@dxos/react-ui-editor 0.3.11-main.3f845e1 → 0.3.11-main.463e5cd
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 +2578 -1622
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts +14 -15
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +20 -17
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +6 -3
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/{hooks/automerge → components/TextEditor}/automerge.stories.d.ts +6 -1
- package/dist/types/src/components/TextEditor/automerge.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/hooks.stories.d.ts +23 -0
- package/dist/types/src/components/TextEditor/hooks.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/index.d.ts +0 -2
- package/dist/types/src/components/TextEditor/index.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +25 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +23 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions/autocomplete.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/automerge.d.ts +9 -0
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/automerge.spec.d.ts +2 -0
- package/dist/types/src/extensions/automerge/automerge.spec.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/automerge.test.d.ts +2 -0
- package/dist/types/src/extensions/automerge/automerge.test.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/cursor.d.ts +5 -0
- package/dist/types/src/extensions/automerge/cursor.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/defs.d.ts +24 -0
- package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/index.d.ts +3 -0
- package/dist/types/src/extensions/automerge/index.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/semaphore.d.ts +15 -0
- package/dist/types/src/extensions/automerge/semaphore.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/update-automerge.d.ts +5 -0
- package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/update-codemirror.d.ts.map +1 -0
- package/dist/types/src/extensions/awareness.d.ts +46 -0
- package/dist/types/src/extensions/awareness.d.ts.map +1 -0
- package/dist/types/src/extensions/basic.d.ts +8 -0
- package/dist/types/src/extensions/basic.d.ts.map +1 -0
- package/dist/types/src/extensions/blast.d.ts.map +1 -0
- package/dist/types/src/extensions/comments.d.ts +67 -0
- package/dist/types/src/extensions/comments.d.ts.map +1 -0
- package/dist/types/src/extensions/cursor.d.ts +25 -0
- package/dist/types/src/extensions/cursor.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +13 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/listener.d.ts +10 -0
- package/dist/types/src/extensions/listener.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/bundle.d.ts +14 -0
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/code.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/formatting.d.ts +13 -0
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/heading.d.ts +6 -0
- package/dist/types/src/extensions/markdown/heading.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/hr.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/image.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/index.d.ts +11 -0
- package/dist/types/src/extensions/markdown/index.d.ts.map +1 -0
- package/dist/types/src/{components/TextEditor/extensions → extensions/markdown}/link.d.ts +1 -0
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/table.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/tasklist.d.ts.map +1 -0
- package/dist/types/src/extensions/mention.d.ts.map +1 -0
- package/dist/types/src/extensions/outliner.d.ts +4 -0
- package/dist/types/src/extensions/outliner.d.ts.map +1 -0
- package/dist/types/src/extensions/typewriter.d.ts.map +1 -0
- package/dist/types/src/hooks/awareness-provider.d.ts +31 -0
- package/dist/types/src/hooks/awareness-provider.d.ts.map +1 -0
- package/dist/types/src/hooks/defs.d.ts +25 -0
- package/dist/types/src/hooks/defs.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useActionHandler.d.ts +4 -0
- package/dist/types/src/hooks/useActionHandler.d.ts.map +1 -0
- package/dist/types/src/hooks/useEditorView.d.ts +17 -0
- package/dist/types/src/hooks/useEditorView.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextEditor.d.ts +39 -0
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextModel.d.ts +14 -31
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/styles/cursors.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +1 -0
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/dist/types/src/styles/markdown.d.ts +2 -2
- package/dist/types/src/styles/markdown.d.ts.map +1 -1
- package/dist/types/src/styles/tokens.d.ts +1 -0
- package/dist/types/src/styles/tokens.d.ts.map +1 -1
- package/dist/types/src/{components/TextEditor/themes → themes}/default.d.ts +1 -1
- package/dist/types/src/themes/default.d.ts.map +1 -0
- package/dist/types/src/themes/index.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +7 -0
- package/dist/types/src/util.d.ts.map +1 -0
- package/package.json +48 -36
- package/src/components/TextEditor/MarkdownEditor.stories.tsx +93 -102
- package/src/components/TextEditor/TextEditor.stories.tsx +13 -34
- package/src/components/TextEditor/TextEditor.tsx +137 -97
- package/src/{hooks/automerge → components/TextEditor}/automerge.stories.tsx +65 -6
- package/src/components/TextEditor/hooks.stories.tsx +106 -0
- package/src/components/TextEditor/index.ts +0 -3
- package/src/components/Toolbar/Toolbar.stories.tsx +90 -0
- package/src/components/Toolbar/Toolbar.tsx +166 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/{components/TextEditor/extensions → extensions}/autocomplete.ts +23 -19
- package/src/extensions/automerge/automerge.spec.tsx +76 -0
- package/src/extensions/automerge/automerge.test.ts +13 -0
- package/src/extensions/automerge/automerge.ts +103 -0
- package/src/extensions/automerge/cursor.ts +52 -0
- package/src/extensions/automerge/defs.ts +41 -0
- package/src/extensions/automerge/index.ts +6 -0
- package/src/extensions/automerge/semaphore.ts +81 -0
- package/src/extensions/automerge/update-automerge.ts +49 -0
- package/src/{hooks → extensions}/automerge/update-codemirror.ts +17 -9
- package/src/extensions/awareness.ts +313 -0
- package/src/{components/TextEditor/extensions → extensions}/basic.ts +17 -10
- package/src/{components/TextEditor/extensions → extensions}/blast.ts +4 -1
- package/src/extensions/comments.ts +476 -0
- package/src/extensions/cursor.ts +50 -0
- package/src/{components/TextEditor/extensions → extensions}/index.ts +4 -8
- package/src/extensions/listener.ts +35 -0
- package/src/{components/TextEditor/extensions → extensions}/markdown/bundle.ts +23 -28
- package/src/extensions/markdown/code.ts +150 -0
- package/src/extensions/markdown/formatting.ts +188 -0
- package/src/extensions/markdown/heading.ts +59 -0
- package/src/{components/TextEditor/extensions → extensions}/markdown/highlight.ts +12 -27
- package/src/extensions/markdown/hr.ts +71 -0
- package/src/extensions/markdown/image.ts +87 -0
- package/src/extensions/markdown/index.ts +14 -0
- package/src/{components/TextEditor/extensions → extensions/markdown}/link.ts +121 -58
- package/src/{components/TextEditor/extensions → extensions/markdown}/table.ts +10 -4
- package/src/extensions/markdown/tasklist.ts +110 -0
- package/src/{components/TextEditor/extensions → extensions}/mention.ts +9 -2
- package/src/extensions/outliner.ts +12 -0
- package/src/{components/TextEditor/extensions → extensions}/typewriter.ts +1 -1
- package/src/hooks/awareness-provider.ts +124 -0
- package/src/hooks/defs.ts +42 -0
- package/src/hooks/index.ts +6 -1
- package/src/hooks/useActionHandler.ts +62 -0
- package/src/hooks/useEditorView.ts +29 -0
- package/src/hooks/useTextEditor.ts +153 -0
- package/src/hooks/useTextModel.ts +48 -114
- package/src/index.ts +5 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/markdown.ts +9 -12
- package/src/styles/tokens.ts +3 -0
- package/src/{components/TextEditor/themes → themes}/default.ts +58 -82
- package/src/util.ts +41 -0
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts +0 -12
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/basic.d.ts +0 -9
- package/dist/types/src/components/TextEditor/extensions/basic.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/blast.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/code.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/comments.d.ts +0 -48
- package/dist/types/src/components/TextEditor/extensions/comments.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/hr.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/image.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/index.d.ts +0 -17
- package/dist/types/src/components/TextEditor/extensions/index.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/link.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts +0 -9
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/bundle.d.ts +0 -17
- package/dist/types/src/components/TextEditor/extensions/markdown/bundle.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/highlight.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/index.d.ts +0 -3
- package/dist/types/src/components/TextEditor/extensions/markdown/index.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/mention.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/mermaid.d.ts +0 -3
- package/dist/types/src/components/TextEditor/extensions/mermaid.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/table.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/tasklist.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/tooltip.d.ts +0 -12
- package/dist/types/src/components/TextEditor/extensions/tooltip.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/typewriter.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/util.d.ts +0 -5
- package/dist/types/src/components/TextEditor/extensions/util.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/themes/default.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/themes/index.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/automerge.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/handle.d.ts +0 -9
- package/dist/types/src/hooks/automerge/handle.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/index.d.ts +0 -3
- package/dist/types/src/hooks/automerge/index.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/plugin.d.ts +0 -26
- package/dist/types/src/hooks/automerge/plugin.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/semaphore.d.ts +0 -19
- package/dist/types/src/hooks/automerge/semaphore.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/update-automerge.d.ts +0 -6
- package/dist/types/src/hooks/automerge/update-automerge.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/update-codemirror.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/cursors.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/index.d.ts +0 -3
- package/dist/types/src/hooks/yjs/index.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/space-provider.d.ts +0 -27
- package/dist/types/src/hooks/yjs/space-provider.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/yjs.stories.d.ts +0 -12
- package/dist/types/src/hooks/yjs/yjs.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs/yjs.test.d.ts +0 -2
- package/dist/types/src/hooks/yjs/yjs.test.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/proto/gen/schema.d.ts +0 -15
- package/dist/types/src/testing/proto/gen/schema.d.ts.map +0 -1
- package/dist/types/src/testing/proto/index.d.ts +0 -2
- package/dist/types/src/testing/proto/index.d.ts.map +0 -1
- package/dist/types/src/testing/replicator.d.ts +0 -45
- package/dist/types/src/testing/replicator.d.ts.map +0 -1
- package/src/components/TextEditor/codemirror.stories.ts +0 -114
- package/src/components/TextEditor/extensions/code.ts +0 -99
- package/src/components/TextEditor/extensions/comments.ts +0 -388
- package/src/components/TextEditor/extensions/hr.ts +0 -74
- package/src/components/TextEditor/extensions/image.ts +0 -69
- package/src/components/TextEditor/extensions/listener.ts +0 -23
- package/src/components/TextEditor/extensions/markdown/index.ts +0 -6
- package/src/components/TextEditor/extensions/mermaid.ts +0 -11
- package/src/components/TextEditor/extensions/tasklist.ts +0 -121
- package/src/components/TextEditor/extensions/tooltip.ts +0 -61
- package/src/components/TextEditor/extensions/util.ts +0 -18
- package/src/hooks/automerge/handle.ts +0 -14
- package/src/hooks/automerge/index.ts +0 -6
- package/src/hooks/automerge/plugin.ts +0 -134
- package/src/hooks/automerge/semaphore.ts +0 -78
- package/src/hooks/automerge/update-automerge.ts +0 -44
- package/src/hooks/yjs/index.ts +0 -6
- package/src/hooks/yjs/space-provider.ts +0 -126
- package/src/hooks/yjs/yjs.stories.tsx +0 -56
- package/src/hooks/yjs/yjs.test.ts +0 -59
- package/src/testing/index.ts +0 -6
- package/src/testing/proto/gen/schema.ts +0 -49
- package/src/testing/proto/index.ts +0 -5
- package/src/testing/proto/schema.proto +0 -15
- package/src/testing/replicator.ts +0 -189
- /package/dist/types/src/{components/TextEditor/extensions → extensions}/autocomplete.d.ts +0 -0
- /package/dist/types/src/{hooks → extensions}/automerge/update-codemirror.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions}/blast.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions/markdown}/code.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions}/markdown/highlight.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions/markdown}/hr.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions/markdown}/image.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions/markdown}/table.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions/markdown}/tasklist.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions}/mention.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/extensions → extensions}/typewriter.d.ts +0 -0
- /package/dist/types/src/{hooks/yjs → styles}/cursors.d.ts +0 -0
- /package/dist/types/src/{components/TextEditor/themes → themes}/index.d.ts +0 -0
- /package/src/{hooks/yjs → styles}/cursors.ts +0 -0
- /package/src/{components/TextEditor/themes → themes}/index.ts +0 -0
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import get from 'lodash.get';
|
|
6
6
|
|
|
7
|
-
import { type ThemeStyles, tokens } from '
|
|
7
|
+
import { type ThemeStyles, tokens } from '../styles';
|
|
8
8
|
|
|
9
|
-
// TODO(burdon): Can we
|
|
10
|
-
//
|
|
9
|
+
// TODO(burdon): Can we use @apply and import css file?
|
|
10
|
+
// https://tailwindcss.com/docs/reusing-styles#extracting-classes-with-apply?
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Minimal styles.
|
|
@@ -49,12 +49,14 @@ export const defaultTheme: ThemeStyles = {
|
|
|
49
49
|
'&.cm-focused': {
|
|
50
50
|
outline: 'none',
|
|
51
51
|
},
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
|
|
53
|
+
'.cm-scroller': {
|
|
54
|
+
// overflow: 'visible',
|
|
54
55
|
fontFamily: get(tokens, 'fontFamily.mono', []).join(','),
|
|
56
|
+
lineHeight: 1.4,
|
|
55
57
|
},
|
|
56
58
|
|
|
57
|
-
'
|
|
59
|
+
'.cm-content': {
|
|
58
60
|
padding: 0,
|
|
59
61
|
// NOTE: Base font size (otherwise defined by HTML tag, which might be different for storybook).
|
|
60
62
|
fontSize: '16px',
|
|
@@ -77,18 +79,21 @@ export const defaultTheme: ThemeStyles = {
|
|
|
77
79
|
'&dark .cm-cursor, &dark .cm-dropCursor': {
|
|
78
80
|
borderLeft: '2px solid white',
|
|
79
81
|
},
|
|
80
|
-
'& .cm-placeholder': {
|
|
81
|
-
|
|
82
|
+
'&light .cm-placeholder': {
|
|
83
|
+
color: get(tokens, 'extend.semanticColors.description.light', 'rgba(0,0,0,.2)'),
|
|
84
|
+
},
|
|
85
|
+
'&dark .cm-placeholder': {
|
|
86
|
+
color: get(tokens, 'extend.semanticColors.description.dark', 'rgba(255,255,255,.2)'),
|
|
82
87
|
},
|
|
83
88
|
|
|
84
89
|
//
|
|
85
90
|
// line
|
|
86
91
|
//
|
|
87
|
-
'
|
|
92
|
+
'.cm-line': {
|
|
88
93
|
paddingInline: 0,
|
|
89
94
|
},
|
|
90
|
-
'
|
|
91
|
-
background: '
|
|
95
|
+
'.cm-activeLine': {
|
|
96
|
+
background: 'transparent',
|
|
92
97
|
},
|
|
93
98
|
|
|
94
99
|
//
|
|
@@ -119,40 +124,10 @@ export const defaultTheme: ThemeStyles = {
|
|
|
119
124
|
backgroundColor: get(tokens, 'extend.colors.yellow.700'),
|
|
120
125
|
},
|
|
121
126
|
|
|
122
|
-
//
|
|
123
|
-
// collaboration
|
|
124
|
-
// TODO(burdon): Review classnames (YJS dependent?) Note: e2e tests depend on this class.
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
'&light .cm-ySelection, &light .cm-yLineSelection': {
|
|
128
|
-
mixBlendMode: 'multiply',
|
|
129
|
-
},
|
|
130
|
-
'&dark .cm-ySelection, &dark .cm-yLineSelection': {
|
|
131
|
-
mixBlendMode: 'screen',
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
'& .cm-ySelectionInfo': {
|
|
135
|
-
padding: '2px 4px',
|
|
136
|
-
marginBlockStart: '-4px',
|
|
137
|
-
},
|
|
138
|
-
'& .cm-ySelection, & .cm-selectionMatch': {
|
|
139
|
-
paddingBlockStart: '.15em',
|
|
140
|
-
paddingBlockEnd: '.15em',
|
|
141
|
-
},
|
|
142
|
-
'& .cm-ySelectionCaret': {
|
|
143
|
-
display: 'inline-block',
|
|
144
|
-
insetBlockStart: '.1em',
|
|
145
|
-
blockSize: '1.4em',
|
|
146
|
-
verticalAlign: 'top',
|
|
147
|
-
},
|
|
148
|
-
'& .cm-yLineSelection': {
|
|
149
|
-
margin: 0,
|
|
150
|
-
},
|
|
151
|
-
|
|
152
127
|
//
|
|
153
128
|
// link
|
|
154
129
|
//
|
|
155
|
-
'
|
|
130
|
+
'.cm-link': {
|
|
156
131
|
color: get(tokens, 'extend.colors.primary.500'),
|
|
157
132
|
textDecorationLine: 'underline',
|
|
158
133
|
textDecorationThickness: '1px',
|
|
@@ -164,75 +139,74 @@ export const defaultTheme: ThemeStyles = {
|
|
|
164
139
|
//
|
|
165
140
|
// tooltip
|
|
166
141
|
//
|
|
167
|
-
'
|
|
142
|
+
'.cm-tooltip': {
|
|
168
143
|
border: 'none',
|
|
169
144
|
},
|
|
170
|
-
'
|
|
145
|
+
'.cm-tooltip-below': {},
|
|
171
146
|
|
|
172
147
|
//
|
|
173
148
|
// autocomplete
|
|
174
149
|
//
|
|
175
|
-
'
|
|
150
|
+
'.cm-tooltip-autocomplete': {
|
|
176
151
|
marginTop: '4px',
|
|
177
152
|
marginLeft: '-3px',
|
|
178
153
|
},
|
|
179
|
-
'
|
|
180
|
-
'
|
|
181
|
-
'
|
|
154
|
+
'.cm-tooltip-autocomplete ul li': {},
|
|
155
|
+
'.cm-tooltip-autocomplete ul li[aria-selected]': {},
|
|
156
|
+
'.cm-completionIcon': {
|
|
182
157
|
display: 'none',
|
|
183
158
|
},
|
|
184
|
-
'
|
|
159
|
+
'.cm-completionLabel': {
|
|
185
160
|
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
186
161
|
},
|
|
187
|
-
'
|
|
162
|
+
'.cm-completionMatchedText': {
|
|
188
163
|
textDecoration: 'none',
|
|
189
164
|
},
|
|
190
165
|
|
|
191
|
-
//
|
|
192
|
-
// widgets
|
|
193
|
-
//
|
|
194
|
-
'& .cm-widgetBuffer': {
|
|
195
|
-
display: 'none',
|
|
196
|
-
height: 0,
|
|
197
|
-
},
|
|
198
|
-
|
|
199
166
|
//
|
|
200
167
|
// table
|
|
201
168
|
//
|
|
202
|
-
'
|
|
169
|
+
'.cm-table *': {
|
|
203
170
|
fontFamily: `${get(tokens, 'fontFamily.mono', []).join(',')} !important`,
|
|
204
171
|
textDecoration: 'none !important',
|
|
205
172
|
},
|
|
206
|
-
'
|
|
173
|
+
'.cm-table-head': {
|
|
207
174
|
padding: '2px 16px 2px 0px',
|
|
208
175
|
borderBottom: `1px solid ${get(tokens, 'extend.colors.neutral.500')}`,
|
|
209
176
|
fontWeight: 100,
|
|
210
177
|
textAlign: 'left',
|
|
211
178
|
color: get(tokens, 'extend.colors.neutral.500'),
|
|
212
179
|
},
|
|
213
|
-
'
|
|
180
|
+
'.cm-table-cell': {
|
|
214
181
|
padding: '2px 16px 2px 0px',
|
|
215
182
|
},
|
|
216
183
|
|
|
217
184
|
//
|
|
218
185
|
// image
|
|
219
186
|
//
|
|
220
|
-
'
|
|
221
|
-
|
|
187
|
+
'.cm-image': {
|
|
188
|
+
display: 'block',
|
|
189
|
+
height: '0',
|
|
190
|
+
},
|
|
191
|
+
'.cm-image.cm-loaded-image': {
|
|
192
|
+
height: 'auto',
|
|
193
|
+
borderTop: '0.5rem solid transparent',
|
|
194
|
+
borderBottom: '0.5rem solid transparent',
|
|
222
195
|
},
|
|
223
196
|
|
|
224
197
|
//
|
|
225
198
|
// font size
|
|
226
|
-
// TODO(thure): This appears to be the best or only way to set selection caret heights,
|
|
199
|
+
// TODO(thure): This appears to be the best or only way to set selection caret heights,
|
|
200
|
+
// but it's far more verbose than it needs to be.
|
|
227
201
|
//
|
|
228
|
-
...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}, {}),
|
|
202
|
+
// ...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {
|
|
203
|
+
// const height = get(tokens, ['extend', 'fontSize', fontSize, 1, 'lineHeight']);
|
|
204
|
+
//
|
|
205
|
+
// acc[`& .text-${fontSize} + .cm-ySelectionCaret`] = { height };
|
|
206
|
+
// acc[`& .text-${fontSize} + .cm-ySelection + .cm-ySelectionCaret`] = { height };
|
|
207
|
+
// acc[`& .text-${fontSize} + .cm-widgetBuffer + .cm-ySelectionCaret`] = { height };
|
|
208
|
+
// return acc;
|
|
209
|
+
// }, {}),
|
|
236
210
|
|
|
237
211
|
/**
|
|
238
212
|
* Panels
|
|
@@ -250,14 +224,14 @@ export const defaultTheme: ThemeStyles = {
|
|
|
250
224
|
* </div>
|
|
251
225
|
* </div
|
|
252
226
|
*/
|
|
253
|
-
'
|
|
227
|
+
'.cm-panels': {
|
|
254
228
|
border: `1px solid ${get(tokens, 'extend.colors.neutral.200')}`,
|
|
255
229
|
},
|
|
256
|
-
'
|
|
230
|
+
'.cm-panel': {
|
|
257
231
|
background: get(tokens, 'extend.colors.neutral.50'),
|
|
258
232
|
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
259
233
|
},
|
|
260
|
-
'
|
|
234
|
+
'.cm-button': {
|
|
261
235
|
margin: '4px',
|
|
262
236
|
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
263
237
|
background: get(tokens, 'extend.colors.neutral.100'),
|
|
@@ -271,32 +245,34 @@ export const defaultTheme: ThemeStyles = {
|
|
|
271
245
|
backgroundImage: 'none',
|
|
272
246
|
},
|
|
273
247
|
},
|
|
274
|
-
'
|
|
248
|
+
'.cm-panel input[type=checkbox]': {
|
|
275
249
|
marginRight: '0.4rem !important',
|
|
276
250
|
},
|
|
277
251
|
};
|
|
278
252
|
|
|
279
253
|
export const textTheme: ThemeStyles = {
|
|
280
|
-
'
|
|
254
|
+
'.cm-scroller': {
|
|
281
255
|
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
282
256
|
},
|
|
283
|
-
'
|
|
257
|
+
'.cm-placeholder': {
|
|
284
258
|
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
285
259
|
},
|
|
286
260
|
};
|
|
287
261
|
|
|
288
262
|
export const markdownTheme: ThemeStyles = {
|
|
289
|
-
|
|
290
|
-
|
|
263
|
+
'.cm-scroller': {
|
|
264
|
+
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
265
|
+
},
|
|
266
|
+
'.cm-placeholder': {
|
|
291
267
|
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
292
268
|
},
|
|
293
269
|
};
|
|
294
270
|
|
|
295
271
|
export const codeTheme: ThemeStyles = {
|
|
296
|
-
'
|
|
272
|
+
'.cm-scroller': {
|
|
297
273
|
fontFamily: get(tokens, 'fontFamily.mono', []).join(','),
|
|
298
274
|
},
|
|
299
|
-
'
|
|
275
|
+
'.cm-placeholder': {
|
|
300
276
|
fontFamily: get(tokens, 'fontFamily.mono', []).join(','),
|
|
301
277
|
},
|
|
302
278
|
};
|
package/src/util.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type { Transaction } from '@codemirror/state';
|
|
6
|
+
|
|
7
|
+
import { log } from '@dxos/log';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* CodeMirror callbacks swallow errors so wrap handlers.
|
|
11
|
+
*/
|
|
12
|
+
// TODO(burdon): EditorView.exceptionSink should catch errors.
|
|
13
|
+
export const callbackWrapper = <T extends Function>(fn: T): T =>
|
|
14
|
+
((...args: any[]) => {
|
|
15
|
+
try {
|
|
16
|
+
return fn(...args);
|
|
17
|
+
} catch (err) {
|
|
18
|
+
log.catch(err);
|
|
19
|
+
}
|
|
20
|
+
}) as unknown as T;
|
|
21
|
+
|
|
22
|
+
export const logChanges = (trs: readonly Transaction[]) => {
|
|
23
|
+
const changes = trs
|
|
24
|
+
.flatMap((tr) => {
|
|
25
|
+
if (tr.changes.empty) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const changes: any[] = [];
|
|
30
|
+
tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) =>
|
|
31
|
+
changes.push(JSON.stringify({ fromA, toA, fromB, toB, inserted: inserted.toString() })),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return changes;
|
|
35
|
+
})
|
|
36
|
+
.filter(Boolean);
|
|
37
|
+
|
|
38
|
+
if (changes.length) {
|
|
39
|
+
console.log('changes', changes);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/html';
|
|
2
|
-
import { Client, type PublicKey } from '@dxos/react-client';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
};
|
|
6
|
-
export default _default;
|
|
7
|
-
export declare const Default: StoryObj<{
|
|
8
|
-
id: number;
|
|
9
|
-
client: Client;
|
|
10
|
-
spaceKey: PublicKey;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=codemirror.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codemirror.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/codemirror.stories.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhD,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;;;;AAS5D,wBAEE;AAqEF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAoBjF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/autocomplete.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,iBAAkB,mBAAmB,4CAgC7D,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import type { ThemeMode } from '@dxos/react-ui';
|
|
3
|
-
export type BasicBundleOptions = {
|
|
4
|
-
readonly?: boolean;
|
|
5
|
-
themeMode?: ThemeMode;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const basicBundle: ({ readonly, themeMode, placeholder: _placeholder }: BasicBundleOptions) => Extension[];
|
|
9
|
-
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/basic.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,uDAAwD,kBAAkB,KAAG,SAAS,EAa5E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blast.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/blast.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,gBAAgB,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,qBAAqB,EAAE;QAAE,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IACpE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,YAU5B,CAAC;AAEF,eAAO,MAAM,KAAK,aAAa,QAAQ,YAAY,CAAC,KAAoB,SAmEvE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/code.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,IAAI,+CA2ChB,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import { type Rect } from '@codemirror/view';
|
|
3
|
-
import { type CommentRange, type EditorModel, type Range } from '../../../hooks';
|
|
4
|
-
type CommentSelected = {
|
|
5
|
-
active?: string;
|
|
6
|
-
closest?: string;
|
|
7
|
-
};
|
|
8
|
-
type ExtendedCommentRange = Range & CommentRange & {
|
|
9
|
-
location?: Rect | null;
|
|
10
|
-
};
|
|
11
|
-
export type CommentsState = CommentSelected & {
|
|
12
|
-
ranges: ExtendedCommentRange[];
|
|
13
|
-
};
|
|
14
|
-
export declare const setCommentRange: import("@codemirror/state").StateEffectType<{
|
|
15
|
-
model: EditorModel;
|
|
16
|
-
comments: CommentRange[];
|
|
17
|
-
}>;
|
|
18
|
-
export type CommentsOptions = {
|
|
19
|
-
key?: string;
|
|
20
|
-
footnote?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Called to create a new thread and return the thread id.
|
|
23
|
-
*/
|
|
24
|
-
onCreate?: (range: string) => string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Called to notify which thread is currently closest to the cursor.
|
|
27
|
-
*/
|
|
28
|
-
onSelect?: (state: CommentsState) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Called to render tooltip.
|
|
31
|
-
*/
|
|
32
|
-
onHover?: (el: Element) => void;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Comment threads.
|
|
36
|
-
* 1). Updates the EditorModel to store relative selections for a set of comments threads.
|
|
37
|
-
* Since the selections are relative, they do not need to be updated when the document is edited.
|
|
38
|
-
* 2). Implements a StateField to track absolute selections corresponding to the comments (i.e., when the document is edited).
|
|
39
|
-
* 3). Creates decoration marks to apply classes to each selection.
|
|
40
|
-
* 4). Tracks the current cursor position to:
|
|
41
|
-
* a). Update the decoration to show if the cursor is within a current selection.
|
|
42
|
-
* b). Calls a handler to indicate which is the closest selection (e.g., to update the thread sidebar).
|
|
43
|
-
* 5). Optionally, inserts a markdown footnote when creating a comment thread.
|
|
44
|
-
* 6). Optionally, implements a hoverTooltip to show hints when creating a selection range.
|
|
45
|
-
*/
|
|
46
|
-
export declare const comments: (options?: CommentsOptions) => Extension;
|
|
47
|
-
export {};
|
|
48
|
-
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/comments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAWL,KAAK,IAAI,EACV,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAc,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AA8B7F,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAGF,KAAK,oBAAoB,GAAG,KAAK,GAC/B,YAAY,GAAG;IAEb,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAC5C,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,eAAe;WAA+B,WAAW;cAAY,YAAY,EAAE;EAAK,CAAC;AA+FtG,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACjD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,aAAa,eAAe,KAAQ,SA+LxD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hr.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,EAAE,+CAsBd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/image.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC;AAE9B,eAAO,MAAM,KAAK,aAAa,YAAY,KAAQ,SAMlD,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './autocomplete';
|
|
2
|
-
export * from './basic';
|
|
3
|
-
export * from './blast';
|
|
4
|
-
export * from './code';
|
|
5
|
-
export * from './comments';
|
|
6
|
-
export * from './hr';
|
|
7
|
-
export * from './image';
|
|
8
|
-
export * from './link';
|
|
9
|
-
export * from './listener';
|
|
10
|
-
export * from './markdown';
|
|
11
|
-
export * from './mention';
|
|
12
|
-
export * from './mermaid';
|
|
13
|
-
export * from './table';
|
|
14
|
-
export * from './tasklist';
|
|
15
|
-
export * from './tooltip';
|
|
16
|
-
export * from './typewriter';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/link.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAO3B,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,aAAa,WAAW,KAAQ,SAMhD,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StateField } from '@codemirror/state';
|
|
2
|
-
export type ListenerOptions = {
|
|
3
|
-
onChange: (text: string) => void;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799
|
|
7
|
-
*/
|
|
8
|
-
export declare const listener: ({ onChange }: ListenerOptions) => StateField<null>;
|
|
9
|
-
//# sourceMappingURL=listener.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/listener.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,QAAQ,iBAAkB,eAAe,qBAWrD,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import type { ThemeMode } from '@dxos/react-ui';
|
|
3
|
-
export type MarkdownBundleOptions = {
|
|
4
|
-
readonly?: boolean;
|
|
5
|
-
themeMode?: ThemeMode;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Markdown bundle.
|
|
10
|
-
* Refs:
|
|
11
|
-
* https://github.com/codemirror/basic-setup
|
|
12
|
-
* https://github.com/codemirror/basic-setup/blob/main/src/codemirror.ts#L50
|
|
13
|
-
* https://codemirror.net/docs/community
|
|
14
|
-
* https://codemirror.net/docs/ref/#codemirror.basicSetup
|
|
15
|
-
*/
|
|
16
|
-
export declare const markdownBundle: ({ readonly, themeMode, placeholder: _placeholder, }: MarkdownBundleOptions) => Extension[];
|
|
17
|
-
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/TextEditor/extensions/markdown/bundle.ts"],"names":[],"mappings":"AAUA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAYhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;GAOG;AAEH,eAAO,MAAM,cAAc,wDAIxB,qBAAqB,KAAG,SAAS,EA6CnC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/TextEditor/extensions/markdown/highlight.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAmB,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,iBAAiB,CAAC;AAgB7D;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAgBxB,CAAC;AAaF,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAKlD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,cAAe,OAAO,mBAgIxD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/TextEditor/extensions/markdown/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mention.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/mention.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,OAAO,iBAAkB,cAAc,KAAG,SAmBtD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mermaid.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/mermaid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,eAAO,MAAM,OAAO,QAAO,SAE1B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/table.ts"],"names":[],"mappings":"AAKA,OAAO,EAAoB,KAAK,QAAQ,EAAmB,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AASnH,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,KAAK,aAAa,YAAY,8BAM1C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasklist.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/tasklist.ts"],"names":[],"mappings":"AA+DA,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAEjC,eAAO,MAAM,QAAQ,aAAa,eAAe,4CAuDhD,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
export type TooltipOptions = {
|
|
3
|
-
onHover: (el: Element, url: string) => void;
|
|
4
|
-
regexp?: RegExp;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* https://codemirror.net/examples/tooltip
|
|
8
|
-
* https://codemirror.net/docs/ref/#view.hoverTooltip
|
|
9
|
-
* https://github.com/codemirror/view/blob/main/src/tooltip.ts
|
|
10
|
-
*/
|
|
11
|
-
export declare const tooltip: ({ onHover, regexp }: TooltipOptions) => Extension;
|
|
12
|
-
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/tooltip.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,wBAA8C,cAAc,KAAG,SAuC/E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typewriter.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/typewriter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,UAAU,sBAA0C,WAAW,KAAQ,SAgDnF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/util.ts"],"names":[],"mappings":"AAMA;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAOR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/themes/default.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,iBAAiB,CAAC;AAK3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,WA8P1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAOvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAK3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAOvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/themes/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automerge.stories.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/automerge/automerge.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,uBAAuB,CAAC;AAQ/B,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,IAAI,EAAE,CAAC;CACd,CAAC;;;;;;AA+DF,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as A from '@dxos/automerge/automerge';
|
|
2
|
-
export type IDocHandle<T = any> = {
|
|
3
|
-
docSync(): A.Doc<T> | undefined;
|
|
4
|
-
change(callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): void;
|
|
5
|
-
changeAt(heads: A.Heads, callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): string[] | undefined;
|
|
6
|
-
addListener(event: 'change', listener: () => void): void;
|
|
7
|
-
removeListener(event: 'change', listener: () => void): void;
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=handle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/automerge/handle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,CAAC,MAAM,2BAA2B,CAAC;AAEpD,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,IAAI;IAChC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACpE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAEtG,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACzD,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/automerge/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type EditorState, type Extension, StateEffect, StateField, type Transaction, type TransactionSpec } from '@codemirror/state';
|
|
2
|
-
import * as automerge from '@dxos/automerge/automerge';
|
|
3
|
-
import { type Heads, type Prop } from '@dxos/automerge/automerge';
|
|
4
|
-
import { type IDocHandle } from './handle';
|
|
5
|
-
export type Value = {
|
|
6
|
-
lastHeads: Heads;
|
|
7
|
-
path: Prop[];
|
|
8
|
-
unreconciledTransactions: Transaction[];
|
|
9
|
-
};
|
|
10
|
-
type UpdateHeads = {
|
|
11
|
-
newHeads: Heads;
|
|
12
|
-
};
|
|
13
|
-
export declare const effectType: import("@codemirror/state").StateEffectType<UpdateHeads>;
|
|
14
|
-
export declare const updateHeads: (newHeads: automerge.next.Heads) => StateEffect<UpdateHeads>;
|
|
15
|
-
export declare const getLastHeads: (state: EditorState, field: Field) => automerge.next.Heads;
|
|
16
|
-
export declare const getPath: (state: EditorState, field: Field) => Prop[];
|
|
17
|
-
export type Field = StateField<Value>;
|
|
18
|
-
export type AutomergePlugin = {
|
|
19
|
-
extension: Extension;
|
|
20
|
-
};
|
|
21
|
-
export declare const automergePlugin: (handle: IDocHandle, path: Prop[]) => AutomergePlugin;
|
|
22
|
-
export declare const reconcileAnnotationType: import("@codemirror/state").AnnotationType<unknown>;
|
|
23
|
-
export declare const isReconcileTx: (tr: Transaction) => boolean;
|
|
24
|
-
export declare const makeReconcile: (tr: TransactionSpec) => void;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/automerge/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,WAAW,EACX,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,wBAAwB,EAAE,WAAW,EAAE,CAAC;CACzC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,0DAAsC,CAAC;AAE9D,eAAO,MAAM,WAAW,sCAAsB,YAAY,WAAW,CAAgC,CAAC;AAEtG,eAAO,MAAM,YAAY,UAAW,WAAW,uCAAsD,CAAC;AAEtG,eAAO,MAAM,OAAO,UAAW,WAAW,mBAAiB,IAAI,EAA6B,CAAC;AAE7F,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAMtC,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,QAAQ,IAAI,EAAE,KAAG,eA+DlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qDAA+B,CAAC;AAEpE,eAAO,MAAM,aAAa,OAAQ,WAAW,KAAG,OAAmD,CAAC;AAEpG,eAAO,MAAM,aAAa,OAAQ,eAAe,SAchD,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type EditorView } from '@codemirror/view';
|
|
2
|
-
import { next as automerge } from '@dxos/automerge/automerge';
|
|
3
|
-
import { type IDocHandle } from './handle';
|
|
4
|
-
import { type Field } from './plugin';
|
|
5
|
-
type Doc<T> = automerge.Doc<T>;
|
|
6
|
-
type Heads = automerge.Heads;
|
|
7
|
-
type ChangeFn = (atHeads: Heads, change: (doc: Doc<unknown>) => void) => Heads | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* TODO(burdon): Comment.
|
|
10
|
-
*/
|
|
11
|
-
export declare class PatchSemaphore {
|
|
12
|
-
_field: Field;
|
|
13
|
-
_inReconcile: boolean;
|
|
14
|
-
_queue: Array<ChangeFn>;
|
|
15
|
-
constructor(field?: Field);
|
|
16
|
-
reconcile: (handle: IDocHandle, view: EditorView) => void;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=semaphore.d.ts.map
|