solid-js 1.7.0-beta.0 → 1.7.0-beta.1
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/LICENSE +1 -1
- package/dist/dev.cjs +35 -15
- package/dist/dev.js +35 -16
- package/dist/server.cjs +88 -69
- package/dist/server.js +88 -69
- package/dist/solid.cjs +31 -12
- package/dist/solid.js +31 -13
- package/h/jsx-runtime/types/jsx.d.ts +3 -0
- package/html/dist/html.cjs +14 -10
- package/html/dist/html.js +15 -11
- package/html/types/lit.d.ts +1 -1
- package/package.json +1 -1
- package/store/dist/dev.cjs +2 -5
- package/store/dist/dev.js +2 -5
- package/store/dist/store.cjs +2 -5
- package/store/dist/store.js +2 -5
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +4 -0
- package/types/reactive/array.d.ts +23 -0
- package/types/reactive/signal.d.ts +36 -1
- package/types/render/flow.d.ts +15 -13
- package/types/server/reactive.d.ts +8 -4
- package/types/server/rendering.d.ts +7 -3
- package/web/dist/dev.cjs +80 -54
- package/web/dist/dev.js +80 -55
- package/web/dist/server.cjs +18 -7
- package/web/dist/server.js +19 -9
- package/web/dist/web.cjs +86 -54
- package/web/dist/web.js +86 -55
- package/web/types/client.d.ts +1 -1
- package/web/types/index.d.ts +2 -1
package/web/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRoot, createRenderEffect, sharedConfig,
|
|
1
|
+
import { createRoot, untrack, createRenderEffect, sharedConfig, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
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"];
|
|
@@ -10,12 +10,33 @@ const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
10
10
|
});
|
|
11
11
|
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
12
12
|
class: "className",
|
|
13
|
-
formnovalidate:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
formnovalidate: {
|
|
14
|
+
$: "formNoValidate",
|
|
15
|
+
BUTTON: 1,
|
|
16
|
+
INPUT: 1
|
|
17
|
+
},
|
|
18
|
+
ismap: {
|
|
19
|
+
$: "isMap",
|
|
20
|
+
IMG: 1
|
|
21
|
+
},
|
|
22
|
+
nomodule: {
|
|
23
|
+
$: "noModule",
|
|
24
|
+
SCRIPT: 1
|
|
25
|
+
},
|
|
26
|
+
playsinline: {
|
|
27
|
+
$: "playsInline",
|
|
28
|
+
VIDEO: 1
|
|
29
|
+
},
|
|
30
|
+
readonly: {
|
|
31
|
+
$: "readOnly",
|
|
32
|
+
INPUT: 1,
|
|
33
|
+
TEXTAREA: 1
|
|
34
|
+
}
|
|
18
35
|
});
|
|
36
|
+
function getPropAlias(prop, tagName) {
|
|
37
|
+
const a = PropAliases[prop];
|
|
38
|
+
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
39
|
+
}
|
|
19
40
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
20
41
|
const SVGElements = /*#__PURE__*/new Set([
|
|
21
42
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -97,13 +118,14 @@ function render(code, element, init, options = {}) {
|
|
|
97
118
|
element.textContent = "";
|
|
98
119
|
};
|
|
99
120
|
}
|
|
100
|
-
function template(html,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
function template(html, isSVG, isCE) {
|
|
122
|
+
let node;
|
|
123
|
+
const create = () => {
|
|
124
|
+
const t = document.createElement("template");
|
|
125
|
+
t.innerHTML = html;
|
|
126
|
+
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
127
|
+
};
|
|
128
|
+
return isCE ? () => (node || (node = create())).cloneNode(true) : () => untrack(() => document.importNode(node || (node = create()), true));
|
|
107
129
|
}
|
|
108
130
|
function delegateEvents(eventNames, document = window.document) {
|
|
109
131
|
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
@@ -248,7 +270,7 @@ function getNextElement(template) {
|
|
|
248
270
|
if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
249
271
|
if (sharedConfig.context) console.warn("Unable to find DOM nodes for hydration key:", key);
|
|
250
272
|
if (!template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
|
|
251
|
-
return template
|
|
273
|
+
return template();
|
|
252
274
|
}
|
|
253
275
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
254
276
|
sharedConfig.registry.delete(key);
|
|
@@ -303,7 +325,7 @@ function toggleClassKey(node, key, value) {
|
|
|
303
325
|
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
304
326
|
}
|
|
305
327
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
306
|
-
let isCE, isProp, isChildProp;
|
|
328
|
+
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
307
329
|
if (prop === "style") return style(node, value, prev);
|
|
308
330
|
if (prop === "classList") return classList(node, value, prev);
|
|
309
331
|
if (value === prev) return prev;
|
|
@@ -328,8 +350,14 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
328
350
|
addEventListener(node, name, value, delegate);
|
|
329
351
|
delegate && delegateEvents([name]);
|
|
330
352
|
}
|
|
331
|
-
} else if (
|
|
332
|
-
|
|
353
|
+
} else if (prop.slice(0, 5) === "attr:") {
|
|
354
|
+
setAttribute(node, prop.slice(5), value);
|
|
355
|
+
} else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
|
|
356
|
+
if (forceProp) {
|
|
357
|
+
prop = prop.slice(5);
|
|
358
|
+
isProp = true;
|
|
359
|
+
}
|
|
360
|
+
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
|
|
333
361
|
} else {
|
|
334
362
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
335
363
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);
|
|
@@ -351,17 +379,7 @@ function eventHandler(e) {
|
|
|
351
379
|
return node || document;
|
|
352
380
|
}
|
|
353
381
|
});
|
|
354
|
-
if (sharedConfig.registry && !sharedConfig.done)
|
|
355
|
-
sharedConfig.done = true;
|
|
356
|
-
document.querySelectorAll("[id^=pl-]").forEach(elem => {
|
|
357
|
-
while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
|
|
358
|
-
let x = elem.nextSibling;
|
|
359
|
-
elem.remove();
|
|
360
|
-
elem = x;
|
|
361
|
-
}
|
|
362
|
-
elem && elem.remove();
|
|
363
|
-
});
|
|
364
|
-
}
|
|
382
|
+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
365
383
|
while (node) {
|
|
366
384
|
const handler = node[key];
|
|
367
385
|
if (handler && !node.disabled) {
|
|
@@ -459,7 +477,9 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
459
477
|
}
|
|
460
478
|
} else {
|
|
461
479
|
const value = String(item);
|
|
462
|
-
if (
|
|
480
|
+
if (value === "<!>") {
|
|
481
|
+
if (prev && prev.nodeType === 8) normalized.push(prev);
|
|
482
|
+
} else if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
463
483
|
normalized.push(prev);
|
|
464
484
|
} else normalized.push(document.createTextNode(value));
|
|
465
485
|
}
|
|
@@ -528,6 +548,7 @@ function escape(html) {}
|
|
|
528
548
|
function ssrSpread(props, isSVG, skipChildren) {}
|
|
529
549
|
|
|
530
550
|
const isServer = false;
|
|
551
|
+
const isDev = true;
|
|
531
552
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
532
553
|
function createElement(tagName, isSVG = false) {
|
|
533
554
|
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
@@ -541,37 +562,41 @@ function Portal(props) {
|
|
|
541
562
|
useShadow
|
|
542
563
|
} = props,
|
|
543
564
|
marker = document.createTextNode(""),
|
|
544
|
-
mount = props.mount || document.body
|
|
565
|
+
mount = () => props.mount || document.body,
|
|
566
|
+
content = createMemo(renderPortal());
|
|
545
567
|
function renderPortal() {
|
|
546
568
|
if (sharedConfig.context) {
|
|
547
569
|
const [s, set] = createSignal(false);
|
|
548
|
-
|
|
570
|
+
onMount(() => set(true));
|
|
549
571
|
return () => s() && props.children;
|
|
550
572
|
} else return () => props.children;
|
|
551
573
|
}
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
574
|
+
createRenderEffect(() => {
|
|
575
|
+
const el = mount();
|
|
576
|
+
if (el instanceof HTMLHeadElement) {
|
|
577
|
+
const [clean, setClean] = createSignal(false);
|
|
578
|
+
const cleanup = () => setClean(true);
|
|
579
|
+
createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
|
|
580
|
+
onCleanup(() => {
|
|
581
|
+
if (sharedConfig.context) queueMicrotask(cleanup);else cleanup();
|
|
582
|
+
});
|
|
583
|
+
} else {
|
|
584
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
585
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
586
|
+
mode: "open"
|
|
587
|
+
}) : container;
|
|
588
|
+
Object.defineProperty(container, "_$host", {
|
|
589
|
+
get() {
|
|
590
|
+
return marker.parentNode;
|
|
591
|
+
},
|
|
592
|
+
configurable: true
|
|
593
|
+
});
|
|
594
|
+
insert(renderRoot, content);
|
|
595
|
+
el.appendChild(container);
|
|
596
|
+
props.ref && props.ref(container);
|
|
597
|
+
onCleanup(() => el.removeChild(container));
|
|
598
|
+
}
|
|
599
|
+
});
|
|
575
600
|
return marker;
|
|
576
601
|
}
|
|
577
602
|
function Dynamic(props) {
|
|
@@ -594,4 +619,4 @@ function Dynamic(props) {
|
|
|
594
619
|
});
|
|
595
620
|
}
|
|
596
621
|
|
|
597
|
-
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal,
|
|
622
|
+
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getPropAlias, hydrate, innerHTML, insert, isDev, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
package/web/dist/server.cjs
CHANGED
|
@@ -262,7 +262,7 @@ function toRefParam(index) {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
265
|
-
const REPLACE_SCRIPT = `function $df(e,t,
|
|
265
|
+
const REPLACE_SCRIPT = `function $df(e,n,t,o,d){if(t=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;_$HY.done?o.remove():o.replaceWith(t.content)}t.remove(),_$HY.set(e,n),_$HY.fe(e)}`;
|
|
266
266
|
function renderToString(code, options = {}) {
|
|
267
267
|
let scripts = "";
|
|
268
268
|
solidJs.sharedConfig.context = {
|
|
@@ -278,7 +278,10 @@ function renderToString(code, options = {}) {
|
|
|
278
278
|
scripts += `_$HY.set("${id}", ${stringify(p)});`;
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
let html =
|
|
281
|
+
let html = solidJs.createRoot(d => {
|
|
282
|
+
setTimeout(d);
|
|
283
|
+
return resolveSSRNode(escape(code()));
|
|
284
|
+
});
|
|
282
285
|
solidJs.sharedConfig.context.noHydrate = true;
|
|
283
286
|
html = injectAssets(solidJs.sharedConfig.context.assets, html);
|
|
284
287
|
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
@@ -304,6 +307,7 @@ function renderToStream(code, options = {}) {
|
|
|
304
307
|
onCompleteAll,
|
|
305
308
|
renderId
|
|
306
309
|
} = options;
|
|
310
|
+
let dispose;
|
|
307
311
|
const blockingResources = [];
|
|
308
312
|
const registry = new Map();
|
|
309
313
|
const dedupe = new WeakMap();
|
|
@@ -317,6 +321,7 @@ function renderToStream(code, options = {}) {
|
|
|
317
321
|
});
|
|
318
322
|
writable && writable.end();
|
|
319
323
|
completed = true;
|
|
324
|
+
setTimeout(dispose);
|
|
320
325
|
}
|
|
321
326
|
};
|
|
322
327
|
const pushTask = task => {
|
|
@@ -404,7 +409,10 @@ function renderToStream(code, options = {}) {
|
|
|
404
409
|
};
|
|
405
410
|
}
|
|
406
411
|
};
|
|
407
|
-
let html =
|
|
412
|
+
let html = solidJs.createRoot(d => {
|
|
413
|
+
dispose = d;
|
|
414
|
+
return resolveSSRNode(escape(code()));
|
|
415
|
+
});
|
|
408
416
|
function doShell() {
|
|
409
417
|
solidJs.sharedConfig.context = context;
|
|
410
418
|
context.noHydrate = true;
|
|
@@ -502,7 +510,7 @@ function ssrClassList(value) {
|
|
|
502
510
|
classValue = !!value[key];
|
|
503
511
|
if (!key || key === "undefined" || !classValue) continue;
|
|
504
512
|
i && (result += " ");
|
|
505
|
-
result += key;
|
|
513
|
+
result += escape(key);
|
|
506
514
|
}
|
|
507
515
|
return result;
|
|
508
516
|
}
|
|
@@ -539,7 +547,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
539
547
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
540
548
|
if (classResolved) continue;
|
|
541
549
|
let n;
|
|
542
|
-
result += `class="${(n = props.class) ? n + " " : ""
|
|
550
|
+
result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
|
|
543
551
|
classResolved = true;
|
|
544
552
|
} else if (BooleanAttributes.has(prop)) {
|
|
545
553
|
if (value) result += prop;else continue;
|
|
@@ -552,7 +560,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
552
560
|
}
|
|
553
561
|
if (skipChildren) {
|
|
554
562
|
return {
|
|
555
|
-
t: result +
|
|
563
|
+
t: result + "/>"
|
|
556
564
|
};
|
|
557
565
|
}
|
|
558
566
|
return {
|
|
@@ -773,9 +781,10 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
773
781
|
classResolved = true;
|
|
774
782
|
} else if (BooleanAttributes.has(prop)) {
|
|
775
783
|
if (value) result += prop;else continue;
|
|
776
|
-
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
784
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
777
785
|
continue;
|
|
778
786
|
} else {
|
|
787
|
+
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
779
788
|
result += `${Aliases[prop] || prop}="${escape(value, true)}"`;
|
|
780
789
|
}
|
|
781
790
|
if (i !== keys.length - 1) result += " ";
|
|
@@ -784,6 +793,7 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
784
793
|
}
|
|
785
794
|
|
|
786
795
|
const isServer = true;
|
|
796
|
+
const isDev = false;
|
|
787
797
|
function render() {}
|
|
788
798
|
function hydrate() {}
|
|
789
799
|
function insert() {}
|
|
@@ -858,6 +868,7 @@ exports.getAssets = getAssets;
|
|
|
858
868
|
exports.getHydrationKey = getHydrationKey;
|
|
859
869
|
exports.hydrate = hydrate;
|
|
860
870
|
exports.insert = insert;
|
|
871
|
+
exports.isDev = isDev;
|
|
861
872
|
exports.isServer = isServer;
|
|
862
873
|
exports.pipeToNodeWritable = pipeToNodeWritable;
|
|
863
874
|
exports.pipeToWritable = pipeToWritable;
|
package/web/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sharedConfig, splitProps } from 'solid-js';
|
|
1
|
+
import { sharedConfig, createRoot, splitProps } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, mergeProps } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
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"];
|
|
@@ -261,7 +261,7 @@ function toRefParam(index) {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
264
|
-
const REPLACE_SCRIPT = `function $df(e,t,
|
|
264
|
+
const REPLACE_SCRIPT = `function $df(e,n,t,o,d){if(t=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;_$HY.done?o.remove():o.replaceWith(t.content)}t.remove(),_$HY.set(e,n),_$HY.fe(e)}`;
|
|
265
265
|
function renderToString(code, options = {}) {
|
|
266
266
|
let scripts = "";
|
|
267
267
|
sharedConfig.context = {
|
|
@@ -277,7 +277,10 @@ function renderToString(code, options = {}) {
|
|
|
277
277
|
scripts += `_$HY.set("${id}", ${stringify(p)});`;
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
-
let html =
|
|
280
|
+
let html = createRoot(d => {
|
|
281
|
+
setTimeout(d);
|
|
282
|
+
return resolveSSRNode(escape(code()));
|
|
283
|
+
});
|
|
281
284
|
sharedConfig.context.noHydrate = true;
|
|
282
285
|
html = injectAssets(sharedConfig.context.assets, html);
|
|
283
286
|
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
@@ -303,6 +306,7 @@ function renderToStream(code, options = {}) {
|
|
|
303
306
|
onCompleteAll,
|
|
304
307
|
renderId
|
|
305
308
|
} = options;
|
|
309
|
+
let dispose;
|
|
306
310
|
const blockingResources = [];
|
|
307
311
|
const registry = new Map();
|
|
308
312
|
const dedupe = new WeakMap();
|
|
@@ -316,6 +320,7 @@ function renderToStream(code, options = {}) {
|
|
|
316
320
|
});
|
|
317
321
|
writable && writable.end();
|
|
318
322
|
completed = true;
|
|
323
|
+
setTimeout(dispose);
|
|
319
324
|
}
|
|
320
325
|
};
|
|
321
326
|
const pushTask = task => {
|
|
@@ -403,7 +408,10 @@ function renderToStream(code, options = {}) {
|
|
|
403
408
|
};
|
|
404
409
|
}
|
|
405
410
|
};
|
|
406
|
-
let html =
|
|
411
|
+
let html = createRoot(d => {
|
|
412
|
+
dispose = d;
|
|
413
|
+
return resolveSSRNode(escape(code()));
|
|
414
|
+
});
|
|
407
415
|
function doShell() {
|
|
408
416
|
sharedConfig.context = context;
|
|
409
417
|
context.noHydrate = true;
|
|
@@ -501,7 +509,7 @@ function ssrClassList(value) {
|
|
|
501
509
|
classValue = !!value[key];
|
|
502
510
|
if (!key || key === "undefined" || !classValue) continue;
|
|
503
511
|
i && (result += " ");
|
|
504
|
-
result += key;
|
|
512
|
+
result += escape(key);
|
|
505
513
|
}
|
|
506
514
|
return result;
|
|
507
515
|
}
|
|
@@ -538,7 +546,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
538
546
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
539
547
|
if (classResolved) continue;
|
|
540
548
|
let n;
|
|
541
|
-
result += `class="${(n = props.class) ? n + " " : ""
|
|
549
|
+
result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
|
|
542
550
|
classResolved = true;
|
|
543
551
|
} else if (BooleanAttributes.has(prop)) {
|
|
544
552
|
if (value) result += prop;else continue;
|
|
@@ -551,7 +559,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
551
559
|
}
|
|
552
560
|
if (skipChildren) {
|
|
553
561
|
return {
|
|
554
|
-
t: result +
|
|
562
|
+
t: result + "/>"
|
|
555
563
|
};
|
|
556
564
|
}
|
|
557
565
|
return {
|
|
@@ -772,9 +780,10 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
772
780
|
classResolved = true;
|
|
773
781
|
} else if (BooleanAttributes.has(prop)) {
|
|
774
782
|
if (value) result += prop;else continue;
|
|
775
|
-
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
783
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
776
784
|
continue;
|
|
777
785
|
} else {
|
|
786
|
+
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
778
787
|
result += `${Aliases[prop] || prop}="${escape(value, true)}"`;
|
|
779
788
|
}
|
|
780
789
|
if (i !== keys.length - 1) result += " ";
|
|
@@ -783,6 +792,7 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
783
792
|
}
|
|
784
793
|
|
|
785
794
|
const isServer = true;
|
|
795
|
+
const isDev = false;
|
|
786
796
|
function render() {}
|
|
787
797
|
function hydrate() {}
|
|
788
798
|
function insert() {}
|
|
@@ -803,4 +813,4 @@ function Portal(props) {
|
|
|
803
813
|
return "";
|
|
804
814
|
}
|
|
805
815
|
|
|
806
|
-
export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, addEventListener, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, hydrate, insert, isServer, pipeToNodeWritable, pipeToWritable, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, stringify, useAssets };
|
|
816
|
+
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, stringify, useAssets };
|