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/ecosystem.cjs
CHANGED
|
@@ -53,7 +53,7 @@ function devWarn(message) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// src/reactivity/track.ts
|
|
56
|
+
// src/reactivity/track-core.ts
|
|
57
57
|
var _isDev2 = isDev();
|
|
58
58
|
var POOL_MAX = 4096;
|
|
59
59
|
var nodePool = [];
|
|
@@ -137,6 +137,7 @@ function unlinkSub(node) {
|
|
|
137
137
|
else sub.depsTail = prev;
|
|
138
138
|
}
|
|
139
139
|
var currentSubscriber = null;
|
|
140
|
+
var suspendSavedSub = null;
|
|
140
141
|
var notifyDepth = 0;
|
|
141
142
|
var pendingQueue = [];
|
|
142
143
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
@@ -148,7 +149,35 @@ function safeInvoke(sub) {
|
|
|
148
149
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
152
|
+
var suspendDepth = 0;
|
|
151
153
|
var trackingSuspended = false;
|
|
154
|
+
function suspendTracking() {
|
|
155
|
+
if (suspendDepth === 0) {
|
|
156
|
+
suspendSavedSub = currentSubscriber;
|
|
157
|
+
currentSubscriber = null;
|
|
158
|
+
trackingSuspended = true;
|
|
159
|
+
}
|
|
160
|
+
suspendDepth++;
|
|
161
|
+
}
|
|
162
|
+
function resumeTracking() {
|
|
163
|
+
suspendDepth--;
|
|
164
|
+
if (suspendDepth === 0) {
|
|
165
|
+
currentSubscriber = suspendSavedSub;
|
|
166
|
+
suspendSavedSub = null;
|
|
167
|
+
trackingSuspended = false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function isTrackingSuspended() {
|
|
171
|
+
return trackingSuspended;
|
|
172
|
+
}
|
|
173
|
+
function untracked(fn) {
|
|
174
|
+
suspendTracking();
|
|
175
|
+
try {
|
|
176
|
+
return fn();
|
|
177
|
+
} finally {
|
|
178
|
+
resumeTracking();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
152
181
|
var subscriberEpochCounter = 0;
|
|
153
182
|
function retrack(effectFn, subscriber) {
|
|
154
183
|
const prev = currentSubscriber;
|
|
@@ -258,6 +287,16 @@ function cleanup(subscriber) {
|
|
|
258
287
|
var maxSubscriberRepeats = 50;
|
|
259
288
|
var maxDrainIterations = 1e6;
|
|
260
289
|
var drainEpoch = 0;
|
|
290
|
+
function setMaxSubscriberRepeats(n) {
|
|
291
|
+
const prev = maxSubscriberRepeats;
|
|
292
|
+
if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
|
|
293
|
+
return prev;
|
|
294
|
+
}
|
|
295
|
+
function setMaxDrainIterations(n) {
|
|
296
|
+
const prev = maxDrainIterations;
|
|
297
|
+
if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
|
|
298
|
+
return prev;
|
|
299
|
+
}
|
|
261
300
|
function tickRepeat(sub) {
|
|
262
301
|
const s = sub;
|
|
263
302
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -406,25 +445,110 @@ function notifySubscribers(signal2) {
|
|
|
406
445
|
}
|
|
407
446
|
}
|
|
408
447
|
}
|
|
448
|
+
function getSubscriberCount(signal2) {
|
|
449
|
+
return signal2.__sc ?? 0;
|
|
450
|
+
}
|
|
451
|
+
function getSubscriberDeps(subscriber) {
|
|
452
|
+
const sub = subscriber;
|
|
453
|
+
const out = [];
|
|
454
|
+
let node = sub.depsHead ?? null;
|
|
455
|
+
while (node) {
|
|
456
|
+
if (node.sig) out.push(node.sig);
|
|
457
|
+
node = node.subNext;
|
|
458
|
+
}
|
|
459
|
+
return out;
|
|
460
|
+
}
|
|
461
|
+
function forEachSubscriber(signal2, visit) {
|
|
462
|
+
let node = signal2.subsHead ?? null;
|
|
463
|
+
while (node) {
|
|
464
|
+
const s = node.sub;
|
|
465
|
+
if (s) visit(s);
|
|
466
|
+
node = node.sigNext;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// src/reactivity/track.ts
|
|
471
|
+
var _isDev3 = isDev();
|
|
472
|
+
var _runtimeVersion = true ? "3.3.2" : "dev";
|
|
473
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
474
|
+
function resolveReactiveApi() {
|
|
475
|
+
const g = globalThis;
|
|
476
|
+
const existing = g[REGISTRY_KEY];
|
|
477
|
+
if (existing) {
|
|
478
|
+
if (_isDev3 && !existing.__dupWarned) {
|
|
479
|
+
existing.__dupWarned = true;
|
|
480
|
+
devWarn(
|
|
481
|
+
`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']).`
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
return existing;
|
|
485
|
+
}
|
|
486
|
+
const local = {
|
|
487
|
+
suspendTracking,
|
|
488
|
+
resumeTracking,
|
|
489
|
+
isTrackingSuspended,
|
|
490
|
+
untracked,
|
|
491
|
+
retrack,
|
|
492
|
+
track,
|
|
493
|
+
reactiveBinding,
|
|
494
|
+
recordDependency,
|
|
495
|
+
cleanup,
|
|
496
|
+
setMaxSubscriberRepeats,
|
|
497
|
+
setMaxDrainIterations,
|
|
498
|
+
drainNotificationQueue,
|
|
499
|
+
queueSignalNotification,
|
|
500
|
+
notifySubscribers,
|
|
501
|
+
getSubscriberCount,
|
|
502
|
+
getSubscriberDeps,
|
|
503
|
+
forEachSubscriber,
|
|
504
|
+
version: _runtimeVersion
|
|
505
|
+
};
|
|
506
|
+
g[REGISTRY_KEY] = local;
|
|
507
|
+
return local;
|
|
508
|
+
}
|
|
509
|
+
var API = resolveReactiveApi();
|
|
510
|
+
var suspendTracking2 = API.suspendTracking;
|
|
511
|
+
var resumeTracking2 = API.resumeTracking;
|
|
512
|
+
var isTrackingSuspended2 = API.isTrackingSuspended;
|
|
513
|
+
var untracked2 = API.untracked;
|
|
514
|
+
var retrack2 = API.retrack;
|
|
515
|
+
var track2 = API.track;
|
|
516
|
+
var reactiveBinding2 = API.reactiveBinding;
|
|
517
|
+
var recordDependency2 = API.recordDependency;
|
|
518
|
+
var cleanup2 = API.cleanup;
|
|
519
|
+
var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
|
|
520
|
+
var setMaxDrainIterations2 = API.setMaxDrainIterations;
|
|
521
|
+
var drainNotificationQueue2 = API.drainNotificationQueue;
|
|
522
|
+
var queueSignalNotification2 = API.queueSignalNotification;
|
|
523
|
+
var notifySubscribers2 = API.notifySubscribers;
|
|
524
|
+
var getSubscriberCount2 = API.getSubscriberCount;
|
|
525
|
+
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
526
|
+
var forEachSubscriber2 = API.forEachSubscriber;
|
|
409
527
|
|
|
410
528
|
// src/core/ssr-context.ts
|
|
411
|
-
var
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
529
|
+
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
530
|
+
function detectSSRShared() {
|
|
531
|
+
let detected = null;
|
|
532
|
+
try {
|
|
533
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
534
|
+
let mod = null;
|
|
535
|
+
const getBuiltin = process.getBuiltinModule;
|
|
536
|
+
if (typeof getBuiltin === "function") {
|
|
537
|
+
mod = getBuiltin("node:async_hooks");
|
|
538
|
+
} else {
|
|
539
|
+
const req = Function("return typeof require==='function'?require:null")();
|
|
540
|
+
if (req) mod = req("node:async_hooks");
|
|
541
|
+
}
|
|
542
|
+
if (mod) detected = new mod.AsyncLocalStorage();
|
|
421
543
|
}
|
|
422
|
-
|
|
544
|
+
} catch {
|
|
545
|
+
detected = null;
|
|
423
546
|
}
|
|
424
|
-
|
|
425
|
-
als = null;
|
|
547
|
+
return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
|
|
426
548
|
}
|
|
427
|
-
var
|
|
549
|
+
var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
|
|
550
|
+
var als = _shared.als;
|
|
551
|
+
var fallbackStore = _shared.fallbackStore;
|
|
428
552
|
function getSSRStore() {
|
|
429
553
|
if (als) {
|
|
430
554
|
const s = als.getStore();
|
|
@@ -456,7 +580,7 @@ function drainReruns(ctx) {
|
|
|
456
580
|
do {
|
|
457
581
|
ctx.rerunPending = false;
|
|
458
582
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
459
|
-
|
|
583
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
460
584
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
461
585
|
if (ctx.rerunPending) {
|
|
462
586
|
ctx.rerunPending = false;
|
|
@@ -485,7 +609,7 @@ function disposeEffect(ctx) {
|
|
|
485
609
|
}
|
|
486
610
|
}
|
|
487
611
|
try {
|
|
488
|
-
|
|
612
|
+
cleanup2(ctx.subscriber);
|
|
489
613
|
} catch (err) {
|
|
490
614
|
if (typeof console !== "undefined") {
|
|
491
615
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -530,7 +654,7 @@ function effect(effectFn, options) {
|
|
|
530
654
|
try {
|
|
531
655
|
ctx.rerunPending = false;
|
|
532
656
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
533
|
-
|
|
657
|
+
retrack2(ctx.bodyFn, sub);
|
|
534
658
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
535
659
|
} finally {
|
|
536
660
|
ctx.running = false;
|
|
@@ -546,7 +670,7 @@ function effect(effectFn, options) {
|
|
|
546
670
|
ctx.subscriber = sub;
|
|
547
671
|
ctx.running = true;
|
|
548
672
|
try {
|
|
549
|
-
|
|
673
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
550
674
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
551
675
|
} finally {
|
|
552
676
|
ctx.running = false;
|
|
@@ -560,7 +684,7 @@ function effect(effectFn, options) {
|
|
|
560
684
|
// src/reactivity/batch.ts
|
|
561
685
|
var batchDepth = 0;
|
|
562
686
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
563
|
-
function
|
|
687
|
+
function batchImpl(fn) {
|
|
564
688
|
batchDepth++;
|
|
565
689
|
try {
|
|
566
690
|
return fn();
|
|
@@ -571,25 +695,45 @@ function batch(fn) {
|
|
|
571
695
|
}
|
|
572
696
|
}
|
|
573
697
|
}
|
|
574
|
-
function
|
|
698
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
575
699
|
if (batchDepth === 0) return false;
|
|
576
700
|
pendingSignals.add(signal2);
|
|
577
701
|
return true;
|
|
578
702
|
}
|
|
703
|
+
function isBatchingImpl() {
|
|
704
|
+
return batchDepth > 0;
|
|
705
|
+
}
|
|
579
706
|
function flushBatch() {
|
|
580
707
|
try {
|
|
581
708
|
for (const signal2 of pendingSignals) {
|
|
582
|
-
|
|
709
|
+
queueSignalNotification2(signal2);
|
|
583
710
|
}
|
|
584
711
|
} finally {
|
|
585
712
|
pendingSignals.clear();
|
|
586
713
|
}
|
|
587
|
-
|
|
714
|
+
drainNotificationQueue2();
|
|
715
|
+
}
|
|
716
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
717
|
+
function resolveBatchApi() {
|
|
718
|
+
const g = globalThis;
|
|
719
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
720
|
+
if (existing) return existing;
|
|
721
|
+
const local = {
|
|
722
|
+
batch: batchImpl,
|
|
723
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
724
|
+
isBatching: isBatchingImpl
|
|
725
|
+
};
|
|
726
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
727
|
+
return local;
|
|
588
728
|
}
|
|
729
|
+
var API2 = resolveBatchApi();
|
|
730
|
+
var batch = API2.batch;
|
|
731
|
+
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
732
|
+
var isBatching = API2.isBatching;
|
|
589
733
|
|
|
590
734
|
// src/core/signals/signal.ts
|
|
591
735
|
var _g2 = globalThis;
|
|
592
|
-
var
|
|
736
|
+
var _isDev4 = isDev();
|
|
593
737
|
function signal(initial, options) {
|
|
594
738
|
const state = {
|
|
595
739
|
value: initial,
|
|
@@ -600,11 +744,11 @@ function signal(initial, options) {
|
|
|
600
744
|
__activeNode: null,
|
|
601
745
|
__name: void 0
|
|
602
746
|
};
|
|
603
|
-
const debugName =
|
|
747
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
604
748
|
const equalsFn = options?.equals;
|
|
605
749
|
if (debugName) state.__name = debugName;
|
|
606
750
|
function get() {
|
|
607
|
-
|
|
751
|
+
recordDependency2(state);
|
|
608
752
|
return state.value;
|
|
609
753
|
}
|
|
610
754
|
get.__signal = state;
|
|
@@ -617,15 +761,15 @@ function signal(initial, options) {
|
|
|
617
761
|
if (equalsFn(prev, newValue)) return;
|
|
618
762
|
state.value = newValue;
|
|
619
763
|
state.__v++;
|
|
620
|
-
if (
|
|
764
|
+
if (_isDev4) {
|
|
621
765
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
622
766
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
623
767
|
}
|
|
624
768
|
if (!enqueueBatchedSignal(state)) {
|
|
625
|
-
|
|
769
|
+
notifySubscribers2(state);
|
|
626
770
|
}
|
|
627
771
|
};
|
|
628
|
-
} else if (
|
|
772
|
+
} else if (_isDev4) {
|
|
629
773
|
set = (next) => {
|
|
630
774
|
const prev = state.value;
|
|
631
775
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -635,7 +779,7 @@ function signal(initial, options) {
|
|
|
635
779
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
636
780
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
637
781
|
if (!enqueueBatchedSignal(state)) {
|
|
638
|
-
|
|
782
|
+
notifySubscribers2(state);
|
|
639
783
|
}
|
|
640
784
|
};
|
|
641
785
|
} else {
|
|
@@ -646,11 +790,11 @@ function signal(initial, options) {
|
|
|
646
790
|
state.value = newValue;
|
|
647
791
|
state.__v++;
|
|
648
792
|
if (!enqueueBatchedSignal(state)) {
|
|
649
|
-
|
|
793
|
+
notifySubscribers2(state);
|
|
650
794
|
}
|
|
651
795
|
};
|
|
652
796
|
}
|
|
653
|
-
if (
|
|
797
|
+
if (_isDev4) {
|
|
654
798
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
655
799
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
656
800
|
}
|
|
@@ -809,7 +953,7 @@ function derived(getter, options) {
|
|
|
809
953
|
cs._d = false;
|
|
810
954
|
cs._init = true;
|
|
811
955
|
};
|
|
812
|
-
|
|
956
|
+
track2(() => {
|
|
813
957
|
let threw = true;
|
|
814
958
|
try {
|
|
815
959
|
cs._v = getter();
|
|
@@ -828,12 +972,12 @@ function derived(getter, options) {
|
|
|
828
972
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
829
973
|
);
|
|
830
974
|
}
|
|
831
|
-
if (
|
|
975
|
+
if (isTrackingSuspended2()) {
|
|
832
976
|
if (cs._d) {
|
|
833
977
|
const prev = cs._v;
|
|
834
978
|
evaluating = true;
|
|
835
979
|
try {
|
|
836
|
-
|
|
980
|
+
retrack2(recompute, markDirty);
|
|
837
981
|
if (!Object.is(prev, cs._v)) cs.__v++;
|
|
838
982
|
} finally {
|
|
839
983
|
evaluating = false;
|
|
@@ -841,12 +985,12 @@ function derived(getter, options) {
|
|
|
841
985
|
}
|
|
842
986
|
return cs._v;
|
|
843
987
|
}
|
|
844
|
-
|
|
988
|
+
recordDependency2(cs);
|
|
845
989
|
if (cs._d) {
|
|
846
990
|
const oldValue = cs._v;
|
|
847
991
|
evaluating = true;
|
|
848
992
|
try {
|
|
849
|
-
|
|
993
|
+
retrack2(recompute, markDirty);
|
|
850
994
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
851
995
|
} finally {
|
|
852
996
|
evaluating = false;
|
|
@@ -998,13 +1142,13 @@ function sanitizeAttributeString(attr, value) {
|
|
|
998
1142
|
}
|
|
999
1143
|
|
|
1000
1144
|
// src/reactivity/bindAttribute.ts
|
|
1001
|
-
var
|
|
1145
|
+
var _isDev5 = isDev();
|
|
1002
1146
|
function setProp(el, key, val) {
|
|
1003
1147
|
el[key] = val;
|
|
1004
1148
|
}
|
|
1005
1149
|
function bindAttribute(el, attr, getter) {
|
|
1006
1150
|
if (isEventHandlerAttr(attr)) {
|
|
1007
|
-
if (
|
|
1151
|
+
if (_isDev5)
|
|
1008
1152
|
devWarn(
|
|
1009
1153
|
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
1010
1154
|
);
|
|
@@ -1016,7 +1160,7 @@ function bindAttribute(el, attr, getter) {
|
|
|
1016
1160
|
try {
|
|
1017
1161
|
value = getter();
|
|
1018
1162
|
} catch (err) {
|
|
1019
|
-
if (
|
|
1163
|
+
if (_isDev5)
|
|
1020
1164
|
devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1021
1165
|
return;
|
|
1022
1166
|
}
|
|
@@ -1037,12 +1181,12 @@ function bindAttribute(el, attr, getter) {
|
|
|
1037
1181
|
el.setAttribute(attr, sanitizeAttributeString(attr, str));
|
|
1038
1182
|
}
|
|
1039
1183
|
}
|
|
1040
|
-
return
|
|
1184
|
+
return reactiveBinding2(commit);
|
|
1041
1185
|
}
|
|
1042
1186
|
|
|
1043
1187
|
// src/core/rendering/dispose.ts
|
|
1044
1188
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
1045
|
-
var
|
|
1189
|
+
var _isDev6 = isDev();
|
|
1046
1190
|
var activeBindingCount = 0;
|
|
1047
1191
|
function registerDisposer(node, teardown) {
|
|
1048
1192
|
let disposers = elementDisposers.get(node);
|
|
@@ -1051,7 +1195,7 @@ function registerDisposer(node, teardown) {
|
|
|
1051
1195
|
elementDisposers.set(node, disposers);
|
|
1052
1196
|
}
|
|
1053
1197
|
disposers.push(teardown);
|
|
1054
|
-
if (
|
|
1198
|
+
if (_isDev6) activeBindingCount++;
|
|
1055
1199
|
}
|
|
1056
1200
|
function dispose(node) {
|
|
1057
1201
|
const stack = [node];
|
|
@@ -1070,12 +1214,12 @@ function dispose(node) {
|
|
|
1070
1214
|
if (disposers) {
|
|
1071
1215
|
const snapshot = disposers.slice();
|
|
1072
1216
|
elementDisposers.delete(current);
|
|
1073
|
-
if (
|
|
1217
|
+
if (_isDev6) activeBindingCount -= snapshot.length;
|
|
1074
1218
|
for (const d of snapshot) {
|
|
1075
1219
|
try {
|
|
1076
1220
|
d();
|
|
1077
1221
|
} catch (err) {
|
|
1078
|
-
if (
|
|
1222
|
+
if (_isDev6 && typeof console !== "undefined") {
|
|
1079
1223
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1080
1224
|
}
|
|
1081
1225
|
}
|
|
@@ -1086,12 +1230,12 @@ function dispose(node) {
|
|
|
1086
1230
|
if (!added || added.length === 0) break;
|
|
1087
1231
|
const moreSnapshot = added.slice();
|
|
1088
1232
|
elementDisposers.delete(current);
|
|
1089
|
-
if (
|
|
1233
|
+
if (_isDev6) activeBindingCount -= moreSnapshot.length;
|
|
1090
1234
|
for (const d of moreSnapshot) {
|
|
1091
1235
|
try {
|
|
1092
1236
|
d();
|
|
1093
1237
|
} catch (err) {
|
|
1094
|
-
if (
|
|
1238
|
+
if (_isDev6 && typeof console !== "undefined") {
|
|
1095
1239
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1096
1240
|
}
|
|
1097
1241
|
}
|
|
@@ -1102,7 +1246,7 @@ function dispose(node) {
|
|
|
1102
1246
|
}
|
|
1103
1247
|
|
|
1104
1248
|
// src/reactivity/bindChildNode.ts
|
|
1105
|
-
var
|
|
1249
|
+
var _isDev7 = isDev();
|
|
1106
1250
|
function bindChildNode(placeholder, getter) {
|
|
1107
1251
|
let lastNodes = [];
|
|
1108
1252
|
function commit() {
|
|
@@ -1110,7 +1254,7 @@ function bindChildNode(placeholder, getter) {
|
|
|
1110
1254
|
try {
|
|
1111
1255
|
result = getter();
|
|
1112
1256
|
} catch (err) {
|
|
1113
|
-
if (
|
|
1257
|
+
if (_isDev7) devWarn(`bindChildNode: getter threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1114
1258
|
return;
|
|
1115
1259
|
}
|
|
1116
1260
|
if (result == null || typeof result === "boolean") {
|
|
@@ -1136,7 +1280,7 @@ function bindChildNode(placeholder, getter) {
|
|
|
1136
1280
|
if (item == null || typeof item === "boolean") continue;
|
|
1137
1281
|
const node = item instanceof Node ? item : document.createTextNode(String(item));
|
|
1138
1282
|
if (seen.has(node)) {
|
|
1139
|
-
if (
|
|
1283
|
+
if (_isDev7)
|
|
1140
1284
|
devWarn("bindChildNode: duplicate node reference in array \u2014 only the first occurrence is rendered.");
|
|
1141
1285
|
continue;
|
|
1142
1286
|
}
|
|
@@ -1171,11 +1315,11 @@ function bindChildNode(placeholder, getter) {
|
|
|
1171
1315
|
}
|
|
1172
1316
|
lastNodes = newNodes;
|
|
1173
1317
|
}
|
|
1174
|
-
return
|
|
1318
|
+
return reactiveBinding2(commit);
|
|
1175
1319
|
}
|
|
1176
1320
|
|
|
1177
1321
|
// src/core/rendering/tagFactory.ts
|
|
1178
|
-
var
|
|
1322
|
+
var _isDev8 = isDev();
|
|
1179
1323
|
var BLOCKED_TAGS = /* @__PURE__ */ new Set(["script", "iframe", "object", "embed", "frame", "frameset"]);
|
|
1180
1324
|
function isBlockedTag(tag) {
|
|
1181
1325
|
return BLOCKED_TAGS.has(tag.toLowerCase());
|
|
@@ -1218,7 +1362,7 @@ function toKebab(prop) {
|
|
|
1218
1362
|
}
|
|
1219
1363
|
function applyStyle(el, style) {
|
|
1220
1364
|
if (typeof style === "function") {
|
|
1221
|
-
const teardown =
|
|
1365
|
+
const teardown = track2(() => {
|
|
1222
1366
|
el.setAttribute("style", style());
|
|
1223
1367
|
});
|
|
1224
1368
|
registerDisposer(el, teardown);
|
|
@@ -1234,7 +1378,7 @@ function applyStyle(el, style) {
|
|
|
1234
1378
|
const name = toKebab(prop);
|
|
1235
1379
|
if (typeof val === "function") {
|
|
1236
1380
|
const getter = val;
|
|
1237
|
-
const teardown =
|
|
1381
|
+
const teardown = track2(() => {
|
|
1238
1382
|
htmlEl.style.setProperty(name, sanitizeCSSValue(String(getter())));
|
|
1239
1383
|
});
|
|
1240
1384
|
registerDisposer(el, teardown);
|
|
@@ -1249,7 +1393,7 @@ function applyClass(el, cls) {
|
|
|
1249
1393
|
return;
|
|
1250
1394
|
}
|
|
1251
1395
|
if (typeof cls === "function") {
|
|
1252
|
-
const teardown =
|
|
1396
|
+
const teardown = track2(() => {
|
|
1253
1397
|
el.setAttribute("class", cls());
|
|
1254
1398
|
});
|
|
1255
1399
|
registerDisposer(el, teardown);
|
|
@@ -1276,7 +1420,7 @@ function applyClass(el, cls) {
|
|
|
1276
1420
|
}
|
|
1277
1421
|
el.setAttribute("class", r);
|
|
1278
1422
|
};
|
|
1279
|
-
const teardown =
|
|
1423
|
+
const teardown = track2(update);
|
|
1280
1424
|
registerDisposer(el, teardown);
|
|
1281
1425
|
} else {
|
|
1282
1426
|
el.setAttribute("class", result);
|
|
@@ -1346,7 +1490,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1346
1490
|
appendChildren(el, second);
|
|
1347
1491
|
return el;
|
|
1348
1492
|
}
|
|
1349
|
-
if (
|
|
1493
|
+
if (_isDev8 && looksLikeClassList(first)) {
|
|
1350
1494
|
devWarn(
|
|
1351
1495
|
`tagFactory: lone string "${first}" looks like a class list but is being rendered as TEXT. For a class, use ${tag}({ class: "${first}" }) \u2014 or ${tag}("${first}", children) to set the class AND add children.`
|
|
1352
1496
|
);
|
|
@@ -1367,7 +1511,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1367
1511
|
if (pClass != null) applyClass(el, pClass);
|
|
1368
1512
|
const pId = props.id;
|
|
1369
1513
|
if (pId != null) {
|
|
1370
|
-
if (
|
|
1514
|
+
if (_isDev8 && typeof pId === "string" && CLOBBER_RISKY_IDS.has(pId.toLowerCase())) {
|
|
1371
1515
|
devWarn(
|
|
1372
1516
|
`tagFactory: element id="${pId}" matches a common global and may cause DOM clobbering. Avoid setting ids from untrusted input.`
|
|
1373
1517
|
);
|
|
@@ -1382,7 +1526,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1382
1526
|
const handler = pOn[ev];
|
|
1383
1527
|
if (typeof handler === "function") {
|
|
1384
1528
|
el.addEventListener(ev, handler);
|
|
1385
|
-
} else if (
|
|
1529
|
+
} else if (_isDev8) {
|
|
1386
1530
|
devWarn(
|
|
1387
1531
|
`tagFactory: on.${ev} handler is not a function (got ${typeof handler}). Event listener was not attached.`
|
|
1388
1532
|
);
|
package/dist/ecosystem.js
CHANGED
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P7C7SEJV.js";
|
|
11
11
|
import "./chunk-3JHCYHWN.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZEUP4TUD.js";
|
|
13
|
+
import "./chunk-QCFBIVIQ.js";
|
|
14
|
+
import "./chunk-G6N3LMO2.js";
|
|
15
15
|
import "./chunk-5VGSK6D2.js";
|
|
16
16
|
import "./chunk-L3GAGWCC.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-N5TQVEKE.js";
|
|
18
|
+
import "./chunk-S3NFJO6L.js";
|
|
19
|
+
import "./chunk-JCQG2I2G.js";
|
|
20
|
+
import "./chunk-4NJEAPLI.js";
|
|
21
21
|
import "./chunk-COY6PUD2.js";
|
|
22
22
|
export {
|
|
23
23
|
antdAdapter,
|