@solidjs/web 2.0.0-rc.18 → 2.0.0-rc.19
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/server.dev.js +12 -17
- package/dist/server.js +12 -17
- package/dist/server.observe.js +12 -17
- package/dist/web.dev.js +53 -71
- package/dist/web.js +52 -70
- package/dist/web.observe.js +52 -70
- package/package.json +2 -2
package/dist/server.dev.js
CHANGED
|
@@ -1842,7 +1842,7 @@ function isAttrName(prop) {
|
|
|
1842
1842
|
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1843
1843
|
return true;
|
|
1844
1844
|
}
|
|
1845
|
-
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,
|
|
1845
|
+
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,(_$HY.v=_$HY.v||{})[e]=n.hasAttribute("e")?[...n.content.childNodes]:1,o.replaceWith(n.content),n.remove(),_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}function $dfe(e,t,k){(t=e.target)&&t.getAttribute&&!t._$dc&&(k=t.getAttribute("data-dfc"))&&(t._$dc=1,$dfc(k))}document.addEventListener("load",$dfe,!0);document.addEventListener("error",$dfe,!0)`;
|
|
1846
1846
|
const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))?n.hasAttribute("data-dh")||n.setAttribute("data-dhf",n.textContent):(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
|
|
1847
1847
|
function renderToString(code, options = {}) {
|
|
1848
1848
|
const {
|
|
@@ -2113,7 +2113,6 @@ function renderToStream(code, options = {}) {
|
|
|
2113
2113
|
const blockingPromises = new Set();
|
|
2114
2114
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
2115
2115
|
let stubBatch = null;
|
|
2116
|
-
const STUB_BATCH_KEY = "$B";
|
|
2117
2116
|
let stableOrder = false;
|
|
2118
2117
|
let parkedWrites = null;
|
|
2119
2118
|
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
@@ -2128,19 +2127,10 @@ function renderToStream(code, options = {}) {
|
|
|
2128
2127
|
};
|
|
2129
2128
|
const flushStubBatch = () => {
|
|
2130
2129
|
if (!stubBatch) return;
|
|
2131
|
-
const
|
|
2130
|
+
const entries = [...stubBatch];
|
|
2132
2131
|
stubBatch = null;
|
|
2133
|
-
if (batch.size === 1) {
|
|
2134
|
-
const [id, p] = batch.entries().next().value;
|
|
2135
|
-
serializer.write(id, p);
|
|
2136
|
-
return;
|
|
2137
|
-
}
|
|
2138
|
-
const obj = {};
|
|
2139
|
-
const entries = [...batch];
|
|
2140
2132
|
if (stableOrder) entries.sort(byKey);
|
|
2141
|
-
for (
|
|
2142
|
-
serializer.write(STUB_BATCH_KEY, obj);
|
|
2143
|
-
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
2133
|
+
for (let i = 0; i < entries.length; i++) serializer.write(entries[i][0], entries[i][1]);
|
|
2144
2134
|
};
|
|
2145
2135
|
let headerEmitted = false;
|
|
2146
2136
|
const pushTask = task => {
|
|
@@ -2177,6 +2167,7 @@ function renderToStream(code, options = {}) {
|
|
|
2177
2167
|
fragment(key, value, meta) {
|
|
2178
2168
|
const deferActivation = !!meta.revealGroup;
|
|
2179
2169
|
const styles = meta.styles;
|
|
2170
|
+
const tpl = `<template id="${key}"${meta.error ? " e" : ""}>${value}</template>`;
|
|
2180
2171
|
for (let i = 0; i < styles.inline.length; i++) {
|
|
2181
2172
|
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
2182
2173
|
}
|
|
@@ -2184,12 +2175,12 @@ function renderToStream(code, options = {}) {
|
|
|
2184
2175
|
const styleAttr = nonceAttr(nonce, "style");
|
|
2185
2176
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
2186
2177
|
writeTasks();
|
|
2187
|
-
buffer.write(
|
|
2178
|
+
buffer.write(tpl);
|
|
2188
2179
|
for (const entry of styles.links) {
|
|
2189
2180
|
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
2190
2181
|
}
|
|
2191
2182
|
} else {
|
|
2192
|
-
buffer.write(
|
|
2183
|
+
buffer.write(tpl);
|
|
2193
2184
|
if (!deferActivation) {
|
|
2194
2185
|
emitTask(`$df("${key}")`);
|
|
2195
2186
|
}
|
|
@@ -2302,22 +2293,26 @@ function renderToStream(code, options = {}) {
|
|
|
2302
2293
|
return raced;
|
|
2303
2294
|
};
|
|
2304
2295
|
const abandonSubtree = (key, error) => {
|
|
2296
|
+
if (key == null) return;
|
|
2305
2297
|
let fragments = 0;
|
|
2306
2298
|
let serialized = 0;
|
|
2307
2299
|
for (const [k, entry] of registry) {
|
|
2308
|
-
if (k.length > key.length && k.startsWith(key)) {
|
|
2300
|
+
if (k != null && k.length > key.length && k.startsWith(key)) {
|
|
2309
2301
|
registry.delete(k);
|
|
2310
2302
|
entry.resolve();
|
|
2311
2303
|
fragments++;
|
|
2312
2304
|
}
|
|
2313
2305
|
}
|
|
2306
|
+
const unregister = [];
|
|
2314
2307
|
for (const [id, settle] of pendingSerialized) {
|
|
2315
2308
|
if (id.startsWith(key)) {
|
|
2316
2309
|
pendingSerialized.delete(id);
|
|
2317
2310
|
settle();
|
|
2318
2311
|
serialized++;
|
|
2312
|
+
if (!stubBatch?.delete(id)) unregister.push(`delete _$HY.r[${JSON.stringify(id)}]`);
|
|
2319
2313
|
}
|
|
2320
2314
|
}
|
|
2315
|
+
if (unregister.length && !options.sink) pushTask(unregister.join(";"));
|
|
2321
2316
|
if ((fragments || serialized)) emitFinding({
|
|
2322
2317
|
code: "SSR_SUBTREE_ABANDONED",
|
|
2323
2318
|
kind: "ssr",
|
|
@@ -2544,7 +2539,7 @@ function renderToStream(code, options = {}) {
|
|
|
2544
2539
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
2545
2540
|
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
2546
2541
|
if (headOps) emitHeadOps(key, headOps);
|
|
2547
|
-
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2542
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : error ? "" : " "), {
|
|
2548
2543
|
styles,
|
|
2549
2544
|
revealGroup,
|
|
2550
2545
|
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
package/dist/server.js
CHANGED
|
@@ -1577,7 +1577,7 @@ function isAttrName(prop) {
|
|
|
1577
1577
|
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1578
1578
|
return true;
|
|
1579
1579
|
}
|
|
1580
|
-
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,
|
|
1580
|
+
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,(_$HY.v=_$HY.v||{})[e]=n.hasAttribute("e")?[...n.content.childNodes]:1,o.replaceWith(n.content),n.remove(),_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}function $dfe(e,t,k){(t=e.target)&&t.getAttribute&&!t._$dc&&(k=t.getAttribute("data-dfc"))&&(t._$dc=1,$dfc(k))}document.addEventListener("load",$dfe,!0);document.addEventListener("error",$dfe,!0)`;
|
|
1581
1581
|
const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))?n.hasAttribute("data-dh")||n.setAttribute("data-dhf",n.textContent):(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
|
|
1582
1582
|
function renderToString(code, options = {}) {
|
|
1583
1583
|
const {
|
|
@@ -1827,7 +1827,6 @@ function renderToStream(code, options = {}) {
|
|
|
1827
1827
|
const blockingPromises = new Set();
|
|
1828
1828
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1829
1829
|
let stubBatch = null;
|
|
1830
|
-
const STUB_BATCH_KEY = "$B";
|
|
1831
1830
|
let stableOrder = false;
|
|
1832
1831
|
let parkedWrites = null;
|
|
1833
1832
|
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
@@ -1842,19 +1841,10 @@ function renderToStream(code, options = {}) {
|
|
|
1842
1841
|
};
|
|
1843
1842
|
const flushStubBatch = () => {
|
|
1844
1843
|
if (!stubBatch) return;
|
|
1845
|
-
const
|
|
1844
|
+
const entries = [...stubBatch];
|
|
1846
1845
|
stubBatch = null;
|
|
1847
|
-
if (batch.size === 1) {
|
|
1848
|
-
const [id, p] = batch.entries().next().value;
|
|
1849
|
-
serializer.write(id, p);
|
|
1850
|
-
return;
|
|
1851
|
-
}
|
|
1852
|
-
const obj = {};
|
|
1853
|
-
const entries = [...batch];
|
|
1854
1846
|
if (stableOrder) entries.sort(byKey);
|
|
1855
|
-
for (
|
|
1856
|
-
serializer.write(STUB_BATCH_KEY, obj);
|
|
1857
|
-
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1847
|
+
for (let i = 0; i < entries.length; i++) serializer.write(entries[i][0], entries[i][1]);
|
|
1858
1848
|
};
|
|
1859
1849
|
let headerEmitted = false;
|
|
1860
1850
|
const pushTask = task => {
|
|
@@ -1891,6 +1881,7 @@ function renderToStream(code, options = {}) {
|
|
|
1891
1881
|
fragment(key, value, meta) {
|
|
1892
1882
|
const deferActivation = !!meta.revealGroup;
|
|
1893
1883
|
const styles = meta.styles;
|
|
1884
|
+
const tpl = `<template id="${key}"${meta.error ? " e" : ""}>${value}</template>`;
|
|
1894
1885
|
for (let i = 0; i < styles.inline.length; i++) {
|
|
1895
1886
|
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
1896
1887
|
}
|
|
@@ -1898,12 +1889,12 @@ function renderToStream(code, options = {}) {
|
|
|
1898
1889
|
const styleAttr = nonceAttr(nonce, "style");
|
|
1899
1890
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
1900
1891
|
writeTasks();
|
|
1901
|
-
buffer.write(
|
|
1892
|
+
buffer.write(tpl);
|
|
1902
1893
|
for (const entry of styles.links) {
|
|
1903
1894
|
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
1904
1895
|
}
|
|
1905
1896
|
} else {
|
|
1906
|
-
buffer.write(
|
|
1897
|
+
buffer.write(tpl);
|
|
1907
1898
|
if (!deferActivation) {
|
|
1908
1899
|
emitTask(`$df("${key}")`);
|
|
1909
1900
|
}
|
|
@@ -2016,18 +2007,22 @@ function renderToStream(code, options = {}) {
|
|
|
2016
2007
|
return raced;
|
|
2017
2008
|
};
|
|
2018
2009
|
const abandonSubtree = (key, error) => {
|
|
2010
|
+
if (key == null) return;
|
|
2019
2011
|
for (const [k, entry] of registry) {
|
|
2020
|
-
if (k.length > key.length && k.startsWith(key)) {
|
|
2012
|
+
if (k != null && k.length > key.length && k.startsWith(key)) {
|
|
2021
2013
|
registry.delete(k);
|
|
2022
2014
|
entry.resolve();
|
|
2023
2015
|
}
|
|
2024
2016
|
}
|
|
2017
|
+
const unregister = [];
|
|
2025
2018
|
for (const [id, settle] of pendingSerialized) {
|
|
2026
2019
|
if (id.startsWith(key)) {
|
|
2027
2020
|
pendingSerialized.delete(id);
|
|
2028
2021
|
settle();
|
|
2022
|
+
if (!stubBatch?.delete(id)) unregister.push(`delete _$HY.r[${JSON.stringify(id)}]`);
|
|
2029
2023
|
}
|
|
2030
2024
|
}
|
|
2025
|
+
if (unregister.length && !options.sink) pushTask(unregister.join(";"));
|
|
2031
2026
|
};
|
|
2032
2027
|
const writeTasks = () => {
|
|
2033
2028
|
if (tasks.length && !completed && firstFlushed) {
|
|
@@ -2242,7 +2237,7 @@ function renderToStream(code, options = {}) {
|
|
|
2242
2237
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
2243
2238
|
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
2244
2239
|
if (headOps) emitHeadOps(key, headOps);
|
|
2245
|
-
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2240
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : error ? "" : " "), {
|
|
2246
2241
|
styles,
|
|
2247
2242
|
revealGroup,
|
|
2248
2243
|
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
package/dist/server.observe.js
CHANGED
|
@@ -1673,7 +1673,7 @@ function isAttrName(prop) {
|
|
|
1673
1673
|
if (safeAttrNames.size < 512) safeAttrNames.add(prop);
|
|
1674
1674
|
return true;
|
|
1675
1675
|
}
|
|
1676
|
-
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,
|
|
1676
|
+
const REPLACE_SCRIPT = `function $df(e){return _$HY.f?_$HY.f(e):$dfr(e)}function $dfr(e,n,o,t){if(!(n=document.getElementById(e)))return 0;if(!(o=document.getElementById("pl-"+e)))return(_$HY.dq=_$HY.dq||{})[e]=1,0;for(;o&&(8!==o.nodeType||o.nodeValue!=="pl-"+e);)t=o.nextSibling,o.remove(),o=t;t=o.parentNode,(_$HY.v=_$HY.v||{})[e]=n.hasAttribute("e")?[...n.content.childNodes]:1,o.replaceWith(n.content),n.remove(),_$HY.fe(e,t),_$HY.hp&&_$HY.hp[e]&&($dh(_$HY.hp[e]),delete _$HY.hp[e]),$dfd();return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return(_$HY.dlq=_$HY.dlq||{})[e]=1,0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1,$dfd();return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfd(e,i){if(e=_$HY.dq){_$HY.dq=0;for(i in e)$df(i)}if(e=_$HY.dlq){_$HY.dlq=0;for(i in e)$dfl(i)}}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}function $dfe(e,t,k){(t=e.target)&&t.getAttribute&&!t._$dc&&(k=t.getAttribute("data-dfc"))&&(t._$dc=1,$dfc(k))}document.addEventListener("load",$dfe,!0);document.addEventListener("error",$dfe,!0)`;
|
|
1677
1677
|
const HEAD_SCRIPT = `function $dha(o,i,e,n){for(i=0;i<o.length;i++)e=o[i],"t"==e[0]?((n=document.querySelector("title"))?n.hasAttribute("data-dh")||n.setAttribute("data-dhf",n.textContent):(n=document.createElement("title"),document.head.appendChild(n)),n.textContent=e[1],n.setAttribute("data-dh","title")):"r"==e[0]?$dhr(e[1]):(n=document.createElement(e[2]),Object.keys(e[3]).forEach(function(a){n.setAttribute(a,e[3][a])}),null!=e[4]&&(n.textContent=e[4]),n.setAttribute("data-dh",e[1]),document.head.appendChild(n))}function $dhr(v,l,i){for(l=document.head.querySelectorAll("[data-dh]"),i=0;i<l.length;i++)l[i].getAttribute("data-dh")==v&&l[i].remove()}function $dh(o){_$HY.h?_$HY.h(o):$dha(o)}`;
|
|
1678
1678
|
function renderToString(code, options = {}) {
|
|
1679
1679
|
const {
|
|
@@ -1944,7 +1944,6 @@ function renderToStream(code, options = {}) {
|
|
|
1944
1944
|
const blockingPromises = new Set();
|
|
1945
1945
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1946
1946
|
let stubBatch = null;
|
|
1947
|
-
const STUB_BATCH_KEY = "$B";
|
|
1948
1947
|
let stableOrder = false;
|
|
1949
1948
|
let parkedWrites = null;
|
|
1950
1949
|
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
@@ -1959,19 +1958,10 @@ function renderToStream(code, options = {}) {
|
|
|
1959
1958
|
};
|
|
1960
1959
|
const flushStubBatch = () => {
|
|
1961
1960
|
if (!stubBatch) return;
|
|
1962
|
-
const
|
|
1961
|
+
const entries = [...stubBatch];
|
|
1963
1962
|
stubBatch = null;
|
|
1964
|
-
if (batch.size === 1) {
|
|
1965
|
-
const [id, p] = batch.entries().next().value;
|
|
1966
|
-
serializer.write(id, p);
|
|
1967
|
-
return;
|
|
1968
|
-
}
|
|
1969
|
-
const obj = {};
|
|
1970
|
-
const entries = [...batch];
|
|
1971
1963
|
if (stableOrder) entries.sort(byKey);
|
|
1972
|
-
for (
|
|
1973
|
-
serializer.write(STUB_BATCH_KEY, obj);
|
|
1974
|
-
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1964
|
+
for (let i = 0; i < entries.length; i++) serializer.write(entries[i][0], entries[i][1]);
|
|
1975
1965
|
};
|
|
1976
1966
|
let headerEmitted = false;
|
|
1977
1967
|
const pushTask = task => {
|
|
@@ -2008,6 +1998,7 @@ function renderToStream(code, options = {}) {
|
|
|
2008
1998
|
fragment(key, value, meta) {
|
|
2009
1999
|
const deferActivation = !!meta.revealGroup;
|
|
2010
2000
|
const styles = meta.styles;
|
|
2001
|
+
const tpl = `<template id="${key}"${meta.error ? " e" : ""}>${value}</template>`;
|
|
2011
2002
|
for (let i = 0; i < styles.inline.length; i++) {
|
|
2012
2003
|
buffer.write(renderInlineStyle(styles.inline[i], nonce));
|
|
2013
2004
|
}
|
|
@@ -2015,12 +2006,12 @@ function renderToStream(code, options = {}) {
|
|
|
2015
2006
|
const styleAttr = nonceAttr(nonce, "style");
|
|
2016
2007
|
emitTask(`$dfs("${key}",${styles.links.length},${deferActivation ? 1 : 0})`);
|
|
2017
2008
|
writeTasks();
|
|
2018
|
-
buffer.write(
|
|
2009
|
+
buffer.write(tpl);
|
|
2019
2010
|
for (const entry of styles.links) {
|
|
2020
2011
|
buffer.write(typeof entry === "string" ? `<link rel="stylesheet" href="${entry}"${styleAttr} data-dfc="${key}">` : `<link${entry.attrHtml}${styleAttr} data-dfc="${key}">`);
|
|
2021
2012
|
}
|
|
2022
2013
|
} else {
|
|
2023
|
-
buffer.write(
|
|
2014
|
+
buffer.write(tpl);
|
|
2024
2015
|
if (!deferActivation) {
|
|
2025
2016
|
emitTask(`$df("${key}")`);
|
|
2026
2017
|
}
|
|
@@ -2133,22 +2124,26 @@ function renderToStream(code, options = {}) {
|
|
|
2133
2124
|
return raced;
|
|
2134
2125
|
};
|
|
2135
2126
|
const abandonSubtree = (key, error) => {
|
|
2127
|
+
if (key == null) return;
|
|
2136
2128
|
let fragments = 0;
|
|
2137
2129
|
let serialized = 0;
|
|
2138
2130
|
for (const [k, entry] of registry) {
|
|
2139
|
-
if (k.length > key.length && k.startsWith(key)) {
|
|
2131
|
+
if (k != null && k.length > key.length && k.startsWith(key)) {
|
|
2140
2132
|
registry.delete(k);
|
|
2141
2133
|
entry.resolve();
|
|
2142
2134
|
fragments++;
|
|
2143
2135
|
}
|
|
2144
2136
|
}
|
|
2137
|
+
const unregister = [];
|
|
2145
2138
|
for (const [id, settle] of pendingSerialized) {
|
|
2146
2139
|
if (id.startsWith(key)) {
|
|
2147
2140
|
pendingSerialized.delete(id);
|
|
2148
2141
|
settle();
|
|
2149
2142
|
serialized++;
|
|
2143
|
+
if (!stubBatch?.delete(id)) unregister.push(`delete _$HY.r[${JSON.stringify(id)}]`);
|
|
2150
2144
|
}
|
|
2151
2145
|
}
|
|
2146
|
+
if (unregister.length && !options.sink) pushTask(unregister.join(";"));
|
|
2152
2147
|
if ((fragments || serialized)) emitFinding({
|
|
2153
2148
|
code: "SSR_SUBTREE_ABANDONED",
|
|
2154
2149
|
kind: "ssr",
|
|
@@ -2375,7 +2370,7 @@ function renderToStream(code, options = {}) {
|
|
|
2375
2370
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
2376
2371
|
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
2377
2372
|
if (headOps) emitHeadOps(key, headOps);
|
|
2378
|
-
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2373
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : error ? "" : " "), {
|
|
2379
2374
|
styles,
|
|
2380
2375
|
revealGroup,
|
|
2381
2376
|
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
package/dist/web.dev.js
CHANGED
|
@@ -101,10 +101,21 @@ function memo(fn) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
104
|
+
let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
|
|
105
|
+
if (active === document.body) active = null;
|
|
106
|
+
const slot = marker || parentNode;
|
|
107
|
+
const insert = (n, ref) => {
|
|
108
|
+
active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
109
|
+
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
110
|
+
};
|
|
111
|
+
if (!a.length) {
|
|
112
|
+
for (const n of b) insert(n, marker);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
104
115
|
const isLive = n => {
|
|
105
116
|
if (!n) return false;
|
|
106
117
|
const tag = n[$$SLOT];
|
|
107
|
-
return n.parentNode === parentNode && (!tag || tag ===
|
|
118
|
+
return n.parentNode === parentNode && (!tag || tag === slot);
|
|
108
119
|
};
|
|
109
120
|
let bLength = b.length,
|
|
110
121
|
aEnd = a.length,
|
|
@@ -127,40 +138,21 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
127
138
|
bEnd--;
|
|
128
139
|
}
|
|
129
140
|
if (aEnd === aStart) {
|
|
130
|
-
let
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
while (k < bLength && !isLive(b[k])) k++;
|
|
135
|
-
node = k < bLength ? b[k] : after;
|
|
136
|
-
}
|
|
137
|
-
} else node = after;
|
|
138
|
-
while (bStart < bEnd) {
|
|
139
|
-
const n = b[bStart++];
|
|
140
|
-
parentNode.insertBefore(n, node);
|
|
141
|
-
if (marker) n[$$SLOT] = marker;
|
|
142
|
-
}
|
|
141
|
+
let k = bEnd;
|
|
142
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
143
|
+
const node = k < bLength ? b[k] : after;
|
|
144
|
+
while (bStart < bEnd) insert(b[bStart++], node);
|
|
143
145
|
} else if (bEnd === bStart) {
|
|
144
146
|
while (aStart < aEnd) {
|
|
145
147
|
const n = a[aStart++];
|
|
146
148
|
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
147
149
|
}
|
|
148
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag ===
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
bStart++;
|
|
155
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
156
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
157
|
-
} else {
|
|
158
|
-
do {
|
|
159
|
-
parentNode.insertBefore(a[--aEnd], anchor);
|
|
160
|
-
bStart++;
|
|
161
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
162
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
163
|
-
}
|
|
150
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
151
|
+
do {
|
|
152
|
+
insert(a[--aEnd], anchor);
|
|
153
|
+
bStart++;
|
|
154
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
155
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
164
156
|
} else {
|
|
165
157
|
if (!isLive(a[aStart])) {
|
|
166
158
|
aStart++;
|
|
@@ -183,15 +175,12 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
183
175
|
}
|
|
184
176
|
if (sequence > index - bStart) {
|
|
185
177
|
const node = a[aStart];
|
|
186
|
-
while (bStart < index)
|
|
187
|
-
const n = b[bStart++];
|
|
188
|
-
parentNode.insertBefore(n, node);
|
|
189
|
-
if (marker) n[$$SLOT] = marker;
|
|
190
|
-
}
|
|
178
|
+
while (bStart < index) insert(b[bStart++], node);
|
|
191
179
|
} else {
|
|
192
|
-
const newNode = b[bStart++]
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
const newNode = b[bStart++],
|
|
181
|
+
node = a[aStart++];
|
|
182
|
+
active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
|
|
183
|
+
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
195
184
|
}
|
|
196
185
|
} else aStart++;
|
|
197
186
|
} else a[aStart++].remove();
|
|
@@ -1540,7 +1529,7 @@ function gateHeadResource(props) {
|
|
|
1540
1529
|
if (attrs) descriptor.attrs = attrs;
|
|
1541
1530
|
effect(() => {
|
|
1542
1531
|
const entry = warmAsset(descriptor);
|
|
1543
|
-
if (gateable && !
|
|
1532
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1544
1533
|
}, () => acquireAsset(descriptor));
|
|
1545
1534
|
}
|
|
1546
1535
|
function useHead(tags) {
|
|
@@ -1735,14 +1724,13 @@ function hydrate(code, element, options = {}) {
|
|
|
1735
1724
|
}
|
|
1736
1725
|
}
|
|
1737
1726
|
function getNextElement(template) {
|
|
1738
|
-
let
|
|
1739
|
-
key
|
|
1740
|
-
|
|
1741
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1727
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1728
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1729
|
+
if (!node) {
|
|
1742
1730
|
if (!template) {
|
|
1743
1731
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1744
1732
|
}
|
|
1745
|
-
if (
|
|
1733
|
+
if (isHydrating()) {
|
|
1746
1734
|
hydrationKeyMisses++;
|
|
1747
1735
|
console.warn(`Hydration key miss for "${key}": no server-rendered element carries this key` + (template._html ? ` (template: ${template._html.slice(0, 60)})` : "") + `. A detached element was created instead; its subtree will not appear in the ` + `document or become interactive. This usually means the server and client ` + `hydration id namespaces are misaligned — when hydrating a subtree of a larger ` + `server render, wrap the document shell in <NoHydration> and re-enter with ` + `<Hydration> around the hydrated subtree (or pass hydrate() a renderId matching ` + `the server's <Hydration id>).`);
|
|
1748
1736
|
}
|
|
@@ -1864,6 +1852,7 @@ function runHydrationEvents() {
|
|
|
1864
1852
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1865
1853
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1866
1854
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1855
|
+
flush();
|
|
1867
1856
|
}
|
|
1868
1857
|
if (sharedConfig.done) {
|
|
1869
1858
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -1980,7 +1969,6 @@ function eventHandler(e, container, state) {
|
|
|
1980
1969
|
e[$$EVENT_OWNER] = owner;
|
|
1981
1970
|
let node = resumeNode || e.target;
|
|
1982
1971
|
const key = EVENT_KEY + e.type;
|
|
1983
|
-
const oriTarget = e.target;
|
|
1984
1972
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1985
1973
|
configurable: true,
|
|
1986
1974
|
value
|
|
@@ -2029,7 +2017,8 @@ function eventHandler(e, container, state) {
|
|
|
2029
2017
|
} else walkUpTree();
|
|
2030
2018
|
}
|
|
2031
2019
|
else walkUpTree();
|
|
2032
|
-
|
|
2020
|
+
delete e.target;
|
|
2021
|
+
delete e.currentTarget;
|
|
2033
2022
|
}
|
|
2034
2023
|
function insertExpression(parent, value, current, marker) {
|
|
2035
2024
|
tagElement(parent);
|
|
@@ -2075,7 +2064,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2075
2064
|
} else {
|
|
2076
2065
|
parent.appendChild(value);
|
|
2077
2066
|
}
|
|
2078
|
-
if (marker) value[$$SLOT] = marker;
|
|
2067
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
2079
2068
|
} else if (Array.isArray(value)) {
|
|
2080
2069
|
const currentArray = Array.isArray(current);
|
|
2081
2070
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -2092,12 +2081,10 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2092
2081
|
if (value.length === 0) {
|
|
2093
2082
|
cleanChildren(parent, current, marker);
|
|
2094
2083
|
} else if (currentArray) {
|
|
2095
|
-
|
|
2096
|
-
appendNodes(parent, value, marker);
|
|
2097
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
2084
|
+
reconcileArrays(parent, current, value, marker);
|
|
2098
2085
|
} else {
|
|
2099
2086
|
if (current != null) cleanChildren(parent, current);
|
|
2100
|
-
|
|
2087
|
+
reconcileArrays(parent, [], value);
|
|
2101
2088
|
}
|
|
2102
2089
|
} else devCheck({
|
|
2103
2090
|
code: "UNRECOGNIZED_INSERT_VALUE",
|
|
@@ -2125,18 +2112,19 @@ function writeSelectValue(node, value) {
|
|
|
2125
2112
|
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
2126
2113
|
}
|
|
2127
2114
|
node._$v = value;
|
|
2128
|
-
(selectInsert ||=
|
|
2129
|
-
p && p._$v == null && (p = p.parentNode);
|
|
2130
|
-
const v = p && p._$v;
|
|
2131
|
-
if (v == null) return;
|
|
2132
|
-
if (v.map) {
|
|
2133
|
-
const o = [...p.options];
|
|
2134
|
-
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
2135
|
-
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
2136
|
-
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
2137
|
-
})(node);
|
|
2115
|
+
(selectInsert ||= applySelectValue)(node);
|
|
2138
2116
|
queueMicrotask(() => selectInsert(node));
|
|
2139
2117
|
}
|
|
2118
|
+
function applySelectValue(p) {
|
|
2119
|
+
p && p._$v == null && (p = p.parentNode);
|
|
2120
|
+
const v = p && p._$v;
|
|
2121
|
+
if (v == null) return;
|
|
2122
|
+
if (v.map) {
|
|
2123
|
+
const o = [...p.options];
|
|
2124
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
2125
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
2126
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
2127
|
+
}
|
|
2140
2128
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
2141
2129
|
value = flatten(value, {
|
|
2142
2130
|
skipNonRendered: true,
|
|
@@ -2165,13 +2153,6 @@ function tagHost(value, host) {
|
|
|
2165
2153
|
});
|
|
2166
2154
|
}
|
|
2167
2155
|
}
|
|
2168
|
-
function appendNodes(parent, array, marker = null) {
|
|
2169
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
2170
|
-
const n = array[i];
|
|
2171
|
-
parent.insertBefore(n, marker);
|
|
2172
|
-
if (marker) n[$$SLOT] = marker;
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
2156
|
function ownsAllChildren(parent, current) {
|
|
2176
2157
|
if (current == null) return true;
|
|
2177
2158
|
if (Array.isArray(current)) {
|
|
@@ -2206,12 +2187,12 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
2206
2187
|
const el = current[i];
|
|
2207
2188
|
if (replacement !== el) {
|
|
2208
2189
|
const tag = el[$$SLOT];
|
|
2209
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
2190
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
2210
2191
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
2211
2192
|
} else inserted = true;
|
|
2212
2193
|
}
|
|
2213
2194
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
2214
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
2195
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
2215
2196
|
}
|
|
2216
2197
|
function gatherHydratable(element, root) {
|
|
2217
2198
|
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
@@ -2468,7 +2449,8 @@ function dynamic(source, options) {
|
|
|
2468
2449
|
}
|
|
2469
2450
|
function staticElement(tag, props) {
|
|
2470
2451
|
const hydrating = sharedConfig.hydrating;
|
|
2471
|
-
const
|
|
2452
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2453
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2472
2454
|
spread(el, props);
|
|
2473
2455
|
if (hydrating) runHydrationEvents();
|
|
2474
2456
|
return el;
|
package/dist/web.js
CHANGED
|
@@ -71,10 +71,21 @@ function memo(fn) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
74
|
+
let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
|
|
75
|
+
if (active === document.body) active = null;
|
|
76
|
+
const slot = marker || parentNode;
|
|
77
|
+
const insert = (n, ref) => {
|
|
78
|
+
active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
79
|
+
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
80
|
+
};
|
|
81
|
+
if (!a.length) {
|
|
82
|
+
for (const n of b) insert(n, marker);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
74
85
|
const isLive = n => {
|
|
75
86
|
if (!n) return false;
|
|
76
87
|
const tag = n[$$SLOT];
|
|
77
|
-
return n.parentNode === parentNode && (!tag || tag ===
|
|
88
|
+
return n.parentNode === parentNode && (!tag || tag === slot);
|
|
78
89
|
};
|
|
79
90
|
let bLength = b.length,
|
|
80
91
|
aEnd = a.length,
|
|
@@ -97,40 +108,21 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
97
108
|
bEnd--;
|
|
98
109
|
}
|
|
99
110
|
if (aEnd === aStart) {
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
while (k < bLength && !isLive(b[k])) k++;
|
|
105
|
-
node = k < bLength ? b[k] : after;
|
|
106
|
-
}
|
|
107
|
-
} else node = after;
|
|
108
|
-
while (bStart < bEnd) {
|
|
109
|
-
const n = b[bStart++];
|
|
110
|
-
parentNode.insertBefore(n, node);
|
|
111
|
-
if (marker) n[$$SLOT] = marker;
|
|
112
|
-
}
|
|
111
|
+
let k = bEnd;
|
|
112
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
113
|
+
const node = k < bLength ? b[k] : after;
|
|
114
|
+
while (bStart < bEnd) insert(b[bStart++], node);
|
|
113
115
|
} else if (bEnd === bStart) {
|
|
114
116
|
while (aStart < aEnd) {
|
|
115
117
|
const n = a[aStart++];
|
|
116
118
|
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
117
119
|
}
|
|
118
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag ===
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
bStart++;
|
|
125
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
126
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
127
|
-
} else {
|
|
128
|
-
do {
|
|
129
|
-
parentNode.insertBefore(a[--aEnd], anchor);
|
|
130
|
-
bStart++;
|
|
131
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
132
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
133
|
-
}
|
|
120
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
121
|
+
do {
|
|
122
|
+
insert(a[--aEnd], anchor);
|
|
123
|
+
bStart++;
|
|
124
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
125
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
134
126
|
} else {
|
|
135
127
|
if (!isLive(a[aStart])) {
|
|
136
128
|
aStart++;
|
|
@@ -153,15 +145,12 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
153
145
|
}
|
|
154
146
|
if (sequence > index - bStart) {
|
|
155
147
|
const node = a[aStart];
|
|
156
|
-
while (bStart < index)
|
|
157
|
-
const n = b[bStart++];
|
|
158
|
-
parentNode.insertBefore(n, node);
|
|
159
|
-
if (marker) n[$$SLOT] = marker;
|
|
160
|
-
}
|
|
148
|
+
while (bStart < index) insert(b[bStart++], node);
|
|
161
149
|
} else {
|
|
162
|
-
const newNode = b[bStart++]
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
const newNode = b[bStart++],
|
|
151
|
+
node = a[aStart++];
|
|
152
|
+
active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
|
|
153
|
+
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
165
154
|
}
|
|
166
155
|
} else aStart++;
|
|
167
156
|
} else a[aStart++].remove();
|
|
@@ -1298,7 +1287,7 @@ function gateHeadResource(props) {
|
|
|
1298
1287
|
if (attrs) descriptor.attrs = attrs;
|
|
1299
1288
|
effect(() => {
|
|
1300
1289
|
const entry = warmAsset(descriptor);
|
|
1301
|
-
if (gateable && !
|
|
1290
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1302
1291
|
}, () => acquireAsset(descriptor));
|
|
1303
1292
|
}
|
|
1304
1293
|
function useHead(tags) {
|
|
@@ -1481,10 +1470,9 @@ function hydrate(code, element, options = {}) {
|
|
|
1481
1470
|
}
|
|
1482
1471
|
}
|
|
1483
1472
|
function getNextElement(template) {
|
|
1484
|
-
let
|
|
1485
|
-
key
|
|
1486
|
-
|
|
1487
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1473
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1474
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1475
|
+
if (!node) {
|
|
1488
1476
|
if (!template) {
|
|
1489
1477
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1490
1478
|
}
|
|
@@ -1564,6 +1552,7 @@ function runHydrationEvents() {
|
|
|
1564
1552
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1565
1553
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1566
1554
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1555
|
+
flush();
|
|
1567
1556
|
}
|
|
1568
1557
|
if (sharedConfig.done) {
|
|
1569
1558
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -1678,7 +1667,6 @@ function eventHandler(e, container, state) {
|
|
|
1678
1667
|
e[$$EVENT_OWNER] = owner;
|
|
1679
1668
|
let node = resumeNode || e.target;
|
|
1680
1669
|
const key = EVENT_KEY + e.type;
|
|
1681
|
-
const oriTarget = e.target;
|
|
1682
1670
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1683
1671
|
configurable: true,
|
|
1684
1672
|
value
|
|
@@ -1727,7 +1715,8 @@ function eventHandler(e, container, state) {
|
|
|
1727
1715
|
} else walkUpTree();
|
|
1728
1716
|
}
|
|
1729
1717
|
else walkUpTree();
|
|
1730
|
-
|
|
1718
|
+
delete e.target;
|
|
1719
|
+
delete e.currentTarget;
|
|
1731
1720
|
}
|
|
1732
1721
|
function insertExpression(parent, value, current, marker) {
|
|
1733
1722
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
@@ -1772,7 +1761,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1772
1761
|
} else {
|
|
1773
1762
|
parent.appendChild(value);
|
|
1774
1763
|
}
|
|
1775
|
-
if (marker) value[$$SLOT] = marker;
|
|
1764
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
1776
1765
|
} else if (Array.isArray(value)) {
|
|
1777
1766
|
const currentArray = Array.isArray(current);
|
|
1778
1767
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1789,12 +1778,10 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1789
1778
|
if (value.length === 0) {
|
|
1790
1779
|
cleanChildren(parent, current, marker);
|
|
1791
1780
|
} else if (currentArray) {
|
|
1792
|
-
|
|
1793
|
-
appendNodes(parent, value, marker);
|
|
1794
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
1781
|
+
reconcileArrays(parent, current, value, marker);
|
|
1795
1782
|
} else {
|
|
1796
1783
|
if (current != null) cleanChildren(parent, current);
|
|
1797
|
-
|
|
1784
|
+
reconcileArrays(parent, [], value);
|
|
1798
1785
|
}
|
|
1799
1786
|
} else ;
|
|
1800
1787
|
selectInsert && selectInsert(parent);
|
|
@@ -1813,18 +1800,19 @@ function writeSelectValue(node, value) {
|
|
|
1813
1800
|
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
1814
1801
|
}
|
|
1815
1802
|
node._$v = value;
|
|
1816
|
-
(selectInsert ||=
|
|
1817
|
-
p && p._$v == null && (p = p.parentNode);
|
|
1818
|
-
const v = p && p._$v;
|
|
1819
|
-
if (v == null) return;
|
|
1820
|
-
if (v.map) {
|
|
1821
|
-
const o = [...p.options];
|
|
1822
|
-
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1823
|
-
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1824
|
-
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1825
|
-
})(node);
|
|
1803
|
+
(selectInsert ||= applySelectValue)(node);
|
|
1826
1804
|
queueMicrotask(() => selectInsert(node));
|
|
1827
1805
|
}
|
|
1806
|
+
function applySelectValue(p) {
|
|
1807
|
+
p && p._$v == null && (p = p.parentNode);
|
|
1808
|
+
const v = p && p._$v;
|
|
1809
|
+
if (v == null) return;
|
|
1810
|
+
if (v.map) {
|
|
1811
|
+
const o = [...p.options];
|
|
1812
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1813
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1814
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1815
|
+
}
|
|
1828
1816
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1829
1817
|
value = flatten(value, {
|
|
1830
1818
|
skipNonRendered: true,
|
|
@@ -1853,13 +1841,6 @@ function tagHost(value, host) {
|
|
|
1853
1841
|
});
|
|
1854
1842
|
}
|
|
1855
1843
|
}
|
|
1856
|
-
function appendNodes(parent, array, marker = null) {
|
|
1857
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1858
|
-
const n = array[i];
|
|
1859
|
-
parent.insertBefore(n, marker);
|
|
1860
|
-
if (marker) n[$$SLOT] = marker;
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
1844
|
function ownsAllChildren(parent, current) {
|
|
1864
1845
|
if (current == null) return true;
|
|
1865
1846
|
if (Array.isArray(current)) {
|
|
@@ -1894,12 +1875,12 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1894
1875
|
const el = current[i];
|
|
1895
1876
|
if (replacement !== el) {
|
|
1896
1877
|
const tag = el[$$SLOT];
|
|
1897
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1878
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
1898
1879
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
1899
1880
|
} else inserted = true;
|
|
1900
1881
|
}
|
|
1901
1882
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1902
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1883
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
1903
1884
|
}
|
|
1904
1885
|
function gatherHydratable(element, root) {
|
|
1905
1886
|
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
@@ -2156,7 +2137,8 @@ function dynamic(source, options) {
|
|
|
2156
2137
|
}
|
|
2157
2138
|
function staticElement(tag, props) {
|
|
2158
2139
|
const hydrating = sharedConfig.hydrating;
|
|
2159
|
-
const
|
|
2140
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2141
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2160
2142
|
spread(el, props);
|
|
2161
2143
|
if (hydrating) runHydrationEvents();
|
|
2162
2144
|
return el;
|
package/dist/web.observe.js
CHANGED
|
@@ -82,10 +82,21 @@ function memo(fn) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
85
|
+
let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
|
|
86
|
+
if (active === document.body) active = null;
|
|
87
|
+
const slot = marker || parentNode;
|
|
88
|
+
const insert = (n, ref) => {
|
|
89
|
+
active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
90
|
+
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
91
|
+
};
|
|
92
|
+
if (!a.length) {
|
|
93
|
+
for (const n of b) insert(n, marker);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
85
96
|
const isLive = n => {
|
|
86
97
|
if (!n) return false;
|
|
87
98
|
const tag = n[$$SLOT];
|
|
88
|
-
return n.parentNode === parentNode && (!tag || tag ===
|
|
99
|
+
return n.parentNode === parentNode && (!tag || tag === slot);
|
|
89
100
|
};
|
|
90
101
|
let bLength = b.length,
|
|
91
102
|
aEnd = a.length,
|
|
@@ -108,40 +119,21 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
108
119
|
bEnd--;
|
|
109
120
|
}
|
|
110
121
|
if (aEnd === aStart) {
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
while (k < bLength && !isLive(b[k])) k++;
|
|
116
|
-
node = k < bLength ? b[k] : after;
|
|
117
|
-
}
|
|
118
|
-
} else node = after;
|
|
119
|
-
while (bStart < bEnd) {
|
|
120
|
-
const n = b[bStart++];
|
|
121
|
-
parentNode.insertBefore(n, node);
|
|
122
|
-
if (marker) n[$$SLOT] = marker;
|
|
123
|
-
}
|
|
122
|
+
let k = bEnd;
|
|
123
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
124
|
+
const node = k < bLength ? b[k] : after;
|
|
125
|
+
while (bStart < bEnd) insert(b[bStart++], node);
|
|
124
126
|
} else if (bEnd === bStart) {
|
|
125
127
|
while (aStart < aEnd) {
|
|
126
128
|
const n = a[aStart++];
|
|
127
129
|
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
128
130
|
}
|
|
129
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag ===
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
bStart++;
|
|
136
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
137
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
138
|
-
} else {
|
|
139
|
-
do {
|
|
140
|
-
parentNode.insertBefore(a[--aEnd], anchor);
|
|
141
|
-
bStart++;
|
|
142
|
-
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
143
|
-
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
144
|
-
}
|
|
131
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
132
|
+
do {
|
|
133
|
+
insert(a[--aEnd], anchor);
|
|
134
|
+
bStart++;
|
|
135
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
136
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
145
137
|
} else {
|
|
146
138
|
if (!isLive(a[aStart])) {
|
|
147
139
|
aStart++;
|
|
@@ -164,15 +156,12 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
164
156
|
}
|
|
165
157
|
if (sequence > index - bStart) {
|
|
166
158
|
const node = a[aStart];
|
|
167
|
-
while (bStart < index)
|
|
168
|
-
const n = b[bStart++];
|
|
169
|
-
parentNode.insertBefore(n, node);
|
|
170
|
-
if (marker) n[$$SLOT] = marker;
|
|
171
|
-
}
|
|
159
|
+
while (bStart < index) insert(b[bStart++], node);
|
|
172
160
|
} else {
|
|
173
|
-
const newNode = b[bStart++]
|
|
174
|
-
|
|
175
|
-
|
|
161
|
+
const newNode = b[bStart++],
|
|
162
|
+
node = a[aStart++];
|
|
163
|
+
active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
|
|
164
|
+
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
176
165
|
}
|
|
177
166
|
} else aStart++;
|
|
178
167
|
} else a[aStart++].remove();
|
|
@@ -1349,7 +1338,7 @@ function gateHeadResource(props) {
|
|
|
1349
1338
|
if (attrs) descriptor.attrs = attrs;
|
|
1350
1339
|
effect(() => {
|
|
1351
1340
|
const entry = warmAsset(descriptor);
|
|
1352
|
-
if (gateable && !
|
|
1341
|
+
if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1353
1342
|
}, () => acquireAsset(descriptor));
|
|
1354
1343
|
}
|
|
1355
1344
|
function useHead(tags) {
|
|
@@ -1532,10 +1521,9 @@ function hydrate(code, element, options = {}) {
|
|
|
1532
1521
|
}
|
|
1533
1522
|
}
|
|
1534
1523
|
function getNextElement(template) {
|
|
1535
|
-
let
|
|
1536
|
-
key
|
|
1537
|
-
|
|
1538
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
1524
|
+
let key = sharedConfig.hydrating && getHydrationKey(),
|
|
1525
|
+
node = isHydrating() && sharedConfig.registry.get(key);
|
|
1526
|
+
if (!node) {
|
|
1539
1527
|
if (!template) {
|
|
1540
1528
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1541
1529
|
}
|
|
@@ -1615,6 +1603,7 @@ function runHydrationEvents() {
|
|
|
1615
1603
|
matches.sort((a, b) => a.distance - b.distance);
|
|
1616
1604
|
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1617
1605
|
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
1606
|
+
flush();
|
|
1618
1607
|
}
|
|
1619
1608
|
if (sharedConfig.done) {
|
|
1620
1609
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -1729,7 +1718,6 @@ function eventHandler(e, container, state) {
|
|
|
1729
1718
|
e[$$EVENT_OWNER] = owner;
|
|
1730
1719
|
let node = resumeNode || e.target;
|
|
1731
1720
|
const key = EVENT_KEY + e.type;
|
|
1732
|
-
const oriTarget = e.target;
|
|
1733
1721
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1734
1722
|
configurable: true,
|
|
1735
1723
|
value
|
|
@@ -1778,7 +1766,8 @@ function eventHandler(e, container, state) {
|
|
|
1778
1766
|
} else walkUpTree();
|
|
1779
1767
|
}
|
|
1780
1768
|
else walkUpTree();
|
|
1781
|
-
|
|
1769
|
+
delete e.target;
|
|
1770
|
+
delete e.currentTarget;
|
|
1782
1771
|
}
|
|
1783
1772
|
function insertExpression(parent, value, current, marker) {
|
|
1784
1773
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
@@ -1823,7 +1812,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1823
1812
|
} else {
|
|
1824
1813
|
parent.appendChild(value);
|
|
1825
1814
|
}
|
|
1826
|
-
if (marker) value[$$SLOT] = marker;
|
|
1815
|
+
if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
|
|
1827
1816
|
} else if (Array.isArray(value)) {
|
|
1828
1817
|
const currentArray = Array.isArray(current);
|
|
1829
1818
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
@@ -1840,12 +1829,10 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1840
1829
|
if (value.length === 0) {
|
|
1841
1830
|
cleanChildren(parent, current, marker);
|
|
1842
1831
|
} else if (currentArray) {
|
|
1843
|
-
|
|
1844
|
-
appendNodes(parent, value, marker);
|
|
1845
|
-
} else reconcileArrays(parent, current, value, marker);
|
|
1832
|
+
reconcileArrays(parent, current, value, marker);
|
|
1846
1833
|
} else {
|
|
1847
1834
|
if (current != null) cleanChildren(parent, current);
|
|
1848
|
-
|
|
1835
|
+
reconcileArrays(parent, [], value);
|
|
1849
1836
|
}
|
|
1850
1837
|
} else ;
|
|
1851
1838
|
selectInsert && selectInsert(parent);
|
|
@@ -1864,18 +1851,19 @@ function writeSelectValue(node, value) {
|
|
|
1864
1851
|
return queueMicrotask(() => node.value = value) || (node.value = value);
|
|
1865
1852
|
}
|
|
1866
1853
|
node._$v = value;
|
|
1867
|
-
(selectInsert ||=
|
|
1868
|
-
p && p._$v == null && (p = p.parentNode);
|
|
1869
|
-
const v = p && p._$v;
|
|
1870
|
-
if (v == null) return;
|
|
1871
|
-
if (v.map) {
|
|
1872
|
-
const o = [...p.options];
|
|
1873
|
-
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1874
|
-
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1875
|
-
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1876
|
-
})(node);
|
|
1854
|
+
(selectInsert ||= applySelectValue)(node);
|
|
1877
1855
|
queueMicrotask(() => selectInsert(node));
|
|
1878
1856
|
}
|
|
1857
|
+
function applySelectValue(p) {
|
|
1858
|
+
p && p._$v == null && (p = p.parentNode);
|
|
1859
|
+
const v = p && p._$v;
|
|
1860
|
+
if (v == null) return;
|
|
1861
|
+
if (v.map) {
|
|
1862
|
+
const o = [...p.options];
|
|
1863
|
+
for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
|
|
1864
|
+
v.every(x => o.some(el => el.value == x)) && selectChange(p);
|
|
1865
|
+
} else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
|
|
1866
|
+
}
|
|
1879
1867
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
1880
1868
|
value = flatten(value, {
|
|
1881
1869
|
skipNonRendered: true,
|
|
@@ -1904,13 +1892,6 @@ function tagHost(value, host) {
|
|
|
1904
1892
|
});
|
|
1905
1893
|
}
|
|
1906
1894
|
}
|
|
1907
|
-
function appendNodes(parent, array, marker = null) {
|
|
1908
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1909
|
-
const n = array[i];
|
|
1910
|
-
parent.insertBefore(n, marker);
|
|
1911
|
-
if (marker) n[$$SLOT] = marker;
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
1895
|
function ownsAllChildren(parent, current) {
|
|
1915
1896
|
if (current == null) return true;
|
|
1916
1897
|
if (Array.isArray(current)) {
|
|
@@ -1945,12 +1926,12 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
1945
1926
|
const el = current[i];
|
|
1946
1927
|
if (replacement !== el) {
|
|
1947
1928
|
const tag = el[$$SLOT];
|
|
1948
|
-
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1929
|
+
const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
|
|
1949
1930
|
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
1950
1931
|
} else inserted = true;
|
|
1951
1932
|
}
|
|
1952
1933
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1953
|
-
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
1934
|
+
if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
|
|
1954
1935
|
}
|
|
1955
1936
|
function gatherHydratable(element, root) {
|
|
1956
1937
|
const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
|
|
@@ -2207,7 +2188,8 @@ function dynamic(source, options) {
|
|
|
2207
2188
|
}
|
|
2208
2189
|
function staticElement(tag, props) {
|
|
2209
2190
|
const hydrating = sharedConfig.hydrating;
|
|
2210
|
-
const
|
|
2191
|
+
const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
|
|
2192
|
+
const el = hydrating ? getNextElement(create) : create();
|
|
2211
2193
|
spread(el, props);
|
|
2212
2194
|
if (hydrating) runHydrationEvents();
|
|
2213
2195
|
return el;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.19",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
"seroval-plugins": "1.7.0"
|
|
378
378
|
},
|
|
379
379
|
"peerDependencies": {
|
|
380
|
-
"solid-js": "^2.0.0-rc.
|
|
380
|
+
"solid-js": "^2.0.0-rc.19"
|
|
381
381
|
},
|
|
382
382
|
"devDependencies": {
|
|
383
383
|
"@codspeed/vitest-plugin": "^5.4.0",
|