@estjs/template 0.0.17-beta.1 → 0.0.17-beta.2
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/template.cjs +2 -2
- package/dist/template.d.cts +25 -52
- package/dist/template.d.ts +25 -52
- package/dist/template.dev.cjs +211 -257
- package/dist/template.dev.cjs.map +1 -1
- package/dist/template.dev.js +211 -257
- package/dist/template.dev.js.map +1 -1
- package/dist/template.js +2 -2
- package/package.json +4 -4
package/dist/template.dev.cjs
CHANGED
|
@@ -160,6 +160,14 @@ function onCleanup(fn) {
|
|
|
160
160
|
}
|
|
161
161
|
scope.cleanup.push(fn);
|
|
162
162
|
}
|
|
163
|
+
var DANGEROUS_DATA_MIME_RE = /^data:\s*(?:text\/html|text\/xml|application\/xhtml\+xml|image\/svg\+xml|application\/xml)/;
|
|
164
|
+
function isUnsafeUrl(value) {
|
|
165
|
+
const v = value.replaceAll(/[\u0000-\u0020]+/g, "").toLowerCase();
|
|
166
|
+
if (shared.startsWith(v, "javascript:") || shared.startsWith(v, "vbscript:")) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
return DANGEROUS_DATA_MIME_RE.test(v);
|
|
170
|
+
}
|
|
163
171
|
function patchAttr(el, key, prev, next2) {
|
|
164
172
|
if (key === KEY_PROP) {
|
|
165
173
|
if (next2 == null) {
|
|
@@ -241,11 +249,8 @@ function patchAttr(el, key, prev, next2) {
|
|
|
241
249
|
}
|
|
242
250
|
const attrValue = shared.isSymbol(next2) ? String(next2) : next2;
|
|
243
251
|
const isUrlAttr = lowerKey === "href" || lowerKey === "src" || lowerKey === "xlink:href" || lowerKey === "action" || lowerKey === "formaction" || lowerKey === "poster";
|
|
244
|
-
if (isUrlAttr && shared.isString(attrValue)) {
|
|
245
|
-
|
|
246
|
-
if (shared.startsWith(v, "javascript:") || shared.startsWith(v, "data:")) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
252
|
+
if (isUrlAttr && shared.isString(attrValue) && isUnsafeUrl(attrValue)) {
|
|
253
|
+
return;
|
|
249
254
|
}
|
|
250
255
|
if (isXlink) {
|
|
251
256
|
el.setAttributeNS(XLINK_NAMESPACE, key, String(attrValue));
|
|
@@ -1182,7 +1187,13 @@ function createApp(component, target) {
|
|
|
1182
1187
|
const existingContent = container.innerHTML;
|
|
1183
1188
|
if (existingContent) {
|
|
1184
1189
|
{
|
|
1185
|
-
|
|
1190
|
+
if (container.querySelector("[data-hk]")) {
|
|
1191
|
+
shared.warn(
|
|
1192
|
+
`Target element contains server-rendered markup ([data-hk]); createApp() will discard it and render from scratch. Did you mean to call hydrate()?`
|
|
1193
|
+
);
|
|
1194
|
+
} else {
|
|
1195
|
+
shared.warn(`Target element is not empty, it will be cleared: ${target}`);
|
|
1196
|
+
}
|
|
1186
1197
|
}
|
|
1187
1198
|
container.innerHTML = "";
|
|
1188
1199
|
}
|
|
@@ -1687,11 +1698,6 @@ function tryHydratePortal(props) {
|
|
|
1687
1698
|
function isPortal(node) {
|
|
1688
1699
|
return !!node && !!node[PORTAL_COMPONENT];
|
|
1689
1700
|
}
|
|
1690
|
-
function clearContainer(el) {
|
|
1691
|
-
while (el.firstChild) {
|
|
1692
|
-
el.removeChild(el.firstChild);
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
1701
|
function resolveNodeValue(value) {
|
|
1696
1702
|
let current = value;
|
|
1697
1703
|
while (shared.isFunction(current)) {
|
|
@@ -1700,6 +1706,9 @@ function resolveNodeValue(value) {
|
|
|
1700
1706
|
if (signals.isSignal(current) || signals.isComputed(current)) {
|
|
1701
1707
|
return resolveNodeValue(current.value);
|
|
1702
1708
|
}
|
|
1709
|
+
if (Array.isArray(current)) {
|
|
1710
|
+
return current.map((item) => resolveNodeValue(item));
|
|
1711
|
+
}
|
|
1703
1712
|
return current;
|
|
1704
1713
|
}
|
|
1705
1714
|
var SuspenseContext = /* @__PURE__ */ Symbol("SuspenseContext");
|
|
@@ -1708,129 +1717,127 @@ function Suspense(props) {
|
|
|
1708
1717
|
if (!shared.isBrowser()) {
|
|
1709
1718
|
return (_a2 = props.fallback) != null ? _a2 : "";
|
|
1710
1719
|
}
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
let
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
return nodes;
|
|
1730
|
-
}
|
|
1731
|
-
return normalizeNode(current);
|
|
1720
|
+
const owner = getActiveScope();
|
|
1721
|
+
const start = document.createComment("suspense");
|
|
1722
|
+
const end = document.createComment("/suspense");
|
|
1723
|
+
const frag = document.createDocumentFragment();
|
|
1724
|
+
frag.append(start, end);
|
|
1725
|
+
let mounted = true;
|
|
1726
|
+
let pending = 0;
|
|
1727
|
+
let mounting = false;
|
|
1728
|
+
let contentScope = null;
|
|
1729
|
+
let parked = null;
|
|
1730
|
+
let fallbackScope = null;
|
|
1731
|
+
let resolved = null;
|
|
1732
|
+
const parkContent = () => {
|
|
1733
|
+
const off = document.createDocumentFragment();
|
|
1734
|
+
while (end.previousSibling && end.previousSibling !== start) {
|
|
1735
|
+
off.prepend(end.previousSibling);
|
|
1736
|
+
}
|
|
1737
|
+
parked = off;
|
|
1732
1738
|
};
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1739
|
+
const restoreContent = () => {
|
|
1740
|
+
var _a3;
|
|
1741
|
+
if (!parked) return;
|
|
1742
|
+
const parent = (_a3 = end.parentNode) != null ? _a3 : frag;
|
|
1743
|
+
while (parked.firstChild) {
|
|
1744
|
+
parent.insertBefore(parked.firstChild, end);
|
|
1745
|
+
}
|
|
1746
|
+
parked = null;
|
|
1741
1747
|
};
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1748
|
+
const mountFallback = () => {
|
|
1749
|
+
if (props.fallback == null || fallbackScope) return;
|
|
1750
|
+
fallbackScope = createScope(owner);
|
|
1751
|
+
runWithScope(fallbackScope, () => {
|
|
1752
|
+
var _a3;
|
|
1753
|
+
insert((_a3 = end.parentNode) != null ? _a3 : frag, () => resolveNodeValue(props.fallback), end);
|
|
1754
|
+
});
|
|
1747
1755
|
};
|
|
1748
|
-
const
|
|
1749
|
-
if (
|
|
1750
|
-
|
|
1751
|
-
|
|
1756
|
+
const disposeFallback = () => {
|
|
1757
|
+
if (!fallbackScope) return;
|
|
1758
|
+
disposeScope(fallbackScope);
|
|
1759
|
+
fallbackScope = null;
|
|
1752
1760
|
};
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
if (
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
renderChildren(props.children);
|
|
1761
|
+
const mountContent = (children2) => {
|
|
1762
|
+
mounting = true;
|
|
1763
|
+
contentScope = createScope(owner);
|
|
1764
|
+
runWithScope(contentScope, () => {
|
|
1765
|
+
var _a3;
|
|
1766
|
+
insert((_a3 = end.parentNode) != null ? _a3 : frag, () => resolveNodeValue(children2), end);
|
|
1767
|
+
});
|
|
1768
|
+
mounting = false;
|
|
1769
|
+
if (pending && !parked) {
|
|
1770
|
+
parkContent();
|
|
1771
|
+
mountFallback();
|
|
1765
1772
|
}
|
|
1766
1773
|
};
|
|
1767
|
-
const
|
|
1768
|
-
if (
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1774
|
+
const showFallback = () => {
|
|
1775
|
+
if (parked) return;
|
|
1776
|
+
if (mounting) return;
|
|
1777
|
+
parkContent();
|
|
1778
|
+
mountFallback();
|
|
1779
|
+
};
|
|
1780
|
+
const showContent = () => {
|
|
1781
|
+
if (!parked) return;
|
|
1782
|
+
const hasSyncChildren = props.children != null && !shared.isPromise(props.children);
|
|
1783
|
+
if (contentScope == null && resolved == null && !hasSyncChildren) return;
|
|
1784
|
+
disposeFallback();
|
|
1785
|
+
restoreContent();
|
|
1786
|
+
if (!contentScope) {
|
|
1787
|
+
if (resolved) {
|
|
1788
|
+
mountContent(resolved);
|
|
1789
|
+
} else if (hasSyncChildren) {
|
|
1790
|
+
mountContent(props.children);
|
|
1775
1791
|
}
|
|
1776
1792
|
}
|
|
1777
|
-
if (isShowingFallback) {
|
|
1778
|
-
renderFallbackContent();
|
|
1779
|
-
}
|
|
1780
1793
|
};
|
|
1781
|
-
const
|
|
1794
|
+
const settle = () => {
|
|
1795
|
+
if (!mounted) return;
|
|
1796
|
+
if (--pending === 0) showContent();
|
|
1797
|
+
};
|
|
1798
|
+
const ctx = {
|
|
1782
1799
|
register: (promise) => {
|
|
1783
|
-
|
|
1800
|
+
pending++;
|
|
1784
1801
|
showFallback();
|
|
1785
|
-
promise.then(() => {
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
if (pendingCount === 0) {
|
|
1789
|
-
showChildren();
|
|
1790
|
-
}
|
|
1791
|
-
}).catch((error5) => {
|
|
1792
|
-
{
|
|
1793
|
-
shared.warn("[Suspense] Resource failed:", error5);
|
|
1794
|
-
}
|
|
1795
|
-
if (!isMounted) return;
|
|
1796
|
-
pendingCount--;
|
|
1797
|
-
if (pendingCount === 0) {
|
|
1798
|
-
showChildren();
|
|
1799
|
-
}
|
|
1802
|
+
promise.then(settle).catch((error5) => {
|
|
1803
|
+
shared.warn("[Suspense] Resource failed:", error5);
|
|
1804
|
+
settle();
|
|
1800
1805
|
});
|
|
1801
1806
|
},
|
|
1802
1807
|
increment: () => {
|
|
1803
|
-
|
|
1808
|
+
pending++;
|
|
1804
1809
|
showFallback();
|
|
1805
1810
|
},
|
|
1806
1811
|
decrement: () => {
|
|
1807
|
-
|
|
1808
|
-
if (
|
|
1809
|
-
showChildren();
|
|
1810
|
-
}
|
|
1812
|
+
pending = Math.max(0, pending - 1);
|
|
1813
|
+
if (pending === 0) showContent();
|
|
1811
1814
|
}
|
|
1812
1815
|
};
|
|
1813
|
-
provide(SuspenseContext,
|
|
1816
|
+
provide(SuspenseContext, ctx);
|
|
1814
1817
|
const children = props.children;
|
|
1815
1818
|
if (shared.isPromise(children)) {
|
|
1816
|
-
children.then((
|
|
1817
|
-
|
|
1819
|
+
children.then((value) => {
|
|
1820
|
+
resolved = value;
|
|
1818
1821
|
}).catch(() => {
|
|
1819
1822
|
});
|
|
1820
|
-
|
|
1823
|
+
ctx.register(children);
|
|
1821
1824
|
} else if (children != null) {
|
|
1822
|
-
|
|
1823
|
-
} else {
|
|
1825
|
+
mountContent(children);
|
|
1826
|
+
} else if (props.fallback != null) {
|
|
1824
1827
|
showFallback();
|
|
1825
1828
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1829
|
+
onCleanup(() => {
|
|
1830
|
+
mounted = false;
|
|
1831
|
+
pending = 0;
|
|
1832
|
+
resolved = null;
|
|
1833
|
+
if (contentScope) disposeScope(contentScope);
|
|
1834
|
+
if (fallbackScope) disposeScope(fallbackScope);
|
|
1835
|
+
contentScope = fallbackScope = null;
|
|
1836
|
+
parked = null;
|
|
1837
|
+
start.remove();
|
|
1838
|
+
end.remove();
|
|
1832
1839
|
});
|
|
1833
|
-
return
|
|
1840
|
+
return frag;
|
|
1834
1841
|
}
|
|
1835
1842
|
Suspense[SUSPENSE_COMPONENT] = true;
|
|
1836
1843
|
function isSuspense(node) {
|
|
@@ -1904,185 +1911,130 @@ function createResource(fetcher, options) {
|
|
|
1904
1911
|
function resolveModule(mod) {
|
|
1905
1912
|
return shared.isFunction(mod) ? mod : mod.default;
|
|
1906
1913
|
}
|
|
1907
|
-
function
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1914
|
+
function defineServerAsyncComponent(loader, ssr) {
|
|
1915
|
+
if (ssr === "client-only") {
|
|
1916
|
+
const placeholder = () => "";
|
|
1917
|
+
placeholder.__asyncLoader = loader;
|
|
1918
|
+
placeholder.__asyncResolved = () => null;
|
|
1919
|
+
return placeholder;
|
|
1920
|
+
}
|
|
1921
|
+
let resolved = null;
|
|
1922
|
+
let promise = null;
|
|
1923
|
+
const load = () => promise != null ? promise : promise = loader().then((mod) => {
|
|
1924
|
+
resolved = resolveModule(mod);
|
|
1925
|
+
}).catch(() => {
|
|
1926
|
+
});
|
|
1927
|
+
load();
|
|
1928
|
+
const wrapper = (props) => resolved ? resolved(props) : "";
|
|
1929
|
+
wrapper.__asyncLoader = load;
|
|
1930
|
+
wrapper.__asyncResolved = () => resolved;
|
|
1931
|
+
return wrapper;
|
|
1911
1932
|
}
|
|
1912
|
-
function
|
|
1913
|
-
const { delay = 200, timeout,
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
placeholder.__asyncLoader = loader;
|
|
1918
|
-
placeholder.__asyncResolved = () => null;
|
|
1919
|
-
return placeholder;
|
|
1920
|
-
}
|
|
1921
|
-
let ssrResolved = null;
|
|
1922
|
-
let ssrPromise = null;
|
|
1923
|
-
const ssrLoad = () => {
|
|
1924
|
-
if (ssrPromise) return ssrPromise;
|
|
1925
|
-
ssrPromise = loader().then((mod) => {
|
|
1926
|
-
ssrResolved = resolveModule(mod);
|
|
1927
|
-
}).catch(() => {
|
|
1928
|
-
});
|
|
1929
|
-
return ssrPromise;
|
|
1930
|
-
};
|
|
1931
|
-
ssrLoad();
|
|
1932
|
-
const ssrWrapper = (props) => {
|
|
1933
|
-
if (ssrResolved) {
|
|
1934
|
-
return ssrResolved(props);
|
|
1935
|
-
}
|
|
1936
|
-
return "";
|
|
1937
|
-
};
|
|
1938
|
-
ssrWrapper.__asyncLoader = ssrLoad;
|
|
1939
|
-
ssrWrapper.__asyncResolved = () => ssrResolved;
|
|
1940
|
-
return ssrWrapper;
|
|
1941
|
-
}
|
|
1942
|
-
let cachedComponent = null;
|
|
1943
|
-
let cachedError = null;
|
|
1944
|
-
let cachedStatus = "pending";
|
|
1933
|
+
function defineClientAsyncComponent(loader, options) {
|
|
1934
|
+
const { loading, error: errorComp, delay = 200, timeout, onError } = options;
|
|
1935
|
+
let component = null;
|
|
1936
|
+
let error5 = null;
|
|
1937
|
+
let status = "pending";
|
|
1945
1938
|
let loadPromise = null;
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
loadPromise = null;
|
|
1955
|
-
});
|
|
1956
|
-
return loadPromise;
|
|
1957
|
-
}
|
|
1939
|
+
const load = () => loadPromise != null ? loadPromise : loadPromise = loader().then((mod) => {
|
|
1940
|
+
component = resolveModule(mod);
|
|
1941
|
+
status = "resolved";
|
|
1942
|
+
}).catch((error_) => {
|
|
1943
|
+
error5 = error_ instanceof Error ? error_ : new Error(String(error_));
|
|
1944
|
+
status = "errored";
|
|
1945
|
+
loadPromise = null;
|
|
1946
|
+
});
|
|
1958
1947
|
load();
|
|
1959
1948
|
function AsyncWrapper(props) {
|
|
1960
1949
|
var _a2;
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
onCleanup(() => comp.destroy());
|
|
1966
|
-
return el;
|
|
1967
|
-
}
|
|
1968
|
-
if (cachedStatus === "errored" && cachedError) {
|
|
1969
|
-
const el = document.createElement("div");
|
|
1970
|
-
el.style.display = "contents";
|
|
1971
|
-
if (options.error) {
|
|
1972
|
-
let alive2 = true;
|
|
1973
|
-
let currentComp2 = null;
|
|
1974
|
-
const swap2 = (fn, swapProps) => {
|
|
1975
|
-
if (!alive2) return;
|
|
1976
|
-
currentComp2 == null ? void 0 : currentComp2.destroy();
|
|
1977
|
-
currentComp2 = renderInto(el, fn, swapProps);
|
|
1978
|
-
};
|
|
1979
|
-
const retry = () => {
|
|
1980
|
-
loadPromise = null;
|
|
1981
|
-
cachedStatus = "pending";
|
|
1982
|
-
cachedError = null;
|
|
1983
|
-
if (options.loading) swap2(options.loading);
|
|
1984
|
-
load().then(() => {
|
|
1985
|
-
if (!alive2) return;
|
|
1986
|
-
if (cachedStatus === "resolved" && cachedComponent) {
|
|
1987
|
-
swap2(cachedComponent, props);
|
|
1988
|
-
} else if (cachedStatus === "errored" && cachedError) {
|
|
1989
|
-
if (options.error) swap2(options.error, { error: cachedError, retry });
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
|
-
};
|
|
1993
|
-
swap2(options.error, { error: cachedError, retry });
|
|
1994
|
-
onDestroy(() => {
|
|
1995
|
-
alive2 = false;
|
|
1996
|
-
currentComp2 == null ? void 0 : currentComp2.destroy();
|
|
1997
|
-
currentComp2 = null;
|
|
1998
|
-
});
|
|
1999
|
-
}
|
|
2000
|
-
return el;
|
|
2001
|
-
}
|
|
2002
|
-
const container = document.createElement("div");
|
|
2003
|
-
container.style.display = "contents";
|
|
1950
|
+
const owner = getActiveScope();
|
|
1951
|
+
const end = document.createComment("async");
|
|
1952
|
+
const frag = document.createDocumentFragment();
|
|
1953
|
+
frag.appendChild(end);
|
|
2004
1954
|
let alive = true;
|
|
2005
|
-
let
|
|
1955
|
+
let viewScope = null;
|
|
2006
1956
|
let delayTimer = null;
|
|
2007
1957
|
let timeoutTimer = null;
|
|
2008
|
-
const
|
|
2009
|
-
if (
|
|
2010
|
-
|
|
2011
|
-
|
|
1958
|
+
const clearTimers = () => {
|
|
1959
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
1960
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
1961
|
+
delayTimer = timeoutTimer = null;
|
|
2012
1962
|
};
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
error: cachedError,
|
|
2025
|
-
retry: retryWith(retryProps)
|
|
2026
|
-
});
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
1963
|
+
const render = (fn, fnProps) => {
|
|
1964
|
+
if (!alive) return;
|
|
1965
|
+
if (viewScope) {
|
|
1966
|
+
disposeScope(viewScope);
|
|
1967
|
+
viewScope = null;
|
|
1968
|
+
}
|
|
1969
|
+
if (!fn) return;
|
|
1970
|
+
viewScope = createScope(owner);
|
|
1971
|
+
runWithScope(viewScope, () => {
|
|
1972
|
+
var _a3;
|
|
1973
|
+
insert((_a3 = end.parentNode) != null ? _a3 : frag, () => new Component(fn, fnProps), end);
|
|
2029
1974
|
});
|
|
2030
1975
|
};
|
|
2031
1976
|
onDestroy(() => {
|
|
2032
1977
|
alive = false;
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
1978
|
+
clearTimers();
|
|
1979
|
+
if (viewScope) {
|
|
1980
|
+
disposeScope(viewScope);
|
|
1981
|
+
viewScope = null;
|
|
1982
|
+
}
|
|
1983
|
+
end.remove();
|
|
2037
1984
|
});
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
if (options.loading) swap(options.loading);
|
|
1985
|
+
const retryWith = (retryProps) => () => {
|
|
1986
|
+
loadPromise = null;
|
|
1987
|
+
status = "pending";
|
|
1988
|
+
error5 = null;
|
|
1989
|
+
if (loading) render(loading);
|
|
1990
|
+
load().then(() => settle(retryProps));
|
|
2045
1991
|
};
|
|
2046
|
-
const
|
|
1992
|
+
const settle = (renderProps) => {
|
|
2047
1993
|
if (!alive) return;
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
if (
|
|
1994
|
+
clearTimers();
|
|
1995
|
+
if (status === "resolved" && component) {
|
|
1996
|
+
render(component, renderProps);
|
|
1997
|
+
} else if (status === "errored" && error5) {
|
|
1998
|
+
if (errorComp) render(errorComp, { error: error5, retry: retryWith(renderProps) });
|
|
1999
|
+
if (onError) onError(error5, retryWith(renderProps));
|
|
2053
2000
|
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2001
|
+
};
|
|
2002
|
+
if (status === "resolved" && component) {
|
|
2003
|
+
render(component, props);
|
|
2004
|
+
return frag;
|
|
2005
|
+
}
|
|
2006
|
+
if (status === "errored" && error5) {
|
|
2007
|
+
if (errorComp) render(errorComp, { error: error5, retry: retryWith(props) });
|
|
2008
|
+
return frag;
|
|
2059
2009
|
}
|
|
2010
|
+
const pending = load().then(() => settle(props));
|
|
2011
|
+
(_a2 = inject(SuspenseContext)) == null ? void 0 : _a2.register(pending);
|
|
2060
2012
|
if (delay > 0) {
|
|
2061
2013
|
delayTimer = setTimeout(() => {
|
|
2062
|
-
if (alive &&
|
|
2063
|
-
showLoading();
|
|
2064
|
-
}
|
|
2014
|
+
if (alive && status === "pending" && loading) render(loading);
|
|
2065
2015
|
}, delay);
|
|
2066
|
-
} else if (
|
|
2067
|
-
|
|
2016
|
+
} else if (loading) {
|
|
2017
|
+
render(loading);
|
|
2068
2018
|
}
|
|
2069
2019
|
if (timeout != null) {
|
|
2070
2020
|
timeoutTimer = setTimeout(() => {
|
|
2071
|
-
if (alive
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
if (onError) onError(err, retryWith(props));
|
|
2077
|
-
}
|
|
2021
|
+
if (!alive || status !== "pending") return;
|
|
2022
|
+
error5 = new Error(`[defineAsyncComponent] Timeout after ${timeout}ms`);
|
|
2023
|
+
status = "errored";
|
|
2024
|
+
if (errorComp) render(errorComp, { error: error5, retry: retryWith(props) });
|
|
2025
|
+
if (onError) onError(error5, retryWith(props));
|
|
2078
2026
|
}, timeout);
|
|
2079
2027
|
}
|
|
2080
|
-
return
|
|
2028
|
+
return frag;
|
|
2081
2029
|
}
|
|
2082
2030
|
AsyncWrapper.__asyncLoader = load;
|
|
2083
|
-
AsyncWrapper.__asyncResolved = () =>
|
|
2031
|
+
AsyncWrapper.__asyncResolved = () => component;
|
|
2084
2032
|
return AsyncWrapper;
|
|
2085
2033
|
}
|
|
2034
|
+
function defineAsyncComponent(loader, options = {}) {
|
|
2035
|
+
var _a2;
|
|
2036
|
+
return typeof window === "undefined" ? defineServerAsyncComponent(loader, (_a2 = options.ssr) != null ? _a2 : "blocking") : defineClientAsyncComponent(loader, options);
|
|
2037
|
+
}
|
|
2086
2038
|
function For(props) {
|
|
2087
2039
|
const fragment = document.createDocumentFragment();
|
|
2088
2040
|
const marker = document.createComment("");
|
|
@@ -2131,8 +2083,10 @@ function For(props) {
|
|
|
2131
2083
|
}
|
|
2132
2084
|
fallbackNodes = [];
|
|
2133
2085
|
};
|
|
2086
|
+
const ownerScope = getActiveScope();
|
|
2134
2087
|
const renderItem = (item, index, parent, before, key = getKey(item, index)) => {
|
|
2135
|
-
|
|
2088
|
+
var _a2;
|
|
2089
|
+
const parentScope = (_a2 = getActiveScope()) != null ? _a2 : ownerScope;
|
|
2136
2090
|
const scope = createScope(parentScope);
|
|
2137
2091
|
let mountedNodes = [];
|
|
2138
2092
|
runWithScope(scope, () => {
|