solid-js 1.8.0-beta.0 → 1.8.0-beta.2
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/dev.js +297 -532
- package/dist/server.js +74 -168
- package/dist/solid.js +255 -459
- package/h/dist/h.js +8 -34
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/jsx-runtime/types/jsx.d.ts +19 -5
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +31 -45
- package/package.json +1 -1
- package/store/dist/dev.js +42 -114
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +39 -105
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +9 -72
- package/types/jsx.d.ts +19 -5
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +140 -228
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +31 -62
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +13 -12
- package/types/server/index.d.ts +2 -56
- package/types/server/reactive.d.ts +40 -67
- package/types/server/rendering.d.ts +95 -166
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.cjs +11 -4
- package/web/dist/dev.js +89 -614
- package/web/dist/server.cjs +5 -6
- package/web/dist/server.js +97 -181
- package/web/dist/web.cjs +11 -4
- package/web/dist/web.js +89 -614
- package/web/types/client.d.ts +3 -3
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
package/web/dist/server.cjs
CHANGED
|
@@ -99,9 +99,8 @@ function renderToStream(code, options = {}) {
|
|
|
99
99
|
tasks = getLocalHeaderScript(renderId);
|
|
100
100
|
}
|
|
101
101
|
tasks += task + ";";
|
|
102
|
-
if (!
|
|
103
|
-
|
|
104
|
-
scheduled = true;
|
|
102
|
+
if (!timer && firstFlushed) {
|
|
103
|
+
timer = setTimeout(writeTasks);
|
|
105
104
|
}
|
|
106
105
|
};
|
|
107
106
|
const checkEnd = () => {
|
|
@@ -133,7 +132,8 @@ function renderToStream(code, options = {}) {
|
|
|
133
132
|
buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks}</script>`);
|
|
134
133
|
tasks = "";
|
|
135
134
|
}
|
|
136
|
-
|
|
135
|
+
timer && clearTimeout(timer);
|
|
136
|
+
timer = null;
|
|
137
137
|
};
|
|
138
138
|
let context;
|
|
139
139
|
let writable;
|
|
@@ -142,7 +142,7 @@ function renderToStream(code, options = {}) {
|
|
|
142
142
|
let firstFlushed = false;
|
|
143
143
|
let completed = false;
|
|
144
144
|
let scriptFlushed = false;
|
|
145
|
-
let
|
|
145
|
+
let timer = null;
|
|
146
146
|
let buffer = {
|
|
147
147
|
write(payload) {
|
|
148
148
|
tmp += payload;
|
|
@@ -228,7 +228,6 @@ function renderToStream(code, options = {}) {
|
|
|
228
228
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
229
229
|
buffer.write(html);
|
|
230
230
|
tasks = "";
|
|
231
|
-
scheduled = false;
|
|
232
231
|
onCompleteShell && onCompleteShell({
|
|
233
232
|
write(v) {
|
|
234
233
|
!completed && buffer.write(v);
|
package/web/dist/server.js
CHANGED
|
@@ -1,59 +1,24 @@
|
|
|
1
|
-
import { sharedConfig, createRoot, splitProps } from
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
For,
|
|
5
|
-
Index,
|
|
6
|
-
Match,
|
|
7
|
-
Show,
|
|
8
|
-
Suspense,
|
|
9
|
-
SuspenseList,
|
|
10
|
-
Switch,
|
|
11
|
-
createComponent,
|
|
12
|
-
mergeProps
|
|
13
|
-
} from "solid-js";
|
|
14
|
-
import { Feature, Serializer, GLOBAL_CONTEXT_API_SCRIPT, getCrossReferenceHeader } from "seroval";
|
|
1
|
+
import { sharedConfig, createRoot, splitProps } from 'solid-js';
|
|
2
|
+
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, mergeProps } from 'solid-js';
|
|
3
|
+
import { Feature, Serializer, GLOBAL_CONTEXT_API_SCRIPT, getCrossReferenceHeader } from 'seroval';
|
|
15
4
|
|
|
16
|
-
const booleans = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"autoplay",
|
|
21
|
-
"checked",
|
|
22
|
-
"controls",
|
|
23
|
-
"default",
|
|
24
|
-
"disabled",
|
|
25
|
-
"formnovalidate",
|
|
26
|
-
"hidden",
|
|
27
|
-
"indeterminate",
|
|
28
|
-
"ismap",
|
|
29
|
-
"loop",
|
|
30
|
-
"multiple",
|
|
31
|
-
"muted",
|
|
32
|
-
"nomodule",
|
|
33
|
-
"novalidate",
|
|
34
|
-
"open",
|
|
35
|
-
"playsinline",
|
|
36
|
-
"readonly",
|
|
37
|
-
"required",
|
|
38
|
-
"reversed",
|
|
39
|
-
"seamless",
|
|
40
|
-
"selected"
|
|
41
|
-
];
|
|
42
|
-
const BooleanAttributes = /*#__PURE__*/ new Set(booleans);
|
|
43
|
-
const ChildProperties = /*#__PURE__*/ new Set([
|
|
44
|
-
"innerHTML",
|
|
45
|
-
"textContent",
|
|
46
|
-
"innerText",
|
|
47
|
-
"children"
|
|
48
|
-
]);
|
|
49
|
-
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
5
|
+
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
6
|
+
const BooleanAttributes = /*#__PURE__*/new Set(booleans);
|
|
7
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
|
+
const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
50
9
|
className: "class",
|
|
51
10
|
htmlFor: "for"
|
|
52
11
|
});
|
|
53
12
|
|
|
54
|
-
const ES2017FLAG = Feature.AggregateError
|
|
55
|
-
|
|
56
|
-
|
|
13
|
+
const ES2017FLAG = Feature.AggregateError
|
|
14
|
+
| Feature.BigInt
|
|
15
|
+
| Feature.BigIntTypedArray;
|
|
16
|
+
const GLOBAL_IDENTIFIER = '_$HY.r';
|
|
17
|
+
function createSerializer({
|
|
18
|
+
onData,
|
|
19
|
+
onDone,
|
|
20
|
+
scopeId
|
|
21
|
+
}) {
|
|
57
22
|
return new Serializer({
|
|
58
23
|
scopeId,
|
|
59
24
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
@@ -69,11 +34,12 @@ function getLocalHeaderScript(id) {
|
|
|
69
34
|
return getCrossReferenceHeader(id);
|
|
70
35
|
}
|
|
71
36
|
|
|
72
|
-
const VOID_ELEMENTS =
|
|
73
|
-
/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
37
|
+
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
74
38
|
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content)}n.remove(),_$HY.fe(e)}`;
|
|
75
39
|
function renderToString(code, options = {}) {
|
|
76
|
-
const {
|
|
40
|
+
const {
|
|
41
|
+
renderId
|
|
42
|
+
} = options;
|
|
77
43
|
let scripts = "";
|
|
78
44
|
const serializer = createSerializer({
|
|
79
45
|
scopeId: renderId,
|
|
@@ -106,7 +72,9 @@ function renderToString(code, options = {}) {
|
|
|
106
72
|
return html;
|
|
107
73
|
}
|
|
108
74
|
function renderToStringAsync(code, options = {}) {
|
|
109
|
-
const {
|
|
75
|
+
const {
|
|
76
|
+
timeoutMs = 30000
|
|
77
|
+
} = options;
|
|
110
78
|
let timeoutHandle;
|
|
111
79
|
const timeout = new Promise((_, reject) => {
|
|
112
80
|
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
@@ -117,7 +85,12 @@ function renderToStringAsync(code, options = {}) {
|
|
|
117
85
|
});
|
|
118
86
|
}
|
|
119
87
|
function renderToStream(code, options = {}) {
|
|
120
|
-
let {
|
|
88
|
+
let {
|
|
89
|
+
nonce,
|
|
90
|
+
onCompleteShell,
|
|
91
|
+
onCompleteAll,
|
|
92
|
+
renderId
|
|
93
|
+
} = options;
|
|
121
94
|
let dispose;
|
|
122
95
|
const blockingPromises = [];
|
|
123
96
|
const pushTask = task => {
|
|
@@ -125,20 +98,18 @@ function renderToStream(code, options = {}) {
|
|
|
125
98
|
tasks = getLocalHeaderScript(renderId);
|
|
126
99
|
}
|
|
127
100
|
tasks += task + ";";
|
|
128
|
-
if (!
|
|
129
|
-
|
|
130
|
-
scheduled = true;
|
|
101
|
+
if (!timer && firstFlushed) {
|
|
102
|
+
timer = setTimeout(writeTasks);
|
|
131
103
|
}
|
|
132
104
|
};
|
|
133
105
|
const checkEnd = () => {
|
|
134
106
|
if (!registry.size && !completed) {
|
|
135
107
|
writeTasks();
|
|
136
|
-
onCompleteAll &&
|
|
137
|
-
|
|
138
|
-
write(v)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
108
|
+
onCompleteAll && onCompleteAll({
|
|
109
|
+
write(v) {
|
|
110
|
+
!completed && buffer.write(v);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
142
113
|
writable && writable.end();
|
|
143
114
|
completed = true;
|
|
144
115
|
setTimeout(dispose);
|
|
@@ -160,7 +131,8 @@ function renderToStream(code, options = {}) {
|
|
|
160
131
|
buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks}</script>`);
|
|
161
132
|
tasks = "";
|
|
162
133
|
}
|
|
163
|
-
|
|
134
|
+
timer && clearTimeout(timer);
|
|
135
|
+
timer = null;
|
|
164
136
|
};
|
|
165
137
|
let context;
|
|
166
138
|
let writable;
|
|
@@ -169,7 +141,7 @@ function renderToStream(code, options = {}) {
|
|
|
169
141
|
let firstFlushed = false;
|
|
170
142
|
let completed = false;
|
|
171
143
|
let scriptFlushed = false;
|
|
172
|
-
let
|
|
144
|
+
let timer = null;
|
|
173
145
|
let buffer = {
|
|
174
146
|
write(payload) {
|
|
175
147
|
tmp += payload;
|
|
@@ -193,29 +165,23 @@ function renderToStream(code, options = {}) {
|
|
|
193
165
|
const first = html.indexOf(placeholder);
|
|
194
166
|
if (first === -1) return;
|
|
195
167
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
196
|
-
html = html.replace(
|
|
197
|
-
html.slice(first, last + placeholder.length + 1),
|
|
198
|
-
resolveSSRNode(payloadFn())
|
|
199
|
-
);
|
|
168
|
+
html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
|
|
200
169
|
},
|
|
201
170
|
serialize(id, p, wait) {
|
|
202
171
|
const serverOnly = sharedConfig.context.noHydrate;
|
|
203
172
|
if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
|
|
204
173
|
blockingPromises.push(p);
|
|
205
|
-
!serverOnly &&
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.catch(e => {
|
|
211
|
-
serializer.write(id, e);
|
|
212
|
-
});
|
|
174
|
+
!serverOnly && p.then(d => {
|
|
175
|
+
serializer.write(id, d);
|
|
176
|
+
}).catch(e => {
|
|
177
|
+
serializer.write(id, e);
|
|
178
|
+
});
|
|
213
179
|
} else if (!serverOnly) serializer.write(id, p);
|
|
214
180
|
},
|
|
215
181
|
registerFragment(key) {
|
|
216
182
|
if (!registry.has(key)) {
|
|
217
183
|
let resolve, reject;
|
|
218
|
-
const p = new Promise((r, rej) => (
|
|
184
|
+
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
219
185
|
registry.set(key, {
|
|
220
186
|
resolve,
|
|
221
187
|
reject
|
|
@@ -224,7 +190,10 @@ function renderToStream(code, options = {}) {
|
|
|
224
190
|
}
|
|
225
191
|
return (value, error) => {
|
|
226
192
|
if (registry.has(key)) {
|
|
227
|
-
const {
|
|
193
|
+
const {
|
|
194
|
+
resolve,
|
|
195
|
+
reject
|
|
196
|
+
} = registry.get(key);
|
|
228
197
|
registry.delete(key);
|
|
229
198
|
if (waitForFragments(registry, key)) {
|
|
230
199
|
resolve(true);
|
|
@@ -232,9 +201,7 @@ function renderToStream(code, options = {}) {
|
|
|
232
201
|
}
|
|
233
202
|
if ((value !== undefined || error) && !completed) {
|
|
234
203
|
if (!firstFlushed) {
|
|
235
|
-
Promise.resolve().then(
|
|
236
|
-
() => (html = replacePlaceholder(html, key, value !== undefined ? value : ""))
|
|
237
|
-
);
|
|
204
|
+
Promise.resolve().then(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
238
205
|
error ? reject(error) : resolve(true);
|
|
239
206
|
} else {
|
|
240
207
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
@@ -260,13 +227,11 @@ function renderToStream(code, options = {}) {
|
|
|
260
227
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
261
228
|
buffer.write(html);
|
|
262
229
|
tasks = "";
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
});
|
|
230
|
+
onCompleteShell && onCompleteShell({
|
|
231
|
+
write(v) {
|
|
232
|
+
!completed && buffer.write(v);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
270
235
|
}
|
|
271
236
|
return {
|
|
272
237
|
then(fn) {
|
|
@@ -289,8 +254,7 @@ function renderToStream(code, options = {}) {
|
|
|
289
254
|
buffer = writable = w;
|
|
290
255
|
buffer.write(tmp);
|
|
291
256
|
firstFlushed = true;
|
|
292
|
-
if (completed) writable.end();
|
|
293
|
-
else setTimeout(flushEnd);
|
|
257
|
+
if (completed) writable.end();else setTimeout(flushEnd);
|
|
294
258
|
});
|
|
295
259
|
},
|
|
296
260
|
pipeTo(w) {
|
|
@@ -299,7 +263,7 @@ function renderToStream(code, options = {}) {
|
|
|
299
263
|
const encoder = new TextEncoder();
|
|
300
264
|
const writer = w.getWriter();
|
|
301
265
|
let resolve;
|
|
302
|
-
const p = new Promise(r =>
|
|
266
|
+
const p = new Promise(r => resolve = r);
|
|
303
267
|
writable = {
|
|
304
268
|
end() {
|
|
305
269
|
writer.releaseLock();
|
|
@@ -314,21 +278,20 @@ function renderToStream(code, options = {}) {
|
|
|
314
278
|
};
|
|
315
279
|
buffer.write(tmp);
|
|
316
280
|
firstFlushed = true;
|
|
317
|
-
if (completed) writable.end();
|
|
318
|
-
else setTimeout(flushEnd);
|
|
281
|
+
if (completed) writable.end();else setTimeout(flushEnd);
|
|
319
282
|
return p;
|
|
320
283
|
});
|
|
321
284
|
}
|
|
322
285
|
};
|
|
323
286
|
}
|
|
324
287
|
function HydrationScript(props) {
|
|
325
|
-
const {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
);
|
|
288
|
+
const {
|
|
289
|
+
nonce
|
|
290
|
+
} = sharedConfig.context;
|
|
291
|
+
return ssr(generateHydrationScript({
|
|
292
|
+
nonce,
|
|
293
|
+
...props
|
|
294
|
+
}));
|
|
332
295
|
}
|
|
333
296
|
function ssr(t, ...nodes) {
|
|
334
297
|
if (nodes.length) {
|
|
@@ -373,8 +336,7 @@ function ssrStyle(value) {
|
|
|
373
336
|
return result;
|
|
374
337
|
}
|
|
375
338
|
function ssrElement(tag, props, children, needsId) {
|
|
376
|
-
if (props == null) props = {};
|
|
377
|
-
else if (typeof props === "function") props = props();
|
|
339
|
+
if (props == null) props = {};else if (typeof props === "function") props = props();
|
|
378
340
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
379
341
|
const keys = Object.keys(props);
|
|
380
342
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
@@ -382,8 +344,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
382
344
|
for (let i = 0; i < keys.length; i++) {
|
|
383
345
|
const prop = keys[i];
|
|
384
346
|
if (ChildProperties.has(prop)) {
|
|
385
|
-
if (children === undefined && !skipChildren)
|
|
386
|
-
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
347
|
+
if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
387
348
|
continue;
|
|
388
349
|
}
|
|
389
350
|
const value = props[prop];
|
|
@@ -392,14 +353,10 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
392
353
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
393
354
|
if (classResolved) continue;
|
|
394
355
|
let n;
|
|
395
|
-
result += `class="${
|
|
396
|
-
escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) +
|
|
397
|
-
ssrClassList(props.classList)
|
|
398
|
-
}"`;
|
|
356
|
+
result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
|
|
399
357
|
classResolved = true;
|
|
400
358
|
} else if (BooleanAttributes.has(prop)) {
|
|
401
|
-
if (value) result += prop;
|
|
402
|
-
else continue;
|
|
359
|
+
if (value) result += prop;else continue;
|
|
403
360
|
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
404
361
|
continue;
|
|
405
362
|
} else {
|
|
@@ -407,17 +364,16 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
407
364
|
}
|
|
408
365
|
if (i !== keys.length - 1) result += " ";
|
|
409
366
|
}
|
|
410
|
-
if (skipChildren)
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
};
|
|
367
|
+
if (skipChildren) return {
|
|
368
|
+
t: result + "/>"
|
|
369
|
+
};
|
|
414
370
|
if (typeof children === "function") children = children();
|
|
415
371
|
return {
|
|
416
372
|
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
417
373
|
};
|
|
418
374
|
}
|
|
419
375
|
function ssrAttribute(key, value, isBoolean) {
|
|
420
|
-
return isBoolean ?
|
|
376
|
+
return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
|
|
421
377
|
}
|
|
422
378
|
function ssrHydrationKey() {
|
|
423
379
|
const hk = getHydrationKey();
|
|
@@ -461,13 +417,12 @@ function escape(s, attr) {
|
|
|
461
417
|
left = iDelim + 1;
|
|
462
418
|
iDelim = s.indexOf(delim, left);
|
|
463
419
|
} while (iDelim >= 0);
|
|
464
|
-
} else
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
420
|
+
} else while (iAmp >= 0) {
|
|
421
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
422
|
+
out += "&";
|
|
423
|
+
left = iAmp + 1;
|
|
424
|
+
iAmp = s.indexOf("&", left);
|
|
425
|
+
}
|
|
471
426
|
return left < s.length ? out + s.substring(left) : out;
|
|
472
427
|
}
|
|
473
428
|
function resolveSSRNode(node, top) {
|
|
@@ -479,7 +434,7 @@ function resolveSSRNode(node, top) {
|
|
|
479
434
|
let mapped = "";
|
|
480
435
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
481
436
|
if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
482
|
-
mapped += resolveSSRNode(
|
|
437
|
+
mapped += resolveSSRNode(prev = node[i]);
|
|
483
438
|
}
|
|
484
439
|
return mapped;
|
|
485
440
|
}
|
|
@@ -500,12 +455,11 @@ function getAssets() {
|
|
|
500
455
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
501
456
|
return out;
|
|
502
457
|
}
|
|
503
|
-
function generateHydrationScript({
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
)}"].forEach((o=>document.addEventListener(o,(o=>{let a=o.composedPath&&o.composedPath()[0]||o.target,s=t(a);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});${getGlobalHeaderScript()}</script><!--xs-->`;
|
|
458
|
+
function generateHydrationScript({
|
|
459
|
+
eventNames = ["click", "input"],
|
|
460
|
+
nonce
|
|
461
|
+
} = {}) {
|
|
462
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('", "')}"].forEach((o=>document.addEventListener(o,(o=>{let a=o.composedPath&&o.composedPath()[0]||o.target,s=t(a);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});${getGlobalHeaderScript()}</script><!--xs-->`;
|
|
509
463
|
}
|
|
510
464
|
function Hydration(props) {
|
|
511
465
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
@@ -557,7 +511,9 @@ function Assets(props) {
|
|
|
557
511
|
}
|
|
558
512
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
559
513
|
if (options.onReady) {
|
|
560
|
-
options.onCompleteShell = ({
|
|
514
|
+
options.onCompleteShell = ({
|
|
515
|
+
write
|
|
516
|
+
}) => {
|
|
561
517
|
options.onReady({
|
|
562
518
|
write,
|
|
563
519
|
startWriting() {
|
|
@@ -571,7 +527,9 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
571
527
|
}
|
|
572
528
|
function pipeToWritable(code, writable, options = {}) {
|
|
573
529
|
if (options.onReady) {
|
|
574
|
-
options.onCompleteShell = ({
|
|
530
|
+
options.onCompleteShell = ({
|
|
531
|
+
write
|
|
532
|
+
}) => {
|
|
575
533
|
options.onReady({
|
|
576
534
|
write,
|
|
577
535
|
startWriting() {
|
|
@@ -601,19 +559,11 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
601
559
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
602
560
|
if (classResolved) continue;
|
|
603
561
|
let n;
|
|
604
|
-
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
605
|
-
(n = props.className) ? n + " " : ""
|
|
606
|
-
}${ssrClassList(props.classList)}"`;
|
|
562
|
+
result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
|
|
607
563
|
classResolved = true;
|
|
608
564
|
} else if (BooleanAttributes.has(prop)) {
|
|
609
|
-
if (value) result += prop;
|
|
610
|
-
|
|
611
|
-
} else if (
|
|
612
|
-
value == undefined ||
|
|
613
|
-
prop === "ref" ||
|
|
614
|
-
prop.slice(0, 2) === "on" ||
|
|
615
|
-
prop.slice(0, 5) === "prop:"
|
|
616
|
-
) {
|
|
565
|
+
if (value) result += prop;else continue;
|
|
566
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
617
567
|
continue;
|
|
618
568
|
} else {
|
|
619
569
|
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
@@ -637,8 +587,7 @@ function Dynamic(props) {
|
|
|
637
587
|
const comp = p.component,
|
|
638
588
|
t = typeof comp;
|
|
639
589
|
if (comp) {
|
|
640
|
-
if (t === "function") return comp(others);
|
|
641
|
-
else if (t === "string") {
|
|
590
|
+
if (t === "function") return comp(others);else if (t === "string") {
|
|
642
591
|
return ssrElement(comp, others, undefined, true);
|
|
643
592
|
}
|
|
644
593
|
}
|
|
@@ -647,37 +596,4 @@ function Portal(props) {
|
|
|
647
596
|
return "";
|
|
648
597
|
}
|
|
649
598
|
|
|
650
|
-
export {
|
|
651
|
-
Assets,
|
|
652
|
-
Dynamic,
|
|
653
|
-
Hydration,
|
|
654
|
-
HydrationScript,
|
|
655
|
-
NoHydration,
|
|
656
|
-
Portal,
|
|
657
|
-
addEventListener,
|
|
658
|
-
delegateEvents,
|
|
659
|
-
escape,
|
|
660
|
-
generateHydrationScript,
|
|
661
|
-
getAssets,
|
|
662
|
-
getHydrationKey,
|
|
663
|
-
hydrate,
|
|
664
|
-
insert,
|
|
665
|
-
isDev,
|
|
666
|
-
isServer,
|
|
667
|
-
pipeToNodeWritable,
|
|
668
|
-
pipeToWritable,
|
|
669
|
-
render,
|
|
670
|
-
renderToStream,
|
|
671
|
-
renderToString,
|
|
672
|
-
renderToStringAsync,
|
|
673
|
-
resolveSSRNode,
|
|
674
|
-
spread,
|
|
675
|
-
ssr,
|
|
676
|
-
ssrAttribute,
|
|
677
|
-
ssrClassList,
|
|
678
|
-
ssrElement,
|
|
679
|
-
ssrHydrationKey,
|
|
680
|
-
ssrSpread,
|
|
681
|
-
ssrStyle,
|
|
682
|
-
useAssets
|
|
683
|
-
};
|
|
599
|
+
export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, addEventListener, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, hydrate, insert, isDev, isServer, pipeToNodeWritable, pipeToWritable, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
|
package/web/dist/web.cjs
CHANGED
|
@@ -146,13 +146,19 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
146
146
|
delete document[$$EVENTS];
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
function setProperty(node, name, value) {
|
|
150
|
+
!solidJs.sharedConfig.context && (node[name] = value);
|
|
151
|
+
}
|
|
149
152
|
function setAttribute(node, name, value) {
|
|
153
|
+
if (solidJs.sharedConfig.context) return;
|
|
150
154
|
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
151
155
|
}
|
|
152
156
|
function setAttributeNS(node, namespace, name, value) {
|
|
157
|
+
if (solidJs.sharedConfig.context) return;
|
|
153
158
|
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
154
159
|
}
|
|
155
160
|
function className(node, value) {
|
|
161
|
+
if (solidJs.sharedConfig.context) return;
|
|
156
162
|
if (value == null) node.removeAttribute("class");else node.className = value;
|
|
157
163
|
}
|
|
158
164
|
function addEventListener(node, name, handler, delegate) {
|
|
@@ -225,9 +231,6 @@ function dynamicProperty(props, key) {
|
|
|
225
231
|
});
|
|
226
232
|
return props;
|
|
227
233
|
}
|
|
228
|
-
function innerHTML(parent, content) {
|
|
229
|
-
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|
|
230
|
-
}
|
|
231
234
|
function use(fn, element, arg) {
|
|
232
235
|
return solidJs.untrack(() => fn(element, arg));
|
|
233
236
|
}
|
|
@@ -360,7 +363,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
360
363
|
if (forceProp) {
|
|
361
364
|
prop = prop.slice(5);
|
|
362
365
|
isProp = true;
|
|
363
|
-
}
|
|
366
|
+
} else if (solidJs.sharedConfig.context) return value;
|
|
364
367
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
|
|
365
368
|
} else {
|
|
366
369
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -534,6 +537,9 @@ function Hydration(props) {
|
|
|
534
537
|
return props.children;
|
|
535
538
|
}
|
|
536
539
|
function voidFn() {}
|
|
540
|
+
function innerHTML(parent, content) {
|
|
541
|
+
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|
|
542
|
+
}
|
|
537
543
|
|
|
538
544
|
function throwInBrowser(func) {
|
|
539
545
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
@@ -724,6 +730,7 @@ exports.resolveSSRNode = resolveSSRNode;
|
|
|
724
730
|
exports.runHydrationEvents = runHydrationEvents;
|
|
725
731
|
exports.setAttribute = setAttribute;
|
|
726
732
|
exports.setAttributeNS = setAttributeNS;
|
|
733
|
+
exports.setProperty = setProperty;
|
|
727
734
|
exports.spread = spread;
|
|
728
735
|
exports.ssr = ssr;
|
|
729
736
|
exports.ssrAttribute = ssrAttribute;
|