solid-js 1.8.14 → 1.8.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/dist/dev.cjs +8 -7
- package/dist/dev.js +561 -319
- package/dist/server.js +170 -75
- package/dist/solid.cjs +8 -7
- package/dist/solid.js +488 -277
- package/h/dist/h.js +34 -8
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +7 -2
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +216 -94
- package/html/types/lit.d.ts +47 -33
- package/package.json +2 -2
- package/store/dist/dev.js +122 -43
- package/store/dist/server.js +19 -8
- package/store/dist/store.js +113 -40
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +12 -4
- package/store/types/store.d.ts +219 -62
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +7 -2
- package/types/reactive/array.d.ts +14 -6
- package/types/reactive/observable.d.ts +26 -18
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +239 -147
- package/types/render/Suspense.d.ts +7 -7
- package/types/render/component.d.ts +64 -33
- package/types/render/flow.d.ts +47 -35
- package/types/render/hydration.d.ts +13 -13
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +167 -96
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.cjs +13 -11
- package/web/dist/dev.js +635 -92
- package/web/dist/server.js +210 -96
- package/web/dist/web.cjs +13 -11
- package/web/dist/web.js +626 -90
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +29 -12
- package/web/types/server-mock.d.ts +47 -32
package/web/dist/server.js
CHANGED
|
@@ -1,30 +1,86 @@
|
|
|
1
|
-
import { sharedConfig, createRoot, splitProps } from
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { sharedConfig, createRoot, splitProps } from "solid-js";
|
|
2
|
+
export {
|
|
3
|
+
ErrorBoundary,
|
|
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, getCrossReferenceHeader } from "seroval";
|
|
15
|
+
import {
|
|
16
|
+
CustomEventPlugin,
|
|
17
|
+
DOMExceptionPlugin,
|
|
18
|
+
EventPlugin,
|
|
19
|
+
FormDataPlugin,
|
|
20
|
+
HeadersPlugin,
|
|
21
|
+
ReadableStreamPlugin,
|
|
22
|
+
RequestPlugin,
|
|
23
|
+
ResponsePlugin,
|
|
24
|
+
URLSearchParamsPlugin,
|
|
25
|
+
URLPlugin
|
|
26
|
+
} from "seroval-plugins/web";
|
|
5
27
|
|
|
6
|
-
const booleans = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
28
|
+
const booleans = [
|
|
29
|
+
"allowfullscreen",
|
|
30
|
+
"async",
|
|
31
|
+
"autofocus",
|
|
32
|
+
"autoplay",
|
|
33
|
+
"checked",
|
|
34
|
+
"controls",
|
|
35
|
+
"default",
|
|
36
|
+
"disabled",
|
|
37
|
+
"formnovalidate",
|
|
38
|
+
"hidden",
|
|
39
|
+
"indeterminate",
|
|
40
|
+
"inert",
|
|
41
|
+
"ismap",
|
|
42
|
+
"loop",
|
|
43
|
+
"multiple",
|
|
44
|
+
"muted",
|
|
45
|
+
"nomodule",
|
|
46
|
+
"novalidate",
|
|
47
|
+
"open",
|
|
48
|
+
"playsinline",
|
|
49
|
+
"readonly",
|
|
50
|
+
"required",
|
|
51
|
+
"reversed",
|
|
52
|
+
"seamless",
|
|
53
|
+
"selected"
|
|
54
|
+
];
|
|
55
|
+
const BooleanAttributes = /*#__PURE__*/ new Set(booleans);
|
|
56
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
57
|
+
"innerHTML",
|
|
58
|
+
"textContent",
|
|
59
|
+
"innerText",
|
|
60
|
+
"children"
|
|
61
|
+
]);
|
|
62
|
+
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
10
63
|
className: "class",
|
|
11
64
|
htmlFor: "for"
|
|
12
65
|
});
|
|
13
66
|
|
|
14
|
-
const ES2017FLAG = Feature.AggregateError
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function createSerializer({
|
|
18
|
-
onData,
|
|
19
|
-
onDone,
|
|
20
|
-
scopeId,
|
|
21
|
-
onError
|
|
22
|
-
}) {
|
|
67
|
+
const ES2017FLAG = Feature.AggregateError | Feature.BigIntTypedArray;
|
|
68
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
69
|
+
function createSerializer({ onData, onDone, scopeId, onError }) {
|
|
23
70
|
return new Serializer({
|
|
24
71
|
scopeId,
|
|
25
72
|
plugins: [
|
|
26
|
-
|
|
27
|
-
|
|
73
|
+
CustomEventPlugin,
|
|
74
|
+
DOMExceptionPlugin,
|
|
75
|
+
EventPlugin,
|
|
76
|
+
FormDataPlugin,
|
|
77
|
+
HeadersPlugin,
|
|
78
|
+
ReadableStreamPlugin,
|
|
79
|
+
RequestPlugin,
|
|
80
|
+
ResponsePlugin,
|
|
81
|
+
URLSearchParamsPlugin,
|
|
82
|
+
URLPlugin
|
|
83
|
+
],
|
|
28
84
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
29
85
|
disabledFeatures: ES2017FLAG,
|
|
30
86
|
onData,
|
|
@@ -33,15 +89,14 @@ function createSerializer({
|
|
|
33
89
|
});
|
|
34
90
|
}
|
|
35
91
|
function getLocalHeaderScript(id) {
|
|
36
|
-
return getCrossReferenceHeader(id) +
|
|
92
|
+
return getCrossReferenceHeader(id) + ";";
|
|
37
93
|
}
|
|
38
94
|
|
|
39
|
-
const VOID_ELEMENTS =
|
|
95
|
+
const VOID_ELEMENTS =
|
|
96
|
+
/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
40
97
|
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)}`;
|
|
41
98
|
function renderToString(code, options = {}) {
|
|
42
|
-
const {
|
|
43
|
-
renderId
|
|
44
|
-
} = options;
|
|
99
|
+
const { renderId } = options;
|
|
45
100
|
let scripts = "";
|
|
46
101
|
const serializer = createSerializer({
|
|
47
102
|
scopeId: renderId,
|
|
@@ -79,9 +134,7 @@ function renderToString(code, options = {}) {
|
|
|
79
134
|
return html;
|
|
80
135
|
}
|
|
81
136
|
function renderToStringAsync(code, options = {}) {
|
|
82
|
-
const {
|
|
83
|
-
timeoutMs = 30000
|
|
84
|
-
} = options;
|
|
137
|
+
const { timeoutMs = 30000 } = options;
|
|
85
138
|
let timeoutHandle;
|
|
86
139
|
const timeout = new Promise((_, reject) => {
|
|
87
140
|
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
@@ -92,13 +145,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
92
145
|
});
|
|
93
146
|
}
|
|
94
147
|
function renderToStream(code, options = {}) {
|
|
95
|
-
let {
|
|
96
|
-
nonce,
|
|
97
|
-
onCompleteShell,
|
|
98
|
-
onCompleteAll,
|
|
99
|
-
renderId,
|
|
100
|
-
noScripts
|
|
101
|
-
} = options;
|
|
148
|
+
let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options;
|
|
102
149
|
let dispose;
|
|
103
150
|
const blockingPromises = [];
|
|
104
151
|
const pushTask = task => {
|
|
@@ -114,11 +161,12 @@ function renderToStream(code, options = {}) {
|
|
|
114
161
|
const onDone = () => {
|
|
115
162
|
writeTasks();
|
|
116
163
|
doShell();
|
|
117
|
-
onCompleteAll &&
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
164
|
+
onCompleteAll &&
|
|
165
|
+
onCompleteAll({
|
|
166
|
+
write(v) {
|
|
167
|
+
!completed && buffer.write(v);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
122
170
|
writable && writable.end();
|
|
123
171
|
completed = true;
|
|
124
172
|
if (firstFlushed) dispose();
|
|
@@ -175,17 +223,23 @@ function renderToStream(code, options = {}) {
|
|
|
175
223
|
const first = html.indexOf(placeholder);
|
|
176
224
|
if (first === -1) return;
|
|
177
225
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
178
|
-
html = html.replace(
|
|
226
|
+
html = html.replace(
|
|
227
|
+
html.slice(first, last + placeholder.length + 1),
|
|
228
|
+
resolveSSRNode(payloadFn())
|
|
229
|
+
);
|
|
179
230
|
},
|
|
180
231
|
serialize(id, p, wait) {
|
|
181
232
|
const serverOnly = sharedConfig.context.noHydrate;
|
|
182
233
|
if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
|
|
183
234
|
blockingPromises.push(p);
|
|
184
|
-
!serverOnly &&
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
235
|
+
!serverOnly &&
|
|
236
|
+
p
|
|
237
|
+
.then(d => {
|
|
238
|
+
serializer.write(id, d);
|
|
239
|
+
})
|
|
240
|
+
.catch(e => {
|
|
241
|
+
serializer.write(id, e);
|
|
242
|
+
});
|
|
189
243
|
} else if (!serverOnly) serializer.write(id, p);
|
|
190
244
|
},
|
|
191
245
|
roots: 0,
|
|
@@ -195,11 +249,15 @@ function renderToStream(code, options = {}) {
|
|
|
195
249
|
registerFragment(key) {
|
|
196
250
|
if (!registry.has(key)) {
|
|
197
251
|
let resolve, reject;
|
|
198
|
-
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
199
|
-
registry.set(key, err =>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
252
|
+
const p = new Promise((r, rej) => ((resolve = r), (reject = rej)));
|
|
253
|
+
registry.set(key, err =>
|
|
254
|
+
queue(() =>
|
|
255
|
+
queue(() => {
|
|
256
|
+
err ? reject(err) : resolve(true);
|
|
257
|
+
queue(flushEnd);
|
|
258
|
+
})
|
|
259
|
+
)
|
|
260
|
+
);
|
|
203
261
|
serializer.write(key, p);
|
|
204
262
|
}
|
|
205
263
|
return (value, error) => {
|
|
@@ -212,7 +270,7 @@ function renderToStream(code, options = {}) {
|
|
|
212
270
|
}
|
|
213
271
|
if (!completed) {
|
|
214
272
|
if (!firstFlushed) {
|
|
215
|
-
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
273
|
+
queue(() => (html = replacePlaceholder(html, key, value !== undefined ? value : "")));
|
|
216
274
|
resolve(error);
|
|
217
275
|
} else {
|
|
218
276
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
@@ -238,11 +296,12 @@ function renderToStream(code, options = {}) {
|
|
|
238
296
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
239
297
|
buffer.write(html);
|
|
240
298
|
tasks = "";
|
|
241
|
-
onCompleteShell &&
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
299
|
+
onCompleteShell &&
|
|
300
|
+
onCompleteShell({
|
|
301
|
+
write(v) {
|
|
302
|
+
!completed && buffer.write(v);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
246
305
|
shellCompleted = true;
|
|
247
306
|
}
|
|
248
307
|
return {
|
|
@@ -277,7 +336,7 @@ function renderToStream(code, options = {}) {
|
|
|
277
336
|
pipeTo(w) {
|
|
278
337
|
return allSettled(blockingPromises).then(() => {
|
|
279
338
|
let resolve;
|
|
280
|
-
const p = new Promise(r => resolve = r);
|
|
339
|
+
const p = new Promise(r => (resolve = r));
|
|
281
340
|
setTimeout(() => {
|
|
282
341
|
doShell();
|
|
283
342
|
const encoder = new TextEncoder();
|
|
@@ -307,13 +366,13 @@ function renderToStream(code, options = {}) {
|
|
|
307
366
|
};
|
|
308
367
|
}
|
|
309
368
|
function HydrationScript(props) {
|
|
310
|
-
const {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
369
|
+
const { nonce } = sharedConfig.context;
|
|
370
|
+
return ssr(
|
|
371
|
+
generateHydrationScript({
|
|
372
|
+
nonce,
|
|
373
|
+
...props
|
|
374
|
+
})
|
|
375
|
+
);
|
|
317
376
|
}
|
|
318
377
|
function ssr(t, ...nodes) {
|
|
319
378
|
if (nodes.length) {
|
|
@@ -358,7 +417,8 @@ function ssrStyle(value) {
|
|
|
358
417
|
return result;
|
|
359
418
|
}
|
|
360
419
|
function ssrElement(tag, props, children, needsId) {
|
|
361
|
-
if (props == null) props = {};
|
|
420
|
+
if (props == null) props = {};
|
|
421
|
+
else if (typeof props === "function") props = props();
|
|
362
422
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
363
423
|
const keys = Object.keys(props);
|
|
364
424
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
@@ -366,7 +426,8 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
366
426
|
for (let i = 0; i < keys.length; i++) {
|
|
367
427
|
const prop = keys[i];
|
|
368
428
|
if (ChildProperties.has(prop)) {
|
|
369
|
-
if (children === undefined && !skipChildren)
|
|
429
|
+
if (children === undefined && !skipChildren)
|
|
430
|
+
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
370
431
|
continue;
|
|
371
432
|
}
|
|
372
433
|
const value = props[prop];
|
|
@@ -375,10 +436,14 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
375
436
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
376
437
|
if (classResolved) continue;
|
|
377
438
|
let n;
|
|
378
|
-
result += `class="${
|
|
439
|
+
result += `class="${
|
|
440
|
+
escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) +
|
|
441
|
+
ssrClassList(props.classList)
|
|
442
|
+
}"`;
|
|
379
443
|
classResolved = true;
|
|
380
444
|
} else if (BooleanAttributes.has(prop)) {
|
|
381
|
-
if (value) result += prop;
|
|
445
|
+
if (value) result += prop;
|
|
446
|
+
else continue;
|
|
382
447
|
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
383
448
|
continue;
|
|
384
449
|
} else {
|
|
@@ -386,16 +451,17 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
386
451
|
}
|
|
387
452
|
if (i !== keys.length - 1) result += " ";
|
|
388
453
|
}
|
|
389
|
-
if (skipChildren)
|
|
390
|
-
|
|
391
|
-
|
|
454
|
+
if (skipChildren)
|
|
455
|
+
return {
|
|
456
|
+
t: result + "/>"
|
|
457
|
+
};
|
|
392
458
|
if (typeof children === "function") children = children();
|
|
393
459
|
return {
|
|
394
460
|
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
395
461
|
};
|
|
396
462
|
}
|
|
397
463
|
function ssrAttribute(key, value, isBoolean) {
|
|
398
|
-
return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
|
|
464
|
+
return isBoolean ? (value ? " " + key : "") : value != null ? ` ${key}="${value}"` : "";
|
|
399
465
|
}
|
|
400
466
|
function ssrHydrationKey() {
|
|
401
467
|
const hk = getHydrationKey();
|
|
@@ -439,12 +505,13 @@ function escape(s, attr) {
|
|
|
439
505
|
left = iDelim + 1;
|
|
440
506
|
iDelim = s.indexOf(delim, left);
|
|
441
507
|
} while (iDelim >= 0);
|
|
442
|
-
} else
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
508
|
+
} else
|
|
509
|
+
while (iAmp >= 0) {
|
|
510
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
511
|
+
out += "&";
|
|
512
|
+
left = iAmp + 1;
|
|
513
|
+
iAmp = s.indexOf("&", left);
|
|
514
|
+
}
|
|
448
515
|
return left < s.length ? out + s.substring(left) : out;
|
|
449
516
|
}
|
|
450
517
|
function resolveSSRNode(node, top) {
|
|
@@ -456,7 +523,7 @@ function resolveSSRNode(node, top) {
|
|
|
456
523
|
let mapped = "";
|
|
457
524
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
458
525
|
if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
459
|
-
mapped += resolveSSRNode(prev = node[i]);
|
|
526
|
+
mapped += resolveSSRNode((prev = node[i]));
|
|
460
527
|
}
|
|
461
528
|
return mapped;
|
|
462
529
|
}
|
|
@@ -477,11 +544,12 @@ function getAssets() {
|
|
|
477
544
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
478
545
|
return out;
|
|
479
546
|
}
|
|
480
|
-
function generateHydrationScript({
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
} =
|
|
484
|
-
|
|
547
|
+
function generateHydrationScript({ eventNames = ["click", "input"], nonce } = {}) {
|
|
548
|
+
return `<script${
|
|
549
|
+
nonce ? ` nonce="${nonce}"` : ""
|
|
550
|
+
}>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(
|
|
551
|
+
'", "'
|
|
552
|
+
)}"].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(){}});</script><!--xs-->`;
|
|
485
553
|
}
|
|
486
554
|
function Hydration(props) {
|
|
487
555
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
@@ -540,16 +608,20 @@ function replacePlaceholder(html, key, value) {
|
|
|
540
608
|
}
|
|
541
609
|
const RequestContext = Symbol();
|
|
542
610
|
function getRequestEvent() {
|
|
543
|
-
return globalThis[RequestContext]
|
|
611
|
+
return globalThis[RequestContext]
|
|
612
|
+
? globalThis[RequestContext].getStore() ||
|
|
613
|
+
(sharedConfig.context && sharedConfig.context.event) ||
|
|
614
|
+
console.log(
|
|
615
|
+
"RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls."
|
|
616
|
+
)
|
|
617
|
+
: undefined;
|
|
544
618
|
}
|
|
545
619
|
function Assets(props) {
|
|
546
620
|
useAssets(() => props.children);
|
|
547
621
|
}
|
|
548
622
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
549
623
|
if (options.onReady) {
|
|
550
|
-
options.onCompleteShell = ({
|
|
551
|
-
write
|
|
552
|
-
}) => {
|
|
624
|
+
options.onCompleteShell = ({ write }) => {
|
|
553
625
|
options.onReady({
|
|
554
626
|
write,
|
|
555
627
|
startWriting() {
|
|
@@ -563,9 +635,7 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
563
635
|
}
|
|
564
636
|
function pipeToWritable(code, writable, options = {}) {
|
|
565
637
|
if (options.onReady) {
|
|
566
|
-
options.onCompleteShell = ({
|
|
567
|
-
write
|
|
568
|
-
}) => {
|
|
638
|
+
options.onCompleteShell = ({ write }) => {
|
|
569
639
|
options.onReady({
|
|
570
640
|
write,
|
|
571
641
|
startWriting() {
|
|
@@ -595,11 +665,19 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
595
665
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
596
666
|
if (classResolved) continue;
|
|
597
667
|
let n;
|
|
598
|
-
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
668
|
+
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
669
|
+
(n = props.className) ? n + " " : ""
|
|
670
|
+
}${ssrClassList(props.classList)}"`;
|
|
599
671
|
classResolved = true;
|
|
600
672
|
} else if (BooleanAttributes.has(prop)) {
|
|
601
|
-
if (value) result += prop;
|
|
602
|
-
|
|
673
|
+
if (value) result += prop;
|
|
674
|
+
else continue;
|
|
675
|
+
} else if (
|
|
676
|
+
value == undefined ||
|
|
677
|
+
prop === "ref" ||
|
|
678
|
+
prop.slice(0, 2) === "on" ||
|
|
679
|
+
prop.slice(0, 5) === "prop:"
|
|
680
|
+
) {
|
|
603
681
|
continue;
|
|
604
682
|
} else {
|
|
605
683
|
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
@@ -623,7 +701,8 @@ function Dynamic(props) {
|
|
|
623
701
|
const comp = p.component,
|
|
624
702
|
t = typeof comp;
|
|
625
703
|
if (comp) {
|
|
626
|
-
if (t === "function") return comp(others);
|
|
704
|
+
if (t === "function") return comp(others);
|
|
705
|
+
else if (t === "string") {
|
|
627
706
|
return ssrElement(comp, others, undefined, true);
|
|
628
707
|
}
|
|
629
708
|
}
|
|
@@ -632,4 +711,39 @@ function Portal(props) {
|
|
|
632
711
|
return "";
|
|
633
712
|
}
|
|
634
713
|
|
|
635
|
-
export {
|
|
714
|
+
export {
|
|
715
|
+
Assets,
|
|
716
|
+
Dynamic,
|
|
717
|
+
Hydration,
|
|
718
|
+
HydrationScript,
|
|
719
|
+
NoHydration,
|
|
720
|
+
Portal,
|
|
721
|
+
RequestContext,
|
|
722
|
+
addEventListener,
|
|
723
|
+
delegateEvents,
|
|
724
|
+
escape,
|
|
725
|
+
generateHydrationScript,
|
|
726
|
+
getAssets,
|
|
727
|
+
getHydrationKey,
|
|
728
|
+
getRequestEvent,
|
|
729
|
+
hydrate,
|
|
730
|
+
insert,
|
|
731
|
+
isDev,
|
|
732
|
+
isServer,
|
|
733
|
+
pipeToNodeWritable,
|
|
734
|
+
pipeToWritable,
|
|
735
|
+
render,
|
|
736
|
+
renderToStream,
|
|
737
|
+
renderToString,
|
|
738
|
+
renderToStringAsync,
|
|
739
|
+
resolveSSRNode,
|
|
740
|
+
spread,
|
|
741
|
+
ssr,
|
|
742
|
+
ssrAttribute,
|
|
743
|
+
ssrClassList,
|
|
744
|
+
ssrElement,
|
|
745
|
+
ssrHydrationKey,
|
|
746
|
+
ssrSpread,
|
|
747
|
+
ssrStyle,
|
|
748
|
+
useAssets
|
|
749
|
+
};
|
package/web/dist/web.cjs
CHANGED
|
@@ -147,18 +147,19 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
function setProperty(node, name, value) {
|
|
150
|
-
|
|
150
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
151
|
+
node[name] = value;
|
|
151
152
|
}
|
|
152
153
|
function setAttribute(node, name, value) {
|
|
153
|
-
if (solidJs.sharedConfig.context) return;
|
|
154
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
154
155
|
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
155
156
|
}
|
|
156
157
|
function setAttributeNS(node, namespace, name, value) {
|
|
157
|
-
if (solidJs.sharedConfig.context) return;
|
|
158
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
158
159
|
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
159
160
|
}
|
|
160
161
|
function className(node, value) {
|
|
161
|
-
if (solidJs.sharedConfig.context) return;
|
|
162
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
162
163
|
if (value == null) node.removeAttribute("class");else node.className = value;
|
|
163
164
|
}
|
|
164
165
|
function addEventListener(node, name, handler, delegate) {
|
|
@@ -361,7 +362,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
361
362
|
if (forceProp) {
|
|
362
363
|
prop = prop.slice(5);
|
|
363
364
|
isProp = true;
|
|
364
|
-
} else if (solidJs.sharedConfig.context) return value;
|
|
365
|
+
} else if (!!solidJs.sharedConfig.context && node.isConnected) return value;
|
|
365
366
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
|
|
366
367
|
} else {
|
|
367
368
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -396,7 +397,8 @@ function eventHandler(e) {
|
|
|
396
397
|
}
|
|
397
398
|
}
|
|
398
399
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
399
|
-
|
|
400
|
+
const hydrating = !!solidJs.sharedConfig.context && parent.isConnected;
|
|
401
|
+
if (hydrating) {
|
|
400
402
|
!current && (current = [...parent.childNodes]);
|
|
401
403
|
let cleaned = [];
|
|
402
404
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -411,7 +413,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
411
413
|
multi = marker !== undefined;
|
|
412
414
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
413
415
|
if (t === "string" || t === "number") {
|
|
414
|
-
if (
|
|
416
|
+
if (hydrating) return current;
|
|
415
417
|
if (t === "number") value = value.toString();
|
|
416
418
|
if (multi) {
|
|
417
419
|
let node = current[0];
|
|
@@ -425,7 +427,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
425
427
|
} else current = parent.textContent = value;
|
|
426
428
|
}
|
|
427
429
|
} else if (value == null || t === "boolean") {
|
|
428
|
-
if (
|
|
430
|
+
if (hydrating) return current;
|
|
429
431
|
current = cleanChildren(parent, current, marker);
|
|
430
432
|
} else if (t === "function") {
|
|
431
433
|
solidJs.createRenderEffect(() => {
|
|
@@ -441,7 +443,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
441
443
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
442
444
|
return () => current;
|
|
443
445
|
}
|
|
444
|
-
if (
|
|
446
|
+
if (hydrating) {
|
|
445
447
|
if (!array.length) return current;
|
|
446
448
|
if (marker === undefined) return [...parent.childNodes];
|
|
447
449
|
let node = array[0];
|
|
@@ -462,7 +464,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
462
464
|
}
|
|
463
465
|
current = array;
|
|
464
466
|
} else if (value.nodeType) {
|
|
465
|
-
if (
|
|
467
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
466
468
|
if (Array.isArray(current)) {
|
|
467
469
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
468
470
|
cleanChildren(parent, current, null, value);
|
|
@@ -477,7 +479,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
477
479
|
let dynamic = false;
|
|
478
480
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
479
481
|
let item = array[i],
|
|
480
|
-
prev = current && current[
|
|
482
|
+
prev = current && current[normalized.length],
|
|
481
483
|
t;
|
|
482
484
|
if (item == null || item === true || item === false) ; else if ((t = typeof item) === "object" && item.nodeType) {
|
|
483
485
|
normalized.push(item);
|