@glasshome/widget-sdk 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { createSignal as L, createContext as pt, useContext as vt, createEffect as Y, untrack as dt, createMemo as _, splitProps as St, on as gt, Show as J } from "solid-js";
1
+ import { createSignal as L, createContext as pt, useContext as vt, createEffect as Y, untrack as dt, createMemo as A, splitProps as St, on as gt, Show as J } from "solid-js";
2
2
  import { z as X } from "zod";
3
3
  import { GridSizeSchema as lr, PublishBodySchema as cr, PublishConfirmSchema as ur, PublishRequestSchema as dr, WidgetManifestSchema as gr, formatSchemaError as mr, parseGridSize as fr, serializeGridSize as hr } from "./schemas.js";
4
- import { memo as N, effect as M, setStyleProperty as C, className as k, template as v, insert as h, style as et, createComponent as V, use as Ct, delegateEvents as Mt } from "solid-js/web";
4
+ import { memo as _, effect as M, setStyleProperty as C, className as k, template as v, insert as h, style as et, createComponent as V, use as Ct, delegateEvents as Mt } from "solid-js/web";
5
5
  import { clsx as zt } from "clsx";
6
6
  import { twMerge as Dt } from "tailwind-merge";
7
7
  import { createElementSize as _t } from "@solid-primitives/resize-observer";
@@ -250,7 +250,7 @@ function Tn(t = "column", e = "start", n = "start", i) {
250
250
  var Ft = /* @__PURE__ */ v("<div>"), Ut = /* @__PURE__ */ v('<div class="pointer-events-none absolute inset-0 opacity-40 blur-2xl">');
251
251
  function Yt(t) {
252
252
  const e = G(), n = () => e.orientation() === "vertical" ? `inset(${100 - t.value}% 0 0 0)` : `inset(0 ${100 - t.value}% 0 0)`, i = () => t.color ?? "rgb(59, 130, 246)";
253
- return [N(() => N(() => !!((t.glow ?? !1) && t.value > 0))() && (() => {
253
+ return [_(() => _(() => !!((t.glow ?? !1) && t.value > 0))() && (() => {
254
254
  var r = Ut();
255
255
  return M((a) => {
256
256
  var o = i(), s = F.BACKGROUND;
@@ -262,8 +262,8 @@ function Yt(t) {
262
262
  })()), (() => {
263
263
  var r = Ft();
264
264
  return M((a) => {
265
- var o = $("pointer-events-none absolute inset-0", t.isDragging ? "duration-0" : "transition-all duration-300 ease-out", t.class), s = i(), l = n(), g = t.opacity ?? 0.3, d = F.BACKGROUND;
266
- return o !== a.e && k(r, a.e = o), s !== a.t && C(r, "background", a.t = s), l !== a.a && C(r, "clip-path", a.a = l), g !== a.o && C(r, "opacity", a.o = g), d !== a.i && C(r, "z-index", a.i = d), a;
265
+ var o = $("pointer-events-none absolute inset-0", t.isDragging ? "duration-0" : "transition-all duration-300 ease-out", t.class), s = i(), l = n(), m = t.opacity ?? 0.3, d = F.BACKGROUND;
266
+ return o !== a.e && k(r, a.e = o), s !== a.t && C(r, "background", a.t = s), l !== a.a && C(r, "clip-path", a.a = l), m !== a.o && C(r, "opacity", a.o = m), d !== a.i && C(r, "z-index", a.i = d), a;
267
267
  }, {
268
268
  e: void 0,
269
269
  t: void 0,
@@ -494,12 +494,12 @@ function re(t) {
494
494
  return (() => {
495
495
  var i = Zt(), r = i.firstChild;
496
496
  return h(i, (() => {
497
- var a = N(() => !!t.icon);
497
+ var a = _(() => !!t.icon);
498
498
  return () => a() && (() => {
499
499
  var o = Qt();
500
500
  return h(o, () => t.icon), M((s) => {
501
- var l = $("flex items-center justify-center text-foreground/30", n() ? "shrink-0" : ""), g = `${W.icon(e.size())}px`, d = `${W.icon(e.size())}px`;
502
- return l !== s.e && k(o, s.e = l), g !== s.t && C(o, "width", s.t = g), d !== s.a && C(o, "height", s.a = d), s;
501
+ var l = $("flex items-center justify-center text-foreground/30", n() ? "shrink-0" : ""), m = `${W.icon(e.size())}px`, d = `${W.icon(e.size())}px`;
502
+ return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "width", s.t = m), d !== s.a && C(o, "height", s.a = d), s;
503
503
  }, {
504
504
  e: void 0,
505
505
  t: void 0,
@@ -507,38 +507,38 @@ function re(t) {
507
507
  }), o;
508
508
  })();
509
509
  })(), r), h(r, (() => {
510
- var a = N(() => !!(t.title ?? "No data"));
510
+ var a = _(() => !!(t.title ?? "No data"));
511
511
  return () => a() && (() => {
512
512
  var o = te();
513
513
  return h(o, () => t.title ?? "No data"), M((s) => {
514
- var l = $("font-semibold text-foreground/60", j.subtitle(e.size())), g = n() ? "100%" : "80%";
515
- return l !== s.e && k(o, s.e = l), g !== s.t && C(o, "max-width", s.t = g), s;
514
+ var l = $("font-semibold text-foreground/60", j.subtitle(e.size())), m = n() ? "100%" : "80%";
515
+ return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "max-width", s.t = m), s;
516
516
  }, {
517
517
  e: void 0,
518
518
  t: void 0
519
519
  }), o;
520
520
  })();
521
521
  })(), null), h(r, (() => {
522
- var a = N(() => !!t.message);
522
+ var a = _(() => !!t.message);
523
523
  return () => a() && (() => {
524
524
  var o = ee();
525
525
  return h(o, () => t.message), M((s) => {
526
- var l = $("text-foreground/50", j.emptyState(e.size())), g = n() ? "100%" : "85%";
527
- return l !== s.e && k(o, s.e = l), g !== s.t && C(o, "max-width", s.t = g), s;
526
+ var l = $("text-foreground/50", j.emptyState(e.size())), m = n() ? "100%" : "85%";
527
+ return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "max-width", s.t = m), s;
528
528
  }, {
529
529
  e: void 0,
530
530
  t: void 0
531
531
  }), o;
532
532
  })();
533
533
  })(), null), h(r, (() => {
534
- var a = N(() => !!t.action);
534
+ var a = _(() => !!t.action);
535
535
  return () => a() && (() => {
536
536
  var o = ne();
537
537
  return h(o, () => t.action), o;
538
538
  })();
539
539
  })(), null), M((a) => {
540
- var o = $("flex h-full w-full", n() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", t.class), s = W.S2(e.size()), l = W.container(e.size()), g = $("flex flex-col", n() ? "items-start text-left" : "items-center text-center"), d = W.S1(e.size());
541
- return o !== a.e && k(i, a.e = o), s !== a.t && C(i, "gap", a.t = s), l !== a.a && C(i, "padding", a.a = l), g !== a.o && k(r, a.o = g), d !== a.i && C(r, "gap", a.i = d), a;
540
+ var o = $("flex h-full w-full", n() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", t.class), s = W.S2(e.size()), l = W.container(e.size()), m = $("flex flex-col", n() ? "items-start text-left" : "items-center text-center"), d = W.S1(e.size());
541
+ return o !== a.e && k(i, a.e = o), s !== a.t && C(i, "gap", a.t = s), l !== a.a && C(i, "padding", a.a = l), m !== a.o && k(r, a.o = m), d !== a.i && C(r, "gap", a.i = d), a;
542
542
  }, {
543
543
  e: void 0,
544
544
  t: void 0,
@@ -607,24 +607,24 @@ function ue(t) {
607
607
  width: `${W.icon(e.size())}px`,
608
608
  height: `${W.icon(e.size())}px`,
609
609
  "border-radius": "var(--radius-sm, 12px)"
610
- }, g = r(), d = a();
611
- return g && Object.assign(l, g), d && Object.assign(l, d), l;
612
- }, s = (l, g, d) => {
610
+ }, m = r(), d = a();
611
+ return m && Object.assign(l, m), d && Object.assign(l, d), l;
612
+ }, s = (l, m, d) => {
613
613
  const x = {
614
614
  width: `${W.icon(e.size()) * 1.02}px`,
615
615
  height: `${W.icon(e.size()) * 1.02}px`,
616
616
  "border-radius": "var(--radius-sm, 12px)",
617
617
  bottom: `${-W.icon(e.size()) * l}px`,
618
618
  right: `${-W.icon(e.size()) * (l * 0.71)}px`,
619
- "z-index": g,
619
+ "z-index": m,
620
620
  opacity: d
621
621
  }, p = r();
622
622
  return p && Object.assign(x, p), x;
623
623
  };
624
624
  return (() => {
625
- var l = ce(), g = l.firstChild;
625
+ var l = ce(), m = l.firstChild;
626
626
  return h(l, (() => {
627
- var d = N(() => (t.entityCount ?? 1) >= 2);
627
+ var d = _(() => (t.entityCount ?? 1) >= 2);
628
628
  return () => d() && (() => {
629
629
  var x = ft();
630
630
  return M((p) => {
@@ -635,8 +635,8 @@ function ue(t) {
635
635
  t: void 0
636
636
  }), x;
637
637
  })();
638
- })(), g), h(l, (() => {
639
- var d = N(() => (t.entityCount ?? 1) >= 3);
638
+ })(), m), h(l, (() => {
639
+ var d = _(() => (t.entityCount ?? 1) >= 3);
640
640
  return () => d() && (() => {
641
641
  var x = ft();
642
642
  return M((p) => {
@@ -647,7 +647,7 @@ function ue(t) {
647
647
  t: void 0
648
648
  }), x;
649
649
  })();
650
- })(), g), h(g, () => t.icon), M((d) => {
650
+ })(), m), h(m, () => t.icon), M((d) => {
651
651
  var x = $(
652
652
  "relative flex shrink-0 items-center justify-center transition-all",
653
653
  "pointer-events-none",
@@ -658,7 +658,7 @@ function ue(t) {
658
658
  !i() && t.glow,
659
659
  t.class
660
660
  ), p = o(), c = `${W.iconSize(e.size())}px`;
661
- return x !== d.e && k(l, d.e = x), d.t = et(l, p, d.t), c !== d.a && C(g, "font-size", d.a = c), d;
661
+ return x !== d.e && k(l, d.e = x), d.t = et(l, p, d.t), c !== d.a && C(m, "font-size", d.a = c), d;
662
662
  }, {
663
663
  e: void 0,
664
664
  t: void 0,
@@ -682,20 +682,20 @@ function xe(t) {
682
682
  return (() => {
683
683
  var n = ge(), i = n.firstChild, r = i.firstChild, a = i.nextSibling;
684
684
  return h(i, (() => {
685
- var o = N(() => !!t.icon);
685
+ var o = _(() => !!t.icon);
686
686
  return () => o() && (() => {
687
687
  var s = me();
688
688
  return h(s, () => t.icon), s;
689
689
  })();
690
690
  })(), r), h(r, () => t.label), h(a, () => t.value, null), h(a, (() => {
691
- var o = N(() => !!t.unit);
691
+ var o = _(() => !!t.unit);
692
692
  return () => o() && (() => {
693
693
  var s = fe();
694
694
  return h(s, () => t.unit), s;
695
695
  })();
696
696
  })(), null), M((o) => {
697
- var s = $("flex flex-col", t.dimmed && "opacity-50", t.class), l = W.S1(e.size()), g = $("flex items-center gap-1 text-foreground/60", j.metricLabel(e.size())), d = $("font-semibold text-foreground", j.metricValue(e.size()));
698
- return s !== o.e && k(n, o.e = s), l !== o.t && C(n, "gap", o.t = l), g !== o.a && k(i, o.a = g), d !== o.o && k(a, o.o = d), o;
697
+ var s = $("flex flex-col", t.dimmed && "opacity-50", t.class), l = W.S1(e.size()), m = $("flex items-center gap-1 text-foreground/60", j.metricLabel(e.size())), d = $("font-semibold text-foreground", j.metricValue(e.size()));
698
+ return s !== o.e && k(n, o.e = s), l !== o.t && C(n, "gap", o.t = l), m !== o.a && k(i, o.a = m), d !== o.o && k(a, o.o = d), o;
699
699
  }, {
700
700
  e: void 0,
701
701
  t: void 0,
@@ -712,7 +712,7 @@ function be(t) {
712
712
  return (() => {
713
713
  var n = ve();
714
714
  return h(n, (() => {
715
- var i = N(() => !!t.isUnavailable);
715
+ var i = _(() => !!t.isUnavailable);
716
716
  return () => i() ? "Unavailable" : t.children;
717
717
  })()), M((i) => {
718
718
  var r = $("relative font-bold text-foreground", t.dimmed && "opacity-40", j.status(e.size()), t.class), a = F.ACTIONS;
@@ -737,7 +737,7 @@ function pe(t) {
737
737
  return (() => {
738
738
  var n = $e(), i = n.firstChild;
739
739
  return h(i, () => t.children), h(n, (() => {
740
- var r = N(() => t.badge !== void 0 && t.badge > 0);
740
+ var r = _(() => t.badge !== void 0 && t.badge > 0);
741
741
  return () => r() && (() => {
742
742
  var a = ke();
743
743
  return h(a, () => t.badge), M(() => k(a, $("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", j.badge(e.size())))), a;
@@ -791,11 +791,11 @@ function Se(t, e = !1) {
791
791
  };
792
792
  }
793
793
  let i = 0, r = 0, a = 0, o = 0, s = 0, l = 0;
794
- const g = [];
794
+ const m = [];
795
795
  for (const z of t)
796
796
  switch (z.state) {
797
797
  case "on":
798
- i++, z.attributes?.brightness !== void 0 && (s += z.attributes.brightness, l++), z.attributes?.rgb_color && g.push(z.attributes.rgb_color);
798
+ i++, z.attributes?.brightness !== void 0 && (s += z.attributes.brightness, l++), z.attributes?.rgb_color && m.push(z.attributes.rgb_color);
799
799
  break;
800
800
  case "off":
801
801
  r++;
@@ -811,12 +811,12 @@ function Se(t, e = !1) {
811
811
  let y, O;
812
812
  e ? x ? (y = "unavailable", O = !1) : a > 0 || o > 0 ? (y = "unknown", O = !1) : r > 0 ? (y = "off", O = !1) : (y = "on", O = !0) : x ? (y = "unavailable", O = !1) : p ? (y = "unknown", O = !1) : c ? (y = "on", O = !0) : (y = "off", O = !1);
813
813
  const P = l > 0 ? Math.round(s / l) : 0, w = Math.round(P / 255 * 100);
814
- let A;
815
- if (g.length > 0) {
816
- const z = Math.round(g.reduce((f, R) => f + R[0], 0) / g.length), S = Math.round(g.reduce((f, R) => f + R[1], 0) / g.length), E = Math.round(g.reduce((f, R) => f + R[2], 0) / g.length), I = P / 255;
817
- A = `rgb(${Math.round(z * I)}, ${Math.round(S * I)}, ${Math.round(E * I)})`;
814
+ let N;
815
+ if (m.length > 0) {
816
+ const z = Math.round(m.reduce((g, R) => g + R[0], 0) / m.length), S = Math.round(m.reduce((g, R) => g + R[1], 0) / m.length), E = Math.round(m.reduce((g, R) => g + R[2], 0) / m.length), I = P / 255;
817
+ N = `rgb(${Math.round(z * I)}, ${Math.round(S * I)}, ${Math.round(E * I)})`;
818
818
  } else
819
- A = ht(t[0]);
819
+ N = ht(t[0]);
820
820
  let T;
821
821
  return u ? T = "All on" : b ? T = "All off" : i > 0 ? T = `${i} of ${d} on` : T = "Off", {
822
822
  isGroup: n,
@@ -825,7 +825,7 @@ function Se(t, e = !1) {
825
825
  isUnavailable: y === "unavailable",
826
826
  brightness: P,
827
827
  brightnessPercent: w,
828
- color: A,
828
+ color: N,
829
829
  onCount: i,
830
830
  totalCount: d,
831
831
  description: T
@@ -875,8 +875,8 @@ function Ce(t, e = "mean", n = !0) {
875
875
  friendly_name: c.friendlyName
876
876
  }));
877
877
  }
878
- const l = o === t.length, g = r.length === 0;
879
- if (l || g)
878
+ const l = o === t.length, m = r.length === 0;
879
+ if (l || m)
880
880
  return {
881
881
  isGroup: i,
882
882
  state: l ? "unavailable" : "unknown",
@@ -1001,7 +1001,7 @@ function Te(t) {
1001
1001
  return (() => {
1002
1002
  var n = Ae(), i = n.firstChild;
1003
1003
  return h(i, () => De(t.value, t.unit)), h(n, (() => {
1004
- var r = N(() => !!(t.interpret && typeof t.value == "number"));
1004
+ var r = _(() => !!(t.interpret && typeof t.value == "number"));
1005
1005
  return () => r() && (() => {
1006
1006
  var a = Ne();
1007
1007
  return h(a, () => _e(t.value, t.unit)), M((o) => {
@@ -1036,27 +1036,27 @@ function je(t) {
1036
1036
  let e;
1037
1037
  const n = _t(() => e), i = 2, [r, a] = L(0), [o, s] = L(0);
1038
1038
  Y(() => {
1039
- const w = Math.round(n.width ?? 0), A = Math.round(n.height ?? 0), T = dt(r), z = dt(o);
1040
- (Math.abs(w - T) > i || Math.abs(A - z) > i) && (a(w), s(A));
1039
+ const w = Math.round(n.width ?? 0), N = Math.round(n.height ?? 0), T = dt(r), z = dt(o);
1040
+ (Math.abs(w - T) > i || Math.abs(N - z) > i) && (a(w), s(N));
1041
1041
  });
1042
- const l = _(() => {
1042
+ const l = A(() => {
1043
1043
  if (t.variant)
1044
1044
  return typeof t.variant == "string" ? Gt(t.variant) : t.variant;
1045
- }), g = _(() => ({
1045
+ }), m = A(() => ({
1046
1046
  width: r(),
1047
1047
  height: o(),
1048
1048
  gridWidth: Math.max(1, Math.round(r() / 150)),
1049
1049
  gridHeight: Math.max(1, Math.round(o() / 75))
1050
1050
  }), void 0, {
1051
- equals: (w, A) => w.width === A.width && w.height === A.height && w.gridWidth === A.gridWidth && w.gridHeight === A.gridHeight
1052
- }), d = _(() => {
1053
- const w = g();
1051
+ equals: (w, N) => w.width === N.width && w.height === N.height && w.gridWidth === N.gridWidth && w.gridHeight === N.gridHeight
1052
+ }), d = A(() => {
1053
+ const w = m();
1054
1054
  return He(w.gridWidth, w.gridHeight);
1055
- }), x = _(() => {
1056
- const w = g();
1055
+ }), x = A(() => {
1056
+ const w = m();
1057
1057
  return Be(w.width, w.height);
1058
- }), p = _(() => {
1059
- const w = g();
1058
+ }), p = A(() => {
1059
+ const w = m();
1060
1060
  return Le(w.width, w.height);
1061
1061
  }), c = vt(st), u = c;
1062
1062
  u?._isStub?.() && u._bridge && (Y(() => {
@@ -1066,7 +1066,7 @@ function je(t) {
1066
1066
  }), Y(() => {
1067
1067
  u._bridge.setContentLayout(p());
1068
1068
  }), Y(() => {
1069
- u._bridge.setDimensions(g());
1069
+ u._bridge.setDimensions(m());
1070
1070
  }), Y(() => {
1071
1071
  u._bridge.setIsStub(!1);
1072
1072
  }));
@@ -1074,11 +1074,11 @@ function je(t) {
1074
1074
  size: d,
1075
1075
  orientation: x,
1076
1076
  contentLayout: p,
1077
- dimensions: g,
1077
+ dimensions: m,
1078
1078
  isEditMode: () => t.isEditMode ?? !1,
1079
1079
  updateConfig: c?.updateConfig ?? (() => {
1080
1080
  })
1081
- }, y = "bg-gradient-to-br from-gray-500/20 to-gray-600/20", O = _(() => t.emptyState && !t.gradient ? y : t.gradient), P = _(() => ({
1081
+ }, y = "bg-gradient-to-br from-gray-500/20 to-gray-600/20", O = A(() => t.emptyState && !t.gradient ? y : t.gradient), P = A(() => ({
1082
1082
  "container-type": "size",
1083
1083
  "container-name": "widget",
1084
1084
  ...l()?.styles?.container,
@@ -1087,21 +1087,21 @@ function je(t) {
1087
1087
  return V(st.Provider, {
1088
1088
  value: b,
1089
1089
  get children() {
1090
- var w = Oe(), A = w.firstChild, T = A.firstChild, z = e;
1091
- return typeof z == "function" ? Ct(z, w) : e = w, h(A, (() => {
1092
- var S = N(() => !!t.backgroundGlow);
1090
+ var w = Oe(), N = w.firstChild, T = N.firstChild, z = e;
1091
+ return typeof z == "function" ? Ct(z, w) : e = w, h(N, (() => {
1092
+ var S = _(() => !!t.backgroundGlow);
1093
1093
  return () => S() && (() => {
1094
1094
  var E = Ee(), I = E.firstChild;
1095
- return M((f) => {
1095
+ return M((g) => {
1096
1096
  var R = F.BACKGROUND, H = $("absolute inset-0 opacity-20 blur-2xl", t.backgroundGlow);
1097
- return R !== f.e && C(E, "z-index", f.e = R), H !== f.t && k(I, f.t = H), f;
1097
+ return R !== g.e && C(E, "z-index", g.e = R), H !== g.t && k(I, g.t = H), g;
1098
1098
  }, {
1099
1099
  e: void 0,
1100
1100
  t: void 0
1101
1101
  }), E;
1102
1102
  })();
1103
1103
  })(), T), h(T, (() => {
1104
- var S = N(() => !!t.emptyState);
1104
+ var S = _(() => !!t.emptyState);
1105
1105
  return () => S() ? V(Pe, {
1106
1106
  get icon() {
1107
1107
  return t.emptyState.icon;
@@ -1113,8 +1113,8 @@ function je(t) {
1113
1113
  return t.emptyState.message;
1114
1114
  }
1115
1115
  }) : t.children;
1116
- })()), h(A, (() => {
1117
- var S = N(() => !!t.loading);
1116
+ })()), h(N, (() => {
1117
+ var S = _(() => !!t.loading);
1118
1118
  return () => S() && (() => {
1119
1119
  var E = Ve();
1120
1120
  return M((I) => C(E, "z-index", F.OVERLAY)), E;
@@ -1126,12 +1126,12 @@ function je(t) {
1126
1126
  l()?.styles?.class,
1127
1127
  // Custom class (highest priority)
1128
1128
  t.class
1129
- ), I = P(), f = $(
1129
+ ), I = P(), g = $(
1130
1130
  "relative h-full w-full overflow-hidden rounded-xl",
1131
1131
  // Gradient prop (overrides variant, auto-applied for empty state)
1132
1132
  O()
1133
1133
  ), R = F.CONTENT;
1134
- return E !== S.e && k(w, S.e = E), S.t = et(w, I, S.t), f !== S.a && k(A, S.a = f), R !== S.o && C(T, "z-index", S.o = R), S;
1134
+ return E !== S.e && k(w, S.e = E), S.t = et(w, I, S.t), g !== S.a && k(N, S.a = g), R !== S.o && C(T, "z-index", S.o = R), S;
1135
1135
  }, {
1136
1136
  e: void 0,
1137
1137
  t: void 0,
@@ -1145,19 +1145,19 @@ function Pe(t) {
1145
1145
  return (() => {
1146
1146
  var e = We();
1147
1147
  return h(e, (() => {
1148
- var n = N(() => !!t.icon);
1148
+ var n = _(() => !!t.icon);
1149
1149
  return () => n() && (() => {
1150
1150
  var i = Ie();
1151
1151
  return h(i, () => t.icon), i;
1152
1152
  })();
1153
1153
  })(), null), h(e, (() => {
1154
- var n = N(() => !!t.title);
1154
+ var n = _(() => !!t.title);
1155
1155
  return () => n() && (() => {
1156
1156
  var i = Re();
1157
1157
  return h(i, () => t.title), i;
1158
1158
  })();
1159
1159
  })(), null), h(e, (() => {
1160
- var n = N(() => !!t.message);
1160
+ var n = _(() => !!t.message);
1161
1161
  return () => n() && (() => {
1162
1162
  var i = Ge();
1163
1163
  return h(i, () => t.message), i;
@@ -1215,7 +1215,7 @@ function Ln(t) {
1215
1215
  }), i;
1216
1216
  })();
1217
1217
  }
1218
- var Xe = /* @__PURE__ */ v('<span class="inline-flex size-3.5 shrink-0 items-center">'), Ke = /* @__PURE__ */ v("<button type=button>"), qe = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z">'), Je = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No edit options available'), Ze = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>'), Qe = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), tn = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4">'), en = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No debug information available'), nn = /* @__PURE__ */ v('<div class="min-w-0 shrink-0">'), rn = /* @__PURE__ */ v('<div class="flex items-center gap-2"><div class="flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5">'), an = /* @__PURE__ */ v('<div class="min-h-0 flex-1 overflow-y-auto">'), on = /* @__PURE__ */ v('<div class="flex shrink-0 justify-end pt-3">');
1218
+ var Xe = /* @__PURE__ */ v('<span class="inline-flex size-3.5 shrink-0 items-center">'), Ke = /* @__PURE__ */ v("<button type=button>"), qe = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z">'), Je = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No edit options available'), Ze = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>'), Qe = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), tn = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4">'), en = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No debug information available'), nn = /* @__PURE__ */ v('<div class="min-w-0 shrink-0">'), rn = /* @__PURE__ */ v('<div class="flex items-center gap-2"><div class="flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5">'), an = /* @__PURE__ */ v('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), on = /* @__PURE__ */ v('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
1219
1219
  function sn(t) {
1220
1220
  return (() => {
1221
1221
  var e = Ke();
@@ -1232,21 +1232,21 @@ function sn(t) {
1232
1232
  }
1233
1233
  function jn(t) {
1234
1234
  const [e] = St(t, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), n = () => !!e.configSchema && !!e.config && !!e.onConfigSave && !!e.SchemaForm, [i, r] = L({}), [a, o] = L(null);
1235
- Y(gt(() => e.config, (f) => {
1236
- f && r({
1237
- ...f
1235
+ Y(gt(() => e.config, (g) => {
1236
+ g && r({
1237
+ ...g
1238
1238
  });
1239
- })), Y(gt(() => e.configSchema, (f) => {
1240
- f && o(bt(f));
1239
+ })), Y(gt(() => e.configSchema, (g) => {
1240
+ g && o(bt(g));
1241
1241
  }));
1242
- const s = () => n() && JSON.stringify(i()) !== JSON.stringify(e.config), l = (f) => {
1243
- !f && e.config && r({
1242
+ const s = () => n() && JSON.stringify(i()) !== JSON.stringify(e.config), l = (g) => {
1243
+ !g && e.config && r({
1244
1244
  ...e.config
1245
- }), e.onOpenChange(f);
1246
- }, g = () => {
1245
+ }), e.onOpenChange(g);
1246
+ }, m = () => {
1247
1247
  e.onConfigSave?.(i());
1248
1248
  }, [d, x] = L(e.defaultTab ?? "controls"), p = () => {
1249
- const f = e.maxWidth ?? "3xl";
1249
+ const g = e.maxWidth ?? "3xl";
1250
1250
  return {
1251
1251
  sm: "max-w-sm",
1252
1252
  md: "max-w-md",
@@ -1255,11 +1255,11 @@ function jn(t) {
1255
1255
  "2xl": "max-w-2xl",
1256
1256
  "3xl": "max-w-3xl",
1257
1257
  "4xl": "max-w-4xl"
1258
- }[f];
1258
+ }[g];
1259
1259
  }, c = () => {
1260
1260
  if (e.tabs) return e.tabs;
1261
- const f = [];
1262
- return f.push({
1261
+ const g = [];
1262
+ return g.push({
1263
1263
  id: "edit",
1264
1264
  label: "Edit",
1265
1265
  icon: qe(),
@@ -1272,33 +1272,33 @@ function jn(t) {
1272
1272
  },
1273
1273
  onChange: r
1274
1274
  }) : Je())
1275
- }), f.push({
1275
+ }), g.push({
1276
1276
  id: "controls",
1277
1277
  label: "Controls",
1278
1278
  icon: Ze(),
1279
1279
  content: e.controlsContent ?? Qe()
1280
- }), f.push({
1280
+ }), g.push({
1281
1281
  id: "debug",
1282
1282
  label: "Debug",
1283
1283
  icon: tn(),
1284
1284
  content: e.debugContent ?? en()
1285
- }), f;
1285
+ }), g;
1286
1286
  }, u = async () => {
1287
1287
  if (e.debugData !== void 0)
1288
1288
  try {
1289
- const f = typeof e.debugData == "string" ? e.debugData : JSON.stringify(e.debugData, null, 2);
1290
- await navigator.clipboard.writeText(f);
1289
+ const g = typeof e.debugData == "string" ? e.debugData : JSON.stringify(e.debugData, null, 2);
1290
+ await navigator.clipboard.writeText(g);
1291
1291
  } catch {
1292
1292
  }
1293
1293
  }, b = () => {
1294
- const f = c();
1295
- return f.find((H) => H.id === d())?.content ?? f[0]?.content;
1296
- }, y = e.ResponsiveDialog, O = e.ResponsiveDialogContent, P = e.ResponsiveDialogHeader, w = e.ResponsiveDialogTitle, A = e.ResponsiveDialogDescription, T = e.Button, z = e.SchemaForm, S = n() ? l : e.onOpenChange, E = n() ? s() : e.hasUnsavedChanges, I = n() ? g : e.onSave;
1294
+ const g = c();
1295
+ return g.find((H) => H.id === d())?.content ?? g[0]?.content;
1296
+ }, y = e.ResponsiveDialog, O = e.ResponsiveDialogContent, P = e.ResponsiveDialogHeader, w = e.ResponsiveDialogTitle, N = e.ResponsiveDialogDescription, T = e.Button, z = e.SchemaForm, S = (g) => n() ? l(g) : e.onOpenChange(g), E = () => n() ? s() : e.hasUnsavedChanges, I = () => n() ? m : e.onSave;
1297
1297
  return V(y, {
1298
1298
  get open() {
1299
1299
  return e.open;
1300
1300
  },
1301
- onOpenChange: S,
1301
+ onOpenChange: (g) => S(g),
1302
1302
  get children() {
1303
1303
  return V(O, {
1304
1304
  get class() {
@@ -1309,18 +1309,18 @@ function jn(t) {
1309
1309
  class: "flex flex-row items-center justify-between gap-3",
1310
1310
  get children() {
1311
1311
  return [(() => {
1312
- var f = nn();
1313
- return h(f, V(w, {
1312
+ var g = nn();
1313
+ return h(g, V(w, {
1314
1314
  class: "truncate leading-tight",
1315
1315
  get children() {
1316
1316
  return e.title;
1317
1317
  }
1318
- }), null), h(f, V(A, {
1318
+ }), null), h(g, V(N, {
1319
1319
  class: "sr-only",
1320
1320
  children: "Widget configuration dialog"
1321
- }), null), f;
1321
+ }), null), g;
1322
1322
  })(), (() => {
1323
- var f = rn(), R = f.firstChild;
1323
+ var g = rn(), R = g.firstChild;
1324
1324
  return h(R, () => c().map((H) => V(sn, {
1325
1325
  get icon() {
1326
1326
  return H.icon;
@@ -1332,54 +1332,64 @@ function jn(t) {
1332
1332
  return d() === H.id;
1333
1333
  },
1334
1334
  onClick: () => x(H.id)
1335
- }))), h(f, V(J, {
1335
+ }))), h(g, V(J, {
1336
1336
  get when() {
1337
1337
  return e.headerActions;
1338
1338
  },
1339
1339
  get children() {
1340
1340
  return e.headerActions;
1341
1341
  }
1342
- }), null), h(f, V(J, {
1343
- get when() {
1344
- return d() === "edit" && I && E;
1345
- },
1346
- get children() {
1347
- return V(T, {
1348
- size: "sm",
1349
- onClick: () => I?.(),
1350
- children: "Save"
1351
- });
1352
- }
1353
- }), null), h(f, V(J, {
1354
- get when() {
1355
- return N(() => d() === "edit")() && e.onDelete;
1356
- },
1357
- get children() {
1358
- return V(T, {
1359
- size: "sm",
1360
- variant: "destructive",
1361
- onClick: () => e.onDelete?.(),
1362
- children: "Delete"
1363
- });
1364
- }
1365
- }), null), f;
1342
+ }), null), g;
1366
1343
  })()];
1367
1344
  }
1368
1345
  }), (() => {
1369
- var f = an();
1370
- return h(f, b), f;
1346
+ var g = an();
1347
+ return h(g, b), g;
1371
1348
  })(), V(J, {
1372
1349
  get when() {
1373
- return N(() => d() === "debug")() && e.debugData !== void 0;
1350
+ return _(() => d() === "edit")() && (I() || e.onDelete) || d() === "debug" && e.debugData !== void 0;
1374
1351
  },
1375
1352
  get children() {
1376
- var f = on();
1377
- return h(f, V(T, {
1378
- size: "sm",
1379
- variant: "outline",
1380
- onClick: u,
1381
- children: "Copy"
1382
- })), f;
1353
+ var g = on();
1354
+ return h(g, V(J, {
1355
+ get when() {
1356
+ return _(() => d() === "edit")() && e.onDelete;
1357
+ },
1358
+ get children() {
1359
+ return V(T, {
1360
+ size: "sm",
1361
+ variant: "destructive",
1362
+ onClick: () => e.onDelete?.(),
1363
+ children: "Delete"
1364
+ });
1365
+ }
1366
+ }), null), h(g, V(J, {
1367
+ get when() {
1368
+ return _(() => d() === "edit")() && I();
1369
+ },
1370
+ get children() {
1371
+ return V(T, {
1372
+ size: "sm",
1373
+ get disabled() {
1374
+ return !E();
1375
+ },
1376
+ onClick: () => I()?.(),
1377
+ children: "Save"
1378
+ });
1379
+ }
1380
+ }), null), h(g, V(J, {
1381
+ get when() {
1382
+ return _(() => d() === "debug")() && e.debugData !== void 0;
1383
+ },
1384
+ get children() {
1385
+ return V(T, {
1386
+ size: "sm",
1387
+ variant: "outline",
1388
+ onClick: u,
1389
+ children: "Copy"
1390
+ });
1391
+ }
1392
+ }), null), g;
1383
1393
  }
1384
1394
  })];
1385
1395
  }
@@ -1388,7 +1398,7 @@ function jn(t) {
1388
1398
  });
1389
1399
  }
1390
1400
  Mt(["click"]);
1391
- const Q = 32, m = Q / 2, B = "white", nt = "rgba(0,0,0,0.4)", ut = 2, rt = 3;
1401
+ const Q = 32, f = Q / 2, B = "white", nt = "rgba(0,0,0,0.4)", ut = 2, rt = 3;
1392
1402
  function ln(t) {
1393
1403
  return `url("data:image/svg+xml,${encodeURIComponent(t)}")`;
1394
1404
  }
@@ -1408,47 +1418,47 @@ const cn = it(`
1408
1418
  </g>
1409
1419
  `), un = it(`
1410
1420
  <g>
1411
- <circle cx="${m}" cy="${m}" r="8" stroke="${nt}" stroke-width="${rt}" fill="none"/>
1412
- <circle cx="${m}" cy="${m}" r="8" stroke="${B}" stroke-width="1.5" fill="none"/>
1413
- <circle cx="${m}" cy="${m}" r="1.5" fill="${B}"/>
1421
+ <circle cx="${f}" cy="${f}" r="8" stroke="${nt}" stroke-width="${rt}" fill="none"/>
1422
+ <circle cx="${f}" cy="${f}" r="8" stroke="${B}" stroke-width="1.5" fill="none"/>
1423
+ <circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
1414
1424
  </g>
1415
1425
  `), dn = it(`
1416
1426
  <g>
1417
1427
  <!-- shadow -->
1418
1428
  <g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1419
- <line x1="6" y1="${m}" x2="26" y2="${m}"/>
1420
- <polyline points="10,${m - 4} 6,${m} 10,${m + 4}"/>
1421
- <polyline points="22,${m - 4} 26,${m} 22,${m + 4}"/>
1429
+ <line x1="6" y1="${f}" x2="26" y2="${f}"/>
1430
+ <polyline points="10,${f - 4} 6,${f} 10,${f + 4}"/>
1431
+ <polyline points="22,${f - 4} 26,${f} 22,${f + 4}"/>
1422
1432
  </g>
1423
1433
  <!-- main -->
1424
1434
  <g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1425
- <line x1="6" y1="${m}" x2="26" y2="${m}"/>
1426
- <polyline points="10,${m - 4} 6,${m} 10,${m + 4}"/>
1427
- <polyline points="22,${m - 4} 26,${m} 22,${m + 4}"/>
1435
+ <line x1="6" y1="${f}" x2="26" y2="${f}"/>
1436
+ <polyline points="10,${f - 4} 6,${f} 10,${f + 4}"/>
1437
+ <polyline points="22,${f - 4} 26,${f} 22,${f + 4}"/>
1428
1438
  </g>
1429
1439
  <!-- center grip dots -->
1430
- <circle cx="${m}" cy="${m}" r="1.5" fill="${B}"/>
1431
- <circle cx="${m - 5}" cy="${m}" r="1" fill="${B}" opacity="0.6"/>
1432
- <circle cx="${m + 5}" cy="${m}" r="1" fill="${B}" opacity="0.6"/>
1440
+ <circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
1441
+ <circle cx="${f - 5}" cy="${f}" r="1" fill="${B}" opacity="0.6"/>
1442
+ <circle cx="${f + 5}" cy="${f}" r="1" fill="${B}" opacity="0.6"/>
1433
1443
  </g>
1434
1444
  `), gn = it(`
1435
1445
  <g>
1436
1446
  <!-- shadow -->
1437
1447
  <g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1438
- <line x1="${m}" y1="6" x2="${m}" y2="26"/>
1439
- <polyline points="${m - 4},10 ${m},6 ${m + 4},10"/>
1440
- <polyline points="${m - 4},22 ${m},26 ${m + 4},22"/>
1448
+ <line x1="${f}" y1="6" x2="${f}" y2="26"/>
1449
+ <polyline points="${f - 4},10 ${f},6 ${f + 4},10"/>
1450
+ <polyline points="${f - 4},22 ${f},26 ${f + 4},22"/>
1441
1451
  </g>
1442
1452
  <!-- main -->
1443
1453
  <g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1444
- <line x1="${m}" y1="6" x2="${m}" y2="26"/>
1445
- <polyline points="${m - 4},10 ${m},6 ${m + 4},10"/>
1446
- <polyline points="${m - 4},22 ${m},26 ${m + 4},22"/>
1454
+ <line x1="${f}" y1="6" x2="${f}" y2="26"/>
1455
+ <polyline points="${f - 4},10 ${f},6 ${f + 4},10"/>
1456
+ <polyline points="${f - 4},22 ${f},26 ${f + 4},22"/>
1447
1457
  </g>
1448
1458
  <!-- center grip dots -->
1449
- <circle cx="${m}" cy="${m}" r="1.5" fill="${B}"/>
1450
- <circle cx="${m}" cy="${m - 5}" r="1" fill="${B}" opacity="0.6"/>
1451
- <circle cx="${m}" cy="${m + 5}" r="1" fill="${B}" opacity="0.6"/>
1459
+ <circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
1460
+ <circle cx="${f}" cy="${f - 5}" r="1" fill="${B}" opacity="0.6"/>
1461
+ <circle cx="${f}" cy="${f + 5}" r="1" fill="${B}" opacity="0.6"/>
1452
1462
  </g>
1453
1463
  `);
1454
1464
  function tt(t, e, n) {
@@ -1457,8 +1467,8 @@ function tt(t, e, n) {
1457
1467
  const K = {
1458
1468
  tap: tt(cn, 12, 4),
1459
1469
  hold: tt(un, 16, 16),
1460
- slideHorizontal: tt(dn, m, m),
1461
- slideVertical: tt(gn, m, m)
1470
+ slideHorizontal: tt(dn, f, f),
1471
+ slideVertical: tt(gn, f, f)
1462
1472
  };
1463
1473
  function Pn(t, e) {
1464
1474
  const n = {
@@ -1505,16 +1515,16 @@ function Pn(t, e) {
1505
1515
  if (!n.isDown) return;
1506
1516
  const u = t();
1507
1517
  n.currentX = c.clientX, n.currentY = c.clientY;
1508
- const b = n.currentX - n.startX, y = n.currentY - n.startY, O = Math.abs(b), P = Math.abs(y), w = Math.sqrt(b * b + y * y), A = c.currentTarget, T = o(A);
1518
+ const b = n.currentX - n.startX, y = n.currentY - n.startY, O = Math.abs(b), P = Math.abs(y), w = Math.sqrt(b * b + y * y), N = c.currentTarget, T = o(N);
1509
1519
  if (!n.lockedAxis && w > r && (O > P ? n.lockedAxis = "horizontal" : n.lockedAxis = "vertical", u.slide && n.lockedAxis !== T)) {
1510
- A.releasePointerCapture(c.pointerId), n.isDown = !1, n.slideActive = !1, a();
1520
+ N.releasePointerCapture(c.pointerId), n.isDown = !1, n.slideActive = !1, a();
1511
1521
  return;
1512
1522
  }
1513
1523
  if (w > i && (n.hasMoved = !0, a()), u.slide && n.slideActive && n.hasMoved && n.lockedAxis === T) {
1514
- const z = u.slide.min ?? 0, S = u.slide.max ?? 100, E = S - z, I = T === "vertical" ? -y : b, f = T === "vertical" ? c.currentTarget.clientHeight : c.currentTarget.clientWidth, H = I / f * E, kt = Math.max(z, Math.min(S, u.slide.value + H));
1524
+ const z = u.slide.min ?? 0, S = u.slide.max ?? 100, E = S - z, I = T === "vertical" ? -y : b, g = T === "vertical" ? c.currentTarget.clientHeight : c.currentTarget.clientWidth, H = I / g * E, kt = Math.max(z, Math.min(S, u.slide.value + H));
1515
1525
  u.slide.onChange(Math.round(kt)), n.startX = n.currentX, n.startY = n.currentY, c.preventDefault();
1516
1526
  }
1517
- }, g = (c) => {
1527
+ }, m = (c) => {
1518
1528
  if (!n.isDown) return;
1519
1529
  const u = t(), b = u.hold?.delay ?? 300;
1520
1530
  if (a(), u.tap && !n.hasMoved) {
@@ -1538,7 +1548,7 @@ function Pn(t, e) {
1538
1548
  return {
1539
1549
  onPointerDown: s,
1540
1550
  onPointerMove: l,
1541
- onPointerUp: g,
1551
+ onPointerUp: m,
1542
1552
  onPointerCancel: d,
1543
1553
  onPointerEnter: (c) => {
1544
1554
  const u = c.currentTarget;
@@ -1548,7 +1558,7 @@ function Pn(t, e) {
1548
1558
  };
1549
1559
  }
1550
1560
  function Fn(t) {
1551
- return _(() => {
1561
+ return A(() => {
1552
1562
  const e = t.entities();
1553
1563
  if (e.length === 0) return;
1554
1564
  const n = {
@@ -1608,10 +1618,10 @@ function Yn(t = "edit") {
1608
1618
  };
1609
1619
  }
1610
1620
  function Xn(t) {
1611
- const e = _(() => t.entity() !== null), n = _(() => {
1621
+ const e = A(() => t.entity() !== null), n = A(() => {
1612
1622
  const r = t.entity();
1613
1623
  return r ? t.calculateData(r) : null;
1614
- }), i = _(() => e() ? void 0 : t.emptyStateConfig);
1624
+ }), i = A(() => e() ? void 0 : t.emptyStateConfig);
1615
1625
  return {
1616
1626
  entity: t.entity,
1617
1627
  data: n,
@@ -1620,7 +1630,7 @@ function Xn(t) {
1620
1630
  };
1621
1631
  }
1622
1632
  function Kn(t) {
1623
- const e = t.minEntities ?? 1, n = _(() => t.entities().length), i = _(() => n() >= e), r = _(() => !i() || !t.calculateGroupData ? null : t.calculateGroupData(t.entities())), a = _(() => {
1633
+ const e = t.minEntities ?? 1, n = A(() => t.entities().length), i = A(() => n() >= e), r = A(() => !i() || !t.calculateGroupData ? null : t.calculateGroupData(t.entities())), a = A(() => {
1624
1634
  if (!i()) return;
1625
1635
  const s = t.aggregationMode?.();
1626
1636
  if (!s || s === "none") return;
@@ -1628,10 +1638,10 @@ function Kn(t) {
1628
1638
  if (s === "light" || s === "binary-sensor" || s === "switch")
1629
1639
  return Se(l, t.allEntitiesMode);
1630
1640
  if (s === "sensor") {
1631
- const g = t.sensorGroupType?.() ?? "mean";
1632
- return Ce(l, g, !0);
1641
+ const m = t.sensorGroupType?.() ?? "mean";
1642
+ return Ce(l, m, !0);
1633
1643
  }
1634
- }), o = _(() => i() ? void 0 : t.emptyStateConfig);
1644
+ }), o = A(() => i() ? void 0 : t.emptyStateConfig);
1635
1645
  return {
1636
1646
  entities: t.entities,
1637
1647
  groupData: r,
@@ -1645,7 +1655,7 @@ function qn(t) {
1645
1655
  const [e] = At({
1646
1656
  validate: Nt(t.schema),
1647
1657
  initialValues: t.initialValues
1648
- }), n = _(() => e.dirty), i = _(() => e.submitting);
1658
+ }), n = A(() => e.dirty), i = A(() => e.submitting);
1649
1659
  return {
1650
1660
  form: e,
1651
1661
  isDirty: n,
@@ -1660,13 +1670,13 @@ function qn(t) {
1660
1670
  }
1661
1671
  const at = ["xs", "sm", "md", "lg", "xl"];
1662
1672
  function Jn() {
1663
- const t = G(), e = _(() => at.indexOf(t.size())), n = _(() => {
1673
+ const t = G(), e = A(() => at.indexOf(t.size())), n = A(() => {
1664
1674
  const l = t.size();
1665
1675
  return l === "xs" || l === "sm";
1666
- }), i = _(() => {
1676
+ }), i = A(() => {
1667
1677
  const l = t.size();
1668
1678
  return l === "lg" || l === "xl";
1669
- }), r = _(() => e() >= 2);
1679
+ }), r = A(() => e() >= 2);
1670
1680
  return {
1671
1681
  isCompact: n,
1672
1682
  isLarge: i,
@@ -1674,16 +1684,16 @@ function Jn() {
1674
1684
  showOn: (l) => l.includes(t.size()),
1675
1685
  hideOn: (l) => !l.includes(t.size()),
1676
1686
  matches: (l) => {
1677
- const g = l.trim();
1678
- if (g.endsWith("+")) {
1679
- const d = g.slice(0, -1), x = at.indexOf(d);
1687
+ const m = l.trim();
1688
+ if (m.endsWith("+")) {
1689
+ const d = m.slice(0, -1), x = at.indexOf(d);
1680
1690
  return x >= 0 && e() >= x;
1681
1691
  }
1682
- if (g.endsWith("-")) {
1683
- const d = g.slice(0, -1), x = at.indexOf(d);
1692
+ if (m.endsWith("-")) {
1693
+ const d = m.slice(0, -1), x = at.indexOf(d);
1684
1694
  return x >= 0 && e() <= x;
1685
1695
  }
1686
- return t.size() === g;
1696
+ return t.size() === m;
1687
1697
  }
1688
1698
  };
1689
1699
  }
@@ -1943,7 +1953,7 @@ function rr(t) {
1943
1953
  function ir() {
1944
1954
  return document.documentElement.classList.contains("dark");
1945
1955
  }
1946
- const fn = "0.3.0", hn = {
1956
+ const fn = "0.3.3", hn = {
1947
1957
  version: fn
1948
1958
  }, ar = hn.version;
1949
1959
  export {
package/dist/schemas.d.ts CHANGED
@@ -25,7 +25,23 @@ export declare const WidgetManifestSchema: z.ZodObject<{
25
25
  icon: z.ZodOptional<z.ZodString>;
26
26
  schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
27
  defaultConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
- }, z.core.$strip>;
28
+ version: z.ZodOptional<z.ZodString>;
29
+ displayName: z.ZodOptional<z.ZodString>;
30
+ scope: z.ZodOptional<z.ZodString>;
31
+ author: z.ZodOptional<z.ZodString>;
32
+ license: z.ZodOptional<z.ZodString>;
33
+ homepage: z.ZodOptional<z.ZodString>;
34
+ source: z.ZodOptional<z.ZodString>;
35
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
+ isOfficial: z.ZodOptional<z.ZodBoolean>;
37
+ sha256Hash: z.ZodOptional<z.ZodString>;
38
+ bundleUrl: z.ZodOptional<z.ZodString>;
39
+ _registry: z.ZodOptional<z.ZodEnum<{
40
+ local: "local";
41
+ hub: "hub";
42
+ }>>;
43
+ releaseNotes: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$loose>;
29
45
  export declare const PublishRequestSchema: z.ZodObject<{
30
46
  action: z.ZodLiteral<"request">;
31
47
  scope: z.ZodString;
package/dist/schemas.js CHANGED
@@ -2,7 +2,7 @@ import { z as n } from "zod";
2
2
  const t = n.object({
3
3
  w: n.number().int().min(1),
4
4
  h: n.number().int().min(1)
5
- }), u = n.object({
5
+ }), p = n.object({
6
6
  name: n.string().min(1),
7
7
  description: n.string().optional(),
8
8
  minSize: t,
@@ -10,10 +10,26 @@ const t = n.object({
10
10
  sdkVersion: n.string().min(1),
11
11
  icon: n.string().optional(),
12
12
  schema: n.record(n.string(), n.unknown()).optional(),
13
- defaultConfig: n.record(n.string(), n.unknown()).optional()
14
- }), o = /^[a-z0-9][a-z0-9-]*$/, a = n.object({
13
+ defaultConfig: n.record(n.string(), n.unknown()).optional(),
14
+ // Round-trip fields set by the Hub / widget browser when installing. These
15
+ // must validate so real manifests stringified from WidgetRegistryEntry
16
+ // pass through the canonical schema without being stripped.
17
+ version: n.string().optional(),
18
+ displayName: n.string().optional(),
19
+ scope: n.string().optional(),
20
+ author: n.string().optional(),
21
+ license: n.string().optional(),
22
+ homepage: n.string().url().optional(),
23
+ source: n.string().url().optional(),
24
+ permissions: n.array(n.string()).optional(),
25
+ isOfficial: n.boolean().optional(),
26
+ sha256Hash: n.string().optional(),
27
+ bundleUrl: n.string().optional(),
28
+ _registry: n.enum(["hub", "local"]).optional(),
29
+ releaseNotes: n.string().optional()
30
+ }).passthrough(), r = /^[a-z0-9][a-z0-9-]*$/, a = n.object({
15
31
  action: n.literal("request"),
16
- scope: n.string().regex(o, "Must be lowercase alphanumeric with hyphens"),
32
+ scope: n.string().regex(r, "Must be lowercase alphanumeric with hyphens"),
17
33
  name: n.string().min(1),
18
34
  displayName: n.string().min(1),
19
35
  description: n.string().optional(),
@@ -28,36 +44,36 @@ const t = n.object({
28
44
  }), c = n.object({
29
45
  action: n.literal("confirm"),
30
46
  versionId: n.string().min(1)
31
- }), p = n.discriminatedUnion("action", [
47
+ }), m = n.discriminatedUnion("action", [
32
48
  a,
33
49
  c
34
50
  ]);
35
- function h(i) {
51
+ function g(i) {
36
52
  return JSON.stringify(i);
37
53
  }
38
- function l(i, e = { w: 1, h: 1 }) {
54
+ function u(i, o = { w: 1, h: 1 }) {
39
55
  if (i != null && typeof i == "object") {
40
56
  const s = t.safeParse(i);
41
57
  if (s.success) return s.data;
42
58
  }
43
59
  if (typeof i == "string")
44
60
  try {
45
- const s = JSON.parse(i), r = t.safeParse(s);
46
- if (r.success) return r.data;
61
+ const s = JSON.parse(i), e = t.safeParse(s);
62
+ if (e.success) return e.data;
47
63
  } catch {
48
64
  }
49
- return e;
65
+ return o;
50
66
  }
51
- function g(i) {
52
- return i.issues.map((e) => `${e.path.length > 0 ? e.path.join(".") : "(root)"}: ${e.message}`).join("; ");
67
+ function h(i) {
68
+ return i.issues.map((o) => `${o.path.length > 0 ? o.path.join(".") : "(root)"}: ${o.message}`).join("; ");
53
69
  }
54
70
  export {
55
71
  t as GridSizeSchema,
56
- p as PublishBodySchema,
72
+ m as PublishBodySchema,
57
73
  c as PublishConfirmSchema,
58
74
  a as PublishRequestSchema,
59
- u as WidgetManifestSchema,
60
- g as formatSchemaError,
61
- l as parseGridSize,
62
- h as serializeGridSize
75
+ p as WidgetManifestSchema,
76
+ h as formatSchemaError,
77
+ u as parseGridSize,
78
+ g as serializeGridSize
63
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/widget-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "description": "SDK for building GlassHome dashboard widgets with SolidJS",
5
5
  "keywords": [
6
6
  "glasshome",