@dxos/react-ui-editor 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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 +371 -499
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +379 -515
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +371 -499
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/{stories/InputMode.stories.d.ts → InputMode.stories.d.ts} +1 -1
- package/dist/types/src/InputMode.stories.d.ts.map +1 -0
- package/dist/types/src/{stories/TextEditorBasic.stories.d.ts → TextEditor.stories.d.ts} +35 -2
- package/dist/types/src/TextEditor.stories.d.ts.map +1 -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/{view-mode.d.ts → viewMode.d.ts} +1 -1
- package/dist/types/src/components/EditorToolbar/viewMode.d.ts.map +1 -0
- package/dist/types/src/defaults.d.ts +0 -1
- 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/command.d.ts +10 -5
- package/dist/types/src/extensions/command/command.d.ts.map +1 -1
- package/dist/types/src/extensions/command/hint.d.ts +2 -4
- package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
- package/dist/types/src/extensions/command/index.d.ts +0 -1
- package/dist/types/src/extensions/command/index.d.ts.map +1 -1
- package/dist/types/src/extensions/command/menu.d.ts +2 -7
- package/dist/types/src/extensions/command/menu.d.ts.map +1 -1
- package/dist/types/src/extensions/command/preview.d.ts +12 -0
- package/dist/types/src/extensions/command/preview.d.ts.map +1 -0
- package/dist/types/src/extensions/command/state.d.ts +11 -9
- package/dist/types/src/extensions/command/state.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts +7 -9
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +0 -1
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts +1 -4
- 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 +1 -4
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -1
- package/dist/types/src/fragments.d.ts +3 -0
- package/dist/types/src/fragments.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextEditor.d.ts +1 -2
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +0 -5
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/react.d.ts +1 -6
- package/dist/types/src/util/react.d.ts.map +1 -1
- package/package.json +27 -33
- package/src/{stories/InputMode.stories.tsx → InputMode.stories.tsx} +4 -4
- package/src/TextEditor.stories.tsx +856 -0
- package/src/components/EditorToolbar/EditorToolbar.tsx +2 -2
- package/src/components/EditorToolbar/util.ts +3 -3
- package/src/defaults.ts +3 -5
- package/src/extensions/automerge/automerge.stories.tsx +11 -3
- package/src/extensions/command/command.ts +27 -9
- package/src/extensions/command/hint.ts +30 -33
- package/src/extensions/command/index.ts +0 -1
- package/src/extensions/command/menu.ts +8 -11
- package/src/extensions/command/preview.ts +79 -0
- package/src/extensions/command/state.ts +61 -41
- package/src/extensions/comments.ts +9 -9
- package/src/extensions/folding.tsx +1 -1
- package/src/extensions/index.ts +0 -1
- package/src/extensions/markdown/decorate.ts +3 -4
- package/src/extensions/markdown/formatting.ts +2 -2
- package/src/extensions/markdown/image.ts +11 -12
- package/src/extensions/markdown/link.ts +24 -33
- package/src/fragments.ts +19 -0
- package/src/hooks/useTextEditor.ts +3 -4
- package/src/types.ts +0 -7
- package/src/util/react.tsx +2 -20
- package/dist/lib/browser/testing/index.mjs +0 -67
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -101
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -69
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +0 -1
- package/dist/types/src/extensions/command/action.d.ts +0 -17
- package/dist/types/src/extensions/command/action.d.ts.map +0 -1
- package/dist/types/src/extensions/preview/index.d.ts +0 -2
- package/dist/types/src/extensions/preview/index.d.ts.map +0 -1
- package/dist/types/src/extensions/preview/preview.d.ts +0 -39
- package/dist/types/src/extensions/preview/preview.d.ts.map +0 -1
- package/dist/types/src/stories/InputMode.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorBasic.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorComments.stories.d.ts +0 -13
- package/dist/types/src/stories/TextEditorComments.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts +0 -13
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts +0 -19
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts.map +0 -1
- package/dist/types/src/stories/story-utils.d.ts +0 -53
- package/dist/types/src/stories/story-utils.d.ts.map +0 -1
- package/dist/types/src/testing/RefPopover.d.ts +0 -21
- package/dist/types/src/testing/RefPopover.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/src/extensions/command/action.ts +0 -49
- package/src/extensions/preview/index.ts +0 -5
- package/src/extensions/preview/preview.ts +0 -271
- package/src/stories/TextEditorBasic.stories.tsx +0 -289
- package/src/stories/TextEditorComments.stories.tsx +0 -99
- package/src/stories/TextEditorPreview.stories.tsx +0 -239
- package/src/stories/TextEditorSpecial.stories.tsx +0 -107
- package/src/stories/story-utils.tsx +0 -329
- package/src/testing/RefPopover.tsx +0 -74
- package/src/testing/index.ts +0 -5
- /package/src/components/EditorToolbar/{view-mode.ts → viewMode.ts} +0 -0
@@ -51,6 +51,16 @@ export const image = (_options: ImageOptions = {}): Extension => {
|
|
51
51
|
];
|
52
52
|
};
|
53
53
|
|
54
|
+
const preloaded = new Set<string>();
|
55
|
+
|
56
|
+
const preloadImage = (url: string) => {
|
57
|
+
if (!preloaded.has(url)) {
|
58
|
+
const img = document.createElement('img');
|
59
|
+
img.src = url;
|
60
|
+
preloaded.add(url);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
54
64
|
const buildDecorations = (from: number, to: number, state: EditorState) => {
|
55
65
|
const decorations: Range<Decoration>[] = [];
|
56
66
|
const cursor = state.selection.main.head;
|
@@ -84,23 +94,13 @@ const buildDecorations = (from: number, to: number, state: EditorState) => {
|
|
84
94
|
return decorations;
|
85
95
|
};
|
86
96
|
|
87
|
-
const preloaded = new Set<string>();
|
88
|
-
|
89
|
-
const preloadImage = (url: string) => {
|
90
|
-
if (!preloaded.has(url)) {
|
91
|
-
const img = document.createElement('img');
|
92
|
-
img.src = url;
|
93
|
-
preloaded.add(url);
|
94
|
-
}
|
95
|
-
};
|
96
|
-
|
97
97
|
class ImageWidget extends WidgetType {
|
98
98
|
constructor(readonly _url: string) {
|
99
99
|
super();
|
100
100
|
}
|
101
101
|
|
102
102
|
override eq(other: this) {
|
103
|
-
return this._url === other._url;
|
103
|
+
return this._url === (other as any as ImageWidget)._url;
|
104
104
|
}
|
105
105
|
|
106
106
|
override toDOM(view: EditorView) {
|
@@ -113,7 +113,6 @@ class ImageWidget extends WidgetType {
|
|
113
113
|
} else {
|
114
114
|
img.classList.add('cm-loaded-image');
|
115
115
|
}
|
116
|
-
|
117
116
|
return img;
|
118
117
|
}
|
119
118
|
}
|
@@ -9,39 +9,30 @@ import { type SyntaxNode } from '@lezer/common';
|
|
9
9
|
|
10
10
|
import { tooltipContent } from '@dxos/react-ui-theme';
|
11
11
|
|
12
|
-
|
12
|
+
export const linkTooltip = (render: (el: HTMLElement, url: string) => void) => {
|
13
|
+
return hoverTooltip((view, pos, side) => {
|
14
|
+
const syntax = syntaxTree(view.state).resolveInner(pos, side);
|
15
|
+
let link = null;
|
16
|
+
for (let i = 0, node: SyntaxNode | null = syntax; !link && node && i < 5; node = node.parent, i++) {
|
17
|
+
link = node.name === 'Link' ? node : null;
|
18
|
+
}
|
13
19
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
let link = null;
|
19
|
-
for (let i = 0, node: SyntaxNode | null = syntax; !link && node && i < 5; node = node.parent, i++) {
|
20
|
-
link = node.name === 'Link' ? node : null;
|
21
|
-
}
|
20
|
+
const url = link && link.getChild('URL');
|
21
|
+
if (!url || !link) {
|
22
|
+
return null;
|
23
|
+
}
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
el.className = tooltipContent({});
|
37
|
-
renderTooltip(el, { url: urlText }, view);
|
38
|
-
return { dom: el, offset: { x: 0, y: 4 } };
|
39
|
-
},
|
40
|
-
};
|
41
|
-
},
|
42
|
-
{
|
43
|
-
// NOTE: 0 = default of 300ms.
|
44
|
-
hoverTime: 1,
|
45
|
-
},
|
46
|
-
);
|
25
|
+
const urlText = view.state.sliceDoc(url.from, url.to);
|
26
|
+
return {
|
27
|
+
pos: link.from,
|
28
|
+
end: link.to,
|
29
|
+
above: true,
|
30
|
+
create: () => {
|
31
|
+
const el = document.createElement('div');
|
32
|
+
el.className = tooltipContent({}, 'pli-2 plb-1');
|
33
|
+
render(el, urlText);
|
34
|
+
return { dom: el, offset: { x: 0, y: 4 } };
|
35
|
+
},
|
36
|
+
};
|
37
|
+
});
|
47
38
|
};
|
package/src/fragments.ts
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2025 DXOS.org
|
3
|
+
//
|
4
|
+
|
5
|
+
import { mx } from '@dxos/react-ui-theme';
|
6
|
+
|
7
|
+
// TODO(burdon): Move this to a common plugin.
|
8
|
+
|
9
|
+
export const stackItemContentEditorClassNames = (role?: string) =>
|
10
|
+
mx(
|
11
|
+
'attention-surface dx-focus-ring-inset data-[toolbar=disabled]:pbs-2',
|
12
|
+
role === 'section' ? '[&_.cm-scroller]:overflow-hidden [&_.cm-scroller]:min-bs-24' : 'min-bs-0',
|
13
|
+
);
|
14
|
+
|
15
|
+
export const stackItemContentToolbarClassNames = (role?: string) =>
|
16
|
+
mx(
|
17
|
+
'attention-surface is-full border-be !border-separator',
|
18
|
+
role === 'section' && 'sticky block-start-0 z-[1] -mbe-px min-is-0',
|
19
|
+
);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Copyright 2024 DXOS.org
|
3
3
|
//
|
4
4
|
|
5
|
-
import { EditorState, type EditorStateConfig
|
5
|
+
import { EditorState, type EditorStateConfig } from '@codemirror/state';
|
6
6
|
import { EditorView } from '@codemirror/view';
|
7
7
|
import { useFocusableGroup, type TabsterTypes } from '@fluentui/react-tabster';
|
8
8
|
import {
|
@@ -43,7 +43,6 @@ export type CursorInfo = {
|
|
43
43
|
|
44
44
|
export type UseTextEditorProps = Pick<EditorStateConfig, 'extensions'> & {
|
45
45
|
id?: string;
|
46
|
-
doc?: Text;
|
47
46
|
initialValue?: string;
|
48
47
|
className?: string;
|
49
48
|
autoFocus?: boolean;
|
@@ -62,7 +61,7 @@ export const useTextEditor = (
|
|
62
61
|
props: MaybeProvider<UseTextEditorProps> = {},
|
63
62
|
deps: DependencyList = [],
|
64
63
|
): UseTextEditor => {
|
65
|
-
const { id,
|
64
|
+
const { id, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } =
|
66
65
|
useMemo<UseTextEditorProps>(() => getProviderValue(props), deps ?? []);
|
67
66
|
|
68
67
|
// NOTE: Increments by 2 in strict mode.
|
@@ -88,7 +87,7 @@ export const useTextEditor = (
|
|
88
87
|
|
89
88
|
// https://codemirror.net/docs/ref/#state.EditorStateConfig
|
90
89
|
const state = EditorState.create({
|
91
|
-
doc:
|
90
|
+
doc: initialValue,
|
92
91
|
// selection: initialSelection,
|
93
92
|
extensions: [
|
94
93
|
id && documentId.of(id),
|
package/src/types.ts
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
// Copyright 2024 DXOS.org
|
3
3
|
//
|
4
4
|
|
5
|
-
import { type EditorView } from '@codemirror/view';
|
6
|
-
|
7
5
|
// Runtime data structure.
|
8
6
|
export type Range = {
|
9
7
|
from: number;
|
@@ -16,8 +14,3 @@ export type Comment = {
|
|
16
14
|
id: string;
|
17
15
|
cursor?: string;
|
18
16
|
};
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Callback that renders into a DOM element within the editor.
|
22
|
-
*/
|
23
|
-
export type RenderCallback<Props extends object> = (el: HTMLElement, props: Props, view: EditorView) => void;
|
package/src/util/react.tsx
CHANGED
@@ -2,14 +2,12 @@
|
|
2
2
|
// Copyright 2024 DXOS.org
|
3
3
|
//
|
4
4
|
|
5
|
-
import React, { type
|
5
|
+
import React, { type ReactNode } from 'react';
|
6
6
|
import { createRoot } from 'react-dom/client';
|
7
7
|
|
8
|
-
import { ThemeProvider
|
8
|
+
import { ThemeProvider } from '@dxos/react-ui';
|
9
9
|
import { defaultTx } from '@dxos/react-ui-theme';
|
10
10
|
|
11
|
-
import { type RenderCallback } from '../types';
|
12
|
-
|
13
11
|
// TODO(burdon): Factor out.
|
14
12
|
|
15
13
|
export type ElementOptions = {
|
@@ -34,19 +32,3 @@ export const renderRoot = <T extends Element>(root: T, node: ReactNode): T => {
|
|
34
32
|
createRoot(root).render(<ThemeProvider tx={defaultTx}>{node}</ThemeProvider>);
|
35
33
|
return root;
|
36
34
|
};
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Utility to create a renderer for a React component.
|
40
|
-
*/
|
41
|
-
export const createRenderer =
|
42
|
-
<Props extends object>(Component: FC<Props>): RenderCallback<Props> =>
|
43
|
-
(el, props) => {
|
44
|
-
renderRoot(
|
45
|
-
el,
|
46
|
-
<ThemeProvider tx={defaultTx}>
|
47
|
-
<Tooltip.Provider>
|
48
|
-
<Component {...props} />
|
49
|
-
</Tooltip.Provider>
|
50
|
-
</ThemeProvider>,
|
51
|
-
);
|
52
|
-
};
|
@@ -1,67 +0,0 @@
|
|
1
|
-
// packages/ui/react-ui-editor/src/testing/RefPopover.tsx
|
2
|
-
import { createContext } from "@radix-ui/react-context";
|
3
|
-
import React, { useRef, useState, useEffect, useCallback } from "react";
|
4
|
-
import { addEventListener } from "@dxos/async";
|
5
|
-
import { Popover } from "@dxos/react-ui";
|
6
|
-
var customEventOptions = {
|
7
|
-
capture: true,
|
8
|
-
passive: false
|
9
|
-
};
|
10
|
-
var REF_POPOVER = "RefPopover";
|
11
|
-
var [RefPopoverContextProvider, useRefPopover] = createContext(REF_POPOVER, {});
|
12
|
-
var RefPopoverProvider = ({ children, onLookup }) => {
|
13
|
-
const trigger = useRef(null);
|
14
|
-
const [value, setValue] = useState({});
|
15
|
-
const [rootRef, setRootRef] = useState(null);
|
16
|
-
const [open, setOpen] = useState(false);
|
17
|
-
const handleDxRefTagActivate = useCallback((event) => {
|
18
|
-
const { ref, label, trigger: dxTrigger } = event;
|
19
|
-
setValue((value2) => ({
|
20
|
-
...value2,
|
21
|
-
link: {
|
22
|
-
label,
|
23
|
-
ref
|
24
|
-
},
|
25
|
-
pending: true
|
26
|
-
}));
|
27
|
-
trigger.current = dxTrigger;
|
28
|
-
queueMicrotask(() => setOpen(true));
|
29
|
-
void onLookup?.({
|
30
|
-
label,
|
31
|
-
ref
|
32
|
-
}).then((target) => setValue((value2) => ({
|
33
|
-
...value2,
|
34
|
-
target: target ?? void 0,
|
35
|
-
pending: false
|
36
|
-
})));
|
37
|
-
}, [
|
38
|
-
onLookup
|
39
|
-
]);
|
40
|
-
useEffect(() => {
|
41
|
-
return rootRef ? addEventListener(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions) : void 0;
|
42
|
-
}, [
|
43
|
-
rootRef
|
44
|
-
]);
|
45
|
-
return /* @__PURE__ */ React.createElement(RefPopoverContextProvider, {
|
46
|
-
pending: value.pending,
|
47
|
-
link: value.link,
|
48
|
-
target: value.target
|
49
|
-
}, /* @__PURE__ */ React.createElement(Popover.Root, {
|
50
|
-
open,
|
51
|
-
onOpenChange: setOpen
|
52
|
-
}, /* @__PURE__ */ React.createElement(Popover.VirtualTrigger, {
|
53
|
-
virtualRef: trigger
|
54
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
55
|
-
role: "none",
|
56
|
-
className: "contents",
|
57
|
-
ref: setRootRef
|
58
|
-
}, children)));
|
59
|
-
};
|
60
|
-
var RefPopover = {
|
61
|
-
Provider: RefPopoverProvider
|
62
|
-
};
|
63
|
-
export {
|
64
|
-
RefPopover,
|
65
|
-
useRefPopover
|
66
|
-
};
|
67
|
-
//# sourceMappingURL=index.mjs.map
|
@@ -1,7 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../../src/testing/RefPopover.tsx"],
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren, useRef, useState, useEffect, useCallback, type RefObject } from 'react';\n\nimport { addEventListener } from '@dxos/async';\nimport { type DxRefTag, type DxRefTagActivate } from '@dxos/lit-ui';\nimport { Popover } from '@dxos/react-ui';\n\nimport { type PreviewLinkRef, type PreviewLinkTarget, type PreviewLookup } from '../extensions';\n\nconst customEventOptions = { capture: true, passive: false };\n\n// Create a context for the dxn value.\ntype RefPopoverValue = Partial<{ link: PreviewLinkRef; target: PreviewLinkTarget; pending: boolean }>;\nconst REF_POPOVER = 'RefPopover';\nconst [RefPopoverContextProvider, useRefPopover] = createContext<RefPopoverValue>(REF_POPOVER, {});\n\ntype RefPopoverProviderProps = PropsWithChildren<{ onLookup?: PreviewLookup }>;\n\nconst RefPopoverProvider = ({ children, onLookup }: RefPopoverProviderProps) => {\n const trigger = useRef<DxRefTag | null>(null);\n const [value, setValue] = useState<RefPopoverValue>({});\n const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);\n const [open, setOpen] = useState(false);\n\n const handleDxRefTagActivate = useCallback(\n (event: DxRefTagActivate) => {\n const { ref, label, trigger: dxTrigger } = event;\n setValue((value) => ({\n ...value,\n link: { label, ref },\n pending: true,\n }));\n trigger.current = dxTrigger;\n queueMicrotask(() => setOpen(true));\n void onLookup?.({ label, ref }).then((target) =>\n setValue((value) => ({\n ...value,\n target: target ?? undefined,\n pending: false,\n })),\n );\n },\n [onLookup],\n );\n\n useEffect(() => {\n return rootRef\n ? addEventListener(rootRef, 'dx-ref-tag-activate', handleDxRefTagActivate, customEventOptions)\n : undefined;\n }, [rootRef]);\n\n return (\n <RefPopoverContextProvider pending={value.pending} link={value.link} target={value.target}>\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.VirtualTrigger virtualRef={trigger as unknown as RefObject<HTMLButtonElement>} />\n <div role='none' className='contents' ref={setRootRef}>\n {children}\n </div>\n </Popover.Root>\n </RefPopoverContextProvider>\n );\n};\n\nexport const RefPopover = {\n Provider: RefPopoverProvider,\n};\n\nexport { useRefPopover };\n\nexport type { RefPopoverProviderProps, RefPopoverValue };\n"],
|
5
|
-
"mappings": ";AAIA,SAASA,qBAAqB;AAC9B,OAAOC,SAAiCC,QAAQC,UAAUC,WAAWC,mBAAmC;AAExG,SAASC,wBAAwB;AAEjC,SAASC,eAAe;AAIxB,IAAMC,qBAAqB;EAAEC,SAAS;EAAMC,SAAS;AAAM;AAI3D,IAAMC,cAAc;AACpB,IAAM,CAACC,2BAA2BC,aAAAA,IAAiBC,cAA+BH,aAA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allback", "addEventListener", "Popover", "customEventOptions", "capture", "passive", "REF_POPOVER", "RefPopoverContextProvider", "useRefPopover", "createContext", "RefPopoverProvider", "children", "onLookup", "trigger", "useRef", "value", "setValue", "useState", "rootRef", "setRootRef", "open", "setOpen", "handleDxRefTagActivate", "useCallback", "event", "ref", "label", "dxTrigger", "link", "pending", "current", "queueMicrotask", "then", "target", "undefined", "useEffect", "addEventListener", "Popover", "Root", "onOpenChange", "VirtualTrigger", "virtualRef", "div", "role", "className", "RefPopover", "Provider"]
|
7
|
-
}
|
@@ -1,101 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var testing_exports = {};
|
30
|
-
__export(testing_exports, {
|
31
|
-
RefPopover: () => RefPopover,
|
32
|
-
useRefPopover: () => useRefPopover
|
33
|
-
});
|
34
|
-
module.exports = __toCommonJS(testing_exports);
|
35
|
-
var import_react_context = require("@radix-ui/react-context");
|
36
|
-
var import_react = __toESM(require("react"));
|
37
|
-
var import_async = require("@dxos/async");
|
38
|
-
var import_react_ui = require("@dxos/react-ui");
|
39
|
-
var customEventOptions = {
|
40
|
-
capture: true,
|
41
|
-
passive: false
|
42
|
-
};
|
43
|
-
var REF_POPOVER = "RefPopover";
|
44
|
-
var [RefPopoverContextProvider, useRefPopover] = (0, import_react_context.createContext)(REF_POPOVER, {});
|
45
|
-
var RefPopoverProvider = ({ children, onLookup }) => {
|
46
|
-
const trigger = (0, import_react.useRef)(null);
|
47
|
-
const [value, setValue] = (0, import_react.useState)({});
|
48
|
-
const [rootRef, setRootRef] = (0, import_react.useState)(null);
|
49
|
-
const [open, setOpen] = (0, import_react.useState)(false);
|
50
|
-
const handleDxRefTagActivate = (0, import_react.useCallback)((event) => {
|
51
|
-
const { ref, label, trigger: dxTrigger } = event;
|
52
|
-
setValue((value2) => ({
|
53
|
-
...value2,
|
54
|
-
link: {
|
55
|
-
label,
|
56
|
-
ref
|
57
|
-
},
|
58
|
-
pending: true
|
59
|
-
}));
|
60
|
-
trigger.current = dxTrigger;
|
61
|
-
queueMicrotask(() => setOpen(true));
|
62
|
-
void onLookup?.({
|
63
|
-
label,
|
64
|
-
ref
|
65
|
-
}).then((target) => setValue((value2) => ({
|
66
|
-
...value2,
|
67
|
-
target: target ?? void 0,
|
68
|
-
pending: false
|
69
|
-
})));
|
70
|
-
}, [
|
71
|
-
onLookup
|
72
|
-
]);
|
73
|
-
(0, import_react.useEffect)(() => {
|
74
|
-
return rootRef ? (0, import_async.addEventListener)(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions) : void 0;
|
75
|
-
}, [
|
76
|
-
rootRef
|
77
|
-
]);
|
78
|
-
return /* @__PURE__ */ import_react.default.createElement(RefPopoverContextProvider, {
|
79
|
-
pending: value.pending,
|
80
|
-
link: value.link,
|
81
|
-
target: value.target
|
82
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Popover.Root, {
|
83
|
-
open,
|
84
|
-
onOpenChange: setOpen
|
85
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Popover.VirtualTrigger, {
|
86
|
-
virtualRef: trigger
|
87
|
-
}), /* @__PURE__ */ import_react.default.createElement("div", {
|
88
|
-
role: "none",
|
89
|
-
className: "contents",
|
90
|
-
ref: setRootRef
|
91
|
-
}, children)));
|
92
|
-
};
|
93
|
-
var RefPopover = {
|
94
|
-
Provider: RefPopoverProvider
|
95
|
-
};
|
96
|
-
// Annotate the CommonJS export names for ESM import in node:
|
97
|
-
0 && (module.exports = {
|
98
|
-
RefPopover,
|
99
|
-
useRefPopover
|
100
|
-
});
|
101
|
-
//# sourceMappingURL=index.cjs.map
|
@@ -1,7 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../../src/testing/RefPopover.tsx"],
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren, useRef, useState, useEffect, useCallback, type RefObject } from 'react';\n\nimport { addEventListener } from '@dxos/async';\nimport { type DxRefTag, type DxRefTagActivate } from '@dxos/lit-ui';\nimport { Popover } from '@dxos/react-ui';\n\nimport { type PreviewLinkRef, type PreviewLinkTarget, type PreviewLookup } from '../extensions';\n\nconst customEventOptions = { capture: true, passive: false };\n\n// Create a context for the dxn value.\ntype RefPopoverValue = Partial<{ link: PreviewLinkRef; target: PreviewLinkTarget; pending: boolean }>;\nconst REF_POPOVER = 'RefPopover';\nconst [RefPopoverContextProvider, useRefPopover] = createContext<RefPopoverValue>(REF_POPOVER, {});\n\ntype RefPopoverProviderProps = PropsWithChildren<{ onLookup?: PreviewLookup }>;\n\nconst RefPopoverProvider = ({ children, onLookup }: RefPopoverProviderProps) => {\n const trigger = useRef<DxRefTag | null>(null);\n const [value, setValue] = useState<RefPopoverValue>({});\n const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);\n const [open, setOpen] = useState(false);\n\n const handleDxRefTagActivate = useCallback(\n (event: DxRefTagActivate) => {\n const { ref, label, trigger: dxTrigger } = event;\n setValue((value) => ({\n ...value,\n link: { label, ref },\n pending: true,\n }));\n trigger.current = dxTrigger;\n queueMicrotask(() => setOpen(true));\n void onLookup?.({ label, ref }).then((target) =>\n setValue((value) => ({\n ...value,\n target: target ?? undefined,\n pending: false,\n })),\n );\n },\n [onLookup],\n );\n\n useEffect(() => {\n return rootRef\n ? addEventListener(rootRef, 'dx-ref-tag-activate', handleDxRefTagActivate, customEventOptions)\n : undefined;\n }, [rootRef]);\n\n return (\n <RefPopoverContextProvider pending={value.pending} link={value.link} target={value.target}>\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.VirtualTrigger virtualRef={trigger as unknown as RefObject<HTMLButtonElement>} />\n <div role='none' className='contents' ref={setRootRef}>\n {children}\n </div>\n </Popover.Root>\n </RefPopoverContextProvider>\n );\n};\n\nexport const RefPopover = {\n Provider: RefPopoverProvider,\n};\n\nexport { useRefPopover };\n\nexport type { RefPopoverProviderProps, RefPopoverValue };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAA8B;AAC9B,mBAAwG;AAExG,mBAAiC;AAEjC,sBAAwB;AAIxB,IAAMA,qBAAqB;EAAEC,SAAS;EAAMC,SAAS;AAAM;AAI3D,IAAMC,cAAc;AACpB,IAAM,CAACC,2BAA2BC,aAAAA,QAAiBC,oCAA+BH,aAAa,CAAC,CAAA;AAIhG,IAAMI,qBAAqB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POVER", "RefPopoverContextProvider", "useRefPopover", "createContext", "RefPopoverProvider", "children", "onLookup", "trigger", "useRef", "value", "setValue", "useState", "rootRef", "setRootRef", "open", "setOpen", "handleDxRefTagActivate", "useCallback", "event", "ref", "label", "dxTrigger", "link", "pending", "current", "queueMicrotask", "then", "target", "undefined", "useEffect", "addEventListener", "React", "Popover", "Root", "onOpenChange", "VirtualTrigger", "virtualRef", "div", "role", "className", "RefPopover", "Provider"]
|
7
|
-
}
|
@@ -1,69 +0,0 @@
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
2
|
-
|
3
|
-
// packages/ui/react-ui-editor/src/testing/RefPopover.tsx
|
4
|
-
import { createContext } from "@radix-ui/react-context";
|
5
|
-
import React, { useRef, useState, useEffect, useCallback } from "react";
|
6
|
-
import { addEventListener } from "@dxos/async";
|
7
|
-
import { Popover } from "@dxos/react-ui";
|
8
|
-
var customEventOptions = {
|
9
|
-
capture: true,
|
10
|
-
passive: false
|
11
|
-
};
|
12
|
-
var REF_POPOVER = "RefPopover";
|
13
|
-
var [RefPopoverContextProvider, useRefPopover] = createContext(REF_POPOVER, {});
|
14
|
-
var RefPopoverProvider = ({ children, onLookup }) => {
|
15
|
-
const trigger = useRef(null);
|
16
|
-
const [value, setValue] = useState({});
|
17
|
-
const [rootRef, setRootRef] = useState(null);
|
18
|
-
const [open, setOpen] = useState(false);
|
19
|
-
const handleDxRefTagActivate = useCallback((event) => {
|
20
|
-
const { ref, label, trigger: dxTrigger } = event;
|
21
|
-
setValue((value2) => ({
|
22
|
-
...value2,
|
23
|
-
link: {
|
24
|
-
label,
|
25
|
-
ref
|
26
|
-
},
|
27
|
-
pending: true
|
28
|
-
}));
|
29
|
-
trigger.current = dxTrigger;
|
30
|
-
queueMicrotask(() => setOpen(true));
|
31
|
-
void onLookup?.({
|
32
|
-
label,
|
33
|
-
ref
|
34
|
-
}).then((target) => setValue((value2) => ({
|
35
|
-
...value2,
|
36
|
-
target: target ?? void 0,
|
37
|
-
pending: false
|
38
|
-
})));
|
39
|
-
}, [
|
40
|
-
onLookup
|
41
|
-
]);
|
42
|
-
useEffect(() => {
|
43
|
-
return rootRef ? addEventListener(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions) : void 0;
|
44
|
-
}, [
|
45
|
-
rootRef
|
46
|
-
]);
|
47
|
-
return /* @__PURE__ */ React.createElement(RefPopoverContextProvider, {
|
48
|
-
pending: value.pending,
|
49
|
-
link: value.link,
|
50
|
-
target: value.target
|
51
|
-
}, /* @__PURE__ */ React.createElement(Popover.Root, {
|
52
|
-
open,
|
53
|
-
onOpenChange: setOpen
|
54
|
-
}, /* @__PURE__ */ React.createElement(Popover.VirtualTrigger, {
|
55
|
-
virtualRef: trigger
|
56
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
57
|
-
role: "none",
|
58
|
-
className: "contents",
|
59
|
-
ref: setRootRef
|
60
|
-
}, children)));
|
61
|
-
};
|
62
|
-
var RefPopover = {
|
63
|
-
Provider: RefPopoverProvider
|
64
|
-
};
|
65
|
-
export {
|
66
|
-
RefPopover,
|
67
|
-
useRefPopover
|
68
|
-
};
|
69
|
-
//# sourceMappingURL=index.mjs.map
|
@@ -1,7 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../../src/testing/RefPopover.tsx"],
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren, useRef, useState, useEffect, useCallback, type RefObject } from 'react';\n\nimport { addEventListener } from '@dxos/async';\nimport { type DxRefTag, type DxRefTagActivate } from '@dxos/lit-ui';\nimport { Popover } from '@dxos/react-ui';\n\nimport { type PreviewLinkRef, type PreviewLinkTarget, type PreviewLookup } from '../extensions';\n\nconst customEventOptions = { capture: true, passive: false };\n\n// Create a context for the dxn value.\ntype RefPopoverValue = Partial<{ link: PreviewLinkRef; target: PreviewLinkTarget; pending: boolean }>;\nconst REF_POPOVER = 'RefPopover';\nconst [RefPopoverContextProvider, useRefPopover] = createContext<RefPopoverValue>(REF_POPOVER, {});\n\ntype RefPopoverProviderProps = PropsWithChildren<{ onLookup?: PreviewLookup }>;\n\nconst RefPopoverProvider = ({ children, onLookup }: RefPopoverProviderProps) => {\n const trigger = useRef<DxRefTag | null>(null);\n const [value, setValue] = useState<RefPopoverValue>({});\n const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);\n const [open, setOpen] = useState(false);\n\n const handleDxRefTagActivate = useCallback(\n (event: DxRefTagActivate) => {\n const { ref, label, trigger: dxTrigger } = event;\n setValue((value) => ({\n ...value,\n link: { label, ref },\n pending: true,\n }));\n trigger.current = dxTrigger;\n queueMicrotask(() => setOpen(true));\n void onLookup?.({ label, ref }).then((target) =>\n setValue((value) => ({\n ...value,\n target: target ?? undefined,\n pending: false,\n })),\n );\n },\n [onLookup],\n );\n\n useEffect(() => {\n return rootRef\n ? addEventListener(rootRef, 'dx-ref-tag-activate', handleDxRefTagActivate, customEventOptions)\n : undefined;\n }, [rootRef]);\n\n return (\n <RefPopoverContextProvider pending={value.pending} link={value.link} target={value.target}>\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.VirtualTrigger virtualRef={trigger as unknown as RefObject<HTMLButtonElement>} />\n <div role='none' className='contents' ref={setRootRef}>\n {children}\n </div>\n </Popover.Root>\n </RefPopoverContextProvider>\n );\n};\n\nexport const RefPopover = {\n Provider: RefPopoverProvider,\n};\n\nexport { useRefPopover };\n\nexport type { RefPopoverProviderProps, RefPopoverValue };\n"],
|
5
|
-
"mappings": ";;;AAIA,SAASA,qBAAqB;AAC9B,OAAOC,SAAiCC,QAAQC,UAAUC,WAAWC,mBAAmC;AAExG,SAASC,wBAAwB;AAEjC,SAASC,eAAe;AAIxB,IAAMC,qBAAqB;EAAEC,SAAS;EAAMC,SAAS;AAAM;AAI3D,IAAMC,cAAc;AACpB,IAAM,CAACC,2BAA2BC,aAAAA,IAAiBC,c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"useEffect", "useCallback", "addEventListener", "Popover", "customEventOptions", "capture", "passive", "REF_POPOVER", "RefPopoverContextProvider", "useRefPopover", "createContext", "RefPopoverProvider", "children", "onLookup", "trigger", "useRef", "value", "setValue", "useState", "rootRef", "setRootRef", "open", "setOpen", "handleDxRefTagActivate", "useCallback", "event", "ref", "label", "dxTrigger", "link", "pending", "current", "queueMicrotask", "then", "target", "undefined", "useEffect", "addEventListener", "Popover", "Root", "onOpenChange", "VirtualTrigger", "virtualRef", "div", "role", "className", "RefPopover", "Provider"]
|
7
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"view-mode.d.ts","sourceRoot":"","sources":["../../../../../src/components/EditorToolbar/view-mode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAA+C,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AA6B9F,eAAO,MAAM,cAAc,UAAW,kBAAkB;;;;;;;;;;;;;;CAWvD,CAAC"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { type KeyBinding, type Command } from '@codemirror/view';
|
2
|
-
export type Action = {
|
3
|
-
type: 'insert';
|
4
|
-
text: string;
|
5
|
-
} | {
|
6
|
-
type: 'cancel';
|
7
|
-
};
|
8
|
-
export type ActionHandler = (action: Action) => void;
|
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
|
-
//# sourceMappingURL=action.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/action.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AAIlF,MAAM,MAAM,MAAM,GACd;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEN,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAErD,eAAO,MAAM,UAAU;SAA6B,MAAM;gBAAc,OAAO;EAAK,CAAC;AACrF,eAAO,MAAM,WAAW,mDAA6B,CAAC;AAEtD,eAAO,MAAM,WAAW,EAAE,OAWzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAO1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EAGnD,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/preview/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
@@ -1,39 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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 +0,0 @@
|
|
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 +0,0 @@
|
|
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,CAAC;AAE1B,OA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
-
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,13 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|