sibujs 4.7.0 → 4.8.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 (81) hide show
  1. package/dist/browser.cjs +45 -4
  2. package/dist/browser.d.cts +23 -0
  3. package/dist/browser.d.ts +23 -0
  4. package/dist/browser.js +6 -5
  5. package/dist/build.cjs +513 -78
  6. package/dist/build.d.cts +22 -8
  7. package/dist/build.d.ts +22 -8
  8. package/dist/build.js +68 -21
  9. package/dist/cdn.dev.global.js +15 -13
  10. package/dist/cdn.full.dev.global.js +15 -13
  11. package/dist/cdn.full.global.js +14 -12
  12. package/dist/cdn.global.js +14 -12
  13. package/dist/chunk-3ACAAQIN.js +224 -0
  14. package/dist/{chunk-DKXRACVN.js → chunk-44MTL7ED.js} +6 -6
  15. package/dist/{chunk-3QWBSL5R.js → chunk-4WMSTZ7J.js} +8 -5
  16. package/dist/{chunk-H3SRKIYX.js → chunk-62BDYGAG.js} +8 -0
  17. package/dist/{chunk-BSY63EM6.js → chunk-C5PEWEGH.js} +20 -5
  18. package/dist/{chunk-BC2SECJD.js → chunk-C7AA2CZX.js} +1 -1
  19. package/dist/{chunk-SLM3IA34.js → chunk-CZPRSWSS.js} +1 -1
  20. package/dist/{chunk-FQRUXCEE.js → chunk-DSID757X.js} +1 -1
  21. package/dist/{chunk-ZVL7TY4K.js → chunk-EGUQLBHE.js} +22 -8
  22. package/dist/{chunk-2INLLLMZ.js → chunk-EXXSN3BW.js} +202 -26
  23. package/dist/{chunk-HURREPU2.js → chunk-FC6KCJSA.js} +87 -150
  24. package/dist/{chunk-Z3OHK6QT.js → chunk-GSGNX35Q.js} +5 -5
  25. package/dist/{chunk-XYV3EDB7.js → chunk-J3YQ457H.js} +37 -20
  26. package/dist/{chunk-VZSG24LS.js → chunk-JUTFX2RM.js} +18 -10
  27. package/dist/{chunk-RUSSKG6G.js → chunk-KJ3UKABJ.js} +1 -1
  28. package/dist/{chunk-UNWRJRKC.js → chunk-LI4W3U6C.js} +1 -1
  29. package/dist/{chunk-FNJXNGYZ.js → chunk-O6TRVMJI.js} +58 -6
  30. package/dist/{chunk-7LUJQAOJ.js → chunk-Q5J2LVKH.js} +1 -1
  31. package/dist/{chunk-4AWA2PVD.js → chunk-QGMSESDD.js} +10 -5
  32. package/dist/{chunk-XZR4PXRE.js → chunk-RGLPEBDE.js} +13 -10
  33. package/dist/{chunk-JWKYU5GV.js → chunk-TQQUN4WR.js} +1 -1
  34. package/dist/{chunk-WOLJZUFQ.js → chunk-UCNP3HVM.js} +12 -8
  35. package/dist/{chunk-WEQ3DMVL.js → chunk-V3LHZSU5.js} +1 -1
  36. package/dist/{chunk-UOL2ECCS.js → chunk-VWT3VXPL.js} +18 -12
  37. package/dist/{chunk-2BPG2XDA.js → chunk-ZVLHNEEL.js} +17 -35
  38. package/dist/{customElement-MmInOW1U.d.ts → customElement-pYDKUzWl.d.cts} +11 -3
  39. package/dist/{customElement-MmInOW1U.d.cts → customElement-pYDKUzWl.d.ts} +11 -3
  40. package/dist/data.cjs +9 -2
  41. package/dist/data.js +6 -6
  42. package/dist/devtools.cjs +1 -1
  43. package/dist/devtools.js +5 -5
  44. package/dist/ecosystem.cjs +400 -37
  45. package/dist/ecosystem.js +9 -8
  46. package/dist/extras.cjs +621 -252
  47. package/dist/extras.d.cts +2 -2
  48. package/dist/extras.d.ts +2 -2
  49. package/dist/extras.js +24 -23
  50. package/dist/index.cjs +464 -70
  51. package/dist/index.d.cts +28 -2
  52. package/dist/index.d.ts +28 -2
  53. package/dist/index.js +16 -12
  54. package/dist/motion.cjs +1 -1
  55. package/dist/motion.js +3 -3
  56. package/dist/patterns.cjs +10 -7
  57. package/dist/patterns.js +6 -6
  58. package/dist/performance.cjs +31 -2
  59. package/dist/performance.d.cts +12 -2
  60. package/dist/performance.d.ts +12 -2
  61. package/dist/performance.js +8 -6
  62. package/dist/plugins.cjs +558 -231
  63. package/dist/plugins.d.cts +8 -3
  64. package/dist/plugins.d.ts +8 -3
  65. package/dist/plugins.js +22 -28
  66. package/dist/{ssr-XOTUASDO.js → ssr-5OWAH3U2.js} +4 -2
  67. package/dist/{ssr-Bli9XRW5.d.ts → ssr-C8hgIAw7.d.cts} +6 -0
  68. package/dist/{ssr-Bli9XRW5.d.cts → ssr-C8hgIAw7.d.ts} +6 -0
  69. package/dist/ssr.cjs +457 -131
  70. package/dist/ssr.d.cts +55 -5
  71. package/dist/ssr.d.ts +55 -5
  72. package/dist/ssr.js +11 -9
  73. package/dist/testing.cjs +3 -3
  74. package/dist/testing.js +4 -4
  75. package/dist/ui.cjs +608 -240
  76. package/dist/ui.d.cts +1 -1
  77. package/dist/ui.d.ts +1 -1
  78. package/dist/ui.js +9 -8
  79. package/dist/widgets.cjs +1 -1
  80. package/dist/widgets.js +7 -7
  81. package/package.json +5 -4
@@ -135,40 +135,44 @@ import {
135
135
  use,
136
136
  var_,
137
137
  video
138
- } from "./chunk-7LUJQAOJ.js";
138
+ } from "./chunk-Q5J2LVKH.js";
139
139
  import {
140
140
  trustHTML
141
- } from "./chunk-HURREPU2.js";
141
+ } from "./chunk-FC6KCJSA.js";
142
142
  import {
143
143
  watch
144
- } from "./chunk-SLM3IA34.js";
144
+ } from "./chunk-CZPRSWSS.js";
145
145
  import {
146
146
  __resetIdCounter,
147
147
  createId,
148
148
  domBinding
149
- } from "./chunk-BC2SECJD.js";
149
+ } from "./chunk-C7AA2CZX.js";
150
150
  import {
151
151
  SVG_NS,
152
152
  bindChildNode,
153
153
  captureFocusWithin,
154
154
  restoreFocusWithin,
155
155
  tagFactory
156
- } from "./chunk-UOL2ECCS.js";
156
+ } from "./chunk-VWT3VXPL.js";
157
157
  import {
158
158
  bindAttribute,
159
159
  bindDynamic,
160
- setSafeAttribute
161
- } from "./chunk-FNJXNGYZ.js";
160
+ setSafeAttribute,
161
+ setTrustedAttribute
162
+ } from "./chunk-O6TRVMJI.js";
163
+ import {
164
+ isCodeTextElement
165
+ } from "./chunk-3ACAAQIN.js";
162
166
  import {
163
167
  derived
164
- } from "./chunk-RUSSKG6G.js";
168
+ } from "./chunk-KJ3UKABJ.js";
165
169
  import {
166
170
  globalSingleton
167
171
  } from "./chunk-7ZHH77QA.js";
168
172
  import {
169
173
  effect,
170
174
  on
171
- } from "./chunk-WEQ3DMVL.js";
175
+ } from "./chunk-V3LHZSU5.js";
172
176
  import {
173
177
  disableSSR,
174
178
  enableSSR,
@@ -187,7 +191,7 @@ import {
187
191
  external,
188
192
  isBatching,
189
193
  signal
190
- } from "./chunk-FQRUXCEE.js";
194
+ } from "./chunk-DSID757X.js";
191
195
  import {
192
196
  emitDevtools,
193
197
  notifySubscribers,
@@ -199,7 +203,7 @@ import {
199
203
  suspendTracking,
200
204
  track,
201
205
  untracked
202
- } from "./chunk-JWKYU5GV.js";
206
+ } from "./chunk-TQQUN4WR.js";
203
207
  import {
204
208
  DEV,
205
209
  MAX_DRAIN_TEARDOWNS,
@@ -234,6 +238,7 @@ __export(index_exports, {
234
238
  Portal: () => Portal,
235
239
  SVG_NS: () => SVG_NS,
236
240
  Suspense: () => Suspense,
241
+ __renderParsedTemplate: () => __renderParsedTemplate,
237
242
  __resetIdCounter: () => __resetIdCounter,
238
243
  a: () => a,
239
244
  abbr: () => abbr,
@@ -1831,6 +1836,10 @@ function attachBranch(parent, anchor, branch, attachedOnce, where) {
1831
1836
  parent.insertBefore(node, anchor.nextSibling);
1832
1837
  return { node, owned };
1833
1838
  }
1839
+ function releaseBranchNode(node, owned) {
1840
+ if (owned) dispose(node);
1841
+ node.parentNode?.removeChild(node);
1842
+ }
1834
1843
  function when(condition, thenBranch, elseBranch) {
1835
1844
  const anchor = document.createComment("when");
1836
1845
  let currentNode = null;
@@ -1848,8 +1857,7 @@ function when(condition, thenBranch, elseBranch) {
1848
1857
  lastCondition = show2;
1849
1858
  const focused = currentNode ? captureFocusWithin([currentNode]) : null;
1850
1859
  if (currentNode?.parentNode) {
1851
- if (currentNodeOwned) dispose(currentNode);
1852
- currentNode.parentNode.removeChild(currentNode);
1860
+ releaseBranchNode(currentNode, currentNodeOwned);
1853
1861
  currentNode = null;
1854
1862
  }
1855
1863
  const branch = show2 ? thenBranch : elseBranch !== void 0 ? elseBranch : null;
@@ -1863,6 +1871,8 @@ function when(condition, thenBranch, elseBranch) {
1863
1871
  registerDisposer(anchor, () => {
1864
1872
  disposed = true;
1865
1873
  stopBinding();
1874
+ if (currentNode) releaseBranchNode(currentNode, currentNodeOwned);
1875
+ currentNode = null;
1866
1876
  });
1867
1877
  if (!initialized) {
1868
1878
  queueMicrotask(() => {
@@ -1888,8 +1898,7 @@ function match(value, cases, fallback) {
1888
1898
  lastKey = key;
1889
1899
  const focused = currentNode ? captureFocusWithin([currentNode]) : null;
1890
1900
  if (currentNode?.parentNode) {
1891
- if (currentNodeOwned) dispose(currentNode);
1892
- currentNode.parentNode.removeChild(currentNode);
1901
+ releaseBranchNode(currentNode, currentNodeOwned);
1893
1902
  currentNode = null;
1894
1903
  }
1895
1904
  const branch = Object.hasOwn(cases, key) ? cases[key] : fallback;
@@ -1903,6 +1912,8 @@ function match(value, cases, fallback) {
1903
1912
  registerDisposer(anchor, () => {
1904
1913
  disposed = true;
1905
1914
  stopBinding();
1915
+ if (currentNode) releaseBranchNode(currentNode, currentNodeOwned);
1916
+ currentNode = null;
1906
1917
  });
1907
1918
  if (!initialized) {
1908
1919
  queueMicrotask(() => {
@@ -2239,7 +2250,6 @@ function appendChild(frag, child) {
2239
2250
  }
2240
2251
 
2241
2252
  // src/core/rendering/htm.ts
2242
- var RAW_TEXT_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
2243
2253
  var VOID_ELEMENTS = /* @__PURE__ */ new Set([
2244
2254
  "area",
2245
2255
  "base",
@@ -2462,7 +2472,7 @@ function parseTemplate(strings) {
2462
2472
  children.push({ t: 0, el: { tag, svg: SVG_TAGS.has(tag), attrs, children: [] } });
2463
2473
  } else {
2464
2474
  const inner = parseChildren();
2465
- if (RAW_TEXT_TAGS.has(tag.toLowerCase())) {
2475
+ if (isCodeTextElement(tag)) {
2466
2476
  for (let i2 = 0; i2 < inner.length; i2++) {
2467
2477
  if (inner[i2].t === 2) {
2468
2478
  throw new Error(
@@ -2493,7 +2503,7 @@ function executeElement(tmpl, values) {
2493
2503
  const attr = tmpl.attrs[i2];
2494
2504
  switch (attr.t) {
2495
2505
  case 0:
2496
- el.setAttribute(attr.name, attr.value);
2506
+ setTrustedAttribute(el, attr.name, attr.value);
2497
2507
  break;
2498
2508
  case 1: {
2499
2509
  const name = attr.name;
@@ -2526,7 +2536,7 @@ function executeElement(tmpl, values) {
2526
2536
  break;
2527
2537
  }
2528
2538
  case 4:
2529
- el.setAttribute(attr.name, "");
2539
+ setTrustedAttribute(el, attr.name, "");
2530
2540
  break;
2531
2541
  }
2532
2542
  }
@@ -2571,6 +2581,12 @@ function html(strings, ...values) {
2571
2581
  tmpl = parseTemplate(strings);
2572
2582
  cache.set(strings, tmpl);
2573
2583
  }
2584
+ return renderTemplate(tmpl, values);
2585
+ }
2586
+ function __renderParsedTemplate(tree, values) {
2587
+ return renderTemplate(tree, values);
2588
+ }
2589
+ function renderTemplate(tmpl, values) {
2574
2590
  if (tmpl.length === 1 && tmpl[0].t === 0) {
2575
2591
  return executeElement(tmpl[0].el, values);
2576
2592
  }
@@ -3512,7 +3528,7 @@ function enhance(target, setup) {
3512
3528
  bindNode(el, () => {
3513
3529
  const v = value();
3514
3530
  const next = v == null ? null : String(v);
3515
- setSafeAttribute(el, name, next, { syncValueProperty: false, label: "enhance attr()" });
3531
+ setSafeAttribute(el, name, next, { syncValueProperty: false, label: "enhance attr()", reactive: true });
3516
3532
  })
3517
3533
  );
3518
3534
  });
@@ -3899,6 +3915,7 @@ export {
3899
3915
  each,
3900
3916
  Fragment,
3901
3917
  html,
3918
+ __renderParsedTemplate,
3902
3919
  KeepAlive,
3903
3920
  mount,
3904
3921
  Portal,
@@ -6,25 +6,25 @@ import {
6
6
  import {
7
7
  div,
8
8
  span
9
- } from "./chunk-7LUJQAOJ.js";
9
+ } from "./chunk-Q5J2LVKH.js";
10
10
  import {
11
11
  STATIC_VALUE_RESOLVER,
12
12
  planHeadElementEntry,
13
13
  planMetaEntry
14
- } from "./chunk-HURREPU2.js";
15
- import {
16
- sanitizeUrl
17
- } from "./chunk-2INLLLMZ.js";
14
+ } from "./chunk-FC6KCJSA.js";
18
15
  import {
19
16
  globalSingleton
20
17
  } from "./chunk-7ZHH77QA.js";
21
18
  import {
22
19
  effect
23
- } from "./chunk-WEQ3DMVL.js";
20
+ } from "./chunk-V3LHZSU5.js";
21
+ import {
22
+ sanitizeUrl
23
+ } from "./chunk-EXXSN3BW.js";
24
24
  import {
25
25
  batch,
26
26
  signal
27
- } from "./chunk-FQRUXCEE.js";
27
+ } from "./chunk-DSID757X.js";
28
28
  import {
29
29
  registerDisposer,
30
30
  replaceChildrenSafely,
@@ -179,7 +179,16 @@ function toError(err) {
179
179
  if (err !== null && typeof err === "object" && "name" in err && "message" in err) return err;
180
180
  return new Error(String(err));
181
181
  }
182
+ function workerSource(fn, api) {
183
+ if (typeof fn !== "function") {
184
+ throw new TypeError(
185
+ `${api}: expected a function, got ${typeof fn}. Worker code must be a function defined in your source \u2014 a string would be evaluated as code.`
186
+ );
187
+ }
188
+ return Function.prototype.toString.call(fn);
189
+ }
182
190
  function worker(workerFn2) {
191
+ const fnBody = workerSource(workerFn2, "worker");
183
192
  const [result, setResult] = signal(null);
184
193
  const [error, setError] = signal(null);
185
194
  const [loading, setLoading] = signal(false);
@@ -195,7 +204,6 @@ function worker(workerFn2) {
195
204
  if (typeof Worker === "undefined") {
196
205
  throw new Error("Web Workers are not supported in this environment");
197
206
  }
198
- const fnBody = workerFn2.toString();
199
207
  const blob = new Blob([`self.onmessage = ${fnBody};`], { type: "application/javascript" });
200
208
  blobUrl = URL.createObjectURL(blob);
201
209
  worker2 = new Worker(blobUrl);
@@ -244,6 +252,7 @@ function worker(workerFn2) {
244
252
  return { post, result, error, loading, terminate };
245
253
  }
246
254
  function workerFn(fn) {
255
+ const fnStr = workerSource(fn, "workerFn");
247
256
  const [loading, setLoading] = signal(false);
248
257
  let worker2 = null;
249
258
  let blobUrl = null;
@@ -258,7 +267,6 @@ function workerFn(fn) {
258
267
  if (typeof Worker === "undefined") {
259
268
  throw new Error("Web Workers are not supported in this environment");
260
269
  }
261
- const fnStr = fn.toString();
262
270
  const blob = new Blob(
263
271
  [
264
272
  `self.onmessage = function(e) {
@@ -318,6 +326,7 @@ function workerFn(fn) {
318
326
  return { run, loading, terminate };
319
327
  }
320
328
  function createWorkerPool(workerFn2, poolSize) {
329
+ const fnBody = workerSource(workerFn2, "createWorkerPool");
321
330
  const size = poolSize || typeof navigator !== "undefined" && navigator.hardwareConcurrency || 4;
322
331
  const workers = [];
323
332
  const queues = [];
@@ -376,7 +385,6 @@ function createWorkerPool(workerFn2, poolSize) {
376
385
  if (typeof Worker === "undefined") {
377
386
  throw new Error("Web Workers are not supported in this environment");
378
387
  }
379
- const fnBody = workerFn2.toString();
380
388
  const blob = new Blob([`self.onmessage = ${fnBody};`], { type: "application/javascript" });
381
389
  blobUrl = URL.createObjectURL(blob);
382
390
  for (let i = 0; i < size; i++) {
@@ -5,7 +5,7 @@ import {
5
5
  recordDependency,
6
6
  retrack,
7
7
  track
8
- } from "./chunk-JWKYU5GV.js";
8
+ } from "./chunk-TQQUN4WR.js";
9
9
  import {
10
10
  devAssert
11
11
  } from "./chunk-NYNYSPK7.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5HZXGZ6T.js";
4
4
  import {
5
5
  signal
6
- } from "./chunk-FQRUXCEE.js";
6
+ } from "./chunk-DSID757X.js";
7
7
  import {
8
8
  registerDisposer,
9
9
  reportError
@@ -1,14 +1,20 @@
1
+ import {
2
+ ContextualRefusal,
3
+ contextualAttributeRefusal,
4
+ settleAttributeProvenance
5
+ } from "./chunk-3ACAAQIN.js";
1
6
  import {
2
7
  isEventHandlerAttr,
3
8
  isHtmlContentAttribute,
4
- sanitizeAttributeString
5
- } from "./chunk-2INLLLMZ.js";
9
+ resolveAttributeValue
10
+ } from "./chunk-EXXSN3BW.js";
6
11
  import {
7
12
  reactiveBinding
8
- } from "./chunk-JWKYU5GV.js";
13
+ } from "./chunk-TQQUN4WR.js";
9
14
  import {
10
15
  DEV,
11
16
  devWarn,
17
+ devWarnLazy,
12
18
  reportError
13
19
  } from "./chunk-NYNYSPK7.js";
14
20
 
@@ -21,6 +27,19 @@ var BOOLEAN_IDL_ATTRS = /* @__PURE__ */ new Set(["checked", "disabled", "selecte
21
27
  function isHtmlElement(el) {
22
28
  return el.namespaceURI === null || el.namespaceURI === HTML_NS;
23
29
  }
30
+ function warnContextualRefusal(label, name, refusal) {
31
+ devWarnLazy(() => {
32
+ const reasons = [
33
+ "",
34
+ 'the element would become a <meta http-equiv="refresh"> directive the shared refresh policy forbids (a destination outside the URL allowlist, or a directive too malformed to read unambiguously)',
35
+ "a <meta> whose http-equiv or content is reactive may never carry a refresh directive: a browser schedules the navigation as soon as the directive is valid, and nothing can withdraw it when the state changes back",
36
+ "a runtime value may not choose the program a <script> runs; name the script in static template source, or load it through Head({ script }) as an explicit trust decision",
37
+ "an SVG animation may not target a URL, event-handler or nested-document attribute; its to / values would be written into that attribute without passing the URL policy",
38
+ 'a runtime-chosen href may not become an applied <link rel="stylesheet">: a well-formed URL is not a trusted stylesheet. Name the stylesheet in static template source, or load a runtime-chosen one through Head({ link }) as an explicit trust decision'
39
+ ];
40
+ return `${label}: refusing "${name}" in this element's context \u2014 ${reasons[refusal]}. The write was not performed.`;
41
+ });
42
+ }
24
43
  function setProp(el, key, val) {
25
44
  el[key] = val;
26
45
  }
@@ -32,6 +51,11 @@ function namespaceFor(el, name) {
32
51
  return null;
33
52
  }
34
53
  function setSafeAttribute(el, name, value, options = {}) {
54
+ const written = commitSafeAttribute(el, name, value, options);
55
+ if (el.localName === "link") settleAttributeProvenance(el, name, options.reactive ? "reactive" : "runtime");
56
+ return written;
57
+ }
58
+ function commitSafeAttribute(el, name, value, options) {
35
59
  const ns = namespaceFor(el, name);
36
60
  const localName = ns ? name.slice(name.indexOf(":") + 1) : name;
37
61
  if (isEventHandlerAttr(name)) {
@@ -44,6 +68,14 @@ function setSafeAttribute(el, name, value, options = {}) {
44
68
  else el.removeAttribute(name);
45
69
  return false;
46
70
  }
71
+ const pending = value == null || value === false ? null : value === true ? "" : String(value);
72
+ const refusal = contextualAttributeRefusal(el, name, pending, options.reactive ? "reactive" : "runtime");
73
+ if (refusal !== ContextualRefusal.None) {
74
+ warnContextualRefusal(options.label ?? "setSafeAttribute", name, refusal);
75
+ if (ns) el.removeAttributeNS(ns, localName);
76
+ else el.removeAttribute(name);
77
+ return false;
78
+ }
47
79
  if (value == null) {
48
80
  if (ns) el.removeAttributeNS(ns, localName);
49
81
  else el.removeAttribute(name);
@@ -87,13 +119,32 @@ function setSafeAttribute(el, name, value, options = {}) {
87
119
  setProp(el, idlName, idlName === "checked" ? Boolean(value) : str);
88
120
  return true;
89
121
  }
90
- const safe = sanitizeAttributeString(name, str, { element: el });
122
+ const safe = str === "" ? "" : resolveAttributeValue(name, str, { element: el });
123
+ if (safe === null) {
124
+ if (ns) el.removeAttributeNS(ns, localName);
125
+ else el.removeAttribute(name);
126
+ return true;
127
+ }
91
128
  const current = ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name);
92
129
  if (current === safe) return true;
93
130
  if (ns) el.setAttributeNS(ns, name, safe);
94
131
  else el.setAttribute(name, safe);
95
132
  return true;
96
133
  }
134
+ function setTrustedAttribute(el, name, value) {
135
+ if (isHtmlContentAttribute(name)) {
136
+ if (DEV) devWarn(`html: refusing static attribute "${name}" \u2014 the browser parses it as a nested document.`);
137
+ return false;
138
+ }
139
+ const refusal = contextualAttributeRefusal(el, name, value, "static");
140
+ if (refusal !== ContextualRefusal.None) {
141
+ warnContextualRefusal("html (static attribute)", name, refusal);
142
+ return false;
143
+ }
144
+ el.setAttribute(name, value);
145
+ if (el.localName === "link") settleAttributeProvenance(el, name, "static");
146
+ return true;
147
+ }
97
148
 
98
149
  // src/reactivity/bindAttribute.ts
99
150
  function bindAttribute(el, attr, getter) {
@@ -110,7 +161,7 @@ function bindAttribute(el, attr, getter) {
110
161
  reportError(err, { phase: "binding", name: `bindAttribute("${attr}")`, node: el });
111
162
  return;
112
163
  }
113
- setSafeAttribute(el, attr, value, { label: `bindAttribute("${attr}")` });
164
+ setSafeAttribute(el, attr, value, { label: `bindAttribute("${attr}")`, reactive: true });
114
165
  }
115
166
  return reactiveBinding(commit, el);
116
167
  }
@@ -135,7 +186,7 @@ function bindDynamic(el, nameGetter, valueGetter) {
135
186
  el.removeAttribute(prevName);
136
187
  prevName = null;
137
188
  }
138
- if (!setSafeAttribute(el, name, value, { label: "bindDynamic" })) return;
189
+ if (!setSafeAttribute(el, name, value, { label: "bindDynamic", reactive: true })) return;
139
190
  prevName = name;
140
191
  }
141
192
  const teardown = reactiveBinding(commit, el);
@@ -149,6 +200,7 @@ function bindDynamic(el, nameGetter, valueGetter) {
149
200
 
150
201
  export {
151
202
  setSafeAttribute,
203
+ setTrustedAttribute,
152
204
  bindAttribute,
153
205
  bindDynamic
154
206
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SVG_NS,
3
3
  tagFactory
4
- } from "./chunk-UOL2ECCS.js";
4
+ } from "./chunk-VWT3VXPL.js";
5
5
 
6
6
  // src/core/rendering/html.ts
7
7
  var html = tagFactory("html");
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  renderToString
3
- } from "./chunk-HURREPU2.js";
3
+ } from "./chunk-FC6KCJSA.js";
4
4
  import {
5
5
  globalSingleton
6
6
  } from "./chunk-7ZHH77QA.js";
7
+ import {
8
+ sanitizeUrl
9
+ } from "./chunk-EXXSN3BW.js";
7
10
  import {
8
11
  reportError
9
12
  } from "./chunk-NYNYSPK7.js";
@@ -167,7 +170,7 @@ var CDN_ENTRY_POINTS = {
167
170
  };
168
171
  var packageInfo = {
169
172
  name: "sibujs",
170
- version: true ? "4.7.0" : "dev",
173
+ version: true ? "4.8.0" : "dev",
171
174
  entryPoints: MODULE_ENTRY_POINTS,
172
175
  /**
173
176
  * Generate the package.json `exports` map. Module entries resolve to the
@@ -312,7 +315,7 @@ var env = {
312
315
  };
313
316
 
314
317
  // src/plugins/versioning.ts
315
- var VERSION = true ? "4.7.0" : "dev";
318
+ var VERSION = true ? "4.8.0" : "dev";
316
319
  var NUM = "(?:0|[1-9]\\d*)";
317
320
  var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
318
321
  var BUILD_ID = "[0-9a-zA-Z-]+";
@@ -595,12 +598,14 @@ function extractRangeTarget(range) {
595
598
  function preloadCritical(resources) {
596
599
  if (typeof document === "undefined") return;
597
600
  for (const resource of resources) {
598
- const safeHref = typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(resource.href) : resource.href.replace(/["\\]/g, "\\$&");
601
+ const href = sanitizeUrl(resource.href);
602
+ if (!href) continue;
603
+ const safeHref = typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(href) : href.replace(/["\\]/g, "\\$&");
599
604
  const existing = document.querySelector(`link[rel="preload"][href="${safeHref}"]`);
600
605
  if (existing) continue;
601
606
  const link = document.createElement("link");
602
607
  link.rel = "preload";
603
- link.href = resource.href;
608
+ link.href = href;
604
609
  link.setAttribute("as", resource.as);
605
610
  if (resource.type) {
606
611
  link.type = resource.type;
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  isUnsafeKey,
3
3
  stripUnsafeKeys
4
- } from "./chunk-H3SRKIYX.js";
4
+ } from "./chunk-62BDYGAG.js";
5
5
  import {
6
6
  derived
7
- } from "./chunk-RUSSKG6G.js";
7
+ } from "./chunk-KJ3UKABJ.js";
8
8
  import {
9
9
  effect
10
- } from "./chunk-WEQ3DMVL.js";
10
+ } from "./chunk-V3LHZSU5.js";
11
11
  import {
12
12
  batch,
13
13
  signal
14
- } from "./chunk-FQRUXCEE.js";
14
+ } from "./chunk-DSID757X.js";
15
15
  import {
16
16
  DEV,
17
17
  devWarn,
@@ -19,6 +19,9 @@ import {
19
19
  } from "./chunk-NYNYSPK7.js";
20
20
 
21
21
  // src/patterns/machine.ts
22
+ function ownEntry(table, key) {
23
+ return Object.hasOwn(table, key) ? table[key] : void 0;
24
+ }
22
25
  function machine(config) {
23
26
  const [state, setState] = signal(config.initial);
24
27
  const [context, setContext] = signal(config.context || {});
@@ -40,9 +43,9 @@ function machine(config) {
40
43
  }
41
44
  }
42
45
  function step(event) {
43
- const stateDef = config.states[currentState];
46
+ const stateDef = ownEntry(config.states, currentState);
44
47
  if (!stateDef?.on) return;
45
- const transition = stateDef.on[event];
48
+ const transition = ownEntry(stateDef.on, event);
46
49
  if (!transition) return;
47
50
  let target;
48
51
  let guard;
@@ -70,7 +73,7 @@ function machine(config) {
70
73
  if (action) setContext(nextContext);
71
74
  setState(target);
72
75
  });
73
- const targetDef = config.states[target];
76
+ const targetDef = ownEntry(config.states, target);
74
77
  if (targetDef?.entry) {
75
78
  targetDef.entry(currentContext);
76
79
  }
@@ -80,7 +83,7 @@ function machine(config) {
80
83
  if (processing) return;
81
84
  drain();
82
85
  }
83
- const initialDef = config.states[config.initial];
86
+ const initialDef = ownEntry(config.states, config.initial);
84
87
  if (initialDef?.entry) {
85
88
  processing = true;
86
89
  try {
@@ -98,9 +101,9 @@ function machine(config) {
98
101
  }
99
102
  function can(event) {
100
103
  const currentState2 = state();
101
- const stateDef = config.states[currentState2];
104
+ const stateDef = ownEntry(config.states, currentState2);
102
105
  if (!stateDef?.on) return false;
103
- const transition = stateDef.on[event];
106
+ const transition = ownEntry(stateDef.on, event);
104
107
  if (!transition) return false;
105
108
  if (typeof transition === "string") return true;
106
109
  if (transition.guard) {
@@ -498,7 +498,7 @@ function forEachSubscriber(signal, visit) {
498
498
  }
499
499
 
500
500
  // src/reactivity/track.ts
501
- var _runtimeVersion = true ? "4.7.0" : "dev";
501
+ var _runtimeVersion = true ? "4.8.0" : "dev";
502
502
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
503
503
  function resolveReactiveApi() {
504
504
  const g = globalThis;
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  derived
3
- } from "./chunk-RUSSKG6G.js";
4
- import {
5
- sanitizeUrl
6
- } from "./chunk-2INLLLMZ.js";
3
+ } from "./chunk-KJ3UKABJ.js";
7
4
  import {
8
5
  globalSingleton
9
6
  } from "./chunk-7ZHH77QA.js";
10
7
  import {
11
8
  effect
12
- } from "./chunk-WEQ3DMVL.js";
9
+ } from "./chunk-V3LHZSU5.js";
10
+ import {
11
+ sanitizeUrl
12
+ } from "./chunk-EXXSN3BW.js";
13
13
  import {
14
14
  getRequestScopedCache
15
15
  } from "./chunk-7XHATCIH.js";
16
16
  import {
17
17
  batch,
18
18
  signal
19
- } from "./chunk-FQRUXCEE.js";
19
+ } from "./chunk-DSID757X.js";
20
20
  import {
21
21
  untracked
22
- } from "./chunk-JWKYU5GV.js";
22
+ } from "./chunk-TQQUN4WR.js";
23
23
  import {
24
24
  reportError
25
25
  } from "./chunk-NYNYSPK7.js";
@@ -173,7 +173,11 @@ function reconcile(prev, next, depth, walk, newRoot) {
173
173
  const nextChild = nextRecord[key];
174
174
  const hasPrev = Object.hasOwn(prevRecord, key);
175
175
  const shared = hasPrev ? reconcile(prevRecord[key], nextChild, depth + 1, walk, false) : nextChild;
176
- copy[key] = shared;
176
+ if (key === "__proto__") {
177
+ Object.defineProperty(copy, key, { value: shared, writable: true, enumerable: true, configurable: true });
178
+ } else {
179
+ copy[key] = shared;
180
+ }
177
181
  if (!hasPrev || !Object.is(shared, prevRecord[key])) allFromPrev = false;
178
182
  if (!Object.is(shared, nextChild)) allFromNext = false;
179
183
  }
@@ -6,7 +6,7 @@ import {
6
6
  emitDevtools,
7
7
  retrack,
8
8
  untracked
9
- } from "./chunk-JWKYU5GV.js";
9
+ } from "./chunk-TQQUN4WR.js";
10
10
  import {
11
11
  devAssert,
12
12
  reportError