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/devtools.cjs
CHANGED
|
@@ -45,7 +45,7 @@ __export(devtools_exports, {
|
|
|
45
45
|
getDependencies: () => getDependencies,
|
|
46
46
|
getPerformanceReport: () => getPerformanceReport,
|
|
47
47
|
getSignalName: () => getSignalName,
|
|
48
|
-
getSubscriberCount: () =>
|
|
48
|
+
getSubscriberCount: () => getSubscriberCount3,
|
|
49
49
|
hmrState: () => hmrState,
|
|
50
50
|
initDevTools: () => initDevTools,
|
|
51
51
|
inspectSignal: () => inspectSignal,
|
|
@@ -137,18 +137,18 @@ function clearPerformanceData() {
|
|
|
137
137
|
perfMarks.clear();
|
|
138
138
|
}
|
|
139
139
|
var trackedCleanups = /* @__PURE__ */ new Map();
|
|
140
|
-
function trackCleanup(component,
|
|
140
|
+
function trackCleanup(component, cleanup3) {
|
|
141
141
|
if (!trackedCleanups.has(component)) {
|
|
142
142
|
trackedCleanups.set(component, []);
|
|
143
143
|
}
|
|
144
|
-
trackedCleanups.get(component)?.push(
|
|
144
|
+
trackedCleanups.get(component)?.push(cleanup3);
|
|
145
145
|
}
|
|
146
146
|
function runCleanups(component) {
|
|
147
147
|
const cleanups = trackedCleanups.get(component);
|
|
148
148
|
if (cleanups) {
|
|
149
|
-
for (const
|
|
149
|
+
for (const cleanup3 of cleanups) {
|
|
150
150
|
try {
|
|
151
|
-
|
|
151
|
+
cleanup3();
|
|
152
152
|
} catch (err) {
|
|
153
153
|
if (typeof console !== "undefined") {
|
|
154
154
|
console.warn("[SibuJS debug] cleanup threw:", err);
|
|
@@ -193,7 +193,7 @@ function devWarn(message) {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
// src/reactivity/track.ts
|
|
196
|
+
// src/reactivity/track-core.ts
|
|
197
197
|
var _isDev2 = isDev();
|
|
198
198
|
var POOL_MAX = 4096;
|
|
199
199
|
var nodePool = [];
|
|
@@ -277,6 +277,7 @@ function unlinkSub(node) {
|
|
|
277
277
|
else sub.depsTail = prev;
|
|
278
278
|
}
|
|
279
279
|
var currentSubscriber = null;
|
|
280
|
+
var suspendSavedSub = null;
|
|
280
281
|
var notifyDepth = 0;
|
|
281
282
|
var pendingQueue = [];
|
|
282
283
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
@@ -288,6 +289,35 @@ function safeInvoke(sub) {
|
|
|
288
289
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
289
290
|
}
|
|
290
291
|
}
|
|
292
|
+
var suspendDepth = 0;
|
|
293
|
+
var trackingSuspended = false;
|
|
294
|
+
function suspendTracking() {
|
|
295
|
+
if (suspendDepth === 0) {
|
|
296
|
+
suspendSavedSub = currentSubscriber;
|
|
297
|
+
currentSubscriber = null;
|
|
298
|
+
trackingSuspended = true;
|
|
299
|
+
}
|
|
300
|
+
suspendDepth++;
|
|
301
|
+
}
|
|
302
|
+
function resumeTracking() {
|
|
303
|
+
suspendDepth--;
|
|
304
|
+
if (suspendDepth === 0) {
|
|
305
|
+
currentSubscriber = suspendSavedSub;
|
|
306
|
+
suspendSavedSub = null;
|
|
307
|
+
trackingSuspended = false;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function isTrackingSuspended() {
|
|
311
|
+
return trackingSuspended;
|
|
312
|
+
}
|
|
313
|
+
function untracked(fn) {
|
|
314
|
+
suspendTracking();
|
|
315
|
+
try {
|
|
316
|
+
return fn();
|
|
317
|
+
} finally {
|
|
318
|
+
resumeTracking();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
291
321
|
var subscriberEpochCounter = 0;
|
|
292
322
|
function retrack(effectFn, subscriber) {
|
|
293
323
|
const prev = currentSubscriber;
|
|
@@ -320,6 +350,51 @@ function retrack(effectFn, subscriber) {
|
|
|
320
350
|
}
|
|
321
351
|
}
|
|
322
352
|
}
|
|
353
|
+
function track(effectFn, subscriber) {
|
|
354
|
+
if (!subscriber) return reactiveBinding(effectFn);
|
|
355
|
+
cleanup(subscriber);
|
|
356
|
+
const prev = currentSubscriber;
|
|
357
|
+
currentSubscriber = subscriber;
|
|
358
|
+
try {
|
|
359
|
+
effectFn();
|
|
360
|
+
} finally {
|
|
361
|
+
currentSubscriber = prev;
|
|
362
|
+
const sub2 = subscriber;
|
|
363
|
+
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
364
|
+
const sig = n.sig;
|
|
365
|
+
sig.__activeNode = n.prevActive;
|
|
366
|
+
n.prevActive = null;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const sub = subscriber;
|
|
370
|
+
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
371
|
+
}
|
|
372
|
+
function reactiveBinding(commit) {
|
|
373
|
+
const run = () => {
|
|
374
|
+
const s = subscriber;
|
|
375
|
+
if (s._disposed || s._reentrant) return;
|
|
376
|
+
s._reentrant = true;
|
|
377
|
+
try {
|
|
378
|
+
retrack(commit, subscriber);
|
|
379
|
+
} finally {
|
|
380
|
+
s._reentrant = false;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const subscriber = run;
|
|
384
|
+
subscriber.depsHead = null;
|
|
385
|
+
subscriber.depsTail = null;
|
|
386
|
+
subscriber._epoch = 0;
|
|
387
|
+
subscriber._structDirty = false;
|
|
388
|
+
subscriber._runEpoch = 0;
|
|
389
|
+
subscriber._runs = 0;
|
|
390
|
+
subscriber._reentrant = false;
|
|
391
|
+
subscriber._disposed = false;
|
|
392
|
+
run();
|
|
393
|
+
return subscriber._dispose ?? (subscriber._dispose = () => {
|
|
394
|
+
subscriber._disposed = true;
|
|
395
|
+
cleanup(subscriber);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
323
398
|
function recordDependency(signal2) {
|
|
324
399
|
if (!currentSubscriber) return;
|
|
325
400
|
const sub = currentSubscriber;
|
|
@@ -352,6 +427,16 @@ function cleanup(subscriber) {
|
|
|
352
427
|
var maxSubscriberRepeats = 50;
|
|
353
428
|
var maxDrainIterations = 1e6;
|
|
354
429
|
var drainEpoch = 0;
|
|
430
|
+
function setMaxSubscriberRepeats(n) {
|
|
431
|
+
const prev = maxSubscriberRepeats;
|
|
432
|
+
if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
|
|
433
|
+
return prev;
|
|
434
|
+
}
|
|
435
|
+
function setMaxDrainIterations(n) {
|
|
436
|
+
const prev = maxDrainIterations;
|
|
437
|
+
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
438
|
+
return prev;
|
|
439
|
+
}
|
|
355
440
|
function tickRepeat(sub) {
|
|
356
441
|
const s = sub;
|
|
357
442
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -393,6 +478,20 @@ function drainQueue() {
|
|
|
393
478
|
safeInvoke(sub);
|
|
394
479
|
}
|
|
395
480
|
}
|
|
481
|
+
function drainNotificationQueue() {
|
|
482
|
+
if (notifyDepth > 0) return;
|
|
483
|
+
notifyDepth++;
|
|
484
|
+
drainEpoch++;
|
|
485
|
+
try {
|
|
486
|
+
drainQueue();
|
|
487
|
+
} finally {
|
|
488
|
+
notifyDepth--;
|
|
489
|
+
if (notifyDepth === 0) {
|
|
490
|
+
pendingQueue.length = 0;
|
|
491
|
+
pendingSet.clear();
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
396
495
|
function propagateDirty(sub) {
|
|
397
496
|
sub();
|
|
398
497
|
const rootSig = sub._sig;
|
|
@@ -425,6 +524,22 @@ function propagateDirty(sub) {
|
|
|
425
524
|
}
|
|
426
525
|
}
|
|
427
526
|
}
|
|
527
|
+
function queueSignalNotification(signal2) {
|
|
528
|
+
const sig = signal2;
|
|
529
|
+
let node = sig.subsHead ?? null;
|
|
530
|
+
while (node) {
|
|
531
|
+
const s = node.sub;
|
|
532
|
+
if (s) {
|
|
533
|
+
if (s._c) {
|
|
534
|
+
propagateDirty(s);
|
|
535
|
+
} else if (!pendingSet.has(s)) {
|
|
536
|
+
pendingSet.add(s);
|
|
537
|
+
pendingQueue.push(s);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
node = node.sigNext;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
428
543
|
function notifySubscribers(signal2) {
|
|
429
544
|
const sig = signal2;
|
|
430
545
|
const head = sig.subsHead;
|
|
@@ -492,18 +607,117 @@ function forEachSubscriber(signal2, visit) {
|
|
|
492
607
|
}
|
|
493
608
|
}
|
|
494
609
|
|
|
610
|
+
// src/reactivity/track.ts
|
|
611
|
+
var _isDev3 = isDev();
|
|
612
|
+
var _runtimeVersion = true ? "3.3.2" : "dev";
|
|
613
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
614
|
+
function resolveReactiveApi() {
|
|
615
|
+
const g = globalThis;
|
|
616
|
+
const existing = g[REGISTRY_KEY];
|
|
617
|
+
if (existing) {
|
|
618
|
+
if (_isDev3 && !existing.__dupWarned) {
|
|
619
|
+
existing.__dupWarned = true;
|
|
620
|
+
devWarn(
|
|
621
|
+
`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']).`
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
return existing;
|
|
625
|
+
}
|
|
626
|
+
const local = {
|
|
627
|
+
suspendTracking,
|
|
628
|
+
resumeTracking,
|
|
629
|
+
isTrackingSuspended,
|
|
630
|
+
untracked,
|
|
631
|
+
retrack,
|
|
632
|
+
track,
|
|
633
|
+
reactiveBinding,
|
|
634
|
+
recordDependency,
|
|
635
|
+
cleanup,
|
|
636
|
+
setMaxSubscriberRepeats,
|
|
637
|
+
setMaxDrainIterations,
|
|
638
|
+
drainNotificationQueue,
|
|
639
|
+
queueSignalNotification,
|
|
640
|
+
notifySubscribers,
|
|
641
|
+
getSubscriberCount,
|
|
642
|
+
getSubscriberDeps,
|
|
643
|
+
forEachSubscriber,
|
|
644
|
+
version: _runtimeVersion
|
|
645
|
+
};
|
|
646
|
+
g[REGISTRY_KEY] = local;
|
|
647
|
+
return local;
|
|
648
|
+
}
|
|
649
|
+
var API = resolveReactiveApi();
|
|
650
|
+
var suspendTracking2 = API.suspendTracking;
|
|
651
|
+
var resumeTracking2 = API.resumeTracking;
|
|
652
|
+
var isTrackingSuspended2 = API.isTrackingSuspended;
|
|
653
|
+
var untracked2 = API.untracked;
|
|
654
|
+
var retrack2 = API.retrack;
|
|
655
|
+
var track2 = API.track;
|
|
656
|
+
var reactiveBinding2 = API.reactiveBinding;
|
|
657
|
+
var recordDependency2 = API.recordDependency;
|
|
658
|
+
var cleanup2 = API.cleanup;
|
|
659
|
+
var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
|
|
660
|
+
var setMaxDrainIterations2 = API.setMaxDrainIterations;
|
|
661
|
+
var drainNotificationQueue2 = API.drainNotificationQueue;
|
|
662
|
+
var queueSignalNotification2 = API.queueSignalNotification;
|
|
663
|
+
var notifySubscribers2 = API.notifySubscribers;
|
|
664
|
+
var getSubscriberCount2 = API.getSubscriberCount;
|
|
665
|
+
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
666
|
+
var forEachSubscriber2 = API.forEachSubscriber;
|
|
667
|
+
|
|
495
668
|
// src/reactivity/batch.ts
|
|
496
669
|
var batchDepth = 0;
|
|
497
670
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
498
|
-
function
|
|
671
|
+
function batchImpl(fn) {
|
|
672
|
+
batchDepth++;
|
|
673
|
+
try {
|
|
674
|
+
return fn();
|
|
675
|
+
} finally {
|
|
676
|
+
batchDepth--;
|
|
677
|
+
if (batchDepth === 0) {
|
|
678
|
+
flushBatch();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
499
683
|
if (batchDepth === 0) return false;
|
|
500
684
|
pendingSignals.add(signal2);
|
|
501
685
|
return true;
|
|
502
686
|
}
|
|
687
|
+
function isBatchingImpl() {
|
|
688
|
+
return batchDepth > 0;
|
|
689
|
+
}
|
|
690
|
+
function flushBatch() {
|
|
691
|
+
try {
|
|
692
|
+
for (const signal2 of pendingSignals) {
|
|
693
|
+
queueSignalNotification2(signal2);
|
|
694
|
+
}
|
|
695
|
+
} finally {
|
|
696
|
+
pendingSignals.clear();
|
|
697
|
+
}
|
|
698
|
+
drainNotificationQueue2();
|
|
699
|
+
}
|
|
700
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
701
|
+
function resolveBatchApi() {
|
|
702
|
+
const g = globalThis;
|
|
703
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
704
|
+
if (existing) return existing;
|
|
705
|
+
const local = {
|
|
706
|
+
batch: batchImpl,
|
|
707
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
708
|
+
isBatching: isBatchingImpl
|
|
709
|
+
};
|
|
710
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
711
|
+
return local;
|
|
712
|
+
}
|
|
713
|
+
var API2 = resolveBatchApi();
|
|
714
|
+
var batch = API2.batch;
|
|
715
|
+
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
716
|
+
var isBatching = API2.isBatching;
|
|
503
717
|
|
|
504
718
|
// src/core/signals/signal.ts
|
|
505
719
|
var _g = globalThis;
|
|
506
|
-
var
|
|
720
|
+
var _isDev4 = isDev();
|
|
507
721
|
function signal(initial, options) {
|
|
508
722
|
const state = {
|
|
509
723
|
value: initial,
|
|
@@ -514,11 +728,11 @@ function signal(initial, options) {
|
|
|
514
728
|
__activeNode: null,
|
|
515
729
|
__name: void 0
|
|
516
730
|
};
|
|
517
|
-
const debugName =
|
|
731
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
518
732
|
const equalsFn = options?.equals;
|
|
519
733
|
if (debugName) state.__name = debugName;
|
|
520
734
|
function get() {
|
|
521
|
-
|
|
735
|
+
recordDependency2(state);
|
|
522
736
|
return state.value;
|
|
523
737
|
}
|
|
524
738
|
get.__signal = state;
|
|
@@ -531,15 +745,15 @@ function signal(initial, options) {
|
|
|
531
745
|
if (equalsFn(prev, newValue)) return;
|
|
532
746
|
state.value = newValue;
|
|
533
747
|
state.__v++;
|
|
534
|
-
if (
|
|
748
|
+
if (_isDev4) {
|
|
535
749
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
536
750
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
537
751
|
}
|
|
538
752
|
if (!enqueueBatchedSignal(state)) {
|
|
539
|
-
|
|
753
|
+
notifySubscribers2(state);
|
|
540
754
|
}
|
|
541
755
|
};
|
|
542
|
-
} else if (
|
|
756
|
+
} else if (_isDev4) {
|
|
543
757
|
set = (next) => {
|
|
544
758
|
const prev = state.value;
|
|
545
759
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -549,7 +763,7 @@ function signal(initial, options) {
|
|
|
549
763
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
550
764
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
551
765
|
if (!enqueueBatchedSignal(state)) {
|
|
552
|
-
|
|
766
|
+
notifySubscribers2(state);
|
|
553
767
|
}
|
|
554
768
|
};
|
|
555
769
|
} else {
|
|
@@ -560,11 +774,11 @@ function signal(initial, options) {
|
|
|
560
774
|
state.value = newValue;
|
|
561
775
|
state.__v++;
|
|
562
776
|
if (!enqueueBatchedSignal(state)) {
|
|
563
|
-
|
|
777
|
+
notifySubscribers2(state);
|
|
564
778
|
}
|
|
565
779
|
};
|
|
566
780
|
}
|
|
567
|
-
if (
|
|
781
|
+
if (_isDev4) {
|
|
568
782
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
569
783
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
570
784
|
}
|
|
@@ -1208,7 +1422,7 @@ function devState(name, initial) {
|
|
|
1208
1422
|
|
|
1209
1423
|
// src/core/rendering/dispose.ts
|
|
1210
1424
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
1211
|
-
var
|
|
1425
|
+
var _isDev5 = isDev();
|
|
1212
1426
|
var activeBindingCount = 0;
|
|
1213
1427
|
function dispose(node) {
|
|
1214
1428
|
const stack = [node];
|
|
@@ -1227,12 +1441,12 @@ function dispose(node) {
|
|
|
1227
1441
|
if (disposers) {
|
|
1228
1442
|
const snapshot = disposers.slice();
|
|
1229
1443
|
elementDisposers.delete(current);
|
|
1230
|
-
if (
|
|
1444
|
+
if (_isDev5) activeBindingCount -= snapshot.length;
|
|
1231
1445
|
for (const d of snapshot) {
|
|
1232
1446
|
try {
|
|
1233
1447
|
d();
|
|
1234
1448
|
} catch (err) {
|
|
1235
|
-
if (
|
|
1449
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
1236
1450
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1237
1451
|
}
|
|
1238
1452
|
}
|
|
@@ -1243,12 +1457,12 @@ function dispose(node) {
|
|
|
1243
1457
|
if (!added || added.length === 0) break;
|
|
1244
1458
|
const moreSnapshot = added.slice();
|
|
1245
1459
|
elementDisposers.delete(current);
|
|
1246
|
-
if (
|
|
1460
|
+
if (_isDev5) activeBindingCount -= moreSnapshot.length;
|
|
1247
1461
|
for (const d of moreSnapshot) {
|
|
1248
1462
|
try {
|
|
1249
1463
|
d();
|
|
1250
1464
|
} catch (err) {
|
|
1251
|
-
if (
|
|
1465
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
1252
1466
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1253
1467
|
}
|
|
1254
1468
|
}
|
|
@@ -1553,23 +1767,29 @@ function formatError(error, context, seen = /* @__PURE__ */ new Set([error])) {
|
|
|
1553
1767
|
}
|
|
1554
1768
|
|
|
1555
1769
|
// src/core/ssr-context.ts
|
|
1556
|
-
var
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1770
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
1771
|
+
function detectSSRShared() {
|
|
1772
|
+
let detected = null;
|
|
1773
|
+
try {
|
|
1774
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
1775
|
+
let mod = null;
|
|
1776
|
+
const getBuiltin = process.getBuiltinModule;
|
|
1777
|
+
if (typeof getBuiltin === "function") {
|
|
1778
|
+
mod = getBuiltin("node:async_hooks");
|
|
1779
|
+
} else {
|
|
1780
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
1781
|
+
if (req) mod = req("node:async_hooks");
|
|
1782
|
+
}
|
|
1783
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
1566
1784
|
}
|
|
1567
|
-
|
|
1785
|
+
} catch {
|
|
1786
|
+
detected = null;
|
|
1568
1787
|
}
|
|
1569
|
-
|
|
1570
|
-
als = null;
|
|
1788
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
1571
1789
|
}
|
|
1572
|
-
var
|
|
1790
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
1791
|
+
var als = _shared.als;
|
|
1792
|
+
var fallbackStore = _shared.fallbackStore;
|
|
1573
1793
|
function getSSRStore() {
|
|
1574
1794
|
if (als) {
|
|
1575
1795
|
const s = als.getStore();
|
|
@@ -1601,7 +1821,7 @@ function drainReruns(ctx) {
|
|
|
1601
1821
|
do {
|
|
1602
1822
|
ctx.rerunPending = false;
|
|
1603
1823
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1604
|
-
|
|
1824
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
1605
1825
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
1606
1826
|
if (ctx.rerunPending) {
|
|
1607
1827
|
ctx.rerunPending = false;
|
|
@@ -1630,7 +1850,7 @@ function disposeEffect(ctx) {
|
|
|
1630
1850
|
}
|
|
1631
1851
|
}
|
|
1632
1852
|
try {
|
|
1633
|
-
|
|
1853
|
+
cleanup2(ctx.subscriber);
|
|
1634
1854
|
} catch (err) {
|
|
1635
1855
|
if (typeof console !== "undefined") {
|
|
1636
1856
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -1675,7 +1895,7 @@ function effect(effectFn, options) {
|
|
|
1675
1895
|
try {
|
|
1676
1896
|
ctx.rerunPending = false;
|
|
1677
1897
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1678
|
-
|
|
1898
|
+
retrack2(ctx.bodyFn, sub);
|
|
1679
1899
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
1680
1900
|
} finally {
|
|
1681
1901
|
ctx.running = false;
|
|
@@ -1691,7 +1911,7 @@ function effect(effectFn, options) {
|
|
|
1691
1911
|
ctx.subscriber = sub;
|
|
1692
1912
|
ctx.running = true;
|
|
1693
1913
|
try {
|
|
1694
|
-
|
|
1914
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
1695
1915
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
1696
1916
|
} finally {
|
|
1697
1917
|
ctx.running = false;
|
|
@@ -1809,13 +2029,13 @@ function createDevtoolsOverlay(options) {
|
|
|
1809
2029
|
function getSignalName(getter) {
|
|
1810
2030
|
return getter.__name;
|
|
1811
2031
|
}
|
|
1812
|
-
function
|
|
2032
|
+
function getSubscriberCount3(getter) {
|
|
1813
2033
|
const signal2 = getter.__signal;
|
|
1814
2034
|
if (!signal2) return 0;
|
|
1815
|
-
return
|
|
2035
|
+
return getSubscriberCount2(signal2);
|
|
1816
2036
|
}
|
|
1817
2037
|
function getDependencies(subscriberFn) {
|
|
1818
|
-
return
|
|
2038
|
+
return getSubscriberDeps2(subscriberFn);
|
|
1819
2039
|
}
|
|
1820
2040
|
function inspectSignal(getter) {
|
|
1821
2041
|
const signal2 = getter.__signal;
|
|
@@ -1823,7 +2043,7 @@ function inspectSignal(getter) {
|
|
|
1823
2043
|
return {
|
|
1824
2044
|
name: getter.__name,
|
|
1825
2045
|
signal: signal2,
|
|
1826
|
-
subscriberCount:
|
|
2046
|
+
subscriberCount: getSubscriberCount2(signal2)
|
|
1827
2047
|
};
|
|
1828
2048
|
}
|
|
1829
2049
|
function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ new WeakSet()) {
|
|
@@ -1833,7 +2053,7 @@ function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ ne
|
|
|
1833
2053
|
}
|
|
1834
2054
|
visited.add(signal2);
|
|
1835
2055
|
const downstream = [];
|
|
1836
|
-
|
|
2056
|
+
forEachSubscriber2(signal2, (sub) => {
|
|
1837
2057
|
const subSig = sub._sig;
|
|
1838
2058
|
if (subSig && !visited.has(subSig)) {
|
|
1839
2059
|
const subName = subSig.__name;
|
|
@@ -1846,7 +2066,7 @@ function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ ne
|
|
|
1846
2066
|
});
|
|
1847
2067
|
return {
|
|
1848
2068
|
name: getSignalName(getter),
|
|
1849
|
-
subscribers:
|
|
2069
|
+
subscribers: getSubscriberCount2(signal2),
|
|
1850
2070
|
downstream
|
|
1851
2071
|
};
|
|
1852
2072
|
}
|
package/dist/devtools.js
CHANGED
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
trackCleanup,
|
|
36
36
|
walkDependencyGraph,
|
|
37
37
|
withErrorTracking
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-AEOLHSSQ.js";
|
|
39
39
|
import "./chunk-5VGSK6D2.js";
|
|
40
40
|
import "./chunk-L3GAGWCC.js";
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-N5TQVEKE.js";
|
|
42
|
+
import "./chunk-S3NFJO6L.js";
|
|
43
|
+
import "./chunk-JCQG2I2G.js";
|
|
44
|
+
import "./chunk-4NJEAPLI.js";
|
|
45
45
|
import {
|
|
46
46
|
isDev
|
|
47
47
|
} from "./chunk-COY6PUD2.js";
|