@blocklet/editor 2.4.89 → 2.4.91

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.
Files changed (44) hide show
  1. package/lib/blocklet-editor-viewer.d.ts +4 -0
  2. package/lib/blocklet-editor-viewer.js +12 -0
  3. package/lib/blocklet-editor.d.ts +2 -0
  4. package/lib/blocklet-editor.js +12 -0
  5. package/lib/ext/CustomComponent/CustomComponentNode.js +1 -0
  6. package/lib/ext/CustomComponent/components/Code.js +2 -1
  7. package/lib/ext/CustomComponent/components/Field.d.ts +9 -0
  8. package/lib/ext/CustomComponent/components/Field.js +32 -0
  9. package/lib/ext/CustomComponent/components/index.d.ts +2 -0
  10. package/lib/ext/CustomComponent/components/index.js +2 -0
  11. package/lib/ext/PagesKitComponent/PagesKitComponentRenderer.js +2 -2
  12. package/lib/index.d.ts +0 -3
  13. package/lib/index.js +2 -2
  14. package/lib/main/editor-root.d.ts +2 -0
  15. package/lib/main/editor-root.js +46 -0
  16. package/lib/main/hooks/use-mobile.d.ts +4 -0
  17. package/lib/main/hooks/use-mobile.js +6 -0
  18. package/lib/main/index.css +0 -954
  19. package/lib/main/index.d.ts +3 -0
  20. package/lib/main/index.js +7 -12
  21. package/lib/main/markdown-editor/index.js +1 -9
  22. package/lib/main/nodes/PlaygroundNodes.js +0 -2
  23. package/lib/main/style/editable.css +476 -0
  24. package/lib/main/themes/code-highlight/index.d.ts +2 -32
  25. package/lib/main/themes/code-highlight/index.js +10 -65
  26. package/lib/main/themes/customTheme.js +17 -18
  27. package/lib/main/viewer/index.d.ts +5 -0
  28. package/lib/main/viewer/index.js +26 -0
  29. package/lib/main/viewer/types.d.ts +14 -0
  30. package/lib/main/viewer/types.js +1 -0
  31. package/lib/main/viewer/viewer.d.ts +3 -0
  32. package/lib/main/viewer/viewer.js +30 -0
  33. package/lib/types.d.ts +2 -1
  34. package/package.json +4 -2
  35. package/lib/main/Settings.d.ts +0 -9
  36. package/lib/main/Settings.js +0 -39
  37. package/lib/main/plugins/KeywordsPlugin/index.d.ts +0 -9
  38. package/lib/main/plugins/KeywordsPlugin/index.js +0 -38
  39. package/lib/main/plugins/PasteLogPlugin/index.d.ts +0 -9
  40. package/lib/main/plugins/PasteLogPlugin/index.js +0 -34
  41. package/lib/main/plugins/TestRecorderPlugin/index.d.ts +0 -10
  42. package/lib/main/plugins/TestRecorderPlugin/index.js +0 -340
  43. package/lib/main/ui/Switch.d.ts +0 -15
  44. package/lib/main/ui/Switch.js +0 -6
@@ -5,6 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ import '@iconify/iconify';
9
+ import './index.css';
10
+ import './style/editable.css';
8
11
  import { EditorState, Klass, LexicalEditor, LexicalNode } from 'lexical';
9
12
  import React, { MutableRefObject, ReactNode, type JSX } from 'react';
10
13
  export interface BlockletEditorProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'placeholder' | 'onChange'> {
package/lib/main/index.js CHANGED
@@ -6,8 +6,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  */
9
+ import '@iconify/iconify';
10
+ import './index.css';
11
+ import './style/editable.css';
9
12
  import { cx } from '@emotion/css';
10
- import styled from '@emotion/styled';
11
13
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
12
14
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
13
15
  import { useCallback, useEffect, useRef } from 'react';
@@ -17,6 +19,7 @@ import { SettingsContext } from './context/SettingsContext';
17
19
  import { SharedAutocompleteContext } from './context/SharedAutocompleteContext';
18
20
  import { SharedHistoryContext } from './context/SharedHistoryContext';
19
21
  import Editor from './editor';
22
+ import { EditorRoot } from './editor-root';
20
23
  import PlaygroundNodes from './nodes/PlaygroundNodes';
21
24
  import { TableContext } from './plugins/TablePlugin';
22
25
  import { useCustomTheme } from './themes/customTheme';
@@ -34,9 +37,10 @@ export default function BlockletEditor({ editorState, nodes = PlaygroundNodes, e
34
37
  },
35
38
  theme,
36
39
  };
37
- return (_jsx(SettingsContext, { children: _jsx(SharedHistoryContext, { children: _jsx(SharedAutocompleteContext, { children: _jsx(TableContext, { children: _jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx(EditorShell, { ...props, editable: editable }) }, muiTheme.palette.mode) }) }) }) }));
40
+ return (_jsx(SettingsContext, { children: _jsx(SharedHistoryContext, { children: _jsx(SharedAutocompleteContext, { children: _jsx(TableContext, { children: _jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx(EditorShell, { ...props, editable: editable }) }) }) }) }) }));
38
41
  }
39
42
  function EditorShell({ placeholder, children, prepend, editable, onChange, autoFocus, showToolbar = true, editorRef, onReady, enableHeadingsIdPlugin, ...props }) {
43
+ const muiTheme = useTheme();
40
44
  const [editor] = useLexicalComposerContext();
41
45
  useEffect(() => {
42
46
  editor.setEditable(editable ?? true);
@@ -47,14 +51,5 @@ function EditorShell({ placeholder, children, prepend, editable, onChange, autoF
47
51
  editor.focus();
48
52
  }
49
53
  }, []);
50
- return (_jsx(EditorRoot, { ...props, className: cx(props.className, 'be-shell'), ref: shellRef, onClick: onShellClick, children: _jsx(Editor, { onChange: onChange, placeholder: placeholder, autoFocus: autoFocus, showToolbar: showToolbar, editorRef: editorRef, onReady: onReady, enableHeadingsIdPlugin: enableHeadingsIdPlugin, prepend: prepend, children: children }) }));
54
+ return (_jsx(EditorRoot, { ...props, className: cx(props.className, 'be-shell'), ref: shellRef, "data-mode": muiTheme.palette.mode, onClick: onShellClick, children: _jsx(Editor, { onChange: onChange, placeholder: placeholder, autoFocus: autoFocus, showToolbar: showToolbar, editorRef: editorRef, onReady: onReady, enableHeadingsIdPlugin: enableHeadingsIdPlugin, prepend: prepend, children: children }) }));
51
55
  }
52
- const EditorRoot = styled.div `
53
- container: blocklet-editor / inline-size;
54
- margin: 0 auto;
55
- border-radius: 4px;
56
- position: relative;
57
- line-height: 1.7;
58
- font-weight: 400;
59
- text-align: left;
60
- `;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cx } from '@emotion/css';
3
- import styled from '@emotion/styled';
4
3
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
5
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
6
5
  import { useCallback, useEffect, useRef } from 'react';
7
6
  import { $convertFromMarkdownString } from '@lexical/markdown';
8
7
  import Editor from './editor';
8
+ import { EditorRoot } from '../editor-root';
9
9
  import nodes from './nodes';
10
10
  import { useCustomTheme } from '../themes/customTheme';
11
11
  import { MarkdownEditorThemeProvider } from './theme';
@@ -40,11 +40,3 @@ function EditorShell({ placeholder, children, editable, onChange, autoFocus, sho
40
40
  }, []);
41
41
  return (_jsx(EditorRoot, { ...props, className: cx(props.className, 'be-shell'), ref: shellRef, onClick: onShellClick, children: _jsx(Editor, { onChange: onChange, placeholder: placeholder, autoFocus: autoFocus, showToolbar: showToolbar, editorRef: editorRef, onReady: onReady, enableHeadingsIdPlugin: enableHeadingsIdPlugin, mediaUrlPrefix: mediaUrlPrefix, children: children }) }));
42
42
  }
43
- const EditorRoot = styled.div `
44
- margin: 0 auto;
45
- border-radius: 4px;
46
- position: relative;
47
- line-height: 1.7;
48
- font-weight: 400;
49
- text-align: left;
50
- `;
@@ -23,7 +23,6 @@ import { ExcalidrawNode } from './ExcalidrawNode';
23
23
  import { FigmaNode } from './FigmaNode';
24
24
  import { ImageNode } from './ImageNode';
25
25
  import { MermaidNode } from './MermaidNode';
26
- import { KeywordNode } from './KeywordNode';
27
26
  import { MentionNode } from './MentionNode';
28
27
  import { TweetNode } from './TweetNode';
29
28
  import { YouTubeNode } from './YouTubeNode';
@@ -60,7 +59,6 @@ const PlaygroundNodes = [
60
59
  EmojiNode,
61
60
  ExcalidrawNode,
62
61
  EquationNode,
63
- KeywordNode,
64
62
  HorizontalRuleNode,
65
63
  TweetNode,
66
64
  YouTubeNode,
@@ -0,0 +1,476 @@
1
+ /* ============================== toolbar ============================== */
2
+ @container toolbar (max-width: 700px) {
3
+ .toolbar-item.font-size,
4
+ .toolbar-item.code,
5
+ .toolbar-item.alignment,
6
+ .toolbar-item.link,
7
+ .toolbar-item.aide,
8
+ .toolbar-item.color-picker,
9
+ .toolbar-item.text-format-additional {
10
+ display: none !important;
11
+ }
12
+ }
13
+
14
+ .toolbar {
15
+ display: flex;
16
+ margin-bottom: 1px;
17
+ padding: 4px;
18
+ border-top-left-radius: 4px;
19
+ border-top-right-radius: 4px;
20
+ vertical-align: middle;
21
+ overflow: auto;
22
+ container: toolbar / inline-size;
23
+ }
24
+
25
+ .toolbar button.toolbar-item {
26
+ border: 0;
27
+ display: flex;
28
+ background: none;
29
+ border-radius: 8px;
30
+ padding: 8px;
31
+ cursor: pointer;
32
+ vertical-align: middle;
33
+ flex-shrink: 0;
34
+ align-items: center;
35
+ }
36
+
37
+ .toolbar button.toolbar-item:disabled {
38
+ cursor: not-allowed;
39
+ }
40
+
41
+ .toolbar button.toolbar-item.spaced {
42
+ margin-right: 4px;
43
+ }
44
+
45
+ .toolbar button.toolbar-item i.format {
46
+ background-size: contain;
47
+ display: inline-block;
48
+ height: 18px;
49
+ width: 18px;
50
+ vertical-align: -0.25em;
51
+ display: flex;
52
+ opacity: 0.6;
53
+ }
54
+
55
+ .toolbar button.toolbar-item:disabled .icon,
56
+ .toolbar button.toolbar-item:disabled .text,
57
+ .toolbar button.toolbar-item:disabled i.format,
58
+ .toolbar button.toolbar-item:disabled .chevron-down {
59
+ opacity: 0.2;
60
+ }
61
+
62
+ .toolbar button.toolbar-item.active i {
63
+ opacity: 1;
64
+ }
65
+
66
+ .toolbar .toolbar-item.font-family .text {
67
+ display: block;
68
+ max-width: 40px;
69
+ }
70
+
71
+ .toolbar .code-language {
72
+ width: 150px;
73
+ }
74
+
75
+ .toolbar .toolbar-item .text {
76
+ display: flex;
77
+ line-height: 20px;
78
+ vertical-align: middle;
79
+ font-size: 14px;
80
+ color: #777;
81
+ text-overflow: ellipsis;
82
+ overflow: hidden;
83
+ height: 20px;
84
+ text-align: left;
85
+ }
86
+
87
+ .toolbar .toolbar-item .icon {
88
+ display: flex;
89
+ width: 20px;
90
+ height: 20px;
91
+ user-select: none;
92
+ line-height: 16px;
93
+ background-size: contain;
94
+ }
95
+
96
+ .toolbar .toolbar-item .iconify {
97
+ display: flex;
98
+ width: 20px;
99
+ height: 20px;
100
+ }
101
+
102
+ .toolbar i.chevron-down {
103
+ margin-top: 3px;
104
+ margin-left: auto;
105
+ width: 16px;
106
+ height: 16px;
107
+ display: flex;
108
+ user-select: none;
109
+ }
110
+
111
+ .toolbar i.chevron-down.inside {
112
+ width: 16px;
113
+ height: 16px;
114
+ display: flex;
115
+ margin-left: -25px;
116
+ margin-top: 11px;
117
+ margin-right: 10px;
118
+ pointer-events: none;
119
+ }
120
+
121
+ .toolbar .divider {
122
+ width: 1px;
123
+ background-color: #eee;
124
+ margin: 0 4px;
125
+ }
126
+
127
+ /* ============================== typeahead & menu ============================== */
128
+ .typeahead-popover {
129
+ box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
130
+ border-radius: 8px;
131
+ z-index: 1;
132
+ }
133
+
134
+ .typeahead-popover ul {
135
+ padding: 0;
136
+ list-style: none;
137
+ margin: 0;
138
+ border-radius: 8px;
139
+ max-height: 280px;
140
+ overflow-y: scroll;
141
+ }
142
+
143
+ .typeahead-popover ul::-webkit-scrollbar {
144
+ display: none;
145
+ }
146
+
147
+ .typeahead-popover ul {
148
+ -ms-overflow-style: none;
149
+ scrollbar-width: none;
150
+ padding: 8px 0;
151
+ }
152
+
153
+ .typeahead-popover ul li {
154
+ margin: 0;
155
+ min-width: 180px;
156
+ font-size: 14px;
157
+ outline: none;
158
+ cursor: pointer;
159
+ }
160
+
161
+ .typeahead-popover li {
162
+ margin: 0 8px 0 8px;
163
+ padding: 8px;
164
+ cursor: pointer;
165
+ line-height: 16px;
166
+ font-size: 15px;
167
+ display: flex;
168
+ align-content: center;
169
+ flex-direction: row;
170
+ flex-shrink: 0;
171
+ border: 0;
172
+ }
173
+
174
+ .typeahead-popover li.active {
175
+ display: flex;
176
+ width: 20px;
177
+ height: 20px;
178
+ background-size: contain;
179
+ }
180
+
181
+ .typeahead-popover li .text {
182
+ display: flex;
183
+ line-height: 20px;
184
+ flex-grow: 1;
185
+ min-width: 150px;
186
+ }
187
+
188
+ .typeahead-popover li .icon {
189
+ display: flex;
190
+ width: 20px;
191
+ height: 20px;
192
+ user-select: none;
193
+ margin-right: 8px;
194
+ line-height: 16px;
195
+ background-size: contain;
196
+ }
197
+
198
+ /* blocklet embed option - disabled 样式 */
199
+ .typeahead-popover ul li.embed-option-disabled {
200
+ color: #999;
201
+ cursor: default;
202
+ }
203
+
204
+ #typeahead-menu {
205
+ pointer-events: none;
206
+ z-index: 10001;
207
+ }
208
+
209
+ #typeahead-menu > * {
210
+ pointer-events: auto;
211
+ }
212
+
213
+ .component-picker-menu {
214
+ width: 200px;
215
+ }
216
+
217
+ .mentions-menu {
218
+ width: 250px;
219
+ }
220
+
221
+ .auto-embed-menu {
222
+ width: 200px;
223
+ }
224
+
225
+ .emoji-menu {
226
+ width: 200px;
227
+ }
228
+
229
+ /* ============================== link-editor ============================== */
230
+ .link-editor .button.active,
231
+ .toolbar .button.active {
232
+ background-color: rgb(223, 232, 250);
233
+ }
234
+
235
+ .link-editor .link-input {
236
+ display: block;
237
+ width: calc(100% - 24px);
238
+ box-sizing: border-box;
239
+ margin: 8px 12px;
240
+ padding: 8px 12px;
241
+ border-radius: 15px;
242
+ font-size: 15px;
243
+ border: 0;
244
+ outline: 0;
245
+ position: relative;
246
+ font-family: inherit;
247
+ }
248
+
249
+ .link-editor div.link-edit {
250
+ width: 35px;
251
+ vertical-align: -0.25em;
252
+ position: absolute;
253
+ right: 0;
254
+ top: 0;
255
+ bottom: 0;
256
+ cursor: pointer;
257
+ font-size: 20px;
258
+ display: flex;
259
+ align-items: center;
260
+ justify-content: center;
261
+ }
262
+
263
+ .link-editor .link-input a {
264
+ text-decoration: none;
265
+ display: block;
266
+ white-space: nowrap;
267
+ overflow: hidden;
268
+ margin-right: 30px;
269
+ text-overflow: ellipsis;
270
+ }
271
+
272
+ .link-editor .link-input a:hover {
273
+ text-decoration: underline;
274
+ }
275
+
276
+ .link-editor .font-size-wrapper,
277
+ .link-editor .font-family-wrapper {
278
+ display: flex;
279
+ margin: 0 4px;
280
+ }
281
+
282
+ .link-editor select {
283
+ padding: 6px;
284
+ border: none;
285
+ background-color: rgba(0, 0, 0, 0.075);
286
+ border-radius: 4px;
287
+ }
288
+
289
+ /* ============================== dropdown ============================== */
290
+ .mention {
291
+ color: #666;
292
+ }
293
+
294
+ .mention:hover {
295
+ text-decoration: underline;
296
+ }
297
+
298
+ .mention:before {
299
+ display: inline-block;
300
+ content: '@';
301
+ }
302
+
303
+ .mention-typeahead-item-avatar {
304
+ width: 24px;
305
+ height: 24px;
306
+ border-radius: 15px;
307
+ background-size: cover;
308
+ }
309
+
310
+ .dropdown {
311
+ z-index: 10001;
312
+ display: block;
313
+ position: fixed;
314
+ border-radius: 8px;
315
+ min-height: 40px;
316
+ }
317
+
318
+ .dropdown .item {
319
+ padding: 8px;
320
+ cursor: pointer;
321
+ line-height: 16px;
322
+ font-size: 15px;
323
+ display: flex;
324
+ align-content: center;
325
+ flex-direction: row;
326
+ flex-shrink: 0;
327
+ justify-content: space-between;
328
+ border: 0;
329
+ max-width: 250px;
330
+ min-width: 100px;
331
+ }
332
+
333
+ .dropdown .item.fontsize-item,
334
+ .dropdown .item.fontsize-item .text {
335
+ min-width: unset;
336
+ }
337
+
338
+ .dropdown .item .active {
339
+ display: flex;
340
+ width: 20px;
341
+ height: 20px;
342
+ background-size: contain;
343
+ }
344
+
345
+ .dropdown .item:first-child {
346
+ margin-top: 8px;
347
+ }
348
+
349
+ .dropdown .item:last-child {
350
+ margin-bottom: 8px;
351
+ }
352
+
353
+ .dropdown .item .text {
354
+ display: flex;
355
+ line-height: 20px;
356
+ flex-grow: 1;
357
+ min-width: 150px;
358
+ }
359
+
360
+ .dropdown .item .icon {
361
+ display: flex;
362
+ width: 20px;
363
+ height: 20px;
364
+ user-select: none;
365
+ margin-right: 12px;
366
+ line-height: 16px;
367
+ background-size: contain;
368
+ background-position: center;
369
+ background-repeat: no-repeat;
370
+ }
371
+
372
+ .dropdown .divider {
373
+ width: auto;
374
+ margin: 4px 8px;
375
+ height: 1px;
376
+ }
377
+
378
+ .dropdown-button-text {
379
+ margin-left: 8px;
380
+ }
381
+
382
+ @media screen and (max-width: 1100px) {
383
+ .dropdown-button-text {
384
+ display: none !important;
385
+ }
386
+ .font-size .dropdown-button-text {
387
+ display: flex !important;
388
+ }
389
+ .code-language .dropdown-button-text {
390
+ display: flex !important;
391
+ }
392
+ }
393
+
394
+ /* ============================== actions & table-cell-action ============================== */
395
+
396
+ .actions {
397
+ position: absolute;
398
+ text-align: right;
399
+ padding: 10px;
400
+ bottom: 0;
401
+ right: 0;
402
+ }
403
+
404
+ .actions.tree-view {
405
+ border-bottom-left-radius: 0;
406
+ border-bottom-right-radius: 0;
407
+ }
408
+
409
+ .actions i {
410
+ background-size: contain;
411
+ display: inline-block;
412
+ height: 15px;
413
+ width: 15px;
414
+ vertical-align: -0.25em;
415
+ }
416
+
417
+ .action-button {
418
+ background-color: #eee;
419
+ border: 0;
420
+ padding: 8px 12px;
421
+ position: relative;
422
+ margin-left: 5px;
423
+ border-radius: 15px;
424
+ color: #222;
425
+ cursor: pointer;
426
+ display: flex;
427
+ }
428
+
429
+ .action-button .MuiLoadingButton-loadingIndicator {
430
+ position: relative;
431
+ left: 0;
432
+ margin-right: 8px;
433
+ }
434
+
435
+ .action-button:hover {
436
+ background-color: #ddd;
437
+ color: #000;
438
+ }
439
+
440
+ .action-button-mic.active {
441
+ animation: mic-pulsate-color 3s infinite;
442
+ }
443
+ button.action-button:disabled {
444
+ cursor: not-allowed;
445
+ }
446
+
447
+ .table-cell-action-button-container {
448
+ position: absolute;
449
+ z-index: 3;
450
+ top: 0;
451
+ left: 0;
452
+ will-change: transform;
453
+ }
454
+ .table-cell-action-button-container.table-cell-action-button-container--active {
455
+ pointer-events: auto;
456
+ opacity: 1;
457
+ }
458
+ .table-cell-action-button-container.table-cell-action-button-container--inactive {
459
+ pointer-events: none;
460
+ opacity: 0;
461
+ }
462
+
463
+ .table-cell-action-button {
464
+ display: flex;
465
+ justify-content: center;
466
+ align-items: center;
467
+ border: 0;
468
+ position: absolute;
469
+ top: 10px;
470
+ right: 10px;
471
+ border-radius: 15px;
472
+ color: #222;
473
+ display: inline-block;
474
+ cursor: pointer;
475
+ opacity: 0.75;
476
+ }
@@ -1,35 +1,4 @@
1
- export declare const codeHighlightDark: {
2
- atrule: string;
3
- attr: string;
4
- boolean: string;
5
- builtin: string;
6
- cdata: string;
7
- char: string;
8
- class: string;
9
- comment: string;
10
- constant: string;
11
- deleted: string;
12
- doctype: string;
13
- entity: string;
14
- function: string;
15
- important: string;
16
- inserted: string;
17
- keyword: string;
18
- namespace: string;
19
- number: string;
20
- operator: string;
21
- prolog: string;
22
- property: string;
23
- punctuation: string;
24
- regex: string;
25
- selector: string;
26
- string: string;
27
- symbol: string;
28
- tag: string;
29
- url: string;
30
- variable: string;
31
- };
32
- export declare const codeHighlightLight: {
1
+ declare const codeHighlight: {
33
2
  atrule: string;
34
3
  attr: string;
35
4
  boolean: string;
@@ -60,3 +29,4 @@ export declare const codeHighlightLight: {
60
29
  url: string;
61
30
  variable: string;
62
31
  };
32
+ export default codeHighlight;
@@ -1,55 +1,30 @@
1
1
  import { css } from '@emotion/css';
2
2
  // Dark theme tokens
3
3
  const tokenComment = css `
4
- color: #6a9955;
4
+ color: var(--lexical-code-comment);
5
5
  `;
6
6
  const tokenPunctuation = css `
7
- color: #d4d4d4;
7
+ color: var(--lexical-code-punctuation);
8
8
  `;
9
9
  const tokenProperty = css `
10
- color: #9cdcfe;
10
+ color: var(--lexical-code-property);
11
11
  `;
12
12
  const tokenSelector = css `
13
- color: #d7ba7d;
13
+ color: var(--lexical-code-selector);
14
14
  `;
15
15
  const tokenOperator = css `
16
- color: #d4d4d4;
16
+ color: var(--lexical-code-operator);
17
17
  `;
18
18
  const tokenAttr = css `
19
- color: #9cdcfe;
19
+ color: var(--lexical-code-attr);
20
20
  `;
21
21
  const tokenVariable = css `
22
- color: #9cdcfe;
22
+ color: var(--lexical-code-variable);
23
23
  `;
24
24
  const tokenFunction = css `
25
- color: #dcdcaa;
25
+ color: var(--lexical-code-function);
26
26
  `;
27
- // Light theme tokens - 更有活力和年轻化的配色,优化对比度
28
- const tokenCommentLight = css `
29
- color: #1e8449;
30
- `;
31
- const tokenPunctuationLight = css `
32
- color: #2c3e50;
33
- `;
34
- const tokenPropertyLight = css `
35
- color: #e67e22;
36
- `;
37
- const tokenSelectorLight = css `
38
- color: #c0392b;
39
- `;
40
- const tokenOperatorLight = css `
41
- color: #8e44ad;
42
- `;
43
- const tokenAttrLight = css `
44
- color: #2980b9;
45
- `;
46
- const tokenVariableLight = css `
47
- color: #27ae60;
48
- `;
49
- const tokenFunctionLight = css `
50
- color: #f39c12;
51
- `;
52
- export const codeHighlightDark = {
27
+ const codeHighlight = {
53
28
  atrule: tokenAttr,
54
29
  attr: tokenAttr,
55
30
  boolean: tokenProperty,
@@ -80,34 +55,4 @@ export const codeHighlightDark = {
80
55
  url: tokenOperator,
81
56
  variable: tokenVariable,
82
57
  };
83
- export const codeHighlightLight = {
84
- atrule: tokenAttrLight,
85
- attr: tokenAttrLight,
86
- boolean: tokenPropertyLight,
87
- builtin: tokenSelectorLight,
88
- cdata: tokenCommentLight,
89
- char: tokenSelectorLight,
90
- class: tokenFunctionLight,
91
- comment: tokenCommentLight,
92
- constant: tokenPropertyLight,
93
- deleted: tokenPropertyLight,
94
- doctype: tokenCommentLight,
95
- entity: tokenOperatorLight,
96
- function: tokenFunctionLight,
97
- important: tokenVariableLight,
98
- inserted: tokenSelectorLight,
99
- keyword: tokenAttrLight,
100
- namespace: tokenVariableLight,
101
- number: tokenPropertyLight,
102
- operator: tokenOperatorLight,
103
- prolog: tokenCommentLight,
104
- property: tokenPropertyLight,
105
- punctuation: tokenPunctuationLight,
106
- regex: tokenVariableLight,
107
- selector: tokenSelectorLight,
108
- string: tokenSelectorLight,
109
- symbol: tokenPropertyLight,
110
- tag: tokenPropertyLight,
111
- url: tokenOperatorLight,
112
- variable: tokenVariableLight,
113
- };
58
+ export default codeHighlight;