@dxos/react-ui-editor 0.8.1 → 0.8.2-main.f081794
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 +499 -371
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +67 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/node/index.cjs +515 -379
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +101 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +499 -371
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +69 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/EditorToolbar/util.d.ts +3 -3
- package/dist/types/src/components/EditorToolbar/util.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/{viewMode.d.ts → view-mode.d.ts} +1 -1
- package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +1 -0
- package/dist/types/src/defaults.d.ts +1 -0
- package/dist/types/src/defaults.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/command/action.d.ts +17 -0
- package/dist/types/src/extensions/command/action.d.ts.map +1 -0
- package/dist/types/src/extensions/command/command.d.ts +5 -10
- package/dist/types/src/extensions/command/command.d.ts.map +1 -1
- package/dist/types/src/extensions/command/hint.d.ts +4 -2
- package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
- package/dist/types/src/extensions/command/index.d.ts +1 -0
- package/dist/types/src/extensions/command/index.d.ts.map +1 -1
- package/dist/types/src/extensions/command/menu.d.ts +7 -2
- package/dist/types/src/extensions/command/menu.d.ts.map +1 -1
- package/dist/types/src/extensions/command/state.d.ts +9 -11
- package/dist/types/src/extensions/command/state.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts +9 -7
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +1 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts +4 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/formatting.d.ts +2 -2
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/link.d.ts +4 -1
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -1
- package/dist/types/src/extensions/preview/index.d.ts +2 -0
- package/dist/types/src/extensions/preview/index.d.ts.map +1 -0
- package/dist/types/src/extensions/preview/preview.d.ts +39 -0
- package/dist/types/src/extensions/preview/preview.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextEditor.d.ts +2 -1
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
- package/dist/types/src/{InputMode.stories.d.ts → stories/InputMode.stories.d.ts} +1 -1
- package/dist/types/src/stories/InputMode.stories.d.ts.map +1 -0
- package/dist/types/src/{TextEditor.stories.d.ts → stories/TextEditorBasic.stories.d.ts} +2 -35
- package/dist/types/src/stories/TextEditorBasic.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TextEditorComments.stories.d.ts +13 -0
- package/dist/types/src/stories/TextEditorComments.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts +13 -0
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts +19 -0
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts.map +1 -0
- package/dist/types/src/stories/story-utils.d.ts +53 -0
- package/dist/types/src/stories/story-utils.d.ts.map +1 -0
- package/dist/types/src/testing/RefPopover.d.ts +21 -0
- package/dist/types/src/testing/RefPopover.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +5 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/react.d.ts +6 -1
- package/dist/types/src/util/react.d.ts.map +1 -1
- package/package.json +33 -27
- package/src/components/EditorToolbar/EditorToolbar.tsx +2 -2
- package/src/components/EditorToolbar/util.ts +3 -3
- package/src/defaults.ts +5 -3
- package/src/extensions/automerge/automerge.stories.tsx +3 -11
- package/src/extensions/command/action.ts +49 -0
- package/src/extensions/command/command.ts +9 -27
- package/src/extensions/command/hint.ts +33 -30
- package/src/extensions/command/index.ts +1 -0
- package/src/extensions/command/menu.ts +11 -8
- package/src/extensions/command/state.ts +41 -61
- package/src/extensions/comments.ts +9 -9
- package/src/extensions/folding.tsx +1 -1
- package/src/extensions/index.ts +1 -0
- package/src/extensions/markdown/decorate.ts +4 -3
- package/src/extensions/markdown/formatting.ts +2 -2
- package/src/extensions/markdown/image.ts +12 -11
- package/src/extensions/markdown/link.ts +33 -24
- package/src/extensions/preview/index.ts +5 -0
- package/src/extensions/preview/preview.ts +271 -0
- package/src/hooks/useTextEditor.ts +4 -3
- package/src/{InputMode.stories.tsx → stories/InputMode.stories.tsx} +4 -4
- package/src/stories/TextEditorBasic.stories.tsx +289 -0
- package/src/stories/TextEditorComments.stories.tsx +99 -0
- package/src/stories/TextEditorPreview.stories.tsx +239 -0
- package/src/stories/TextEditorSpecial.stories.tsx +107 -0
- package/src/stories/story-utils.tsx +329 -0
- package/src/testing/RefPopover.tsx +74 -0
- package/src/testing/index.ts +5 -0
- package/src/types.ts +7 -0
- package/src/util/react.tsx +20 -2
- package/dist/types/src/InputMode.stories.d.ts.map +0 -1
- package/dist/types/src/TextEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/EditorToolbar/viewMode.d.ts.map +0 -1
- package/dist/types/src/extensions/command/preview.d.ts +0 -12
- package/dist/types/src/extensions/command/preview.d.ts.map +0 -1
- package/dist/types/src/fragments.d.ts +0 -3
- package/dist/types/src/fragments.d.ts.map +0 -1
- package/src/TextEditor.stories.tsx +0 -856
- package/src/extensions/command/preview.ts +0 -79
- package/src/fragments.ts +0 -19
- /package/src/components/EditorToolbar/{viewMode.ts → view-mode.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAOzE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,GAAG,mBAAmB,GAAG,WAAW,CAAC,CAAC;AAEvF,eAAO,MAAM,OAAO,aAAa,cAAc,KAAQ,SAgBtD,CAAC"}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
2
|
-
|
3
|
-
|
2
|
+
export type HintOptions = {
|
3
|
+
onHint: () => string | undefined;
|
4
|
+
};
|
5
|
+
export declare const hintViewPlugin: ({ onHint }: HintOptions) => ViewPlugin<{
|
4
6
|
deco: import("@codemirror/view").DecorationSet;
|
5
7
|
update(update: ViewUpdate): void;
|
6
8
|
}>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/hint.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,UAAU,EAAE,KAAK,UAAU,EAAc,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/hint.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,UAAU,EAAE,KAAK,UAAU,EAAc,MAAM,kBAAkB,CAAC;AAKnG,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,cAAc,eAAgB,WAAW;;mBAIjC,UAAU;EAuB5B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import { type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
2
|
-
import { type
|
3
|
-
export
|
2
|
+
import { type RenderCallback } from '../../types';
|
3
|
+
export type FloatingMenuOptions = {
|
4
|
+
renderMenu: RenderCallback<{
|
5
|
+
onAction: () => void;
|
6
|
+
}>;
|
7
|
+
};
|
8
|
+
export declare const floatingMenu: (options: FloatingMenuOptions) => ViewPlugin<{
|
4
9
|
button: HTMLElement;
|
5
10
|
view: EditorView;
|
6
11
|
rafId: number | null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/menu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/menu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGhG,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,cAAc,CAAC;QAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CACtD,CAAC;AAIF,eAAO,MAAM,YAAY,YAAa,mBAAmB;YAG3C,WAAW;UACb,UAAU;WACT,MAAM,GAAG,IAAI;mBAyBL,UAAU;;;;EAyD5B,CAAC"}
|
@@ -1,18 +1,16 @@
|
|
1
1
|
import { StateField } from '@codemirror/state';
|
2
|
-
import { type
|
3
|
-
import { type
|
2
|
+
import { type Tooltip } from '@codemirror/view';
|
3
|
+
import { type Action } from './action';
|
4
|
+
import { type RenderCallback } from '../../types';
|
5
|
+
export declare const commandConfig: import("@codemirror/state").Facet<Partial<PopupOptions & import("./menu").FloatingMenuOptions & import("./hint").HintOptions>, Partial<PopupOptions & import("./menu").FloatingMenuOptions & import("./hint").HintOptions>>;
|
6
|
+
export type PopupOptions = {
|
7
|
+
renderDialog: RenderCallback<{
|
8
|
+
onAction: (action?: Action) => void;
|
9
|
+
}>;
|
10
|
+
};
|
4
11
|
type CommandState = {
|
5
12
|
tooltip?: Tooltip | null;
|
6
13
|
};
|
7
|
-
export declare const commandConfig: import("@codemirror/state").Facet<CommandOptions, CommandOptions>;
|
8
14
|
export declare const commandState: StateField<CommandState>;
|
9
|
-
export declare const openEffect: import("@codemirror/state").StateEffectType<{
|
10
|
-
pos: number;
|
11
|
-
fullWidth?: boolean;
|
12
|
-
}>;
|
13
|
-
export declare const closeEffect: import("@codemirror/state").StateEffectType<null>;
|
14
|
-
export declare const openCommand: Command;
|
15
|
-
export declare const closeCommand: Command;
|
16
|
-
export declare const commandKeyBindings: readonly KeyBinding[];
|
17
15
|
export {};
|
18
16
|
//# sourceMappingURL=state.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/state.ts"],"names":[],"mappings":"AAIA,OAAO,
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAgC,KAAK,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAe,KAAK,MAAM,EAAc,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,aAAa,6NAAqC,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,cAAc,CAAC;QAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC,CAAC;CACvE,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,YAAY,0BAmEvB,CAAC"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { type EditorState, type Extension, StateField } from '@codemirror/state';
|
2
2
|
import { type Command, EditorView, type Rect } from '@codemirror/view';
|
3
3
|
import { type CleanupFn } from '@dxos/async';
|
4
|
-
import { type
|
4
|
+
import { type Live } from '@dxos/live-object';
|
5
5
|
import { type EditorToolbarState } from '../components';
|
6
|
-
import { type Comment, type Range } from '../types';
|
6
|
+
import { type RenderCallback, type Comment, type Range } from '../types';
|
7
7
|
type CommentState = {
|
8
8
|
comment: Comment;
|
9
9
|
range: Range;
|
@@ -41,6 +41,12 @@ export type CommentsOptions = {
|
|
41
41
|
* Key shortcut to create a new thread.
|
42
42
|
*/
|
43
43
|
key?: string;
|
44
|
+
/**
|
45
|
+
* Called to render tooltip.
|
46
|
+
*/
|
47
|
+
renderTooltip?: RenderCallback<{
|
48
|
+
shortcut: string;
|
49
|
+
}>;
|
44
50
|
/**
|
45
51
|
* Called to create a new thread and return the thread id.
|
46
52
|
*/
|
@@ -66,10 +72,6 @@ export type CommentsOptions = {
|
|
66
72
|
* Called to notify which thread is currently closest to the cursor.
|
67
73
|
*/
|
68
74
|
onSelect?: (state: CommentsState) => void;
|
69
|
-
/**
|
70
|
-
* Called to render tooltip.
|
71
|
-
*/
|
72
|
-
onHover?: (el: Element, shortcut: string) => void;
|
73
75
|
};
|
74
76
|
/**
|
75
77
|
* Comment threads.
|
@@ -89,7 +91,7 @@ export declare const scrollThreadIntoView: (view: EditorView, id: string, center
|
|
89
91
|
*/
|
90
92
|
export declare const selectionOverlapsComment: (state: EditorState) => boolean;
|
91
93
|
export declare const createExternalCommentSync: (id: string, subscribe: (sink: () => void) => CleanupFn, getComments: () => Comment[]) => Extension;
|
92
|
-
export declare const useCommentState: (state:
|
94
|
+
export declare const useCommentState: (state: Live<EditorToolbarState>) => Extension;
|
93
95
|
/**
|
94
96
|
* @deprecated This hook will be removed in future versions. Use the new comment sync extension instead.
|
95
97
|
* Update comments state field.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../src/extensions/comments.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,KAAK,OAAO,EAEZ,UAAU,EACV,KAAK,IAAI,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../src/extensions/comments.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,UAA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../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type RenderCallback } from '../../types';
|
1
2
|
export interface DecorateOptions {
|
2
3
|
/**
|
3
4
|
* Prevents triggering decorations as the cursor moves through the document.
|
@@ -7,7 +8,9 @@ export interface DecorateOptions {
|
|
7
8
|
from: number;
|
8
9
|
to?: number;
|
9
10
|
};
|
10
|
-
renderLinkButton?:
|
11
|
+
renderLinkButton?: RenderCallback<{
|
12
|
+
url: string;
|
13
|
+
}>;
|
11
14
|
}
|
12
15
|
export declare const decorateMarkdown: (options?: DecorateOptions) => import("@codemirror/state").Extension[];
|
13
16
|
//# sourceMappingURL=decorate.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/decorate.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/decorate.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAmflD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,gBAAgB,CAAC,EAAE,cAAc,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,gBAAgB,aAAa,eAAe,4CAgExD,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type Extension, type StateCommand, type EditorState } from '@codemirror/state';
|
2
2
|
import { EditorView } from '@codemirror/view';
|
3
|
-
import { type
|
3
|
+
import { type Live } from '@dxos/live-object';
|
4
4
|
import { type EditorToolbarState } from '../../components';
|
5
5
|
export type Formatting = Partial<{
|
6
6
|
blankLine: boolean;
|
@@ -59,5 +59,5 @@ export declare const getFormatting: (state: EditorState) => Formatting;
|
|
59
59
|
/**
|
60
60
|
* Hook provides an extension to compute the current formatting state.
|
61
61
|
*/
|
62
|
-
export declare const useFormattingState: (state:
|
62
|
+
export declare const useFormattingState: (state: Live<EditorToolbarState>) => Extension;
|
63
63
|
//# sourceMappingURL=formatting.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IAGnB,SAAS,EACL,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,IAAI,CAAC;IAET,UAAU,EAAE,OAAO,CAAC;IAEpB,MAAM,EAAE,OAAO,CAAC;IAEhB,QAAQ,EAAE,OAAO,CAAC;IAElB,aAAa,EAAE,OAAO,CAAC;IAEvB,IAAI,EAAE,OAAO,CAAC;IAEd,IAAI,EAAE,OAAO,CAAC;IAEd,SAAS,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;CACjD,CAAC,CAAC;AAEH,eAAO,MAAM,gBAAgB,MAAO,UAAU,KAAK,UAAU,YAQ9B,CAAC;AAEhC,oBAAY,MAAM;IAChB,MAAM,IAAI;IACV,QAAQ,I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CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YAE7B,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEnC,eAAO,MAAM,gBAAgB,cAAc,iBAAiB,KAAQ,SAanE,CAAC;AA4CF;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,WAAW,KAAG,UAqKlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,UAAW,IAAI,CAAC,kBAAkB,CAAC,KAAG,SAYpE,CAAC"}
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
import { type RenderCallback } from '../../types';
|
2
|
+
export declare const linkTooltip: (renderTooltip: RenderCallback<{
|
3
|
+
url: string;
|
4
|
+
}>) => import("@codemirror/state").Extension & {
|
2
5
|
active: import("@codemirror/state").StateField<readonly import("@codemirror/view").Tooltip[]>;
|
3
6
|
};
|
4
7
|
//# sourceMappingURL=link.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/link.ts"],"names":[],"mappings":"AAWA,
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/link.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,WAAW,kBAAmB,cAAc,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;;CAiCzE,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/preview/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import '@dxos/lit-ui/dx-ref-tag.pcss';
|
2
|
+
import { type Extension } from '@codemirror/state';
|
3
|
+
import { type RenderCallback } from '../../types';
|
4
|
+
export type PreviewLinkRef = {
|
5
|
+
suggest?: boolean;
|
6
|
+
block?: boolean;
|
7
|
+
label: string;
|
8
|
+
ref: string;
|
9
|
+
};
|
10
|
+
export type PreviewLinkTarget = {
|
11
|
+
label: string;
|
12
|
+
text?: string;
|
13
|
+
object?: any;
|
14
|
+
};
|
15
|
+
export type PreviewAction = {
|
16
|
+
type: 'insert';
|
17
|
+
link: PreviewLinkRef;
|
18
|
+
target: PreviewLinkTarget;
|
19
|
+
} | {
|
20
|
+
type: 'delete';
|
21
|
+
link: PreviewLinkRef;
|
22
|
+
};
|
23
|
+
export type PreviewLookup = (link: PreviewLinkRef) => Promise<PreviewLinkTarget | null | undefined>;
|
24
|
+
export type PreviewActionHandler = (action: PreviewAction) => void;
|
25
|
+
export type PreviewRenderProps = {
|
26
|
+
readonly: boolean;
|
27
|
+
link: PreviewLinkRef;
|
28
|
+
onAction: PreviewActionHandler;
|
29
|
+
onLookup?: PreviewLookup;
|
30
|
+
};
|
31
|
+
export type PreviewOptions = {
|
32
|
+
renderBlock?: RenderCallback<PreviewRenderProps>;
|
33
|
+
onLookup?: PreviewLookup;
|
34
|
+
};
|
35
|
+
/**
|
36
|
+
* Create preview decorations.
|
37
|
+
*/
|
38
|
+
export declare const preview: (options?: PreviewOptions) => Extension;
|
39
|
+
//# sourceMappingURL=preview.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/preview/preview.ts"],"names":[],"mappings":"AAIA,OAAO,8BAA8B,CAAC;AAGtC,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAGN,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEpG,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;AAEnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,aAAa,cAAc,KAAQ,SAwBtD,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type EditorStateConfig } from '@codemirror/state';
|
1
|
+
import { type EditorStateConfig, type Text } from '@codemirror/state';
|
2
2
|
import { EditorView } from '@codemirror/view';
|
3
3
|
import { type TabsterTypes } from '@fluentui/react-tabster';
|
4
4
|
import { type DependencyList, type KeyboardEventHandler, type RefObject } from 'react';
|
@@ -22,6 +22,7 @@ export type CursorInfo = {
|
|
22
22
|
};
|
23
23
|
export type UseTextEditorProps = Pick<EditorStateConfig, 'extensions'> & {
|
24
24
|
id?: string;
|
25
|
+
doc?: Text;
|
25
26
|
initialValue?: string;
|
26
27
|
className?: string;
|
27
28
|
autoFocus?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTextEditor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextEditor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"useTextEditor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextEditor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EAAE,KAAK,eAAe,EAA6D,MAAM,eAAe,CAAC;AAGhH,MAAM,MAAM,aAAa,GAAG;IAE1B,SAAS,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,eAAe,CAAC,EAAE,YAAY,CAAC,mBAAmB,GAAG;QACnD,QAAQ,EAAE,CAAC,CAAC;QACZ,OAAO,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC;KAC/C,CAAC;CACH,CAAC;AAEF,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,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG;IACvE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,aAAa,WACjB,aAAa,CAAC,kBAAkB,CAAC,SAClC,cAAc,KACnB,aA+HF,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"InputMode.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/InputMode.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAmB,MAAM,OAAO,CAAC;AAiBxC,OAAO,EAAmC,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGpF,KAAK,UAAU,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,kBAAkB,CAAC;AAqEpF,eAAO,MAAM,OAAO;;CAanB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC;;;iEAxFwE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FpF,wBAKE"}
|
@@ -1,19 +1,7 @@
|
|
1
1
|
import '@dxos-theme';
|
2
|
-
import { type EditorView } from '@codemirror/view';
|
3
2
|
import React from 'react';
|
4
3
|
import { type Meta } from '@dxos/storybook-utils';
|
5
|
-
import {
|
6
|
-
type DebugMode = 'raw' | 'tree' | 'raw+tree';
|
7
|
-
type StoryProps = {
|
8
|
-
id?: string;
|
9
|
-
debug?: DebugMode;
|
10
|
-
text?: string;
|
11
|
-
readOnly?: boolean;
|
12
|
-
placeholder?: string;
|
13
|
-
lineNumbers?: boolean;
|
14
|
-
onReady?: (view: EditorView) => void;
|
15
|
-
} & Pick<UseTextEditorProps, 'scrollTo' | 'selection' | 'extensions'>;
|
16
|
-
declare const DefaultStory: ({ id, debug, text, extensions, readOnly, placeholder, scrollTo, selection, lineNumbers, onReady, }: StoryProps) => React.JSX.Element;
|
4
|
+
import { DefaultStory } from './story-utils';
|
17
5
|
declare const meta: Meta<typeof DefaultStory>;
|
18
6
|
export default meta;
|
19
7
|
export declare const Default: {
|
@@ -91,25 +79,4 @@ export declare const Mention: {
|
|
91
79
|
export declare const Search: {
|
92
80
|
render: () => React.JSX.Element;
|
93
81
|
};
|
94
|
-
|
95
|
-
render: () => React.JSX.Element;
|
96
|
-
};
|
97
|
-
export declare const Comments: {
|
98
|
-
render: () => React.JSX.Element;
|
99
|
-
};
|
100
|
-
export declare const Annotations: {
|
101
|
-
render: () => React.JSX.Element;
|
102
|
-
};
|
103
|
-
export declare const DND: {
|
104
|
-
render: () => React.JSX.Element;
|
105
|
-
};
|
106
|
-
export declare const Listener: {
|
107
|
-
render: () => React.JSX.Element;
|
108
|
-
};
|
109
|
-
export declare const Typewriter: {
|
110
|
-
render: () => React.JSX.Element;
|
111
|
-
};
|
112
|
-
export declare const Blast: {
|
113
|
-
render: () => React.JSX.Element;
|
114
|
-
};
|
115
|
-
//# sourceMappingURL=TextEditor.stories.d.ts.map
|
82
|
+
//# sourceMappingURL=TextEditorBasic.stories.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TextEditorBasic.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/TextEditorBasic.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAKrB,OAAO,KAAK,MAAM,OAAO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
import React from 'react';
|
3
|
+
import { type Meta } from '@dxos/storybook-utils';
|
4
|
+
import { DefaultStory } from './story-utils';
|
5
|
+
declare const meta: Meta<typeof DefaultStory>;
|
6
|
+
export default meta;
|
7
|
+
export declare const Comments: {
|
8
|
+
render: () => React.JSX.Element;
|
9
|
+
};
|
10
|
+
export declare const Annotations: {
|
11
|
+
render: () => React.JSX.Element;
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=TextEditorComments.stories.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TextEditorComments.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/TextEditorComments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,YAAY,EAA0B,MAAM,eAAe,CAAC;AAKrE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAKnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,QAAQ;;CAsCpB,CAAC;AAyBF,eAAO,MAAM,WAAW;;CAIvB,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import '@dxos-theme';
|
2
|
+
import React from 'react';
|
3
|
+
import { type Meta } from '@dxos/storybook-utils';
|
4
|
+
import { DefaultStory } from './story-utils';
|
5
|
+
declare const meta: Meta<typeof DefaultStory>;
|
6
|
+
export default meta;
|
7
|
+
export declare const Preview: {
|
8
|
+
render: () => React.JSX.Element;
|
9
|
+
};
|
10
|
+
export declare const Command: {
|
11
|
+
render: () => React.JSX.Element;
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=TextEditorPreview.stories.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TextEditorPreview.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/TextEditorPreview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAA2D,MAAM,OAAO,CAAC;AAKhF,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAO,MAAM,eAAe,CAAC;AAelD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAKnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO;;CA8BnB,CAAC;AAwFF,eAAO,MAAM,OAAO;;CAwBnB,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import '@dxos-theme';
|
2
|
+
import React from 'react';
|
3
|
+
import { type Meta } from '@dxos/storybook-utils';
|
4
|
+
import { DefaultStory } from './story-utils';
|
5
|
+
declare const meta: Meta<typeof DefaultStory>;
|
6
|
+
export default meta;
|
7
|
+
export declare const Listener: {
|
8
|
+
render: () => React.JSX.Element;
|
9
|
+
};
|
10
|
+
export declare const Typewriter: {
|
11
|
+
render: () => React.JSX.Element;
|
12
|
+
};
|
13
|
+
export declare const Blast: {
|
14
|
+
render: () => React.JSX.Element;
|
15
|
+
};
|
16
|
+
export declare const DND: {
|
17
|
+
render: () => React.JSX.Element;
|
18
|
+
};
|
19
|
+
//# sourceMappingURL=TextEditorSpecial.stories.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TextEditorSpecial.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/TextEditorSpecial.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAgB,MAAM,eAAe,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAKnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,QAAQ;;CAgBpB,CAAC;AAQF,eAAO,MAAM,UAAU;;CAOtB,CAAC;AAMF,eAAO,MAAM,KAAK;;CAqBjB,CAAC;AAMF,eAAO,MAAM,GAAG;;CAaf,CAAC"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { type Completion } from '@codemirror/autocomplete';
|
2
|
+
import { type Extension } from '@codemirror/state';
|
3
|
+
import { type EditorView } from '@codemirror/view';
|
4
|
+
import React from 'react';
|
5
|
+
import { type EditorSelectionState } from '../extensions';
|
6
|
+
import { type UseTextEditorProps } from '../hooks';
|
7
|
+
export declare const str: (...lines: string[]) => string;
|
8
|
+
export declare const num: () => string;
|
9
|
+
export declare const img = "";
|
10
|
+
export declare const code: string;
|
11
|
+
export declare const content: {
|
12
|
+
tasks: string;
|
13
|
+
bullets: string;
|
14
|
+
numbered: string;
|
15
|
+
typescript: string;
|
16
|
+
codeblocks: string;
|
17
|
+
comment: string;
|
18
|
+
links: string;
|
19
|
+
table: string;
|
20
|
+
image: string;
|
21
|
+
headings: string;
|
22
|
+
formatting: string;
|
23
|
+
blockquotes: string;
|
24
|
+
paragraphs: string;
|
25
|
+
footer: string;
|
26
|
+
};
|
27
|
+
export declare const text: string;
|
28
|
+
export declare const links: Completion[];
|
29
|
+
export declare const names: string[];
|
30
|
+
export declare const renderLinkTooltip: import("..").RenderCallback<{
|
31
|
+
url: string;
|
32
|
+
}>;
|
33
|
+
export declare const renderLinkButton: import("..").RenderCallback<{
|
34
|
+
url: string;
|
35
|
+
}>;
|
36
|
+
export declare const defaultExtensions: Extension[];
|
37
|
+
export declare const allExtensions: Extension[];
|
38
|
+
export declare const longText: string;
|
39
|
+
export declare const largeWithImages: string;
|
40
|
+
export declare const headings: string;
|
41
|
+
export declare const global: Map<string, EditorSelectionState>;
|
42
|
+
export type DebugMode = 'raw' | 'tree' | 'raw+tree';
|
43
|
+
export type StoryProps = {
|
44
|
+
id?: string;
|
45
|
+
debug?: DebugMode;
|
46
|
+
text?: string;
|
47
|
+
readOnly?: boolean;
|
48
|
+
placeholder?: string;
|
49
|
+
lineNumbers?: boolean;
|
50
|
+
onReady?: (view: EditorView) => void;
|
51
|
+
} & Pick<UseTextEditorProps, 'scrollTo' | 'selection' | 'extensions'>;
|
52
|
+
export declare const DefaultStory: ({ id, debug, text, extensions, readOnly, placeholder, scrollTo, selection, lineNumbers, onReady, }: StoryProps) => React.JSX.Element;
|
53
|
+
//# sourceMappingURL=story-utils.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"story-utils.d.ts","sourceRoot":"","sources":["../../../../src/stories/story-utils.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAuC,MAAM,OAAO,CAAC;AAW5D,OAAO,EACL,KAAK,oBAAoB,EAQ1B,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,eAAO,MAAM,GAAG,aAAc,MAAM,EAAE,WAAqB,CAAC;AAE5D,eAAO,MAAM,GAAG,cAAiE,CAAC;AAElF,eAAO,MAAM,GAAG,yDAAyD,CAAC;AAE1E,eAAO,MAAM,IAAI,QAOhB,CAAC;AAGF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;CA+FnB,CAAC;AAGF,eAAO,MAAM,IAAI,QAwBhB,CAAC;AAGF,eAAO,MAAM,KAAK,EAAE,UAAU,EAM7B,CAAC;AAEF,eAAO,MAAM,KAAK,UAA4E,CAAC;AAe/F,eAAO,MAAM,iBAAiB;SAVD,MAAM;EAUyB,CAAC;AAU7D,eAAO,MAAM,gBAAgB;SARD,MAAM;EAQwB,CAAC;AAG3D,eAAO,MAAM,iBAAiB,EAAE,SAAS,EAIxC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAAS,EAOpC,CAAC;AAGF,eAAO,MAAM,QAAQ,QAEN,CAAC;AAEhB,eAAO,MAAM,eAAe,QAGb,CAAC;AAEhB,eAAO,MAAM,QAAQ,QAIpB,CAAC;AAEF,eAAO,MAAM,MAAM,mCAA0C,CAAC;AAG9D,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC,GAAG,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;AAGtE,eAAO,MAAM,YAAY,uGAWtB,UAAU,sBAsDZ,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
2
|
+
import { type PreviewLinkRef, type PreviewLinkTarget, type PreviewLookup } from '../extensions';
|
3
|
+
type RefPopoverValue = Partial<{
|
4
|
+
link: PreviewLinkRef;
|
5
|
+
target: PreviewLinkTarget;
|
6
|
+
pending: boolean;
|
7
|
+
}>;
|
8
|
+
declare const useRefPopover: (consumerName: string) => Partial<{
|
9
|
+
link: PreviewLinkRef;
|
10
|
+
target: PreviewLinkTarget;
|
11
|
+
pending: boolean;
|
12
|
+
}>;
|
13
|
+
type RefPopoverProviderProps = PropsWithChildren<{
|
14
|
+
onLookup?: PreviewLookup;
|
15
|
+
}>;
|
16
|
+
export declare const RefPopover: {
|
17
|
+
Provider: ({ children, onLookup }: RefPopoverProviderProps) => React.JSX.Element;
|
18
|
+
};
|
19
|
+
export { useRefPopover };
|
20
|
+
export type { RefPopoverProviderProps, RefPopoverValue };
|
21
|
+
//# sourceMappingURL=RefPopover.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RefPopover.d.ts","sourceRoot":"","sources":["../../../../src/testing/RefPopover.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA4C,MAAM,OAAO,CAAC;AAMhG,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAKhG,KAAK,eAAe,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtG,QAAA,MAAkC,aAAa;UAFR,cAAc;YAAU,iBAAiB;aAAW,OAAO;EAEA,CAAC;AAEnG,KAAK,uBAAuB,GAAG,iBAAiB,CAAC;IAAE,QAAQ,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AA+C/E,eAAO,MAAM,UAAU;uCA7C6B,uBAAuB;CA+C1E,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,YAAY,EAAE,uBAAuB,EAAE,eAAe,EAAE,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type EditorView } from '@codemirror/view';
|
1
2
|
export type Range = {
|
2
3
|
from: number;
|
3
4
|
to: number;
|
@@ -6,4 +7,8 @@ export type Comment = {
|
|
6
7
|
id: string;
|
7
8
|
cursor?: string;
|
8
9
|
};
|
10
|
+
/**
|
11
|
+
* Callback that renders into a DOM element within the editor.
|
12
|
+
*/
|
13
|
+
export type RenderCallback<Props extends object> = (el: HTMLElement, props: Props, view: EditorView) => void;
|
9
14
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAIF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,MAAM,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC"}
|
@@ -1,7 +1,12 @@
|
|
1
|
-
import { type ReactNode } from 'react';
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
2
|
+
import { type RenderCallback } from '../types';
|
2
3
|
export type ElementOptions = {
|
3
4
|
className?: string;
|
4
5
|
};
|
5
6
|
export declare const createElement: (tag: string, options?: ElementOptions, children?: ReactNode) => HTMLElement;
|
6
7
|
export declare const renderRoot: <T extends Element>(root: T, node: ReactNode) => T;
|
8
|
+
/**
|
9
|
+
* Utility to create a renderer for a React component.
|
10
|
+
*/
|
11
|
+
export declare const createRenderer: <Props extends object>(Component: FC<Props>) => RenderCallback<Props>;
|
7
12
|
//# sourceMappingURL=react.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/util/react.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/util/react.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,YAAY,cAAc,aAAa,SAAS,KAAG,WAU3F,CAAC;AAIF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,OAAO,QAAQ,CAAC,QAAQ,SAAS,KAAG,CAGxE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACxB,KAAK,SAAS,MAAM,aAAa,EAAE,CAAC,KAAK,CAAC,KAAG,cAAc,CAAC,KAAK,CAUjE,CAAC"}
|