solid-js 1.5.6 → 1.6.0-beta.0
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 +71 -61
- package/dist/dev.js +71 -61
- package/dist/solid.cjs +71 -61
- package/dist/solid.js +71 -61
- package/html/dist/html.cjs +30 -10
- package/html/dist/html.js +30 -10
- package/package.json +22 -22
- package/store/package.json +7 -7
- package/types/reactive/signal.d.ts +1 -1
- package/universal/dist/dev.cjs +4 -20
- package/universal/dist/dev.js +5 -21
- package/universal/dist/universal.cjs +4 -20
- package/universal/dist/universal.js +5 -21
- package/web/dist/dev.cjs +37 -44
- package/web/dist/dev.js +35 -46
- package/web/dist/server.cjs +34 -20
- package/web/dist/server.js +34 -21
- package/web/dist/web.cjs +37 -44
- package/web/dist/web.js +35 -46
- package/web/package.json +7 -7
- package/web/types/client.d.ts +6 -5
- package/web/types/core.d.ts +1 -3
- package/web/types/index.d.ts +3 -1
- package/web/types/server.d.ts +11 -4
package/web/dist/dev.cjs
CHANGED
|
@@ -7,18 +7,16 @@ var solidJs = require('solid-js');
|
|
|
7
7
|
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"];
|
|
8
8
|
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
9
9
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
10
|
-
const Aliases =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
readonly: "readOnly"
|
|
21
|
-
};
|
|
10
|
+
const Aliases = Object.create(null);
|
|
11
|
+
Aliases.className = "class";
|
|
12
|
+
Aliases.htmlFor = "for";
|
|
13
|
+
const PropAliases = Object.create(null);
|
|
14
|
+
PropAliases.class = "className";
|
|
15
|
+
PropAliases.formnovalidate = "formNoValidate";
|
|
16
|
+
PropAliases.ismap = "isMap";
|
|
17
|
+
PropAliases.nomodule = "noModule";
|
|
18
|
+
PropAliases.playsinline = "playsInline";
|
|
19
|
+
PropAliases.readonly = "readOnly";
|
|
22
20
|
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"]);
|
|
23
21
|
const SVGElements = /*#__PURE__*/new Set([
|
|
24
22
|
"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",
|
|
@@ -31,12 +29,6 @@ const SVGNamespace = {
|
|
|
31
29
|
};
|
|
32
30
|
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
|
|
33
31
|
|
|
34
|
-
function memo(fn, equals) {
|
|
35
|
-
return solidJs.createMemo(fn, undefined, !equals ? {
|
|
36
|
-
equals
|
|
37
|
-
} : undefined);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
32
|
function reconcileArrays(parentNode, a, b) {
|
|
41
33
|
let bLength = b.length,
|
|
42
34
|
aEnd = a.length,
|
|
@@ -95,12 +87,12 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
95
87
|
}
|
|
96
88
|
|
|
97
89
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
98
|
-
function render(code, element, init) {
|
|
90
|
+
function render(code, element, init, options = {}) {
|
|
99
91
|
let disposer;
|
|
100
92
|
solidJs.createRoot(dispose => {
|
|
101
93
|
disposer = dispose;
|
|
102
94
|
element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
|
|
103
|
-
});
|
|
95
|
+
}, options.owner);
|
|
104
96
|
return () => {
|
|
105
97
|
disposer();
|
|
106
98
|
element.textContent = "";
|
|
@@ -169,11 +161,12 @@ function classList(node, value, prev = {}) {
|
|
|
169
161
|
}
|
|
170
162
|
return prev;
|
|
171
163
|
}
|
|
172
|
-
function style(node, value, prev
|
|
164
|
+
function style(node, value, prev) {
|
|
165
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
173
166
|
const nodeStyle = node.style;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
168
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
169
|
+
prev || (prev = {});
|
|
177
170
|
value || (value = {});
|
|
178
171
|
let v, s;
|
|
179
172
|
for (s in prev) {
|
|
@@ -189,10 +182,14 @@ function style(node, value, prev = {}) {
|
|
|
189
182
|
}
|
|
190
183
|
return prev;
|
|
191
184
|
}
|
|
192
|
-
function spread(node,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
185
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
186
|
+
const prevProps = {};
|
|
187
|
+
if (!skipChildren) {
|
|
188
|
+
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
189
|
+
}
|
|
190
|
+
solidJs.createRenderEffect(() => props.ref && props.ref(node));
|
|
191
|
+
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
192
|
+
return prevProps;
|
|
196
193
|
}
|
|
197
194
|
function dynamicProperty(props, key) {
|
|
198
195
|
const src = props[key];
|
|
@@ -220,7 +217,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
220
217
|
for (const prop in prevProps) {
|
|
221
218
|
if (!(prop in props)) {
|
|
222
219
|
if (prop === "children") continue;
|
|
223
|
-
assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
220
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
224
221
|
}
|
|
225
222
|
}
|
|
226
223
|
for (const prop in props) {
|
|
@@ -243,7 +240,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
243
240
|
count: 0
|
|
244
241
|
};
|
|
245
242
|
gatherHydratable(element, options.renderId);
|
|
246
|
-
const dispose = render(code, element, [...element.childNodes]);
|
|
243
|
+
const dispose = render(code, element, [...element.childNodes], options);
|
|
247
244
|
solidJs.sharedConfig.context = null;
|
|
248
245
|
return dispose;
|
|
249
246
|
}
|
|
@@ -312,9 +309,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
312
309
|
if (prop === "classList") return classList(node, value, prev);
|
|
313
310
|
if (value === prev) return prev;
|
|
314
311
|
if (prop === "ref") {
|
|
315
|
-
if (!skipRef)
|
|
316
|
-
value(node);
|
|
317
|
-
}
|
|
312
|
+
if (!skipRef) value(node);
|
|
318
313
|
} else if (prop.slice(0, 3) === "on:") {
|
|
319
314
|
const e = prop.slice(3);
|
|
320
315
|
prev && node.removeEventListener(e, prev);
|
|
@@ -371,15 +366,6 @@ function eventHandler(e) {
|
|
|
371
366
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
372
367
|
}
|
|
373
368
|
}
|
|
374
|
-
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
375
|
-
props || (props = {});
|
|
376
|
-
if (!skipChildren) {
|
|
377
|
-
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
378
|
-
}
|
|
379
|
-
solidJs.createRenderEffect(() => props.ref && props.ref(node));
|
|
380
|
-
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
381
|
-
return prevProps;
|
|
382
|
-
}
|
|
383
369
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
384
370
|
if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
|
|
385
371
|
while (typeof current === "function") current = current();
|
|
@@ -474,7 +460,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
474
460
|
}
|
|
475
461
|
return dynamic;
|
|
476
462
|
}
|
|
477
|
-
function appendNodes(parent, array, marker) {
|
|
463
|
+
function appendNodes(parent, array, marker = null) {
|
|
478
464
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
479
465
|
}
|
|
480
466
|
function cleanChildren(parent, current, marker, replacement) {
|
|
@@ -507,6 +493,9 @@ function getHydrationKey() {
|
|
|
507
493
|
function NoHydration(props) {
|
|
508
494
|
return solidJs.sharedConfig.context ? undefined : props.children;
|
|
509
495
|
}
|
|
496
|
+
function Hydration(props) {
|
|
497
|
+
return props.children;
|
|
498
|
+
}
|
|
510
499
|
function voidFn() {}
|
|
511
500
|
|
|
512
501
|
function throwInBrowser(func) {
|
|
@@ -642,6 +631,10 @@ Object.defineProperty(exports, 'getOwner', {
|
|
|
642
631
|
enumerable: true,
|
|
643
632
|
get: function () { return solidJs.getOwner; }
|
|
644
633
|
});
|
|
634
|
+
Object.defineProperty(exports, 'memo', {
|
|
635
|
+
enumerable: true,
|
|
636
|
+
get: function () { return solidJs.createMemo; }
|
|
637
|
+
});
|
|
645
638
|
Object.defineProperty(exports, 'mergeProps', {
|
|
646
639
|
enumerable: true,
|
|
647
640
|
get: function () { return solidJs.mergeProps; }
|
|
@@ -656,6 +649,7 @@ exports.ChildProperties = ChildProperties;
|
|
|
656
649
|
exports.DOMElements = DOMElements;
|
|
657
650
|
exports.DelegatedEvents = DelegatedEvents;
|
|
658
651
|
exports.Dynamic = Dynamic;
|
|
652
|
+
exports.Hydration = Hydration;
|
|
659
653
|
exports.HydrationScript = voidFn;
|
|
660
654
|
exports.NoHydration = NoHydration;
|
|
661
655
|
exports.Portal = Portal;
|
|
@@ -681,7 +675,6 @@ exports.hydrate = hydrate;
|
|
|
681
675
|
exports.innerHTML = innerHTML;
|
|
682
676
|
exports.insert = insert;
|
|
683
677
|
exports.isServer = isServer;
|
|
684
|
-
exports.memo = memo;
|
|
685
678
|
exports.render = render;
|
|
686
679
|
exports.renderToStream = renderToStream;
|
|
687
680
|
exports.renderToString = renderToString;
|
package/web/dist/dev.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
|
|
1
|
+
import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createSignal, onCleanup, splitProps, createMemo, $DEVCOMP } from 'solid-js';
|
|
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"];
|
|
5
5
|
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
6
6
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
7
|
-
const Aliases =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly: "readOnly"
|
|
18
|
-
};
|
|
7
|
+
const Aliases = Object.create(null);
|
|
8
|
+
Aliases.className = "class";
|
|
9
|
+
Aliases.htmlFor = "for";
|
|
10
|
+
const PropAliases = Object.create(null);
|
|
11
|
+
PropAliases.class = "className";
|
|
12
|
+
PropAliases.formnovalidate = "formNoValidate";
|
|
13
|
+
PropAliases.ismap = "isMap";
|
|
14
|
+
PropAliases.nomodule = "noModule";
|
|
15
|
+
PropAliases.playsinline = "playsInline";
|
|
16
|
+
PropAliases.readonly = "readOnly";
|
|
19
17
|
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
18
|
const SVGElements = /*#__PURE__*/new Set([
|
|
21
19
|
"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",
|
|
@@ -28,12 +26,6 @@ const SVGNamespace = {
|
|
|
28
26
|
};
|
|
29
27
|
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
|
|
30
28
|
|
|
31
|
-
function memo(fn, equals) {
|
|
32
|
-
return createMemo(fn, undefined, !equals ? {
|
|
33
|
-
equals
|
|
34
|
-
} : undefined);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
29
|
function reconcileArrays(parentNode, a, b) {
|
|
38
30
|
let bLength = b.length,
|
|
39
31
|
aEnd = a.length,
|
|
@@ -92,12 +84,12 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
92
84
|
}
|
|
93
85
|
|
|
94
86
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
95
|
-
function render(code, element, init) {
|
|
87
|
+
function render(code, element, init, options = {}) {
|
|
96
88
|
let disposer;
|
|
97
89
|
createRoot(dispose => {
|
|
98
90
|
disposer = dispose;
|
|
99
91
|
element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
|
|
100
|
-
});
|
|
92
|
+
}, options.owner);
|
|
101
93
|
return () => {
|
|
102
94
|
disposer();
|
|
103
95
|
element.textContent = "";
|
|
@@ -166,11 +158,12 @@ function classList(node, value, prev = {}) {
|
|
|
166
158
|
}
|
|
167
159
|
return prev;
|
|
168
160
|
}
|
|
169
|
-
function style(node, value, prev
|
|
161
|
+
function style(node, value, prev) {
|
|
162
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
170
163
|
const nodeStyle = node.style;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
164
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
165
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
166
|
+
prev || (prev = {});
|
|
174
167
|
value || (value = {});
|
|
175
168
|
let v, s;
|
|
176
169
|
for (s in prev) {
|
|
@@ -186,10 +179,14 @@ function style(node, value, prev = {}) {
|
|
|
186
179
|
}
|
|
187
180
|
return prev;
|
|
188
181
|
}
|
|
189
|
-
function spread(node,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
183
|
+
const prevProps = {};
|
|
184
|
+
if (!skipChildren) {
|
|
185
|
+
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
186
|
+
}
|
|
187
|
+
createRenderEffect(() => props.ref && props.ref(node));
|
|
188
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
189
|
+
return prevProps;
|
|
193
190
|
}
|
|
194
191
|
function dynamicProperty(props, key) {
|
|
195
192
|
const src = props[key];
|
|
@@ -217,7 +214,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
217
214
|
for (const prop in prevProps) {
|
|
218
215
|
if (!(prop in props)) {
|
|
219
216
|
if (prop === "children") continue;
|
|
220
|
-
assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
217
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
for (const prop in props) {
|
|
@@ -240,7 +237,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
240
237
|
count: 0
|
|
241
238
|
};
|
|
242
239
|
gatherHydratable(element, options.renderId);
|
|
243
|
-
const dispose = render(code, element, [...element.childNodes]);
|
|
240
|
+
const dispose = render(code, element, [...element.childNodes], options);
|
|
244
241
|
sharedConfig.context = null;
|
|
245
242
|
return dispose;
|
|
246
243
|
}
|
|
@@ -309,9 +306,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
309
306
|
if (prop === "classList") return classList(node, value, prev);
|
|
310
307
|
if (value === prev) return prev;
|
|
311
308
|
if (prop === "ref") {
|
|
312
|
-
if (!skipRef)
|
|
313
|
-
value(node);
|
|
314
|
-
}
|
|
309
|
+
if (!skipRef) value(node);
|
|
315
310
|
} else if (prop.slice(0, 3) === "on:") {
|
|
316
311
|
const e = prop.slice(3);
|
|
317
312
|
prev && node.removeEventListener(e, prev);
|
|
@@ -368,15 +363,6 @@ function eventHandler(e) {
|
|
|
368
363
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
369
364
|
}
|
|
370
365
|
}
|
|
371
|
-
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
372
|
-
props || (props = {});
|
|
373
|
-
if (!skipChildren) {
|
|
374
|
-
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
375
|
-
}
|
|
376
|
-
createRenderEffect(() => props.ref && props.ref(node));
|
|
377
|
-
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
378
|
-
return prevProps;
|
|
379
|
-
}
|
|
380
366
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
381
367
|
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
382
368
|
while (typeof current === "function") current = current();
|
|
@@ -471,7 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
471
457
|
}
|
|
472
458
|
return dynamic;
|
|
473
459
|
}
|
|
474
|
-
function appendNodes(parent, array, marker) {
|
|
460
|
+
function appendNodes(parent, array, marker = null) {
|
|
475
461
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
476
462
|
}
|
|
477
463
|
function cleanChildren(parent, current, marker, replacement) {
|
|
@@ -504,6 +490,9 @@ function getHydrationKey() {
|
|
|
504
490
|
function NoHydration(props) {
|
|
505
491
|
return sharedConfig.context ? undefined : props.children;
|
|
506
492
|
}
|
|
493
|
+
function Hydration(props) {
|
|
494
|
+
return props.children;
|
|
495
|
+
}
|
|
507
496
|
function voidFn() {}
|
|
508
497
|
|
|
509
498
|
function throwInBrowser(func) {
|
|
@@ -595,4 +584,4 @@ function Dynamic(props) {
|
|
|
595
584
|
});
|
|
596
585
|
}
|
|
597
586
|
|
|
598
|
-
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer,
|
|
587
|
+
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, 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
|
@@ -8,10 +8,16 @@ const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked"
|
|
|
8
8
|
const BooleanAttributes = /*#__PURE__*/new Set(booleans);
|
|
9
9
|
/*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
10
10
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
11
|
-
const Aliases =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const Aliases = Object.create(null);
|
|
12
|
+
Aliases.className = "class";
|
|
13
|
+
Aliases.htmlFor = "for";
|
|
14
|
+
const PropAliases = Object.create(null);
|
|
15
|
+
PropAliases.class = "className";
|
|
16
|
+
PropAliases.formnovalidate = "formNoValidate";
|
|
17
|
+
PropAliases.ismap = "isMap";
|
|
18
|
+
PropAliases.nomodule = "noModule";
|
|
19
|
+
PropAliases.playsinline = "playsInline";
|
|
20
|
+
PropAliases.readonly = "readOnly";
|
|
15
21
|
|
|
16
22
|
const {
|
|
17
23
|
hasOwnProperty
|
|
@@ -273,6 +279,7 @@ function renderToString(code, options = {}) {
|
|
|
273
279
|
assets: [],
|
|
274
280
|
nonce: options.nonce,
|
|
275
281
|
writeResource(id, p, error) {
|
|
282
|
+
if (solidJs.sharedConfig.context.noHydrate) return;
|
|
276
283
|
if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
|
|
277
284
|
scripts += `_$HY.set("${id}", ${stringify(p)});`;
|
|
278
285
|
}
|
|
@@ -365,9 +372,11 @@ function renderToStream(code, options = {}) {
|
|
|
365
372
|
html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
|
|
366
373
|
},
|
|
367
374
|
writeResource(id, p, error, wait) {
|
|
368
|
-
|
|
369
|
-
if (
|
|
370
|
-
if (!
|
|
375
|
+
const serverOnly = solidJs.sharedConfig.context.noHydrate;
|
|
376
|
+
if (error) return !serverOnly && pushTask(serializeSet(dedupe, id, p, serializeError));
|
|
377
|
+
if (!p || typeof p !== "object" || !("then" in p)) return !serverOnly && pushTask(serializeSet(dedupe, id, p));
|
|
378
|
+
if (!firstFlushed) wait && blockingResources.push(p);else !serverOnly && pushTask(`_$HY.init("${id}")`);
|
|
379
|
+
if (serverOnly) return;
|
|
371
380
|
p.then(d => {
|
|
372
381
|
!completed && pushTask(serializeSet(dedupe, id, d));
|
|
373
382
|
}).catch(() => {
|
|
@@ -466,9 +475,6 @@ function renderToStream(code, options = {}) {
|
|
|
466
475
|
}
|
|
467
476
|
};
|
|
468
477
|
}
|
|
469
|
-
function Assets(props) {
|
|
470
|
-
useAssets(() => props.children);
|
|
471
|
-
}
|
|
472
478
|
function HydrationScript(props) {
|
|
473
479
|
const {
|
|
474
480
|
nonce
|
|
@@ -478,13 +484,6 @@ function HydrationScript(props) {
|
|
|
478
484
|
...props
|
|
479
485
|
}));
|
|
480
486
|
}
|
|
481
|
-
function NoHydration(props) {
|
|
482
|
-
const c = solidJs.sharedConfig.context;
|
|
483
|
-
c.noHydrate = true;
|
|
484
|
-
const children = props.children;
|
|
485
|
-
c.noHydrate = false;
|
|
486
|
-
return children;
|
|
487
|
-
}
|
|
488
487
|
function ssr(t, ...nodes) {
|
|
489
488
|
if (nodes.length) {
|
|
490
489
|
let result = "";
|
|
@@ -506,7 +505,7 @@ function ssrClassList(value) {
|
|
|
506
505
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
507
506
|
const key = classKeys[i],
|
|
508
507
|
classValue = !!value[key];
|
|
509
|
-
if (!key || !classValue) continue;
|
|
508
|
+
if (!key || key === "undefined" || !classValue) continue;
|
|
510
509
|
i && (result += " ");
|
|
511
510
|
result += key;
|
|
512
511
|
}
|
|
@@ -519,8 +518,11 @@ function ssrStyle(value) {
|
|
|
519
518
|
const k = Object.keys(value);
|
|
520
519
|
for (let i = 0; i < k.length; i++) {
|
|
521
520
|
const s = k[i];
|
|
522
|
-
|
|
523
|
-
|
|
521
|
+
const v = value[s];
|
|
522
|
+
if (v != undefined) {
|
|
523
|
+
if (i) result += ";";
|
|
524
|
+
result += `${s}:${escape(v, true)}`;
|
|
525
|
+
}
|
|
524
526
|
}
|
|
525
527
|
return result;
|
|
526
528
|
}
|
|
@@ -644,6 +646,14 @@ function generateHydrationScript({
|
|
|
644
646
|
} = {}) {
|
|
645
647
|
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=t=>e.r[t];</script><!--xs-->`;
|
|
646
648
|
}
|
|
649
|
+
function Hydration(props) {
|
|
650
|
+
solidJs.sharedConfig.context.noHydrate = false;
|
|
651
|
+
return props.children;
|
|
652
|
+
}
|
|
653
|
+
function NoHydration(props) {
|
|
654
|
+
solidJs.sharedConfig.context.noHydrate = true;
|
|
655
|
+
return props.children;
|
|
656
|
+
}
|
|
647
657
|
function injectAssets(assets, html) {
|
|
648
658
|
if (!assets || !assets.length) return html;
|
|
649
659
|
let out = "";
|
|
@@ -705,6 +715,9 @@ function replacePlaceholder(html, key, value) {
|
|
|
705
715
|
}
|
|
706
716
|
return html.slice(0, first) + value + html.slice(nextRegex.lastIndex);
|
|
707
717
|
}
|
|
718
|
+
function Assets(props) {
|
|
719
|
+
useAssets(() => props.children);
|
|
720
|
+
}
|
|
708
721
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
709
722
|
if (options.onReady) {
|
|
710
723
|
options.onCompleteShell = ({
|
|
@@ -829,6 +842,7 @@ Object.defineProperty(exports, 'mergeProps', {
|
|
|
829
842
|
});
|
|
830
843
|
exports.Assets = Assets;
|
|
831
844
|
exports.Dynamic = Dynamic;
|
|
845
|
+
exports.Hydration = Hydration;
|
|
832
846
|
exports.HydrationScript = HydrationScript;
|
|
833
847
|
exports.NoHydration = NoHydration;
|
|
834
848
|
exports.Portal = Portal;
|
package/web/dist/server.js
CHANGED
|
@@ -5,10 +5,16 @@ const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked"
|
|
|
5
5
|
const BooleanAttributes = /*#__PURE__*/new Set(booleans);
|
|
6
6
|
/*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
7
7
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
|
-
const Aliases =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const Aliases = Object.create(null);
|
|
9
|
+
Aliases.className = "class";
|
|
10
|
+
Aliases.htmlFor = "for";
|
|
11
|
+
const PropAliases = Object.create(null);
|
|
12
|
+
PropAliases.class = "className";
|
|
13
|
+
PropAliases.formnovalidate = "formNoValidate";
|
|
14
|
+
PropAliases.ismap = "isMap";
|
|
15
|
+
PropAliases.nomodule = "noModule";
|
|
16
|
+
PropAliases.playsinline = "playsInline";
|
|
17
|
+
PropAliases.readonly = "readOnly";
|
|
12
18
|
|
|
13
19
|
const {
|
|
14
20
|
hasOwnProperty
|
|
@@ -270,6 +276,7 @@ function renderToString(code, options = {}) {
|
|
|
270
276
|
assets: [],
|
|
271
277
|
nonce: options.nonce,
|
|
272
278
|
writeResource(id, p, error) {
|
|
279
|
+
if (sharedConfig.context.noHydrate) return;
|
|
273
280
|
if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
|
|
274
281
|
scripts += `_$HY.set("${id}", ${stringify(p)});`;
|
|
275
282
|
}
|
|
@@ -362,9 +369,11 @@ function renderToStream(code, options = {}) {
|
|
|
362
369
|
html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
|
|
363
370
|
},
|
|
364
371
|
writeResource(id, p, error, wait) {
|
|
365
|
-
|
|
366
|
-
if (
|
|
367
|
-
if (!
|
|
372
|
+
const serverOnly = sharedConfig.context.noHydrate;
|
|
373
|
+
if (error) return !serverOnly && pushTask(serializeSet(dedupe, id, p, serializeError));
|
|
374
|
+
if (!p || typeof p !== "object" || !("then" in p)) return !serverOnly && pushTask(serializeSet(dedupe, id, p));
|
|
375
|
+
if (!firstFlushed) wait && blockingResources.push(p);else !serverOnly && pushTask(`_$HY.init("${id}")`);
|
|
376
|
+
if (serverOnly) return;
|
|
368
377
|
p.then(d => {
|
|
369
378
|
!completed && pushTask(serializeSet(dedupe, id, d));
|
|
370
379
|
}).catch(() => {
|
|
@@ -463,9 +472,6 @@ function renderToStream(code, options = {}) {
|
|
|
463
472
|
}
|
|
464
473
|
};
|
|
465
474
|
}
|
|
466
|
-
function Assets(props) {
|
|
467
|
-
useAssets(() => props.children);
|
|
468
|
-
}
|
|
469
475
|
function HydrationScript(props) {
|
|
470
476
|
const {
|
|
471
477
|
nonce
|
|
@@ -475,13 +481,6 @@ function HydrationScript(props) {
|
|
|
475
481
|
...props
|
|
476
482
|
}));
|
|
477
483
|
}
|
|
478
|
-
function NoHydration(props) {
|
|
479
|
-
const c = sharedConfig.context;
|
|
480
|
-
c.noHydrate = true;
|
|
481
|
-
const children = props.children;
|
|
482
|
-
c.noHydrate = false;
|
|
483
|
-
return children;
|
|
484
|
-
}
|
|
485
484
|
function ssr(t, ...nodes) {
|
|
486
485
|
if (nodes.length) {
|
|
487
486
|
let result = "";
|
|
@@ -503,7 +502,7 @@ function ssrClassList(value) {
|
|
|
503
502
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
504
503
|
const key = classKeys[i],
|
|
505
504
|
classValue = !!value[key];
|
|
506
|
-
if (!key || !classValue) continue;
|
|
505
|
+
if (!key || key === "undefined" || !classValue) continue;
|
|
507
506
|
i && (result += " ");
|
|
508
507
|
result += key;
|
|
509
508
|
}
|
|
@@ -516,8 +515,11 @@ function ssrStyle(value) {
|
|
|
516
515
|
const k = Object.keys(value);
|
|
517
516
|
for (let i = 0; i < k.length; i++) {
|
|
518
517
|
const s = k[i];
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
const v = value[s];
|
|
519
|
+
if (v != undefined) {
|
|
520
|
+
if (i) result += ";";
|
|
521
|
+
result += `${s}:${escape(v, true)}`;
|
|
522
|
+
}
|
|
521
523
|
}
|
|
522
524
|
return result;
|
|
523
525
|
}
|
|
@@ -641,6 +643,14 @@ function generateHydrationScript({
|
|
|
641
643
|
} = {}) {
|
|
642
644
|
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=t=>e.r[t];</script><!--xs-->`;
|
|
643
645
|
}
|
|
646
|
+
function Hydration(props) {
|
|
647
|
+
sharedConfig.context.noHydrate = false;
|
|
648
|
+
return props.children;
|
|
649
|
+
}
|
|
650
|
+
function NoHydration(props) {
|
|
651
|
+
sharedConfig.context.noHydrate = true;
|
|
652
|
+
return props.children;
|
|
653
|
+
}
|
|
644
654
|
function injectAssets(assets, html) {
|
|
645
655
|
if (!assets || !assets.length) return html;
|
|
646
656
|
let out = "";
|
|
@@ -702,6 +712,9 @@ function replacePlaceholder(html, key, value) {
|
|
|
702
712
|
}
|
|
703
713
|
return html.slice(0, first) + value + html.slice(nextRegex.lastIndex);
|
|
704
714
|
}
|
|
715
|
+
function Assets(props) {
|
|
716
|
+
useAssets(() => props.children);
|
|
717
|
+
}
|
|
705
718
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
706
719
|
if (options.onReady) {
|
|
707
720
|
options.onCompleteShell = ({
|
|
@@ -784,4 +797,4 @@ function Portal(props) {
|
|
|
784
797
|
return "";
|
|
785
798
|
}
|
|
786
799
|
|
|
787
|
-
export { Assets, Dynamic, HydrationScript, NoHydration, Portal, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, insert, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
|
|
800
|
+
export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, insert, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
|