@syntrologie/runtime-sdk 2.14.0 → 2.16.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/README.md +1 -0
- package/dist/SmartCanvasApp.d.ts +4 -1
- package/dist/SmartCanvasElementLit.d.ts +166 -0
- package/dist/actions/schema.js +4 -3
- package/dist/actions/types.d.ts +8 -2
- package/dist/anchor/AnchorResolver.d.ts +1 -0
- package/dist/api-lit.d.ts +84 -0
- package/dist/api.d.ts +3 -0
- package/dist/apps/builtinRuntimeModules-lit.d.ts +20 -0
- package/dist/bootstrap-init.d.ts +2 -0
- package/dist/bootstrap-types.d.ts +10 -0
- package/dist/chunk-2IQ2PTLJ.js +871 -0
- package/dist/chunk-2IQ2PTLJ.js.map +7 -0
- package/dist/{chunk-YLLWLUQX.js → chunk-4HXPGXUC.js} +1 -16
- package/dist/{chunk-YLLWLUQX.js.map → chunk-4HXPGXUC.js.map} +1 -1
- package/dist/{chunk-IR6UOR63.js → chunk-GX7BBYX6.js} +2 -2
- package/dist/chunk-JMHRHAEL.js +18 -0
- package/dist/chunk-JMHRHAEL.js.map +7 -0
- package/dist/{chunk-JCDCANR7.js → chunk-NVV7IWJC.js} +1301 -1084
- package/dist/chunk-NVV7IWJC.js.map +7 -0
- package/dist/{chunk-77TNZ66J.js → chunk-XVRDKBYF.js} +3 -3
- package/dist/components/SyntroCanvasOverlay.d.ts +100 -0
- package/dist/components/SyntroDrawer.d.ts +110 -0
- package/dist/components/SyntroLauncher.d.ts +105 -0
- package/dist/components/SyntroTileCard.d.ts +74 -0
- package/dist/components/SyntroTileWheel.d.ts +51 -0
- package/dist/config/schema.js +3 -2
- package/dist/controllers/DecisionController.d.ts +48 -0
- package/dist/controllers/NotificationsController.d.ts +59 -0
- package/dist/controllers/RuntimeController.d.ts +52 -0
- package/dist/controllers/RuntimeEventsController.d.ts +42 -0
- package/dist/controllers/ThemeController.d.ts +110 -0
- package/dist/controllers/index.d.ts +13 -0
- package/dist/decisions/schema.js +2 -1
- package/dist/decisions/types.d.ts +4 -0
- package/dist/editorLoader.d.ts +5 -0
- package/dist/index-lit.d.ts +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1338 -19
- package/dist/index.js.map +4 -4
- package/dist/interop/LitInReact.d.ts +27 -0
- package/dist/interop/ReactInLit.d.ts +42 -0
- package/dist/interop/index.d.ts +7 -0
- package/dist/metrics/sessionMetrics.d.ts +4 -0
- package/dist/notifications/SyntroToastStack.d.ts +43 -0
- package/dist/platform/PlatformAdapter.d.ts +46 -0
- package/dist/platform/ShopifyAdapter.d.ts +36 -0
- package/dist/platform/ShopifyAnchorResolver.d.ts +31 -0
- package/dist/platform/ShopifyAntiFlicker.d.ts +21 -0
- package/dist/platform/ShopifyPixelBridge.d.ts +37 -0
- package/dist/platform/detect.d.ts +9 -0
- package/dist/platform/index.d.ts +10 -0
- package/dist/platform/shopify-cookie-contract.d.ts +39 -0
- package/dist/react-compat.d.ts +114 -0
- package/dist/react.js +6 -4
- package/dist/react.js.map +1 -1
- package/dist/shopify-pixel-entry.d.ts +68 -0
- package/dist/shopify-pixel.js +77 -0
- package/dist/shopify-pixel.js.map +7 -0
- package/dist/shopify-pixel.min.js +2 -0
- package/dist/shopify-pixel.min.js.map +7 -0
- package/dist/smart-canvas.esm.js +856 -240
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +28769 -37080
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +855 -240
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/theme/index.js +30 -0
- package/dist/theme/index.js.map +7 -0
- package/dist/version.d.ts +1 -1
- package/package.json +10 -1
- package/dist/chunk-JCDCANR7.js.map +0 -7
- /package/dist/{chunk-IR6UOR63.js.map → chunk-GX7BBYX6.js.map} +0 -0
- /package/dist/{chunk-77TNZ66J.js.map → chunk-XVRDKBYF.js.map} +0 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
// ../design-system/src/tokens/colors.ts
|
|
2
|
+
var base = {
|
|
3
|
+
white: "#ffffff",
|
|
4
|
+
black: "#000000"
|
|
5
|
+
};
|
|
6
|
+
var brand = {
|
|
7
|
+
0: "#2c0b0a",
|
|
8
|
+
1: "#5b1715",
|
|
9
|
+
2: "#89221f",
|
|
10
|
+
3: "#b72e2a",
|
|
11
|
+
4: "#d44844",
|
|
12
|
+
5: "#dd6d69",
|
|
13
|
+
6: "#e5918f",
|
|
14
|
+
7: "#eeb6b4",
|
|
15
|
+
8: "#f6dada",
|
|
16
|
+
9: "#faebea"
|
|
17
|
+
};
|
|
18
|
+
var slateGrey = {
|
|
19
|
+
0: "#07080a",
|
|
20
|
+
1: "#0f1318",
|
|
21
|
+
2: "#0e1114",
|
|
22
|
+
3: "#1c222a",
|
|
23
|
+
4: "#2b333f",
|
|
24
|
+
5: "#394454",
|
|
25
|
+
6: "#475569",
|
|
26
|
+
7: "#677384",
|
|
27
|
+
8: "#87919f",
|
|
28
|
+
9: "#a8afba",
|
|
29
|
+
10: "#cbd0d7",
|
|
30
|
+
11: "#e8eaee",
|
|
31
|
+
12: "#f6f7f9"
|
|
32
|
+
};
|
|
33
|
+
var green = {
|
|
34
|
+
0: "#07230a",
|
|
35
|
+
1: "#0e4514",
|
|
36
|
+
2: "#16681e",
|
|
37
|
+
3: "#1d8a28",
|
|
38
|
+
4: "#24ad32",
|
|
39
|
+
5: "#4fbd5a",
|
|
40
|
+
6: "#7acd82",
|
|
41
|
+
7: "#a5deab",
|
|
42
|
+
8: "#d0eed3",
|
|
43
|
+
9: "#e5f6e7"
|
|
44
|
+
};
|
|
45
|
+
var yellow = {
|
|
46
|
+
0: "#301f09",
|
|
47
|
+
1: "#5f3e12",
|
|
48
|
+
2: "#8f5e1b",
|
|
49
|
+
3: "#be7d24",
|
|
50
|
+
4: "#ee9c2d",
|
|
51
|
+
5: "#f1b057",
|
|
52
|
+
6: "#f5c481",
|
|
53
|
+
7: "#f8d7ab",
|
|
54
|
+
8: "#fcebd5",
|
|
55
|
+
9: "#fdf5ea"
|
|
56
|
+
};
|
|
57
|
+
var red = {
|
|
58
|
+
0: "#330707",
|
|
59
|
+
1: "#660f0e",
|
|
60
|
+
2: "#991616",
|
|
61
|
+
3: "#cc1e1d",
|
|
62
|
+
4: "#ff2524",
|
|
63
|
+
5: "#ff5150",
|
|
64
|
+
6: "#ff7c7c",
|
|
65
|
+
7: "#ffa8a7",
|
|
66
|
+
8: "#ffd3d3",
|
|
67
|
+
9: "#ffe9e9"
|
|
68
|
+
};
|
|
69
|
+
var blue = {
|
|
70
|
+
0: "#051533",
|
|
71
|
+
1: "#0a2a66",
|
|
72
|
+
2: "#0f3f98",
|
|
73
|
+
3: "#1454cb",
|
|
74
|
+
4: "#1969fe",
|
|
75
|
+
5: "#4787fe",
|
|
76
|
+
6: "#75a5fe",
|
|
77
|
+
7: "#a3c3ff",
|
|
78
|
+
8: "#d1e1ff",
|
|
79
|
+
9: "#e8f0ff"
|
|
80
|
+
};
|
|
81
|
+
var orange = {
|
|
82
|
+
0: "#662500",
|
|
83
|
+
1: "#993d00",
|
|
84
|
+
2: "#cc5800",
|
|
85
|
+
3: "#ff7700",
|
|
86
|
+
4: "#fea85d",
|
|
87
|
+
5: "#fec58f",
|
|
88
|
+
6: "#ffd6ae",
|
|
89
|
+
7: "#fee6cd",
|
|
90
|
+
8: "#fff1e1",
|
|
91
|
+
9: "#fff8f0"
|
|
92
|
+
};
|
|
93
|
+
var purple = {
|
|
94
|
+
0: "#151229",
|
|
95
|
+
1: "#2a2452",
|
|
96
|
+
2: "#40357c",
|
|
97
|
+
3: "#5547a5",
|
|
98
|
+
4: "#6a59ce",
|
|
99
|
+
5: "#887ad8",
|
|
100
|
+
6: "#a69be2",
|
|
101
|
+
7: "#c3bdeb",
|
|
102
|
+
8: "#e1def5",
|
|
103
|
+
9: "#f0eefa"
|
|
104
|
+
};
|
|
105
|
+
var pink = {
|
|
106
|
+
0: "#37091f",
|
|
107
|
+
1: "#69123c",
|
|
108
|
+
2: "#9b1c58",
|
|
109
|
+
3: "#cd2575",
|
|
110
|
+
4: "#ff2e92",
|
|
111
|
+
5: "#ff58a8",
|
|
112
|
+
6: "#ff82be",
|
|
113
|
+
7: "#ffabd3",
|
|
114
|
+
8: "#ffd5e9",
|
|
115
|
+
9: "#ffeaf4"
|
|
116
|
+
};
|
|
117
|
+
var text = {
|
|
118
|
+
primary: slateGrey[10],
|
|
119
|
+
secondary: slateGrey[9],
|
|
120
|
+
tertiary: slateGrey[8]
|
|
121
|
+
};
|
|
122
|
+
var background = {
|
|
123
|
+
primary: slateGrey[2],
|
|
124
|
+
secondary: slateGrey[0]
|
|
125
|
+
};
|
|
126
|
+
var border = {
|
|
127
|
+
primary: slateGrey[4],
|
|
128
|
+
secondary: slateGrey[3]
|
|
129
|
+
};
|
|
130
|
+
var button = {
|
|
131
|
+
primary: {
|
|
132
|
+
text: base.white,
|
|
133
|
+
icon: base.white,
|
|
134
|
+
border: brand[3],
|
|
135
|
+
backgroundDefault: brand[3],
|
|
136
|
+
backgroundHover: brand[2]
|
|
137
|
+
},
|
|
138
|
+
neutral: {
|
|
139
|
+
text: slateGrey[10],
|
|
140
|
+
textHover: base.white,
|
|
141
|
+
icon: slateGrey[10],
|
|
142
|
+
iconHover: base.white,
|
|
143
|
+
border: slateGrey[4],
|
|
144
|
+
background: slateGrey[2]
|
|
145
|
+
},
|
|
146
|
+
link: {
|
|
147
|
+
text: base.white,
|
|
148
|
+
icon: base.white,
|
|
149
|
+
hover: brand[5]
|
|
150
|
+
},
|
|
151
|
+
error: {
|
|
152
|
+
text: red[5],
|
|
153
|
+
hover: red[6]
|
|
154
|
+
},
|
|
155
|
+
success: {
|
|
156
|
+
text: green[5],
|
|
157
|
+
hover: green[6]
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
var badge = {
|
|
161
|
+
slateGrey: {
|
|
162
|
+
content: slateGrey[10],
|
|
163
|
+
pillOutline: slateGrey[10],
|
|
164
|
+
borderPrimary: slateGrey[5],
|
|
165
|
+
borderSecondary: slateGrey[5],
|
|
166
|
+
background: slateGrey[3]
|
|
167
|
+
},
|
|
168
|
+
brand: {
|
|
169
|
+
content: brand[9],
|
|
170
|
+
pillOutline: brand[9],
|
|
171
|
+
borderPrimary: brand[6],
|
|
172
|
+
borderSecondary: brand[6],
|
|
173
|
+
background: brand[0]
|
|
174
|
+
},
|
|
175
|
+
red: {
|
|
176
|
+
content: red[8],
|
|
177
|
+
pillOutline: red[4],
|
|
178
|
+
borderPrimary: red[2],
|
|
179
|
+
borderSecondary: red[2],
|
|
180
|
+
background: red[0]
|
|
181
|
+
},
|
|
182
|
+
yellow: {
|
|
183
|
+
content: yellow[8],
|
|
184
|
+
pillOutline: yellow[4],
|
|
185
|
+
borderPrimary: yellow[2],
|
|
186
|
+
borderSecondary: yellow[2],
|
|
187
|
+
background: yellow[0]
|
|
188
|
+
},
|
|
189
|
+
green: {
|
|
190
|
+
content: green[8],
|
|
191
|
+
pillOutline: green[4],
|
|
192
|
+
borderPrimary: green[2],
|
|
193
|
+
borderSecondary: green[2],
|
|
194
|
+
background: green[0]
|
|
195
|
+
},
|
|
196
|
+
purple: {
|
|
197
|
+
content: purple[8],
|
|
198
|
+
pillOutline: purple[4],
|
|
199
|
+
borderPrimary: purple[2],
|
|
200
|
+
borderSecondary: purple[2],
|
|
201
|
+
background: purple[0]
|
|
202
|
+
},
|
|
203
|
+
blue: {
|
|
204
|
+
content: blue[8],
|
|
205
|
+
pillOutline: blue[4],
|
|
206
|
+
borderPrimary: blue[2],
|
|
207
|
+
borderSecondary: blue[2],
|
|
208
|
+
background: blue[0]
|
|
209
|
+
},
|
|
210
|
+
orange: {
|
|
211
|
+
content: orange[8],
|
|
212
|
+
pillOutline: orange[4],
|
|
213
|
+
borderPrimary: orange[2],
|
|
214
|
+
borderSecondary: orange[2],
|
|
215
|
+
background: orange[0]
|
|
216
|
+
},
|
|
217
|
+
pink: {
|
|
218
|
+
content: pink[8],
|
|
219
|
+
pillOutline: pink[4],
|
|
220
|
+
borderPrimary: pink[2],
|
|
221
|
+
borderSecondary: pink[2],
|
|
222
|
+
background: pink[0]
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var badgeBanner = {
|
|
226
|
+
green: {
|
|
227
|
+
content: green[8],
|
|
228
|
+
border: green[2],
|
|
229
|
+
background: green[0]
|
|
230
|
+
},
|
|
231
|
+
yellow: {
|
|
232
|
+
content: yellow[8],
|
|
233
|
+
border: yellow[2],
|
|
234
|
+
background: yellow[0]
|
|
235
|
+
},
|
|
236
|
+
red: {
|
|
237
|
+
content: red[8],
|
|
238
|
+
border: red[2],
|
|
239
|
+
background: red[0]
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
var alert = {
|
|
243
|
+
green: {
|
|
244
|
+
content: green[1],
|
|
245
|
+
background: green[9]
|
|
246
|
+
},
|
|
247
|
+
yellow: {
|
|
248
|
+
content: yellow[1],
|
|
249
|
+
background: yellow[9]
|
|
250
|
+
},
|
|
251
|
+
red: {
|
|
252
|
+
content: red[1],
|
|
253
|
+
background: red[9]
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
var tag = {
|
|
257
|
+
content: slateGrey[10],
|
|
258
|
+
border: slateGrey[4],
|
|
259
|
+
background: slateGrey[3]
|
|
260
|
+
};
|
|
261
|
+
var menu = {
|
|
262
|
+
backgroundDefault: slateGrey[2],
|
|
263
|
+
backgroundHover: slateGrey[1],
|
|
264
|
+
selected: slateGrey[3]
|
|
265
|
+
};
|
|
266
|
+
var inputDropdown = {
|
|
267
|
+
background: slateGrey[2],
|
|
268
|
+
icon: slateGrey[10],
|
|
269
|
+
borderDefault: slateGrey[4],
|
|
270
|
+
borderSelected: brand[3],
|
|
271
|
+
textLabel: slateGrey[9],
|
|
272
|
+
textPlaceholder: slateGrey[8],
|
|
273
|
+
textHint: slateGrey[8]
|
|
274
|
+
};
|
|
275
|
+
var inputField = {
|
|
276
|
+
backgroundDefault: slateGrey[2],
|
|
277
|
+
backgroundDisabled: slateGrey[0],
|
|
278
|
+
textLabel: slateGrey[9],
|
|
279
|
+
textPlaceholder: slateGrey[8],
|
|
280
|
+
textHint: slateGrey[8],
|
|
281
|
+
textError: red[5],
|
|
282
|
+
iconDefault: slateGrey[9],
|
|
283
|
+
iconPlaceholder: slateGrey[10],
|
|
284
|
+
iconError: red[5],
|
|
285
|
+
borderDefault: slateGrey[4],
|
|
286
|
+
borderSelected: brand[3],
|
|
287
|
+
borderError: red[5]
|
|
288
|
+
};
|
|
289
|
+
var toggle = {
|
|
290
|
+
handleDefault: base.white,
|
|
291
|
+
handleDisabled: slateGrey[10],
|
|
292
|
+
off: {
|
|
293
|
+
backgroundDefault: slateGrey[4],
|
|
294
|
+
backgroundHover: slateGrey[5],
|
|
295
|
+
backgroundDisabled: slateGrey[4]
|
|
296
|
+
},
|
|
297
|
+
on: {
|
|
298
|
+
backgroundDefault: green[3],
|
|
299
|
+
backgroundHover: green[2],
|
|
300
|
+
backgroundDisabled: slateGrey[4]
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var checkbox = {
|
|
304
|
+
off: {
|
|
305
|
+
backgroundDefault: "#00000000",
|
|
306
|
+
backgroundHover: slateGrey[5],
|
|
307
|
+
backgroundDisabled: slateGrey[2],
|
|
308
|
+
border: slateGrey[6]
|
|
309
|
+
},
|
|
310
|
+
on: {
|
|
311
|
+
backgroundDefault: green[0],
|
|
312
|
+
backgroundHover: green[1],
|
|
313
|
+
backgroundDisabled: slateGrey[2],
|
|
314
|
+
border: green[3]
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
var avatar = {
|
|
318
|
+
content: slateGrey[10],
|
|
319
|
+
background: slateGrey[4]
|
|
320
|
+
};
|
|
321
|
+
var progressBarSlider = {
|
|
322
|
+
background: slateGrey[4],
|
|
323
|
+
active: green[3]
|
|
324
|
+
};
|
|
325
|
+
var card = {
|
|
326
|
+
background: slateGrey[1],
|
|
327
|
+
content: slateGrey[9],
|
|
328
|
+
border: slateGrey[4]
|
|
329
|
+
};
|
|
330
|
+
var sidebar = {
|
|
331
|
+
backgroundDefault: slateGrey[1],
|
|
332
|
+
backgroundHover: slateGrey[3],
|
|
333
|
+
backgroundActive: slateGrey[4],
|
|
334
|
+
border: slateGrey[4],
|
|
335
|
+
contentPrimary: slateGrey[10],
|
|
336
|
+
contentSecondary: slateGrey[9],
|
|
337
|
+
contentTertiary: slateGrey[8]
|
|
338
|
+
};
|
|
339
|
+
var modal = {
|
|
340
|
+
background: slateGrey[1],
|
|
341
|
+
content: slateGrey[9],
|
|
342
|
+
border: slateGrey[4]
|
|
343
|
+
};
|
|
344
|
+
var tab = {
|
|
345
|
+
activeBackground: slateGrey[3],
|
|
346
|
+
activeContent: brand[5],
|
|
347
|
+
inactiveContent: slateGrey[9],
|
|
348
|
+
border: slateGrey[4]
|
|
349
|
+
};
|
|
350
|
+
var table = {
|
|
351
|
+
header: {
|
|
352
|
+
textDefault: slateGrey[9],
|
|
353
|
+
textHover: slateGrey[8],
|
|
354
|
+
backgroundDefault: slateGrey[1]
|
|
355
|
+
},
|
|
356
|
+
border: slateGrey[4],
|
|
357
|
+
cell: {
|
|
358
|
+
textPrimary: slateGrey[10],
|
|
359
|
+
textSecondary: slateGrey[9],
|
|
360
|
+
backgroundDefault: slateGrey[2],
|
|
361
|
+
backgroundHover: slateGrey[1]
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
var breadcrumbs = {
|
|
365
|
+
textPrimaryDefault: slateGrey[10],
|
|
366
|
+
textPrimaryHover: slateGrey[10],
|
|
367
|
+
textSecondaryDefault: slateGrey[8],
|
|
368
|
+
textSecondaryHover: slateGrey[9],
|
|
369
|
+
iconPrimary: slateGrey[10],
|
|
370
|
+
iconSecondary: slateGrey[8]
|
|
371
|
+
};
|
|
372
|
+
var loadingIndicator = {
|
|
373
|
+
background: green[1],
|
|
374
|
+
active: green[5]
|
|
375
|
+
};
|
|
376
|
+
var datePicker = {
|
|
377
|
+
textDefault: slateGrey[10],
|
|
378
|
+
textSelected: base.white,
|
|
379
|
+
textDisabled: slateGrey[7],
|
|
380
|
+
backgroundDefault: slateGrey[2],
|
|
381
|
+
backgroundMiddle: slateGrey[3],
|
|
382
|
+
backgroundSelected: brand[3],
|
|
383
|
+
border: slateGrey[4]
|
|
384
|
+
};
|
|
385
|
+
var scroll = slateGrey[9];
|
|
386
|
+
|
|
387
|
+
// ../design-system/src/tokens/panel-shell.ts
|
|
388
|
+
var fab = {
|
|
389
|
+
/** Diameter in pixels. */
|
|
390
|
+
size: 56,
|
|
391
|
+
/** Inset from the panel's top-left corner in pixels. */
|
|
392
|
+
inset: 12,
|
|
393
|
+
/** Background color (always the brand black). */
|
|
394
|
+
background: base.black,
|
|
395
|
+
/** Icon / logo color. */
|
|
396
|
+
color: base.white,
|
|
397
|
+
/** Border — 2px brand red ring. */
|
|
398
|
+
border: `2px solid ${brand[3]}`,
|
|
399
|
+
/** Shadow when the panel is open (inner ring for "active" state). */
|
|
400
|
+
shadowOpen: "0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",
|
|
401
|
+
/** Shadow when the panel is closed. */
|
|
402
|
+
shadowClosed: "0 4px 24px rgba(0,0,0,0.6)"
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// src/theme/defaultTheme.ts
|
|
406
|
+
function withAlpha(hex, alpha) {
|
|
407
|
+
return `${hex}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
408
|
+
}
|
|
409
|
+
var darkTheme = {
|
|
410
|
+
// Brand colors
|
|
411
|
+
colorPrimary: brand[3],
|
|
412
|
+
colorPrimaryHover: brand[4],
|
|
413
|
+
colorPrimaryMuted: brand[0],
|
|
414
|
+
// Surface colors (with alpha for glass/vibrancy effects)
|
|
415
|
+
colorBackground: withAlpha(slateGrey[1], 0.95),
|
|
416
|
+
colorBackgroundElevated: withAlpha(slateGrey[3], 0.95),
|
|
417
|
+
colorBackgroundSubtle: withAlpha(slateGrey[0], 0.2),
|
|
418
|
+
colorSurface: withAlpha(slateGrey[4], 0.8),
|
|
419
|
+
colorSurfaceHover: withAlpha(slateGrey[5], 0.8),
|
|
420
|
+
// Text colors
|
|
421
|
+
colorText: text.primary,
|
|
422
|
+
colorTextSecondary: text.secondary,
|
|
423
|
+
colorTextMuted: text.tertiary,
|
|
424
|
+
colorTextInverse: slateGrey[1],
|
|
425
|
+
// Border colors
|
|
426
|
+
colorBorder: border.primary,
|
|
427
|
+
colorBorderSubtle: border.secondary,
|
|
428
|
+
// Semantic colors
|
|
429
|
+
colorSuccess: green[4],
|
|
430
|
+
colorSuccessMuted: green[0],
|
|
431
|
+
colorWarning: yellow[4],
|
|
432
|
+
colorWarningMuted: yellow[0],
|
|
433
|
+
colorError: red[4],
|
|
434
|
+
colorErrorMuted: red[0],
|
|
435
|
+
colorInfo: blue[4],
|
|
436
|
+
colorInfoMuted: blue[0],
|
|
437
|
+
// Notification badge
|
|
438
|
+
colorNotification: brand[4],
|
|
439
|
+
colorNotificationMuted: withAlpha(brand[4], 0.4),
|
|
440
|
+
// Glass morphism
|
|
441
|
+
glassBackground: withAlpha(slateGrey[1], 0.6),
|
|
442
|
+
glassBackgroundHover: withAlpha(slateGrey[1], 0.7),
|
|
443
|
+
glassBorder: "rgba(255, 255, 255, 0.08)",
|
|
444
|
+
glassBlur: "blur(24px)",
|
|
445
|
+
glassSaturate: "saturate(1.2)",
|
|
446
|
+
// Typography (SF Pro stack)
|
|
447
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",
|
|
448
|
+
fontFamilyMono: "'SF Mono', 'Fira Code', Consolas, monospace",
|
|
449
|
+
fontSizeXs: "0.7rem",
|
|
450
|
+
fontSizeSm: "0.8rem",
|
|
451
|
+
fontSizeMd: "0.9rem",
|
|
452
|
+
fontSizeLg: "1rem",
|
|
453
|
+
fontSizeXl: "1.25rem",
|
|
454
|
+
fontSizeXxl: "1.5rem",
|
|
455
|
+
fontWeightNormal: "400",
|
|
456
|
+
fontWeightMedium: "500",
|
|
457
|
+
fontWeightSemibold: "600",
|
|
458
|
+
fontWeightBold: "700",
|
|
459
|
+
lineHeightTight: "1.25",
|
|
460
|
+
lineHeightNormal: "1.5",
|
|
461
|
+
lineHeightRelaxed: "1.75",
|
|
462
|
+
// Spacing
|
|
463
|
+
spacingXs: "0.25rem",
|
|
464
|
+
spacingSm: "0.5rem",
|
|
465
|
+
spacingMd: "0.75rem",
|
|
466
|
+
spacingLg: "1rem",
|
|
467
|
+
spacingXl: "1.5rem",
|
|
468
|
+
// Border radius
|
|
469
|
+
borderRadiusSm: "6px",
|
|
470
|
+
borderRadiusMd: "10px",
|
|
471
|
+
borderRadiusLg: "14px",
|
|
472
|
+
borderRadiusXl: "20px",
|
|
473
|
+
borderRadiusFull: "9999px",
|
|
474
|
+
// Shadows
|
|
475
|
+
shadowSm: "0 1px 2px rgba(0, 0, 0, 0.2)",
|
|
476
|
+
shadowMd: "0 2px 12px rgba(0, 0, 0, 0.3)",
|
|
477
|
+
shadowLg: "0 8px 24px rgba(0, 0, 0, 0.4)",
|
|
478
|
+
shadowXl: "0 16px 48px rgba(0, 0, 0, 0.5)",
|
|
479
|
+
// Backdrop effects
|
|
480
|
+
backdropBlur: "blur(20px)",
|
|
481
|
+
backdropSaturate: "saturate(180%)",
|
|
482
|
+
// Animation
|
|
483
|
+
transitionFast: "0.1s ease",
|
|
484
|
+
transitionNormal: "0.25s ease",
|
|
485
|
+
transitionSlow: "0.4s ease"
|
|
486
|
+
};
|
|
487
|
+
var lightTheme = {
|
|
488
|
+
// Brand colors
|
|
489
|
+
colorPrimary: brand[3],
|
|
490
|
+
colorPrimaryHover: brand[2],
|
|
491
|
+
colorPrimaryMuted: withAlpha(brand[5], 0.1),
|
|
492
|
+
// Surface colors
|
|
493
|
+
colorBackground: withAlpha(slateGrey[12], 0.95),
|
|
494
|
+
colorBackgroundElevated: withAlpha(slateGrey[11], 0.95),
|
|
495
|
+
colorBackgroundSubtle: withAlpha(slateGrey[0], 0.02),
|
|
496
|
+
colorSurface: withAlpha(slateGrey[11], 0.6),
|
|
497
|
+
colorSurfaceHover: withAlpha(slateGrey[10], 0.6),
|
|
498
|
+
// Text colors
|
|
499
|
+
colorText: slateGrey[1],
|
|
500
|
+
colorTextSecondary: slateGrey[6],
|
|
501
|
+
colorTextMuted: slateGrey[8],
|
|
502
|
+
colorTextInverse: slateGrey[12],
|
|
503
|
+
// Border colors
|
|
504
|
+
colorBorder: withAlpha(slateGrey[0], 0.12),
|
|
505
|
+
colorBorderSubtle: withAlpha(slateGrey[0], 0.06),
|
|
506
|
+
// Semantic colors
|
|
507
|
+
colorSuccess: green[4],
|
|
508
|
+
colorSuccessMuted: withAlpha(green[4], 0.12),
|
|
509
|
+
colorWarning: yellow[4],
|
|
510
|
+
colorWarningMuted: withAlpha(yellow[4], 0.12),
|
|
511
|
+
colorError: red[4],
|
|
512
|
+
colorErrorMuted: withAlpha(red[4], 0.12),
|
|
513
|
+
colorInfo: blue[4],
|
|
514
|
+
colorInfoMuted: withAlpha(blue[4], 0.12),
|
|
515
|
+
// Notification badge
|
|
516
|
+
colorNotification: brand[3],
|
|
517
|
+
colorNotificationMuted: withAlpha(brand[3], 0.4),
|
|
518
|
+
// Glass morphism
|
|
519
|
+
glassBackground: withAlpha(slateGrey[12], 0.7),
|
|
520
|
+
glassBackgroundHover: withAlpha(slateGrey[12], 0.8),
|
|
521
|
+
glassBorder: "rgba(0, 0, 0, 0.06)",
|
|
522
|
+
glassBlur: "blur(24px)",
|
|
523
|
+
glassSaturate: "saturate(1.2)",
|
|
524
|
+
// Typography (same as dark)
|
|
525
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",
|
|
526
|
+
fontFamilyMono: "'SF Mono', 'Fira Code', Consolas, monospace",
|
|
527
|
+
fontSizeXs: "0.7rem",
|
|
528
|
+
fontSizeSm: "0.8rem",
|
|
529
|
+
fontSizeMd: "0.9rem",
|
|
530
|
+
fontSizeLg: "1rem",
|
|
531
|
+
fontSizeXl: "1.25rem",
|
|
532
|
+
fontSizeXxl: "1.5rem",
|
|
533
|
+
fontWeightNormal: "400",
|
|
534
|
+
fontWeightMedium: "500",
|
|
535
|
+
fontWeightSemibold: "600",
|
|
536
|
+
fontWeightBold: "700",
|
|
537
|
+
lineHeightTight: "1.25",
|
|
538
|
+
lineHeightNormal: "1.5",
|
|
539
|
+
lineHeightRelaxed: "1.75",
|
|
540
|
+
// Spacing (same as dark)
|
|
541
|
+
spacingXs: "0.25rem",
|
|
542
|
+
spacingSm: "0.5rem",
|
|
543
|
+
spacingMd: "0.75rem",
|
|
544
|
+
spacingLg: "1rem",
|
|
545
|
+
spacingXl: "1.5rem",
|
|
546
|
+
// Border radius (same as dark)
|
|
547
|
+
borderRadiusSm: "6px",
|
|
548
|
+
borderRadiusMd: "10px",
|
|
549
|
+
borderRadiusLg: "14px",
|
|
550
|
+
borderRadiusXl: "20px",
|
|
551
|
+
borderRadiusFull: "9999px",
|
|
552
|
+
// Shadows (lighter for light mode)
|
|
553
|
+
shadowSm: "0 1px 2px rgba(0, 0, 0, 0.08)",
|
|
554
|
+
shadowMd: "0 2px 12px rgba(0, 0, 0, 0.12)",
|
|
555
|
+
shadowLg: "0 8px 24px rgba(0, 0, 0, 0.16)",
|
|
556
|
+
shadowXl: "0 16px 48px rgba(0, 0, 0, 0.2)",
|
|
557
|
+
// Backdrop effects
|
|
558
|
+
backdropBlur: "blur(20px)",
|
|
559
|
+
backdropSaturate: "saturate(180%)",
|
|
560
|
+
// Animation
|
|
561
|
+
transitionFast: "0.1s ease",
|
|
562
|
+
transitionNormal: "0.25s ease",
|
|
563
|
+
transitionSlow: "0.4s ease"
|
|
564
|
+
};
|
|
565
|
+
function getDefaultTheme(mode = "dark") {
|
|
566
|
+
return mode === "light" ? lightTheme : darkTheme;
|
|
567
|
+
}
|
|
568
|
+
function kebabCase(str) {
|
|
569
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
570
|
+
}
|
|
571
|
+
function themeToCssVariables(theme) {
|
|
572
|
+
const variables = {};
|
|
573
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
574
|
+
variables[`--sc-${kebabCase(key)}`] = value;
|
|
575
|
+
}
|
|
576
|
+
return variables;
|
|
577
|
+
}
|
|
578
|
+
var darkDefaults = {
|
|
579
|
+
mode: "dark",
|
|
580
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",
|
|
581
|
+
colorPrimary: brand[3],
|
|
582
|
+
colorPrimaryHover: brand[4],
|
|
583
|
+
borderRadius: "12px",
|
|
584
|
+
canvas: {
|
|
585
|
+
position: "right",
|
|
586
|
+
layout: "overlay",
|
|
587
|
+
background: withAlpha(slateGrey[1], 0.6),
|
|
588
|
+
blur: "blur(24px)",
|
|
589
|
+
border: "none",
|
|
590
|
+
width: "clamp(380px, 25vw, 520px)",
|
|
591
|
+
transitionDuration: "300ms",
|
|
592
|
+
transitionEasing: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
593
|
+
transitionFade: "6%"
|
|
594
|
+
},
|
|
595
|
+
launcher: {
|
|
596
|
+
background: button.primary.backgroundDefault,
|
|
597
|
+
backgroundHover: button.primary.backgroundHover,
|
|
598
|
+
color: button.primary.icon,
|
|
599
|
+
size: "56px",
|
|
600
|
+
shadow: `0 8px 32px ${withAlpha(slateGrey[0], 0.6)}`,
|
|
601
|
+
borderRadius: "9999px"
|
|
602
|
+
},
|
|
603
|
+
tile: {
|
|
604
|
+
background: withAlpha(slateGrey[1], 0.6),
|
|
605
|
+
backgroundHover: withAlpha(slateGrey[1], 0.7),
|
|
606
|
+
border: "1px solid rgba(255, 255, 255, 0.08)",
|
|
607
|
+
borderRadius: "14px",
|
|
608
|
+
shadow: "0 2px 12px rgba(0, 0, 0, 0.3)",
|
|
609
|
+
titleColor: text.primary,
|
|
610
|
+
textColor: text.secondary,
|
|
611
|
+
iconBackground: `linear-gradient(135deg, ${brand[3]} 0%, ${brand[3]}cc 100%)`,
|
|
612
|
+
iconShadow: `0 2px 8px ${brand[3]}40`,
|
|
613
|
+
headerPadding: "0.375rem 0.75rem",
|
|
614
|
+
bodyPadding: "0 0.75rem 0.5rem",
|
|
615
|
+
gap: "0.25rem"
|
|
616
|
+
},
|
|
617
|
+
overlay: {
|
|
618
|
+
background: withAlpha(slateGrey[1], 0.6),
|
|
619
|
+
textColor: text.primary,
|
|
620
|
+
titleColor: text.primary,
|
|
621
|
+
arrowColor: withAlpha(slateGrey[1], 0.6),
|
|
622
|
+
arrowSize: "8px",
|
|
623
|
+
border: "none",
|
|
624
|
+
borderRadius: "0",
|
|
625
|
+
scrimOpacity: "0",
|
|
626
|
+
highlightRing: `2px solid ${brand[3]}`
|
|
627
|
+
},
|
|
628
|
+
notification: {
|
|
629
|
+
background: withAlpha(slateGrey[0], 0.95),
|
|
630
|
+
textColor: text.primary,
|
|
631
|
+
textSecondaryColor: text.secondary,
|
|
632
|
+
border: `1px solid ${slateGrey[5]}`,
|
|
633
|
+
borderRadius: "12px",
|
|
634
|
+
successColor: green[4],
|
|
635
|
+
warningColor: yellow[4],
|
|
636
|
+
errorColor: red[4],
|
|
637
|
+
iconBackground: withAlpha(brand[3], 0.15),
|
|
638
|
+
progressGradient: `linear-gradient(90deg, ${brand[3]}, ${brand[4]})`
|
|
639
|
+
},
|
|
640
|
+
content: {
|
|
641
|
+
background: withAlpha(slateGrey[3], 0.8),
|
|
642
|
+
backgroundHover: withAlpha(slateGrey[5], 0.6),
|
|
643
|
+
border: `1px solid ${withAlpha(slateGrey[5], 0.5)}`,
|
|
644
|
+
borderRadius: "8px",
|
|
645
|
+
textColor: text.primary,
|
|
646
|
+
textSecondaryColor: text.secondary,
|
|
647
|
+
itemDivider: "none",
|
|
648
|
+
itemGap: "6px",
|
|
649
|
+
itemPadding: "12px 16px",
|
|
650
|
+
itemFontSize: "15px",
|
|
651
|
+
bodyPadding: "0 16px 12px 16px",
|
|
652
|
+
bodyFontSize: "14px",
|
|
653
|
+
categoryPadding: "8px 4px 4px 4px",
|
|
654
|
+
categoryGap: "4px",
|
|
655
|
+
categoryFontSize: "12px",
|
|
656
|
+
searchBackground: withAlpha(slateGrey[3], 0.8),
|
|
657
|
+
searchColor: text.primary,
|
|
658
|
+
chevronColor: "currentColor"
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
var lightDefaults = {
|
|
662
|
+
mode: "light",
|
|
663
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",
|
|
664
|
+
colorPrimary: brand[3],
|
|
665
|
+
colorPrimaryHover: brand[2],
|
|
666
|
+
borderRadius: "12px",
|
|
667
|
+
canvas: {
|
|
668
|
+
position: "right",
|
|
669
|
+
layout: "overlay",
|
|
670
|
+
background: withAlpha(slateGrey[12], 0.7),
|
|
671
|
+
blur: "blur(24px)",
|
|
672
|
+
border: "none",
|
|
673
|
+
width: "clamp(380px, 25vw, 520px)",
|
|
674
|
+
transitionDuration: "300ms",
|
|
675
|
+
transitionEasing: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
676
|
+
transitionFade: "6%"
|
|
677
|
+
},
|
|
678
|
+
launcher: {
|
|
679
|
+
background: brand[3],
|
|
680
|
+
backgroundHover: brand[2],
|
|
681
|
+
color: "#ffffff",
|
|
682
|
+
size: "56px",
|
|
683
|
+
shadow: "0 8px 32px rgba(0, 0, 0, 0.15)",
|
|
684
|
+
borderRadius: "9999px"
|
|
685
|
+
},
|
|
686
|
+
tile: {
|
|
687
|
+
background: withAlpha(slateGrey[12], 0.7),
|
|
688
|
+
backgroundHover: withAlpha(slateGrey[12], 0.8),
|
|
689
|
+
border: "1px solid rgba(0, 0, 0, 0.06)",
|
|
690
|
+
borderRadius: "14px",
|
|
691
|
+
shadow: "0 2px 12px rgba(0, 0, 0, 0.12)",
|
|
692
|
+
titleColor: slateGrey[1],
|
|
693
|
+
textColor: slateGrey[6],
|
|
694
|
+
iconBackground: `linear-gradient(135deg, ${brand[3]} 0%, ${brand[3]}cc 100%)`,
|
|
695
|
+
iconShadow: `0 2px 8px ${brand[3]}40`,
|
|
696
|
+
headerPadding: "0.375rem 0.75rem",
|
|
697
|
+
bodyPadding: "0 0.75rem 0.5rem",
|
|
698
|
+
gap: "0.25rem"
|
|
699
|
+
},
|
|
700
|
+
overlay: {
|
|
701
|
+
background: withAlpha(slateGrey[12], 0.7),
|
|
702
|
+
textColor: slateGrey[1],
|
|
703
|
+
titleColor: slateGrey[1],
|
|
704
|
+
arrowColor: withAlpha(slateGrey[12], 0.7),
|
|
705
|
+
arrowSize: "8px",
|
|
706
|
+
border: "none",
|
|
707
|
+
borderRadius: "0",
|
|
708
|
+
scrimOpacity: "0",
|
|
709
|
+
highlightRing: `2px solid ${brand[3]}`
|
|
710
|
+
},
|
|
711
|
+
notification: {
|
|
712
|
+
background: withAlpha(slateGrey[12], 0.95),
|
|
713
|
+
textColor: slateGrey[1],
|
|
714
|
+
textSecondaryColor: slateGrey[6],
|
|
715
|
+
border: `1px solid ${withAlpha(slateGrey[0], 0.12)}`,
|
|
716
|
+
borderRadius: "12px",
|
|
717
|
+
successColor: green[4],
|
|
718
|
+
warningColor: yellow[4],
|
|
719
|
+
errorColor: red[4],
|
|
720
|
+
iconBackground: withAlpha(brand[3], 0.1),
|
|
721
|
+
progressGradient: `linear-gradient(90deg, ${brand[3]}, ${brand[2]})`
|
|
722
|
+
},
|
|
723
|
+
content: {
|
|
724
|
+
background: withAlpha(slateGrey[12], 0.8),
|
|
725
|
+
backgroundHover: withAlpha(slateGrey[11], 0.6),
|
|
726
|
+
border: `1px solid ${slateGrey[11]}`,
|
|
727
|
+
borderRadius: "8px",
|
|
728
|
+
textColor: slateGrey[1],
|
|
729
|
+
textSecondaryColor: slateGrey[6],
|
|
730
|
+
itemDivider: "none",
|
|
731
|
+
itemGap: "6px",
|
|
732
|
+
itemPadding: "12px 16px",
|
|
733
|
+
itemFontSize: "15px",
|
|
734
|
+
bodyPadding: "0 16px 12px 16px",
|
|
735
|
+
bodyFontSize: "14px",
|
|
736
|
+
categoryPadding: "8px 4px 4px 4px",
|
|
737
|
+
categoryGap: "4px",
|
|
738
|
+
categoryFontSize: "12px",
|
|
739
|
+
searchBackground: slateGrey[12],
|
|
740
|
+
searchColor: slateGrey[1],
|
|
741
|
+
chevronColor: "currentColor"
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
function mergeThemeConfig(customer) {
|
|
745
|
+
var _a, _b, _c, _d, _e;
|
|
746
|
+
const base2 = customer.mode === "light" ? lightDefaults : darkDefaults;
|
|
747
|
+
return {
|
|
748
|
+
mode: (_a = customer.mode) != null ? _a : base2.mode,
|
|
749
|
+
fontFamily: (_b = customer.fontFamily) != null ? _b : base2.fontFamily,
|
|
750
|
+
colorPrimary: (_c = customer.colorPrimary) != null ? _c : base2.colorPrimary,
|
|
751
|
+
colorPrimaryHover: (_d = customer.colorPrimaryHover) != null ? _d : base2.colorPrimaryHover,
|
|
752
|
+
borderRadius: (_e = customer.borderRadius) != null ? _e : base2.borderRadius,
|
|
753
|
+
canvas: { ...base2.canvas, ...customer.canvas },
|
|
754
|
+
launcher: { ...base2.launcher, ...customer.launcher },
|
|
755
|
+
tile: { ...base2.tile, ...customer.tile },
|
|
756
|
+
overlay: { ...base2.overlay, ...customer.overlay },
|
|
757
|
+
notification: { ...base2.notification, ...customer.notification },
|
|
758
|
+
content: { ...base2.content, ...customer.content }
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
function mergeThemeWithWorkspace(workspaceTheme, configTheme) {
|
|
762
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
763
|
+
const mode = (_b = (_a = configTheme.mode) != null ? _a : workspaceTheme.mode) != null ? _b : "dark";
|
|
764
|
+
const base2 = mode === "light" ? lightDefaults : darkDefaults;
|
|
765
|
+
return {
|
|
766
|
+
mode,
|
|
767
|
+
fontFamily: (_d = (_c = configTheme.fontFamily) != null ? _c : workspaceTheme.fontFamily) != null ? _d : base2.fontFamily,
|
|
768
|
+
colorPrimary: (_f = (_e = configTheme.colorPrimary) != null ? _e : workspaceTheme.colorPrimary) != null ? _f : base2.colorPrimary,
|
|
769
|
+
colorPrimaryHover: (_h = (_g = configTheme.colorPrimaryHover) != null ? _g : workspaceTheme.colorPrimaryHover) != null ? _h : base2.colorPrimaryHover,
|
|
770
|
+
borderRadius: (_j = (_i = configTheme.borderRadius) != null ? _i : workspaceTheme.borderRadius) != null ? _j : base2.borderRadius,
|
|
771
|
+
canvas: { ...base2.canvas, ...workspaceTheme.canvas, ...configTheme.canvas },
|
|
772
|
+
launcher: { ...base2.launcher, ...workspaceTheme.launcher, ...configTheme.launcher },
|
|
773
|
+
tile: { ...base2.tile, ...workspaceTheme.tile, ...configTheme.tile },
|
|
774
|
+
overlay: { ...base2.overlay, ...workspaceTheme.overlay, ...configTheme.overlay },
|
|
775
|
+
notification: {
|
|
776
|
+
...base2.notification,
|
|
777
|
+
...workspaceTheme.notification,
|
|
778
|
+
...configTheme.notification
|
|
779
|
+
},
|
|
780
|
+
content: { ...base2.content, ...workspaceTheme.content, ...configTheme.content }
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
var ELEMENT_SECTIONS = [
|
|
784
|
+
"canvas",
|
|
785
|
+
"launcher",
|
|
786
|
+
"tile",
|
|
787
|
+
"overlay",
|
|
788
|
+
"notification",
|
|
789
|
+
"content"
|
|
790
|
+
];
|
|
791
|
+
function flattenThemeConfig(config) {
|
|
792
|
+
const vars = {};
|
|
793
|
+
if (config.fontFamily) vars["--sc-font-family"] = config.fontFamily;
|
|
794
|
+
if (config.colorPrimary) vars["--sc-color-primary"] = config.colorPrimary;
|
|
795
|
+
if (config.colorPrimaryHover) vars["--sc-color-primary-hover"] = config.colorPrimaryHover;
|
|
796
|
+
if (config.borderRadius) vars["--sc-border-radius"] = config.borderRadius;
|
|
797
|
+
for (const section of ELEMENT_SECTIONS) {
|
|
798
|
+
const sectionConfig = config[section];
|
|
799
|
+
if (!sectionConfig) continue;
|
|
800
|
+
for (const [key, value] of Object.entries(sectionConfig)) {
|
|
801
|
+
if (value !== void 0) {
|
|
802
|
+
vars[`--sc-${section}-${kebabCase(key)}`] = value;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return vars;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// src/theme/ThemeProvider.tsx
|
|
810
|
+
import { createContext, useContext, useEffect, useMemo } from "react";
|
|
811
|
+
import { jsx } from "react/jsx-runtime";
|
|
812
|
+
var ThemeContext = createContext(null);
|
|
813
|
+
function ThemeProvider({
|
|
814
|
+
children,
|
|
815
|
+
themeConfig,
|
|
816
|
+
workspaceTheme,
|
|
817
|
+
shadowRoot
|
|
818
|
+
}) {
|
|
819
|
+
const merged = useMemo(
|
|
820
|
+
() => workspaceTheme ? mergeThemeWithWorkspace(workspaceTheme, themeConfig != null ? themeConfig : {}) : mergeThemeConfig(themeConfig != null ? themeConfig : {}),
|
|
821
|
+
[themeConfig, workspaceTheme]
|
|
822
|
+
);
|
|
823
|
+
const cssVariables = useMemo(() => flattenThemeConfig(merged), [merged]);
|
|
824
|
+
useEffect(() => {
|
|
825
|
+
if (!shadowRoot) return;
|
|
826
|
+
let styleEl = shadowRoot.querySelector("#sc-theme-vars");
|
|
827
|
+
if (!styleEl) {
|
|
828
|
+
styleEl = document.createElement("style");
|
|
829
|
+
styleEl.id = "sc-theme-vars";
|
|
830
|
+
shadowRoot.insertBefore(styleEl, shadowRoot.firstChild);
|
|
831
|
+
}
|
|
832
|
+
const cssRules = Object.entries(cssVariables).map(([key, value2]) => ` ${key}: ${value2};`).join("\n");
|
|
833
|
+
styleEl.textContent = `:host {
|
|
834
|
+
${cssRules}
|
|
835
|
+
}`;
|
|
836
|
+
}, [shadowRoot, cssVariables]);
|
|
837
|
+
const value = {
|
|
838
|
+
config: merged,
|
|
839
|
+
mode: merged.mode,
|
|
840
|
+
cssVariables
|
|
841
|
+
};
|
|
842
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
843
|
+
}
|
|
844
|
+
function useTheme() {
|
|
845
|
+
const context = useContext(ThemeContext);
|
|
846
|
+
if (!context) {
|
|
847
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
848
|
+
}
|
|
849
|
+
return context;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export {
|
|
853
|
+
base,
|
|
854
|
+
slateGrey,
|
|
855
|
+
red,
|
|
856
|
+
blue,
|
|
857
|
+
purple,
|
|
858
|
+
withAlpha,
|
|
859
|
+
darkTheme,
|
|
860
|
+
lightTheme,
|
|
861
|
+
getDefaultTheme,
|
|
862
|
+
themeToCssVariables,
|
|
863
|
+
darkDefaults,
|
|
864
|
+
lightDefaults,
|
|
865
|
+
mergeThemeConfig,
|
|
866
|
+
mergeThemeWithWorkspace,
|
|
867
|
+
flattenThemeConfig,
|
|
868
|
+
ThemeProvider,
|
|
869
|
+
useTheme
|
|
870
|
+
};
|
|
871
|
+
//# sourceMappingURL=chunk-2IQ2PTLJ.js.map
|