solid-js 1.9.4 → 1.9.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/LICENSE +1 -1
- package/dist/dev.cjs +57 -42
- package/dist/dev.js +65 -50
- package/dist/solid.cjs +38 -34
- package/dist/solid.js +49 -41
- package/h/jsx-runtime/types/jsx.d.ts +2975 -1021
- package/html/dist/html.cjs +5 -5
- package/html/dist/html.js +5 -5
- package/package.json +1 -1
- package/store/types/store.d.ts +1 -0
- package/types/index.d.ts +3 -0
- package/types/jsx.d.ts +2126 -281
- package/types/reactive/observable.d.ts +11 -11
- package/types/reactive/signal.d.ts +4 -0
- package/types/server/reactive.d.ts +6 -1
- package/universal/dist/dev.cjs +3 -1
- package/universal/dist/dev.js +4 -2
- package/universal/dist/universal.cjs +3 -1
- package/universal/dist/universal.js +4 -2
- package/web/dist/dev.cjs +21 -14
- package/web/dist/dev.js +25 -12
- package/web/dist/server.cjs +18 -11
- package/web/dist/server.js +22 -8
- package/web/dist/web.cjs +21 -14
- package/web/dist/web.js +23 -10
- package/web/types/core.d.ts +1 -1
- package/web/types/index.d.ts +16 -0
package/web/dist/web.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
|
|
5
5
|
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
6
|
-
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
6
|
+
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "noValidate", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
7
7
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
8
|
const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
9
9
|
className: "class",
|
|
@@ -11,6 +11,10 @@ const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
11
11
|
});
|
|
12
12
|
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
13
13
|
class: "className",
|
|
14
|
+
novalidate: {
|
|
15
|
+
$: "noValidate",
|
|
16
|
+
FORM: 1
|
|
17
|
+
},
|
|
14
18
|
formnovalidate: {
|
|
15
19
|
$: "formNoValidate",
|
|
16
20
|
BUTTON: 1,
|
|
@@ -50,6 +54,8 @@ const SVGNamespace = {
|
|
|
50
54
|
};
|
|
51
55
|
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", "h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
52
56
|
|
|
57
|
+
const memo = fn => solidJs.createMemo(() => fn());
|
|
58
|
+
|
|
53
59
|
function reconcileArrays(parentNode, a, b) {
|
|
54
60
|
let bLength = b.length,
|
|
55
61
|
aEnd = a.length,
|
|
@@ -119,12 +125,12 @@ function render(code, element, init, options = {}) {
|
|
|
119
125
|
element.textContent = "";
|
|
120
126
|
};
|
|
121
127
|
}
|
|
122
|
-
function template(html, isImportNode, isSVG) {
|
|
128
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
123
129
|
let node;
|
|
124
130
|
const create = () => {
|
|
125
|
-
const t = document.createElement("template");
|
|
131
|
+
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
126
132
|
t.innerHTML = html;
|
|
127
|
-
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
133
|
+
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
128
134
|
};
|
|
129
135
|
const fn = isImportNode ? () => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
130
136
|
fn.cloneNode = fn;
|
|
@@ -377,7 +383,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
|
377
383
|
setAttribute(node, prop.slice(5), value);
|
|
378
384
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
379
385
|
setBoolAttribute(node, prop.slice(5), value);
|
|
380
|
-
} else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") ||
|
|
386
|
+
} else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") || "is" in props)) {
|
|
381
387
|
if (forceProp) {
|
|
382
388
|
prop = prop.slice(5);
|
|
383
389
|
isProp = true;
|
|
@@ -661,22 +667,25 @@ function Portal(props) {
|
|
|
661
667
|
});
|
|
662
668
|
return marker;
|
|
663
669
|
}
|
|
664
|
-
function
|
|
665
|
-
const
|
|
666
|
-
const cached = solidJs.createMemo(() => p.component);
|
|
670
|
+
function createDynamic(component, props) {
|
|
671
|
+
const cached = solidJs.createMemo(component);
|
|
667
672
|
return solidJs.createMemo(() => {
|
|
668
673
|
const component = cached();
|
|
669
674
|
switch (typeof component) {
|
|
670
675
|
case "function":
|
|
671
|
-
return solidJs.untrack(() => component(
|
|
676
|
+
return solidJs.untrack(() => component(props));
|
|
672
677
|
case "string":
|
|
673
678
|
const isSvg = SVGElements.has(component);
|
|
674
679
|
const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
675
|
-
spread(el,
|
|
680
|
+
spread(el, props, isSvg);
|
|
676
681
|
return el;
|
|
677
682
|
}
|
|
678
683
|
});
|
|
679
684
|
}
|
|
685
|
+
function Dynamic(props) {
|
|
686
|
+
const [, others] = solidJs.splitProps(props, ["component"]);
|
|
687
|
+
return createDynamic(() => props.component, others);
|
|
688
|
+
}
|
|
680
689
|
|
|
681
690
|
Object.defineProperty(exports, "ErrorBoundary", {
|
|
682
691
|
enumerable: true,
|
|
@@ -722,10 +731,6 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
722
731
|
enumerable: true,
|
|
723
732
|
get: function () { return solidJs.getOwner; }
|
|
724
733
|
});
|
|
725
|
-
Object.defineProperty(exports, "memo", {
|
|
726
|
-
enumerable: true,
|
|
727
|
-
get: function () { return solidJs.createMemo; }
|
|
728
|
-
});
|
|
729
734
|
Object.defineProperty(exports, "mergeProps", {
|
|
730
735
|
enumerable: true,
|
|
731
736
|
get: function () { return solidJs.mergeProps; }
|
|
@@ -753,6 +758,7 @@ exports.assign = assign;
|
|
|
753
758
|
exports.classList = classList;
|
|
754
759
|
exports.className = className;
|
|
755
760
|
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
761
|
+
exports.createDynamic = createDynamic;
|
|
756
762
|
exports.delegateEvents = delegateEvents;
|
|
757
763
|
exports.dynamicProperty = dynamicProperty;
|
|
758
764
|
exports.escape = escape;
|
|
@@ -769,6 +775,7 @@ exports.innerHTML = innerHTML;
|
|
|
769
775
|
exports.insert = insert;
|
|
770
776
|
exports.isDev = isDev;
|
|
771
777
|
exports.isServer = isServer;
|
|
778
|
+
exports.memo = memo;
|
|
772
779
|
exports.render = render;
|
|
773
780
|
exports.renderToStream = renderToStream;
|
|
774
781
|
exports.renderToString = renderToString;
|
package/web/dist/web.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createMemo,
|
|
2
3
|
createRoot,
|
|
3
4
|
createRenderEffect,
|
|
4
5
|
untrack,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
getOwner,
|
|
8
9
|
createEffect,
|
|
9
10
|
runWithOwner,
|
|
10
|
-
createMemo,
|
|
11
11
|
createSignal,
|
|
12
12
|
onCleanup,
|
|
13
13
|
splitProps
|
|
@@ -24,7 +24,6 @@ export {
|
|
|
24
24
|
createComponent,
|
|
25
25
|
createRenderEffect as effect,
|
|
26
26
|
getOwner,
|
|
27
|
-
createMemo as memo,
|
|
28
27
|
mergeProps,
|
|
29
28
|
untrack
|
|
30
29
|
} from "solid-js";
|
|
@@ -60,6 +59,7 @@ const Properties = /*#__PURE__*/ new Set([
|
|
|
60
59
|
"className",
|
|
61
60
|
"value",
|
|
62
61
|
"readOnly",
|
|
62
|
+
"noValidate",
|
|
63
63
|
"formNoValidate",
|
|
64
64
|
"isMap",
|
|
65
65
|
"noModule",
|
|
@@ -78,6 +78,10 @@ const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
|
78
78
|
});
|
|
79
79
|
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
80
80
|
class: "className",
|
|
81
|
+
novalidate: {
|
|
82
|
+
$: "noValidate",
|
|
83
|
+
FORM: 1
|
|
84
|
+
},
|
|
81
85
|
formnovalidate: {
|
|
82
86
|
$: "formNoValidate",
|
|
83
87
|
BUTTON: 1,
|
|
@@ -494,6 +498,8 @@ const DOMElements = /*#__PURE__*/ new Set([
|
|
|
494
498
|
"h6"
|
|
495
499
|
]);
|
|
496
500
|
|
|
501
|
+
const memo = fn => createMemo(() => fn());
|
|
502
|
+
|
|
497
503
|
function reconcileArrays(parentNode, a, b) {
|
|
498
504
|
let bLength = b.length,
|
|
499
505
|
aEnd = a.length,
|
|
@@ -565,12 +571,14 @@ function render(code, element, init, options = {}) {
|
|
|
565
571
|
element.textContent = "";
|
|
566
572
|
};
|
|
567
573
|
}
|
|
568
|
-
function template(html, isImportNode, isSVG) {
|
|
574
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
569
575
|
let node;
|
|
570
576
|
const create = () => {
|
|
571
|
-
const t =
|
|
577
|
+
const t = isMathML
|
|
578
|
+
? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template")
|
|
579
|
+
: document.createElement("template");
|
|
572
580
|
t.innerHTML = html;
|
|
573
|
-
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
581
|
+
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
574
582
|
};
|
|
575
583
|
const fn = isImportNode
|
|
576
584
|
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
@@ -1142,22 +1150,25 @@ function Portal(props) {
|
|
|
1142
1150
|
);
|
|
1143
1151
|
return marker;
|
|
1144
1152
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const
|
|
1147
|
-
const cached = createMemo(() => p.component);
|
|
1153
|
+
function createDynamic(component, props) {
|
|
1154
|
+
const cached = createMemo(component);
|
|
1148
1155
|
return createMemo(() => {
|
|
1149
1156
|
const component = cached();
|
|
1150
1157
|
switch (typeof component) {
|
|
1151
1158
|
case "function":
|
|
1152
|
-
return untrack(() => component(
|
|
1159
|
+
return untrack(() => component(props));
|
|
1153
1160
|
case "string":
|
|
1154
1161
|
const isSvg = SVGElements.has(component);
|
|
1155
1162
|
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
1156
|
-
spread(el,
|
|
1163
|
+
spread(el, props, isSvg);
|
|
1157
1164
|
return el;
|
|
1158
1165
|
}
|
|
1159
1166
|
});
|
|
1160
1167
|
}
|
|
1168
|
+
function Dynamic(props) {
|
|
1169
|
+
const [, others] = splitProps(props, ["component"]);
|
|
1170
|
+
return createDynamic(() => props.component, others);
|
|
1171
|
+
}
|
|
1161
1172
|
|
|
1162
1173
|
export {
|
|
1163
1174
|
Aliases,
|
|
@@ -1179,6 +1190,7 @@ export {
|
|
|
1179
1190
|
classList,
|
|
1180
1191
|
className,
|
|
1181
1192
|
clearDelegatedEvents,
|
|
1193
|
+
createDynamic,
|
|
1182
1194
|
delegateEvents,
|
|
1183
1195
|
dynamicProperty,
|
|
1184
1196
|
escape,
|
|
@@ -1195,6 +1207,7 @@ export {
|
|
|
1195
1207
|
insert,
|
|
1196
1208
|
isDev,
|
|
1197
1209
|
isServer,
|
|
1210
|
+
memo,
|
|
1198
1211
|
render,
|
|
1199
1212
|
renderToStream,
|
|
1200
1213
|
renderToString,
|
package/web/types/core.d.ts
CHANGED
package/web/types/index.d.ts
CHANGED
|
@@ -44,6 +44,22 @@ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
|
44
44
|
} & {
|
|
45
45
|
component: T | undefined;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Renders an arbitrary component or element with the given props
|
|
49
|
+
*
|
|
50
|
+
* This is a lower level version of the `Dynamic` component, useful for
|
|
51
|
+
* performance optimizations in libraries. Do not use this unless you know
|
|
52
|
+
* what you are doing.
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const element = () => multiline() ? 'textarea' : 'input';
|
|
55
|
+
* createDynamic(element, { value: value() });
|
|
56
|
+
* ```
|
|
57
|
+
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
58
|
+
*/
|
|
59
|
+
export declare function createDynamic<T extends ValidComponent>(
|
|
60
|
+
component: () => T | undefined,
|
|
61
|
+
props: ComponentProps<T>
|
|
62
|
+
): JSX.Element;
|
|
47
63
|
/**
|
|
48
64
|
* Renders an arbitrary custom or native component and passes the other props
|
|
49
65
|
* ```typescript
|