sibujs 4.14.0 → 4.15.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 (93) hide show
  1. package/dist/browser.cjs +297 -45
  2. package/dist/browser.js +6 -7
  3. package/dist/build.cjs +2189 -573
  4. package/dist/build.js +16 -15
  5. package/dist/cdn.dev.global.js +13 -12
  6. package/dist/cdn.full.dev.global.js +14 -13
  7. package/dist/cdn.full.global.js +12 -12
  8. package/dist/cdn.global.js +12 -12
  9. package/dist/{chunk-RVR5NPFL.js → chunk-2VKTFA7C.js} +1 -1
  10. package/dist/{chunk-7ILEHTVX.js → chunk-4AEFGRYW.js} +1 -1
  11. package/dist/{chunk-4TQDTWWN.js → chunk-6IV5ZRG6.js} +5 -7
  12. package/dist/{chunk-GVAMIU6K.js → chunk-75EAQH3U.js} +2 -2
  13. package/dist/{chunk-TLS4NVIB.js → chunk-7JO7DPSS.js} +4 -4
  14. package/dist/{chunk-SVULV7O4.js → chunk-AQH7WDSE.js} +6 -8
  15. package/dist/{chunk-S37PZD6I.js → chunk-BF3WBJJQ.js} +60 -10
  16. package/dist/{chunk-LJMX4SQ7.js → chunk-BG4BP44S.js} +3 -3
  17. package/dist/{chunk-N7A6FKWW.js → chunk-D44TAGCT.js} +2 -2
  18. package/dist/{chunk-CCKUNHVU.js → chunk-DAEXQJQA.js} +1 -1
  19. package/dist/chunk-DNCQDFJJ.js +22 -0
  20. package/dist/{chunk-BKZ5N6NK.js → chunk-DNCT2UXB.js} +4 -4
  21. package/dist/{chunk-BOYKGGVD.js → chunk-DRWOD7RZ.js} +4 -4
  22. package/dist/chunk-DS5V2PRE.js +64 -0
  23. package/dist/{chunk-VM2U5LEL.js → chunk-EHSJESRN.js} +595 -123
  24. package/dist/{chunk-MIRKTVH4.js → chunk-GFM5WWPU.js} +252 -5
  25. package/dist/{chunk-52XFPGSN.js → chunk-HTPOIAAL.js} +1 -1
  26. package/dist/{chunk-3HEX6QJQ.js → chunk-I2R5QALY.js} +2 -4
  27. package/dist/{chunk-4FJSAUKB.js → chunk-IUBV5WO5.js} +1 -1
  28. package/dist/{chunk-A454RAEK.js → chunk-KIDETDMU.js} +5 -7
  29. package/dist/{chunk-JTFQ7IL4.js → chunk-KPAXG5IR.js} +7 -9
  30. package/dist/{chunk-AE32RGWX.js → chunk-LGUXYHTZ.js} +3 -3
  31. package/dist/{chunk-Y4LUM2XS.js → chunk-LQWLPQOK.js} +6 -8
  32. package/dist/{chunk-CNPT6NKV.js → chunk-MINLMJUY.js} +48 -9
  33. package/dist/{chunk-BNXRWZZV.js → chunk-OURTGOJT.js} +8 -10
  34. package/dist/{chunk-F67F77IA.js → chunk-TQ24Y3IV.js} +2 -2
  35. package/dist/{chunk-2TTRW2TE.js → chunk-UM3M5PXS.js} +8 -8
  36. package/dist/{chunk-CJ7KS3DF.js → chunk-VSTX3XSX.js} +205 -15
  37. package/dist/{chunk-HQIAL7F2.js → chunk-XPDZ2LDR.js} +2 -2
  38. package/dist/{chunk-UUIKJJIK.js → chunk-Y7JM7GY2.js} +5 -7
  39. package/dist/{chunk-QS6GMWDD.js → chunk-YAFITBOK.js} +1269 -162
  40. package/dist/data.cjs +285 -33
  41. package/dist/data.js +6 -7
  42. package/dist/devtools.cjs +289 -39
  43. package/dist/devtools.js +5 -6
  44. package/dist/{dispose-EIHHHDC7.js → dispose-3WDBYJMH.js} +3 -1
  45. package/dist/ecosystem.cjs +345 -61
  46. package/dist/ecosystem.d.cts +1 -1
  47. package/dist/ecosystem.d.ts +1 -1
  48. package/dist/ecosystem.js +10 -10
  49. package/dist/extras.cjs +568 -248
  50. package/dist/extras.d.cts +1 -1
  51. package/dist/extras.d.ts +1 -1
  52. package/dist/extras.js +27 -27
  53. package/dist/index.cjs +2134 -515
  54. package/dist/index.d.cts +628 -211
  55. package/dist/index.d.ts +628 -211
  56. package/dist/index.js +22 -15
  57. package/dist/motion.cjs +286 -30
  58. package/dist/motion.js +4 -4
  59. package/dist/patterns.cjs +301 -43
  60. package/dist/patterns.js +6 -6
  61. package/dist/performance.cjs +286 -36
  62. package/dist/performance.js +9 -9
  63. package/dist/plugins.cjs +1237 -291
  64. package/dist/plugins.d.cts +3 -1
  65. package/dist/plugins.d.ts +3 -1
  66. package/dist/plugins.js +20 -19
  67. package/dist/{renderRoute-fxgsm2Ir.d.ts → renderRoute-B84MONaO.d.cts} +2 -2
  68. package/dist/{renderRoute-DP20XwMS.d.cts → renderRoute-_yxPuEQY.d.ts} +2 -2
  69. package/dist/{routeHead-CE9SV-cH.d.cts → routeHead-DLxlq15W.d.cts} +94 -0
  70. package/dist/{routeHead-DzVxPviY.d.ts → routeHead-w8nANZ3M.d.ts} +94 -0
  71. package/dist/{ssr-NECEU4X4.js → ssr-EF3IUHTE.js} +6 -6
  72. package/dist/ssr-dom.cjs +64 -9
  73. package/dist/ssr-dom.d.cts +2 -0
  74. package/dist/ssr-dom.d.ts +2 -0
  75. package/dist/ssr-dom.js +2 -1
  76. package/dist/ssr.cjs +850 -170
  77. package/dist/ssr.d.cts +5 -3
  78. package/dist/ssr.d.ts +5 -3
  79. package/dist/ssr.js +16 -15
  80. package/dist/{tagFactory-DkytnJws.d.cts → tagFactory-BfEh69VF.d.cts} +7 -0
  81. package/dist/{tagFactory-Bnd_Nph9.d.ts → tagFactory-pSYiLYyh.d.ts} +7 -0
  82. package/dist/testing.cjs +817 -132
  83. package/dist/testing.d.cts +4 -2
  84. package/dist/testing.d.ts +4 -2
  85. package/dist/testing.js +18 -17
  86. package/dist/track-core-0edROAF5.d.ts +187 -0
  87. package/dist/track-core-DN5fYLWi.d.cts +187 -0
  88. package/dist/ui.cjs +293 -43
  89. package/dist/ui.js +10 -12
  90. package/dist/widgets.cjs +285 -27
  91. package/dist/widgets.js +7 -7
  92. package/package.json +1 -1
  93. package/dist/chunk-7ZHH77QA.js +0 -9
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  createPlugin
3
- } from "./chunk-3HEX6QJQ.js";
3
+ } from "./chunk-I2R5QALY.js";
4
4
  import {
5
5
  tagFactory
6
- } from "./chunk-CJ7KS3DF.js";
6
+ } from "./chunk-VSTX3XSX.js";
7
7
  import {
8
8
  derived
9
- } from "./chunk-N7A6FKWW.js";
10
- import {
11
- globalSingleton
12
- } from "./chunk-7ZHH77QA.js";
9
+ } from "./chunk-D44TAGCT.js";
13
10
  import {
14
11
  effect
15
- } from "./chunk-AE32RGWX.js";
12
+ } from "./chunk-LGUXYHTZ.js";
16
13
  import {
17
14
  sanitizeCSSDeclaration
18
15
  } from "./chunk-B3HOT4TK.js";
19
16
  import {
20
17
  batch,
21
18
  signal
22
- } from "./chunk-4FJSAUKB.js";
19
+ } from "./chunk-IUBV5WO5.js";
20
+ import {
21
+ globalSingleton
22
+ } from "./chunk-BF3WBJJQ.js";
23
23
 
24
24
  // src/ecosystem/adapters/mobx.ts
25
25
  function mobXAdapter(options) {
@@ -1,8 +1,11 @@
1
+ import {
2
+ styleKeyToProperty
3
+ } from "./chunk-DNCQDFJJ.js";
1
4
  import {
2
5
  bindAttribute,
3
6
  noDocument,
4
7
  setSafeAttribute
5
- } from "./chunk-HQIAL7F2.js";
8
+ } from "./chunk-XPDZ2LDR.js";
6
9
  import {
7
10
  isBlockedElement
8
11
  } from "./chunk-RVWJGWCL.js";
@@ -11,14 +14,18 @@ import {
11
14
  sanitizeCSSDeclaration,
12
15
  sanitizeStyleAttribute
13
16
  } from "./chunk-B3HOT4TK.js";
17
+ import {
18
+ isServer
19
+ } from "./chunk-UYTYNCMZ.js";
14
20
  import {
15
21
  reactiveBinding
16
- } from "./chunk-MIRKTVH4.js";
22
+ } from "./chunk-GFM5WWPU.js";
17
23
  import {
18
24
  dispose,
25
+ globalSingleton,
19
26
  registerDisposer,
20
27
  reportError
21
- } from "./chunk-S37PZD6I.js";
28
+ } from "./chunk-BF3WBJJQ.js";
22
29
  import {
23
30
  DEV,
24
31
  captureScope,
@@ -103,7 +110,7 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
103
110
  const active = document.activeElement;
104
111
  if (active === snapshot.el) return;
105
112
  if (active && active !== document.body && active !== document.documentElement) return;
106
- if (snapshot.el.isConnected) {
113
+ if (snapshot.el.isConnected && !snapshot.el.closest("[inert]")) {
107
114
  refocus(snapshot.el, snapshot);
108
115
  return;
109
116
  }
@@ -130,8 +137,179 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
130
137
  });
131
138
  }
132
139
 
140
+ // src/core/rendering/range.ts
141
+ var state = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.ranges.v1"), () => ({
142
+ ends: /* @__PURE__ */ new WeakMap(),
143
+ pending: /* @__PURE__ */ new WeakMap(),
144
+ registrations: /* @__PURE__ */ new Set(),
145
+ listeners: /* @__PURE__ */ new Set(),
146
+ notice: { queued: false, batch: [] }
147
+ }));
148
+ var ends = state.ends;
149
+ function registerRange(start, last) {
150
+ ends.set(start, last);
151
+ }
152
+ var pending = state.pending;
153
+ var NOTHING = () => {
154
+ };
155
+ function queueFirstRender(anchor, render, held) {
156
+ if (held) {
157
+ const unguarded = render;
158
+ render = () => {
159
+ held.wait(unguarded, NOTHING);
160
+ };
161
+ }
162
+ pending.set(anchor, true);
163
+ queueMicrotask(() => {
164
+ if (pending.get(anchor) !== true) return;
165
+ if (anchor.parentNode === null) {
166
+ pending.set(anchor, render);
167
+ return;
168
+ }
169
+ pending.delete(anchor);
170
+ render();
171
+ });
172
+ }
173
+ function resumePending(nodes) {
174
+ for (const node of nodes) {
175
+ const render = pending.get(node);
176
+ if (typeof render !== "function") continue;
177
+ pending.delete(node);
178
+ render();
179
+ }
180
+ }
181
+ function anyPending(nodes) {
182
+ for (const node of nodes) if (pending.has(node)) return true;
183
+ return false;
184
+ }
185
+ var registrations = state.registrations;
186
+ var loadListeners = state.listeners;
187
+ var notice = state.notice;
188
+ function notifyLoad(settled) {
189
+ if (loadListeners.size === 0) return;
190
+ if (settled !== null) notice.batch.push(settled);
191
+ if (notice.queued) return;
192
+ notice.queued = true;
193
+ queueMicrotask(() => {
194
+ notice.queued = false;
195
+ const batch = notice.batch;
196
+ notice.batch = [];
197
+ for (const listener of [...loadListeners]) listener(batch);
198
+ });
199
+ }
200
+ function beginPending(at, held) {
201
+ const entry = { at, held, settled: false, cancelled: false, committed: null };
202
+ registrations.add(entry);
203
+ notifyLoad(null);
204
+ const settle = (cancelled, committed) => {
205
+ if (entry.settled) return;
206
+ entry.settled = true;
207
+ entry.cancelled = cancelled;
208
+ entry.committed = committed;
209
+ registrations.delete(entry);
210
+ notifyLoad(entry);
211
+ };
212
+ return {
213
+ entry,
214
+ done: (committed) => settle(false, committed ?? null),
215
+ cancel: () => settle(true, null)
216
+ };
217
+ }
218
+ var INERT = { done: NOTHING, cancel: NOTHING };
219
+ function beginLoading(anchor) {
220
+ if (isServer()) return INERT;
221
+ const { done, cancel } = beginPending(anchor, null);
222
+ return { done: () => done(), cancel };
223
+ }
224
+ function pendingWithin(entry, nodes, owner) {
225
+ const at = entry.at;
226
+ if (at !== null) {
227
+ for (let i = 0; i < nodes.length; i++) if (nodes[i] === at || nodes[i].contains(at)) return true;
228
+ return false;
229
+ }
230
+ return owner !== null && entry.held?.within(owner) === true;
231
+ }
232
+ function loadingWithin(nodes, owner) {
233
+ const found = [];
234
+ if (registrations.size === 0) return found;
235
+ for (const entry of registrations) if (pendingWithin(entry, nodes, owner)) found.push(entry);
236
+ return found;
237
+ }
238
+ function settledContent(entry) {
239
+ if (!entry.settled || entry.cancelled) return [];
240
+ let nodes;
241
+ if (entry.committed !== null) nodes = entry.committed;
242
+ else if (entry.at === null) return [];
243
+ else if (entry.at.nodeType === 1) nodes = Array.from(entry.at.childNodes);
244
+ else nodes = collectRange([entry.at]);
245
+ const out = [];
246
+ for (let i = 0; i < nodes.length; i++) if (nodes[i].nodeType === 1) out.push(nodes[i]);
247
+ return out;
248
+ }
249
+ function onLoaded(listener) {
250
+ loadListeners.add(listener);
251
+ return () => {
252
+ loadListeners.delete(listener);
253
+ };
254
+ }
255
+ function settledSinceNotify() {
256
+ return notice.batch;
257
+ }
258
+ function hasRange(node) {
259
+ return ends.has(node);
260
+ }
261
+ function registerNodesRange(anchor, nodes) {
262
+ registerRange(anchor, () => {
263
+ const parent = anchor.parentNode;
264
+ const wanted = nodes().filter((n) => n !== null && n.parentNode === parent);
265
+ let last = null;
266
+ let left = wanted.length;
267
+ for (let n = anchor.nextSibling; n !== null && left > 0; n = n.nextSibling) {
268
+ if (wanted.includes(n)) {
269
+ last = n;
270
+ left--;
271
+ }
272
+ }
273
+ return last;
274
+ });
275
+ }
276
+ function rangeEnd(node) {
277
+ let cur = node;
278
+ for (let get = ends.get(cur); get !== void 0; get = ends.get(cur)) {
279
+ const next = get();
280
+ if (next === null || next === cur || next.parentNode !== node.parentNode) break;
281
+ cur = next;
282
+ }
283
+ return cur;
284
+ }
285
+ function collectRange(starts) {
286
+ const out = [];
287
+ const seen = /* @__PURE__ */ new Set();
288
+ for (const start of starts) {
289
+ if (start.parentNode === null) continue;
290
+ const end = rangeEnd(start);
291
+ let node = start;
292
+ let span = [start];
293
+ while (node !== end) {
294
+ node = node.nextSibling;
295
+ if (node === null) {
296
+ span = [start];
297
+ break;
298
+ }
299
+ span.push(node);
300
+ }
301
+ for (const n of span) {
302
+ if (!seen.has(n)) {
303
+ seen.add(n);
304
+ out.push(n);
305
+ }
306
+ }
307
+ }
308
+ return out;
309
+ }
310
+
133
311
  // src/reactivity/bindChildNode.ts
134
- function bindChildNode(placeholder, getter) {
312
+ function bindChildNode(placeholder, getter, exposeNodes) {
135
313
  let lastNodes = [];
136
314
  const scope = captureScope();
137
315
  function commit() {
@@ -202,6 +380,12 @@ function bindChildNode(placeholder, getter) {
202
380
  lastNodes = newNodes;
203
381
  restoreFocusWithin(focused, newNodes, "bindChildNode");
204
382
  }
383
+ if (exposeNodes) {
384
+ registerRange(placeholder, () => {
385
+ for (let i = lastNodes.length - 1; i >= 0; i--) if (lastNodes[i].parentNode !== null) return lastNodes[i];
386
+ return null;
387
+ });
388
+ }
205
389
  return reactiveBinding(commit, placeholder, true);
206
390
  }
207
391
 
@@ -223,14 +407,6 @@ var CLOBBER_RISKY_IDS = /* @__PURE__ */ new Set([
223
407
  var warnedLoneStrings = /* @__PURE__ */ new Set();
224
408
  var MAX_WARNED_LONE_STRINGS = 100;
225
409
  var loneStringCapAnnounced = false;
226
- var kebabCache = /* @__PURE__ */ new Map();
227
- function toKebab(prop) {
228
- let cached = kebabCache.get(prop);
229
- if (cached !== void 0) return cached;
230
- cached = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
231
- kebabCache.set(prop, cached);
232
- return cached;
233
- }
234
410
  function applyStyle(el, style) {
235
411
  if (typeof style === "function") {
236
412
  const getter = style;
@@ -254,7 +430,7 @@ function applyStyle(el, style) {
254
430
  if (!Object.hasOwn(value, prop)) continue;
255
431
  const val = value[prop];
256
432
  if (val == null) continue;
257
- const name = toKebab(prop);
433
+ const name = styleKeyToProperty(prop);
258
434
  next.push(name);
259
435
  decl.setProperty(name, sanitizeCSSDeclaration(name, String(val), { element: el }));
260
436
  }
@@ -274,7 +450,7 @@ function applyStyle(el, style) {
274
450
  for (const prop in style) {
275
451
  if (!Object.hasOwn(style, prop)) continue;
276
452
  const val = style[prop];
277
- const name = toKebab(prop);
453
+ const name = styleKeyToProperty(prop);
278
454
  if (typeof val === "function") {
279
455
  const getter = val;
280
456
  const teardown = reactiveBinding(() => {
@@ -504,6 +680,20 @@ function tagFactory(tag, ns) {
504
680
  export {
505
681
  captureFocusWithin,
506
682
  restoreFocusWithin,
683
+ registerRange,
684
+ queueFirstRender,
685
+ resumePending,
686
+ anyPending,
687
+ beginPending,
688
+ beginLoading,
689
+ pendingWithin,
690
+ loadingWithin,
691
+ settledContent,
692
+ onLoaded,
693
+ settledSinceNotify,
694
+ hasRange,
695
+ registerNodesRange,
696
+ collectRange,
507
697
  bindChildNode,
508
698
  SVG_NS,
509
699
  resolveClassValue,
@@ -10,10 +10,10 @@ import {
10
10
  } from "./chunk-B3HOT4TK.js";
11
11
  import {
12
12
  reactiveBinding
13
- } from "./chunk-MIRKTVH4.js";
13
+ } from "./chunk-GFM5WWPU.js";
14
14
  import {
15
15
  reportError
16
- } from "./chunk-S37PZD6I.js";
16
+ } from "./chunk-BF3WBJJQ.js";
17
17
  import {
18
18
  DEV,
19
19
  devWarn,
@@ -1,27 +1,25 @@
1
1
  import {
2
2
  isBlockedElement
3
3
  } from "./chunk-RVWJGWCL.js";
4
- import {
5
- globalSingleton
6
- } from "./chunk-7ZHH77QA.js";
7
4
  import {
8
5
  effect
9
- } from "./chunk-AE32RGWX.js";
6
+ } from "./chunk-LGUXYHTZ.js";
10
7
  import {
11
8
  sanitizeUrl
12
9
  } from "./chunk-B3HOT4TK.js";
13
10
  import {
14
11
  signal
15
- } from "./chunk-4FJSAUKB.js";
12
+ } from "./chunk-IUBV5WO5.js";
16
13
  import {
17
14
  bindOwnerScope
18
- } from "./chunk-MIRKTVH4.js";
15
+ } from "./chunk-GFM5WWPU.js";
19
16
  import {
20
17
  dispose,
18
+ globalSingleton,
21
19
  registerDisposer,
22
20
  replaceChildrenSafely,
23
21
  reportError
24
- } from "./chunk-S37PZD6I.js";
22
+ } from "./chunk-BF3WBJJQ.js";
25
23
  import {
26
24
  DEV,
27
25
  devWarn