sibujs 3.2.2 → 3.3.1
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 +217 -27
- package/dist/browser.js +5 -5
- package/dist/build.cjs +236 -105
- package/dist/build.js +14 -14
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-5N74TKLD.js → chunk-37BUKSLH.js} +1 -1
- package/dist/{chunk-BGNLPNGV.js → chunk-4UUMSLSL.js} +4 -4
- package/dist/{chunk-2UPRY23K.js → chunk-5VGSK6D2.js} +1 -1
- package/dist/{chunk-OYLPZO4N.js → chunk-6LTFHJQG.js} +4 -4
- package/dist/{chunk-VOCE4NNK.js → chunk-AMIKDMLP.js} +5 -5
- package/dist/{chunk-LMLD24FC.js → chunk-COY6PUD2.js} +7 -1
- package/dist/{chunk-YFDGQWDA.js → chunk-F7FXQ3QS.js} +1 -1
- package/dist/{chunk-V2MTG5FT.js → chunk-IKLYI3RF.js} +33 -16
- package/dist/{chunk-HMJFCBRR.js → chunk-L3GAGWCC.js} +10 -1
- package/dist/{chunk-X67UYC74.js → chunk-LU2MQXQQ.js} +14 -24
- package/dist/{chunk-4JCAUOLN.js → chunk-M5KBNOSJ.js} +22 -12
- package/dist/{chunk-FDY42FIU.js → chunk-MHBCEJQO.js} +2 -2
- package/dist/{chunk-RLUJL2MV.js → chunk-NHKQKKZU.js} +6 -7
- package/dist/{chunk-HXMS4SNP.js → chunk-R3QEDXFS.js} +2 -2
- package/dist/{chunk-NPIEEKPT.js → chunk-RYMOSG5B.js} +6 -6
- package/dist/{chunk-H6PCHJZQ.js → chunk-SLMFA3ZZ.js} +11 -3
- package/dist/{chunk-Z2FWAE4B.js → chunk-TEFZT5PJ.js} +84 -16
- package/dist/{chunk-7XDYVJLE.js → chunk-ULLTNDRA.js} +6 -6
- package/dist/{chunk-GOUM4JCT.js → chunk-VOVVTOEA.js} +2 -2
- package/dist/{chunk-FOI23UJL.js → chunk-WL7BIR6O.js} +1 -1
- package/dist/{chunk-JYXOEYI4.js → chunk-WW6DAGGR.js} +5 -5
- package/dist/{chunk-C427DVQF.js → chunk-WZG2SZOT.js} +22 -5
- package/dist/{chunk-NFYWLRUO.js → chunk-XH2RTYEQ.js} +3 -3
- package/dist/{chunk-2C4E3HBM.js → chunk-Z37APKBV.js} +5 -5
- package/dist/{chunk-RDRSWYNP.js → chunk-ZUVLC7TM.js} +1 -1
- package/dist/data.cjs +168 -24
- package/dist/data.js +8 -8
- package/dist/devtools.cjs +252 -32
- package/dist/devtools.js +7 -7
- package/dist/ecosystem.cjs +205 -64
- package/dist/ecosystem.js +10 -10
- package/dist/extras.cjs +245 -112
- package/dist/extras.js +24 -24
- package/dist/index.cjs +236 -105
- package/dist/index.d.cts +72 -8
- package/dist/index.d.ts +72 -8
- package/dist/index.js +14 -14
- package/dist/motion.cjs +336 -14
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +168 -24
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +305 -32
- package/dist/performance.js +8 -8
- package/dist/plugins.cjs +268 -69
- package/dist/plugins.js +12 -12
- package/dist/{ssr-2QDQ27EV.js → ssr-6D67RAVB.js} +3 -3
- package/dist/ssr.cjs +205 -63
- package/dist/ssr.js +11 -11
- package/dist/testing.cjs +415 -12
- package/dist/testing.js +16 -10
- package/dist/ui.cjs +248 -36
- package/dist/ui.js +9 -9
- package/dist/widgets.cjs +176 -26
- package/dist/widgets.js +8 -8
- package/package.json +1 -1
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);
|
|
@@ -173,7 +173,13 @@ function checkLeaks() {
|
|
|
173
173
|
|
|
174
174
|
// src/core/dev.ts
|
|
175
175
|
function isDev() {
|
|
176
|
-
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ :
|
|
176
|
+
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
177
|
+
// The bare `__SIBU_DEV__` is a bundler define that only exists in
|
|
178
|
+
// production builds; under the test runner it is always undefined, so
|
|
179
|
+
// this branch is unreachable here.
|
|
180
|
+
/* v8 ignore next 2 */
|
|
181
|
+
typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
182
|
+
);
|
|
177
183
|
}
|
|
178
184
|
var _isDev = isDev();
|
|
179
185
|
function devAssert(condition, message) {
|
|
@@ -187,7 +193,7 @@ function devWarn(message) {
|
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
195
|
|
|
190
|
-
// src/reactivity/track.ts
|
|
196
|
+
// src/reactivity/track-core.ts
|
|
191
197
|
var _isDev2 = isDev();
|
|
192
198
|
var POOL_MAX = 4096;
|
|
193
199
|
var nodePool = [];
|
|
@@ -271,6 +277,7 @@ function unlinkSub(node) {
|
|
|
271
277
|
else sub.depsTail = prev;
|
|
272
278
|
}
|
|
273
279
|
var currentSubscriber = null;
|
|
280
|
+
var suspendSavedSub = null;
|
|
274
281
|
var notifyDepth = 0;
|
|
275
282
|
var pendingQueue = [];
|
|
276
283
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
@@ -282,6 +289,35 @@ function safeInvoke(sub) {
|
|
|
282
289
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
283
290
|
}
|
|
284
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
|
+
}
|
|
285
321
|
var subscriberEpochCounter = 0;
|
|
286
322
|
function retrack(effectFn, subscriber) {
|
|
287
323
|
const prev = currentSubscriber;
|
|
@@ -314,6 +350,51 @@ function retrack(effectFn, subscriber) {
|
|
|
314
350
|
}
|
|
315
351
|
}
|
|
316
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
|
+
}
|
|
317
398
|
function recordDependency(signal2) {
|
|
318
399
|
if (!currentSubscriber) return;
|
|
319
400
|
const sub = currentSubscriber;
|
|
@@ -346,6 +427,16 @@ function cleanup(subscriber) {
|
|
|
346
427
|
var maxSubscriberRepeats = 50;
|
|
347
428
|
var maxDrainIterations = 1e6;
|
|
348
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
|
+
}
|
|
349
440
|
function tickRepeat(sub) {
|
|
350
441
|
const s = sub;
|
|
351
442
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -387,6 +478,20 @@ function drainQueue() {
|
|
|
387
478
|
safeInvoke(sub);
|
|
388
479
|
}
|
|
389
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
|
+
}
|
|
390
495
|
function propagateDirty(sub) {
|
|
391
496
|
sub();
|
|
392
497
|
const rootSig = sub._sig;
|
|
@@ -419,6 +524,22 @@ function propagateDirty(sub) {
|
|
|
419
524
|
}
|
|
420
525
|
}
|
|
421
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
|
+
}
|
|
422
543
|
function notifySubscribers(signal2) {
|
|
423
544
|
const sig = signal2;
|
|
424
545
|
const head = sig.subsHead;
|
|
@@ -486,18 +607,117 @@ function forEachSubscriber(signal2, visit) {
|
|
|
486
607
|
}
|
|
487
608
|
}
|
|
488
609
|
|
|
610
|
+
// src/reactivity/track.ts
|
|
611
|
+
var _isDev3 = isDev();
|
|
612
|
+
var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "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
|
+
|
|
489
668
|
// src/reactivity/batch.ts
|
|
490
669
|
var batchDepth = 0;
|
|
491
670
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
492
|
-
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) {
|
|
493
683
|
if (batchDepth === 0) return false;
|
|
494
684
|
pendingSignals.add(signal2);
|
|
495
685
|
return true;
|
|
496
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;
|
|
497
717
|
|
|
498
718
|
// src/core/signals/signal.ts
|
|
499
719
|
var _g = globalThis;
|
|
500
|
-
var
|
|
720
|
+
var _isDev4 = isDev();
|
|
501
721
|
function signal(initial, options) {
|
|
502
722
|
const state = {
|
|
503
723
|
value: initial,
|
|
@@ -508,11 +728,11 @@ function signal(initial, options) {
|
|
|
508
728
|
__activeNode: null,
|
|
509
729
|
__name: void 0
|
|
510
730
|
};
|
|
511
|
-
const debugName =
|
|
731
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
512
732
|
const equalsFn = options?.equals;
|
|
513
733
|
if (debugName) state.__name = debugName;
|
|
514
734
|
function get() {
|
|
515
|
-
|
|
735
|
+
recordDependency2(state);
|
|
516
736
|
return state.value;
|
|
517
737
|
}
|
|
518
738
|
get.__signal = state;
|
|
@@ -525,15 +745,15 @@ function signal(initial, options) {
|
|
|
525
745
|
if (equalsFn(prev, newValue)) return;
|
|
526
746
|
state.value = newValue;
|
|
527
747
|
state.__v++;
|
|
528
|
-
if (
|
|
748
|
+
if (_isDev4) {
|
|
529
749
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
530
750
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
531
751
|
}
|
|
532
752
|
if (!enqueueBatchedSignal(state)) {
|
|
533
|
-
|
|
753
|
+
notifySubscribers2(state);
|
|
534
754
|
}
|
|
535
755
|
};
|
|
536
|
-
} else if (
|
|
756
|
+
} else if (_isDev4) {
|
|
537
757
|
set = (next) => {
|
|
538
758
|
const prev = state.value;
|
|
539
759
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -543,7 +763,7 @@ function signal(initial, options) {
|
|
|
543
763
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
544
764
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
545
765
|
if (!enqueueBatchedSignal(state)) {
|
|
546
|
-
|
|
766
|
+
notifySubscribers2(state);
|
|
547
767
|
}
|
|
548
768
|
};
|
|
549
769
|
} else {
|
|
@@ -554,11 +774,11 @@ function signal(initial, options) {
|
|
|
554
774
|
state.value = newValue;
|
|
555
775
|
state.__v++;
|
|
556
776
|
if (!enqueueBatchedSignal(state)) {
|
|
557
|
-
|
|
777
|
+
notifySubscribers2(state);
|
|
558
778
|
}
|
|
559
779
|
};
|
|
560
780
|
}
|
|
561
|
-
if (
|
|
781
|
+
if (_isDev4) {
|
|
562
782
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
563
783
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
564
784
|
}
|
|
@@ -1202,7 +1422,7 @@ function devState(name, initial) {
|
|
|
1202
1422
|
|
|
1203
1423
|
// src/core/rendering/dispose.ts
|
|
1204
1424
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
1205
|
-
var
|
|
1425
|
+
var _isDev5 = isDev();
|
|
1206
1426
|
var activeBindingCount = 0;
|
|
1207
1427
|
function dispose(node) {
|
|
1208
1428
|
const stack = [node];
|
|
@@ -1221,12 +1441,12 @@ function dispose(node) {
|
|
|
1221
1441
|
if (disposers) {
|
|
1222
1442
|
const snapshot = disposers.slice();
|
|
1223
1443
|
elementDisposers.delete(current);
|
|
1224
|
-
if (
|
|
1444
|
+
if (_isDev5) activeBindingCount -= snapshot.length;
|
|
1225
1445
|
for (const d of snapshot) {
|
|
1226
1446
|
try {
|
|
1227
1447
|
d();
|
|
1228
1448
|
} catch (err) {
|
|
1229
|
-
if (
|
|
1449
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
1230
1450
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1231
1451
|
}
|
|
1232
1452
|
}
|
|
@@ -1237,12 +1457,12 @@ function dispose(node) {
|
|
|
1237
1457
|
if (!added || added.length === 0) break;
|
|
1238
1458
|
const moreSnapshot = added.slice();
|
|
1239
1459
|
elementDisposers.delete(current);
|
|
1240
|
-
if (
|
|
1460
|
+
if (_isDev5) activeBindingCount -= moreSnapshot.length;
|
|
1241
1461
|
for (const d of moreSnapshot) {
|
|
1242
1462
|
try {
|
|
1243
1463
|
d();
|
|
1244
1464
|
} catch (err) {
|
|
1245
|
-
if (
|
|
1465
|
+
if (_isDev5 && typeof console !== "undefined") {
|
|
1246
1466
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1247
1467
|
}
|
|
1248
1468
|
}
|
|
@@ -1595,7 +1815,7 @@ function drainReruns(ctx) {
|
|
|
1595
1815
|
do {
|
|
1596
1816
|
ctx.rerunPending = false;
|
|
1597
1817
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1598
|
-
|
|
1818
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
1599
1819
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
1600
1820
|
if (ctx.rerunPending) {
|
|
1601
1821
|
ctx.rerunPending = false;
|
|
@@ -1624,7 +1844,7 @@ function disposeEffect(ctx) {
|
|
|
1624
1844
|
}
|
|
1625
1845
|
}
|
|
1626
1846
|
try {
|
|
1627
|
-
|
|
1847
|
+
cleanup2(ctx.subscriber);
|
|
1628
1848
|
} catch (err) {
|
|
1629
1849
|
if (typeof console !== "undefined") {
|
|
1630
1850
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -1669,7 +1889,7 @@ function effect(effectFn, options) {
|
|
|
1669
1889
|
try {
|
|
1670
1890
|
ctx.rerunPending = false;
|
|
1671
1891
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
1672
|
-
|
|
1892
|
+
retrack2(ctx.bodyFn, sub);
|
|
1673
1893
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
1674
1894
|
} finally {
|
|
1675
1895
|
ctx.running = false;
|
|
@@ -1685,7 +1905,7 @@ function effect(effectFn, options) {
|
|
|
1685
1905
|
ctx.subscriber = sub;
|
|
1686
1906
|
ctx.running = true;
|
|
1687
1907
|
try {
|
|
1688
|
-
|
|
1908
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
1689
1909
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
1690
1910
|
} finally {
|
|
1691
1911
|
ctx.running = false;
|
|
@@ -1803,13 +2023,13 @@ function createDevtoolsOverlay(options) {
|
|
|
1803
2023
|
function getSignalName(getter) {
|
|
1804
2024
|
return getter.__name;
|
|
1805
2025
|
}
|
|
1806
|
-
function
|
|
2026
|
+
function getSubscriberCount3(getter) {
|
|
1807
2027
|
const signal2 = getter.__signal;
|
|
1808
2028
|
if (!signal2) return 0;
|
|
1809
|
-
return
|
|
2029
|
+
return getSubscriberCount2(signal2);
|
|
1810
2030
|
}
|
|
1811
2031
|
function getDependencies(subscriberFn) {
|
|
1812
|
-
return
|
|
2032
|
+
return getSubscriberDeps2(subscriberFn);
|
|
1813
2033
|
}
|
|
1814
2034
|
function inspectSignal(getter) {
|
|
1815
2035
|
const signal2 = getter.__signal;
|
|
@@ -1817,7 +2037,7 @@ function inspectSignal(getter) {
|
|
|
1817
2037
|
return {
|
|
1818
2038
|
name: getter.__name,
|
|
1819
2039
|
signal: signal2,
|
|
1820
|
-
subscriberCount:
|
|
2040
|
+
subscriberCount: getSubscriberCount2(signal2)
|
|
1821
2041
|
};
|
|
1822
2042
|
}
|
|
1823
2043
|
function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ new WeakSet()) {
|
|
@@ -1827,7 +2047,7 @@ function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ ne
|
|
|
1827
2047
|
}
|
|
1828
2048
|
visited.add(signal2);
|
|
1829
2049
|
const downstream = [];
|
|
1830
|
-
|
|
2050
|
+
forEachSubscriber2(signal2, (sub) => {
|
|
1831
2051
|
const subSig = sub._sig;
|
|
1832
2052
|
if (subSig && !visited.has(subSig)) {
|
|
1833
2053
|
const subName = subSig.__name;
|
|
@@ -1840,7 +2060,7 @@ function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ ne
|
|
|
1840
2060
|
});
|
|
1841
2061
|
return {
|
|
1842
2062
|
name: getSignalName(getter),
|
|
1843
|
-
subscribers:
|
|
2063
|
+
subscribers: getSubscriberCount2(signal2),
|
|
1844
2064
|
downstream
|
|
1845
2065
|
};
|
|
1846
2066
|
}
|
package/dist/devtools.js
CHANGED
|
@@ -35,16 +35,16 @@ import {
|
|
|
35
35
|
trackCleanup,
|
|
36
36
|
walkDependencyGraph,
|
|
37
37
|
withErrorTracking
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
38
|
+
} from "./chunk-ULLTNDRA.js";
|
|
39
|
+
import "./chunk-5VGSK6D2.js";
|
|
40
|
+
import "./chunk-L3GAGWCC.js";
|
|
41
|
+
import "./chunk-MHBCEJQO.js";
|
|
42
42
|
import "./chunk-GOJMFRBL.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-WZG2SZOT.js";
|
|
44
|
+
import "./chunk-TEFZT5PJ.js";
|
|
45
45
|
import {
|
|
46
46
|
isDev
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-COY6PUD2.js";
|
|
48
48
|
|
|
49
49
|
// src/devtools/signalGraph.ts
|
|
50
50
|
function getHook() {
|