@sqlrooms/monaco-editor 0.7.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/LICENSE.md +9 -0
- package/README.md +86 -0
- package/dist/components/JsonMonacoEditor.d.ts +17 -0
- package/dist/components/JsonMonacoEditor.d.ts.map +1 -0
- package/dist/components/JsonMonacoEditor.js +38 -0
- package/dist/components/JsonMonacoEditor.js.map +1 -0
- package/dist/components/MonacoEditor.d.ts +46 -0
- package/dist/components/MonacoEditor.d.ts.map +1 -0
- package/dist/components/MonacoEditor.js +154 -0
- package/dist/components/MonacoEditor.js.map +1 -0
- package/dist/components/SqlMonacoEditor.d.ts +27 -0
- package/dist/components/SqlMonacoEditor.d.ts.map +1 -0
- package/dist/components/SqlMonacoEditor.js +172 -0
- package/dist/components/SqlMonacoEditor.js.map +1 -0
- package/dist/constants/duckdb.d.ts +73 -0
- package/dist/constants/duckdb.d.ts.map +1 -0
- package/dist/constants/duckdb.js +392 -0
- package/dist/constants/duckdb.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/color-utils.d.ts +33 -0
- package/dist/utils/color-utils.d.ts.map +1 -0
- package/dist/utils/color-utils.js +263 -0
- package/dist/utils/color-utils.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts HSL color values to Hex color string
|
|
3
|
+
* @param h Hue (0-360)
|
|
4
|
+
* @param s Saturation (0-100)
|
|
5
|
+
* @param l Lightness (0-100)
|
|
6
|
+
* @returns Hex color string (#RRGGBB)
|
|
7
|
+
*/
|
|
8
|
+
export function hslToHex(h, s, l) {
|
|
9
|
+
// Convert saturation and lightness to fractions
|
|
10
|
+
s /= 100;
|
|
11
|
+
l /= 100;
|
|
12
|
+
// Calculate chroma
|
|
13
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
14
|
+
const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
|
|
15
|
+
const m = l - c / 2;
|
|
16
|
+
let r = 0, g = 0, b = 0;
|
|
17
|
+
if (0 <= h && h < 60) {
|
|
18
|
+
r = c;
|
|
19
|
+
g = x;
|
|
20
|
+
b = 0;
|
|
21
|
+
}
|
|
22
|
+
else if (60 <= h && h < 120) {
|
|
23
|
+
r = x;
|
|
24
|
+
g = c;
|
|
25
|
+
b = 0;
|
|
26
|
+
}
|
|
27
|
+
else if (120 <= h && h < 180) {
|
|
28
|
+
r = 0;
|
|
29
|
+
g = c;
|
|
30
|
+
b = x;
|
|
31
|
+
}
|
|
32
|
+
else if (180 <= h && h < 240) {
|
|
33
|
+
r = 0;
|
|
34
|
+
g = x;
|
|
35
|
+
b = c;
|
|
36
|
+
}
|
|
37
|
+
else if (240 <= h && h < 300) {
|
|
38
|
+
r = x;
|
|
39
|
+
g = 0;
|
|
40
|
+
b = c;
|
|
41
|
+
}
|
|
42
|
+
else if (300 <= h && h < 360) {
|
|
43
|
+
r = c;
|
|
44
|
+
g = 0;
|
|
45
|
+
b = x;
|
|
46
|
+
}
|
|
47
|
+
// Convert RGB to hex format
|
|
48
|
+
const toHex = (c) => {
|
|
49
|
+
const hex = Math.round((c + m) * 255).toString(16);
|
|
50
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
51
|
+
};
|
|
52
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Safely gets a CSS variable and ensures it's in a format Monaco can use
|
|
56
|
+
* @param variableName CSS variable name (e.g. '--background')
|
|
57
|
+
* @param fallbackColor Fallback color if the variable isn't found
|
|
58
|
+
* @returns A color string in a format Monaco can use (typically hex)
|
|
59
|
+
*/
|
|
60
|
+
export function getCssColor(variableName, fallbackColor) {
|
|
61
|
+
try {
|
|
62
|
+
// Get CSS variable value
|
|
63
|
+
const cssValue = getComputedStyle(document.documentElement)
|
|
64
|
+
.getPropertyValue(variableName)
|
|
65
|
+
.trim();
|
|
66
|
+
if (!cssValue)
|
|
67
|
+
return fallbackColor;
|
|
68
|
+
// If already a hex color, return it
|
|
69
|
+
if (cssValue.startsWith('#'))
|
|
70
|
+
return cssValue;
|
|
71
|
+
// Check if value is in HSL format (e.g. "210 40% 98%" or "222.2 84% 4.9%")
|
|
72
|
+
const hslMatch = cssValue.match(/^(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%$/);
|
|
73
|
+
if (hslMatch && hslMatch[1] && hslMatch[2] && hslMatch[3]) {
|
|
74
|
+
const h = parseFloat(hslMatch[1]);
|
|
75
|
+
const s = parseFloat(hslMatch[2]);
|
|
76
|
+
const l = parseFloat(hslMatch[3]);
|
|
77
|
+
return hslToHex(h, s, l);
|
|
78
|
+
}
|
|
79
|
+
// Try to parse other formats or return fallback
|
|
80
|
+
return fallbackColor;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error(`Error getting CSS variable ${variableName}:`, error);
|
|
84
|
+
return fallbackColor;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets a monospace font family from CSS variables or falls back to a system monospace font stack
|
|
89
|
+
* @returns Monospace font family string suitable for code editors
|
|
90
|
+
*/
|
|
91
|
+
export function getMonospaceFont() {
|
|
92
|
+
return (getComputedStyle(document.documentElement)
|
|
93
|
+
.getPropertyValue('--font-mono')
|
|
94
|
+
.trim() ||
|
|
95
|
+
'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
|
96
|
+
//'SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Gets Monaco editor menu theme colors based on Tailwind CSS variables
|
|
101
|
+
* @param isDarkTheme Whether the current theme is dark or light
|
|
102
|
+
* @returns Object with menu-related color settings for Monaco editor
|
|
103
|
+
*/
|
|
104
|
+
export function getMenuColors(isDarkTheme) {
|
|
105
|
+
const defaultDarkColors = {
|
|
106
|
+
'editorWidget.background': '#1f1f1f',
|
|
107
|
+
'editorWidget.foreground': '#cccccc',
|
|
108
|
+
'editorWidget.border': '#454545',
|
|
109
|
+
'editorSuggestWidget.background': '#252526',
|
|
110
|
+
'list.hoverBackground': '#2a2d2e',
|
|
111
|
+
'list.highlightForeground': '#0097fb',
|
|
112
|
+
'menu.background': '#252526',
|
|
113
|
+
'menu.foreground': '#cccccc',
|
|
114
|
+
'menu.selectionBackground': '#04395e',
|
|
115
|
+
'menu.selectionForeground': '#ffffff',
|
|
116
|
+
'quickInput.background': '#252526',
|
|
117
|
+
'quickInput.foreground': '#cccccc',
|
|
118
|
+
'dropdown.background': '#252526',
|
|
119
|
+
'dropdown.foreground': '#f0f0f0',
|
|
120
|
+
};
|
|
121
|
+
const defaultLightColors = {
|
|
122
|
+
'editorWidget.background': '#f3f3f3',
|
|
123
|
+
'editorWidget.foreground': '#616161',
|
|
124
|
+
'editorWidget.border': '#c8c8c8',
|
|
125
|
+
'editorSuggestWidget.background': '#f3f3f3',
|
|
126
|
+
'list.hoverBackground': '#e8e8e8',
|
|
127
|
+
'list.highlightForeground': '#0066bf',
|
|
128
|
+
'menu.background': '#f3f3f3',
|
|
129
|
+
'menu.foreground': '#616161',
|
|
130
|
+
'menu.selectionBackground': '#d6ebff',
|
|
131
|
+
'menu.selectionForeground': '#333333',
|
|
132
|
+
'quickInput.background': '#f3f3f3',
|
|
133
|
+
'quickInput.foreground': '#616161',
|
|
134
|
+
'dropdown.background': '#f3f3f3',
|
|
135
|
+
'dropdown.foreground': '#616161',
|
|
136
|
+
};
|
|
137
|
+
// Choose base defaults based on theme
|
|
138
|
+
const defaults = isDarkTheme ? defaultDarkColors : defaultLightColors;
|
|
139
|
+
const result = {};
|
|
140
|
+
// Map Tailwind variables to Monaco color settings
|
|
141
|
+
if (isDarkTheme) {
|
|
142
|
+
// Dark theme mappings
|
|
143
|
+
result['editorWidget.background'] = getCssColor('--popover', defaults['editorWidget.background']);
|
|
144
|
+
result['editorWidget.foreground'] = getCssColor('--popover-foreground', defaults['editorWidget.foreground']);
|
|
145
|
+
result['editorWidget.border'] = getCssColor('--border', defaults['editorWidget.border']);
|
|
146
|
+
result['editorSuggestWidget.background'] = getCssColor('--popover', defaults['editorSuggestWidget.background']);
|
|
147
|
+
result['list.hoverBackground'] = getCssColor('--accent', defaults['list.hoverBackground']);
|
|
148
|
+
result['list.highlightForeground'] = getCssColor('--primary', defaults['list.highlightForeground']);
|
|
149
|
+
result['menu.background'] = getCssColor('--popover', defaults['menu.background']);
|
|
150
|
+
result['menu.foreground'] = getCssColor('--popover-foreground', defaults['menu.foreground']);
|
|
151
|
+
result['menu.selectionBackground'] = getCssColor('--accent', defaults['menu.selectionBackground']);
|
|
152
|
+
result['menu.selectionForeground'] = getCssColor('--accent-foreground', defaults['menu.selectionForeground']);
|
|
153
|
+
result['quickInput.background'] = getCssColor('--popover', defaults['quickInput.background']);
|
|
154
|
+
result['quickInput.foreground'] = getCssColor('--popover-foreground', defaults['quickInput.foreground']);
|
|
155
|
+
result['dropdown.background'] = getCssColor('--popover', defaults['dropdown.background']);
|
|
156
|
+
result['dropdown.foreground'] = getCssColor('--popover-foreground', defaults['dropdown.foreground']);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// Light theme mappings
|
|
160
|
+
result['editorWidget.background'] = getCssColor('--popover', defaults['editorWidget.background']);
|
|
161
|
+
result['editorWidget.foreground'] = getCssColor('--popover-foreground', defaults['editorWidget.foreground']);
|
|
162
|
+
result['editorWidget.border'] = getCssColor('--border', defaults['editorWidget.border']);
|
|
163
|
+
result['editorSuggestWidget.background'] = getCssColor('--popover', defaults['editorSuggestWidget.background']);
|
|
164
|
+
result['list.hoverBackground'] = getCssColor('--accent', defaults['list.hoverBackground']);
|
|
165
|
+
result['list.highlightForeground'] = getCssColor('--primary', defaults['list.highlightForeground']);
|
|
166
|
+
result['menu.background'] = getCssColor('--popover', defaults['menu.background']);
|
|
167
|
+
result['menu.foreground'] = getCssColor('--popover-foreground', defaults['menu.foreground']);
|
|
168
|
+
result['menu.selectionBackground'] = getCssColor('--accent', defaults['menu.selectionBackground']);
|
|
169
|
+
result['menu.selectionForeground'] = getCssColor('--accent-foreground', defaults['menu.selectionForeground']);
|
|
170
|
+
result['quickInput.background'] = getCssColor('--popover', defaults['quickInput.background']);
|
|
171
|
+
result['quickInput.foreground'] = getCssColor('--popover-foreground', defaults['quickInput.foreground']);
|
|
172
|
+
result['dropdown.background'] = getCssColor('--popover', defaults['dropdown.background']);
|
|
173
|
+
result['dropdown.foreground'] = getCssColor('--popover-foreground', defaults['dropdown.foreground']);
|
|
174
|
+
}
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Generates a Monaco editor theme specifically for JSON editing with Tailwind colors
|
|
179
|
+
* @param isDarkTheme Whether the current theme is dark or light
|
|
180
|
+
* @returns A complete Monaco editor theme data object for JSON editing
|
|
181
|
+
*/
|
|
182
|
+
export function getJsonEditorTheme(isDarkTheme) {
|
|
183
|
+
// Predefined pastel colors for syntax highlighting
|
|
184
|
+
// Light theme colors
|
|
185
|
+
const lightThemeColors = {
|
|
186
|
+
property: '#4B6BDF', // Soft blue for property names
|
|
187
|
+
string: '#DB745C', // Soft coral for string values
|
|
188
|
+
number: '#56A64B', // Soft green for numbers
|
|
189
|
+
keyword: '#A450B5', // Soft purple for keywords
|
|
190
|
+
punctuation: '#6E7781', // Soft gray for punctuation
|
|
191
|
+
};
|
|
192
|
+
// Dark theme colors
|
|
193
|
+
const darkThemeColors = {
|
|
194
|
+
property: '#78AEFF', // Pastel blue for property names
|
|
195
|
+
string: '#FFAD85', // Pastel coral/orange for string values
|
|
196
|
+
number: '#7CD992', // Pastel green for numbers
|
|
197
|
+
keyword: '#C987E8', // Pastel purple for keywords
|
|
198
|
+
punctuation: '#A9B1BA', // Light gray for punctuation
|
|
199
|
+
};
|
|
200
|
+
// Select the appropriate color set based on theme
|
|
201
|
+
const colors = isDarkTheme ? darkThemeColors : lightThemeColors;
|
|
202
|
+
// Theme background and UI colors - still using CSS variables for the editor itself
|
|
203
|
+
const background = getCssColor('--background', isDarkTheme ? '#1E1E1E' : '#FFFFFF');
|
|
204
|
+
const foreground = getCssColor('--foreground', isDarkTheme ? '#D4D4D4' : '#000000');
|
|
205
|
+
const selection = getCssColor('--accent', isDarkTheme ? '#264F78' : '#ADD6FF');
|
|
206
|
+
const lineHighlight = getCssColor('--muted', isDarkTheme ? '#2A2A2A' : '#F5F5F5');
|
|
207
|
+
const lineNumbers = getCssColor('--muted-foreground', isDarkTheme ? '#858585' : '#888888');
|
|
208
|
+
const cursor = getCssColor('--primary', isDarkTheme ? '#FFFFFF' : '#000000');
|
|
209
|
+
// Menu colors
|
|
210
|
+
const menuBackground = getCssColor('--popover', isDarkTheme ? '#1C2233' : '#F3F3F3');
|
|
211
|
+
const menuForeground = getCssColor('--popover-foreground', isDarkTheme ? '#FFFFFF' : '#616161');
|
|
212
|
+
const menuSeparator = getCssColor('--border', isDarkTheme ? '#39435E' : '#C8C8C8');
|
|
213
|
+
return {
|
|
214
|
+
base: isDarkTheme ? 'vs-dark' : 'vs',
|
|
215
|
+
inherit: true,
|
|
216
|
+
rules: [
|
|
217
|
+
// Property keys - using pastel blue
|
|
218
|
+
{ token: 'type', foreground: colors.property.slice(1) },
|
|
219
|
+
{ token: 'string.key.json', foreground: colors.property.slice(1) },
|
|
220
|
+
{ token: 'key', foreground: colors.property.slice(1) },
|
|
221
|
+
// String values - using pastel coral/orange
|
|
222
|
+
{ token: 'string.value.json', foreground: colors.string.slice(1) },
|
|
223
|
+
{ token: 'string', foreground: colors.string.slice(1) },
|
|
224
|
+
// Numbers - using pastel green
|
|
225
|
+
{ token: 'number', foreground: colors.number.slice(1) },
|
|
226
|
+
// Keywords (true, false, null) - using pastel purple
|
|
227
|
+
{ token: 'keyword', foreground: colors.keyword.slice(1) },
|
|
228
|
+
// Punctuation - using light gray
|
|
229
|
+
{ token: 'delimiter', foreground: colors.punctuation.slice(1) },
|
|
230
|
+
{ token: 'bracket', foreground: colors.punctuation.slice(1) },
|
|
231
|
+
// Fallbacks
|
|
232
|
+
{ token: '', foreground: foreground.slice(1) },
|
|
233
|
+
],
|
|
234
|
+
colors: {
|
|
235
|
+
// Editor colors
|
|
236
|
+
'editor.background': background,
|
|
237
|
+
'editor.foreground': foreground,
|
|
238
|
+
'editor.selectionBackground': selection,
|
|
239
|
+
'editor.lineHighlightBackground': lineHighlight,
|
|
240
|
+
'editorLineNumber.foreground': lineNumbers,
|
|
241
|
+
'editorCursor.foreground': cursor,
|
|
242
|
+
// Widget and UI colors
|
|
243
|
+
'editorWidget.background': menuBackground,
|
|
244
|
+
'editorWidget.foreground': menuForeground,
|
|
245
|
+
'editorWidget.border': menuSeparator,
|
|
246
|
+
'editorSuggestWidget.background': menuBackground,
|
|
247
|
+
'editorSuggestWidget.foreground': menuForeground,
|
|
248
|
+
'editorSuggestWidget.border': menuSeparator,
|
|
249
|
+
// Menu colors
|
|
250
|
+
'menu.background': menuBackground,
|
|
251
|
+
'menu.foreground': menuForeground,
|
|
252
|
+
'menu.selectionBackground': selection,
|
|
253
|
+
'menu.selectionForeground': menuForeground,
|
|
254
|
+
'menu.separatorBackground': menuSeparator,
|
|
255
|
+
// Additional UI elements
|
|
256
|
+
'list.hoverBackground': lineHighlight,
|
|
257
|
+
'list.activeSelectionBackground': selection,
|
|
258
|
+
'quickInput.background': menuBackground,
|
|
259
|
+
'quickInput.foreground': menuForeground,
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=color-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../src/utils/color-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG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AC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC;YAEvD,iCAAiC;YACjC,EAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC;YAC7D,EAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC;YAE3D,YAAY;YACZ,EAAC,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC;SAC7C;QACD,MAAM,EAAE;YACN,gBAAgB;YAChB,mBAAmB,EAAE,UAAU;YAC/B,mBAAmB,EAAE,UAAU;YAC/B,4BAA4B,EAAE,SAAS;YACvC,gCAAgC,EAAE,aAAa;YAC/C,6BAA6B,EAAE,WAAW;YAC1C,yBAAyB,EAAE,MAAM;YAEjC,uBAAuB;YACvB,yBAAyB,EAAE,cAAc;YACzC,yBAAyB,EAAE,cAAc;YACzC,qBAAqB,EAAE,aAAa;YACpC,gCAAgC,EAAE,cAAc;YAChD,gCAAgC,EAAE,cAAc;YAChD,4BAA4B,EAAE,aAAa;YAE3C,cAAc;YACd,iBAAiB,EAAE,cAAc;YACjC,iBAAiB,EAAE,cAAc;YACjC,0BAA0B,EAAE,SAAS;YACrC,0BAA0B,EAAE,cAAc;YAC1C,0BAA0B,EAAE,aAAa;YAEzC,yBAAyB;YACzB,sBAAsB,EAAE,aAAa;YACrC,gCAAgC,EAAE,SAAS;YAC3C,uBAAuB,EAAE,cAAc;YACvC,uBAAuB,EAAE,cAAc;SACxC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Converts HSL color values to Hex color string\n * @param h Hue (0-360)\n * @param s Saturation (0-100)\n * @param l Lightness (0-100)\n * @returns Hex color string (#RRGGBB)\n */\nexport function hslToHex(h: number, s: number, l: number): string {\n // Convert saturation and lightness to fractions\n s /= 100;\n l /= 100;\n\n // Calculate chroma\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = l - c / 2;\n let r = 0,\n g = 0,\n b = 0;\n\n if (0 <= h && h < 60) {\n r = c;\n g = x;\n b = 0;\n } else if (60 <= h && h < 120) {\n r = x;\n g = c;\n b = 0;\n } else if (120 <= h && h < 180) {\n r = 0;\n g = c;\n b = x;\n } else if (180 <= h && h < 240) {\n r = 0;\n g = x;\n b = c;\n } else if (240 <= h && h < 300) {\n r = x;\n g = 0;\n b = c;\n } else if (300 <= h && h < 360) {\n r = c;\n g = 0;\n b = x;\n }\n\n // Convert RGB to hex format\n const toHex = (c: number) => {\n const hex = Math.round((c + m) * 255).toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n };\n\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\n/**\n * Safely gets a CSS variable and ensures it's in a format Monaco can use\n * @param variableName CSS variable name (e.g. '--background')\n * @param fallbackColor Fallback color if the variable isn't found\n * @returns A color string in a format Monaco can use (typically hex)\n */\nexport function getCssColor(\n variableName: string,\n fallbackColor: string,\n): string {\n try {\n // Get CSS variable value\n const cssValue = getComputedStyle(document.documentElement)\n .getPropertyValue(variableName)\n .trim();\n\n if (!cssValue) return fallbackColor;\n\n // If already a hex color, return it\n if (cssValue.startsWith('#')) return cssValue;\n\n // Check if value is in HSL format (e.g. \"210 40% 98%\" or \"222.2 84% 4.9%\")\n const hslMatch = cssValue.match(\n /^(\\d+(?:\\.\\d+)?)\\s+(\\d+(?:\\.\\d+)?)%\\s+(\\d+(?:\\.\\d+)?)%$/,\n );\n if (hslMatch && hslMatch[1] && hslMatch[2] && hslMatch[3]) {\n const h = parseFloat(hslMatch[1]);\n const s = parseFloat(hslMatch[2]);\n const l = parseFloat(hslMatch[3]);\n return hslToHex(h, s, l);\n }\n\n // Try to parse other formats or return fallback\n return fallbackColor;\n } catch (error) {\n console.error(`Error getting CSS variable ${variableName}:`, error);\n return fallbackColor;\n }\n}\n\n/**\n * Gets a monospace font family from CSS variables or falls back to a system monospace font stack\n * @returns Monospace font family string suitable for code editors\n */\nexport function getMonospaceFont(): string {\n return (\n getComputedStyle(document.documentElement)\n .getPropertyValue('--font-mono')\n .trim() ||\n 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace'\n //'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace'\n );\n}\n\n/**\n * Gets Monaco editor menu theme colors based on Tailwind CSS variables\n * @param isDarkTheme Whether the current theme is dark or light\n * @returns Object with menu-related color settings for Monaco editor\n */\nexport function getMenuColors(isDarkTheme: boolean): Record<string, string> {\n const defaultDarkColors = {\n 'editorWidget.background': '#1f1f1f',\n 'editorWidget.foreground': '#cccccc',\n 'editorWidget.border': '#454545',\n 'editorSuggestWidget.background': '#252526',\n 'list.hoverBackground': '#2a2d2e',\n 'list.highlightForeground': '#0097fb',\n 'menu.background': '#252526',\n 'menu.foreground': '#cccccc',\n 'menu.selectionBackground': '#04395e',\n 'menu.selectionForeground': '#ffffff',\n 'quickInput.background': '#252526',\n 'quickInput.foreground': '#cccccc',\n 'dropdown.background': '#252526',\n 'dropdown.foreground': '#f0f0f0',\n };\n\n const defaultLightColors = {\n 'editorWidget.background': '#f3f3f3',\n 'editorWidget.foreground': '#616161',\n 'editorWidget.border': '#c8c8c8',\n 'editorSuggestWidget.background': '#f3f3f3',\n 'list.hoverBackground': '#e8e8e8',\n 'list.highlightForeground': '#0066bf',\n 'menu.background': '#f3f3f3',\n 'menu.foreground': '#616161',\n 'menu.selectionBackground': '#d6ebff',\n 'menu.selectionForeground': '#333333',\n 'quickInput.background': '#f3f3f3',\n 'quickInput.foreground': '#616161',\n 'dropdown.background': '#f3f3f3',\n 'dropdown.foreground': '#616161',\n };\n\n // Choose base defaults based on theme\n const defaults = isDarkTheme ? defaultDarkColors : defaultLightColors;\n const result: Record<string, string> = {};\n\n // Map Tailwind variables to Monaco color settings\n if (isDarkTheme) {\n // Dark theme mappings\n result['editorWidget.background'] = getCssColor(\n '--popover',\n defaults['editorWidget.background'],\n );\n result['editorWidget.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['editorWidget.foreground'],\n );\n result['editorWidget.border'] = getCssColor(\n '--border',\n defaults['editorWidget.border'],\n );\n result['editorSuggestWidget.background'] = getCssColor(\n '--popover',\n defaults['editorSuggestWidget.background'],\n );\n result['list.hoverBackground'] = getCssColor(\n '--accent',\n defaults['list.hoverBackground'],\n );\n result['list.highlightForeground'] = getCssColor(\n '--primary',\n defaults['list.highlightForeground'],\n );\n result['menu.background'] = getCssColor(\n '--popover',\n defaults['menu.background'],\n );\n result['menu.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['menu.foreground'],\n );\n result['menu.selectionBackground'] = getCssColor(\n '--accent',\n defaults['menu.selectionBackground'],\n );\n result['menu.selectionForeground'] = getCssColor(\n '--accent-foreground',\n defaults['menu.selectionForeground'],\n );\n result['quickInput.background'] = getCssColor(\n '--popover',\n defaults['quickInput.background'],\n );\n result['quickInput.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['quickInput.foreground'],\n );\n result['dropdown.background'] = getCssColor(\n '--popover',\n defaults['dropdown.background'],\n );\n result['dropdown.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['dropdown.foreground'],\n );\n } else {\n // Light theme mappings\n result['editorWidget.background'] = getCssColor(\n '--popover',\n defaults['editorWidget.background'],\n );\n result['editorWidget.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['editorWidget.foreground'],\n );\n result['editorWidget.border'] = getCssColor(\n '--border',\n defaults['editorWidget.border'],\n );\n result['editorSuggestWidget.background'] = getCssColor(\n '--popover',\n defaults['editorSuggestWidget.background'],\n );\n result['list.hoverBackground'] = getCssColor(\n '--accent',\n defaults['list.hoverBackground'],\n );\n result['list.highlightForeground'] = getCssColor(\n '--primary',\n defaults['list.highlightForeground'],\n );\n result['menu.background'] = getCssColor(\n '--popover',\n defaults['menu.background'],\n );\n result['menu.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['menu.foreground'],\n );\n result['menu.selectionBackground'] = getCssColor(\n '--accent',\n defaults['menu.selectionBackground'],\n );\n result['menu.selectionForeground'] = getCssColor(\n '--accent-foreground',\n defaults['menu.selectionForeground'],\n );\n result['quickInput.background'] = getCssColor(\n '--popover',\n defaults['quickInput.background'],\n );\n result['quickInput.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['quickInput.foreground'],\n );\n result['dropdown.background'] = getCssColor(\n '--popover',\n defaults['dropdown.background'],\n );\n result['dropdown.foreground'] = getCssColor(\n '--popover-foreground',\n defaults['dropdown.foreground'],\n );\n }\n\n return result;\n}\n\n/**\n * Generates a Monaco editor theme specifically for JSON editing with Tailwind colors\n * @param isDarkTheme Whether the current theme is dark or light\n * @returns A complete Monaco editor theme data object for JSON editing\n */\nexport function getJsonEditorTheme(isDarkTheme: boolean): any {\n // Predefined pastel colors for syntax highlighting\n // Light theme colors\n const lightThemeColors = {\n property: '#4B6BDF', // Soft blue for property names\n string: '#DB745C', // Soft coral for string values\n number: '#56A64B', // Soft green for numbers\n keyword: '#A450B5', // Soft purple for keywords\n punctuation: '#6E7781', // Soft gray for punctuation\n };\n\n // Dark theme colors\n const darkThemeColors = {\n property: '#78AEFF', // Pastel blue for property names\n string: '#FFAD85', // Pastel coral/orange for string values\n number: '#7CD992', // Pastel green for numbers\n keyword: '#C987E8', // Pastel purple for keywords\n punctuation: '#A9B1BA', // Light gray for punctuation\n };\n\n // Select the appropriate color set based on theme\n const colors = isDarkTheme ? darkThemeColors : lightThemeColors;\n\n // Theme background and UI colors - still using CSS variables for the editor itself\n const background = getCssColor(\n '--background',\n isDarkTheme ? '#1E1E1E' : '#FFFFFF',\n );\n const foreground = getCssColor(\n '--foreground',\n isDarkTheme ? '#D4D4D4' : '#000000',\n );\n const selection = getCssColor(\n '--accent',\n isDarkTheme ? '#264F78' : '#ADD6FF',\n );\n const lineHighlight = getCssColor(\n '--muted',\n isDarkTheme ? '#2A2A2A' : '#F5F5F5',\n );\n const lineNumbers = getCssColor(\n '--muted-foreground',\n isDarkTheme ? '#858585' : '#888888',\n );\n const cursor = getCssColor('--primary', isDarkTheme ? '#FFFFFF' : '#000000');\n\n // Menu colors\n const menuBackground = getCssColor(\n '--popover',\n isDarkTheme ? '#1C2233' : '#F3F3F3',\n );\n const menuForeground = getCssColor(\n '--popover-foreground',\n isDarkTheme ? '#FFFFFF' : '#616161',\n );\n const menuSeparator = getCssColor(\n '--border',\n isDarkTheme ? '#39435E' : '#C8C8C8',\n );\n\n return {\n base: isDarkTheme ? 'vs-dark' : 'vs',\n inherit: true,\n rules: [\n // Property keys - using pastel blue\n {token: 'type', foreground: colors.property.slice(1)},\n {token: 'string.key.json', foreground: colors.property.slice(1)},\n {token: 'key', foreground: colors.property.slice(1)},\n\n // String values - using pastel coral/orange\n {token: 'string.value.json', foreground: colors.string.slice(1)},\n {token: 'string', foreground: colors.string.slice(1)},\n\n // Numbers - using pastel green\n {token: 'number', foreground: colors.number.slice(1)},\n\n // Keywords (true, false, null) - using pastel purple\n {token: 'keyword', foreground: colors.keyword.slice(1)},\n\n // Punctuation - using light gray\n {token: 'delimiter', foreground: colors.punctuation.slice(1)},\n {token: 'bracket', foreground: colors.punctuation.slice(1)},\n\n // Fallbacks\n {token: '', foreground: foreground.slice(1)},\n ],\n colors: {\n // Editor colors\n 'editor.background': background,\n 'editor.foreground': foreground,\n 'editor.selectionBackground': selection,\n 'editor.lineHighlightBackground': lineHighlight,\n 'editorLineNumber.foreground': lineNumbers,\n 'editorCursor.foreground': cursor,\n\n // Widget and UI colors\n 'editorWidget.background': menuBackground,\n 'editorWidget.foreground': menuForeground,\n 'editorWidget.border': menuSeparator,\n 'editorSuggestWidget.background': menuBackground,\n 'editorSuggestWidget.foreground': menuForeground,\n 'editorSuggestWidget.border': menuSeparator,\n\n // Menu colors\n 'menu.background': menuBackground,\n 'menu.foreground': menuForeground,\n 'menu.selectionBackground': selection,\n 'menu.selectionForeground': menuForeground,\n 'menu.separatorBackground': menuSeparator,\n\n // Additional UI elements\n 'list.hoverBackground': lineHighlight,\n 'list.activeSelectionBackground': selection,\n 'quickInput.background': menuBackground,\n 'quickInput.foreground': menuForeground,\n },\n };\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sqlrooms/monaco-editor",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"private": false,
|
|
9
|
+
"author": "Ilya Boyandin <ilya@boyandin.me>",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/sqlrooms/sqlrooms.git"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@monaco-editor/react": "^4.7.0",
|
|
23
|
+
"@sqlrooms/ui": "0.7.0",
|
|
24
|
+
"monaco-editor": "^0.52.2"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": "*",
|
|
28
|
+
"react-dom": "*"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"dev": "tsc -w",
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"lint": "eslint .",
|
|
34
|
+
"typedoc": "typedoc"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "8be65f051c588d3a963f721322429657913b6c63"
|
|
37
|
+
}
|