@jasonshimmy/custom-elements-runtime 3.1.0 → 3.1.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 (34) hide show
  1. package/dist/custom-elements-runtime.cjs.js +1 -1
  2. package/dist/custom-elements-runtime.es.js +3 -3
  3. package/dist/custom-elements-runtime.jit-css.cjs.js +1 -1
  4. package/dist/custom-elements-runtime.jit-css.es.js +2 -2
  5. package/dist/custom-elements-runtime.router.cjs.js +1 -1
  6. package/dist/custom-elements-runtime.router.es.js +2 -2
  7. package/dist/custom-elements-runtime.ssr-middleware.cjs.js +1 -1
  8. package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -1
  9. package/dist/custom-elements-runtime.ssr-middleware.es.js +36 -30
  10. package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -1
  11. package/dist/custom-elements-runtime.ssr.cjs.js +3 -3
  12. package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
  13. package/dist/custom-elements-runtime.ssr.es.js +121 -100
  14. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  15. package/dist/{hooks-B50HhrHh.cjs → hooks-x8M4knLc.cjs} +4 -4
  16. package/dist/hooks-x8M4knLc.cjs.map +1 -0
  17. package/dist/{hooks-Cze3o-F7.js → hooks-xWZhQHco.js} +202 -199
  18. package/dist/hooks-xWZhQHco.js.map +1 -0
  19. package/dist/runtime/render.d.ts +0 -11
  20. package/dist/runtime/scheduler.d.ts +12 -0
  21. package/dist/runtime/ssr-context.d.ts +3 -1
  22. package/dist/runtime/ssr-utils.d.ts +9 -0
  23. package/dist/runtime/vdom-ssr-dsd.d.ts +25 -1
  24. package/dist/runtime/vdom-ssr.d.ts +2 -6
  25. package/dist/template-compiler-CTUhEHr8.cjs +22 -0
  26. package/dist/template-compiler-CTUhEHr8.cjs.map +1 -0
  27. package/dist/{template-compiler-DtpNsqE-.js → template-compiler-ZhSg1yPh.js} +902 -922
  28. package/dist/template-compiler-ZhSg1yPh.js.map +1 -0
  29. package/package.json +1 -1
  30. package/dist/hooks-B50HhrHh.cjs.map +0 -1
  31. package/dist/hooks-Cze3o-F7.js.map +0 -1
  32. package/dist/template-compiler-Cshhqxyd.cjs +0 -23
  33. package/dist/template-compiler-Cshhqxyd.cjs.map +0 -1
  34. package/dist/template-compiler-DtpNsqE-.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as g, d as D } from "./logger-BvkEbVM4.js";
1
+ import { a as m, d as T } from "./logger-BvkEbVM4.js";
2
2
  import { m as G, s as X } from "./css-utils-Cg4o1MqY.js";
3
3
  function K() {
4
4
  const r = (() => {
@@ -70,7 +70,7 @@ class Z {
70
70
  try {
71
71
  n();
72
72
  } catch (t) {
73
- D("Error in batched update:", t);
73
+ T("Error in batched update:", t);
74
74
  }
75
75
  } finally {
76
76
  this.isFlushing = !1;
@@ -119,7 +119,7 @@ class Z {
119
119
  */
120
120
  performPeriodicCleanup() {
121
121
  const e = Date.now();
122
- e - this.lastCleanup < this.CLEANUP_INTERVAL || (this.pendingUpdates.size > 100 && g(
122
+ e - this.lastCleanup < this.CLEANUP_INTERVAL || (this.pendingUpdates.size > 100 && m(
123
123
  `Scheduler has ${this.pendingUpdates.size} pending updates. Consider investigating.`
124
124
  ), this.lastCleanup = e);
125
125
  }
@@ -128,7 +128,7 @@ class Z {
128
128
  * @param queue - The specific map to trim; defaults to the normal queue.
129
129
  */
130
130
  performEmergencyCleanup(e = this.pendingUpdates) {
131
- g(
131
+ m(
132
132
  "Scheduler emergency cleanup: too many pending updates, clearing oldest entries"
133
133
  );
134
134
  const n = Array.from(e.entries()), t = Math.floor(n.length / 2);
@@ -155,7 +155,7 @@ class Z {
155
155
  try {
156
156
  e();
157
157
  } catch (o) {
158
- D("Error in immediate update:", o);
158
+ T("Error in immediate update:", o);
159
159
  }
160
160
  return;
161
161
  }
@@ -216,7 +216,7 @@ class Z {
216
216
  try {
217
217
  n[t][1]();
218
218
  } catch (s) {
219
- D("Error in idle update:", s);
219
+ T("Error in idle update:", s);
220
220
  }
221
221
  }
222
222
  }
@@ -236,13 +236,13 @@ function ue() {
236
236
  let n = 0;
237
237
  for (; S.hasPendingUpdates && n < 100; )
238
238
  S.flushImmediately(), n++;
239
- n >= 100 && g(
239
+ n >= 100 && m(
240
240
  "[nextTick] Maximum flush iterations reached — possible circular update loop. Check for watchers or computed values that unconditionally mutate reactive state."
241
241
  ), queueMicrotask(r);
242
242
  });
243
243
  }
244
244
  const I = /* @__PURE__ */ new WeakSet();
245
- class J {
245
+ class Y {
246
246
  static cache = /* @__PURE__ */ new WeakMap();
247
247
  static arrayHandlerCache = /* @__PURE__ */ new WeakMap();
248
248
  static objectHandlerCache = /* @__PURE__ */ new WeakMap();
@@ -278,9 +278,9 @@ class J {
278
278
  "reverse",
279
279
  "fill",
280
280
  "copyWithin"
281
- ].includes(s) ? function(...u) {
282
- const c = i.apply(t, u);
283
- return e.triggerUpdate(), c;
281
+ ].includes(s) ? function(...l) {
282
+ const a = i.apply(t, l);
283
+ return e.triggerUpdate(), a;
284
284
  } : i !== null && typeof i == "object" && typeof s == "string" ? e.makeReactiveValue(i) : i;
285
285
  },
286
286
  set: (t, s, o) => (t[s] = e.makeReactiveValue(o), e.triggerUpdate(), !0),
@@ -350,7 +350,7 @@ class $ {
350
350
  return i || (i = {
351
351
  triggerUpdate: n,
352
352
  makeReactiveValue: t
353
- }, o.set(t, i)), J.getOrCreateProxy(e, i, s);
353
+ }, o.set(t, i)), Y.getOrCreateProxy(e, i, s);
354
354
  }
355
355
  /**
356
356
  * Mark an object as a proxy (for optimization)
@@ -363,23 +363,23 @@ class $ {
363
363
  }
364
364
  }
365
365
  }
366
- let T = !1;
367
- function h() {
368
- return T;
366
+ let D = !1;
367
+ function p() {
368
+ return D;
369
369
  }
370
370
  function le() {
371
- T && g(
371
+ D && m(
372
372
  "[CER] beginDiscoveryRender() called while a discovery render is already active. This usually means a component was registered inside another component's render function. Ensure component() calls are at module top-level."
373
- ), T = !0;
373
+ ), D = !0;
374
374
  }
375
375
  function de() {
376
- T = !1;
376
+ D = !1;
377
377
  }
378
- let Q = 0;
379
- function R(r) {
380
- return `${r}-${++Q}`;
378
+ let J = 0;
379
+ function A(r) {
380
+ return `${r}-${++J}`;
381
381
  }
382
- class Y {
382
+ class Q {
383
383
  // Use a stack to support nested callers (component render -> watcher)
384
384
  // so that watchers can temporarily become the "current component" while
385
385
  // establishing dependencies without clobbering the outer component id.
@@ -542,7 +542,7 @@ class Y {
542
542
  s.startsWith(t) && this.stateStorage.delete(s);
543
543
  }
544
544
  }
545
- const d = new Y();
545
+ const d = new Q();
546
546
  class x {
547
547
  _value;
548
548
  /** The unwrapped value last assigned — used for Object.is equality checks. */
@@ -563,7 +563,7 @@ class x {
563
563
  return d.trackDependency(this), this._value;
564
564
  }
565
565
  set value(e) {
566
- Object.is(e, this._rawValue) || (d.isRenderingComponent() && d.shouldEmitRenderWarning() && g(
566
+ Object.is(e, this._rawValue) || (d.isRenderingComponent() && d.shouldEmitRenderWarning() && m(
567
567
  `🚨 State modification detected during render! This can cause infinite loops.
568
568
  • Move state updates to event handlers
569
569
  • Use watchEffect/watch for side effects
@@ -623,7 +623,7 @@ function C(r) {
623
623
  }
624
624
  function he(r) {
625
625
  let e, n = !0;
626
- const t = R("computed"), s = () => {
626
+ const t = A("computed"), s = () => {
627
627
  n = !0;
628
628
  };
629
629
  try {
@@ -638,9 +638,9 @@ function he(r) {
638
638
  };
639
639
  }
640
640
  function pe(r) {
641
- if (h()) return () => {
641
+ if (p()) return () => {
642
642
  };
643
- const e = R("effect");
643
+ const e = A("effect");
644
644
  try {
645
645
  const t = d.getCurrentComponentId();
646
646
  t && d.registerWatcher(t, e);
@@ -664,7 +664,7 @@ function N(r, e = /* @__PURE__ */ new WeakMap(), n = 0) {
664
664
  const t = r;
665
665
  if (e.has(t)) return e.get(t);
666
666
  if (n > H)
667
- return g(
667
+ return m(
668
668
  `[watch] Deep clone exceeded ${H} nesting levels. Returning a reference at this depth instead of cloning further. Consider restructuring your state or switching to a shallow watch.`
669
669
  ), r;
670
670
  if (typeof Node < "u" && t instanceof Node) return r;
@@ -690,24 +690,24 @@ function N(r, e = /* @__PURE__ */ new WeakMap(), n = 0) {
690
690
  return s;
691
691
  }
692
692
  function ge(r, e, n) {
693
- if (h()) return () => {
693
+ if (p()) return () => {
694
694
  };
695
695
  let t;
696
- const s = C(r) ? () => r.value : r, o = R("watch");
696
+ const s = C(r) ? () => r.value : r, o = A("watch");
697
697
  try {
698
- const a = d.getCurrentComponentId();
699
- a && d.registerWatcher(a, o);
698
+ const c = d.getCurrentComponentId();
699
+ c && d.registerWatcher(c, o);
700
700
  } catch {
701
701
  }
702
702
  const i = () => {
703
703
  d.setCurrentComponent(o, i);
704
- const a = s();
704
+ const c = s();
705
705
  if (d.clearCurrentComponent(), n?.deep) {
706
- const u = d.withoutTracking(
707
- () => N(a)
706
+ const l = d.withoutTracking(
707
+ () => N(c)
708
708
  );
709
- e(u, t), t = u;
710
- } else a !== t && (e(a, t), t = a);
709
+ e(l, t), t = l;
710
+ } else c !== t && (e(c, t), t = c);
711
711
  };
712
712
  return d.setCurrentComponent(o, i), t = s(), d.clearCurrentComponent(), n?.deep && (t = d.withoutTracking(() => N(t))), n && n.immediate && e(t, void 0), () => {
713
713
  d.cleanup(o);
@@ -755,12 +755,12 @@ function y(r) {
755
755
  if (!r) return "";
756
756
  const e = String(r);
757
757
  if (typeof document < "u" && typeof document.createElement == "function") {
758
- const a = e.replace(/</g, "").replace(/>/g, ""), u = L || (L = document.createElement("div"));
758
+ const c = e.replace(/</g, "").replace(/>/g, ""), l = L || (L = document.createElement("div"));
759
759
  try {
760
- y._el = u;
760
+ y._el = l;
761
761
  } catch {
762
762
  }
763
- return u.innerHTML = a, (u.textContent || "").replace(new RegExp("", "g"), "<").replace(new RegExp("", "g"), ">");
763
+ return l.innerHTML = c, (l.textContent || "").replace(new RegExp("", "g"), "<").replace(new RegExp("", "g"), ">");
764
764
  }
765
765
  const n = {
766
766
  lt: "<",
@@ -785,11 +785,11 @@ function y(r) {
785
785
  "../entities.json",
786
786
  "./entities.json"
787
787
  ];
788
- for (const a of i)
788
+ for (const c of i)
789
789
  try {
790
- const u = o(a);
791
- if (u && typeof u == "object") {
792
- s = u;
790
+ const l = o(c);
791
+ if (l && typeof l == "object") {
792
+ s = l;
793
793
  break;
794
794
  }
795
795
  } catch {
@@ -820,7 +820,7 @@ function y(r) {
820
820
  } catch {
821
821
  }
822
822
  try {
823
- g(
823
+ m(
824
824
  "decodeEntities: using small SSR fallback entity map. Register the full entities.json via registerEntityMap(entities) on the server to enable full HTML5 named-entity decoding."
825
825
  );
826
826
  } catch {
@@ -828,11 +828,11 @@ function y(r) {
828
828
  }
829
829
  return e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (o, i) => {
830
830
  if (i.charCodeAt(0) === 35) {
831
- const c = (i.charAt(1) || "").toLowerCase() === "x" ? parseInt(i.slice(2), 16) : parseInt(i.slice(1), 10);
832
- return Number.isNaN(c) ? `&${i};` : String.fromCodePoint(c);
831
+ const a = (i.charAt(1) || "").toLowerCase() === "x" ? parseInt(i.slice(2), 16) : parseInt(i.slice(1), 10);
832
+ return Number.isNaN(a) ? `&${i};` : String.fromCodePoint(a);
833
833
  }
834
- const a = s[i] ?? (t && t[i]);
835
- return a !== void 0 ? a : `&${i};`;
834
+ const c = s[i] ?? (t && t[i]);
835
+ return c !== void 0 ? c : `&${i};`;
836
836
  });
837
837
  }
838
838
  async function z() {
@@ -921,7 +921,7 @@ function Ee(r, e, n) {
921
921
  const t = String(e).split("."), s = t.pop();
922
922
  if (!s) return;
923
923
  const o = t.reduce(
924
- (i, a) => (i[a] == null && (i[a] = {}), i[a]),
924
+ (i, c) => (i[c] == null && (i[c] = {}), i[c]),
925
925
  r
926
926
  );
927
927
  C(o[s]) ? o[s].value = n : o[s] = n;
@@ -955,31 +955,35 @@ function ve(r) {
955
955
  }
956
956
  return !1;
957
957
  }
958
- let w = null;
958
+ let b = null;
959
959
  function Me() {
960
- w = [];
960
+ if (b !== null)
961
+ throw new Error(
962
+ "[CER] Concurrent SSR render detected: beginSSRGlobalStyleCollection() called while a collection is already active. For concurrent request handling, use worker threads or multiple Node.js processes."
963
+ );
964
+ b = [];
961
965
  }
962
- function De() {
963
- const r = w ?? [];
964
- return w = null, r;
966
+ function Te() {
967
+ const r = b ?? [];
968
+ return b = null, r;
965
969
  }
966
970
  function re(r) {
967
- return w !== null ? (r && !w.includes(r) && w.push(r), !0) : !1;
971
+ return b !== null ? (r && !b.includes(r) && b.push(r), !0) : !1;
968
972
  }
969
- function Te(r, e, n = "unknown") {
973
+ function De(r, e, n = "unknown") {
970
974
  const t = {};
971
- for (const [u, c] of Object.entries(e ?? {}))
972
- t[F(u)] = c;
975
+ for (const [a, g] of Object.entries(e ?? {}))
976
+ t[F(a)] = g;
973
977
  const s = {
974
- getAttribute(u) {
975
- const c = F(u);
976
- if (t[c] !== void 0 && t[c] !== null)
977
- return String(t[c]);
978
- const m = (e ?? {})[u];
979
- return m != null ? String(m) : null;
978
+ getAttribute(a) {
979
+ const g = F(a);
980
+ if (t[g] !== void 0 && t[g] !== null)
981
+ return String(t[g]);
982
+ const h = (e ?? {})[a];
983
+ return h != null ? String(h) : null;
980
984
  },
981
- hasAttribute(u) {
982
- return this.getAttribute(u) !== null;
985
+ hasAttribute(a) {
986
+ return this.getAttribute(a) !== null;
983
987
  },
984
988
  // shadowRoot must be null so useJITCSS() doesn't try to registerJITCSSComponent
985
989
  shadowRoot: null,
@@ -1001,48 +1005,46 @@ function Te(r, e, n = "unknown") {
1001
1005
  writable: !0,
1002
1006
  enumerable: !1,
1003
1007
  configurable: !0
1004
- }), A(o);
1005
- let i = null;
1008
+ }), R(o);
1009
+ let i = null, c;
1006
1010
  try {
1007
- const u = r.render(
1011
+ const a = r.render(
1008
1012
  o
1009
1013
  );
1010
- u instanceof Promise ? g(
1011
- `[SSR] Component "${n}" has an async render function. Async renders are not supported in the synchronous SSR pass — the shadow DOM will be empty and hydrated on the client instead.`
1012
- ) : i = u;
1013
- } catch (u) {
1014
- g(
1014
+ a instanceof Promise ? c = a : i = a;
1015
+ } catch (a) {
1016
+ m(
1015
1017
  `[SSR] Component "${n}" threw during SSR render. The shadow DOM will be empty. Error:`,
1016
- u
1018
+ a
1017
1019
  );
1018
1020
  } finally {
1019
1021
  q();
1020
1022
  }
1021
- const a = String(
1023
+ const l = String(
1022
1024
  o._computedStyle ?? ""
1023
1025
  );
1024
- return { shadowVNode: i, useStyleCSS: a };
1026
+ return { shadowVNode: i, useStyleCSS: l, asyncPromise: c };
1025
1027
  }
1026
1028
  function Ne() {
1027
- return h();
1029
+ return p();
1028
1030
  }
1029
- let l = null;
1031
+ let u = null;
1030
1032
  const k = /* @__PURE__ */ Symbol("cer:provides");
1031
- function A(r) {
1032
- l = r;
1033
+ function R(r) {
1034
+ u = r;
1033
1035
  }
1034
1036
  function q() {
1035
- l = null;
1037
+ u = null;
1036
1038
  }
1037
1039
  function xe() {
1038
- return l;
1040
+ return u;
1039
1041
  }
1040
- function Ae() {
1041
- if (!l)
1042
+ function Re() {
1043
+ if (!u)
1042
1044
  throw new Error("useEmit must be called during component render");
1043
- if (h())
1045
+ if (p())
1044
1046
  return () => !1;
1045
- const r = l.emit;
1047
+ const r = u.emit;
1046
1048
  if (typeof r != "function")
1047
1049
  throw new Error(
1048
1050
  "useEmit requires an emit function on the component context"
@@ -1050,7 +1052,7 @@ function Ae() {
1050
1052
  const e = r;
1051
1053
  return (n, t, s) => e(n, t, s);
1052
1054
  }
1053
- function b(r) {
1055
+ function w(r) {
1054
1056
  r._hookCallbacks || Object.defineProperty(r, "_hookCallbacks", {
1055
1057
  value: {},
1056
1058
  writable: !0,
@@ -1058,56 +1060,56 @@ function b(r) {
1058
1060
  configurable: !0
1059
1061
  });
1060
1062
  }
1061
- function Re(r) {
1062
- if (!l)
1063
+ function Ae(r) {
1064
+ if (!u)
1063
1065
  throw new Error("useOnConnected must be called during component render");
1064
- if (h()) return;
1065
- b(l);
1066
- const e = l._hookCallbacks;
1066
+ if (p()) return;
1067
+ w(u);
1068
+ const e = u._hookCallbacks;
1067
1069
  e.onConnected || (e.onConnected = []), e.onConnected.push(r);
1068
1070
  }
1069
1071
  function Oe(r) {
1070
- if (!l)
1072
+ if (!u)
1071
1073
  throw new Error("useOnDisconnected must be called during component render");
1072
- if (h()) return;
1073
- b(l);
1074
- const e = l._hookCallbacks;
1074
+ if (p()) return;
1075
+ w(u);
1076
+ const e = u._hookCallbacks;
1075
1077
  e.onDisconnected || (e.onDisconnected = []), e.onDisconnected.push(r);
1076
1078
  }
1077
1079
  function Pe(r) {
1078
- if (!l)
1080
+ if (!u)
1079
1081
  throw new Error(
1080
1082
  "useOnAttributeChanged must be called during component render"
1081
1083
  );
1082
- if (h()) return;
1083
- b(l);
1084
- const e = l._hookCallbacks;
1084
+ if (p()) return;
1085
+ w(u);
1086
+ const e = u._hookCallbacks;
1085
1087
  e.onAttributeChanged || (e.onAttributeChanged = []), e.onAttributeChanged.push(r);
1086
1088
  }
1087
1089
  function Ie(r) {
1088
- if (!l)
1090
+ if (!u)
1089
1091
  throw new Error("useOnError must be called during component render");
1090
- if (h()) return;
1091
- b(l);
1092
- const e = l._hookCallbacks;
1092
+ if (p()) return;
1093
+ w(u);
1094
+ const e = u._hookCallbacks;
1093
1095
  e.onError || (e.onError = []), e.onError.push((n) => {
1094
1096
  try {
1095
1097
  n instanceof Error ? r(n) : r(new Error(String(n)));
1096
1098
  } catch (t) {
1097
- D("[useOnError] The error handler itself threw an exception:", t);
1099
+ T("[useOnError] The error handler itself threw an exception:", t);
1098
1100
  }
1099
1101
  });
1100
1102
  }
1101
1103
  function se(r) {
1102
- if (!l)
1104
+ if (!u)
1103
1105
  throw new Error("useProps must be called during component render");
1104
- b(l);
1105
- const e = l._hookCallbacks;
1106
+ w(u);
1107
+ const e = u._hookCallbacks;
1106
1108
  e.props = {
1107
1109
  ...e.props || {},
1108
1110
  ...r
1109
1111
  };
1110
- const n = l;
1112
+ const n = u;
1111
1113
  try {
1112
1114
  const s = Object.keys(r || {});
1113
1115
  for (const o of s) {
@@ -1115,21 +1117,21 @@ function se(r) {
1115
1117
  const i = Object.getOwnPropertyDescriptor(n, o);
1116
1118
  if (!(i && !i.configurable))
1117
1119
  try {
1118
- let u = Object.prototype.hasOwnProperty.call(n, o) ? n[o] : void 0;
1120
+ let l = Object.prototype.hasOwnProperty.call(n, o) ? n[o] : void 0;
1119
1121
  Object.defineProperty(n, o, {
1120
1122
  configurable: !0,
1121
1123
  enumerable: !0,
1122
1124
  get() {
1123
1125
  try {
1124
- const c = n && n._host;
1125
- if (c) {
1126
- const m = te(o), p = c.getAttribute(m);
1127
- if (p !== null) {
1126
+ const a = n && n._host;
1127
+ if (a) {
1128
+ const g = te(o), h = a.getAttribute(g);
1129
+ if (h !== null) {
1128
1130
  const f = typeof r[o];
1129
- return f === "boolean" ? p === "" || p === "true" : f === "number" ? Number(p) : p;
1131
+ return f === "boolean" ? h === "" || h === "true" : f === "number" ? Number(h) : h;
1130
1132
  }
1131
- if (typeof c[o] < "u") {
1132
- const f = c[o];
1133
+ if (typeof a[o] < "u") {
1134
+ const f = a[o];
1133
1135
  if (C(f) || f && typeof f == "object" && "value" in f && !(f instanceof Node))
1134
1136
  return f.value;
1135
1137
  const P = typeof r[o];
@@ -1139,10 +1141,10 @@ function se(r) {
1139
1141
  }
1140
1142
  } catch {
1141
1143
  }
1142
- return u;
1144
+ return l;
1143
1145
  },
1144
- set(c) {
1145
- u = c;
1146
+ set(a) {
1147
+ l = a;
1146
1148
  }
1147
1149
  });
1148
1150
  } catch {
@@ -1155,24 +1157,24 @@ function se(r) {
1155
1157
  if (typeof o != "string") return;
1156
1158
  const i = r[o];
1157
1159
  try {
1158
- const u = n && n._host;
1159
- if (u) {
1160
- if (u instanceof HTMLElement || typeof u.getAttribute == "function" && typeof u.hasAttribute == "function") {
1161
- const m = o.replace(/([A-Z])/g, "-$1").toLowerCase(), p = u.getAttribute(m);
1162
- if (p !== null)
1163
- return typeof i == "boolean" ? p === "" || p === "true" : typeof i == "number" ? Number(p) : p;
1160
+ const l = n && n._host;
1161
+ if (l) {
1162
+ if (l instanceof HTMLElement || typeof l.getAttribute == "function" && typeof l.hasAttribute == "function") {
1163
+ const g = o.replace(/([A-Z])/g, "-$1").toLowerCase(), h = l.getAttribute(g);
1164
+ if (h !== null)
1165
+ return typeof i == "boolean" ? h === "" || h === "true" : typeof i == "number" ? Number(h) : h;
1164
1166
  }
1165
- const c = u[o];
1166
- if (typeof c < "u" && c !== "") {
1167
- const m = c && typeof c == "object" && "value" in c && !(c instanceof Node);
1168
- if (!(typeof i == "string" && c && typeof c == "object" && !m && !C(c)))
1169
- return typeof i == "boolean" && i === !1 && c === "" ? i : C(c) || m ? c.value : typeof i == "boolean" && typeof c == "string" ? c === "" || c === "true" : typeof i == "number" && typeof c == "string" && !Number.isNaN(Number(c)) ? Number(c) : c;
1167
+ const a = l[o];
1168
+ if (typeof a < "u" && a !== "") {
1169
+ const g = a && typeof a == "object" && "value" in a && !(a instanceof Node);
1170
+ if (!(typeof i == "string" && a && typeof a == "object" && !g && !C(a)))
1171
+ return typeof i == "boolean" && i === !1 && a === "" ? i : C(a) || g ? a.value : typeof i == "boolean" && typeof a == "string" ? a === "" || a === "true" : typeof i == "number" && typeof a == "string" && !Number.isNaN(Number(a)) ? Number(a) : a;
1170
1172
  }
1171
1173
  }
1172
1174
  } catch {
1173
1175
  }
1174
- const a = n[o];
1175
- return typeof i == "boolean" && a === "" ? i === !1 ? i : !0 : C(a) || a && typeof a == "object" && "value" in a && !(a instanceof Node) ? a.value : a != null && a !== "" ? typeof i == "boolean" && typeof a == "string" ? a === "true" : typeof i == "number" && typeof a == "string" && !Number.isNaN(Number(a)) ? Number(a) : a : i;
1176
+ const c = n[o];
1177
+ return typeof i == "boolean" && c === "" ? i === !1 ? i : !0 : C(c) || c && typeof c == "object" && "value" in c && !(c instanceof Node) ? c.value : c != null && c !== "" ? typeof i == "boolean" && typeof c == "string" ? c === "true" : typeof i == "number" && typeof c == "string" && !Number.isNaN(Number(c)) ? Number(c) : c : i;
1176
1178
  },
1177
1179
  has(s, o) {
1178
1180
  return typeof o == "string" && (o in n || o in r);
@@ -1188,20 +1190,20 @@ function se(r) {
1188
1190
  });
1189
1191
  }
1190
1192
  function He(r) {
1191
- if (!l)
1193
+ if (!u)
1192
1194
  throw new Error("useStyle must be called during component render");
1193
- if (!h()) {
1194
- b(l);
1195
+ if (!p()) {
1196
+ w(u);
1195
1197
  try {
1196
1198
  const e = r();
1197
- Object.defineProperty(l, "_computedStyle", {
1199
+ Object.defineProperty(u, "_computedStyle", {
1198
1200
  value: e,
1199
1201
  writable: !0,
1200
1202
  enumerable: !1,
1201
1203
  configurable: !0
1202
1204
  });
1203
1205
  } catch (e) {
1204
- g("Error in useStyle callback:", e), Object.defineProperty(l, "_computedStyle", {
1206
+ m("Error in useStyle callback:", e), Object.defineProperty(u, "_computedStyle", {
1205
1207
  value: "",
1206
1208
  writable: !0,
1207
1209
  enumerable: !1,
@@ -1220,7 +1222,7 @@ function je(r) {
1220
1222
  }
1221
1223
  if (re(e) || typeof document > "u" || typeof CSSStyleSheet > "u")
1222
1224
  return;
1223
- g(
1225
+ m(
1224
1226
  "[useGlobalStyle] Injecting global styles from a component. This escapes Shadow DOM encapsulation — use sparingly."
1225
1227
  );
1226
1228
  const n = G(X(e));
@@ -1234,9 +1236,9 @@ function je(r) {
1234
1236
  }
1235
1237
  }
1236
1238
  function Ue(r) {
1237
- if (!l)
1239
+ if (!u)
1238
1240
  throw new Error("useDesignTokens must be called during component render");
1239
- if (h()) return;
1241
+ if (p()) return;
1240
1242
  const e = [], n = {
1241
1243
  primary: "--cer-color-primary-500",
1242
1244
  secondary: "--cer-color-secondary-500",
@@ -1250,23 +1252,23 @@ function Ue(r) {
1250
1252
  fontSerif: "--cer-font-serif",
1251
1253
  fontMono: "--cer-font-mono"
1252
1254
  };
1253
- for (const [u, c] of Object.entries(r))
1254
- c !== void 0 && (u in n ? e.push(`${n[u]}:${c}`) : u in t ? e.push(`${t[u]}:${c}`) : u.startsWith("--") && e.push(`${u}:${c}`));
1255
+ for (const [l, a] of Object.entries(r))
1256
+ a !== void 0 && (l in n ? e.push(`${n[l]}:${a}`) : l in t ? e.push(`${t[l]}:${a}`) : l.startsWith("--") && e.push(`${l}:${a}`));
1255
1257
  if (e.length === 0) return;
1256
- const s = `:host{${e.join(";")}}`, i = l._computedStyle ?? "", a = i ? `${i}
1258
+ const s = `:host{${e.join(";")}}`, i = u._computedStyle ?? "", c = i ? `${i}
1257
1259
  ${s}` : s;
1258
- Object.defineProperty(l, "_computedStyle", {
1259
- value: a,
1260
+ Object.defineProperty(u, "_computedStyle", {
1261
+ value: c,
1260
1262
  writable: !0,
1261
1263
  enumerable: !1,
1262
1264
  configurable: !0
1263
1265
  });
1264
1266
  }
1265
1267
  function Le(r, e) {
1266
- if (!l)
1268
+ if (!u)
1267
1269
  throw new Error("provide must be called during component render");
1268
- if (h()) return;
1269
- const n = l;
1270
+ if (p()) return;
1271
+ const n = u;
1270
1272
  n[k] || Object.defineProperty(n, k, {
1271
1273
  value: /* @__PURE__ */ new Map(),
1272
1274
  writable: !1,
@@ -1275,11 +1277,11 @@ function Le(r, e) {
1275
1277
  }), n[k].set(r, e);
1276
1278
  }
1277
1279
  function Fe(r, e) {
1278
- if (!l)
1280
+ if (!u)
1279
1281
  throw new Error("inject must be called during component render");
1280
- if (h()) return e;
1282
+ if (p()) return e;
1281
1283
  try {
1282
- const n = l._host;
1284
+ const n = u._host;
1283
1285
  if (n) {
1284
1286
  let t = n.parentNode;
1285
1287
  t || (t = n.getRootNode());
@@ -1287,20 +1289,20 @@ function Fe(r, e) {
1287
1289
  const o = 50;
1288
1290
  for (; t && s < o; )
1289
1291
  if (s++, t instanceof ShadowRoot) {
1290
- const i = t.host, a = i.context;
1291
- if (a) {
1292
- const c = a[k];
1293
- if (c?.has(r))
1294
- return c.get(r);
1292
+ const i = t.host, c = i.context;
1293
+ if (c) {
1294
+ const a = c[k];
1295
+ if (a?.has(r))
1296
+ return a.get(r);
1295
1297
  }
1296
1298
  if (t = i.parentNode ?? i.getRootNode(), t === document || t === i) break;
1297
1299
  } else {
1298
1300
  if (t instanceof Element) {
1299
- const u = t.context;
1300
- if (u) {
1301
- const c = u[k];
1302
- if (c?.has(r))
1303
- return c.get(r);
1301
+ const l = t.context;
1302
+ if (l) {
1303
+ const a = l[k];
1304
+ if (a?.has(r))
1305
+ return a.get(r);
1304
1306
  }
1305
1307
  }
1306
1308
  const i = t;
@@ -1313,28 +1315,28 @@ function Fe(r, e) {
1313
1315
  }
1314
1316
  function We(r) {
1315
1317
  return (e) => {
1316
- const n = e ?? l;
1318
+ const n = e ?? u;
1317
1319
  if (!n)
1318
1320
  throw new Error(
1319
1321
  "createComposable: no component context available. Pass a context explicitly or call inside a render function."
1320
1322
  );
1321
- const t = l;
1322
- A(n);
1323
+ const t = u;
1324
+ R(n);
1323
1325
  try {
1324
1326
  return r();
1325
1327
  } finally {
1326
- t ? A(t) : q();
1328
+ t ? R(t) : q();
1327
1329
  }
1328
1330
  };
1329
1331
  }
1330
1332
  function $e(r) {
1331
- if (!l)
1333
+ if (!u)
1332
1334
  throw new Error("useExpose must be called during component render");
1333
- if (h()) return;
1334
- b(l);
1335
- const e = l._hookCallbacks;
1335
+ if (p()) return;
1336
+ w(u);
1337
+ const e = u._hookCallbacks;
1336
1338
  e.expose = { ...e.expose ?? {}, ...r };
1337
- const n = l._host;
1339
+ const n = u._host;
1338
1340
  if (n)
1339
1341
  for (const [t, s] of Object.entries(r))
1340
1342
  try {
@@ -1343,11 +1345,11 @@ function $e(r) {
1343
1345
  }
1344
1346
  }
1345
1347
  function Ve() {
1346
- if (!l)
1348
+ if (!u)
1347
1349
  throw new Error("useSlots must be called during component render");
1348
- if (h())
1350
+ if (p())
1349
1351
  return { has: () => !1, getNodes: () => [], names: () => [] };
1350
- const r = l._host, e = () => {
1352
+ const r = u._host, e = () => {
1351
1353
  const n = /* @__PURE__ */ new Map();
1352
1354
  if (!r) return n;
1353
1355
  for (const t of r.children) {
@@ -1382,19 +1384,19 @@ function Ve() {
1382
1384
  };
1383
1385
  }
1384
1386
  function ze(...r) {
1385
- if (!l)
1387
+ if (!u)
1386
1388
  throw new Error("defineModel must be called during component render");
1387
1389
  const e = r.length === 2 ? r[0] : "modelValue", n = r.length === 2 ? r[1] : r.length === 1 ? r[0] : void 0, t = se({
1388
1390
  [e]: n
1389
- }), o = h() ? null : (() => {
1390
- const a = l.emit;
1391
- return typeof a != "function" ? null : a;
1391
+ }), o = p() ? null : (() => {
1392
+ const c = u.emit;
1393
+ return typeof c != "function" ? null : c;
1392
1394
  })(), i = {
1393
1395
  get value() {
1394
1396
  return t[e];
1395
1397
  },
1396
- set value(a) {
1397
- o && o(`update:${e}`, a);
1398
+ set value(c) {
1399
+ o && o(`update:${e}`, c);
1398
1400
  }
1399
1401
  };
1400
1402
  try {
@@ -1417,21 +1419,22 @@ export {
1417
1419
  _e as G,
1418
1420
  F as H,
1419
1421
  ve as I,
1420
- B as J,
1421
- A as K,
1422
- le as L,
1423
- de as M,
1424
- q as N,
1425
- ke as O,
1426
- h as P,
1427
- ye as Q,
1422
+ K as J,
1423
+ B as K,
1424
+ R as L,
1425
+ le as M,
1426
+ de as N,
1427
+ q as O,
1428
+ ke as P,
1429
+ p as Q,
1428
1430
  x as R,
1429
- Te as S,
1430
- Me as T,
1431
- De as U,
1432
- be as V,
1433
- z as W,
1434
- Ce as X,
1431
+ ye as S,
1432
+ De as T,
1433
+ Me as U,
1434
+ Te as V,
1435
+ be as W,
1436
+ z as X,
1437
+ Ce as Y,
1435
1438
  $e as a,
1436
1439
  se as b,
1437
1440
  d as c,
@@ -1448,15 +1451,15 @@ export {
1448
1451
  ue as n,
1449
1452
  Ue as o,
1450
1453
  Le as p,
1451
- Ae as q,
1454
+ Re as q,
1452
1455
  fe as r,
1453
1456
  ae as s,
1454
1457
  je as t,
1455
1458
  Ie as u,
1456
1459
  Pe as v,
1457
- Re as w,
1460
+ Ae as w,
1458
1461
  Oe as x,
1459
1462
  Ve as y,
1460
1463
  He as z
1461
1464
  };
1462
- //# sourceMappingURL=hooks-Cze3o-F7.js.map
1465
+ //# sourceMappingURL=hooks-xWZhQHco.js.map