@dxos/ui-editor 0.0.0 → 0.8.4-main.1c7ec43d41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/lib/browser/index.mjs +8633 -0
  2. package/dist/lib/browser/index.mjs.map +7 -0
  3. package/dist/lib/browser/meta.json +1 -0
  4. package/dist/lib/browser/types/index.mjs +33 -0
  5. package/dist/lib/browser/types/index.mjs.map +7 -0
  6. package/dist/lib/node-esm/index.mjs +8635 -0
  7. package/dist/lib/node-esm/index.mjs.map +7 -0
  8. package/dist/lib/node-esm/meta.json +1 -0
  9. package/dist/lib/node-esm/types/index.mjs +35 -0
  10. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  11. package/dist/types/src/defaults.d.ts +6 -0
  12. package/dist/types/src/defaults.d.ts.map +1 -0
  13. package/dist/types/src/extensions/annotations.d.ts +9 -0
  14. package/dist/types/src/extensions/annotations.d.ts.map +1 -0
  15. package/dist/types/src/extensions/auto-scroll.d.ts +18 -0
  16. package/dist/types/src/extensions/auto-scroll.d.ts.map +1 -0
  17. package/dist/types/src/extensions/autocomplete/autocomplete.d.ts +17 -0
  18. package/dist/types/src/extensions/autocomplete/autocomplete.d.ts.map +1 -0
  19. package/dist/types/src/extensions/autocomplete/index.d.ts +5 -0
  20. package/dist/types/src/extensions/autocomplete/index.d.ts.map +1 -0
  21. package/dist/types/src/extensions/autocomplete/match.d.ts +13 -0
  22. package/dist/types/src/extensions/autocomplete/match.d.ts.map +1 -0
  23. package/dist/types/src/extensions/autocomplete/placeholder.d.ts +23 -0
  24. package/dist/types/src/extensions/autocomplete/placeholder.d.ts.map +1 -0
  25. package/dist/types/src/extensions/autocomplete/typeahead.d.ts +10 -0
  26. package/dist/types/src/extensions/autocomplete/typeahead.d.ts.map +1 -0
  27. package/dist/types/src/extensions/automerge/automerge.d.ts +4 -0
  28. package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -0
  29. package/dist/types/src/extensions/automerge/automerge.test.d.ts +2 -0
  30. package/dist/types/src/extensions/automerge/automerge.test.d.ts.map +1 -0
  31. package/dist/types/src/extensions/automerge/cursor.d.ts +4 -0
  32. package/dist/types/src/extensions/automerge/cursor.d.ts.map +1 -0
  33. package/dist/types/src/extensions/automerge/defs.d.ts +17 -0
  34. package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -0
  35. package/dist/types/src/extensions/automerge/index.d.ts +2 -0
  36. package/dist/types/src/extensions/automerge/index.d.ts.map +1 -0
  37. package/dist/types/src/extensions/automerge/sync.d.ts +17 -0
  38. package/dist/types/src/extensions/automerge/sync.d.ts.map +1 -0
  39. package/dist/types/src/extensions/automerge/update-automerge.d.ts +6 -0
  40. package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -0
  41. package/dist/types/src/extensions/automerge/update-codemirror.d.ts +5 -0
  42. package/dist/types/src/extensions/automerge/update-codemirror.d.ts.map +1 -0
  43. package/dist/types/src/extensions/awareness/awareness-provider.d.ts +31 -0
  44. package/dist/types/src/extensions/awareness/awareness-provider.d.ts.map +1 -0
  45. package/dist/types/src/extensions/awareness/awareness.d.ts +46 -0
  46. package/dist/types/src/extensions/awareness/awareness.d.ts.map +1 -0
  47. package/dist/types/src/extensions/awareness/index.d.ts +3 -0
  48. package/dist/types/src/extensions/awareness/index.d.ts.map +1 -0
  49. package/dist/types/src/extensions/blast.d.ts +25 -0
  50. package/dist/types/src/extensions/blast.d.ts.map +1 -0
  51. package/dist/types/src/extensions/blocks.d.ts +2 -0
  52. package/dist/types/src/extensions/blocks.d.ts.map +1 -0
  53. package/dist/types/src/extensions/bookmarks.d.ts +12 -0
  54. package/dist/types/src/extensions/bookmarks.d.ts.map +1 -0
  55. package/dist/types/src/extensions/comments.d.ts +90 -0
  56. package/dist/types/src/extensions/comments.d.ts.map +1 -0
  57. package/dist/types/src/extensions/debug.d.ts +3 -0
  58. package/dist/types/src/extensions/debug.d.ts.map +1 -0
  59. package/dist/types/src/extensions/dnd.d.ts +9 -0
  60. package/dist/types/src/extensions/dnd.d.ts.map +1 -0
  61. package/dist/types/src/extensions/factories.d.ts +88 -0
  62. package/dist/types/src/extensions/factories.d.ts.map +1 -0
  63. package/dist/types/src/extensions/factories.test.d.ts +2 -0
  64. package/dist/types/src/extensions/factories.test.d.ts.map +1 -0
  65. package/dist/types/src/extensions/focus.d.ts +7 -0
  66. package/dist/types/src/extensions/focus.d.ts.map +1 -0
  67. package/dist/types/src/extensions/folding.d.ts +6 -0
  68. package/dist/types/src/extensions/folding.d.ts.map +1 -0
  69. package/dist/types/src/extensions/hashtag.d.ts +3 -0
  70. package/dist/types/src/extensions/hashtag.d.ts.map +1 -0
  71. package/dist/types/src/extensions/index.d.ts +32 -0
  72. package/dist/types/src/extensions/index.d.ts.map +1 -0
  73. package/dist/types/src/extensions/json.d.ts +7 -0
  74. package/dist/types/src/extensions/json.d.ts.map +1 -0
  75. package/dist/types/src/extensions/listener.d.ts +13 -0
  76. package/dist/types/src/extensions/listener.d.ts.map +1 -0
  77. package/dist/types/src/extensions/markdown/action.d.ts +12 -0
  78. package/dist/types/src/extensions/markdown/action.d.ts.map +1 -0
  79. package/dist/types/src/extensions/markdown/bundle.d.ts +25 -0
  80. package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -0
  81. package/dist/types/src/extensions/markdown/changes.d.ts +10 -0
  82. package/dist/types/src/extensions/markdown/changes.d.ts.map +1 -0
  83. package/dist/types/src/extensions/markdown/changes.test.d.ts +2 -0
  84. package/dist/types/src/extensions/markdown/changes.test.d.ts.map +1 -0
  85. package/dist/types/src/extensions/markdown/debug.d.ts +11 -0
  86. package/dist/types/src/extensions/markdown/debug.d.ts.map +1 -0
  87. package/dist/types/src/extensions/markdown/decorate.d.ts +25 -0
  88. package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -0
  89. package/dist/types/src/extensions/markdown/formatting.d.ts +63 -0
  90. package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -0
  91. package/dist/types/src/extensions/markdown/formatting.test.d.ts +3 -0
  92. package/dist/types/src/extensions/markdown/formatting.test.d.ts.map +1 -0
  93. package/dist/types/src/extensions/markdown/highlight.d.ts +37 -0
  94. package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -0
  95. package/dist/types/src/extensions/markdown/image.d.ts +7 -0
  96. package/dist/types/src/extensions/markdown/image.d.ts.map +1 -0
  97. package/dist/types/src/extensions/markdown/index.d.ts +10 -0
  98. package/dist/types/src/extensions/markdown/index.d.ts.map +1 -0
  99. package/dist/types/src/extensions/markdown/link.d.ts +7 -0
  100. package/dist/types/src/extensions/markdown/link.d.ts.map +1 -0
  101. package/dist/types/src/extensions/markdown/parser.test.d.ts +2 -0
  102. package/dist/types/src/extensions/markdown/parser.test.d.ts.map +1 -0
  103. package/dist/types/src/extensions/markdown/styles.d.ts +4 -0
  104. package/dist/types/src/extensions/markdown/styles.d.ts.map +1 -0
  105. package/dist/types/src/extensions/markdown/table.d.ts +8 -0
  106. package/dist/types/src/extensions/markdown/table.d.ts.map +1 -0
  107. package/dist/types/src/extensions/mention.d.ts +7 -0
  108. package/dist/types/src/extensions/mention.d.ts.map +1 -0
  109. package/dist/types/src/extensions/modal.d.ts +7 -0
  110. package/dist/types/src/extensions/modal.d.ts.map +1 -0
  111. package/dist/types/src/extensions/modes.d.ts +10 -0
  112. package/dist/types/src/extensions/modes.d.ts.map +1 -0
  113. package/dist/types/src/extensions/outliner/commands.d.ts +10 -0
  114. package/dist/types/src/extensions/outliner/commands.d.ts.map +1 -0
  115. package/dist/types/src/extensions/outliner/editor.d.ts +5 -0
  116. package/dist/types/src/extensions/outliner/editor.d.ts.map +1 -0
  117. package/dist/types/src/extensions/outliner/editor.test.d.ts +2 -0
  118. package/dist/types/src/extensions/outliner/editor.test.d.ts.map +1 -0
  119. package/dist/types/src/extensions/outliner/index.d.ts +4 -0
  120. package/dist/types/src/extensions/outliner/index.d.ts.map +1 -0
  121. package/dist/types/src/extensions/outliner/menu.d.ts +8 -0
  122. package/dist/types/src/extensions/outliner/menu.d.ts.map +1 -0
  123. package/dist/types/src/extensions/outliner/outliner.d.ts +11 -0
  124. package/dist/types/src/extensions/outliner/outliner.d.ts.map +1 -0
  125. package/dist/types/src/extensions/outliner/outliner.test.d.ts +2 -0
  126. package/dist/types/src/extensions/outliner/outliner.test.d.ts.map +1 -0
  127. package/dist/types/src/extensions/outliner/selection.d.ts +12 -0
  128. package/dist/types/src/extensions/outliner/selection.d.ts.map +1 -0
  129. package/dist/types/src/extensions/outliner/tree.d.ts +79 -0
  130. package/dist/types/src/extensions/outliner/tree.d.ts.map +1 -0
  131. package/dist/types/src/extensions/outliner/tree.test.d.ts +2 -0
  132. package/dist/types/src/extensions/outliner/tree.test.d.ts.map +1 -0
  133. package/dist/types/src/extensions/preview/index.d.ts +2 -0
  134. package/dist/types/src/extensions/preview/index.d.ts.map +1 -0
  135. package/dist/types/src/extensions/preview/preview.d.ts +34 -0
  136. package/dist/types/src/extensions/preview/preview.d.ts.map +1 -0
  137. package/dist/types/src/extensions/replacer.d.ts +21 -0
  138. package/dist/types/src/extensions/replacer.d.ts.map +1 -0
  139. package/dist/types/src/extensions/replacer.test.d.ts +2 -0
  140. package/dist/types/src/extensions/replacer.test.d.ts.map +1 -0
  141. package/dist/types/src/extensions/scroll-past-end.d.ts +3 -0
  142. package/dist/types/src/extensions/scroll-past-end.d.ts.map +1 -0
  143. package/dist/types/src/extensions/scroller.d.ts +68 -0
  144. package/dist/types/src/extensions/scroller.d.ts.map +1 -0
  145. package/dist/types/src/extensions/selection.d.ts +24 -0
  146. package/dist/types/src/extensions/selection.d.ts.map +1 -0
  147. package/dist/types/src/extensions/snippets.d.ts +10 -0
  148. package/dist/types/src/extensions/snippets.d.ts.map +1 -0
  149. package/dist/types/src/extensions/state.d.ts +2 -0
  150. package/dist/types/src/extensions/state.d.ts.map +1 -0
  151. package/dist/types/src/extensions/submit.d.ts +10 -0
  152. package/dist/types/src/extensions/submit.d.ts.map +1 -0
  153. package/dist/types/src/extensions/tags/extended-markdown.d.ts +10 -0
  154. package/dist/types/src/extensions/tags/extended-markdown.d.ts.map +1 -0
  155. package/dist/types/src/extensions/tags/extended-markdown.test.d.ts +2 -0
  156. package/dist/types/src/extensions/tags/extended-markdown.test.d.ts.map +1 -0
  157. package/dist/types/src/extensions/tags/fader.d.ts +12 -0
  158. package/dist/types/src/extensions/tags/fader.d.ts.map +1 -0
  159. package/dist/types/src/extensions/tags/index.d.ts +7 -0
  160. package/dist/types/src/extensions/tags/index.d.ts.map +1 -0
  161. package/dist/types/src/extensions/tags/typewriter.d.ts +43 -0
  162. package/dist/types/src/extensions/tags/typewriter.d.ts.map +1 -0
  163. package/dist/types/src/extensions/tags/typewriter.test.d.ts +2 -0
  164. package/dist/types/src/extensions/tags/typewriter.test.d.ts.map +1 -0
  165. package/dist/types/src/extensions/tags/xml-block-decoration.d.ts +31 -0
  166. package/dist/types/src/extensions/tags/xml-block-decoration.d.ts.map +1 -0
  167. package/dist/types/src/extensions/tags/xml-formatting.d.ts +24 -0
  168. package/dist/types/src/extensions/tags/xml-formatting.d.ts.map +1 -0
  169. package/dist/types/src/extensions/tags/xml-tags.d.ts +117 -0
  170. package/dist/types/src/extensions/tags/xml-tags.d.ts.map +1 -0
  171. package/dist/types/src/extensions/tags/xml-util.d.ts +10 -0
  172. package/dist/types/src/extensions/tags/xml-util.d.ts.map +1 -0
  173. package/dist/types/src/extensions/tags/xml-util.test.d.ts +2 -0
  174. package/dist/types/src/extensions/tags/xml-util.test.d.ts.map +1 -0
  175. package/dist/types/src/index.d.ts +8 -0
  176. package/dist/types/src/index.d.ts.map +1 -0
  177. package/dist/types/src/styles/index.d.ts +2 -0
  178. package/dist/types/src/styles/index.d.ts.map +1 -0
  179. package/dist/types/src/styles/theme.d.ts +58 -0
  180. package/dist/types/src/styles/theme.d.ts.map +1 -0
  181. package/dist/types/src/types/index.d.ts +2 -0
  182. package/dist/types/src/types/index.d.ts.map +1 -0
  183. package/dist/types/src/types/types.d.ts +21 -0
  184. package/dist/types/src/types/types.d.ts.map +1 -0
  185. package/dist/types/src/util/cursor.d.ts +31 -0
  186. package/dist/types/src/util/cursor.d.ts.map +1 -0
  187. package/dist/types/src/util/debug.d.ts +17 -0
  188. package/dist/types/src/util/debug.d.ts.map +1 -0
  189. package/dist/types/src/util/decorations.d.ts +4 -0
  190. package/dist/types/src/util/decorations.d.ts.map +1 -0
  191. package/dist/types/src/util/dom.d.ts +10 -0
  192. package/dist/types/src/util/dom.d.ts.map +1 -0
  193. package/dist/types/src/util/facet.d.ts +3 -0
  194. package/dist/types/src/util/facet.d.ts.map +1 -0
  195. package/dist/types/src/util/index.d.ts +7 -0
  196. package/dist/types/src/util/index.d.ts.map +1 -0
  197. package/dist/types/src/util/util.d.ts +8 -0
  198. package/dist/types/src/util/util.d.ts.map +1 -0
  199. package/dist/types/tsconfig.tsbuildinfo +1 -0
  200. package/package.json +42 -43
  201. package/src/defaults.ts +33 -20
  202. package/src/extensions/annotations.ts +1 -1
  203. package/src/extensions/auto-scroll.ts +234 -0
  204. package/src/extensions/autocomplete/placeholder.ts +37 -18
  205. package/src/extensions/automerge/automerge.test.tsx +37 -11
  206. package/src/extensions/automerge/automerge.ts +5 -7
  207. package/src/extensions/blocks.ts +5 -5
  208. package/src/extensions/comments.ts +5 -6
  209. package/src/extensions/dnd.ts +2 -2
  210. package/src/extensions/factories.test.ts +88 -0
  211. package/src/extensions/factories.ts +32 -15
  212. package/src/extensions/folding.ts +5 -22
  213. package/src/extensions/index.ts +4 -3
  214. package/src/extensions/markdown/action.ts +0 -1
  215. package/src/extensions/markdown/bundle.ts +23 -9
  216. package/src/extensions/markdown/decorate.ts +15 -12
  217. package/src/extensions/markdown/formatting.ts +5 -10
  218. package/src/extensions/markdown/highlight.ts +15 -7
  219. package/src/extensions/markdown/link.ts +27 -33
  220. package/src/extensions/markdown/parser.test.ts +0 -1
  221. package/src/extensions/markdown/styles.ts +42 -9
  222. package/src/extensions/markdown/table.ts +24 -2
  223. package/src/extensions/outliner/outliner.test.ts +0 -1
  224. package/src/extensions/outliner/outliner.ts +3 -4
  225. package/src/extensions/outliner/tree.test.ts +0 -1
  226. package/src/extensions/preview/preview.ts +62 -15
  227. package/src/extensions/scroll-past-end.ts +32 -0
  228. package/src/extensions/scroller.ts +256 -0
  229. package/src/extensions/selection.ts +1 -1
  230. package/src/extensions/snippets.ts +67 -0
  231. package/src/extensions/tags/extended-markdown.test.ts +120 -2
  232. package/src/extensions/tags/extended-markdown.ts +80 -1
  233. package/src/extensions/tags/fader.ts +195 -0
  234. package/src/extensions/tags/index.ts +4 -1
  235. package/src/extensions/tags/testing/text.md +36 -0
  236. package/src/extensions/tags/testing/text.txt +35 -0
  237. package/src/extensions/tags/typewriter.test.ts +65 -0
  238. package/src/extensions/tags/typewriter.ts +594 -0
  239. package/src/extensions/tags/xml-block-decoration.ts +123 -0
  240. package/src/extensions/tags/xml-formatting.ts +125 -0
  241. package/src/extensions/tags/xml-tags.ts +186 -35
  242. package/src/extensions/tags/xml-util.test.ts +199 -24
  243. package/src/extensions/tags/xml-util.ts +62 -5
  244. package/src/index.ts +0 -1
  245. package/src/styles/index.ts +0 -2
  246. package/src/styles/theme.ts +124 -33
  247. package/src/types/types.ts +10 -2
  248. package/src/typings.d.ts +8 -0
  249. package/src/util/cursor.ts +1 -2
  250. package/src/extensions/autoscroll.ts +0 -165
  251. package/src/extensions/scrolling.ts +0 -189
  252. package/src/extensions/tags/streamer.ts +0 -243
  253. package/src/extensions/typewriter.ts +0 -68
  254. package/src/styles/markdown.ts +0 -26
  255. package/src/styles/tokens.ts +0 -17
@@ -0,0 +1,43 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ /** Annotate a transaction to bypass the typewriter buffer (content appears immediately). */
3
+ export declare const typewriterBypass: import("@codemirror/state").AnnotationType<boolean>;
4
+ /**
5
+ * Public state effect signalling whether typewriter's drip queue is currently draining.
6
+ * Other extensions can subscribe to coordinate behaviour with the typewriter (e.g. hide
7
+ * a block-widget footer while text is being dripped to avoid scroll-measure conflicts).
8
+ *
9
+ * Dispatched at queue transitions:
10
+ * - `true` — empty → non-empty (drain rAF/interval is starting).
11
+ * - `false` — non-empty → empty (last char written, drain stopped).
12
+ */
13
+ export declare const typewriterDrainingEffect: import("@codemirror/state").StateEffectType<boolean>;
14
+ export type TypewriterOptions = {
15
+ /** Show a blinking cursor at the insertion point while streaming. */
16
+ cursor?: boolean;
17
+ /** Tag names whose inner content should be streamed (not buffered until close). */
18
+ streamingTags?: Set<string>;
19
+ /** Hard cap before falling back to single-flush mode. Defaults to 2 000 chars. */
20
+ flushThreshold?: number;
21
+ /** Per-frame time budget for draining (ms). Defaults to 20 ms. */
22
+ frameBudgetMs?: number;
23
+ /**
24
+ * Maximum visible characters of plain text emitted per animation frame. Atomic
25
+ * structures (XML elements, markdown links) always flush whole and are not subject
26
+ * to this cap. Default 1 — ~60 char/s at 60 fps. Raise for faster typewriter speed.
27
+ */
28
+ charsPerFrame?: number;
29
+ };
30
+ /**
31
+ * Intercepts appended text and inserts it as time-budgeted batches per animation frame,
32
+ * while flushing XML tags, markdown links, and images atomically for smooth typewriter-style
33
+ * streaming. Falls back to bulk-flush when the buffer grows past `flushThreshold` to keep
34
+ * the editor responsive on long runs.
35
+ */
36
+ export declare const typewriter: (options?: TypewriterOptions) => Extension;
37
+ /**
38
+ * Returns the length of a complete XML element starting at `start`, or 0 if the element
39
+ * is incomplete. Handles self-closing tags, closing tags, and opening tags with nested
40
+ * content. E.g., `<foo>content<bar />more</foo>` returns the full length.
41
+ */
42
+ export declare const xmlElementLength: (buffer: string, start?: number) => number;
43
+ //# sourceMappingURL=typewriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typewriter.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/typewriter.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,mBAAmB,CAAC;AAK3B,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,qDAA+B,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,sDAAgC,CAAC;AAiCtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mFAAmF;IACnF,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,aAAa,iBAAiB,KAAQ,SA0N5D,CAAC;AA6MF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,WAAY,MAAM,qBAAc,MAoD5D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=typewriter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typewriter.test.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/typewriter.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type XmlBlockDecorationOptions = {
3
+ /**
4
+ * Tag name to match (e.g. `'prompt'`).
5
+ */
6
+ tag: string;
7
+ /**
8
+ * Class added via `Decoration.line` to each line that intersects the element's content
9
+ * range. Use to style the bubble container (e.g. flex alignment, vertical margin).
10
+ */
11
+ lineClass?: string;
12
+ /**
13
+ * Class added via `Decoration.mark` covering the inner content (between the open and
14
+ * close tags). Use to style the bubble surface (background, padding, rounding).
15
+ */
16
+ contentClass?: string;
17
+ /**
18
+ * When true, the open and close tag delimiters are hidden via `Decoration.replace`
19
+ * with no widget, so the rendered text is the inner content only.
20
+ */
21
+ hideTags?: boolean;
22
+ };
23
+ /**
24
+ * Walks the doc with the Lezer XML parser and decorates `<tag>…</tag>` elements without
25
+ * replacing them with a widget — the source text remains in the document and can still
26
+ * be matched by other extensions (e.g. `xmlFormatting`). Use this for "bubble"-style
27
+ * styling of XML blocks (chat prompts, callouts, etc.) where the inner content should
28
+ * stay editable/copyable rather than living inside a CodeMirror widget.
29
+ */
30
+ export declare const xmlBlockDecoration: ({ tag, lineClass, contentClass, hideTags, }: XmlBlockDecorationOptions) => Extension;
31
+ //# sourceMappingURL=xml-block-decoration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-block-decoration.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/xml-block-decoration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,yBAAyB,GAAG;IACtC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,gDAK5B,yBAAyB,KAAG,SA6E9B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type XmlFormattingOptions = {
3
+ /**
4
+ * Tag names whose elements should NOT receive xmlFormatting decorations. Use to
5
+ * opt-out tags rendered by another extension (e.g. `xmlBlockDecoration` for `<prompt>`)
6
+ * so the two don't double-wrap the same content with stacked styling.
7
+ *
8
+ * Skipping is recursive: descendants of a skipped element are also untouched, so a
9
+ * `<foo>` inside a skipped `<prompt>` still appears literally without xmlFormatting
10
+ * styling.
11
+ */
12
+ skip?: string[];
13
+ };
14
+ /**
15
+ * Mark decoration extension that highlights XML tag delimiters
16
+ * (e.g., `<tag>`, `</tag>`, `<tag attr="x"/>`) with the `cm-xml-tag` class.
17
+ *
18
+ * Uses `@codemirror/lang-xml`'s Lezer parser standalone — only to compute
19
+ * decoration ranges — without changing the editor's primary language. This
20
+ * keeps the document plain text while still handling nesting and attributes
21
+ * correctly.
22
+ */
23
+ export declare const xmlFormatting: ({ skip }?: XmlFormattingOptions) => Extension;
24
+ //# sourceMappingURL=xml-formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-formatting.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/xml-formatting.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAY/D,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,cAAc,oBAAoB,KAAQ,SAqFnE,CAAC"}
@@ -0,0 +1,117 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ import { EditorView, WidgetType } from '@codemirror/view';
3
+ import { type FunctionComponent } from 'react';
4
+ /**
5
+ * StateEffect for navigating to previous bookmark.
6
+ */
7
+ export declare const navigatePreviousEffect: import("@codemirror/state").StateEffectType<void>;
8
+ /**
9
+ * StateEffect for navigating to next bookmark.
10
+ */
11
+ export declare const navigateNextEffect: import("@codemirror/state").StateEffectType<void>;
12
+ /**
13
+ * Dispatch function for updating state.
14
+ */
15
+ export type StateDispatch<T> = T | ((state: T) => T);
16
+ /**
17
+ * Manages widget state.
18
+ */
19
+ export interface XmlWidgetStateManager {
20
+ updateWidget<T>(id: string, props: StateDispatch<T>): void;
21
+ }
22
+ export type XmlEventHandler<TEvent = any> = (event: TEvent) => void;
23
+ /**
24
+ * Widget component.
25
+ */
26
+ export type XmlWidgetProps<TProps = any, TContext = any> = TProps & {
27
+ _tag: string;
28
+ range: {
29
+ from: number;
30
+ to: number;
31
+ };
32
+ children?: any[];
33
+ context?: TContext;
34
+ view?: EditorView;
35
+ onEvent?: XmlEventHandler;
36
+ };
37
+ /**
38
+ * Factory for creating widgets.
39
+ */
40
+ export type XmlWidgetFactory = (props: XmlWidgetProps) => WidgetType | null;
41
+ /**
42
+ * Widget registry definition.
43
+ * NOTE: Widgets should NOT use top/bottom margins (it causes unstable measurements while scrolling which leads to jumps).
44
+ * If required, use encapsulated divs with padding instead.
45
+ */
46
+ export type XmlWidgetDef = {
47
+ /**
48
+ * Block widget.
49
+ */
50
+ block?: boolean;
51
+ /**
52
+ * When true, the opening tag is flushed immediately and inner content streams character-by-character.
53
+ */
54
+ streaming?: boolean;
55
+ /**
56
+ * Debug only.
57
+ */
58
+ debug?: boolean;
59
+ /**
60
+ * Native widget (rendered inline).
61
+ */
62
+ factory?: XmlWidgetFactory;
63
+ /**
64
+ * React/Solid widget (rendered in portals outside of the editor).
65
+ * Prefer an `id="..."` attribute on the tag so `updateWidget` can target the instance; if omitted,
66
+ * an id is derived from the tag’s document range (non-streaming) or opening position (streaming).
67
+ * Streaming tags use `cm-xml-<from>` so the same portal id is kept when the closing tag arrives.
68
+ */
69
+ Component?: FunctionComponent<XmlWidgetProps>;
70
+ };
71
+ export type XmlWidgetRegistry = Record<string, XmlWidgetDef>;
72
+ export declare const getXmlTextChild: (children: any[]) => string | null;
73
+ /**
74
+ * Update context.
75
+ */
76
+ export declare const xmlTagContextEffect: import("@codemirror/state").StateEffectType<any>;
77
+ /**
78
+ * Reset all state.
79
+ */
80
+ export declare const xmlTagResetEffect: import("@codemirror/state").StateEffectType<null>;
81
+ /**
82
+ * Update widget.
83
+ */
84
+ export declare const xmlTagUpdateEffect: import("@codemirror/state").StateEffectType<{
85
+ id: string;
86
+ value: any;
87
+ }>;
88
+ export type XmlWidgetState = {
89
+ id: string;
90
+ root: HTMLElement;
91
+ props: any;
92
+ Component: FunctionComponent<XmlWidgetProps>;
93
+ };
94
+ export interface XmlWidgetNotifier {
95
+ mounted(widget: XmlWidgetState): void;
96
+ unmounted(id: string): void;
97
+ }
98
+ export type XmlTagsOptions = {
99
+ /** Tag registry. */
100
+ registry?: XmlWidgetRegistry;
101
+ /** Tags to bookmark for navigation. */
102
+ bookmarks?: string[];
103
+ /** Called when widgets are mounted or unmounted. */
104
+ setWidgets?: (widgets: XmlWidgetState[]) => void;
105
+ };
106
+ /**
107
+ * Implements custom XML tags via CodeMirror-native Widgets and portaled React/Solid components.
108
+ *
109
+ * Basic mechanism:
110
+ * - Decorations are created from XML tags that matched the provided Widget registry.
111
+ * - Native widgets are rendered inline.
112
+ * - React/Solid widgets are rendered in portals outside of the editor via the PlaceholderWidget.
113
+ * - Widget state can be update via effects.
114
+ * - NOTE: Widget state may be updated BEFORE the widget is mounted.
115
+ */
116
+ export declare const xmlTags: ({ registry, setWidgets, bookmarks }?: XmlTagsOptions) => Extension;
117
+ //# sourceMappingURL=xml-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-tags.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/xml-tags.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import { type EditorState } from '@codemirror/state';
2
+ import { type SyntaxNode } from '@lezer/common';
3
+ export type Tag = Record<string, any> & {
4
+ _tag: string;
5
+ };
6
+ /**
7
+ * Parse XML Element.
8
+ */
9
+ export declare const nodeToJson: (state: EditorState, node: SyntaxNode) => Tag | undefined;
10
+ //# sourceMappingURL=xml-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-util.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/xml-util.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,UAAW,WAAW,QAAQ,UAAU,KAAG,GAAG,GAAG,SAsGvE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=xml-util.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-util.test.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/tags/xml-util.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export { type Extension, EditorState } from '@codemirror/state';
2
+ export { EditorView, keymap } from '@codemirror/view';
3
+ export { tags } from '@lezer/highlight';
4
+ export { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';
5
+ export * from './defaults';
6
+ export * from './extensions';
7
+ export * from './util';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAEtE,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './theme';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/styles/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
3
+ export declare const fontBody = "\"Inter Variable\", ui-sans-serif, system-ui, sans-serif";
4
+ export declare const fontMono = "\"JetBrains Mono Variable\", ui-monospace, \"Cascadia Code\", \"Source Code Pro\", monospace";
5
+ export declare const markdownTheme: {
6
+ code: string;
7
+ codeMark: string;
8
+ mark: string;
9
+ heading: (level: HeadingLevel) => {
10
+ className: string;
11
+ color: string;
12
+ lineHeight: string;
13
+ fontSize: string;
14
+ fontWeight: string;
15
+ };
16
+ };
17
+ /**
18
+ * Global base theme.
19
+ *
20
+ * NOTE: The base theme is GLOBAL and is applied to ALL editors.
21
+ * NOTE: `light` and `dark` selectors are preprocessed by CodeMirror and can only be in the base theme.
22
+ * NOTE: Use 'unset' to remove default CM style.
23
+ *
24
+ * Examples:
25
+ * - https://codemirror.net/examples/styling
26
+ * - https://github.com/codemirror/view/blob/main/src/theme.ts
27
+ * - https://github.com/codemirror/theme-one-dark/blob/main/src/one-dark.ts
28
+ *
29
+ * Main layout:
30
+ * - https://codemirror.net/examples/styling
31
+ * - https://codemirror.net/docs/guide (DOM Structure).
32
+ *
33
+ * <div class="cm-editor [cm-focused] [generated classes]">
34
+ * <div class="cm-scroller">
35
+ * <div class="cm-gutters">
36
+ * <div class="cm-gutter [...]">
37
+ * <div class="cm-gutterElement">...</div>
38
+ * </div>
39
+ * </div>
40
+ * <div class="cm-content" role="textbox" contenteditable="true">
41
+ * <div class="cm-line"></div>
42
+ * </div>
43
+ * <div class="cm-selectionLayer">
44
+ * <div class="cm-selectionBackground"></div>
45
+ * </div>
46
+ * <div class="cm-cursorLayer">
47
+ * <div class="cm-cursor"></div>
48
+ * </div>
49
+ * </div>
50
+ * </div>
51
+ */
52
+ export declare const baseTheme: Extension;
53
+ export declare const editorGutter: Extension;
54
+ export type FontOptions = {
55
+ monospace?: boolean;
56
+ };
57
+ export declare const createFontTheme: ({ monospace }?: FontOptions) => Extension;
58
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAqCjD,eAAO,MAAM,QAAQ,6DAA2D,CAAC;AACjF,eAAO,MAAM,QAAQ,iGAA2F,CAAC;AAEjH,eAAO,MAAM,aAAa;IACxB,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,OAAO,UAAU,YAAY;QAC3B,SAAS;QACT,KAAK;QACL,UAAU;QACV,QAAQ;QACR,UAAU;;CAEb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,SAAS,WAoQpB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,SAMzB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,eAAe,mBAAmB,WAAW,cAYtD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type EditorView } from '@codemirror/view';
2
+ import * as Schema from 'effect/Schema';
3
+ export type Range = {
4
+ from: number;
5
+ to: number;
6
+ };
7
+ export type Comment = {
8
+ id: string;
9
+ cursor?: string;
10
+ };
11
+ /**
12
+ * Callback that renders into a DOM element within the editor.
13
+ */
14
+ export type RenderCallback<Props extends object> = (el: HTMLElement, props: Props, view: EditorView) => void;
15
+ export declare const EditorViewModes: readonly ['preview', 'readonly', 'source'];
16
+ export declare const EditorViewMode: Schema.Union<[Schema.Literal<["preview"]>, Schema.Literal<["readonly"]>, Schema.Literal<["source"]>]>;
17
+ export type EditorViewMode = Schema.Schema.Type<typeof EditorViewMode>;
18
+ export declare const EditorInputModes: readonly ['default', 'vim', 'vscode'];
19
+ export declare const EditorInputMode: Schema.Union<[Schema.Literal<["default"]>, Schema.Literal<["vim"]>, Schema.Literal<["vscode"]>]>;
20
+ export type EditorInputMode = Schema.Schema.Type<typeof EditorInputMode>;
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAIF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,MAAM,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;AAE7G,eAAO,MAAM,eAAe,YAAI,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAC;AAC1E,eAAO,MAAM,cAAc,uGAI1B,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,cAAc,CAAC,CAAC;AAEvE,eAAO,MAAM,gBAAgB,YAAI,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AACtE,eAAO,MAAM,eAAe,kGAI3B,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type EditorState } from '@codemirror/state';
2
+ import { type Range } from '../types';
3
+ /**
4
+ * Determines if two ranges overlap.
5
+ * A range is considered to overlap if there is any intersection
6
+ * between the two ranges, inclusive of their boundaries.
7
+ */
8
+ export declare const overlap: (a: Range, b: Range) => boolean;
9
+ /**
10
+ * Converts indexes into the text document into stable peer-independent cursors.
11
+ *
12
+ * See:
13
+ * - https://automerge.org/automerge/api-docs/js/functions/next.getCursor.html
14
+ * - https://github.com/yjs/yjs?tab=readme-ov-file#relative-positions
15
+ *
16
+ * @param {assoc} number Negative values will associate the cursor with the previous character
17
+ * while positive - with the next one.
18
+ */
19
+ export interface CursorConverter {
20
+ toCursor(position: number, assoc?: -1 | 1): string;
21
+ fromCursor(cursor: string): number;
22
+ }
23
+ export declare class Cursor {
24
+ static readonly converter: import("@codemirror/state").Facet<unknown, CursorConverter>;
25
+ static readonly getCursorFromRange: (state: EditorState, range: Range) => string;
26
+ static readonly getRangeFromCursor: (state: EditorState, cursor: string) => {
27
+ from: number;
28
+ to: number;
29
+ } | undefined;
30
+ }
31
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../src/util/cursor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAGtC;;;;GAIG;AACH,eAAO,MAAM,OAAO,MAAO,KAAK,KAAK,KAAK,KAAG,OAA2C,CAAC;AAEzF;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACnD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAOD,qBAAa,MAAM;IACjB,MAAM,CAAC,QAAQ,CAAC,SAAS,8DAA4C;IAErE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,UAAW,WAAW,SAAS,KAAK,YAKpE;IAEF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,UAAW,WAAW,UAAU,MAAM;;;kBAOtE;CACH"}
@@ -0,0 +1,17 @@
1
+ import { type Transaction } from '@codemirror/state';
2
+ import { type EditorView } from '@codemirror/view';
3
+ export declare const join: (...lines: string[]) => string;
4
+ /**
5
+ * CodeMirror callbacks swallow errors so wrap handlers.
6
+ */
7
+ export declare const wrapWithCatch: (fn: (...args: any[]) => any, label?: string) => (...args: any[]) => any;
8
+ /**
9
+ * Log all changes before dispatching them to the view.
10
+ * https://codemirror.net/docs/ref/#view.EditorView.dispatch
11
+ */
12
+ export declare const debugDispatcher: (trs: readonly Transaction[], view: EditorView) => void;
13
+ /**
14
+ * Util to log transactions in update listener.
15
+ */
16
+ export declare const logChanges: (trs: readonly Transaction[]) => void;
17
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../../src/util/debug.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,eAAO,MAAM,IAAI,aAAc,MAAM,EAAE,WAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,aAAa,OAAQ,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,UAAU,MAAM,eACtD,GAAG,EAAE,QAOvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,SAAS,WAAW,EAAE,QAAQ,UAAU,SAG5E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,QAAS,SAAS,WAAW,EAAE,SAmBrD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Range } from '@codemirror/state';
2
+ import { type Decoration, type DecorationSet } from '@codemirror/view';
3
+ export declare const decorationSetToArray: (deco: DecorationSet) => readonly Range<Decoration>[];
4
+ //# sourceMappingURL=decorations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorations.d.ts","sourceRoot":"","sources":["../../../../src/util/decorations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEvE,eAAO,MAAM,oBAAoB,SAAU,aAAa,KAAG,SAAS,KAAK,CAAC,UAAU,CAAC,EAapF,CAAC"}
@@ -0,0 +1,10 @@
1
+ export type Rect = {
2
+ readonly left: number;
3
+ readonly right: number;
4
+ readonly top: number;
5
+ readonly bottom: number;
6
+ };
7
+ export declare const flattenRect: (rect: Rect, left: boolean) => Rect;
8
+ export declare const textRange: (node: Text, from: number, to?: number) => Range;
9
+ export declare const clientRectsFor: (dom: Node) => DOMRectList;
10
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/util/dom.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,IAAI,GAAG;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,IAAI,QAAQ,OAAO,KAAG,IAGvD,CAAC;AAIF,eAAO,MAAM,SAAS,SAAU,IAAI,QAAQ,MAAM,kBAAc,KAK/D,CAAC;AAEF,eAAO,MAAM,cAAc,QAAS,IAAI,KAAG,WAQ1C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Facet } from '@codemirror/state';
2
+ export declare const singleValueFacet: <I, O = I>(defaultValue?: O) => Facet<I, O>;
3
+ //# sourceMappingURL=facet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../../../../src/util/facet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,gBAMvD,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './cursor';
2
+ export * from './decorations';
3
+ export * from './debug';
4
+ export * from './dom';
5
+ export * from './facet';
6
+ export * from './util';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type EditorView } from '@codemirror/view';
2
+ export declare const insertAtCursor: (view: EditorView, from: number, insert: string) => void;
3
+ /**
4
+ * If the cursor is at the start of a line, insert the text at the cursor.
5
+ * Otherwise, insert the text on a new line.
6
+ */
7
+ export declare const insertAtLineStart: (view: EditorView, from: number, insert: string) => void;
8
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/util/util.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,eAAO,MAAM,cAAc,SAAU,UAAU,QAAQ,MAAM,UAAU,MAAM,SAK5E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,UAAU,QAAQ,MAAM,UAAU,MAAM,SAW/E,CAAC"}