sibujs 4.9.0 → 4.10.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 +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-FNOK662L.js → chunk-2NWHJ2UJ.js} +73 -43
- package/dist/{chunk-KG25XMGP.js → chunk-4DCVJ4YA.js} +15 -8
- package/dist/{chunk-CF2KCWRE.js → chunk-54F4TPHK.js} +2 -2
- package/dist/{chunk-X7NRHFZR.js → chunk-5PC7OTQW.js} +1 -1
- package/dist/{chunk-SBTZEYNI.js → chunk-7WIHYHWD.js} +8 -1
- package/dist/{chunk-K6K5ACO6.js → chunk-BMCR7TXG.js} +3 -3
- package/dist/{chunk-G2WHYEL7.js → chunk-D6HYFOWR.js} +39 -4
- package/dist/{chunk-5MLWTIQE.js → chunk-EVI4ZQO3.js} +2 -2
- package/dist/{chunk-CDBKFGXN.js → chunk-EVOK663Z.js} +1 -1
- package/dist/{chunk-SYHGGDNW.js → chunk-FYUEL5IW.js} +1 -1
- package/dist/{chunk-562UVHMM.js → chunk-GMMDHJJT.js} +11 -6
- package/dist/{chunk-FHCZMHHE.js → chunk-GOL3FU5Q.js} +1 -1
- package/dist/{chunk-YW6HQKGO.js → chunk-GTS35FLA.js} +2 -2
- package/dist/{chunk-2K3Z3XO4.js → chunk-IFRIBZ4O.js} +4 -4
- package/dist/{chunk-DRMLIF6M.js → chunk-IL5MMSCL.js} +19 -12
- package/dist/{chunk-XJVTQUIV.js → chunk-ITEL5KPL.js} +5 -5
- package/dist/{chunk-TV464N2M.js → chunk-JCKUWWHU.js} +3 -3
- package/dist/{chunk-QBKCK6MJ.js → chunk-N6U4GOIU.js} +1 -1
- package/dist/{chunk-NQMKWBKU.js → chunk-TOPRMXFY.js} +1 -1
- package/dist/{chunk-7OV5Q2UU.js → chunk-VWPMWV7O.js} +4 -4
- package/dist/{chunk-MPWDSTYK.js → chunk-XUQUQJYE.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 +16 -0
- package/dist/index.d.ts +16 -0
- 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
|
@@ -135,44 +135,44 @@ import {
|
|
|
135
135
|
use,
|
|
136
136
|
var_,
|
|
137
137
|
video
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-N6U4GOIU.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-EVOK663Z.js";
|
|
145
145
|
import {
|
|
146
146
|
__resetIdCounter,
|
|
147
147
|
createId,
|
|
148
148
|
domBinding
|
|
149
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-GOL3FU5Q.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-EVI4ZQO3.js";
|
|
157
157
|
import {
|
|
158
158
|
bindAttribute,
|
|
159
159
|
bindDynamic,
|
|
160
160
|
setSafeAttribute,
|
|
161
161
|
setTrustedAttribute
|
|
162
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-XUQUQJYE.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-5PC7OTQW.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-7WIHYHWD.js";
|
|
176
176
|
import {
|
|
177
177
|
disableSSR,
|
|
178
178
|
enableSSR,
|
|
@@ -191,19 +191,22 @@ import {
|
|
|
191
191
|
external,
|
|
192
192
|
isBatching,
|
|
193
193
|
signal
|
|
194
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-FYUEL5IW.js";
|
|
195
195
|
import {
|
|
196
|
+
bindOwnerScope,
|
|
196
197
|
emitDevtools,
|
|
198
|
+
getOwnerScope,
|
|
197
199
|
notifySubscribers,
|
|
198
200
|
reactiveBinding,
|
|
199
201
|
recordDependency,
|
|
200
202
|
resumeTracking,
|
|
201
203
|
retrack,
|
|
204
|
+
runWithOwnerScope,
|
|
202
205
|
setMaxDrainIterations,
|
|
203
206
|
suspendTracking,
|
|
204
207
|
track,
|
|
205
208
|
untracked
|
|
206
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-D6HYFOWR.js";
|
|
207
210
|
import {
|
|
208
211
|
DEV,
|
|
209
212
|
MAX_DRAIN_TEARDOWNS,
|
|
@@ -487,12 +490,16 @@ function lazy(importFn) {
|
|
|
487
490
|
}
|
|
488
491
|
const container = div({ class: "sibu-lazy" });
|
|
489
492
|
let disposed = false;
|
|
490
|
-
importFn().then(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
importFn().then(
|
|
494
|
+
// The component renders after the import resolves, in the owner scope
|
|
495
|
+
// of whoever rendered the placeholder.
|
|
496
|
+
bindOwnerScope((mod) => {
|
|
497
|
+
if (disposed) return;
|
|
498
|
+
cached = mod.default;
|
|
499
|
+
const rendered = cached();
|
|
500
|
+
replaceChildrenSafely(container, rendered);
|
|
501
|
+
})
|
|
502
|
+
).catch((err) => {
|
|
496
503
|
if (disposed) return;
|
|
497
504
|
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
498
505
|
replaceChildrenSafely(
|
|
@@ -523,7 +530,7 @@ function Suspense({ nodes, fallback }) {
|
|
|
523
530
|
}
|
|
524
531
|
if (childEl && !container.contains(childEl)) dispose(childEl);
|
|
525
532
|
});
|
|
526
|
-
|
|
533
|
+
const renderContent = bindOwnerScope(() => {
|
|
527
534
|
if (suspenseDisposed) return;
|
|
528
535
|
try {
|
|
529
536
|
const el = nodes();
|
|
@@ -551,10 +558,14 @@ function Suspense({ nodes, fallback }) {
|
|
|
551
558
|
dispatchPropagate(container, errorObj);
|
|
552
559
|
}
|
|
553
560
|
});
|
|
561
|
+
queueMicrotask(renderContent);
|
|
554
562
|
return container;
|
|
555
563
|
}
|
|
556
564
|
|
|
557
565
|
// src/core/rendering/lifecycle.ts
|
|
566
|
+
function pinScope(scope, fn) {
|
|
567
|
+
return () => getOwnerScope() === scope ? fn() : runWithOwnerScope(scope, fn);
|
|
568
|
+
}
|
|
558
569
|
function safeCall(cb, hookName) {
|
|
559
570
|
try {
|
|
560
571
|
return cb();
|
|
@@ -564,13 +575,14 @@ function safeCall(cb, hookName) {
|
|
|
564
575
|
return void 0;
|
|
565
576
|
}
|
|
566
577
|
}
|
|
567
|
-
function runMountCallback(callback, hookName, element, isDisposed) {
|
|
568
|
-
const
|
|
569
|
-
if (typeof
|
|
578
|
+
function runMountCallback(callback, hookName, element, isDisposed, scope) {
|
|
579
|
+
const returned = safeCall(callback, hookName);
|
|
580
|
+
if (typeof returned !== "function") return;
|
|
581
|
+
const cleanup = pinScope(scope, returned);
|
|
570
582
|
if (isDisposed() || !element.isConnected) {
|
|
571
583
|
safeCall(cleanup, "onUnmount");
|
|
572
584
|
} else {
|
|
573
|
-
|
|
585
|
+
watchUnmount(cleanup, element);
|
|
574
586
|
}
|
|
575
587
|
}
|
|
576
588
|
var mountWatchers = /* @__PURE__ */ new WeakMap();
|
|
@@ -730,6 +742,8 @@ function registerUnmountWatcher(element, cb) {
|
|
|
730
742
|
}
|
|
731
743
|
function onMount(callback, element) {
|
|
732
744
|
if (typeof document === "undefined") return;
|
|
745
|
+
const scope = getOwnerScope();
|
|
746
|
+
callback = pinScope(scope, callback);
|
|
733
747
|
if (element) {
|
|
734
748
|
let disposed = false;
|
|
735
749
|
const isDisposed = () => disposed;
|
|
@@ -739,19 +753,19 @@ function onMount(callback, element) {
|
|
|
739
753
|
if (element.isConnected) {
|
|
740
754
|
queueMicrotask(() => {
|
|
741
755
|
if (disposed) return;
|
|
742
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
756
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
743
757
|
});
|
|
744
758
|
return;
|
|
745
759
|
}
|
|
746
760
|
queueMicrotask(() => {
|
|
747
761
|
if (disposed) return;
|
|
748
762
|
if (element.isConnected) {
|
|
749
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
763
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
750
764
|
return;
|
|
751
765
|
}
|
|
752
766
|
const unregister = registerMountWatcher(element, () => {
|
|
753
767
|
if (disposed) return;
|
|
754
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
768
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
755
769
|
});
|
|
756
770
|
registerDisposer(element, unregister);
|
|
757
771
|
});
|
|
@@ -763,6 +777,9 @@ function onMount(callback, element) {
|
|
|
763
777
|
}
|
|
764
778
|
function onUnmount(callback, element) {
|
|
765
779
|
if (typeof document === "undefined") return;
|
|
780
|
+
watchUnmount(pinScope(getOwnerScope(), callback), element);
|
|
781
|
+
}
|
|
782
|
+
function watchUnmount(callback, element) {
|
|
766
783
|
let fired = false;
|
|
767
784
|
const fireOnce = () => {
|
|
768
785
|
if (fired) return;
|
|
@@ -1463,11 +1480,15 @@ function ErrorBoundary(optionsOrChildren, maybeChildren) {
|
|
|
1463
1480
|
return;
|
|
1464
1481
|
}
|
|
1465
1482
|
replaceChildrenSafely(asyncContainer, el);
|
|
1466
|
-
}).catch(
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1483
|
+
}).catch(
|
|
1484
|
+
// The fallback is rendered later, in the owner scope of the
|
|
1485
|
+
// render that produced the async child.
|
|
1486
|
+
bindOwnerScope((e) => {
|
|
1487
|
+
if (asyncDisposed) return;
|
|
1488
|
+
const err = handleError(e);
|
|
1489
|
+
replaceChildrenSafely(asyncContainer, tryRenderFallback(err));
|
|
1490
|
+
})
|
|
1491
|
+
);
|
|
1471
1492
|
return asyncContainer;
|
|
1472
1493
|
}
|
|
1473
1494
|
return result;
|
|
@@ -1883,9 +1904,11 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
1883
1904
|
currentNode = null;
|
|
1884
1905
|
});
|
|
1885
1906
|
if (!initialized) {
|
|
1886
|
-
queueMicrotask(
|
|
1887
|
-
|
|
1888
|
-
|
|
1907
|
+
queueMicrotask(
|
|
1908
|
+
bindOwnerScope(() => {
|
|
1909
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
1910
|
+
})
|
|
1911
|
+
);
|
|
1889
1912
|
}
|
|
1890
1913
|
return anchor;
|
|
1891
1914
|
}
|
|
@@ -1924,9 +1947,11 @@ function match(value, cases, fallback) {
|
|
|
1924
1947
|
currentNode = null;
|
|
1925
1948
|
});
|
|
1926
1949
|
if (!initialized) {
|
|
1927
|
-
queueMicrotask(
|
|
1928
|
-
|
|
1929
|
-
|
|
1950
|
+
queueMicrotask(
|
|
1951
|
+
bindOwnerScope(() => {
|
|
1952
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
1953
|
+
})
|
|
1954
|
+
);
|
|
1930
1955
|
}
|
|
1931
1956
|
return anchor;
|
|
1932
1957
|
}
|
|
@@ -2218,11 +2243,13 @@ function each(getArray, render, options) {
|
|
|
2218
2243
|
};
|
|
2219
2244
|
registerDisposer(anchor, disposeRange);
|
|
2220
2245
|
if (!initialized) {
|
|
2221
|
-
queueMicrotask(
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2246
|
+
queueMicrotask(
|
|
2247
|
+
bindOwnerScope(() => {
|
|
2248
|
+
if (!initialized && !rangeDisposed && anchor.parentNode) {
|
|
2249
|
+
update();
|
|
2250
|
+
}
|
|
2251
|
+
})
|
|
2252
|
+
);
|
|
2226
2253
|
}
|
|
2227
2254
|
return anchor;
|
|
2228
2255
|
}
|
|
@@ -2700,9 +2727,11 @@ function KeepAlive(activeKey, cases, options) {
|
|
|
2700
2727
|
};
|
|
2701
2728
|
const untrack = track(update);
|
|
2702
2729
|
if (!initialized) {
|
|
2703
|
-
queueMicrotask(
|
|
2704
|
-
|
|
2705
|
-
|
|
2730
|
+
queueMicrotask(
|
|
2731
|
+
bindOwnerScope(() => {
|
|
2732
|
+
if (!initialized && anchor.parentNode) update();
|
|
2733
|
+
})
|
|
2734
|
+
);
|
|
2706
2735
|
}
|
|
2707
2736
|
registerDisposer(anchor, () => {
|
|
2708
2737
|
disposed = true;
|
|
@@ -2807,7 +2836,7 @@ function Portal(nodes, target) {
|
|
|
2807
2836
|
const container = target || document.body;
|
|
2808
2837
|
let portalContent = null;
|
|
2809
2838
|
let disposed = false;
|
|
2810
|
-
|
|
2839
|
+
const renderContent = bindOwnerScope(() => {
|
|
2811
2840
|
if (disposed) return;
|
|
2812
2841
|
try {
|
|
2813
2842
|
portalContent = nodes();
|
|
@@ -2822,6 +2851,7 @@ function Portal(nodes, target) {
|
|
|
2822
2851
|
});
|
|
2823
2852
|
}
|
|
2824
2853
|
});
|
|
2854
|
+
queueMicrotask(renderContent);
|
|
2825
2855
|
registerDisposer(anchor, () => {
|
|
2826
2856
|
disposed = true;
|
|
2827
2857
|
if (portalContent) {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
div,
|
|
8
8
|
span
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-N6U4GOIU.js";
|
|
10
10
|
import {
|
|
11
11
|
STATIC_VALUE_RESOLVER,
|
|
12
12
|
planHeadElementEntry,
|
|
@@ -17,14 +17,17 @@ import {
|
|
|
17
17
|
} from "./chunk-7ZHH77QA.js";
|
|
18
18
|
import {
|
|
19
19
|
effect
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7WIHYHWD.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-FYUEL5IW.js";
|
|
28
|
+
import {
|
|
29
|
+
bindOwnerScope
|
|
30
|
+
} from "./chunk-D6HYFOWR.js";
|
|
28
31
|
import {
|
|
29
32
|
registerDisposer,
|
|
30
33
|
replaceChildrenSafely,
|
|
@@ -686,11 +689,15 @@ function defineRemoteComponent(name, loader) {
|
|
|
686
689
|
registerDisposer(container, () => {
|
|
687
690
|
disposed = true;
|
|
688
691
|
});
|
|
689
|
-
loader().then(
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
loader().then(
|
|
693
|
+
// Instantiated after the module resolves, in the owner scope of the
|
|
694
|
+
// render that asked for it — as `lazy()` does.
|
|
695
|
+
bindOwnerScope((mod) => {
|
|
696
|
+
cached = mod.default;
|
|
697
|
+
if (disposed) return;
|
|
698
|
+
replaceChildrenSafely(container, cached());
|
|
699
|
+
})
|
|
700
|
+
).catch((err) => {
|
|
694
701
|
if (disposed) return;
|
|
695
702
|
const message = err instanceof Error ? err.message : String(err);
|
|
696
703
|
replaceChildrenSafely(
|
|
@@ -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.10.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.10.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-]+";
|
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
cleanup,
|
|
6
6
|
emitDevtools,
|
|
7
|
+
getOwnerScope,
|
|
7
8
|
retrack,
|
|
9
|
+
runWithOwnerScope,
|
|
8
10
|
untracked
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-D6HYFOWR.js";
|
|
10
12
|
import {
|
|
11
13
|
devAssert,
|
|
12
14
|
reportError
|
|
@@ -35,6 +37,11 @@ function flushUserCleanups(ctx) {
|
|
|
35
37
|
const list = ctx.userCleanups;
|
|
36
38
|
if (list.length === 0) return;
|
|
37
39
|
ctx.userCleanups = [];
|
|
40
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
41
|
+
if (scope === getOwnerScope()) runCleanups(list);
|
|
42
|
+
else runWithOwnerScope(scope, () => runCleanups(list));
|
|
43
|
+
}
|
|
44
|
+
function runCleanups(list) {
|
|
38
45
|
for (let i = list.length - 1; i >= 0; i--) {
|
|
39
46
|
try {
|
|
40
47
|
list[i]();
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
} from "./chunk-7ZHH77QA.js";
|
|
4
4
|
import {
|
|
5
5
|
effect
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7WIHYHWD.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-FYUEL5IW.js";
|
|
13
13
|
import {
|
|
14
14
|
forEachSubscriber,
|
|
15
15
|
getSubscriberCount,
|
|
16
16
|
getSubscriberDeps
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D6HYFOWR.js";
|
|
18
18
|
import {
|
|
19
19
|
dispose,
|
|
20
20
|
isDev
|
|
@@ -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.0" : "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
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bindAttribute,
|
|
3
3
|
setSafeAttribute
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XUQUQJYE.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-D6HYFOWR.js";
|
|
16
16
|
import {
|
|
17
17
|
DEV,
|
|
18
18
|
devWarn,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
derived
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5PC7OTQW.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-7WIHYHWD.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-FYUEL5IW.js";
|
|
20
20
|
import {
|
|
21
21
|
untracked
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-D6HYFOWR.js";
|
|
23
23
|
import {
|
|
24
24
|
reportError
|
|
25
25
|
} from "./chunk-NYNYSPK7.js";
|
|
@@ -269,7 +269,7 @@ function query(key, fetcher, options = {}) {
|
|
|
269
269
|
} = options;
|
|
270
270
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
271
271
|
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
272
|
-
const isEnabled = enabledGate ?? (() => enabled);
|
|
272
|
+
const isEnabled = enabledGate ?? (() => Boolean(enabled));
|
|
273
273
|
const cache = getActiveQueryCache();
|
|
274
274
|
const [data, setData] = signal(initialData);
|
|
275
275
|
const [isFetching, setIsFetching] = signal(false);
|
|
@@ -288,6 +288,7 @@ function query(key, fetcher, options = {}) {
|
|
|
288
288
|
let currentKey = null;
|
|
289
289
|
let attachedEntry = null;
|
|
290
290
|
let attachedKey = null;
|
|
291
|
+
let lastEnabled = null;
|
|
291
292
|
let intervalTimer = null;
|
|
292
293
|
const loading = derived(() => isFetching() && data() === void 0);
|
|
293
294
|
const isStale = derived(() => {
|
|
@@ -488,13 +489,16 @@ function query(key, fetcher, options = {}) {
|
|
|
488
489
|
const key2 = resolveKey();
|
|
489
490
|
const on = isEnabled();
|
|
490
491
|
const keyChanged = currentKey !== key2;
|
|
492
|
+
const enabledRose = on && lastEnabled === false;
|
|
491
493
|
currentKey = key2;
|
|
494
|
+
lastEnabled = on;
|
|
492
495
|
if (key2 === "") {
|
|
493
496
|
detachFromEntry();
|
|
494
497
|
setIsFetching(false);
|
|
495
498
|
return;
|
|
496
499
|
}
|
|
497
500
|
const entry = getOrCreateEntry(cache, key2, initialData);
|
|
501
|
+
const reattached = attachedEntry !== entry;
|
|
498
502
|
attachToEntry(entry, key2);
|
|
499
503
|
if (keyChanged) setIsFetching(entry.promise !== null);
|
|
500
504
|
if (entry.data !== void 0) {
|
|
@@ -505,7 +509,8 @@ function query(key, fetcher, options = {}) {
|
|
|
505
509
|
setUpdatedAt(entry.dataUpdatedAt);
|
|
506
510
|
});
|
|
507
511
|
}
|
|
508
|
-
if (!keyChanged &&
|
|
512
|
+
if (!keyChanged && !reattached && !enabledRose) return;
|
|
513
|
+
if (!keyChanged && entry.data !== void 0) {
|
|
509
514
|
const isDataStale2 = entry.dataUpdatedAt === 0 || Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
510
515
|
if (on && isDataStale2 && !entry.promise) doFetch();
|
|
511
516
|
return;
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from "./chunk-7ZHH77QA.js";
|
|
10
10
|
import {
|
|
11
11
|
effect
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7WIHYHWD.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-FYUEL5IW.js";
|
|
20
20
|
import {
|
|
21
21
|
reportError
|
|
22
22
|
} from "./chunk-NYNYSPK7.js";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EVOK663Z.js";
|
|
4
4
|
import {
|
|
5
5
|
createId,
|
|
6
6
|
domBinding,
|
|
7
7
|
idSegment
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GOL3FU5Q.js";
|
|
9
9
|
import {
|
|
10
10
|
derived
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5PC7OTQW.js";
|
|
12
12
|
import {
|
|
13
13
|
stripHtml
|
|
14
14
|
} from "./chunk-EXXSN3BW.js";
|
|
15
15
|
import {
|
|
16
16
|
batch,
|
|
17
17
|
signal
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FYUEL5IW.js";
|
|
19
19
|
|
|
20
20
|
// src/widgets/Combobox.ts
|
|
21
21
|
var boundComboboxes = /* @__PURE__ */ new WeakMap();
|