solid-js 1.4.3 → 1.4.6
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 +37 -31
- package/dist/dev.js +37 -31
- package/dist/solid.cjs +30 -30
- package/dist/solid.js +30 -30
- package/package.json +2 -2
- package/store/dist/dev.cjs +14 -9
- package/store/dist/dev.js +14 -9
- package/store/dist/server.cjs +16 -2
- package/store/dist/server.js +16 -2
- package/store/dist/store.cjs +14 -9
- package/store/dist/store.js +14 -9
- package/store/types/store.d.ts +6 -4
- package/types/index.d.ts +1 -1
- package/types/reactive/signal.d.ts +1 -0
- package/web/dist/dev.cjs +40 -24
- package/web/dist/dev.js +40 -24
- package/web/dist/server.cjs +7 -3
- package/web/dist/server.js +7 -3
- package/web/dist/web.cjs +40 -24
- package/web/dist/web.js +40 -24
- package/web/types/index.d.ts +6 -3
- package/web/types/server-mock.d.ts +1 -1
package/web/dist/dev.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var solidJs = require('solid-js');
|
|
6
6
|
|
|
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
|
-
const Properties = new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
9
|
-
const ChildProperties = new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
|
+
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
9
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
10
10
|
const Aliases = {
|
|
11
11
|
className: "class",
|
|
12
12
|
htmlFor: "for"
|
|
@@ -19,8 +19,8 @@ const PropAliases = {
|
|
|
19
19
|
playsinline: "playsInline",
|
|
20
20
|
readonly: "readOnly"
|
|
21
21
|
};
|
|
22
|
-
const DelegatedEvents = 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
|
-
const SVGElements = new Set([
|
|
22
|
+
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
|
+
const SVGElements = /*#__PURE__*/new Set([
|
|
24
24
|
"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",
|
|
25
25
|
"set", "stop",
|
|
26
26
|
"svg", "switch", "symbol", "text", "textPath",
|
|
@@ -29,7 +29,7 @@ const SVGNamespace = {
|
|
|
29
29
|
xlink: "http://www.w3.org/1999/xlink",
|
|
30
30
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
31
31
|
};
|
|
32
|
-
const DOMElements = 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"]);
|
|
32
|
+
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
33
|
|
|
34
34
|
function memo(fn, equals) {
|
|
35
35
|
return solidJs.createMemo(fn, undefined, !equals ? {
|
|
@@ -146,7 +146,8 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
146
146
|
node[`$$${name}Data`] = handler[1];
|
|
147
147
|
} else node[`$$${name}`] = handler;
|
|
148
148
|
} else if (Array.isArray(handler)) {
|
|
149
|
-
|
|
149
|
+
const handlerFn = handler[0];
|
|
150
|
+
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
150
151
|
} else node.addEventListener(name, handler);
|
|
151
152
|
}
|
|
152
153
|
function classList(node, value, prev = {}) {
|
|
@@ -310,14 +311,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
310
311
|
value(node);
|
|
311
312
|
}
|
|
312
313
|
} else if (prop.slice(0, 3) === "on:") {
|
|
313
|
-
|
|
314
|
+
const e = prop.slice(3);
|
|
315
|
+
prev && node.removeEventListener(e, prev);
|
|
316
|
+
value && node.addEventListener(e, value);
|
|
314
317
|
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
315
|
-
|
|
318
|
+
const e = prop.slice(10);
|
|
319
|
+
prev && node.removeEventListener(e, prev, true);
|
|
320
|
+
value && node.addEventListener(e, value, true);
|
|
316
321
|
} else if (prop.slice(0, 2) === "on") {
|
|
317
322
|
const name = prop.slice(2).toLowerCase();
|
|
318
323
|
const delegate = DelegatedEvents.has(name);
|
|
319
|
-
|
|
320
|
-
|
|
324
|
+
if (!delegate && prev) {
|
|
325
|
+
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
326
|
+
node.removeEventListener(name, h);
|
|
327
|
+
}
|
|
328
|
+
if (delegate || value) {
|
|
329
|
+
addEventListener(node, name, value, delegate);
|
|
330
|
+
delegate && delegateEvents([name]);
|
|
331
|
+
}
|
|
321
332
|
} else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
|
|
322
333
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[PropAliases[prop] || prop] = value;
|
|
323
334
|
} else {
|
|
@@ -349,7 +360,7 @@ function eventHandler(e) {
|
|
|
349
360
|
const handler = node[key];
|
|
350
361
|
if (handler && !node.disabled) {
|
|
351
362
|
const data = node[`${key}Data`];
|
|
352
|
-
data !== undefined ? handler(data, e) : handler(e);
|
|
363
|
+
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
353
364
|
if (e.cancelBubble) return;
|
|
354
365
|
}
|
|
355
366
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
@@ -397,7 +408,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
397
408
|
return () => current;
|
|
398
409
|
} else if (Array.isArray(value)) {
|
|
399
410
|
const array = [];
|
|
400
|
-
|
|
411
|
+
const currentArray = current && Array.isArray(current);
|
|
412
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
401
413
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
402
414
|
return () => current;
|
|
403
415
|
}
|
|
@@ -409,7 +421,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
409
421
|
if (array.length === 0) {
|
|
410
422
|
current = cleanChildren(parent, current, marker);
|
|
411
423
|
if (multi) return current;
|
|
412
|
-
} else if (
|
|
424
|
+
} else if (currentArray) {
|
|
413
425
|
if (current.length === 0) {
|
|
414
426
|
appendNodes(parent, array, marker);
|
|
415
427
|
} else reconcileArrays(parent, current, array);
|
|
@@ -430,26 +442,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
430
442
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
431
443
|
return current;
|
|
432
444
|
}
|
|
433
|
-
function normalizeIncomingArray(normalized, array, unwrap) {
|
|
445
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
434
446
|
let dynamic = false;
|
|
435
447
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
436
448
|
let item = array[i],
|
|
437
|
-
|
|
449
|
+
prev = current && current[i];
|
|
438
450
|
if (item instanceof Node) {
|
|
439
451
|
normalized.push(item);
|
|
440
452
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
441
|
-
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
442
|
-
} else if ((
|
|
443
|
-
normalized.push(document.createTextNode(item));
|
|
444
|
-
} else if (t === "function") {
|
|
453
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
454
|
+
} else if ((typeof item) === "function") {
|
|
445
455
|
if (unwrap) {
|
|
446
456
|
while (typeof item === "function") item = item();
|
|
447
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
457
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
448
458
|
} else {
|
|
449
459
|
normalized.push(item);
|
|
450
460
|
dynamic = true;
|
|
451
461
|
}
|
|
452
|
-
} else
|
|
462
|
+
} else {
|
|
463
|
+
const value = String(item);
|
|
464
|
+
if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
465
|
+
normalized.push(prev);
|
|
466
|
+
} else normalized.push(document.createTextNode(value));
|
|
467
|
+
}
|
|
453
468
|
}
|
|
454
469
|
return dynamic;
|
|
455
470
|
}
|
|
@@ -508,7 +523,7 @@ function resolveSSRNode(node) {}
|
|
|
508
523
|
function ssrClassList(value) {}
|
|
509
524
|
function ssrStyle(value) {}
|
|
510
525
|
function ssrSpread(accessor) {}
|
|
511
|
-
function
|
|
526
|
+
function ssrAttribute(key, value) {}
|
|
512
527
|
function ssrHydrationKey() {}
|
|
513
528
|
function escape(html) {}
|
|
514
529
|
function generateHydrationScript() {}
|
|
@@ -561,8 +576,9 @@ function Portal(props) {
|
|
|
561
576
|
}
|
|
562
577
|
function Dynamic(props) {
|
|
563
578
|
const [p, others] = solidJs.splitProps(props, ["component"]);
|
|
579
|
+
const cached = solidJs.createMemo(() => p.component);
|
|
564
580
|
return solidJs.createMemo(() => {
|
|
565
|
-
const component =
|
|
581
|
+
const component = cached();
|
|
566
582
|
switch (typeof component) {
|
|
567
583
|
case "function":
|
|
568
584
|
Object.assign(component, {
|
|
@@ -667,7 +683,7 @@ exports.setAttribute = setAttribute;
|
|
|
667
683
|
exports.setAttributeNS = setAttributeNS;
|
|
668
684
|
exports.spread = spread;
|
|
669
685
|
exports.ssr = ssr;
|
|
670
|
-
exports.
|
|
686
|
+
exports.ssrAttribute = ssrAttribute;
|
|
671
687
|
exports.ssrClassList = ssrClassList;
|
|
672
688
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
673
689
|
exports.ssrSpread = ssrSpread;
|
package/web/dist/dev.js
CHANGED
|
@@ -2,8 +2,8 @@ import { createMemo, createRoot, createRenderEffect, sharedConfig, enableHydrati
|
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, 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"];
|
|
5
|
-
const Properties = new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
6
|
-
const ChildProperties = new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
5
|
+
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
6
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
7
7
|
const Aliases = {
|
|
8
8
|
className: "class",
|
|
9
9
|
htmlFor: "for"
|
|
@@ -16,8 +16,8 @@ const PropAliases = {
|
|
|
16
16
|
playsinline: "playsInline",
|
|
17
17
|
readonly: "readOnly"
|
|
18
18
|
};
|
|
19
|
-
const DelegatedEvents = 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
|
-
const SVGElements = new Set([
|
|
19
|
+
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
|
+
const SVGElements = /*#__PURE__*/new Set([
|
|
21
21
|
"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",
|
|
22
22
|
"set", "stop",
|
|
23
23
|
"svg", "switch", "symbol", "text", "textPath",
|
|
@@ -26,7 +26,7 @@ const SVGNamespace = {
|
|
|
26
26
|
xlink: "http://www.w3.org/1999/xlink",
|
|
27
27
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
28
28
|
};
|
|
29
|
-
const DOMElements = 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"]);
|
|
29
|
+
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
30
|
|
|
31
31
|
function memo(fn, equals) {
|
|
32
32
|
return createMemo(fn, undefined, !equals ? {
|
|
@@ -143,7 +143,8 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
143
143
|
node[`$$${name}Data`] = handler[1];
|
|
144
144
|
} else node[`$$${name}`] = handler;
|
|
145
145
|
} else if (Array.isArray(handler)) {
|
|
146
|
-
|
|
146
|
+
const handlerFn = handler[0];
|
|
147
|
+
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
147
148
|
} else node.addEventListener(name, handler);
|
|
148
149
|
}
|
|
149
150
|
function classList(node, value, prev = {}) {
|
|
@@ -307,14 +308,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
307
308
|
value(node);
|
|
308
309
|
}
|
|
309
310
|
} else if (prop.slice(0, 3) === "on:") {
|
|
310
|
-
|
|
311
|
+
const e = prop.slice(3);
|
|
312
|
+
prev && node.removeEventListener(e, prev);
|
|
313
|
+
value && node.addEventListener(e, value);
|
|
311
314
|
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
312
|
-
|
|
315
|
+
const e = prop.slice(10);
|
|
316
|
+
prev && node.removeEventListener(e, prev, true);
|
|
317
|
+
value && node.addEventListener(e, value, true);
|
|
313
318
|
} else if (prop.slice(0, 2) === "on") {
|
|
314
319
|
const name = prop.slice(2).toLowerCase();
|
|
315
320
|
const delegate = DelegatedEvents.has(name);
|
|
316
|
-
|
|
317
|
-
|
|
321
|
+
if (!delegate && prev) {
|
|
322
|
+
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
323
|
+
node.removeEventListener(name, h);
|
|
324
|
+
}
|
|
325
|
+
if (delegate || value) {
|
|
326
|
+
addEventListener(node, name, value, delegate);
|
|
327
|
+
delegate && delegateEvents([name]);
|
|
328
|
+
}
|
|
318
329
|
} else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
|
|
319
330
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[PropAliases[prop] || prop] = value;
|
|
320
331
|
} else {
|
|
@@ -346,7 +357,7 @@ function eventHandler(e) {
|
|
|
346
357
|
const handler = node[key];
|
|
347
358
|
if (handler && !node.disabled) {
|
|
348
359
|
const data = node[`${key}Data`];
|
|
349
|
-
data !== undefined ? handler(data, e) : handler(e);
|
|
360
|
+
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
350
361
|
if (e.cancelBubble) return;
|
|
351
362
|
}
|
|
352
363
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
@@ -394,7 +405,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
394
405
|
return () => current;
|
|
395
406
|
} else if (Array.isArray(value)) {
|
|
396
407
|
const array = [];
|
|
397
|
-
|
|
408
|
+
const currentArray = current && Array.isArray(current);
|
|
409
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
398
410
|
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
399
411
|
return () => current;
|
|
400
412
|
}
|
|
@@ -406,7 +418,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
406
418
|
if (array.length === 0) {
|
|
407
419
|
current = cleanChildren(parent, current, marker);
|
|
408
420
|
if (multi) return current;
|
|
409
|
-
} else if (
|
|
421
|
+
} else if (currentArray) {
|
|
410
422
|
if (current.length === 0) {
|
|
411
423
|
appendNodes(parent, array, marker);
|
|
412
424
|
} else reconcileArrays(parent, current, array);
|
|
@@ -427,26 +439,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
427
439
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
428
440
|
return current;
|
|
429
441
|
}
|
|
430
|
-
function normalizeIncomingArray(normalized, array, unwrap) {
|
|
442
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
431
443
|
let dynamic = false;
|
|
432
444
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
433
445
|
let item = array[i],
|
|
434
|
-
|
|
446
|
+
prev = current && current[i];
|
|
435
447
|
if (item instanceof Node) {
|
|
436
448
|
normalized.push(item);
|
|
437
449
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
438
|
-
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
439
|
-
} else if ((
|
|
440
|
-
normalized.push(document.createTextNode(item));
|
|
441
|
-
} else if (t === "function") {
|
|
450
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
451
|
+
} else if ((typeof item) === "function") {
|
|
442
452
|
if (unwrap) {
|
|
443
453
|
while (typeof item === "function") item = item();
|
|
444
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
454
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
445
455
|
} else {
|
|
446
456
|
normalized.push(item);
|
|
447
457
|
dynamic = true;
|
|
448
458
|
}
|
|
449
|
-
} else
|
|
459
|
+
} else {
|
|
460
|
+
const value = String(item);
|
|
461
|
+
if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
462
|
+
normalized.push(prev);
|
|
463
|
+
} else normalized.push(document.createTextNode(value));
|
|
464
|
+
}
|
|
450
465
|
}
|
|
451
466
|
return dynamic;
|
|
452
467
|
}
|
|
@@ -505,7 +520,7 @@ function resolveSSRNode(node) {}
|
|
|
505
520
|
function ssrClassList(value) {}
|
|
506
521
|
function ssrStyle(value) {}
|
|
507
522
|
function ssrSpread(accessor) {}
|
|
508
|
-
function
|
|
523
|
+
function ssrAttribute(key, value) {}
|
|
509
524
|
function ssrHydrationKey() {}
|
|
510
525
|
function escape(html) {}
|
|
511
526
|
function generateHydrationScript() {}
|
|
@@ -558,8 +573,9 @@ function Portal(props) {
|
|
|
558
573
|
}
|
|
559
574
|
function Dynamic(props) {
|
|
560
575
|
const [p, others] = splitProps(props, ["component"]);
|
|
576
|
+
const cached = createMemo(() => p.component);
|
|
561
577
|
return createMemo(() => {
|
|
562
|
-
const component =
|
|
578
|
+
const component = cached();
|
|
563
579
|
switch (typeof component) {
|
|
564
580
|
case "function":
|
|
565
581
|
Object.assign(component, {
|
|
@@ -575,4 +591,4 @@ function Dynamic(props) {
|
|
|
575
591
|
});
|
|
576
592
|
}
|
|
577
593
|
|
|
578
|
-
export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr,
|
|
594
|
+
export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
package/web/dist/server.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var solidJs = require('solid-js');
|
|
6
6
|
|
|
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
|
-
const BooleanAttributes = new Set(booleans);
|
|
9
|
-
new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
8
|
+
const BooleanAttributes = /*#__PURE__*/new Set(booleans);
|
|
9
|
+
/*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
10
10
|
const Aliases = {
|
|
11
11
|
className: "class",
|
|
12
12
|
htmlFor: "for"
|
|
@@ -273,7 +273,10 @@ function renderToStringAsync(code, options = {}) {
|
|
|
273
273
|
p.then(d => scripts += serializeSet(dedupe, id, d) + ";").catch(() => scripts += `_$HY.set("${id}", {});`);
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
|
|
276
|
+
let timeoutHandle;
|
|
277
|
+
const timeout = new Promise((_, reject) => {
|
|
278
|
+
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
279
|
+
});
|
|
277
280
|
function asyncWrap(fn) {
|
|
278
281
|
return new Promise(resolve => {
|
|
279
282
|
const registry = new Set();
|
|
@@ -304,6 +307,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
304
307
|
});
|
|
305
308
|
}
|
|
306
309
|
return Promise.race([asyncWrap(() => escape(code())), timeout]).then(res => {
|
|
310
|
+
clearTimeout(timeoutHandle);
|
|
307
311
|
let html = injectAssets(context.assets, resolveSSRNode(res));
|
|
308
312
|
if (scripts.length) html = injectScripts(html, scripts, nonce);
|
|
309
313
|
return html;
|
package/web/dist/server.js
CHANGED
|
@@ -2,8 +2,8 @@ import { sharedConfig, 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"];
|
|
5
|
-
const BooleanAttributes = new Set(booleans);
|
|
6
|
-
new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
5
|
+
const BooleanAttributes = /*#__PURE__*/new Set(booleans);
|
|
6
|
+
/*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
7
7
|
const Aliases = {
|
|
8
8
|
className: "class",
|
|
9
9
|
htmlFor: "for"
|
|
@@ -270,7 +270,10 @@ function renderToStringAsync(code, options = {}) {
|
|
|
270
270
|
p.then(d => scripts += serializeSet(dedupe, id, d) + ";").catch(() => scripts += `_$HY.set("${id}", {});`);
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
-
|
|
273
|
+
let timeoutHandle;
|
|
274
|
+
const timeout = new Promise((_, reject) => {
|
|
275
|
+
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
276
|
+
});
|
|
274
277
|
function asyncWrap(fn) {
|
|
275
278
|
return new Promise(resolve => {
|
|
276
279
|
const registry = new Set();
|
|
@@ -301,6 +304,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
301
304
|
});
|
|
302
305
|
}
|
|
303
306
|
return Promise.race([asyncWrap(() => escape(code())), timeout]).then(res => {
|
|
307
|
+
clearTimeout(timeoutHandle);
|
|
304
308
|
let html = injectAssets(context.assets, resolveSSRNode(res));
|
|
305
309
|
if (scripts.length) html = injectScripts(html, scripts, nonce);
|
|
306
310
|
return html;
|
package/web/dist/web.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var solidJs = require('solid-js');
|
|
6
6
|
|
|
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
|
-
const Properties = new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
9
|
-
const ChildProperties = new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
|
+
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
9
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
10
10
|
const Aliases = {
|
|
11
11
|
className: "class",
|
|
12
12
|
htmlFor: "for"
|
|
@@ -19,8 +19,8 @@ const PropAliases = {
|
|
|
19
19
|
playsinline: "playsInline",
|
|
20
20
|
readonly: "readOnly"
|
|
21
21
|
};
|
|
22
|
-
const DelegatedEvents = 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
|
-
const SVGElements = new Set([
|
|
22
|
+
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
|
+
const SVGElements = /*#__PURE__*/new Set([
|
|
24
24
|
"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",
|
|
25
25
|
"set", "stop",
|
|
26
26
|
"svg", "switch", "symbol", "text", "textPath",
|
|
@@ -29,7 +29,7 @@ const SVGNamespace = {
|
|
|
29
29
|
xlink: "http://www.w3.org/1999/xlink",
|
|
30
30
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
31
31
|
};
|
|
32
|
-
const DOMElements = 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"]);
|
|
32
|
+
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
33
|
|
|
34
34
|
function memo(fn, equals) {
|
|
35
35
|
return solidJs.createMemo(fn, undefined, !equals ? {
|
|
@@ -145,7 +145,8 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
145
145
|
node[`$$${name}Data`] = handler[1];
|
|
146
146
|
} else node[`$$${name}`] = handler;
|
|
147
147
|
} else if (Array.isArray(handler)) {
|
|
148
|
-
|
|
148
|
+
const handlerFn = handler[0];
|
|
149
|
+
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
149
150
|
} else node.addEventListener(name, handler);
|
|
150
151
|
}
|
|
151
152
|
function classList(node, value, prev = {}) {
|
|
@@ -309,14 +310,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
309
310
|
value(node);
|
|
310
311
|
}
|
|
311
312
|
} else if (prop.slice(0, 3) === "on:") {
|
|
312
|
-
|
|
313
|
+
const e = prop.slice(3);
|
|
314
|
+
prev && node.removeEventListener(e, prev);
|
|
315
|
+
value && node.addEventListener(e, value);
|
|
313
316
|
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
314
|
-
|
|
317
|
+
const e = prop.slice(10);
|
|
318
|
+
prev && node.removeEventListener(e, prev, true);
|
|
319
|
+
value && node.addEventListener(e, value, true);
|
|
315
320
|
} else if (prop.slice(0, 2) === "on") {
|
|
316
321
|
const name = prop.slice(2).toLowerCase();
|
|
317
322
|
const delegate = DelegatedEvents.has(name);
|
|
318
|
-
|
|
319
|
-
|
|
323
|
+
if (!delegate && prev) {
|
|
324
|
+
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
325
|
+
node.removeEventListener(name, h);
|
|
326
|
+
}
|
|
327
|
+
if (delegate || value) {
|
|
328
|
+
addEventListener(node, name, value, delegate);
|
|
329
|
+
delegate && delegateEvents([name]);
|
|
330
|
+
}
|
|
320
331
|
} else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
|
|
321
332
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[PropAliases[prop] || prop] = value;
|
|
322
333
|
} else {
|
|
@@ -348,7 +359,7 @@ function eventHandler(e) {
|
|
|
348
359
|
const handler = node[key];
|
|
349
360
|
if (handler && !node.disabled) {
|
|
350
361
|
const data = node[`${key}Data`];
|
|
351
|
-
data !== undefined ? handler(data, e) : handler(e);
|
|
362
|
+
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
352
363
|
if (e.cancelBubble) return;
|
|
353
364
|
}
|
|
354
365
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
@@ -396,7 +407,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
396
407
|
return () => current;
|
|
397
408
|
} else if (Array.isArray(value)) {
|
|
398
409
|
const array = [];
|
|
399
|
-
|
|
410
|
+
const currentArray = current && Array.isArray(current);
|
|
411
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
400
412
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
401
413
|
return () => current;
|
|
402
414
|
}
|
|
@@ -408,7 +420,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
408
420
|
if (array.length === 0) {
|
|
409
421
|
current = cleanChildren(parent, current, marker);
|
|
410
422
|
if (multi) return current;
|
|
411
|
-
} else if (
|
|
423
|
+
} else if (currentArray) {
|
|
412
424
|
if (current.length === 0) {
|
|
413
425
|
appendNodes(parent, array, marker);
|
|
414
426
|
} else reconcileArrays(parent, current, array);
|
|
@@ -429,26 +441,29 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
429
441
|
} else ;
|
|
430
442
|
return current;
|
|
431
443
|
}
|
|
432
|
-
function normalizeIncomingArray(normalized, array, unwrap) {
|
|
444
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
433
445
|
let dynamic = false;
|
|
434
446
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
435
447
|
let item = array[i],
|
|
436
|
-
|
|
448
|
+
prev = current && current[i];
|
|
437
449
|
if (item instanceof Node) {
|
|
438
450
|
normalized.push(item);
|
|
439
451
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
440
|
-
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
441
|
-
} else if ((
|
|
442
|
-
normalized.push(document.createTextNode(item));
|
|
443
|
-
} else if (t === "function") {
|
|
452
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
453
|
+
} else if ((typeof item) === "function") {
|
|
444
454
|
if (unwrap) {
|
|
445
455
|
while (typeof item === "function") item = item();
|
|
446
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
456
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
447
457
|
} else {
|
|
448
458
|
normalized.push(item);
|
|
449
459
|
dynamic = true;
|
|
450
460
|
}
|
|
451
|
-
} else
|
|
461
|
+
} else {
|
|
462
|
+
const value = String(item);
|
|
463
|
+
if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
464
|
+
normalized.push(prev);
|
|
465
|
+
} else normalized.push(document.createTextNode(value));
|
|
466
|
+
}
|
|
452
467
|
}
|
|
453
468
|
return dynamic;
|
|
454
469
|
}
|
|
@@ -507,7 +522,7 @@ function resolveSSRNode(node) {}
|
|
|
507
522
|
function ssrClassList(value) {}
|
|
508
523
|
function ssrStyle(value) {}
|
|
509
524
|
function ssrSpread(accessor) {}
|
|
510
|
-
function
|
|
525
|
+
function ssrAttribute(key, value) {}
|
|
511
526
|
function ssrHydrationKey() {}
|
|
512
527
|
function escape(html) {}
|
|
513
528
|
function generateHydrationScript() {}
|
|
@@ -560,8 +575,9 @@ function Portal(props) {
|
|
|
560
575
|
}
|
|
561
576
|
function Dynamic(props) {
|
|
562
577
|
const [p, others] = solidJs.splitProps(props, ["component"]);
|
|
578
|
+
const cached = solidJs.createMemo(() => p.component);
|
|
563
579
|
return solidJs.createMemo(() => {
|
|
564
|
-
const component =
|
|
580
|
+
const component = cached();
|
|
565
581
|
switch (typeof component) {
|
|
566
582
|
case "function":
|
|
567
583
|
return solidJs.untrack(() => component(others));
|
|
@@ -663,7 +679,7 @@ exports.setAttribute = setAttribute;
|
|
|
663
679
|
exports.setAttributeNS = setAttributeNS;
|
|
664
680
|
exports.spread = spread;
|
|
665
681
|
exports.ssr = ssr;
|
|
666
|
-
exports.
|
|
682
|
+
exports.ssrAttribute = ssrAttribute;
|
|
667
683
|
exports.ssrClassList = ssrClassList;
|
|
668
684
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
669
685
|
exports.ssrSpread = ssrSpread;
|