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/ecosystem.cjs
CHANGED
|
@@ -33,7 +33,13 @@ module.exports = __toCommonJS(ecosystem_exports);
|
|
|
33
33
|
|
|
34
34
|
// src/core/dev.ts
|
|
35
35
|
function isDev() {
|
|
36
|
-
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ :
|
|
36
|
+
return typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
37
|
+
// The bare `__SIBU_DEV__` is a bundler define that only exists in
|
|
38
|
+
// production builds; under the test runner it is always undefined, so
|
|
39
|
+
// this branch is unreachable here.
|
|
40
|
+
/* v8 ignore next 2 */
|
|
41
|
+
typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
42
|
+
);
|
|
37
43
|
}
|
|
38
44
|
var _isDev = isDev();
|
|
39
45
|
function devAssert(condition, message) {
|
|
@@ -47,7 +53,7 @@ function devWarn(message) {
|
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
// src/reactivity/track.ts
|
|
56
|
+
// src/reactivity/track-core.ts
|
|
51
57
|
var _isDev2 = isDev();
|
|
52
58
|
var POOL_MAX = 4096;
|
|
53
59
|
var nodePool = [];
|
|
@@ -131,6 +137,7 @@ function unlinkSub(node) {
|
|
|
131
137
|
else sub.depsTail = prev;
|
|
132
138
|
}
|
|
133
139
|
var currentSubscriber = null;
|
|
140
|
+
var suspendSavedSub = null;
|
|
134
141
|
var notifyDepth = 0;
|
|
135
142
|
var pendingQueue = [];
|
|
136
143
|
var pendingSet = /* @__PURE__ */ new Set();
|
|
@@ -142,7 +149,35 @@ function safeInvoke(sub) {
|
|
|
142
149
|
if (_isDev2) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
143
150
|
}
|
|
144
151
|
}
|
|
152
|
+
var suspendDepth = 0;
|
|
145
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
|
+
}
|
|
146
181
|
var subscriberEpochCounter = 0;
|
|
147
182
|
function retrack(effectFn, subscriber) {
|
|
148
183
|
const prev = currentSubscriber;
|
|
@@ -252,6 +287,16 @@ function cleanup(subscriber) {
|
|
|
252
287
|
var maxSubscriberRepeats = 50;
|
|
253
288
|
var maxDrainIterations = 1e6;
|
|
254
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
|
+
}
|
|
255
300
|
function tickRepeat(sub) {
|
|
256
301
|
const s = sub;
|
|
257
302
|
if (s._runEpoch !== drainEpoch) {
|
|
@@ -400,6 +445,85 @@ function notifySubscribers(signal2) {
|
|
|
400
445
|
}
|
|
401
446
|
}
|
|
402
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 = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "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;
|
|
403
527
|
|
|
404
528
|
// src/core/ssr-context.ts
|
|
405
529
|
var als = null;
|
|
@@ -450,7 +574,7 @@ function drainReruns(ctx) {
|
|
|
450
574
|
do {
|
|
451
575
|
ctx.rerunPending = false;
|
|
452
576
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
453
|
-
|
|
577
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
454
578
|
} while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
|
|
455
579
|
if (ctx.rerunPending) {
|
|
456
580
|
ctx.rerunPending = false;
|
|
@@ -479,7 +603,7 @@ function disposeEffect(ctx) {
|
|
|
479
603
|
}
|
|
480
604
|
}
|
|
481
605
|
try {
|
|
482
|
-
|
|
606
|
+
cleanup2(ctx.subscriber);
|
|
483
607
|
} catch (err) {
|
|
484
608
|
if (typeof console !== "undefined") {
|
|
485
609
|
console.warn("[SibuJS effect] dispose threw:", err);
|
|
@@ -524,7 +648,7 @@ function effect(effectFn, options) {
|
|
|
524
648
|
try {
|
|
525
649
|
ctx.rerunPending = false;
|
|
526
650
|
if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
|
|
527
|
-
|
|
651
|
+
retrack2(ctx.bodyFn, sub);
|
|
528
652
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
529
653
|
} finally {
|
|
530
654
|
ctx.running = false;
|
|
@@ -540,7 +664,7 @@ function effect(effectFn, options) {
|
|
|
540
664
|
ctx.subscriber = sub;
|
|
541
665
|
ctx.running = true;
|
|
542
666
|
try {
|
|
543
|
-
|
|
667
|
+
retrack2(ctx.bodyFn, ctx.subscriber);
|
|
544
668
|
if (ctx.rerunPending) drainReruns(ctx);
|
|
545
669
|
} finally {
|
|
546
670
|
ctx.running = false;
|
|
@@ -554,7 +678,7 @@ function effect(effectFn, options) {
|
|
|
554
678
|
// src/reactivity/batch.ts
|
|
555
679
|
var batchDepth = 0;
|
|
556
680
|
var pendingSignals = /* @__PURE__ */ new Set();
|
|
557
|
-
function
|
|
681
|
+
function batchImpl(fn) {
|
|
558
682
|
batchDepth++;
|
|
559
683
|
try {
|
|
560
684
|
return fn();
|
|
@@ -565,25 +689,45 @@ function batch(fn) {
|
|
|
565
689
|
}
|
|
566
690
|
}
|
|
567
691
|
}
|
|
568
|
-
function
|
|
692
|
+
function enqueueBatchedSignalImpl(signal2) {
|
|
569
693
|
if (batchDepth === 0) return false;
|
|
570
694
|
pendingSignals.add(signal2);
|
|
571
695
|
return true;
|
|
572
696
|
}
|
|
697
|
+
function isBatchingImpl() {
|
|
698
|
+
return batchDepth > 0;
|
|
699
|
+
}
|
|
573
700
|
function flushBatch() {
|
|
574
701
|
try {
|
|
575
702
|
for (const signal2 of pendingSignals) {
|
|
576
|
-
|
|
703
|
+
queueSignalNotification2(signal2);
|
|
577
704
|
}
|
|
578
705
|
} finally {
|
|
579
706
|
pendingSignals.clear();
|
|
580
707
|
}
|
|
581
|
-
|
|
708
|
+
drainNotificationQueue2();
|
|
709
|
+
}
|
|
710
|
+
var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
|
|
711
|
+
function resolveBatchApi() {
|
|
712
|
+
const g = globalThis;
|
|
713
|
+
const existing = g[BATCH_REGISTRY_KEY];
|
|
714
|
+
if (existing) return existing;
|
|
715
|
+
const local = {
|
|
716
|
+
batch: batchImpl,
|
|
717
|
+
enqueueBatchedSignal: enqueueBatchedSignalImpl,
|
|
718
|
+
isBatching: isBatchingImpl
|
|
719
|
+
};
|
|
720
|
+
g[BATCH_REGISTRY_KEY] = local;
|
|
721
|
+
return local;
|
|
582
722
|
}
|
|
723
|
+
var API2 = resolveBatchApi();
|
|
724
|
+
var batch = API2.batch;
|
|
725
|
+
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
726
|
+
var isBatching = API2.isBatching;
|
|
583
727
|
|
|
584
728
|
// src/core/signals/signal.ts
|
|
585
729
|
var _g2 = globalThis;
|
|
586
|
-
var
|
|
730
|
+
var _isDev4 = isDev();
|
|
587
731
|
function signal(initial, options) {
|
|
588
732
|
const state = {
|
|
589
733
|
value: initial,
|
|
@@ -594,11 +738,11 @@ function signal(initial, options) {
|
|
|
594
738
|
__activeNode: null,
|
|
595
739
|
__name: void 0
|
|
596
740
|
};
|
|
597
|
-
const debugName =
|
|
741
|
+
const debugName = _isDev4 ? options?.name : void 0;
|
|
598
742
|
const equalsFn = options?.equals;
|
|
599
743
|
if (debugName) state.__name = debugName;
|
|
600
744
|
function get() {
|
|
601
|
-
|
|
745
|
+
recordDependency2(state);
|
|
602
746
|
return state.value;
|
|
603
747
|
}
|
|
604
748
|
get.__signal = state;
|
|
@@ -611,15 +755,15 @@ function signal(initial, options) {
|
|
|
611
755
|
if (equalsFn(prev, newValue)) return;
|
|
612
756
|
state.value = newValue;
|
|
613
757
|
state.__v++;
|
|
614
|
-
if (
|
|
758
|
+
if (_isDev4) {
|
|
615
759
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
616
760
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
617
761
|
}
|
|
618
762
|
if (!enqueueBatchedSignal(state)) {
|
|
619
|
-
|
|
763
|
+
notifySubscribers2(state);
|
|
620
764
|
}
|
|
621
765
|
};
|
|
622
|
-
} else if (
|
|
766
|
+
} else if (_isDev4) {
|
|
623
767
|
set = (next) => {
|
|
624
768
|
const prev = state.value;
|
|
625
769
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
@@ -629,7 +773,7 @@ function signal(initial, options) {
|
|
|
629
773
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
630
774
|
if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
|
|
631
775
|
if (!enqueueBatchedSignal(state)) {
|
|
632
|
-
|
|
776
|
+
notifySubscribers2(state);
|
|
633
777
|
}
|
|
634
778
|
};
|
|
635
779
|
} else {
|
|
@@ -640,11 +784,11 @@ function signal(initial, options) {
|
|
|
640
784
|
state.value = newValue;
|
|
641
785
|
state.__v++;
|
|
642
786
|
if (!enqueueBatchedSignal(state)) {
|
|
643
|
-
|
|
787
|
+
notifySubscribers2(state);
|
|
644
788
|
}
|
|
645
789
|
};
|
|
646
790
|
}
|
|
647
|
-
if (
|
|
791
|
+
if (_isDev4) {
|
|
648
792
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
649
793
|
if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
|
|
650
794
|
}
|
|
@@ -803,7 +947,7 @@ function derived(getter, options) {
|
|
|
803
947
|
cs._d = false;
|
|
804
948
|
cs._init = true;
|
|
805
949
|
};
|
|
806
|
-
|
|
950
|
+
track2(() => {
|
|
807
951
|
let threw = true;
|
|
808
952
|
try {
|
|
809
953
|
cs._v = getter();
|
|
@@ -822,12 +966,12 @@ function derived(getter, options) {
|
|
|
822
966
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
823
967
|
);
|
|
824
968
|
}
|
|
825
|
-
if (
|
|
969
|
+
if (isTrackingSuspended2()) {
|
|
826
970
|
if (cs._d) {
|
|
827
971
|
const prev = cs._v;
|
|
828
972
|
evaluating = true;
|
|
829
973
|
try {
|
|
830
|
-
|
|
974
|
+
retrack2(recompute, markDirty);
|
|
831
975
|
if (!Object.is(prev, cs._v)) cs.__v++;
|
|
832
976
|
} finally {
|
|
833
977
|
evaluating = false;
|
|
@@ -835,12 +979,12 @@ function derived(getter, options) {
|
|
|
835
979
|
}
|
|
836
980
|
return cs._v;
|
|
837
981
|
}
|
|
838
|
-
|
|
982
|
+
recordDependency2(cs);
|
|
839
983
|
if (cs._d) {
|
|
840
984
|
const oldValue = cs._v;
|
|
841
985
|
evaluating = true;
|
|
842
986
|
try {
|
|
843
|
-
|
|
987
|
+
retrack2(recompute, markDirty);
|
|
844
988
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
845
989
|
} finally {
|
|
846
990
|
evaluating = false;
|
|
@@ -952,7 +1096,9 @@ function sanitizeSrcset(value) {
|
|
|
952
1096
|
}
|
|
953
1097
|
return out.join(", ");
|
|
954
1098
|
}
|
|
1099
|
+
var CSS_DANGER_GATE = /[(:@\\]/;
|
|
955
1100
|
function sanitizeCSSValue(value) {
|
|
1101
|
+
if (!CSS_DANGER_GATE.test(value)) return value;
|
|
956
1102
|
const decoded = value.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (_m, hex) => {
|
|
957
1103
|
const code = Number.parseInt(hex, 16);
|
|
958
1104
|
if (!Number.isFinite(code) || code < 0 || code > 1114111) return "";
|
|
@@ -982,18 +1128,21 @@ var URL_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
982
1128
|
"ping",
|
|
983
1129
|
"data"
|
|
984
1130
|
]);
|
|
985
|
-
function
|
|
986
|
-
|
|
1131
|
+
function sanitizeAttributeString(attr, value) {
|
|
1132
|
+
const lower = attr.toLowerCase();
|
|
1133
|
+
if (lower === "srcset") return sanitizeSrcset(value);
|
|
1134
|
+
if (URL_ATTRIBUTES.has(lower)) return sanitizeUrl(value);
|
|
1135
|
+
return value;
|
|
987
1136
|
}
|
|
988
1137
|
|
|
989
1138
|
// src/reactivity/bindAttribute.ts
|
|
990
|
-
var
|
|
1139
|
+
var _isDev5 = isDev();
|
|
991
1140
|
function setProp(el, key, val) {
|
|
992
1141
|
el[key] = val;
|
|
993
1142
|
}
|
|
994
1143
|
function bindAttribute(el, attr, getter) {
|
|
995
1144
|
if (isEventHandlerAttr(attr)) {
|
|
996
|
-
if (
|
|
1145
|
+
if (_isDev5)
|
|
997
1146
|
devWarn(
|
|
998
1147
|
`bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
|
|
999
1148
|
);
|
|
@@ -1005,7 +1154,7 @@ function bindAttribute(el, attr, getter) {
|
|
|
1005
1154
|
try {
|
|
1006
1155
|
value = getter();
|
|
1007
1156
|
} catch (err) {
|
|
1008
|
-
if (
|
|
1157
|
+
if (_isDev5)
|
|
1009
1158
|
devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1010
1159
|
return;
|
|
1011
1160
|
}
|
|
@@ -1023,15 +1172,15 @@ function bindAttribute(el, attr, getter) {
|
|
|
1023
1172
|
if ((attr === "value" || attr === "checked") && attr in el) {
|
|
1024
1173
|
setProp(el, attr, attr === "checked" ? Boolean(value) : str);
|
|
1025
1174
|
} else {
|
|
1026
|
-
el.setAttribute(attr,
|
|
1175
|
+
el.setAttribute(attr, sanitizeAttributeString(attr, str));
|
|
1027
1176
|
}
|
|
1028
1177
|
}
|
|
1029
|
-
return
|
|
1178
|
+
return reactiveBinding2(commit);
|
|
1030
1179
|
}
|
|
1031
1180
|
|
|
1032
1181
|
// src/core/rendering/dispose.ts
|
|
1033
1182
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
1034
|
-
var
|
|
1183
|
+
var _isDev6 = isDev();
|
|
1035
1184
|
var activeBindingCount = 0;
|
|
1036
1185
|
function registerDisposer(node, teardown) {
|
|
1037
1186
|
let disposers = elementDisposers.get(node);
|
|
@@ -1040,7 +1189,7 @@ function registerDisposer(node, teardown) {
|
|
|
1040
1189
|
elementDisposers.set(node, disposers);
|
|
1041
1190
|
}
|
|
1042
1191
|
disposers.push(teardown);
|
|
1043
|
-
if (
|
|
1192
|
+
if (_isDev6) activeBindingCount++;
|
|
1044
1193
|
}
|
|
1045
1194
|
function dispose(node) {
|
|
1046
1195
|
const stack = [node];
|
|
@@ -1059,12 +1208,12 @@ function dispose(node) {
|
|
|
1059
1208
|
if (disposers) {
|
|
1060
1209
|
const snapshot = disposers.slice();
|
|
1061
1210
|
elementDisposers.delete(current);
|
|
1062
|
-
if (
|
|
1211
|
+
if (_isDev6) activeBindingCount -= snapshot.length;
|
|
1063
1212
|
for (const d of snapshot) {
|
|
1064
1213
|
try {
|
|
1065
1214
|
d();
|
|
1066
1215
|
} catch (err) {
|
|
1067
|
-
if (
|
|
1216
|
+
if (_isDev6 && typeof console !== "undefined") {
|
|
1068
1217
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1069
1218
|
}
|
|
1070
1219
|
}
|
|
@@ -1075,12 +1224,12 @@ function dispose(node) {
|
|
|
1075
1224
|
if (!added || added.length === 0) break;
|
|
1076
1225
|
const moreSnapshot = added.slice();
|
|
1077
1226
|
elementDisposers.delete(current);
|
|
1078
|
-
if (
|
|
1227
|
+
if (_isDev6) activeBindingCount -= moreSnapshot.length;
|
|
1079
1228
|
for (const d of moreSnapshot) {
|
|
1080
1229
|
try {
|
|
1081
1230
|
d();
|
|
1082
1231
|
} catch (err) {
|
|
1083
|
-
if (
|
|
1232
|
+
if (_isDev6 && typeof console !== "undefined") {
|
|
1084
1233
|
console.warn("[SibuJS] Disposer threw during cleanup:", err);
|
|
1085
1234
|
}
|
|
1086
1235
|
}
|
|
@@ -1091,7 +1240,7 @@ function dispose(node) {
|
|
|
1091
1240
|
}
|
|
1092
1241
|
|
|
1093
1242
|
// src/reactivity/bindChildNode.ts
|
|
1094
|
-
var
|
|
1243
|
+
var _isDev7 = isDev();
|
|
1095
1244
|
function bindChildNode(placeholder, getter) {
|
|
1096
1245
|
let lastNodes = [];
|
|
1097
1246
|
function commit() {
|
|
@@ -1099,7 +1248,7 @@ function bindChildNode(placeholder, getter) {
|
|
|
1099
1248
|
try {
|
|
1100
1249
|
result = getter();
|
|
1101
1250
|
} catch (err) {
|
|
1102
|
-
if (
|
|
1251
|
+
if (_isDev7) devWarn(`bindChildNode: getter threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
1103
1252
|
return;
|
|
1104
1253
|
}
|
|
1105
1254
|
if (result == null || typeof result === "boolean") {
|
|
@@ -1125,7 +1274,7 @@ function bindChildNode(placeholder, getter) {
|
|
|
1125
1274
|
if (item == null || typeof item === "boolean") continue;
|
|
1126
1275
|
const node = item instanceof Node ? item : document.createTextNode(String(item));
|
|
1127
1276
|
if (seen.has(node)) {
|
|
1128
|
-
if (
|
|
1277
|
+
if (_isDev7)
|
|
1129
1278
|
devWarn("bindChildNode: duplicate node reference in array \u2014 only the first occurrence is rendered.");
|
|
1130
1279
|
continue;
|
|
1131
1280
|
}
|
|
@@ -1160,17 +1309,14 @@ function bindChildNode(placeholder, getter) {
|
|
|
1160
1309
|
}
|
|
1161
1310
|
lastNodes = newNodes;
|
|
1162
1311
|
}
|
|
1163
|
-
return
|
|
1312
|
+
return reactiveBinding2(commit);
|
|
1164
1313
|
}
|
|
1165
1314
|
|
|
1166
1315
|
// src/core/rendering/tagFactory.ts
|
|
1167
|
-
var
|
|
1316
|
+
var _isDev8 = isDev();
|
|
1168
1317
|
var BLOCKED_TAGS = /* @__PURE__ */ new Set(["script", "iframe", "object", "embed", "frame", "frameset"]);
|
|
1169
|
-
function
|
|
1170
|
-
|
|
1171
|
-
if (BLOCKED_TAGS.has(lower)) {
|
|
1172
|
-
throw new Error(`tagFactory: refusing to create <${tag}> \u2014 tag is blocked for security reasons.`);
|
|
1173
|
-
}
|
|
1318
|
+
function isBlockedTag(tag) {
|
|
1319
|
+
return BLOCKED_TAGS.has(tag.toLowerCase());
|
|
1174
1320
|
}
|
|
1175
1321
|
var CLOBBER_RISKY_IDS = /* @__PURE__ */ new Set([
|
|
1176
1322
|
"config",
|
|
@@ -1210,7 +1356,7 @@ function toKebab(prop) {
|
|
|
1210
1356
|
}
|
|
1211
1357
|
function applyStyle(el, style) {
|
|
1212
1358
|
if (typeof style === "function") {
|
|
1213
|
-
const teardown =
|
|
1359
|
+
const teardown = track2(() => {
|
|
1214
1360
|
el.setAttribute("style", style());
|
|
1215
1361
|
});
|
|
1216
1362
|
registerDisposer(el, teardown);
|
|
@@ -1226,7 +1372,7 @@ function applyStyle(el, style) {
|
|
|
1226
1372
|
const name = toKebab(prop);
|
|
1227
1373
|
if (typeof val === "function") {
|
|
1228
1374
|
const getter = val;
|
|
1229
|
-
const teardown =
|
|
1375
|
+
const teardown = track2(() => {
|
|
1230
1376
|
htmlEl.style.setProperty(name, sanitizeCSSValue(String(getter())));
|
|
1231
1377
|
});
|
|
1232
1378
|
registerDisposer(el, teardown);
|
|
@@ -1241,7 +1387,7 @@ function applyClass(el, cls) {
|
|
|
1241
1387
|
return;
|
|
1242
1388
|
}
|
|
1243
1389
|
if (typeof cls === "function") {
|
|
1244
|
-
const teardown =
|
|
1390
|
+
const teardown = track2(() => {
|
|
1245
1391
|
el.setAttribute("class", cls());
|
|
1246
1392
|
});
|
|
1247
1393
|
registerDisposer(el, teardown);
|
|
@@ -1268,7 +1414,7 @@ function applyClass(el, cls) {
|
|
|
1268
1414
|
}
|
|
1269
1415
|
el.setAttribute("class", r);
|
|
1270
1416
|
};
|
|
1271
|
-
const teardown =
|
|
1417
|
+
const teardown = track2(update);
|
|
1272
1418
|
registerDisposer(el, teardown);
|
|
1273
1419
|
} else {
|
|
1274
1420
|
el.setAttribute("class", result);
|
|
@@ -1325,8 +1471,11 @@ function appendChildren(el, nodes) {
|
|
|
1325
1471
|
}
|
|
1326
1472
|
}
|
|
1327
1473
|
var tagFactory = (tag, ns) => {
|
|
1474
|
+
const blocked = isBlockedTag(tag);
|
|
1328
1475
|
return (first, second) => {
|
|
1329
|
-
|
|
1476
|
+
if (blocked) {
|
|
1477
|
+
throw new Error(`tagFactory: refusing to create <${tag}> \u2014 tag is blocked for security reasons.`);
|
|
1478
|
+
}
|
|
1330
1479
|
const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
1331
1480
|
if (first === void 0) return el;
|
|
1332
1481
|
if (typeof first === "string") {
|
|
@@ -1335,7 +1484,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1335
1484
|
appendChildren(el, second);
|
|
1336
1485
|
return el;
|
|
1337
1486
|
}
|
|
1338
|
-
if (
|
|
1487
|
+
if (_isDev8 && looksLikeClassList(first)) {
|
|
1339
1488
|
devWarn(
|
|
1340
1489
|
`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.`
|
|
1341
1490
|
);
|
|
@@ -1356,7 +1505,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1356
1505
|
if (pClass != null) applyClass(el, pClass);
|
|
1357
1506
|
const pId = props.id;
|
|
1358
1507
|
if (pId != null) {
|
|
1359
|
-
if (
|
|
1508
|
+
if (_isDev8 && typeof pId === "string" && CLOBBER_RISKY_IDS.has(pId.toLowerCase())) {
|
|
1360
1509
|
devWarn(
|
|
1361
1510
|
`tagFactory: element id="${pId}" matches a common global and may cause DOM clobbering. Avoid setting ids from untrusted input.`
|
|
1362
1511
|
);
|
|
@@ -1371,7 +1520,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1371
1520
|
const handler = pOn[ev];
|
|
1372
1521
|
if (typeof handler === "function") {
|
|
1373
1522
|
el.addEventListener(ev, handler);
|
|
1374
|
-
} else if (
|
|
1523
|
+
} else if (_isDev8) {
|
|
1375
1524
|
devWarn(
|
|
1376
1525
|
`tagFactory: on.${ev} handler is not a function (got ${typeof handler}). Event listener was not attached.`
|
|
1377
1526
|
);
|
|
@@ -1396,7 +1545,6 @@ var tagFactory = (tag, ns) => {
|
|
|
1396
1545
|
default: {
|
|
1397
1546
|
const value = props[key];
|
|
1398
1547
|
if (value == null) continue;
|
|
1399
|
-
const lkey = key.toLowerCase();
|
|
1400
1548
|
if (isEventHandlerAttr(key)) continue;
|
|
1401
1549
|
if (typeof value === "function") {
|
|
1402
1550
|
registerDisposer(el, bindAttribute(el, key, value));
|
|
@@ -1409,14 +1557,7 @@ var tagFactory = (tag, ns) => {
|
|
|
1409
1557
|
el.removeAttribute(key);
|
|
1410
1558
|
}
|
|
1411
1559
|
} else {
|
|
1412
|
-
|
|
1413
|
-
if (lkey === "srcset") {
|
|
1414
|
-
el.setAttribute(key, sanitizeSrcset(str));
|
|
1415
|
-
} else if (isUrlAttribute(lkey)) {
|
|
1416
|
-
el.setAttribute(key, sanitizeUrl(str));
|
|
1417
|
-
} else {
|
|
1418
|
-
el.setAttribute(key, str);
|
|
1419
|
-
}
|
|
1560
|
+
el.setAttribute(key, sanitizeAttributeString(key, String(value)));
|
|
1420
1561
|
}
|
|
1421
1562
|
}
|
|
1422
1563
|
}
|
package/dist/ecosystem.js
CHANGED
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4UUMSLSL.js";
|
|
11
11
|
import "./chunk-3JHCYHWN.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-LU2MQXQQ.js";
|
|
13
|
+
import "./chunk-NHKQKKZU.js";
|
|
14
|
+
import "./chunk-WW6DAGGR.js";
|
|
15
|
+
import "./chunk-5VGSK6D2.js";
|
|
16
|
+
import "./chunk-L3GAGWCC.js";
|
|
17
|
+
import "./chunk-MHBCEJQO.js";
|
|
18
18
|
import "./chunk-GOJMFRBL.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-WZG2SZOT.js";
|
|
20
|
+
import "./chunk-TEFZT5PJ.js";
|
|
21
|
+
import "./chunk-COY6PUD2.js";
|
|
22
22
|
export {
|
|
23
23
|
antdAdapter,
|
|
24
24
|
chakraAdapter,
|