@dxos/react-ui-editor 0.3.11-main.d7d4c52 → 0.3.11-main.d8b8a39
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 +656 -680
- 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 +13 -14
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +14 -6
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TextEditor/comments.stories.d.ts +1 -1
- package/dist/types/src/components/TextEditor/comments.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/autocomplete.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/defs.d.ts +7 -9
- package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/index.d.ts +0 -1
- package/dist/types/src/extensions/automerge/index.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/semaphore.d.ts +7 -12
- package/dist/types/src/extensions/automerge/semaphore.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/update-automerge.d.ts +2 -2
- package/dist/types/src/extensions/awareness.d.ts +1 -1
- package/dist/types/src/extensions/awareness.d.ts.map +1 -1
- 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 +30 -17
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/cursor.d.ts +3 -3
- package/dist/types/src/extensions/cursor.d.ts.map +1 -1
- package/dist/types/src/extensions/hr.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +1 -1
- package/dist/types/src/extensions/index.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/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/hooks/awareness-provider.d.ts +7 -4
- package/dist/types/src/hooks/awareness-provider.d.ts.map +1 -1
- package/dist/types/src/hooks/defs.d.ts +25 -0
- package/dist/types/src/hooks/defs.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -2
- 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 -27
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/themes/default.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +2 -0
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +33 -36
- package/src/components/TextEditor/MarkdownEditor.stories.tsx +64 -69
- package/src/components/TextEditor/TextEditor.tsx +95 -70
- package/src/components/TextEditor/comments.stories.tsx +113 -71
- package/src/extensions/autocomplete.ts +6 -3
- package/src/extensions/automerge/automerge.ts +39 -45
- package/src/extensions/automerge/defs.ts +10 -31
- package/src/extensions/automerge/index.ts +0 -1
- package/src/extensions/automerge/semaphore.ts +23 -20
- package/src/extensions/automerge/update-automerge.ts +2 -2
- package/src/extensions/awareness.ts +15 -14
- package/src/extensions/basic.ts +22 -17
- package/src/extensions/code.ts +15 -17
- package/src/extensions/comments.ts +239 -136
- package/src/extensions/cursor.ts +7 -3
- package/src/extensions/hr.ts +49 -50
- package/src/extensions/index.ts +1 -1
- package/src/extensions/link.ts +3 -3
- package/src/extensions/markdown/bundle.ts +18 -24
- package/src/extensions/mention.ts +9 -2
- package/src/extensions/outliner.ts +12 -0
- package/src/extensions/tasklist.ts +76 -84
- package/src/hooks/awareness-provider.ts +24 -20
- package/src/hooks/defs.ts +42 -0
- package/src/hooks/index.ts +3 -2
- package/src/hooks/useTextEditor.ts +29 -0
- package/src/hooks/useTextModel.ts +47 -56
- package/src/themes/default.ts +0 -8
- package/src/util.ts +26 -3
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts +0 -12
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/yjs.stories.d.ts +0 -12
- package/dist/types/src/components/TextEditor/yjs.stories.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/cursor.d.ts +0 -4
- package/dist/types/src/extensions/yjs/cursor.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/index.d.ts +0 -2
- package/dist/types/src/extensions/yjs/index.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/yjs.d.ts +0 -4
- package/dist/types/src/extensions/yjs/yjs.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/yjs.test.d.ts +0 -2
- package/dist/types/src/extensions/yjs/yjs.test.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge.d.ts +0 -3
- package/dist/types/src/hooks/automerge.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs.d.ts +0 -27
- package/dist/types/src/hooks/yjs.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/proto/gen/schema.d.ts +0 -15
- package/dist/types/src/testing/proto/gen/schema.d.ts.map +0 -1
- package/dist/types/src/testing/proto/index.d.ts +0 -2
- package/dist/types/src/testing/proto/index.d.ts.map +0 -1
- package/dist/types/src/testing/replicator.d.ts +0 -45
- package/dist/types/src/testing/replicator.d.ts.map +0 -1
- package/src/components/TextEditor/codemirror.stories.ts +0 -115
- package/src/components/TextEditor/yjs.stories.tsx +0 -56
- package/src/extensions/yjs/cursor.ts +0 -22
- package/src/extensions/yjs/index.ts +0 -5
- package/src/extensions/yjs/yjs.test.ts +0 -35
- package/src/extensions/yjs/yjs.ts +0 -16
- package/src/hooks/automerge.ts +0 -52
- package/src/hooks/yjs.ts +0 -156
- package/src/testing/index.ts +0 -6
- package/src/testing/proto/gen/schema.ts +0 -49
- package/src/testing/proto/index.ts +0 -5
- package/src/testing/proto/schema.proto +0 -15
- package/src/testing/replicator.ts +0 -184
|
@@ -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
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
|
*/
|
|
@@ -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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Facet } from '@codemirror/state';
|
|
1
|
+
import { type EditorState, Facet } from '@codemirror/state';
|
|
2
2
|
import type { Range } from '../hooks';
|
|
3
3
|
/**
|
|
4
4
|
* Converts indexes into the text document into stable peer-independent cursors.
|
|
@@ -16,8 +16,8 @@ export interface CursorConverter {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class Cursor {
|
|
18
18
|
static readonly converter: Facet<CursorConverter, CursorConverter>;
|
|
19
|
-
static readonly getCursorFromRange: (
|
|
20
|
-
static readonly getRangeFromCursor: (
|
|
19
|
+
static readonly getCursorFromRange: (state: EditorState, range: Range) => string;
|
|
20
|
+
static readonly getRangeFromCursor: (state: EditorState, cursor: string) => {
|
|
21
21
|
from: number;
|
|
22
22
|
to: number;
|
|
23
23
|
} | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
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":"
|
|
1
|
+
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../../../src/extensions/hr.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,EAAE,+CAoBd,CAAC"}
|
|
@@ -12,8 +12,8 @@ export * from './link';
|
|
|
12
12
|
export * from './listener';
|
|
13
13
|
export * from './markdown';
|
|
14
14
|
export * from './mention';
|
|
15
|
+
export * from './outliner';
|
|
15
16
|
export * from './table';
|
|
16
17
|
export * from './tasklist';
|
|
17
18
|
export * from './typewriter';
|
|
18
|
-
export * from './yjs';
|
|
19
19
|
//# 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,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,
|
|
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,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":"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"}
|
|
@@ -7,21 +7,24 @@ export type AwarenessProviderParams = {
|
|
|
7
7
|
peerId: string;
|
|
8
8
|
info: AwarenessInfo;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Receives and broadcasts profile and cursor position.
|
|
12
|
+
*/
|
|
10
13
|
export declare class SpaceAwarenessProvider implements AwarenessProvider {
|
|
11
|
-
readonly remoteStateChange: Event<void>;
|
|
12
14
|
private readonly _remoteStates;
|
|
13
15
|
private readonly _space;
|
|
14
16
|
private readonly _channel;
|
|
15
17
|
private readonly _peerId;
|
|
16
18
|
private readonly _info;
|
|
17
|
-
private _localState?;
|
|
18
|
-
private _postTask?;
|
|
19
19
|
private _ctx?;
|
|
20
|
+
private _postTask?;
|
|
21
|
+
private _localState?;
|
|
22
|
+
readonly remoteStateChange: Event<void>;
|
|
20
23
|
constructor(params: AwarenessProviderParams);
|
|
21
24
|
open(): void;
|
|
22
25
|
close(): void;
|
|
23
|
-
update(position: AwarenessPosition | undefined): void;
|
|
24
26
|
getRemoteStates(): AwarenessState[];
|
|
27
|
+
update(position: AwarenessPosition | undefined): void;
|
|
25
28
|
private _handleQueryMessage;
|
|
26
29
|
private _handlePostMessage;
|
|
27
30
|
}
|
|
@@ -1 +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,
|
|
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 +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,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,31 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type * as YP 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
|
-
/**
|
|
7
|
-
* State field makes the model available to other extensions.
|
|
8
|
-
*/
|
|
9
|
-
export declare const modelState: StateField<EditorModel | undefined>;
|
|
10
|
-
export type Range = {
|
|
11
|
-
from: number;
|
|
12
|
-
to: number;
|
|
13
|
-
};
|
|
14
|
-
export type CommentRange = {
|
|
15
|
-
id: string;
|
|
16
|
-
cursor: string;
|
|
17
|
-
};
|
|
18
|
-
export type EditorModel = {
|
|
19
|
-
id: string;
|
|
20
|
-
text: () => string;
|
|
21
|
-
extension?: Extension;
|
|
22
|
-
content: string | YText | YXmlFragment | DocAccessor;
|
|
23
|
-
awareness?: YP.Awareness;
|
|
24
|
-
peer?: {
|
|
25
|
-
id: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
3
|
+
import { type EditorModel } from './defs';
|
|
29
4
|
export type UseTextModelProps = {
|
|
30
5
|
identity?: Identity | null;
|
|
31
6
|
space?: Space;
|
|
@@ -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":"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 +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,
|
|
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"}
|
package/dist/types/src/util.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Transaction } from '@codemirror/state';
|
|
1
2
|
/**
|
|
2
3
|
* CodeMirror callbacks swallow errors so wrap handlers.
|
|
3
4
|
*/
|
|
4
5
|
export declare const callbackWrapper: <T extends Function>(fn: T) => T;
|
|
6
|
+
export declare const logChanges: (trs: readonly Transaction[]) => void;
|
|
5
7
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-editor",
|
|
3
|
-
"version": "0.3.11-main.
|
|
3
|
+
"version": "0.3.11-main.d8b8a39",
|
|
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,20 +13,20 @@
|
|
|
13
13
|
"src"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@codemirror/autocomplete": "^6.
|
|
17
|
-
"@codemirror/commands": "^6.3.
|
|
18
|
-
"@codemirror/lang-markdown": "^6.2.
|
|
19
|
-
"@codemirror/language": "^6.
|
|
16
|
+
"@codemirror/autocomplete": "^6.12.0",
|
|
17
|
+
"@codemirror/commands": "^6.3.3",
|
|
18
|
+
"@codemirror/lang-markdown": "^6.2.4",
|
|
19
|
+
"@codemirror/language": "^6.10.0",
|
|
20
20
|
"@codemirror/language-data": "^6.3.1",
|
|
21
21
|
"@codemirror/lint": "^6.4.2",
|
|
22
22
|
"@codemirror/search": "^6.5.5",
|
|
23
|
-
"@codemirror/state": "^6.
|
|
23
|
+
"@codemirror/state": "^6.4.0",
|
|
24
24
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
25
|
-
"@codemirror/view": "^6.
|
|
25
|
+
"@codemirror/view": "^6.23.0",
|
|
26
26
|
"@fluentui/react-tabster": "^9.16.1",
|
|
27
|
-
"@lezer/common": "^1.
|
|
27
|
+
"@lezer/common": "^1.2.1",
|
|
28
28
|
"@lezer/highlight": "^1.2.0",
|
|
29
|
-
"@lezer/markdown": "^1.
|
|
29
|
+
"@lezer/markdown": "^1.2.0",
|
|
30
30
|
"@replit/codemirror-vim": "^6.0.14",
|
|
31
31
|
"codemirror": "6.0.1",
|
|
32
32
|
"lib0": "^0.2.65",
|
|
@@ -35,27 +35,24 @@
|
|
|
35
35
|
"lodash.pick": "^4.4.0",
|
|
36
36
|
"lodash.sortby": "^4.7.0",
|
|
37
37
|
"style-mod": "^4.1.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/context": "0.3.11-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-ui-theme": "0.3.11-main.d7d4c52",
|
|
53
|
-
"@dxos/text-model": "0.3.11-main.d7d4c52",
|
|
54
|
-
"@dxos/util": "0.3.11-main.d7d4c52"
|
|
38
|
+
"@dxos/async": "0.3.11-main.d8b8a39",
|
|
39
|
+
"@dxos/debug": "0.3.11-main.d8b8a39",
|
|
40
|
+
"@dxos/automerge": "0.3.11-main.d8b8a39",
|
|
41
|
+
"@dxos/display-name": "0.3.11-main.d8b8a39",
|
|
42
|
+
"@dxos/context": "0.3.11-main.d8b8a39",
|
|
43
|
+
"@dxos/echo-schema": "0.3.11-main.d8b8a39",
|
|
44
|
+
"@dxos/invariant": "0.3.11-main.d8b8a39",
|
|
45
|
+
"@dxos/log": "0.3.11-main.d8b8a39",
|
|
46
|
+
"@dxos/protocols": "0.3.11-main.d8b8a39",
|
|
47
|
+
"@dxos/react-ui": "0.3.11-main.d8b8a39",
|
|
48
|
+
"@dxos/react-async": "0.3.11-main.d8b8a39",
|
|
49
|
+
"@dxos/react-ui-theme": "0.3.11-main.d8b8a39",
|
|
50
|
+
"@dxos/text-model": "0.3.11-main.d8b8a39",
|
|
51
|
+
"@dxos/util": "0.3.11-main.d8b8a39"
|
|
55
52
|
},
|
|
56
53
|
"devDependencies": {
|
|
57
54
|
"@automerge/automerge-repo-network-broadcastchannel": "^1.0.19",
|
|
58
|
-
"@faker-js/faker": "^8.
|
|
55
|
+
"@faker-js/faker": "^8.3.1",
|
|
59
56
|
"@phosphor-icons/react": "^2.0.5",
|
|
60
57
|
"@preact/signals-react": "^1.3.6",
|
|
61
58
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
@@ -67,24 +64,24 @@
|
|
|
67
64
|
"deepsignal": "1.4.0-shallow.0",
|
|
68
65
|
"react": "^18.2.0",
|
|
69
66
|
"react-dom": "^18.2.0",
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/echo-typegen": "0.3.11-main.
|
|
73
|
-
"@dxos/keyboard": "0.3.11-main.
|
|
74
|
-
"@dxos/react-client": "0.3.11-main.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
67
|
+
"@dxos/config": "0.3.11-main.d8b8a39",
|
|
68
|
+
"@dxos/echo-signals": "0.3.11-main.d8b8a39",
|
|
69
|
+
"@dxos/echo-typegen": "0.3.11-main.d8b8a39",
|
|
70
|
+
"@dxos/keyboard": "0.3.11-main.d8b8a39",
|
|
71
|
+
"@dxos/react-client": "0.3.11-main.d8b8a39",
|
|
72
|
+
"@dxos/react-ui": "0.3.11-main.d8b8a39",
|
|
73
|
+
"@dxos/storybook-utils": "0.3.11-main.d8b8a39"
|
|
77
74
|
},
|
|
78
75
|
"peerDependencies": {
|
|
79
76
|
"@phosphor-icons/react": "^2.0.5",
|
|
80
77
|
"react": "^18.2.0",
|
|
81
78
|
"react-dom": "^18.2.0",
|
|
82
|
-
"@dxos/react-client": "0.3.11-main.
|
|
79
|
+
"@dxos/react-client": "0.3.11-main.d8b8a39"
|
|
83
80
|
},
|
|
84
81
|
"publishConfig": {
|
|
85
82
|
"access": "public"
|
|
86
83
|
},
|
|
87
84
|
"scripts": {
|
|
88
|
-
"
|
|
85
|
+
"test": "true"
|
|
89
86
|
}
|
|
90
87
|
}
|