sibujs 3.3.0 → 3.3.2
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.
- package/dist/browser.cjs +230 -40
- package/dist/browser.js +5 -5
- package/dist/build.cjs +240 -108
- package/dist/build.js +13 -13
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-BEIKESVL.js → chunk-2ARSB7NG.js} +36 -13
- package/dist/{chunk-X3NHE2DK.js → chunk-4NJEAPLI.js} +83 -17
- package/dist/{chunk-JBXNCZSC.js → chunk-5VH3GIDX.js} +1 -1
- package/dist/{chunk-6G6UNHZI.js → chunk-62V653X2.js} +16 -21
- package/dist/{chunk-S4FHR5ZZ.js → chunk-655B7MMR.js} +3 -3
- package/dist/{chunk-24DBWDTK.js → chunk-6TCOWMGY.js} +1 -1
- package/dist/{chunk-USDR2GFV.js → chunk-A7CZH3GN.js} +3 -3
- package/dist/{chunk-SLCUP2EK.js → chunk-AEOLHSSQ.js} +3 -3
- package/dist/chunk-CCSJMTRN.js +15 -0
- package/dist/{chunk-R3QEDXFS.js → chunk-EX77FXTT.js} +1 -1
- package/dist/{chunk-ZUVLC7TM.js → chunk-FJIRS3FM.js} +1 -1
- package/dist/{chunk-4WXWJ4SW.js → chunk-FJO2ZL4Q.js} +4 -4
- package/dist/{chunk-CVMMULHO.js → chunk-G6N3LMO2.js} +4 -4
- package/dist/{chunk-XQ7XSGYP.js → chunk-IQJ36UTJ.js} +1 -1
- package/dist/{chunk-5K72I3UQ.js → chunk-JCQG2I2G.js} +21 -4
- package/dist/{chunk-7JHWAGRQ.js → chunk-N5TQVEKE.js} +2 -2
- package/dist/{chunk-IHBVTURX.js → chunk-P7C7SEJV.js} +4 -4
- package/dist/{chunk-M6WSIGYW.js → chunk-Q46YIQYW.js} +2 -2
- package/dist/{chunk-Q2ERM6NT.js → chunk-QCFBIVIQ.js} +1 -1
- package/dist/{chunk-F4UM7QBJ.js → chunk-RLTFJYDN.js} +2 -2
- package/dist/{chunk-GOJMFRBL.js → chunk-S3NFJO6L.js} +20 -14
- package/dist/{chunk-MWZFOIBG.js → chunk-YUBEOWII.js} +5 -5
- package/dist/{chunk-WVJJUFPC.js → chunk-YUR5SX7F.js} +2 -2
- package/dist/{chunk-NUWKIEHE.js → chunk-ZEUP4TUD.js} +2 -2
- package/dist/data.cjs +181 -37
- package/dist/data.js +7 -7
- package/dist/devtools.cjs +265 -45
- package/dist/devtools.js +5 -5
- package/dist/ecosystem.cjs +203 -59
- package/dist/ecosystem.js +8 -8
- package/dist/extras.cjs +216 -116
- package/dist/extras.js +22 -22
- package/dist/index.cjs +242 -108
- package/dist/index.d.cts +78 -14
- package/dist/index.d.ts +78 -14
- package/dist/index.js +17 -13
- package/dist/motion.cjs +329 -13
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +181 -37
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +278 -37
- package/dist/performance.js +6 -6
- package/dist/plugins.cjs +353 -153
- package/dist/plugins.js +95 -94
- package/dist/{ssr-6D67RAVB.js → ssr-2PPULEK2.js} +2 -2
- package/dist/ssr.cjs +203 -58
- package/dist/ssr.js +9 -9
- package/dist/testing.cjs +416 -19
- package/dist/testing.js +3 -3
- package/dist/ui.cjs +256 -65
- package/dist/ui.js +8 -8
- package/dist/widgets.cjs +166 -40
- package/dist/widgets.js +7 -7
- package/package.json +1 -1
- package/dist/chunk-YT6HQ6AM.js +0 -14
package/dist/ui.cjs
CHANGED
|
@@ -107,7 +107,7 @@ function devWarn(message) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// src/reactivity/track.ts
|
|
110
|
+
// src/reactivity/track-core.ts
|
|
111
111
|
var _isDev2 = isDev();
|
|
112
112
|
var POOL_MAX = 4096;
|
|
113
113
|
var nodePool = [];
|
|
@@ -191,6 +191,7 @@ function unlinkSub(node) {
|
|
|
191
191
|
else sub.depsTail = prev;
|
|
192
192
|
}
|
|
193
193
|
var currentSubscriber = null;
|
|
194
|
+
var suspendSavedSub = null;
|
|
194
195
|
var notifyDepth = 0;
|
|
195
196
|
var pendingQueue = [];
|
|
196
197
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
@@ -202,7 +203,35 @@ function safeInvoke(sub) {
|
|
|
202
203
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
203
204
|
}
|
|
204
205
|
}
|
|
206
|
+
var suspendDepth = 0;
|
|
205
207
|
var trackingSuspended = false;
|
|
208
|
+
function suspendTracking() {
|
|
209
|
+
if (suspendDepth === 0) {
|
|
210
|
+
suspendSavedSub = currentSubscriber;
|
|
211
|
+
currentSubscriber = null;
|
|
212
|
+
trackingSuspended = true;
|
|
213
|
+
}
|
|
214
|
+
suspendDepth++;
|
|
215
|
+
}
|
|
216
|
+
function resumeTracking() {
|
|
217
|
+
suspendDepth--;
|
|
218
|
+
if (suspendDepth === 0) {
|
|
219
|
+
currentSubscriber = suspendSavedSub;
|
|
220
|
+
suspendSavedSub = null;
|
|
221
|
+
trackingSuspended = false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function isTrackingSuspended() {
|
|
225
|
+
return trackingSuspended;
|
|
226
|
+
}
|
|
227
|
+
function untracked(fn) {
|
|
228
|
+
suspendTracking();
|
|
229
|
+
try {
|
|
230
|
+
return fn();
|
|
231
|
+
} finally {
|
|
232
|
+
resumeTracking();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
206
235
|
var subscriberEpochCounter = 0;
|
|
207
236
|
function retrack(effectFn, subscriber) {
|
|
208
237
|
const prev = currentSubscriber;
|
|
@@ -312,6 +341,16 @@ function cleanup(subscriber) {
|
|
|
312
341
|
var maxSubscriberRepeats = 50;
|
|
313
342
|
var maxDrainIterations = 1e6;
|
|
314
343
|
var drainEpoch = 0;
|
|
344
|
+
function setMaxSubscriberRepeats(n) {
|
|
345
|
+
const prev = maxSubscriberRepeats;
|
|
346
|
+
if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
|
|
347
|
+
return prev;
|
|
348
|
+
}
|
|
349
|
+
function setMaxDrainIterations(n) {
|
|
350
|
+
const prev = maxDrainIterations;
|
|
351
|
+
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
352
|
+
return prev;
|
|
353
|
+
}
|
|
315
354
|
function tickRepeat(sub) {
|
|
316
355
|
const s = sub;
|
|
317
356
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -353,6 +392,20 @@ function drainQueue() {
|
|
|
353
392
|
safeInvoke(sub);
|
|
354
393
|
}
|
|
355
394
|
}
|
|
395
|
+
function drainNotificationQueue() {
|
|
396
|
+
if (notifyDepth > 0) return;
|
|
397
|
+
notifyDepth++;
|
|
398
|
+
drainEpoch++;
|
|
399
|
+
try {
|
|
400
|
+
drainQueue();
|
|
401
|
+
} finally {
|
|
402
|
+
notifyDepth--;
|
|
403
|
+
if (notifyDepth === 0) {
|
|
404
|
+
pendingQueue.length = 0;
|
|
405
|
+
pendingSet.clear();
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
356
409
|
function propagateDirty(sub) {
|
|
357
410
|
sub();
|
|
358
411
|
const rootSig = sub._sig;
|
|
@@ -385,6 +438,22 @@ function propagateDirty(sub) {
|
|
|
385
438
|
}
|
|
386
439
|
}
|
|
387
440
|
}
|
|
441
|
+
function queueSignalNotification(signal2) {
|
|
442
|
+
const sig = signal2;
|
|
443
|
+
let node = sig.subsHead ?? null;
|
|
444
|
+
while (node) {
|
|
445
|
+
const s = node.sub;
|
|
446
|
+
if (s) {
|
|
447
|
+
if (s._c) {
|
|
448
|
+
propagateDirty(s);
|
|
449
|
+
} else if (!pendingSet.has(s)) {
|
|
450
|
+
pendingSet.add(s);
|
|
451
|
+
pendingQueue.push(s);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
node = node.sigNext;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
388
457
|
function notifySubscribers(signal2) {
|
|
389
458
|
const sig = signal2;
|
|
390
459
|
const head = sig.subsHead;
|
|
@@ -430,6 +499,85 @@ function notifySubscribers(signal2) {
|
|
|
430
499
|
}
|
|
431
500
|
}
|
|
432
501
|
}
|
|
502
|
+
function getSubscriberCount(signal2) {
|
|
503
|
+
return signal2.__sc ?? 0;
|
|
504
|
+
}
|
|
505
|
+
function getSubscriberDeps(subscriber) {
|
|
506
|
+
const sub = subscriber;
|
|
507
|
+
const out = [];
|
|
508
|
+
let node = sub.depsHead ?? null;
|
|
509
|
+
while (node) {
|
|
510
|
+
if (node.sig) out.push(node.sig);
|
|
511
|
+
node = node.subNext;
|
|
512
|
+
}
|
|
513
|
+
return out;
|
|
514
|
+
}
|
|
515
|
+
function forEachSubscriber(signal2, visit) {
|
|
516
|
+
let node = signal2.subsHead ?? null;
|
|
517
|
+
while (node) {
|
|
518
|
+
const s = node.sub;
|
|
519
|
+
if (s) visit(s);
|
|
520
|
+
node = node.sigNext;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// src/reactivity/track.ts
|
|
525
|
+
var _isDev3 = isDev();
|
|
526
|
+
var _runtimeVersion = true ? "3.3.2" : "dev";
|
|
527
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
528
|
+
function resolveReactiveApi() {
|
|
529
|
+
const g = globalThis;
|
|
530
|
+
const existing = g[REGISTRY_KEY];
|
|
531
|
+
if (existing) {
|
|
532
|
+
if (_isDev3 && !existing.__dupWarned) {
|
|
533
|
+
existing.__dupWarned = true;
|
|
534
|
+
devWarn(
|
|
535
|
+
`Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity still works \u2014 all copies share the first one \u2014 but de-duplicate sibujs in your bundler (e.g. Vite optimizeDeps.exclude: ['sibujs'] or resolve.dedupe: ['sibujs']).`
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
return existing;
|
|
539
|
+
}
|
|
540
|
+
const local = {
|
|
541
|
+
suspendTracking,
|
|
542
|
+
resumeTracking,
|
|
543
|
+
isTrackingSuspended,
|
|
544
|
+
untracked,
|
|
545
|
+
retrack,
|
|
546
|
+
track,
|
|
547
|
+
reactiveBinding,
|
|
548
|
+
recordDependency,
|
|
549
|
+
cleanup,
|
|
550
|
+
setMaxSubscriberRepeats,
|
|
551
|
+
setMaxDrainIterations,
|
|
552
|
+
drainNotificationQueue,
|
|
553
|
+
queueSignalNotification,
|
|
554
|
+
notifySubscribers,
|
|
555
|
+
getSubscriberCount,
|
|
556
|
+
getSubscriberDeps,
|
|
557
|
+
forEachSubscriber,
|
|
558
|
+
version: _runtimeVersion
|
|
559
|
+
};
|
|
560
|
+
g[REGISTRY_KEY] = local;
|
|
561
|
+
return local;
|
|
562
|
+
}
|
|
563
|
+
var API = resolveReactiveApi();
|
|
564
|
+
var suspendTracking2 = API.suspendTracking;
|
|
565
|
+
var resumeTracking2 = API.resumeTracking;
|
|
566
|
+
var isTrackingSuspended2 = API.isTrackingSuspended;
|
|
567
|
+
var untracked2 = API.untracked;
|
|
568
|
+
var retrack2 = API.retrack;
|
|
569
|
+
var track2 = API.track;
|
|
570
|
+
var reactiveBinding2 = API.reactiveBinding;
|
|
571
|
+
var recordDependency2 = API.recordDependency;
|
|
572
|
+
var cleanup2 = API.cleanup;
|
|
573
|
+
var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
|
|
574
|
+
var setMaxDrainIterations2 = API.setMaxDrainIterations;
|
|
575
|
+
var drainNotificationQueue2 = API.drainNotificationQueue;
|
|
576
|
+
var queueSignalNotification2 = API.queueSignalNotification;
|
|
577
|
+
var notifySubscribers2 = API.notifySubscribers;
|
|
578
|
+
var getSubscriberCount2 = API.getSubscriberCount;
|
|
579
|
+
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
580
|
+
var forEachSubscriber2 = API.forEachSubscriber;
|
|
433
581
|
|
|
434
582
|
// src/core/signals/derived.ts
|
|
435
583
|
function derived(getter, options) {
|
|
@@ -453,7 +601,7 @@ function derived(getter, options) {
|
|
|
453
601
|
cs._d = false;
|
|
454
602
|
cs._init = true;
|
|
455
603
|
};
|
|
456
|
-
|
|
604
|
+
track2(() => {
|
|
457
605
|
let threw = true;
|
|
458
606
|
try {
|
|
459
607
|
cs._v = getter();
|
|
@@ -472,12 +620,12 @@ function derived(getter, options) {
|
|
|
472
620
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
473
621
|
);
|
|
474
622
|
}
|
|
475
|
-
if (
|
|
623
|
+
if (isTrackingSuspended2()) {
|
|
476
624
|
if (cs._d) {
|
|
477
625
|
const prev = cs._v;
|
|
478
626
|
evaluating = true;
|
|
479
627
|
try {
|
|
480
|
-
|
|
628
|
+
retrack2(recompute, markDirty);
|
|
481
629
|
if (!Object.is(prev, cs._v)) cs.__v++;
|
|
482
630
|
} finally {
|
|
483
631
|
evaluating = false;
|
|
@@ -485,12 +633,12 @@ function derived(getter, options) {
|
|
|
485
633
|
}
|
|
486
634
|
return cs._v;
|
|
487
635
|
}
|
|
488
|
-
|
|
636
|
+
recordDependency2(cs);
|
|
489
637
|
if (cs._d) {
|
|
490
638
|
const oldValue = cs._v;
|
|
491
639
|
evaluating = true;
|
|
492
640
|
try {
|
|
493
|
-
|
|
641
|
+
retrack2(recompute, markDirty);
|
|
494
642
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
495
643
|
} finally {
|
|
496
644
|
evaluating = false;
|
|
@@ -513,15 +661,56 @@ function derived(getter, options) {
|
|
|
513
661
|
// src/reactivity/batch.ts
|
|
514
662
|
var batchDepth = 0;
|
|
515
663
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
516
|
-
function
|
|
664
|
+
function batchImpl(fn) {
|
|
665
|
+
batchDepth++;
|
|
666
|
+
try {
|
|
667
|
+
return fn();
|
|
668
|
+
} finally {
|
|
669
|
+
batchDepth--;
|
|
670
|
+
if (batchDepth === 0) {
|
|
671
|
+
flushBatch();
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
517
676
|
if (batchDepth === 0) return false;
|
|
518
677
|
pendingSignals.add(signal2);
|
|
519
678
|
return true;
|
|
520
679
|
}
|
|
680
|
+
function isBatchingImpl() {
|
|
681
|
+
return batchDepth > 0;
|
|
682
|
+
}
|
|
683
|
+
function flushBatch() {
|
|
684
|
+
try {
|
|
685
|
+
for (const signal2 of pendingSignals) {
|
|
686
|
+
queueSignalNotification2(signal2);
|
|
687
|
+
}
|
|
688
|
+
} finally {
|
|
689
|
+
pendingSignals.clear();
|
|
690
|
+
}
|
|
691
|
+
drainNotificationQueue2();
|
|
692
|
+
}
|
|
693
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
694
|
+
function resolveBatchApi() {
|
|
695
|
+
const g = globalThis;
|
|
696
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
697
|
+
if (existing) return existing;
|
|
698
|
+
const local = {
|
|
699
|
+
batch: batchImpl,
|
|
700
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
701
|
+
isBatching: isBatchingImpl
|
|
702
|
+
};
|
|
703
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
704
|
+
return local;
|
|
705
|
+
}
|
|
706
|
+
var API2 = resolveBatchApi();
|
|
707
|
+
var batch = API2.batch;
|
|
708
|
+
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
709
|
+
var isBatching = API2.isBatching;
|
|
521
710
|
|
|
522
711
|
// src/core/signals/signal.ts
|
|
523
712
|
var _g = globalThis;
|
|
524
|
-
var
|
|
713
|
+
var _isDev4 = isDev();
|
|
525
714
|
function signal(initial, options) {
|
|
526
715
|
const state = {
|
|
527
716
|
value: initial,
|
|
@@ -532,11 +721,11 @@ function signal(initial, options) {
|
|
|
532
721
|
__activeNode: null,
|
|
533
722
|
__name: void 0
|
|
534
723
|
};
|
|
535
|
-
const debugName =
|
|
724
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
536
725
|
const equalsFn = options?.equals;
|
|
537
726
|
if (debugName) state.__name = debugName;
|
|
538
727
|
function get() {
|
|
539
|
-
|
|
728
|
+
recordDependency2(state);
|
|
540
729
|
return state.value;
|
|
541
730
|
}
|
|
542
731
|
get.__signal = state;
|
|
@@ -549,15 +738,15 @@ function signal(initial, options) {
|
|
|
549
738
|
if (equalsFn(prev, newValue)) return;
|
|
550
739
|
state.value = newValue;
|
|
551
740
|
state.__v++;
|
|
552
|
-
if (
|
|
741
|
+
if (_isDev4) {
|
|
553
742
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
554
743
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
555
744
|
}
|
|
556
745
|
if (!enqueueBatchedSignal(state)) {
|
|
557
|
-
|
|
746
|
+
notifySubscribers2(state);
|
|
558
747
|
}
|
|
559
748
|
};
|
|
560
|
-
} else if (
|
|
749
|
+
} else if (_isDev4) {
|
|
561
750
|
set = (next) => {
|
|
562
751
|
const prev = state.value;
|
|
563
752
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -567,7 +756,7 @@ function signal(initial, options) {
|
|
|
567
756
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
568
757
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
569
758
|
if (!enqueueBatchedSignal(state)) {
|
|
570
|
-
|
|
759
|
+
notifySubscribers2(state);
|
|
571
760
|
}
|
|
572
761
|
};
|
|
573
762
|
} else {
|
|
@@ -578,11 +767,11 @@ function signal(initial, options) {
|
|
|
578
767
|
state.value = newValue;
|
|
579
768
|
state.__v++;
|
|
580
769
|
if (!enqueueBatchedSignal(state)) {
|
|
581
|
-
|
|
770
|
+
notifySubscribers2(state);
|
|
582
771
|
}
|
|
583
772
|
};
|
|
584
773
|
}
|
|
585
|
-
if (
|
|
774
|
+
if (_isDev4) {
|
|
586
775
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
587
776
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
588
777
|
}
|
|
@@ -645,23 +834,18 @@ function custom(fn, message) {
|
|
|
645
834
|
return (value) => fn(value) ? null : message;
|
|
646
835
|
}
|
|
647
836
|
function bindField(field, extras) {
|
|
837
|
+
const readControlValue = (target) => {
|
|
838
|
+
if ("checked" in target && target.type === "checkbox") {
|
|
839
|
+
return target.checked;
|
|
840
|
+
}
|
|
841
|
+
if (target instanceof HTMLSelectElement && target.multiple) {
|
|
842
|
+
return Array.from(target.selectedOptions, (o) => o.value);
|
|
843
|
+
}
|
|
844
|
+
return target.value;
|
|
845
|
+
};
|
|
648
846
|
const fieldOn = {
|
|
649
|
-
input: (e) =>
|
|
650
|
-
|
|
651
|
-
if (target.type === "checkbox") {
|
|
652
|
-
field.set(target.checked);
|
|
653
|
-
} else {
|
|
654
|
-
field.set(target.value);
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
|
-
change: (e) => {
|
|
658
|
-
const target = e.target;
|
|
659
|
-
if ("checked" in target && target.type === "checkbox") {
|
|
660
|
-
field.set(target.checked);
|
|
661
|
-
} else {
|
|
662
|
-
field.set(target.value);
|
|
663
|
-
}
|
|
664
|
-
},
|
|
847
|
+
input: (e) => field.set(readControlValue(e.target)),
|
|
848
|
+
change: (e) => field.set(readControlValue(e.target)),
|
|
665
849
|
blur: () => field.touch()
|
|
666
850
|
};
|
|
667
851
|
const { on: extraOn, value: _ignoreValue, ...restExtras } = extras ?? {};
|
|
@@ -824,7 +1008,7 @@ function formAction(fn) {
|
|
|
824
1008
|
|
|
825
1009
|
// src/core/rendering/dispose.ts
|
|
826
1010
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
827
|
-
var
|
|
1011
|
+
var _isDev5 = isDev();
|
|
828
1012
|
var activeBindingCount = 0;
|
|
829
1013
|
function registerDisposer(node, teardown) {
|
|
830
1014
|
let disposers = elementDisposers.get(node);
|
|
@@ -833,7 +1017,7 @@ function registerDisposer(node, teardown) {
|
|
|
833
1017
|
elementDisposers.set(node, disposers);
|
|
834
1018
|
}
|
|
835
1019
|
disposers.push(teardown);
|
|
836
|
-
if (
|
|
1020
|
+
if (_isDev5) activeBindingCount++;
|
|
837
1021
|
}
|
|
838
1022
|
function dispose(node) {
|
|
839
1023
|
const stack = [node];
|
|
@@ -852,12 +1036,12 @@ function dispose(node) {
|
|
|
852
1036
|
if (disposers) {
|
|
853
1037
|
const snapshot = disposers.slice();
|
|
854
1038
|
elementDisposers.delete(current);
|
|
855
|
-
if (
|
|
1039
|
+
if (_isDev5) activeBindingCount -= snapshot.length;
|
|
856
1040
|
for (const d of snapshot) {
|
|
857
1041
|
try {
|
|
858
1042
|
d();
|
|
859
1043
|
} catch (err) {
|
|
860
|
-
if (
|
|
1044
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
861
1045
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
862
1046
|
}
|
|
863
1047
|
}
|
|
@@ -868,12 +1052,12 @@ function dispose(node) {
|
|
|
868
1052
|
if (!added || added.length === 0) break;
|
|
869
1053
|
const moreSnapshot = added.slice();
|
|
870
1054
|
elementDisposers.delete(current);
|
|
871
|
-
if (
|
|
1055
|
+
if (_isDev5) activeBindingCount -= moreSnapshot.length;
|
|
872
1056
|
for (const d of moreSnapshot) {
|
|
873
1057
|
try {
|
|
874
1058
|
d();
|
|
875
1059
|
} catch (err) {
|
|
876
|
-
if (
|
|
1060
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
877
1061
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
878
1062
|
}
|
|
879
1063
|
}
|
|
@@ -884,23 +1068,29 @@ function dispose(node) {
|
|
|
884
1068
|
}
|
|
885
1069
|
|
|
886
1070
|
// src/core/ssr-context.ts
|
|
887
|
-
var
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
1071
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
1072
|
+
function detectSSRShared() {
|
|
1073
|
+
let detected = null;
|
|
1074
|
+
try {
|
|
1075
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
1076
|
+
let mod = null;
|
|
1077
|
+
const getBuiltin = process.getBuiltinModule;
|
|
1078
|
+
if (typeof getBuiltin === "function") {
|
|
1079
|
+
mod = getBuiltin("node:async_hooks");
|
|
1080
|
+
} else {
|
|
1081
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
1082
|
+
if (req) mod = req("node:async_hooks");
|
|
1083
|
+
}
|
|
1084
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
897
1085
|
}
|
|
898
|
-
|
|
1086
|
+
} catch {
|
|
1087
|
+
detected = null;
|
|
899
1088
|
}
|
|
900
|
-
|
|
901
|
-
als = null;
|
|
1089
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
902
1090
|
}
|
|
903
|
-
var
|
|
1091
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
1092
|
+
var als = _shared.als;
|
|
1093
|
+
var fallbackStore = _shared.fallbackStore;
|
|
904
1094
|
function getSSRStore() {
|
|
905
1095
|
if (als) {
|
|
906
1096
|
const s = als.getStore();
|
|
@@ -932,7 +1122,7 @@ function drainReruns(ctx) {
|
|
|
932
1122
|
do {
|
|
933
1123
|
ctx.rerunPending = false;
|
|
934
1124
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
935
|
-
|
|
1125
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
936
1126
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
937
1127
|
if (ctx.rerunPending) {
|
|
938
1128
|
ctx.rerunPending = false;
|
|
@@ -961,7 +1151,7 @@ function disposeEffect(ctx) {
|
|
|
961
1151
|
}
|
|
962
1152
|
}
|
|
963
1153
|
try {
|
|
964
|
-
|
|
1154
|
+
cleanup2(ctx.subscriber);
|
|
965
1155
|
} catch (err) {
|
|
966
1156
|
if (typeof console !== "undefined") {
|
|
967
1157
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -1006,7 +1196,7 @@ function effect(effectFn, options) {
|
|
|
1006
1196
|
try {
|
|
1007
1197
|
ctx.rerunPending = false;
|
|
1008
1198
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1009
|
-
|
|
1199
|
+
retrack2(ctx.bodyFn, sub);
|
|
1010
1200
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
1011
1201
|
} finally {
|
|
1012
1202
|
ctx.running = false;
|
|
@@ -1022,7 +1212,7 @@ function effect(effectFn, options) {
|
|
|
1022
1212
|
ctx.subscriber = sub;
|
|
1023
1213
|
ctx.running = true;
|
|
1024
1214
|
try {
|
|
1025
|
-
|
|
1215
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
1026
1216
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
1027
1217
|
} finally {
|
|
1028
1218
|
ctx.running = false;
|
|
@@ -1261,7 +1451,7 @@ function aria(element, attrs) {
|
|
|
1261
1451
|
const getter = value;
|
|
1262
1452
|
registerDisposer(
|
|
1263
1453
|
element,
|
|
1264
|
-
|
|
1454
|
+
track2(() => {
|
|
1265
1455
|
element.setAttribute(ariaKey, String(getter()));
|
|
1266
1456
|
})
|
|
1267
1457
|
);
|
|
@@ -1460,10 +1650,11 @@ function announce(message, priority = "polite") {
|
|
|
1460
1650
|
}
|
|
1461
1651
|
|
|
1462
1652
|
// src/core/rendering/createId.ts
|
|
1463
|
-
var
|
|
1653
|
+
var COUNTER_KEY = /* @__PURE__ */ Symbol.for("sibujs.createId.v1");
|
|
1654
|
+
var _counter = globalThis[COUNTER_KEY] ?? (globalThis[COUNTER_KEY] = { n: 0 });
|
|
1464
1655
|
function createId(prefix = "sibu") {
|
|
1465
|
-
|
|
1466
|
-
return `${prefix}-${
|
|
1656
|
+
_counter.n++;
|
|
1657
|
+
return `${prefix}-${_counter.n}`;
|
|
1467
1658
|
}
|
|
1468
1659
|
|
|
1469
1660
|
// src/ui/a11yPrimitives.ts
|
|
@@ -1782,13 +1973,13 @@ function sanitizeAttributeString(attr, value) {
|
|
|
1782
1973
|
}
|
|
1783
1974
|
|
|
1784
1975
|
// src/reactivity/bindAttribute.ts
|
|
1785
|
-
var
|
|
1976
|
+
var _isDev6 = isDev();
|
|
1786
1977
|
function setProp(el, key, val) {
|
|
1787
1978
|
el[key] = val;
|
|
1788
1979
|
}
|
|
1789
1980
|
function bindAttribute(el, attr, getter) {
|
|
1790
1981
|
if (isEventHandlerAttr(attr)) {
|
|
1791
|
-
if (
|
|
1982
|
+
if (_isDev6)
|
|
1792
1983
|
devWarn(
|
|
1793
1984
|
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
1794
1985
|
);
|
|
@@ -1800,7 +1991,7 @@ function bindAttribute(el, attr, getter) {
|
|
|
1800
1991
|
try {
|
|
1801
1992
|
value = getter();
|
|
1802
1993
|
} catch (err) {
|
|
1803
|
-
if (
|
|
1994
|
+
if (_isDev6)
|
|
1804
1995
|
devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1805
1996
|
return;
|
|
1806
1997
|
}
|
|
@@ -1821,7 +2012,7 @@ function bindAttribute(el, attr, getter) {
|
|
|
1821
2012
|
el.setAttribute(attr, sanitizeAttributeString(attr, str));
|
|
1822
2013
|
}
|
|
1823
2014
|
}
|
|
1824
|
-
return
|
|
2015
|
+
return reactiveBinding2(commit);
|
|
1825
2016
|
}
|
|
1826
2017
|
|
|
1827
2018
|
// src/ui/reactiveAttr.ts
|
|
@@ -1871,7 +2062,7 @@ function bindBoolAttr(el, attr, getter) {
|
|
|
1871
2062
|
el.removeAttribute(attr);
|
|
1872
2063
|
}
|
|
1873
2064
|
}
|
|
1874
|
-
const teardown =
|
|
2065
|
+
const teardown = track2(commit);
|
|
1875
2066
|
return teardown;
|
|
1876
2067
|
}
|
|
1877
2068
|
function bindData(el, key, getter) {
|
package/dist/ui.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
toast,
|
|
39
39
|
withScopedStyle,
|
|
40
40
|
zipMask
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-62V653X2.js";
|
|
42
42
|
import {
|
|
43
43
|
RenderProp,
|
|
44
44
|
assertType,
|
|
@@ -57,21 +57,21 @@ import {
|
|
|
57
57
|
} from "./chunk-VJE6DDYM.js";
|
|
58
58
|
import {
|
|
59
59
|
createId
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import "./chunk-
|
|
62
|
-
import "./chunk-
|
|
60
|
+
} from "./chunk-CCSJMTRN.js";
|
|
61
|
+
import "./chunk-QCFBIVIQ.js";
|
|
62
|
+
import "./chunk-G6N3LMO2.js";
|
|
63
63
|
import {
|
|
64
64
|
registerDisposer
|
|
65
65
|
} from "./chunk-5VGSK6D2.js";
|
|
66
66
|
import "./chunk-L3GAGWCC.js";
|
|
67
67
|
import {
|
|
68
68
|
effect
|
|
69
|
-
} from "./chunk-
|
|
70
|
-
import "./chunk-
|
|
69
|
+
} from "./chunk-N5TQVEKE.js";
|
|
70
|
+
import "./chunk-S3NFJO6L.js";
|
|
71
71
|
import {
|
|
72
72
|
signal
|
|
73
|
-
} from "./chunk-
|
|
74
|
-
import "./chunk-
|
|
73
|
+
} from "./chunk-JCQG2I2G.js";
|
|
74
|
+
import "./chunk-4NJEAPLI.js";
|
|
75
75
|
import "./chunk-COY6PUD2.js";
|
|
76
76
|
|
|
77
77
|
// src/ui/formAction.ts
|