sibujs 4.8.0 → 4.9.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 +4 -3
- package/dist/browser.d.cts +3 -2
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +4 -4
- package/dist/build.cjs +27 -19
- package/dist/build.js +10 -10
- package/dist/cdn.dev.global.js +12 -12
- package/dist/cdn.full.dev.global.js +13 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-GSGNX35Q.js → chunk-2K3Z3XO4.js} +4 -4
- package/dist/{chunk-UCNP3HVM.js → chunk-562UVHMM.js} +24 -11
- package/dist/{chunk-VWT3VXPL.js → chunk-5MLWTIQE.js} +2 -2
- package/dist/{chunk-4WMSTZ7J.js → chunk-7OV5Q2UU.js} +4 -4
- package/dist/{chunk-CZPRSWSS.js → chunk-CDBKFGXN.js} +1 -1
- package/dist/{chunk-QGMSESDD.js → chunk-CF2KCWRE.js} +2 -2
- package/dist/{chunk-C5PEWEGH.js → chunk-DRMLIF6M.js} +2 -2
- package/dist/{chunk-C7AA2CZX.js → chunk-FHCZMHHE.js} +1 -1
- package/dist/{chunk-J3YQ457H.js → chunk-FNOK662L.js} +35 -27
- package/dist/{chunk-TQQUN4WR.js → chunk-G2WHYEL7.js} +1 -1
- package/dist/{chunk-44MTL7ED.js → chunk-K6K5ACO6.js} +3 -3
- package/dist/{chunk-JUTFX2RM.js → chunk-KG25XMGP.js} +30 -10
- package/dist/{chunk-O6TRVMJI.js → chunk-MPWDSTYK.js} +1 -1
- package/dist/{chunk-LI4W3U6C.js → chunk-NQMKWBKU.js} +1 -1
- package/dist/{chunk-Q5J2LVKH.js → chunk-QBKCK6MJ.js} +1 -1
- package/dist/{chunk-V3LHZSU5.js → chunk-SBTZEYNI.js} +1 -1
- package/dist/{chunk-DSID757X.js → chunk-SYHGGDNW.js} +1 -1
- package/dist/{chunk-RGLPEBDE.js → chunk-TV464N2M.js} +3 -3
- package/dist/{chunk-KJ3UKABJ.js → chunk-X7NRHFZR.js} +1 -1
- package/dist/{chunk-ZVLHNEEL.js → chunk-XJVTQUIV.js} +6 -6
- package/dist/{chunk-EGUQLBHE.js → chunk-YW6HQKGO.js} +5 -4
- package/dist/data.cjs +21 -8
- package/dist/data.d.cts +23 -4
- package/dist/data.d.ts +23 -4
- package/dist/data.js +5 -5
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +1 -1
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +54 -20
- package/dist/extras.js +20 -20
- package/dist/index.cjs +27 -19
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -10
- package/dist/motion.cjs +1 -1
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +1 -1
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +1 -1
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +16 -12
- package/dist/plugins.d.cts +6 -0
- package/dist/plugins.d.ts +6 -0
- package/dist/plugins.js +20 -16
- package/dist/ssr.cjs +28 -8
- package/dist/ssr.d.cts +4 -0
- package/dist/ssr.d.ts +4 -0
- package/dist/ssr.js +7 -7
- package/dist/testing.cjs +1 -1
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +2 -2
- package/dist/ui.js +7 -7
- package/dist/widgets.cjs +1 -1
- package/dist/widgets.js +6 -6
- package/package.json +1 -1
package/dist/data.cjs
CHANGED
|
@@ -660,7 +660,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
// src/reactivity/track.ts
|
|
663
|
-
var _runtimeVersion = true ? "4.
|
|
663
|
+
var _runtimeVersion = true ? "4.9.0" : "dev";
|
|
664
664
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
665
665
|
function resolveReactiveApi() {
|
|
666
666
|
const g = globalThis;
|
|
@@ -1384,6 +1384,8 @@ function query(key, fetcher, options = {}) {
|
|
|
1384
1384
|
structuralSharing = true
|
|
1385
1385
|
} = options;
|
|
1386
1386
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
1387
|
+
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
1388
|
+
const isEnabled = enabledGate ?? (() => enabled);
|
|
1387
1389
|
const cache = getActiveQueryCache();
|
|
1388
1390
|
const [data, setData] = signal(initialData);
|
|
1389
1391
|
const [isFetching, setIsFetching] = signal(false);
|
|
@@ -1498,7 +1500,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1498
1500
|
}
|
|
1499
1501
|
}
|
|
1500
1502
|
async function doFetch() {
|
|
1501
|
-
if (disposed || !currentKey || !
|
|
1503
|
+
if (disposed || !currentKey || !untracked2(isEnabled)) return;
|
|
1502
1504
|
const key2 = currentKey;
|
|
1503
1505
|
const entry = getOrCreateEntry(cache, key2);
|
|
1504
1506
|
attachToEntry(entry, key2);
|
|
@@ -1600,10 +1602,17 @@ function query(key, fetcher, options = {}) {
|
|
|
1600
1602
|
}
|
|
1601
1603
|
const effectCleanup = effect(() => {
|
|
1602
1604
|
const key2 = resolveKey();
|
|
1605
|
+
const on = isEnabled();
|
|
1603
1606
|
const keyChanged = currentKey !== key2;
|
|
1604
1607
|
currentKey = key2;
|
|
1608
|
+
if (key2 === "") {
|
|
1609
|
+
detachFromEntry();
|
|
1610
|
+
setIsFetching(false);
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1605
1613
|
const entry = getOrCreateEntry(cache, key2, initialData);
|
|
1606
1614
|
attachToEntry(entry, key2);
|
|
1615
|
+
if (keyChanged) setIsFetching(entry.promise !== null);
|
|
1607
1616
|
if (entry.data !== void 0) {
|
|
1608
1617
|
const view = viewOf(entry);
|
|
1609
1618
|
batch(() => {
|
|
@@ -1614,17 +1623,17 @@ function query(key, fetcher, options = {}) {
|
|
|
1614
1623
|
}
|
|
1615
1624
|
if (!keyChanged && currentKey === key2 && entry.data !== void 0) {
|
|
1616
1625
|
const isDataStale2 = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
1617
|
-
if (
|
|
1626
|
+
if (on && isDataStale2 && !entry.promise) doFetch();
|
|
1618
1627
|
return;
|
|
1619
1628
|
}
|
|
1620
1629
|
const isDataStale = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
1621
|
-
if (
|
|
1630
|
+
if (on && (entry.data === void 0 || isDataStale)) {
|
|
1622
1631
|
doFetch();
|
|
1623
1632
|
}
|
|
1624
1633
|
});
|
|
1625
1634
|
if (refetchInterval && refetchInterval > 0) {
|
|
1626
1635
|
intervalTimer = setInterval(() => {
|
|
1627
|
-
if (!disposed && currentKey
|
|
1636
|
+
if (!disposed && currentKey) doFetch();
|
|
1628
1637
|
}, refetchInterval);
|
|
1629
1638
|
}
|
|
1630
1639
|
let focusHandler = null;
|
|
@@ -1632,13 +1641,13 @@ function query(key, fetcher, options = {}) {
|
|
|
1632
1641
|
if (typeof globalThis !== "undefined" && typeof globalThis.addEventListener === "function") {
|
|
1633
1642
|
if (refetchOnWindowFocus) {
|
|
1634
1643
|
focusHandler = () => {
|
|
1635
|
-
if (!disposed && currentKey
|
|
1644
|
+
if (!disposed && currentKey) doFetch();
|
|
1636
1645
|
};
|
|
1637
1646
|
globalThis.addEventListener("focus", focusHandler);
|
|
1638
1647
|
}
|
|
1639
1648
|
if (refetchOnReconnect) {
|
|
1640
1649
|
onlineHandler = () => {
|
|
1641
|
-
if (!disposed && currentKey
|
|
1650
|
+
if (!disposed && currentKey) doFetch();
|
|
1642
1651
|
};
|
|
1643
1652
|
globalThis.addEventListener("online", onlineHandler);
|
|
1644
1653
|
}
|
|
@@ -1650,6 +1659,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1650
1659
|
stopSelect?.();
|
|
1651
1660
|
loading.dispose();
|
|
1652
1661
|
isStale.dispose();
|
|
1662
|
+
enabledGate?.dispose();
|
|
1653
1663
|
if (intervalTimer) clearInterval(intervalTimer);
|
|
1654
1664
|
detachFromEntry();
|
|
1655
1665
|
if (focusHandler && typeof globalThis.removeEventListener === "function") {
|
|
@@ -1829,6 +1839,8 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
1829
1839
|
onError
|
|
1830
1840
|
} = options;
|
|
1831
1841
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
1842
|
+
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
1843
|
+
const isEnabled = enabledGate ?? (() => enabled);
|
|
1832
1844
|
const [pages, setPages] = signal([]);
|
|
1833
1845
|
const [isFetching, setIsFetching] = signal(false);
|
|
1834
1846
|
const [isFetchingNext, setIsFetchingNext] = signal(false);
|
|
@@ -1907,7 +1919,7 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
1907
1919
|
}
|
|
1908
1920
|
const effectCleanup = effect(() => {
|
|
1909
1921
|
resolveKey();
|
|
1910
|
-
if (
|
|
1922
|
+
if (isEnabled()) {
|
|
1911
1923
|
abortController?.abort();
|
|
1912
1924
|
batch(() => {
|
|
1913
1925
|
setPages([]);
|
|
@@ -1948,6 +1960,7 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
1948
1960
|
loading.dispose();
|
|
1949
1961
|
hasNextPage.dispose();
|
|
1950
1962
|
hasPreviousPage.dispose();
|
|
1963
|
+
enabledGate?.dispose();
|
|
1951
1964
|
}
|
|
1952
1965
|
return {
|
|
1953
1966
|
data,
|
package/dist/data.d.cts
CHANGED
|
@@ -137,8 +137,21 @@ interface QueryOptions<T> {
|
|
|
137
137
|
staleTime?: number;
|
|
138
138
|
/** Time in ms to keep unused cache entries. Default: 300000 (5 min) */
|
|
139
139
|
cacheTime?: number;
|
|
140
|
-
/**
|
|
141
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Whether the query may fetch. Default: `true`.
|
|
142
|
+
*
|
|
143
|
+
* A function is reactive: while it returns `false` the query stays idle
|
|
144
|
+
* (nothing fetches — not the key effect, `refetch()`, `invalidateQueries`,
|
|
145
|
+
* the interval, focus or reconnect), and it fetches as soon as it returns
|
|
146
|
+
* `true`, following the usual staleness rules.
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* query(() => `user:${userId()}`, fetchUser, { enabled: () => userId() != null });
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* An empty key (`""`) also holds a query idle, without creating a cache entry.
|
|
153
|
+
*/
|
|
154
|
+
enabled?: boolean | (() => boolean);
|
|
142
155
|
/** Retry options for failed fetches */
|
|
143
156
|
retry?: RetryOptions;
|
|
144
157
|
/** Initial data before first fetch */
|
|
@@ -325,8 +338,14 @@ interface InfiniteQueryOptions<TData, TPageParam = number> {
|
|
|
325
338
|
* unbounded.
|
|
326
339
|
*/
|
|
327
340
|
maxPages?: number;
|
|
328
|
-
/**
|
|
329
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Whether the query may load its first page. Default: `true`.
|
|
343
|
+
*
|
|
344
|
+
* A function is reactive: while it returns `false` the query stays idle, and
|
|
345
|
+
* each time it turns `true` the query loads from `initialPageParam`, as a key
|
|
346
|
+
* change does.
|
|
347
|
+
*/
|
|
348
|
+
enabled?: boolean | (() => boolean);
|
|
330
349
|
/** Retry options */
|
|
331
350
|
retry?: RetryOptions;
|
|
332
351
|
/** Called on successful page fetch */
|
package/dist/data.d.ts
CHANGED
|
@@ -137,8 +137,21 @@ interface QueryOptions<T> {
|
|
|
137
137
|
staleTime?: number;
|
|
138
138
|
/** Time in ms to keep unused cache entries. Default: 300000 (5 min) */
|
|
139
139
|
cacheTime?: number;
|
|
140
|
-
/**
|
|
141
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Whether the query may fetch. Default: `true`.
|
|
142
|
+
*
|
|
143
|
+
* A function is reactive: while it returns `false` the query stays idle
|
|
144
|
+
* (nothing fetches — not the key effect, `refetch()`, `invalidateQueries`,
|
|
145
|
+
* the interval, focus or reconnect), and it fetches as soon as it returns
|
|
146
|
+
* `true`, following the usual staleness rules.
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* query(() => `user:${userId()}`, fetchUser, { enabled: () => userId() != null });
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* An empty key (`""`) also holds a query idle, without creating a cache entry.
|
|
153
|
+
*/
|
|
154
|
+
enabled?: boolean | (() => boolean);
|
|
142
155
|
/** Retry options for failed fetches */
|
|
143
156
|
retry?: RetryOptions;
|
|
144
157
|
/** Initial data before first fetch */
|
|
@@ -325,8 +338,14 @@ interface InfiniteQueryOptions<TData, TPageParam = number> {
|
|
|
325
338
|
* unbounded.
|
|
326
339
|
*/
|
|
327
340
|
maxPages?: number;
|
|
328
|
-
/**
|
|
329
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Whether the query may load its first page. Default: `true`.
|
|
343
|
+
*
|
|
344
|
+
* A function is reactive: while it returns `false` the query stays idle, and
|
|
345
|
+
* each time it turns `true` the query loads from `initialPageParam`, as a key
|
|
346
|
+
* change does.
|
|
347
|
+
*/
|
|
348
|
+
enabled?: boolean | (() => boolean);
|
|
330
349
|
/** Retry options */
|
|
331
350
|
retry?: RetryOptions;
|
|
332
351
|
/** Called on successful page fetch */
|
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-562UVHMM.js";
|
|
26
|
+
import "./chunk-X7NRHFZR.js";
|
|
27
27
|
import "./chunk-7ZHH77QA.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-SBTZEYNI.js";
|
|
29
29
|
import "./chunk-EXXSN3BW.js";
|
|
30
30
|
import "./chunk-7XHATCIH.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-SYHGGDNW.js";
|
|
32
|
+
import "./chunk-G2WHYEL7.js";
|
|
33
33
|
import "./chunk-NYNYSPK7.js";
|
|
34
34
|
export {
|
|
35
35
|
__resetQueryCache,
|
package/dist/devtools.cjs
CHANGED
|
@@ -844,7 +844,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
844
844
|
}
|
|
845
845
|
|
|
846
846
|
// src/reactivity/track.ts
|
|
847
|
-
var _runtimeVersion = true ? "4.
|
|
847
|
+
var _runtimeVersion = true ? "4.9.0" : "dev";
|
|
848
848
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
849
849
|
function resolveReactiveApi() {
|
|
850
850
|
const g = globalThis;
|
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-K6K5ACO6.js";
|
|
39
39
|
import "./chunk-7ZHH77QA.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-SBTZEYNI.js";
|
|
41
41
|
import "./chunk-EXXSN3BW.js";
|
|
42
42
|
import "./chunk-7XHATCIH.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-SYHGGDNW.js";
|
|
44
|
+
import "./chunk-G2WHYEL7.js";
|
|
45
45
|
import {
|
|
46
46
|
isDev
|
|
47
47
|
} from "./chunk-NYNYSPK7.js";
|
package/dist/ecosystem.cjs
CHANGED
|
@@ -716,7 +716,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
716
716
|
}
|
|
717
717
|
|
|
718
718
|
// src/reactivity/track.ts
|
|
719
|
-
var _runtimeVersion = true ? "4.
|
|
719
|
+
var _runtimeVersion = true ? "4.9.0" : "dev";
|
|
720
720
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
721
721
|
function resolveReactiveApi() {
|
|
722
722
|
const g = globalThis;
|
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-7OV5Q2UU.js";
|
|
11
11
|
import "./chunk-J6FW5TV6.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5MLWTIQE.js";
|
|
13
|
+
import "./chunk-MPWDSTYK.js";
|
|
14
14
|
import "./chunk-3ACAAQIN.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-X7NRHFZR.js";
|
|
16
16
|
import "./chunk-7ZHH77QA.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-SBTZEYNI.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-SYHGGDNW.js";
|
|
22
|
+
import "./chunk-G2WHYEL7.js";
|
|
23
23
|
import "./chunk-NYNYSPK7.js";
|
|
24
24
|
export {
|
|
25
25
|
antdAdapter,
|
package/dist/extras.cjs
CHANGED
|
@@ -1077,7 +1077,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
1079
|
// src/reactivity/track.ts
|
|
1080
|
-
var _runtimeVersion = true ? "4.
|
|
1080
|
+
var _runtimeVersion = true ? "4.9.0" : "dev";
|
|
1081
1081
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1082
1082
|
function resolveReactiveApi() {
|
|
1083
1083
|
const g2 = globalThis;
|
|
@@ -1805,6 +1805,8 @@ function query(key, fetcher, options = {}) {
|
|
|
1805
1805
|
structuralSharing = true
|
|
1806
1806
|
} = options;
|
|
1807
1807
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
1808
|
+
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
1809
|
+
const isEnabled = enabledGate ?? (() => enabled);
|
|
1808
1810
|
const cache = getActiveQueryCache();
|
|
1809
1811
|
const [data2, setData] = signal(initialData);
|
|
1810
1812
|
const [isFetching, setIsFetching] = signal(false);
|
|
@@ -1919,7 +1921,7 @@ function query(key, fetcher, options = {}) {
|
|
|
1919
1921
|
}
|
|
1920
1922
|
}
|
|
1921
1923
|
async function doFetch() {
|
|
1922
|
-
if (disposed || !currentKey || !
|
|
1924
|
+
if (disposed || !currentKey || !untracked2(isEnabled)) return;
|
|
1923
1925
|
const key2 = currentKey;
|
|
1924
1926
|
const entry = getOrCreateEntry(cache, key2);
|
|
1925
1927
|
attachToEntry(entry, key2);
|
|
@@ -2021,10 +2023,17 @@ function query(key, fetcher, options = {}) {
|
|
|
2021
2023
|
}
|
|
2022
2024
|
const effectCleanup = effect(() => {
|
|
2023
2025
|
const key2 = resolveKey();
|
|
2026
|
+
const on = isEnabled();
|
|
2024
2027
|
const keyChanged = currentKey !== key2;
|
|
2025
2028
|
currentKey = key2;
|
|
2029
|
+
if (key2 === "") {
|
|
2030
|
+
detachFromEntry();
|
|
2031
|
+
setIsFetching(false);
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
2026
2034
|
const entry = getOrCreateEntry(cache, key2, initialData);
|
|
2027
2035
|
attachToEntry(entry, key2);
|
|
2036
|
+
if (keyChanged) setIsFetching(entry.promise !== null);
|
|
2028
2037
|
if (entry.data !== void 0) {
|
|
2029
2038
|
const view = viewOf(entry);
|
|
2030
2039
|
batch(() => {
|
|
@@ -2035,17 +2044,17 @@ function query(key, fetcher, options = {}) {
|
|
|
2035
2044
|
}
|
|
2036
2045
|
if (!keyChanged && currentKey === key2 && entry.data !== void 0) {
|
|
2037
2046
|
const isDataStale2 = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
2038
|
-
if (
|
|
2047
|
+
if (on && isDataStale2 && !entry.promise) doFetch();
|
|
2039
2048
|
return;
|
|
2040
2049
|
}
|
|
2041
2050
|
const isDataStale = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
2042
|
-
if (
|
|
2051
|
+
if (on && (entry.data === void 0 || isDataStale)) {
|
|
2043
2052
|
doFetch();
|
|
2044
2053
|
}
|
|
2045
2054
|
});
|
|
2046
2055
|
if (refetchInterval && refetchInterval > 0) {
|
|
2047
2056
|
intervalTimer = setInterval(() => {
|
|
2048
|
-
if (!disposed && currentKey
|
|
2057
|
+
if (!disposed && currentKey) doFetch();
|
|
2049
2058
|
}, refetchInterval);
|
|
2050
2059
|
}
|
|
2051
2060
|
let focusHandler = null;
|
|
@@ -2053,13 +2062,13 @@ function query(key, fetcher, options = {}) {
|
|
|
2053
2062
|
if (typeof globalThis !== "undefined" && typeof globalThis.addEventListener === "function") {
|
|
2054
2063
|
if (refetchOnWindowFocus) {
|
|
2055
2064
|
focusHandler = () => {
|
|
2056
|
-
if (!disposed && currentKey
|
|
2065
|
+
if (!disposed && currentKey) doFetch();
|
|
2057
2066
|
};
|
|
2058
2067
|
globalThis.addEventListener("focus", focusHandler);
|
|
2059
2068
|
}
|
|
2060
2069
|
if (refetchOnReconnect) {
|
|
2061
2070
|
onlineHandler = () => {
|
|
2062
|
-
if (!disposed && currentKey
|
|
2071
|
+
if (!disposed && currentKey) doFetch();
|
|
2063
2072
|
};
|
|
2064
2073
|
globalThis.addEventListener("online", onlineHandler);
|
|
2065
2074
|
}
|
|
@@ -2071,6 +2080,7 @@ function query(key, fetcher, options = {}) {
|
|
|
2071
2080
|
stopSelect?.();
|
|
2072
2081
|
loading.dispose();
|
|
2073
2082
|
isStale.dispose();
|
|
2083
|
+
enabledGate?.dispose();
|
|
2074
2084
|
if (intervalTimer) clearInterval(intervalTimer);
|
|
2075
2085
|
detachFromEntry();
|
|
2076
2086
|
if (focusHandler && typeof globalThis.removeEventListener === "function") {
|
|
@@ -2250,6 +2260,8 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
2250
2260
|
onError
|
|
2251
2261
|
} = options;
|
|
2252
2262
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
2263
|
+
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
2264
|
+
const isEnabled = enabledGate ?? (() => enabled);
|
|
2253
2265
|
const [pages, setPages] = signal([]);
|
|
2254
2266
|
const [isFetching, setIsFetching] = signal(false);
|
|
2255
2267
|
const [isFetchingNext, setIsFetchingNext] = signal(false);
|
|
@@ -2328,7 +2340,7 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
2328
2340
|
}
|
|
2329
2341
|
const effectCleanup = effect(() => {
|
|
2330
2342
|
resolveKey();
|
|
2331
|
-
if (
|
|
2343
|
+
if (isEnabled()) {
|
|
2332
2344
|
abortController?.abort();
|
|
2333
2345
|
batch(() => {
|
|
2334
2346
|
setPages([]);
|
|
@@ -2369,6 +2381,7 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
2369
2381
|
loading.dispose();
|
|
2370
2382
|
hasNextPage.dispose();
|
|
2371
2383
|
hasPreviousPage.dispose();
|
|
2384
|
+
enabledGate?.dispose();
|
|
2372
2385
|
}
|
|
2373
2386
|
return {
|
|
2374
2387
|
data: data2,
|
|
@@ -4843,6 +4856,7 @@ function keyboard(options = {}) {
|
|
|
4843
4856
|
};
|
|
4844
4857
|
}
|
|
4845
4858
|
const target = options.target ?? window;
|
|
4859
|
+
const view = options.target?.ownerDocument?.defaultView ?? window;
|
|
4846
4860
|
const filter = options.keys ? new Set(options.keys) : null;
|
|
4847
4861
|
const onDown = (e) => {
|
|
4848
4862
|
if (filter && !filter.has(e.key)) return;
|
|
@@ -4865,14 +4879,14 @@ function keyboard(options = {}) {
|
|
|
4865
4879
|
const onBlur = () => setPressed(/* @__PURE__ */ new Set());
|
|
4866
4880
|
target.addEventListener("keydown", onDown);
|
|
4867
4881
|
target.addEventListener("keyup", onUp);
|
|
4868
|
-
|
|
4882
|
+
view.addEventListener("blur", onBlur);
|
|
4869
4883
|
function isPressed(key) {
|
|
4870
4884
|
return pressed().has(key);
|
|
4871
4885
|
}
|
|
4872
4886
|
function dispose2() {
|
|
4873
4887
|
target.removeEventListener("keydown", onDown);
|
|
4874
4888
|
target.removeEventListener("keyup", onUp);
|
|
4875
|
-
|
|
4889
|
+
view.removeEventListener("blur", onBlur);
|
|
4876
4890
|
}
|
|
4877
4891
|
return { pressed, isPressed, dispose: dispose2 };
|
|
4878
4892
|
}
|
|
@@ -10042,7 +10056,7 @@ function svgElement(tag, props = {}, ...nodes) {
|
|
|
10042
10056
|
for (const child of nodes) {
|
|
10043
10057
|
if (typeof child === "string") {
|
|
10044
10058
|
el.appendChild(document.createTextNode(child));
|
|
10045
|
-
} else if (child
|
|
10059
|
+
} else if (typeof child?.nodeType === "number") {
|
|
10046
10060
|
el.appendChild(child);
|
|
10047
10061
|
}
|
|
10048
10062
|
}
|
|
@@ -11374,7 +11388,7 @@ function createISR(options) {
|
|
|
11374
11388
|
const [data2, setData] = signal(initialData);
|
|
11375
11389
|
const [stale, setStale] = signal(initialData === void 0);
|
|
11376
11390
|
const controller = new AbortController();
|
|
11377
|
-
let inFlight =
|
|
11391
|
+
let inFlight = null;
|
|
11378
11392
|
let disposed = false;
|
|
11379
11393
|
let deadline;
|
|
11380
11394
|
const clearDeadline = () => {
|
|
@@ -11394,10 +11408,7 @@ function createISR(options) {
|
|
|
11394
11408
|
});
|
|
11395
11409
|
}, revalidateAfter);
|
|
11396
11410
|
};
|
|
11397
|
-
const
|
|
11398
|
-
if (disposed || inFlight) return;
|
|
11399
|
-
if (controller.signal.aborted) return;
|
|
11400
|
-
inFlight = true;
|
|
11411
|
+
const run = async () => {
|
|
11401
11412
|
try {
|
|
11402
11413
|
const result = await fetcher({ signal: controller.signal });
|
|
11403
11414
|
if (disposed || controller.signal.aborted) return;
|
|
@@ -11409,10 +11420,33 @@ function createISR(options) {
|
|
|
11409
11420
|
} catch (err) {
|
|
11410
11421
|
if (!disposed && !controller.signal.aborted) armDeadline();
|
|
11411
11422
|
throw err;
|
|
11412
|
-
} finally {
|
|
11413
|
-
inFlight = false;
|
|
11414
11423
|
}
|
|
11415
11424
|
};
|
|
11425
|
+
const revalidate = () => {
|
|
11426
|
+
if (disposed || controller.signal.aborted) return Promise.resolve();
|
|
11427
|
+
if (inFlight) return inFlight;
|
|
11428
|
+
let resolve;
|
|
11429
|
+
let reject;
|
|
11430
|
+
const current = new Promise((res, rej) => {
|
|
11431
|
+
resolve = res;
|
|
11432
|
+
reject = rej;
|
|
11433
|
+
});
|
|
11434
|
+
inFlight = current;
|
|
11435
|
+
const release = () => {
|
|
11436
|
+
if (inFlight === current) inFlight = null;
|
|
11437
|
+
};
|
|
11438
|
+
run().then(
|
|
11439
|
+
() => {
|
|
11440
|
+
release();
|
|
11441
|
+
resolve();
|
|
11442
|
+
},
|
|
11443
|
+
(err) => {
|
|
11444
|
+
release();
|
|
11445
|
+
reject(err);
|
|
11446
|
+
}
|
|
11447
|
+
);
|
|
11448
|
+
return current;
|
|
11449
|
+
};
|
|
11416
11450
|
if (initialData === void 0) {
|
|
11417
11451
|
revalidate().catch((err) => {
|
|
11418
11452
|
if (typeof console !== "undefined") console.warn("[SibuJS ISR] initial fetch failed", err);
|
|
@@ -11947,7 +11981,7 @@ var CDN_ENTRY_POINTS = {
|
|
|
11947
11981
|
};
|
|
11948
11982
|
var packageInfo = {
|
|
11949
11983
|
name: "sibujs",
|
|
11950
|
-
version: true ? "4.
|
|
11984
|
+
version: true ? "4.9.0" : "dev",
|
|
11951
11985
|
entryPoints: MODULE_ENTRY_POINTS,
|
|
11952
11986
|
/**
|
|
11953
11987
|
* Generate the package.json `exports` map. Module entries resolve to the
|
|
@@ -12092,7 +12126,7 @@ var env = {
|
|
|
12092
12126
|
};
|
|
12093
12127
|
|
|
12094
12128
|
// src/plugins/versioning.ts
|
|
12095
|
-
var VERSION = true ? "4.
|
|
12129
|
+
var VERSION = true ? "4.9.0" : "dev";
|
|
12096
12130
|
var NUM = "(?:0|[1-9]\\d*)";
|
|
12097
12131
|
var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
|
|
12098
12132
|
var BUILD_ID = "[0-9a-zA-Z-]+";
|
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-TV464N2M.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-DRMLIF6M.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-CF2KCWRE.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-KG25XMGP.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-XJVTQUIV.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-2K3Z3XO4.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-YW6HQKGO.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-562UVHMM.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-K6K5ACO6.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-7OV5Q2UU.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-QBKCK6MJ.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-CDBKFGXN.js";
|
|
309
|
+
import "./chunk-FHCZMHHE.js";
|
|
310
310
|
import "./chunk-62BDYGAG.js";
|
|
311
|
-
import "./chunk-
|
|
312
|
-
import "./chunk-
|
|
311
|
+
import "./chunk-5MLWTIQE.js";
|
|
312
|
+
import "./chunk-MPWDSTYK.js";
|
|
313
313
|
import "./chunk-3ACAAQIN.js";
|
|
314
|
-
import "./chunk-
|
|
314
|
+
import "./chunk-X7NRHFZR.js";
|
|
315
315
|
import "./chunk-7ZHH77QA.js";
|
|
316
|
-
import "./chunk-
|
|
316
|
+
import "./chunk-SBTZEYNI.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-NQMKWBKU.js";
|
|
342
342
|
import "./chunk-5HZXGZ6T.js";
|
|
343
|
-
import "./chunk-
|
|
344
|
-
import "./chunk-
|
|
343
|
+
import "./chunk-SYHGGDNW.js";
|
|
344
|
+
import "./chunk-G2WHYEL7.js";
|
|
345
345
|
import "./chunk-NYNYSPK7.js";
|
|
346
346
|
export {
|
|
347
347
|
DOMPool,
|