@solidjs/web 2.0.0-rc.0 → 2.0.0-rc.1
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 +1 -1
- package/dist/dev.cjs +9 -5
- package/dist/dev.js +9 -5
- package/dist/server.cjs +94 -4
- package/dist/server.js +94 -5
- package/dist/web.cjs +6 -5
- package/dist/web.js +6 -5
- package/frames/dist/client.cjs +1 -1
- package/frames/dist/client.dev.cjs +1 -1
- package/frames/dist/client.dev.js +1 -1
- package/frames/dist/client.js +1 -1
- package/frames/dist/server.cjs +92 -3
- package/frames/dist/server.js +92 -3
- package/package.json +4 -3
- package/serialization/dist/decode.cjs +13 -1
- package/serialization/dist/decode.js +13 -1
- package/serialization/dist/serialization.cjs +13 -1
- package/serialization/dist/serialization.js +13 -1
- package/server-functions/dist/client.cjs +150 -3
- package/server-functions/dist/client.js +150 -4
- package/server-functions/dist/server.cjs +125 -31
- package/server-functions/dist/server.dev.cjs +125 -31
- package/server-functions/dist/server.dev.js +124 -32
- package/server-functions/dist/server.js +124 -32
- package/types/index.d.ts +16 -2
- package/types/jsx.d.ts +9 -0
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/server.d.ts +28 -0
- package/types-cjs/index.d.cts +16 -2
- package/types-cjs/jsx.d.cts +9 -0
- package/types-cjs/server-functions/client.d.cts +30 -0
- package/types-cjs/server-functions/server.d.cts +28 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Solid 2.0's web platform runtime — DOM rendering, hydration, server-side rendering, and the web-only control-flow components (`Portal`, `Dynamic`).
|
|
4
4
|
|
|
5
|
-
> **Solid 2.0 (
|
|
5
|
+
> **Solid 2.0 (Release Candidate).** In 1.x this package was the `solid-js/web` subpath; in 2.0 it's a separate `@solidjs/web` package.
|
|
6
6
|
>
|
|
7
7
|
> See [`solid-js`'s CHEATSHEET](https://github.com/solidjs/solid/blob/next/packages/solid/CHEATSHEET.md) and [MIGRATION guide](https://github.com/solidjs/solid/blob/next/documentation/solid-2.0/MIGRATION.md) for the 2.0 surface.
|
|
8
8
|
|
package/dist/dev.cjs
CHANGED
|
@@ -1219,6 +1219,9 @@ function getNextElement(template) {
|
|
|
1219
1219
|
if (!template) {
|
|
1220
1220
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1221
1221
|
}
|
|
1222
|
+
if (hydrating) {
|
|
1223
|
+
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>).`);
|
|
1224
|
+
}
|
|
1222
1225
|
return template(true);
|
|
1223
1226
|
}
|
|
1224
1227
|
if (template && template._html) {
|
|
@@ -1422,6 +1425,7 @@ function eventHandler(e, container, state) {
|
|
|
1422
1425
|
}
|
|
1423
1426
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
1424
1427
|
if (state && !owner) return;
|
|
1428
|
+
if (owner && owner === resumeNode) return;
|
|
1425
1429
|
e[$$EVENT_OWNER] = owner || true;
|
|
1426
1430
|
let node = resumeNode || e.target;
|
|
1427
1431
|
const key = `$$${e.type}`;
|
|
@@ -1442,7 +1446,7 @@ function eventHandler(e, container, state) {
|
|
|
1442
1446
|
return true;
|
|
1443
1447
|
};
|
|
1444
1448
|
const walkUpTree = () => {
|
|
1445
|
-
while (handleNode()) {
|
|
1449
|
+
while (node && handleNode()) {
|
|
1446
1450
|
if (node === boundary || node.parentNode === boundary) break;
|
|
1447
1451
|
node = node._$host || node.parentNode || node.host;
|
|
1448
1452
|
}
|
|
@@ -1894,21 +1898,21 @@ function createElement(tagName, is = undefined) {
|
|
|
1894
1898
|
is
|
|
1895
1899
|
});
|
|
1896
1900
|
}
|
|
1897
|
-
function loadClientOnly(fn, setComp) {
|
|
1898
|
-
fn().then(m => setComp(() => m.default));
|
|
1901
|
+
function loadClientOnly(fn, setComp, exportName) {
|
|
1902
|
+
fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
|
|
1899
1903
|
}
|
|
1900
1904
|
function clientOnly(fn, options = {},
|
|
1901
1905
|
_moduleUrl) {
|
|
1902
1906
|
const [comp, setComp] = solidJs.createSignal();
|
|
1903
1907
|
let started = !options.lazy;
|
|
1904
|
-
started && loadClientOnly(fn, setComp);
|
|
1908
|
+
started && loadClientOnly(fn, setComp, options.export);
|
|
1905
1909
|
return props => {
|
|
1906
1910
|
let Comp;
|
|
1907
1911
|
let m;
|
|
1908
1912
|
const rest = solidJs.omit(props, "fallback");
|
|
1909
1913
|
if (!started) {
|
|
1910
1914
|
started = true;
|
|
1911
|
-
loadClientOnly(fn, setComp);
|
|
1915
|
+
loadClientOnly(fn, setComp, options.export);
|
|
1912
1916
|
}
|
|
1913
1917
|
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1914
1918
|
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
package/dist/dev.js
CHANGED
|
@@ -1218,6 +1218,9 @@ function getNextElement(template) {
|
|
|
1218
1218
|
if (!template) {
|
|
1219
1219
|
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1220
1220
|
}
|
|
1221
|
+
if (hydrating) {
|
|
1222
|
+
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>).`);
|
|
1223
|
+
}
|
|
1221
1224
|
return template(true);
|
|
1222
1225
|
}
|
|
1223
1226
|
if (template && template._html) {
|
|
@@ -1421,6 +1424,7 @@ function eventHandler(e, container, state) {
|
|
|
1421
1424
|
}
|
|
1422
1425
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
1423
1426
|
if (state && !owner) return;
|
|
1427
|
+
if (owner && owner === resumeNode) return;
|
|
1424
1428
|
e[$$EVENT_OWNER] = owner || true;
|
|
1425
1429
|
let node = resumeNode || e.target;
|
|
1426
1430
|
const key = `$$${e.type}`;
|
|
@@ -1441,7 +1445,7 @@ function eventHandler(e, container, state) {
|
|
|
1441
1445
|
return true;
|
|
1442
1446
|
};
|
|
1443
1447
|
const walkUpTree = () => {
|
|
1444
|
-
while (handleNode()) {
|
|
1448
|
+
while (node && handleNode()) {
|
|
1445
1449
|
if (node === boundary || node.parentNode === boundary) break;
|
|
1446
1450
|
node = node._$host || node.parentNode || node.host;
|
|
1447
1451
|
}
|
|
@@ -1893,21 +1897,21 @@ function createElement(tagName, is = undefined) {
|
|
|
1893
1897
|
is
|
|
1894
1898
|
});
|
|
1895
1899
|
}
|
|
1896
|
-
function loadClientOnly(fn, setComp) {
|
|
1897
|
-
fn().then(m => setComp(() => m.default));
|
|
1900
|
+
function loadClientOnly(fn, setComp, exportName) {
|
|
1901
|
+
fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
|
|
1898
1902
|
}
|
|
1899
1903
|
function clientOnly(fn, options = {},
|
|
1900
1904
|
_moduleUrl) {
|
|
1901
1905
|
const [comp, setComp] = createSignal();
|
|
1902
1906
|
let started = !options.lazy;
|
|
1903
|
-
started && loadClientOnly(fn, setComp);
|
|
1907
|
+
started && loadClientOnly(fn, setComp, options.export);
|
|
1904
1908
|
return props => {
|
|
1905
1909
|
let Comp;
|
|
1906
1910
|
let m;
|
|
1907
1911
|
const rest = omit(props, "fallback");
|
|
1908
1912
|
if (!started) {
|
|
1909
1913
|
started = true;
|
|
1910
|
-
loadClientOnly(fn, setComp);
|
|
1914
|
+
loadClientOnly(fn, setComp, options.export);
|
|
1911
1915
|
}
|
|
1912
1916
|
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1913
1917
|
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
package/dist/server.cjs
CHANGED
|
@@ -969,7 +969,7 @@ function renderToString(code, options = {}) {
|
|
|
969
969
|
solidJs.sharedConfig.context.noHydrate = true;
|
|
970
970
|
serializer.close();
|
|
971
971
|
const head = renderShellHead(headRegistry, nonce, null);
|
|
972
|
-
return assembleDocument(html, tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
972
|
+
return assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
973
973
|
}
|
|
974
974
|
function renderToStream(code, options = {}) {
|
|
975
975
|
let {
|
|
@@ -1302,7 +1302,7 @@ function renderToStream(code, options = {}) {
|
|
|
1302
1302
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
1303
1303
|
const headOps = error ? null : flushHeadFragment(headRegistry, key);
|
|
1304
1304
|
if (headOps) emitHeadOps(key, headOps);
|
|
1305
|
-
sink.fragment(key, value !== undefined ? value : " ", {
|
|
1305
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
1306
1306
|
styles,
|
|
1307
1307
|
revealGroup,
|
|
1308
1308
|
error
|
|
@@ -1394,7 +1394,7 @@ function renderToStream(code, options = {}) {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
serializeRootAssets();
|
|
1396
1396
|
const head = renderShellHead(headRegistry, nonce, k => registry.has(k));
|
|
1397
|
-
sink.shell(html, {
|
|
1397
|
+
sink.shell(resolveSSRSelectValues(html), {
|
|
1398
1398
|
preloads: tracking.emittedAssets,
|
|
1399
1399
|
inlineStyles: tracking.inlineStyles,
|
|
1400
1400
|
tasks,
|
|
@@ -2279,6 +2279,93 @@ function ssrHydrationKey() {
|
|
|
2279
2279
|
const hk = getHydrationKey();
|
|
2280
2280
|
return hk ? ` _hk=${hk}` : "";
|
|
2281
2281
|
}
|
|
2282
|
+
function decodeSSREntities(s) {
|
|
2283
|
+
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
2284
|
+
}
|
|
2285
|
+
const SELECT_VALUE_ATTR = /\svalue="([^"]*)"/;
|
|
2286
|
+
function tagEnd(html, i) {
|
|
2287
|
+
for (let j = i + 1; j < html.length; j++) {
|
|
2288
|
+
const c = html.charCodeAt(j);
|
|
2289
|
+
if (c === 34) {
|
|
2290
|
+
j = html.indexOf('"', j + 1);
|
|
2291
|
+
if (j < 0) return -1;
|
|
2292
|
+
} else if (c === 62) return j;
|
|
2293
|
+
}
|
|
2294
|
+
return -1;
|
|
2295
|
+
}
|
|
2296
|
+
function optionText(html, from) {
|
|
2297
|
+
let t = "";
|
|
2298
|
+
let i = from;
|
|
2299
|
+
for (;;) {
|
|
2300
|
+
const lt = html.indexOf("<", i);
|
|
2301
|
+
if (lt < 0) return t + html.slice(i);
|
|
2302
|
+
t += html.slice(i, lt);
|
|
2303
|
+
if (!html.startsWith("<!--", lt)) return t;
|
|
2304
|
+
const ce = html.indexOf("-->", lt);
|
|
2305
|
+
if (ce < 0) return t;
|
|
2306
|
+
i = ce + 3;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
function tagIs(html, i, name) {
|
|
2310
|
+
if (!html.startsWith(name, i + 1)) return false;
|
|
2311
|
+
const c = html.charCodeAt(i + 1 + name.length);
|
|
2312
|
+
return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
|
|
2313
|
+
}
|
|
2314
|
+
function resolveSSRSelectValues(html) {
|
|
2315
|
+
if (html.indexOf("<select") < 0) return html;
|
|
2316
|
+
let out = "";
|
|
2317
|
+
let idx = 0;
|
|
2318
|
+
let sel = null;
|
|
2319
|
+
let i = html.indexOf("<");
|
|
2320
|
+
while (i >= 0) {
|
|
2321
|
+
let e;
|
|
2322
|
+
if (html.charCodeAt(i + 1) === 33) {
|
|
2323
|
+
e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
|
|
2324
|
+
if (e < 0) break;
|
|
2325
|
+
if (html.charCodeAt(i + 2) === 45) e += 2;
|
|
2326
|
+
} else {
|
|
2327
|
+
e = tagEnd(html, i);
|
|
2328
|
+
if (e < 0) break;
|
|
2329
|
+
if (sel) {
|
|
2330
|
+
if (html.startsWith("</select>", i)) {
|
|
2331
|
+
out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
|
|
2332
|
+
let seg = sel.body;
|
|
2333
|
+
if (!sel.defaulted) {
|
|
2334
|
+
for (let k = 0; k < sel.marks.length; k++) {
|
|
2335
|
+
out += html.slice(seg, sel.marks[k]) + " selected";
|
|
2336
|
+
seg = sel.marks[k];
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
out += html.slice(seg, i);
|
|
2340
|
+
idx = i;
|
|
2341
|
+
sel = null;
|
|
2342
|
+
} else if (tagIs(html, i, "option")) {
|
|
2343
|
+
const attrs = html.slice(i + 7, e);
|
|
2344
|
+
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
2345
|
+
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
2346
|
+
const value = vm ? decodeSSREntities(vm[1]) : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
2347
|
+
if (sel.values.includes(value)) sel.marks.push(e);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
} else if (tagIs(html, i, "select")) {
|
|
2351
|
+
const m = SELECT_VALUE_ATTR.exec(html.slice(i, e + 1));
|
|
2352
|
+
if (m) {
|
|
2353
|
+
const bound = decodeSSREntities(m[1]);
|
|
2354
|
+
sel = {
|
|
2355
|
+
values: /\smultiple(?=[\s>=])/.test(html.slice(i, e + 1)) ? bound.split(",") : [bound],
|
|
2356
|
+
strip: i + m.index,
|
|
2357
|
+
stripEnd: i + m.index + m[0].length,
|
|
2358
|
+
body: e + 1,
|
|
2359
|
+
marks: [],
|
|
2360
|
+
defaulted: false
|
|
2361
|
+
};
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
i = html.indexOf("<", e + 1);
|
|
2366
|
+
}
|
|
2367
|
+
return out + html.slice(idx);
|
|
2368
|
+
}
|
|
2282
2369
|
function escape(s, attr) {
|
|
2283
2370
|
const t = typeof s;
|
|
2284
2371
|
if (t !== "string") {
|
|
@@ -2423,7 +2510,9 @@ function renderHeadAssets(emittedAssets, inlineStyles, nonce) {
|
|
|
2423
2510
|
function serializeFragmentAssets(key, boundaryModules, context, name = key) {
|
|
2424
2511
|
const map = boundaryModules.get(key);
|
|
2425
2512
|
if (!map || !Object.keys(map).length) return;
|
|
2426
|
-
context.serialize(name + "_assets",
|
|
2513
|
+
context.serialize(name + "_assets", {
|
|
2514
|
+
...map
|
|
2515
|
+
});
|
|
2427
2516
|
}
|
|
2428
2517
|
function propagateBoundaryStyles(childKey, parentKey, tracking) {
|
|
2429
2518
|
const childStyles = tracking.getBoundaryStyles(childKey);
|
|
@@ -3106,6 +3195,7 @@ exports.reload = reload;
|
|
|
3106
3195
|
exports.render = notSup;
|
|
3107
3196
|
exports.renderToStream = renderToStream;
|
|
3108
3197
|
exports.renderToString = renderToString;
|
|
3198
|
+
exports.resolveSSRSelectValues = resolveSSRSelectValues;
|
|
3109
3199
|
exports.respond = respond;
|
|
3110
3200
|
exports.runHydrationEvents = notSup;
|
|
3111
3201
|
exports.serializeCookie = serializeCookie;
|
package/dist/server.js
CHANGED
|
@@ -968,7 +968,7 @@ function renderToString(code, options = {}) {
|
|
|
968
968
|
sharedConfig.context.noHydrate = true;
|
|
969
969
|
serializer.close();
|
|
970
970
|
const head = renderShellHead(headRegistry, nonce, null);
|
|
971
|
-
return assembleDocument(html, tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
971
|
+
return assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead);
|
|
972
972
|
}
|
|
973
973
|
function renderToStream(code, options = {}) {
|
|
974
974
|
let {
|
|
@@ -1301,7 +1301,7 @@ function renderToStream(code, options = {}) {
|
|
|
1301
1301
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
1302
1302
|
const headOps = error ? null : flushHeadFragment(headRegistry, key);
|
|
1303
1303
|
if (headOps) emitHeadOps(key, headOps);
|
|
1304
|
-
sink.fragment(key, value !== undefined ? value : " ", {
|
|
1304
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
1305
1305
|
styles,
|
|
1306
1306
|
revealGroup,
|
|
1307
1307
|
error
|
|
@@ -1393,7 +1393,7 @@ function renderToStream(code, options = {}) {
|
|
|
1393
1393
|
}
|
|
1394
1394
|
serializeRootAssets();
|
|
1395
1395
|
const head = renderShellHead(headRegistry, nonce, k => registry.has(k));
|
|
1396
|
-
sink.shell(html, {
|
|
1396
|
+
sink.shell(resolveSSRSelectValues(html), {
|
|
1397
1397
|
preloads: tracking.emittedAssets,
|
|
1398
1398
|
inlineStyles: tracking.inlineStyles,
|
|
1399
1399
|
tasks,
|
|
@@ -2278,6 +2278,93 @@ function ssrHydrationKey() {
|
|
|
2278
2278
|
const hk = getHydrationKey();
|
|
2279
2279
|
return hk ? ` _hk=${hk}` : "";
|
|
2280
2280
|
}
|
|
2281
|
+
function decodeSSREntities(s) {
|
|
2282
|
+
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
2283
|
+
}
|
|
2284
|
+
const SELECT_VALUE_ATTR = /\svalue="([^"]*)"/;
|
|
2285
|
+
function tagEnd(html, i) {
|
|
2286
|
+
for (let j = i + 1; j < html.length; j++) {
|
|
2287
|
+
const c = html.charCodeAt(j);
|
|
2288
|
+
if (c === 34) {
|
|
2289
|
+
j = html.indexOf('"', j + 1);
|
|
2290
|
+
if (j < 0) return -1;
|
|
2291
|
+
} else if (c === 62) return j;
|
|
2292
|
+
}
|
|
2293
|
+
return -1;
|
|
2294
|
+
}
|
|
2295
|
+
function optionText(html, from) {
|
|
2296
|
+
let t = "";
|
|
2297
|
+
let i = from;
|
|
2298
|
+
for (;;) {
|
|
2299
|
+
const lt = html.indexOf("<", i);
|
|
2300
|
+
if (lt < 0) return t + html.slice(i);
|
|
2301
|
+
t += html.slice(i, lt);
|
|
2302
|
+
if (!html.startsWith("<!--", lt)) return t;
|
|
2303
|
+
const ce = html.indexOf("-->", lt);
|
|
2304
|
+
if (ce < 0) return t;
|
|
2305
|
+
i = ce + 3;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
function tagIs(html, i, name) {
|
|
2309
|
+
if (!html.startsWith(name, i + 1)) return false;
|
|
2310
|
+
const c = html.charCodeAt(i + 1 + name.length);
|
|
2311
|
+
return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
|
|
2312
|
+
}
|
|
2313
|
+
function resolveSSRSelectValues(html) {
|
|
2314
|
+
if (html.indexOf("<select") < 0) return html;
|
|
2315
|
+
let out = "";
|
|
2316
|
+
let idx = 0;
|
|
2317
|
+
let sel = null;
|
|
2318
|
+
let i = html.indexOf("<");
|
|
2319
|
+
while (i >= 0) {
|
|
2320
|
+
let e;
|
|
2321
|
+
if (html.charCodeAt(i + 1) === 33) {
|
|
2322
|
+
e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
|
|
2323
|
+
if (e < 0) break;
|
|
2324
|
+
if (html.charCodeAt(i + 2) === 45) e += 2;
|
|
2325
|
+
} else {
|
|
2326
|
+
e = tagEnd(html, i);
|
|
2327
|
+
if (e < 0) break;
|
|
2328
|
+
if (sel) {
|
|
2329
|
+
if (html.startsWith("</select>", i)) {
|
|
2330
|
+
out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
|
|
2331
|
+
let seg = sel.body;
|
|
2332
|
+
if (!sel.defaulted) {
|
|
2333
|
+
for (let k = 0; k < sel.marks.length; k++) {
|
|
2334
|
+
out += html.slice(seg, sel.marks[k]) + " selected";
|
|
2335
|
+
seg = sel.marks[k];
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
out += html.slice(seg, i);
|
|
2339
|
+
idx = i;
|
|
2340
|
+
sel = null;
|
|
2341
|
+
} else if (tagIs(html, i, "option")) {
|
|
2342
|
+
const attrs = html.slice(i + 7, e);
|
|
2343
|
+
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
2344
|
+
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
2345
|
+
const value = vm ? decodeSSREntities(vm[1]) : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
2346
|
+
if (sel.values.includes(value)) sel.marks.push(e);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
} else if (tagIs(html, i, "select")) {
|
|
2350
|
+
const m = SELECT_VALUE_ATTR.exec(html.slice(i, e + 1));
|
|
2351
|
+
if (m) {
|
|
2352
|
+
const bound = decodeSSREntities(m[1]);
|
|
2353
|
+
sel = {
|
|
2354
|
+
values: /\smultiple(?=[\s>=])/.test(html.slice(i, e + 1)) ? bound.split(",") : [bound],
|
|
2355
|
+
strip: i + m.index,
|
|
2356
|
+
stripEnd: i + m.index + m[0].length,
|
|
2357
|
+
body: e + 1,
|
|
2358
|
+
marks: [],
|
|
2359
|
+
defaulted: false
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
i = html.indexOf("<", e + 1);
|
|
2365
|
+
}
|
|
2366
|
+
return out + html.slice(idx);
|
|
2367
|
+
}
|
|
2281
2368
|
function escape(s, attr) {
|
|
2282
2369
|
const t = typeof s;
|
|
2283
2370
|
if (t !== "string") {
|
|
@@ -2422,7 +2509,9 @@ function renderHeadAssets(emittedAssets, inlineStyles, nonce) {
|
|
|
2422
2509
|
function serializeFragmentAssets(key, boundaryModules, context, name = key) {
|
|
2423
2510
|
const map = boundaryModules.get(key);
|
|
2424
2511
|
if (!map || !Object.keys(map).length) return;
|
|
2425
|
-
context.serialize(name + "_assets",
|
|
2512
|
+
context.serialize(name + "_assets", {
|
|
2513
|
+
...map
|
|
2514
|
+
});
|
|
2426
2515
|
}
|
|
2427
2516
|
function propagateBoundaryStyles(childKey, parentKey, tracking) {
|
|
2428
2517
|
const childStyles = tracking.getBoundaryStyles(childKey);
|
|
@@ -2974,4 +3063,4 @@ function httpHeader(name, value, options) {
|
|
|
2974
3063
|
}
|
|
2975
3064
|
}
|
|
2976
3065
|
|
|
2977
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
|
3066
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
package/dist/web.cjs
CHANGED
|
@@ -1361,6 +1361,7 @@ function eventHandler(e, container, state) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
1363
1363
|
if (state && !owner) return;
|
|
1364
|
+
if (owner && owner === resumeNode) return;
|
|
1364
1365
|
e[$$EVENT_OWNER] = owner || true;
|
|
1365
1366
|
let node = resumeNode || e.target;
|
|
1366
1367
|
const key = `$$${e.type}`;
|
|
@@ -1381,7 +1382,7 @@ function eventHandler(e, container, state) {
|
|
|
1381
1382
|
return true;
|
|
1382
1383
|
};
|
|
1383
1384
|
const walkUpTree = () => {
|
|
1384
|
-
while (handleNode()) {
|
|
1385
|
+
while (node && handleNode()) {
|
|
1385
1386
|
if (node === boundary || node.parentNode === boundary) break;
|
|
1386
1387
|
node = node._$host || node.parentNode || node.host;
|
|
1387
1388
|
}
|
|
@@ -1828,21 +1829,21 @@ function createElement(tagName, is = undefined) {
|
|
|
1828
1829
|
is
|
|
1829
1830
|
});
|
|
1830
1831
|
}
|
|
1831
|
-
function loadClientOnly(fn, setComp) {
|
|
1832
|
-
fn().then(m => setComp(() => m.default));
|
|
1832
|
+
function loadClientOnly(fn, setComp, exportName) {
|
|
1833
|
+
fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
|
|
1833
1834
|
}
|
|
1834
1835
|
function clientOnly(fn, options = {},
|
|
1835
1836
|
_moduleUrl) {
|
|
1836
1837
|
const [comp, setComp] = solidJs.createSignal();
|
|
1837
1838
|
let started = !options.lazy;
|
|
1838
|
-
started && loadClientOnly(fn, setComp);
|
|
1839
|
+
started && loadClientOnly(fn, setComp, options.export);
|
|
1839
1840
|
return props => {
|
|
1840
1841
|
let Comp;
|
|
1841
1842
|
let m;
|
|
1842
1843
|
const rest = solidJs.omit(props, "fallback");
|
|
1843
1844
|
if (!started) {
|
|
1844
1845
|
started = true;
|
|
1845
|
-
loadClientOnly(fn, setComp);
|
|
1846
|
+
loadClientOnly(fn, setComp, options.export);
|
|
1846
1847
|
}
|
|
1847
1848
|
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1848
1849
|
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
package/dist/web.js
CHANGED
|
@@ -1360,6 +1360,7 @@ function eventHandler(e, container, state) {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
1362
1362
|
if (state && !owner) return;
|
|
1363
|
+
if (owner && owner === resumeNode) return;
|
|
1363
1364
|
e[$$EVENT_OWNER] = owner || true;
|
|
1364
1365
|
let node = resumeNode || e.target;
|
|
1365
1366
|
const key = `$$${e.type}`;
|
|
@@ -1380,7 +1381,7 @@ function eventHandler(e, container, state) {
|
|
|
1380
1381
|
return true;
|
|
1381
1382
|
};
|
|
1382
1383
|
const walkUpTree = () => {
|
|
1383
|
-
while (handleNode()) {
|
|
1384
|
+
while (node && handleNode()) {
|
|
1384
1385
|
if (node === boundary || node.parentNode === boundary) break;
|
|
1385
1386
|
node = node._$host || node.parentNode || node.host;
|
|
1386
1387
|
}
|
|
@@ -1827,21 +1828,21 @@ function createElement(tagName, is = undefined) {
|
|
|
1827
1828
|
is
|
|
1828
1829
|
});
|
|
1829
1830
|
}
|
|
1830
|
-
function loadClientOnly(fn, setComp) {
|
|
1831
|
-
fn().then(m => setComp(() => m.default));
|
|
1831
|
+
function loadClientOnly(fn, setComp, exportName) {
|
|
1832
|
+
fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
|
|
1832
1833
|
}
|
|
1833
1834
|
function clientOnly(fn, options = {},
|
|
1834
1835
|
_moduleUrl) {
|
|
1835
1836
|
const [comp, setComp] = createSignal();
|
|
1836
1837
|
let started = !options.lazy;
|
|
1837
|
-
started && loadClientOnly(fn, setComp);
|
|
1838
|
+
started && loadClientOnly(fn, setComp, options.export);
|
|
1838
1839
|
return props => {
|
|
1839
1840
|
let Comp;
|
|
1840
1841
|
let m;
|
|
1841
1842
|
const rest = omit(props, "fallback");
|
|
1842
1843
|
if (!started) {
|
|
1843
1844
|
started = true;
|
|
1844
|
-
loadClientOnly(fn, setComp);
|
|
1845
|
+
loadClientOnly(fn, setComp, options.export);
|
|
1845
1846
|
}
|
|
1846
1847
|
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1847
1848
|
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
package/frames/dist/client.cjs
CHANGED
|
@@ -995,7 +995,7 @@ function isSlotMarker(node) {
|
|
|
995
995
|
}
|
|
996
996
|
function compatible(a, b) {
|
|
997
997
|
if (a.nodeType !== b.nodeType) return false;
|
|
998
|
-
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName;
|
|
998
|
+
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName && a.getAttribute("_key") === b.getAttribute("_key");
|
|
999
999
|
return a.nodeType === TEXT_NODE || a.nodeType === COMMENT_NODE;
|
|
1000
1000
|
}
|
|
1001
1001
|
function preservesOpen(el) {
|
|
@@ -1003,7 +1003,7 @@ function isSlotMarker(node) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
function compatible(a, b) {
|
|
1005
1005
|
if (a.nodeType !== b.nodeType) return false;
|
|
1006
|
-
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName;
|
|
1006
|
+
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName && a.getAttribute("_key") === b.getAttribute("_key");
|
|
1007
1007
|
return a.nodeType === TEXT_NODE || a.nodeType === COMMENT_NODE;
|
|
1008
1008
|
}
|
|
1009
1009
|
function preservesOpen(el) {
|
|
@@ -1001,7 +1001,7 @@ function isSlotMarker(node) {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
function compatible(a, b) {
|
|
1003
1003
|
if (a.nodeType !== b.nodeType) return false;
|
|
1004
|
-
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName;
|
|
1004
|
+
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName && a.getAttribute("_key") === b.getAttribute("_key");
|
|
1005
1005
|
return a.nodeType === TEXT_NODE || a.nodeType === COMMENT_NODE;
|
|
1006
1006
|
}
|
|
1007
1007
|
function preservesOpen(el) {
|
package/frames/dist/client.js
CHANGED
|
@@ -993,7 +993,7 @@ function isSlotMarker(node) {
|
|
|
993
993
|
}
|
|
994
994
|
function compatible(a, b) {
|
|
995
995
|
if (a.nodeType !== b.nodeType) return false;
|
|
996
|
-
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName;
|
|
996
|
+
if (a.nodeType === ELEMENT_NODE) return a.nodeName === b.nodeName && a.getAttribute("_key") === b.getAttribute("_key");
|
|
997
997
|
return a.nodeType === TEXT_NODE || a.nodeType === COMMENT_NODE;
|
|
998
998
|
}
|
|
999
999
|
function preservesOpen(el) {
|
package/frames/dist/server.cjs
CHANGED
|
@@ -1266,7 +1266,7 @@ function renderToStream(code, options = {}) {
|
|
|
1266
1266
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
1267
1267
|
const headOps = error ? null : flushHeadFragment(headRegistry, key);
|
|
1268
1268
|
if (headOps) emitHeadOps(key, headOps);
|
|
1269
|
-
sink.fragment(key, value !== undefined ? value : " ", {
|
|
1269
|
+
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
1270
1270
|
styles,
|
|
1271
1271
|
revealGroup,
|
|
1272
1272
|
error
|
|
@@ -1358,7 +1358,7 @@ function renderToStream(code, options = {}) {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
serializeRootAssets();
|
|
1360
1360
|
const head = renderShellHead(headRegistry, nonce, k => registry.has(k));
|
|
1361
|
-
sink.shell(html, {
|
|
1361
|
+
sink.shell(resolveSSRSelectValues(html), {
|
|
1362
1362
|
preloads: tracking.emittedAssets,
|
|
1363
1363
|
inlineStyles: tracking.inlineStyles,
|
|
1364
1364
|
tasks,
|
|
@@ -2154,6 +2154,93 @@ function ssr(t) {
|
|
|
2154
2154
|
};
|
|
2155
2155
|
return result;
|
|
2156
2156
|
}
|
|
2157
|
+
function decodeSSREntities(s) {
|
|
2158
|
+
return s.indexOf("&") < 0 ? s : s.replace(/"/g, '"').replace(/</g, "<").replace(/&/g, "&");
|
|
2159
|
+
}
|
|
2160
|
+
const SELECT_VALUE_ATTR = /\svalue="([^"]*)"/;
|
|
2161
|
+
function tagEnd(html, i) {
|
|
2162
|
+
for (let j = i + 1; j < html.length; j++) {
|
|
2163
|
+
const c = html.charCodeAt(j);
|
|
2164
|
+
if (c === 34) {
|
|
2165
|
+
j = html.indexOf('"', j + 1);
|
|
2166
|
+
if (j < 0) return -1;
|
|
2167
|
+
} else if (c === 62) return j;
|
|
2168
|
+
}
|
|
2169
|
+
return -1;
|
|
2170
|
+
}
|
|
2171
|
+
function optionText(html, from) {
|
|
2172
|
+
let t = "";
|
|
2173
|
+
let i = from;
|
|
2174
|
+
for (;;) {
|
|
2175
|
+
const lt = html.indexOf("<", i);
|
|
2176
|
+
if (lt < 0) return t + html.slice(i);
|
|
2177
|
+
t += html.slice(i, lt);
|
|
2178
|
+
if (!html.startsWith("<!--", lt)) return t;
|
|
2179
|
+
const ce = html.indexOf("-->", lt);
|
|
2180
|
+
if (ce < 0) return t;
|
|
2181
|
+
i = ce + 3;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
function tagIs(html, i, name) {
|
|
2185
|
+
if (!html.startsWith(name, i + 1)) return false;
|
|
2186
|
+
const c = html.charCodeAt(i + 1 + name.length);
|
|
2187
|
+
return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
|
|
2188
|
+
}
|
|
2189
|
+
function resolveSSRSelectValues(html) {
|
|
2190
|
+
if (html.indexOf("<select") < 0) return html;
|
|
2191
|
+
let out = "";
|
|
2192
|
+
let idx = 0;
|
|
2193
|
+
let sel = null;
|
|
2194
|
+
let i = html.indexOf("<");
|
|
2195
|
+
while (i >= 0) {
|
|
2196
|
+
let e;
|
|
2197
|
+
if (html.charCodeAt(i + 1) === 33) {
|
|
2198
|
+
e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
|
|
2199
|
+
if (e < 0) break;
|
|
2200
|
+
if (html.charCodeAt(i + 2) === 45) e += 2;
|
|
2201
|
+
} else {
|
|
2202
|
+
e = tagEnd(html, i);
|
|
2203
|
+
if (e < 0) break;
|
|
2204
|
+
if (sel) {
|
|
2205
|
+
if (html.startsWith("</select>", i)) {
|
|
2206
|
+
out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
|
|
2207
|
+
let seg = sel.body;
|
|
2208
|
+
if (!sel.defaulted) {
|
|
2209
|
+
for (let k = 0; k < sel.marks.length; k++) {
|
|
2210
|
+
out += html.slice(seg, sel.marks[k]) + " selected";
|
|
2211
|
+
seg = sel.marks[k];
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
out += html.slice(seg, i);
|
|
2215
|
+
idx = i;
|
|
2216
|
+
sel = null;
|
|
2217
|
+
} else if (tagIs(html, i, "option")) {
|
|
2218
|
+
const attrs = html.slice(i + 7, e);
|
|
2219
|
+
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
2220
|
+
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
2221
|
+
const value = vm ? decodeSSREntities(vm[1]) : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
2222
|
+
if (sel.values.includes(value)) sel.marks.push(e);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
} else if (tagIs(html, i, "select")) {
|
|
2226
|
+
const m = SELECT_VALUE_ATTR.exec(html.slice(i, e + 1));
|
|
2227
|
+
if (m) {
|
|
2228
|
+
const bound = decodeSSREntities(m[1]);
|
|
2229
|
+
sel = {
|
|
2230
|
+
values: /\smultiple(?=[\s>=])/.test(html.slice(i, e + 1)) ? bound.split(",") : [bound],
|
|
2231
|
+
strip: i + m.index,
|
|
2232
|
+
stripEnd: i + m.index + m[0].length,
|
|
2233
|
+
body: e + 1,
|
|
2234
|
+
marks: [],
|
|
2235
|
+
defaulted: false
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
i = html.indexOf("<", e + 1);
|
|
2241
|
+
}
|
|
2242
|
+
return out + html.slice(idx);
|
|
2243
|
+
}
|
|
2157
2244
|
function escape(s, attr) {
|
|
2158
2245
|
const t = typeof s;
|
|
2159
2246
|
if (t !== "string") {
|
|
@@ -2285,7 +2372,9 @@ function renderHeadAssets(emittedAssets, inlineStyles, nonce) {
|
|
|
2285
2372
|
function serializeFragmentAssets(key, boundaryModules, context, name = key) {
|
|
2286
2373
|
const map = boundaryModules.get(key);
|
|
2287
2374
|
if (!map || !Object.keys(map).length) return;
|
|
2288
|
-
context.serialize(name + "_assets",
|
|
2375
|
+
context.serialize(name + "_assets", {
|
|
2376
|
+
...map
|
|
2377
|
+
});
|
|
2289
2378
|
}
|
|
2290
2379
|
function propagateBoundaryStyles(childKey, parentKey, tracking) {
|
|
2291
2380
|
const childStyles = tracking.getBoundaryStyles(childKey);
|