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
|
@@ -151,6 +151,24 @@ function untracked(fn) {
|
|
|
151
151
|
resumeTracking();
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
var currentOwnerScope = null;
|
|
155
|
+
function getOwnerScope() {
|
|
156
|
+
return currentOwnerScope;
|
|
157
|
+
}
|
|
158
|
+
function runWithOwnerScope(scope, fn) {
|
|
159
|
+
const prev = currentOwnerScope;
|
|
160
|
+
currentOwnerScope = scope;
|
|
161
|
+
try {
|
|
162
|
+
return fn();
|
|
163
|
+
} finally {
|
|
164
|
+
currentOwnerScope = prev;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function bindOwnerScope(fn) {
|
|
168
|
+
const scope = currentOwnerScope;
|
|
169
|
+
if (scope === null) return fn;
|
|
170
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
171
|
+
}
|
|
154
172
|
var subscriberEpochCounter = 0;
|
|
155
173
|
function retrack(effectFn, subscriber) {
|
|
156
174
|
const prev = currentSubscriber;
|
|
@@ -166,6 +184,10 @@ function retrack(effectFn, subscriber) {
|
|
|
166
184
|
currentSubscriber = subscriber;
|
|
167
185
|
const sub = subscriber;
|
|
168
186
|
if (sub._cap === void 0) sub._cap = currentDisposerCapture();
|
|
187
|
+
const prevScope = currentOwnerScope;
|
|
188
|
+
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
189
|
+
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
190
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
169
191
|
const epoch = ++subscriberEpochCounter;
|
|
170
192
|
sub._epoch = epoch;
|
|
171
193
|
sub._structDirty = false;
|
|
@@ -178,6 +200,7 @@ function retrack(effectFn, subscriber) {
|
|
|
178
200
|
effectFn();
|
|
179
201
|
} finally {
|
|
180
202
|
currentSubscriber = prev;
|
|
203
|
+
currentOwnerScope = prevScope;
|
|
181
204
|
if (savedDepth !== 0) {
|
|
182
205
|
suspendDepth = savedDepth;
|
|
183
206
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -212,23 +235,26 @@ function track(effectFn, subscriber) {
|
|
|
212
235
|
trackingSuspended = false;
|
|
213
236
|
}
|
|
214
237
|
currentSubscriber = subscriber;
|
|
238
|
+
const sub = subscriber;
|
|
239
|
+
if (sub._scope === void 0) sub._scope = currentOwnerScope;
|
|
240
|
+
const prevScope = currentOwnerScope;
|
|
241
|
+
currentOwnerScope = sub._scope;
|
|
215
242
|
try {
|
|
216
243
|
effectFn();
|
|
217
244
|
} finally {
|
|
218
245
|
currentSubscriber = prev;
|
|
246
|
+
currentOwnerScope = prevScope;
|
|
219
247
|
if (savedDepth !== 0) {
|
|
220
248
|
suspendDepth = savedDepth;
|
|
221
249
|
suspendSavedSub = savedSuspendSub;
|
|
222
250
|
trackingSuspended = true;
|
|
223
251
|
}
|
|
224
|
-
|
|
225
|
-
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
252
|
+
for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
|
|
226
253
|
const sig = n.sig;
|
|
227
254
|
sig.__activeNode = n.prevActive;
|
|
228
255
|
n.prevActive = null;
|
|
229
256
|
}
|
|
230
257
|
}
|
|
231
|
-
const sub = subscriber;
|
|
232
258
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
233
259
|
}
|
|
234
260
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -498,7 +524,7 @@ function forEachSubscriber(signal, visit) {
|
|
|
498
524
|
}
|
|
499
525
|
|
|
500
526
|
// src/reactivity/track.ts
|
|
501
|
-
var _runtimeVersion = true ? "4.
|
|
527
|
+
var _runtimeVersion = true ? "4.10.1" : "dev";
|
|
502
528
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
503
529
|
function resolveReactiveApi() {
|
|
504
530
|
const g = globalThis;
|
|
@@ -530,6 +556,9 @@ function resolveReactiveApi() {
|
|
|
530
556
|
getSubscriberCount,
|
|
531
557
|
getSubscriberDeps,
|
|
532
558
|
forEachSubscriber,
|
|
559
|
+
getOwnerScope,
|
|
560
|
+
runWithOwnerScope,
|
|
561
|
+
bindOwnerScope,
|
|
533
562
|
version: _runtimeVersion
|
|
534
563
|
};
|
|
535
564
|
g[REGISTRY_KEY] = local;
|
|
@@ -553,6 +582,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
553
582
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
554
583
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
555
584
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
585
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
586
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
587
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
556
588
|
|
|
557
589
|
// src/core/devtoolsHook.ts
|
|
558
590
|
function emitDevtools(hook, event, payload) {
|
|
@@ -579,5 +611,8 @@ export {
|
|
|
579
611
|
getSubscriberCount2 as getSubscriberCount,
|
|
580
612
|
getSubscriberDeps2 as getSubscriberDeps,
|
|
581
613
|
forEachSubscriber2 as forEachSubscriber,
|
|
614
|
+
getOwnerScope2 as getOwnerScope,
|
|
615
|
+
runWithOwnerScope2 as runWithOwnerScope,
|
|
616
|
+
bindOwnerScope2 as bindOwnerScope,
|
|
582
617
|
emitDevtools
|
|
583
618
|
};
|
|
@@ -6,13 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6DYRY2NF.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeUrl
|
|
12
12
|
} from "./chunk-EXXSN3BW.js";
|
|
13
13
|
import {
|
|
14
14
|
signal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BNZDDNBR.js";
|
|
16
|
+
import {
|
|
17
|
+
bindOwnerScope
|
|
18
|
+
} from "./chunk-NROLUUCO.js";
|
|
16
19
|
import {
|
|
17
20
|
DEV,
|
|
18
21
|
devWarn,
|
|
@@ -785,16 +788,20 @@ function lazyChunk(id, loader, registry, fallback) {
|
|
|
785
788
|
registry.load(id, async () => {
|
|
786
789
|
const mod = await loader();
|
|
787
790
|
return typeof mod === "function" ? mod : mod.default;
|
|
788
|
-
}).then(
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
791
|
+
}).then(
|
|
792
|
+
// Instantiated after the chunk resolves, in the owner scope of the
|
|
793
|
+
// render that asked for it — as `lazy()` does.
|
|
794
|
+
bindOwnerScope((component) => {
|
|
795
|
+
if (disposed) return;
|
|
796
|
+
const node = component();
|
|
797
|
+
if (disposed) {
|
|
798
|
+
dispose(node);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
clearChildren(container);
|
|
802
|
+
container.appendChild(node);
|
|
803
|
+
})
|
|
804
|
+
).catch((err) => {
|
|
798
805
|
if (disposed) return;
|
|
799
806
|
clearChildren(container);
|
|
800
807
|
const errorEl = document.createElement("div");
|
package/dist/data.cjs
CHANGED
|
@@ -313,6 +313,24 @@ function untracked(fn) {
|
|
|
313
313
|
resumeTracking();
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
+
var currentOwnerScope = null;
|
|
317
|
+
function getOwnerScope() {
|
|
318
|
+
return currentOwnerScope;
|
|
319
|
+
}
|
|
320
|
+
function runWithOwnerScope(scope, fn) {
|
|
321
|
+
const prev = currentOwnerScope;
|
|
322
|
+
currentOwnerScope = scope;
|
|
323
|
+
try {
|
|
324
|
+
return fn();
|
|
325
|
+
} finally {
|
|
326
|
+
currentOwnerScope = prev;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function bindOwnerScope(fn) {
|
|
330
|
+
const scope = currentOwnerScope;
|
|
331
|
+
if (scope === null) return fn;
|
|
332
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
333
|
+
}
|
|
316
334
|
var subscriberEpochCounter = 0;
|
|
317
335
|
function retrack(effectFn, subscriber) {
|
|
318
336
|
const prev = currentSubscriber;
|
|
@@ -328,6 +346,10 @@ function retrack(effectFn, subscriber) {
|
|
|
328
346
|
currentSubscriber = subscriber;
|
|
329
347
|
const sub = subscriber;
|
|
330
348
|
if (sub._cap === void 0) sub._cap = currentDisposerCapture();
|
|
349
|
+
const prevScope = currentOwnerScope;
|
|
350
|
+
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
351
|
+
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
352
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
331
353
|
const epoch = ++subscriberEpochCounter;
|
|
332
354
|
sub._epoch = epoch;
|
|
333
355
|
sub._structDirty = false;
|
|
@@ -340,6 +362,7 @@ function retrack(effectFn, subscriber) {
|
|
|
340
362
|
effectFn();
|
|
341
363
|
} finally {
|
|
342
364
|
currentSubscriber = prev;
|
|
365
|
+
currentOwnerScope = prevScope;
|
|
343
366
|
if (savedDepth !== 0) {
|
|
344
367
|
suspendDepth = savedDepth;
|
|
345
368
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -374,23 +397,26 @@ function track(effectFn, subscriber) {
|
|
|
374
397
|
trackingSuspended = false;
|
|
375
398
|
}
|
|
376
399
|
currentSubscriber = subscriber;
|
|
400
|
+
const sub = subscriber;
|
|
401
|
+
if (sub._scope === void 0) sub._scope = currentOwnerScope;
|
|
402
|
+
const prevScope = currentOwnerScope;
|
|
403
|
+
currentOwnerScope = sub._scope;
|
|
377
404
|
try {
|
|
378
405
|
effectFn();
|
|
379
406
|
} finally {
|
|
380
407
|
currentSubscriber = prev;
|
|
408
|
+
currentOwnerScope = prevScope;
|
|
381
409
|
if (savedDepth !== 0) {
|
|
382
410
|
suspendDepth = savedDepth;
|
|
383
411
|
suspendSavedSub = savedSuspendSub;
|
|
384
412
|
trackingSuspended = true;
|
|
385
413
|
}
|
|
386
|
-
|
|
387
|
-
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
414
|
+
for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
|
|
388
415
|
const sig = n.sig;
|
|
389
416
|
sig.__activeNode = n.prevActive;
|
|
390
417
|
n.prevActive = null;
|
|
391
418
|
}
|
|
392
419
|
}
|
|
393
|
-
const sub = subscriber;
|
|
394
420
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
395
421
|
}
|
|
396
422
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -660,7 +686,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
660
686
|
}
|
|
661
687
|
|
|
662
688
|
// src/reactivity/track.ts
|
|
663
|
-
var _runtimeVersion = true ? "4.
|
|
689
|
+
var _runtimeVersion = true ? "4.10.1" : "dev";
|
|
664
690
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
665
691
|
function resolveReactiveApi() {
|
|
666
692
|
const g = globalThis;
|
|
@@ -692,6 +718,9 @@ function resolveReactiveApi() {
|
|
|
692
718
|
getSubscriberCount,
|
|
693
719
|
getSubscriberDeps,
|
|
694
720
|
forEachSubscriber,
|
|
721
|
+
getOwnerScope,
|
|
722
|
+
runWithOwnerScope,
|
|
723
|
+
bindOwnerScope,
|
|
695
724
|
version: _runtimeVersion
|
|
696
725
|
};
|
|
697
726
|
g[REGISTRY_KEY] = local;
|
|
@@ -715,6 +744,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
715
744
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
716
745
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
717
746
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
747
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
748
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
749
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
718
750
|
|
|
719
751
|
// src/core/devtoolsHook.ts
|
|
720
752
|
function emitDevtools(hook, event, payload) {
|
|
@@ -891,6 +923,11 @@ function flushUserCleanups(ctx) {
|
|
|
891
923
|
const list = ctx.userCleanups;
|
|
892
924
|
if (list.length === 0) return;
|
|
893
925
|
ctx.userCleanups = [];
|
|
926
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
927
|
+
if (scope === getOwnerScope2()) runCleanups(list);
|
|
928
|
+
else runWithOwnerScope2(scope, () => runCleanups(list));
|
|
929
|
+
}
|
|
930
|
+
function runCleanups(list) {
|
|
894
931
|
for (let i = list.length - 1; i >= 0; i--) {
|
|
895
932
|
try {
|
|
896
933
|
list[i]();
|
|
@@ -1385,7 +1422,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1385
1422
|
} = options;
|
|
1386
1423
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
1387
1424
|
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
1388
|
-
const isEnabled = enabledGate ?? (() => enabled);
|
|
1425
|
+
const isEnabled = enabledGate ?? (() => Boolean(enabled));
|
|
1389
1426
|
const cache = getActiveQueryCache();
|
|
1390
1427
|
const [data, setData] = signal(initialData);
|
|
1391
1428
|
const [isFetching, setIsFetching] = signal(false);
|
|
@@ -1404,6 +1441,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1404
1441
|
let currentKey = null;
|
|
1405
1442
|
let attachedEntry = null;
|
|
1406
1443
|
let attachedKey = null;
|
|
1444
|
+
let lastEnabled = null;
|
|
1407
1445
|
let intervalTimer = null;
|
|
1408
1446
|
const loading = derived(() => isFetching() && data() === void 0);
|
|
1409
1447
|
const isStale = derived(() => {
|
|
@@ -1604,13 +1642,16 @@ function query(key, fetcher, options = {}) {
|
|
|
1604
1642
|
const key2 = resolveKey();
|
|
1605
1643
|
const on = isEnabled();
|
|
1606
1644
|
const keyChanged = currentKey !== key2;
|
|
1645
|
+
const enabledRose = on && lastEnabled === false;
|
|
1607
1646
|
currentKey = key2;
|
|
1647
|
+
lastEnabled = on;
|
|
1608
1648
|
if (key2 === "") {
|
|
1609
1649
|
detachFromEntry();
|
|
1610
1650
|
setIsFetching(false);
|
|
1611
1651
|
return;
|
|
1612
1652
|
}
|
|
1613
1653
|
const entry = getOrCreateEntry(cache, key2, initialData);
|
|
1654
|
+
const reattached = attachedEntry !== entry;
|
|
1614
1655
|
attachToEntry(entry, key2);
|
|
1615
1656
|
if (keyChanged) setIsFetching(entry.promise !== null);
|
|
1616
1657
|
if (entry.data !== void 0) {
|
|
@@ -1621,7 +1662,8 @@ function query(key, fetcher, options = {}) {
|
|
|
1621
1662
|
setUpdatedAt(entry.dataUpdatedAt);
|
|
1622
1663
|
});
|
|
1623
1664
|
}
|
|
1624
|
-
if (!keyChanged &&
|
|
1665
|
+
if (!keyChanged && !reattached && !enabledRose) return;
|
|
1666
|
+
if (!keyChanged && entry.data !== void 0) {
|
|
1625
1667
|
const isDataStale2 = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
1626
1668
|
if (on && isDataStale2 && !entry.promise) doFetch();
|
|
1627
1669
|
return;
|
package/dist/data.d.cts
CHANGED
|
@@ -133,7 +133,15 @@ type StructuralSharingOption<T> = boolean | ((prev: T, next: T) => T);
|
|
|
133
133
|
* mutation rather than a notification — see `MutationOptions.onMutate`.
|
|
134
134
|
*/
|
|
135
135
|
interface QueryOptions<T> {
|
|
136
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Time in ms before cached data is considered stale. Default: 0 (always stale)
|
|
138
|
+
*
|
|
139
|
+
* Staleness is acted on when the query mounts, when its resolved key
|
|
140
|
+
* changes, when `enabled` turns on, and by the explicit triggers (`refetch()`,
|
|
141
|
+
* `invalidateQueries`, the interval, focus, reconnect). A key getter that
|
|
142
|
+
* re-runs and resolves to the SAME key is not a key change and never
|
|
143
|
+
* refetches, whatever the data's age — no `derived()` wrapper needed.
|
|
144
|
+
*/
|
|
137
145
|
staleTime?: number;
|
|
138
146
|
/** Time in ms to keep unused cache entries. Default: 300000 (5 min) */
|
|
139
147
|
cacheTime?: number;
|
package/dist/data.d.ts
CHANGED
|
@@ -133,7 +133,15 @@ type StructuralSharingOption<T> = boolean | ((prev: T, next: T) => T);
|
|
|
133
133
|
* mutation rather than a notification — see `MutationOptions.onMutate`.
|
|
134
134
|
*/
|
|
135
135
|
interface QueryOptions<T> {
|
|
136
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Time in ms before cached data is considered stale. Default: 0 (always stale)
|
|
138
|
+
*
|
|
139
|
+
* Staleness is acted on when the query mounts, when its resolved key
|
|
140
|
+
* changes, when `enabled` turns on, and by the explicit triggers (`refetch()`,
|
|
141
|
+
* `invalidateQueries`, the interval, focus, reconnect). A key getter that
|
|
142
|
+
* re-runs and resolves to the SAME key is not a key change and never
|
|
143
|
+
* refetches, whatever the data's age — no `derived()` wrapper needed.
|
|
144
|
+
*/
|
|
137
145
|
staleTime?: number;
|
|
138
146
|
/** Time in ms to keep unused cache entries. Default: 300000 (5 min) */
|
|
139
147
|
cacheTime?: number;
|
package/dist/data.js
CHANGED
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
throttle,
|
|
23
23
|
withLoader,
|
|
24
24
|
withRetry
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-ADJEMTRC.js";
|
|
26
|
+
import "./chunk-LK3VK47W.js";
|
|
27
27
|
import "./chunk-7ZHH77QA.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-6DYRY2NF.js";
|
|
29
29
|
import "./chunk-EXXSN3BW.js";
|
|
30
30
|
import "./chunk-7XHATCIH.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-BNZDDNBR.js";
|
|
32
|
+
import "./chunk-NROLUUCO.js";
|
|
33
33
|
import "./chunk-NYNYSPK7.js";
|
|
34
34
|
export {
|
|
35
35
|
__resetQueryCache,
|
package/dist/devtools.cjs
CHANGED
|
@@ -497,6 +497,24 @@ function untracked(fn) {
|
|
|
497
497
|
resumeTracking();
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
+
var currentOwnerScope = null;
|
|
501
|
+
function getOwnerScope() {
|
|
502
|
+
return currentOwnerScope;
|
|
503
|
+
}
|
|
504
|
+
function runWithOwnerScope(scope, fn) {
|
|
505
|
+
const prev = currentOwnerScope;
|
|
506
|
+
currentOwnerScope = scope;
|
|
507
|
+
try {
|
|
508
|
+
return fn();
|
|
509
|
+
} finally {
|
|
510
|
+
currentOwnerScope = prev;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function bindOwnerScope(fn) {
|
|
514
|
+
const scope = currentOwnerScope;
|
|
515
|
+
if (scope === null) return fn;
|
|
516
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
517
|
+
}
|
|
500
518
|
var subscriberEpochCounter = 0;
|
|
501
519
|
function retrack(effectFn, subscriber) {
|
|
502
520
|
const prev = currentSubscriber;
|
|
@@ -512,6 +530,10 @@ function retrack(effectFn, subscriber) {
|
|
|
512
530
|
currentSubscriber = subscriber;
|
|
513
531
|
const sub = subscriber;
|
|
514
532
|
if (sub._cap === void 0) sub._cap = currentDisposerCapture();
|
|
533
|
+
const prevScope = currentOwnerScope;
|
|
534
|
+
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
535
|
+
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
536
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
515
537
|
const epoch = ++subscriberEpochCounter;
|
|
516
538
|
sub._epoch = epoch;
|
|
517
539
|
sub._structDirty = false;
|
|
@@ -524,6 +546,7 @@ function retrack(effectFn, subscriber) {
|
|
|
524
546
|
effectFn();
|
|
525
547
|
} finally {
|
|
526
548
|
currentSubscriber = prev;
|
|
549
|
+
currentOwnerScope = prevScope;
|
|
527
550
|
if (savedDepth !== 0) {
|
|
528
551
|
suspendDepth = savedDepth;
|
|
529
552
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -558,23 +581,26 @@ function track(effectFn, subscriber) {
|
|
|
558
581
|
trackingSuspended = false;
|
|
559
582
|
}
|
|
560
583
|
currentSubscriber = subscriber;
|
|
584
|
+
const sub = subscriber;
|
|
585
|
+
if (sub._scope === void 0) sub._scope = currentOwnerScope;
|
|
586
|
+
const prevScope = currentOwnerScope;
|
|
587
|
+
currentOwnerScope = sub._scope;
|
|
561
588
|
try {
|
|
562
589
|
effectFn();
|
|
563
590
|
} finally {
|
|
564
591
|
currentSubscriber = prev;
|
|
592
|
+
currentOwnerScope = prevScope;
|
|
565
593
|
if (savedDepth !== 0) {
|
|
566
594
|
suspendDepth = savedDepth;
|
|
567
595
|
suspendSavedSub = savedSuspendSub;
|
|
568
596
|
trackingSuspended = true;
|
|
569
597
|
}
|
|
570
|
-
|
|
571
|
-
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
598
|
+
for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
|
|
572
599
|
const sig = n.sig;
|
|
573
600
|
sig.__activeNode = n.prevActive;
|
|
574
601
|
n.prevActive = null;
|
|
575
602
|
}
|
|
576
603
|
}
|
|
577
|
-
const sub = subscriber;
|
|
578
604
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
579
605
|
}
|
|
580
606
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -844,7 +870,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
844
870
|
}
|
|
845
871
|
|
|
846
872
|
// src/reactivity/track.ts
|
|
847
|
-
var _runtimeVersion = true ? "4.
|
|
873
|
+
var _runtimeVersion = true ? "4.10.1" : "dev";
|
|
848
874
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
849
875
|
function resolveReactiveApi() {
|
|
850
876
|
const g = globalThis;
|
|
@@ -876,6 +902,9 @@ function resolveReactiveApi() {
|
|
|
876
902
|
getSubscriberCount,
|
|
877
903
|
getSubscriberDeps,
|
|
878
904
|
forEachSubscriber,
|
|
905
|
+
getOwnerScope,
|
|
906
|
+
runWithOwnerScope,
|
|
907
|
+
bindOwnerScope,
|
|
879
908
|
version: _runtimeVersion
|
|
880
909
|
};
|
|
881
910
|
g[REGISTRY_KEY] = local;
|
|
@@ -899,6 +928,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
899
928
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
900
929
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
901
930
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
931
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
932
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
933
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
902
934
|
|
|
903
935
|
// src/reactivity/batch.ts
|
|
904
936
|
var batchDepth = 0;
|
|
@@ -2064,6 +2096,11 @@ function flushUserCleanups(ctx) {
|
|
|
2064
2096
|
const list = ctx.userCleanups;
|
|
2065
2097
|
if (list.length === 0) return;
|
|
2066
2098
|
ctx.userCleanups = [];
|
|
2099
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
2100
|
+
if (scope === getOwnerScope2()) runCleanups2(list);
|
|
2101
|
+
else runWithOwnerScope2(scope, () => runCleanups2(list));
|
|
2102
|
+
}
|
|
2103
|
+
function runCleanups2(list) {
|
|
2067
2104
|
for (let i = list.length - 1; i >= 0; i--) {
|
|
2068
2105
|
try {
|
|
2069
2106
|
list[i]();
|
package/dist/devtools.js
CHANGED
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
trackCleanup,
|
|
36
36
|
walkDependencyGraph,
|
|
37
37
|
withErrorTracking
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-CID4BYBF.js";
|
|
39
39
|
import "./chunk-7ZHH77QA.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-6DYRY2NF.js";
|
|
41
41
|
import "./chunk-EXXSN3BW.js";
|
|
42
42
|
import "./chunk-7XHATCIH.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-BNZDDNBR.js";
|
|
44
|
+
import "./chunk-NROLUUCO.js";
|
|
45
45
|
import {
|
|
46
46
|
isDev
|
|
47
47
|
} from "./chunk-NYNYSPK7.js";
|
package/dist/ecosystem.cjs
CHANGED
|
@@ -369,6 +369,24 @@ function untracked(fn) {
|
|
|
369
369
|
resumeTracking();
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
+
var currentOwnerScope = null;
|
|
373
|
+
function getOwnerScope() {
|
|
374
|
+
return currentOwnerScope;
|
|
375
|
+
}
|
|
376
|
+
function runWithOwnerScope(scope, fn) {
|
|
377
|
+
const prev = currentOwnerScope;
|
|
378
|
+
currentOwnerScope = scope;
|
|
379
|
+
try {
|
|
380
|
+
return fn();
|
|
381
|
+
} finally {
|
|
382
|
+
currentOwnerScope = prev;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function bindOwnerScope(fn) {
|
|
386
|
+
const scope = currentOwnerScope;
|
|
387
|
+
if (scope === null) return fn;
|
|
388
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
389
|
+
}
|
|
372
390
|
var subscriberEpochCounter = 0;
|
|
373
391
|
function retrack(effectFn, subscriber) {
|
|
374
392
|
const prev = currentSubscriber;
|
|
@@ -384,6 +402,10 @@ function retrack(effectFn, subscriber) {
|
|
|
384
402
|
currentSubscriber = subscriber;
|
|
385
403
|
const sub = subscriber;
|
|
386
404
|
if (sub._cap === void 0) sub._cap = currentDisposerCapture();
|
|
405
|
+
const prevScope = currentOwnerScope;
|
|
406
|
+
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
407
|
+
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
408
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
387
409
|
const epoch = ++subscriberEpochCounter;
|
|
388
410
|
sub._epoch = epoch;
|
|
389
411
|
sub._structDirty = false;
|
|
@@ -396,6 +418,7 @@ function retrack(effectFn, subscriber) {
|
|
|
396
418
|
effectFn();
|
|
397
419
|
} finally {
|
|
398
420
|
currentSubscriber = prev;
|
|
421
|
+
currentOwnerScope = prevScope;
|
|
399
422
|
if (savedDepth !== 0) {
|
|
400
423
|
suspendDepth = savedDepth;
|
|
401
424
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -430,23 +453,26 @@ function track(effectFn, subscriber) {
|
|
|
430
453
|
trackingSuspended = false;
|
|
431
454
|
}
|
|
432
455
|
currentSubscriber = subscriber;
|
|
456
|
+
const sub = subscriber;
|
|
457
|
+
if (sub._scope === void 0) sub._scope = currentOwnerScope;
|
|
458
|
+
const prevScope = currentOwnerScope;
|
|
459
|
+
currentOwnerScope = sub._scope;
|
|
433
460
|
try {
|
|
434
461
|
effectFn();
|
|
435
462
|
} finally {
|
|
436
463
|
currentSubscriber = prev;
|
|
464
|
+
currentOwnerScope = prevScope;
|
|
437
465
|
if (savedDepth !== 0) {
|
|
438
466
|
suspendDepth = savedDepth;
|
|
439
467
|
suspendSavedSub = savedSuspendSub;
|
|
440
468
|
trackingSuspended = true;
|
|
441
469
|
}
|
|
442
|
-
|
|
443
|
-
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
470
|
+
for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
|
|
444
471
|
const sig = n.sig;
|
|
445
472
|
sig.__activeNode = n.prevActive;
|
|
446
473
|
n.prevActive = null;
|
|
447
474
|
}
|
|
448
475
|
}
|
|
449
|
-
const sub = subscriber;
|
|
450
476
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
451
477
|
}
|
|
452
478
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -716,7 +742,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
716
742
|
}
|
|
717
743
|
|
|
718
744
|
// src/reactivity/track.ts
|
|
719
|
-
var _runtimeVersion = true ? "4.
|
|
745
|
+
var _runtimeVersion = true ? "4.10.1" : "dev";
|
|
720
746
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
721
747
|
function resolveReactiveApi() {
|
|
722
748
|
const g = globalThis;
|
|
@@ -748,6 +774,9 @@ function resolveReactiveApi() {
|
|
|
748
774
|
getSubscriberCount,
|
|
749
775
|
getSubscriberDeps,
|
|
750
776
|
forEachSubscriber,
|
|
777
|
+
getOwnerScope,
|
|
778
|
+
runWithOwnerScope,
|
|
779
|
+
bindOwnerScope,
|
|
751
780
|
version: _runtimeVersion
|
|
752
781
|
};
|
|
753
782
|
g[REGISTRY_KEY] = local;
|
|
@@ -771,6 +800,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
771
800
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
772
801
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
773
802
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
803
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
804
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
805
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
774
806
|
|
|
775
807
|
// src/core/devtoolsHook.ts
|
|
776
808
|
function emitDevtools(hook, event, payload) {
|
|
@@ -826,6 +858,11 @@ function flushUserCleanups(ctx) {
|
|
|
826
858
|
const list = ctx.userCleanups;
|
|
827
859
|
if (list.length === 0) return;
|
|
828
860
|
ctx.userCleanups = [];
|
|
861
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
862
|
+
if (scope === getOwnerScope2()) runCleanups(list);
|
|
863
|
+
else runWithOwnerScope2(scope, () => runCleanups(list));
|
|
864
|
+
}
|
|
865
|
+
function runCleanups(list) {
|
|
829
866
|
for (let i = list.length - 1; i >= 0; i--) {
|
|
830
867
|
try {
|
|
831
868
|
list[i]();
|
package/dist/ecosystem.js
CHANGED
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2D47RVVK.js";
|
|
11
11
|
import "./chunk-J6FW5TV6.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-2T73SWKF.js";
|
|
13
|
+
import "./chunk-DS6PFIZK.js";
|
|
14
14
|
import "./chunk-3ACAAQIN.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-LK3VK47W.js";
|
|
16
16
|
import "./chunk-7ZHH77QA.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-6DYRY2NF.js";
|
|
18
18
|
import "./chunk-EXXSN3BW.js";
|
|
19
19
|
import "./chunk-7XHATCIH.js";
|
|
20
20
|
import "./chunk-5HZXGZ6T.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-BNZDDNBR.js";
|
|
22
|
+
import "./chunk-NROLUUCO.js";
|
|
23
23
|
import "./chunk-NYNYSPK7.js";
|
|
24
24
|
export {
|
|
25
25
|
antdAdapter,
|