sibujs 4.4.0 → 4.6.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/README.md +11 -0
- package/dist/browser.cjs +339 -130
- package/dist/browser.d.cts +61 -16
- package/dist/browser.d.ts +61 -16
- package/dist/browser.js +8 -6
- package/dist/build.cjs +273 -82
- package/dist/build.js +15 -16
- package/dist/cdn.dev.global.js +12 -12
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/chunk-3ISI6ACU.js +44 -0
- package/dist/{chunk-VCTAEPSB.js → chunk-47M47FOM.js} +11 -3
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-KKLW7YWL.js → chunk-5MT6SJ3P.js} +275 -144
- package/dist/{chunk-3BTTCZ5J.js → chunk-5Q4R7HCL.js} +42 -4
- package/dist/{chunk-ADM46X22.js → chunk-7GQCWFOE.js} +157 -61
- package/dist/{chunk-4Z3SPQ67.js → chunk-7NCARGJW.js} +16 -8
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/{chunk-LQFGQNMV.js → chunk-AIF3Z2T7.js} +302 -39
- package/dist/{chunk-UCALUKB5.js → chunk-BAAG6ZTI.js} +98 -29
- package/dist/{chunk-NVNJH22U.js → chunk-D33YTSX5.js} +2 -2
- package/dist/{chunk-M2F7TZHH.js → chunk-DKGBBKOF.js} +136 -80
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/{chunk-HFCOH2GN.js → chunk-HYXDKS4N.js} +153 -110
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-36S2YPP4.js → chunk-JSXPZCET.js} +1 -1
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-HQSEH5F6.js → chunk-ORMZXBKQ.js} +108 -45
- package/dist/{chunk-LYVUX7NT.js → chunk-OXUY2A6L.js} +287 -130
- package/dist/{chunk-6GSIXTWX.js → chunk-PK6FK2G2.js} +187 -66
- package/dist/{chunk-W2EQ7X2L.js → chunk-QE4TTDU3.js} +47 -9
- package/dist/{chunk-XLO7SLIX.js → chunk-SXXVZMKZ.js} +262 -70
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-RR7M3FHM.js → chunk-UZQ6ALFS.js} +3 -3
- package/dist/{chunk-PNIRUQ4C.js → chunk-VVWPJ543.js} +6 -8
- package/dist/{chunk-7GIHSAWB.js → chunk-XC4MEKGA.js} +3 -3
- package/dist/{chunk-SKPTERHP.js → chunk-XRRZKZYX.js} +55 -31
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-DRIuclVT.d.cts} +10 -2
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-DRIuclVT.d.ts} +10 -2
- package/dist/{customElement-CNZxEB9G.d.ts → customElement-MmInOW1U.d.cts} +59 -10
- package/dist/{customElement-CNZxEB9G.d.cts → customElement-MmInOW1U.d.ts} +59 -10
- package/dist/data.cjs +293 -125
- package/dist/data.d.cts +47 -9
- package/dist/data.d.ts +47 -9
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +121 -58
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +391 -112
- package/dist/ecosystem.d.cts +31 -7
- package/dist/ecosystem.d.ts +31 -7
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2250 -879
- package/dist/extras.d.cts +10 -9
- package/dist/extras.d.ts +10 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +273 -82
- package/dist/index.d.cts +44 -154
- package/dist/index.d.ts +44 -154
- package/dist/index.js +24 -27
- package/dist/motion.cjs +137 -42
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +397 -48
- package/dist/patterns.d.cts +32 -9
- package/dist/patterns.d.ts +32 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +338 -217
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +587 -203
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +35 -23
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +214 -73
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/tagFactory-DFstCLQV.d.cts +117 -0
- package/dist/tagFactory-DkaNVUNV.d.ts +117 -0
- package/dist/testing.cjs +2481 -2153
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/ui.cjs +798 -328
- package/dist/ui.d.cts +40 -7
- package/dist/ui.d.ts +40 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +319 -285
- package/dist/widgets.js +9 -10
- package/package.json +2 -2
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-7NBDXVHS.js +0 -60
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
- package/dist/tagFactory-Bzupt4Pj.d.cts +0 -55
- package/dist/tagFactory-Bzupt4Pj.d.ts +0 -55
|
@@ -135,42 +135,40 @@ import {
|
|
|
135
135
|
use,
|
|
136
136
|
var_,
|
|
137
137
|
video
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-JSXPZCET.js";
|
|
139
139
|
import {
|
|
140
140
|
trustHTML
|
|
141
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-HURREPU2.js";
|
|
142
142
|
import {
|
|
143
143
|
watch
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-UZQ6ALFS.js";
|
|
145
145
|
import {
|
|
146
146
|
__resetIdCounter,
|
|
147
|
-
createId
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
context
|
|
151
|
-
} from "./chunk-7NBDXVHS.js";
|
|
147
|
+
createId,
|
|
148
|
+
domBinding
|
|
149
|
+
} from "./chunk-3ISI6ACU.js";
|
|
152
150
|
import {
|
|
153
151
|
SVG_NS,
|
|
154
152
|
bindChildNode,
|
|
155
153
|
captureFocusWithin,
|
|
156
154
|
restoreFocusWithin,
|
|
157
155
|
tagFactory
|
|
158
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-VVWPJ543.js";
|
|
159
157
|
import {
|
|
160
158
|
bindAttribute,
|
|
161
159
|
bindDynamic,
|
|
162
160
|
setSafeAttribute
|
|
163
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-47M47FOM.js";
|
|
164
162
|
import {
|
|
165
163
|
derived
|
|
166
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-QE4TTDU3.js";
|
|
167
165
|
import {
|
|
168
166
|
globalSingleton
|
|
169
167
|
} from "./chunk-7ZHH77QA.js";
|
|
170
168
|
import {
|
|
171
169
|
effect,
|
|
172
170
|
on
|
|
173
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-XC4MEKGA.js";
|
|
174
172
|
import {
|
|
175
173
|
disableSSR,
|
|
176
174
|
enableSSR,
|
|
@@ -179,23 +177,17 @@ import {
|
|
|
179
177
|
isSSR,
|
|
180
178
|
runInSSRContext,
|
|
181
179
|
withSSR
|
|
182
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-7XHATCIH.js";
|
|
183
181
|
import {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
dispose,
|
|
187
|
-
registerDisposer,
|
|
188
|
-
replaceChildrenSafely,
|
|
189
|
-
reportDrainRunaway,
|
|
190
|
-
unregisterDisposer
|
|
191
|
-
} from "./chunk-QKRPLZ2V.js";
|
|
182
|
+
adoptThenable
|
|
183
|
+
} from "./chunk-5HZXGZ6T.js";
|
|
192
184
|
import {
|
|
193
185
|
batch,
|
|
194
186
|
enqueueBatchedSignal,
|
|
195
187
|
external,
|
|
196
188
|
isBatching,
|
|
197
189
|
signal
|
|
198
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-D33YTSX5.js";
|
|
199
191
|
import {
|
|
200
192
|
notifySubscribers,
|
|
201
193
|
reactiveBinding,
|
|
@@ -206,19 +198,26 @@ import {
|
|
|
206
198
|
suspendTracking,
|
|
207
199
|
track,
|
|
208
200
|
untracked
|
|
209
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-5Q4R7HCL.js";
|
|
210
202
|
import {
|
|
211
203
|
DEV,
|
|
204
|
+
MAX_DRAIN_TEARDOWNS,
|
|
212
205
|
__export,
|
|
206
|
+
checkLeaks,
|
|
213
207
|
devAssert,
|
|
214
208
|
devWarn,
|
|
215
209
|
devWarnLazy,
|
|
210
|
+
dispose,
|
|
216
211
|
getRuntimeErrorHandler,
|
|
217
212
|
isDev,
|
|
218
213
|
normalizeError,
|
|
214
|
+
registerDisposer,
|
|
215
|
+
replaceChildrenSafely,
|
|
216
|
+
reportDrainRunaway,
|
|
219
217
|
reportError,
|
|
220
|
-
setRuntimeErrorHandler
|
|
221
|
-
|
|
218
|
+
setRuntimeErrorHandler,
|
|
219
|
+
unregisterDisposer
|
|
220
|
+
} from "./chunk-NYNYSPK7.js";
|
|
222
221
|
|
|
223
222
|
// index.ts
|
|
224
223
|
var index_exports = {};
|
|
@@ -1663,9 +1662,14 @@ var longPress = (element, options) => {
|
|
|
1663
1662
|
};
|
|
1664
1663
|
};
|
|
1665
1664
|
var copyOnClick = (element, getText) => {
|
|
1665
|
+
const report = (error) => reportError(error, { phase: "async", name: "copyOnClick", node: element });
|
|
1666
1666
|
const handler = () => {
|
|
1667
|
-
|
|
1668
|
-
|
|
1667
|
+
try {
|
|
1668
|
+
const text2 = typeof getText === "function" ? getText() : element.textContent ?? "";
|
|
1669
|
+
Promise.resolve(navigator.clipboard.writeText(text2)).catch(report);
|
|
1670
|
+
} catch (error) {
|
|
1671
|
+
report(error);
|
|
1672
|
+
}
|
|
1669
1673
|
};
|
|
1670
1674
|
element.addEventListener("click", handler);
|
|
1671
1675
|
return () => element.removeEventListener("click", handler);
|
|
@@ -1751,13 +1755,59 @@ function setGlobalErrorHandler(handler) {
|
|
|
1751
1755
|
globalErrorHandler = handler;
|
|
1752
1756
|
}
|
|
1753
1757
|
|
|
1758
|
+
// src/core/rendering/context.ts
|
|
1759
|
+
function context(defaultValue) {
|
|
1760
|
+
const [getValue, setValue] = signal(defaultValue);
|
|
1761
|
+
const warnIfSSR = (method) => {
|
|
1762
|
+
if (!DEV || !isSSR()) return;
|
|
1763
|
+
devWarn(
|
|
1764
|
+
`context.${method}() called during SSR. SibuJS context() is application-global \u2014 it is NOT isolated per request, so a concurrent request can observe this value. Do not use context() for request-specific SSR data; pass it explicitly or use request-scoped storage instead.`
|
|
1765
|
+
);
|
|
1766
|
+
};
|
|
1767
|
+
const ctx = {
|
|
1768
|
+
provide(value) {
|
|
1769
|
+
warnIfSSR("provide");
|
|
1770
|
+
const previous = getValue();
|
|
1771
|
+
setValue(value);
|
|
1772
|
+
return () => setValue(previous);
|
|
1773
|
+
},
|
|
1774
|
+
use() {
|
|
1775
|
+
return getValue;
|
|
1776
|
+
},
|
|
1777
|
+
get() {
|
|
1778
|
+
return getValue();
|
|
1779
|
+
},
|
|
1780
|
+
set(value) {
|
|
1781
|
+
warnIfSSR("set");
|
|
1782
|
+
setValue(value);
|
|
1783
|
+
},
|
|
1784
|
+
withContext(value, fn) {
|
|
1785
|
+
warnIfSSR("withContext");
|
|
1786
|
+
const previous = getValue();
|
|
1787
|
+
setValue(value);
|
|
1788
|
+
try {
|
|
1789
|
+
const result = fn();
|
|
1790
|
+
if (DEV && result !== null && typeof result?.then === "function") {
|
|
1791
|
+
devWarn(
|
|
1792
|
+
"context.withContext() received an async callback. Scoping is synchronous only \u2014 the previous value is restored as soon as the callback returns its promise, so anything after an `await` runs outside the scope."
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
return result;
|
|
1796
|
+
} finally {
|
|
1797
|
+
setValue(previous);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
return ctx;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1754
1804
|
// src/core/rendering/directives.ts
|
|
1755
1805
|
function show(condition, element) {
|
|
1756
1806
|
const resolved = typeof element === "function" ? element() : element;
|
|
1757
1807
|
const update = () => {
|
|
1758
1808
|
resolved.style.display = condition() ? "" : "none";
|
|
1759
1809
|
};
|
|
1760
|
-
registerDisposer(resolved,
|
|
1810
|
+
registerDisposer(resolved, reactiveBinding(update, resolved));
|
|
1761
1811
|
return resolved;
|
|
1762
1812
|
}
|
|
1763
1813
|
function attachBranch(parent, anchor, branch, attachedOnce, where) {
|
|
@@ -1781,9 +1831,11 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
1781
1831
|
let currentNode = null;
|
|
1782
1832
|
let lastCondition;
|
|
1783
1833
|
let initialized = false;
|
|
1834
|
+
let disposed = false;
|
|
1784
1835
|
const attachedOnce = /* @__PURE__ */ new WeakSet();
|
|
1785
1836
|
let currentNodeOwned = false;
|
|
1786
1837
|
const update = () => {
|
|
1838
|
+
if (disposed) return;
|
|
1787
1839
|
const show2 = condition();
|
|
1788
1840
|
const parent = anchor.parentNode;
|
|
1789
1841
|
if (!parent) return;
|
|
@@ -1802,10 +1854,14 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
1802
1854
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
|
|
1803
1855
|
initialized = true;
|
|
1804
1856
|
};
|
|
1805
|
-
|
|
1857
|
+
const stopBinding = reactiveBinding(update, anchor);
|
|
1858
|
+
registerDisposer(anchor, () => {
|
|
1859
|
+
disposed = true;
|
|
1860
|
+
stopBinding();
|
|
1861
|
+
});
|
|
1806
1862
|
if (!initialized) {
|
|
1807
1863
|
queueMicrotask(() => {
|
|
1808
|
-
if (!initialized && anchor.parentNode) update();
|
|
1864
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
1809
1865
|
});
|
|
1810
1866
|
}
|
|
1811
1867
|
return anchor;
|
|
@@ -1815,9 +1871,11 @@ function match(value, cases, fallback) {
|
|
|
1815
1871
|
let currentNode = null;
|
|
1816
1872
|
let lastKey;
|
|
1817
1873
|
let initialized = false;
|
|
1874
|
+
let disposed = false;
|
|
1818
1875
|
const attachedOnce = /* @__PURE__ */ new WeakSet();
|
|
1819
1876
|
let currentNodeOwned = false;
|
|
1820
1877
|
const update = () => {
|
|
1878
|
+
if (disposed) return;
|
|
1821
1879
|
const key = String(value());
|
|
1822
1880
|
const parent = anchor.parentNode;
|
|
1823
1881
|
if (!parent) return;
|
|
@@ -1836,17 +1894,24 @@ function match(value, cases, fallback) {
|
|
|
1836
1894
|
restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
|
|
1837
1895
|
initialized = true;
|
|
1838
1896
|
};
|
|
1839
|
-
|
|
1897
|
+
const stopBinding = reactiveBinding(update, anchor);
|
|
1898
|
+
registerDisposer(anchor, () => {
|
|
1899
|
+
disposed = true;
|
|
1900
|
+
stopBinding();
|
|
1901
|
+
});
|
|
1840
1902
|
if (!initialized) {
|
|
1841
1903
|
queueMicrotask(() => {
|
|
1842
|
-
if (!initialized && anchor.parentNode) update();
|
|
1904
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
1843
1905
|
});
|
|
1844
1906
|
}
|
|
1845
1907
|
return anchor;
|
|
1846
1908
|
}
|
|
1847
1909
|
|
|
1848
1910
|
// src/core/rendering/dynamic.ts
|
|
1849
|
-
var componentRegistry =
|
|
1911
|
+
var componentRegistry = globalSingleton(
|
|
1912
|
+
/* @__PURE__ */ Symbol.for("sibujs.components.registry.v1"),
|
|
1913
|
+
() => /* @__PURE__ */ new Map()
|
|
1914
|
+
);
|
|
1850
1915
|
function registerComponent(name, component) {
|
|
1851
1916
|
componentRegistry.set(name, component);
|
|
1852
1917
|
}
|
|
@@ -1858,7 +1923,7 @@ function resolveComponent(name) {
|
|
|
1858
1923
|
if (component) {
|
|
1859
1924
|
return component();
|
|
1860
1925
|
}
|
|
1861
|
-
return div(
|
|
1926
|
+
return div(`[Component "${name}" not found]`);
|
|
1862
1927
|
}
|
|
1863
1928
|
function DynamicComponent(is) {
|
|
1864
1929
|
const container = div({ class: "sibu-dynamic" });
|
|
@@ -1991,7 +2056,12 @@ function each(getArray, render, options) {
|
|
|
1991
2056
|
const [indexGetter, setIndex] = signal(i2);
|
|
1992
2057
|
let node;
|
|
1993
2058
|
try {
|
|
1994
|
-
|
|
2059
|
+
suspendTracking();
|
|
2060
|
+
try {
|
|
2061
|
+
node = resolveNodeChild(render(itemGetter, indexGetter));
|
|
2062
|
+
} finally {
|
|
2063
|
+
resumeTracking();
|
|
2064
|
+
}
|
|
1995
2065
|
} catch (err) {
|
|
1996
2066
|
const key2 = newKeys[i2];
|
|
1997
2067
|
node = document.createComment(`each:error:${i2}`);
|
|
@@ -2672,10 +2742,15 @@ function Portal(nodes, target) {
|
|
|
2672
2742
|
|
|
2673
2743
|
// src/core/rendering/slots.ts
|
|
2674
2744
|
function getSlot(slots, name = "default") {
|
|
2675
|
-
|
|
2745
|
+
if (slots == null || !Object.hasOwn(slots, name)) return void 0;
|
|
2746
|
+
const slot2 = slots[name];
|
|
2747
|
+
return typeof slot2 === "function" ? slot2 : void 0;
|
|
2676
2748
|
}
|
|
2677
2749
|
|
|
2678
2750
|
// src/core/signals/array.ts
|
|
2751
|
+
function nativeSplice(target, start, rest) {
|
|
2752
|
+
return rest.length === 0 ? target.splice(start) : target.splice(start, ...rest);
|
|
2753
|
+
}
|
|
2679
2754
|
function array(initial = []) {
|
|
2680
2755
|
const [arr, setArr] = signal([...initial]);
|
|
2681
2756
|
const actions = {
|
|
@@ -2703,12 +2778,12 @@ function array(initial = []) {
|
|
|
2703
2778
|
unshift(...items) {
|
|
2704
2779
|
setArr((prev) => [...items, ...prev]);
|
|
2705
2780
|
},
|
|
2706
|
-
splice(start,
|
|
2781
|
+
splice(start, ...rest) {
|
|
2707
2782
|
let removed = [];
|
|
2708
2783
|
setArr((prev) => {
|
|
2709
2784
|
const copy = [...prev];
|
|
2710
|
-
removed = copy
|
|
2711
|
-
return copy;
|
|
2785
|
+
removed = nativeSplice(copy, start, rest);
|
|
2786
|
+
return removed.length === 0 && rest.length <= 1 ? prev : copy;
|
|
2712
2787
|
});
|
|
2713
2788
|
return removed;
|
|
2714
2789
|
},
|
|
@@ -2791,9 +2866,9 @@ function reactiveArray(initial = []) {
|
|
|
2791
2866
|
data2.unshift(...items);
|
|
2792
2867
|
notify();
|
|
2793
2868
|
},
|
|
2794
|
-
splice(start,
|
|
2795
|
-
const removed = data2
|
|
2796
|
-
if (removed.length > 0 ||
|
|
2869
|
+
splice(start, ...rest) {
|
|
2870
|
+
const removed = nativeSplice(data2, start, rest);
|
|
2871
|
+
if (removed.length > 0 || rest.length > 1) {
|
|
2797
2872
|
notify();
|
|
2798
2873
|
}
|
|
2799
2874
|
return removed;
|
|
@@ -3015,6 +3090,21 @@ function deepEqual(a2, b2, seen) {
|
|
|
3015
3090
|
if (a2.length !== b2.length) return false;
|
|
3016
3091
|
return a2.every((val, i2) => deepEqual(val, b2[i2], seen));
|
|
3017
3092
|
}
|
|
3093
|
+
if (a2 instanceof Number || a2 instanceof String || a2 instanceof Boolean) {
|
|
3094
|
+
return Object.is(a2.valueOf(), b2.valueOf());
|
|
3095
|
+
}
|
|
3096
|
+
if (typeof URL !== "undefined" && a2 instanceof URL) {
|
|
3097
|
+
return a2.href === b2.href;
|
|
3098
|
+
}
|
|
3099
|
+
if (a2 instanceof Error) {
|
|
3100
|
+
const eb = b2;
|
|
3101
|
+
return a2.name === eb.name && a2.message === eb.message && deepEqual(a2.cause, eb.cause, seen) && plainKeysEqual(objA, objB, seen);
|
|
3102
|
+
}
|
|
3103
|
+
const proto = Object.getPrototypeOf(objA);
|
|
3104
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
3105
|
+
return plainKeysEqual(objA, objB, seen);
|
|
3106
|
+
}
|
|
3107
|
+
function plainKeysEqual(objA, objB, seen) {
|
|
3018
3108
|
const keysA = Object.keys(objA);
|
|
3019
3109
|
const keysB = Object.keys(objB);
|
|
3020
3110
|
if (keysA.length !== keysB.length) return false;
|
|
@@ -3040,15 +3130,18 @@ function ref(initial) {
|
|
|
3040
3130
|
}
|
|
3041
3131
|
|
|
3042
3132
|
// src/core/signals/store.ts
|
|
3133
|
+
function defineOwn(obj, key, value) {
|
|
3134
|
+
Object.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });
|
|
3135
|
+
}
|
|
3043
3136
|
function store(initialState) {
|
|
3044
3137
|
devAssert(
|
|
3045
3138
|
initialState !== null && typeof initialState === "object" && !Array.isArray(initialState),
|
|
3046
3139
|
"store: argument must be a plain object. For arrays, use array() instead."
|
|
3047
3140
|
);
|
|
3048
|
-
const signals =
|
|
3141
|
+
const signals = /* @__PURE__ */ Object.create(null);
|
|
3049
3142
|
Object.keys(initialState).forEach((key) => {
|
|
3050
3143
|
const [getter, setter] = signal(initialState[key]);
|
|
3051
|
-
signals
|
|
3144
|
+
defineOwn(signals, key, [getter, setter]);
|
|
3052
3145
|
});
|
|
3053
3146
|
const store2 = new Proxy({}, {
|
|
3054
3147
|
get(target, prop) {
|
|
@@ -3067,7 +3160,7 @@ function store(initialState) {
|
|
|
3067
3160
|
const getSnapshot = () => {
|
|
3068
3161
|
const snapshot = {};
|
|
3069
3162
|
Object.keys(signals).forEach((key) => {
|
|
3070
|
-
snapshot
|
|
3163
|
+
defineOwn(snapshot, key, signals[key][0]());
|
|
3071
3164
|
});
|
|
3072
3165
|
return snapshot;
|
|
3073
3166
|
};
|
|
@@ -3208,9 +3301,7 @@ function resolveTarget(root, target) {
|
|
|
3208
3301
|
}
|
|
3209
3302
|
}
|
|
3210
3303
|
function bindNode(el, commit) {
|
|
3211
|
-
|
|
3212
|
-
};
|
|
3213
|
-
return reactiveBinding(commit, el);
|
|
3304
|
+
return domBinding(commit, el);
|
|
3214
3305
|
}
|
|
3215
3306
|
function readControlValue(el) {
|
|
3216
3307
|
if (el instanceof HTMLInputElement) {
|
|
@@ -3667,23 +3758,27 @@ function scheduleIdle(fn) {
|
|
|
3667
3758
|
}
|
|
3668
3759
|
function transition() {
|
|
3669
3760
|
const [pending, setPending] = signal(false);
|
|
3761
|
+
let outstanding = 0;
|
|
3670
3762
|
function start(fn) {
|
|
3763
|
+
outstanding++;
|
|
3671
3764
|
setPending(true);
|
|
3765
|
+
let settled = false;
|
|
3766
|
+
const finish = () => {
|
|
3767
|
+
if (settled) return;
|
|
3768
|
+
settled = true;
|
|
3769
|
+
outstanding--;
|
|
3770
|
+
if (outstanding === 0) setPending(false);
|
|
3771
|
+
};
|
|
3772
|
+
const fail = (error) => {
|
|
3773
|
+
finish();
|
|
3774
|
+
reportError(error, { phase: "async", name: "transition" });
|
|
3775
|
+
};
|
|
3672
3776
|
scheduleIdle(() => {
|
|
3673
|
-
let result;
|
|
3674
3777
|
try {
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
}
|
|
3680
|
-
if (result && typeof result.then === "function") {
|
|
3681
|
-
result.then(
|
|
3682
|
-
() => setPending(false),
|
|
3683
|
-
() => setPending(false)
|
|
3684
|
-
);
|
|
3685
|
-
} else {
|
|
3686
|
-
setPending(false);
|
|
3778
|
+
const adopted = adoptThenable(fn());
|
|
3779
|
+
adopted ? adopted.then(finish, fail) : finish();
|
|
3780
|
+
} catch (error) {
|
|
3781
|
+
fail(error);
|
|
3687
3782
|
}
|
|
3688
3783
|
});
|
|
3689
3784
|
}
|
|
@@ -3724,6 +3819,7 @@ export {
|
|
|
3724
3819
|
catchError,
|
|
3725
3820
|
catchErrorAsync,
|
|
3726
3821
|
setGlobalErrorHandler,
|
|
3822
|
+
context,
|
|
3727
3823
|
show,
|
|
3728
3824
|
when,
|
|
3729
3825
|
match,
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stripHtml
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2INLLLMZ.js";
|
|
4
4
|
import {
|
|
5
5
|
globalSingleton
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
dispose
|
|
12
|
-
} from "./chunk-QKRPLZ2V.js";
|
|
9
|
+
} from "./chunk-XC4MEKGA.js";
|
|
13
10
|
import {
|
|
14
11
|
signal
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-D33YTSX5.js";
|
|
16
13
|
import {
|
|
17
14
|
forEachSubscriber,
|
|
18
15
|
getSubscriberCount,
|
|
19
16
|
getSubscriberDeps
|
|
20
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5Q4R7HCL.js";
|
|
21
18
|
import {
|
|
19
|
+
dispose,
|
|
22
20
|
isDev
|
|
23
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NYNYSPK7.js";
|
|
24
22
|
|
|
25
23
|
// src/devtools/debug.ts
|
|
26
24
|
var debugEnabled = false;
|
|
@@ -296,6 +294,16 @@ function initDevTools(config) {
|
|
|
296
294
|
});
|
|
297
295
|
emit();
|
|
298
296
|
});
|
|
297
|
+
hook.on("computed:destroy", (payload) => {
|
|
298
|
+
const p = payload;
|
|
299
|
+
for (const [id, node] of hook.nodes) {
|
|
300
|
+
if (node.ref === p.signal) {
|
|
301
|
+
hook.nodes.delete(id);
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
emit();
|
|
306
|
+
});
|
|
299
307
|
hook.on("effect:create", (payload) => {
|
|
300
308
|
_dt.nextNodeId++;
|
|
301
309
|
const name = inferName();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require,
|
|
3
3
|
devWarn
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NYNYSPK7.js";
|
|
5
5
|
|
|
6
6
|
// src/core/ssr-context.ts
|
|
7
7
|
var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
|
|
@@ -74,16 +74,18 @@ function disableSSR() {
|
|
|
74
74
|
getSSRStore().ssr = false;
|
|
75
75
|
}
|
|
76
76
|
function runInSSRContext(fn) {
|
|
77
|
-
const store = { ssr: true, suspenseIdCounter: 0, locale: void 0 };
|
|
77
|
+
const store = { ssr: true, suspenseIdCounter: 0, idCounter: 0, locale: void 0 };
|
|
78
78
|
if (als) {
|
|
79
79
|
return als.run(store, fn);
|
|
80
80
|
}
|
|
81
81
|
warnMissingAsyncLocalStorage();
|
|
82
82
|
const prevSSR = fallbackStore.ssr;
|
|
83
83
|
const prevCounter = fallbackStore.suspenseIdCounter;
|
|
84
|
+
const prevIdCounter = fallbackStore.idCounter;
|
|
84
85
|
const prevLocale = fallbackStore.locale;
|
|
85
86
|
fallbackStore.ssr = true;
|
|
86
87
|
fallbackStore.suspenseIdCounter = 0;
|
|
88
|
+
fallbackStore.idCounter = 0;
|
|
87
89
|
fallbackStore.locale = void 0;
|
|
88
90
|
_shared.fallbackDepth++;
|
|
89
91
|
try {
|
|
@@ -92,6 +94,7 @@ function runInSSRContext(fn) {
|
|
|
92
94
|
_shared.fallbackDepth--;
|
|
93
95
|
fallbackStore.ssr = prevSSR;
|
|
94
96
|
fallbackStore.suspenseIdCounter = prevCounter;
|
|
97
|
+
fallbackStore.idCounter = prevIdCounter;
|
|
95
98
|
fallbackStore.locale = prevLocale;
|
|
96
99
|
}
|
|
97
100
|
}
|