@dxos/react-ui-editor 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a
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/{chunk-22UMM3QJ.mjs → chunk-HL3YF6WC.mjs} +2 -2
- package/dist/lib/browser/chunk-HL3YF6WC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5482 -5519
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +71 -1
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-YXYQPV6R.mjs → chunk-YJZGD3LY.mjs} +2 -2
- package/dist/lib/node-esm/chunk-YJZGD3LY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5482 -5519
- 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 +71 -1
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/components/Editor/Editor.d.ts +24 -9
- package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
- package/dist/types/src/components/Editor/Editor.stories.d.ts +27 -0
- package/dist/types/src/components/Editor/Editor.stories.d.ts.map +1 -0
- package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/util.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions/{autocomplete.d.ts → autocomplete/autocomplete.d.ts} +1 -1
- package/dist/types/src/extensions/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/types/src/extensions/autocomplete/index.d.ts +5 -0
- package/dist/types/src/extensions/autocomplete/index.d.ts.map +1 -0
- package/dist/types/src/extensions/autocomplete/match.d.ts +13 -0
- package/dist/types/src/extensions/autocomplete/match.d.ts.map +1 -0
- package/dist/types/src/extensions/autocomplete/placeholder.d.ts +20 -0
- package/dist/types/src/extensions/autocomplete/placeholder.d.ts.map +1 -0
- package/dist/types/src/extensions/autocomplete/typeahead.d.ts +10 -0
- package/dist/types/src/extensions/autocomplete/typeahead.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/automerge.d.ts +1 -1
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/sync.d.ts +2 -2
- package/dist/types/src/extensions/automerge/sync.d.ts.map +1 -1
- package/dist/types/src/extensions/autoscroll.d.ts +2 -2
- package/dist/types/src/extensions/autoscroll.d.ts.map +1 -1
- package/dist/types/src/extensions/factories.d.ts +7 -2
- package/dist/types/src/extensions/factories.d.ts.map +1 -1
- package/dist/types/src/extensions/focus.d.ts.map +1 -1
- package/dist/types/src/extensions/folding.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +2 -1
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/json.d.ts +1 -1
- package/dist/types/src/extensions/json.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -1
- package/dist/types/src/extensions/modes.d.ts +1 -1
- package/dist/types/src/extensions/modes.d.ts.map +1 -1
- package/dist/types/src/extensions/outliner/menu.d.ts +8 -0
- package/dist/types/src/extensions/outliner/menu.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/PopoverMenuProvider.d.ts +36 -0
- package/dist/types/src/extensions/popover/PopoverMenuProvider.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/index.d.ts +8 -0
- package/dist/types/src/extensions/popover/index.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/menu-presets.d.ts +4 -0
- package/dist/types/src/extensions/popover/menu-presets.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/menu.d.ts +24 -0
- package/dist/types/src/extensions/popover/menu.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/modal.d.ts +7 -0
- package/dist/types/src/extensions/popover/modal.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/popover.d.ts +47 -0
- package/dist/types/src/extensions/popover/popover.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/usePopoverMenu.d.ts +34 -0
- package/dist/types/src/extensions/popover/usePopoverMenu.d.ts.map +1 -0
- package/dist/types/src/extensions/popover/util.d.ts +8 -0
- package/dist/types/src/extensions/popover/util.d.ts.map +1 -0
- package/dist/types/src/extensions/preview/preview.d.ts +0 -2
- package/dist/types/src/extensions/preview/preview.d.ts.map +1 -1
- package/dist/types/src/extensions/state.d.ts +2 -0
- package/dist/types/src/extensions/state.d.ts.map +1 -0
- package/dist/types/src/extensions/tags/streamer.d.ts.map +1 -1
- package/dist/types/src/extensions/tags/xml-tags.d.ts +1 -0
- package/dist/types/src/extensions/tags/xml-tags.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextEditor.d.ts +4 -8
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
- package/dist/types/src/stories/{Command.stories.d.ts → CommandDialog.stories.d.ts} +2 -3
- package/dist/types/src/stories/CommandDialog.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Comments.stories.d.ts +3 -4
- package/dist/types/src/stories/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/stories/EditorToolbar.stories.d.ts +1 -2
- package/dist/types/src/stories/EditorToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/stories/Experimental.stories.d.ts +3 -4
- package/dist/types/src/stories/Experimental.stories.d.ts.map +1 -1
- package/dist/types/src/stories/Markdown.stories.d.ts +3 -4
- package/dist/types/src/stories/Markdown.stories.d.ts.map +1 -1
- package/dist/types/src/stories/Outliner.stories.d.ts +0 -1
- package/dist/types/src/stories/Outliner.stories.d.ts.map +1 -1
- package/dist/types/src/stories/{CommandMenu.stories.d.ts → Popover.stories.d.ts} +6 -6
- package/dist/types/src/stories/Popover.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Preview.stories.d.ts +3 -4
- package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
- package/dist/types/src/stories/Tags.stories.d.ts +0 -1
- package/dist/types/src/stories/Tags.stories.d.ts.map +1 -1
- package/dist/types/src/stories/TextEditor.stories.d.ts +3 -5
- package/dist/types/src/stories/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/stories/components/EditorStory.d.ts +5 -5
- package/dist/types/src/stories/components/EditorStory.d.ts.map +1 -1
- package/dist/types/src/styles/theme.d.ts.map +1 -1
- package/dist/types/src/testing/PreviewPopover.d.ts +20 -0
- package/dist/types/src/testing/PreviewPopover.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +0 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -52
- package/src/components/Editor/Editor.stories.tsx +69 -0
- package/src/components/Editor/Editor.tsx +57 -14
- package/src/components/EditorToolbar/EditorToolbar.tsx +1 -0
- package/src/components/index.ts +0 -1
- package/src/extensions/{autocomplete.ts → autocomplete/autocomplete.ts} +2 -1
- package/src/extensions/autocomplete/index.ts +8 -0
- package/src/extensions/autocomplete/match.ts +46 -0
- package/src/extensions/{command → autocomplete}/placeholder.ts +21 -17
- package/src/extensions/{command → autocomplete}/typeahead.ts +6 -48
- package/src/extensions/automerge/automerge.stories.tsx +8 -8
- package/src/extensions/automerge/automerge.ts +28 -9
- package/src/extensions/automerge/sync.ts +7 -3
- package/src/extensions/autoscroll.ts +43 -37
- package/src/extensions/factories.ts +41 -12
- package/src/extensions/focus.ts +5 -4
- package/src/extensions/folding.tsx +4 -6
- package/src/extensions/hashtag.tsx +2 -2
- package/src/extensions/index.ts +2 -1
- package/src/extensions/json.ts +1 -1
- package/src/extensions/markdown/bundle.ts +16 -4
- package/src/extensions/markdown/decorate.ts +1 -0
- package/src/extensions/markdown/link.ts +3 -0
- package/src/extensions/modes.ts +2 -2
- package/src/extensions/{command/floating-menu.ts → outliner/menu.ts} +15 -20
- package/src/extensions/outliner/outliner.ts +3 -3
- package/src/extensions/popover/PopoverMenuProvider.tsx +221 -0
- package/src/extensions/popover/index.ts +12 -0
- package/src/extensions/popover/menu-presets.ts +124 -0
- package/src/extensions/popover/menu.ts +67 -0
- package/src/extensions/popover/modal.ts +24 -0
- package/src/extensions/popover/popover.ts +291 -0
- package/src/extensions/popover/usePopoverMenu.ts +173 -0
- package/src/extensions/popover/util.ts +29 -0
- package/src/extensions/preview/index.ts +1 -1
- package/src/extensions/preview/preview.ts +0 -5
- package/src/extensions/selection.ts +2 -2
- package/src/extensions/state.ts +7 -0
- package/src/extensions/tags/streamer.ts +4 -5
- package/src/extensions/tags/xml-tags.ts +59 -1
- package/src/hooks/useTextEditor.ts +27 -39
- package/src/stories/{Command.stories.tsx → CommandDialog.stories.tsx} +10 -22
- package/src/stories/Comments.stories.tsx +5 -5
- package/src/stories/EditorToolbar.stories.tsx +6 -5
- package/src/stories/Experimental.stories.tsx +6 -6
- package/src/stories/Markdown.stories.tsx +5 -5
- package/src/stories/Outliner.stories.tsx +42 -26
- package/src/stories/Popover.stories.tsx +163 -0
- package/src/stories/Preview.stories.tsx +9 -9
- package/src/stories/Tags.stories.tsx +5 -5
- package/src/stories/TextEditor.stories.tsx +7 -32
- package/src/stories/components/EditorStory.tsx +7 -5
- package/src/styles/theme.ts +12 -10
- package/src/{components/Popover/RefDropdownMenu.tsx → testing/PreviewPopover.tsx} +20 -29
- package/src/testing/index.ts +1 -0
- package/src/types/types.ts +1 -1
- package/src/util/index.ts +0 -1
- package/dist/lib/browser/chunk-22UMM3QJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YXYQPV6R.mjs.map +0 -7
- package/dist/types/src/components/Popover/CommandMenu.d.ts +0 -34
- package/dist/types/src/components/Popover/CommandMenu.d.ts.map +0 -1
- package/dist/types/src/components/Popover/RefDropdownMenu.d.ts +0 -14
- package/dist/types/src/components/Popover/RefDropdownMenu.d.ts.map +0 -1
- package/dist/types/src/components/Popover/RefPopover.d.ts +0 -37
- package/dist/types/src/components/Popover/RefPopover.d.ts.map +0 -1
- package/dist/types/src/components/Popover/index.d.ts +0 -4
- package/dist/types/src/components/Popover/index.d.ts.map +0 -1
- package/dist/types/src/extensions/autocomplete.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/command/command-menu.d.ts +0 -20
- package/dist/types/src/extensions/command/command-menu.d.ts.map +0 -1
- package/dist/types/src/extensions/command/command.d.ts +0 -6
- package/dist/types/src/extensions/command/command.d.ts.map +0 -1
- package/dist/types/src/extensions/command/floating-menu.d.ts +0 -7
- package/dist/types/src/extensions/command/floating-menu.d.ts.map +0 -1
- package/dist/types/src/extensions/command/hint.d.ts +0 -19
- package/dist/types/src/extensions/command/hint.d.ts.map +0 -1
- package/dist/types/src/extensions/command/index.d.ts +0 -7
- package/dist/types/src/extensions/command/index.d.ts.map +0 -1
- package/dist/types/src/extensions/command/placeholder.d.ts +0 -10
- package/dist/types/src/extensions/command/placeholder.d.ts.map +0 -1
- package/dist/types/src/extensions/command/state.d.ts +0 -16
- package/dist/types/src/extensions/command/state.d.ts.map +0 -1
- package/dist/types/src/extensions/command/typeahead.d.ts +0 -22
- package/dist/types/src/extensions/command/typeahead.d.ts.map +0 -1
- package/dist/types/src/extensions/command/useCommandMenu.d.ts +0 -26
- package/dist/types/src/extensions/command/useCommandMenu.d.ts.map +0 -1
- package/dist/types/src/stories/Command.stories.d.ts.map +0 -1
- package/dist/types/src/stories/CommandMenu.stories.d.ts.map +0 -1
- package/dist/types/src/util/domino.d.ts +0 -18
- package/dist/types/src/util/domino.d.ts.map +0 -1
- package/src/components/Popover/CommandMenu.tsx +0 -279
- package/src/components/Popover/RefPopover.tsx +0 -117
- package/src/components/Popover/index.ts +0 -7
- package/src/extensions/command/action.ts +0 -56
- package/src/extensions/command/command-menu.ts +0 -211
- package/src/extensions/command/command.ts +0 -34
- package/src/extensions/command/hint.ts +0 -103
- package/src/extensions/command/index.ts +0 -10
- package/src/extensions/command/state.ts +0 -90
- package/src/extensions/command/useCommandMenu.ts +0 -119
- package/src/stories/CommandMenu.stories.tsx +0 -160
- package/src/util/domino.ts +0 -51
|
@@ -2,20 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { javascript } from '@codemirror/lang-javascript';
|
|
8
6
|
import { openSearchPanel } from '@codemirror/search';
|
|
9
7
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
10
8
|
import React from 'react';
|
|
11
9
|
|
|
12
10
|
import { log } from '@dxos/log';
|
|
13
|
-
import {
|
|
11
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
|
|
15
13
|
import { editorMonospace } from '../defaults';
|
|
16
14
|
import {
|
|
17
15
|
InputModeExtensions,
|
|
18
|
-
autocomplete,
|
|
19
16
|
decorateMarkdown,
|
|
20
17
|
folding,
|
|
21
18
|
image,
|
|
@@ -34,18 +31,19 @@ import {
|
|
|
34
31
|
defaultExtensions,
|
|
35
32
|
global,
|
|
36
33
|
largeWithImages,
|
|
37
|
-
links,
|
|
38
34
|
longText,
|
|
39
35
|
names,
|
|
40
|
-
renderLinkButton,
|
|
41
36
|
text,
|
|
42
37
|
} from './components';
|
|
43
38
|
|
|
44
39
|
const meta = {
|
|
45
40
|
title: 'ui/react-ui-editor/TextEditor',
|
|
46
41
|
component: EditorStory,
|
|
47
|
-
decorators: [withTheme
|
|
48
|
-
parameters: {
|
|
42
|
+
decorators: [withTheme],
|
|
43
|
+
parameters: {
|
|
44
|
+
layout: 'fullscreen',
|
|
45
|
+
controls: { disable: true },
|
|
46
|
+
},
|
|
49
47
|
} satisfies Meta<typeof EditorStory>;
|
|
50
48
|
|
|
51
49
|
export default meta;
|
|
@@ -188,40 +186,17 @@ export const Typescript: Story = {
|
|
|
188
186
|
),
|
|
189
187
|
};
|
|
190
188
|
|
|
191
|
-
//
|
|
192
|
-
// Autocomplete
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
export const Autocomplete: Story = {
|
|
196
|
-
render: () => (
|
|
197
|
-
<EditorStory
|
|
198
|
-
text={str('# Autocomplete', '', 'Press Ctrl-Space...', content.footer)}
|
|
199
|
-
extensions={[
|
|
200
|
-
decorateMarkdown({ renderLinkButton }),
|
|
201
|
-
autocomplete({
|
|
202
|
-
onSuggest: (text) => {
|
|
203
|
-
return links
|
|
204
|
-
.filter(({ label }) => label.toLowerCase().includes(text.toLowerCase()))
|
|
205
|
-
.map(({ label }) => label);
|
|
206
|
-
},
|
|
207
|
-
}),
|
|
208
|
-
]}
|
|
209
|
-
/>
|
|
210
|
-
),
|
|
211
|
-
};
|
|
212
|
-
|
|
213
189
|
//
|
|
214
190
|
// Typeahead
|
|
215
191
|
//
|
|
216
192
|
|
|
217
|
-
const completions = ['
|
|
193
|
+
const completions = ['hello world!', 'dxos.org'];
|
|
218
194
|
|
|
219
195
|
export const Typeahead: Story = {
|
|
220
196
|
render: () => (
|
|
221
197
|
<EditorStory
|
|
222
198
|
text={str('# Typeahead', '')}
|
|
223
199
|
extensions={[
|
|
224
|
-
decorateMarkdown({ renderLinkButton }),
|
|
225
200
|
typeahead({
|
|
226
201
|
onComplete: staticCompletion(completions, { minLength: 2 }),
|
|
227
202
|
}),
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
6
|
import React, { type ReactNode, forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Expando } from '@dxos/echo
|
|
8
|
+
import { Expando } from '@dxos/echo/internal';
|
|
9
|
+
import { live } from '@dxos/echo/internal';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
10
11
|
import { PublicKey } from '@dxos/keys';
|
|
11
|
-
import { live } from '@dxos/live-object';
|
|
12
12
|
import { createDocAccessor, createObject } from '@dxos/react-client/echo';
|
|
13
13
|
import { useForwardedRef, useThemeContext } from '@dxos/react-ui';
|
|
14
14
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
createMarkdownExtensions,
|
|
26
26
|
createThemeExtensions,
|
|
27
27
|
debugTree,
|
|
28
|
+
decorateMarkdown,
|
|
28
29
|
} from '../../extensions';
|
|
29
30
|
import { type UseTextEditorProps, useTextEditor } from '../../hooks';
|
|
30
31
|
|
|
@@ -45,7 +46,7 @@ export type StoryProps = Pick<UseTextEditorProps, 'id' | 'scrollTo' | 'selection
|
|
|
45
46
|
onReady?: (view: EditorView) => void;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
export const EditorStory = forwardRef<EditorView |
|
|
49
|
+
export const EditorStory = forwardRef<EditorView | null, StoryProps>(
|
|
49
50
|
({ debug, debugCustom, text, extensions: _extensions, ...props }, forwardedRef) => {
|
|
50
51
|
const attentionAttrs = useAttentionAttributes('test-panel');
|
|
51
52
|
const [tree, setTree] = useState<DebugNode>();
|
|
@@ -83,7 +84,7 @@ export const EditorStory = forwardRef<EditorView | undefined, StoryProps>(
|
|
|
83
84
|
/**
|
|
84
85
|
* Default story component.
|
|
85
86
|
*/
|
|
86
|
-
export const EditorComponent = forwardRef<EditorView |
|
|
87
|
+
export const EditorComponent = forwardRef<EditorView | null, StoryProps>(
|
|
87
88
|
(
|
|
88
89
|
{
|
|
89
90
|
id = defaultId,
|
|
@@ -114,6 +115,7 @@ export const EditorComponent = forwardRef<EditorView | undefined, StoryProps>(
|
|
|
114
115
|
createBasicExtensions({ readOnly, placeholder, lineNumbers, scrollPastEnd: true, search: true }),
|
|
115
116
|
createMarkdownExtensions(),
|
|
116
117
|
createThemeExtensions({ themeMode, syntaxHighlighting: true, slots }),
|
|
118
|
+
decorateMarkdown(),
|
|
117
119
|
editorGutter,
|
|
118
120
|
extensions || [],
|
|
119
121
|
],
|
|
@@ -121,7 +123,7 @@ export const EditorComponent = forwardRef<EditorView | undefined, StoryProps>(
|
|
|
121
123
|
[id, object, extensions, themeMode],
|
|
122
124
|
);
|
|
123
125
|
|
|
124
|
-
useImperativeHandle(forwardedRef, () => view, [view]);
|
|
126
|
+
useImperativeHandle<EditorView | null, EditorView | null>(forwardedRef, () => view, [view]);
|
|
125
127
|
|
|
126
128
|
useEffect(() => {
|
|
127
129
|
if (view) {
|
package/src/styles/theme.ts
CHANGED
|
@@ -110,6 +110,7 @@ export const defaultTheme: ThemeStyles = {
|
|
|
110
110
|
borderLeft: '2px solid var(--dx-cmCursor)',
|
|
111
111
|
},
|
|
112
112
|
'.cm-placeholder': {
|
|
113
|
+
fontFamily: fontBody,
|
|
113
114
|
color: 'var(--dx-placeholder)',
|
|
114
115
|
},
|
|
115
116
|
|
|
@@ -156,7 +157,7 @@ export const defaultTheme: ThemeStyles = {
|
|
|
156
157
|
* Tooltip.
|
|
157
158
|
*/
|
|
158
159
|
'.cm-tooltip': {
|
|
159
|
-
background: 'var(--dx-
|
|
160
|
+
background: 'var(--dx-baseSurface)',
|
|
160
161
|
},
|
|
161
162
|
'.cm-tooltip-below': {},
|
|
162
163
|
|
|
@@ -165,10 +166,10 @@ export const defaultTheme: ThemeStyles = {
|
|
|
165
166
|
* https://github.com/codemirror/autocomplete/blob/main/src/completion.ts
|
|
166
167
|
*/
|
|
167
168
|
'.cm-tooltip.cm-tooltip-autocomplete': {
|
|
168
|
-
marginTop: '
|
|
169
|
-
marginLeft: '-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
marginTop: '6px',
|
|
170
|
+
marginLeft: '-10px',
|
|
171
|
+
border: '2px solid var(--dx-separator)',
|
|
172
|
+
borderRadius: '4px',
|
|
172
173
|
},
|
|
173
174
|
'.cm-tooltip.cm-tooltip-autocomplete > ul': {
|
|
174
175
|
maxHeight: '20em',
|
|
@@ -177,13 +178,12 @@ export const defaultTheme: ThemeStyles = {
|
|
|
177
178
|
padding: '4px',
|
|
178
179
|
},
|
|
179
180
|
'.cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]': {
|
|
180
|
-
background: 'var(--dx-
|
|
181
|
-
color: 'var(--dx-
|
|
181
|
+
background: 'var(--dx-activeSurface)',
|
|
182
|
+
color: 'var(--dx-activeSurfaceText)',
|
|
182
183
|
},
|
|
183
184
|
'.cm-tooltip.cm-tooltip-autocomplete > ul > completion-section': {
|
|
184
185
|
paddingLeft: '4px !important',
|
|
185
|
-
|
|
186
|
-
color: 'var(--dx-accentText)',
|
|
186
|
+
color: 'var(--dx-hoverSurfaceText)',
|
|
187
187
|
},
|
|
188
188
|
|
|
189
189
|
'.cm-completionInfo': {
|
|
@@ -197,10 +197,12 @@ export const defaultTheme: ThemeStyles = {
|
|
|
197
197
|
},
|
|
198
198
|
'.cm-completionLabel': {
|
|
199
199
|
fontFamily: fontBody,
|
|
200
|
+
color: 'var(--dx-description)',
|
|
201
|
+
padding: '0 4px',
|
|
200
202
|
},
|
|
201
203
|
'.cm-completionMatchedText': {
|
|
202
204
|
textDecoration: 'none !important',
|
|
203
|
-
|
|
205
|
+
color: 'var(--dx-baseText)',
|
|
204
206
|
},
|
|
205
207
|
|
|
206
208
|
/**
|
|
@@ -6,38 +6,28 @@ import { createContext } from '@radix-ui/react-context';
|
|
|
6
6
|
import React, { type PropsWithChildren, type RefObject, useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { addEventListener } from '@dxos/async';
|
|
9
|
-
import { type
|
|
10
|
-
import { DropdownMenu } from '@dxos/react-ui';
|
|
9
|
+
import { type DxAnchorActivate, Popover } from '@dxos/react-ui';
|
|
11
10
|
|
|
12
|
-
import { type PreviewLinkRef, type PreviewLinkTarget
|
|
11
|
+
import { type PreviewLinkRef, type PreviewLinkTarget } from '../extensions';
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
type PreviewLookup = (link: PreviewLinkRef) => Promise<PreviewLinkTarget | null | undefined>;
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
// Context
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
type RefDropdownMenuValue = Partial<{
|
|
15
|
+
type PreviewPopoverValue = Partial<{
|
|
21
16
|
link: PreviewLinkRef;
|
|
22
17
|
target: PreviewLinkTarget;
|
|
23
18
|
pending: boolean;
|
|
24
19
|
}>;
|
|
25
20
|
|
|
26
|
-
const [
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
// Context Provider
|
|
30
|
-
// NOTE: This is handled by the preview-plugin.
|
|
31
|
-
//
|
|
21
|
+
const [PreviewPopoverContextProvider, usePreviewPopover] = createContext<PreviewPopoverValue>('PreviewPopover', {});
|
|
32
22
|
|
|
33
|
-
type
|
|
23
|
+
type PopoverLookupProviderProps = PropsWithChildren<{
|
|
34
24
|
onLookup?: PreviewLookup;
|
|
35
25
|
}>;
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const [
|
|
27
|
+
// TOOD(burdon): Reconcile with PreviewPlugin?
|
|
28
|
+
const PreviewPopoverProvider = ({ children, onLookup }: PopoverLookupProviderProps) => {
|
|
29
|
+
const trigger = useRef<HTMLElement | null>(null);
|
|
30
|
+
const [value, setValue] = useState<PreviewPopoverValue>({});
|
|
41
31
|
const [open, setOpen] = useState(false);
|
|
42
32
|
|
|
43
33
|
const handleDxAnchorActivate = useCallback(
|
|
@@ -61,8 +51,9 @@ const RefDropdownMenuProvider = ({ children, onLookup }: RefDropdownMenuProvider
|
|
|
61
51
|
[onLookup],
|
|
62
52
|
);
|
|
63
53
|
|
|
54
|
+
const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);
|
|
64
55
|
useEffect(() => {
|
|
65
|
-
if (!rootRef) {
|
|
56
|
+
if (!rootRef || !handleDxAnchorActivate) {
|
|
66
57
|
return;
|
|
67
58
|
}
|
|
68
59
|
|
|
@@ -70,20 +61,20 @@ const RefDropdownMenuProvider = ({ children, onLookup }: RefDropdownMenuProvider
|
|
|
70
61
|
capture: true,
|
|
71
62
|
passive: false,
|
|
72
63
|
});
|
|
73
|
-
}, [rootRef]);
|
|
64
|
+
}, [rootRef, handleDxAnchorActivate]);
|
|
74
65
|
|
|
75
66
|
return (
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
<
|
|
67
|
+
<PreviewPopoverContextProvider pending={value.pending} link={value.link} target={value.target}>
|
|
68
|
+
<Popover.Root open={open} onOpenChange={setOpen}>
|
|
69
|
+
<Popover.VirtualTrigger virtualRef={trigger as unknown as RefObject<HTMLButtonElement>} />
|
|
79
70
|
<div role='none' className='contents' ref={setRootRef}>
|
|
80
71
|
{children}
|
|
81
72
|
</div>
|
|
82
|
-
</
|
|
83
|
-
</
|
|
73
|
+
</Popover.Root>
|
|
74
|
+
</PreviewPopoverContextProvider>
|
|
84
75
|
);
|
|
85
76
|
};
|
|
86
77
|
|
|
87
|
-
export {
|
|
78
|
+
export { PreviewPopoverProvider, usePreviewPopover };
|
|
88
79
|
|
|
89
|
-
export type {
|
|
80
|
+
export type { PopoverLookupProviderProps, PreviewPopoverValue };
|
package/src/testing/index.ts
CHANGED
package/src/types/types.ts
CHANGED
package/src/util/index.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type EditorView } from '@codemirror/view';\nimport { Schema } from 'effect';\n\n// Runtime data structure.\nexport type Range = {\n from: number;\n to: number;\n};\n\n// Persistent data structure.\n// TODO(burdon): Rename annotation?\nexport type Comment = {\n id: string;\n cursor?: string;\n};\n\n/**\n * Callback that renders into a DOM element within the editor.\n */\nexport type RenderCallback<Props extends object> = (el: HTMLElement, props: Props, view: EditorView) => void;\n\nexport const EditorViewModes = ['preview', 'readonly', 'source'] as const;\nexport const EditorViewMode = Schema.Union(...EditorViewModes.map((mode) => Schema.Literal(mode)));\nexport type EditorViewMode = Schema.Schema.Type<typeof EditorViewMode>;\n\nexport const EditorInputModes = ['default', 'vim', 'vscode'] as const;\nexport const EditorInputMode = Schema.Union(...EditorInputModes.map((mode) => Schema.Literal(mode)));\nexport type EditorInputMode = Schema.Schema.Type<typeof EditorInputMode>;\n"],
|
|
5
|
-
"mappings": ";AAKA,SAASA,cAAc;AAoBhB,IAAMC,kBAAkB;EAAC;EAAW;EAAY;;AAChD,IAAMC,iBAAiBC,OAAOC,MAAK,GAAIH,gBAAgBI,IAAI,CAACC,SAASH,OAAOI,QAAQD,IAAAA,CAAAA,CAAAA;AAGpF,IAAME,mBAAmB;EAAC;EAAW;EAAO;;AAC5C,IAAMC,kBAAkBN,OAAOC,MAAK,GAAII,iBAAiBH,IAAI,CAACC,SAASH,OAAOI,QAAQD,IAAAA,CAAAA,CAAAA;",
|
|
6
|
-
"names": ["Schema", "EditorViewModes", "EditorViewMode", "Schema", "Union", "map", "mode", "Literal", "EditorInputModes", "EditorInputMode"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type EditorView } from '@codemirror/view';\nimport { Schema } from 'effect';\n\n// Runtime data structure.\nexport type Range = {\n from: number;\n to: number;\n};\n\n// Persistent data structure.\n// TODO(burdon): Rename annotation?\nexport type Comment = {\n id: string;\n cursor?: string;\n};\n\n/**\n * Callback that renders into a DOM element within the editor.\n */\nexport type RenderCallback<Props extends object> = (el: HTMLElement, props: Props, view: EditorView) => void;\n\nexport const EditorViewModes = ['preview', 'readonly', 'source'] as const;\nexport const EditorViewMode = Schema.Union(...EditorViewModes.map((mode) => Schema.Literal(mode)));\nexport type EditorViewMode = Schema.Schema.Type<typeof EditorViewMode>;\n\nexport const EditorInputModes = ['default', 'vim', 'vscode'] as const;\nexport const EditorInputMode = Schema.Union(...EditorInputModes.map((mode) => Schema.Literal(mode)));\nexport type EditorInputMode = Schema.Schema.Type<typeof EditorInputMode>;\n"],
|
|
5
|
-
"mappings": ";;;AAKA,SAASA,cAAc;AAoBhB,IAAMC,kBAAkB;EAAC;EAAW;EAAY;;AAChD,IAAMC,iBAAiBC,OAAOC,MAAK,GAAIH,gBAAgBI,IAAI,CAACC,SAASH,OAAOI,QAAQD,IAAAA,CAAAA,CAAAA;AAGpF,IAAME,mBAAmB;EAAC;EAAW;EAAO;;AAC5C,IAAMC,kBAAkBN,OAAOC,MAAK,GAAII,iBAAiBH,IAAI,CAACC,SAASH,OAAOI,QAAQD,IAAAA,CAAAA,CAAAA;",
|
|
6
|
-
"names": ["Schema", "EditorViewModes", "EditorViewMode", "Schema", "Union", "map", "mode", "Literal", "EditorInputModes", "EditorInputMode"]
|
|
7
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type EditorView } from '@codemirror/view';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { type Label } from '@dxos/react-ui';
|
|
4
|
-
import { type MaybePromise } from '@dxos/util';
|
|
5
|
-
export type CommandMenuGroup = {
|
|
6
|
-
id: string;
|
|
7
|
-
label?: Label;
|
|
8
|
-
items: CommandMenuItem[];
|
|
9
|
-
};
|
|
10
|
-
export type CommandMenuItem = {
|
|
11
|
-
id: string;
|
|
12
|
-
label: Label;
|
|
13
|
-
icon?: string;
|
|
14
|
-
onSelect?: (view: EditorView, head: number) => MaybePromise<void>;
|
|
15
|
-
};
|
|
16
|
-
export type CommandMenuProps = {
|
|
17
|
-
groups: CommandMenuGroup[];
|
|
18
|
-
currentItem?: string;
|
|
19
|
-
onSelect: (item: CommandMenuItem) => void;
|
|
20
|
-
};
|
|
21
|
-
export declare const CommandMenu: ({ groups, currentItem, onSelect }: CommandMenuProps) => React.JSX.Element;
|
|
22
|
-
export declare const getItem: (groups: CommandMenuGroup[], id?: string) => CommandMenuItem | undefined;
|
|
23
|
-
export declare const getNextItem: (groups: CommandMenuGroup[], id?: string) => CommandMenuItem;
|
|
24
|
-
export declare const getPreviousItem: (groups: CommandMenuGroup[], id?: string) => CommandMenuItem;
|
|
25
|
-
export declare const filterItems: (groups: CommandMenuGroup[], filter: (item: CommandMenuItem) => boolean) => CommandMenuGroup[];
|
|
26
|
-
export declare const insertAtCursor: (view: EditorView, head: number, insert: string) => void;
|
|
27
|
-
/**
|
|
28
|
-
* If the cursor is at the start of a line, insert the text at the cursor.
|
|
29
|
-
* Otherwise, insert the text on a new line.
|
|
30
|
-
*/
|
|
31
|
-
export declare const insertAtLineStart: (view: EditorView, head: number, insert: string) => void;
|
|
32
|
-
export declare const coreSlashCommands: CommandMenuGroup;
|
|
33
|
-
export declare const linkSlashCommands: CommandMenuGroup;
|
|
34
|
-
//# sourceMappingURL=CommandMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/CommandMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,EAAQ,KAAK,KAAK,EAA+D,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3C,CAAC;AAGF,eAAO,MAAM,WAAW,GAAI,mCAAmC,gBAAgB,sBAyB9E,CAAC;AAiEF,eAAO,MAAM,OAAO,GAAI,QAAQ,gBAAgB,EAAE,EAAE,KAAK,MAAM,KAAG,eAAe,GAAG,SAEnF,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,gBAAgB,EAAE,EAAE,KAAK,MAAM,KAAG,eAIrE,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,gBAAgB,EAAE,EAAE,KAAK,MAAM,KAAG,eAIzE,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,QAAQ,gBAAgB,EAAE,EAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,KACzC,gBAAgB,EAKlB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,UAAU,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,SAK5E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,UAAU,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,SAW/E,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,gBA6E/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,gBA2B/B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type PreviewLinkRef, type PreviewLinkTarget, type PreviewLookup } from '../../extensions';
|
|
3
|
-
type RefDropdownMenuValue = Partial<{
|
|
4
|
-
link: PreviewLinkRef;
|
|
5
|
-
target: PreviewLinkTarget;
|
|
6
|
-
pending: boolean;
|
|
7
|
-
}>;
|
|
8
|
-
type RefDropdownMenuProviderProps = PropsWithChildren<{
|
|
9
|
-
onLookup?: PreviewLookup;
|
|
10
|
-
}>;
|
|
11
|
-
declare const RefDropdownMenuProvider: ({ children, onLookup }: RefDropdownMenuProviderProps) => React.JSX.Element;
|
|
12
|
-
export { RefDropdownMenuProvider };
|
|
13
|
-
export type { RefDropdownMenuProviderProps, RefDropdownMenuValue };
|
|
14
|
-
//# sourceMappingURL=RefDropdownMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefDropdownMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/RefDropdownMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA4D,MAAM,OAAO,CAAC;AAMhH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQnG,KAAK,oBAAoB,GAAG,OAAO,CAAC;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AASH,KAAK,4BAA4B,GAAG,iBAAiB,CAAC;IACpD,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC,CAAC;AAEH,QAAA,MAAM,uBAAuB,GAAI,wBAAwB,4BAA4B,sBAgDpF,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,YAAY,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type DxAnchor, type DxAnchorActivate } from '@dxos/lit-ui';
|
|
3
|
-
import { type PreviewLinkRef, type PreviewLinkTarget, type PreviewLookup } from '../../extensions';
|
|
4
|
-
type RefPopoverValue = Partial<{
|
|
5
|
-
link: PreviewLinkRef;
|
|
6
|
-
target: PreviewLinkTarget;
|
|
7
|
-
pending: boolean;
|
|
8
|
-
}>;
|
|
9
|
-
declare const useRefPopover: (consumerName: string) => Partial<{
|
|
10
|
-
link: PreviewLinkRef;
|
|
11
|
-
target: PreviewLinkTarget;
|
|
12
|
-
pending: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
type PreviewProviderProps = PropsWithChildren<{
|
|
15
|
-
onLookup?: PreviewLookup;
|
|
16
|
-
}>;
|
|
17
|
-
declare const PreviewProvider: ({ children, onLookup }: PreviewProviderProps) => React.JSX.Element;
|
|
18
|
-
type RefPopoverProps = PropsWithChildren<{
|
|
19
|
-
modal?: boolean;
|
|
20
|
-
open?: boolean;
|
|
21
|
-
onOpenChange?: (open: boolean) => void;
|
|
22
|
-
onActivate?: (event: DxAnchorActivate) => void;
|
|
23
|
-
}>;
|
|
24
|
-
/**
|
|
25
|
-
* Wraps components that contain <dx-anchor> elements?
|
|
26
|
-
*/
|
|
27
|
-
declare const RefPopover: React.ForwardRefExoticComponent<{
|
|
28
|
-
modal?: boolean;
|
|
29
|
-
open?: boolean;
|
|
30
|
-
onOpenChange?: (open: boolean) => void;
|
|
31
|
-
onActivate?: (event: DxAnchorActivate) => void;
|
|
32
|
-
} & {
|
|
33
|
-
children?: React.ReactNode | undefined;
|
|
34
|
-
} & React.RefAttributes<DxAnchor | null>>;
|
|
35
|
-
export { RefPopover, PreviewProvider, useRefPopover };
|
|
36
|
-
export type { RefPopoverProps, PreviewProviderProps, RefPopoverValue };
|
|
37
|
-
//# sourceMappingURL=RefPopover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefPopover.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/RefPopover.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAOvB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQnG,KAAK,eAAe,GAAG,OAAO,CAAC;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AAEH,QAAA,MAAkC,aAAa;UALvC,cAAc;YACZ,iBAAiB;aAChB,OAAO;EAGiF,CAAC;AAMpG,KAAK,oBAAoB,GAAG,iBAAiB,CAAC;IAC5C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC,CAAC;AAEH,QAAA,MAAM,eAAe,GAAI,wBAAwB,oBAAoB,sBAiCpE,CAAC;AAMF,KAAK,eAAe,GAAG,iBAAiB,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAChD,CAAC,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,UAAU;YATN,OAAO;WACR,OAAO;mBACC,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI;iBACzB,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI;;;yCA0B/C,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC;AAEtD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/extensions/autocomplete.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAC;AAWzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IAE5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,gDAAgD,mBAAmB,KAAG,SA+JlG,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Command, type KeyBinding } 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,OAAO,EAAmB,KAAK,UAAU,EAAE,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,EAUnD,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StateField } from '@codemirror/state';
|
|
2
|
-
import { type Range } from '../../types';
|
|
3
|
-
import { type PlaceholderOptions } from './placeholder';
|
|
4
|
-
export type CommandMenuOptions = {
|
|
5
|
-
trigger: string | string[];
|
|
6
|
-
placeholder?: Partial<PlaceholderOptions>;
|
|
7
|
-
onClose?: () => void;
|
|
8
|
-
onArrowDown?: () => void;
|
|
9
|
-
onArrowUp?: () => void;
|
|
10
|
-
onEnter?: () => void;
|
|
11
|
-
onTextChange?: (trigger: string, text: string) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const commandMenu: (options: CommandMenuOptions) => (import("@codemirror/state").Extension | StateField<CommandState | null>)[];
|
|
14
|
-
type CommandState = {
|
|
15
|
-
trigger: string;
|
|
16
|
-
range: Range;
|
|
17
|
-
};
|
|
18
|
-
export declare const commandRangeEffect: import("@codemirror/state").StateEffectType<CommandState | null>;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=command-menu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/command-menu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsC,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGnF,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,eAAe,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAG1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,SAAS,kBAAkB,gFAmKtD,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAGF,eAAO,MAAM,kBAAkB,kEAA4C,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import { type HintOptions } from './hint';
|
|
3
|
-
import { type PopupOptions } from './state';
|
|
4
|
-
export type CommandOptions = Partial<PopupOptions & HintOptions>;
|
|
5
|
-
export declare const command: (options?: CommandOptions) => Extension;
|
|
6
|
-
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAC;AAMzD,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,KAAK,YAAY,EAA+B,MAAM,SAAS,CAAC;AAOzE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,GAAG,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,OAAO,GAAI,UAAS,cAAmB,KAAG,SAatD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"floating-menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/floating-menu.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAS,mBAAwB,4CAoH7D,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';
|
|
2
|
-
export type HintOptions = {
|
|
3
|
-
delay?: number;
|
|
4
|
-
onHint?: () => string | undefined;
|
|
5
|
-
};
|
|
6
|
-
export declare const hint: ({ delay, onHint }: HintOptions) => ViewPlugin<{
|
|
7
|
-
decorations: import("@codemirror/view").DecorationSet;
|
|
8
|
-
timeout: ReturnType<typeof setTimeout> | undefined;
|
|
9
|
-
update(update: ViewUpdate): void;
|
|
10
|
-
destroy(): void;
|
|
11
|
-
}, undefined>;
|
|
12
|
-
export declare class Hint extends WidgetType {
|
|
13
|
-
readonly content: string | HTMLElement;
|
|
14
|
-
constructor(content: string | HTMLElement);
|
|
15
|
-
toDOM(): HTMLSpanElement;
|
|
16
|
-
coordsAt(dom: HTMLElement): import("../..").Rect | null;
|
|
17
|
-
ignoreEvent(): boolean;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=hint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/hint.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,UAAU,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnG,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,mBAA2B,WAAW;;aAI5C,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,SAAS;mBAEnC,UAAU;;aAuC9B,CAAC;AAEF,qBAAa,IAAK,SAAQ,UAAU;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;gBAA7B,OAAO,EAAE,MAAM,GAAG,WAAW;IAIlD,KAAK,IAAI,eAAe;IAcf,QAAQ,CAAC,GAAG,EAAE,WAAW;IAgBzB,WAAW,IAAI,OAAO;CAGhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import { EditorView } from '@codemirror/view';
|
|
3
|
-
type Content = string | HTMLElement | ((view: EditorView) => HTMLElement);
|
|
4
|
-
export type PlaceholderOptions = {
|
|
5
|
-
delay?: number;
|
|
6
|
-
content: Content;
|
|
7
|
-
};
|
|
8
|
-
export declare const placeholder: ({ delay, content }: PlaceholderOptions) => Extension;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=placeholder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placeholder.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/placeholder.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAc,UAAU,EAA2C,MAAM,kBAAkB,CAAC;AAInG,KAAK,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,CAAC,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,oBAA4B,kBAAkB,KAAG,SAiD5E,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { StateField } from '@codemirror/state';
|
|
2
|
-
import { type Tooltip } from '@codemirror/view';
|
|
3
|
-
import { type RenderCallback } from '../../types';
|
|
4
|
-
import { type Action } from './action';
|
|
5
|
-
export declare const commandConfig: import("@codemirror/state").Facet<Partial<PopupOptions & import("./hint").HintOptions>, Partial<PopupOptions & import("./hint").HintOptions>>;
|
|
6
|
-
export type PopupOptions = {
|
|
7
|
-
renderDialog: RenderCallback<{
|
|
8
|
-
onAction: (action?: Action) => void;
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
11
|
-
type CommandState = {
|
|
12
|
-
tooltip?: Tooltip;
|
|
13
|
-
};
|
|
14
|
-
export declare const commandState: StateField<CommandState>;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAmB,KAAK,OAAO,EAAiC,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,KAAK,MAAM,EAA2B,MAAM,UAAU,CAAC;AAGhE,eAAO,MAAM,aAAa,+IAAqC,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,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,0BAkEvB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
export type TypeaheadContext = {
|
|
3
|
-
line: string;
|
|
4
|
-
};
|
|
5
|
-
export type TypeaheadOptions = {
|
|
6
|
-
onComplete?: (context: TypeaheadContext) => string | undefined;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* CodeMirror extension for typeahead completion.
|
|
10
|
-
*/
|
|
11
|
-
export declare const typeahead: ({ onComplete }?: TypeaheadOptions) => Extension;
|
|
12
|
-
type CompletionOptions = {
|
|
13
|
-
default?: string;
|
|
14
|
-
minLength?: number;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Util to match current line to a static list of completions.
|
|
18
|
-
*/
|
|
19
|
-
export declare const staticCompletion: (completions: string[], options?: CompletionOptions) => ({ line }: TypeaheadContext) => string | undefined;
|
|
20
|
-
export declare const matchCompletion: (completion: string, str: string, minLength?: number) => string | undefined;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=typeahead.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeahead.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/typeahead.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAyB,MAAM,mBAAmB,CAAC;AAa3F,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAGhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,MAAM,GAAG,SAAS,CAAC;CAChE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,iBAAgB,gBAAqB,KAAG,SA4DjE,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC1B,aAAa,MAAM,EAAE,EAAE,UAAS,iBAAsB,MACtD,UAAU,gBAAgB,uBAiB1B,CAAC;AAEJ,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,EAAE,KAAK,MAAM,EAAE,kBAAa,KAAG,MAAM,GAAG,SAUzF,CAAC"}
|