sibujs 4.9.0 → 4.10.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 +41 -4
- package/dist/browser.js +4 -4
- package/dist/build.cjs +102 -38
- package/dist/build.js +10 -10
- package/dist/cdn.dev.global.js +14 -14
- package/dist/cdn.full.dev.global.js +13 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +15 -15
- package/dist/{chunk-7OV5Q2UU.js → chunk-2D47RVVK.js} +4 -4
- package/dist/{chunk-5MLWTIQE.js → chunk-2T73SWKF.js} +2 -2
- package/dist/{chunk-YW6HQKGO.js → chunk-42REZXE4.js} +2 -2
- package/dist/{chunk-SBTZEYNI.js → chunk-6DYRY2NF.js} +8 -1
- package/dist/{chunk-562UVHMM.js → chunk-ADJEMTRC.js} +11 -6
- package/dist/{chunk-SYHGGDNW.js → chunk-BNZDDNBR.js} +1 -1
- package/dist/{chunk-K6K5ACO6.js → chunk-CID4BYBF.js} +3 -3
- package/dist/{chunk-TV464N2M.js → chunk-CYUU3XXG.js} +3 -3
- package/dist/{chunk-FNOK662L.js → chunk-CZINTERN.js} +73 -43
- package/dist/{chunk-CDBKFGXN.js → chunk-DA2LJXK3.js} +1 -1
- package/dist/{chunk-MPWDSTYK.js → chunk-DS6PFIZK.js} +1 -1
- package/dist/{chunk-XJVTQUIV.js → chunk-GEQNWNYS.js} +5 -5
- package/dist/{chunk-FHCZMHHE.js → chunk-GVVZPMA5.js} +1 -1
- package/dist/{chunk-NQMKWBKU.js → chunk-HZQEL575.js} +1 -1
- package/dist/{chunk-CF2KCWRE.js → chunk-JZMLRF2G.js} +2 -2
- package/dist/{chunk-X7NRHFZR.js → chunk-LK3VK47W.js} +1 -1
- package/dist/{chunk-2K3Z3XO4.js → chunk-LYM6TT2R.js} +4 -4
- package/dist/{chunk-KG25XMGP.js → chunk-MJZUXQHR.js} +15 -8
- package/dist/{chunk-G2WHYEL7.js → chunk-NROLUUCO.js} +39 -4
- package/dist/{chunk-DRMLIF6M.js → chunk-WHZKRSHQ.js} +19 -12
- package/dist/{chunk-QBKCK6MJ.js → chunk-YNE4FSVX.js} +1 -1
- package/dist/data.cjs +48 -6
- package/dist/data.d.cts +9 -1
- package/dist/data.d.ts +9 -1
- package/dist/data.js +5 -5
- package/dist/devtools.cjs +41 -4
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +41 -4
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +75 -25
- package/dist/extras.js +20 -20
- package/dist/index.cjs +102 -38
- package/dist/index.d.cts +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.js +10 -10
- package/dist/motion.cjs +36 -4
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +41 -4
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +55 -14
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +163 -51
- package/dist/plugins.d.cts +56 -2
- package/dist/plugins.d.ts +56 -2
- package/dist/plugins.js +130 -52
- package/dist/ssr.cjs +50 -9
- package/dist/ssr.js +7 -7
- package/dist/testing.cjs +41 -4
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +41 -4
- package/dist/ui.js +7 -7
- package/dist/widgets.cjs +36 -4
- package/dist/widgets.js +6 -6
- package/package.json +1 -1
package/dist/extras.cjs
CHANGED
|
@@ -245,7 +245,7 @@ __export(extras_exports, {
|
|
|
245
245
|
resetSSRState: () => resetSSRState,
|
|
246
246
|
resize: () => resize,
|
|
247
247
|
resource: () => resource,
|
|
248
|
-
runCleanups: () =>
|
|
248
|
+
runCleanups: () => runCleanups2,
|
|
249
249
|
satisfies: () => satisfies,
|
|
250
250
|
scaleDown: () => scaleDown,
|
|
251
251
|
scaleUp: () => scaleUp,
|
|
@@ -730,6 +730,24 @@ function untracked(fn) {
|
|
|
730
730
|
resumeTracking();
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
+
var currentOwnerScope = null;
|
|
734
|
+
function getOwnerScope() {
|
|
735
|
+
return currentOwnerScope;
|
|
736
|
+
}
|
|
737
|
+
function runWithOwnerScope(scope, fn) {
|
|
738
|
+
const prev = currentOwnerScope;
|
|
739
|
+
currentOwnerScope = scope;
|
|
740
|
+
try {
|
|
741
|
+
return fn();
|
|
742
|
+
} finally {
|
|
743
|
+
currentOwnerScope = prev;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
function bindOwnerScope(fn) {
|
|
747
|
+
const scope = currentOwnerScope;
|
|
748
|
+
if (scope === null) return fn;
|
|
749
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
750
|
+
}
|
|
733
751
|
var subscriberEpochCounter = 0;
|
|
734
752
|
function retrack(effectFn, subscriber) {
|
|
735
753
|
const prev = currentSubscriber;
|
|
@@ -745,6 +763,10 @@ function retrack(effectFn, subscriber) {
|
|
|
745
763
|
currentSubscriber = subscriber;
|
|
746
764
|
const sub2 = subscriber;
|
|
747
765
|
if (sub2._cap === void 0) sub2._cap = currentDisposerCapture();
|
|
766
|
+
const prevScope = currentOwnerScope;
|
|
767
|
+
if (prevScope !== null && !sub2._epoch && sub2._scope === void 0) sub2._scope = prevScope;
|
|
768
|
+
const scope = sub2._scope === void 0 ? null : sub2._scope;
|
|
769
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
748
770
|
const epoch = ++subscriberEpochCounter;
|
|
749
771
|
sub2._epoch = epoch;
|
|
750
772
|
sub2._structDirty = false;
|
|
@@ -757,6 +779,7 @@ function retrack(effectFn, subscriber) {
|
|
|
757
779
|
effectFn();
|
|
758
780
|
} finally {
|
|
759
781
|
currentSubscriber = prev;
|
|
782
|
+
currentOwnerScope = prevScope;
|
|
760
783
|
if (savedDepth !== 0) {
|
|
761
784
|
suspendDepth = savedDepth;
|
|
762
785
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -791,23 +814,26 @@ function track(effectFn, subscriber) {
|
|
|
791
814
|
trackingSuspended = false;
|
|
792
815
|
}
|
|
793
816
|
currentSubscriber = subscriber;
|
|
817
|
+
const sub2 = subscriber;
|
|
818
|
+
if (sub2._scope === void 0) sub2._scope = currentOwnerScope;
|
|
819
|
+
const prevScope = currentOwnerScope;
|
|
820
|
+
currentOwnerScope = sub2._scope;
|
|
794
821
|
try {
|
|
795
822
|
effectFn();
|
|
796
823
|
} finally {
|
|
797
824
|
currentSubscriber = prev;
|
|
825
|
+
currentOwnerScope = prevScope;
|
|
798
826
|
if (savedDepth !== 0) {
|
|
799
827
|
suspendDepth = savedDepth;
|
|
800
828
|
suspendSavedSub = savedSuspendSub;
|
|
801
829
|
trackingSuspended = true;
|
|
802
830
|
}
|
|
803
|
-
|
|
804
|
-
for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
|
|
831
|
+
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
805
832
|
const sig = n.sig;
|
|
806
833
|
sig.__activeNode = n.prevActive;
|
|
807
834
|
n.prevActive = null;
|
|
808
835
|
}
|
|
809
836
|
}
|
|
810
|
-
const sub2 = subscriber;
|
|
811
837
|
return sub2._dispose ?? (sub2._dispose = () => cleanup(subscriber));
|
|
812
838
|
}
|
|
813
839
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -1077,7 +1103,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1077
1103
|
}
|
|
1078
1104
|
|
|
1079
1105
|
// src/reactivity/track.ts
|
|
1080
|
-
var _runtimeVersion = true ? "4.
|
|
1106
|
+
var _runtimeVersion = true ? "4.10.1" : "dev";
|
|
1081
1107
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1082
1108
|
function resolveReactiveApi() {
|
|
1083
1109
|
const g2 = globalThis;
|
|
@@ -1109,6 +1135,9 @@ function resolveReactiveApi() {
|
|
|
1109
1135
|
getSubscriberCount,
|
|
1110
1136
|
getSubscriberDeps,
|
|
1111
1137
|
forEachSubscriber,
|
|
1138
|
+
getOwnerScope,
|
|
1139
|
+
runWithOwnerScope,
|
|
1140
|
+
bindOwnerScope,
|
|
1112
1141
|
version: _runtimeVersion
|
|
1113
1142
|
};
|
|
1114
1143
|
g2[REGISTRY_KEY] = local;
|
|
@@ -1132,6 +1161,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
1132
1161
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
1133
1162
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
1134
1163
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
1164
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
1165
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
1166
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
1135
1167
|
|
|
1136
1168
|
// src/core/devtoolsHook.ts
|
|
1137
1169
|
function emitDevtools(hook, event, payload) {
|
|
@@ -1312,6 +1344,11 @@ function flushUserCleanups(ctx) {
|
|
|
1312
1344
|
const list = ctx.userCleanups;
|
|
1313
1345
|
if (list.length === 0) return;
|
|
1314
1346
|
ctx.userCleanups = [];
|
|
1347
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
1348
|
+
if (scope === getOwnerScope2()) runCleanups(list);
|
|
1349
|
+
else runWithOwnerScope2(scope, () => runCleanups(list));
|
|
1350
|
+
}
|
|
1351
|
+
function runCleanups(list) {
|
|
1315
1352
|
for (let i2 = list.length - 1; i2 >= 0; i2--) {
|
|
1316
1353
|
try {
|
|
1317
1354
|
list[i2]();
|
|
@@ -1806,7 +1843,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1806
1843
|
} = options;
|
|
1807
1844
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
1808
1845
|
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
1809
|
-
const isEnabled = enabledGate ?? (() => enabled);
|
|
1846
|
+
const isEnabled = enabledGate ?? (() => Boolean(enabled));
|
|
1810
1847
|
const cache = getActiveQueryCache();
|
|
1811
1848
|
const [data2, setData] = signal(initialData);
|
|
1812
1849
|
const [isFetching, setIsFetching] = signal(false);
|
|
@@ -1825,6 +1862,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1825
1862
|
let currentKey = null;
|
|
1826
1863
|
let attachedEntry = null;
|
|
1827
1864
|
let attachedKey = null;
|
|
1865
|
+
let lastEnabled = null;
|
|
1828
1866
|
let intervalTimer = null;
|
|
1829
1867
|
const loading = derived(() => isFetching() && data2() === void 0);
|
|
1830
1868
|
const isStale = derived(() => {
|
|
@@ -2025,13 +2063,16 @@ function query(key, fetcher, options = {}) {
|
|
|
2025
2063
|
const key2 = resolveKey();
|
|
2026
2064
|
const on = isEnabled();
|
|
2027
2065
|
const keyChanged = currentKey !== key2;
|
|
2066
|
+
const enabledRose = on && lastEnabled === false;
|
|
2028
2067
|
currentKey = key2;
|
|
2068
|
+
lastEnabled = on;
|
|
2029
2069
|
if (key2 === "") {
|
|
2030
2070
|
detachFromEntry();
|
|
2031
2071
|
setIsFetching(false);
|
|
2032
2072
|
return;
|
|
2033
2073
|
}
|
|
2034
2074
|
const entry = getOrCreateEntry(cache, key2, initialData);
|
|
2075
|
+
const reattached = attachedEntry !== entry;
|
|
2035
2076
|
attachToEntry(entry, key2);
|
|
2036
2077
|
if (keyChanged) setIsFetching(entry.promise !== null);
|
|
2037
2078
|
if (entry.data !== void 0) {
|
|
@@ -2042,7 +2083,8 @@ function query(key, fetcher, options = {}) {
|
|
|
2042
2083
|
setUpdatedAt(entry.dataUpdatedAt);
|
|
2043
2084
|
});
|
|
2044
2085
|
}
|
|
2045
|
-
if (!keyChanged &&
|
|
2086
|
+
if (!keyChanged && !reattached && !enabledRose) return;
|
|
2087
|
+
if (!keyChanged && entry.data !== void 0) {
|
|
2046
2088
|
const isDataStale2 = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
2047
2089
|
if (on && isDataStale2 && !entry.promise) doFetch();
|
|
2048
2090
|
return;
|
|
@@ -9714,16 +9756,20 @@ function lazyChunk(id, loader, registry, fallback) {
|
|
|
9714
9756
|
registry.load(id, async () => {
|
|
9715
9757
|
const mod = await loader();
|
|
9716
9758
|
return typeof mod === "function" ? mod : mod.default;
|
|
9717
|
-
}).then(
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9759
|
+
}).then(
|
|
9760
|
+
// Instantiated after the chunk resolves, in the owner scope of the
|
|
9761
|
+
// render that asked for it — as `lazy()` does.
|
|
9762
|
+
bindOwnerScope2((component) => {
|
|
9763
|
+
if (disposed) return;
|
|
9764
|
+
const node = component();
|
|
9765
|
+
if (disposed) {
|
|
9766
|
+
dispose(node);
|
|
9767
|
+
return;
|
|
9768
|
+
}
|
|
9769
|
+
clearChildren(container);
|
|
9770
|
+
container.appendChild(node);
|
|
9771
|
+
})
|
|
9772
|
+
).catch((err) => {
|
|
9727
9773
|
if (disposed) return;
|
|
9728
9774
|
clearChildren(container);
|
|
9729
9775
|
const errorEl = document.createElement("div");
|
|
@@ -11164,11 +11210,15 @@ function defineRemoteComponent(name, loader) {
|
|
|
11164
11210
|
registerDisposer(container, () => {
|
|
11165
11211
|
disposed = true;
|
|
11166
11212
|
});
|
|
11167
|
-
loader().then(
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11213
|
+
loader().then(
|
|
11214
|
+
// Instantiated after the module resolves, in the owner scope of the
|
|
11215
|
+
// render that asked for it — as `lazy()` does.
|
|
11216
|
+
bindOwnerScope2((mod) => {
|
|
11217
|
+
cached = mod.default;
|
|
11218
|
+
if (disposed) return;
|
|
11219
|
+
replaceChildrenSafely(container, cached());
|
|
11220
|
+
})
|
|
11221
|
+
).catch((err) => {
|
|
11172
11222
|
if (disposed) return;
|
|
11173
11223
|
const message = err instanceof Error ? err.message : String(err);
|
|
11174
11224
|
replaceChildrenSafely(
|
|
@@ -11981,7 +12031,7 @@ var CDN_ENTRY_POINTS = {
|
|
|
11981
12031
|
};
|
|
11982
12032
|
var packageInfo = {
|
|
11983
12033
|
name: "sibujs",
|
|
11984
|
-
version: true ? "4.
|
|
12034
|
+
version: true ? "4.10.1" : "dev",
|
|
11985
12035
|
entryPoints: MODULE_ENTRY_POINTS,
|
|
11986
12036
|
/**
|
|
11987
12037
|
* Generate the package.json `exports` map. Module entries resolve to the
|
|
@@ -12126,7 +12176,7 @@ var env = {
|
|
|
12126
12176
|
};
|
|
12127
12177
|
|
|
12128
12178
|
// src/plugins/versioning.ts
|
|
12129
|
-
var VERSION = true ? "4.
|
|
12179
|
+
var VERSION = true ? "4.10.1" : "dev";
|
|
12130
12180
|
var NUM = "(?:0|[1-9]\\d*)";
|
|
12131
12181
|
var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
|
|
12132
12182
|
var BUILD_ID = "[0-9a-zA-Z-]+";
|
|
@@ -12728,7 +12778,7 @@ function trackCleanup(component, cleanup3) {
|
|
|
12728
12778
|
}
|
|
12729
12779
|
trackedCleanups.get(component)?.push(cleanup3);
|
|
12730
12780
|
}
|
|
12731
|
-
function
|
|
12781
|
+
function runCleanups2(component) {
|
|
12732
12782
|
const cleanups = trackedCleanups.get(component);
|
|
12733
12783
|
if (cleanups) {
|
|
12734
12784
|
for (const cleanup3 of cleanups) {
|
package/dist/extras.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
optimisticList,
|
|
6
6
|
persisted,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CYUU3XXG.js";
|
|
9
9
|
import {
|
|
10
10
|
DOMPool,
|
|
11
11
|
Features,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
transitionState,
|
|
42
42
|
uniqueId,
|
|
43
43
|
yieldToMain
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-WHZKRSHQ.js";
|
|
45
45
|
import {
|
|
46
46
|
MigrationStorageError,
|
|
47
47
|
VERSION,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
preloadCritical,
|
|
64
64
|
prerenderRoutes,
|
|
65
65
|
satisfies
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-JZMLRF2G.js";
|
|
67
67
|
import {
|
|
68
68
|
Head,
|
|
69
69
|
clearWasmCache,
|
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
wasm,
|
|
90
90
|
worker,
|
|
91
91
|
workerFn
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-MJZUXQHR.js";
|
|
93
93
|
import {
|
|
94
94
|
FocusTrap,
|
|
95
95
|
VirtualList,
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
toast,
|
|
131
131
|
withScopedStyle,
|
|
132
132
|
zipMask
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-GEQNWNYS.js";
|
|
134
134
|
import {
|
|
135
135
|
RenderProp,
|
|
136
136
|
assertType,
|
|
@@ -157,7 +157,7 @@ import {
|
|
|
157
157
|
select,
|
|
158
158
|
tabs,
|
|
159
159
|
tooltip
|
|
160
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-LYM6TT2R.js";
|
|
161
161
|
import {
|
|
162
162
|
__resetSpeechCoordinator,
|
|
163
163
|
animationFrame,
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
visibility,
|
|
197
197
|
wakeLock,
|
|
198
198
|
windowSize
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-42REZXE4.js";
|
|
200
200
|
import "./chunk-52XFPGSN.js";
|
|
201
201
|
import {
|
|
202
202
|
__resetQueryCache,
|
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
throttle,
|
|
223
223
|
withLoader,
|
|
224
224
|
withRetry
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-ADJEMTRC.js";
|
|
226
226
|
import {
|
|
227
227
|
SibuError,
|
|
228
228
|
checkLeaks,
|
|
@@ -260,7 +260,7 @@ import {
|
|
|
260
260
|
trackCleanup,
|
|
261
261
|
walkDependencyGraph,
|
|
262
262
|
withErrorTracking
|
|
263
|
-
} from "./chunk-
|
|
263
|
+
} from "./chunk-CID4BYBF.js";
|
|
264
264
|
import {
|
|
265
265
|
antdAdapter,
|
|
266
266
|
chakraAdapter,
|
|
@@ -270,7 +270,7 @@ import {
|
|
|
270
270
|
mobXAdapter,
|
|
271
271
|
reduxAdapter,
|
|
272
272
|
zustandAdapter
|
|
273
|
-
} from "./chunk-
|
|
273
|
+
} from "./chunk-2D47RVVK.js";
|
|
274
274
|
import {
|
|
275
275
|
PluginInstallCancelledError,
|
|
276
276
|
createPlugin,
|
|
@@ -284,7 +284,7 @@ import {
|
|
|
284
284
|
triggerPluginMount,
|
|
285
285
|
triggerPluginUnmount
|
|
286
286
|
} from "./chunk-J6FW5TV6.js";
|
|
287
|
-
import "./chunk-
|
|
287
|
+
import "./chunk-YNE4FSVX.js";
|
|
288
288
|
import {
|
|
289
289
|
collectStream,
|
|
290
290
|
deserializeState,
|
|
@@ -305,15 +305,15 @@ import {
|
|
|
305
305
|
suspenseSwapScript,
|
|
306
306
|
trustHTML
|
|
307
307
|
} from "./chunk-FC6KCJSA.js";
|
|
308
|
-
import "./chunk-
|
|
309
|
-
import "./chunk-
|
|
308
|
+
import "./chunk-DA2LJXK3.js";
|
|
309
|
+
import "./chunk-GVVZPMA5.js";
|
|
310
310
|
import "./chunk-62BDYGAG.js";
|
|
311
|
-
import "./chunk-
|
|
312
|
-
import "./chunk-
|
|
311
|
+
import "./chunk-2T73SWKF.js";
|
|
312
|
+
import "./chunk-DS6PFIZK.js";
|
|
313
313
|
import "./chunk-3ACAAQIN.js";
|
|
314
|
-
import "./chunk-
|
|
314
|
+
import "./chunk-LK3VK47W.js";
|
|
315
315
|
import "./chunk-7ZHH77QA.js";
|
|
316
|
-
import "./chunk-
|
|
316
|
+
import "./chunk-6DYRY2NF.js";
|
|
317
317
|
import "./chunk-EXXSN3BW.js";
|
|
318
318
|
import "./chunk-7XHATCIH.js";
|
|
319
319
|
import {
|
|
@@ -338,10 +338,10 @@ import {
|
|
|
338
338
|
stagger,
|
|
339
339
|
transition,
|
|
340
340
|
viewTransition
|
|
341
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-HZQEL575.js";
|
|
342
342
|
import "./chunk-5HZXGZ6T.js";
|
|
343
|
-
import "./chunk-
|
|
344
|
-
import "./chunk-
|
|
343
|
+
import "./chunk-BNZDDNBR.js";
|
|
344
|
+
import "./chunk-NROLUUCO.js";
|
|
345
345
|
import "./chunk-NYNYSPK7.js";
|
|
346
346
|
export {
|
|
347
347
|
DOMPool,
|
package/dist/index.cjs
CHANGED
|
@@ -1350,6 +1350,24 @@ function untracked(fn) {
|
|
|
1350
1350
|
resumeTracking();
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
1353
|
+
var currentOwnerScope = null;
|
|
1354
|
+
function getOwnerScope() {
|
|
1355
|
+
return currentOwnerScope;
|
|
1356
|
+
}
|
|
1357
|
+
function runWithOwnerScope(scope, fn) {
|
|
1358
|
+
const prev = currentOwnerScope;
|
|
1359
|
+
currentOwnerScope = scope;
|
|
1360
|
+
try {
|
|
1361
|
+
return fn();
|
|
1362
|
+
} finally {
|
|
1363
|
+
currentOwnerScope = prev;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function bindOwnerScope(fn) {
|
|
1367
|
+
const scope = currentOwnerScope;
|
|
1368
|
+
if (scope === null) return fn;
|
|
1369
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
1370
|
+
}
|
|
1353
1371
|
var subscriberEpochCounter = 0;
|
|
1354
1372
|
function retrack(effectFn, subscriber) {
|
|
1355
1373
|
const prev = currentSubscriber;
|
|
@@ -1365,6 +1383,10 @@ function retrack(effectFn, subscriber) {
|
|
|
1365
1383
|
currentSubscriber = subscriber;
|
|
1366
1384
|
const sub2 = subscriber;
|
|
1367
1385
|
if (sub2._cap === void 0) sub2._cap = currentDisposerCapture();
|
|
1386
|
+
const prevScope = currentOwnerScope;
|
|
1387
|
+
if (prevScope !== null && !sub2._epoch && sub2._scope === void 0) sub2._scope = prevScope;
|
|
1388
|
+
const scope = sub2._scope === void 0 ? null : sub2._scope;
|
|
1389
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
1368
1390
|
const epoch = ++subscriberEpochCounter;
|
|
1369
1391
|
sub2._epoch = epoch;
|
|
1370
1392
|
sub2._structDirty = false;
|
|
@@ -1377,6 +1399,7 @@ function retrack(effectFn, subscriber) {
|
|
|
1377
1399
|
effectFn();
|
|
1378
1400
|
} finally {
|
|
1379
1401
|
currentSubscriber = prev;
|
|
1402
|
+
currentOwnerScope = prevScope;
|
|
1380
1403
|
if (savedDepth !== 0) {
|
|
1381
1404
|
suspendDepth = savedDepth;
|
|
1382
1405
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -1411,23 +1434,26 @@ function track(effectFn, subscriber) {
|
|
|
1411
1434
|
trackingSuspended = false;
|
|
1412
1435
|
}
|
|
1413
1436
|
currentSubscriber = subscriber;
|
|
1437
|
+
const sub2 = subscriber;
|
|
1438
|
+
if (sub2._scope === void 0) sub2._scope = currentOwnerScope;
|
|
1439
|
+
const prevScope = currentOwnerScope;
|
|
1440
|
+
currentOwnerScope = sub2._scope;
|
|
1414
1441
|
try {
|
|
1415
1442
|
effectFn();
|
|
1416
1443
|
} finally {
|
|
1417
1444
|
currentSubscriber = prev;
|
|
1445
|
+
currentOwnerScope = prevScope;
|
|
1418
1446
|
if (savedDepth !== 0) {
|
|
1419
1447
|
suspendDepth = savedDepth;
|
|
1420
1448
|
suspendSavedSub = savedSuspendSub;
|
|
1421
1449
|
trackingSuspended = true;
|
|
1422
1450
|
}
|
|
1423
|
-
|
|
1424
|
-
for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
|
|
1451
|
+
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
1425
1452
|
const sig = n.sig;
|
|
1426
1453
|
sig.__activeNode = n.prevActive;
|
|
1427
1454
|
n.prevActive = null;
|
|
1428
1455
|
}
|
|
1429
1456
|
}
|
|
1430
|
-
const sub2 = subscriber;
|
|
1431
1457
|
return sub2._dispose ?? (sub2._dispose = () => cleanup(subscriber));
|
|
1432
1458
|
}
|
|
1433
1459
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -1697,7 +1723,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1697
1723
|
}
|
|
1698
1724
|
|
|
1699
1725
|
// src/reactivity/track.ts
|
|
1700
|
-
var _runtimeVersion = true ? "4.
|
|
1726
|
+
var _runtimeVersion = true ? "4.10.1" : "dev";
|
|
1701
1727
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1702
1728
|
function resolveReactiveApi() {
|
|
1703
1729
|
const g2 = globalThis;
|
|
@@ -1729,6 +1755,9 @@ function resolveReactiveApi() {
|
|
|
1729
1755
|
getSubscriberCount,
|
|
1730
1756
|
getSubscriberDeps,
|
|
1731
1757
|
forEachSubscriber,
|
|
1758
|
+
getOwnerScope,
|
|
1759
|
+
runWithOwnerScope,
|
|
1760
|
+
bindOwnerScope,
|
|
1732
1761
|
version: _runtimeVersion
|
|
1733
1762
|
};
|
|
1734
1763
|
g2[REGISTRY_KEY] = local;
|
|
@@ -1752,6 +1781,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
1752
1781
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
1753
1782
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
1754
1783
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
1784
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
1785
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
1786
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
1755
1787
|
|
|
1756
1788
|
// src/reactivity/bindAttribute.ts
|
|
1757
1789
|
function bindAttribute(el, attr, getter) {
|
|
@@ -2425,12 +2457,16 @@ function lazy(importFn) {
|
|
|
2425
2457
|
}
|
|
2426
2458
|
const container = div({ class: "sibu-lazy" });
|
|
2427
2459
|
let disposed = false;
|
|
2428
|
-
importFn().then(
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2460
|
+
importFn().then(
|
|
2461
|
+
// The component renders after the import resolves, in the owner scope
|
|
2462
|
+
// of whoever rendered the placeholder.
|
|
2463
|
+
bindOwnerScope2((mod) => {
|
|
2464
|
+
if (disposed) return;
|
|
2465
|
+
cached = mod.default;
|
|
2466
|
+
const rendered = cached();
|
|
2467
|
+
replaceChildrenSafely(container, rendered);
|
|
2468
|
+
})
|
|
2469
|
+
).catch((err) => {
|
|
2434
2470
|
if (disposed) return;
|
|
2435
2471
|
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
2436
2472
|
replaceChildrenSafely(
|
|
@@ -2461,7 +2497,7 @@ function Suspense({ nodes, fallback }) {
|
|
|
2461
2497
|
}
|
|
2462
2498
|
if (childEl && !container.contains(childEl)) dispose(childEl);
|
|
2463
2499
|
});
|
|
2464
|
-
|
|
2500
|
+
const renderContent = bindOwnerScope2(() => {
|
|
2465
2501
|
if (suspenseDisposed) return;
|
|
2466
2502
|
try {
|
|
2467
2503
|
const el = nodes();
|
|
@@ -2489,10 +2525,14 @@ function Suspense({ nodes, fallback }) {
|
|
|
2489
2525
|
dispatchPropagate(container, errorObj);
|
|
2490
2526
|
}
|
|
2491
2527
|
});
|
|
2528
|
+
queueMicrotask(renderContent);
|
|
2492
2529
|
return container;
|
|
2493
2530
|
}
|
|
2494
2531
|
|
|
2495
2532
|
// src/core/rendering/lifecycle.ts
|
|
2533
|
+
function pinScope(scope, fn) {
|
|
2534
|
+
return () => getOwnerScope2() === scope ? fn() : runWithOwnerScope2(scope, fn);
|
|
2535
|
+
}
|
|
2496
2536
|
function safeCall(cb, hookName) {
|
|
2497
2537
|
try {
|
|
2498
2538
|
return cb();
|
|
@@ -2502,13 +2542,14 @@ function safeCall(cb, hookName) {
|
|
|
2502
2542
|
return void 0;
|
|
2503
2543
|
}
|
|
2504
2544
|
}
|
|
2505
|
-
function runMountCallback(callback, hookName, element, isDisposed) {
|
|
2506
|
-
const
|
|
2507
|
-
if (typeof
|
|
2545
|
+
function runMountCallback(callback, hookName, element, isDisposed, scope) {
|
|
2546
|
+
const returned = safeCall(callback, hookName);
|
|
2547
|
+
if (typeof returned !== "function") return;
|
|
2548
|
+
const cleanup3 = pinScope(scope, returned);
|
|
2508
2549
|
if (isDisposed() || !element.isConnected) {
|
|
2509
2550
|
safeCall(cleanup3, "onUnmount");
|
|
2510
2551
|
} else {
|
|
2511
|
-
|
|
2552
|
+
watchUnmount(cleanup3, element);
|
|
2512
2553
|
}
|
|
2513
2554
|
}
|
|
2514
2555
|
var mountWatchers = /* @__PURE__ */ new WeakMap();
|
|
@@ -2668,6 +2709,8 @@ function registerUnmountWatcher(element, cb) {
|
|
|
2668
2709
|
}
|
|
2669
2710
|
function onMount(callback, element) {
|
|
2670
2711
|
if (typeof document === "undefined") return;
|
|
2712
|
+
const scope = getOwnerScope2();
|
|
2713
|
+
callback = pinScope(scope, callback);
|
|
2671
2714
|
if (element) {
|
|
2672
2715
|
let disposed = false;
|
|
2673
2716
|
const isDisposed = () => disposed;
|
|
@@ -2677,19 +2720,19 @@ function onMount(callback, element) {
|
|
|
2677
2720
|
if (element.isConnected) {
|
|
2678
2721
|
queueMicrotask(() => {
|
|
2679
2722
|
if (disposed) return;
|
|
2680
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
2723
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
2681
2724
|
});
|
|
2682
2725
|
return;
|
|
2683
2726
|
}
|
|
2684
2727
|
queueMicrotask(() => {
|
|
2685
2728
|
if (disposed) return;
|
|
2686
2729
|
if (element.isConnected) {
|
|
2687
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
2730
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
2688
2731
|
return;
|
|
2689
2732
|
}
|
|
2690
2733
|
const unregister = registerMountWatcher(element, () => {
|
|
2691
2734
|
if (disposed) return;
|
|
2692
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
2735
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
2693
2736
|
});
|
|
2694
2737
|
registerDisposer(element, unregister);
|
|
2695
2738
|
});
|
|
@@ -2701,6 +2744,9 @@ function onMount(callback, element) {
|
|
|
2701
2744
|
}
|
|
2702
2745
|
function onUnmount(callback, element) {
|
|
2703
2746
|
if (typeof document === "undefined") return;
|
|
2747
|
+
watchUnmount(pinScope(getOwnerScope2(), callback), element);
|
|
2748
|
+
}
|
|
2749
|
+
function watchUnmount(callback, element) {
|
|
2704
2750
|
let fired = false;
|
|
2705
2751
|
const fireOnce = () => {
|
|
2706
2752
|
if (fired) return;
|
|
@@ -2863,6 +2909,11 @@ function flushUserCleanups(ctx) {
|
|
|
2863
2909
|
const list = ctx.userCleanups;
|
|
2864
2910
|
if (list.length === 0) return;
|
|
2865
2911
|
ctx.userCleanups = [];
|
|
2912
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
2913
|
+
if (scope === getOwnerScope2()) runCleanups(list);
|
|
2914
|
+
else runWithOwnerScope2(scope, () => runCleanups(list));
|
|
2915
|
+
}
|
|
2916
|
+
function runCleanups(list) {
|
|
2866
2917
|
for (let i2 = list.length - 1; i2 >= 0; i2--) {
|
|
2867
2918
|
try {
|
|
2868
2919
|
list[i2]();
|
|
@@ -3792,11 +3843,15 @@ function ErrorBoundary(optionsOrChildren, maybeChildren) {
|
|
|
3792
3843
|
return;
|
|
3793
3844
|
}
|
|
3794
3845
|
replaceChildrenSafely(asyncContainer, el);
|
|
3795
|
-
}).catch(
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3846
|
+
}).catch(
|
|
3847
|
+
// The fallback is rendered later, in the owner scope of the
|
|
3848
|
+
// render that produced the async child.
|
|
3849
|
+
bindOwnerScope2((e) => {
|
|
3850
|
+
if (asyncDisposed) return;
|
|
3851
|
+
const err = handleError(e);
|
|
3852
|
+
replaceChildrenSafely(asyncContainer, tryRenderFallback(err));
|
|
3853
|
+
})
|
|
3854
|
+
);
|
|
3800
3855
|
return asyncContainer;
|
|
3801
3856
|
}
|
|
3802
3857
|
return result;
|
|
@@ -4249,9 +4304,11 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
4249
4304
|
currentNode = null;
|
|
4250
4305
|
});
|
|
4251
4306
|
if (!initialized) {
|
|
4252
|
-
queueMicrotask(
|
|
4253
|
-
|
|
4254
|
-
|
|
4307
|
+
queueMicrotask(
|
|
4308
|
+
bindOwnerScope2(() => {
|
|
4309
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
4310
|
+
})
|
|
4311
|
+
);
|
|
4255
4312
|
}
|
|
4256
4313
|
return anchor;
|
|
4257
4314
|
}
|
|
@@ -4290,9 +4347,11 @@ function match(value, cases, fallback) {
|
|
|
4290
4347
|
currentNode = null;
|
|
4291
4348
|
});
|
|
4292
4349
|
if (!initialized) {
|
|
4293
|
-
queueMicrotask(
|
|
4294
|
-
|
|
4295
|
-
|
|
4350
|
+
queueMicrotask(
|
|
4351
|
+
bindOwnerScope2(() => {
|
|
4352
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
4353
|
+
})
|
|
4354
|
+
);
|
|
4296
4355
|
}
|
|
4297
4356
|
return anchor;
|
|
4298
4357
|
}
|
|
@@ -4590,11 +4649,13 @@ function each(getArray, render, options) {
|
|
|
4590
4649
|
};
|
|
4591
4650
|
registerDisposer(anchor, disposeRange);
|
|
4592
4651
|
if (!initialized) {
|
|
4593
|
-
queueMicrotask(
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4652
|
+
queueMicrotask(
|
|
4653
|
+
bindOwnerScope2(() => {
|
|
4654
|
+
if (!initialized && !rangeDisposed && anchor.parentNode) {
|
|
4655
|
+
update();
|
|
4656
|
+
}
|
|
4657
|
+
})
|
|
4658
|
+
);
|
|
4598
4659
|
}
|
|
4599
4660
|
return anchor;
|
|
4600
4661
|
}
|
|
@@ -5072,9 +5133,11 @@ function KeepAlive(activeKey, cases, options) {
|
|
|
5072
5133
|
};
|
|
5073
5134
|
const untrack = track2(update);
|
|
5074
5135
|
if (!initialized) {
|
|
5075
|
-
queueMicrotask(
|
|
5076
|
-
|
|
5077
|
-
|
|
5136
|
+
queueMicrotask(
|
|
5137
|
+
bindOwnerScope2(() => {
|
|
5138
|
+
if (!initialized && anchor.parentNode) update();
|
|
5139
|
+
})
|
|
5140
|
+
);
|
|
5078
5141
|
}
|
|
5079
5142
|
registerDisposer(anchor, () => {
|
|
5080
5143
|
disposed = true;
|
|
@@ -5179,7 +5242,7 @@ function Portal(nodes, target) {
|
|
|
5179
5242
|
const container = target || document.body;
|
|
5180
5243
|
let portalContent = null;
|
|
5181
5244
|
let disposed = false;
|
|
5182
|
-
|
|
5245
|
+
const renderContent = bindOwnerScope2(() => {
|
|
5183
5246
|
if (disposed) return;
|
|
5184
5247
|
try {
|
|
5185
5248
|
portalContent = nodes();
|
|
@@ -5194,6 +5257,7 @@ function Portal(nodes, target) {
|
|
|
5194
5257
|
});
|
|
5195
5258
|
}
|
|
5196
5259
|
});
|
|
5260
|
+
queueMicrotask(renderContent);
|
|
5197
5261
|
registerDisposer(anchor, () => {
|
|
5198
5262
|
disposed = true;
|
|
5199
5263
|
if (portalContent) {
|