@dxos/react-ui-editor 0.3.9-main.501fe30 → 0.3.9-main.52d137d

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 (64) hide show
  1. package/dist/lib/browser/index.mjs +88 -183
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/automerge/automerge-plugin/PatchSemaphore.d.ts +2 -2
  5. package/dist/types/src/automerge/automerge-plugin/PatchSemaphore.d.ts.map +1 -1
  6. package/dist/types/src/automerge/automerge-plugin/codeMirrorToAm.d.ts +2 -2
  7. package/dist/types/src/automerge/automerge-plugin/codeMirrorToAm.d.ts.map +1 -1
  8. package/dist/types/src/automerge/automerge-plugin/index.d.ts +2 -2
  9. package/dist/types/src/automerge/automerge-plugin/index.d.ts.map +1 -1
  10. package/dist/types/src/automerge/automerge-plugin/plugin.d.ts +5 -6
  11. package/dist/types/src/automerge/automerge-plugin/plugin.d.ts.map +1 -1
  12. package/dist/types/src/automerge/automerge.stories.d.ts +0 -1
  13. package/dist/types/src/automerge/automerge.stories.d.ts.map +1 -1
  14. package/dist/types/src/automerge/demo.d.ts +25 -0
  15. package/dist/types/src/automerge/demo.d.ts.map +1 -0
  16. package/dist/types/src/components/Editor/Editor.d.ts +1 -0
  17. package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
  18. package/dist/types/src/components/Editor/Editor.stories.d.ts +8 -2
  19. package/dist/types/src/components/Editor/Editor.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/Markdown/Markdown.d.ts +1 -2
  21. package/dist/types/src/components/Markdown/Markdown.d.ts.map +1 -1
  22. package/dist/types/src/components/Markdown/Markdown.stories.d.ts +1 -0
  23. package/dist/types/src/components/Markdown/Markdown.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Markdown/markdownTheme.d.ts +1 -8
  25. package/dist/types/src/components/Markdown/markdownTheme.d.ts.map +1 -1
  26. package/dist/types/src/components/RichText/RichText.stories.d.ts +3 -1
  27. package/dist/types/src/components/RichText/RichText.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
  29. package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +15 -0
  30. package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
  31. package/dist/types/src/components/TextEditor/extensions/{hyperlinkWidget.d.ts → hyperlink.d.ts} +3 -3
  32. package/dist/types/src/components/TextEditor/extensions/hyperlink.d.ts.map +1 -0
  33. package/dist/types/src/components/TextEditor/extensions/hyperlinkTooltip.d.ts.map +1 -1
  34. package/dist/types/src/components/TextEditor/extensions/index.d.ts +1 -2
  35. package/dist/types/src/components/TextEditor/extensions/index.d.ts.map +1 -1
  36. package/dist/types/src/components/TextEditor/theme.d.ts +0 -1
  37. package/dist/types/src/components/TextEditor/theme.d.ts.map +1 -1
  38. package/dist/types/stories/html/code-mirror.stories.d.ts.map +1 -1
  39. package/package.json +27 -26
  40. package/src/automerge/automerge-plugin/PatchSemaphore.ts +5 -5
  41. package/src/automerge/automerge-plugin/codeMirrorToAm.ts +7 -10
  42. package/src/automerge/automerge-plugin/index.ts +2 -2
  43. package/src/automerge/automerge-plugin/plugin.ts +10 -39
  44. package/src/automerge/automerge.stories.tsx +46 -31
  45. package/src/automerge/demo.ts +106 -0
  46. package/src/components/Editor/Editor.stories.tsx +5 -3
  47. package/src/components/Editor/Editor.tsx +1 -4
  48. package/src/components/Markdown/Markdown.stories.tsx +25 -36
  49. package/src/components/Markdown/Markdown.tsx +22 -47
  50. package/src/components/Markdown/markdownTheme.ts +1 -12
  51. package/src/components/RichText/RichText.stories.tsx +33 -35
  52. package/src/components/TextEditor/TextEditor.stories.tsx +64 -39
  53. package/src/components/TextEditor/TextEditor.tsx +0 -1
  54. package/src/components/TextEditor/extensions/{hyperlinkWidget.tsx → hyperlink.tsx} +10 -21
  55. package/src/components/TextEditor/extensions/hyperlinkTooltip.tsx +0 -1
  56. package/src/components/TextEditor/extensions/index.ts +1 -2
  57. package/src/components/TextEditor/theme.ts +4 -6
  58. package/dist/types/src/automerge/automerge-plugin/handle.d.ts +0 -9
  59. package/dist/types/src/automerge/automerge-plugin/handle.d.ts.map +0 -1
  60. package/dist/types/src/components/TextEditor/extensions/hyperlinkDecoration.d.ts +0 -11
  61. package/dist/types/src/components/TextEditor/extensions/hyperlinkDecoration.d.ts.map +0 -1
  62. package/dist/types/src/components/TextEditor/extensions/hyperlinkWidget.d.ts.map +0 -1
  63. package/src/automerge/automerge-plugin/handle.ts +0 -14
  64. package/src/components/TextEditor/extensions/hyperlinkDecoration.ts +0 -99
@@ -1,7 +1,7 @@
1
1
  import { type EditorState, type Transaction } from '@codemirror/state';
2
2
  import { type Heads } from '@dxos/automerge/automerge';
3
- import { type IDocHandle } from './handle';
4
3
  import { type Field } from './plugin';
5
- declare const _default: (field: Field, handle: IDocHandle, transactions: Transaction[], state: EditorState) => Heads | undefined;
4
+ import { type Peer } from '../demo';
5
+ declare const _default: (field: Field, handle: Peer, transactions: Transaction[], state: EditorState) => Heads | undefined;
6
6
  export default _default;
7
7
  //# sourceMappingURL=codeMirrorToAm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeMirrorToAm.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/codeMirrorToAm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;+CAI5B,UAAU,gBACJ,WAAW,EAAE,SACpB,WAAW,KACjB,KAAK,GAAG,SAAS;AALpB,wBA6BE"}
1
+ {"version":3,"file":"codeMirrorToAm.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/codeMirrorToAm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;+CAEE,IAAI,gBAAgB,WAAW,EAAE,SAAS,WAAW,KAAG,KAAK,GAAG,SAAS;AAA/G,wBA0BE"}
@@ -1,3 +1,3 @@
1
- export { automergePlugin, type AutomergePlugin } from './plugin';
2
- export { type IDocHandle } from './handle';
1
+ export { plugin, reconcile } from './plugin';
2
+ export { PatchSemaphore } from './PatchSemaphore';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { type EditorState, type Extension, StateEffect, StateField, type Transaction, type TransactionSpec } from '@codemirror/state';
2
+ import { type EditorView } from '@codemirror/view';
2
3
  import * as automerge from '@dxos/automerge/automerge';
3
- import { type Heads, type Prop } from '@dxos/automerge/automerge';
4
- import { type IDocHandle } from './handle';
4
+ import { type Doc, type Heads, type Prop } from '@dxos/automerge/automerge';
5
+ import { type Peer } from '../demo';
5
6
  export type Value = {
6
7
  lastHeads: Heads;
7
8
  path: Prop[];
@@ -15,12 +16,10 @@ export declare const updateHeads: (newHeads: automerge.next.Heads) => StateEffec
15
16
  export declare const getLastHeads: (state: EditorState, field: Field) => automerge.next.Heads;
16
17
  export declare const getPath: (state: EditorState, field: Field) => Prop[];
17
18
  export type Field = StateField<Value>;
18
- export type AutomergePlugin = {
19
- extension: Extension;
20
- };
21
- export declare const automergePlugin: (handle: IDocHandle, path: Prop[]) => AutomergePlugin;
19
+ export declare const plugin: <T>(doc: automerge.next.Doc<T>, path: Prop[]) => Extension;
22
20
  export declare const reconcileAnnotationType: import("@codemirror/state").AnnotationType<unknown>;
23
21
  export declare const isReconcileTx: (tr: Transaction) => boolean;
24
22
  export declare const makeReconcile: (tr: TransactionSpec) => void;
23
+ export declare const reconcile: (handle: Peer, view: EditorView) => void;
25
24
  export {};
26
25
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,WAAW,EACX,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,wBAAwB,EAAE,WAAW,EAAE,CAAC;CACzC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,0DAAsC,CAAC;AAE9D,eAAO,MAAM,WAAW,sCAAsB,YAAY,WAAW,CAAgC,CAAC;AAEtG,eAAO,MAAM,YAAY,UAAW,WAAW,uCAAsD,CAAC;AAEtG,eAAO,MAAM,OAAO,UAAW,WAAW,mBAAiB,IAAI,EAA6B,CAAC;AAE7F,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAMtC,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,QAAQ,IAAI,EAAE,KAAG,eA8DlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qDAA+B,CAAC;AAEpE,eAAO,MAAM,aAAa,OAAQ,WAAW,KAAG,OAAmD,CAAC;AAEpG,eAAO,MAAM,aAAa,OAAQ,eAAe,SAchD,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,WAAW,EACX,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,wBAAwB,EAAE,WAAW,EAAE,CAAC;CACzC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,0DAAsC,CAAC;AAE9D,eAAO,MAAM,WAAW,sCAAsB,YAAY,WAAW,CAAgC,CAAC;AAEtG,eAAO,MAAM,YAAY,UAAW,WAAW,uCAAsD,CAAC;AAEtG,eAAO,MAAM,OAAO,UAAW,WAAW,mBAAiB,IAAI,EAA6B,CAAC;AAE7F,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAMtC,eAAO,MAAM,MAAM,wCAA0B,IAAI,EAAE,KAAG,SAiCrD,CAAC;AAEF,eAAO,MAAM,uBAAuB,qDAA+B,CAAC;AAEpE,eAAO,MAAM,aAAa,OAAQ,WAAW,KAAG,OAAmD,CAAC;AAEpG,eAAO,MAAM,aAAa,OAAQ,eAAe,SAchD,CAAC;AAEF,eAAO,MAAM,SAAS,WAAY,IAAI,QAAQ,UAAU,SAEvD,CAAC"}
@@ -1,4 +1,3 @@
1
- import '@preact/signals-react';
2
1
  declare const _default: {
3
2
  title: string;
4
3
  };
@@ -1 +1 @@
1
- {"version":3,"file":"automerge.stories.d.ts","sourceRoot":"","sources":["../../../../src/automerge/automerge.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,uBAAuB,CAAC;;;;AA8E/B,wBAEE;AAEF,eAAO,MAAM,WAAW;;CAEvB,CAAC"}
1
+ {"version":3,"file":"automerge.stories.d.ts","sourceRoot":"","sources":["../../../../src/automerge/automerge.stories.tsx"],"names":[],"mappings":";;;AAiGA,wBAEE;AAEF,eAAO,MAAM,WAAW;;CAEvB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Event } from '@dxos/async';
2
+ import { type Doc, next as automerge, type ChangeOptions, type ChangeFn, type Heads } from '@dxos/automerge/automerge';
3
+ export declare class Peer {
4
+ changeEvent: Event<void>;
5
+ storage: Map<string, Uint8Array>;
6
+ stats: {
7
+ messagesSent: number;
8
+ messagesReceived: number;
9
+ bytesSent: number;
10
+ bytesReceived: number;
11
+ snapshotBytes: number;
12
+ incrementalBytes: number;
13
+ };
14
+ doc: Doc<{
15
+ text: string;
16
+ }>;
17
+ change(options: string | ChangeOptions<any> | ChangeFn<any>, callback?: ChangeFn<any>): void;
18
+ changeAt(scope: Heads, options: string | ChangeOptions<any> | ChangeFn<any>, callback?: ChangeFn<any>): automerge.Heads | null;
19
+ replicate(): {
20
+ readable: ReadableStream<Uint8Array>;
21
+ writable: WritableStream<Uint8Array>;
22
+ };
23
+ private _handleChange;
24
+ }
25
+ //# sourceMappingURL=demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../../../src/automerge/demo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,KAAK,GAAG,EACR,IAAI,IAAI,SAAS,EACjB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,KAAK,EAEX,MAAM,2BAA2B,CAAC;AAEnC,qBAAa,IAAI;IACf,WAAW,cAAe;IAE1B,OAAO,0BAAiC;IACxC,KAAK;;;;;;;MAOH;IAEF,GAAG,EAAG,GAAG,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE5B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC;IAKrF,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC;IAOrG,SAAS,IAAI;QAAE,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;QAAC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;KAAE;IAgD3F,OAAO,CAAC,aAAa;CAgBtB"}
@@ -6,6 +6,7 @@ export type EditorProps = UseTextModelOptions & {
6
6
  };
7
7
  /**
8
8
  * Memoized editor which depends on DXOS platform.
9
+ *
9
10
  * Determines which editor to render based on the kind of text.
10
11
  */
11
12
  export declare const Editor: React.MemoExoticComponent<React.ForwardRefExoticComponent<UseTextModelOptions & {
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,OAAO,EAAE,KAAK,WAAW,EAAgB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrE,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG;IAC9C,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF;;;GAGG;AAGH,eAAO,MAAM,MAAM;;6EAalB,CAAC"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,OAAO,EAAE,KAAK,WAAW,EAAgB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrE,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG;IAC9C,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AAGH,eAAO,MAAM,MAAM;;6EASlB,CAAC"}
@@ -8,10 +8,15 @@ declare const _default: {
8
8
  };
9
9
  export default _default;
10
10
  export declare const Markdown: {
11
- render: () => JSX.Element;
11
+ render: (args: {
12
+ id: number;
13
+ }) => JSX.Element;
14
+ decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R, any>[];
12
15
  };
13
16
  export declare const Rich: {
14
- render: () => JSX.Element;
17
+ render: (args: {
18
+ id: number;
19
+ }) => JSX.Element;
15
20
  args: {
16
21
  slots: {
17
22
  editor: {
@@ -19,5 +24,6 @@ export declare const Rich: {
19
24
  };
20
25
  };
21
26
  };
27
+ decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R, any>[];
22
28
  };
23
29
  //# sourceMappingURL=Editor.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;AAYxC,wBAGE;AAoCF,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAWF,eAAO,MAAM,IAAI;;;;;;;;;CAShB,CAAC"}
1
+ {"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;AAYxC,wBAGE;AAoCF,eAAO,MAAM,QAAQ;mBACJ;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;;CAE9B,CAAC;AAWF,eAAO,MAAM,IAAI;mBACA;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;;;;;;;;;CAS9B,CAAC"}
@@ -5,10 +5,9 @@ import { type EditorModel, type EditorSlots } from '../../model';
5
5
  export declare const EditorModes: readonly ["default", "vim"];
6
6
  export type EditorMode = (typeof EditorModes)[number];
7
7
  export type MarkdownEditorProps = {
8
- model: EditorModel;
8
+ model?: EditorModel;
9
9
  slots?: EditorSlots;
10
10
  editorMode?: EditorMode;
11
- showWidgets?: boolean;
12
11
  extensions?: Extension[];
13
12
  onChange?: (content: string | Text) => void;
14
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAc,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,EAUL,UAAU,EACX,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,WAAW,6BAA8B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,+FAsK1B,CAAC"}
1
+ {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAc,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,EAUL,UAAU,EACX,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,WAAW,6BAA8B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,+FA+I1B,CAAC"}
@@ -15,5 +15,6 @@ export declare const Default: {
15
15
  };
16
16
  export declare const WithYjs: {
17
17
  render: () => JSX.Element;
18
+ decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R, any>[];
18
19
  };
19
20
  //# sourceMappingURL=Markdown.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;AAWxC,wBAGE;AAYF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AA2BF,eAAO,MAAM,OAAO;;CAGnB,CAAC"}
1
+ {"version":3,"file":"Markdown.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;AAWxC,wBAGE;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAIF,eAAO,MAAM,OAAO;;;CAyBnB,CAAC"}
@@ -88,13 +88,6 @@ export declare const markdownTheme: {
88
88
  '& .cm-yLineSelection': {
89
89
  margin: string;
90
90
  };
91
- '.cm-link': {
92
- color: string;
93
- textDecorationLine: string;
94
- textDecorationThickness: string;
95
- textUnderlineOffset: string;
96
- borderRadius: string;
97
- };
98
91
  };
99
- export declare const markdownHighlightStyle: HighlightStyle;
92
+ export declare const markdownDarkHighlighting: HighlightStyle;
100
93
  //# sourceMappingURL=markdownTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTheme.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/markdownTheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,eAAO,MAAM,MAAM,YAAY,CAAC;AAQhC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmJzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBA6ElC,CAAC"}
1
+ {"version":3,"file":"markdownTheme.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/markdownTheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,eAAO,MAAM,MAAM,YAAY,CAAC;AAIhC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IzB,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBA6EpC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import '@dxosTheme';
2
2
  import React from 'react';
3
+ import { type RichTextEditorProps } from './RichText';
3
4
  declare const _default: {
4
5
  component: React.ForwardRefExoticComponent<{
5
6
  model?: import("../..").EditorModel | undefined;
@@ -20,6 +21,7 @@ export declare const Default: {
20
21
  };
21
22
  };
22
23
  export declare const WithYjs: {
23
- render: () => JSX.Element;
24
+ render: (args: Omit<RichTextEditorProps, 'model'>) => JSX.Element;
25
+ decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R, any>[];
24
26
  };
25
27
  //# sourceMappingURL=RichText.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/RichText/RichText.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;;;;;AAYxC,wBAGE;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAsCF,eAAO,MAAM,OAAO;;CAGnB,CAAC"}
1
+ {"version":3,"file":"RichText.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/RichText/RichText.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;AASxC,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;;;;;;;;;;;AAGtE,wBAGE;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAGF,eAAO,MAAM,OAAO;mBACH,KAAK,mBAAmB,EAAE,OAAO,CAAC;;CAmClD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAMlB,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE;QACN,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;KAC/B,CAAC;IACF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CAC9D,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;yBAND,aAAa,QAAQ,UAAU,KAAK,IAAI;0GAkF7D,CAAC"}
1
+ {"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAMlB,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE;QACN,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;KAC/B,CAAC;IACF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CAC9D,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;yBAND,aAAa,QAAQ,UAAU,KAAK,IAAI;0GAiF7D,CAAC"}
@@ -1,5 +1,20 @@
1
1
  import '@dxosTheme';
2
+ import { HighlightStyle, StreamLanguage } from '@codemirror/language';
2
3
  import React from 'react';
4
+ export declare const nameRegex: RegExp;
5
+ /**
6
+ * Simple Monaco language extension.
7
+ * https://github.com/codemirror/stream-parser/blob/main/test/test-stream-parser.ts
8
+ */
9
+ export declare const promptLanguage: StreamLanguage<{
10
+ count: number;
11
+ }>;
12
+ /**
13
+ * https://codemirror.net/examples/styling
14
+ * https://lezer.codemirror.net/docs/ref/#highlight
15
+ */
16
+ export declare const promptHighlightStyles: HighlightStyle;
17
+ export declare const defaultHyperLinkTooltip: import("@codemirror/state").Extension;
3
18
  declare const _default: {
4
19
  component: React.ForwardRefExoticComponent<{
5
20
  model?: import("../../model").EditorModel | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAGpB,OAAO,KAA+B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;AA0DpD,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"TextEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtE,OAAO,KAA+B,MAAM,OAAO,CAAC;AAWpD,eAAO,MAAM,SAAS,QAAgB,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,cAAc;WAAkC,MAAM;EAcjE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,gBAShC,CAAC;AAEH,eAAO,MAAM,uBAAuB,uCAUlC,CAAC;;;;;;;;;;;;;;AAuBH,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -5,6 +5,6 @@ export declare function hyperLinkExtension(): ViewPlugin<{
5
5
  decorations: DecorationSet;
6
6
  update(update: ViewUpdate): void;
7
7
  }>;
8
- export declare const hyperlinkStyle: Extension;
9
- export declare const hyperlinkWidget: Extension;
10
- //# sourceMappingURL=hyperlinkWidget.d.ts.map
8
+ export declare const hyperLinkStyle: Extension;
9
+ export declare const hyperlink: Extension;
10
+ //# sourceMappingURL=hyperlink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperlink.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlink.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAEL,KAAK,aAAa,EAElB,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AA4C1B,wBAAgB,kBAAkB;wBAGR,cAAc;;mBAOnB,UAAU;GAwB9B;AAED,eAAO,MAAM,cAAc,WAYzB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,SAAkD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hyperlinkTooltip.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlinkTooltip.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAElE;;;;GAIG;AAEH,eAAO,MAAM,sBAAsB,YAAa,gBAAgB,2DA0C5D,CAAC"}
1
+ {"version":3,"file":"hyperlinkTooltip.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlinkTooltip.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,YAAa,gBAAgB,2DA0C5D,CAAC"}
@@ -1,4 +1,3 @@
1
- export * from './hyperlinkDecoration';
1
+ export * from './hyperlink';
2
2
  export * from './hyperlinkTooltip';
3
- export * from './hyperlinkWidget';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { type StyleSpec } from 'style-mod';
2
2
  /**
3
- * Minimal styles.
4
3
  * https://codemirror.net/examples/styling
5
4
  */
6
5
  export declare const defaultStyles: {
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/theme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C;;;GAGG;AAEH,eAAO,MAAM,aAAa,EAAE;IAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAiB/B,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/theme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C;;GAEG;AAEH,eAAO,MAAM,aAAa,EAAE;IAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAgB/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"code-mirror.stories.d.ts","sourceRoot":"","sources":["../../../../stories/html/code-mirror.stories.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhD,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;;;;AAS5D,wBAEE;AAoEF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAoBjF,CAAC"}
1
+ {"version":3,"file":"code-mirror.stories.d.ts","sourceRoot":"","sources":["../../../../stories/html/code-mirror.stories.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;;;;AAS5D,wBAEE;AAoEF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAoBjF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-editor",
3
- "version": "0.3.9-main.501fe30",
3
+ "version": "0.3.9-main.52d137d",
4
4
  "description": "Document editing experience within a DXOS shell.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -13,16 +13,16 @@
13
13
  "src"
14
14
  ],
15
15
  "dependencies": {
16
- "@codemirror/autocomplete": "^6.11.1",
17
- "@codemirror/commands": "^6.3.2",
18
- "@codemirror/lang-markdown": "^6.2.3",
19
- "@codemirror/language": "^6.9.3",
16
+ "@codemirror/autocomplete": "^6.11.0",
17
+ "@codemirror/commands": "^6.3.0",
18
+ "@codemirror/lang-markdown": "^6.2.2",
19
+ "@codemirror/language": "^6.9.2",
20
20
  "@codemirror/language-data": "^6.3.1",
21
21
  "@codemirror/lint": "^6.4.2",
22
- "@codemirror/search": "^6.5.5",
23
- "@codemirror/state": "^6.3.3",
22
+ "@codemirror/search": "^6.5.4",
23
+ "@codemirror/state": "^6.3.1",
24
24
  "@codemirror/theme-one-dark": "^6.1.2",
25
- "@codemirror/view": "^6.22.2",
25
+ "@codemirror/view": "^6.22.0",
26
26
  "@fluentui/react-tabster": "^9.12.0",
27
27
  "@lezer/common": "^1.1.1",
28
28
  "@lezer/highlight": "^1.2.0",
@@ -37,7 +37,7 @@
37
37
  "@tiptap/pm": "2.0.0-beta.220",
38
38
  "@tiptap/react": "2.0.0-beta.220",
39
39
  "@tiptap/starter-kit": "2.0.0-beta.220",
40
- "codemirror": "6.0.1",
40
+ "codemirror": "^6.65.7",
41
41
  "lib0": "^0.2.65",
42
42
  "lodash.get": "^4.4.2",
43
43
  "prosemirror-model": "^1.19.0",
@@ -48,36 +48,37 @@
48
48
  "y-prosemirror": "~1.0.20",
49
49
  "y-protocols": "^1.0.5",
50
50
  "yjs": "^13.6.10",
51
- "@dxos/debug": "0.3.9-main.501fe30",
52
- "@dxos/display-name": "0.3.9-main.501fe30",
53
- "@dxos/protocols": "0.3.9-main.501fe30",
54
- "@dxos/react-async": "0.3.9-main.501fe30",
55
- "@dxos/log": "0.3.9-main.501fe30",
56
- "@dxos/react-ui": "0.3.9-main.501fe30",
57
- "@dxos/react-ui-theme": "0.3.9-main.501fe30",
58
- "@dxos/util": "0.3.9-main.501fe30",
59
- "@dxos/text-model": "0.3.9-main.501fe30"
51
+ "@dxos/log": "0.3.9-main.52d137d",
52
+ "@dxos/display-name": "0.3.9-main.52d137d",
53
+ "@dxos/protocols": "0.3.9-main.52d137d",
54
+ "@dxos/react-async": "0.3.9-main.52d137d",
55
+ "@dxos/debug": "0.3.9-main.52d137d",
56
+ "@dxos/react-ui-theme": "0.3.9-main.52d137d",
57
+ "@dxos/util": "0.3.9-main.52d137d",
58
+ "@dxos/text-model": "0.3.9-main.52d137d",
59
+ "@dxos/react-ui": "0.3.9-main.52d137d"
60
60
  },
61
61
  "devDependencies": {
62
- "@automerge/automerge-repo-network-broadcastchannel": "^1.0.19",
62
+ "@codemirror/basic-setup": "^0.20.0",
63
63
  "@phosphor-icons/react": "^2.0.5",
64
+ "@types/codemirror": "^5.60.14",
64
65
  "@types/lodash.get": "^4.4.7",
65
66
  "@types/react": "^18.0.21",
66
67
  "@types/react-dom": "^18.0.6",
67
68
  "react": "^18.2.0",
68
69
  "react-dom": "^18.2.0",
69
- "@dxos/automerge": "0.3.9-main.501fe30",
70
- "@dxos/echo-typegen": "0.3.9-main.501fe30",
71
- "@dxos/echo-schema": "0.3.9-main.501fe30",
72
- "@dxos/react-client": "0.3.9-main.501fe30",
73
- "@dxos/storybook-utils": "0.3.9-main.501fe30",
74
- "@dxos/config": "0.3.9-main.501fe30"
70
+ "@dxos/echo-schema": "0.3.9-main.52d137d",
71
+ "@dxos/config": "0.3.9-main.52d137d",
72
+ "@dxos/react-client": "0.3.9-main.52d137d",
73
+ "@dxos/automerge": "0.3.9-main.52d137d",
74
+ "@dxos/storybook-utils": "0.3.9-main.52d137d",
75
+ "@dxos/echo-typegen": "0.3.9-main.52d137d"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "@phosphor-icons/react": "^2.0.5",
78
79
  "react": "^18.2.0",
79
80
  "react-dom": "^18.2.0",
80
- "@dxos/react-client": "0.3.9-main.501fe30"
81
+ "@dxos/react-client": "0.3.9-main.52d137d"
81
82
  },
82
83
  "publishConfig": {
83
84
  "access": "public"
@@ -8,8 +8,8 @@ import { next as automerge } from '@dxos/automerge/automerge';
8
8
 
9
9
  import amToCodemirror from './amToCodemirror';
10
10
  import codeMirrorToAm from './codeMirrorToAm';
11
- import { type IDocHandle } from './handle';
12
11
  import { type Field, isReconcileTx, getPath, reconcileAnnotationType, updateHeads, getLastHeads } from './plugin';
12
+ import { type Peer } from '../demo';
13
13
 
14
14
  type Doc<T> = automerge.Doc<T>;
15
15
  type Heads = automerge.Heads;
@@ -27,8 +27,8 @@ export class PatchSemaphore {
27
27
  }
28
28
  }
29
29
 
30
- reconcile = (handle: IDocHandle, view: EditorView) => {
31
- if (this._inReconcile) {
30
+ reconcile = (handle: Peer, view: EditorView) => {
31
+ if (!this._inReconcile) {
32
32
  return;
33
33
  }
34
34
  this._inReconcile = true;
@@ -56,12 +56,12 @@ export class PatchSemaphore {
56
56
  // NOTE: null and undefined each come from automerge and repo respectively
57
57
  if (newHeads === null || newHeads === undefined) {
58
58
  // TODO: @alexjg this is the call that's resetting the editor state on click
59
- newHeads = automerge.getHeads(handle.docSync()!);
59
+ newHeads = automerge.getHeads(handle.doc);
60
60
  }
61
61
 
62
62
  // now get the diff between the updated state of the document and the heads
63
63
  // and apply that to the codemirror doc
64
- const diff = automerge.equals(oldHeads, newHeads) ? [] : automerge.diff(handle.docSync()!, oldHeads, newHeads);
64
+ const diff = automerge.equals(oldHeads, newHeads) ? [] : automerge.diff(handle.doc, oldHeads, newHeads);
65
65
  amToCodemirror(view, selection, path, diff);
66
66
 
67
67
  view.dispatch({
@@ -6,24 +6,21 @@ import { type EditorState, type Text, type Transaction } from '@codemirror/state
6
6
 
7
7
  import { next as am, type Heads } from '@dxos/automerge/automerge';
8
8
 
9
- import { type IDocHandle } from './handle';
10
9
  import { type Field } from './plugin';
10
+ import { type Peer } from '../demo';
11
11
 
12
- export default (
13
- field: Field,
14
- handle: IDocHandle,
15
- transactions: Transaction[],
16
- state: EditorState,
17
- ): Heads | undefined => {
12
+ export default (field: Field, handle: Peer, transactions: Transaction[], state: EditorState): Heads | undefined => {
18
13
  const { lastHeads, path } = state.field(field);
19
14
 
20
15
  // We don't want to call `automerge.updateAt` if there are no changes.
21
16
  // Otherwise later on `automerge.diff` will return empty patches that result in a no-op but still mess up the selection.
22
17
  let hasChanges = false;
23
18
  for (const tr of transactions) {
24
- tr.changes.iterChanges(() => {
25
- hasChanges = true;
26
- });
19
+ if (tr.changes.length) {
20
+ tr.changes.iterChanges(() => {
21
+ hasChanges = true;
22
+ });
23
+ }
27
24
  }
28
25
 
29
26
  if (!hasChanges) {
@@ -2,5 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export { automergePlugin, type AutomergePlugin } from './plugin';
6
- export { type IDocHandle } from './handle';
5
+ export { plugin, reconcile } from './plugin';
6
+ export { PatchSemaphore } from './PatchSemaphore';
@@ -12,13 +12,13 @@ import {
12
12
  type Transaction,
13
13
  type TransactionSpec,
14
14
  } from '@codemirror/state';
15
- import { ViewPlugin, type EditorView, type PluginValue, type ViewUpdate } from '@codemirror/view';
15
+ import { type EditorView } from '@codemirror/view';
16
16
 
17
17
  import * as automerge from '@dxos/automerge/automerge';
18
- import { type Heads, type Prop } from '@dxos/automerge/automerge';
18
+ import { type Doc, type Heads, type Prop } from '@dxos/automerge/automerge';
19
19
 
20
20
  import { PatchSemaphore } from './PatchSemaphore';
21
- import { type IDocHandle } from './handle';
21
+ import { type Peer } from '../demo';
22
22
 
23
23
  export type Value = {
24
24
  lastHeads: Heads;
@@ -44,14 +44,10 @@ const semaphoreFacet = Facet.define<PatchSemaphore, PatchSemaphore>({
44
44
  combine: (values) => values.at(-1)!, // Take last.
45
45
  });
46
46
 
47
- export type AutomergePlugin = {
48
- extension: Extension;
49
- };
50
-
51
- export const automergePlugin = (handle: IDocHandle, path: Prop[]): AutomergePlugin => {
47
+ export const plugin = <T>(doc: Doc<T>, path: Prop[]): Extension => {
52
48
  const stateField: StateField<Value> = StateField.define({
53
49
  create: () => ({
54
- lastHeads: automerge.getHeads(handle.docSync()!),
50
+ lastHeads: automerge.getHeads(doc),
55
51
  unreconciledTransactions: [],
56
52
  path: path.slice(),
57
53
  }),
@@ -80,36 +76,7 @@ export const automergePlugin = (handle: IDocHandle, path: Prop[]): AutomergePlug
80
76
  });
81
77
  const semaphore = new PatchSemaphore(stateField);
82
78
 
83
- const viewPlugin = ViewPlugin.fromClass(
84
- class AutomergeCodemirrorViewPlugin implements PluginValue {
85
- private _view: EditorView;
86
-
87
- constructor(view: EditorView) {
88
- this._view = view;
89
- handle.addListener('change', this._handleChange);
90
- }
91
-
92
- update(update: ViewUpdate) {
93
- if (update.transactions.length > 0 && update.transactions.some((t) => !isReconcileTx(t))) {
94
- queueMicrotask(() => {
95
- this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);
96
- });
97
- }
98
- }
99
-
100
- destroy() {
101
- handle.addListener('change', this._handleChange);
102
- }
103
-
104
- private _handleChange = () => {
105
- this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);
106
- };
107
- },
108
- );
109
-
110
- return {
111
- extension: [stateField, semaphoreFacet.of(semaphore), viewPlugin],
112
- };
79
+ return [stateField, semaphoreFacet.of(semaphore)];
113
80
  };
114
81
 
115
82
  export const reconcileAnnotationType = Annotation.define<unknown>();
@@ -131,3 +98,7 @@ export const makeReconcile = (tr: TransactionSpec) => {
131
98
  // annotations: reconcileAnnotationType.of({})
132
99
  // }
133
100
  };
101
+
102
+ export const reconcile = (handle: Peer, view: EditorView) => {
103
+ view.state.facet(semaphoreFacet).reconcile(handle, view);
104
+ };