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/web.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 = "";
|
|
@@ -168,11 +160,12 @@ function classList(node, value, prev = {}) {
|
|
|
168
160
|
}
|
|
169
161
|
return prev;
|
|
170
162
|
}
|
|
171
|
-
function style(node, value, prev
|
|
163
|
+
function style(node, value, prev) {
|
|
164
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
172
165
|
const nodeStyle = node.style;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
166
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
167
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
168
|
+
prev || (prev = {});
|
|
176
169
|
value || (value = {});
|
|
177
170
|
let v, s;
|
|
178
171
|
for (s in prev) {
|
|
@@ -188,10 +181,14 @@ function style(node, value, prev = {}) {
|
|
|
188
181
|
}
|
|
189
182
|
return prev;
|
|
190
183
|
}
|
|
191
|
-
function spread(node,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
184
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
185
|
+
const prevProps = {};
|
|
186
|
+
if (!skipChildren) {
|
|
187
|
+
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
188
|
+
}
|
|
189
|
+
solidJs.createRenderEffect(() => props.ref && props.ref(node));
|
|
190
|
+
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
191
|
+
return prevProps;
|
|
195
192
|
}
|
|
196
193
|
function dynamicProperty(props, key) {
|
|
197
194
|
const src = props[key];
|
|
@@ -219,7 +216,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
219
216
|
for (const prop in prevProps) {
|
|
220
217
|
if (!(prop in props)) {
|
|
221
218
|
if (prop === "children") continue;
|
|
222
|
-
assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
219
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
222
|
for (const prop in props) {
|
|
@@ -242,7 +239,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
242
239
|
count: 0
|
|
243
240
|
};
|
|
244
241
|
gatherHydratable(element, options.renderId);
|
|
245
|
-
const dispose = render(code, element, [...element.childNodes]);
|
|
242
|
+
const dispose = render(code, element, [...element.childNodes], options);
|
|
246
243
|
solidJs.sharedConfig.context = null;
|
|
247
244
|
return dispose;
|
|
248
245
|
}
|
|
@@ -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
|
-
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
375
|
-
}
|
|
376
|
-
solidJs.createRenderEffect(() => props.ref && props.ref(node));
|
|
377
|
-
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
378
|
-
return prevProps;
|
|
379
|
-
}
|
|
380
366
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
381
367
|
if (solidJs.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 solidJs.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) {
|
|
@@ -636,6 +625,10 @@ Object.defineProperty(exports, 'getOwner', {
|
|
|
636
625
|
enumerable: true,
|
|
637
626
|
get: function () { return solidJs.getOwner; }
|
|
638
627
|
});
|
|
628
|
+
Object.defineProperty(exports, 'memo', {
|
|
629
|
+
enumerable: true,
|
|
630
|
+
get: function () { return solidJs.createMemo; }
|
|
631
|
+
});
|
|
639
632
|
Object.defineProperty(exports, 'mergeProps', {
|
|
640
633
|
enumerable: true,
|
|
641
634
|
get: function () { return solidJs.mergeProps; }
|
|
@@ -650,6 +643,7 @@ exports.ChildProperties = ChildProperties;
|
|
|
650
643
|
exports.DOMElements = DOMElements;
|
|
651
644
|
exports.DelegatedEvents = DelegatedEvents;
|
|
652
645
|
exports.Dynamic = Dynamic;
|
|
646
|
+
exports.Hydration = Hydration;
|
|
653
647
|
exports.HydrationScript = voidFn;
|
|
654
648
|
exports.NoHydration = NoHydration;
|
|
655
649
|
exports.Portal = Portal;
|
|
@@ -675,7 +669,6 @@ exports.hydrate = hydrate;
|
|
|
675
669
|
exports.innerHTML = innerHTML;
|
|
676
670
|
exports.insert = insert;
|
|
677
671
|
exports.isServer = isServer;
|
|
678
|
-
exports.memo = memo;
|
|
679
672
|
exports.render = render;
|
|
680
673
|
exports.renderToStream = renderToStream;
|
|
681
674
|
exports.renderToString = renderToString;
|
package/web/dist/web.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 } 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 = "";
|
|
@@ -165,11 +157,12 @@ function classList(node, value, prev = {}) {
|
|
|
165
157
|
}
|
|
166
158
|
return prev;
|
|
167
159
|
}
|
|
168
|
-
function style(node, value, prev
|
|
160
|
+
function style(node, value, prev) {
|
|
161
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
169
162
|
const nodeStyle = node.style;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
163
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
164
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
165
|
+
prev || (prev = {});
|
|
173
166
|
value || (value = {});
|
|
174
167
|
let v, s;
|
|
175
168
|
for (s in prev) {
|
|
@@ -185,10 +178,14 @@ function style(node, value, prev = {}) {
|
|
|
185
178
|
}
|
|
186
179
|
return prev;
|
|
187
180
|
}
|
|
188
|
-
function spread(node,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
182
|
+
const prevProps = {};
|
|
183
|
+
if (!skipChildren) {
|
|
184
|
+
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
185
|
+
}
|
|
186
|
+
createRenderEffect(() => props.ref && props.ref(node));
|
|
187
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
188
|
+
return prevProps;
|
|
192
189
|
}
|
|
193
190
|
function dynamicProperty(props, key) {
|
|
194
191
|
const src = props[key];
|
|
@@ -216,7 +213,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
216
213
|
for (const prop in prevProps) {
|
|
217
214
|
if (!(prop in props)) {
|
|
218
215
|
if (prop === "children") continue;
|
|
219
|
-
assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
216
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
220
217
|
}
|
|
221
218
|
}
|
|
222
219
|
for (const prop in props) {
|
|
@@ -239,7 +236,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
239
236
|
count: 0
|
|
240
237
|
};
|
|
241
238
|
gatherHydratable(element, options.renderId);
|
|
242
|
-
const dispose = render(code, element, [...element.childNodes]);
|
|
239
|
+
const dispose = render(code, element, [...element.childNodes], options);
|
|
243
240
|
sharedConfig.context = null;
|
|
244
241
|
return dispose;
|
|
245
242
|
}
|
|
@@ -306,9 +303,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
306
303
|
if (prop === "classList") return classList(node, value, prev);
|
|
307
304
|
if (value === prev) return prev;
|
|
308
305
|
if (prop === "ref") {
|
|
309
|
-
if (!skipRef)
|
|
310
|
-
value(node);
|
|
311
|
-
}
|
|
306
|
+
if (!skipRef) value(node);
|
|
312
307
|
} else if (prop.slice(0, 3) === "on:") {
|
|
313
308
|
const e = prop.slice(3);
|
|
314
309
|
prev && node.removeEventListener(e, prev);
|
|
@@ -365,15 +360,6 @@ function eventHandler(e) {
|
|
|
365
360
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
366
361
|
}
|
|
367
362
|
}
|
|
368
|
-
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
369
|
-
props || (props = {});
|
|
370
|
-
if (!skipChildren) {
|
|
371
|
-
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
372
|
-
}
|
|
373
|
-
createRenderEffect(() => props.ref && props.ref(node));
|
|
374
|
-
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
375
|
-
return prevProps;
|
|
376
|
-
}
|
|
377
363
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
378
364
|
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
379
365
|
while (typeof current === "function") current = current();
|
|
@@ -468,7 +454,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
468
454
|
}
|
|
469
455
|
return dynamic;
|
|
470
456
|
}
|
|
471
|
-
function appendNodes(parent, array, marker) {
|
|
457
|
+
function appendNodes(parent, array, marker = null) {
|
|
472
458
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
473
459
|
}
|
|
474
460
|
function cleanChildren(parent, current, marker, replacement) {
|
|
@@ -501,6 +487,9 @@ function getHydrationKey() {
|
|
|
501
487
|
function NoHydration(props) {
|
|
502
488
|
return sharedConfig.context ? undefined : props.children;
|
|
503
489
|
}
|
|
490
|
+
function Hydration(props) {
|
|
491
|
+
return props.children;
|
|
492
|
+
}
|
|
504
493
|
function voidFn() {}
|
|
505
494
|
|
|
506
495
|
function throwInBrowser(func) {
|
|
@@ -589,4 +578,4 @@ function Dynamic(props) {
|
|
|
589
578
|
});
|
|
590
579
|
}
|
|
591
580
|
|
|
592
|
-
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,
|
|
581
|
+
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/package.json
CHANGED
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"worker": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./types/index.d.ts",
|
|
18
|
+
"default": "./dist/server.js"
|
|
19
|
+
},
|
|
20
|
+
"require": "./dist/server.cjs"
|
|
21
|
+
},
|
|
15
22
|
"browser": {
|
|
16
23
|
"development": {
|
|
17
24
|
"import": {
|
|
@@ -33,13 +40,6 @@
|
|
|
33
40
|
},
|
|
34
41
|
"require": "./dist/server.cjs"
|
|
35
42
|
},
|
|
36
|
-
"worker": {
|
|
37
|
-
"import": {
|
|
38
|
-
"types": "./types/index.d.ts",
|
|
39
|
-
"default": "./dist/server.js"
|
|
40
|
-
},
|
|
41
|
-
"require": "./dist/server.cjs"
|
|
42
|
-
},
|
|
43
43
|
"node": {
|
|
44
44
|
"import": {
|
|
45
45
|
"types": "./types/index.d.ts",
|
package/web/types/client.d.ts
CHANGED
|
@@ -57,15 +57,16 @@ export function dynamicProperty(props: unknown, key: string): unknown;
|
|
|
57
57
|
export function hydrate(
|
|
58
58
|
fn: () => JSX.Element,
|
|
59
59
|
node: MountableElement,
|
|
60
|
-
options?: { renderId?: string }
|
|
60
|
+
options?: { renderId?: string, owner?: unknown }
|
|
61
61
|
): () => void;
|
|
62
62
|
export function getHydrationKey(): string;
|
|
63
63
|
export function getNextElement(template?: HTMLTemplateElement): Element;
|
|
64
64
|
export function getNextMatch(start: Node, elementName: string): Element;
|
|
65
65
|
export function getNextMarker(start: Node): [Node, Array<Node>];
|
|
66
|
-
export function useAssets(fn: () =>
|
|
66
|
+
export function useAssets(fn: () => JSX.Element): void;
|
|
67
67
|
export function getAssets(): string;
|
|
68
|
-
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
69
68
|
export function HydrationScript(): JSX.Element;
|
|
70
|
-
export function
|
|
71
|
-
export function
|
|
69
|
+
export function generateHydrationScript(): string;
|
|
70
|
+
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
71
|
+
export function Hydration(props: { children?: JSX.Element }): JSX.Element;
|
|
72
|
+
export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
|
package/web/types/core.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
declare function memo<T>(fn: () => T, equals: boolean): import("solid-js").Accessor<T>;
|
|
3
|
-
export { getOwner, createComponent, createRoot as root, createRenderEffect as effect, memo, sharedConfig, untrack };
|
|
1
|
+
export { getOwner, createComponent, createRoot as root, createRenderEffect as effect, createMemo as memo, sharedConfig, untrack, mergeProps } from "solid-js";
|
package/web/types/index.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export declare function Portal<T extends boolean = false, S extends boolean = fa
|
|
|
21
21
|
} : {}) & (S extends true ? SVGGElement : HTMLDivElement)) => void);
|
|
22
22
|
children: JSX.Element;
|
|
23
23
|
}): Text;
|
|
24
|
-
declare type DynamicProps<T extends ValidComponent
|
|
24
|
+
declare type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
25
|
+
[K in keyof P]: P[K];
|
|
26
|
+
} & {
|
|
25
27
|
component: T | undefined;
|
|
26
28
|
};
|
|
27
29
|
/**
|
package/web/types/server.d.ts
CHANGED
|
@@ -26,18 +26,21 @@ export function renderToStream<T>(
|
|
|
26
26
|
pipeTo: (writable: WritableStream) => void;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
30
29
|
export function HydrationScript(props: { nonce?: string; eventNames?: string[] }): JSX.Element;
|
|
31
|
-
export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
|
|
32
30
|
export function ssr(template: string[] | string, ...nodes: any[]): { t: string };
|
|
33
|
-
export function ssrElement(
|
|
31
|
+
export function ssrElement(
|
|
32
|
+
name: string,
|
|
33
|
+
props: any,
|
|
34
|
+
children: any,
|
|
35
|
+
needsId: boolean
|
|
36
|
+
): { t: string };
|
|
34
37
|
export function ssrClassList(value: { [k: string]: boolean }): string;
|
|
35
38
|
export function ssrStyle(value: { [k: string]: string }): string;
|
|
36
39
|
export function ssrAttribute(key: string, value: any, isBoolean: boolean): string;
|
|
37
40
|
export function ssrHydrationKey(): string;
|
|
38
41
|
export function resolveSSRNode(node: any): string;
|
|
39
42
|
export function escape(html: string): string;
|
|
40
|
-
export function useAssets(fn: () =>
|
|
43
|
+
export function useAssets(fn: () => JSX.Element): void;
|
|
41
44
|
export function getAssets(): string;
|
|
42
45
|
export function getHydrationKey(): string;
|
|
43
46
|
export function effect<T>(fn: (prev?: T) => T, init?: T): void;
|
|
@@ -47,6 +50,10 @@ export function mergeProps(...sources: unknown[]): unknown;
|
|
|
47
50
|
export function getOwner(): unknown;
|
|
48
51
|
export function generateHydrationScript(options: { nonce?: string; eventNames?: string[] }): string;
|
|
49
52
|
|
|
53
|
+
export function Hydration(props: { children?: JSX.Element }): JSX.Element;
|
|
54
|
+
export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
|
|
55
|
+
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
56
|
+
|
|
50
57
|
// deprecated
|
|
51
58
|
export type LegacyResults = {
|
|
52
59
|
write: (text: string) => void;
|