@solidjs/web 2.0.0-rc.20 → 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 +521 -280
- package/dist/server.js +518 -279
- package/dist/server.observe.js +518 -279
- package/dist/web.dev.js +142 -106
- package/dist/web.js +120 -105
- package/dist/web.observe.js +120 -105
- 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 +124 -68
- package/frames/dist/server.js +124 -68
- package/frames/dist/server.observe.js +124 -68
- package/frames/dist/wire.js +1 -1
- package/package.json +2 -2
- package/serialization/dist/serialization.js +53 -12
- package/serialization/types/index.d.ts +42 -0
- package/serialization/types/serializer.d.ts +42 -0
- 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/server-functions/dist/rich-args.js +27 -9
- package/server-functions/dist/server.dev.js +122 -36
- package/server-functions/dist/server.js +122 -36
- package/server-functions/dist/server.observe.js +122 -36
- 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 +42 -0
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +42 -0
- package/types/server-functions/client.d.ts +0 -1
- package/types/server-functions/server.d.ts +0 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server-functions/uploads.d.ts +3 -0
- package/types/server-mock.d.ts +35 -8
- package/types/server.d.ts +89 -18
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
|
}
|
|
@@ -540,16 +536,11 @@ function render(code, element, init, options = {}) {
|
|
|
540
536
|
createRoot(dispose => {
|
|
541
537
|
disposer = dispose;
|
|
542
538
|
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
549
|
-
...options.insertOptions,
|
|
550
|
-
schedule: true
|
|
551
|
-
});
|
|
552
|
-
}
|
|
539
|
+
const tree = code();
|
|
540
|
+
if (element === document) effect(() => flatten(tree), () => {});else insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
541
|
+
...options.insertOptions,
|
|
542
|
+
schedule: true
|
|
543
|
+
});
|
|
553
544
|
}, {
|
|
554
545
|
id: options.renderId
|
|
555
546
|
});
|
|
@@ -567,12 +558,20 @@ function render(code, element, init, options = {}) {
|
|
|
567
558
|
element.textContent = "";
|
|
568
559
|
};
|
|
569
560
|
}
|
|
561
|
+
let policy;
|
|
562
|
+
function setTrustedTypesPolicy(value) {
|
|
563
|
+
policy = value;
|
|
564
|
+
}
|
|
565
|
+
function trustedHTML(html) {
|
|
566
|
+
return policy ? policy.createHTML(html) : html;
|
|
567
|
+
}
|
|
570
568
|
function create(html, bypassGuard, flag) {
|
|
571
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.");
|
|
572
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.");
|
|
573
571
|
const t = document.createElement("template");
|
|
574
|
-
t.innerHTML = html;
|
|
575
|
-
|
|
572
|
+
t.innerHTML = policy ? policy.createHTML(html) : html;
|
|
573
|
+
const node = t.content.firstChild;
|
|
574
|
+
return flag === 2 ? node.firstChild : node;
|
|
576
575
|
}
|
|
577
576
|
function template(html, flag) {
|
|
578
577
|
let node;
|
|
@@ -581,8 +580,7 @@ function template(html, flag) {
|
|
|
581
580
|
return fn;
|
|
582
581
|
}
|
|
583
582
|
function delegateEvents(eventNames) {
|
|
584
|
-
for (
|
|
585
|
-
const name = eventNames[i];
|
|
583
|
+
for (const name of eventNames) {
|
|
586
584
|
if (!delegatedEvents.has(name)) {
|
|
587
585
|
delegatedEvents.add(name);
|
|
588
586
|
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
@@ -650,9 +648,10 @@ function dispatchAsInteraction(e, fn) {
|
|
|
650
648
|
function getDelegatedRoot(node) {
|
|
651
649
|
while (node) {
|
|
652
650
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
653
|
-
node = node
|
|
651
|
+
node = parentOf(node);
|
|
654
652
|
}
|
|
655
653
|
}
|
|
654
|
+
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
656
655
|
function findOwner(target, state) {
|
|
657
656
|
let node = target;
|
|
658
657
|
let distance = 0;
|
|
@@ -662,7 +661,7 @@ function findOwner(target, state) {
|
|
|
662
661
|
distance
|
|
663
662
|
};
|
|
664
663
|
distance++;
|
|
665
|
-
node = node
|
|
664
|
+
node = parentOf(node);
|
|
666
665
|
}
|
|
667
666
|
}
|
|
668
667
|
function setProperty(node, name, value) {
|
|
@@ -681,6 +680,9 @@ function setStatefulProperty(node, name, value) {
|
|
|
681
680
|
node[name] = value;
|
|
682
681
|
recordStatefulWrite(node, name, value);
|
|
683
682
|
}
|
|
683
|
+
function strictHandler(fn) {
|
|
684
|
+
return strictReadTracked(fn) ;
|
|
685
|
+
}
|
|
684
686
|
let claimHandlers = null;
|
|
685
687
|
const claimAttributeSets = [];
|
|
686
688
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -766,7 +768,7 @@ function className(node, value, prev) {
|
|
|
766
768
|
return;
|
|
767
769
|
}
|
|
768
770
|
if (typeof value === "string") {
|
|
769
|
-
node._$classes = undefined;
|
|
771
|
+
if (node._$classes) node._$classes = undefined;
|
|
770
772
|
value !== prev && node.setAttribute("class", value);
|
|
771
773
|
return;
|
|
772
774
|
}
|
|
@@ -889,14 +891,22 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
889
891
|
}
|
|
890
892
|
const prevProps = {};
|
|
891
893
|
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
894
|
+
let held = 0;
|
|
892
895
|
const apply = newProps => {
|
|
893
896
|
const r = newProps.ref;
|
|
894
897
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
898
|
+
spreadHeld = held;
|
|
895
899
|
assign(node, newProps, true, prevProps, true);
|
|
900
|
+
spreadHeld = 0;
|
|
896
901
|
if (owner !== undefined) claimElement(node, owner);
|
|
897
902
|
};
|
|
903
|
+
const read = fn => () => {
|
|
904
|
+
const p = fn();
|
|
905
|
+
held = heldRead();
|
|
906
|
+
return p;
|
|
907
|
+
};
|
|
898
908
|
if (Array.isArray(props)) {
|
|
899
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
909
|
+
effect(read(() => collectSources({}, props, undefined, skip)), apply);
|
|
900
910
|
unscopedByDesign = node;
|
|
901
911
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
902
912
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
@@ -907,7 +917,7 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
907
917
|
unscopedByDesign = null;
|
|
908
918
|
return prevProps;
|
|
909
919
|
}
|
|
910
|
-
|
|
920
|
+
const collect = () => {
|
|
911
921
|
const source = resolveSource(props);
|
|
912
922
|
const newProps = {};
|
|
913
923
|
const table = resolvedTable(source);
|
|
@@ -917,7 +927,8 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
917
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);
|
|
918
928
|
}
|
|
919
929
|
return newProps;
|
|
920
|
-
}
|
|
930
|
+
};
|
|
931
|
+
effect(read(collect), apply);
|
|
921
932
|
unscopedByDesign = node;
|
|
922
933
|
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
923
934
|
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
@@ -1007,7 +1018,7 @@ function applyRef(r, element) {
|
|
|
1007
1018
|
}
|
|
1008
1019
|
function ref(fn, element) {
|
|
1009
1020
|
const resolved = untrack(fn);
|
|
1010
|
-
|
|
1021
|
+
runRefCallback(() => applyRef(resolved, element));
|
|
1011
1022
|
}
|
|
1012
1023
|
function scope(fn) {
|
|
1013
1024
|
fn.$s = true;
|
|
@@ -1040,6 +1051,29 @@ function checkUnscopedHole(snapshot, accessor, parent) {
|
|
|
1040
1051
|
}
|
|
1041
1052
|
let hydrationRt = null;
|
|
1042
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
|
+
}
|
|
1043
1077
|
function installHydrationRuntime() {
|
|
1044
1078
|
hydrationRt = {
|
|
1045
1079
|
claimInitial(parent, multi, initial) {
|
|
@@ -1050,8 +1084,7 @@ function installHydrationRuntime() {
|
|
|
1050
1084
|
},
|
|
1051
1085
|
reclaimRegion(current, parent, marker) {
|
|
1052
1086
|
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
1053
|
-
|
|
1054
|
-
if (first == null || first.isConnected) return current;
|
|
1087
|
+
if (Array.isArray(current) ? current.every(n => !n || n.isConnected) : current.isConnected) return current;
|
|
1055
1088
|
let nodes;
|
|
1056
1089
|
if (marker) {
|
|
1057
1090
|
nodes = [];
|
|
@@ -1125,7 +1158,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1125
1158
|
accessor = normalize(accessor, initial, multi, true);
|
|
1126
1159
|
if (typeof accessor !== "function") {
|
|
1127
1160
|
insertExpression(parent, accessor, initial, marker);
|
|
1128
|
-
host &&
|
|
1161
|
+
hostRt !== null && host && hostRt(accessor, host);
|
|
1129
1162
|
return;
|
|
1130
1163
|
}
|
|
1131
1164
|
}
|
|
@@ -1150,7 +1183,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1150
1183
|
} : options;
|
|
1151
1184
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
1152
1185
|
current = insertExpression(parent, inner, current, marker);
|
|
1153
|
-
host &&
|
|
1186
|
+
hostRt !== null && host && hostRt(current, host);
|
|
1154
1187
|
}, {
|
|
1155
1188
|
...innerOptions,
|
|
1156
1189
|
_wide: true
|
|
@@ -1160,7 +1193,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1160
1193
|
}, value => {
|
|
1161
1194
|
if (value === INNER_OWNED) return;
|
|
1162
1195
|
current = insertExpression(parent, value, current, marker);
|
|
1163
|
-
host &&
|
|
1196
|
+
hostRt !== null && host && hostRt(current, host);
|
|
1164
1197
|
},
|
|
1165
1198
|
accessor.$s ? options ? {
|
|
1166
1199
|
...options,
|
|
@@ -1244,7 +1277,7 @@ function trackAssetLoad(entry, adopted) {
|
|
|
1244
1277
|
}
|
|
1245
1278
|
entry.loadState = "pending";
|
|
1246
1279
|
entry.loadPromise = new Promise(resolve => {
|
|
1247
|
-
const settle = state => {
|
|
1280
|
+
const settle = entry.settle = state => {
|
|
1248
1281
|
entry.loadState = state;
|
|
1249
1282
|
resolve();
|
|
1250
1283
|
};
|
|
@@ -1356,6 +1389,7 @@ function acquireAsset(descriptor) {
|
|
|
1356
1389
|
entry.timer = setTimeout(() => {
|
|
1357
1390
|
assetRegistry.delete(key);
|
|
1358
1391
|
entry.element && entry.element.remove();
|
|
1392
|
+
if (entry.loadState === "pending") entry.settle("errored");
|
|
1359
1393
|
}, ASSET_REMOVAL_GRACE);
|
|
1360
1394
|
};
|
|
1361
1395
|
}
|
|
@@ -1372,6 +1406,7 @@ function initHeadRegistry() {
|
|
|
1372
1406
|
headRegistrations = [];
|
|
1373
1407
|
headOwned = new Map();
|
|
1374
1408
|
headApplied = new Map();
|
|
1409
|
+
setSwapHook(scheduleHeadApply);
|
|
1375
1410
|
const t = document.querySelector("title");
|
|
1376
1411
|
headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
|
|
1377
1412
|
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
@@ -1422,7 +1457,7 @@ function flushHeadRegistry() {
|
|
|
1422
1457
|
return;
|
|
1423
1458
|
}
|
|
1424
1459
|
headScheduled = false;
|
|
1425
|
-
const winners = resolveHead(headRegistrations);
|
|
1460
|
+
const winners = resolveHead(headRegistrations.filter(r => !isHidden(r.node)));
|
|
1426
1461
|
for (const [identity, els] of headOwned) {
|
|
1427
1462
|
if (winners.has(identity)) continue;
|
|
1428
1463
|
headOwned.delete(identity);
|
|
@@ -1536,10 +1571,12 @@ function useHead(tags) {
|
|
|
1536
1571
|
initHeadRegistry();
|
|
1537
1572
|
const reg = {
|
|
1538
1573
|
seq: -1,
|
|
1539
|
-
tags: null
|
|
1574
|
+
tags: null,
|
|
1575
|
+
node: null
|
|
1540
1576
|
};
|
|
1541
1577
|
const uid = ++headUid;
|
|
1542
1578
|
effect(() => {
|
|
1579
|
+
reg.node = getOwner();
|
|
1543
1580
|
let list = typeof tags === "function" ? tags() : tags;
|
|
1544
1581
|
if (!Array.isArray(list)) list = [list];
|
|
1545
1582
|
const replaceable = [];
|
|
@@ -1732,7 +1769,8 @@ function getNextElement(template) {
|
|
|
1732
1769
|
}
|
|
1733
1770
|
if (isHydrating()) {
|
|
1734
1771
|
hydrationKeyMisses++;
|
|
1735
|
-
console.warn(`Hydration key miss for "${key}": no server-rendered element carries this key` + (template._html ? ` (template: ${template._html.slice(0, 60)})` : "") + `. A detached element was created instead; its subtree will not appear in the ` + `document or become interactive. This usually means the server and client ` + `hydration id namespaces are misaligned — when hydrating a subtree of a larger ` + `server render, wrap the document shell in <NoHydration> and re-enter with ` + `<Hydration> around the hydrated subtree (or pass hydrate() a renderId matching ` + `the server's <Hydration id>).`
|
|
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.` : ""));
|
|
1736
1774
|
}
|
|
1737
1775
|
return template(true);
|
|
1738
1776
|
}
|
|
@@ -1919,10 +1957,11 @@ function flattenClassList(list, result) {
|
|
|
1919
1957
|
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1920
1958
|
}
|
|
1921
1959
|
}
|
|
1960
|
+
let spreadHeld = 0;
|
|
1922
1961
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
1923
1962
|
if (prop === "style") return style(node, value, prev), value;
|
|
1924
1963
|
if (prop === "class") return className(node, value, prev), value;
|
|
1925
|
-
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
1964
|
+
if (value === prev && (spreadHeld || DOMWithState[nodeName]?.[prop] !== 1)) return prev;
|
|
1926
1965
|
if (prop === "ref") {
|
|
1927
1966
|
if (!skipRef && value) ref(() => value, node);
|
|
1928
1967
|
return value;
|
|
@@ -1969,39 +2008,32 @@ function eventHandler(e, container, state) {
|
|
|
1969
2008
|
e[$$EVENT_OWNER] = owner;
|
|
1970
2009
|
let node = resumeNode || e.target;
|
|
1971
2010
|
const key = EVENT_KEY + e.type;
|
|
1972
|
-
const
|
|
2011
|
+
const define = (name, value) => Object.defineProperty(e, name, {
|
|
1973
2012
|
configurable: true,
|
|
1974
2013
|
value
|
|
1975
2014
|
});
|
|
1976
2015
|
const handleNode = () => {
|
|
1977
2016
|
const handler = node[key];
|
|
1978
2017
|
if (handler && !node.disabled) {
|
|
2018
|
+
define("currentTarget", node);
|
|
1979
2019
|
const data = node[`${key}Data`];
|
|
1980
2020
|
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1981
2021
|
if (e.cancelBubble) return;
|
|
1982
2022
|
}
|
|
1983
|
-
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);
|
|
1984
2024
|
return true;
|
|
1985
2025
|
};
|
|
2026
|
+
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1986
2027
|
const walkUpTree = () => {
|
|
1987
|
-
while (node && handleNode())
|
|
1988
|
-
if (node === owner || node.parentNode === owner) break;
|
|
1989
|
-
node = node._$host || node.parentNode || node.host;
|
|
1990
|
-
}
|
|
2028
|
+
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1991
2029
|
};
|
|
1992
|
-
Object.defineProperty(e, "currentTarget", {
|
|
1993
|
-
configurable: true,
|
|
1994
|
-
get() {
|
|
1995
|
-
return node || owner;
|
|
1996
|
-
}
|
|
1997
|
-
});
|
|
1998
2030
|
if (resumeNode) {
|
|
1999
|
-
if (resumeNode === e.target) node = resumeNode
|
|
2031
|
+
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
2000
2032
|
if (node && node !== owner) walkUpTree();
|
|
2001
2033
|
} else if (e.composedPath) {
|
|
2002
2034
|
const path = e.composedPath();
|
|
2003
2035
|
if (path.length) {
|
|
2004
|
-
|
|
2036
|
+
define("target", path[0]);
|
|
2005
2037
|
for (let i = 0; i < path.length; i++) {
|
|
2006
2038
|
node = path[i];
|
|
2007
2039
|
if (!handleNode()) break;
|
|
@@ -2010,9 +2042,7 @@ function eventHandler(e, container, state) {
|
|
|
2010
2042
|
walkUpTree();
|
|
2011
2043
|
break;
|
|
2012
2044
|
}
|
|
2013
|
-
if (
|
|
2014
|
-
break;
|
|
2015
|
-
}
|
|
2045
|
+
if (atOwner()) break;
|
|
2016
2046
|
}
|
|
2017
2047
|
} else walkUpTree();
|
|
2018
2048
|
}
|
|
@@ -2028,6 +2058,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2028
2058
|
for (const n of arr ? value : [value]) {
|
|
2029
2059
|
if (n && n.nodeType) {
|
|
2030
2060
|
if (!isHydrating(n)) return current;
|
|
2061
|
+
if (n.nodeType === 1 && parent.nodeType === 1) checkParserMoved(parent, n);
|
|
2031
2062
|
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
2032
2063
|
return current;
|
|
2033
2064
|
}
|
|
@@ -2073,7 +2104,8 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2073
2104
|
if (t === "string" || t === "number") {
|
|
2074
2105
|
const prev = currentArray ? current[i] : undefined;
|
|
2075
2106
|
if (prev && prev.nodeType === 3) {
|
|
2076
|
-
|
|
2107
|
+
const last = prev._$d;
|
|
2108
|
+
if (last !== item && (last !== undefined || prev.data !== "" + item)) prev.data = prev._$d = item;
|
|
2077
2109
|
value[i] = prev;
|
|
2078
2110
|
} else value[i] = document.createTextNode(item);
|
|
2079
2111
|
}
|
|
@@ -2142,13 +2174,16 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
2142
2174
|
}
|
|
2143
2175
|
return value;
|
|
2144
2176
|
}
|
|
2177
|
+
function hostGetter() {
|
|
2178
|
+
return this[$$HOST]();
|
|
2179
|
+
}
|
|
2145
2180
|
function tagHost(value, host) {
|
|
2146
2181
|
if (Array.isArray(value)) {
|
|
2147
2182
|
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
2148
2183
|
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
2149
2184
|
value[$$HOST] = host;
|
|
2150
2185
|
Object.defineProperty(value, "_$host", {
|
|
2151
|
-
get:
|
|
2186
|
+
get: hostGetter,
|
|
2152
2187
|
configurable: true
|
|
2153
2188
|
});
|
|
2154
2189
|
}
|
|
@@ -2409,6 +2444,7 @@ function portalImpl(props) {
|
|
|
2409
2444
|
const m = untrack(mount);
|
|
2410
2445
|
m.appendChild(endMarker);
|
|
2411
2446
|
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
2447
|
+
installHostTagging();
|
|
2412
2448
|
insert(m, c, endMarker, undefined, {
|
|
2413
2449
|
host: () => treeMarker.parentNode
|
|
2414
2450
|
});
|
|
@@ -2494,4 +2530,4 @@ _moduleUrl) {
|
|
|
2494
2530
|
function httpStatus(_code, _text) {}
|
|
2495
2531
|
function httpHeader(_name, _value, _options) {}
|
|
2496
2532
|
|
|
2497
|
-
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 };
|