@dxos/react-ui-editor 0.3.11-main.baa8c4d → 0.3.11-main.bc6b68b

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 (221) hide show
  1. package/dist/lib/browser/index.mjs +1882 -1531
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts +14 -14
  5. package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
  6. package/dist/types/src/components/TextEditor/TextEditor.d.ts +20 -17
  7. package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
  8. package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +6 -3
  9. package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
  10. package/dist/types/src/{hooks/automerge → components/TextEditor}/automerge.stories.d.ts +6 -1
  11. package/dist/types/src/components/TextEditor/automerge.stories.d.ts.map +1 -0
  12. package/dist/types/src/components/TextEditor/comments.stories.d.ts +26 -0
  13. package/dist/types/src/components/TextEditor/comments.stories.d.ts.map +1 -0
  14. package/dist/types/src/components/TextEditor/index.d.ts +0 -2
  15. package/dist/types/src/components/TextEditor/index.d.ts.map +1 -1
  16. package/dist/types/src/extensions/autocomplete.d.ts.map +1 -0
  17. package/dist/types/src/extensions/automerge/automerge.d.ts +9 -0
  18. package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -0
  19. package/dist/types/src/extensions/automerge/cursor.d.ts +5 -0
  20. package/dist/types/src/extensions/automerge/cursor.d.ts.map +1 -0
  21. package/dist/types/src/extensions/automerge/defs.d.ts +24 -0
  22. package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -0
  23. package/dist/types/src/extensions/automerge/index.d.ts +3 -0
  24. package/dist/types/src/extensions/automerge/index.d.ts.map +1 -0
  25. package/dist/types/src/extensions/automerge/semaphore.d.ts +14 -0
  26. package/dist/types/src/extensions/automerge/semaphore.d.ts.map +1 -0
  27. package/dist/types/src/extensions/automerge/update-automerge.d.ts +5 -0
  28. package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -0
  29. package/dist/types/src/extensions/automerge/update-codemirror.d.ts.map +1 -0
  30. package/dist/types/src/extensions/awareness.d.ts +46 -0
  31. package/dist/types/src/extensions/awareness.d.ts.map +1 -0
  32. package/dist/types/src/extensions/basic.d.ts +8 -0
  33. package/dist/types/src/extensions/basic.d.ts.map +1 -0
  34. package/dist/types/src/extensions/blast.d.ts.map +1 -0
  35. package/dist/types/src/extensions/code.d.ts.map +1 -0
  36. package/dist/types/src/{components/TextEditor/extensions → extensions}/comments.d.ts +33 -18
  37. package/dist/types/src/extensions/comments.d.ts.map +1 -0
  38. package/dist/types/src/extensions/cursor.d.ts +25 -0
  39. package/dist/types/src/extensions/cursor.d.ts.map +1 -0
  40. package/dist/types/src/extensions/hr.d.ts.map +1 -0
  41. package/dist/types/src/extensions/image.d.ts.map +1 -0
  42. package/dist/types/src/{components/TextEditor/extensions → extensions}/index.d.ts +4 -2
  43. package/dist/types/src/extensions/index.d.ts.map +1 -0
  44. package/dist/types/src/{components/TextEditor/extensions → extensions}/link.d.ts +1 -0
  45. package/dist/types/src/extensions/link.d.ts.map +1 -0
  46. package/dist/types/src/extensions/listener.d.ts +10 -0
  47. package/dist/types/src/extensions/listener.d.ts.map +1 -0
  48. package/dist/types/src/{components/TextEditor/extensions → extensions}/markdown/bundle.d.ts +2 -5
  49. package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -0
  50. package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -0
  51. package/dist/types/src/extensions/markdown/index.d.ts.map +1 -0
  52. package/dist/types/src/extensions/mention.d.ts.map +1 -0
  53. package/dist/types/src/extensions/outliner.d.ts +4 -0
  54. package/dist/types/src/extensions/outliner.d.ts.map +1 -0
  55. package/dist/types/src/extensions/table.d.ts.map +1 -0
  56. package/dist/types/src/extensions/tasklist.d.ts.map +1 -0
  57. package/dist/types/src/extensions/typewriter.d.ts.map +1 -0
  58. package/dist/types/src/hooks/awareness-provider.d.ts +31 -0
  59. package/dist/types/src/hooks/awareness-provider.d.ts.map +1 -0
  60. package/dist/types/src/hooks/defs.d.ts +25 -0
  61. package/dist/types/src/hooks/defs.d.ts.map +1 -0
  62. package/dist/types/src/hooks/index.d.ts +3 -1
  63. package/dist/types/src/hooks/index.d.ts.map +1 -1
  64. package/dist/types/src/hooks/useTextEditor.d.ts +17 -0
  65. package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -0
  66. package/dist/types/src/hooks/useTextModel.d.ts +2 -31
  67. package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
  68. package/dist/types/src/index.d.ts +5 -0
  69. package/dist/types/src/index.d.ts.map +1 -1
  70. package/dist/types/src/styles/cursors.d.ts.map +1 -0
  71. package/dist/types/src/styles/index.d.ts +1 -0
  72. package/dist/types/src/styles/index.d.ts.map +1 -1
  73. package/dist/types/src/styles/markdown.d.ts.map +1 -1
  74. package/dist/types/src/styles/tokens.d.ts +1 -0
  75. package/dist/types/src/styles/tokens.d.ts.map +1 -1
  76. package/dist/types/src/{components/TextEditor/themes → themes}/default.d.ts +1 -1
  77. package/dist/types/src/themes/default.d.ts.map +1 -0
  78. package/dist/types/src/themes/index.d.ts.map +1 -0
  79. package/dist/types/src/util.d.ts +7 -0
  80. package/dist/types/src/util.d.ts.map +1 -0
  81. package/package.json +33 -34
  82. package/src/components/TextEditor/MarkdownEditor.stories.tsx +86 -91
  83. package/src/components/TextEditor/TextEditor.stories.tsx +13 -34
  84. package/src/components/TextEditor/TextEditor.tsx +124 -95
  85. package/src/{hooks/automerge → components/TextEditor}/automerge.stories.tsx +66 -6
  86. package/src/components/TextEditor/comments.stories.tsx +357 -0
  87. package/src/components/TextEditor/index.ts +0 -3
  88. package/src/{components/TextEditor/extensions → extensions}/autocomplete.ts +23 -19
  89. package/src/extensions/automerge/automerge.ts +88 -0
  90. package/src/extensions/automerge/cursor.ts +52 -0
  91. package/src/extensions/automerge/defs.ts +41 -0
  92. package/src/extensions/automerge/index.ts +6 -0
  93. package/src/{hooks → extensions}/automerge/semaphore.ts +34 -29
  94. package/src/{hooks → extensions}/automerge/update-automerge.ts +5 -6
  95. package/src/{hooks → extensions}/automerge/update-codemirror.ts +13 -5
  96. package/src/extensions/awareness.ts +310 -0
  97. package/src/extensions/basic.ts +37 -0
  98. package/src/{components/TextEditor/extensions → extensions}/code.ts +28 -23
  99. package/src/extensions/comments.ts +428 -0
  100. package/src/extensions/cursor.ts +50 -0
  101. package/src/extensions/hr.ts +72 -0
  102. package/src/extensions/image.ts +87 -0
  103. package/src/{components/TextEditor/extensions → extensions}/index.ts +4 -2
  104. package/src/{components/TextEditor/extensions → extensions}/link.ts +116 -62
  105. package/src/extensions/listener.ts +35 -0
  106. package/src/{components/TextEditor/extensions → extensions}/markdown/bundle.ts +18 -24
  107. package/src/{components/TextEditor/extensions → extensions}/markdown/highlight.ts +4 -13
  108. package/src/{components/TextEditor/extensions → extensions}/mention.ts +9 -2
  109. package/src/extensions/outliner.ts +12 -0
  110. package/src/{components/TextEditor/extensions → extensions}/table.ts +10 -4
  111. package/src/extensions/tasklist.ts +111 -0
  112. package/src/{components/TextEditor/extensions → extensions}/typewriter.ts +1 -1
  113. package/src/hooks/awareness-provider.ts +124 -0
  114. package/src/hooks/defs.ts +42 -0
  115. package/src/hooks/index.ts +4 -1
  116. package/src/hooks/useTextEditor.ts +29 -0
  117. package/src/hooks/useTextModel.ts +30 -115
  118. package/src/index.ts +5 -0
  119. package/src/styles/index.ts +1 -0
  120. package/src/styles/markdown.ts +0 -2
  121. package/src/styles/tokens.ts +3 -0
  122. package/src/{components/TextEditor/themes → themes}/default.ts +52 -79
  123. package/src/util.ts +41 -0
  124. package/dist/types/src/components/TextEditor/codemirror.stories.d.ts +0 -12
  125. package/dist/types/src/components/TextEditor/codemirror.stories.d.ts.map +0 -1
  126. package/dist/types/src/components/TextEditor/extensions/autocomplete.d.ts.map +0 -1
  127. package/dist/types/src/components/TextEditor/extensions/basic.d.ts +0 -9
  128. package/dist/types/src/components/TextEditor/extensions/basic.d.ts.map +0 -1
  129. package/dist/types/src/components/TextEditor/extensions/blast.d.ts.map +0 -1
  130. package/dist/types/src/components/TextEditor/extensions/code.d.ts.map +0 -1
  131. package/dist/types/src/components/TextEditor/extensions/comments.d.ts.map +0 -1
  132. package/dist/types/src/components/TextEditor/extensions/hr.d.ts.map +0 -1
  133. package/dist/types/src/components/TextEditor/extensions/image.d.ts.map +0 -1
  134. package/dist/types/src/components/TextEditor/extensions/index.d.ts.map +0 -1
  135. package/dist/types/src/components/TextEditor/extensions/link.d.ts.map +0 -1
  136. package/dist/types/src/components/TextEditor/extensions/listener.d.ts +0 -9
  137. package/dist/types/src/components/TextEditor/extensions/listener.d.ts.map +0 -1
  138. package/dist/types/src/components/TextEditor/extensions/markdown/bundle.d.ts.map +0 -1
  139. package/dist/types/src/components/TextEditor/extensions/markdown/highlight.d.ts.map +0 -1
  140. package/dist/types/src/components/TextEditor/extensions/markdown/index.d.ts.map +0 -1
  141. package/dist/types/src/components/TextEditor/extensions/mention.d.ts.map +0 -1
  142. package/dist/types/src/components/TextEditor/extensions/mermaid.d.ts +0 -3
  143. package/dist/types/src/components/TextEditor/extensions/mermaid.d.ts.map +0 -1
  144. package/dist/types/src/components/TextEditor/extensions/table.d.ts.map +0 -1
  145. package/dist/types/src/components/TextEditor/extensions/tasklist.d.ts.map +0 -1
  146. package/dist/types/src/components/TextEditor/extensions/tooltip.d.ts +0 -12
  147. package/dist/types/src/components/TextEditor/extensions/tooltip.d.ts.map +0 -1
  148. package/dist/types/src/components/TextEditor/extensions/typewriter.d.ts.map +0 -1
  149. package/dist/types/src/components/TextEditor/extensions/util.d.ts +0 -5
  150. package/dist/types/src/components/TextEditor/extensions/util.d.ts.map +0 -1
  151. package/dist/types/src/components/TextEditor/themes/default.d.ts.map +0 -1
  152. package/dist/types/src/components/TextEditor/themes/index.d.ts.map +0 -1
  153. package/dist/types/src/hooks/automerge/automerge.stories.d.ts.map +0 -1
  154. package/dist/types/src/hooks/automerge/handle.d.ts +0 -9
  155. package/dist/types/src/hooks/automerge/handle.d.ts.map +0 -1
  156. package/dist/types/src/hooks/automerge/index.d.ts +0 -3
  157. package/dist/types/src/hooks/automerge/index.d.ts.map +0 -1
  158. package/dist/types/src/hooks/automerge/plugin.d.ts +0 -26
  159. package/dist/types/src/hooks/automerge/plugin.d.ts.map +0 -1
  160. package/dist/types/src/hooks/automerge/semaphore.d.ts +0 -19
  161. package/dist/types/src/hooks/automerge/semaphore.d.ts.map +0 -1
  162. package/dist/types/src/hooks/automerge/update-automerge.d.ts +0 -6
  163. package/dist/types/src/hooks/automerge/update-automerge.d.ts.map +0 -1
  164. package/dist/types/src/hooks/automerge/update-codemirror.d.ts.map +0 -1
  165. package/dist/types/src/hooks/yjs/cursors.d.ts.map +0 -1
  166. package/dist/types/src/hooks/yjs/index.d.ts +0 -3
  167. package/dist/types/src/hooks/yjs/index.d.ts.map +0 -1
  168. package/dist/types/src/hooks/yjs/space-provider.d.ts +0 -27
  169. package/dist/types/src/hooks/yjs/space-provider.d.ts.map +0 -1
  170. package/dist/types/src/hooks/yjs/yjs.stories.d.ts +0 -12
  171. package/dist/types/src/hooks/yjs/yjs.stories.d.ts.map +0 -1
  172. package/dist/types/src/hooks/yjs/yjs.test.d.ts +0 -2
  173. package/dist/types/src/hooks/yjs/yjs.test.d.ts.map +0 -1
  174. package/dist/types/src/testing/index.d.ts +0 -3
  175. package/dist/types/src/testing/index.d.ts.map +0 -1
  176. package/dist/types/src/testing/proto/gen/schema.d.ts +0 -15
  177. package/dist/types/src/testing/proto/gen/schema.d.ts.map +0 -1
  178. package/dist/types/src/testing/proto/index.d.ts +0 -2
  179. package/dist/types/src/testing/proto/index.d.ts.map +0 -1
  180. package/dist/types/src/testing/replicator.d.ts +0 -45
  181. package/dist/types/src/testing/replicator.d.ts.map +0 -1
  182. package/src/components/TextEditor/codemirror.stories.ts +0 -114
  183. package/src/components/TextEditor/extensions/basic.ts +0 -32
  184. package/src/components/TextEditor/extensions/comments.ts +0 -388
  185. package/src/components/TextEditor/extensions/hr.ts +0 -74
  186. package/src/components/TextEditor/extensions/image.ts +0 -69
  187. package/src/components/TextEditor/extensions/listener.ts +0 -23
  188. package/src/components/TextEditor/extensions/mermaid.ts +0 -11
  189. package/src/components/TextEditor/extensions/tasklist.ts +0 -121
  190. package/src/components/TextEditor/extensions/tooltip.ts +0 -61
  191. package/src/components/TextEditor/extensions/util.ts +0 -18
  192. package/src/hooks/automerge/handle.ts +0 -14
  193. package/src/hooks/automerge/index.ts +0 -6
  194. package/src/hooks/automerge/plugin.ts +0 -134
  195. package/src/hooks/yjs/index.ts +0 -6
  196. package/src/hooks/yjs/space-provider.ts +0 -126
  197. package/src/hooks/yjs/yjs.stories.tsx +0 -56
  198. package/src/hooks/yjs/yjs.test.ts +0 -59
  199. package/src/testing/index.ts +0 -6
  200. package/src/testing/proto/gen/schema.ts +0 -49
  201. package/src/testing/proto/index.ts +0 -5
  202. package/src/testing/proto/schema.proto +0 -15
  203. package/src/testing/replicator.ts +0 -189
  204. /package/dist/types/src/{components/TextEditor/extensions → extensions}/autocomplete.d.ts +0 -0
  205. /package/dist/types/src/{hooks → extensions}/automerge/update-codemirror.d.ts +0 -0
  206. /package/dist/types/src/{components/TextEditor/extensions → extensions}/blast.d.ts +0 -0
  207. /package/dist/types/src/{components/TextEditor/extensions → extensions}/code.d.ts +0 -0
  208. /package/dist/types/src/{components/TextEditor/extensions → extensions}/hr.d.ts +0 -0
  209. /package/dist/types/src/{components/TextEditor/extensions → extensions}/image.d.ts +0 -0
  210. /package/dist/types/src/{components/TextEditor/extensions → extensions}/markdown/highlight.d.ts +0 -0
  211. /package/dist/types/src/{components/TextEditor/extensions → extensions}/markdown/index.d.ts +0 -0
  212. /package/dist/types/src/{components/TextEditor/extensions → extensions}/mention.d.ts +0 -0
  213. /package/dist/types/src/{components/TextEditor/extensions → extensions}/table.d.ts +0 -0
  214. /package/dist/types/src/{components/TextEditor/extensions → extensions}/tasklist.d.ts +0 -0
  215. /package/dist/types/src/{components/TextEditor/extensions → extensions}/typewriter.d.ts +0 -0
  216. /package/dist/types/src/{hooks/yjs → styles}/cursors.d.ts +0 -0
  217. /package/dist/types/src/{components/TextEditor/themes → themes}/index.d.ts +0 -0
  218. /package/src/{components/TextEditor/extensions → extensions}/blast.ts +0 -0
  219. /package/src/{components/TextEditor/extensions → extensions}/markdown/index.ts +0 -0
  220. /package/src/{hooks/yjs → styles}/cursors.ts +0 -0
  221. /package/src/{components/TextEditor/themes → themes}/index.ts +0 -0
@@ -0,0 +1,46 @@
1
+ import { Facet, type Extension } from '@codemirror/state';
2
+ import { type DecorationSet, EditorView, type PluginValue, type ViewUpdate } from '@codemirror/view';
3
+ import { Event } from '@dxos/async';
4
+ export interface AwarenessProvider {
5
+ remoteStateChange: Event<void>;
6
+ open(): void;
7
+ close(): void;
8
+ getRemoteStates(): AwarenessState[];
9
+ update(position: AwarenessPosition | undefined): void;
10
+ }
11
+ export declare const AwarenessProvider: Facet<AwarenessProvider, AwarenessProvider>;
12
+ export type AwarenessPosition = {
13
+ anchor?: string;
14
+ head?: string;
15
+ };
16
+ export type AwarenessInfo = {
17
+ displayName?: string;
18
+ color?: string;
19
+ lightColor?: string;
20
+ };
21
+ export type AwarenessState = {
22
+ position?: AwarenessPosition;
23
+ peerId: string;
24
+ info: AwarenessInfo;
25
+ };
26
+ /**
27
+ * Extension provides presence information about other peers.
28
+ */
29
+ export declare const awareness: (provider?: AwarenessProvider) => Extension;
30
+ /**
31
+ * Generates selection decorations from remote peers.
32
+ */
33
+ export declare class RemoteSelectionsDecorator implements PluginValue {
34
+ decorations: DecorationSet;
35
+ private readonly _ctx;
36
+ private _cursorConverter;
37
+ private _provider;
38
+ private _lastAnchor?;
39
+ private _lastHead?;
40
+ constructor(view: EditorView);
41
+ destroy(): void;
42
+ update(update: ViewUpdate): void;
43
+ private _updateLocalSelection;
44
+ private _updateRemoteSelections;
45
+ }
46
+ //# sourceMappingURL=awareness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["../../../../src/extensions/awareness.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,EAAE,KAAK,SAAS,EAAwB,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAEL,KAAK,aAAa,EAClB,UAAU,EACV,KAAK,WAAW,EAEhB,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IAEd,eAAe,IAAI,cAAc,EAAE,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,CAAC;CACvD;AAYD,eAAO,MAAM,iBAAiB,6CAE5B,CAAC;AAKH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,oCAA+B,SAQpD,CAAC;AAEF;;GAEG;AACH,qBAAa,yBAA0B,YAAW,WAAW;IACpD,WAAW,EAAE,aAAa,CAAmB;IAEpD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IAEtC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,WAAW,CAAC,CAAqB;IACzC,OAAO,CAAC,SAAS,CAAC,CAAqB;gBAE3B,IAAI,EAAE,UAAU;IAS5B,OAAO;IAKP,MAAM,CAAC,MAAM,EAAE,UAAU;IAKzB,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,uBAAuB;CA4EhC"}
@@ -0,0 +1,8 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ import { type ThemeMode } from '@dxos/react-ui';
3
+ import { type TextEditorProps } from '../components';
4
+ export type BasicBundleOptions = {
5
+ themeMode?: ThemeMode;
6
+ } & Pick<TextEditorProps, 'placeholder' | 'lineWrapping'>;
7
+ export declare const basicBundle: ({ themeMode, placeholder: _placeholder, lineWrapping, }: BasicBundleOptions) => Extension[];
8
+ //# sourceMappingURL=basic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../src/extensions/basic.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC;AAE1D,eAAO,MAAM,WAAW,4DAIrB,kBAAkB,KAAG,SAAS,EAahC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blast.d.ts","sourceRoot":"","sources":["../../../../src/extensions/blast.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,gBAAgB,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,qBAAqB,EAAE;QAAE,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IACpE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,YAU5B,CAAC;AAEF,eAAO,MAAM,KAAK,aAAa,QAAQ,YAAY,CAAC,KAAoB,SAmEvE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../../src/extensions/code.ts"],"names":[],"mappings":"AAsDA,eAAO,MAAM,IAAI,+CAiDhB,CAAC"}
@@ -1,27 +1,39 @@
1
1
  import { type Extension } from '@codemirror/state';
2
- import { type Rect } from '@codemirror/view';
3
- import { type CommentRange, type EditorModel, type Range } from '../../../hooks';
4
- type CommentSelected = {
5
- active?: string;
6
- closest?: string;
7
- };
8
- type ExtendedCommentRange = Range & CommentRange & {
2
+ import { EditorView, type Rect } from '@codemirror/view';
3
+ import { type Comment, type Range } from '../hooks';
4
+ type CommentState = {
5
+ comment: Comment;
6
+ range: Range;
9
7
  location?: Rect | null;
10
8
  };
11
- export type CommentsState = CommentSelected & {
12
- ranges: ExtendedCommentRange[];
9
+ type SelectionState = {
10
+ current?: string;
11
+ closest?: string;
12
+ };
13
+ export type CommentsState = {
14
+ comments: CommentState[];
15
+ selection: SelectionState;
13
16
  };
14
- export declare const setCommentRange: import("@codemirror/state").StateEffectType<{
15
- model: EditorModel;
16
- comments: CommentRange[];
17
- }>;
17
+ export declare const setFocus: (view: EditorView, id: string, center?: boolean) => void;
18
+ export declare const setComments: import("@codemirror/state").StateEffectType<Comment[]>;
19
+ export declare const setSelection: import("@codemirror/state").StateEffectType<SelectionState>;
18
20
  export type CommentsOptions = {
21
+ /**
22
+ * Key shortcut to create a new thread.
23
+ */
19
24
  key?: string;
20
- footnote?: boolean;
21
25
  /**
22
26
  * Called to create a new thread and return the thread id.
23
27
  */
24
- onCreate?: (range: string) => string | undefined;
28
+ onCreate?: (cursor: string, location?: Rect | null) => string | undefined;
29
+ /**
30
+ * Selection cut/deleted.
31
+ */
32
+ onDelete?: (thread: string) => void;
33
+ /**
34
+ * Called when a comment is moved.
35
+ */
36
+ onUpdate?: (thread: string, cursor: string) => void;
25
37
  /**
26
38
  * Called to notify which thread is currently closest to the cursor.
27
39
  */
@@ -29,7 +41,7 @@ export type CommentsOptions = {
29
41
  /**
30
42
  * Called to render tooltip.
31
43
  */
32
- onHover?: (el: Element) => void;
44
+ onHover?: (el: Element, shortcut: string) => void;
33
45
  };
34
46
  /**
35
47
  * Comment threads.
@@ -40,9 +52,12 @@ export type CommentsOptions = {
40
52
  * 4). Tracks the current cursor position to:
41
53
  * a). Update the decoration to show if the cursor is within a current selection.
42
54
  * b). Calls a handler to indicate which is the closest selection (e.g., to update the thread sidebar).
43
- * 5). Optionally, inserts a markdown footnote when creating a comment thread.
44
- * 6). Optionally, implements a hoverTooltip to show hints when creating a selection range.
55
+ * 5). Optionally, implements a hoverTooltip to show hints when creating a selection range.
45
56
  */
46
57
  export declare const comments: (options?: CommentsOptions) => Extension;
58
+ /**
59
+ * Update comments state field.
60
+ */
61
+ export declare const useComments: (view: EditorView | null, comments?: Comment[]) => void;
47
62
  export {};
48
63
  //# sourceMappingURL=comments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../src/extensions/comments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAsC,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAkD,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AASzG,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAmBpD,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,UAAU,MAAM,MAAM,2BAiBpD,CAAC;AAEF,eAAO,MAAM,WAAW,wDAAkC,CAAC;AAE3D,eAAO,MAAM,YAAY,6DAAuC,CAAC;AAwEjE,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1E;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD,CAAC;AAuEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,aAAa,eAAe,KAAQ,SAqKxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,SAAU,UAAU,GAAG,IAAI,aAAY,OAAO,EAAE,SAQvE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type EditorState, Facet } from '@codemirror/state';
2
+ import type { Range } from '../hooks';
3
+ /**
4
+ * Converts indexes into the text document into stable peer-independent cursors.
5
+ *
6
+ * See:
7
+ * - https://automerge.org/automerge/api-docs/js/functions/next.getCursor.html
8
+ * - https://github.com/yjs/yjs?tab=readme-ov-file#relative-positions
9
+ *
10
+ * @param {assoc} number Negative values will associate the cursor with the previous character
11
+ * while positive - with the next one.
12
+ */
13
+ export interface CursorConverter {
14
+ toCursor(position: number, assoc?: -1 | 1 | undefined): string;
15
+ fromCursor(cursor: string): number;
16
+ }
17
+ export declare class Cursor {
18
+ static readonly converter: Facet<CursorConverter, CursorConverter>;
19
+ static readonly getCursorFromRange: (state: EditorState, range: Range) => string;
20
+ static readonly getRangeFromCursor: (state: EditorState, cursor: string) => {
21
+ from: number;
22
+ to: number;
23
+ } | undefined;
24
+ }
25
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC;IAC/D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAOD,qBAAa,MAAM;IACjB,MAAM,CAAC,QAAQ,CAAC,SAAS,0CAEtB;IAEH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,UAAW,WAAW,SAAS,KAAK,YAMpE;IAEF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,UAAW,WAAW,UAAU,MAAM;;;kBAOtE;CACH"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../../../src/extensions/hr.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,EAAE,+CAoBd,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image.ts"],"names":[],"mappings":"AAKA,OAAO,EAAoB,KAAK,SAAS,EAA4C,MAAM,mBAAmB,CAAC;AAG/G,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC;AAE9B,eAAO,MAAM,KAAK,aAAa,YAAY,KAAQ,SA8BlD,CAAC"}
@@ -1,17 +1,19 @@
1
1
  export * from './autocomplete';
2
+ export * from './automerge';
3
+ export * from './awareness';
2
4
  export * from './basic';
3
5
  export * from './blast';
4
6
  export * from './code';
5
7
  export * from './comments';
8
+ export * from './cursor';
6
9
  export * from './hr';
7
10
  export * from './image';
8
11
  export * from './link';
9
12
  export * from './listener';
10
13
  export * from './markdown';
11
14
  export * from './mention';
12
- export * from './mermaid';
15
+ export * from './outliner';
13
16
  export * from './table';
14
17
  export * from './tasklist';
15
- export * from './tooltip';
16
18
  export * from './typewriter';
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type Extension } from '@codemirror/state';
2
2
  export type LinkOptions = {
3
3
  link?: boolean;
4
+ onHover?: (el: Element, url: string) => void;
4
5
  onRender?: (el: Element, url: string) => void;
5
6
  };
6
7
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../src/extensions/link.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAkBpE,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,aAAa,WAAW,KAAQ,SAsDhD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type ListenerOptions = {
3
+ onFocus?: (focused: boolean) => void;
4
+ onChange?: (text: string) => void;
5
+ };
6
+ /**
7
+ * Event listener.
8
+ */
9
+ export declare const listener: ({ onFocus, onChange }: ListenerOptions) => Extension;
10
+ //# sourceMappingURL=listener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/extensions/listener.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,0BAA2B,eAAe,KAAG,SAmBjE,CAAC"}
@@ -1,15 +1,12 @@
1
1
  import { type Extension } from '@codemirror/state';
2
2
  import type { ThemeMode } from '@dxos/react-ui';
3
+ import { type TextEditorProps } from '../../components';
3
4
  export type MarkdownBundleOptions = {
4
- readonly?: boolean;
5
5
  themeMode?: ThemeMode;
6
- placeholder?: string;
7
- };
6
+ } & Pick<TextEditorProps, 'readonly' | 'placeholder'>;
8
7
  /**
9
8
  * Markdown bundle.
10
9
  * Refs:
11
- * https://github.com/codemirror/basic-setup
12
- * https://github.com/codemirror/basic-setup/blob/main/src/codemirror.ts#L50
13
10
  * https://codemirror.net/docs/community
14
11
  * https://codemirror.net/docs/ref/#codemirror.basicSetup
15
12
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/bundle.ts"],"names":[],"mappings":"AAUA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAYhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC;AAEtD;;;;;GAKG;AAEH,eAAO,MAAM,cAAc,wDAIxB,qBAAqB,KAAG,SAAS,EAyDnC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/highlight.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAmB,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,iBAAiB,CAAC;AAe7D;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAexB,CAAC;AAaF,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAKlD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,cAAe,OAAO,mBAyHxD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mention.d.ts","sourceRoot":"","sources":["../../../../src/extensions/mention.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;CACtC,CAAC;AAGF,eAAO,MAAM,OAAO,iBAAkB,cAAc,KAAG,SAyBtD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export type OutlinerOptions = {};
3
+ export declare const outliner: (options?: OutlinerOptions) => Extension;
4
+ //# sourceMappingURL=outliner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outliner.d.ts","sourceRoot":"","sources":["../../../../src/extensions/outliner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAGjC,eAAO,MAAM,QAAQ,aAAa,eAAe,KAAQ,SAExD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/extensions/table.ts"],"names":[],"mappings":"AAKA,OAAO,EAAoB,KAAK,QAAQ,EAAmB,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AASnH,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,KAAK,aAAa,YAAY,8BAM1C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasklist.d.ts","sourceRoot":"","sources":["../../../../src/extensions/tasklist.ts"],"names":[],"mappings":"AAsFA,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAEjC,eAAO,MAAM,QAAQ,aAAa,eAAe,4CAsBhD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typewriter.d.ts","sourceRoot":"","sources":["../../../../src/extensions/typewriter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,UAAU,sBAA0C,WAAW,KAAQ,SAgDnF,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { Event } from '@dxos/async';
2
+ import { type Space } from '@dxos/react-client/echo';
3
+ import { type AwarenessInfo, type AwarenessPosition, type AwarenessProvider, type AwarenessState } from '../extensions';
4
+ export type AwarenessProviderParams = {
5
+ space: Space;
6
+ channel: string;
7
+ peerId: string;
8
+ info: AwarenessInfo;
9
+ };
10
+ /**
11
+ * Receives and broadcasts profile and cursor position.
12
+ */
13
+ export declare class SpaceAwarenessProvider implements AwarenessProvider {
14
+ private readonly _remoteStates;
15
+ private readonly _space;
16
+ private readonly _channel;
17
+ private readonly _peerId;
18
+ private readonly _info;
19
+ private _ctx?;
20
+ private _postTask?;
21
+ private _localState?;
22
+ readonly remoteStateChange: Event<void>;
23
+ constructor(params: AwarenessProviderParams);
24
+ open(): void;
25
+ close(): void;
26
+ getRemoteStates(): AwarenessState[];
27
+ update(position: AwarenessPosition | undefined): void;
28
+ private _handleQueryMessage;
29
+ private _handlePostMessage;
30
+ }
31
+ //# sourceMappingURL=awareness-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awareness-provider.d.ts","sourceRoot":"","sources":["../../../../src/hooks/awareness-provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,EAAS,MAAM,aAAa,CAAC;AAIzD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAaxH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IAEnE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IAEtC,OAAO,CAAC,IAAI,CAAC,CAAU;IACvB,OAAO,CAAC,SAAS,CAAC,CAAe;IACjC,OAAO,CAAC,WAAW,CAAC,CAAiB;IAErC,SAAgB,iBAAiB,cAAqB;gBAE1C,MAAM,EAAE,uBAAuB;IAO3C,IAAI;IAqCJ,KAAK;IAML,eAAe,IAAI,cAAc,EAAE;IAInC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI;IAWrD,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,kBAAkB;CAK3B"}
@@ -0,0 +1,25 @@
1
+ import { type Extension, StateField } from '@codemirror/state';
2
+ import { type DocAccessor } from '@dxos/echo-schema';
3
+ export type Range = {
4
+ from: number;
5
+ to: number;
6
+ };
7
+ export type Comment = {
8
+ id: string;
9
+ cursor?: string;
10
+ };
11
+ export type EditorModel = {
12
+ id: string;
13
+ text: () => string;
14
+ extension?: Extension;
15
+ content: string | DocAccessor;
16
+ peer?: {
17
+ id: string;
18
+ name?: string;
19
+ };
20
+ };
21
+ /**
22
+ * State field makes the model available to other extensions.
23
+ */
24
+ export declare const modelState: StateField<EditorModel | undefined>;
25
+ //# sourceMappingURL=defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/hooks/defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAGF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IAGtB,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAG9B,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,qCAGrB,CAAC"}
@@ -1,3 +1,5 @@
1
+ export * from './awareness-provider';
2
+ export * from './defs';
3
+ export * from './useTextEditor';
1
4
  export * from './useTextModel';
2
- export * from './yjs';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AAEvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type EditorView } from '@codemirror/view';
2
+ import { type RefCallback } from 'react';
3
+ /**
4
+ * Hook for accessing the editor view.
5
+ *
6
+ * ```tsx
7
+ * const Test = () => {
8
+ * const [editorRef, editorView] = useTextEditor();
9
+ * useEffect(() => {
10
+ * editorView?.focus();
11
+ * }, [editorView]);
12
+ * return <TextEditor ref={editorRef} />;
13
+ * };
14
+ * ```
15
+ */
16
+ export declare const useTextEditor: () => [RefCallback<EditorView | null>, EditorView | null];
17
+ //# sourceMappingURL=useTextEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTextEditor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextEditor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,OAAO,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,QAAO,CAAC,YAAY,UAAU,GAAG,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAQlF,CAAC"}
@@ -1,39 +1,10 @@
1
- import { type Extension, StateField } from '@codemirror/state';
2
- import type * as awarenessProtocol from 'y-protocols/awareness';
3
- import { type DocAccessor, type Space, type TextObject } from '@dxos/react-client/echo';
1
+ import { type Space, type TextObject } from '@dxos/react-client/echo';
4
2
  import { type Identity } from '@dxos/react-client/halo';
5
- import type { YText, YXmlFragment } from '@dxos/text-model';
6
- type Awareness = awarenessProtocol.Awareness;
7
- /**
8
- * State field makes the model available to other extensions.
9
- */
10
- export declare const modelState: StateField<EditorModel | undefined>;
11
- export type Range = {
12
- from: number;
13
- to: number;
14
- };
15
- export type CommentRange = {
16
- id: string;
17
- cursor: string;
18
- };
19
- export type EditorModel = {
20
- id: string;
21
- content: string | YText | YXmlFragment | DocAccessor;
22
- text: () => string;
23
- getCursorFromRange?: (value: Range) => string;
24
- getRangeFromCursor?: (cursor: string) => Range;
25
- extension?: Extension;
26
- awareness?: Awareness;
27
- peer?: {
28
- id: string;
29
- name?: string;
30
- };
31
- };
3
+ import { type EditorModel } from './defs';
32
4
  export type UseTextModelProps = {
33
5
  identity?: Identity | null;
34
6
  space?: Space;
35
7
  text?: TextObject;
36
8
  };
37
9
  export declare const useTextModel: (props: UseTextModelProps) => EditorModel | undefined;
38
- export {};
39
10
  //# sourceMappingURL=useTextModel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTextModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/D,OAAO,KAAK,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAIhE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,UAAU,EAIhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO5D,KAAK,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;AAE7C;;GAEG;AAEH,eAAO,MAAM,UAAU,qCAGrB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IAEX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,WAAW,CAAC;IACrD,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IAC9C,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC;IAC/C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,YAAY,UAAW,iBAAiB,KAAG,WAAW,GAAG,SAKrE,CAAC"}
1
+ {"version":3,"file":"useTextModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextModel.ts"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,QAAQ,CAAC;AAKtD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,iBAAiB,KAAG,WAAW,GAAG,SAKrE,CAAC"}
@@ -1,6 +1,11 @@
1
1
  export { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';
2
2
  export { Doc, YText, YXmlFragment } from '@dxos/text-model';
3
3
  export { type Extension } from '@codemirror/state';
4
+ export { type EditorView } from '@codemirror/view';
4
5
  export * from './components';
6
+ export * from './extensions';
5
7
  export * from './hooks';
8
+ export { getToken } from './styles';
9
+ export * from './themes';
10
+ export * from './util';
6
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursors.d.ts","sourceRoot":"","sources":["../../../../src/styles/cursors.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,WAAW;;;CAAsD,CAAC"}
@@ -1,3 +1,4 @@
1
+ export * from './cursors';
1
2
  export * from './markdown';
2
3
  export * from './tokens';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/styles/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/styles/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../src/styles/markdown.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAIjD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAOnD,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,YAAY,aAAa,OAAO,WAG9D,CAAC;AAEF,eAAO,MAAM,IAAI,2CAA2C,CAAC;AAC7D,eAAO,MAAM,KAAK,2CAA2C,CAAC;AAE9D,eAAO,MAAM,IAAI,QAAmE,CAAC;AAErF,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAE5C,eAAO,MAAM,IAAI,mEAAmE,CAAC;AACrF,eAAO,MAAM,QAAQ,+BAA+B,CAAC;AACrD,eAAO,MAAM,SAAS,kDAAkD,CAAC;AAEzE,eAAO,MAAM,SAAS,QAAmB,CAAC;AAG1C,eAAO,MAAM,UAAU,QAAsF,CAAC;AAG9G,eAAO,MAAM,cAAc,0GAC8E,CAAC;AAG1G,eAAO,MAAM,aAAa,wHAC6F,CAAC;AACxH,eAAO,MAAM,WAAW,+IACkH,CAAC;AAE3I,eAAO,MAAM,QAAQ,gDAAgD,CAAC"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../src/styles/markdown.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAIjD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAOnD,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,YAAY,aAAa,OAAO,WAG9D,CAAC;AAEF,eAAO,MAAM,IAAI,2CAA2C,CAAC;AAC7D,eAAO,MAAM,KAAK,2CAA2C,CAAC;AAE9D,eAAO,MAAM,IAAI,QAAmE,CAAC;AAErF,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAE5C,eAAO,MAAM,IAAI,mEAAmE,CAAC;AACrF,eAAO,MAAM,QAAQ,+BAA+B,CAAC;AACrD,eAAO,MAAM,SAAS,kDAAkD,CAAC;AAEzE,eAAO,MAAM,SAAS,QAAmB,CAAC;AAE1C,eAAO,MAAM,UAAU,QAAsF,CAAC;AAE9G,eAAO,MAAM,cAAc,0GAC8E,CAAC;AAG1G,eAAO,MAAM,aAAa,wHAC6F,CAAC;AACxH,eAAO,MAAM,WAAW,+IACkH,CAAC;AAE3I,eAAO,MAAM,QAAQ,gDAAgD,CAAC"}
@@ -4,4 +4,5 @@ export type ThemeStyles = {
4
4
  [selector: string]: StyleSpec;
5
5
  };
6
6
  export declare const tokens: TailwindConfig['theme'];
7
+ export declare const getToken: (path: string, defaultValue?: any) => any;
7
8
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/styles/tokens.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAGF,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,OAAO,CAA4B,CAAC"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/styles/tokens.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAGF,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,OAAO,CAA4B,CAAC;AAExE,eAAO,MAAM,QAAQ,SAAU,MAAM,iBAAgB,GAAG,QAAgD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type ThemeStyles } from '../../../styles';
1
+ import { type ThemeStyles } from '../styles';
2
2
  /**
3
3
  * Minimal styles.
4
4
  * https://codemirror.net/examples/styling
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/themes/default.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,WAAW,CAAC;AAKrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,WAiO1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAOvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAO3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAOvB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/themes/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Transaction } from '@codemirror/state';
2
+ /**
3
+ * CodeMirror callbacks swallow errors so wrap handlers.
4
+ */
5
+ export declare const callbackWrapper: <T extends Function>(fn: T) => T;
6
+ export declare const logChanges: (trs: readonly Transaction[]) => void;
7
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAOR,CAAC;AAErB,eAAO,MAAM,UAAU,QAAS,SAAS,WAAW,EAAE,SAmBrD,CAAC"}