@floegence/floe-webapp-core 0.52.13 → 0.53.1

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 (41) hide show
  1. package/dist/components/chat/ChatProvider.js +31 -30
  2. package/dist/components/chat/hooks/useAttachments.js +27 -26
  3. package/dist/components/chat/hooks/useCodeDiff.js +24 -23
  4. package/dist/components/chat/hooks/useCodeHighlight.js +21 -20
  5. package/dist/components/chat/hooks/useMarkdown.js +27 -26
  6. package/dist/components/chat/hooks/useMermaid.js +21 -20
  7. package/dist/components/layout/BottomBar.js +22 -22
  8. package/dist/components/layout/TopBar.js +7 -7
  9. package/dist/components/ui/Button.js +1 -1
  10. package/dist/components/ui/Card.js +1 -1
  11. package/dist/components/ui/Checkbox.js +69 -69
  12. package/dist/components/ui/CommandPalette.js +29 -30
  13. package/dist/components/ui/Dialog.js +1 -1
  14. package/dist/components/ui/Dropdown.js +36 -38
  15. package/dist/components/ui/FloatingWindow.js +2 -3
  16. package/dist/components/ui/Input.js +3 -3
  17. package/dist/components/ui/Radio.js +26 -26
  18. package/dist/components/ui/SegmentedControl.js +6 -6
  19. package/dist/components/ui/Tabs.js +43 -43
  20. package/dist/components/ui/floatingPresence.js +1 -1
  21. package/dist/components/workbench/workbenchHelpers.js +96 -96
  22. package/dist/context/ThemeContext.js +75 -65
  23. package/dist/floe.css +27 -55
  24. package/dist/full.js +61 -59
  25. package/dist/index.js +26 -24
  26. package/dist/styles/themes/classicSemanticTokens.d.ts +142 -0
  27. package/dist/styles/themes/classicSemanticTokens.js +100 -94
  28. package/dist/styles/themes/presets.d.ts +3 -1
  29. package/dist/styles/themes/presets.js +126 -63
  30. package/dist/styles/tokens.d.ts +252 -252
  31. package/dist/styles/tokens.js +165 -164
  32. package/dist/styles.css +1 -1
  33. package/dist/surface.css +17 -42
  34. package/dist/themes/dark.css +41 -95
  35. package/dist/themes/light.css +43 -95
  36. package/dist/themes/shell-presets.generated.css +146 -4
  37. package/dist/utils/index.d.ts +1 -0
  38. package/dist/utils/secureRandom.d.ts +2 -0
  39. package/dist/utils/secureRandom.js +11 -0
  40. package/dist/utils/secureRandom.test.d.ts +1 -0
  41. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { DEFAULT_WORKBENCH_VIEWPORT as O, WORKBENCH_BACKGROUND_REGION_FILTER_ID as K, WORKBENCH_LAYER_COMPONENT_FILTER_IDS as P } from "./types.js";
2
- import { WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as E, WORKBENCH_DEFAULT_REGION_FILL as S, WORKBENCH_DEFAULT_TEXT_COLOR as R, WORKBENCH_DEFAULT_TEXT_FONT as N, WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as z, resolveWorkbenchTextFontOption as U, WORKBENCH_BACKGROUND_MATERIALS as X, WORKBENCH_STICKY_NOTE_COLORS as Y, WORKBENCH_TEXT_COLOR_OPTIONS as j, WORKBENCH_REGION_FILL_OPTIONS as V } from "./workbenchOptions.js";
3
- import { resolveWorkbenchWidgetDefinitions as T, getWidgetEntry as C, createWorkbenchFilterState as I, isValidWorkbenchWidgetType as G } from "./widgets/widgetRegistry.js";
4
- import { DEFAULT_WORKBENCH_THEME as A, isWorkbenchThemeId as $ } from "./workbenchThemes.js";
5
- function Z() {
6
- const e = globalThis.crypto;
7
- return e && typeof e.randomUUID == "function" ? `wb-${e.randomUUID()}` : `wb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
8
- }
9
- function ke(e) {
1
+ import { secureRandomUUID as K } from "../../utils/secureRandom.js";
2
+ import { DEFAULT_WORKBENCH_VIEWPORT as O, WORKBENCH_BACKGROUND_REGION_FILTER_ID as P, WORKBENCH_LAYER_COMPONENT_FILTER_IDS as X } from "./types.js";
3
+ import { WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as E, WORKBENCH_DEFAULT_REGION_FILL as S, WORKBENCH_DEFAULT_TEXT_COLOR as R, WORKBENCH_DEFAULT_TEXT_FONT as N, WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as z, resolveWorkbenchTextFontOption as U, WORKBENCH_BACKGROUND_MATERIALS as Y, WORKBENCH_STICKY_NOTE_COLORS as j, WORKBENCH_TEXT_COLOR_OPTIONS as V, WORKBENCH_REGION_FILL_OPTIONS as G } from "./workbenchOptions.js";
4
+ import { resolveWorkbenchWidgetDefinitions as T, getWidgetEntry as C, createWorkbenchFilterState as A, isValidWorkbenchWidgetType as $ } from "./widgets/widgetRegistry.js";
5
+ import { DEFAULT_WORKBENCH_THEME as I, isWorkbenchThemeId as Z } from "./workbenchThemes.js";
6
+ function q() {
7
+ return `wb-${K()}`;
8
+ }
9
+ function Ne(e) {
10
10
  return e.renderMode ?? "canvas_scaled";
11
11
  }
12
- function Me(e) {
12
+ function Oe(e) {
13
13
  return e.projectedSurfaceScaleBehavior ?? "stable_transform";
14
14
  }
15
- function q(e) {
15
+ function J(e) {
16
16
  const t = Number.isFinite(e.viewport.scale) && e.viewport.scale > 0 ? e.viewport.scale : 1, n = typeof window < "u" && Number.isFinite(window.devicePixelRatio) && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1, r = Math.round((e.viewport.x + e.worldX * t) * n) / n, i = Math.round((e.viewport.y + e.worldY * t) * n) / n;
17
17
  return {
18
18
  widgetId: e.widgetId,
@@ -27,13 +27,13 @@ function q(e) {
27
27
  viewportScale: t
28
28
  };
29
29
  }
30
- function Ne(e) {
30
+ function Ee(e) {
31
31
  return {
32
32
  ready: e.ready,
33
- rect: q(e)
33
+ rect: J(e)
34
34
  };
35
35
  }
36
- function Oe(e, t) {
36
+ function Se(e, t) {
37
37
  const { width: n, height: r } = e.defaultSize;
38
38
  switch (t.anchor) {
39
39
  case "center":
@@ -52,23 +52,23 @@ function Oe(e, t) {
52
52
  };
53
53
  }
54
54
  }
55
- function J(e) {
55
+ function Q(e) {
56
56
  return e ? {
57
57
  x: Number.isFinite(e.x) ? e.x : 0,
58
58
  y: Number.isFinite(e.y) ? e.y : 0,
59
59
  scale: Number.isFinite(e.scale) && e.scale > 0 ? e.scale : 1
60
60
  } : { ...O };
61
61
  }
62
- function Q(e, t) {
63
- const n = J(e);
62
+ function v(e, t) {
63
+ const n = Q(e);
64
64
  return {
65
65
  ...n,
66
- scale: b(n.scale, me(t).minScale, g)
66
+ scale: b(n.scale, xe(t).minScale, g)
67
67
  };
68
68
  }
69
- function v(e, t) {
70
- const n = I(t, e);
71
- for (const r of P)
69
+ function ee(e, t) {
70
+ const n = A(t, e);
71
+ for (const r of X)
72
72
  n[r] = typeof e?.[r] == "boolean" ? !!e[r] : !0;
73
73
  return n;
74
74
  }
@@ -88,30 +88,30 @@ function m(e, t) {
88
88
  }
89
89
  function W(e, t) {
90
90
  const n = f(e);
91
- return n.length > 0 && n.length <= 128 ? n : `${t}-${Z()}`;
91
+ return n.length > 0 && n.length <= 128 ? n : `${t}-${q()}`;
92
92
  }
93
- function ee(e) {
93
+ function te(e) {
94
94
  return F(e);
95
95
  }
96
- function te(e, t) {
96
+ function ne(e, t) {
97
97
  const n = f(e);
98
- return n || (t === "annotation" || t === "background" ? K : "select");
98
+ return n || (t === "annotation" || t === "background" ? P : "select");
99
99
  }
100
100
  function w(e, t, n) {
101
101
  const r = f(e);
102
102
  return t.includes(r) ? r : n;
103
103
  }
104
- function ne(e) {
105
- return w(e, Y, z);
106
- }
107
104
  function ie(e) {
105
+ return w(e, j, z);
106
+ }
107
+ function re(e) {
108
108
  if (!y(e)) return null;
109
109
  const t = Date.now();
110
110
  return {
111
111
  id: W(e.id, "sticky"),
112
112
  kind: "sticky_note",
113
113
  body: f(e.body) || "Untitled note",
114
- color: ne(e.color),
114
+ color: ie(e.color),
115
115
  x: d(e.x, 0),
116
116
  y: d(e.y, 0),
117
117
  width: m(e.width, 260),
@@ -121,16 +121,16 @@ function ie(e) {
121
121
  updated_at_unix_ms: Math.max(0, Math.trunc(d(e.updated_at_unix_ms, t)))
122
122
  };
123
123
  }
124
- function re(e) {
124
+ function oe(e) {
125
125
  if (!Array.isArray(e)) return [];
126
126
  const t = /* @__PURE__ */ new Set();
127
- return e.map((n) => ie(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
128
- }
129
- const oe = ["left", "center", "right"];
130
- function ae(e) {
131
- return oe.includes(e) ? e : "left";
127
+ return e.map((n) => re(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
132
128
  }
129
+ const ae = ["left", "center", "right"];
133
130
  function ce(e) {
131
+ return ae.includes(e) ? e : "left";
132
+ }
133
+ function de(e) {
134
134
  if (!y(e)) return null;
135
135
  const t = Date.now(), n = U(e.font_family);
136
136
  return {
@@ -140,8 +140,8 @@ function ce(e) {
140
140
  font_family: n.fontFamily,
141
141
  font_size: Math.max(8, Math.min(160, Math.round(d(e.font_size, 28)))),
142
142
  font_weight: n.fontWeight,
143
- color: w(e.color, j, R),
144
- align: ae(e.align),
143
+ color: w(e.color, V, R),
144
+ align: ce(e.align),
145
145
  x: d(e.x, 0),
146
146
  y: d(e.y, 0),
147
147
  width: m(e.width, 280),
@@ -151,27 +151,27 @@ function ce(e) {
151
151
  updated_at_unix_ms: Math.max(0, Math.trunc(d(e.updated_at_unix_ms, t)))
152
152
  };
153
153
  }
154
- function de(e) {
154
+ function se(e) {
155
155
  if (!Array.isArray(e)) return [];
156
156
  const t = /* @__PURE__ */ new Set();
157
- return e.map((n) => ce(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
157
+ return e.map((n) => de(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
158
158
  }
159
- function se(e) {
159
+ function he(e) {
160
160
  return w(
161
161
  e,
162
- X,
162
+ Y,
163
163
  E
164
164
  );
165
165
  }
166
- function he(e) {
166
+ function ue(e) {
167
167
  if (!y(e)) return null;
168
168
  const t = Date.now();
169
169
  return {
170
170
  id: W(e.id, "region"),
171
171
  name: f(e.name) || "Canvas region",
172
- fill: w(e.fill, V, S),
172
+ fill: w(e.fill, G, S),
173
173
  opacity: Math.max(0.08, Math.min(1, d(e.opacity, 0.72))),
174
- material: se(e.material),
174
+ material: he(e.material),
175
175
  x: d(e.x, 0),
176
176
  y: d(e.y, 0),
177
177
  width: m(e.width, 560),
@@ -181,12 +181,12 @@ function he(e) {
181
181
  updated_at_unix_ms: Math.max(0, Math.trunc(d(e.updated_at_unix_ms, t)))
182
182
  };
183
183
  }
184
- function ue(e) {
184
+ function le(e) {
185
185
  if (!Array.isArray(e)) return [];
186
186
  const t = /* @__PURE__ */ new Set();
187
- return e.map((n) => he(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
187
+ return e.map((n) => ue(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
188
188
  }
189
- function le(e, t, n, r, i, a) {
189
+ function _e(e, t, n, r, i, a) {
190
190
  if (y(e)) {
191
191
  const c = f(e.kind), s = f(e.id);
192
192
  if (c === "widget" && t.some((u) => u.id === s)) return { kind: c, id: s };
@@ -197,12 +197,12 @@ function le(e, t, n, r, i, a) {
197
197
  }
198
198
  return a ? { kind: "widget", id: a } : null;
199
199
  }
200
- function Ee(e, t = {}) {
201
- const n = T(t.widgetDefinitions), r = t.createFallbackState ?? (() => _e(n)), i = e;
200
+ function Re(e, t = {}) {
201
+ const n = T(t.widgetDefinitions), r = t.createFallbackState ?? (() => fe(n)), i = e;
202
202
  if (!i || i.version !== 1 || !Array.isArray(i.widgets))
203
203
  return r();
204
204
  const a = i.widgets.filter(
205
- (o) => !!o && typeof o.id == "string" && G(o.type, n) && typeof o.title == "string"
205
+ (o) => !!o && typeof o.id == "string" && $(o.type, n) && typeof o.title == "string"
206
206
  ).map((o) => {
207
207
  const _ = C(o.type, n);
208
208
  return {
@@ -216,18 +216,18 @@ function Ee(e, t = {}) {
216
216
  z_index: Number.isFinite(o.z_index) && o.z_index >= 0 ? o.z_index : 1,
217
217
  created_at_unix_ms: Number.isFinite(o.created_at_unix_ms) ? o.created_at_unix_ms : Date.now()
218
218
  };
219
- }), c = typeof i.selectedWidgetId == "string" && a.some((o) => o.id === i.selectedWidgetId) ? i.selectedWidgetId : null, s = re(i.stickyNotes), u = de(i.annotations), x = ue(i.backgroundLayers), h = ee(i.mode), l = Q(i.viewport, h);
219
+ }), c = typeof i.selectedWidgetId == "string" && a.some((o) => o.id === i.selectedWidgetId) ? i.selectedWidgetId : null, s = oe(i.stickyNotes), u = se(i.annotations), x = le(i.backgroundLayers), h = te(i.mode), l = v(i.viewport, h);
220
220
  return {
221
221
  version: 1,
222
222
  widgets: a,
223
223
  viewport: l,
224
224
  locked: typeof i.locked == "boolean" ? i.locked : !1,
225
- filters: v(i.filters, n),
225
+ filters: ee(i.filters, n),
226
226
  selectedWidgetId: c,
227
- theme: $(i.theme) ? i.theme : A,
227
+ theme: Z(i.theme) ? i.theme : I,
228
228
  mode: h,
229
- activeTool: te(i.activeTool, h),
230
- selectedObject: le(
229
+ activeTool: ne(i.activeTool, h),
230
+ selectedObject: _e(
231
231
  i.selectedObject,
232
232
  a,
233
233
  s,
@@ -240,7 +240,7 @@ function Ee(e, t = {}) {
240
240
  backgroundLayers: x
241
241
  };
242
242
  }
243
- function _e(e) {
243
+ function fe(e) {
244
244
  const t = T(e), n = Date.now(), r = [
245
245
  { type: "terminal", title: "dev · terminal", x: 80, y: 80 },
246
246
  { type: "file-browser", title: "project · files", x: 600, y: 80 },
@@ -266,9 +266,9 @@ function _e(e) {
266
266
  widgets: i,
267
267
  viewport: { ...O },
268
268
  locked: !1,
269
- filters: I(t),
269
+ filters: A(t),
270
270
  selectedWidgetId: i[0]?.id ?? null,
271
- theme: A,
271
+ theme: I,
272
272
  mode: "work",
273
273
  activeTool: "select",
274
274
  selectedObject: i[0] ? { kind: "widget", id: i[0].id } : null,
@@ -324,11 +324,11 @@ function _e(e) {
324
324
  ]
325
325
  };
326
326
  }
327
- const Se = 1.18, Re = 200, H = 0.35, L = 0.2, k = H, g = 2.2, fe = 48;
327
+ const ze = 1.18, Te = 200, H = 0.35, L = 0.2, k = H, g = 2.2, me = 48;
328
328
  function F(e) {
329
329
  return e === "annotation" || e === "background" ? "background" : "work";
330
330
  }
331
- function me(e) {
331
+ function xe(e) {
332
332
  return F(e) === "background" ? {
333
333
  mode: "background",
334
334
  label: "Composition Mode",
@@ -343,7 +343,7 @@ function me(e) {
343
343
  layerEditingEnabled: !1
344
344
  };
345
345
  }
346
- function ze(e) {
346
+ function Ce(e) {
347
347
  const t = b(
348
348
  e.scale,
349
349
  e.minScale ?? L,
@@ -358,7 +358,7 @@ function ze(e) {
358
358
  scale: t
359
359
  };
360
360
  }
361
- function xe(e) {
361
+ function ge(e) {
362
362
  const t = b(e.scale, k, g);
363
363
  return {
364
364
  x: e.frameWidth / 2 - (e.widget.x + e.widget.width / 2) * t,
@@ -366,8 +366,8 @@ function xe(e) {
366
366
  scale: t
367
367
  };
368
368
  }
369
- function Te(e) {
370
- const t = e.minScale ?? k, n = e.maxScale ?? g, r = e.paddingPx ?? fe, i = Math.max(e.frameWidth - r * 2, 1), a = Math.max(e.frameHeight - r * 2, 1), c = b(
369
+ function Ae(e) {
370
+ const t = e.minScale ?? k, n = e.maxScale ?? g, r = e.paddingPx ?? me, i = Math.max(e.frameWidth - r * 2, 1), a = Math.max(e.frameHeight - r * 2, 1), c = b(
371
371
  Math.min(
372
372
  i / Math.max(e.widget.width, 1),
373
373
  a / Math.max(e.widget.height, 1)
@@ -375,7 +375,7 @@ function Te(e) {
375
375
  t,
376
376
  n
377
377
  );
378
- return xe({
378
+ return ge({
379
379
  widget: e.widget,
380
380
  scale: c,
381
381
  frameWidth: e.frameWidth,
@@ -385,7 +385,7 @@ function Te(e) {
385
385
  function p(e, t) {
386
386
  return e.z_index !== t.z_index ? e.z_index - t.z_index : e.created_at_unix_ms !== t.created_at_unix_ms ? e.created_at_unix_ms - t.created_at_unix_ms : e.id.localeCompare(t.id);
387
387
  }
388
- function Ce(e) {
388
+ function Ie(e) {
389
389
  const t = [...e].sort(p), n = /* @__PURE__ */ new Map();
390
390
  for (const [r, i] of t.entries())
391
391
  n.set(i.id, r + 1);
@@ -394,27 +394,27 @@ function Ce(e) {
394
394
  topRenderLayer: Math.max(t.length, 1)
395
395
  };
396
396
  }
397
- function ge(e, t) {
397
+ function ye(e, t) {
398
398
  return p(e, t) > 0;
399
399
  }
400
- function Ie(e, t) {
400
+ function He(e, t) {
401
401
  const n = e.find((a) => a.id === t);
402
402
  if (!n)
403
403
  return null;
404
404
  const r = e.reduce((a, c) => Math.max(a, c.z_index), 1);
405
405
  return {
406
406
  isTop: !e.some(
407
- (a) => a.id !== t && ge(a, n)
407
+ (a) => a.id !== t && ye(a, n)
408
408
  ),
409
409
  nextZIndex: r + 1
410
410
  };
411
411
  }
412
- function Ae(e) {
412
+ function Le(e) {
413
413
  const t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800;
414
414
  let r = e.clientX, i = e.clientY;
415
415
  return r + e.menuWidth > t && (r = Math.max(0, t - e.menuWidth - 8)), i + e.menuHeight > n && (i = Math.max(0, n - e.menuHeight - 8)), { left: r, top: i };
416
416
  }
417
- function He(e, t, n, r) {
417
+ function Fe(e, t, n, r) {
418
418
  const i = e.filter((h) => r[h.type]);
419
419
  if (i.length === 0) return null;
420
420
  if (!t) return i[0] ?? null;
@@ -452,39 +452,39 @@ function He(e, t, n, r) {
452
452
  function b(e, t = k, n = g) {
453
453
  return Math.max(t, Math.min(n, e));
454
454
  }
455
- function Le(e, t = 0) {
455
+ function pe(e, t = 0) {
456
456
  return 16 + Math.max(1, e) * 32 + Math.max(0, t) * 9;
457
457
  }
458
458
  export {
459
- Se as WORKBENCH_CANVAS_ZOOM_STEP,
459
+ ze as WORKBENCH_CANVAS_ZOOM_STEP,
460
460
  L as WORKBENCH_COMPOSITION_MIN_SCALE,
461
- Re as WORKBENCH_CONTEXT_MENU_WIDTH_PX,
461
+ Te as WORKBENCH_CONTEXT_MENU_WIDTH_PX,
462
462
  g as WORKBENCH_MAX_SCALE,
463
463
  k as WORKBENCH_MIN_SCALE,
464
- fe as WORKBENCH_VIEWPORT_FIT_PADDING_PX,
464
+ me as WORKBENCH_VIEWPORT_FIT_PADDING_PX,
465
465
  H as WORKBENCH_WORK_MIN_SCALE,
466
466
  b as clampScale,
467
467
  p as compareWorkbenchLayerRenderOrder,
468
- Ae as createContextMenuPosition,
469
- _e as createDefaultWorkbenchState,
470
- Z as createWorkbenchId,
471
- q as createWorkbenchProjectedRect,
472
- Ce as createWorkbenchRenderLayerMap,
473
- ze as createWorkbenchViewportAtScale,
474
- xe as createWorkbenchViewportCenteredOnWidget,
475
- Te as createWorkbenchViewportFitForWidget,
476
- Oe as createWorkbenchWidgetFrame,
477
- Ne as createWorkbenchWidgetSurfaceMetrics,
478
- Le as estimateContextMenuHeight,
479
- He as findNearestWidget,
480
- ge as isWorkbenchLayerItemAbove,
468
+ Le as createContextMenuPosition,
469
+ fe as createDefaultWorkbenchState,
470
+ q as createWorkbenchId,
471
+ J as createWorkbenchProjectedRect,
472
+ Ie as createWorkbenchRenderLayerMap,
473
+ Ce as createWorkbenchViewportAtScale,
474
+ ge as createWorkbenchViewportCenteredOnWidget,
475
+ Ae as createWorkbenchViewportFitForWidget,
476
+ Se as createWorkbenchWidgetFrame,
477
+ Ee as createWorkbenchWidgetSurfaceMetrics,
478
+ pe as estimateContextMenuHeight,
479
+ Fe as findNearestWidget,
480
+ ye as isWorkbenchLayerItemAbove,
481
481
  F as normalizeWorkbenchInteractionMode,
482
- Ie as resolveWorkbenchLayerFront,
483
- me as resolveWorkbenchModeStrategy,
484
- Me as resolveWorkbenchProjectedSurfaceScaleBehavior,
485
- ke as resolveWorkbenchWidgetRenderMode,
486
- v as sanitizeFilters,
487
- J as sanitizeViewport,
488
- Ee as sanitizeWorkbenchState,
489
- Q as sanitizeWorkbenchViewportForMode
482
+ He as resolveWorkbenchLayerFront,
483
+ xe as resolveWorkbenchModeStrategy,
484
+ Oe as resolveWorkbenchProjectedSurfaceScaleBehavior,
485
+ Ne as resolveWorkbenchWidgetRenderMode,
486
+ ee as sanitizeFilters,
487
+ Q as sanitizeViewport,
488
+ Re as sanitizeWorkbenchState,
489
+ v as sanitizeWorkbenchViewportForMode
490
490
  };
@@ -1,95 +1,105 @@
1
- import { createSignal as h, createEffect as S, createMemo as Q, onCleanup as R } from "solid-js";
1
+ import { createSignal as u, createEffect as p, createMemo as O, onCleanup as Q } from "solid-js";
2
2
  import { createSimpleContext as te } from "./createSimpleContext.js";
3
3
  import { useResolvedFloeConfig as se } from "./FloeConfigContext.js";
4
- import { isFloeSurfaceStyle as k, applySurfaceStyleAttribute as V, isThemeType as re, getSystemTheme as ne, applyTheme as oe, applyShellThemeAttribute as j, syncThemeTokenOverrides as q, resolveThemeTokens as ce } from "../styles/themes/index.js";
4
+ import { isFloeSurfaceStyle as K, applySurfaceStyleAttribute as R, isThemeType as ne, getSystemTheme as re, applyTheme as oe, applyShellThemeAttribute as V, syncThemeTokenOverrides as j, resolveThemeTokens as ce } from "../styles/themes/index.js";
5
5
  import { normalizeShellThemeSelection as B, presetSupportsMode as D } from "../styles/themes/presets.js";
6
- function d(s, n, c) {
7
- if (n.length !== 0)
8
- return s && n.some((l) => l.name === s) ? s : c && n.some((l) => l.name === c) ? c : n[0]?.name;
6
+ function S(s, r, l) {
7
+ if (r.length !== 0)
8
+ return s && r.some((a) => a.name === s) ? s : l && r.some((a) => a.name === l) ? l : r[0]?.name;
9
9
  }
10
- function le() {
11
- const s = se(), n = () => s.config.theme.storageKey, c = () => s.config.theme.defaultTheme, l = () => s.config.theme.surfaceStyleStorageKey ?? `${n()}-surface-style`, K = s.config.theme.defaultSurfaceStyle, g = k(K) ? K : "standard", x = s.persist.load(l(), g), [b, G] = h(k(x) ? x : g), H = (e) => {
12
- const t = k(e) ? e : g;
13
- G(t), s.persist.debouncedSave(l(), t);
10
+ function ie() {
11
+ const s = se(), r = () => s.config.theme.storageKey, l = () => s.config.theme.defaultTheme, a = () => s.config.theme.surfaceStyleStorageKey ?? `${r()}-surface-style`, b = s.config.theme.defaultSurfaceStyle, y = K(b) ? b : "standard", w = s.persist.load(a(), y), [M, G] = u(K(w) ? w : y), H = (e) => {
12
+ const t = K(e) ? e : y;
13
+ G(t), s.persist.debouncedSave(a(), t);
14
14
  };
15
- S(() => V(b()));
16
- const I = () => s.config.theme.tokens, o = () => s.config.theme.presets ?? [], p = () => s.config.theme.presetStorageKey ?? `${n()}-preset`, m = () => d(s.config.theme.defaultPreset, o()), i = () => s.config.theme.shellPresets ?? [], C = () => s.config.theme.shellPresetStorageKey ?? `${n()}-shell-preset`, M = () => s.config.theme.defaultShellPreset ?? {}, w = s.persist.load(n(), c()), J = re(w) ? w : c(), [T, U] = h(J), W = s.persist.load(p(), m()), [y, E] = h(d(W, o(), m())), X = s.persist.load(C(), void 0), [v, F] = h(B(X, i(), M())), [Y, Z] = h(ne());
17
- let f = [];
18
- const N = Q(() => {
19
- const e = d(y(), o(), m());
15
+ p(() => R(M()));
16
+ const I = () => s.config.theme.tokens, c = () => s.config.theme.presets ?? [], T = () => s.config.theme.presetStorageKey ?? `${r()}-preset`, h = () => S(s.config.theme.defaultPreset, c()), m = () => s.config.theme.shellPresets ?? [], $ = () => s.config.theme.shellPresetStorageKey ?? `${r()}-shell-preset`, C = () => s.config.theme.defaultShellPreset ?? {}, E = s.persist.load(r(), l()), J = ne(E) ? E : l(), [v, U] = u(J), W = s.persist.load(T(), h()), [P, A] = u(S(W, c(), h())), X = s.persist.load($(), void 0), [k, F] = u(B(X, m(), C())), [Y, Z] = u(re());
17
+ let g = [];
18
+ const N = O(() => {
19
+ const e = S(P(), c(), h());
20
20
  if (e)
21
- return o().find((t) => t.name === e);
22
- }), a = () => {
23
- const e = T();
21
+ return c().find((t) => t.name === e);
22
+ }), f = () => {
23
+ const e = v();
24
24
  return e === "system" ? Y() : e;
25
- }, $ = (e) => {
26
- const t = v()[e];
25
+ }, L = (e) => {
26
+ const t = k()[e];
27
27
  if (t)
28
- return i().find((r) => r.name === t && D(r, e));
29
- }, A = Q(() => $(a()));
30
- if (S(() => {
31
- const e = d(y(), o(), m());
32
- y() !== e && E(e);
33
- }), S(() => {
34
- const e = v(), t = B(e, i(), M());
28
+ return m().find((n) => n.name === t && D(n, e));
29
+ }, q = O(() => L(f()));
30
+ if (p(() => {
31
+ const e = S(P(), c(), h());
32
+ P() !== e && A(e);
33
+ }), p(() => {
34
+ const e = k(), t = B(e, m(), C());
35
35
  (e.light !== t.light || e.dark !== t.dark) && F(t);
36
36
  }), typeof window < "u") {
37
- const e = window.matchMedia("(prefers-color-scheme: dark)"), t = (r) => {
38
- Z(r.matches ? "dark" : "light");
37
+ const e = window.matchMedia("(prefers-color-scheme: dark)"), t = (n) => {
38
+ Z(n.matches ? "dark" : "light");
39
39
  };
40
- e.addEventListener("change", t), R(() => e.removeEventListener("change", t));
40
+ e.addEventListener("change", t), Q(() => e.removeEventListener("change", t));
41
41
  }
42
- S(() => {
43
- const e = T(), t = a(), r = A();
44
- oe(e), j(r?.name), f = q(ce(t, I(), r?.tokens, N()?.tokens), f);
45
- }), R(() => {
46
- V(void 0), j(void 0), f = q(void 0, f);
42
+ p(() => {
43
+ const e = v(), t = f(), n = q();
44
+ oe(e), V(n?.name), g = j(ce(t, I(), n?.tokens, N()?.tokens), g), typeof document < "u" && queueMicrotask(() => {
45
+ const i = /* @__PURE__ */ new Set();
46
+ for (; ; ) {
47
+ const d = (document.documentElement.getAnimations?.({
48
+ subtree: !0
49
+ }) ?? []).filter((o) => !i.has(o) && "transitionProperty" in o && /(^|-)color$|^(fill|stroke|box-shadow)$/.test(String(o.transitionProperty)));
50
+ if (d.length === 0) break;
51
+ for (const o of d)
52
+ i.add(o), o.finish();
53
+ }
54
+ });
55
+ }), Q(() => {
56
+ R(void 0), V(void 0), g = j(void 0, g);
47
57
  });
48
- const P = (e) => {
49
- U(e), s.persist.debouncedSave(n(), e);
58
+ const x = (e) => {
59
+ U(e), s.persist.debouncedSave(r(), e);
50
60
  }, _ = () => {
51
- const e = a();
52
- P(e === "light" ? "dark" : "light");
61
+ const e = f();
62
+ x(e === "light" ? "dark" : "light");
53
63
  }, ee = (e) => {
54
- const t = d(e, o(), m());
55
- if (E(t), !t) {
56
- s.persist.remove(p());
64
+ const t = S(e, c(), h());
65
+ if (A(t), !t) {
66
+ s.persist.remove(T());
57
67
  return;
58
68
  }
59
- s.persist.debouncedSave(p(), t);
60
- }, L = (e, t) => {
61
- const r = i().find((O) => O.name === t && D(O, e));
62
- if (!r) return !1;
63
- const u = v();
64
- if (u[e] === r.name) return !0;
65
- const z = {
66
- ...u,
69
+ s.persist.debouncedSave(T(), t);
70
+ }, z = (e, t) => {
71
+ const n = m().find((o) => o.name === t && D(o, e));
72
+ if (!n) return !1;
73
+ const i = k();
74
+ if (i[e] === n.name) return !0;
75
+ const d = {
76
+ ...i,
67
77
  version: 1,
68
- [e]: r.name
78
+ [e]: n.name
69
79
  };
70
- return F(z), s.persist.debouncedSave(C(), z), !0;
80
+ return F(d), s.persist.debouncedSave($(), d), !0;
71
81
  };
72
82
  return {
73
- surfaceStyle: b,
83
+ surfaceStyle: M,
74
84
  setSurfaceStyle: H,
75
- theme: T,
76
- resolvedTheme: a,
77
- setTheme: P,
85
+ theme: v,
86
+ resolvedTheme: f,
87
+ setTheme: x,
78
88
  toggleTheme: _,
79
- themePresets: o,
89
+ themePresets: c,
80
90
  themePreset: N,
81
91
  setThemePreset: ee,
82
- shellPresets: i,
83
- shellPreset: A,
84
- shellPresetForMode: $,
92
+ shellPresets: m,
93
+ shellPreset: q,
94
+ shellPresetForMode: L,
85
95
  setShellPreset: (e) => {
86
- const t = i().find((u) => u.name === e);
96
+ const t = m().find((i) => i.name === e);
87
97
  if (!t) return;
88
- const r = t.mode === "light" || t.mode === "dark" ? t.mode : a();
89
- L(r, e);
98
+ const n = t.mode === "light" || t.mode === "dark" ? t.mode : f();
99
+ z(n, e);
90
100
  },
91
101
  selectShellTheme: (e, t) => {
92
- L(e, t) && P(e);
102
+ z(e, t) && x(e);
93
103
  }
94
104
  };
95
105
  }
@@ -98,10 +108,10 @@ const {
98
108
  use: ge
99
109
  } = te({
100
110
  name: "Theme",
101
- init: le
111
+ init: ie
102
112
  });
103
113
  export {
104
114
  Se as ThemeProvider,
105
- le as createThemeService,
115
+ ie as createThemeService,
106
116
  ge as useTheme
107
117
  };