sibujs 1.4.0 → 1.5.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 (79) hide show
  1. package/README.md +105 -119
  2. package/dist/browser.cjs +53 -14
  3. package/dist/browser.d.cts +14 -9
  4. package/dist/browser.d.ts +14 -9
  5. package/dist/browser.js +4 -4
  6. package/dist/build.cjs +124 -42
  7. package/dist/build.d.cts +1 -1
  8. package/dist/build.d.ts +1 -1
  9. package/dist/build.js +10 -10
  10. package/dist/cdn.global.js +7 -7
  11. package/dist/chunk-5ZYQ6KDD.js +154 -0
  12. package/dist/chunk-6BMPXPUW.js +26 -0
  13. package/dist/chunk-7GRNSCFT.js +1097 -0
  14. package/dist/chunk-BGTHZHJ5.js +1016 -0
  15. package/dist/chunk-BMPL52BF.js +654 -0
  16. package/dist/chunk-GJPXRJ45.js +37 -0
  17. package/dist/chunk-JCDUJN2F.js +2779 -0
  18. package/dist/chunk-K4G4ZQNR.js +286 -0
  19. package/dist/chunk-MB6QFH3I.js +2776 -0
  20. package/dist/chunk-MYRV7VDM.js +742 -0
  21. package/dist/chunk-NZIIMDWI.js +84 -0
  22. package/dist/chunk-P3XWXJZU.js +282 -0
  23. package/dist/chunk-PDZQY43A.js +616 -0
  24. package/dist/chunk-RJ46C3CS.js +1293 -0
  25. package/dist/chunk-SFKNRVCU.js +292 -0
  26. package/dist/chunk-TDGZL5CU.js +365 -0
  27. package/dist/chunk-VAPYJN4X.js +368 -0
  28. package/dist/chunk-VQDZK23A.js +1023 -0
  29. package/dist/chunk-VQNQZCWJ.js +61 -0
  30. package/dist/chunk-XHK6BDAJ.js +76 -0
  31. package/dist/chunk-XUEEGU5O.js +409 -0
  32. package/dist/contracts-ey_Qh8ef.d.cts +239 -0
  33. package/dist/contracts-ey_Qh8ef.d.ts +239 -0
  34. package/dist/customElement-BL3Uo8dL.d.cts +318 -0
  35. package/dist/customElement-BL3Uo8dL.d.ts +318 -0
  36. package/dist/data.cjs +52 -11
  37. package/dist/data.js +6 -6
  38. package/dist/devtools.cjs +22 -24
  39. package/dist/devtools.js +26 -28
  40. package/dist/ecosystem.cjs +31 -6
  41. package/dist/ecosystem.d.cts +4 -4
  42. package/dist/ecosystem.d.ts +4 -4
  43. package/dist/ecosystem.js +7 -7
  44. package/dist/extras.cjs +304 -108
  45. package/dist/extras.d.cts +3 -3
  46. package/dist/extras.d.ts +3 -3
  47. package/dist/extras.js +19 -19
  48. package/dist/index.cjs +124 -42
  49. package/dist/index.d.cts +58 -48
  50. package/dist/index.d.ts +58 -48
  51. package/dist/index.js +10 -10
  52. package/dist/motion.cjs +13 -2
  53. package/dist/motion.d.cts +1 -1
  54. package/dist/motion.d.ts +1 -1
  55. package/dist/motion.js +3 -3
  56. package/dist/patterns.cjs +91 -24
  57. package/dist/patterns.d.cts +46 -12
  58. package/dist/patterns.d.ts +46 -12
  59. package/dist/patterns.js +5 -5
  60. package/dist/performance.cjs +97 -12
  61. package/dist/performance.d.cts +6 -1
  62. package/dist/performance.d.ts +6 -1
  63. package/dist/performance.js +5 -3
  64. package/dist/plugins.cjs +19 -13
  65. package/dist/plugins.d.cts +3 -3
  66. package/dist/plugins.d.ts +3 -3
  67. package/dist/plugins.js +16 -18
  68. package/dist/ssr.cjs +9 -0
  69. package/dist/ssr.d.cts +1 -1
  70. package/dist/ssr.d.ts +1 -1
  71. package/dist/ssr.js +7 -7
  72. package/dist/testing.js +2 -2
  73. package/dist/ui.cjs +130 -48
  74. package/dist/ui.d.cts +13 -16
  75. package/dist/ui.d.ts +13 -16
  76. package/dist/ui.js +6 -6
  77. package/dist/widgets.cjs +31 -6
  78. package/dist/widgets.js +5 -5
  79. package/package.json +1 -1
package/dist/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-D2DJp_xn.js';
2
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, 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-xo5ckdRP.js';
1
+ export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-BL3Uo8dL.js';
2
+ export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, 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-ey_Qh8ef.js';
3
3
 
4
4
  interface FormActionHandle<TArgs extends unknown[], TResult> {
5
5
  /** Invoke the action. Rejections become `error()`, resolutions `result()`. */
@@ -30,14 +30,11 @@ interface FormActionHandle<TArgs extends unknown[], TResult> {
30
30
  * return res.json();
31
31
  * });
32
32
  *
33
- * form({
34
- * on: { submit: save.onSubmit },
35
- * nodes: [
36
- * input({ name: "title" }),
37
- * button({ disabled: save.pending, nodes: () => (save.pending() ? "Saving..." : "Save") }),
38
- * when(() => save.error() != null, () => div({ class: "error", nodes: () => String(save.error()) })),
39
- * ],
40
- * });
33
+ * form({ on: { submit: save.onSubmit } }, [
34
+ * input({ name: "title" }),
35
+ * button({ disabled: save.pending }, () => (save.pending() ? "Saving..." : "Save")),
36
+ * when(() => save.error() != null, () => div("error", () => String(save.error()))),
37
+ * ]);
41
38
  * ```
42
39
  */
43
40
  declare function formAction<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>): FormActionHandle<TArgs, TResult>;
@@ -102,10 +99,10 @@ interface ListboxHandle {
102
99
  *
103
100
  * @example
104
101
  * ```ts
105
- * const container = ul({ nodes: [
106
- * li({ role: "option", "data-value": "a", nodes: "Apple" }),
107
- * li({ role: "option", "data-value": "b", nodes: "Banana" }),
108
- * ]}) as HTMLElement;
102
+ * const container = ul([
103
+ * li({ role: "option", "data-value": "a" }, "Apple"),
104
+ * li({ role: "option", "data-value": "b" }, "Banana"),
105
+ * ]) as HTMLElement;
109
106
  *
110
107
  * const lb = createListbox(container, { onSelect: v => console.log(v) });
111
108
  * ```
@@ -142,8 +139,8 @@ interface DialogAriaHandle {
142
139
  * const dlg = document.createElement("div");
143
140
  * const aria = createDialogAria(dlg, { alert: false });
144
141
  * dlg.append(
145
- * h2({ id: aria.titleId, nodes: "Delete?" }),
146
- * p({ id: aria.descriptionId, nodes: "This cannot be undone." }),
142
+ * h2({ id: aria.titleId }, "Delete?"),
143
+ * p({ id: aria.descriptionId }, "This cannot be undone."),
147
144
  * );
148
145
  * ```
149
146
  */
package/dist/ui.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  toast,
38
38
  withScopedStyle,
39
39
  zipMask
40
- } from "./chunk-JCI5M6U6.js";
40
+ } from "./chunk-VQDZK23A.js";
41
41
  import {
42
42
  RenderProp,
43
43
  assertType,
@@ -59,17 +59,17 @@ import {
59
59
  } from "./chunk-YT6HQ6AM.js";
60
60
  import {
61
61
  registerDisposer
62
- } from "./chunk-PTQJDMRT.js";
63
- import "./chunk-NEKUBFPT.js";
62
+ } from "./chunk-5ZYQ6KDD.js";
63
+ import "./chunk-XHK6BDAJ.js";
64
64
  import "./chunk-CMBFNA7L.js";
65
65
  import {
66
66
  effect
67
- } from "./chunk-CHF5OHIA.js";
67
+ } from "./chunk-VQNQZCWJ.js";
68
68
  import "./chunk-EUZND3CB.js";
69
69
  import {
70
70
  signal
71
- } from "./chunk-WZSPOOER.js";
72
- import "./chunk-ZD6OAMTH.js";
71
+ } from "./chunk-NZIIMDWI.js";
72
+ import "./chunk-K4G4ZQNR.js";
73
73
  import "./chunk-5X6PP2UK.js";
74
74
 
75
75
  // src/ui/formAction.ts
package/dist/widgets.cjs CHANGED
@@ -127,12 +127,21 @@ function queueSignalNotification(signal2) {
127
127
  }
128
128
  }
129
129
  }
130
+ var MAX_DRAIN_ITERATIONS = 1e3;
130
131
  function drainNotificationQueue() {
131
132
  if (notifyDepth > 0) return;
132
133
  notifyDepth++;
133
134
  try {
134
135
  let i = 0;
135
136
  while (i < pendingQueue.length) {
137
+ if (i >= MAX_DRAIN_ITERATIONS) {
138
+ if (typeof console !== "undefined") {
139
+ console.error(
140
+ `[SibuJS] Notification queue exceeded ${MAX_DRAIN_ITERATIONS} iterations \u2014 likely an effect that writes to a signal it reads. Breaking to prevent infinite loop.`
141
+ );
142
+ }
143
+ break;
144
+ }
136
145
  safeInvoke(pendingQueue[i]);
137
146
  i++;
138
147
  }
@@ -299,21 +308,37 @@ function derived(getter, options) {
299
308
  cs._v = getter();
300
309
  }, markDirty);
301
310
  const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
311
+ let evaluating = false;
302
312
  function computedGetter() {
313
+ if (evaluating) {
314
+ throw new Error(
315
+ `[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
316
+ );
317
+ }
303
318
  if (trackingSuspended) {
304
319
  if (cs._d) {
305
- cs._d = false;
306
- cs._v = getter();
320
+ evaluating = true;
321
+ try {
322
+ cs._d = false;
323
+ cs._v = getter();
324
+ } finally {
325
+ evaluating = false;
326
+ }
307
327
  }
308
328
  return cs._v;
309
329
  }
310
330
  recordDependency(cs);
311
331
  if (cs._d) {
312
332
  const oldValue = cs._v;
313
- track(() => {
314
- cs._d = false;
315
- cs._v = getter();
316
- }, markDirty);
333
+ evaluating = true;
334
+ try {
335
+ track(() => {
336
+ cs._d = false;
337
+ cs._v = getter();
338
+ }, markDirty);
339
+ } finally {
340
+ evaluating = false;
341
+ }
317
342
  if (hook && oldValue !== cs._v) {
318
343
  hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
319
344
  }
package/dist/widgets.js CHANGED
@@ -8,12 +8,12 @@ import {
8
8
  select,
9
9
  tabs,
10
10
  tooltip
11
- } from "./chunk-EBGIRKQY.js";
12
- import "./chunk-NYVAC6P5.js";
13
- import "./chunk-NEKUBFPT.js";
11
+ } from "./chunk-PDZQY43A.js";
12
+ import "./chunk-GJPXRJ45.js";
13
+ import "./chunk-XHK6BDAJ.js";
14
14
  import "./chunk-EUZND3CB.js";
15
- import "./chunk-WZSPOOER.js";
16
- import "./chunk-ZD6OAMTH.js";
15
+ import "./chunk-NZIIMDWI.js";
16
+ import "./chunk-K4G4ZQNR.js";
17
17
  import "./chunk-5X6PP2UK.js";
18
18
  export {
19
19
  accordion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sibujs",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "A lightweight, function-based frontend framework that combines the best of React, Svelte, and Vue — with zero VDOM and maximum simplicity. Designed for developers who want fine-grained reactivity and full control without compilation or magic.",
5
5
  "keywords": [
6
6
  "frontend",