sibujs 1.2.0 → 1.4.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 (95) hide show
  1. package/README.md +29 -25
  2. package/dist/browser.cjs +804 -2
  3. package/dist/browser.d.cts +591 -1
  4. package/dist/browser.d.ts +591 -1
  5. package/dist/browser.js +50 -8
  6. package/dist/build.cjs +655 -237
  7. package/dist/build.js +15 -93
  8. package/dist/cdn.global.js +188 -7
  9. package/dist/chunk-2BYQDGN3.js +742 -0
  10. package/dist/chunk-32DY64NT.js +282 -0
  11. package/dist/chunk-3AIRKM3B.js +1263 -0
  12. package/dist/chunk-3X2YG6YM.js +505 -0
  13. package/dist/chunk-5X6PP2UK.js +28 -0
  14. package/dist/chunk-77L6NL3X.js +1097 -0
  15. package/dist/chunk-BGN5ZMP4.js +26 -0
  16. package/dist/chunk-BTU3TJDS.js +365 -0
  17. package/dist/chunk-CHF5OHIA.js +61 -0
  18. package/dist/chunk-CMBFNA7L.js +27 -0
  19. package/dist/chunk-CNZ35WI2.js +178 -0
  20. package/dist/chunk-DAHRH4ON.js +331 -0
  21. package/dist/chunk-EBGIRKQY.js +616 -0
  22. package/dist/chunk-EUZND3CB.js +27 -0
  23. package/dist/chunk-F3FA4F32.js +292 -0
  24. package/dist/chunk-JAKHTMQU.js +1000 -0
  25. package/dist/chunk-JCI5M6U6.js +956 -0
  26. package/dist/chunk-KQPDEVVS.js +398 -0
  27. package/dist/chunk-M4NLBH4I.js +725 -0
  28. package/dist/chunk-NEKUBFPT.js +60 -0
  29. package/dist/chunk-NYVAC6P5.js +37 -0
  30. package/dist/chunk-PTQJDMRT.js +146 -0
  31. package/dist/chunk-QWZG56ET.js +2744 -0
  32. package/dist/chunk-TSOKIX5Z.js +654 -0
  33. package/dist/chunk-UHNL42EF.js +2730 -0
  34. package/dist/chunk-VRW3FULF.js +725 -0
  35. package/dist/chunk-WZSPOOER.js +84 -0
  36. package/dist/chunk-YT6HQ6AM.js +14 -0
  37. package/dist/chunk-ZD6OAMTH.js +277 -0
  38. package/dist/chunk-ZWKZCBO6.js +317 -0
  39. package/dist/contracts-DDrwxvJ-.d.cts +245 -0
  40. package/dist/contracts-DDrwxvJ-.d.ts +245 -0
  41. package/dist/contracts-xo5ckdRP.d.cts +240 -0
  42. package/dist/contracts-xo5ckdRP.d.ts +240 -0
  43. package/dist/data.cjs +35 -2
  44. package/dist/data.d.cts +7 -0
  45. package/dist/data.d.ts +7 -0
  46. package/dist/data.js +9 -8
  47. package/dist/devtools.cjs +122 -0
  48. package/dist/devtools.d.cts +69 -461
  49. package/dist/devtools.d.ts +69 -461
  50. package/dist/devtools.js +127 -6
  51. package/dist/ecosystem.cjs +23 -6
  52. package/dist/ecosystem.d.cts +1 -1
  53. package/dist/ecosystem.d.ts +1 -1
  54. package/dist/ecosystem.js +10 -9
  55. package/dist/extras.cjs +1208 -88
  56. package/dist/extras.d.cts +6 -6
  57. package/dist/extras.d.ts +6 -6
  58. package/dist/extras.js +70 -33
  59. package/dist/index.cjs +663 -158
  60. package/dist/index.d.cts +398 -40
  61. package/dist/index.d.ts +398 -40
  62. package/dist/index.js +39 -21
  63. package/dist/introspect-BumjnBKr.d.cts +477 -0
  64. package/dist/introspect-CZrlcaYy.d.ts +477 -0
  65. package/dist/introspect-Cb0zgpi2.d.cts +477 -0
  66. package/dist/introspect-Y2xNXGSf.d.ts +477 -0
  67. package/dist/motion.js +4 -4
  68. package/dist/patterns.cjs +51 -24
  69. package/dist/patterns.d.cts +19 -57
  70. package/dist/patterns.d.ts +19 -57
  71. package/dist/patterns.js +8 -16
  72. package/dist/performance.js +4 -4
  73. package/dist/plugins.cjs +429 -82
  74. package/dist/plugins.d.cts +27 -4
  75. package/dist/plugins.d.ts +27 -4
  76. package/dist/plugins.js +156 -37
  77. package/dist/ssr-4PBXAOO3.js +40 -0
  78. package/dist/ssr-Do_SiVoL.d.cts +201 -0
  79. package/dist/ssr-Do_SiVoL.d.ts +201 -0
  80. package/dist/ssr.cjs +312 -60
  81. package/dist/ssr.d.cts +10 -1
  82. package/dist/ssr.d.ts +10 -1
  83. package/dist/ssr.js +13 -10
  84. package/dist/tagFactory-DaJ0YWX6.d.cts +47 -0
  85. package/dist/tagFactory-DaJ0YWX6.d.ts +47 -0
  86. package/dist/testing.cjs +233 -2
  87. package/dist/testing.d.cts +42 -1
  88. package/dist/testing.d.ts +42 -1
  89. package/dist/testing.js +129 -2
  90. package/dist/ui.cjs +374 -8
  91. package/dist/ui.d.cts +252 -2
  92. package/dist/ui.d.ts +252 -2
  93. package/dist/ui.js +329 -11
  94. package/dist/widgets.js +7 -7
  95. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as composable, d as compose, e as createGuard, f as createSlots, g as defineComponent, h as defineSlottedComponent, i as defineStrictComponent, v as validateProps, j as validators, w as withBoundary, k as withDefaults, l as withProps, m as withWrapper } from './contracts-DOrhwbke.cjs';
1
+ 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.cjs';
2
2
 
3
3
  interface MachineConfig<S extends string, E extends string, C extends Record<string, unknown> = Record<string, unknown>> {
4
4
  initial: S;
@@ -54,23 +54,33 @@ interface PersistOptions<T = unknown> {
54
54
  deserialize?: (raw: string) => unknown;
55
55
  /** Optional type guard to validate deserialized data. Falls back to initial on failure. */
56
56
  validate?: (value: unknown) => value is T;
57
+ /**
58
+ * Sync the signal across browser tabs via the `storage` event.
59
+ * Only applies when using localStorage (not sessionStorage — session storage
60
+ * is already isolated per tab). Default: `true` for localStorage.
61
+ */
62
+ syncTabs?: boolean;
57
63
  /**
58
64
  * Encrypt the serialized value before writing to storage.
59
65
  * Paired with `decrypt` for reading. Use for sensitive data.
60
66
  *
61
- * **Security:** Use a real encryption algorithm (e.g. AES-GCM via Web Crypto API).
62
- * Do NOT use `btoa()`/`atob()` Base64 is encoding, not encryption, and provides
63
- * zero confidentiality.
67
+ * **Security requirement:** use an authenticated encryption algorithm
68
+ * such as AES-GCM via the Web Crypto API. Do NOT:
69
+ *
70
+ * - use `btoa()` / `atob()` — Base64 is encoding, not encryption
71
+ * - use XOR with a static key — trivially reversible
72
+ * - roll your own cipher — nearly always broken
64
73
  *
65
74
  * @example
66
75
  * ```ts
67
- * // Example using a simple XOR cipher for illustration — in production,
68
- * // use crypto.subtle.encrypt() with AES-GCM or a proven library.
69
76
  * persisted("token", "", {
70
- * encrypt: (v) => myAesGcmEncrypt(v, secretKey),
71
- * decrypt: (v) => myAesGcmDecrypt(v, secretKey),
77
+ * encrypt: async (v) => aesGcmEncrypt(v, await getKey()),
78
+ * decrypt: async (v) => aesGcmDecrypt(v, await getKey()),
72
79
  * });
73
80
  * ```
81
+ *
82
+ * Note that because localStorage is synchronous, any real AES-GCM
83
+ * flow needs pre-derived keys and is inherently best-effort.
74
84
  */
75
85
  encrypt?: (value: string) => string;
76
86
  /** Decrypt the stored value before deserialization. Required if `encrypt` is set. */
@@ -141,52 +151,4 @@ declare function globalStore<S extends Record<string, unknown>, A extends Record
141
151
  middleware?: Middleware<S>[];
142
152
  }): GlobalStore<S, A>;
143
153
 
144
- /**
145
- * SolidJS-style reactive primitives — standalone APIs that don't require
146
- * being inside a component. These are thin wrappers around the signal system.
147
- */
148
- /**
149
- * Creates a reactive signal. Equivalent to signal but with SolidJS naming.
150
- *
151
- * @param value Initial value
152
- * @returns Tuple [getter, setter]
153
- *
154
- * @example
155
- * ```ts
156
- * const [count, setCount] = createSignal(0);
157
- * console.log(count()); // 0
158
- * setCount(5);
159
- * ```
160
- */
161
- declare function createSignal<T>(value: T): [() => T, (next: T | ((prev: T) => T)) => void];
162
- /**
163
- * Creates a derived/computed reactive value. Equivalent to derived.
164
- *
165
- * @param fn Computation function that reads other signals
166
- * @returns Getter for the computed value
167
- *
168
- * @example
169
- * ```ts
170
- * const [count] = createSignal(5);
171
- * const doubled = createMemo(() => count() * 2);
172
- * console.log(doubled()); // 10
173
- * ```
174
- */
175
- declare function createMemo<T>(fn: () => T): () => T;
176
- /**
177
- * Creates a reactive side effect. Equivalent to effect.
178
- *
179
- * @param fn Effect function that reads reactive signals
180
- * @returns Cleanup/teardown function
181
- *
182
- * @example
183
- * ```ts
184
- * const [count] = createSignal(0);
185
- * const cleanup = createEffect(() => {
186
- * console.log("Count is:", count());
187
- * });
188
- * ```
189
- */
190
- declare function createEffect(fn: () => void): () => void;
191
-
192
- export { type GlobalStore, type MachineConfig, type MachineReturn, type Middleware, type OptimisticAction, type PersistOptions, type Selector, type TimeTravelReturn, createEffect, createMemo, createSignal, globalStore, machine, optimistic, optimisticList, persisted, timeline };
154
+ export { type GlobalStore, type MachineConfig, type MachineReturn, type Middleware, type OptimisticAction, type PersistOptions, type Selector, type TimeTravelReturn, globalStore, machine, optimistic, optimisticList, persisted, timeline };
@@ -1,4 +1,4 @@
1
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as composable, d as compose, e as createGuard, f as createSlots, g as defineComponent, h as defineSlottedComponent, i as defineStrictComponent, v as validateProps, j as validators, w as withBoundary, k as withDefaults, l as withProps, m as withWrapper } from './contracts-DOrhwbke.js';
1
+ 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';
2
2
 
3
3
  interface MachineConfig<S extends string, E extends string, C extends Record<string, unknown> = Record<string, unknown>> {
4
4
  initial: S;
@@ -54,23 +54,33 @@ interface PersistOptions<T = unknown> {
54
54
  deserialize?: (raw: string) => unknown;
55
55
  /** Optional type guard to validate deserialized data. Falls back to initial on failure. */
56
56
  validate?: (value: unknown) => value is T;
57
+ /**
58
+ * Sync the signal across browser tabs via the `storage` event.
59
+ * Only applies when using localStorage (not sessionStorage — session storage
60
+ * is already isolated per tab). Default: `true` for localStorage.
61
+ */
62
+ syncTabs?: boolean;
57
63
  /**
58
64
  * Encrypt the serialized value before writing to storage.
59
65
  * Paired with `decrypt` for reading. Use for sensitive data.
60
66
  *
61
- * **Security:** Use a real encryption algorithm (e.g. AES-GCM via Web Crypto API).
62
- * Do NOT use `btoa()`/`atob()` Base64 is encoding, not encryption, and provides
63
- * zero confidentiality.
67
+ * **Security requirement:** use an authenticated encryption algorithm
68
+ * such as AES-GCM via the Web Crypto API. Do NOT:
69
+ *
70
+ * - use `btoa()` / `atob()` — Base64 is encoding, not encryption
71
+ * - use XOR with a static key — trivially reversible
72
+ * - roll your own cipher — nearly always broken
64
73
  *
65
74
  * @example
66
75
  * ```ts
67
- * // Example using a simple XOR cipher for illustration — in production,
68
- * // use crypto.subtle.encrypt() with AES-GCM or a proven library.
69
76
  * persisted("token", "", {
70
- * encrypt: (v) => myAesGcmEncrypt(v, secretKey),
71
- * decrypt: (v) => myAesGcmDecrypt(v, secretKey),
77
+ * encrypt: async (v) => aesGcmEncrypt(v, await getKey()),
78
+ * decrypt: async (v) => aesGcmDecrypt(v, await getKey()),
72
79
  * });
73
80
  * ```
81
+ *
82
+ * Note that because localStorage is synchronous, any real AES-GCM
83
+ * flow needs pre-derived keys and is inherently best-effort.
74
84
  */
75
85
  encrypt?: (value: string) => string;
76
86
  /** Decrypt the stored value before deserialization. Required if `encrypt` is set. */
@@ -141,52 +151,4 @@ declare function globalStore<S extends Record<string, unknown>, A extends Record
141
151
  middleware?: Middleware<S>[];
142
152
  }): GlobalStore<S, A>;
143
153
 
144
- /**
145
- * SolidJS-style reactive primitives — standalone APIs that don't require
146
- * being inside a component. These are thin wrappers around the signal system.
147
- */
148
- /**
149
- * Creates a reactive signal. Equivalent to signal but with SolidJS naming.
150
- *
151
- * @param value Initial value
152
- * @returns Tuple [getter, setter]
153
- *
154
- * @example
155
- * ```ts
156
- * const [count, setCount] = createSignal(0);
157
- * console.log(count()); // 0
158
- * setCount(5);
159
- * ```
160
- */
161
- declare function createSignal<T>(value: T): [() => T, (next: T | ((prev: T) => T)) => void];
162
- /**
163
- * Creates a derived/computed reactive value. Equivalent to derived.
164
- *
165
- * @param fn Computation function that reads other signals
166
- * @returns Getter for the computed value
167
- *
168
- * @example
169
- * ```ts
170
- * const [count] = createSignal(5);
171
- * const doubled = createMemo(() => count() * 2);
172
- * console.log(doubled()); // 10
173
- * ```
174
- */
175
- declare function createMemo<T>(fn: () => T): () => T;
176
- /**
177
- * Creates a reactive side effect. Equivalent to effect.
178
- *
179
- * @param fn Effect function that reads reactive signals
180
- * @returns Cleanup/teardown function
181
- *
182
- * @example
183
- * ```ts
184
- * const [count] = createSignal(0);
185
- * const cleanup = createEffect(() => {
186
- * console.log("Count is:", count());
187
- * });
188
- * ```
189
- */
190
- declare function createEffect(fn: () => void): () => void;
191
-
192
- export { type GlobalStore, type MachineConfig, type MachineReturn, type Middleware, type OptimisticAction, type PersistOptions, type Selector, type TimeTravelReturn, createEffect, createMemo, createSignal, globalStore, machine, optimistic, optimisticList, persisted, timeline };
154
+ export { type GlobalStore, type MachineConfig, type MachineReturn, type Middleware, type OptimisticAction, type PersistOptions, type Selector, type TimeTravelReturn, globalStore, machine, optimistic, optimisticList, persisted, timeline };
package/dist/patterns.js CHANGED
@@ -1,18 +1,14 @@
1
1
  import {
2
- createEffect,
3
- createMemo,
4
- createSignal,
5
2
  globalStore,
6
3
  machine,
7
4
  optimistic,
8
5
  optimisticList,
9
6
  persisted,
10
7
  timeline
11
- } from "./chunk-WILQZRO4.js";
8
+ } from "./chunk-ZWKZCBO6.js";
12
9
  import {
13
10
  RenderProp,
14
11
  assertType,
15
- composable,
16
12
  compose,
17
13
  createGuard,
18
14
  createSlots,
@@ -25,22 +21,18 @@ import {
25
21
  withDefaults,
26
22
  withProps,
27
23
  withWrapper
28
- } from "./chunk-XYU6TZOW.js";
29
- import "./chunk-L6JRBDNS.js";
30
- import "./chunk-6SA3QQES.js";
31
- import "./chunk-CHJ27IGK.js";
32
- import "./chunk-V2XTI523.js";
33
- import "./chunk-UNXCEF6S.js";
34
- import "./chunk-MLKGABMK.js";
24
+ } from "./chunk-CNZ35WI2.js";
25
+ import "./chunk-NEKUBFPT.js";
26
+ import "./chunk-CHF5OHIA.js";
27
+ import "./chunk-EUZND3CB.js";
28
+ import "./chunk-WZSPOOER.js";
29
+ import "./chunk-ZD6OAMTH.js";
30
+ import "./chunk-5X6PP2UK.js";
35
31
  export {
36
32
  RenderProp,
37
33
  assertType,
38
- composable,
39
34
  compose,
40
- createEffect,
41
35
  createGuard,
42
- createMemo,
43
- createSignal,
44
36
  createSlots,
45
37
  defineComponent,
46
38
  defineSlottedComponent,
@@ -33,10 +33,10 @@ import {
33
33
  transitionState,
34
34
  uniqueId,
35
35
  yieldToMain
36
- } from "./chunk-YUTWTI4B.js";
37
- import "./chunk-V2XTI523.js";
38
- import "./chunk-UNXCEF6S.js";
39
- import "./chunk-MLKGABMK.js";
36
+ } from "./chunk-TSOKIX5Z.js";
37
+ import "./chunk-WZSPOOER.js";
38
+ import "./chunk-ZD6OAMTH.js";
39
+ import "./chunk-5X6PP2UK.js";
40
40
  export {
41
41
  DOMPool,
42
42
  Features,