vzcode 0.24.0 → 0.25.0
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/assets/index-8628ebab.js +111 -0
- package/dist/index.html +1 -1
- package/package.json +3 -1
- package/src/client/App.tsx +78 -64
- package/src/client/CodeEditor/getOrCreateEditor.ts +3 -0
- package/src/client/CodeEditor/widgets.ts +112 -10
- package/src/client/Sidebar/Item.tsx +3 -3
- package/src/client/reducer.ts +19 -22
- package/src/client/themes/index.ts +7 -0
- package/src/client/{themes.ts → themes/themes.ts} +5 -5
- package/src/client/{useDynamicTheme.ts → themes/useDynamicTheme.ts} +1 -1
- package/src/client/themes/vizhubTheme/colors.ts +80 -0
- package/src/client/themes/vizhubTheme/index.ts +166 -0
- package/dist/assets/index-9c8bbae0.js +0 -111
- package/src/client/useTabsState.ts +0 -95
- package/src/client/vizhubTheme.js +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// A CodeMirror 6 theme for the VizHub syntax highlighting colors.
|
|
2
|
+
|
|
3
|
+
// Inspired by https://github.com/uiwjs/react-codemirror/blob/master/themes/vscode/src/index.ts
|
|
4
|
+
|
|
5
|
+
import { tags as t } from '@lezer/highlight';
|
|
6
|
+
import {
|
|
7
|
+
createTheme,
|
|
8
|
+
CreateThemeOptions,
|
|
9
|
+
} from '@uiw/codemirror-themes';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
// Colors for various things outside the code itself
|
|
13
|
+
backgroundColor,
|
|
14
|
+
lineHighlight,
|
|
15
|
+
light,
|
|
16
|
+
dark,
|
|
17
|
+
lineNumbers,
|
|
18
|
+
lineNumbersActive,
|
|
19
|
+
selectionBackground,
|
|
20
|
+
selectionBackgroundMatch,
|
|
21
|
+
caretColor,
|
|
22
|
+
|
|
23
|
+
// Syntax highlighting colors
|
|
24
|
+
MINT,
|
|
25
|
+
AQUA,
|
|
26
|
+
SKY,
|
|
27
|
+
LAVENDER,
|
|
28
|
+
SALMON,
|
|
29
|
+
GOLDENROD,
|
|
30
|
+
PANIC,
|
|
31
|
+
} from './colors';
|
|
32
|
+
|
|
33
|
+
const defaultSettingsVizhubTheme: CreateThemeOptions['settings'] =
|
|
34
|
+
{
|
|
35
|
+
background: backgroundColor,
|
|
36
|
+
foreground: light,
|
|
37
|
+
caret: caretColor,
|
|
38
|
+
selection: selectionBackground,
|
|
39
|
+
selectionMatch: selectionBackgroundMatch,
|
|
40
|
+
lineHighlight,
|
|
41
|
+
gutterBackground: backgroundColor,
|
|
42
|
+
gutterForeground: lineNumbers,
|
|
43
|
+
gutterActiveForeground: lineNumbersActive,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function vizhubThemeInit(
|
|
47
|
+
options?: Partial<CreateThemeOptions>,
|
|
48
|
+
) {
|
|
49
|
+
const {
|
|
50
|
+
theme = 'dark',
|
|
51
|
+
settings = {},
|
|
52
|
+
styles = [],
|
|
53
|
+
} = options || {};
|
|
54
|
+
return createTheme({
|
|
55
|
+
theme: theme,
|
|
56
|
+
settings: {
|
|
57
|
+
...defaultSettingsVizhubTheme,
|
|
58
|
+
...settings,
|
|
59
|
+
},
|
|
60
|
+
styles: [
|
|
61
|
+
{
|
|
62
|
+
tag: [
|
|
63
|
+
t.keyword,
|
|
64
|
+
t.operatorKeyword,
|
|
65
|
+
t.modifier,
|
|
66
|
+
t.color,
|
|
67
|
+
t.constant(t.name),
|
|
68
|
+
t.standard(t.name),
|
|
69
|
+
t.standard(t.tagName),
|
|
70
|
+
t.special(t.brace),
|
|
71
|
+
t.atom,
|
|
72
|
+
t.bool,
|
|
73
|
+
t.special(t.variableName),
|
|
74
|
+
],
|
|
75
|
+
color: MINT,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
tag: [t.controlKeyword, t.moduleKeyword],
|
|
79
|
+
color: MINT,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
tag: [
|
|
83
|
+
t.name,
|
|
84
|
+
t.deleted,
|
|
85
|
+
t.character,
|
|
86
|
+
t.macroName,
|
|
87
|
+
|
|
88
|
+
t.variableName,
|
|
89
|
+
t.labelName,
|
|
90
|
+
t.definition(t.name),
|
|
91
|
+
],
|
|
92
|
+
color: AQUA,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
tag: [t.propertyName],
|
|
96
|
+
color: GOLDENROD,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
tag: t.heading,
|
|
100
|
+
fontWeight: 'bold',
|
|
101
|
+
color: SKY,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
tag: [
|
|
105
|
+
t.typeName,
|
|
106
|
+
t.className,
|
|
107
|
+
t.tagName,
|
|
108
|
+
t.number,
|
|
109
|
+
t.changed,
|
|
110
|
+
t.annotation,
|
|
111
|
+
t.self,
|
|
112
|
+
t.namespace,
|
|
113
|
+
],
|
|
114
|
+
color: AQUA,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
tag: [
|
|
118
|
+
t.function(t.variableName),
|
|
119
|
+
t.function(t.propertyName),
|
|
120
|
+
],
|
|
121
|
+
color: AQUA,
|
|
122
|
+
},
|
|
123
|
+
{ tag: [t.number], color: SALMON },
|
|
124
|
+
{
|
|
125
|
+
tag: [
|
|
126
|
+
t.operator,
|
|
127
|
+
t.punctuation,
|
|
128
|
+
t.separator,
|
|
129
|
+
t.url,
|
|
130
|
+
t.escape,
|
|
131
|
+
t.regexp,
|
|
132
|
+
],
|
|
133
|
+
color: light,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
tag: [t.regexp],
|
|
137
|
+
color: LAVENDER,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
tag: [t.special(t.string), t.string, t.inserted],
|
|
141
|
+
color: LAVENDER,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
tag: [t.processingInstruction],
|
|
145
|
+
color: AQUA,
|
|
146
|
+
},
|
|
147
|
+
{ tag: [t.angleBracket], color: AQUA },
|
|
148
|
+
{ tag: t.strong, fontWeight: 'bold' },
|
|
149
|
+
{ tag: t.emphasis, fontStyle: 'italic' },
|
|
150
|
+
{
|
|
151
|
+
tag: t.strikethrough,
|
|
152
|
+
textDecoration: 'line-through',
|
|
153
|
+
},
|
|
154
|
+
{ tag: [t.meta, t.comment], color: dark },
|
|
155
|
+
{
|
|
156
|
+
tag: t.link,
|
|
157
|
+
color: GOLDENROD,
|
|
158
|
+
textDecoration: 'underline',
|
|
159
|
+
},
|
|
160
|
+
{ tag: t.invalid, color: PANIC },
|
|
161
|
+
...styles,
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const vizhubTheme = vizhubThemeInit();
|