@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.15
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 +317 -185
- package/dist/server.js +298 -161
- package/dist/server.observe.js +299 -171
- package/dist/web.dev.js +207 -189
- package/dist/web.js +180 -178
- package/dist/web.observe.js +180 -180
- package/frames/dist/assets.js +92 -0
- package/frames/dist/bind.dev.js +326 -0
- package/frames/dist/bind.js +295 -0
- package/frames/dist/client.dev.js +665 -1114
- package/frames/dist/client.js +630 -1087
- package/frames/dist/client.observe.js +629 -1087
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +400 -201
- package/frames/dist/server.js +397 -198
- package/frames/dist/server.observe.js +397 -198
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -4
- package/performance-tracks/dist/performance-tracks.dev.js +2 -1
- package/performance-tracks/dist/performance-tracks.observe.js +2 -1
- package/performance-tracks/types/index.d.ts +8 -6
- package/serialization/dist/decode.js +38 -9
- package/serialization/dist/serialization.js +40 -11
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +101 -62
- package/server-functions/dist/client.js +101 -62
- package/server-functions/dist/client.observe.js +101 -62
- package/server-functions/dist/server.dev.js +178 -67
- package/server-functions/dist/server.js +178 -67
- package/server-functions/dist/server.observe.js +178 -67
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +120 -8
- package/types/constants.d.ts +3 -1
- package/types/diagnostics.d.ts +8 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/bind-tier.d.ts +60 -0
- package/types/frames/client.d.ts +37 -3
- package/types/frames/frame-client.d.ts +249 -78
- package/types/frames/frame-container-plugin.d.ts +2 -2
- package/types/frames/frame-sink.d.ts +33 -0
- package/types/frames/frame-transport.d.ts +66 -18
- package/types/frames/regions-tier.d.ts +45 -0
- package/types/frames/serializer-decode.d.ts +24 -2
- package/types/frames/server.d.ts +33 -9
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +61 -16
- package/types/index.server.d.ts +3 -18
- package/types/jsx.d.ts +4 -13
- package/types/observe.d.ts +4 -2
- package/types/response.d.ts +26 -4
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/registry.d.ts +4 -1
- package/types/server-functions/shared.d.ts +12 -8
- package/types/server-mock.d.ts +22 -3
- package/types/server.d.ts +119 -17
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
2
|
+
function qualifierValue(name, value) {
|
|
3
|
+
if (value == null) return null;
|
|
4
|
+
if (name === "imagesrcset" || name === "imagesizes") return value === "" ? null : value;
|
|
5
|
+
if (name === "as") return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
|
|
6
|
+
if (name !== "crossorigin") return value;
|
|
7
|
+
return value.length === 15 && value.toLowerCase() === "use-credentials" ? "use-credentials" : "anonymous";
|
|
8
|
+
}
|
|
9
|
+
function findHeadElement(selector, attr, value, qualifiers) {
|
|
10
|
+
candidate: for (const node of document.head.querySelectorAll(selector)) {
|
|
11
|
+
if (node.getAttribute(attr) !== value) continue;
|
|
12
|
+
if (!qualifiers) return node;
|
|
13
|
+
for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
|
|
14
|
+
const name = PRELOAD_QUALIFIERS[i];
|
|
15
|
+
if (qualifierValue(name, node.getAttribute(name)) !== qualifierValue(name, qualifiers[name] ?? null)) continue candidate;
|
|
16
|
+
}
|
|
17
|
+
return node;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function ensurePreload(entry) {
|
|
22
|
+
const attrs = entry.attrs;
|
|
23
|
+
const href = entry.href;
|
|
24
|
+
if (findHeadElement('link[rel="preload"]', "href", href || null, attrs)) return;
|
|
25
|
+
const link = document.createElement("link");
|
|
26
|
+
link.rel = "preload";
|
|
27
|
+
for (const name in attrs) link.setAttribute(name, attrs[name]);
|
|
28
|
+
if (href) link.setAttribute("href", href);
|
|
29
|
+
document.head.appendChild(link);
|
|
30
|
+
}
|
|
31
|
+
function ensureStylesheet(entry, onSettle) {
|
|
32
|
+
const href = typeof entry === "string" ? entry : entry.href;
|
|
33
|
+
let link = findHeadElement('link[rel="stylesheet"]', "href", href);
|
|
34
|
+
if (!link) {
|
|
35
|
+
link = document.createElement("link");
|
|
36
|
+
link.rel = "stylesheet";
|
|
37
|
+
if (typeof entry !== "string" && entry.attrs) {
|
|
38
|
+
for (const name in entry.attrs) link.setAttribute(name, entry.attrs[name]);
|
|
39
|
+
}
|
|
40
|
+
link.href = href;
|
|
41
|
+
const waiters = new Set();
|
|
42
|
+
link._$frWaiters = waiters;
|
|
43
|
+
const settle = () => {
|
|
44
|
+
link._$frWaiters = null;
|
|
45
|
+
for (const fn of waiters) fn();
|
|
46
|
+
};
|
|
47
|
+
link.addEventListener("load", settle);
|
|
48
|
+
link.addEventListener("error", settle);
|
|
49
|
+
document.head.appendChild(link);
|
|
50
|
+
}
|
|
51
|
+
const waiters = link._$frWaiters;
|
|
52
|
+
if (waiters == null) return true;
|
|
53
|
+
waiters.add(onSettle);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
function ensureModulePreload(href) {
|
|
57
|
+
if (findHeadElement('link[rel="modulepreload"]', "href", href)) return;
|
|
58
|
+
const link = document.createElement("link");
|
|
59
|
+
link.rel = "modulepreload";
|
|
60
|
+
link.href = href;
|
|
61
|
+
document.head.appendChild(link);
|
|
62
|
+
}
|
|
63
|
+
function applyInlineStyles(inlineStyles) {
|
|
64
|
+
for (const entry of inlineStyles) {
|
|
65
|
+
if (findHeadElement("style[data-asset]", "data-asset", entry.id)) continue;
|
|
66
|
+
const el = document.createElement("style");
|
|
67
|
+
el.setAttribute("data-asset", entry.id);
|
|
68
|
+
if (entry.attrs) {
|
|
69
|
+
for (const name in entry.attrs) el.setAttribute(name, entry.attrs[name]);
|
|
70
|
+
}
|
|
71
|
+
el.textContent = entry.content || "";
|
|
72
|
+
document.head.appendChild(el);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const flushers = new WeakMap();
|
|
76
|
+
function gate(entries, frame) {
|
|
77
|
+
let flush = flushers.get(frame);
|
|
78
|
+
if (!flush) flushers.set(frame, flush = () => frame.apply({
|
|
79
|
+
version: frame.version,
|
|
80
|
+
r: {}
|
|
81
|
+
}));
|
|
82
|
+
let ready = true;
|
|
83
|
+
for (const entry of entries) ready = ensureStylesheet(entry, flush) && ready;
|
|
84
|
+
return ready;
|
|
85
|
+
}
|
|
86
|
+
function apply(record) {
|
|
87
|
+
if (record.modules) for (const href of record.modules) ensureModulePreload(href);
|
|
88
|
+
if (record.preloads) for (const entry of record.preloads) ensurePreload(entry);
|
|
89
|
+
if (record.inlineStyles) applyInlineStyles(record.inlineStyles);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { apply, gate };
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { DEV, OBSERVE, createSignal, untrack, createRenderEffect, onCleanup } from 'solid-js';
|
|
2
|
+
import { assign, runHydrationEvents } from '@solidjs/web';
|
|
3
|
+
import { sharedConfig } from 'solid-js/internal';
|
|
4
|
+
import { isAsyncValue as isAsyncValue$1 } from '@solidjs/web/frames';
|
|
5
|
+
|
|
6
|
+
const SLOT_MARKER = "_s:";
|
|
7
|
+
const SLOT_TEXT = SLOT_MARKER + "t=";
|
|
8
|
+
function isAsyncValue(v) {
|
|
9
|
+
return v !== null && typeof v === "object" && (typeof v.then === "function" || typeof v[Symbol.asyncIterator] === "function");
|
|
10
|
+
}
|
|
11
|
+
function shapeOf(v) {
|
|
12
|
+
return v === null ? "null" : typeof Node === "function" && v instanceof Node ? "a DOM node" : Array.isArray(v) ? "an array" : isAsyncValue(v) ? "an async value" : typeof v;
|
|
13
|
+
}
|
|
14
|
+
function slotShapeFinding(data, message) {
|
|
15
|
+
DEV.report(OBSERVE.diagnostics.emit({
|
|
16
|
+
code: "BINDING_SLOT_POSITION",
|
|
17
|
+
kind: "render",
|
|
18
|
+
severity: "warn",
|
|
19
|
+
message,
|
|
20
|
+
data
|
|
21
|
+
}, null));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function slotEntry(entry, pos) {
|
|
25
|
+
const colon = entry.indexOf(":");
|
|
26
|
+
if (colon < 1) return null;
|
|
27
|
+
const eq = entry.indexOf("=", colon);
|
|
28
|
+
return [entry.slice(0, colon), {
|
|
29
|
+
pos,
|
|
30
|
+
key: decodeURIComponent(eq === -1 ? entry.slice(colon + 1) : entry.slice(colon + 1, eq)),
|
|
31
|
+
name: eq === -1 ? undefined : decodeURIComponent(entry.slice(eq + 1))
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
function consumersOf(elements, occurrence) {
|
|
35
|
+
let consumers = elements.get(occurrence);
|
|
36
|
+
if (consumers === undefined) elements.set(occurrence, consumers = []);
|
|
37
|
+
return Array.isArray(consumers) ? consumers : null;
|
|
38
|
+
}
|
|
39
|
+
function text(start, elements) {
|
|
40
|
+
const parsed = slotEntry(start.data.slice(SLOT_TEXT.length), "text");
|
|
41
|
+
const consumers = parsed && consumersOf(elements, parsed[0]);
|
|
42
|
+
if (!consumers) return;
|
|
43
|
+
const element = start.parentNode;
|
|
44
|
+
let consumer;
|
|
45
|
+
for (let i = consumers.length; i-- && !consumer;) if (consumers[i].element === element) consumer = consumers[i];
|
|
46
|
+
consumer || consumers.push(consumer = {
|
|
47
|
+
element,
|
|
48
|
+
positions: []
|
|
49
|
+
});
|
|
50
|
+
parsed[1].start = start;
|
|
51
|
+
consumer.positions.push(parsed[1]);
|
|
52
|
+
}
|
|
53
|
+
function slotPositions(el) {
|
|
54
|
+
const attrs = el.attributes;
|
|
55
|
+
let out = null;
|
|
56
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
57
|
+
const attr = attrs[i];
|
|
58
|
+
if (!attr.name.startsWith(SLOT_MARKER)) continue;
|
|
59
|
+
const pos = attr.name.slice(SLOT_MARKER.length);
|
|
60
|
+
for (const entry of attr.value.split(",")) {
|
|
61
|
+
const parsed = slotEntry(entry, pos);
|
|
62
|
+
if (!parsed) continue;
|
|
63
|
+
out || (out = Object.create(null));
|
|
64
|
+
(out[parsed[0]] || (out[parsed[0]] = [])).push(parsed[1]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
function positions(el, elements) {
|
|
70
|
+
const byOccurrence = slotPositions(el);
|
|
71
|
+
if (byOccurrence !== null) {
|
|
72
|
+
for (const occurrence in byOccurrence) {
|
|
73
|
+
const consumers = consumersOf(elements, occurrence);
|
|
74
|
+
if (consumers) consumers.push({
|
|
75
|
+
element: el,
|
|
76
|
+
positions: byOccurrence[occurrence]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function consumersEqual(a, b) {
|
|
82
|
+
if (a.length !== b.length) return false;
|
|
83
|
+
for (let i = 0; i < a.length; i++) {
|
|
84
|
+
const x = a[i];
|
|
85
|
+
const y = b[i];
|
|
86
|
+
if (x.element !== y.element || x.positions.length !== y.positions.length) return false;
|
|
87
|
+
for (let j = 0; j < x.positions.length; j++) {
|
|
88
|
+
const p = x.positions[j];
|
|
89
|
+
const q = y.positions[j];
|
|
90
|
+
if (p.pos !== q.pos || p.key !== q.key || p.name !== q.name || p.start !== q.start) return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
const byFrame = new WeakMap();
|
|
96
|
+
function occurrencesOf(frame) {
|
|
97
|
+
let slots = byFrame.get(frame);
|
|
98
|
+
if (!slots) byFrame.set(frame, slots = new Map());
|
|
99
|
+
return slots;
|
|
100
|
+
}
|
|
101
|
+
function sync(frame, occurrence, consumers) {
|
|
102
|
+
const slots = occurrencesOf(frame);
|
|
103
|
+
const entry = slots.get(occurrence);
|
|
104
|
+
if (!entry) slots.set(occurrence, {
|
|
105
|
+
consumers,
|
|
106
|
+
rebind: undefined
|
|
107
|
+
});else if (!entry.consumers) entry.consumers = consumers;else if (!consumersEqual(entry.consumers, consumers)) {
|
|
108
|
+
entry.consumers = consumers;
|
|
109
|
+
entry.rebind && entry.rebind(consumers);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function rebinder(frame, occurrence, fn) {
|
|
113
|
+
const slots = occurrencesOf(frame);
|
|
114
|
+
const entry = slots.get(occurrence);
|
|
115
|
+
if (entry) entry.rebind = fn;else slots.set(occurrence, {
|
|
116
|
+
consumers: undefined,
|
|
117
|
+
rebind: fn
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function unmount(frame, occurrence) {
|
|
121
|
+
byFrame.get(frame)?.delete(occurrence);
|
|
122
|
+
}
|
|
123
|
+
function owned(el) {
|
|
124
|
+
const attrs = el.attributes;
|
|
125
|
+
let out = null;
|
|
126
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
127
|
+
const name = attrs[i].name;
|
|
128
|
+
if (!name.startsWith(SLOT_MARKER)) continue;
|
|
129
|
+
const pos = name.slice(SLOT_MARKER.length);
|
|
130
|
+
if (pos === "ref" || pos.startsWith("on:")) continue;
|
|
131
|
+
out || (out = {
|
|
132
|
+
attrs: new Set(),
|
|
133
|
+
class: null,
|
|
134
|
+
style: null
|
|
135
|
+
});
|
|
136
|
+
if (pos !== "class" && pos !== "style") {
|
|
137
|
+
out.attrs.add(pos);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
for (const entry of attrs[i].value.split(",")) {
|
|
141
|
+
const eq = entry.indexOf("=");
|
|
142
|
+
if (eq === -1) {
|
|
143
|
+
out.attrs.add(pos);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
(out[pos] || (out[pos] = [])).push(decodeURIComponent(entry.slice(eq + 1)));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
function morphOwnedClass(oldEl, value, names) {
|
|
152
|
+
const list = oldEl.classList;
|
|
153
|
+
const set = new Set(value ? value.split(/\s+/) : []);
|
|
154
|
+
set.delete("");
|
|
155
|
+
for (const name of names) list.contains(name) ? set.add(name) : set.delete(name);
|
|
156
|
+
const next = [...set].join(" ");
|
|
157
|
+
if (next === (oldEl.getAttribute("class") || "")) return false;
|
|
158
|
+
next ? oldEl.setAttribute("class", next) : oldEl.removeAttribute("class");
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
function morphOwnedStyle(oldEl, value, names) {
|
|
162
|
+
const style = oldEl.style;
|
|
163
|
+
const saved = names.map(name => [name, style.getPropertyValue(name), style.getPropertyPriority(name)]);
|
|
164
|
+
const before = oldEl.getAttribute("style");
|
|
165
|
+
value ? oldEl.setAttribute("style", value) : oldEl.removeAttribute("style");
|
|
166
|
+
for (const [name, v, priority] of saved) {
|
|
167
|
+
v ? style.setProperty(name, v, priority) : style.removeProperty(name);
|
|
168
|
+
}
|
|
169
|
+
return oldEl.getAttribute("style") !== before;
|
|
170
|
+
}
|
|
171
|
+
function apply(oldEl, name, value, owned) {
|
|
172
|
+
if (owned.attrs.has(name)) return false;
|
|
173
|
+
if ((name === "class" || name === "style") && owned[name] !== null) {
|
|
174
|
+
return name === "class" ? morphOwnedClass(oldEl, value, owned.class) : morphOwnedStyle(oldEl, value, owned.style);
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
const handlerOwners = new WeakMap();
|
|
179
|
+
function bind(fill, args, ctx, label) {
|
|
180
|
+
const [consumers, setConsumers] = createSignal(ctx.positions);
|
|
181
|
+
ctx.onRebind(setConsumers);
|
|
182
|
+
const raw = untrack(() => fill(args), label);
|
|
183
|
+
const node = typeof Node === "function" && raw instanceof Node;
|
|
184
|
+
const pending = isAsyncValue$1(raw);
|
|
185
|
+
if ((raw == null || typeof raw !== "object" || Array.isArray(raw) || node || pending)) {
|
|
186
|
+
const shape = shapeOf(raw);
|
|
187
|
+
slotShapeFinding({
|
|
188
|
+
reason: "fill-shape",
|
|
189
|
+
occurrence: ctx.key,
|
|
190
|
+
shape
|
|
191
|
+
}, `[BINDING_SLOT_POSITION] The fill for \`${ctx.key}\` returned ${shape}; server markup reads ` + `its properties at bound positions, so it must return an object (\`{ done, onToggle, … }\`). ` + `Nothing binds.`);
|
|
192
|
+
}
|
|
193
|
+
const out = raw == null || typeof raw !== "object" || node || pending ? {} : raw;
|
|
194
|
+
const token = {};
|
|
195
|
+
const state = new WeakMap();
|
|
196
|
+
let bound = new Set();
|
|
197
|
+
createRenderEffect(() => consumers().map(valuesFor), writes => {
|
|
198
|
+
const next = new Set();
|
|
199
|
+
for (const {
|
|
200
|
+
element,
|
|
201
|
+
positions,
|
|
202
|
+
values,
|
|
203
|
+
texts
|
|
204
|
+
} of writes) {
|
|
205
|
+
next.add(element);
|
|
206
|
+
write(element, positions, values);
|
|
207
|
+
for (const [start, v, key] of texts) writeText(start, v, key);
|
|
208
|
+
}
|
|
209
|
+
for (const element of bound) if (!next.has(element)) release(element);
|
|
210
|
+
bound = next;
|
|
211
|
+
});
|
|
212
|
+
onCleanup(() => {
|
|
213
|
+
for (const element of bound) release(element);
|
|
214
|
+
});
|
|
215
|
+
function valuesFor({
|
|
216
|
+
element,
|
|
217
|
+
positions
|
|
218
|
+
}) {
|
|
219
|
+
const props = {};
|
|
220
|
+
const texts = [];
|
|
221
|
+
let classNames = null;
|
|
222
|
+
let styleProps = null;
|
|
223
|
+
for (const {
|
|
224
|
+
pos,
|
|
225
|
+
key,
|
|
226
|
+
name,
|
|
227
|
+
start
|
|
228
|
+
} of positions) {
|
|
229
|
+
if (pos === "ref" || pos.startsWith("on:")) continue;
|
|
230
|
+
if (pos === "text") texts.push([start, out[key], key]);else if (pos === "class" || pos === "style") {
|
|
231
|
+
if (name === undefined) props[pos] = out[key];else if (pos === "class") (classNames || (classNames = {}))[name] = !!out[key];else (styleProps || (styleProps = {}))[name] = out[key];
|
|
232
|
+
} else props[pos] = out[key];
|
|
233
|
+
}
|
|
234
|
+
if (classNames !== null && !("class" in props)) props.class = classNames;
|
|
235
|
+
if (styleProps !== null && !("style" in props)) props.style = styleProps;
|
|
236
|
+
return {
|
|
237
|
+
element,
|
|
238
|
+
positions,
|
|
239
|
+
values: props,
|
|
240
|
+
texts
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function write(element, positions, props) {
|
|
244
|
+
let st = state.get(element);
|
|
245
|
+
if (!st) state.set(element, st = {
|
|
246
|
+
prev: {},
|
|
247
|
+
handlers: {},
|
|
248
|
+
ref: undefined,
|
|
249
|
+
refId: ""
|
|
250
|
+
});
|
|
251
|
+
const handlers = {};
|
|
252
|
+
const refKeys = [];
|
|
253
|
+
for (const {
|
|
254
|
+
pos,
|
|
255
|
+
key
|
|
256
|
+
} of positions) {
|
|
257
|
+
if (pos === "ref") refKeys.push(key);else if (pos.startsWith("on:")) handlers["on" + pos[3].toUpperCase() + pos.slice(4)] = key;
|
|
258
|
+
}
|
|
259
|
+
let owners = handlerOwners.get(element);
|
|
260
|
+
if (!owners) handlerOwners.set(element, owners = {});
|
|
261
|
+
let events = false;
|
|
262
|
+
for (const prop in handlers) {
|
|
263
|
+
events = true;
|
|
264
|
+
const key = handlers[prop];
|
|
265
|
+
let h = st.handlers[prop];
|
|
266
|
+
if (h === undefined || h.key !== key) st.handlers[prop] = h = {
|
|
267
|
+
key,
|
|
268
|
+
value: untrack(() => out[key])
|
|
269
|
+
};
|
|
270
|
+
props[prop] = h.value;
|
|
271
|
+
owners[prop] = token;
|
|
272
|
+
}
|
|
273
|
+
const clearing = {};
|
|
274
|
+
for (const prop in st.handlers) {
|
|
275
|
+
if (prop in handlers) continue;
|
|
276
|
+
delete st.handlers[prop];
|
|
277
|
+
if (owners[prop] === token) {
|
|
278
|
+
delete owners[prop];
|
|
279
|
+
clearing[prop] = true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (refKeys.length) {
|
|
283
|
+
const id = refKeys.join(",");
|
|
284
|
+
if (st.refId !== id) {
|
|
285
|
+
const refs = refKeys.map(k => untrack(() => out[k]));
|
|
286
|
+
st.refId = id;
|
|
287
|
+
st.ref = el => {
|
|
288
|
+
for (const r of refs) typeof r === "function" && r(el);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
props.ref = st.ref;
|
|
292
|
+
}
|
|
293
|
+
for (const k in st.prev) {
|
|
294
|
+
if (k in props || k === "ref" || k in clearing) continue;
|
|
295
|
+
delete st.prev[k];
|
|
296
|
+
}
|
|
297
|
+
assign(element, props, true, st.prev);
|
|
298
|
+
if (events && sharedConfig.completed && !sharedConfig.completed.has(element)) {
|
|
299
|
+
sharedConfig.completed.add(element);
|
|
300
|
+
runHydrationEvents();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function release(element) {
|
|
304
|
+
if (!state.has(element)) return;
|
|
305
|
+
write(element, [], {});
|
|
306
|
+
state.delete(element);
|
|
307
|
+
}
|
|
308
|
+
function writeText(start, v, key) {
|
|
309
|
+
let s = "";
|
|
310
|
+
if (typeof v === "string" || typeof v === "number") s = "" + v;else if (v != null && typeof v !== "boolean") {
|
|
311
|
+
const shape = shapeOf(v);
|
|
312
|
+
slotShapeFinding({
|
|
313
|
+
reason: "text-shape",
|
|
314
|
+
occurrence: ctx.key,
|
|
315
|
+
key,
|
|
316
|
+
shape
|
|
317
|
+
}, `[BINDING_SLOT_POSITION] \`${key}\` of \`${ctx.key}\` is placed as text, but the fill ` + `returned ${shape} for it. A text position renders a string or number; markup belongs ` + `in a template slot. The text is cleared.`);
|
|
318
|
+
}
|
|
319
|
+
const n = start.nextSibling;
|
|
320
|
+
if (n && n.nodeType === 3) {
|
|
321
|
+
if (n.data !== s) n.data = s;
|
|
322
|
+
} else if (s) start.after(s);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export { apply, bind, owned, positions, rebinder, sync, text, unmount };
|