sibujs 4.7.0 → 4.9.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 (83) hide show
  1. package/dist/browser.cjs +48 -6
  2. package/dist/browser.d.cts +26 -2
  3. package/dist/browser.d.ts +26 -2
  4. package/dist/browser.js +6 -5
  5. package/dist/build.cjs +539 -96
  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-Z3OHK6QT.js → chunk-2K3Z3XO4.js} +5 -5
  14. package/dist/chunk-3ACAAQIN.js +224 -0
  15. package/dist/{chunk-WOLJZUFQ.js → chunk-562UVHMM.js} +32 -15
  16. package/dist/{chunk-UOL2ECCS.js → chunk-5MLWTIQE.js} +18 -12
  17. package/dist/{chunk-H3SRKIYX.js → chunk-62BDYGAG.js} +8 -0
  18. package/dist/{chunk-3QWBSL5R.js → chunk-7OV5Q2UU.js} +8 -5
  19. package/dist/{chunk-SLM3IA34.js → chunk-CDBKFGXN.js} +1 -1
  20. package/dist/{chunk-4AWA2PVD.js → chunk-CF2KCWRE.js} +10 -5
  21. package/dist/{chunk-BSY63EM6.js → chunk-DRMLIF6M.js} +20 -5
  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-BC2SECJD.js → chunk-FHCZMHHE.js} +1 -1
  25. package/dist/{chunk-XYV3EDB7.js → chunk-FNOK662L.js} +63 -38
  26. package/dist/{chunk-JWKYU5GV.js → chunk-G2WHYEL7.js} +1 -1
  27. package/dist/{chunk-DKXRACVN.js → chunk-K6K5ACO6.js} +6 -6
  28. package/dist/{chunk-VZSG24LS.js → chunk-KG25XMGP.js} +45 -17
  29. package/dist/{chunk-FNJXNGYZ.js → chunk-MPWDSTYK.js} +58 -6
  30. package/dist/{chunk-UNWRJRKC.js → chunk-NQMKWBKU.js} +1 -1
  31. package/dist/{chunk-7LUJQAOJ.js → chunk-QBKCK6MJ.js} +1 -1
  32. package/dist/{chunk-WEQ3DMVL.js → chunk-SBTZEYNI.js} +1 -1
  33. package/dist/{chunk-FQRUXCEE.js → chunk-SYHGGDNW.js} +1 -1
  34. package/dist/{chunk-XZR4PXRE.js → chunk-TV464N2M.js} +13 -10
  35. package/dist/{chunk-RUSSKG6G.js → chunk-X7NRHFZR.js} +1 -1
  36. package/dist/{chunk-2BPG2XDA.js → chunk-XJVTQUIV.js} +18 -36
  37. package/dist/{chunk-ZVL7TY4K.js → chunk-YW6HQKGO.js} +25 -10
  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 +29 -9
  41. package/dist/data.d.cts +23 -4
  42. package/dist/data.d.ts +23 -4
  43. package/dist/data.js +6 -6
  44. package/dist/devtools.cjs +1 -1
  45. package/dist/devtools.js +5 -5
  46. package/dist/ecosystem.cjs +400 -37
  47. package/dist/ecosystem.js +9 -8
  48. package/dist/extras.cjs +672 -269
  49. package/dist/extras.d.cts +2 -2
  50. package/dist/extras.d.ts +2 -2
  51. package/dist/extras.js +24 -23
  52. package/dist/index.cjs +490 -88
  53. package/dist/index.d.cts +34 -2
  54. package/dist/index.d.ts +34 -2
  55. package/dist/index.js +16 -12
  56. package/dist/motion.cjs +1 -1
  57. package/dist/motion.js +3 -3
  58. package/dist/patterns.cjs +10 -7
  59. package/dist/patterns.js +6 -6
  60. package/dist/performance.cjs +31 -2
  61. package/dist/performance.d.cts +12 -2
  62. package/dist/performance.d.ts +12 -2
  63. package/dist/performance.js +8 -6
  64. package/dist/plugins.cjs +571 -240
  65. package/dist/plugins.d.cts +14 -3
  66. package/dist/plugins.d.ts +14 -3
  67. package/dist/plugins.js +35 -37
  68. package/dist/{ssr-XOTUASDO.js → ssr-5OWAH3U2.js} +4 -2
  69. package/dist/{ssr-Bli9XRW5.d.ts → ssr-C8hgIAw7.d.cts} +6 -0
  70. package/dist/{ssr-Bli9XRW5.d.cts → ssr-C8hgIAw7.d.ts} +6 -0
  71. package/dist/ssr.cjs +484 -138
  72. package/dist/ssr.d.cts +59 -5
  73. package/dist/ssr.d.ts +59 -5
  74. package/dist/ssr.js +11 -9
  75. package/dist/testing.cjs +3 -3
  76. package/dist/testing.js +4 -4
  77. package/dist/ui.cjs +609 -241
  78. package/dist/ui.d.cts +1 -1
  79. package/dist/ui.d.ts +1 -1
  80. package/dist/ui.js +9 -8
  81. package/dist/widgets.cjs +1 -1
  82. package/dist/widgets.js +7 -7
  83. package/package.json +5 -4
@@ -1,6 +1,6 @@
1
1
  import { A as Accessor } from './signal-EotCj4hS.cjs';
2
- import { N as NodeChildren } from './types-CJFViL6Q.cjs';
3
- import { T as TrustedHTML } from './ssr-Bli9XRW5.cjs';
2
+ import { C as Component$1, N as NodeChildren } from './types-CJFViL6Q.cjs';
3
+ import { T as TrustedHTML } from './ssr-C8hgIAw7.cjs';
4
4
  export { P as PluginContext, a as PluginInstallCancelledError, b as PluginRegistry, S as SibuPlugin, c as createPlugin, d as createPluginRegistry, i as inject, e as isPluginInstallCancelledError, p as plugin, r as resetPlugins, s as setDefaultPluginRegistry, t as triggerPluginError, f as triggerPluginMount, g as triggerPluginUnmount } from './plugin-DVgSnTfK.cjs';
5
5
  export { L as LazyModule, M as Migration, a as MigrationStorageError, P as PackageExportTarget, S as SemVer, V as VERSION, b as bundlerMetadata, c as checkCompatibility, d as compareSemVer, e as createBootSequence, f as createBundle, g as createMigrationRunner, h as createModuleRegistry, i as createSSRCache, j as createTestHarness, k as deferNonCritical, l as env, m as healthCheck, n as lazyModule, p as packageInfo, o as parseSemVer, q as preloadCritical, r as prerenderRoutes, s as satisfies } from './startup-BLfSeL15.cjs';
6
6
 
@@ -166,7 +166,12 @@ declare function hasTranslation(key: string): boolean;
166
166
  */
167
167
  declare function getAvailableLocales(): string[];
168
168
 
169
- type Component = () => Element;
169
+ /**
170
+ * A route component. An alias of the public `Component` (props-less, any
171
+ * `Element` root), kept under this name so existing imports of the router's
172
+ * `Component` continue to work.
173
+ */
174
+ type Component = Component$1<void, Element>;
170
175
  type AsyncComponent = () => Promise<Element>;
171
176
  type LazyComponent = () => Promise<{
172
177
  default: Component;
@@ -175,6 +180,12 @@ type Params = Record<string, string>;
175
180
  interface RouteContext {
176
181
  readonly path: string;
177
182
  readonly params: Params;
183
+ /**
184
+ * The decoded query (`+` is a space, `%XX` is decoded). A repeated key keeps
185
+ * its last value: `?tag=a&tag=b` is `{ tag: "b" }`. Two locations are the
186
+ * same route — for duplicate detection and `RouterLink` exact-active — when
187
+ * their queries have the same entries in any order.
188
+ */
178
189
  readonly query: Params;
179
190
  readonly hash: string;
180
191
  readonly meta: RouteMeta;
package/dist/plugins.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as Accessor } from './signal-EotCj4hS.js';
2
- import { N as NodeChildren } from './types-CJFViL6Q.js';
3
- import { T as TrustedHTML } from './ssr-Bli9XRW5.js';
2
+ import { C as Component$1, N as NodeChildren } from './types-CJFViL6Q.js';
3
+ import { T as TrustedHTML } from './ssr-C8hgIAw7.js';
4
4
  export { P as PluginContext, a as PluginInstallCancelledError, b as PluginRegistry, S as SibuPlugin, c as createPlugin, d as createPluginRegistry, i as inject, e as isPluginInstallCancelledError, p as plugin, r as resetPlugins, s as setDefaultPluginRegistry, t as triggerPluginError, f as triggerPluginMount, g as triggerPluginUnmount } from './plugin-DVgSnTfK.js';
5
5
  export { L as LazyModule, M as Migration, a as MigrationStorageError, P as PackageExportTarget, S as SemVer, V as VERSION, b as bundlerMetadata, c as checkCompatibility, d as compareSemVer, e as createBootSequence, f as createBundle, g as createMigrationRunner, h as createModuleRegistry, i as createSSRCache, j as createTestHarness, k as deferNonCritical, l as env, m as healthCheck, n as lazyModule, p as packageInfo, o as parseSemVer, q as preloadCritical, r as prerenderRoutes, s as satisfies } from './startup-BLfSeL15.js';
6
6
 
@@ -166,7 +166,12 @@ declare function hasTranslation(key: string): boolean;
166
166
  */
167
167
  declare function getAvailableLocales(): string[];
168
168
 
169
- type Component = () => Element;
169
+ /**
170
+ * A route component. An alias of the public `Component` (props-less, any
171
+ * `Element` root), kept under this name so existing imports of the router's
172
+ * `Component` continue to work.
173
+ */
174
+ type Component = Component$1<void, Element>;
170
175
  type AsyncComponent = () => Promise<Element>;
171
176
  type LazyComponent = () => Promise<{
172
177
  default: Component;
@@ -175,6 +180,12 @@ type Params = Record<string, string>;
175
180
  interface RouteContext {
176
181
  readonly path: string;
177
182
  readonly params: Params;
183
+ /**
184
+ * The decoded query (`+` is a space, `%XX` is decoded). A repeated key keeps
185
+ * its last value: `?tag=a&tag=b` is `{ tag: "b" }`. Two locations are the
186
+ * same route — for duplicate detection and `RouterLink` exact-active — when
187
+ * their queries have the same entries in any order.
188
+ */
178
189
  readonly query: Params;
179
190
  readonly hash: string;
180
191
  readonly meta: RouteMeta;
package/dist/plugins.js CHANGED
@@ -19,10 +19,7 @@ import {
19
19
  preloadCritical,
20
20
  prerenderRoutes,
21
21
  satisfies
22
- } from "./chunk-4AWA2PVD.js";
23
- import {
24
- isUnsafeKey
25
- } from "./chunk-H3SRKIYX.js";
22
+ } from "./chunk-CF2KCWRE.js";
26
23
  import {
27
24
  PluginInstallCancelledError,
28
25
  createPlugin,
@@ -38,40 +35,45 @@ import {
38
35
  } from "./chunk-J6FW5TV6.js";
39
36
  import {
40
37
  span
41
- } from "./chunk-7LUJQAOJ.js";
38
+ } from "./chunk-QBKCK6MJ.js";
42
39
  import {
43
40
  escapeScriptJson,
44
41
  renderToString,
45
42
  serializeHeadEntry
46
- } from "./chunk-HURREPU2.js";
43
+ } from "./chunk-FC6KCJSA.js";
44
+ import {
45
+ isUnsafeKey,
46
+ readOwnGlobal
47
+ } from "./chunk-62BDYGAG.js";
47
48
  import {
48
49
  appendChildren,
49
50
  resolveClassValue
50
- } from "./chunk-UOL2ECCS.js";
51
- import "./chunk-FNJXNGYZ.js";
51
+ } from "./chunk-5MLWTIQE.js";
52
52
  import {
53
- isUrlAttribute,
54
- sanitizeStyleAttribute,
55
- sanitizeUrl,
56
- stripControlChars
57
- } from "./chunk-2INLLLMZ.js";
53
+ setSafeAttribute
54
+ } from "./chunk-MPWDSTYK.js";
55
+ import "./chunk-3ACAAQIN.js";
58
56
  import {
59
57
  globalSingleton
60
58
  } from "./chunk-7ZHH77QA.js";
61
59
  import {
62
60
  effect
63
- } from "./chunk-WEQ3DMVL.js";
61
+ } from "./chunk-SBTZEYNI.js";
62
+ import {
63
+ sanitizeUrl,
64
+ stripControlChars
65
+ } from "./chunk-EXXSN3BW.js";
64
66
  import {
65
67
  getRequestStore
66
68
  } from "./chunk-7XHATCIH.js";
67
69
  import "./chunk-5HZXGZ6T.js";
68
70
  import {
69
71
  signal
70
- } from "./chunk-FQRUXCEE.js";
72
+ } from "./chunk-SYHGGDNW.js";
71
73
  import {
72
74
  track,
73
75
  untracked
74
- } from "./chunk-JWKYU5GV.js";
76
+ } from "./chunk-G2WHYEL7.js";
75
77
  import {
76
78
  devWarn,
77
79
  dispose,
@@ -116,6 +118,7 @@ function getLocale() {
116
118
  }
117
119
  return clientLocale();
118
120
  }
121
+ _i18n.getLocale ?? (_i18n.getLocale = getLocale);
119
122
  function registerTranslations(locale, messages) {
120
123
  const prepared = { ...messages };
121
124
  const merged = Object.assign(/* @__PURE__ */ Object.create(null), dictionaryFor(locale), prepared);
@@ -177,9 +180,14 @@ function normalizePathname(path) {
177
180
  const trimmed = path.length > 1 ? path.replace(/\/+$/, "") : path;
178
181
  return trimmed || "/";
179
182
  }
180
- function normalizeQuery(query) {
181
- const params = new URLSearchParams(query);
182
- return [...params.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${k}=${v}`).join("&");
183
+ function parseQuery(query) {
184
+ return Object.fromEntries(new URLSearchParams(query));
185
+ }
186
+ function paramsIdentity(params) {
187
+ return JSON.stringify(Object.entries(params).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
188
+ }
189
+ function queryIdentity(query) {
190
+ return paramsIdentity(typeof query === "string" ? parseQuery(query) : query);
183
191
  }
184
192
  function isPathnameAncestor(target, current) {
185
193
  if (target === current) return true;
@@ -880,7 +888,7 @@ var _SibuRouter = class _SibuRouter {
880
888
  }
881
889
  createRouteContext(fullPath) {
882
890
  const { path, query: queryString, hash } = splitRouteUrl(fullPath);
883
- const query = Object.fromEntries(new URLSearchParams(queryString));
891
+ const query = parseQuery(queryString);
884
892
  const match = this.matcher.match(path || "/");
885
893
  const params = match?.params || {};
886
894
  const meta = match?.route.meta || {};
@@ -1044,7 +1052,7 @@ var _SibuRouter = class _SibuRouter {
1044
1052
  }
1045
1053
  isSameRoute(from, to) {
1046
1054
  if (from.matched.length === 0 && to.matched.length > 0) return false;
1047
- return from.path === to.path && JSON.stringify(from.params) === JSON.stringify(to.params) && JSON.stringify(from.query) === JSON.stringify(to.query) && from.hash === to.hash;
1055
+ return from.path === to.path && paramsIdentity(from.params) === paramsIdentity(to.params) && queryIdentity(from.query) === queryIdentity(to.query) && from.hash === to.hash;
1048
1056
  }
1049
1057
  updateHistory(to, options) {
1050
1058
  const fullPath = this.options.base + to.path + (Object.keys(to.query).length ? `?${new URLSearchParams(to.query).toString()}` : "") + (to.hash ? `#${to.hash}` : "");
@@ -1554,8 +1562,7 @@ function KeepAliveRoute(options) {
1554
1562
  return;
1555
1563
  }
1556
1564
  if (!("component" in routeDef)) return;
1557
- const queryStr = Object.keys(route2.query).length > 0 ? `?${new URLSearchParams(route2.query).toString()}` : "";
1558
- const cacheKey = `${route2.path}${queryStr}${route2.hash ? `#${route2.hash}` : ""}`;
1565
+ const cacheKey = JSON.stringify([route2.path, queryIdentity(route2.query), route2.hash]);
1559
1566
  const shouldCache = !includeNames || routeDef.name != null && includeNames.includes(routeDef.name);
1560
1567
  if (cacheKey === currentKey && currentNode) return;
1561
1568
  if (!anchor.parentNode) return;
@@ -1657,7 +1664,7 @@ function RouterLink(props, children) {
1657
1664
  const href = kind === "unsafe" ? "#" : rawHref;
1658
1665
  const { path: hrefPathRaw, query: hrefQueryRaw, hash: hrefHash } = splitRouteUrl(href);
1659
1666
  const targetPath = normalizePathname(hrefPathRaw);
1660
- const targetQuery = normalizeQuery(hrefQueryRaw);
1667
+ const targetQuery = queryIdentity(hrefQueryRaw);
1661
1668
  const link = document.createElement("a");
1662
1669
  link.href = href;
1663
1670
  if (target) {
@@ -1675,7 +1682,7 @@ function RouterLink(props, children) {
1675
1682
  const route2 = routeGetter();
1676
1683
  const currentPath = normalizePathname(route2.path);
1677
1684
  const isActive = kind === "internal" && isPathnameAncestor(targetPath, currentPath);
1678
- const isExactActive = kind === "internal" && currentPath === targetPath && normalizeQuery(route2.query) === targetQuery && route2.hash === hrefHash;
1685
+ const isExactActive = kind === "internal" && currentPath === targetPath && queryIdentity(route2.query) === targetQuery && route2.hash === hrefHash;
1679
1686
  const classes = [];
1680
1687
  if (isActive) {
1681
1688
  if (activeClass) classes.push(activeClass);
@@ -1692,15 +1699,7 @@ function RouterLink(props, children) {
1692
1699
  const lkey = key.toLowerCase();
1693
1700
  if (lkey === "href" || lkey[0] === "o" && lkey[1] === "n") return;
1694
1701
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
1695
- const str = String(value);
1696
- if (isUrlAttribute(lkey)) {
1697
- const safe = sanitizeUrl(str);
1698
- if (safe) link.setAttribute(key, safe);
1699
- } else if (lkey === "style") {
1700
- link.setAttribute(key, sanitizeStyleAttribute(str, { element: link }));
1701
- } else {
1702
- link.setAttribute(key, str);
1703
- }
1702
+ setSafeAttribute(link, key, String(value), { syncValueProperty: false, label: "RouterLink" });
1704
1703
  }
1705
1704
  });
1706
1705
  if (content !== void 0) appendChildren(link, content);
@@ -2228,8 +2227,7 @@ function serializeRouteState(state, nonce) {
2228
2227
  return `<script${nonceAttr}>window.${SSR_ROUTE_STATE_KEY}=${json}</script>`;
2229
2228
  }
2230
2229
  function deserializeRouteState() {
2231
- if (typeof window === "undefined") return void 0;
2232
- return window[SSR_ROUTE_STATE_KEY];
2230
+ return readOwnGlobal(SSR_ROUTE_STATE_KEY);
2233
2231
  }
2234
2232
  function hydrateRouter(routes, options) {
2235
2233
  const serverState = deserializeRouteState();
@@ -2243,7 +2241,7 @@ function hydrateRouter(routes, options) {
2243
2241
  const liveUrl = `${window.location.pathname}${window.location.search}${window.location.hash}`;
2244
2242
  const resolved = resolveServerRoute(liveUrl, routes);
2245
2243
  const bootstrapEpoch = __getNavigationEpoch();
2246
- import("./ssr-XOTUASDO.js").then(async ({ hydrate }) => {
2244
+ import("./ssr-5OWAH3U2.js").then(async ({ hydrate }) => {
2247
2245
  const { replaceChildrenSafely } = await import("./dispose-GEIG2KOF.js");
2248
2246
  if (__getNavigationEpoch() !== bootstrapEpoch) return;
2249
2247
  if (resolved.component) {
@@ -17,8 +17,10 @@ import {
17
17
  ssrSuspense,
18
18
  suspenseSwapScript,
19
19
  trustHTML
20
- } from "./chunk-HURREPU2.js";
21
- import "./chunk-2INLLLMZ.js";
20
+ } from "./chunk-FC6KCJSA.js";
21
+ import "./chunk-62BDYGAG.js";
22
+ import "./chunk-3ACAAQIN.js";
23
+ import "./chunk-EXXSN3BW.js";
22
24
  import "./chunk-7XHATCIH.js";
23
25
  import "./chunk-NYNYSPK7.js";
24
26
  export {
@@ -103,6 +103,12 @@ declare function renderToDocument(component: () => HTMLElement, options?: {
103
103
  title?: string;
104
104
  meta?: Record<string, string>[];
105
105
  links?: Record<string, string>[];
106
+ /**
107
+ * External script URLs appended to `<body>`. Each passes the scheme
108
+ * allowlist; an allowed URL is still code that runs with the page's
109
+ * authority, so this option is an explicit trust decision — first-party
110
+ * or pinned URLs only, never request-derived values.
111
+ */
106
112
  scripts?: string[];
107
113
  bodyAttrs?: Record<string, string>;
108
114
  /**
@@ -103,6 +103,12 @@ declare function renderToDocument(component: () => HTMLElement, options?: {
103
103
  title?: string;
104
104
  meta?: Record<string, string>[];
105
105
  links?: Record<string, string>[];
106
+ /**
107
+ * External script URLs appended to `<body>`. Each passes the scheme
108
+ * allowlist; an allowed URL is still code that runs with the page's
109
+ * authority, so this option is an explicit trust decision — first-party
110
+ * or pinned URLs only, never request-derived values.
111
+ */
106
112
  scripts?: string[];
107
113
  bodyAttrs?: Record<string, string>;
108
114
  /**