A fork of mtelver's day10 project
1module State : sig
2 type t
3
4 include Jv.CONV with type t := t
5
6 module Config : sig
7 type t
8
9 (* TODO: Add selection *)
10 val create :
11 ?doc:Jstr.t ->
12 ?selection:Jv.t ->
13 ?extensions:Extension.t array ->
14 unit ->
15 t
16 end
17
18 module type Facet = sig
19 type t
20
21 include Jv.CONV with type t := t
22
23 type input
24 type output
25
26 val of_ : t -> input -> Extension.t
27 end
28
29 module FacetMaker : functor
30 (I : sig
31 type t
32
33 include Jv.CONV with type t := t
34 end)
35 -> Facet with type input = I.t
36
37 type ('i, 'o) facet =
38 | Facet :
39 (module Facet with type input = 'i and type output = 'o and type t = 'a)
40 * 'a
41 -> ('i, 'o) facet
42
43 val create : ?config:Config.t -> unit -> t
44 val doc : t -> Text.t
45end
46
47module View : sig
48 type t
49 (** Editor view *)
50
51 include Jv.CONV with type t := t
52
53 type opts
54 (** Configurable options for the editor view *)
55
56 (* TODO: Dispatch function *)
57 val opts :
58 ?state:State.t ->
59 ?parent:Brr.El.t ->
60 ?root:Brr.El.document ->
61 ?dispatch:Jv.t ->
62 unit ->
63 opts
64
65 val create : ?opts:opts -> unit -> t
66 (** Create a new view *)
67
68 val state : t -> State.t
69 (** Current editor state *)
70
71 val set_state : t -> State.t -> unit
72
73 module Update : sig
74 type t
75
76 val state : t -> State.t
77 val doc_changed : t -> bool
78
79 include Jv.CONV with type t := t
80 end
81
82 val dom : t -> Brr.El.t
83 val update_listener : unit -> (Update.t -> unit, Jv.t) State.facet
84 val decorations : unit -> (Decoration.Range_set.t, Jv.t) State.facet
85 val request_measure : t -> unit
86 val set_doc : t -> Jstr.t -> unit
87 val line_wrapping : unit -> Extension.t
88 val line_numbers : (int -> string) -> Extension.t
89
90 module Transaction : sig
91 type t
92
93 include Jv.CONV with type t := t
94 end
95
96 val dispatch : t -> Transaction.t -> unit
97end