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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
derived
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X7NRHFZR.js";
|
|
4
4
|
import {
|
|
5
5
|
globalSingleton
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SBTZEYNI.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeUrl
|
|
12
12
|
} from "./chunk-EXXSN3BW.js";
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
batch,
|
|
18
18
|
signal
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SYHGGDNW.js";
|
|
20
20
|
import {
|
|
21
21
|
untracked
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G2WHYEL7.js";
|
|
23
23
|
import {
|
|
24
24
|
reportError
|
|
25
25
|
} from "./chunk-NYNYSPK7.js";
|
|
@@ -268,6 +268,8 @@ function query(key, fetcher, options = {}) {
|
|
|
268
268
|
structuralSharing = true
|
|
269
269
|
} = options;
|
|
270
270
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
271
|
+
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
272
|
+
const isEnabled = enabledGate ?? (() => enabled);
|
|
271
273
|
const cache = getActiveQueryCache();
|
|
272
274
|
const [data, setData] = signal(initialData);
|
|
273
275
|
const [isFetching, setIsFetching] = signal(false);
|
|
@@ -382,7 +384,7 @@ function query(key, fetcher, options = {}) {
|
|
|
382
384
|
}
|
|
383
385
|
}
|
|
384
386
|
async function doFetch() {
|
|
385
|
-
if (disposed || !currentKey || !
|
|
387
|
+
if (disposed || !currentKey || !untracked(isEnabled)) return;
|
|
386
388
|
const key2 = currentKey;
|
|
387
389
|
const entry = getOrCreateEntry(cache, key2);
|
|
388
390
|
attachToEntry(entry, key2);
|
|
@@ -484,10 +486,17 @@ function query(key, fetcher, options = {}) {
|
|
|
484
486
|
}
|
|
485
487
|
const effectCleanup = effect(() => {
|
|
486
488
|
const key2 = resolveKey();
|
|
489
|
+
const on = isEnabled();
|
|
487
490
|
const keyChanged = currentKey !== key2;
|
|
488
491
|
currentKey = key2;
|
|
492
|
+
if (key2 === "") {
|
|
493
|
+
detachFromEntry();
|
|
494
|
+
setIsFetching(false);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
489
497
|
const entry = getOrCreateEntry(cache, key2, initialData);
|
|
490
498
|
attachToEntry(entry, key2);
|
|
499
|
+
if (keyChanged) setIsFetching(entry.promise !== null);
|
|
491
500
|
if (entry.data !== void 0) {
|
|
492
501
|
const view = viewOf(entry);
|
|
493
502
|
batch(() => {
|
|
@@ -498,17 +507,17 @@ function query(key, fetcher, options = {}) {
|
|
|
498
507
|
}
|
|
499
508
|
if (!keyChanged && currentKey === key2 && entry.data !== void 0) {
|
|
500
509
|
const isDataStale2 = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
501
|
-
if (
|
|
510
|
+
if (on && isDataStale2 && !entry.promise) doFetch();
|
|
502
511
|
return;
|
|
503
512
|
}
|
|
504
513
|
const isDataStale = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
505
|
-
if (
|
|
514
|
+
if (on && (entry.data === void 0 || isDataStale)) {
|
|
506
515
|
doFetch();
|
|
507
516
|
}
|
|
508
517
|
});
|
|
509
518
|
if (refetchInterval && refetchInterval > 0) {
|
|
510
519
|
intervalTimer = setInterval(() => {
|
|
511
|
-
if (!disposed && currentKey
|
|
520
|
+
if (!disposed && currentKey) doFetch();
|
|
512
521
|
}, refetchInterval);
|
|
513
522
|
}
|
|
514
523
|
let focusHandler = null;
|
|
@@ -516,13 +525,13 @@ function query(key, fetcher, options = {}) {
|
|
|
516
525
|
if (typeof globalThis !== "undefined" && typeof globalThis.addEventListener === "function") {
|
|
517
526
|
if (refetchOnWindowFocus) {
|
|
518
527
|
focusHandler = () => {
|
|
519
|
-
if (!disposed && currentKey
|
|
528
|
+
if (!disposed && currentKey) doFetch();
|
|
520
529
|
};
|
|
521
530
|
globalThis.addEventListener("focus", focusHandler);
|
|
522
531
|
}
|
|
523
532
|
if (refetchOnReconnect) {
|
|
524
533
|
onlineHandler = () => {
|
|
525
|
-
if (!disposed && currentKey
|
|
534
|
+
if (!disposed && currentKey) doFetch();
|
|
526
535
|
};
|
|
527
536
|
globalThis.addEventListener("online", onlineHandler);
|
|
528
537
|
}
|
|
@@ -534,6 +543,7 @@ function query(key, fetcher, options = {}) {
|
|
|
534
543
|
stopSelect?.();
|
|
535
544
|
loading.dispose();
|
|
536
545
|
isStale.dispose();
|
|
546
|
+
enabledGate?.dispose();
|
|
537
547
|
if (intervalTimer) clearInterval(intervalTimer);
|
|
538
548
|
detachFromEntry();
|
|
539
549
|
if (focusHandler && typeof globalThis.removeEventListener === "function") {
|
|
@@ -713,6 +723,8 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
713
723
|
onError
|
|
714
724
|
} = options;
|
|
715
725
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
726
|
+
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
727
|
+
const isEnabled = enabledGate ?? (() => enabled);
|
|
716
728
|
const [pages, setPages] = signal([]);
|
|
717
729
|
const [isFetching, setIsFetching] = signal(false);
|
|
718
730
|
const [isFetchingNext, setIsFetchingNext] = signal(false);
|
|
@@ -791,7 +803,7 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
791
803
|
}
|
|
792
804
|
const effectCleanup = effect(() => {
|
|
793
805
|
resolveKey();
|
|
794
|
-
if (
|
|
806
|
+
if (isEnabled()) {
|
|
795
807
|
abortController?.abort();
|
|
796
808
|
batch(() => {
|
|
797
809
|
setPages([]);
|
|
@@ -832,6 +844,7 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
832
844
|
loading.dispose();
|
|
833
845
|
hasNextPage.dispose();
|
|
834
846
|
hasPreviousPage.dispose();
|
|
847
|
+
enabledGate?.dispose();
|
|
835
848
|
}
|
|
836
849
|
return {
|
|
837
850
|
data,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bindAttribute,
|
|
3
3
|
setSafeAttribute
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MPWDSTYK.js";
|
|
5
5
|
import {
|
|
6
6
|
isBlockedElement
|
|
7
7
|
} from "./chunk-3ACAAQIN.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-EXXSN3BW.js";
|
|
13
13
|
import {
|
|
14
14
|
reactiveBinding
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-G2WHYEL7.js";
|
|
16
16
|
import {
|
|
17
17
|
DEV,
|
|
18
18
|
devWarn,
|
|
@@ -3,23 +3,23 @@ import {
|
|
|
3
3
|
} from "./chunk-J6FW5TV6.js";
|
|
4
4
|
import {
|
|
5
5
|
tagFactory
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5MLWTIQE.js";
|
|
7
7
|
import {
|
|
8
8
|
derived
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X7NRHFZR.js";
|
|
10
10
|
import {
|
|
11
11
|
globalSingleton
|
|
12
12
|
} from "./chunk-7ZHH77QA.js";
|
|
13
13
|
import {
|
|
14
14
|
effect
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SBTZEYNI.js";
|
|
16
16
|
import {
|
|
17
17
|
sanitizeCSSDeclaration
|
|
18
18
|
} from "./chunk-EXXSN3BW.js";
|
|
19
19
|
import {
|
|
20
20
|
batch,
|
|
21
21
|
signal
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SYHGGDNW.js";
|
|
23
23
|
|
|
24
24
|
// src/ecosystem/adapters/mobx.ts
|
|
25
25
|
function mobXAdapter(options) {
|
|
@@ -170,7 +170,7 @@ var CDN_ENTRY_POINTS = {
|
|
|
170
170
|
};
|
|
171
171
|
var packageInfo = {
|
|
172
172
|
name: "sibujs",
|
|
173
|
-
version: true ? "4.
|
|
173
|
+
version: true ? "4.9.0" : "dev",
|
|
174
174
|
entryPoints: MODULE_ENTRY_POINTS,
|
|
175
175
|
/**
|
|
176
176
|
* Generate the package.json `exports` map. Module entries resolve to the
|
|
@@ -315,7 +315,7 @@ var env = {
|
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
// src/plugins/versioning.ts
|
|
318
|
-
var VERSION = true ? "4.
|
|
318
|
+
var VERSION = true ? "4.9.0" : "dev";
|
|
319
319
|
var NUM = "(?:0|[1-9]\\d*)";
|
|
320
320
|
var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
|
|
321
321
|
var BUILD_ID = "[0-9a-zA-Z-]+";
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SBTZEYNI.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-SYHGGDNW.js";
|
|
16
16
|
import {
|
|
17
17
|
DEV,
|
|
18
18
|
devWarn,
|
|
@@ -135,44 +135,44 @@ import {
|
|
|
135
135
|
use,
|
|
136
136
|
var_,
|
|
137
137
|
video
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-QBKCK6MJ.js";
|
|
139
139
|
import {
|
|
140
140
|
trustHTML
|
|
141
141
|
} from "./chunk-FC6KCJSA.js";
|
|
142
142
|
import {
|
|
143
143
|
watch
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-CDBKFGXN.js";
|
|
145
145
|
import {
|
|
146
146
|
__resetIdCounter,
|
|
147
147
|
createId,
|
|
148
148
|
domBinding
|
|
149
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-FHCZMHHE.js";
|
|
150
150
|
import {
|
|
151
151
|
SVG_NS,
|
|
152
152
|
bindChildNode,
|
|
153
153
|
captureFocusWithin,
|
|
154
154
|
restoreFocusWithin,
|
|
155
155
|
tagFactory
|
|
156
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-5MLWTIQE.js";
|
|
157
157
|
import {
|
|
158
158
|
bindAttribute,
|
|
159
159
|
bindDynamic,
|
|
160
160
|
setSafeAttribute,
|
|
161
161
|
setTrustedAttribute
|
|
162
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-MPWDSTYK.js";
|
|
163
163
|
import {
|
|
164
164
|
isCodeTextElement
|
|
165
165
|
} from "./chunk-3ACAAQIN.js";
|
|
166
166
|
import {
|
|
167
167
|
derived
|
|
168
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-X7NRHFZR.js";
|
|
169
169
|
import {
|
|
170
170
|
globalSingleton
|
|
171
171
|
} from "./chunk-7ZHH77QA.js";
|
|
172
172
|
import {
|
|
173
173
|
effect,
|
|
174
174
|
on
|
|
175
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-SBTZEYNI.js";
|
|
176
176
|
import {
|
|
177
177
|
disableSSR,
|
|
178
178
|
enableSSR,
|
|
@@ -191,7 +191,7 @@ import {
|
|
|
191
191
|
external,
|
|
192
192
|
isBatching,
|
|
193
193
|
signal
|
|
194
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-SYHGGDNW.js";
|
|
195
195
|
import {
|
|
196
196
|
emitDevtools,
|
|
197
197
|
notifySubscribers,
|
|
@@ -203,7 +203,7 @@ import {
|
|
|
203
203
|
suspendTracking,
|
|
204
204
|
track,
|
|
205
205
|
untracked
|
|
206
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-G2WHYEL7.js";
|
|
207
207
|
import {
|
|
208
208
|
DEV,
|
|
209
209
|
MAX_DRAIN_TEARDOWNS,
|
|
@@ -1637,37 +1637,44 @@ function action(element, action2, param2) {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
}
|
|
1639
1639
|
var clickOutside = (element, callback) => {
|
|
1640
|
+
const doc = element.ownerDocument;
|
|
1640
1641
|
const handler = (e) => {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
}
|
|
1642
|
+
const target = e.target;
|
|
1643
|
+
if (!(typeof target?.nodeType === "number" && element.contains(target))) callback();
|
|
1644
1644
|
};
|
|
1645
|
-
|
|
1646
|
-
return () =>
|
|
1645
|
+
doc.addEventListener("pointerdown", handler, true);
|
|
1646
|
+
return () => doc.removeEventListener("pointerdown", handler, true);
|
|
1647
1647
|
};
|
|
1648
|
+
var PRESS_END_EVENTS = ["pointerup", "pointerleave", "pointercancel"];
|
|
1648
1649
|
var longPress = (element, options) => {
|
|
1649
1650
|
const duration = options.duration ?? 500;
|
|
1650
1651
|
let timer = null;
|
|
1651
|
-
|
|
1652
|
-
timer = setTimeout(() => {
|
|
1653
|
-
options.callback();
|
|
1654
|
-
timer = null;
|
|
1655
|
-
}, duration);
|
|
1656
|
-
};
|
|
1652
|
+
let owner;
|
|
1657
1653
|
const cancel = () => {
|
|
1658
1654
|
if (timer !== null) {
|
|
1659
1655
|
clearTimeout(timer);
|
|
1660
1656
|
timer = null;
|
|
1661
1657
|
}
|
|
1662
1658
|
};
|
|
1659
|
+
const start = (e) => {
|
|
1660
|
+
const id = e.pointerId;
|
|
1661
|
+
if (timer !== null && id !== owner) return;
|
|
1662
|
+
cancel();
|
|
1663
|
+
owner = id;
|
|
1664
|
+
timer = setTimeout(() => {
|
|
1665
|
+
timer = null;
|
|
1666
|
+
options.callback();
|
|
1667
|
+
}, duration);
|
|
1668
|
+
};
|
|
1669
|
+
const end = (e) => {
|
|
1670
|
+
if (timer !== null && e.pointerId === owner) cancel();
|
|
1671
|
+
};
|
|
1663
1672
|
element.addEventListener("pointerdown", start);
|
|
1664
|
-
element.addEventListener(
|
|
1665
|
-
element.addEventListener("pointerleave", cancel);
|
|
1673
|
+
for (const type of PRESS_END_EVENTS) element.addEventListener(type, end);
|
|
1666
1674
|
return () => {
|
|
1667
1675
|
cancel();
|
|
1668
1676
|
element.removeEventListener("pointerdown", start);
|
|
1669
|
-
element.removeEventListener(
|
|
1670
|
-
element.removeEventListener("pointerleave", cancel);
|
|
1677
|
+
for (const type of PRESS_END_EVENTS) element.removeEventListener(type, end);
|
|
1671
1678
|
};
|
|
1672
1679
|
};
|
|
1673
1680
|
var copyOnClick = (element, getText) => {
|
|
@@ -1701,10 +1708,11 @@ var trapFocus = (element) => {
|
|
|
1701
1708
|
if (elements.length === 0) return;
|
|
1702
1709
|
const first = elements[0];
|
|
1703
1710
|
const last = elements[elements.length - 1];
|
|
1704
|
-
|
|
1711
|
+
const active = element.ownerDocument.activeElement;
|
|
1712
|
+
if (e.shiftKey && active === first) {
|
|
1705
1713
|
e.preventDefault();
|
|
1706
1714
|
last.focus();
|
|
1707
|
-
} else if (!e.shiftKey &&
|
|
1715
|
+
} else if (!e.shiftKey && active === last) {
|
|
1708
1716
|
e.preventDefault();
|
|
1709
1717
|
first.focus();
|
|
1710
1718
|
}
|
|
@@ -2662,7 +2670,7 @@ function KeepAlive(activeKey, cases, options) {
|
|
|
2662
2670
|
return;
|
|
2663
2671
|
}
|
|
2664
2672
|
node = factory();
|
|
2665
|
-
if (node
|
|
2673
|
+
if (node.nodeType === 11) {
|
|
2666
2674
|
const wrapper = document.createElement("div");
|
|
2667
2675
|
wrapper.style.display = "contents";
|
|
2668
2676
|
wrapper.appendChild(node);
|
|
@@ -498,7 +498,7 @@ function forEachSubscriber(signal, visit) {
|
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
// src/reactivity/track.ts
|
|
501
|
-
var _runtimeVersion = true ? "4.
|
|
501
|
+
var _runtimeVersion = true ? "4.9.0" : "dev";
|
|
502
502
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
503
503
|
function resolveReactiveApi() {
|
|
504
504
|
const g = globalThis;
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
} from "./chunk-7ZHH77QA.js";
|
|
4
4
|
import {
|
|
5
5
|
effect
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SBTZEYNI.js";
|
|
7
7
|
import {
|
|
8
8
|
stripHtml
|
|
9
9
|
} from "./chunk-EXXSN3BW.js";
|
|
10
10
|
import {
|
|
11
11
|
signal
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SYHGGDNW.js";
|
|
13
13
|
import {
|
|
14
14
|
forEachSubscriber,
|
|
15
15
|
getSubscriberCount,
|
|
16
16
|
getSubscriberDeps
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G2WHYEL7.js";
|
|
18
18
|
import {
|
|
19
19
|
dispose,
|
|
20
20
|
isDev
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
div,
|
|
8
8
|
span
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QBKCK6MJ.js";
|
|
10
10
|
import {
|
|
11
11
|
STATIC_VALUE_RESOLVER,
|
|
12
12
|
planHeadElementEntry,
|
|
@@ -17,14 +17,14 @@ import {
|
|
|
17
17
|
} from "./chunk-7ZHH77QA.js";
|
|
18
18
|
import {
|
|
19
19
|
effect
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-SBTZEYNI.js";
|
|
21
21
|
import {
|
|
22
22
|
sanitizeUrl
|
|
23
23
|
} from "./chunk-EXXSN3BW.js";
|
|
24
24
|
import {
|
|
25
25
|
batch,
|
|
26
26
|
signal
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SYHGGDNW.js";
|
|
28
28
|
import {
|
|
29
29
|
registerDisposer,
|
|
30
30
|
replaceChildrenSafely,
|
|
@@ -910,7 +910,7 @@ function createISR(options) {
|
|
|
910
910
|
const [data, setData] = signal(initialData);
|
|
911
911
|
const [stale, setStale] = signal(initialData === void 0);
|
|
912
912
|
const controller = new AbortController();
|
|
913
|
-
let inFlight =
|
|
913
|
+
let inFlight = null;
|
|
914
914
|
let disposed = false;
|
|
915
915
|
let deadline;
|
|
916
916
|
const clearDeadline = () => {
|
|
@@ -930,10 +930,7 @@ function createISR(options) {
|
|
|
930
930
|
});
|
|
931
931
|
}, revalidateAfter);
|
|
932
932
|
};
|
|
933
|
-
const
|
|
934
|
-
if (disposed || inFlight) return;
|
|
935
|
-
if (controller.signal.aborted) return;
|
|
936
|
-
inFlight = true;
|
|
933
|
+
const run = async () => {
|
|
937
934
|
try {
|
|
938
935
|
const result = await fetcher({ signal: controller.signal });
|
|
939
936
|
if (disposed || controller.signal.aborted) return;
|
|
@@ -945,10 +942,33 @@ function createISR(options) {
|
|
|
945
942
|
} catch (err) {
|
|
946
943
|
if (!disposed && !controller.signal.aborted) armDeadline();
|
|
947
944
|
throw err;
|
|
948
|
-
} finally {
|
|
949
|
-
inFlight = false;
|
|
950
945
|
}
|
|
951
946
|
};
|
|
947
|
+
const revalidate = () => {
|
|
948
|
+
if (disposed || controller.signal.aborted) return Promise.resolve();
|
|
949
|
+
if (inFlight) return inFlight;
|
|
950
|
+
let resolve;
|
|
951
|
+
let reject;
|
|
952
|
+
const current = new Promise((res, rej) => {
|
|
953
|
+
resolve = res;
|
|
954
|
+
reject = rej;
|
|
955
|
+
});
|
|
956
|
+
inFlight = current;
|
|
957
|
+
const release = () => {
|
|
958
|
+
if (inFlight === current) inFlight = null;
|
|
959
|
+
};
|
|
960
|
+
run().then(
|
|
961
|
+
() => {
|
|
962
|
+
release();
|
|
963
|
+
resolve();
|
|
964
|
+
},
|
|
965
|
+
(err) => {
|
|
966
|
+
release();
|
|
967
|
+
reject(err);
|
|
968
|
+
}
|
|
969
|
+
);
|
|
970
|
+
return current;
|
|
971
|
+
};
|
|
952
972
|
if (initialData === void 0) {
|
|
953
973
|
revalidate().catch((err) => {
|
|
954
974
|
if (typeof console !== "undefined") console.warn("[SibuJS ISR] initial fetch failed", err);
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-62BDYGAG.js";
|
|
5
5
|
import {
|
|
6
6
|
derived
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X7NRHFZR.js";
|
|
8
8
|
import {
|
|
9
9
|
effect
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SBTZEYNI.js";
|
|
11
11
|
import {
|
|
12
12
|
batch,
|
|
13
13
|
signal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SYHGGDNW.js";
|
|
15
15
|
import {
|
|
16
16
|
DEV,
|
|
17
17
|
devWarn,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
domBinding
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FHCZMHHE.js";
|
|
4
4
|
import {
|
|
5
5
|
bindAttribute,
|
|
6
6
|
setSafeAttribute
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MPWDSTYK.js";
|
|
8
8
|
import {
|
|
9
9
|
isBlockedElement
|
|
10
10
|
} from "./chunk-3ACAAQIN.js";
|
|
11
11
|
import {
|
|
12
12
|
derived
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-X7NRHFZR.js";
|
|
14
14
|
import {
|
|
15
15
|
globalSingleton
|
|
16
16
|
} from "./chunk-7ZHH77QA.js";
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
} from "./chunk-5HZXGZ6T.js";
|
|
24
24
|
import {
|
|
25
25
|
signal
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SYHGGDNW.js";
|
|
27
27
|
import {
|
|
28
28
|
reactiveBinding,
|
|
29
29
|
track
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-G2WHYEL7.js";
|
|
31
31
|
import {
|
|
32
32
|
dispose,
|
|
33
33
|
disposeNodeOwn,
|
|
@@ -1466,7 +1466,7 @@ function svgElement(tag, props = {}, ...nodes) {
|
|
|
1466
1466
|
for (const child of nodes) {
|
|
1467
1467
|
if (typeof child === "string") {
|
|
1468
1468
|
el.appendChild(document.createTextNode(child));
|
|
1469
|
-
} else if (child
|
|
1469
|
+
} else if (typeof child?.nodeType === "number") {
|
|
1470
1470
|
el.appendChild(child);
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from "./chunk-7ZHH77QA.js";
|
|
10
10
|
import {
|
|
11
11
|
effect
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SBTZEYNI.js";
|
|
13
13
|
import {
|
|
14
14
|
sanitizeUrl
|
|
15
15
|
} from "./chunk-EXXSN3BW.js";
|
|
16
16
|
import {
|
|
17
17
|
batch,
|
|
18
18
|
signal
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SYHGGDNW.js";
|
|
20
20
|
import {
|
|
21
21
|
reportError
|
|
22
22
|
} from "./chunk-NYNYSPK7.js";
|
|
@@ -1142,6 +1142,7 @@ function keyboard(options = {}) {
|
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
1144
|
const target = options.target ?? window;
|
|
1145
|
+
const view = options.target?.ownerDocument?.defaultView ?? window;
|
|
1145
1146
|
const filter = options.keys ? new Set(options.keys) : null;
|
|
1146
1147
|
const onDown = (e) => {
|
|
1147
1148
|
if (filter && !filter.has(e.key)) return;
|
|
@@ -1164,14 +1165,14 @@ function keyboard(options = {}) {
|
|
|
1164
1165
|
const onBlur = () => setPressed(/* @__PURE__ */ new Set());
|
|
1165
1166
|
target.addEventListener("keydown", onDown);
|
|
1166
1167
|
target.addEventListener("keyup", onUp);
|
|
1167
|
-
|
|
1168
|
+
view.addEventListener("blur", onBlur);
|
|
1168
1169
|
function isPressed(key) {
|
|
1169
1170
|
return pressed().has(key);
|
|
1170
1171
|
}
|
|
1171
1172
|
function dispose() {
|
|
1172
1173
|
target.removeEventListener("keydown", onDown);
|
|
1173
1174
|
target.removeEventListener("keyup", onUp);
|
|
1174
|
-
|
|
1175
|
+
view.removeEventListener("blur", onBlur);
|
|
1175
1176
|
}
|
|
1176
1177
|
return { pressed, isPressed, dispose };
|
|
1177
1178
|
}
|