@solidjs/web 2.0.0-experimental.0 → 2.0.0-experimental.2
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 +9 -5
- package/dist/dev.js +11 -7
- package/dist/server.cjs +9 -5
- package/dist/server.js +9 -5
- package/dist/web.cjs +9 -5
- package/dist/web.js +9 -5
- package/package.json +3 -3
- package/types/index.d.ts +16 -0
package/LICENSE
CHANGED
package/dist/dev.cjs
CHANGED
|
@@ -609,9 +609,8 @@ function createElementProxy(el, marker) {
|
|
|
609
609
|
}
|
|
610
610
|
});
|
|
611
611
|
}
|
|
612
|
-
function
|
|
613
|
-
const
|
|
614
|
-
const cached = solidJs.createMemo(() => props.component);
|
|
612
|
+
function createDynamic(component, props) {
|
|
613
|
+
const cached = solidJs.createMemo(component);
|
|
615
614
|
return solidJs.createMemo(() => {
|
|
616
615
|
const component = cached();
|
|
617
616
|
switch (typeof component) {
|
|
@@ -619,15 +618,19 @@ function Dynamic(props) {
|
|
|
619
618
|
Object.assign(component, {
|
|
620
619
|
[solidJs.$DEVCOMP]: true
|
|
621
620
|
});
|
|
622
|
-
return solidJs.untrack(() => component(
|
|
621
|
+
return solidJs.untrack(() => component(props));
|
|
623
622
|
case "string":
|
|
624
623
|
const isSvg = SVGElements.has(component);
|
|
625
624
|
const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
626
|
-
spread(el,
|
|
625
|
+
spread(el, props, isSvg);
|
|
627
626
|
return el;
|
|
628
627
|
}
|
|
629
628
|
});
|
|
630
629
|
}
|
|
630
|
+
function Dynamic(props) {
|
|
631
|
+
const others = solidJs.omit(props, "component");
|
|
632
|
+
return createDynamic(() => props.component, others);
|
|
633
|
+
}
|
|
631
634
|
|
|
632
635
|
Object.defineProperty(exports, "ErrorBoundary", {
|
|
633
636
|
enumerable: true,
|
|
@@ -694,6 +697,7 @@ exports.addEventListener = addEventListener;
|
|
|
694
697
|
exports.assign = assign;
|
|
695
698
|
exports.className = className;
|
|
696
699
|
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
700
|
+
exports.createDynamic = createDynamic;
|
|
697
701
|
exports.delegateEvents = delegateEvents;
|
|
698
702
|
exports.dynamicProperty = dynamicProperty;
|
|
699
703
|
exports.escape = escape;
|
package/dist/dev.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
flatten,
|
|
7
7
|
enableHydration,
|
|
8
8
|
createMemo,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
$DEVCOMP,
|
|
10
|
+
omit
|
|
11
11
|
} from "solid-js";
|
|
12
12
|
export {
|
|
13
13
|
ErrorBoundary,
|
|
@@ -1098,9 +1098,8 @@ function createElementProxy(el, marker) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
});
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1102
|
-
const
|
|
1103
|
-
const cached = createMemo(() => props.component);
|
|
1101
|
+
function createDynamic(component, props) {
|
|
1102
|
+
const cached = createMemo(component);
|
|
1104
1103
|
return createMemo(() => {
|
|
1105
1104
|
const component = cached();
|
|
1106
1105
|
switch (typeof component) {
|
|
@@ -1108,15 +1107,19 @@ function Dynamic(props) {
|
|
|
1108
1107
|
Object.assign(component, {
|
|
1109
1108
|
[$DEVCOMP]: true
|
|
1110
1109
|
});
|
|
1111
|
-
return untrack(() => component(
|
|
1110
|
+
return untrack(() => component(props));
|
|
1112
1111
|
case "string":
|
|
1113
1112
|
const isSvg = SVGElements.has(component);
|
|
1114
1113
|
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
1115
|
-
spread(el,
|
|
1114
|
+
spread(el, props, isSvg);
|
|
1116
1115
|
return el;
|
|
1117
1116
|
}
|
|
1118
1117
|
});
|
|
1119
1118
|
}
|
|
1119
|
+
function Dynamic(props) {
|
|
1120
|
+
const others = omit(props, "component");
|
|
1121
|
+
return createDynamic(() => props.component, others);
|
|
1122
|
+
}
|
|
1120
1123
|
|
|
1121
1124
|
export {
|
|
1122
1125
|
voidFn as Assets,
|
|
@@ -1136,6 +1139,7 @@ export {
|
|
|
1136
1139
|
assign,
|
|
1137
1140
|
className,
|
|
1138
1141
|
clearDelegatedEvents,
|
|
1142
|
+
createDynamic,
|
|
1139
1143
|
delegateEvents,
|
|
1140
1144
|
dynamicProperty,
|
|
1141
1145
|
escape,
|
package/dist/server.cjs
CHANGED
|
@@ -592,16 +592,19 @@ function notSup() {
|
|
|
592
592
|
|
|
593
593
|
const isServer = true;
|
|
594
594
|
const isDev = false;
|
|
595
|
-
function
|
|
596
|
-
const
|
|
597
|
-
const comp = p.component,
|
|
595
|
+
function createDynamic(component, props) {
|
|
596
|
+
const comp = component(),
|
|
598
597
|
t = typeof comp;
|
|
599
598
|
if (comp) {
|
|
600
|
-
if (t === "function") return comp(
|
|
601
|
-
return ssrElement(comp,
|
|
599
|
+
if (t === "function") return comp(props);else if (t === "string") {
|
|
600
|
+
return ssrElement(comp, props, undefined, true);
|
|
602
601
|
}
|
|
603
602
|
}
|
|
604
603
|
}
|
|
604
|
+
function Dynamic(props) {
|
|
605
|
+
const [, others] = solidJs.splitProps(props, ["component"]);
|
|
606
|
+
return createDynamic(() => props.component, others);
|
|
607
|
+
}
|
|
605
608
|
function Portal(props) {
|
|
606
609
|
return "";
|
|
607
610
|
}
|
|
@@ -678,6 +681,7 @@ exports.SVGNamespace = SVGNamespace;
|
|
|
678
681
|
exports.addEventListener = notSup;
|
|
679
682
|
exports.assign = notSup;
|
|
680
683
|
exports.className = notSup;
|
|
684
|
+
exports.createDynamic = createDynamic;
|
|
681
685
|
exports.delegateEvents = notSup;
|
|
682
686
|
exports.dynamicProperty = notSup;
|
|
683
687
|
exports.escape = escape;
|
package/dist/server.js
CHANGED
|
@@ -1058,17 +1058,20 @@ function notSup() {
|
|
|
1058
1058
|
|
|
1059
1059
|
const isServer = true;
|
|
1060
1060
|
const isDev = false;
|
|
1061
|
-
function
|
|
1062
|
-
const
|
|
1063
|
-
const comp = p.component,
|
|
1061
|
+
function createDynamic(component, props) {
|
|
1062
|
+
const comp = component(),
|
|
1064
1063
|
t = typeof comp;
|
|
1065
1064
|
if (comp) {
|
|
1066
|
-
if (t === "function") return comp(
|
|
1065
|
+
if (t === "function") return comp(props);
|
|
1067
1066
|
else if (t === "string") {
|
|
1068
|
-
return ssrElement(comp,
|
|
1067
|
+
return ssrElement(comp, props, undefined, true);
|
|
1069
1068
|
}
|
|
1070
1069
|
}
|
|
1071
1070
|
}
|
|
1071
|
+
function Dynamic(props) {
|
|
1072
|
+
const [, others] = splitProps(props, ["component"]);
|
|
1073
|
+
return createDynamic(() => props.component, others);
|
|
1074
|
+
}
|
|
1072
1075
|
function Portal(props) {
|
|
1073
1076
|
return "";
|
|
1074
1077
|
}
|
|
@@ -1090,6 +1093,7 @@ export {
|
|
|
1090
1093
|
notSup as addEventListener,
|
|
1091
1094
|
notSup as assign,
|
|
1092
1095
|
notSup as className,
|
|
1096
|
+
createDynamic,
|
|
1093
1097
|
notSup as delegateEvents,
|
|
1094
1098
|
notSup as dynamicProperty,
|
|
1095
1099
|
escape,
|
package/dist/web.cjs
CHANGED
|
@@ -601,22 +601,25 @@ function createElementProxy(el, marker) {
|
|
|
601
601
|
}
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
|
-
function
|
|
605
|
-
const
|
|
606
|
-
const cached = solidJs.createMemo(() => props.component);
|
|
604
|
+
function createDynamic(component, props) {
|
|
605
|
+
const cached = solidJs.createMemo(component);
|
|
607
606
|
return solidJs.createMemo(() => {
|
|
608
607
|
const component = cached();
|
|
609
608
|
switch (typeof component) {
|
|
610
609
|
case "function":
|
|
611
|
-
return solidJs.untrack(() => component(
|
|
610
|
+
return solidJs.untrack(() => component(props));
|
|
612
611
|
case "string":
|
|
613
612
|
const isSvg = SVGElements.has(component);
|
|
614
613
|
const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
615
|
-
spread(el,
|
|
614
|
+
spread(el, props, isSvg);
|
|
616
615
|
return el;
|
|
617
616
|
}
|
|
618
617
|
});
|
|
619
618
|
}
|
|
619
|
+
function Dynamic(props) {
|
|
620
|
+
const others = solidJs.omit(props, "component");
|
|
621
|
+
return createDynamic(() => props.component, others);
|
|
622
|
+
}
|
|
620
623
|
|
|
621
624
|
Object.defineProperty(exports, "ErrorBoundary", {
|
|
622
625
|
enumerable: true,
|
|
@@ -683,6 +686,7 @@ exports.addEventListener = addEventListener;
|
|
|
683
686
|
exports.assign = assign;
|
|
684
687
|
exports.className = className;
|
|
685
688
|
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
689
|
+
exports.createDynamic = createDynamic;
|
|
686
690
|
exports.delegateEvents = delegateEvents;
|
|
687
691
|
exports.dynamicProperty = dynamicProperty;
|
|
688
692
|
exports.escape = escape;
|
package/dist/web.js
CHANGED
|
@@ -1080,22 +1080,25 @@ function createElementProxy(el, marker) {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1084
|
-
const
|
|
1085
|
-
const cached = createMemo(() => props.component);
|
|
1083
|
+
function createDynamic(component, props) {
|
|
1084
|
+
const cached = createMemo(component);
|
|
1086
1085
|
return createMemo(() => {
|
|
1087
1086
|
const component = cached();
|
|
1088
1087
|
switch (typeof component) {
|
|
1089
1088
|
case "function":
|
|
1090
|
-
return untrack(() => component(
|
|
1089
|
+
return untrack(() => component(props));
|
|
1091
1090
|
case "string":
|
|
1092
1091
|
const isSvg = SVGElements.has(component);
|
|
1093
1092
|
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
1094
|
-
spread(el,
|
|
1093
|
+
spread(el, props, isSvg);
|
|
1095
1094
|
return el;
|
|
1096
1095
|
}
|
|
1097
1096
|
});
|
|
1098
1097
|
}
|
|
1098
|
+
function Dynamic(props) {
|
|
1099
|
+
const others = omit(props, "component");
|
|
1100
|
+
return createDynamic(() => props.component, others);
|
|
1101
|
+
}
|
|
1099
1102
|
|
|
1100
1103
|
export {
|
|
1101
1104
|
voidFn as Assets,
|
|
@@ -1115,6 +1118,7 @@ export {
|
|
|
1115
1118
|
assign,
|
|
1116
1119
|
className,
|
|
1117
1120
|
clearDelegatedEvents,
|
|
1121
|
+
createDynamic,
|
|
1118
1122
|
delegateEvents,
|
|
1119
1123
|
dynamicProperty,
|
|
1120
1124
|
escape,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime for the browser and the server",
|
|
4
|
-
"version": "2.0.0-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.2",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"seroval-plugins": "^1.1.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"solid-js": "^2.0.0-experimental.
|
|
78
|
+
"solid-js": "^2.0.0-experimental.2"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"solid-js": "2.0.0-experimental.
|
|
81
|
+
"solid-js": "2.0.0-experimental.2"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "npm-run-all -nl build:*",
|
package/types/index.d.ts
CHANGED
|
@@ -22,6 +22,22 @@ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
|
22
22
|
} & {
|
|
23
23
|
component: T | undefined;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Renders an arbitrary component or element with the given props
|
|
27
|
+
*
|
|
28
|
+
* This is a lower level version of the `Dynamic` component, useful for
|
|
29
|
+
* performance optimizations in libraries. Do not use this unless you know
|
|
30
|
+
* what you are doing.
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const element = () => multiline() ? 'textarea' : 'input';
|
|
33
|
+
* createDynamic(element, { value: value() });
|
|
34
|
+
* ```
|
|
35
|
+
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
36
|
+
*/
|
|
37
|
+
export declare function createDynamic<T extends ValidComponent>(
|
|
38
|
+
component: () => T | undefined,
|
|
39
|
+
props: ComponentProps<T>
|
|
40
|
+
): JSX.Element;
|
|
25
41
|
/**
|
|
26
42
|
* Renders an arbitrary custom or native component and passes the other props
|
|
27
43
|
* ```typescript
|