@lark-apaas/fullstack-vite-preset 1.0.1-alpha.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.
Files changed (71) hide show
  1. package/README.md +121 -0
  2. package/lib/index.d.ts +39 -0
  3. package/lib/index.d.ts.map +1 -0
  4. package/lib/index.js +75 -0
  5. package/lib/index.js.map +1 -0
  6. package/lib/module-alias/clsx.d.ts +4 -0
  7. package/lib/module-alias/clsx.d.ts.map +1 -0
  8. package/lib/module-alias/clsx.js +13 -0
  9. package/lib/module-alias/clsx.js.map +1 -0
  10. package/lib/module-alias/echarts.d.ts +4 -0
  11. package/lib/module-alias/echarts.d.ts.map +1 -0
  12. package/lib/module-alias/echarts.js +50 -0
  13. package/lib/module-alias/echarts.js.map +1 -0
  14. package/lib/module-alias/registry_echarts_theme.d.ts +696 -0
  15. package/lib/module-alias/registry_echarts_theme.d.ts.map +1 -0
  16. package/lib/module-alias/registry_echarts_theme.js +394 -0
  17. package/lib/module-alias/registry_echarts_theme.js.map +1 -0
  18. package/lib/preset.d.ts +14 -0
  19. package/lib/preset.d.ts.map +1 -0
  20. package/lib/preset.js +283 -0
  21. package/lib/preset.js.map +1 -0
  22. package/lib/utils/hmr-timing.d.ts +8 -0
  23. package/lib/utils/hmr-timing.d.ts.map +1 -0
  24. package/lib/utils/hmr-timing.js +132 -0
  25. package/lib/utils/hmr-timing.js.map +1 -0
  26. package/lib/utils/normalize-base-path.d.ts +7 -0
  27. package/lib/utils/normalize-base-path.d.ts.map +1 -0
  28. package/lib/utils/normalize-base-path.js +15 -0
  29. package/lib/utils/normalize-base-path.js.map +1 -0
  30. package/lib/utils/snapdom-proxy.d.ts +8 -0
  31. package/lib/utils/snapdom-proxy.d.ts.map +1 -0
  32. package/lib/utils/snapdom-proxy.js +52 -0
  33. package/lib/utils/snapdom-proxy.js.map +1 -0
  34. package/lib/vite-plugins/html-output-plugin.d.ts +14 -0
  35. package/lib/vite-plugins/html-output-plugin.d.ts.map +1 -0
  36. package/lib/vite-plugins/html-output-plugin.js +129 -0
  37. package/lib/vite-plugins/html-output-plugin.js.map +1 -0
  38. package/lib/vite-plugins/inspector-css-plugin.d.ts +19 -0
  39. package/lib/vite-plugins/inspector-css-plugin.d.ts.map +1 -0
  40. package/lib/vite-plugins/inspector-css-plugin.js +70 -0
  41. package/lib/vite-plugins/inspector-css-plugin.js.map +1 -0
  42. package/lib/vite-plugins/module-alias-plugin.d.ts +10 -0
  43. package/lib/vite-plugins/module-alias-plugin.d.ts.map +1 -0
  44. package/lib/vite-plugins/module-alias-plugin.js +36 -0
  45. package/lib/vite-plugins/module-alias-plugin.js.map +1 -0
  46. package/lib/vite-plugins/og-meta-plugin.d.ts +17 -0
  47. package/lib/vite-plugins/og-meta-plugin.d.ts.map +1 -0
  48. package/lib/vite-plugins/og-meta-plugin.js +81 -0
  49. package/lib/vite-plugins/og-meta-plugin.js.map +1 -0
  50. package/lib/vite-plugins/route-parser-plugin.d.ts +8 -0
  51. package/lib/vite-plugins/route-parser-plugin.d.ts.map +1 -0
  52. package/lib/vite-plugins/route-parser-plugin.js +280 -0
  53. package/lib/vite-plugins/route-parser-plugin.js.map +1 -0
  54. package/lib/vite-plugins/runtime-injection-plugin.d.ts +22 -0
  55. package/lib/vite-plugins/runtime-injection-plugin.d.ts.map +1 -0
  56. package/lib/vite-plugins/runtime-injection-plugin.js +50 -0
  57. package/lib/vite-plugins/runtime-injection-plugin.js.map +1 -0
  58. package/lib/vite-plugins/slardar-plugin.d.ts +10 -0
  59. package/lib/vite-plugins/slardar-plugin.d.ts.map +1 -0
  60. package/lib/vite-plugins/slardar-plugin.js +98 -0
  61. package/lib/vite-plugins/slardar-plugin.js.map +1 -0
  62. package/lib/vite-plugins/view-context-plugin.d.ts +4 -0
  63. package/lib/vite-plugins/view-context-plugin.d.ts.map +1 -0
  64. package/lib/vite-plugins/view-context-plugin.js +40 -0
  65. package/lib/vite-plugins/view-context-plugin.js.map +1 -0
  66. package/package.json +57 -0
  67. package/src/empty.css +1 -0
  68. package/src/inspector-stub.js +6 -0
  69. package/src/module-alias/clsx.mjs +8 -0
  70. package/src/module-alias/echarts.mjs +28 -0
  71. package/src/module-alias/registry_echarts_theme.mjs +390 -0
@@ -0,0 +1,390 @@
1
+ import Color from 'colorjs.io';
2
+
3
+ /**
4
+ * Get the value of a CSS variable and convert it to sRGB color space hex string
5
+ * @param varName CSS variable name
6
+ * @param element Optional element, defaults to document.body
7
+ * @returns sRGB color space hex string
8
+ */
9
+ export function getCssVariable(varName, element = document.body) {
10
+ const value = window
11
+ .getComputedStyle(element)
12
+ .getPropertyValue(varName)
13
+ .trim();
14
+ if (!value) {
15
+ return '';
16
+ }
17
+ return new Color(value).to('srgb').toString({ format: 'hex' });
18
+ }
19
+
20
+ // Generate ECharts theme configuration
21
+ export function generateEChartsTheme(element = document.body) {
22
+ // Get chart colors
23
+ const chartColors = [
24
+ getCssVariable('--chart-1', element),
25
+ getCssVariable('--chart-2', element),
26
+ getCssVariable('--chart-3', element),
27
+ getCssVariable('--chart-4', element),
28
+ getCssVariable('--chart-5', element),
29
+ ];
30
+
31
+ // Get other color variables
32
+ const background = getCssVariable('--background', element);
33
+ const foreground = getCssVariable('--foreground', element);
34
+ const muted = getCssVariable('--muted', element);
35
+ const mutedForeground = getCssVariable('--muted-foreground', element);
36
+ const border = getCssVariable('--border', element);
37
+ const primary = getCssVariable('--primary', element);
38
+
39
+ const fullTheme = {
40
+ color: chartColors,
41
+ backgroundColor: 'transparent',
42
+ textStyle: {
43
+ color: foreground,
44
+ },
45
+ title: {
46
+ textStyle: {
47
+ color: foreground,
48
+ },
49
+ subtextStyle: {
50
+ color: mutedForeground,
51
+ },
52
+ },
53
+ line: {
54
+ itemStyle: {
55
+ borderWidth: 1,
56
+ },
57
+ lineStyle: {
58
+ width: 2,
59
+ },
60
+ symbolSize: 4,
61
+ symbol: 'circle',
62
+ smooth: false,
63
+ },
64
+ radar: {
65
+ itemStyle: {
66
+ borderWidth: 1,
67
+ },
68
+ lineStyle: {
69
+ width: 2,
70
+ },
71
+ symbolSize: 4,
72
+ symbol: 'circle',
73
+ smooth: false,
74
+ },
75
+ bar: {
76
+ itemStyle: {
77
+ barBorderWidth: 0,
78
+ barBorderColor: border,
79
+ },
80
+ },
81
+ pie: {
82
+ itemStyle: {
83
+ borderWidth: 0,
84
+ borderColor: border,
85
+ },
86
+ },
87
+ scatter: {
88
+ itemStyle: {
89
+ borderWidth: 0,
90
+ borderColor: border,
91
+ },
92
+ },
93
+ boxplot: {
94
+ itemStyle: {
95
+ borderWidth: 0,
96
+ borderColor: border,
97
+ },
98
+ },
99
+ parallel: {
100
+ itemStyle: {
101
+ borderWidth: 0,
102
+ borderColor: border,
103
+ },
104
+ },
105
+ sankey: {
106
+ itemStyle: {
107
+ borderWidth: 0,
108
+ borderColor: border,
109
+ },
110
+ },
111
+ funnel: {
112
+ itemStyle: {
113
+ borderWidth: 0,
114
+ borderColor: border,
115
+ },
116
+ },
117
+ gauge: {
118
+ itemStyle: {
119
+ borderWidth: 0,
120
+ borderColor: border,
121
+ },
122
+ },
123
+ candlestick: {
124
+ itemStyle: {
125
+ color: chartColors[0],
126
+ color0: chartColors[1],
127
+ borderColor: chartColors[0],
128
+ borderColor0: chartColors[1],
129
+ borderWidth: 1,
130
+ },
131
+ },
132
+ graph: {
133
+ itemStyle: {
134
+ borderWidth: 0,
135
+ borderColor: border,
136
+ },
137
+ lineStyle: {
138
+ width: 1,
139
+ color: mutedForeground,
140
+ },
141
+ symbolSize: 4,
142
+ symbol: 'circle',
143
+ smooth: false,
144
+ color: chartColors,
145
+ label: {
146
+ color: foreground,
147
+ },
148
+ },
149
+ map: {
150
+ itemStyle: {
151
+ areaColor: muted,
152
+ borderColor: border,
153
+ borderWidth: 0.5,
154
+ },
155
+ label: {
156
+ color: foreground,
157
+ },
158
+ emphasis: {
159
+ itemStyle: {
160
+ areaColor: chartColors[0],
161
+ borderColor: chartColors[1],
162
+ borderWidth: 1,
163
+ },
164
+ label: {
165
+ color: foreground,
166
+ },
167
+ },
168
+ },
169
+ geo: {
170
+ itemStyle: {
171
+ areaColor: muted,
172
+ borderColor: border,
173
+ borderWidth: 0.5,
174
+ },
175
+ label: {
176
+ color: foreground,
177
+ },
178
+ emphasis: {
179
+ itemStyle: {
180
+ areaColor: chartColors[0],
181
+ borderColor: chartColors[1],
182
+ borderWidth: 1,
183
+ },
184
+ label: {
185
+ color: foreground,
186
+ },
187
+ },
188
+ },
189
+ categoryAxis: {
190
+ axisLine: {
191
+ show: true,
192
+ lineStyle: {
193
+ color: border,
194
+ },
195
+ },
196
+ axisTick: {
197
+ show: true,
198
+ lineStyle: {
199
+ color: border,
200
+ },
201
+ },
202
+ axisLabel: {
203
+ show: true,
204
+ color: mutedForeground,
205
+ },
206
+ splitLine: {
207
+ show: false,
208
+ lineStyle: {
209
+ color: [border],
210
+ },
211
+ },
212
+ splitArea: {
213
+ show: false,
214
+ },
215
+ },
216
+ valueAxis: {
217
+ axisLine: {
218
+ show: true,
219
+ lineStyle: {
220
+ color: border,
221
+ },
222
+ },
223
+ axisTick: {
224
+ show: true,
225
+ lineStyle: {
226
+ color: border,
227
+ },
228
+ },
229
+ axisLabel: {
230
+ show: true,
231
+ color: mutedForeground,
232
+ },
233
+ splitLine: {
234
+ show: true,
235
+ lineStyle: {
236
+ color: [border],
237
+ },
238
+ },
239
+ splitArea: {
240
+ show: false,
241
+ },
242
+ },
243
+ logAxis: {
244
+ axisLine: {
245
+ show: true,
246
+ lineStyle: {
247
+ color: border,
248
+ },
249
+ },
250
+ axisTick: {
251
+ show: true,
252
+ lineStyle: {
253
+ color: border,
254
+ },
255
+ },
256
+ axisLabel: {
257
+ show: true,
258
+ color: mutedForeground,
259
+ },
260
+ splitLine: {
261
+ show: true,
262
+ lineStyle: {
263
+ color: [border],
264
+ },
265
+ },
266
+ splitArea: {
267
+ show: false,
268
+ },
269
+ },
270
+ timeAxis: {
271
+ axisLine: {
272
+ show: true,
273
+ lineStyle: {
274
+ color: border,
275
+ },
276
+ },
277
+ axisTick: {
278
+ show: true,
279
+ lineStyle: {
280
+ color: border,
281
+ },
282
+ },
283
+ axisLabel: {
284
+ show: true,
285
+ color: mutedForeground,
286
+ },
287
+ splitLine: {
288
+ show: true,
289
+ lineStyle: {
290
+ color: [border],
291
+ },
292
+ },
293
+ splitArea: {
294
+ show: false,
295
+ },
296
+ },
297
+ toolbox: {
298
+ iconStyle: {
299
+ borderColor: mutedForeground,
300
+ },
301
+ emphasis: {
302
+ iconStyle: {
303
+ borderColor: primary,
304
+ },
305
+ },
306
+ },
307
+ legend: {
308
+ textStyle: {
309
+ color: foreground,
310
+ },
311
+ },
312
+ tooltip: {
313
+ axisPointer: {
314
+ lineStyle: {
315
+ color: border,
316
+ width: 1,
317
+ },
318
+ crossStyle: {
319
+ color: border,
320
+ width: 1,
321
+ },
322
+ },
323
+ },
324
+ timeline: {
325
+ lineStyle: {
326
+ color: primary,
327
+ width: 1,
328
+ },
329
+ itemStyle: {
330
+ color: primary,
331
+ borderWidth: 1,
332
+ },
333
+ controlStyle: {
334
+ color: primary,
335
+ borderColor: primary,
336
+ borderWidth: 0.5,
337
+ },
338
+ checkpointStyle: {
339
+ color: chartColors[1],
340
+ borderColor: chartColors[1],
341
+ },
342
+ label: {
343
+ color: mutedForeground,
344
+ },
345
+ emphasis: {
346
+ itemStyle: {
347
+ color: chartColors[1],
348
+ },
349
+ controlStyle: {
350
+ color: primary,
351
+ borderColor: primary,
352
+ borderWidth: 0.5,
353
+ },
354
+ label: {
355
+ color: mutedForeground,
356
+ },
357
+ },
358
+ },
359
+ visualMap: {
360
+ color: [chartColors[0], chartColors[2]],
361
+ },
362
+ dataZoom: {
363
+ backgroundColor: background,
364
+ dataBackgroundColor: border,
365
+ fillerColor: `${chartColors[0]}40`, // 25% opacity
366
+ handleColor: primary,
367
+ handleSize: '100%',
368
+ textStyle: {
369
+ color: foreground,
370
+ },
371
+ },
372
+ markPoint: {
373
+ label: {
374
+ color: foreground,
375
+ },
376
+ emphasis: {
377
+ label: {
378
+ color: foreground,
379
+ },
380
+ },
381
+ },
382
+ };
383
+ return fullTheme;
384
+ }
385
+
386
+ // Get current theme's ECharts configuration
387
+ export function getShadcnEChartsTheme() {
388
+ // body
389
+ return generateEChartsTheme(document.body);
390
+ }