sibujs 4.5.0 → 4.6.0
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 +309 -129
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +184 -72
- package/dist/build.js +15 -16
- package/dist/cdn.dev.global.js +12 -12
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/chunk-3ISI6ACU.js +44 -0
- package/dist/{chunk-ONOHFDLG.js → chunk-47M47FOM.js} +3 -3
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-KKLW7YWL.js → chunk-5MT6SJ3P.js} +275 -144
- package/dist/{chunk-UGRX3S57.js → chunk-5Q4R7HCL.js} +12 -3
- package/dist/{chunk-S373NSMK.js → chunk-7GQCWFOE.js} +150 -59
- package/dist/{chunk-FTIR4QW2.js → chunk-7NCARGJW.js} +6 -8
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/{chunk-VZKNK2V7.js → chunk-AIF3Z2T7.js} +296 -38
- package/dist/{chunk-4PMLNECI.js → chunk-BAAG6ZTI.js} +98 -29
- package/dist/{chunk-XZZOBQAY.js → chunk-D33YTSX5.js} +2 -2
- package/dist/{chunk-TBYTO6BS.js → chunk-DKGBBKOF.js} +136 -80
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/{chunk-GW3SCCZG.js → chunk-HYXDKS4N.js} +153 -110
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-PCT43HW3.js → chunk-JSXPZCET.js} +1 -1
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RJE2BNI4.js → chunk-ORMZXBKQ.js} +108 -45
- package/dist/{chunk-OMJJM3KM.js → chunk-OXUY2A6L.js} +287 -130
- package/dist/{chunk-3JZ4L5TJ.js → chunk-PK6FK2G2.js} +181 -66
- package/dist/{chunk-RBTPLM32.js → chunk-QE4TTDU3.js} +2 -2
- package/dist/{chunk-2DCGACUU.js → chunk-SXXVZMKZ.js} +251 -66
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-7LN645I6.js → chunk-UZQ6ALFS.js} +3 -3
- package/dist/{chunk-KEISJXBU.js → chunk-VVWPJ543.js} +6 -8
- package/dist/{chunk-RIXRAYIU.js → chunk-XC4MEKGA.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-XRRZKZYX.js} +55 -31
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-DRIuclVT.d.cts} +10 -2
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-DRIuclVT.d.ts} +10 -2
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +213 -117
- package/dist/data.d.cts +47 -9
- package/dist/data.d.ts +47 -9
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +81 -57
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +309 -104
- package/dist/ecosystem.d.cts +19 -3
- package/dist/ecosystem.d.ts +19 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2133 -863
- package/dist/extras.d.cts +10 -9
- package/dist/extras.d.ts +10 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +184 -72
- package/dist/index.d.cts +22 -5
- package/dist/index.d.ts +22 -5
- package/dist/index.js +24 -27
- package/dist/motion.cjs +107 -41
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +317 -39
- package/dist/patterns.d.cts +27 -9
- package/dist/patterns.d.ts +27 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +308 -216
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +549 -202
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +35 -23
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +176 -72
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/{tagFactory-DVoDpHye.d.ts → tagFactory-DFstCLQV.d.cts} +2 -100
- package/dist/{tagFactory-DVoDpHye.d.cts → tagFactory-DkaNVUNV.d.ts} +2 -100
- package/dist/testing.cjs +2484 -2185
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/ui.cjs +707 -317
- package/dist/ui.d.cts +40 -7
- package/dist/ui.d.ts +40 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +246 -278
- package/dist/widgets.js +9 -10
- package/package.json +1 -1
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
package/dist/build.cjs
CHANGED
|
@@ -1419,6 +1419,23 @@ function reportDrainRunaway(label2, executed, remaining) {
|
|
|
1419
1419
|
);
|
|
1420
1420
|
}
|
|
1421
1421
|
var activeBindingCount = 0;
|
|
1422
|
+
function resolveCapture(capture) {
|
|
1423
|
+
let frame = capture;
|
|
1424
|
+
while (frame?.closed) frame = frame.forwardTo;
|
|
1425
|
+
return frame ?? null;
|
|
1426
|
+
}
|
|
1427
|
+
var registrationCaptures = [];
|
|
1428
|
+
function currentDisposerCapture() {
|
|
1429
|
+
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
1430
|
+
}
|
|
1431
|
+
function beginDisposerCapture(capture) {
|
|
1432
|
+
if (capture === null && registrationCaptures.length === 0) return false;
|
|
1433
|
+
registrationCaptures.push(resolveCapture(capture));
|
|
1434
|
+
return true;
|
|
1435
|
+
}
|
|
1436
|
+
function endDisposerCapture() {
|
|
1437
|
+
registrationCaptures.pop();
|
|
1438
|
+
}
|
|
1422
1439
|
function registerDisposer(node, teardown) {
|
|
1423
1440
|
let disposers = elementDisposers.get(node);
|
|
1424
1441
|
if (!disposers) {
|
|
@@ -1427,15 +1444,18 @@ function registerDisposer(node, teardown) {
|
|
|
1427
1444
|
}
|
|
1428
1445
|
disposers.push(teardown);
|
|
1429
1446
|
if (DEV) activeBindingCount++;
|
|
1447
|
+
const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
1448
|
+
if (capture) capture.entries.push([node, teardown]);
|
|
1430
1449
|
}
|
|
1431
1450
|
function unregisterDisposer(node, teardown) {
|
|
1432
1451
|
const disposers = elementDisposers.get(node);
|
|
1433
|
-
if (!disposers) return;
|
|
1452
|
+
if (!disposers) return false;
|
|
1434
1453
|
const index = disposers.indexOf(teardown);
|
|
1435
|
-
if (index === -1) return;
|
|
1454
|
+
if (index === -1) return false;
|
|
1436
1455
|
disposers.splice(index, 1);
|
|
1437
1456
|
if (DEV) activeBindingCount--;
|
|
1438
1457
|
if (disposers.length === 0) elementDisposers.delete(node);
|
|
1458
|
+
return true;
|
|
1439
1459
|
}
|
|
1440
1460
|
function dispose(node) {
|
|
1441
1461
|
const stack = [node];
|
|
@@ -1449,33 +1469,34 @@ function dispose(node) {
|
|
|
1449
1469
|
}
|
|
1450
1470
|
}
|
|
1451
1471
|
for (let i2 = order.length - 1; i2 >= 0; i2--) {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1472
|
+
disposeNodeOwn(order[i2]);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function disposeNodeOwn(node) {
|
|
1476
|
+
if (!elementDisposers.has(node)) return;
|
|
1477
|
+
let executed = 0;
|
|
1478
|
+
let runaway = false;
|
|
1479
|
+
while (!runaway) {
|
|
1480
|
+
const pending = elementDisposers.get(node);
|
|
1481
|
+
if (!pending || pending.length === 0) break;
|
|
1482
|
+
const snapshot = pending.slice();
|
|
1483
|
+
elementDisposers.delete(node);
|
|
1484
|
+
if (DEV) activeBindingCount -= snapshot.length;
|
|
1485
|
+
for (let i2 = 0; i2 < snapshot.length; i2++) {
|
|
1486
|
+
if (executed >= MAX_DRAIN_TEARDOWNS) {
|
|
1487
|
+
const rest = snapshot.slice(i2);
|
|
1488
|
+
const added = elementDisposers.get(node);
|
|
1489
|
+
elementDisposers.set(node, added ? rest.concat(added) : rest);
|
|
1490
|
+
if (DEV) activeBindingCount += rest.length;
|
|
1491
|
+
reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
|
|
1492
|
+
runaway = true;
|
|
1493
|
+
break;
|
|
1494
|
+
}
|
|
1495
|
+
executed++;
|
|
1496
|
+
try {
|
|
1497
|
+
snapshot[i2]();
|
|
1498
|
+
} catch (err) {
|
|
1499
|
+
reportError(err, { phase: "cleanup", name: "disposer" });
|
|
1479
1500
|
}
|
|
1480
1501
|
}
|
|
1481
1502
|
}
|
|
@@ -1956,6 +1977,7 @@ function retrack(effectFn, subscriber) {
|
|
|
1956
1977
|
}
|
|
1957
1978
|
currentSubscriber = subscriber;
|
|
1958
1979
|
const sub2 = subscriber;
|
|
1980
|
+
if (sub2._cap === void 0) sub2._cap = currentDisposerCapture();
|
|
1959
1981
|
const epoch = ++subscriberEpochCounter;
|
|
1960
1982
|
sub2._epoch = epoch;
|
|
1961
1983
|
sub2._structDirty = false;
|
|
@@ -2147,7 +2169,12 @@ function drainQueue() {
|
|
|
2147
2169
|
quarantined.add(sub2);
|
|
2148
2170
|
continue;
|
|
2149
2171
|
}
|
|
2150
|
-
|
|
2172
|
+
const pushed = beginDisposerCapture(sub2._cap ?? null);
|
|
2173
|
+
try {
|
|
2174
|
+
safeInvoke(sub2);
|
|
2175
|
+
} finally {
|
|
2176
|
+
if (pushed) endDisposerCapture();
|
|
2177
|
+
}
|
|
2151
2178
|
}
|
|
2152
2179
|
}
|
|
2153
2180
|
function drainNotificationQueue() {
|
|
@@ -2283,7 +2310,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
2283
2310
|
}
|
|
2284
2311
|
|
|
2285
2312
|
// src/reactivity/track.ts
|
|
2286
|
-
var _runtimeVersion = true ? "4.
|
|
2313
|
+
var _runtimeVersion = true ? "4.6.0" : "dev";
|
|
2287
2314
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
2288
2315
|
function resolveReactiveApi() {
|
|
2289
2316
|
const g2 = globalThis;
|
|
@@ -3324,6 +3351,10 @@ function getSSRStore() {
|
|
|
3324
3351
|
}
|
|
3325
3352
|
return fallbackStore;
|
|
3326
3353
|
}
|
|
3354
|
+
function getRequestStore() {
|
|
3355
|
+
if (als) return als.getStore() ?? null;
|
|
3356
|
+
return _shared.fallbackDepth > 0 ? fallbackStore : null;
|
|
3357
|
+
}
|
|
3327
3358
|
function isSSR() {
|
|
3328
3359
|
return getSSRStore().ssr;
|
|
3329
3360
|
}
|
|
@@ -3345,16 +3376,18 @@ function disableSSR() {
|
|
|
3345
3376
|
getSSRStore().ssr = false;
|
|
3346
3377
|
}
|
|
3347
3378
|
function runInSSRContext(fn) {
|
|
3348
|
-
const store2 = { ssr: true, suspenseIdCounter: 0, locale: void 0 };
|
|
3379
|
+
const store2 = { ssr: true, suspenseIdCounter: 0, idCounter: 0, locale: void 0 };
|
|
3349
3380
|
if (als) {
|
|
3350
3381
|
return als.run(store2, fn);
|
|
3351
3382
|
}
|
|
3352
3383
|
warnMissingAsyncLocalStorage();
|
|
3353
3384
|
const prevSSR = fallbackStore.ssr;
|
|
3354
3385
|
const prevCounter = fallbackStore.suspenseIdCounter;
|
|
3386
|
+
const prevIdCounter = fallbackStore.idCounter;
|
|
3355
3387
|
const prevLocale = fallbackStore.locale;
|
|
3356
3388
|
fallbackStore.ssr = true;
|
|
3357
3389
|
fallbackStore.suspenseIdCounter = 0;
|
|
3390
|
+
fallbackStore.idCounter = 0;
|
|
3358
3391
|
fallbackStore.locale = void 0;
|
|
3359
3392
|
_shared.fallbackDepth++;
|
|
3360
3393
|
try {
|
|
@@ -3363,6 +3396,7 @@ function runInSSRContext(fn) {
|
|
|
3363
3396
|
_shared.fallbackDepth--;
|
|
3364
3397
|
fallbackStore.ssr = prevSSR;
|
|
3365
3398
|
fallbackStore.suspenseIdCounter = prevCounter;
|
|
3399
|
+
fallbackStore.idCounter = prevIdCounter;
|
|
3366
3400
|
fallbackStore.locale = prevLocale;
|
|
3367
3401
|
}
|
|
3368
3402
|
}
|
|
@@ -4534,9 +4568,14 @@ var longPress = (element, options) => {
|
|
|
4534
4568
|
};
|
|
4535
4569
|
};
|
|
4536
4570
|
var copyOnClick = (element, getText) => {
|
|
4571
|
+
const report = (error) => reportError(error, { phase: "async", name: "copyOnClick", node: element });
|
|
4537
4572
|
const handler = () => {
|
|
4538
|
-
|
|
4539
|
-
|
|
4573
|
+
try {
|
|
4574
|
+
const text2 = typeof getText === "function" ? getText() : element.textContent ?? "";
|
|
4575
|
+
Promise.resolve(navigator.clipboard.writeText(text2)).catch(report);
|
|
4576
|
+
} catch (error) {
|
|
4577
|
+
report(error);
|
|
4578
|
+
}
|
|
4540
4579
|
};
|
|
4541
4580
|
element.addEventListener("click", handler);
|
|
4542
4581
|
return () => element.removeEventListener("click", handler);
|
|
@@ -4672,6 +4711,11 @@ function context(defaultValue) {
|
|
|
4672
4711
|
var COUNTER_KEY = /* @__PURE__ */ Symbol.for("sibujs.createId.v1");
|
|
4673
4712
|
var _counter = globalThis[COUNTER_KEY] ?? (globalThis[COUNTER_KEY] = { n: 0 });
|
|
4674
4713
|
function createId(prefix = "sibu") {
|
|
4714
|
+
const request = getRequestStore();
|
|
4715
|
+
if (request) {
|
|
4716
|
+
request.idCounter = (request.idCounter ?? 0) + 1;
|
|
4717
|
+
return `${prefix}-${request.idCounter}`;
|
|
4718
|
+
}
|
|
4675
4719
|
_counter.n++;
|
|
4676
4720
|
return `${prefix}-${_counter.n}`;
|
|
4677
4721
|
}
|
|
@@ -4709,9 +4753,11 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
4709
4753
|
let currentNode = null;
|
|
4710
4754
|
let lastCondition;
|
|
4711
4755
|
let initialized = false;
|
|
4756
|
+
let disposed = false;
|
|
4712
4757
|
const attachedOnce = /* @__PURE__ */ new WeakSet();
|
|
4713
4758
|
let currentNodeOwned = false;
|
|
4714
4759
|
const update = () => {
|
|
4760
|
+
if (disposed) return;
|
|
4715
4761
|
const show2 = condition();
|
|
4716
4762
|
const parent = anchor.parentNode;
|
|
4717
4763
|
if (!parent) return;
|
|
@@ -4730,10 +4776,14 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
4730
4776
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
|
|
4731
4777
|
initialized = true;
|
|
4732
4778
|
};
|
|
4733
|
-
|
|
4779
|
+
const stopBinding = reactiveBinding2(update, anchor);
|
|
4780
|
+
registerDisposer(anchor, () => {
|
|
4781
|
+
disposed = true;
|
|
4782
|
+
stopBinding();
|
|
4783
|
+
});
|
|
4734
4784
|
if (!initialized) {
|
|
4735
4785
|
queueMicrotask(() => {
|
|
4736
|
-
if (!initialized && anchor.parentNode) update();
|
|
4786
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
4737
4787
|
});
|
|
4738
4788
|
}
|
|
4739
4789
|
return anchor;
|
|
@@ -4743,9 +4793,11 @@ function match(value, cases, fallback) {
|
|
|
4743
4793
|
let currentNode = null;
|
|
4744
4794
|
let lastKey;
|
|
4745
4795
|
let initialized = false;
|
|
4796
|
+
let disposed = false;
|
|
4746
4797
|
const attachedOnce = /* @__PURE__ */ new WeakSet();
|
|
4747
4798
|
let currentNodeOwned = false;
|
|
4748
4799
|
const update = () => {
|
|
4800
|
+
if (disposed) return;
|
|
4749
4801
|
const key = String(value());
|
|
4750
4802
|
const parent = anchor.parentNode;
|
|
4751
4803
|
if (!parent) return;
|
|
@@ -4764,17 +4816,30 @@ function match(value, cases, fallback) {
|
|
|
4764
4816
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
|
|
4765
4817
|
initialized = true;
|
|
4766
4818
|
};
|
|
4767
|
-
|
|
4819
|
+
const stopBinding = reactiveBinding2(update, anchor);
|
|
4820
|
+
registerDisposer(anchor, () => {
|
|
4821
|
+
disposed = true;
|
|
4822
|
+
stopBinding();
|
|
4823
|
+
});
|
|
4768
4824
|
if (!initialized) {
|
|
4769
4825
|
queueMicrotask(() => {
|
|
4770
|
-
if (!initialized && anchor.parentNode) update();
|
|
4826
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
4771
4827
|
});
|
|
4772
4828
|
}
|
|
4773
4829
|
return anchor;
|
|
4774
4830
|
}
|
|
4775
4831
|
|
|
4832
|
+
// src/utils/globalSingleton.ts
|
|
4833
|
+
function globalSingleton(key, create) {
|
|
4834
|
+
const g2 = globalThis;
|
|
4835
|
+
return g2[key] ?? (g2[key] = create());
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4776
4838
|
// src/core/rendering/dynamic.ts
|
|
4777
|
-
var componentRegistry =
|
|
4839
|
+
var componentRegistry = globalSingleton(
|
|
4840
|
+
/* @__PURE__ */ Symbol.for("sibujs.components.registry.v1"),
|
|
4841
|
+
() => /* @__PURE__ */ new Map()
|
|
4842
|
+
);
|
|
4778
4843
|
function registerComponent(name, component) {
|
|
4779
4844
|
componentRegistry.set(name, component);
|
|
4780
4845
|
}
|
|
@@ -4786,7 +4851,7 @@ function resolveComponent(name) {
|
|
|
4786
4851
|
if (component) {
|
|
4787
4852
|
return component();
|
|
4788
4853
|
}
|
|
4789
|
-
return div(
|
|
4854
|
+
return div(`[Component "${name}" not found]`);
|
|
4790
4855
|
}
|
|
4791
4856
|
function DynamicComponent(is) {
|
|
4792
4857
|
const container = div({ class: "sibu-dynamic" });
|
|
@@ -5605,10 +5670,15 @@ function Portal(nodes, target) {
|
|
|
5605
5670
|
|
|
5606
5671
|
// src/core/rendering/slots.ts
|
|
5607
5672
|
function getSlot(slots, name = "default") {
|
|
5608
|
-
|
|
5673
|
+
if (slots == null || !Object.hasOwn(slots, name)) return void 0;
|
|
5674
|
+
const slot2 = slots[name];
|
|
5675
|
+
return typeof slot2 === "function" ? slot2 : void 0;
|
|
5609
5676
|
}
|
|
5610
5677
|
|
|
5611
5678
|
// src/core/signals/array.ts
|
|
5679
|
+
function nativeSplice(target, start, rest) {
|
|
5680
|
+
return rest.length === 0 ? target.splice(start) : target.splice(start, ...rest);
|
|
5681
|
+
}
|
|
5612
5682
|
function array(initial = []) {
|
|
5613
5683
|
const [arr, setArr] = signal([...initial]);
|
|
5614
5684
|
const actions = {
|
|
@@ -5636,12 +5706,12 @@ function array(initial = []) {
|
|
|
5636
5706
|
unshift(...items) {
|
|
5637
5707
|
setArr((prev) => [...items, ...prev]);
|
|
5638
5708
|
},
|
|
5639
|
-
splice(start,
|
|
5709
|
+
splice(start, ...rest) {
|
|
5640
5710
|
let removed = [];
|
|
5641
5711
|
setArr((prev) => {
|
|
5642
5712
|
const copy = [...prev];
|
|
5643
|
-
removed = copy
|
|
5644
|
-
return copy;
|
|
5713
|
+
removed = nativeSplice(copy, start, rest);
|
|
5714
|
+
return removed.length === 0 && rest.length <= 1 ? prev : copy;
|
|
5645
5715
|
});
|
|
5646
5716
|
return removed;
|
|
5647
5717
|
},
|
|
@@ -5724,9 +5794,9 @@ function reactiveArray(initial = []) {
|
|
|
5724
5794
|
data2.unshift(...items);
|
|
5725
5795
|
notify();
|
|
5726
5796
|
},
|
|
5727
|
-
splice(start,
|
|
5728
|
-
const removed = data2
|
|
5729
|
-
if (removed.length > 0 ||
|
|
5797
|
+
splice(start, ...rest) {
|
|
5798
|
+
const removed = nativeSplice(data2, start, rest);
|
|
5799
|
+
if (removed.length > 0 || rest.length > 1) {
|
|
5730
5800
|
notify();
|
|
5731
5801
|
}
|
|
5732
5802
|
return removed;
|
|
@@ -5948,6 +6018,21 @@ function deepEqual(a2, b2, seen) {
|
|
|
5948
6018
|
if (a2.length !== b2.length) return false;
|
|
5949
6019
|
return a2.every((val, i2) => deepEqual(val, b2[i2], seen));
|
|
5950
6020
|
}
|
|
6021
|
+
if (a2 instanceof Number || a2 instanceof String || a2 instanceof Boolean) {
|
|
6022
|
+
return Object.is(a2.valueOf(), b2.valueOf());
|
|
6023
|
+
}
|
|
6024
|
+
if (typeof URL !== "undefined" && a2 instanceof URL) {
|
|
6025
|
+
return a2.href === b2.href;
|
|
6026
|
+
}
|
|
6027
|
+
if (a2 instanceof Error) {
|
|
6028
|
+
const eb = b2;
|
|
6029
|
+
return a2.name === eb.name && a2.message === eb.message && deepEqual(a2.cause, eb.cause, seen) && plainKeysEqual(objA, objB, seen);
|
|
6030
|
+
}
|
|
6031
|
+
const proto = Object.getPrototypeOf(objA);
|
|
6032
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
6033
|
+
return plainKeysEqual(objA, objB, seen);
|
|
6034
|
+
}
|
|
6035
|
+
function plainKeysEqual(objA, objB, seen) {
|
|
5951
6036
|
const keysA = Object.keys(objA);
|
|
5952
6037
|
const keysB = Object.keys(objB);
|
|
5953
6038
|
if (keysA.length !== keysB.length) return false;
|
|
@@ -6083,15 +6168,18 @@ function ref(initial) {
|
|
|
6083
6168
|
}
|
|
6084
6169
|
|
|
6085
6170
|
// src/core/signals/store.ts
|
|
6171
|
+
function defineOwn(obj, key, value) {
|
|
6172
|
+
Object.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });
|
|
6173
|
+
}
|
|
6086
6174
|
function store(initialState) {
|
|
6087
6175
|
devAssert(
|
|
6088
6176
|
initialState !== null && typeof initialState === "object" && !Array.isArray(initialState),
|
|
6089
6177
|
"store: argument must be a plain object. For arrays, use array() instead."
|
|
6090
6178
|
);
|
|
6091
|
-
const signals =
|
|
6179
|
+
const signals = /* @__PURE__ */ Object.create(null);
|
|
6092
6180
|
Object.keys(initialState).forEach((key) => {
|
|
6093
6181
|
const [getter, setter] = signal(initialState[key]);
|
|
6094
|
-
signals
|
|
6182
|
+
defineOwn(signals, key, [getter, setter]);
|
|
6095
6183
|
});
|
|
6096
6184
|
const store2 = new Proxy({}, {
|
|
6097
6185
|
get(target, prop) {
|
|
@@ -6110,7 +6198,7 @@ function store(initialState) {
|
|
|
6110
6198
|
const getSnapshot = () => {
|
|
6111
6199
|
const snapshot = {};
|
|
6112
6200
|
Object.keys(signals).forEach((key) => {
|
|
6113
|
-
snapshot
|
|
6201
|
+
defineOwn(snapshot, key, signals[key][0]());
|
|
6114
6202
|
});
|
|
6115
6203
|
return snapshot;
|
|
6116
6204
|
};
|
|
@@ -6246,6 +6334,13 @@ function strictEffect(fn) {
|
|
|
6246
6334
|
};
|
|
6247
6335
|
}
|
|
6248
6336
|
|
|
6337
|
+
// src/reactivity/domBinding.ts
|
|
6338
|
+
function domBinding(commit, ownerNode) {
|
|
6339
|
+
if (isSSR()) return () => {
|
|
6340
|
+
};
|
|
6341
|
+
return reactiveBinding2(commit, ownerNode);
|
|
6342
|
+
}
|
|
6343
|
+
|
|
6249
6344
|
// src/platform/enhance.ts
|
|
6250
6345
|
var ENHANCED_ATTR = "data-sibu-enhanced";
|
|
6251
6346
|
var enhancementOwner = /* @__PURE__ */ new WeakMap();
|
|
@@ -6281,9 +6376,7 @@ function resolveTarget(root, target) {
|
|
|
6281
6376
|
}
|
|
6282
6377
|
}
|
|
6283
6378
|
function bindNode(el, commit) {
|
|
6284
|
-
|
|
6285
|
-
};
|
|
6286
|
-
return reactiveBinding2(commit, el);
|
|
6379
|
+
return domBinding(commit, el);
|
|
6287
6380
|
}
|
|
6288
6381
|
function readControlValue(el) {
|
|
6289
6382
|
if (el instanceof HTMLInputElement) {
|
|
@@ -6541,12 +6634,6 @@ function enhanceAll(selector, setup) {
|
|
|
6541
6634
|
};
|
|
6542
6635
|
}
|
|
6543
6636
|
|
|
6544
|
-
// src/utils/globalSingleton.ts
|
|
6545
|
-
function globalSingleton(key, create) {
|
|
6546
|
-
const g2 = globalThis;
|
|
6547
|
-
return g2[key] ?? (g2[key] = create());
|
|
6548
|
-
}
|
|
6549
|
-
|
|
6550
6637
|
// src/platform/islands.ts
|
|
6551
6638
|
var SAFE_NAME = /^[A-Za-z0-9_-]+$/;
|
|
6552
6639
|
var LAZY = /* @__PURE__ */ Symbol.for("sibujs.islands.lazy");
|
|
@@ -6703,6 +6790,27 @@ function trustHTML(html3) {
|
|
|
6703
6790
|
}
|
|
6704
6791
|
var DEFAULT_MAX_SSR_BYTES = 1024 * 1024;
|
|
6705
6792
|
|
|
6793
|
+
// src/utils/adoptThenable.ts
|
|
6794
|
+
function adoptThenable(value) {
|
|
6795
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") return null;
|
|
6796
|
+
let then;
|
|
6797
|
+
try {
|
|
6798
|
+
then = value.then;
|
|
6799
|
+
} catch (error) {
|
|
6800
|
+
return Promise.reject(error);
|
|
6801
|
+
}
|
|
6802
|
+
if (typeof then !== "function") return null;
|
|
6803
|
+
return new Promise((resolve, reject) => {
|
|
6804
|
+
queueMicrotask(() => {
|
|
6805
|
+
try {
|
|
6806
|
+
Reflect.apply(then, value, [resolve, reject]);
|
|
6807
|
+
} catch (error) {
|
|
6808
|
+
reject(error);
|
|
6809
|
+
}
|
|
6810
|
+
});
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
|
|
6706
6814
|
// src/reactivity/concurrent.ts
|
|
6707
6815
|
function defer(getter) {
|
|
6708
6816
|
const [value, setValue] = signal(getter());
|
|
@@ -6752,23 +6860,27 @@ function scheduleIdle(fn) {
|
|
|
6752
6860
|
}
|
|
6753
6861
|
function transition() {
|
|
6754
6862
|
const [pending, setPending] = signal(false);
|
|
6863
|
+
let outstanding = 0;
|
|
6755
6864
|
function start(fn) {
|
|
6865
|
+
outstanding++;
|
|
6756
6866
|
setPending(true);
|
|
6867
|
+
let settled = false;
|
|
6868
|
+
const finish = () => {
|
|
6869
|
+
if (settled) return;
|
|
6870
|
+
settled = true;
|
|
6871
|
+
outstanding--;
|
|
6872
|
+
if (outstanding === 0) setPending(false);
|
|
6873
|
+
};
|
|
6874
|
+
const fail = (error) => {
|
|
6875
|
+
finish();
|
|
6876
|
+
reportError(error, { phase: "async", name: "transition" });
|
|
6877
|
+
};
|
|
6757
6878
|
scheduleIdle(() => {
|
|
6758
|
-
let result;
|
|
6759
6879
|
try {
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
}
|
|
6765
|
-
if (result && typeof result.then === "function") {
|
|
6766
|
-
result.then(
|
|
6767
|
-
() => setPending(false),
|
|
6768
|
-
() => setPending(false)
|
|
6769
|
-
);
|
|
6770
|
-
} else {
|
|
6771
|
-
setPending(false);
|
|
6880
|
+
const adopted = adoptThenable(fn());
|
|
6881
|
+
adopted ? adopted.then(finish, fail) : finish();
|
|
6882
|
+
} catch (error) {
|
|
6883
|
+
fail(error);
|
|
6772
6884
|
}
|
|
6773
6885
|
});
|
|
6774
6886
|
}
|
package/dist/build.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
index_exports
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-IXKSNWV5.js";
|
|
3
|
+
} from "./chunk-7GQCWFOE.js";
|
|
4
|
+
import "./chunk-JSXPZCET.js";
|
|
5
|
+
import "./chunk-HURREPU2.js";
|
|
6
|
+
import "./chunk-UZQ6ALFS.js";
|
|
7
|
+
import "./chunk-3ISI6ACU.js";
|
|
8
|
+
import "./chunk-VVWPJ543.js";
|
|
9
|
+
import "./chunk-47M47FOM.js";
|
|
10
|
+
import "./chunk-QE4TTDU3.js";
|
|
11
|
+
import "./chunk-2INLLLMZ.js";
|
|
13
12
|
import "./chunk-7ZHH77QA.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-XC4MEKGA.js";
|
|
14
|
+
import "./chunk-7XHATCIH.js";
|
|
15
|
+
import "./chunk-5HZXGZ6T.js";
|
|
16
|
+
import "./chunk-D33YTSX5.js";
|
|
17
|
+
import "./chunk-5Q4R7HCL.js";
|
|
18
|
+
import "./chunk-NYNYSPK7.js";
|
|
20
19
|
|
|
21
20
|
// src/build/compileTemplates.ts
|
|
22
21
|
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|