sibujs 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +24 -0
  2. package/dist/browser.cjs +13 -21
  3. package/dist/browser.js +6 -6
  4. package/dist/build.cjs +278 -104
  5. package/dist/build.js +15 -15
  6. package/dist/cdn.dev.global.js +398 -0
  7. package/dist/cdn.global.js +10 -10
  8. package/dist/{chunk-DCDS2PQ6.js → chunk-2LOYNGBY.js} +2 -2
  9. package/dist/{chunk-VPP2FONR.js → chunk-2WLZ6757.js} +17 -10
  10. package/dist/{chunk-IM7N5WR4.js → chunk-3VTSPNC5.js} +2 -2
  11. package/dist/{chunk-TIRZCERI.js → chunk-5DXA2J44.js} +1 -1
  12. package/dist/{chunk-I3VI34DP.js → chunk-6ZGI3RBE.js} +149 -33
  13. package/dist/{chunk-D3SZ4LVS.js → chunk-7ALC7KGE.js} +5 -6
  14. package/dist/{chunk-PFTDGEPZ.js → chunk-7VEC3UD2.js} +3 -3
  15. package/dist/{chunk-KSOEJGFO.js → chunk-BMYYZWHX.js} +3 -3
  16. package/dist/{chunk-LOFZHP6V.js → chunk-BNKV4REK.js} +7 -8
  17. package/dist/{chunk-5GJ5RTHA.js → chunk-FOWBJZDL.js} +7 -8
  18. package/dist/{chunk-FB7KQXZI.js → chunk-GDUNQCCW.js} +4 -4
  19. package/dist/{chunk-UFSQEO7P.js → chunk-HECVW343.js} +7 -8
  20. package/dist/{chunk-SHDVWATN.js → chunk-HJEPKZ2O.js} +7 -8
  21. package/dist/{chunk-ANGSYNPX.js → chunk-HZEBO22J.js} +57 -37
  22. package/dist/{chunk-5INI7D2L.js → chunk-IXKSNWV5.js} +74 -11
  23. package/dist/{chunk-DAKLOMKS.js → chunk-KE4KWRDY.js} +3 -3
  24. package/dist/{chunk-AW6HPJ3L.js → chunk-KKLW7YWL.js} +1 -1
  25. package/dist/{chunk-BMSN6NWQ.js → chunk-NEYWS4EX.js} +6 -6
  26. package/dist/{chunk-HYCCIYNS.js → chunk-NIOYEGBQ.js} +13 -14
  27. package/dist/{chunk-4U7KD3RY.js → chunk-OUWAIXIK.js} +3 -3
  28. package/dist/{chunk-MRAMKDHQ.js → chunk-P3DHXBR6.js} +1 -1
  29. package/dist/{chunk-FMHIQNMP.js → chunk-QCFLDD7C.js} +5 -5
  30. package/dist/{chunk-DHDZ7IVN.js → chunk-QKRPLZ2V.js} +7 -8
  31. package/dist/{chunk-4RH6D7GR.js → chunk-QL4UREZO.js} +6 -6
  32. package/dist/{chunk-XIHMS2Y6.js → chunk-SF3TB4K6.js} +8 -8
  33. package/dist/{chunk-XSZRJW76.js → chunk-XZ2N525U.js} +6 -6
  34. package/dist/{customElement-CKLoO63w.d.ts → customElement-CNZxEB9G.d.cts} +77 -0
  35. package/dist/{customElement-CKLoO63w.d.cts → customElement-CNZxEB9G.d.ts} +77 -0
  36. package/dist/data.cjs +15 -24
  37. package/dist/data.js +9 -9
  38. package/dist/devtools.cjs +18 -22
  39. package/dist/devtools.d.cts +1 -1
  40. package/dist/devtools.d.ts +1 -1
  41. package/dist/devtools.js +8 -8
  42. package/dist/{dispose-4FZ6OFXR.js → dispose-46BOMMQJ.js} +2 -2
  43. package/dist/ecosystem.cjs +222 -67
  44. package/dist/ecosystem.js +11 -11
  45. package/dist/extras.cjs +243 -86
  46. package/dist/extras.d.cts +2 -2
  47. package/dist/extras.d.ts +2 -2
  48. package/dist/extras.js +25 -25
  49. package/dist/index.cjs +272 -98
  50. package/dist/index.d.cts +154 -33
  51. package/dist/index.d.ts +154 -33
  52. package/dist/index.js +15 -15
  53. package/dist/{introspect-RjLfIFpL.d.cts → introspect-D5xF-0Es.d.cts} +7 -0
  54. package/dist/{introspect-DOZfmC-4.d.ts → introspect-rSBIxEQi.d.ts} +7 -0
  55. package/dist/motion.cjs +13 -22
  56. package/dist/motion.js +5 -5
  57. package/dist/patterns.cjs +16 -24
  58. package/dist/patterns.d.cts +8 -0
  59. package/dist/patterns.d.ts +8 -0
  60. package/dist/patterns.js +7 -7
  61. package/dist/performance.cjs +16 -27
  62. package/dist/performance.js +9 -9
  63. package/dist/plugins.cjs +260 -86
  64. package/dist/plugins.d.cts +92 -0
  65. package/dist/plugins.d.ts +92 -0
  66. package/dist/plugins.js +18 -17
  67. package/dist/{ssr-JFP5535P.js → ssr-Y7XOEPEN.js} +5 -5
  68. package/dist/ssr.cjs +233 -79
  69. package/dist/ssr.js +12 -12
  70. package/dist/testing.cjs +11 -19
  71. package/dist/testing.js +5 -5
  72. package/dist/ui.cjs +98 -43
  73. package/dist/ui.d.cts +7 -1
  74. package/dist/ui.d.ts +7 -1
  75. package/dist/ui.js +10 -10
  76. package/dist/widgets.cjs +13 -21
  77. package/dist/widgets.d.cts +8 -0
  78. package/dist/widgets.d.ts +8 -0
  79. package/dist/widgets.js +9 -9
  80. package/package.json +5 -2
@@ -135,40 +135,42 @@ import {
135
135
  use,
136
136
  var_,
137
137
  video
138
- } from "./chunk-MRAMKDHQ.js";
138
+ } from "./chunk-P3DHXBR6.js";
139
139
  import {
140
140
  trustHTML
141
- } from "./chunk-HYCCIYNS.js";
141
+ } from "./chunk-NIOYEGBQ.js";
142
142
  import {
143
143
  watch
144
- } from "./chunk-KSOEJGFO.js";
144
+ } from "./chunk-BMYYZWHX.js";
145
145
  import {
146
146
  __resetIdCounter,
147
147
  createId
148
148
  } from "./chunk-CCSJMTRN.js";
149
149
  import {
150
150
  context
151
- } from "./chunk-5GJ5RTHA.js";
151
+ } from "./chunk-FOWBJZDL.js";
152
152
  import {
153
153
  SVG_NS,
154
154
  bindChildNode,
155
+ captureFocusWithin,
156
+ restoreFocusWithin,
155
157
  tagFactory
156
- } from "./chunk-I3VI34DP.js";
158
+ } from "./chunk-6ZGI3RBE.js";
157
159
  import {
158
160
  bindAttribute,
159
161
  bindDynamic,
160
162
  setSafeAttribute
161
- } from "./chunk-SHDVWATN.js";
163
+ } from "./chunk-HJEPKZ2O.js";
162
164
  import {
163
165
  derived
164
- } from "./chunk-DCDS2PQ6.js";
166
+ } from "./chunk-2LOYNGBY.js";
165
167
  import {
166
168
  globalSingleton
167
169
  } from "./chunk-7ZHH77QA.js";
168
170
  import {
169
171
  effect,
170
172
  on
171
- } from "./chunk-PFTDGEPZ.js";
173
+ } from "./chunk-7VEC3UD2.js";
172
174
  import {
173
175
  disableSSR,
174
176
  enableSSR,
@@ -177,7 +179,7 @@ import {
177
179
  isSSR,
178
180
  runInSSRContext,
179
181
  withSSR
180
- } from "./chunk-TIRZCERI.js";
182
+ } from "./chunk-5DXA2J44.js";
181
183
  import {
182
184
  MAX_DRAIN_TEARDOWNS,
183
185
  checkLeaks,
@@ -186,14 +188,14 @@ import {
186
188
  replaceChildrenSafely,
187
189
  reportDrainRunaway,
188
190
  unregisterDisposer
189
- } from "./chunk-DHDZ7IVN.js";
191
+ } from "./chunk-QKRPLZ2V.js";
190
192
  import {
191
193
  batch,
192
194
  enqueueBatchedSignal,
193
195
  external,
194
196
  isBatching,
195
197
  signal
196
- } from "./chunk-UFSQEO7P.js";
198
+ } from "./chunk-HECVW343.js";
197
199
  import {
198
200
  notifySubscribers,
199
201
  reactiveBinding,
@@ -204,17 +206,19 @@ import {
204
206
  suspendTracking,
205
207
  track,
206
208
  untracked
207
- } from "./chunk-D3SZ4LVS.js";
209
+ } from "./chunk-7ALC7KGE.js";
208
210
  import {
211
+ DEV,
209
212
  __export,
210
213
  devAssert,
211
214
  devWarn,
215
+ devWarnLazy,
212
216
  getRuntimeErrorHandler,
213
217
  isDev,
214
218
  normalizeError,
215
219
  reportError,
216
220
  setRuntimeErrorHandler
217
- } from "./chunk-VPP2FONR.js";
221
+ } from "./chunk-2WLZ6757.js";
218
222
 
219
223
  // index.ts
220
224
  var index_exports = {};
@@ -1749,34 +1753,53 @@ function setGlobalErrorHandler(handler) {
1749
1753
 
1750
1754
  // src/core/rendering/directives.ts
1751
1755
  function show(condition, element) {
1756
+ const resolved = typeof element === "function" ? element() : element;
1752
1757
  const update = () => {
1753
- element.style.display = condition() ? "" : "none";
1758
+ resolved.style.display = condition() ? "" : "none";
1754
1759
  };
1755
- registerDisposer(element, track(update));
1756
- return element;
1760
+ registerDisposer(resolved, track(update));
1761
+ return resolved;
1762
+ }
1763
+ function attachBranch(parent, anchor, branch, attachedOnce, where) {
1764
+ const result = typeof branch === "function" ? branch() : branch;
1765
+ if (result == null || typeof result === "boolean") return { node: null, owned: false };
1766
+ const node = result instanceof Node ? result : document.createTextNode(String(result));
1767
+ const handedIn = node === branch;
1768
+ const seenBefore = attachedOnce.has(node);
1769
+ const owned = !handedIn && !seenBefore;
1770
+ attachedOnce.add(node);
1771
+ if (seenBefore) {
1772
+ devWarnLazy(
1773
+ () => `${where}: ${handedIn ? "a branch was given as an element rather than a function" : "a branch factory returned a node it had already returned"}, so the SAME node is being re-attached \u2014 any state it accumulated while detached (input value, scroll position, classes set imperatively) comes back with it. Its reactive bindings are left intact rather than disposed, because the node is not this directive's to tear down. Return a FRESH node per call (\`() => div(\u2026)\`) for rebuild semantics, or keep this form deliberately when the reuse is what you want.`
1774
+ );
1775
+ }
1776
+ parent.insertBefore(node, anchor.nextSibling);
1777
+ return { node, owned };
1757
1778
  }
1758
1779
  function when(condition, thenBranch, elseBranch) {
1759
1780
  const anchor = document.createComment("when");
1760
1781
  let currentNode = null;
1761
1782
  let lastCondition;
1762
1783
  let initialized = false;
1784
+ const attachedOnce = /* @__PURE__ */ new WeakSet();
1785
+ let currentNodeOwned = false;
1763
1786
  const update = () => {
1764
1787
  const show2 = condition();
1765
1788
  const parent = anchor.parentNode;
1766
1789
  if (!parent) return;
1767
1790
  if (initialized && show2 === lastCondition) return;
1768
1791
  lastCondition = show2;
1792
+ const focused = currentNode ? captureFocusWithin([currentNode]) : null;
1769
1793
  if (currentNode?.parentNode) {
1770
- dispose(currentNode);
1794
+ if (currentNodeOwned) dispose(currentNode);
1771
1795
  currentNode.parentNode.removeChild(currentNode);
1772
1796
  currentNode = null;
1773
1797
  }
1774
- const result = show2 ? thenBranch() : elseBranch ? elseBranch() : null;
1775
- if (result != null) {
1776
- const node = result instanceof Node ? result : document.createTextNode(String(result));
1777
- parent.insertBefore(node, anchor.nextSibling);
1778
- currentNode = node;
1779
- }
1798
+ const branch = show2 ? thenBranch : elseBranch !== void 0 ? elseBranch : null;
1799
+ const attached = attachBranch(parent, anchor, branch, attachedOnce, "when");
1800
+ currentNode = attached.node;
1801
+ currentNodeOwned = attached.owned;
1802
+ restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
1780
1803
  initialized = true;
1781
1804
  };
1782
1805
  registerDisposer(anchor, track(update));
@@ -1792,26 +1815,25 @@ function match(value, cases, fallback) {
1792
1815
  let currentNode = null;
1793
1816
  let lastKey;
1794
1817
  let initialized = false;
1818
+ const attachedOnce = /* @__PURE__ */ new WeakSet();
1819
+ let currentNodeOwned = false;
1795
1820
  const update = () => {
1796
1821
  const key = String(value());
1797
1822
  const parent = anchor.parentNode;
1798
1823
  if (!parent) return;
1799
1824
  if (initialized && key === lastKey) return;
1800
1825
  lastKey = key;
1826
+ const focused = currentNode ? captureFocusWithin([currentNode]) : null;
1801
1827
  if (currentNode?.parentNode) {
1802
- dispose(currentNode);
1828
+ if (currentNodeOwned) dispose(currentNode);
1803
1829
  currentNode.parentNode.removeChild(currentNode);
1804
1830
  currentNode = null;
1805
1831
  }
1806
- const renderFn = cases[key] || fallback;
1807
- if (renderFn) {
1808
- const result = renderFn();
1809
- if (result != null) {
1810
- const node = result instanceof Node ? result : document.createTextNode(String(result));
1811
- parent.insertBefore(node, anchor.nextSibling);
1812
- currentNode = node;
1813
- }
1814
- }
1832
+ const branch = Object.hasOwn(cases, key) ? cases[key] : fallback;
1833
+ const attached = attachBranch(parent, anchor, branch ?? null, attachedOnce, "match");
1834
+ currentNode = attached.node;
1835
+ currentNodeOwned = attached.owned;
1836
+ restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
1815
1837
  initialized = true;
1816
1838
  };
1817
1839
  registerDisposer(anchor, track(update));
@@ -1856,7 +1878,6 @@ function DynamicComponent(is) {
1856
1878
  }
1857
1879
 
1858
1880
  // src/core/rendering/each.ts
1859
- var _isDev = isDev();
1860
1881
  function resolveNodeChild(child) {
1861
1882
  if (typeof child === "function") {
1862
1883
  return resolveNodeChild(child());
@@ -1947,7 +1968,7 @@ function each(getArray, render, options) {
1947
1968
  workMap.clear();
1948
1969
  keyIndexMap.clear();
1949
1970
  for (let i2 = 0; i2 < newLen; i2++) {
1950
- if (_isDev && keyIndexMap.has(newKeys[i2])) {
1971
+ if (DEV && keyIndexMap.has(newKeys[i2])) {
1951
1972
  devWarn(
1952
1973
  `each: duplicate key "${String(newKeys[i2])}" at index ${i2} (first seen at ${keyIndexMap.get(newKeys[i2])}). Keys must be unique \u2014 duplicates cause rows to be dropped or mis-ordered.`
1953
1974
  );
@@ -2131,7 +2152,6 @@ function resolveChild(child) {
2131
2152
  }
2132
2153
 
2133
2154
  // src/core/rendering/htm.ts
2134
- var _isDev2 = isDev();
2135
2155
  var RAW_TEXT_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
2136
2156
  var VOID_ELEMENTS = /* @__PURE__ */ new Set([
2137
2157
  "area",
@@ -2411,7 +2431,7 @@ function executeElement(tmpl, values) {
2411
2431
  const fn = values[attr.idx];
2412
2432
  if (typeof fn === "function") {
2413
2433
  el.addEventListener(attr.name, fn);
2414
- } else if (_isDev2) {
2434
+ } else if (DEV) {
2415
2435
  devWarn(
2416
2436
  `html: on:${attr.name} handler is not a function (got ${typeof fn}). Event listener was not attached.`
2417
2437
  );
@@ -1,3 +1,7 @@
1
+ import {
2
+ devWarnLazy
3
+ } from "./chunk-2WLZ6757.js";
4
+
1
5
  // src/utils/sanitize.ts
2
6
  function stripControlChars(value) {
3
7
  return value.replace(/[\x00-\x20\x7f-\x9f]+/g, "");
@@ -94,20 +98,75 @@ function decodeCssEscapes(value) {
94
98
  }
95
99
  return out;
96
100
  }
97
- function sanitizeCSSValue(value) {
98
- if (!CSS_DANGER_GATE.test(value)) return value;
101
+ var BLOCKED_CSS_NEEDLES = [
102
+ "url(",
103
+ "expression(",
104
+ "javascript:",
105
+ "vbscript:",
106
+ "-moz-binding",
107
+ "behavior:",
108
+ "@import",
109
+ "image-set(",
110
+ "filter:progid"
111
+ ];
112
+ function describeElement(el) {
113
+ if (!el) return "an element";
114
+ let out = el.tagName.toLowerCase();
115
+ const id = el.getAttribute("id");
116
+ if (id) out += `#${id}`;
117
+ const cls = el.getAttribute("class");
118
+ if (cls) out += `.${cls.trim().split(/\s+/).slice(0, 3).join(".")}`;
119
+ return `<${out}>`;
120
+ }
121
+ var warnedDeclarations = /* @__PURE__ */ new Set();
122
+ var MAX_WARNED_DECLARATIONS = 100;
123
+ var declarationCapAnnounced = false;
124
+ function warnDroppedDeclaration(value, reason, ctx) {
125
+ devWarnLazy(() => {
126
+ const reasons = [
127
+ "url() in an inline style is an exfiltration channel: the browser fetches it immediately and the URL's path or query can carry page data off-origin",
128
+ "expression() executes arbitrary script in legacy engines",
129
+ "the javascript: scheme executes script",
130
+ "the vbscript: scheme executes script",
131
+ "-moz-binding loads and runs remote XBL",
132
+ "behavior: loads and runs a remote HTC script",
133
+ "@import pulls in a remote stylesheet",
134
+ "image-set() fetches remote images, the same exfiltration channel as url()",
135
+ "filter:progid activates legacy scriptable filters"
136
+ ];
137
+ const declaration = ctx?.property ? `${ctx.property}: ${value}` : value;
138
+ const where = describeElement(ctx?.element);
139
+ const key = `${where}|${declaration}`;
140
+ if (warnedDeclarations.has(key)) return "";
141
+ if (warnedDeclarations.size >= MAX_WARNED_DECLARATIONS) {
142
+ if (declarationCapAnnounced) return "";
143
+ declarationCapAnnounced = true;
144
+ return `${MAX_WARNED_DECLARATIONS} distinct dropped style declarations have been reported; suppressing further ones for the rest of this session so they cannot flood the console. The declarations are still dropped \u2014 only the reporting stops. Fix the reported ones and reload to see any that remain.`;
145
+ }
146
+ warnedDeclarations.add(key);
147
+ return `style declaration "${declaration}" was dropped by the style sanitizer on ${where} \u2014 ${reasons[reason]}. The element renders without it, which usually looks like a missing image rather than an error. Sanctioned alternatives: for a content image use an <img> element (or a <picture>); for decoration, put the rule in a stylesheet and set a class instead \u2014 stylesheet CSS is not sanitized, only inline style attributes are. If this declaration is not yours, it came from untrusted data and the drop just prevented an exfiltration.`;
148
+ });
149
+ }
150
+ function blockedCssReason(value) {
151
+ if (!CSS_DANGER_GATE.test(value)) return -1;
99
152
  const normalized = value.includes("\\") ? decodeCssEscapes(value) : value;
100
153
  const lower = normalized.toLowerCase().replace(/\s+/g, "");
101
- if (lower.includes("url(") || lower.includes("expression(") || lower.includes("javascript:") || lower.includes("vbscript:") || lower.includes("-moz-binding") || lower.includes("behavior:") || lower.includes("@import") || lower.includes("image-set(") || lower.includes("filter:progid")) {
102
- return "";
154
+ for (let i = 0; i < BLOCKED_CSS_NEEDLES.length; i++) {
155
+ if (lower.includes(BLOCKED_CSS_NEEDLES[i])) return i;
103
156
  }
104
- return value;
157
+ return -1;
158
+ }
159
+ function sanitizeCSSValue(value, context) {
160
+ const reason = blockedCssReason(value);
161
+ if (reason === -1) return value;
162
+ warnDroppedDeclaration(value, reason, context);
163
+ return "";
105
164
  }
106
- function sanitizeStyleAttribute(cssText) {
165
+ function sanitizeStyleAttribute(cssText, context) {
107
166
  const input = String(cssText);
108
167
  if (input.trim() === "") return "";
109
168
  if (typeof document === "undefined") {
110
- return sanitizeCSSValue(input) === "" ? "" : input;
169
+ return sanitizeCSSValue(input, context) === "" ? "" : input;
111
170
  }
112
171
  const probe = document.createElement("div");
113
172
  try {
@@ -119,8 +178,12 @@ function sanitizeStyleAttribute(cssText) {
119
178
  for (let i = 0; i < probe.style.length; i++) {
120
179
  const property = probe.style[i];
121
180
  const value = probe.style.getPropertyValue(property);
122
- if (sanitizeCSSValue(value) === "") continue;
123
- if (sanitizeCSSValue(`${property}:${value}`) === "") continue;
181
+ let reason = blockedCssReason(value);
182
+ if (reason === -1) reason = blockedCssReason(`${property}:${value}`);
183
+ if (reason !== -1) {
184
+ warnDroppedDeclaration(value, reason, { property, element: context?.element });
185
+ continue;
186
+ }
124
187
  const priority = probe.style.getPropertyPriority(property);
125
188
  declarations.push(`${property}: ${value}${priority ? ` !${priority}` : ""}`);
126
189
  }
@@ -171,11 +234,11 @@ function isPolicyAttribute(name) {
171
234
  const lower = name.toLowerCase();
172
235
  return lower === "style" || URL_ATTRIBUTES.has(lower);
173
236
  }
174
- function sanitizeAttributeString(attr, value) {
237
+ function sanitizeAttributeString(attr, value, context) {
175
238
  const lower = attr.toLowerCase();
176
239
  if (lower === "srcset") return sanitizeSrcset(value);
177
240
  if (URL_ATTRIBUTES.has(lower)) return sanitizeUrl(value);
178
- if (lower === "style") return sanitizeStyleAttribute(value);
241
+ if (lower === "style") return sanitizeStyleAttribute(value, context);
179
242
  return value;
180
243
  }
181
244
 
@@ -6,14 +6,14 @@ import {
6
6
  } from "./chunk-52XFPGSN.js";
7
7
  import {
8
8
  effect
9
- } from "./chunk-PFTDGEPZ.js";
9
+ } from "./chunk-7VEC3UD2.js";
10
10
  import {
11
11
  batch,
12
12
  signal
13
- } from "./chunk-UFSQEO7P.js";
13
+ } from "./chunk-HECVW343.js";
14
14
  import {
15
15
  reportError
16
- } from "./chunk-VPP2FONR.js";
16
+ } from "./chunk-2WLZ6757.js";
17
17
 
18
18
  // src/browser/media.ts
19
19
  function media(query) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderToString
3
- } from "./chunk-HYCCIYNS.js";
3
+ } from "./chunk-NIOYEGBQ.js";
4
4
 
5
5
  // src/plugins/modular.ts
6
6
  function createModuleRegistry() {
@@ -6,29 +6,29 @@ import {
6
6
  import {
7
7
  div,
8
8
  span
9
- } from "./chunk-MRAMKDHQ.js";
9
+ } from "./chunk-P3DHXBR6.js";
10
10
  import {
11
11
  STATIC_VALUE_RESOLVER,
12
12
  planHeadElementEntry,
13
13
  planMetaEntry
14
- } from "./chunk-HYCCIYNS.js";
14
+ } from "./chunk-NIOYEGBQ.js";
15
15
  import {
16
16
  sanitizeUrl
17
- } from "./chunk-5INI7D2L.js";
17
+ } from "./chunk-IXKSNWV5.js";
18
18
  import {
19
19
  globalSingleton
20
20
  } from "./chunk-7ZHH77QA.js";
21
21
  import {
22
22
  effect
23
- } from "./chunk-PFTDGEPZ.js";
23
+ } from "./chunk-7VEC3UD2.js";
24
24
  import {
25
25
  registerDisposer,
26
26
  replaceChildrenSafely
27
- } from "./chunk-DHDZ7IVN.js";
27
+ } from "./chunk-QKRPLZ2V.js";
28
28
  import {
29
29
  batch,
30
30
  signal
31
- } from "./chunk-UFSQEO7P.js";
31
+ } from "./chunk-HECVW343.js";
32
32
 
33
33
  // src/platform/head.ts
34
34
  function escapeScriptJsonLocal(json) {
@@ -6,17 +6,17 @@ import {
6
6
  sanitizeAttributeString,
7
7
  sanitizeUrl,
8
8
  stripControlChars
9
- } from "./chunk-5INI7D2L.js";
9
+ } from "./chunk-IXKSNWV5.js";
10
10
  import {
11
11
  getSSRStore
12
- } from "./chunk-TIRZCERI.js";
12
+ } from "./chunk-5DXA2J44.js";
13
13
  import {
14
14
  dispose,
15
15
  replaceChildrenSafely
16
- } from "./chunk-DHDZ7IVN.js";
16
+ } from "./chunk-QKRPLZ2V.js";
17
17
  import {
18
- isDev
19
- } from "./chunk-VPP2FONR.js";
18
+ DEV
19
+ } from "./chunk-2WLZ6757.js";
20
20
 
21
21
  // src/utils/metaRefresh.ts
22
22
  function isAsciiWhitespace(ch) {
@@ -185,13 +185,12 @@ function isForbiddenSsrAttr(lowerName) {
185
185
  function sanitizeSsrAttributeValue(lowerName, value) {
186
186
  return sanitizeAttributeString(lowerName, value);
187
187
  }
188
- var _isDev = isDev();
189
188
  var SAFE_ATTR_NAME = /^[A-Za-z_:][-A-Za-z0-9_.:]*$/;
190
189
  function isSafeAttrName(name) {
191
190
  return SAFE_ATTR_NAME.test(name);
192
191
  }
193
192
  function ssrErrorComment(err) {
194
- if (_isDev) {
193
+ if (DEV) {
195
194
  const msg = escapeHtml(err instanceof Error ? err.message : String(err));
196
195
  return `<!--SSR error: ${safeCommentText(msg)}-->`;
197
196
  }
@@ -237,10 +236,10 @@ function renderToString(element) {
237
236
  }
238
237
  const tag = element.tagName.toLowerCase();
239
238
  if (tag === "script" || tag === "style") {
240
- return _isDev ? `<!--ssr:${tag}-stripped-->` : "";
239
+ return DEV ? `<!--ssr:${tag}-stripped-->` : "";
241
240
  }
242
241
  if (!/^[a-z][a-z0-9-]*$/i.test(tag)) {
243
- return _isDev ? "<!--ssr:invalid-tag-->" : "";
242
+ return DEV ? "<!--ssr:invalid-tag-->" : "";
244
243
  }
245
244
  let html = `<${tag}`;
246
245
  for (const attr of Array.from(element.attributes)) {
@@ -282,7 +281,7 @@ function hydrate(component, container, options = {}) {
282
281
  const first = mismatches[0];
283
282
  if (options.onMismatch) {
284
283
  options.onMismatch(first);
285
- } else if (_isDev) {
284
+ } else if (DEV) {
286
285
  console.warn(
287
286
  `[SibuJS hydration] ${first.message}
288
287
  at ${first.path}
@@ -483,11 +482,11 @@ async function* renderToStream(element) {
483
482
  }
484
483
  const tag = element.tagName.toLowerCase();
485
484
  if (tag === "script" || tag === "style") {
486
- if (_isDev) yield `<!--ssr:${tag}-stripped-->`;
485
+ if (DEV) yield `<!--ssr:${tag}-stripped-->`;
487
486
  return;
488
487
  }
489
488
  if (!/^[a-z][a-z0-9-]*$/i.test(tag)) {
490
- if (_isDev) yield "<!--ssr:invalid-tag-->";
489
+ if (DEV) yield "<!--ssr:invalid-tag-->";
491
490
  return;
492
491
  }
493
492
  let openTag = `<${tag}`;
@@ -630,7 +629,7 @@ function ssrSuspense(props) {
630
629
  },
631
630
  (err) => {
632
631
  if (timer) clearTimeout(timer);
633
- if (_isDev) console.warn("[SibuJS SSR] ssrSuspense rejected:", err);
632
+ if (DEV) console.warn("[SibuJS SSR] ssrSuspense rejected:", err);
634
633
  return { id, html: fallbackHtml };
635
634
  }
636
635
  );
@@ -676,7 +675,7 @@ function serializeState(state, nonce, options) {
676
675
  }
677
676
  function deserializeState(validate) {
678
677
  if (typeof window === "undefined") return void 0;
679
- if (_isDev && !validate) {
678
+ if (DEV && !validate) {
680
679
  console.warn(
681
680
  "[SibuJS SSR] deserializeState() called without a validate guard \u2014 tampered SSR payloads will not be detected."
682
681
  );
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-H3SRKIYX.js";
5
5
  import {
6
6
  derived
7
- } from "./chunk-DCDS2PQ6.js";
7
+ } from "./chunk-2LOYNGBY.js";
8
8
  import {
9
9
  effect
10
- } from "./chunk-PFTDGEPZ.js";
10
+ } from "./chunk-7VEC3UD2.js";
11
11
  import {
12
12
  batch,
13
13
  signal
14
- } from "./chunk-UFSQEO7P.js";
14
+ } from "./chunk-HECVW343.js";
15
15
 
16
16
  // src/patterns/machine.ts
17
17
  function machine(config) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SVG_NS,
3
3
  tagFactory
4
- } from "./chunk-I3VI34DP.js";
4
+ } from "./chunk-6ZGI3RBE.js";
5
5
 
6
6
  // src/core/rendering/html.ts
7
7
  var html = tagFactory("html");
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  watch
3
- } from "./chunk-KSOEJGFO.js";
3
+ } from "./chunk-BMYYZWHX.js";
4
4
  import {
5
5
  createId
6
6
  } from "./chunk-CCSJMTRN.js";
7
7
  import {
8
8
  derived
9
- } from "./chunk-DCDS2PQ6.js";
9
+ } from "./chunk-2LOYNGBY.js";
10
10
  import {
11
11
  stripHtml
12
- } from "./chunk-5INI7D2L.js";
12
+ } from "./chunk-IXKSNWV5.js";
13
13
  import {
14
14
  effect
15
- } from "./chunk-PFTDGEPZ.js";
15
+ } from "./chunk-7VEC3UD2.js";
16
16
  import {
17
17
  batch,
18
18
  signal
19
- } from "./chunk-UFSQEO7P.js";
19
+ } from "./chunk-HECVW343.js";
20
20
 
21
21
  // src/widgets/Combobox.ts
22
22
  var boundComboboxes = /* @__PURE__ */ new WeakMap();
@@ -1,8 +1,8 @@
1
1
  import {
2
+ DEV,
2
3
  devWarn,
3
- isDev,
4
4
  reportError
5
- } from "./chunk-VPP2FONR.js";
5
+ } from "./chunk-2WLZ6757.js";
6
6
 
7
7
  // src/core/rendering/dispose.ts
8
8
  var elementDisposers = /* @__PURE__ */ new WeakMap();
@@ -14,7 +14,6 @@ function reportDrainRunaway(label, executed, remaining) {
14
14
  { executed, remaining }
15
15
  );
16
16
  }
17
- var _isDev = isDev();
18
17
  var activeBindingCount = 0;
19
18
  function registerDisposer(node, teardown) {
20
19
  let disposers = elementDisposers.get(node);
@@ -23,7 +22,7 @@ function registerDisposer(node, teardown) {
23
22
  elementDisposers.set(node, disposers);
24
23
  }
25
24
  disposers.push(teardown);
26
- if (_isDev) activeBindingCount++;
25
+ if (DEV) activeBindingCount++;
27
26
  }
28
27
  function unregisterDisposer(node, teardown) {
29
28
  const disposers = elementDisposers.get(node);
@@ -31,7 +30,7 @@ function unregisterDisposer(node, teardown) {
31
30
  const index = disposers.indexOf(teardown);
32
31
  if (index === -1) return;
33
32
  disposers.splice(index, 1);
34
- if (_isDev) activeBindingCount--;
33
+ if (DEV) activeBindingCount--;
35
34
  if (disposers.length === 0) elementDisposers.delete(node);
36
35
  }
37
36
  function dispose(node) {
@@ -55,13 +54,13 @@ function dispose(node) {
55
54
  if (!pending || pending.length === 0) break;
56
55
  const snapshot = pending.slice();
57
56
  elementDisposers.delete(current);
58
- if (_isDev) activeBindingCount -= snapshot.length;
57
+ if (DEV) activeBindingCount -= snapshot.length;
59
58
  for (let i2 = 0; i2 < snapshot.length; i2++) {
60
59
  if (executed >= MAX_DRAIN_TEARDOWNS) {
61
60
  const rest = snapshot.slice(i2);
62
61
  const added = elementDisposers.get(current);
63
62
  elementDisposers.set(current, added ? rest.concat(added) : rest);
64
- if (_isDev) activeBindingCount += rest.length;
63
+ if (DEV) activeBindingCount += rest.length;
65
64
  reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
66
65
  runaway = true;
67
66
  break;
@@ -89,7 +88,7 @@ function replaceChildrenSafely(parent, ...next) {
89
88
  parent.replaceChildren(...next);
90
89
  }
91
90
  function checkLeaks(warnThreshold = 0) {
92
- if (!_isDev) return 0;
91
+ if (!DEV) return 0;
93
92
  if (warnThreshold > 0 && activeBindingCount > warnThreshold) {
94
93
  devWarn(
95
94
  `checkLeaks: ${activeBindingCount} active DOM bindings detected. Expected \u2264${warnThreshold}. This may indicate a component was removed from the DOM without calling dispose().`
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  stripHtml
3
- } from "./chunk-5INI7D2L.js";
3
+ } from "./chunk-IXKSNWV5.js";
4
4
  import {
5
5
  globalSingleton
6
6
  } from "./chunk-7ZHH77QA.js";
7
7
  import {
8
8
  effect
9
- } from "./chunk-PFTDGEPZ.js";
9
+ } from "./chunk-7VEC3UD2.js";
10
10
  import {
11
11
  dispose
12
- } from "./chunk-DHDZ7IVN.js";
12
+ } from "./chunk-QKRPLZ2V.js";
13
13
  import {
14
14
  signal
15
- } from "./chunk-UFSQEO7P.js";
15
+ } from "./chunk-HECVW343.js";
16
16
  import {
17
17
  forEachSubscriber,
18
18
  getSubscriberCount,
19
19
  getSubscriberDeps
20
- } from "./chunk-D3SZ4LVS.js";
20
+ } from "./chunk-7ALC7KGE.js";
21
21
  import {
22
22
  isDev
23
- } from "./chunk-VPP2FONR.js";
23
+ } from "./chunk-2WLZ6757.js";
24
24
 
25
25
  // src/devtools/debug.ts
26
26
  var debugEnabled = false;