sibujs 3.3.0 → 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 +210 -26
- package/dist/browser.js +4 -4
- package/dist/build.cjs +193 -89
- package/dist/build.js +10 -10
- package/dist/cdn.global.js +7 -7
- package/dist/{chunk-24DBWDTK.js → chunk-37BUKSLH.js} +1 -1
- package/dist/{chunk-IHBVTURX.js → chunk-4UUMSLSL.js} +4 -4
- package/dist/{chunk-USDR2GFV.js → chunk-6LTFHJQG.js} +3 -3
- package/dist/{chunk-MWZFOIBG.js → chunk-AMIKDMLP.js} +4 -4
- package/dist/{chunk-JBXNCZSC.js → chunk-F7FXQ3QS.js} +1 -1
- package/dist/{chunk-BEIKESVL.js → chunk-IKLYI3RF.js} +9 -9
- package/dist/{chunk-NUWKIEHE.js → chunk-LU2MQXQQ.js} +2 -2
- package/dist/{chunk-WVJJUFPC.js → chunk-M5KBNOSJ.js} +2 -2
- package/dist/{chunk-7JHWAGRQ.js → chunk-MHBCEJQO.js} +1 -1
- package/dist/{chunk-Q2ERM6NT.js → chunk-NHKQKKZU.js} +1 -1
- package/dist/{chunk-6G6UNHZI.js → chunk-RYMOSG5B.js} +5 -5
- package/dist/{chunk-F4UM7QBJ.js → chunk-SLMFA3ZZ.js} +1 -1
- package/dist/{chunk-X3NHE2DK.js → chunk-TEFZT5PJ.js} +83 -17
- package/dist/{chunk-SLCUP2EK.js → chunk-ULLTNDRA.js} +3 -3
- package/dist/{chunk-M6WSIGYW.js → chunk-VOVVTOEA.js} +2 -2
- package/dist/{chunk-XQ7XSGYP.js → chunk-WL7BIR6O.js} +1 -1
- package/dist/{chunk-CVMMULHO.js → chunk-WW6DAGGR.js} +4 -4
- package/dist/{chunk-5K72I3UQ.js → chunk-WZG2SZOT.js} +21 -4
- package/dist/{chunk-S4FHR5ZZ.js → chunk-XH2RTYEQ.js} +3 -3
- package/dist/{chunk-4WXWJ4SW.js → chunk-Z37APKBV.js} +4 -4
- package/dist/data.cjs +161 -23
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +245 -31
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +183 -45
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +185 -86
- package/dist/extras.js +19 -19
- package/dist/index.cjs +193 -89
- package/dist/index.d.cts +59 -8
- package/dist/index.d.ts +59 -8
- package/dist/index.js +10 -10
- package/dist/motion.cjs +329 -13
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +161 -23
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +258 -23
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +244 -51
- package/dist/plugins.js +6 -6
- package/dist/ssr.cjs +183 -44
- package/dist/ssr.js +7 -7
- package/dist/testing.cjs +396 -5
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +221 -32
- package/dist/ui.js +6 -6
- package/dist/widgets.cjs +146 -26
- package/dist/widgets.js +6 -6
- package/package.json +1 -1
package/dist/widgets.cjs
CHANGED
|
@@ -54,7 +54,7 @@ function devWarn(message) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// src/reactivity/track.ts
|
|
57
|
+
// src/reactivity/track-core.ts
|
|
58
58
|
var _isDev2 = isDev();
|
|
59
59
|
var POOL_MAX = 4096;
|
|
60
60
|
var nodePool = [];
|
|
@@ -168,6 +168,17 @@ function resumeTracking() {
|
|
|
168
168
|
trackingSuspended = false;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
function isTrackingSuspended() {
|
|
172
|
+
return trackingSuspended;
|
|
173
|
+
}
|
|
174
|
+
function untracked(fn) {
|
|
175
|
+
suspendTracking();
|
|
176
|
+
try {
|
|
177
|
+
return fn();
|
|
178
|
+
} finally {
|
|
179
|
+
resumeTracking();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
171
182
|
var subscriberEpochCounter = 0;
|
|
172
183
|
function retrack(effectFn, subscriber) {
|
|
173
184
|
const prev = currentSubscriber;
|
|
@@ -277,6 +288,16 @@ function cleanup(subscriber) {
|
|
|
277
288
|
var maxSubscriberRepeats = 50;
|
|
278
289
|
var maxDrainIterations = 1e6;
|
|
279
290
|
var drainEpoch = 0;
|
|
291
|
+
function setMaxSubscriberRepeats(n) {
|
|
292
|
+
const prev = maxSubscriberRepeats;
|
|
293
|
+
if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
|
|
294
|
+
return prev;
|
|
295
|
+
}
|
|
296
|
+
function setMaxDrainIterations(n) {
|
|
297
|
+
const prev = maxDrainIterations;
|
|
298
|
+
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
299
|
+
return prev;
|
|
300
|
+
}
|
|
280
301
|
function tickRepeat(sub) {
|
|
281
302
|
const s = sub;
|
|
282
303
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -425,6 +446,85 @@ function notifySubscribers(signal2) {
|
|
|
425
446
|
}
|
|
426
447
|
}
|
|
427
448
|
}
|
|
449
|
+
function getSubscriberCount(signal2) {
|
|
450
|
+
return signal2.__sc ?? 0;
|
|
451
|
+
}
|
|
452
|
+
function getSubscriberDeps(subscriber) {
|
|
453
|
+
const sub = subscriber;
|
|
454
|
+
const out = [];
|
|
455
|
+
let node = sub.depsHead ?? null;
|
|
456
|
+
while (node) {
|
|
457
|
+
if (node.sig) out.push(node.sig);
|
|
458
|
+
node = node.subNext;
|
|
459
|
+
}
|
|
460
|
+
return out;
|
|
461
|
+
}
|
|
462
|
+
function forEachSubscriber(signal2, visit) {
|
|
463
|
+
let node = signal2.subsHead ?? null;
|
|
464
|
+
while (node) {
|
|
465
|
+
const s = node.sub;
|
|
466
|
+
if (s) visit(s);
|
|
467
|
+
node = node.sigNext;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// src/reactivity/track.ts
|
|
472
|
+
var _isDev3 = isDev();
|
|
473
|
+
var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
|
|
474
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
475
|
+
function resolveReactiveApi() {
|
|
476
|
+
const g = globalThis;
|
|
477
|
+
const existing = g[REGISTRY_KEY];
|
|
478
|
+
if (existing) {
|
|
479
|
+
if (_isDev3 && !existing.__dupWarned) {
|
|
480
|
+
existing.__dupWarned = true;
|
|
481
|
+
devWarn(
|
|
482
|
+
`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']).`
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
return existing;
|
|
486
|
+
}
|
|
487
|
+
const local = {
|
|
488
|
+
suspendTracking,
|
|
489
|
+
resumeTracking,
|
|
490
|
+
isTrackingSuspended,
|
|
491
|
+
untracked,
|
|
492
|
+
retrack,
|
|
493
|
+
track,
|
|
494
|
+
reactiveBinding,
|
|
495
|
+
recordDependency,
|
|
496
|
+
cleanup,
|
|
497
|
+
setMaxSubscriberRepeats,
|
|
498
|
+
setMaxDrainIterations,
|
|
499
|
+
drainNotificationQueue,
|
|
500
|
+
queueSignalNotification,
|
|
501
|
+
notifySubscribers,
|
|
502
|
+
getSubscriberCount,
|
|
503
|
+
getSubscriberDeps,
|
|
504
|
+
forEachSubscriber,
|
|
505
|
+
version: _runtimeVersion
|
|
506
|
+
};
|
|
507
|
+
g[REGISTRY_KEY] = local;
|
|
508
|
+
return local;
|
|
509
|
+
}
|
|
510
|
+
var API = resolveReactiveApi();
|
|
511
|
+
var suspendTracking2 = API.suspendTracking;
|
|
512
|
+
var resumeTracking2 = API.resumeTracking;
|
|
513
|
+
var isTrackingSuspended2 = API.isTrackingSuspended;
|
|
514
|
+
var untracked2 = API.untracked;
|
|
515
|
+
var retrack2 = API.retrack;
|
|
516
|
+
var track2 = API.track;
|
|
517
|
+
var reactiveBinding2 = API.reactiveBinding;
|
|
518
|
+
var recordDependency2 = API.recordDependency;
|
|
519
|
+
var cleanup2 = API.cleanup;
|
|
520
|
+
var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
|
|
521
|
+
var setMaxDrainIterations2 = API.setMaxDrainIterations;
|
|
522
|
+
var drainNotificationQueue2 = API.drainNotificationQueue;
|
|
523
|
+
var queueSignalNotification2 = API.queueSignalNotification;
|
|
524
|
+
var notifySubscribers2 = API.notifySubscribers;
|
|
525
|
+
var getSubscriberCount2 = API.getSubscriberCount;
|
|
526
|
+
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
527
|
+
var forEachSubscriber2 = API.forEachSubscriber;
|
|
428
528
|
|
|
429
529
|
// src/core/signals/derived.ts
|
|
430
530
|
function derived(getter, options) {
|
|
@@ -448,7 +548,7 @@ function derived(getter, options) {
|
|
|
448
548
|
cs._d = false;
|
|
449
549
|
cs._init = true;
|
|
450
550
|
};
|
|
451
|
-
|
|
551
|
+
track2(() => {
|
|
452
552
|
let threw = true;
|
|
453
553
|
try {
|
|
454
554
|
cs._v = getter();
|
|
@@ -467,12 +567,12 @@ function derived(getter, options) {
|
|
|
467
567
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
468
568
|
);
|
|
469
569
|
}
|
|
470
|
-
if (
|
|
570
|
+
if (isTrackingSuspended2()) {
|
|
471
571
|
if (cs._d) {
|
|
472
572
|
const prev = cs._v;
|
|
473
573
|
evaluating = true;
|
|
474
574
|
try {
|
|
475
|
-
|
|
575
|
+
retrack2(recompute, markDirty);
|
|
476
576
|
if (!Object.is(prev, cs._v)) cs.__v++;
|
|
477
577
|
} finally {
|
|
478
578
|
evaluating = false;
|
|
@@ -480,12 +580,12 @@ function derived(getter, options) {
|
|
|
480
580
|
}
|
|
481
581
|
return cs._v;
|
|
482
582
|
}
|
|
483
|
-
|
|
583
|
+
recordDependency2(cs);
|
|
484
584
|
if (cs._d) {
|
|
485
585
|
const oldValue = cs._v;
|
|
486
586
|
evaluating = true;
|
|
487
587
|
try {
|
|
488
|
-
|
|
588
|
+
retrack2(recompute, markDirty);
|
|
489
589
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
490
590
|
} finally {
|
|
491
591
|
evaluating = false;
|
|
@@ -554,7 +654,7 @@ function drainReruns(ctx) {
|
|
|
554
654
|
do {
|
|
555
655
|
ctx.rerunPending = false;
|
|
556
656
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
557
|
-
|
|
657
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
558
658
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
559
659
|
if (ctx.rerunPending) {
|
|
560
660
|
ctx.rerunPending = false;
|
|
@@ -583,7 +683,7 @@ function disposeEffect(ctx) {
|
|
|
583
683
|
}
|
|
584
684
|
}
|
|
585
685
|
try {
|
|
586
|
-
|
|
686
|
+
cleanup2(ctx.subscriber);
|
|
587
687
|
} catch (err) {
|
|
588
688
|
if (typeof console !== "undefined") {
|
|
589
689
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -628,7 +728,7 @@ function effect(effectFn, options) {
|
|
|
628
728
|
try {
|
|
629
729
|
ctx.rerunPending = false;
|
|
630
730
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
631
|
-
|
|
731
|
+
retrack2(ctx.bodyFn, sub);
|
|
632
732
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
633
733
|
} finally {
|
|
634
734
|
ctx.running = false;
|
|
@@ -644,7 +744,7 @@ function effect(effectFn, options) {
|
|
|
644
744
|
ctx.subscriber = sub;
|
|
645
745
|
ctx.running = true;
|
|
646
746
|
try {
|
|
647
|
-
|
|
747
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
648
748
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
649
749
|
} finally {
|
|
650
750
|
ctx.running = false;
|
|
@@ -658,7 +758,7 @@ function effect(effectFn, options) {
|
|
|
658
758
|
// src/reactivity/batch.ts
|
|
659
759
|
var batchDepth = 0;
|
|
660
760
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
661
|
-
function
|
|
761
|
+
function batchImpl(fn) {
|
|
662
762
|
batchDepth++;
|
|
663
763
|
try {
|
|
664
764
|
return fn();
|
|
@@ -669,25 +769,45 @@ function batch(fn) {
|
|
|
669
769
|
}
|
|
670
770
|
}
|
|
671
771
|
}
|
|
672
|
-
function
|
|
772
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
673
773
|
if (batchDepth === 0) return false;
|
|
674
774
|
pendingSignals.add(signal2);
|
|
675
775
|
return true;
|
|
676
776
|
}
|
|
777
|
+
function isBatchingImpl() {
|
|
778
|
+
return batchDepth > 0;
|
|
779
|
+
}
|
|
677
780
|
function flushBatch() {
|
|
678
781
|
try {
|
|
679
782
|
for (const signal2 of pendingSignals) {
|
|
680
|
-
|
|
783
|
+
queueSignalNotification2(signal2);
|
|
681
784
|
}
|
|
682
785
|
} finally {
|
|
683
786
|
pendingSignals.clear();
|
|
684
787
|
}
|
|
685
|
-
|
|
788
|
+
drainNotificationQueue2();
|
|
686
789
|
}
|
|
790
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
791
|
+
function resolveBatchApi() {
|
|
792
|
+
const g = globalThis;
|
|
793
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
794
|
+
if (existing) return existing;
|
|
795
|
+
const local = {
|
|
796
|
+
batch: batchImpl,
|
|
797
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
798
|
+
isBatching: isBatchingImpl
|
|
799
|
+
};
|
|
800
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
801
|
+
return local;
|
|
802
|
+
}
|
|
803
|
+
var API2 = resolveBatchApi();
|
|
804
|
+
var batch = API2.batch;
|
|
805
|
+
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
806
|
+
var isBatching = API2.isBatching;
|
|
687
807
|
|
|
688
808
|
// src/core/signals/signal.ts
|
|
689
809
|
var _g2 = globalThis;
|
|
690
|
-
var
|
|
810
|
+
var _isDev4 = isDev();
|
|
691
811
|
function signal(initial, options) {
|
|
692
812
|
const state = {
|
|
693
813
|
value: initial,
|
|
@@ -698,11 +818,11 @@ function signal(initial, options) {
|
|
|
698
818
|
__activeNode: null,
|
|
699
819
|
__name: void 0
|
|
700
820
|
};
|
|
701
|
-
const debugName =
|
|
821
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
702
822
|
const equalsFn = options?.equals;
|
|
703
823
|
if (debugName) state.__name = debugName;
|
|
704
824
|
function get() {
|
|
705
|
-
|
|
825
|
+
recordDependency2(state);
|
|
706
826
|
return state.value;
|
|
707
827
|
}
|
|
708
828
|
get.__signal = state;
|
|
@@ -715,15 +835,15 @@ function signal(initial, options) {
|
|
|
715
835
|
if (equalsFn(prev, newValue)) return;
|
|
716
836
|
state.value = newValue;
|
|
717
837
|
state.__v++;
|
|
718
|
-
if (
|
|
838
|
+
if (_isDev4) {
|
|
719
839
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
720
840
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
721
841
|
}
|
|
722
842
|
if (!enqueueBatchedSignal(state)) {
|
|
723
|
-
|
|
843
|
+
notifySubscribers2(state);
|
|
724
844
|
}
|
|
725
845
|
};
|
|
726
|
-
} else if (
|
|
846
|
+
} else if (_isDev4) {
|
|
727
847
|
set = (next) => {
|
|
728
848
|
const prev = state.value;
|
|
729
849
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -733,7 +853,7 @@ function signal(initial, options) {
|
|
|
733
853
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
734
854
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
735
855
|
if (!enqueueBatchedSignal(state)) {
|
|
736
|
-
|
|
856
|
+
notifySubscribers2(state);
|
|
737
857
|
}
|
|
738
858
|
};
|
|
739
859
|
} else {
|
|
@@ -744,11 +864,11 @@ function signal(initial, options) {
|
|
|
744
864
|
state.value = newValue;
|
|
745
865
|
state.__v++;
|
|
746
866
|
if (!enqueueBatchedSignal(state)) {
|
|
747
|
-
|
|
867
|
+
notifySubscribers2(state);
|
|
748
868
|
}
|
|
749
869
|
};
|
|
750
870
|
}
|
|
751
|
-
if (
|
|
871
|
+
if (_isDev4) {
|
|
752
872
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
753
873
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
754
874
|
}
|
|
@@ -773,15 +893,15 @@ function watch(getter, callback) {
|
|
|
773
893
|
if (!Object.is(newValue, oldValue)) {
|
|
774
894
|
const prev = oldValue;
|
|
775
895
|
oldValue = newValue;
|
|
776
|
-
|
|
896
|
+
suspendTracking2();
|
|
777
897
|
try {
|
|
778
898
|
callback(newValue, prev);
|
|
779
899
|
} finally {
|
|
780
|
-
|
|
900
|
+
resumeTracking2();
|
|
781
901
|
}
|
|
782
902
|
}
|
|
783
903
|
};
|
|
784
|
-
const teardown =
|
|
904
|
+
const teardown = track2(subscriber);
|
|
785
905
|
return teardown;
|
|
786
906
|
}
|
|
787
907
|
|
package/dist/widgets.js
CHANGED
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
select,
|
|
9
9
|
tabs,
|
|
10
10
|
tooltip
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-Z37APKBV.js";
|
|
12
|
+
import "./chunk-SLMFA3ZZ.js";
|
|
13
|
+
import "./chunk-WW6DAGGR.js";
|
|
14
14
|
import "./chunk-L3GAGWCC.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-MHBCEJQO.js";
|
|
16
16
|
import "./chunk-GOJMFRBL.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-WZG2SZOT.js";
|
|
18
|
+
import "./chunk-TEFZT5PJ.js";
|
|
19
19
|
import "./chunk-COY6PUD2.js";
|
|
20
20
|
export {
|
|
21
21
|
accordion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sibujs",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "A lightweight, function-based frontend framework that combines the best of React, Svelte, and Vue — with zero VDOM and maximum simplicity. Designed for developers who want fine-grained reactivity and full control without compilation or magic.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"frontend",
|