sibujs 4.6.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 (94) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +62 -8
  3. package/dist/browser.d.cts +23 -0
  4. package/dist/browser.d.ts +23 -0
  5. package/dist/browser.js +6 -5
  6. package/dist/build.cjs +2388 -1004
  7. package/dist/build.d.cts +147 -44
  8. package/dist/build.d.ts +147 -44
  9. package/dist/build.js +1410 -564
  10. package/dist/cdn.dev.global.js +14 -12
  11. package/dist/cdn.full.dev.global.js +15 -13
  12. package/dist/cdn.full.global.js +14 -12
  13. package/dist/cdn.global.js +12 -10
  14. package/dist/chunk-3ACAAQIN.js +224 -0
  15. package/dist/{chunk-7NCARGJW.js → chunk-44MTL7ED.js} +6 -6
  16. package/dist/{chunk-BAAG6ZTI.js → chunk-4WMSTZ7J.js} +8 -5
  17. package/dist/{chunk-H3SRKIYX.js → chunk-62BDYGAG.js} +8 -0
  18. package/dist/{chunk-DKGBBKOF.js → chunk-C5PEWEGH.js} +20 -5
  19. package/dist/{chunk-3ISI6ACU.js → chunk-C7AA2CZX.js} +1 -1
  20. package/dist/{chunk-UZQ6ALFS.js → chunk-CZPRSWSS.js} +1 -1
  21. package/dist/{chunk-D33YTSX5.js → chunk-DSID757X.js} +5 -4
  22. package/dist/{chunk-OXUY2A6L.js → chunk-EGUQLBHE.js} +22 -8
  23. package/dist/{chunk-2INLLLMZ.js → chunk-EXXSN3BW.js} +202 -26
  24. package/dist/{chunk-HURREPU2.js → chunk-FC6KCJSA.js} +87 -150
  25. package/dist/{chunk-HYXDKS4N.js → chunk-GSGNX35Q.js} +5 -5
  26. package/dist/{chunk-7GQCWFOE.js → chunk-J3YQ457H.js} +171 -85
  27. package/dist/{chunk-ORMZXBKQ.js → chunk-JUTFX2RM.js} +18 -10
  28. package/dist/{chunk-QE4TTDU3.js → chunk-KJ3UKABJ.js} +12 -11
  29. package/dist/{chunk-XRRZKZYX.js → chunk-LI4W3U6C.js} +1 -1
  30. package/dist/{chunk-47M47FOM.js → chunk-O6TRVMJI.js} +58 -6
  31. package/dist/{chunk-JSXPZCET.js → chunk-Q5J2LVKH.js} +1 -1
  32. package/dist/{chunk-5MT6SJ3P.js → chunk-QGMSESDD.js} +10 -5
  33. package/dist/{chunk-AIF3Z2T7.js → chunk-RGLPEBDE.js} +13 -10
  34. package/dist/{chunk-5Q4R7HCL.js → chunk-TQQUN4WR.js} +11 -2
  35. package/dist/{chunk-PK6FK2G2.js → chunk-UCNP3HVM.js} +183 -30
  36. package/dist/{chunk-XC4MEKGA.js → chunk-V3LHZSU5.js} +8 -2
  37. package/dist/{chunk-VVWPJ543.js → chunk-VWT3VXPL.js} +55 -20
  38. package/dist/{chunk-SXXVZMKZ.js → chunk-ZVLHNEEL.js} +17 -35
  39. package/dist/{contracts-DRIuclVT.d.cts → contracts-CLqzJnOV.d.ts} +28 -17
  40. package/dist/{contracts-DRIuclVT.d.ts → contracts-CTOJXu-x.d.cts} +28 -17
  41. package/dist/{customElement-MmInOW1U.d.ts → customElement-pYDKUzWl.d.cts} +11 -3
  42. package/dist/{customElement-MmInOW1U.d.cts → customElement-pYDKUzWl.d.ts} +11 -3
  43. package/dist/data.cjs +205 -39
  44. package/dist/data.d.cts +119 -3
  45. package/dist/data.d.ts +119 -3
  46. package/dist/data.js +6 -6
  47. package/dist/devtools.cjs +18 -5
  48. package/dist/devtools.js +5 -5
  49. package/dist/ecosystem.cjs +462 -58
  50. package/dist/ecosystem.d.cts +2 -1
  51. package/dist/ecosystem.d.ts +2 -1
  52. package/dist/ecosystem.js +9 -8
  53. package/dist/extras.cjs +852 -296
  54. package/dist/extras.d.cts +5 -4
  55. package/dist/extras.d.ts +5 -4
  56. package/dist/extras.js +24 -23
  57. package/dist/index.cjs +721 -176
  58. package/dist/index.d.cts +220 -169
  59. package/dist/index.d.ts +220 -169
  60. package/dist/index.js +16 -12
  61. package/dist/motion.cjs +12 -4
  62. package/dist/motion.js +3 -3
  63. package/dist/patterns.cjs +37 -21
  64. package/dist/patterns.d.cts +2 -1
  65. package/dist/patterns.d.ts +2 -1
  66. package/dist/patterns.js +6 -6
  67. package/dist/performance.cjs +48 -6
  68. package/dist/performance.d.cts +12 -2
  69. package/dist/performance.d.ts +12 -2
  70. package/dist/performance.js +8 -6
  71. package/dist/plugins.cjs +672 -261
  72. package/dist/plugins.d.cts +131 -13
  73. package/dist/plugins.d.ts +131 -13
  74. package/dist/plugins.js +83 -47
  75. package/dist/{ssr-XOTUASDO.js → ssr-5OWAH3U2.js} +4 -2
  76. package/dist/{ssr-Bli9XRW5.d.cts → ssr-C8hgIAw7.d.cts} +6 -0
  77. package/dist/{ssr-Bli9XRW5.d.ts → ssr-C8hgIAw7.d.ts} +6 -0
  78. package/dist/ssr.cjs +509 -142
  79. package/dist/ssr.d.cts +55 -5
  80. package/dist/ssr.d.ts +55 -5
  81. package/dist/ssr.js +11 -9
  82. package/dist/{tagFactory-DFstCLQV.d.cts → tagFactory-8qL9LCIx.d.cts} +58 -19
  83. package/dist/{tagFactory-DkaNVUNV.d.ts → tagFactory-BL2fymez.d.ts} +58 -19
  84. package/dist/testing.cjs +17 -4
  85. package/dist/testing.js +4 -4
  86. package/dist/types-CJFViL6Q.d.cts +26 -0
  87. package/dist/types-CJFViL6Q.d.ts +26 -0
  88. package/dist/ui.cjs +635 -254
  89. package/dist/ui.d.cts +3 -2
  90. package/dist/ui.d.ts +3 -2
  91. package/dist/ui.js +9 -8
  92. package/dist/widgets.cjs +22 -14
  93. package/dist/widgets.js +7 -7
  94. package/package.json +8 -5
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  Loading,
8
8
  Portal,
9
9
  Suspense,
10
+ __renderParsedTemplate,
10
11
  action,
11
12
  array,
12
13
  asyncDerived,
@@ -53,7 +54,7 @@ import {
53
54
  unregisterIsland,
54
55
  when,
55
56
  writable
56
- } from "./chunk-7GQCWFOE.js";
57
+ } from "./chunk-J3YQ457H.js";
57
58
  import {
58
59
  a,
59
60
  abbr,
@@ -191,33 +192,35 @@ import {
191
192
  use,
192
193
  var_,
193
194
  video
194
- } from "./chunk-JSXPZCET.js";
195
+ } from "./chunk-Q5J2LVKH.js";
195
196
  import {
196
197
  trustHTML
197
- } from "./chunk-HURREPU2.js";
198
+ } from "./chunk-FC6KCJSA.js";
198
199
  import {
199
200
  watch
200
- } from "./chunk-UZQ6ALFS.js";
201
+ } from "./chunk-CZPRSWSS.js";
201
202
  import {
202
203
  __resetIdCounter,
203
204
  createId
204
- } from "./chunk-3ISI6ACU.js";
205
+ } from "./chunk-C7AA2CZX.js";
206
+ import "./chunk-62BDYGAG.js";
205
207
  import {
206
208
  SVG_NS,
207
209
  tagFactory
208
- } from "./chunk-VVWPJ543.js";
210
+ } from "./chunk-VWT3VXPL.js";
209
211
  import {
210
212
  bindDynamic
211
- } from "./chunk-47M47FOM.js";
213
+ } from "./chunk-O6TRVMJI.js";
214
+ import "./chunk-3ACAAQIN.js";
212
215
  import {
213
216
  derived
214
- } from "./chunk-QE4TTDU3.js";
215
- import "./chunk-2INLLLMZ.js";
217
+ } from "./chunk-KJ3UKABJ.js";
216
218
  import "./chunk-7ZHH77QA.js";
217
219
  import {
218
220
  effect,
219
221
  on
220
- } from "./chunk-XC4MEKGA.js";
222
+ } from "./chunk-V3LHZSU5.js";
223
+ import "./chunk-EXXSN3BW.js";
221
224
  import {
222
225
  disableSSR,
223
226
  enableSSR,
@@ -234,12 +237,12 @@ import {
234
237
  external,
235
238
  isBatching,
236
239
  signal
237
- } from "./chunk-D33YTSX5.js";
240
+ } from "./chunk-DSID757X.js";
238
241
  import {
239
242
  retrack,
240
243
  setMaxDrainIterations,
241
244
  untracked
242
- } from "./chunk-5Q4R7HCL.js";
245
+ } from "./chunk-TQQUN4WR.js";
243
246
  import {
244
247
  MAX_DRAIN_TEARDOWNS,
245
248
  checkLeaks,
@@ -263,6 +266,7 @@ export {
263
266
  Portal,
264
267
  SVG_NS,
265
268
  Suspense,
269
+ __renderParsedTemplate,
266
270
  __resetIdCounter,
267
271
  a,
268
272
  abbr,
package/dist/motion.cjs CHANGED
@@ -761,7 +761,7 @@ function forEachSubscriber(signal2, visit) {
761
761
  }
762
762
 
763
763
  // src/reactivity/track.ts
764
- var _runtimeVersion = true ? "4.6.0" : "dev";
764
+ var _runtimeVersion = true ? "4.8.0" : "dev";
765
765
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
766
766
  function resolveReactiveApi() {
767
767
  const g = globalThis;
@@ -867,6 +867,14 @@ var batch = API2.batch;
867
867
  var enqueueBatchedSignal = API2.enqueueBatchedSignal;
868
868
  var isBatching = API2.isBatching;
869
869
 
870
+ // src/core/devtoolsHook.ts
871
+ function emitDevtools(hook, event, payload) {
872
+ try {
873
+ hook.emit(event, payload);
874
+ } catch {
875
+ }
876
+ }
877
+
870
878
  // src/core/signals/signal.ts
871
879
  var _g = globalThis;
872
880
  function signal(initial, options) {
@@ -900,7 +908,7 @@ function signal(initial, options) {
900
908
  state2.__v++;
901
909
  if (DEV) {
902
910
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
903
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
911
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
904
912
  }
905
913
  if (!enqueueBatchedSignal(state2)) {
906
914
  notifySubscribers2(state2);
@@ -914,7 +922,7 @@ function signal(initial, options) {
914
922
  state2.value = newValue;
915
923
  state2.__v++;
916
924
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
917
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
925
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
918
926
  if (!enqueueBatchedSignal(state2)) {
919
927
  notifySubscribers2(state2);
920
928
  }
@@ -933,7 +941,7 @@ function signal(initial, options) {
933
941
  }
934
942
  if (DEV) {
935
943
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
936
- if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
944
+ if (hook) emitDevtools(hook, "signal:create", { signal: state2, name: debugName, getter: get, initial });
937
945
  }
938
946
  return [get, set];
939
947
  }
package/dist/motion.js CHANGED
@@ -20,10 +20,10 @@ import {
20
20
  stagger,
21
21
  transition,
22
22
  viewTransition
23
- } from "./chunk-XRRZKZYX.js";
23
+ } from "./chunk-LI4W3U6C.js";
24
24
  import "./chunk-5HZXGZ6T.js";
25
- import "./chunk-D33YTSX5.js";
26
- import "./chunk-5Q4R7HCL.js";
25
+ import "./chunk-DSID757X.js";
26
+ import "./chunk-TQQUN4WR.js";
27
27
  import "./chunk-NYNYSPK7.js";
28
28
  export {
29
29
  TransitionGroup,
package/dist/patterns.cjs CHANGED
@@ -657,7 +657,7 @@ function forEachSubscriber(signal2, visit) {
657
657
  }
658
658
 
659
659
  // src/reactivity/track.ts
660
- var _runtimeVersion = true ? "4.6.0" : "dev";
660
+ var _runtimeVersion = true ? "4.8.0" : "dev";
661
661
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
662
662
  function resolveReactiveApi() {
663
663
  const g = globalThis;
@@ -763,6 +763,14 @@ var batch = API2.batch;
763
763
  var enqueueBatchedSignal = API2.enqueueBatchedSignal;
764
764
  var isBatching = API2.isBatching;
765
765
 
766
+ // src/core/devtoolsHook.ts
767
+ function emitDevtools(hook, event, payload) {
768
+ try {
769
+ hook.emit(event, payload);
770
+ } catch {
771
+ }
772
+ }
773
+
766
774
  // src/core/signals/signal.ts
767
775
  var _g = globalThis;
768
776
  function signal(initial, options) {
@@ -796,7 +804,7 @@ function signal(initial, options) {
796
804
  state2.__v++;
797
805
  if (DEV) {
798
806
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
799
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
807
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
800
808
  }
801
809
  if (!enqueueBatchedSignal(state2)) {
802
810
  notifySubscribers2(state2);
@@ -810,7 +818,7 @@ function signal(initial, options) {
810
818
  state2.value = newValue;
811
819
  state2.__v++;
812
820
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
813
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
821
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
814
822
  if (!enqueueBatchedSignal(state2)) {
815
823
  notifySubscribers2(state2);
816
824
  }
@@ -829,7 +837,7 @@ function signal(initial, options) {
829
837
  }
830
838
  if (DEV) {
831
839
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
832
- if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
840
+ if (hook) emitDevtools(hook, "signal:create", { signal: state2, name: debugName, getter: get, initial });
833
841
  }
834
842
  return [get, set];
835
843
  }
@@ -848,6 +856,9 @@ function stripUnsafeKeys(obj) {
848
856
  }
849
857
 
850
858
  // src/patterns/machine.ts
859
+ function ownEntry(table, key) {
860
+ return Object.hasOwn(table, key) ? table[key] : void 0;
861
+ }
851
862
  function machine(config) {
852
863
  const [state2, setState] = signal(config.initial);
853
864
  const [context, setContext] = signal(config.context || {});
@@ -869,9 +880,9 @@ function machine(config) {
869
880
  }
870
881
  }
871
882
  function step(event) {
872
- const stateDef = config.states[currentState];
883
+ const stateDef = ownEntry(config.states, currentState);
873
884
  if (!stateDef?.on) return;
874
- const transition = stateDef.on[event];
885
+ const transition = ownEntry(stateDef.on, event);
875
886
  if (!transition) return;
876
887
  let target;
877
888
  let guard;
@@ -899,7 +910,7 @@ function machine(config) {
899
910
  if (action) setContext(nextContext);
900
911
  setState(target);
901
912
  });
902
- const targetDef = config.states[target];
913
+ const targetDef = ownEntry(config.states, target);
903
914
  if (targetDef?.entry) {
904
915
  targetDef.entry(currentContext);
905
916
  }
@@ -909,7 +920,7 @@ function machine(config) {
909
920
  if (processing) return;
910
921
  drain();
911
922
  }
912
- const initialDef = config.states[config.initial];
923
+ const initialDef = ownEntry(config.states, config.initial);
913
924
  if (initialDef?.entry) {
914
925
  processing = true;
915
926
  try {
@@ -927,9 +938,9 @@ function machine(config) {
927
938
  }
928
939
  function can(event) {
929
940
  const currentState2 = state2();
930
- const stateDef = config.states[currentState2];
941
+ const stateDef = ownEntry(config.states, currentState2);
931
942
  if (!stateDef?.on) return false;
932
- const transition = stateDef.on[event];
943
+ const transition = ownEntry(stateDef.on, event);
933
944
  if (!transition) return false;
934
945
  if (typeof transition === "string") return true;
935
946
  if (transition.guard) {
@@ -1094,12 +1105,17 @@ function effect(effectFn, options) {
1094
1105
  try {
1095
1106
  retrack2(ctx.bodyFn, ctx.subscriber);
1096
1107
  if (ctx.rerunPending) drainReruns(ctx);
1108
+ } catch (err) {
1109
+ ctx.disposed = true;
1110
+ if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
1111
+ cleanup2(ctx.subscriber);
1112
+ throw err;
1097
1113
  } finally {
1098
1114
  ctx.running = false;
1099
1115
  ctx.rerunPending = false;
1100
1116
  }
1101
1117
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1102
- if (hook) hook.emit("effect:create", { effectFn });
1118
+ if (hook) emitDevtools(hook, "effect:create", { effectFn });
1103
1119
  return () => disposeEffect(ctx);
1104
1120
  }
1105
1121
 
@@ -1497,17 +1513,17 @@ function derived(getter, options) {
1497
1513
  cs._d = false;
1498
1514
  cs._init = true;
1499
1515
  };
1500
- track2(() => {
1501
- let threw = true;
1502
- try {
1516
+ try {
1517
+ track2(() => {
1503
1518
  cs._v = getter();
1504
1519
  cs._d = false;
1505
1520
  cs._init = true;
1506
- threw = false;
1507
- } finally {
1508
- if (threw) cs._d = true;
1509
- }
1510
- }, markDirty);
1521
+ }, markDirty);
1522
+ } catch (err) {
1523
+ disposed = true;
1524
+ cleanup2(markDirty);
1525
+ throw err;
1526
+ }
1511
1527
  const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1512
1528
  const validate = () => {
1513
1529
  if (!cs._d || disposed || pendingError !== void 0) return;
@@ -1526,7 +1542,7 @@ function derived(getter, options) {
1526
1542
  if (disposed) cleanup2(markDirty);
1527
1543
  }
1528
1544
  if (hook && !disposed && !Object.is(oldValue, cs._v)) {
1529
- hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
1545
+ emitDevtools(hook, "computed:update", { signal: cs, oldValue, newValue: cs._v });
1530
1546
  }
1531
1547
  };
1532
1548
  cs._validate = validate;
@@ -1577,7 +1593,7 @@ function derived(getter, options) {
1577
1593
  }
1578
1594
  }
1579
1595
  };
1580
- if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
1596
+ if (hook) emitDevtools(hook, "computed:create", { signal: cs, name: debugName, getter: computedGetter });
1581
1597
  return computedGetter;
1582
1598
  }
1583
1599
 
@@ -1,4 +1,5 @@
1
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, W as WithDefaultsProps, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-DRIuclVT.cjs';
1
+ export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, W as WithDefaultsProps, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-CTOJXu-x.cjs';
2
+ import './types-CJFViL6Q.cjs';
2
3
 
3
4
  interface MachineConfig<S extends string, E extends string, C extends object = Record<string, unknown>> {
4
5
  initial: S;
@@ -1,4 +1,5 @@
1
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, W as WithDefaultsProps, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-DRIuclVT.js';
1
+ export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, W as WithDefaultsProps, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-CLqzJnOV.js';
2
+ import './types-CJFViL6Q.js';
2
3
 
3
4
  interface MachineConfig<S extends string, E extends string, C extends object = Record<string, unknown>> {
4
5
  initial: S;
package/dist/patterns.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  optimisticList,
6
6
  persisted,
7
7
  timeline
8
- } from "./chunk-AIF3Z2T7.js";
8
+ } from "./chunk-RGLPEBDE.js";
9
9
  import {
10
10
  RenderProp,
11
11
  assertType,
@@ -22,12 +22,12 @@ import {
22
22
  withProps,
23
23
  withWrapper
24
24
  } from "./chunk-TUCPL2HB.js";
25
- import "./chunk-H3SRKIYX.js";
26
- import "./chunk-QE4TTDU3.js";
27
- import "./chunk-XC4MEKGA.js";
25
+ import "./chunk-62BDYGAG.js";
26
+ import "./chunk-KJ3UKABJ.js";
27
+ import "./chunk-V3LHZSU5.js";
28
28
  import "./chunk-7XHATCIH.js";
29
- import "./chunk-D33YTSX5.js";
30
- import "./chunk-5Q4R7HCL.js";
29
+ import "./chunk-DSID757X.js";
30
+ import "./chunk-TQQUN4WR.js";
31
31
  import "./chunk-NYNYSPK7.js";
32
32
  export {
33
33
  RenderProp,
@@ -923,7 +923,7 @@ function forEachSubscriber(signal2, visit) {
923
923
  }
924
924
 
925
925
  // src/reactivity/track.ts
926
- var _runtimeVersion = true ? "4.6.0" : "dev";
926
+ var _runtimeVersion = true ? "4.8.0" : "dev";
927
927
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
928
928
  function resolveReactiveApi() {
929
929
  const g = globalThis;
@@ -979,6 +979,14 @@ var getSubscriberCount2 = API.getSubscriberCount;
979
979
  var getSubscriberDeps2 = API.getSubscriberDeps;
980
980
  var forEachSubscriber2 = API.forEachSubscriber;
981
981
 
982
+ // src/core/devtoolsHook.ts
983
+ function emitDevtools(hook, event, payload) {
984
+ try {
985
+ hook.emit(event, payload);
986
+ } catch {
987
+ }
988
+ }
989
+
982
990
  // src/core/ssr-context.ts
983
991
  var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
984
992
  function detectSSRShared() {
@@ -1133,12 +1141,17 @@ function effect(effectFn, options) {
1133
1141
  try {
1134
1142
  retrack2(ctx.bodyFn, ctx.subscriber);
1135
1143
  if (ctx.rerunPending) drainReruns(ctx);
1144
+ } catch (err) {
1145
+ ctx.disposed = true;
1146
+ if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
1147
+ cleanup2(ctx.subscriber);
1148
+ throw err;
1136
1149
  } finally {
1137
1150
  ctx.running = false;
1138
1151
  ctx.rerunPending = false;
1139
1152
  }
1140
1153
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1141
- if (hook) hook.emit("effect:create", { effectFn });
1154
+ if (hook) emitDevtools(hook, "effect:create", { effectFn });
1142
1155
  return () => disposeEffect(ctx);
1143
1156
  }
1144
1157
 
@@ -1225,7 +1238,7 @@ function signal(initial, options) {
1225
1238
  state2.__v++;
1226
1239
  if (DEV) {
1227
1240
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1228
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1241
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1229
1242
  }
1230
1243
  if (!enqueueBatchedSignal(state2)) {
1231
1244
  notifySubscribers2(state2);
@@ -1239,7 +1252,7 @@ function signal(initial, options) {
1239
1252
  state2.value = newValue;
1240
1253
  state2.__v++;
1241
1254
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1242
- if (hook) hook.emit("signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1255
+ if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
1243
1256
  if (!enqueueBatchedSignal(state2)) {
1244
1257
  notifySubscribers2(state2);
1245
1258
  }
@@ -1258,7 +1271,7 @@ function signal(initial, options) {
1258
1271
  }
1259
1272
  if (DEV) {
1260
1273
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1261
- if (hook) hook.emit("signal:create", { signal: state2, name: debugName, getter: get, initial });
1274
+ if (hook) emitDevtools(hook, "signal:create", { signal: state2, name: debugName, getter: get, initial });
1262
1275
  }
1263
1276
  return [get, set];
1264
1277
  }
@@ -1308,12 +1321,20 @@ function uniqueId(suffix) {
1308
1321
  function stripControlChars(value) {
1309
1322
  return value.replace(/[\x00-\x20\x7f-\x9f]+/g, "");
1310
1323
  }
1324
+ var ASCII_UPPER = /[A-Z]/;
1325
+ var ASCII_UPPER_G = /[A-Z]/g;
1326
+ function canonicalAttrName(name) {
1327
+ return ASCII_UPPER.test(name) ? name.replace(ASCII_UPPER_G, (ch) => String.fromCharCode(ch.charCodeAt(0) + 32)) : name;
1328
+ }
1311
1329
  var SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:", "ftp:"];
1312
1330
  var OUTER_TRIM = /^[\x00-\x20\x7f-\x9f]+|[\x00-\x20\x7f-\x9f]+$/g;
1313
1331
  function sanitizeUrl(url) {
1314
1332
  const probe = stripControlChars(url).trim();
1315
1333
  if (!probe) return "";
1316
1334
  const output = url.replace(OUTER_TRIM, "");
1335
+ if (probe.length >= 2 && (probe[0] === "\\" || probe[0] === "/") && (probe[1] === "\\" || probe[1] === "/") && (probe[0] === "\\" || probe[1] === "\\")) {
1336
+ return "";
1337
+ }
1317
1338
  const lower = probe.toLowerCase();
1318
1339
  let schemeEnd = -1;
1319
1340
  for (let i = 0; i < lower.length; i++) {
@@ -1331,6 +1352,15 @@ function sanitizeUrl(url) {
1331
1352
  return output;
1332
1353
  }
1333
1354
 
1355
+ // src/utils/elementPolicy.ts
1356
+ var BLOCKED_ELEMENTS = /* @__PURE__ */ new Set(["script", "iframe", "object", "embed", "frame", "frameset"]);
1357
+ function canonicalTagName(tag) {
1358
+ return canonicalAttrName(tag);
1359
+ }
1360
+ function isBlockedElement(tag) {
1361
+ return BLOCKED_ELEMENTS.has(canonicalTagName(tag));
1362
+ }
1363
+
1334
1364
  // src/performance/domRecycler.ts
1335
1365
  var DOMPool = class {
1336
1366
  constructor(maxSize = 50) {
@@ -1341,6 +1371,9 @@ var DOMPool = class {
1341
1371
  * Get a recycled element or create a new one.
1342
1372
  */
1343
1373
  acquire(tag) {
1374
+ if (isBlockedElement(tag)) {
1375
+ throw new Error(`DOMPool: refusing to create <${tag}> \u2014 tag is blocked for security reasons.`);
1376
+ }
1344
1377
  const pool = this.pools.get(tag);
1345
1378
  if (pool && pool.length > 0) {
1346
1379
  const el = pool.pop();
@@ -1446,10 +1479,19 @@ function prefetch(url) {
1446
1479
  }
1447
1480
  function preloadImage(src) {
1448
1481
  return new Promise((resolve, reject) => {
1482
+ const safe = sanitizeUrl(String(src));
1483
+ if (!safe) {
1484
+ reject(
1485
+ new Error(
1486
+ String(src).trim() === "" ? "preloadImage: no image URL was given." : "preloadImage: refusing an image URL outside the URL policy."
1487
+ )
1488
+ );
1489
+ return;
1490
+ }
1449
1491
  const img = new Image();
1450
1492
  img.onload = () => resolve(img);
1451
1493
  img.onerror = reject;
1452
- img.src = src;
1494
+ img.src = safe;
1453
1495
  });
1454
1496
  }
1455
1497
 
@@ -1,5 +1,5 @@
1
- import { T as TrustedHTML } from './ssr-Bli9XRW5.cjs';
2
- export { t as trustHTML } from './ssr-Bli9XRW5.cjs';
1
+ import { T as TrustedHTML } from './ssr-C8hgIAw7.cjs';
2
+ export { t as trustHTML } from './ssr-C8hgIAw7.cjs';
3
3
 
4
4
  declare const Priority: {
5
5
  readonly IMMEDIATE: 0;
@@ -144,6 +144,16 @@ declare function preloadResource(url: string, type?: "script" | "style" | "fetch
144
144
  declare function prefetch(url: string): void;
145
145
  /**
146
146
  * Preloads an image and returns a promise that resolves when loaded.
147
+ *
148
+ * The URL goes through the same canonical policy (`sanitizeUrl`) as
149
+ * `preloadResource()`, `prefetch()` and every attribute writer, BEFORE an
150
+ * `Image` exists: a refused URL creates no element and starts no request. The
151
+ * promise then rejects with an `Error` — never stays pending — so an `await`
152
+ * cannot hang on it. The message does not repeat the URL.
153
+ *
154
+ * An empty (or whitespace-only) `src` names no image, which is not a policy
155
+ * refusal; it rejects with its own message, as the browser would have fired
156
+ * `error` for it anyway.
147
157
  */
148
158
  declare function preloadImage(src: string): Promise<HTMLImageElement>;
149
159
 
@@ -1,5 +1,5 @@
1
- import { T as TrustedHTML } from './ssr-Bli9XRW5.js';
2
- export { t as trustHTML } from './ssr-Bli9XRW5.js';
1
+ import { T as TrustedHTML } from './ssr-C8hgIAw7.js';
2
+ export { t as trustHTML } from './ssr-C8hgIAw7.js';
3
3
 
4
4
  declare const Priority: {
5
5
  readonly IMMEDIATE: 0;
@@ -144,6 +144,16 @@ declare function preloadResource(url: string, type?: "script" | "style" | "fetch
144
144
  declare function prefetch(url: string): void;
145
145
  /**
146
146
  * Preloads an image and returns a promise that resolves when loaded.
147
+ *
148
+ * The URL goes through the same canonical policy (`sanitizeUrl`) as
149
+ * `preloadResource()`, `prefetch()` and every attribute writer, BEFORE an
150
+ * `Image` exists: a refused URL creates no element and starts no request. The
151
+ * promise then rejects with an `Error` — never stays pending — so an `await`
152
+ * cannot hang on it. The message does not repeat the URL.
153
+ *
154
+ * An empty (or whitespace-only) `src` names no image, which is not a policy
155
+ * refusal; it rejects with its own message, as the browser would have fired
156
+ * `error` for it anyway.
147
157
  */
148
158
  declare function preloadImage(src: string): Promise<HTMLImageElement>;
149
159
 
@@ -33,16 +33,18 @@ import {
33
33
  transitionState,
34
34
  uniqueId,
35
35
  yieldToMain
36
- } from "./chunk-DKGBBKOF.js";
36
+ } from "./chunk-C5PEWEGH.js";
37
37
  import {
38
38
  trustHTML
39
- } from "./chunk-HURREPU2.js";
40
- import "./chunk-2INLLLMZ.js";
39
+ } from "./chunk-FC6KCJSA.js";
40
+ import "./chunk-62BDYGAG.js";
41
+ import "./chunk-3ACAAQIN.js";
41
42
  import "./chunk-7ZHH77QA.js";
42
- import "./chunk-XC4MEKGA.js";
43
+ import "./chunk-V3LHZSU5.js";
44
+ import "./chunk-EXXSN3BW.js";
43
45
  import "./chunk-7XHATCIH.js";
44
- import "./chunk-D33YTSX5.js";
45
- import "./chunk-5Q4R7HCL.js";
46
+ import "./chunk-DSID757X.js";
47
+ import "./chunk-TQQUN4WR.js";
46
48
  import "./chunk-NYNYSPK7.js";
47
49
  export {
48
50
  DOMPool,