sibujs 4.13.0 → 4.14.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 (107) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +15 -2
  3. package/dist/browser.js +9 -7
  4. package/dist/build.cjs +880 -281
  5. package/dist/build.d.cts +68 -3
  6. package/dist/build.d.ts +68 -3
  7. package/dist/build.js +88 -30
  8. package/dist/cdn.dev.global.js +12 -12
  9. package/dist/cdn.full.dev.global.js +13 -13
  10. package/dist/cdn.full.global.js +12 -12
  11. package/dist/cdn.global.js +12 -12
  12. package/dist/{chunk-7K7W4AA5.js → chunk-2TTRW2TE.js} +6 -6
  13. package/dist/{chunk-J6FW5TV6.js → chunk-3HEX6QJQ.js} +5 -3
  14. package/dist/chunk-3HZOSMPX.js +90 -0
  15. package/dist/{chunk-GNSRXK34.js → chunk-4FJSAUKB.js} +11 -3
  16. package/dist/{chunk-IV74C2YX.js → chunk-4TQDTWWN.js} +6 -5
  17. package/dist/{chunk-L3QHS4O4.js → chunk-7ILEHTVX.js} +1 -1
  18. package/dist/{chunk-CK5F2IR5.js → chunk-A454RAEK.js} +4 -4
  19. package/dist/{chunk-BRRRVLHQ.js → chunk-AE32RGWX.js} +10 -6
  20. package/dist/{chunk-EXXSN3BW.js → chunk-B3HOT4TK.js} +1 -1
  21. package/dist/{chunk-F4W7WYXY.js → chunk-BKZ5N6NK.js} +8 -6
  22. package/dist/{chunk-MNEITZ27.js → chunk-BNXRWZZV.js} +49 -8
  23. package/dist/chunk-BOYKGGVD.js +2015 -0
  24. package/dist/{chunk-G6366I2A.js → chunk-CCKUNHVU.js} +2 -2
  25. package/dist/{chunk-346BYZL2.js → chunk-CJ7KS3DF.js} +16 -10
  26. package/dist/chunk-CNPT6NKV.js +1859 -0
  27. package/dist/{chunk-ENFRHCMK.js → chunk-F67F77IA.js} +2 -2
  28. package/dist/{chunk-TUCPL2HB.js → chunk-GIJ33UJZ.js} +1 -1
  29. package/dist/chunk-GVAMIU6K.js +195 -0
  30. package/dist/{chunk-HDKDBC6V.js → chunk-HQIAL7F2.js} +8 -6
  31. package/dist/{chunk-ZE5LF44R.js → chunk-JTFQ7IL4.js} +8 -8
  32. package/dist/{chunk-AM6DZLBM.js → chunk-LJMX4SQ7.js} +2 -2
  33. package/dist/{chunk-HVVRXRGO.js → chunk-MIRKTVH4.js} +7 -14
  34. package/dist/{chunk-YJ57VR6Y.js → chunk-N7A6FKWW.js} +5 -3
  35. package/dist/chunk-NT3ZYB5S.js +167 -0
  36. package/dist/{chunk-Z3EZX6DZ.js → chunk-QS6GMWDD.js} +151 -86
  37. package/dist/chunk-R5U7XKVJ.js +16 -0
  38. package/dist/{chunk-3C56VNCK.js → chunk-RVR5NPFL.js} +3 -3
  39. package/dist/{chunk-F2UWOZ6J.js → chunk-RVWJGWCL.js} +2 -2
  40. package/dist/{chunk-NYNYSPK7.js → chunk-S37PZD6I.js} +30 -45
  41. package/dist/{chunk-QV5WEOFD.js → chunk-SVULV7O4.js} +119 -26
  42. package/dist/{chunk-C2FAO6VQ.js → chunk-TLS4NVIB.js} +5 -5
  43. package/dist/{chunk-M25RIH6Y.js → chunk-UUIKJJIK.js} +10 -8
  44. package/dist/chunk-UYTYNCMZ.js +199 -0
  45. package/dist/chunk-VM2U5LEL.js +2596 -0
  46. package/dist/{chunk-24L5RDPS.js → chunk-Y4LUM2XS.js} +8 -6
  47. package/dist/data.cjs +265 -35
  48. package/dist/data.d.cts +31 -1
  49. package/dist/data.d.ts +31 -1
  50. package/dist/data.js +16 -10
  51. package/dist/devtools.cjs +15 -2
  52. package/dist/devtools.js +9 -7
  53. package/dist/{dispose-GEIG2KOF.js → dispose-EIHHHDC7.js} +3 -1
  54. package/dist/ecosystem.cjs +62 -23
  55. package/dist/ecosystem.js +14 -12
  56. package/dist/extras.cjs +3520 -270
  57. package/dist/extras.d.cts +3 -3
  58. package/dist/extras.d.ts +3 -3
  59. package/dist/extras.js +39 -29
  60. package/dist/index.cjs +442 -253
  61. package/dist/index.d.cts +93 -283
  62. package/dist/index.d.ts +93 -283
  63. package/dist/index.js +26 -16
  64. package/dist/motion.cjs +12 -1
  65. package/dist/motion.js +6 -4
  66. package/dist/patterns.cjs +15 -2
  67. package/dist/patterns.js +10 -8
  68. package/dist/performance.cjs +36 -2
  69. package/dist/performance.d.cts +2 -2
  70. package/dist/performance.d.ts +2 -2
  71. package/dist/performance.js +14 -10
  72. package/dist/plugins.cjs +5225 -1807
  73. package/dist/plugins.d.cts +8 -834
  74. package/dist/plugins.d.ts +8 -834
  75. package/dist/plugins.js +64 -2329
  76. package/dist/prerenderServer-MXJEVWA3.js +350 -0
  77. package/dist/renderRoute-DP20XwMS.d.cts +86 -0
  78. package/dist/renderRoute-fxgsm2Ir.d.ts +86 -0
  79. package/dist/routeHead-CE9SV-cH.d.cts +995 -0
  80. package/dist/routeHead-DzVxPviY.d.ts +995 -0
  81. package/dist/{routeMiddleware-B1sp4P7a.d.ts → routeMiddleware-BySbueoE.d.ts} +0 -25
  82. package/dist/{routeMiddleware-CedQTsLK.d.cts → routeMiddleware-CijZD5eW.d.cts} +0 -25
  83. package/dist/ssr-JpGpHnpC.d.cts +841 -0
  84. package/dist/ssr-JpGpHnpC.d.ts +841 -0
  85. package/dist/{ssr-VBM6J5SJ.js → ssr-NECEU4X4.js} +15 -6
  86. package/dist/ssr-dom.cjs +1862 -0
  87. package/dist/ssr-dom.d.cts +341 -0
  88. package/dist/ssr-dom.d.ts +341 -0
  89. package/dist/ssr-dom.js +19 -0
  90. package/dist/ssr.cjs +7630 -2064
  91. package/dist/ssr.d.cts +63 -5
  92. package/dist/ssr.d.ts +63 -5
  93. package/dist/ssr.js +136 -14
  94. package/dist/testing.cjs +6543 -87
  95. package/dist/testing.d.cts +80 -1
  96. package/dist/testing.d.ts +80 -1
  97. package/dist/testing.js +117 -4
  98. package/dist/ui.cjs +36 -2
  99. package/dist/ui.js +17 -14
  100. package/dist/widgets.cjs +14 -1
  101. package/dist/widgets.js +11 -9
  102. package/package.json +9 -2
  103. package/dist/chunk-2F4PSJ5Z.js +0 -765
  104. package/dist/chunk-7XHATCIH.js +0 -121
  105. package/dist/chunk-B36ADEIR.js +0 -21
  106. package/dist/ssr-Db0Sgdu3.d.cts +0 -245
  107. package/dist/ssr-Db0Sgdu3.d.ts +0 -245
@@ -0,0 +1,90 @@
1
+ import {
2
+ isUnsafeKey,
3
+ readOwnGlobal
4
+ } from "./chunk-62BDYGAG.js";
5
+ import {
6
+ getRequestStore
7
+ } from "./chunk-UYTYNCMZ.js";
8
+
9
+ // src/utils/transfer.ts
10
+ var TRANSFER_GLOBAL = "__SIBU_TRANSFER__";
11
+ var TRANSFER_VERSION = 1;
12
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.transfer.v1");
13
+ function registry() {
14
+ const g = globalThis;
15
+ let r = g[REGISTRY_KEY];
16
+ if (!r) {
17
+ r = { collectors: /* @__PURE__ */ new Map(), payload: void 0 };
18
+ g[REGISTRY_KEY] = r;
19
+ }
20
+ return r;
21
+ }
22
+ function registerTransferCollector(section, collect) {
23
+ registry().collectors.set(section, collect);
24
+ }
25
+ function collectTransfer() {
26
+ if (!getRequestStore()) return null;
27
+ const out = {};
28
+ let any = false;
29
+ for (const [section, collect] of registry().collectors) {
30
+ const entries = collect();
31
+ if (!entries) continue;
32
+ const safe = {};
33
+ for (const key of Object.keys(entries)) if (!isUnsafeKey(key)) safe[key] = entries[key];
34
+ if (Object.keys(safe).length > 0) {
35
+ out[section] = safe;
36
+ any = true;
37
+ }
38
+ }
39
+ if (!any) return null;
40
+ out.v = TRANSFER_VERSION;
41
+ return out;
42
+ }
43
+ function isPlainRecord(value) {
44
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
45
+ const proto = Object.getPrototypeOf(value);
46
+ return proto === Object.prototype || proto === null;
47
+ }
48
+ function readPayload() {
49
+ const r = registry();
50
+ if (r.payload !== void 0) return r.payload;
51
+ r.payload = null;
52
+ if (typeof window === "undefined" || getRequestStore()) return null;
53
+ const raw = readOwnGlobal(TRANSFER_GLOBAL);
54
+ if (!isPlainRecord(raw) || raw.v !== TRANSFER_VERSION) return null;
55
+ const sections = /* @__PURE__ */ Object.create(null);
56
+ for (const key of Object.keys(raw)) {
57
+ const section = raw[key];
58
+ if (key === "v" || isUnsafeKey(key) || !isPlainRecord(section)) continue;
59
+ const entries = /* @__PURE__ */ Object.create(null);
60
+ for (const k of Object.keys(section)) if (!isUnsafeKey(k)) entries[k] = section[k];
61
+ sections[key] = entries;
62
+ }
63
+ r.payload = sections;
64
+ return sections;
65
+ }
66
+ function takeTransferred(section, key) {
67
+ const entries = readPayload()?.[section];
68
+ if (!entries || !Object.hasOwn(entries, key)) return void 0;
69
+ const value = entries[key];
70
+ delete entries[key];
71
+ return value;
72
+ }
73
+ function takeTransferredSection(section) {
74
+ const payload = readPayload();
75
+ const entries = payload?.[section];
76
+ if (!payload || !entries) return {};
77
+ delete payload[section];
78
+ return entries;
79
+ }
80
+ function __resetTransfer() {
81
+ registry().payload = void 0;
82
+ }
83
+
84
+ export {
85
+ registerTransferCollector,
86
+ collectTransfer,
87
+ takeTransferred,
88
+ takeTransferredSection,
89
+ __resetTransfer
90
+ };
@@ -1,13 +1,12 @@
1
1
  import {
2
2
  drainNotificationQueue,
3
- emitDevtools,
4
3
  notifySubscribers,
5
4
  queueSignalNotification,
6
5
  recordDependency
7
- } from "./chunk-HVVRXRGO.js";
6
+ } from "./chunk-MIRKTVH4.js";
8
7
  import {
9
8
  DEV
10
- } from "./chunk-NYNYSPK7.js";
9
+ } from "./chunk-NT3ZYB5S.js";
11
10
 
12
11
  // src/reactivity/batch.ts
13
12
  var batchDepth = 0;
@@ -59,6 +58,14 @@ var batch = API.batch;
59
58
  var enqueueBatchedSignal = API.enqueueBatchedSignal;
60
59
  var isBatching = API.isBatching;
61
60
 
61
+ // src/core/devtoolsHook.ts
62
+ function emitDevtools(hook, event, payload) {
63
+ try {
64
+ hook.emit(event, payload);
65
+ } catch {
66
+ }
67
+ }
68
+
62
69
  // src/core/signals/signal.ts
63
70
  var _g = globalThis;
64
71
  function signal(initial, options) {
@@ -145,6 +152,7 @@ export {
145
152
  batch,
146
153
  enqueueBatchedSignal,
147
154
  isBatching,
155
+ emitDevtools,
148
156
  signal,
149
157
  external
150
158
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  renderToString
3
- } from "./chunk-2F4PSJ5Z.js";
3
+ } from "./chunk-BOYKGGVD.js";
4
4
  import {
5
5
  globalSingleton
6
6
  } from "./chunk-7ZHH77QA.js";
7
7
  import {
8
8
  sanitizeUrl
9
- } from "./chunk-EXXSN3BW.js";
9
+ } from "./chunk-B3HOT4TK.js";
10
10
  import {
11
11
  reportError
12
- } from "./chunk-NYNYSPK7.js";
12
+ } from "./chunk-S37PZD6I.js";
13
13
 
14
14
  // src/plugins/modular.ts
15
15
  function createModuleRegistry() {
@@ -154,6 +154,7 @@ var MODULE_ENTRY_POINTS = {
154
154
  ui: "./ui.ts",
155
155
  widgets: "./widgets.ts",
156
156
  ssr: "./ssr.ts",
157
+ "ssr/dom": "./ssr-dom.ts",
157
158
  devtools: "./devtools.ts",
158
159
  performance: "./performance.ts",
159
160
  ecosystem: "./ecosystem.ts",
@@ -170,7 +171,7 @@ var CDN_ENTRY_POINTS = {
170
171
  };
171
172
  var packageInfo = {
172
173
  name: "sibujs",
173
- version: true ? "4.13.0" : "dev",
174
+ version: true ? "4.14.0" : "dev",
174
175
  entryPoints: MODULE_ENTRY_POINTS,
175
176
  /**
176
177
  * Generate the package.json `exports` map. Module entries resolve to the
@@ -315,7 +316,7 @@ var env = {
315
316
  };
316
317
 
317
318
  // src/plugins/versioning.ts
318
- var VERSION = true ? "4.13.0" : "dev";
319
+ var VERSION = true ? "4.14.0" : "dev";
319
320
  var NUM = "(?:0|[1-9]\\d*)";
320
321
  var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
321
322
  var BUILD_ID = "[0-9a-zA-Z-]+";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SVG_NS,
3
3
  tagFactory
4
- } from "./chunk-346BYZL2.js";
4
+ } from "./chunk-CJ7KS3DF.js";
5
5
 
6
6
  // src/core/rendering/html.ts
7
7
  var html = tagFactory("html");
@@ -9,17 +9,17 @@ import {
9
9
  } from "./chunk-7ZHH77QA.js";
10
10
  import {
11
11
  effect
12
- } from "./chunk-BRRRVLHQ.js";
12
+ } from "./chunk-AE32RGWX.js";
13
13
  import {
14
14
  sanitizeUrl
15
- } from "./chunk-EXXSN3BW.js";
15
+ } from "./chunk-B3HOT4TK.js";
16
16
  import {
17
17
  batch,
18
18
  signal
19
- } from "./chunk-GNSRXK34.js";
19
+ } from "./chunk-4FJSAUKB.js";
20
20
  import {
21
21
  reportError
22
- } from "./chunk-NYNYSPK7.js";
22
+ } from "./chunk-S37PZD6I.js";
23
23
 
24
24
  // src/browser/media.ts
25
25
  function media(query) {
@@ -1,18 +1,22 @@
1
1
  import {
2
2
  isSSR
3
- } from "./chunk-7XHATCIH.js";
3
+ } from "./chunk-UYTYNCMZ.js";
4
+ import {
5
+ emitDevtools
6
+ } from "./chunk-4FJSAUKB.js";
4
7
  import {
5
8
  cleanup,
6
- emitDevtools,
7
9
  getOwnerScope,
8
10
  retrack,
9
11
  runWithOwnerScope,
10
12
  untracked
11
- } from "./chunk-HVVRXRGO.js";
13
+ } from "./chunk-MIRKTVH4.js";
12
14
  import {
13
- devAssert,
14
15
  reportError
15
- } from "./chunk-NYNYSPK7.js";
16
+ } from "./chunk-S37PZD6I.js";
17
+ import {
18
+ devAssert
19
+ } from "./chunk-NT3ZYB5S.js";
16
20
 
17
21
  // src/core/signals/effect.ts
18
22
  var _g = globalThis;
@@ -94,7 +98,7 @@ function disposeEffect(ctx) {
94
98
  }
95
99
  function effect(effectFn, options) {
96
100
  devAssert(typeof effectFn === "function", "effect: argument must be a function.");
97
- if (isSSR()) return () => {
101
+ if (isSSR() && !options?.server) return () => {
98
102
  };
99
103
  const ctx = {
100
104
  fn: effectFn,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  devWarnLazy
3
- } from "./chunk-NYNYSPK7.js";
3
+ } from "./chunk-NT3ZYB5S.js";
4
4
 
5
5
  // src/utils/sanitize.ts
6
6
  function stripControlChars(value) {
@@ -4,19 +4,21 @@ import {
4
4
  } from "./chunk-62BDYGAG.js";
5
5
  import {
6
6
  derived
7
- } from "./chunk-YJ57VR6Y.js";
7
+ } from "./chunk-N7A6FKWW.js";
8
8
  import {
9
9
  effect
10
- } from "./chunk-BRRRVLHQ.js";
10
+ } from "./chunk-AE32RGWX.js";
11
11
  import {
12
12
  batch,
13
13
  signal
14
- } from "./chunk-GNSRXK34.js";
14
+ } from "./chunk-4FJSAUKB.js";
15
15
  import {
16
- DEV,
17
- devWarn,
18
16
  reportError
19
- } from "./chunk-NYNYSPK7.js";
17
+ } from "./chunk-S37PZD6I.js";
18
+ import {
19
+ DEV,
20
+ devWarn
21
+ } from "./chunk-NT3ZYB5S.js";
20
22
 
21
23
  // src/patterns/machine.ts
22
24
  function ownEntry(table, key) {
@@ -6,33 +6,39 @@ import {
6
6
  import {
7
7
  div,
8
8
  span
9
- } from "./chunk-L3QHS4O4.js";
9
+ } from "./chunk-7ILEHTVX.js";
10
10
  import {
11
11
  STATIC_VALUE_RESOLVER,
12
12
  planHeadElementEntry,
13
- planMetaEntry
14
- } from "./chunk-2F4PSJ5Z.js";
13
+ planMetaEntry,
14
+ recordServerHead,
15
+ serializeHeadEntry,
16
+ serializePlannedHeadEntry
17
+ } from "./chunk-BOYKGGVD.js";
15
18
  import {
16
19
  globalSingleton
17
20
  } from "./chunk-7ZHH77QA.js";
18
21
  import {
19
22
  effect
20
- } from "./chunk-BRRRVLHQ.js";
23
+ } from "./chunk-AE32RGWX.js";
21
24
  import {
22
25
  sanitizeUrl
23
- } from "./chunk-EXXSN3BW.js";
26
+ } from "./chunk-B3HOT4TK.js";
27
+ import {
28
+ getRequestStore
29
+ } from "./chunk-UYTYNCMZ.js";
24
30
  import {
25
31
  batch,
26
32
  signal
27
- } from "./chunk-GNSRXK34.js";
33
+ } from "./chunk-4FJSAUKB.js";
28
34
  import {
29
35
  bindOwnerScope
30
- } from "./chunk-HVVRXRGO.js";
36
+ } from "./chunk-MIRKTVH4.js";
31
37
  import {
32
38
  registerDisposer,
33
39
  replaceChildrenSafely,
34
40
  reportError
35
- } from "./chunk-NYNYSPK7.js";
41
+ } from "./chunk-S37PZD6I.js";
36
42
 
37
43
  // src/platform/head.ts
38
44
  function escapeScriptJsonLocal(json) {
@@ -86,8 +92,43 @@ function applyMetaEntry(metaProps, managedElements) {
86
92
  retract();
87
93
  };
88
94
  }
95
+ function headEntryKey(tag, attrs) {
96
+ const lower = (v) => (v ?? "").toLowerCase();
97
+ if (tag === "meta") {
98
+ if (attrs.name) return `meta:name:${lower(attrs.name)}`;
99
+ if (attrs.property) return `meta:property:${lower(attrs.property)}`;
100
+ if (attrs["http-equiv"]) return `meta:http-equiv:${lower(attrs["http-equiv"])}`;
101
+ return `meta:${JSON.stringify(attrs)}`;
102
+ }
103
+ const rel = lower(attrs.rel);
104
+ if (rel === "canonical") return "link:rel:canonical";
105
+ if (rel === "alternate" && attrs.hreflang) return `link:hreflang:${lower(attrs.hreflang)}`;
106
+ return `link:${rel}:${attrs.href ?? ""}`;
107
+ }
108
+ function resolveHeadForServer(props) {
109
+ const layer = { tags: [] };
110
+ if (props.title != null) layer.title = CLIENT_RESOLVER.resolveValue("title", props.title);
111
+ for (const entry of props.meta ?? []) {
112
+ const plan = planMetaEntry(entry, CLIENT_RESOLVER);
113
+ if (plan.kind === "drop") continue;
114
+ const attrs = Object.fromEntries(plan.attributes);
115
+ layer.tags.push({ key: headEntryKey("meta", attrs), html: serializePlannedHeadEntry("meta", plan.attributes) });
116
+ }
117
+ for (const attrs of props.link ?? []) {
118
+ const html = serializeHeadEntry("link", attrs);
119
+ if (html) layer.tags.push({ key: headEntryKey("link", attrs), html });
120
+ }
121
+ return layer;
122
+ }
123
+ function recordHeadForServer(props, anchor) {
124
+ const withdraw = recordServerHead(() => resolveHeadForServer(props));
125
+ if (!withdraw) return false;
126
+ registerDisposer(anchor, withdraw);
127
+ return true;
128
+ }
89
129
  function Head(props) {
90
130
  const anchor = document.createComment("sibu-head");
131
+ if (getRequestStore()?.ssr && recordHeadForServer(props, anchor)) return anchor;
91
132
  const managedElements = [];
92
133
  const effectCleanups = [];
93
134
  const cleanup = () => {