@dxos/react-ui-editor 0.3.10-main.a21ec31 → 0.3.10-next.3e4f36f
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 +737 -742
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/automerge/automerge-plugin/PatchSemaphore.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge-plugin/amToCodemirror.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge-plugin/codeMirrorToAm.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge-plugin/handle.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge-plugin/index.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge-plugin/plugin.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +2 -4
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +4 -9
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/{basic.d.ts → basic/bundle.d.ts} +1 -1
- package/dist/types/src/components/TextEditor/extensions/basic/bundle.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/basic/index.d.ts +3 -0
- package/dist/types/src/components/TextEditor/extensions/basic/index.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/basic/theme.d.ts +10 -0
- package/dist/types/src/components/TextEditor/extensions/basic/theme.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/change.d.ts +7 -0
- package/dist/types/src/components/TextEditor/extensions/change.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink/hyperlinkDecoration.d.ts +11 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink/hyperlinkDecoration.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink/hyperlinkTooltip.d.ts +8 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink/hyperlinkTooltip.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/{experimental.d.ts → hyperlink/hyperlinkWidget.d.ts} +2 -2
- package/dist/types/src/components/TextEditor/extensions/hyperlink/hyperlinkWidget.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink/index.d.ts +4 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink/index.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/index.d.ts +2 -5
- package/dist/types/src/components/TextEditor/extensions/index.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/index.d.ts +1 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/index.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/tags.d.ts +17 -0
- package/dist/types/src/components/TextEditor/extensions/markdown/tags.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/markdown/theme.d.ts +21 -0
- package/dist/types/src/components/TextEditor/extensions/markdown/theme.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/TextEditor/yjs.stories.d.ts +0 -1
- package/dist/types/src/components/TextEditor/yjs.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useCollaboration.d.ts +9 -0
- package/dist/types/src/hooks/useCollaboration.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextModel.d.ts +4 -4
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/styles/markdown.d.ts +10 -12
- package/dist/types/src/styles/markdown.d.ts.map +1 -1
- package/package.json +32 -20
- package/src/{hooks/automerge → automerge}/automerge.stories.tsx +1 -2
- package/src/components/TextEditor/TextEditor.stories.tsx +43 -46
- package/src/components/TextEditor/TextEditor.tsx +45 -59
- package/src/components/TextEditor/extensions/{basic.ts → basic/bundle.ts} +2 -4
- package/src/components/TextEditor/extensions/basic/index.ts +6 -0
- package/src/components/TextEditor/extensions/basic/theme.ts +49 -0
- package/src/components/TextEditor/extensions/{listener.ts → change.ts} +3 -3
- package/src/components/TextEditor/extensions/{link.ts → hyperlink/hyperlinkDecoration.ts} +31 -68
- package/src/components/TextEditor/extensions/{tooltip.tsx → hyperlink/hyperlinkTooltip.tsx} +9 -9
- package/src/components/TextEditor/extensions/{experimental.tsx → hyperlink/hyperlinkWidget.tsx} +2 -17
- package/src/components/TextEditor/extensions/hyperlink/index.ts +7 -0
- package/src/components/TextEditor/extensions/index.ts +2 -5
- package/src/components/TextEditor/extensions/markdown/bundle.ts +11 -15
- package/src/components/TextEditor/extensions/markdown/index.ts +1 -1
- package/src/components/TextEditor/extensions/markdown/tags.ts +38 -0
- package/src/components/TextEditor/extensions/markdown/theme.ts +265 -0
- package/src/components/TextEditor/index.ts +0 -3
- package/src/components/TextEditor/yjs.stories.tsx +0 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCollaboration.ts +45 -0
- package/src/hooks/useTextModel.ts +40 -51
- package/src/styles/markdown.ts +24 -26
- package/src/testing/replicator.ts +2 -2
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts +0 -35
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/autocomplete.d.ts +0 -9
- package/dist/types/src/components/TextEditor/extensions/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/basic.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/experimental.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/link.d.ts +0 -11
- package/dist/types/src/components/TextEditor/extensions/link.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts +0 -7
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/markdown/highlight.d.ts +0 -31
- package/dist/types/src/components/TextEditor/extensions/markdown/highlight.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/extensions/tasklist.d.ts +0 -5
- 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/themes/default.d.ts +0 -17
- package/dist/types/src/components/TextEditor/themes/default.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/themes/index.d.ts +0 -2
- package/dist/types/src/components/TextEditor/themes/index.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/PatchSemaphore.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/amToCodemirror.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/automerge.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/codeMirrorToAm.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/handle.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/index.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge/plugin.d.ts.map +0 -1
- package/src/components/TextEditor/MarkdownEditor.stories.tsx +0 -242
- package/src/components/TextEditor/extensions/autocomplete.ts +0 -72
- package/src/components/TextEditor/extensions/markdown/highlight.ts +0 -166
- package/src/components/TextEditor/extensions/tasklist.ts +0 -113
- package/src/components/TextEditor/themes/default.ts +0 -170
- package/src/components/TextEditor/themes/index.ts +0 -5
- /package/dist/types/src/{hooks/automerge → automerge/automerge-plugin}/PatchSemaphore.d.ts +0 -0
- /package/dist/types/src/{hooks/automerge → automerge/automerge-plugin}/amToCodemirror.d.ts +0 -0
- /package/dist/types/src/{hooks/automerge → automerge/automerge-plugin}/codeMirrorToAm.d.ts +0 -0
- /package/dist/types/src/{hooks/automerge → automerge/automerge-plugin}/handle.d.ts +0 -0
- /package/dist/types/src/{hooks/automerge → automerge/automerge-plugin}/index.d.ts +0 -0
- /package/dist/types/src/{hooks/automerge → automerge/automerge-plugin}/plugin.d.ts +0 -0
- /package/dist/types/src/{hooks/automerge → automerge}/automerge.stories.d.ts +0 -0
- /package/src/{hooks/automerge → automerge/automerge-plugin}/PatchSemaphore.ts +0 -0
- /package/src/{hooks/automerge → automerge/automerge-plugin}/amToCodemirror.ts +0 -0
- /package/src/{hooks/automerge → automerge/automerge-plugin}/codeMirrorToAm.ts +0 -0
- /package/src/{hooks/automerge → automerge/automerge-plugin}/handle.ts +0 -0
- /package/src/{hooks/automerge → automerge/automerge-plugin}/index.ts +0 -0
- /package/src/{hooks/automerge → automerge/automerge-plugin}/plugin.ts +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import get from 'lodash.get';
|
|
6
|
-
import { type StyleSpec } from 'style-mod';
|
|
7
|
-
|
|
8
|
-
import { tokens } from '../../../styles';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Minimal styles.
|
|
12
|
-
* https://codemirror.net/examples/styling
|
|
13
|
-
* NOTE: Use one of '&', '&light', and '&dark' prefix to scope instance.
|
|
14
|
-
* NOTE: `light` and `dark` selectors are preprocessed by CodeMirror and can only be in the base theme.
|
|
15
|
-
*/
|
|
16
|
-
export const defaultTheme: {
|
|
17
|
-
[selector: string]: StyleSpec;
|
|
18
|
-
} = {
|
|
19
|
-
//
|
|
20
|
-
// Main layout:
|
|
21
|
-
// <div class=".cm-editor .cm-focused">
|
|
22
|
-
// <div class=".cm-scroller">
|
|
23
|
-
// <div class=".cm-content" role="textbox" contenteditable="true">
|
|
24
|
-
// <div class=".cm-line" />
|
|
25
|
-
// </div>
|
|
26
|
-
// </div>
|
|
27
|
-
// </div>
|
|
28
|
-
//
|
|
29
|
-
'&': {},
|
|
30
|
-
'&.cm-focused': {
|
|
31
|
-
outline: 'none',
|
|
32
|
-
},
|
|
33
|
-
'& .cm-scroller': {
|
|
34
|
-
overflow: 'visible',
|
|
35
|
-
},
|
|
36
|
-
'& .cm-content': {
|
|
37
|
-
padding: 0,
|
|
38
|
-
// Base font size (otherwise defined by HTML tag, which might be different for storybook).
|
|
39
|
-
fontSize: '16px',
|
|
40
|
-
},
|
|
41
|
-
'&light .cm-content': {
|
|
42
|
-
color: get(tokens, 'extend.colors.neutral.900', 'black'),
|
|
43
|
-
caretColor: 'black',
|
|
44
|
-
},
|
|
45
|
-
'&dark .cm-content': {
|
|
46
|
-
color: get(tokens, 'extend.colors.neutral.100', 'white'),
|
|
47
|
-
caretColor: 'white',
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
// Cursor
|
|
52
|
-
//
|
|
53
|
-
'&light .cm-cursor': {
|
|
54
|
-
borderLeft: '2px solid black',
|
|
55
|
-
},
|
|
56
|
-
'&dark .cm-cursor': {
|
|
57
|
-
borderLeft: '2px solid white',
|
|
58
|
-
},
|
|
59
|
-
'& .cm-placeholder': {
|
|
60
|
-
fontWeight: 100,
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
// line
|
|
65
|
-
//
|
|
66
|
-
'& .cm-line': {
|
|
67
|
-
paddingInline: 0,
|
|
68
|
-
},
|
|
69
|
-
'& .cm-line *': {},
|
|
70
|
-
'& .cm-activeLine': {
|
|
71
|
-
backgroundColor: 'transparent',
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
// selection
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
'&light .cm-selectionBackground, &light.cm-focused .cm-selectionBackground': {
|
|
79
|
-
background: get(tokens, 'extend.colors.primary.150', '#00ffff'),
|
|
80
|
-
},
|
|
81
|
-
'&dark .cm-selectionBackground, &dark.cm-focused .cm-selectionBackground': {
|
|
82
|
-
background: get(tokens, 'extend.colors.primary.850', '#00ffff'),
|
|
83
|
-
},
|
|
84
|
-
'&light .cm-selectionMatch': {
|
|
85
|
-
background: get(tokens, 'extend.colors.primary.250', '#00ffff') + '44',
|
|
86
|
-
},
|
|
87
|
-
'&dark .cm-selectionMatch': {
|
|
88
|
-
background: get(tokens, 'extend.colors.primary.600', '#00ffff') + '44',
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
// collaboration
|
|
93
|
-
// TODO(burdon): Review classnames (YJS dependent?)
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
'&light .cm-ySelection, &light .cm-yLineSelection': {
|
|
97
|
-
mixBlendMode: 'multiply',
|
|
98
|
-
},
|
|
99
|
-
'&dark .cm-ySelection, &dark .cm-yLineSelection': {
|
|
100
|
-
mixBlendMode: 'screen',
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
'& .cm-ySelectionInfo': {
|
|
104
|
-
padding: '2px 4px',
|
|
105
|
-
marginBlockStart: '-4px',
|
|
106
|
-
},
|
|
107
|
-
'& .cm-ySelection, & .cm-selectionMatch': {
|
|
108
|
-
paddingBlockStart: '.15em',
|
|
109
|
-
paddingBlockEnd: '.15em',
|
|
110
|
-
},
|
|
111
|
-
'& .cm-ySelectionCaret': {
|
|
112
|
-
display: 'inline-block',
|
|
113
|
-
insetBlockStart: '.1em',
|
|
114
|
-
blockSize: '1.4em',
|
|
115
|
-
verticalAlign: 'top',
|
|
116
|
-
},
|
|
117
|
-
'& .cm-yLineSelection': {
|
|
118
|
-
margin: 0,
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
//
|
|
122
|
-
// link
|
|
123
|
-
//
|
|
124
|
-
'& .cm-link': {
|
|
125
|
-
color: get(tokens, 'extend.colors.primary.500'),
|
|
126
|
-
textDecorationLine: 'underline',
|
|
127
|
-
textDecorationThickness: '1px',
|
|
128
|
-
textUnderlineOffset: '2px',
|
|
129
|
-
borderRadius: '.125rem',
|
|
130
|
-
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
//
|
|
134
|
-
// tooltip
|
|
135
|
-
//
|
|
136
|
-
'& .cm-tooltip': {
|
|
137
|
-
border: 'none',
|
|
138
|
-
},
|
|
139
|
-
// '& .cm-tooltip-below': {},
|
|
140
|
-
// '& .cm-tooltip-autocomplete': {},
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
// font size
|
|
144
|
-
// TODO(thure): This appears to be the best or only way to set selection caret heights, but it's far more verbose than it needs to be.
|
|
145
|
-
//
|
|
146
|
-
...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {
|
|
147
|
-
const height = get(tokens, ['extend', 'fontSize', fontSize, 1, 'lineHeight']);
|
|
148
|
-
|
|
149
|
-
acc[`& .text-${fontSize} + .cm-ySelectionCaret`] = { height };
|
|
150
|
-
acc[`& .text-${fontSize} + .cm-ySelection + .cm-ySelectionCaret`] = { height };
|
|
151
|
-
acc[`& .text-${fontSize} + .cm-widgetBuffer + .cm-ySelectionCaret`] = { height };
|
|
152
|
-
return acc;
|
|
153
|
-
}, {}),
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export const textTheme: {
|
|
157
|
-
[selector: string]: StyleSpec;
|
|
158
|
-
} = {
|
|
159
|
-
'& .cm-scroller': {
|
|
160
|
-
fontFamily: get(tokens, 'fontFamily.body', []).join(','),
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export const codeTheme: {
|
|
165
|
-
[selector: string]: StyleSpec;
|
|
166
|
-
} = {
|
|
167
|
-
'& .cm-scroller': {
|
|
168
|
-
fontFamily: get(tokens, 'fontFamily.mono', []).join(','),
|
|
169
|
-
},
|
|
170
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|