@solidjs/web 2.0.0-rc.21 → 2.0.0-rc.23
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 +403 -242
- package/dist/server.js +400 -241
- package/dist/server.observe.js +400 -241
- package/dist/web.dev.js +140 -100
- package/dist/web.js +118 -99
- package/dist/web.observe.js +118 -99
- 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 +6 -5
- 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 +16 -7
- package/server-functions/dist/client.js +16 -7
- package/server-functions/dist/client.observe.js +16 -7
- package/server-functions/dist/server.dev.js +20 -38
- package/server-functions/dist/server.js +20 -38
- package/server-functions/dist/server.observe.js +20 -38
- package/types/client.d.ts +54 -2
- 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/types/trace.d.ts +18 -0
package/dist/web.dev.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack,
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runRefCallback, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, strictReadTracked, runWithOwner, setSwapHook, isHidden, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
|
|
2
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,
|
|
3
|
+
import { sharedConfig, enableServerComponentHydration, hasStaticKeys, heldRead, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PROXY, SOURCE_PLAIN, sourceKeys, resolvedTable, dynamicCore } from 'solid-js/internal';
|
|
4
|
+
export { heldRead } from 'solid-js/internal';
|
|
4
5
|
|
|
5
6
|
const DOMWithState = {
|
|
6
7
|
INPUT: {
|
|
@@ -32,6 +33,7 @@ const DOMWithState = {
|
|
|
32
33
|
};
|
|
33
34
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
35
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
36
|
+
const $$INDEX = /*#__PURE__*/Symbol("index");
|
|
35
37
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
38
|
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
39
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -101,32 +103,36 @@ function memo(fn) {
|
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
+
let bLength = b.length,
|
|
107
|
+
aEnd = a.length,
|
|
108
|
+
bEnd = bLength,
|
|
109
|
+
aStart = 0,
|
|
110
|
+
bStart = 0,
|
|
111
|
+
stamped,
|
|
112
|
+
after,
|
|
113
|
+
index,
|
|
114
|
+
anchor;
|
|
115
|
+
while (aStart < aEnd && a[aStart] === b[bStart]) {
|
|
116
|
+
aStart++;
|
|
117
|
+
bStart++;
|
|
118
|
+
}
|
|
119
|
+
if (aStart === aEnd && bStart === bEnd) return;
|
|
120
|
+
const mv = parentNode.moveBefore && parentNode.isConnected;
|
|
106
121
|
const slot = marker || parentNode;
|
|
107
122
|
const insert = (n, ref) => {
|
|
108
|
-
|
|
123
|
+
mv && n.isConnected ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
109
124
|
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
110
125
|
};
|
|
111
|
-
if (!
|
|
126
|
+
if (!aEnd) {
|
|
112
127
|
for (const n of b) insert(n, marker);
|
|
113
128
|
return;
|
|
114
129
|
}
|
|
115
|
-
const isLive = n =>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return
|
|
130
|
+
const isLive = n => n && n.parentNode === parentNode && (!(n = n[$$SLOT]) || n === slot);
|
|
131
|
+
const ref = k => {
|
|
132
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
133
|
+
return b[k] || (after && after.parentNode !== parentNode ? marker || null : after);
|
|
119
134
|
};
|
|
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;
|
|
135
|
+
after = isLive(anchor = a[aEnd - 1]) ? anchor.nextSibling : marker || null;
|
|
130
136
|
while (aStart < aEnd || bStart < bEnd) {
|
|
131
137
|
if (a[aStart] === b[bStart]) {
|
|
132
138
|
aStart++;
|
|
@@ -138,52 +144,43 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
138
144
|
bEnd--;
|
|
139
145
|
}
|
|
140
146
|
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)) {
|
|
147
|
+
anchor = ref(bEnd);
|
|
148
|
+
while (bStart < bEnd) insert(b[bStart++], anchor);
|
|
149
|
+
} else if (!isLive(anchor = a[aStart])) aStart++;
|
|
150
|
+
else if (b[bStart] === a[aEnd - 1] && (
|
|
151
|
+
anchor === b[bEnd - 1] ||
|
|
152
|
+
!stamped && anchor === b[bStart + 1] && a[aStart + 1] === b[bStart + 2])) {
|
|
151
153
|
do {
|
|
152
154
|
insert(a[--aEnd], anchor);
|
|
153
155
|
bStart++;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
} while (aStart < aEnd - 1 && bStart < bEnd && anchor === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
157
|
+
} else if (bStart < bEnd && anchor === b[bEnd - 1] && a[aStart + 1] !== b[bEnd - 2] && isLive(b[bStart]) && isLive(a[aEnd - 1])) {
|
|
158
|
+
insert(anchor, ref(bEnd));
|
|
159
|
+
aStart++;
|
|
160
|
+
bEnd--;
|
|
156
161
|
} else {
|
|
157
|
-
if (!
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
if (!stamped) {
|
|
163
|
+
stamped = 1;
|
|
164
|
+
for (index = bStart; index < bEnd;) b[index][$$INDEX] = index++;
|
|
160
165
|
}
|
|
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) {
|
|
166
|
+
if ((index = anchor[$$INDEX]) >= 0 && b[index] === anchor) {
|
|
168
167
|
if (bStart < index && index < bEnd) {
|
|
169
168
|
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
|
-
}
|
|
169
|
+
sequence = 1;
|
|
170
|
+
while (++i < aEnd && i < bEnd && a[i] === b[index + sequence]) sequence++;
|
|
176
171
|
if (sequence > index - bStart) {
|
|
177
|
-
|
|
178
|
-
while (bStart < index) insert(b[bStart++], node);
|
|
172
|
+
while (bStart < index) insert(b[bStart++], anchor);
|
|
179
173
|
} else {
|
|
180
|
-
const newNode = b[bStart++]
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
const newNode = b[bStart++];
|
|
175
|
+
aStart++;
|
|
176
|
+
mv ? insert(newNode, anchor) : parentNode.replaceChild(newNode, anchor);
|
|
183
177
|
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
184
178
|
}
|
|
185
179
|
} else aStart++;
|
|
186
|
-
} else
|
|
180
|
+
} else {
|
|
181
|
+
anchor.remove();
|
|
182
|
+
aStart++;
|
|
183
|
+
}
|
|
187
184
|
}
|
|
188
185
|
}
|
|
189
186
|
}
|
|
@@ -562,17 +559,24 @@ function render(code, element, init, options = {}) {
|
|
|
562
559
|
element.textContent = "";
|
|
563
560
|
};
|
|
564
561
|
}
|
|
562
|
+
let policy;
|
|
563
|
+
function setTrustedTypesPolicy(value) {
|
|
564
|
+
policy = value;
|
|
565
|
+
}
|
|
566
|
+
function trustedHTML(html) {
|
|
567
|
+
return policy ? policy.createHTML(html) : html;
|
|
568
|
+
}
|
|
565
569
|
function create(html, bypassGuard, flag) {
|
|
566
570
|
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
571
|
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
572
|
const t = document.createElement("template");
|
|
569
|
-
t.innerHTML = html;
|
|
573
|
+
t.innerHTML = policy ? policy.createHTML(html) : html;
|
|
570
574
|
const node = t.content.firstChild;
|
|
571
575
|
return flag === 2 ? node.firstChild : node;
|
|
572
576
|
}
|
|
573
577
|
function template(html, flag) {
|
|
574
578
|
let node;
|
|
575
|
-
const fn =
|
|
579
|
+
const fn = bypassGuard => (node || (node = create(html, bypassGuard, flag)), flag === 1 ? document.importNode(node, true) : node.cloneNode(true));
|
|
576
580
|
fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
|
|
577
581
|
return fn;
|
|
578
582
|
}
|
|
@@ -649,8 +653,7 @@ function getDelegatedRoot(node) {
|
|
|
649
653
|
}
|
|
650
654
|
}
|
|
651
655
|
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
652
|
-
function findOwner(
|
|
653
|
-
let node = target;
|
|
656
|
+
function findOwner(node, state) {
|
|
654
657
|
let distance = 0;
|
|
655
658
|
while (node) {
|
|
656
659
|
if (state.owners.has(node)) return {
|
|
@@ -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,35 +891,44 @@ 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--) {
|
|
899
913
|
const s = resolveSource(props[i]);
|
|
900
|
-
if (s
|
|
914
|
+
if (s && entryHas(s, "children")) return entryGet(s, "children");
|
|
901
915
|
}
|
|
902
916
|
});
|
|
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);
|
|
910
924
|
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
911
|
-
if (source
|
|
925
|
+
if (source) {
|
|
912
926
|
const view = viewOf(source);
|
|
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)) {
|
|
@@ -923,7 +938,7 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
923
938
|
}
|
|
924
939
|
} else insert(node, () => {
|
|
925
940
|
const source = resolveSource(props);
|
|
926
|
-
return source
|
|
941
|
+
return source && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
927
942
|
});
|
|
928
943
|
}
|
|
929
944
|
unscopedByDesign = null;
|
|
@@ -963,7 +978,7 @@ function pushEntry(resolved, kinds, s, kind) {
|
|
|
963
978
|
return;
|
|
964
979
|
}
|
|
965
980
|
s = resolveSource(s);
|
|
966
|
-
if (s
|
|
981
|
+
if (!s) return;
|
|
967
982
|
const view = viewOf(s);
|
|
968
983
|
if (view instanceof OmitView) {
|
|
969
984
|
resolved.push(view);
|
|
@@ -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 = [];
|
|
@@ -1107,30 +1144,28 @@ function claimChildNodes(parent) {
|
|
|
1107
1144
|
function isPlaceholderScaffolding(node, t) {
|
|
1108
1145
|
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
1109
1146
|
}
|
|
1110
|
-
function insert(parent, accessor, marker,
|
|
1147
|
+
function insert(parent, accessor, marker, current, options) {
|
|
1111
1148
|
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
1112
1149
|
...options,
|
|
1113
1150
|
name: spreadName + ".children",
|
|
1114
1151
|
loc: spreadLoc
|
|
1115
1152
|
};
|
|
1116
1153
|
const multi = marker !== undefined;
|
|
1117
|
-
|
|
1118
|
-
if (
|
|
1119
|
-
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
1154
|
+
if (multi && !current) current = [];
|
|
1155
|
+
if (hydrationRt !== null) current = hydrationRt.claimInitial(parent, multi, current);
|
|
1120
1156
|
if (typeof accessor !== "function") {
|
|
1121
|
-
accessor = normalize(accessor,
|
|
1157
|
+
accessor = normalize(accessor, current, multi, true);
|
|
1122
1158
|
if (typeof accessor !== "function") {
|
|
1123
|
-
insertExpression(parent, accessor,
|
|
1124
|
-
host &&
|
|
1159
|
+
insertExpression(parent, accessor, current, marker);
|
|
1160
|
+
hostRt !== null && options && options.host && hostRt(accessor, options.host);
|
|
1125
1161
|
return;
|
|
1126
1162
|
}
|
|
1127
1163
|
}
|
|
1128
|
-
if (multi &&
|
|
1164
|
+
if (multi && current.length === 0) {
|
|
1129
1165
|
const placeholder = document.createTextNode("");
|
|
1130
1166
|
parent.insertBefore(placeholder, marker);
|
|
1131
|
-
|
|
1167
|
+
current = [placeholder];
|
|
1132
1168
|
}
|
|
1133
|
-
let current = initial;
|
|
1134
1169
|
let ran = false;
|
|
1135
1170
|
effect(() => {
|
|
1136
1171
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
@@ -1146,7 +1181,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1146
1181
|
} : options;
|
|
1147
1182
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
1148
1183
|
current = insertExpression(parent, inner, current, marker);
|
|
1149
|
-
host &&
|
|
1184
|
+
hostRt !== null && options && options.host && hostRt(current, options.host);
|
|
1150
1185
|
}, {
|
|
1151
1186
|
...innerOptions,
|
|
1152
1187
|
_wide: true
|
|
@@ -1156,7 +1191,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1156
1191
|
}, value => {
|
|
1157
1192
|
if (value === INNER_OWNED) return;
|
|
1158
1193
|
current = insertExpression(parent, value, current, marker);
|
|
1159
|
-
host &&
|
|
1194
|
+
hostRt !== null && options && options.host && hostRt(current, options.host);
|
|
1160
1195
|
},
|
|
1161
1196
|
accessor.$s ? options ? {
|
|
1162
1197
|
...options,
|
|
@@ -1369,6 +1404,7 @@ function initHeadRegistry() {
|
|
|
1369
1404
|
headRegistrations = [];
|
|
1370
1405
|
headOwned = new Map();
|
|
1371
1406
|
headApplied = new Map();
|
|
1407
|
+
setSwapHook(scheduleHeadApply);
|
|
1372
1408
|
const t = document.querySelector("title");
|
|
1373
1409
|
headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
|
|
1374
1410
|
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
@@ -1419,7 +1455,7 @@ function flushHeadRegistry() {
|
|
|
1419
1455
|
return;
|
|
1420
1456
|
}
|
|
1421
1457
|
headScheduled = false;
|
|
1422
|
-
const winners = resolveHead(headRegistrations);
|
|
1458
|
+
const winners = resolveHead(headRegistrations.filter(r => !isHidden(r.node)));
|
|
1423
1459
|
for (const [identity, els] of headOwned) {
|
|
1424
1460
|
if (winners.has(identity)) continue;
|
|
1425
1461
|
headOwned.delete(identity);
|
|
@@ -1533,10 +1569,12 @@ function useHead(tags) {
|
|
|
1533
1569
|
initHeadRegistry();
|
|
1534
1570
|
const reg = {
|
|
1535
1571
|
seq: -1,
|
|
1536
|
-
tags: null
|
|
1572
|
+
tags: null,
|
|
1573
|
+
node: null
|
|
1537
1574
|
};
|
|
1538
1575
|
const uid = ++headUid;
|
|
1539
1576
|
effect(() => {
|
|
1577
|
+
reg.node = getOwner();
|
|
1540
1578
|
let list = typeof tags === "function" ? tags() : tags;
|
|
1541
1579
|
if (!Array.isArray(list)) list = [list];
|
|
1542
1580
|
const replaceable = [];
|
|
@@ -1729,7 +1767,8 @@ function getNextElement(template) {
|
|
|
1729
1767
|
}
|
|
1730
1768
|
if (isHydrating()) {
|
|
1731
1769
|
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>).`
|
|
1770
|
+
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>).` + (
|
|
1771
|
+
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
1772
|
}
|
|
1734
1773
|
return template(true);
|
|
1735
1774
|
}
|
|
@@ -1916,10 +1955,11 @@ function flattenClassList(list, result) {
|
|
|
1916
1955
|
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1917
1956
|
}
|
|
1918
1957
|
}
|
|
1958
|
+
let spreadHeld = 0;
|
|
1919
1959
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
1920
1960
|
if (prop === "style") return style(node, value, prev), value;
|
|
1921
1961
|
if (prop === "class") return className(node, value, prev), value;
|
|
1922
|
-
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
1962
|
+
if (value === prev && (spreadHeld || DOMWithState[nodeName]?.[prop] !== 1)) return prev;
|
|
1923
1963
|
if (prop === "ref") {
|
|
1924
1964
|
if (!skipRef && value) ref(() => value, node);
|
|
1925
1965
|
return value;
|
|
@@ -1966,37 +2006,32 @@ function eventHandler(e, container, state) {
|
|
|
1966
2006
|
e[$$EVENT_OWNER] = owner;
|
|
1967
2007
|
let node = resumeNode || e.target;
|
|
1968
2008
|
const key = EVENT_KEY + e.type;
|
|
1969
|
-
const
|
|
2009
|
+
const define = (name, value) => Object.defineProperty(e, name, {
|
|
1970
2010
|
configurable: true,
|
|
1971
2011
|
value
|
|
1972
2012
|
});
|
|
1973
2013
|
const handleNode = () => {
|
|
1974
2014
|
const handler = node[key];
|
|
1975
2015
|
if (handler && !node.disabled) {
|
|
2016
|
+
define("currentTarget", node);
|
|
1976
2017
|
const data = node[`${key}Data`];
|
|
1977
2018
|
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1978
2019
|
if (e.cancelBubble) return;
|
|
1979
2020
|
}
|
|
1980
|
-
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) &&
|
|
2021
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && define("target", node.host);
|
|
1981
2022
|
return true;
|
|
1982
2023
|
};
|
|
1983
2024
|
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1984
2025
|
const walkUpTree = () => {
|
|
1985
2026
|
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1986
2027
|
};
|
|
1987
|
-
Object.defineProperty(e, "currentTarget", {
|
|
1988
|
-
configurable: true,
|
|
1989
|
-
get() {
|
|
1990
|
-
return node || owner;
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
2028
|
if (resumeNode) {
|
|
1994
2029
|
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1995
2030
|
if (node && node !== owner) walkUpTree();
|
|
1996
2031
|
} else if (e.composedPath) {
|
|
1997
2032
|
const path = e.composedPath();
|
|
1998
2033
|
if (path.length) {
|
|
1999
|
-
|
|
2034
|
+
define("target", path[0]);
|
|
2000
2035
|
for (let i = 0; i < path.length; i++) {
|
|
2001
2036
|
node = path[i];
|
|
2002
2037
|
if (!handleNode()) break;
|
|
@@ -2021,6 +2056,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2021
2056
|
for (const n of arr ? value : [value]) {
|
|
2022
2057
|
if (n && n.nodeType) {
|
|
2023
2058
|
if (!isHydrating(n)) return current;
|
|
2059
|
+
if (n.nodeType === 1 && parent.nodeType === 1) checkParserMoved(parent, n);
|
|
2024
2060
|
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
2025
2061
|
return current;
|
|
2026
2062
|
}
|
|
@@ -2033,8 +2069,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2033
2069
|
const tracked = [].concat(current ?? []);
|
|
2034
2070
|
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
2035
2071
|
}
|
|
2036
|
-
const t = typeof value
|
|
2037
|
-
multi = marker !== undefined;
|
|
2072
|
+
const t = typeof value;
|
|
2038
2073
|
if (t === "string" || t === "number") {
|
|
2039
2074
|
const tc = typeof current;
|
|
2040
2075
|
if (tc === "string" || tc === "number") {
|
|
@@ -2049,7 +2084,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2049
2084
|
cleanChildren(parent, current, marker);
|
|
2050
2085
|
} else if (value.nodeType) {
|
|
2051
2086
|
if (Array.isArray(current)) {
|
|
2052
|
-
cleanChildren(parent, current,
|
|
2087
|
+
cleanChildren(parent, current, marker ?? null, value);
|
|
2053
2088
|
} else if (current != null && current.nodeType) {
|
|
2054
2089
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
2055
2090
|
} else if (current != null && parent.firstChild) {
|
|
@@ -2066,7 +2101,8 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2066
2101
|
if (t === "string" || t === "number") {
|
|
2067
2102
|
const prev = currentArray ? current[i] : undefined;
|
|
2068
2103
|
if (prev && prev.nodeType === 3) {
|
|
2069
|
-
|
|
2104
|
+
const last = prev._$d;
|
|
2105
|
+
if (last !== item && (last !== undefined || prev.data !== "" + item)) prev.data = prev._$d = item;
|
|
2070
2106
|
value[i] = prev;
|
|
2071
2107
|
} else value[i] = document.createTextNode(item);
|
|
2072
2108
|
}
|
|
@@ -2135,13 +2171,16 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
2135
2171
|
}
|
|
2136
2172
|
return value;
|
|
2137
2173
|
}
|
|
2174
|
+
function hostGetter() {
|
|
2175
|
+
return this[$$HOST]();
|
|
2176
|
+
}
|
|
2138
2177
|
function tagHost(value, host) {
|
|
2139
2178
|
if (Array.isArray(value)) {
|
|
2140
2179
|
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
2141
2180
|
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
2142
2181
|
value[$$HOST] = host;
|
|
2143
2182
|
Object.defineProperty(value, "_$host", {
|
|
2144
|
-
get:
|
|
2183
|
+
get: hostGetter,
|
|
2145
2184
|
configurable: true
|
|
2146
2185
|
});
|
|
2147
2186
|
}
|
|
@@ -2402,6 +2441,7 @@ function portalImpl(props) {
|
|
|
2402
2441
|
const m = untrack(mount);
|
|
2403
2442
|
m.appendChild(endMarker);
|
|
2404
2443
|
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
2444
|
+
installHostTagging();
|
|
2405
2445
|
insert(m, c, endMarker, undefined, {
|
|
2406
2446
|
host: () => treeMarker.parentNode
|
|
2407
2447
|
});
|
|
@@ -2487,4 +2527,4 @@ _moduleUrl) {
|
|
|
2487
2527
|
function httpStatus(_code, _text) {}
|
|
2488
2528
|
function httpHeader(_name, _value, _options) {}
|
|
2489
2529
|
|
|
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 };
|
|
2530
|
+
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 };
|