@dxos/react-ui-editor 0.3.11-main.a996413 → 0.3.11-main.b00882f
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.
- package/dist/lib/browser/index.mjs +2010 -1505
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts +16 -13
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +20 -17
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +6 -3
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/{hooks/automerge → components/TextEditor}/automerge.stories.d.ts +6 -1
- package/dist/types/src/components/TextEditor/automerge.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/comments.stories.d.ts +26 -0
- package/dist/types/src/components/TextEditor/comments.stories.d.ts.map +1 -0
- package/dist/types/src/{hooks/yjs → components/TextEditor}/yjs.stories.d.ts +1 -1
- package/dist/types/src/components/TextEditor/yjs.stories.d.ts.map +1 -0
- package/dist/types/src/extensions/autocomplete.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.d.ts +9 -0
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/cursor.d.ts +5 -0
- package/dist/types/src/extensions/automerge/cursor.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/defs.d.ts +24 -0
- package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/index.d.ts +3 -0
- package/dist/types/src/extensions/automerge/index.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/semaphore.d.ts +14 -0
- package/dist/types/src/extensions/automerge/semaphore.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/update-automerge.d.ts +5 -0
- package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/update-codemirror.d.ts.map +1 -0
- package/dist/types/src/extensions/awareness.d.ts +48 -0
- package/dist/types/src/extensions/awareness.d.ts.map +1 -0
- package/dist/types/src/extensions/basic.d.ts +4 -5
- package/dist/types/src/extensions/basic.d.ts.map +1 -1
- package/dist/types/src/extensions/code.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts +32 -19
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/cursor.d.ts +25 -0
- package/dist/types/src/extensions/cursor.d.ts.map +1 -0
- package/dist/types/src/extensions/hr.d.ts.map +1 -1
- package/dist/types/src/extensions/image.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +5 -1
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/link.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/bundle.d.ts +2 -5
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
- package/dist/types/src/extensions/mention.d.ts.map +1 -1
- package/dist/types/src/extensions/outliner.d.ts +4 -0
- package/dist/types/src/extensions/outliner.d.ts.map +1 -0
- package/dist/types/src/extensions/tasklist.d.ts.map +1 -1
- package/dist/types/src/extensions/yjs/cursor.d.ts +4 -0
- package/dist/types/src/extensions/yjs/cursor.d.ts.map +1 -0
- package/dist/types/src/extensions/yjs/index.d.ts +2 -0
- package/dist/types/src/extensions/yjs/index.d.ts.map +1 -0
- package/dist/types/src/extensions/yjs/yjs.d.ts +4 -0
- package/dist/types/src/extensions/yjs/yjs.d.ts.map +1 -0
- package/dist/types/src/extensions/yjs/yjs.test.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge.d.ts +4 -0
- package/dist/types/src/hooks/automerge.d.ts.map +1 -0
- package/dist/types/src/hooks/awareness-provider.d.ts +28 -0
- package/dist/types/src/hooks/awareness-provider.d.ts.map +1 -0
- package/dist/types/src/hooks/defs.d.ts +28 -0
- package/dist/types/src/hooks/defs.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextEditor.d.ts +17 -0
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextModel.d.ts +2 -31
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/hooks/{yjs/space-provider.d.ts → yjs.d.ts} +9 -8
- package/dist/types/src/hooks/yjs.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/styles/cursors.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +1 -0
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/dist/types/src/styles/markdown.d.ts.map +1 -1
- package/dist/types/src/styles/tokens.d.ts +1 -0
- package/dist/types/src/styles/tokens.d.ts.map +1 -1
- package/dist/types/src/testing/replicator.d.ts +2 -2
- package/dist/types/src/testing/replicator.d.ts.map +1 -1
- package/dist/types/src/themes/default.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +7 -0
- package/dist/types/src/util.d.ts.map +1 -0
- package/package.json +32 -30
- package/src/components/TextEditor/MarkdownEditor.stories.tsx +77 -80
- package/src/components/TextEditor/TextEditor.stories.tsx +13 -34
- package/src/components/TextEditor/TextEditor.tsx +125 -93
- package/src/{hooks/automerge → components/TextEditor}/automerge.stories.tsx +66 -6
- package/src/components/TextEditor/codemirror.stories.ts +3 -2
- package/src/components/TextEditor/comments.stories.tsx +357 -0
- package/src/{hooks/yjs → components/TextEditor}/yjs.stories.tsx +1 -1
- package/src/extensions/autocomplete.ts +23 -19
- package/src/extensions/automerge/automerge.ts +88 -0
- package/src/extensions/automerge/cursor.ts +52 -0
- package/src/extensions/automerge/defs.ts +41 -0
- package/src/extensions/automerge/index.ts +6 -0
- package/src/{hooks → extensions}/automerge/semaphore.ts +34 -29
- package/src/{hooks → extensions}/automerge/update-automerge.ts +5 -6
- package/src/{hooks → extensions}/automerge/update-codemirror.ts +13 -5
- package/src/extensions/awareness.ts +327 -0
- package/src/extensions/basic.ts +22 -17
- package/src/extensions/code.ts +28 -23
- package/src/extensions/comments.ts +252 -229
- package/src/extensions/cursor.ts +50 -0
- package/src/extensions/hr.ts +50 -52
- package/src/extensions/image.ts +40 -22
- package/src/extensions/index.ts +5 -1
- package/src/extensions/link.ts +86 -88
- package/src/extensions/markdown/bundle.ts +18 -24
- package/src/extensions/markdown/highlight.ts +3 -12
- package/src/extensions/mention.ts +9 -2
- package/src/extensions/outliner.ts +12 -0
- package/src/extensions/table.ts +10 -4
- package/src/extensions/tasklist.ts +78 -88
- package/src/extensions/yjs/cursor.ts +22 -0
- package/src/extensions/yjs/index.ts +5 -0
- package/src/{hooks → extensions}/yjs/yjs.test.ts +2 -26
- package/src/extensions/yjs/yjs.ts +16 -0
- package/src/hooks/automerge.ts +53 -0
- package/src/hooks/awareness-provider.ts +120 -0
- package/src/hooks/defs.ts +47 -0
- package/src/hooks/index.ts +6 -1
- package/src/hooks/useTextEditor.ts +29 -0
- package/src/hooks/useTextModel.ts +9 -129
- package/src/hooks/{yjs/space-provider.ts → yjs.ts} +50 -19
- package/src/index.ts +3 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/markdown.ts +0 -2
- package/src/styles/tokens.ts +3 -0
- package/src/testing/replicator.ts +10 -15
- package/src/themes/default.ts +51 -78
- package/src/util.ts +41 -0
- package/dist/types/src/extensions/mermaid.d.ts +0 -3
- package/dist/types/src/extensions/mermaid.d.ts.map +0 -1
- package/dist/types/src/extensions/util.d.ts +0 -5
- package/dist/types/src/extensions/util.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/automerge.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/handle.d.ts +0 -9
- package/dist/types/src/hooks/automerge/handle.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/index.d.ts +0 -3
- package/dist/types/src/hooks/automerge/index.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/plugin.d.ts +0 -26
- package/dist/types/src/hooks/automerge/plugin.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/semaphore.d.ts +0 -19
- package/dist/types/src/hooks/automerge/semaphore.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/update-automerge.d.ts +0 -6
- package/dist/types/src/hooks/automerge/update-automerge.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/update-codemirror.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/cursors.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/index.d.ts +0 -3
- package/dist/types/src/hooks/yjs/index.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/space-provider.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/yjs.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/yjs.test.d.ts.map +0 -1
- package/src/extensions/mermaid.ts +0 -11
- package/src/extensions/util.ts +0 -18
- package/src/hooks/automerge/handle.ts +0 -14
- package/src/hooks/automerge/index.ts +0 -6
- package/src/hooks/automerge/plugin.ts +0 -132
- package/src/hooks/yjs/index.ts +0 -6
- /package/dist/types/src/{hooks → extensions}/automerge/update-codemirror.d.ts +0 -0
- /package/dist/types/src/{hooks → extensions}/yjs/yjs.test.d.ts +0 -0
- /package/dist/types/src/{hooks/yjs → styles}/cursors.d.ts +0 -0
- /package/src/{hooks/yjs → styles}/cursors.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-automerge.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/update-automerge.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAErD,eAAO,MAAM,eAAe,UACnB,WAAW,KAAK,CAAC,UAChB,UAAU,gBACJ,WAAW,EAAE,SACpB,WAAW,KACjB,KAAK,GAAG,SAyBV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-codemirror.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/update-codemirror.ts"],"names":[],"mappings":"AAMA,OAAO,EAA8B,KAAK,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,IAAI,EAGV,MAAM,2BAA2B,CAAC;AAInC,eAAO,MAAM,gBAAgB,SAAU,UAAU,aAAa,eAAe,UAAU,IAAI,EAAE,WAAW,KAAK,EAAE,SAiB9G,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
import { type EditorModel } from '../hooks';
|
|
5
|
+
export interface AwarenessProvider {
|
|
6
|
+
remoteStateChange: Event<void>;
|
|
7
|
+
open(): void;
|
|
8
|
+
close(): void;
|
|
9
|
+
update(position: AwarenessPosition | undefined): void;
|
|
10
|
+
getRemoteStates(): AwarenessState[];
|
|
11
|
+
}
|
|
12
|
+
export declare const AwarenessProvider: Facet<AwarenessProvider, AwarenessProvider>;
|
|
13
|
+
export type AwarenessPosition = {
|
|
14
|
+
anchor?: string;
|
|
15
|
+
head?: string;
|
|
16
|
+
};
|
|
17
|
+
export type AwarenessInfo = {
|
|
18
|
+
displayName?: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
lightColor?: string;
|
|
21
|
+
};
|
|
22
|
+
export type AwarenessState = {
|
|
23
|
+
position?: AwarenessPosition;
|
|
24
|
+
peerId: string;
|
|
25
|
+
info: AwarenessInfo;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Extension provides presence information about other peers.
|
|
29
|
+
*/
|
|
30
|
+
export declare const awareness: (provider?: AwarenessProvider) => Extension;
|
|
31
|
+
export declare const useAwareness: ({ awareness, peer }: EditorModel) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Generates selection decorations from remote peers.
|
|
34
|
+
*/
|
|
35
|
+
export declare class RemoteSelectionsDecorator implements PluginValue {
|
|
36
|
+
decorations: DecorationSet;
|
|
37
|
+
private readonly _ctx;
|
|
38
|
+
private _cursorConverter;
|
|
39
|
+
private _provider;
|
|
40
|
+
private _lastAnchor?;
|
|
41
|
+
private _lastHead?;
|
|
42
|
+
constructor(view: EditorView);
|
|
43
|
+
destroy(): void;
|
|
44
|
+
update(update: ViewUpdate): void;
|
|
45
|
+
private _updateLocalSelection;
|
|
46
|
+
private _updateRemoteSelections;
|
|
47
|
+
}
|
|
48
|
+
//# 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;AAG1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOpC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IAEd,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,CAAC;IACtD,eAAe,IAAI,cAAc,EAAE,CAAC;CACrC;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,eAAO,MAAM,YAAY,wBAAyB,WAAW,SAW5D,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"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import type
|
|
2
|
+
import { type ThemeMode } from '@dxos/react-ui';
|
|
3
|
+
import { type TextEditorProps } from '../components';
|
|
3
4
|
export type BasicBundleOptions = {
|
|
4
|
-
readonly?: boolean;
|
|
5
5
|
themeMode?: ThemeMode;
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export declare const basicBundle: ({ readonly, themeMode, placeholder: _placeholder }: BasicBundleOptions) => Extension[];
|
|
6
|
+
} & Pick<TextEditorProps, 'placeholder' | 'lineWrapping'>;
|
|
7
|
+
export declare const basicBundle: ({ themeMode, placeholder: _placeholder, lineWrapping, }: BasicBundleOptions) => Extension[];
|
|
9
8
|
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../src/extensions/basic.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../../src/extensions/code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../../src/extensions/code.ts"],"names":[],"mappings":"AAsDA,eAAO,MAAM,IAAI,+CAiDhB,CAAC"}
|
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
import { type Extension } from '@codemirror/state';
|
|
2
2
|
import { EditorView, type Rect } from '@codemirror/view';
|
|
3
|
-
import { type
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
type ExtendedCommentRange = Range & CommentRange & {
|
|
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
|
-
|
|
12
|
-
|
|
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 setFocus: (view: EditorView,
|
|
15
|
-
export declare const
|
|
16
|
-
|
|
17
|
-
comments: CommentRange[];
|
|
18
|
-
}>;
|
|
19
|
-
export declare const setSelection: import("@codemirror/state").StateEffectType<CommentSelected>;
|
|
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>;
|
|
20
20
|
export type CommentsOptions = {
|
|
21
|
+
/**
|
|
22
|
+
* Key shortcut to create a new thread.
|
|
23
|
+
*/
|
|
21
24
|
key?: string;
|
|
22
|
-
footnote?: boolean;
|
|
23
25
|
/**
|
|
24
26
|
* Called to create a new thread and return the thread id.
|
|
25
27
|
*/
|
|
26
|
-
onCreate?: (
|
|
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;
|
|
27
37
|
/**
|
|
28
38
|
* Called to notify which thread is currently closest to the cursor.
|
|
29
39
|
*/
|
|
@@ -31,7 +41,7 @@ export type CommentsOptions = {
|
|
|
31
41
|
/**
|
|
32
42
|
* Called to render tooltip.
|
|
33
43
|
*/
|
|
34
|
-
onHover?: (el: Element) => void;
|
|
44
|
+
onHover?: (el: Element, shortcut: string) => void;
|
|
35
45
|
};
|
|
36
46
|
/**
|
|
37
47
|
* Comment threads.
|
|
@@ -42,9 +52,12 @@ export type CommentsOptions = {
|
|
|
42
52
|
* 4). Tracks the current cursor position to:
|
|
43
53
|
* a). Update the decoration to show if the cursor is within a current selection.
|
|
44
54
|
* b). Calls a handler to indicate which is the closest selection (e.g., to update the thread sidebar).
|
|
45
|
-
* 5). Optionally,
|
|
46
|
-
* 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.
|
|
47
56
|
*/
|
|
48
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;
|
|
49
62
|
export {};
|
|
50
63
|
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../src/extensions/comments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../../../src/extensions/hr.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,EAAE,+
|
|
1
|
+
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../../../src/extensions/hr.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,EAAE,+CAoBd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
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,16 +1,20 @@
|
|
|
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 './
|
|
15
|
+
export * from './outliner';
|
|
13
16
|
export * from './table';
|
|
14
17
|
export * from './tasklist';
|
|
15
18
|
export * from './typewriter';
|
|
19
|
+
export * from './yjs';
|
|
16
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,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,
|
|
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;AAC7B,cAAc,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../src/extensions/link.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
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"}
|
|
@@ -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
|
-
|
|
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
|
*/
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1 +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;
|
|
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 @@
|
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasklist.d.ts","sourceRoot":"","sources":["../../../../src/extensions/tasklist.ts"],"names":[],"mappings":"
|
|
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":"cursor.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/cursor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,eAAO,MAAM,eAAe,SAAU,MAAM,KAAG,eAW7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yjs.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/yjs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAK9C,eAAO,MAAM,GAAG,YAAa,KAAK,cAAc,GAAG,SAAS,4CAG3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yjs.test.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/yjs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automerge.d.ts","sourceRoot":"","sources":["../../../../src/hooks/automerge.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,eAAO,MAAM,oBAAoB,8BAA+B,iBAAiB,KAAG,WAqCnF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
export declare class SpaceAwarenessProvider implements AwarenessProvider {
|
|
11
|
+
readonly remoteStateChange: Event<void>;
|
|
12
|
+
private readonly _remoteStates;
|
|
13
|
+
private readonly _space;
|
|
14
|
+
private readonly _channel;
|
|
15
|
+
private readonly _peerId;
|
|
16
|
+
private readonly _info;
|
|
17
|
+
private _localState?;
|
|
18
|
+
private _postTask?;
|
|
19
|
+
private _ctx?;
|
|
20
|
+
constructor(params: AwarenessProviderParams);
|
|
21
|
+
open(): void;
|
|
22
|
+
close(): void;
|
|
23
|
+
update(position: AwarenessPosition | undefined): void;
|
|
24
|
+
getRemoteStates(): AwarenessState[];
|
|
25
|
+
private _handleQueryMessage;
|
|
26
|
+
private _handlePostMessage;
|
|
27
|
+
}
|
|
28
|
+
//# 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,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,SAAgB,iBAAiB,cAAqB;IAEtD,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,WAAW,CAAC,CAAiB;IACrC,OAAO,CAAC,SAAS,CAAC,CAAe;IACjC,OAAO,CAAC,IAAI,CAAC,CAAU;gBAEX,MAAM,EAAE,uBAAuB;IAO3C,IAAI;IAoCJ,KAAK;IAML,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI;IAWrD,eAAe,IAAI,cAAc,EAAE;IAInC,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,kBAAkB;CAK3B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Extension, StateField } from '@codemirror/state';
|
|
2
|
+
import type * as YP from 'y-protocols/awareness';
|
|
3
|
+
import { type DocAccessor } from '@dxos/echo-schema';
|
|
4
|
+
import type { YText, YXmlFragment } from '@dxos/text-model';
|
|
5
|
+
export type Range = {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
};
|
|
9
|
+
export type Comment = {
|
|
10
|
+
id: string;
|
|
11
|
+
cursor?: string;
|
|
12
|
+
};
|
|
13
|
+
export type EditorModel = {
|
|
14
|
+
id: string;
|
|
15
|
+
text: () => string;
|
|
16
|
+
extension?: Extension;
|
|
17
|
+
content: string | YText | YXmlFragment | DocAccessor;
|
|
18
|
+
awareness?: YP.Awareness;
|
|
19
|
+
peer?: {
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* State field makes the model available to other extensions.
|
|
26
|
+
*/
|
|
27
|
+
export declare const modelState: StateField<EditorModel | undefined>;
|
|
28
|
+
//# 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;AAC/D,OAAO,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG5D,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,KAAK,GAAG,YAAY,GAAG,WAAW,CAAC;IAGrD,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC;IAGzB,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AAEtB,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
|
|
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
|
|
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 | undefined;
|
|
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":"
|
|
1
|
+
{"version":3,"file":"useTextModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextModel.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAI1C,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,27 +1,28 @@
|
|
|
1
1
|
import { Observable } from 'lib0/observable';
|
|
2
|
-
import * as
|
|
2
|
+
import * as YP from 'y-protocols/awareness';
|
|
3
3
|
import { type Doc } from 'yjs';
|
|
4
4
|
import { type Space } from '@dxos/react-client/echo';
|
|
5
|
-
type
|
|
5
|
+
import { type EditorModel } from './defs';
|
|
6
|
+
import { type UseTextModelProps } from './useTextModel';
|
|
7
|
+
export declare const createYjsModel: ({ identity, space, text }: UseTextModelProps) => EditorModel;
|
|
6
8
|
/**
|
|
7
9
|
* Yjs awareness provider on top of a DXOS space.
|
|
8
10
|
*/
|
|
9
|
-
export declare class
|
|
11
|
+
export declare class YAwarenessProvider extends Observable<any> {
|
|
10
12
|
private readonly _space;
|
|
11
13
|
private readonly _awareness;
|
|
12
14
|
private readonly _clientId;
|
|
13
15
|
private readonly _channel;
|
|
14
|
-
constructor({ space, doc, channel, awareness }: {
|
|
16
|
+
constructor({ space, doc, channel, awareness, }: {
|
|
15
17
|
space: Space;
|
|
16
18
|
doc: Doc;
|
|
17
19
|
channel: string;
|
|
18
|
-
awareness?: Awareness;
|
|
20
|
+
awareness?: YP.Awareness;
|
|
19
21
|
});
|
|
20
|
-
get awareness(): Awareness;
|
|
22
|
+
get awareness(): YP.Awareness;
|
|
21
23
|
private _handleAwarenessUpdate;
|
|
22
24
|
private _handleSpaceMessage;
|
|
23
25
|
private _readMessage;
|
|
24
26
|
private _handleBeforeUnload;
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=space-provider.d.ts.map
|
|
28
|
+
//# sourceMappingURL=yjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yjs.d.ts","sourceRoot":"","sources":["../../../../src/hooks/yjs.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAI/B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,eAAO,MAAM,cAAc,8BAA+B,iBAAiB,KAAG,WAqB7E,CAAC;AAOF;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,UAAU,CAAC,GAAG,CAAC;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,EACV,KAAK,EACL,GAAG,EACH,OAAO,EACP,SAAS,GACV,EAAE;QACD,KAAK,EAAE,KAAK,CAAC;QACb,GAAG,EAAE,GAAG,CAAC;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC;KAC1B;IA4BD,IAAI,SAAS,IAAI,EAAE,CAAC,SAAS,CAE5B;IAED,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,YAAY;IAoCpB,OAAO,CAAC,mBAAmB;CAG5B"}
|
|
@@ -1,8 +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';
|
|
5
6
|
export * from './extensions';
|
|
6
7
|
export * from './hooks';
|
|
8
|
+
export { getToken } from './styles';
|
|
7
9
|
export * from './themes';
|
|
10
|
+
export * from './util';
|
|
8
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,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,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 +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;
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/styles/tokens.ts"],"names":[],"mappings":"
|
|
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"}
|