@solidjs/web 2.0.0-rc.15 → 2.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/server.dev.js +358 -479
- package/dist/server.js +343 -387
- package/dist/server.observe.js +343 -387
- package/dist/web.dev.js +57 -54
- package/dist/web.js +47 -49
- package/dist/web.observe.js +57 -54
- package/frames/dist/client.dev.js +610 -621
- package/frames/dist/client.js +540 -566
- package/frames/dist/client.observe.js +571 -573
- package/frames/dist/regions.js +43 -2
- package/frames/dist/server.dev.js +514 -423
- package/frames/dist/server.js +514 -370
- package/frames/dist/server.observe.js +514 -370
- package/frames/dist/wire.js +371 -6
- package/package.json +11 -11
- package/serialization/dist/decode.js +9 -7
- package/serialization/dist/serialization.js +9 -7
- package/serialization/types/serializer-decode.d.ts +2 -2
- package/server-functions/dist/client.dev.js +3 -1
- package/server-functions/dist/client.js +1 -1
- package/server-functions/dist/client.observe.js +3 -1
- package/server-functions/dist/rich-args.js +33 -1
- package/server-functions/dist/server.dev.js +127 -18
- package/server-functions/dist/server.js +127 -18
- package/server-functions/dist/server.observe.js +127 -18
- package/skills/server-components/SKILL.md +74 -185
- package/types/client.d.ts +15 -5
- package/types/frames/assets-tier.d.ts +2 -2
- package/types/frames/client.d.ts +8 -3
- package/types/frames/frame-client.d.ts +121 -157
- package/types/frames/frame-morph.d.ts +28 -0
- package/types/frames/frame-sink.d.ts +13 -9
- package/types/frames/frame-transport.d.ts +30 -1
- package/types/frames/regions-tier.d.ts +15 -0
- package/types/frames/serializer-decode.d.ts +2 -2
- package/types/frames/server.d.ts +0 -52
- package/types/frames/wire-tier.d.ts +54 -1
- package/types/index.d.ts +2 -2
- package/types/jsx.d.ts +11 -5
- package/types/observe.d.ts +14 -7
- package/types/render.d.ts +3 -1
- package/types/response.d.ts +5 -4
- package/types/serializer-decode.d.ts +2 -2
- package/types/server-functions/argument-codec.d.ts +21 -0
- package/types/server-functions/client.d.ts +14 -5
- package/types/server-functions/server.d.ts +6 -2
- package/types/server-functions/shared.d.ts +19 -0
- package/types/server-observe.d.ts +3 -2
- package/types/server.d.ts +57 -76
- package/frames/dist/bind.dev.js +0 -326
- package/frames/dist/bind.js +0 -295
- package/types/frames/bind-tier.d.ts +0 -60
package/dist/web.dev.js
CHANGED
|
@@ -56,8 +56,10 @@ const transparentOptions = {
|
|
|
56
56
|
sync: true
|
|
57
57
|
};
|
|
58
58
|
let spreadName;
|
|
59
|
-
|
|
59
|
+
let spreadLoc;
|
|
60
|
+
function setSpreadName(name, loc) {
|
|
60
61
|
spreadName = name;
|
|
62
|
+
spreadLoc = loc;
|
|
61
63
|
}
|
|
62
64
|
const syncOptions = {
|
|
63
65
|
sync: true
|
|
@@ -69,7 +71,8 @@ function tagElement(node) {
|
|
|
69
71
|
function effect(fn, effectFn, options) {
|
|
70
72
|
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
71
73
|
...options,
|
|
72
|
-
name: spreadName + ".spread"
|
|
74
|
+
name: spreadName + ".spread",
|
|
75
|
+
loc: spreadLoc
|
|
73
76
|
};
|
|
74
77
|
const nodeOptions = options ? {
|
|
75
78
|
sync: true,
|
|
@@ -98,40 +101,39 @@ function memo(fn) {
|
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
104
|
+
const isLive = n => {
|
|
105
|
+
if (!n) return false;
|
|
106
|
+
const tag = n[$$SLOT];
|
|
107
|
+
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
108
|
+
};
|
|
101
109
|
let bLength = b.length,
|
|
102
110
|
aEnd = a.length,
|
|
103
111
|
bEnd = bLength,
|
|
104
112
|
aStart = 0,
|
|
105
113
|
bStart = 0,
|
|
106
114
|
tail = a[aEnd - 1],
|
|
107
|
-
|
|
108
|
-
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
115
|
+
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
109
116
|
map = null,
|
|
110
117
|
anchor,
|
|
111
118
|
anchorTag;
|
|
112
|
-
const isLive = n => {
|
|
113
|
-
if (!n) return false;
|
|
114
|
-
const tag = n[$$SLOT];
|
|
115
|
-
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
116
|
-
};
|
|
117
119
|
while (aStart < aEnd || bStart < bEnd) {
|
|
118
|
-
if (a[aStart] === b[bStart]
|
|
120
|
+
if (a[aStart] === b[bStart]) {
|
|
119
121
|
aStart++;
|
|
120
122
|
bStart++;
|
|
121
123
|
continue;
|
|
122
124
|
}
|
|
123
|
-
while (a[aEnd - 1] === b[bEnd - 1]
|
|
125
|
+
while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
|
|
124
126
|
aEnd--;
|
|
125
127
|
bEnd--;
|
|
126
128
|
}
|
|
127
129
|
if (aEnd === aStart) {
|
|
128
130
|
let node;
|
|
129
131
|
if (bEnd < bLength) {
|
|
130
|
-
if (bStart) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
node =
|
|
134
|
-
}
|
|
132
|
+
if (bStart && isLive(node = b[bStart - 1])) node = node.nextSibling;else {
|
|
133
|
+
let k = bEnd;
|
|
134
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
135
|
+
node = k < bLength ? b[k] : after;
|
|
136
|
+
}
|
|
135
137
|
} else node = after;
|
|
136
138
|
while (bStart < bEnd) {
|
|
137
139
|
const n = b[bStart++];
|
|
@@ -141,10 +143,7 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
141
143
|
} else if (bEnd === bStart) {
|
|
142
144
|
while (aStart < aEnd) {
|
|
143
145
|
const n = a[aStart++];
|
|
144
|
-
if (!map || !map.has(n))
|
|
145
|
-
const tag = n[$$SLOT];
|
|
146
|
-
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
147
|
-
}
|
|
146
|
+
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
148
147
|
}
|
|
149
148
|
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
150
149
|
if (marker) {
|
|
@@ -163,6 +162,10 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
163
162
|
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
164
163
|
}
|
|
165
164
|
} else {
|
|
165
|
+
if (!isLive(a[aStart])) {
|
|
166
|
+
aStart++;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
166
169
|
if (!map) {
|
|
167
170
|
map = new Map();
|
|
168
171
|
let i = bStart;
|
|
@@ -179,31 +182,19 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
179
182
|
sequence++;
|
|
180
183
|
}
|
|
181
184
|
if (sequence > index - bStart) {
|
|
182
|
-
const
|
|
183
|
-
const headTag = head[$$SLOT];
|
|
184
|
-
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
185
|
+
const node = a[aStart];
|
|
185
186
|
while (bStart < index) {
|
|
186
187
|
const n = b[bStart++];
|
|
187
188
|
parentNode.insertBefore(n, node);
|
|
188
189
|
if (marker) n[$$SLOT] = marker;
|
|
189
190
|
}
|
|
190
191
|
} else {
|
|
191
|
-
const oldNode = a[aStart++];
|
|
192
192
|
const newNode = b[bStart++];
|
|
193
|
-
|
|
194
|
-
if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
|
|
195
|
-
parentNode.replaceChild(newNode, oldNode);
|
|
196
|
-
} else {
|
|
197
|
-
parentNode.insertBefore(newNode, after);
|
|
198
|
-
}
|
|
193
|
+
parentNode.replaceChild(newNode, a[aStart++]);
|
|
199
194
|
if (marker) newNode[$$SLOT] = marker;
|
|
200
195
|
}
|
|
201
196
|
} else aStart++;
|
|
202
|
-
} else
|
|
203
|
-
const n = a[aStart++];
|
|
204
|
-
const nTag = n[$$SLOT];
|
|
205
|
-
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
206
|
-
}
|
|
197
|
+
} else a[aStart++].remove();
|
|
207
198
|
}
|
|
208
199
|
}
|
|
209
200
|
}
|
|
@@ -846,14 +837,15 @@ function setStyleProperty(node, name, value) {
|
|
|
846
837
|
if (isHydrating(node)) return;
|
|
847
838
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
848
839
|
}
|
|
849
|
-
function spread(node, props, skipChildren, skip, name) {
|
|
840
|
+
function spread(node, props, skipChildren, skip, name, loc) {
|
|
850
841
|
if (name !== undefined) {
|
|
851
842
|
const outer = spreadName;
|
|
852
|
-
|
|
843
|
+
const outerLoc = spreadLoc;
|
|
844
|
+
setSpreadName(name, loc);
|
|
853
845
|
try {
|
|
854
846
|
return spread(node, props, skipChildren, skip);
|
|
855
847
|
} finally {
|
|
856
|
-
setSpreadName(outer);
|
|
848
|
+
setSpreadName(outer, outerLoc);
|
|
857
849
|
}
|
|
858
850
|
}
|
|
859
851
|
const prevProps = {};
|
|
@@ -1008,6 +1000,7 @@ function checkUnscopedHole(snapshot, accessor, parent) {
|
|
|
1008
1000
|
} : {});
|
|
1009
1001
|
}
|
|
1010
1002
|
let hydrationRt = null;
|
|
1003
|
+
let selectInsert = null;
|
|
1011
1004
|
function installHydrationRuntime() {
|
|
1012
1005
|
hydrationRt = {
|
|
1013
1006
|
claimInitial(parent, multi, initial) {
|
|
@@ -1082,7 +1075,8 @@ function isPlaceholderScaffolding(node, t) {
|
|
|
1082
1075
|
function insert(parent, accessor, marker, initial, options) {
|
|
1083
1076
|
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
1084
1077
|
...options,
|
|
1085
|
-
name: spreadName + ".children"
|
|
1078
|
+
name: spreadName + ".children",
|
|
1079
|
+
loc: spreadLoc
|
|
1086
1080
|
};
|
|
1087
1081
|
const multi = marker !== undefined;
|
|
1088
1082
|
const host = options && options.host;
|
|
@@ -1102,13 +1096,16 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
1102
1096
|
initial = [placeholder];
|
|
1103
1097
|
}
|
|
1104
1098
|
let current = initial;
|
|
1105
|
-
|
|
1099
|
+
let ran = false;
|
|
1100
|
+
effect(() => {
|
|
1106
1101
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
1107
1102
|
const devNext = unscopedHoleSnapshot(accessor, parent) ;
|
|
1108
1103
|
const value = normalize(accessor(), current, multi, true);
|
|
1109
1104
|
checkUnscopedHole(devNext, accessor, parent);
|
|
1105
|
+
const again = ran;
|
|
1106
|
+
ran = true;
|
|
1110
1107
|
if (typeof value !== "function") return value;
|
|
1111
|
-
const innerOptions =
|
|
1108
|
+
const innerOptions = again && !(options && options.schedule) ? {
|
|
1112
1109
|
...options,
|
|
1113
1110
|
schedule: true
|
|
1114
1111
|
} : options;
|
|
@@ -1925,14 +1922,13 @@ function eventHandler(e, container, state) {
|
|
|
1925
1922
|
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1926
1923
|
resumeNode = prev;
|
|
1927
1924
|
}
|
|
1928
|
-
const owner = state
|
|
1929
|
-
if (
|
|
1930
|
-
if (owner
|
|
1931
|
-
e[$$EVENT_OWNER] = owner
|
|
1925
|
+
const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
|
|
1926
|
+
if (!owner) return;
|
|
1927
|
+
if (owner === resumeNode) return;
|
|
1928
|
+
e[$$EVENT_OWNER] = owner;
|
|
1932
1929
|
let node = resumeNode || e.target;
|
|
1933
1930
|
const key = EVENT_KEY + e.type;
|
|
1934
1931
|
const oriTarget = e.target;
|
|
1935
|
-
const boundary = owner || container || e.currentTarget;
|
|
1936
1932
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1937
1933
|
configurable: true,
|
|
1938
1934
|
value
|
|
@@ -1949,19 +1945,19 @@ function eventHandler(e, container, state) {
|
|
|
1949
1945
|
};
|
|
1950
1946
|
const walkUpTree = () => {
|
|
1951
1947
|
while (node && handleNode()) {
|
|
1952
|
-
if (node ===
|
|
1948
|
+
if (node === owner || node.parentNode === owner) break;
|
|
1953
1949
|
node = node._$host || node.parentNode || node.host;
|
|
1954
1950
|
}
|
|
1955
1951
|
};
|
|
1956
1952
|
Object.defineProperty(e, "currentTarget", {
|
|
1957
1953
|
configurable: true,
|
|
1958
1954
|
get() {
|
|
1959
|
-
return node ||
|
|
1955
|
+
return node || owner;
|
|
1960
1956
|
}
|
|
1961
1957
|
});
|
|
1962
1958
|
if (resumeNode) {
|
|
1963
1959
|
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
1964
|
-
if (node && node !==
|
|
1960
|
+
if (node && node !== owner) walkUpTree();
|
|
1965
1961
|
} else if (e.composedPath) {
|
|
1966
1962
|
const path = e.composedPath();
|
|
1967
1963
|
if (path.length) {
|
|
@@ -1974,7 +1970,7 @@ function eventHandler(e, container, state) {
|
|
|
1974
1970
|
walkUpTree();
|
|
1975
1971
|
break;
|
|
1976
1972
|
}
|
|
1977
|
-
if (node ===
|
|
1973
|
+
if (node === owner || node.parentNode === owner) {
|
|
1978
1974
|
break;
|
|
1979
1975
|
}
|
|
1980
1976
|
}
|
|
@@ -1999,7 +1995,10 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1999
1995
|
return value;
|
|
2000
1996
|
}
|
|
2001
1997
|
if (value === current) return value;
|
|
2002
|
-
if (hydrationRt !== null && sharedConfig.hydrating &&
|
|
1998
|
+
if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
|
|
1999
|
+
const tracked = [].concat(current ?? []);
|
|
2000
|
+
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
2001
|
+
}
|
|
2003
2002
|
const t = typeof value,
|
|
2004
2003
|
multi = marker !== undefined;
|
|
2005
2004
|
if (t === "string" || t === "number") {
|
|
@@ -2061,7 +2060,6 @@ function insertExpression(parent, value, current, marker) {
|
|
|
2061
2060
|
selectInsert && selectInsert(parent);
|
|
2062
2061
|
return value;
|
|
2063
2062
|
}
|
|
2064
|
-
let selectInsert;
|
|
2065
2063
|
function selectChange(e) {
|
|
2066
2064
|
(e = e.currentTarget || e)._$v = null;
|
|
2067
2065
|
e.removeEventListener("change", selectChange, true);
|
|
@@ -2094,7 +2092,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
2094
2092
|
});
|
|
2095
2093
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
2096
2094
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
2097
|
-
if (sharedConfig.hydrating && Array.isArray(value)) {
|
|
2095
|
+
if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
|
|
2098
2096
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
2099
2097
|
const item = value[i],
|
|
2100
2098
|
prev = current && current[i],
|
|
@@ -2348,7 +2346,12 @@ function respond(value, init = {}) {
|
|
|
2348
2346
|
}), value);
|
|
2349
2347
|
}
|
|
2350
2348
|
headers.set("Content-Type", "application/json");
|
|
2351
|
-
return new ResponseEnvelope(new Response(
|
|
2349
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
2350
|
+
pull(controller) {
|
|
2351
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
2352
|
+
controller.close();
|
|
2353
|
+
}
|
|
2354
|
+
}), {
|
|
2352
2355
|
...responseInit,
|
|
2353
2356
|
headers
|
|
2354
2357
|
}), value);
|
package/dist/web.js
CHANGED
|
@@ -71,40 +71,39 @@ function memo(fn) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
74
|
+
const isLive = n => {
|
|
75
|
+
if (!n) return false;
|
|
76
|
+
const tag = n[$$SLOT];
|
|
77
|
+
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
78
|
+
};
|
|
74
79
|
let bLength = b.length,
|
|
75
80
|
aEnd = a.length,
|
|
76
81
|
bEnd = bLength,
|
|
77
82
|
aStart = 0,
|
|
78
83
|
bStart = 0,
|
|
79
84
|
tail = a[aEnd - 1],
|
|
80
|
-
|
|
81
|
-
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
85
|
+
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
82
86
|
map = null,
|
|
83
87
|
anchor,
|
|
84
88
|
anchorTag;
|
|
85
|
-
const isLive = n => {
|
|
86
|
-
if (!n) return false;
|
|
87
|
-
const tag = n[$$SLOT];
|
|
88
|
-
return n.parentNode === parentNode && (!tag || tag === marker);
|
|
89
|
-
};
|
|
90
89
|
while (aStart < aEnd || bStart < bEnd) {
|
|
91
|
-
if (a[aStart] === b[bStart]
|
|
90
|
+
if (a[aStart] === b[bStart]) {
|
|
92
91
|
aStart++;
|
|
93
92
|
bStart++;
|
|
94
93
|
continue;
|
|
95
94
|
}
|
|
96
|
-
while (a[aEnd - 1] === b[bEnd - 1]
|
|
95
|
+
while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
|
|
97
96
|
aEnd--;
|
|
98
97
|
bEnd--;
|
|
99
98
|
}
|
|
100
99
|
if (aEnd === aStart) {
|
|
101
100
|
let node;
|
|
102
101
|
if (bEnd < bLength) {
|
|
103
|
-
if (bStart) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
node =
|
|
107
|
-
}
|
|
102
|
+
if (bStart && isLive(node = b[bStart - 1])) node = node.nextSibling;else {
|
|
103
|
+
let k = bEnd;
|
|
104
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
105
|
+
node = k < bLength ? b[k] : after;
|
|
106
|
+
}
|
|
108
107
|
} else node = after;
|
|
109
108
|
while (bStart < bEnd) {
|
|
110
109
|
const n = b[bStart++];
|
|
@@ -114,10 +113,7 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
114
113
|
} else if (bEnd === bStart) {
|
|
115
114
|
while (aStart < aEnd) {
|
|
116
115
|
const n = a[aStart++];
|
|
117
|
-
if (!map || !map.has(n))
|
|
118
|
-
const tag = n[$$SLOT];
|
|
119
|
-
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
120
|
-
}
|
|
116
|
+
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
121
117
|
}
|
|
122
118
|
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
123
119
|
if (marker) {
|
|
@@ -136,6 +132,10 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
136
132
|
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
137
133
|
}
|
|
138
134
|
} else {
|
|
135
|
+
if (!isLive(a[aStart])) {
|
|
136
|
+
aStart++;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
139
|
if (!map) {
|
|
140
140
|
map = new Map();
|
|
141
141
|
let i = bStart;
|
|
@@ -152,31 +152,19 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
152
152
|
sequence++;
|
|
153
153
|
}
|
|
154
154
|
if (sequence > index - bStart) {
|
|
155
|
-
const
|
|
156
|
-
const headTag = head[$$SLOT];
|
|
157
|
-
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
155
|
+
const node = a[aStart];
|
|
158
156
|
while (bStart < index) {
|
|
159
157
|
const n = b[bStart++];
|
|
160
158
|
parentNode.insertBefore(n, node);
|
|
161
159
|
if (marker) n[$$SLOT] = marker;
|
|
162
160
|
}
|
|
163
161
|
} else {
|
|
164
|
-
const oldNode = a[aStart++];
|
|
165
162
|
const newNode = b[bStart++];
|
|
166
|
-
|
|
167
|
-
if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
|
|
168
|
-
parentNode.replaceChild(newNode, oldNode);
|
|
169
|
-
} else {
|
|
170
|
-
parentNode.insertBefore(newNode, after);
|
|
171
|
-
}
|
|
163
|
+
parentNode.replaceChild(newNode, a[aStart++]);
|
|
172
164
|
if (marker) newNode[$$SLOT] = marker;
|
|
173
165
|
}
|
|
174
166
|
} else aStart++;
|
|
175
|
-
} else
|
|
176
|
-
const n = a[aStart++];
|
|
177
|
-
const nTag = n[$$SLOT];
|
|
178
|
-
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
179
|
-
}
|
|
167
|
+
} else a[aStart++].remove();
|
|
180
168
|
}
|
|
181
169
|
}
|
|
182
170
|
}
|
|
@@ -704,7 +692,7 @@ function setStyleProperty(node, name, value) {
|
|
|
704
692
|
if (isHydrating(node)) return;
|
|
705
693
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
706
694
|
}
|
|
707
|
-
function spread(node, props, skipChildren, skip, name) {
|
|
695
|
+
function spread(node, props, skipChildren, skip, name, loc) {
|
|
708
696
|
const prevProps = {};
|
|
709
697
|
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
710
698
|
const apply = newProps => {
|
|
@@ -831,6 +819,7 @@ const SCOPE_OPTIONS = {
|
|
|
831
819
|
scope: true
|
|
832
820
|
};
|
|
833
821
|
let hydrationRt = null;
|
|
822
|
+
let selectInsert = null;
|
|
834
823
|
function installHydrationRuntime() {
|
|
835
824
|
hydrationRt = {
|
|
836
825
|
claimInitial(parent, multi, initial) {
|
|
@@ -921,11 +910,14 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
921
910
|
initial = [placeholder];
|
|
922
911
|
}
|
|
923
912
|
let current = initial;
|
|
924
|
-
|
|
913
|
+
let ran = false;
|
|
914
|
+
effect(() => {
|
|
925
915
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
926
916
|
const value = normalize(accessor(), current, multi, true);
|
|
917
|
+
const again = ran;
|
|
918
|
+
ran = true;
|
|
927
919
|
if (typeof value !== "function") return value;
|
|
928
|
-
const innerOptions =
|
|
920
|
+
const innerOptions = again && !(options && options.schedule) ? {
|
|
929
921
|
...options,
|
|
930
922
|
schedule: true
|
|
931
923
|
} : options;
|
|
@@ -1677,14 +1669,13 @@ function eventHandler(e, container, state) {
|
|
|
1677
1669
|
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1678
1670
|
resumeNode = prev;
|
|
1679
1671
|
}
|
|
1680
|
-
const owner = state
|
|
1681
|
-
if (
|
|
1682
|
-
if (owner
|
|
1683
|
-
e[$$EVENT_OWNER] = owner
|
|
1672
|
+
const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
|
|
1673
|
+
if (!owner) return;
|
|
1674
|
+
if (owner === resumeNode) return;
|
|
1675
|
+
e[$$EVENT_OWNER] = owner;
|
|
1684
1676
|
let node = resumeNode || e.target;
|
|
1685
1677
|
const key = EVENT_KEY + e.type;
|
|
1686
1678
|
const oriTarget = e.target;
|
|
1687
|
-
const boundary = owner || container || e.currentTarget;
|
|
1688
1679
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
1689
1680
|
configurable: true,
|
|
1690
1681
|
value
|
|
@@ -1701,19 +1692,19 @@ function eventHandler(e, container, state) {
|
|
|
1701
1692
|
};
|
|
1702
1693
|
const walkUpTree = () => {
|
|
1703
1694
|
while (node && handleNode()) {
|
|
1704
|
-
if (node ===
|
|
1695
|
+
if (node === owner || node.parentNode === owner) break;
|
|
1705
1696
|
node = node._$host || node.parentNode || node.host;
|
|
1706
1697
|
}
|
|
1707
1698
|
};
|
|
1708
1699
|
Object.defineProperty(e, "currentTarget", {
|
|
1709
1700
|
configurable: true,
|
|
1710
1701
|
get() {
|
|
1711
|
-
return node ||
|
|
1702
|
+
return node || owner;
|
|
1712
1703
|
}
|
|
1713
1704
|
});
|
|
1714
1705
|
if (resumeNode) {
|
|
1715
1706
|
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
1716
|
-
if (node && node !==
|
|
1707
|
+
if (node && node !== owner) walkUpTree();
|
|
1717
1708
|
} else if (e.composedPath) {
|
|
1718
1709
|
const path = e.composedPath();
|
|
1719
1710
|
if (path.length) {
|
|
@@ -1726,7 +1717,7 @@ function eventHandler(e, container, state) {
|
|
|
1726
1717
|
walkUpTree();
|
|
1727
1718
|
break;
|
|
1728
1719
|
}
|
|
1729
|
-
if (node ===
|
|
1720
|
+
if (node === owner || node.parentNode === owner) {
|
|
1730
1721
|
break;
|
|
1731
1722
|
}
|
|
1732
1723
|
}
|
|
@@ -1750,7 +1741,10 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1750
1741
|
return value;
|
|
1751
1742
|
}
|
|
1752
1743
|
if (value === current) return value;
|
|
1753
|
-
if (hydrationRt !== null && sharedConfig.hydrating &&
|
|
1744
|
+
if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
|
|
1745
|
+
const tracked = [].concat(current ?? []);
|
|
1746
|
+
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
1747
|
+
}
|
|
1754
1748
|
const t = typeof value,
|
|
1755
1749
|
multi = marker !== undefined;
|
|
1756
1750
|
if (t === "string" || t === "number") {
|
|
@@ -1803,7 +1797,6 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1803
1797
|
selectInsert && selectInsert(parent);
|
|
1804
1798
|
return value;
|
|
1805
1799
|
}
|
|
1806
|
-
let selectInsert;
|
|
1807
1800
|
function selectChange(e) {
|
|
1808
1801
|
(e = e.currentTarget || e)._$v = null;
|
|
1809
1802
|
e.removeEventListener("change", selectChange, true);
|
|
@@ -1836,7 +1829,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1836
1829
|
});
|
|
1837
1830
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1838
1831
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1839
|
-
if (sharedConfig.hydrating && Array.isArray(value)) {
|
|
1832
|
+
if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
|
|
1840
1833
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1841
1834
|
const item = value[i],
|
|
1842
1835
|
prev = current && current[i],
|
|
@@ -2090,7 +2083,12 @@ function respond(value, init = {}) {
|
|
|
2090
2083
|
}), value);
|
|
2091
2084
|
}
|
|
2092
2085
|
headers.set("Content-Type", "application/json");
|
|
2093
|
-
return new ResponseEnvelope(new Response(
|
|
2086
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
2087
|
+
pull(controller) {
|
|
2088
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
2089
|
+
controller.close();
|
|
2090
|
+
}
|
|
2091
|
+
}), {
|
|
2094
2092
|
...responseInit,
|
|
2095
2093
|
headers
|
|
2096
2094
|
}), value);
|