@solidjs/web 2.0.0-rc.21 → 2.0.0-rc.22
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 +380 -239
- package/dist/server.js +377 -238
- package/dist/server.observe.js +377 -238
- package/dist/web.dev.js +125 -82
- package/dist/web.js +103 -81
- package/dist/web.observe.js +103 -81
- package/frames/dist/client.dev.js +7 -2
- package/frames/dist/client.js +7 -2
- package/frames/dist/client.observe.js +7 -2
- package/frames/dist/server.dev.js +122 -62
- package/frames/dist/server.js +122 -62
- package/frames/dist/server.observe.js +122 -62
- package/frames/dist/wire.js +1 -1
- package/package.json +2 -2
- package/serialization/dist/serialization.js +5 -4
- package/serialization/types/index.d.ts +8 -1
- package/serialization/types/serializer.d.ts +8 -1
- package/server-functions/dist/client.dev.js +5 -3
- package/server-functions/dist/client.js +5 -3
- package/server-functions/dist/client.observe.js +5 -3
- package/types/client.d.ts +54 -3
- package/types/constants.d.ts +2 -1
- package/types/frames/frame-client.d.ts +2 -0
- package/types/frames/serializer.d.ts +8 -1
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +8 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server.d.ts +48 -7
package/dist/web.dev.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack,
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, enableServerComponentHydration,
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runRefCallback, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, strictReadTracked, runWithOwner, heldRead, setSwapHook, isHidden, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, heldRead, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sharedConfig, enableServerComponentHydration, hasStaticKeys, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PROXY, SOURCE_PLAIN, sourceKeys, resolvedTable, dynamicCore } from 'solid-js/internal';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
@@ -32,6 +32,7 @@ const DOMWithState = {
|
|
|
32
32
|
};
|
|
33
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
34
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
35
|
+
const $$INDEX = /*#__PURE__*/Symbol("index");
|
|
35
36
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
37
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
37
38
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -101,32 +102,36 @@ function memo(fn) {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
104
|
-
let
|
|
105
|
-
|
|
105
|
+
let bLength = b.length,
|
|
106
|
+
aEnd = a.length,
|
|
107
|
+
bEnd = bLength,
|
|
108
|
+
aStart = 0,
|
|
109
|
+
bStart = 0,
|
|
110
|
+
stamped,
|
|
111
|
+
after,
|
|
112
|
+
index,
|
|
113
|
+
anchor;
|
|
114
|
+
while (aStart < aEnd && a[aStart] === b[bStart]) {
|
|
115
|
+
aStart++;
|
|
116
|
+
bStart++;
|
|
117
|
+
}
|
|
118
|
+
if (aStart === aEnd && bStart === bEnd) return;
|
|
119
|
+
const mv = parentNode.moveBefore && parentNode.isConnected;
|
|
106
120
|
const slot = marker || parentNode;
|
|
107
121
|
const insert = (n, ref) => {
|
|
108
|
-
|
|
122
|
+
mv && n.isConnected ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
109
123
|
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
110
124
|
};
|
|
111
|
-
if (!
|
|
125
|
+
if (!aEnd) {
|
|
112
126
|
for (const n of b) insert(n, marker);
|
|
113
127
|
return;
|
|
114
128
|
}
|
|
115
|
-
const isLive = n =>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return
|
|
129
|
+
const isLive = n => n && n.parentNode === parentNode && (!(n = n[$$SLOT]) || n === slot);
|
|
130
|
+
const ref = k => {
|
|
131
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
132
|
+
return b[k] || (after && after.parentNode !== parentNode ? marker || null : after);
|
|
119
133
|
};
|
|
120
|
-
|
|
121
|
-
aEnd = a.length,
|
|
122
|
-
bEnd = bLength,
|
|
123
|
-
aStart = 0,
|
|
124
|
-
bStart = 0,
|
|
125
|
-
tail = a[aEnd - 1],
|
|
126
|
-
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
127
|
-
map = null,
|
|
128
|
-
anchor,
|
|
129
|
-
anchorTag;
|
|
134
|
+
after = isLive(anchor = a[aEnd - 1]) ? anchor.nextSibling : marker || null;
|
|
130
135
|
while (aStart < aEnd || bStart < bEnd) {
|
|
131
136
|
if (a[aStart] === b[bStart]) {
|
|
132
137
|
aStart++;
|
|
@@ -138,52 +143,43 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
138
143
|
bEnd--;
|
|
139
144
|
}
|
|
140
145
|
if (aEnd === aStart) {
|
|
141
|
-
|
|
142
|
-
while (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const n = a[aStart++];
|
|
148
|
-
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
149
|
-
}
|
|
150
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
146
|
+
anchor = ref(bEnd);
|
|
147
|
+
while (bStart < bEnd) insert(b[bStart++], anchor);
|
|
148
|
+
} else if (!isLive(anchor = a[aStart])) aStart++;
|
|
149
|
+
else if (b[bStart] === a[aEnd - 1] && (
|
|
150
|
+
anchor === b[bEnd - 1] ||
|
|
151
|
+
!stamped && anchor === b[bStart + 1] && a[aStart + 1] === b[bStart + 2])) {
|
|
151
152
|
do {
|
|
152
153
|
insert(a[--aEnd], anchor);
|
|
153
154
|
bStart++;
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
} while (aStart < aEnd - 1 && bStart < bEnd && anchor === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
156
|
+
} else if (bStart < bEnd && anchor === b[bEnd - 1] && a[aStart + 1] !== b[bEnd - 2] && isLive(b[bStart]) && isLive(a[aEnd - 1])) {
|
|
157
|
+
insert(anchor, ref(bEnd));
|
|
158
|
+
aStart++;
|
|
159
|
+
bEnd--;
|
|
156
160
|
} else {
|
|
157
|
-
if (!
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
if (!stamped) {
|
|
162
|
+
stamped = 1;
|
|
163
|
+
for (index = bStart; index < bEnd;) b[index][$$INDEX] = index++;
|
|
160
164
|
}
|
|
161
|
-
if (
|
|
162
|
-
map = new Map();
|
|
163
|
-
let i = bStart;
|
|
164
|
-
while (i < bEnd) map.set(b[i], i++);
|
|
165
|
-
}
|
|
166
|
-
const index = map.get(a[aStart]);
|
|
167
|
-
if (index != null) {
|
|
165
|
+
if ((index = anchor[$$INDEX]) >= 0 && b[index] === anchor) {
|
|
168
166
|
if (bStart < index && index < bEnd) {
|
|
169
167
|
let i = aStart,
|
|
170
|
-
sequence = 1
|
|
171
|
-
|
|
172
|
-
while (++i < aEnd && i < bEnd) {
|
|
173
|
-
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
174
|
-
sequence++;
|
|
175
|
-
}
|
|
168
|
+
sequence = 1;
|
|
169
|
+
while (++i < aEnd && i < bEnd && a[i] === b[index + sequence]) sequence++;
|
|
176
170
|
if (sequence > index - bStart) {
|
|
177
|
-
|
|
178
|
-
while (bStart < index) insert(b[bStart++], node);
|
|
171
|
+
while (bStart < index) insert(b[bStart++], anchor);
|
|
179
172
|
} else {
|
|
180
|
-
const newNode = b[bStart++]
|
|
181
|
-
|
|
182
|
-
|
|
173
|
+
const newNode = b[bStart++];
|
|
174
|
+
aStart++;
|
|
175
|
+
mv ? insert(newNode, anchor) : parentNode.replaceChild(newNode, anchor);
|
|
183
176
|
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
184
177
|
}
|
|
185
178
|
} else aStart++;
|
|
186
|
-
} else
|
|
179
|
+
} else {
|
|
180
|
+
anchor.remove();
|
|
181
|
+
aStart++;
|
|
182
|
+
}
|
|
187
183
|
}
|
|
188
184
|
}
|
|
189
185
|
}
|
|
@@ -562,11 +558,18 @@ function render(code, element, init, options = {}) {
|
|
|
562
558
|
element.textContent = "";
|
|
563
559
|
};
|
|
564
560
|
}
|
|
561
|
+
let policy;
|
|
562
|
+
function setTrustedTypesPolicy(value) {
|
|
563
|
+
policy = value;
|
|
564
|
+
}
|
|
565
|
+
function trustedHTML(html) {
|
|
566
|
+
return policy ? policy.createHTML(html) : html;
|
|
567
|
+
}
|
|
565
568
|
function create(html, bypassGuard, flag) {
|
|
566
569
|
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
567
570
|
if (/^<(html|head|body)[\s>]/i.test(html)) throw new Error("Document shell templates (<html>, <head>, <body>) cannot be client-created: " + "a <template> parse strips those tags. Render this component through hydrate(), " + "where the document shell already exists.");
|
|
568
571
|
const t = document.createElement("template");
|
|
569
|
-
t.innerHTML = html;
|
|
572
|
+
t.innerHTML = policy ? policy.createHTML(html) : html;
|
|
570
573
|
const node = t.content.firstChild;
|
|
571
574
|
return flag === 2 ? node.firstChild : node;
|
|
572
575
|
}
|
|
@@ -677,6 +680,9 @@ function setStatefulProperty(node, name, value) {
|
|
|
677
680
|
node[name] = value;
|
|
678
681
|
recordStatefulWrite(node, name, value);
|
|
679
682
|
}
|
|
683
|
+
function strictHandler(fn) {
|
|
684
|
+
return strictReadTracked(fn) ;
|
|
685
|
+
}
|
|
680
686
|
let claimHandlers = null;
|
|
681
687
|
const claimAttributeSets = [];
|
|
682
688
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -762,7 +768,7 @@ function className(node, value, prev) {
|
|
|
762
768
|
return;
|
|
763
769
|
}
|
|
764
770
|
if (typeof value === "string") {
|
|
765
|
-
node._$classes = undefined;
|
|
771
|
+
if (node._$classes) node._$classes = undefined;
|
|
766
772
|
value !== prev && node.setAttribute("class", value);
|
|
767
773
|
return;
|
|
768
774
|
}
|
|
@@ -885,14 +891,22 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
885
891
|
}
|
|
886
892
|
const prevProps = {};
|
|
887
893
|
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
894
|
+
let held = 0;
|
|
888
895
|
const apply = newProps => {
|
|
889
896
|
const r = newProps.ref;
|
|
890
897
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
898
|
+
spreadHeld = held;
|
|
891
899
|
assign(node, newProps, true, prevProps, true);
|
|
900
|
+
spreadHeld = 0;
|
|
892
901
|
if (owner !== undefined) claimElement(node, owner);
|
|
893
902
|
};
|
|
903
|
+
const read = fn => () => {
|
|
904
|
+
const p = fn();
|
|
905
|
+
held = heldRead();
|
|
906
|
+
return p;
|
|
907
|
+
};
|
|
894
908
|
if (Array.isArray(props)) {
|
|
895
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
909
|
+
effect(read(() => collectSources({}, props, undefined, skip)), apply);
|
|
896
910
|
unscopedByDesign = node;
|
|
897
911
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
898
912
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
@@ -903,7 +917,7 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
903
917
|
unscopedByDesign = null;
|
|
904
918
|
return prevProps;
|
|
905
919
|
}
|
|
906
|
-
|
|
920
|
+
const collect = () => {
|
|
907
921
|
const source = resolveSource(props);
|
|
908
922
|
const newProps = {};
|
|
909
923
|
const table = resolvedTable(source);
|
|
@@ -913,7 +927,8 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
913
927
|
if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
|
|
914
928
|
}
|
|
915
929
|
return newProps;
|
|
916
|
-
}
|
|
930
|
+
};
|
|
931
|
+
effect(read(collect), apply);
|
|
917
932
|
unscopedByDesign = node;
|
|
918
933
|
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
919
934
|
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
@@ -1003,7 +1018,7 @@ function applyRef(r, element) {
|
|
|
1003
1018
|
}
|
|
1004
1019
|
function ref(fn, element) {
|
|
1005
1020
|
const resolved = untrack(fn);
|
|
1006
|
-
|
|
1021
|
+
runRefCallback(() => applyRef(resolved, element));
|
|
1007
1022
|
}
|
|
1008
1023
|
function scope(fn) {
|
|
1009
1024
|
fn.$s = true;
|
|
@@ -1036,6 +1051,29 @@ function checkUnscopedHole(snapshot, accessor, parent) {
|
|
|
1036
1051
|
}
|
|
1037
1052
|
let hydrationRt = null;
|
|
1038
1053
|
let selectInsert = null;
|
|
1054
|
+
let hostRt = null;
|
|
1055
|
+
function installHostTagging() {
|
|
1056
|
+
hostRt = tagHost;
|
|
1057
|
+
}
|
|
1058
|
+
function checkParserMoved(parent, node) {
|
|
1059
|
+
const at = node.parentNode;
|
|
1060
|
+
if (!at || at === parent || parent.$$nest) return;
|
|
1061
|
+
parent.$$nest = 1;
|
|
1062
|
+
const wrapped = at.parentNode === parent && !at.hasAttribute("_hk");
|
|
1063
|
+
const p = `<${parent.localName}>`,
|
|
1064
|
+
n = `<${node.localName}>`;
|
|
1065
|
+
devCheck({
|
|
1066
|
+
code: "INVALID_HTML_NESTING",
|
|
1067
|
+
kind: "render",
|
|
1068
|
+
severity: "warn",
|
|
1069
|
+
message: `[INVALID_HTML_NESTING] The server rendered ${n} inside ${p}, which HTML does not ` + `allow there, and the browser's parser ` + (wrapped ? `wrapped it in a <${at.localName}> it added` : `moved it: it now sits in <${at.localName}>`) + `. Hydration keeps the parser's tree, so the page differs from a client render and ` + `Solid cannot update ${n} through ${p} (a removed node stays, a new one lands ` + `elsewhere). The nesting usually spans a component boundary, which the compiler ` + `cannot check. ` + (wrapped ? `Write the <${at.localName}> yourself: \`${p}<${at.localName}>…</${at.localName}></${parent.localName}>\`.` : `Change the outer element (a <div> for a <p> that holds blocks), or move ${n} out ` + `of ${p}.`),
|
|
1070
|
+
data: {
|
|
1071
|
+
parent: parent.localName,
|
|
1072
|
+
child: node.localName,
|
|
1073
|
+
found: at.localName
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1039
1077
|
function installHydrationRuntime() {
|
|
1040
1078
|
hydrationRt = {
|
|
1041
1079
|
claimInitial(parent, multi, initial) {
|
|
@@ -1046,8 +1084,7 @@ function installHydrationRuntime() {
|
|
|
1046
1084
|
},
|
|
1047
1085
|
reclaimRegion(current, parent, marker) {
|
|
1048
1086
|
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
1049
|
-
|
|
1050
|
-
if (first == null || first.isConnected) return current;
|
|
1087
|
+
if (Array.isArray(current) ? current.every(n => !n || n.isConnected) : current.isConnected) return current;
|
|
1051
1088
|
let nodes;
|
|
1052
1089
|
if (marker) {
|
|
1053
1090
|
nodes = [];
|
|
@@ -1121,7 +1158,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1121
1158
|
accessor = normalize(accessor, initial, multi, true);
|
|
1122
1159
|
if (typeof accessor !== "function") {
|
|
1123
1160
|
insertExpression(parent, accessor, initial, marker);
|
|
1124
|
-
host &&
|
|
1161
|
+
hostRt !== null && host && hostRt(accessor, host);
|
|
1125
1162
|
return;
|
|
1126
1163
|
}
|
|
1127
1164
|
}
|
|
@@ -1146,7 +1183,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1146
1183
|
} : options;
|
|
1147
1184
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
1148
1185
|
current = insertExpression(parent, inner, current, marker);
|
|
1149
|
-
host &&
|
|
1186
|
+
hostRt !== null && host && hostRt(current, host);
|
|
1150
1187
|
}, {
|
|
1151
1188
|
...innerOptions,
|
|
1152
1189
|
_wide: true
|
|
@@ -1156,7 +1193,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1156
1193
|
}, value => {
|
|
1157
1194
|
if (value === INNER_OWNED) return;
|
|
1158
1195
|
current = insertExpression(parent, value, current, marker);
|
|
1159
|
-
host &&
|
|
1196
|
+
hostRt !== null && host && hostRt(current, host);
|
|
1160
1197
|
},
|
|
1161
1198
|
accessor.$s ? options ? {
|
|
1162
1199
|
...options,
|
|
@@ -1369,6 +1406,7 @@ function initHeadRegistry() {
|
|
|
1369
1406
|
headRegistrations = [];
|
|
1370
1407
|
headOwned = new Map();
|
|
1371
1408
|
headApplied = new Map();
|
|
1409
|
+
setSwapHook(scheduleHeadApply);
|
|
1372
1410
|
const t = document.querySelector("title");
|
|
1373
1411
|
headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
|
|
1374
1412
|
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
@@ -1419,7 +1457,7 @@ function flushHeadRegistry() {
|
|
|
1419
1457
|
return;
|
|
1420
1458
|
}
|
|
1421
1459
|
headScheduled = false;
|
|
1422
|
-
const winners = resolveHead(headRegistrations);
|
|
1460
|
+
const winners = resolveHead(headRegistrations.filter(r => !isHidden(r.node)));
|
|
1423
1461
|
for (const [identity, els] of headOwned) {
|
|
1424
1462
|
if (winners.has(identity)) continue;
|
|
1425
1463
|
headOwned.delete(identity);
|
|
@@ -1533,10 +1571,12 @@ function useHead(tags) {
|
|
|
1533
1571
|
initHeadRegistry();
|
|
1534
1572
|
const reg = {
|
|
1535
1573
|
seq: -1,
|
|
1536
|
-
tags: null
|
|
1574
|
+
tags: null,
|
|
1575
|
+
node: null
|
|
1537
1576
|
};
|
|
1538
1577
|
const uid = ++headUid;
|
|
1539
1578
|
effect(() => {
|
|
1579
|
+
reg.node = getOwner();
|
|
1540
1580
|
let list = typeof tags === "function" ? tags() : tags;
|
|
1541
1581
|
if (!Array.isArray(list)) list = [list];
|
|
1542
1582
|
const replaceable = [];
|
|
@@ -1729,7 +1769,8 @@ function getNextElement(template) {
|
|
|
1729
1769
|
}
|
|
1730
1770
|
if (isHydrating()) {
|
|
1731
1771
|
hydrationKeyMisses++;
|
|
1732
|
-
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>).`
|
|
1772
|
+
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>).` + (
|
|
1773
|
+
template._html && template._html.startsWith("<form") ? ` If this <form> renders inside another <form> (through a component), the ` + `browser's HTML parser dropped it: forms cannot nest. Move it out of the outer form.` : ""));
|
|
1733
1774
|
}
|
|
1734
1775
|
return template(true);
|
|
1735
1776
|
}
|
|
@@ -1916,10 +1957,11 @@ function flattenClassList(list, result) {
|
|
|
1916
1957
|
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1917
1958
|
}
|
|
1918
1959
|
}
|
|
1960
|
+
let spreadHeld = 0;
|
|
1919
1961
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
1920
1962
|
if (prop === "style") return style(node, value, prev), value;
|
|
1921
1963
|
if (prop === "class") return className(node, value, prev), value;
|
|
1922
|
-
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
1964
|
+
if (value === prev && (spreadHeld || DOMWithState[nodeName]?.[prop] !== 1)) return prev;
|
|
1923
1965
|
if (prop === "ref") {
|
|
1924
1966
|
if (!skipRef && value) ref(() => value, node);
|
|
1925
1967
|
return value;
|
|
@@ -1966,37 +2008,32 @@ function eventHandler(e, container, state) {
|
|
|
1966
2008
|
e[$$EVENT_OWNER] = owner;
|
|
1967
2009
|
let node = resumeNode || e.target;
|
|
1968
2010
|
const key = EVENT_KEY + e.type;
|
|
1969
|
-
const
|
|
2011
|
+
const define = (name, value) => Object.defineProperty(e, name, {
|
|
1970
2012
|
configurable: true,
|
|
1971
2013
|
value
|
|
1972
2014
|
});
|
|
1973
2015
|
const handleNode = () => {
|
|
1974
2016
|
const handler = node[key];
|
|
1975
2017
|
if (handler && !node.disabled) {
|
|
2018
|
+
define("currentTarget", node);
|
|
1976
2019
|
const data = node[`${key}Data`];
|
|
1977
2020
|
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1978
2021
|
if (e.cancelBubble) return;
|
|
1979
2022
|
}
|
|
1980
|
-
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) &&
|
|
2023
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && define("target", node.host);
|
|
1981
2024
|
return true;
|
|
1982
2025
|
};
|
|
1983
2026
|
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1984
2027
|
const walkUpTree = () => {
|
|
1985
2028
|
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1986
2029
|
};
|
|
1987
|
-
Object.defineProperty(e, "currentTarget", {
|
|
1988
|
-
configurable: true,
|
|
1989
|
-
get() {
|
|
1990
|
-
return node || owner;
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
2030
|
if (resumeNode) {
|
|
1994
2031
|
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1995
2032
|
if (node && node !== owner) walkUpTree();
|
|
1996
2033
|
} else if (e.composedPath) {
|
|
1997
2034
|
const path = e.composedPath();
|
|
1998
2035
|
if (path.length) {
|
|
1999
|
-
|
|
2036
|
+
define("target", path[0]);
|
|
2000
2037
|
for (let i = 0; i < path.length; i++) {
|
|
2001
2038
|
node = path[i];
|
|
2002
2039
|
if (!handleNode()) break;
|
|
@@ -2021,6 +2058,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2021
2058
|
for (const n of arr ? value : [value]) {
|
|
2022
2059
|
if (n && n.nodeType) {
|
|
2023
2060
|
if (!isHydrating(n)) return current;
|
|
2061
|
+
if (n.nodeType === 1 && parent.nodeType === 1) checkParserMoved(parent, n);
|
|
2024
2062
|
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
2025
2063
|
return current;
|
|
2026
2064
|
}
|
|
@@ -2066,7 +2104,8 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2066
2104
|
if (t === "string" || t === "number") {
|
|
2067
2105
|
const prev = currentArray ? current[i] : undefined;
|
|
2068
2106
|
if (prev && prev.nodeType === 3) {
|
|
2069
|
-
|
|
2107
|
+
const last = prev._$d;
|
|
2108
|
+
if (last !== item && (last !== undefined || prev.data !== "" + item)) prev.data = prev._$d = item;
|
|
2070
2109
|
value[i] = prev;
|
|
2071
2110
|
} else value[i] = document.createTextNode(item);
|
|
2072
2111
|
}
|
|
@@ -2135,13 +2174,16 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
2135
2174
|
}
|
|
2136
2175
|
return value;
|
|
2137
2176
|
}
|
|
2177
|
+
function hostGetter() {
|
|
2178
|
+
return this[$$HOST]();
|
|
2179
|
+
}
|
|
2138
2180
|
function tagHost(value, host) {
|
|
2139
2181
|
if (Array.isArray(value)) {
|
|
2140
2182
|
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
2141
2183
|
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
2142
2184
|
value[$$HOST] = host;
|
|
2143
2185
|
Object.defineProperty(value, "_$host", {
|
|
2144
|
-
get:
|
|
2186
|
+
get: hostGetter,
|
|
2145
2187
|
configurable: true
|
|
2146
2188
|
});
|
|
2147
2189
|
}
|
|
@@ -2402,6 +2444,7 @@ function portalImpl(props) {
|
|
|
2402
2444
|
const m = untrack(mount);
|
|
2403
2445
|
m.appendChild(endMarker);
|
|
2404
2446
|
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
2447
|
+
installHostTagging();
|
|
2405
2448
|
insert(m, c, endMarker, undefined, {
|
|
2406
2449
|
host: () => treeMarker.parentNode
|
|
2407
2450
|
});
|
|
@@ -2487,4 +2530,4 @@ _moduleUrl) {
|
|
|
2487
2530
|
function httpStatus(_code, _text) {}
|
|
2488
2531
|
function httpHeader(_name, _value, _options) {}
|
|
2489
2532
|
|
|
2490
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2533
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHostTagging, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, setTrustedTypesPolicy, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, strictHandler, style, takeHydrationValue, template, trustedHTML, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|