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
package/dist/ssr.d.cts CHANGED
@@ -1,10 +1,40 @@
1
- export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-Bli9XRW5.cjs';
1
+ export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-C8hgIAw7.cjs';
2
+ import { C as Component } from './types-CJFViL6Q.cjs';
2
3
 
3
4
  interface HeadProps {
4
5
  title?: string | (() => string);
5
6
  meta?: Record<string, string | (() => string)>[];
7
+ /**
8
+ * `<link>` elements to add to `<head>`.
9
+ *
10
+ * TRUST BOUNDARY for stylesheets: `{ rel: "stylesheet", href }` is the
11
+ * framework's explicit API for a stylesheet whose URL is a runtime value.
12
+ * The generic writers refuse to let a runtime `href` become an applied
13
+ * stylesheet at all (see `utils/elementPolicy.ts`), because a well-formed
14
+ * URL is not trusted CSS. Naming it here is the trust decision: first-party
15
+ * or pinned URLs only, and a CSP `style-src` as the second layer.
16
+ */
6
17
  link?: Record<string, string>[];
18
+ /**
19
+ * External scripts to add to `<head>`.
20
+ *
21
+ * TRUST BOUNDARY: this is the framework's explicit API for loading a script
22
+ * whose URL is a runtime value, and naming it here IS the trust decision —
23
+ * the URL passes the scheme allowlist, but an allowed `https:` URL is still a
24
+ * program that runs with the page's full authority. Pass only URLs you
25
+ * control or pin (a first-party path, a CDN URL with `integrity`). The
26
+ * generic writers refuse to let a runtime value choose a `<script>` source
27
+ * at all; see `docs/architecture/attribute-security.md` § Trust model.
28
+ */
7
29
  script?: Record<string, string>[];
30
+ /**
31
+ * The document `<base>`.
32
+ *
33
+ * TRUST BOUNDARY: `href` passes the scheme allowlist, but an allowed `https:`
34
+ * base still re-homes every relative URL on the page — relative `<script
35
+ * src>`, stylesheets, form actions and `fetch("/api")` alike. Treat it like a
36
+ * script URL: first-party values only.
37
+ */
8
38
  base?: {
9
39
  href?: string;
10
40
  target?: string;
@@ -94,6 +124,10 @@ interface UseWorkerFnReturn<TArgs extends unknown[], TResult> {
94
124
  * The function must be self-contained -- it cannot reference variables
95
125
  * from the outer scope. Arguments are serialized via postMessage.
96
126
  *
127
+ * **Trust boundary:** the function's source is evaluated in a `blob:` worker,
128
+ * which is equivalent to `eval()`. Only a function object is accepted — never
129
+ * a string, and never a function built from untrusted input.
130
+ *
97
131
  * @param fn A pure function to execute in a worker thread.
98
132
  * @returns An object with run, loading, and terminate.
99
133
  */
@@ -108,6 +142,9 @@ interface WorkerPool<TInput, TOutput> {
108
142
  * Tasks are distributed across workers using round-robin scheduling.
109
143
  * Each worker is created from the same inline function.
110
144
  *
145
+ * **Trust boundary:** as with `worker()`, the function's source is evaluated in
146
+ * a `blob:` worker. Only a function object is accepted, never a string.
147
+ *
111
148
  * @param workerFn The function body to run inside each worker.
112
149
  * @param poolSize Number of workers in the pool (defaults to navigator.hardwareConcurrency or 4).
113
150
  * @returns An object with execute and terminate.
@@ -362,9 +399,13 @@ interface LoadRemoteModuleOptions {
362
399
  unsafelyAllowAnyOrigin?: boolean;
363
400
  }
364
401
  declare function loadRemoteModule(url: string, optionsOrAllowedOrigins?: string[] | LoadRemoteModuleOptions): Promise<unknown>;
365
- type Component = () => HTMLElement;
366
- type RemoteLoader = () => Promise<{
367
- default: Component;
402
+ /**
403
+ * Loads the remote module whose `default` export is the component. Its root may
404
+ * be any `Element` — an SVG root included — using the public `Component` type
405
+ * rather than a private `() => HTMLElement` that forced a cast.
406
+ */
407
+ type RemoteLoader<R extends Element = HTMLElement> = () => Promise<{
408
+ default: Component<void, R>;
368
409
  }>;
369
410
  /**
370
411
  * Register a remote component that loads on demand.
@@ -392,7 +433,7 @@ type RemoteLoader = () => Promise<{
392
433
  * document.body.appendChild(RemoteHeader());
393
434
  * ```
394
435
  */
395
- declare function defineRemoteComponent(name: string, loader: RemoteLoader): Component;
436
+ declare function defineRemoteComponent<R extends Element = HTMLElement>(name: string, loader: RemoteLoader<R>): Component<void, R | HTMLElement>;
396
437
  /**
397
438
  * Create a shared state scope that enables communication between independent
398
439
  * micro-frontend instances.
@@ -430,6 +471,15 @@ interface ServiceWorkerState {
430
471
  /**
431
472
  * serviceWorker registers and manages a service worker.
432
473
  *
474
+ * TRUST BOUNDARY: `scriptUrl` is CODE. A service worker runs with authority
475
+ * over every page in its scope and persists across reloads, so this is the
476
+ * strongest code-loading primitive in the framework. The browser enforces
477
+ * same-origin, a secure context and a JavaScript MIME type — it does NOT
478
+ * protect against a same-origin URL that serves attacker-influenced content
479
+ * (a JSONP endpoint, an upload directory). Pass only a literal path to a worker
480
+ * script you ship; never a value derived from the URL, storage or an API
481
+ * response.
482
+ *
433
483
  * LIFECYCLE CONTRACT
434
484
  * ------------------
435
485
  * Registration is asynchronous and `unregister()` can be called at any point
package/dist/ssr.d.ts CHANGED
@@ -1,10 +1,40 @@
1
- export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-Bli9XRW5.js';
1
+ export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-C8hgIAw7.js';
2
+ import { C as Component } from './types-CJFViL6Q.js';
2
3
 
3
4
  interface HeadProps {
4
5
  title?: string | (() => string);
5
6
  meta?: Record<string, string | (() => string)>[];
7
+ /**
8
+ * `<link>` elements to add to `<head>`.
9
+ *
10
+ * TRUST BOUNDARY for stylesheets: `{ rel: "stylesheet", href }` is the
11
+ * framework's explicit API for a stylesheet whose URL is a runtime value.
12
+ * The generic writers refuse to let a runtime `href` become an applied
13
+ * stylesheet at all (see `utils/elementPolicy.ts`), because a well-formed
14
+ * URL is not trusted CSS. Naming it here is the trust decision: first-party
15
+ * or pinned URLs only, and a CSP `style-src` as the second layer.
16
+ */
6
17
  link?: Record<string, string>[];
18
+ /**
19
+ * External scripts to add to `<head>`.
20
+ *
21
+ * TRUST BOUNDARY: this is the framework's explicit API for loading a script
22
+ * whose URL is a runtime value, and naming it here IS the trust decision —
23
+ * the URL passes the scheme allowlist, but an allowed `https:` URL is still a
24
+ * program that runs with the page's full authority. Pass only URLs you
25
+ * control or pin (a first-party path, a CDN URL with `integrity`). The
26
+ * generic writers refuse to let a runtime value choose a `<script>` source
27
+ * at all; see `docs/architecture/attribute-security.md` § Trust model.
28
+ */
7
29
  script?: Record<string, string>[];
30
+ /**
31
+ * The document `<base>`.
32
+ *
33
+ * TRUST BOUNDARY: `href` passes the scheme allowlist, but an allowed `https:`
34
+ * base still re-homes every relative URL on the page — relative `<script
35
+ * src>`, stylesheets, form actions and `fetch("/api")` alike. Treat it like a
36
+ * script URL: first-party values only.
37
+ */
8
38
  base?: {
9
39
  href?: string;
10
40
  target?: string;
@@ -94,6 +124,10 @@ interface UseWorkerFnReturn<TArgs extends unknown[], TResult> {
94
124
  * The function must be self-contained -- it cannot reference variables
95
125
  * from the outer scope. Arguments are serialized via postMessage.
96
126
  *
127
+ * **Trust boundary:** the function's source is evaluated in a `blob:` worker,
128
+ * which is equivalent to `eval()`. Only a function object is accepted — never
129
+ * a string, and never a function built from untrusted input.
130
+ *
97
131
  * @param fn A pure function to execute in a worker thread.
98
132
  * @returns An object with run, loading, and terminate.
99
133
  */
@@ -108,6 +142,9 @@ interface WorkerPool<TInput, TOutput> {
108
142
  * Tasks are distributed across workers using round-robin scheduling.
109
143
  * Each worker is created from the same inline function.
110
144
  *
145
+ * **Trust boundary:** as with `worker()`, the function's source is evaluated in
146
+ * a `blob:` worker. Only a function object is accepted, never a string.
147
+ *
111
148
  * @param workerFn The function body to run inside each worker.
112
149
  * @param poolSize Number of workers in the pool (defaults to navigator.hardwareConcurrency or 4).
113
150
  * @returns An object with execute and terminate.
@@ -362,9 +399,13 @@ interface LoadRemoteModuleOptions {
362
399
  unsafelyAllowAnyOrigin?: boolean;
363
400
  }
364
401
  declare function loadRemoteModule(url: string, optionsOrAllowedOrigins?: string[] | LoadRemoteModuleOptions): Promise<unknown>;
365
- type Component = () => HTMLElement;
366
- type RemoteLoader = () => Promise<{
367
- default: Component;
402
+ /**
403
+ * Loads the remote module whose `default` export is the component. Its root may
404
+ * be any `Element` — an SVG root included — using the public `Component` type
405
+ * rather than a private `() => HTMLElement` that forced a cast.
406
+ */
407
+ type RemoteLoader<R extends Element = HTMLElement> = () => Promise<{
408
+ default: Component<void, R>;
368
409
  }>;
369
410
  /**
370
411
  * Register a remote component that loads on demand.
@@ -392,7 +433,7 @@ type RemoteLoader = () => Promise<{
392
433
  * document.body.appendChild(RemoteHeader());
393
434
  * ```
394
435
  */
395
- declare function defineRemoteComponent(name: string, loader: RemoteLoader): Component;
436
+ declare function defineRemoteComponent<R extends Element = HTMLElement>(name: string, loader: RemoteLoader<R>): Component<void, R | HTMLElement>;
396
437
  /**
397
438
  * Create a shared state scope that enables communication between independent
398
439
  * micro-frontend instances.
@@ -430,6 +471,15 @@ interface ServiceWorkerState {
430
471
  /**
431
472
  * serviceWorker registers and manages a service worker.
432
473
  *
474
+ * TRUST BOUNDARY: `scriptUrl` is CODE. A service worker runs with authority
475
+ * over every page in its scope and persists across reloads, so this is the
476
+ * strongest code-loading primitive in the framework. The browser enforces
477
+ * same-origin, a secure context and a JavaScript MIME type — it does NOT
478
+ * protect against a same-origin URL that serves attacker-influenced content
479
+ * (a JSONP endpoint, an upload directory). Pass only a literal path to a worker
480
+ * script you ship; never a value derived from the URL, storage or an API
481
+ * response.
482
+ *
433
483
  * LIFECYCLE CONTRACT
434
484
  * ------------------
435
485
  * Registration is asynchronous and `unregister()` can be called at any point
package/dist/ssr.js CHANGED
@@ -23,9 +23,9 @@ import {
23
23
  wasm,
24
24
  worker,
25
25
  workerFn
26
- } from "./chunk-VZSG24LS.js";
26
+ } from "./chunk-JUTFX2RM.js";
27
27
  import "./chunk-52XFPGSN.js";
28
- import "./chunk-7LUJQAOJ.js";
28
+ import "./chunk-Q5J2LVKH.js";
29
29
  import {
30
30
  collectStream,
31
31
  deserializeState,
@@ -45,15 +45,17 @@ import {
45
45
  ssrSuspense,
46
46
  suspenseSwapScript,
47
47
  trustHTML
48
- } from "./chunk-HURREPU2.js";
49
- import "./chunk-UOL2ECCS.js";
50
- import "./chunk-FNJXNGYZ.js";
51
- import "./chunk-2INLLLMZ.js";
48
+ } from "./chunk-FC6KCJSA.js";
49
+ import "./chunk-62BDYGAG.js";
50
+ import "./chunk-VWT3VXPL.js";
51
+ import "./chunk-O6TRVMJI.js";
52
+ import "./chunk-3ACAAQIN.js";
52
53
  import "./chunk-7ZHH77QA.js";
53
- import "./chunk-WEQ3DMVL.js";
54
+ import "./chunk-V3LHZSU5.js";
55
+ import "./chunk-EXXSN3BW.js";
54
56
  import "./chunk-7XHATCIH.js";
55
- import "./chunk-FQRUXCEE.js";
56
- import "./chunk-JWKYU5GV.js";
57
+ import "./chunk-DSID757X.js";
58
+ import "./chunk-TQQUN4WR.js";
57
59
  import "./chunk-NYNYSPK7.js";
58
60
  export {
59
61
  Head,
package/dist/testing.cjs CHANGED
@@ -754,7 +754,7 @@ function forEachSubscriber(signal, visit) {
754
754
  }
755
755
 
756
756
  // src/reactivity/track.ts
757
- var _runtimeVersion = true ? "4.7.0" : "dev";
757
+ var _runtimeVersion = true ? "4.8.0" : "dev";
758
758
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
759
759
  function resolveReactiveApi() {
760
760
  const g = globalThis;
@@ -1163,8 +1163,8 @@ function enableListenerTracking() {
1163
1163
  if (opts?.signal) {
1164
1164
  const signal = opts.signal;
1165
1165
  const onAbort = () => drop(this, type2, entry);
1166
- add.call(signal, "abort", onAbort, { once: true });
1167
- releases.push(() => remove.call(signal, "abort", onAbort));
1166
+ signal.addEventListener("abort", onAbort, { once: true });
1167
+ releases.push(() => signal.removeEventListener("abort", onAbort));
1168
1168
  }
1169
1169
  if (releases.length > 0) {
1170
1170
  entry.release = () => {
package/dist/testing.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-7ZHH77QA.js";
4
4
  import {
5
5
  effect
6
- } from "./chunk-WEQ3DMVL.js";
6
+ } from "./chunk-V3LHZSU5.js";
7
7
  import "./chunk-7XHATCIH.js";
8
- import "./chunk-JWKYU5GV.js";
8
+ import "./chunk-TQQUN4WR.js";
9
9
  import {
10
10
  dispose,
11
11
  replaceChildrenSafely,
@@ -189,8 +189,8 @@ function enableListenerTracking() {
189
189
  if (opts?.signal) {
190
190
  const signal = opts.signal;
191
191
  const onAbort = () => drop(this, type2, entry);
192
- add.call(signal, "abort", onAbort, { once: true });
193
- releases.push(() => remove.call(signal, "abort", onAbort));
192
+ signal.addEventListener("abort", onAbort, { once: true });
193
+ releases.push(() => signal.removeEventListener("abort", onAbort));
194
194
  }
195
195
  if (releases.length > 0) {
196
196
  entry.release = () => {