@builder.io/sdk-solid 0.0.8-3 → 0.0.8-4
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/entry-point/index.jsx +5 -0
- package/package.json +8 -8
- package/src/blocks/button/button.jsx +1 -1
- package/src/blocks/button/button.lite.tsx +4 -1
- package/src/blocks/custom-code/custom-code.jsx +1 -0
- package/src/blocks/custom-code/custom-code.lite.tsx +2 -0
- package/src/blocks/embed/embed.jsx +1 -0
- package/src/blocks/embed/embed.lite.tsx +2 -0
- package/src/blocks/symbol/symbol.jsx +2 -1
- package/src/blocks/symbol/symbol.lite.tsx +3 -1
- package/src/components/render-block/render-block.jsx +14 -6
- package/src/components/render-block/render-block.lite.tsx +24 -6
- package/src/components/render-content/render-content.jsx +23 -0
- package/src/components/render-content/render-content.lite.tsx +31 -3
- package/src/components/render-inlined-styles.jsx +2 -1
- package/src/components/render-inlined-styles.lite.tsx +4 -1
- package/src/constants/builder-registered-components.js +29 -0
- package/src/context/builder.context.js +2 -1
- package/src/functions/fast-clone.js +4 -0
- package/src/functions/register-component.js +13 -13
- package/src/index-helpers/blocks-exports.js +9 -9
- package/src/types/components.js +0 -0
- package/src/types/element.js +0 -0
- package/src/blocks/button/index.js +0 -7
- package/src/blocks/columns/index.js +0 -7
- package/src/blocks/custom-code/index.js +0 -7
- package/src/blocks/embed/index.js +0 -7
- package/src/blocks/form/index.js +0 -7
- package/src/blocks/fragment/index.js +0 -7
- package/src/blocks/image/index.js +0 -7
- package/src/blocks/img/index.js +0 -7
- package/src/blocks/input/index.js +0 -7
- package/src/blocks/raw-text/index.js +0 -7
- package/src/blocks/section/index.js +0 -7
- package/src/blocks/select/index.js +0 -7
- package/src/blocks/submit-button/index.js +0 -7
- package/src/blocks/symbol/index.js +0 -7
- package/src/blocks/text/index.js +0 -7
- package/src/blocks/textarea/index.js +0 -7
- package/src/blocks/video/index.js +0 -7
- package/vite.config.js +0 -19
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-solid",
|
|
3
|
-
"version": "0.0.8-
|
|
3
|
+
"version": "0.0.8-4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./
|
|
7
|
-
"module": "./
|
|
6
|
+
"main": "./entry-point/index.jsx",
|
|
7
|
+
"module": "./entry-point/index.jsx",
|
|
8
8
|
"exports": {
|
|
9
|
-
".": "./
|
|
9
|
+
".": "./entry-point/index.jsx"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "vite build",
|
|
13
12
|
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
14
13
|
},
|
|
15
14
|
"dependencies": {
|
|
15
|
+
"node-fetch": "^2.6.7",
|
|
16
16
|
"solid-styled-components": "^0.27.6"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"solid-js": "^1.3.15"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"vite": "^2.9.8",
|
|
23
|
-
"vite-plugin-solid": "^2.2.6",
|
|
24
22
|
"babel-preset-solid": "^1.3.17",
|
|
25
|
-
"solid-js": "^1.3.15"
|
|
23
|
+
"solid-js": "^1.3.15",
|
|
24
|
+
"vite": "^2.9.8",
|
|
25
|
+
"vite-plugin-solid": "^2.2.6"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -2,7 +2,7 @@ import { Show } from "solid-js";
|
|
|
2
2
|
|
|
3
3
|
function Button(props) {
|
|
4
4
|
return <>
|
|
5
|
-
<Show when={props.link}>
|
|
5
|
+
<Show fallback={<span {...props.attributes}>{props.text}</span>} when={props.link}>
|
|
6
6
|
<a {...props.attributes} role="button" href={props.link} target={props.openLinkInNewTab ? "_blank" : undefined}>
|
|
7
7
|
{props.text}
|
|
8
8
|
</a>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useContext, onMount } from "solid-js";
|
|
1
2
|
import { createMutable } from "solid-js/store";
|
|
2
3
|
import RenderContent from "../../components/render-content/render-content";
|
|
3
4
|
import BuilderContext from "../../context/builder.context";
|
|
@@ -16,7 +17,7 @@ function Symbol(props) {
|
|
|
16
17
|
}}>
|
|
17
18
|
<RenderContent apiKey={builderContext.apiKey} context={builderContext.context} data={{ ...props.symbol?.data,
|
|
18
19
|
...builderContext.state,
|
|
19
|
-
...props.symbol?.
|
|
20
|
+
...props.symbol?.content?.data?.state
|
|
20
21
|
}} model={props.symbol?.model} content={state.content}></RenderContent>
|
|
21
22
|
</div>;
|
|
22
23
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useContext, onMount } from "solid-js";
|
|
2
|
+
|
|
1
3
|
import { createMutable } from "solid-js/store";
|
|
2
4
|
|
|
3
5
|
import RenderContent from "../../components/render-content/render-content.lite";
|
|
@@ -27,7 +29,7 @@ function Symbol(props) {
|
|
|
27
29
|
data={{
|
|
28
30
|
...props.symbol?.data,
|
|
29
31
|
...builderContext.state,
|
|
30
|
-
...props.symbol?.
|
|
32
|
+
...props.symbol?.content?.data?.state,
|
|
31
33
|
}}
|
|
32
34
|
model={props.symbol?.model}
|
|
33
35
|
content={state.content}
|
|
@@ -9,7 +9,6 @@ import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
|
9
9
|
import { getBlockStyles } from "../../functions/get-block-styles.js";
|
|
10
10
|
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
11
11
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
12
|
-
import { components } from "../../functions/register-component.js";
|
|
13
12
|
import BlockStyles from "./block-styles";
|
|
14
13
|
|
|
15
14
|
function RenderBlock(props) {
|
|
@@ -21,16 +20,17 @@ function RenderBlock(props) {
|
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
const ref =
|
|
23
|
+
const ref = builderContext.registeredComponents[componentName];
|
|
25
24
|
|
|
26
|
-
if (
|
|
25
|
+
if (!ref) {
|
|
27
26
|
// TODO: Public doc page with more info about this message
|
|
28
27
|
console.warn(`
|
|
29
28
|
Could not find a registered component named "${componentName}".
|
|
30
29
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
30
|
+
return undefined;
|
|
31
|
+
} else {
|
|
32
|
+
return ref;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
return ref;
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
get componentInfo() {
|
|
@@ -86,7 +86,15 @@ function RenderBlock(props) {
|
|
|
86
86
|
});
|
|
87
87
|
const builderContext = useContext(BuilderContext);
|
|
88
88
|
return <>
|
|
89
|
-
<Show
|
|
89
|
+
<Show fallback={<Dynamic {...state.componentOptions} attributes={state.propertiesAndActions} builderBlock={state.useBlock} style={state.css} component={state.componentRef}>
|
|
90
|
+
<For each={state.children}>
|
|
91
|
+
{(child, _index) => {
|
|
92
|
+
const index = _index();
|
|
93
|
+
|
|
94
|
+
return <RenderBlock block={child}></RenderBlock>;
|
|
95
|
+
}}
|
|
96
|
+
</For>
|
|
97
|
+
</Dynamic>} when={!state.componentInfo?.noWrap}>
|
|
90
98
|
<Dynamic {...state.propertiesAndActions} style={state.css} component={state.tagName}>
|
|
91
99
|
<Show when={TARGET === "vue" || TARGET === "svelte"}>
|
|
92
100
|
<BlockStyles block={state.useBlock}></BlockStyles>
|
|
@@ -10,7 +10,6 @@ import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
|
10
10
|
import { getBlockStyles } from "../../functions/get-block-styles.js";
|
|
11
11
|
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
12
12
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
13
|
-
import { components } from "../../functions/register-component.js";
|
|
14
13
|
import BlockStyles from "./block-styles.lite";
|
|
15
14
|
|
|
16
15
|
function RenderBlock(props) {
|
|
@@ -22,16 +21,17 @@ function RenderBlock(props) {
|
|
|
22
21
|
return null;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
const ref =
|
|
24
|
+
const ref = builderContext.registeredComponents[componentName];
|
|
26
25
|
|
|
27
|
-
if (
|
|
26
|
+
if (!ref) {
|
|
28
27
|
// TODO: Public doc page with more info about this message
|
|
29
28
|
console.warn(`
|
|
30
29
|
Could not find a registered component named "${componentName}".
|
|
31
30
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
31
|
+
return undefined;
|
|
32
|
+
} else {
|
|
33
|
+
return ref;
|
|
32
34
|
}
|
|
33
|
-
|
|
34
|
-
return ref;
|
|
35
35
|
},
|
|
36
36
|
get componentInfo() {
|
|
37
37
|
return state.component?.info;
|
|
@@ -81,7 +81,25 @@ function RenderBlock(props) {
|
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<>
|
|
84
|
-
<Show
|
|
84
|
+
<Show
|
|
85
|
+
fallback={
|
|
86
|
+
<Dynamic
|
|
87
|
+
{...state.componentOptions}
|
|
88
|
+
attributes={state.propertiesAndActions}
|
|
89
|
+
builderBlock={state.useBlock}
|
|
90
|
+
style={state.css}
|
|
91
|
+
component={state.componentRef}
|
|
92
|
+
>
|
|
93
|
+
<For each={state.children}>
|
|
94
|
+
{(child, _index) => {
|
|
95
|
+
const index = _index();
|
|
96
|
+
return <RenderBlock block={child}></RenderBlock>;
|
|
97
|
+
}}
|
|
98
|
+
</For>
|
|
99
|
+
</Dynamic>
|
|
100
|
+
}
|
|
101
|
+
when={!state.componentInfo?.noWrap}
|
|
102
|
+
>
|
|
85
103
|
<Dynamic
|
|
86
104
|
{...state.propertiesAndActions}
|
|
87
105
|
style={state.css}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Show, onMount } from "solid-js";
|
|
2
2
|
import { Dynamic } from "solid-js/web";
|
|
3
3
|
import { createMutable } from "solid-js/store";
|
|
4
|
+
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
4
5
|
import { TARGET } from "../../constants/target.js";
|
|
5
6
|
import BuilderContext from "../../context/builder.context";
|
|
6
7
|
import { evaluate } from "../../functions/evaluate.js";
|
|
@@ -11,6 +12,7 @@ import { isBrowser } from "../../functions/is-browser.js";
|
|
|
11
12
|
import { isEditing } from "../../functions/is-editing.js";
|
|
12
13
|
import { isPreviewing } from "../../functions/is-previewing.js";
|
|
13
14
|
import { previewingModelName } from "../../functions/previewing-model-name.js";
|
|
15
|
+
import { components, createRegisterComponentMessage } from "../../functions/register-component.js";
|
|
14
16
|
import { track } from "../../functions/track.js";
|
|
15
17
|
import RenderBlocks from "../render-blocks";
|
|
16
18
|
import RenderContentStyles from "./components/render-styles";
|
|
@@ -43,6 +45,19 @@ function RenderContent(props) {
|
|
|
43
45
|
return {};
|
|
44
46
|
},
|
|
45
47
|
|
|
48
|
+
get allRegisteredComponents() {
|
|
49
|
+
const allComponentsArray = [...getDefaultRegisteredComponents(), // While this `components` object is deprecated, we must maintain support for it.
|
|
50
|
+
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
51
|
+
// existing usage.
|
|
52
|
+
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
53
|
+
// which is the new standard way of providing custom components, and must therefore take precedence.
|
|
54
|
+
...components, ...(props.customComponents || [])];
|
|
55
|
+
const allComponents = allComponentsArray.reduce((acc, curr) => ({ ...acc,
|
|
56
|
+
[curr.info.name]: curr
|
|
57
|
+
}), {});
|
|
58
|
+
return allComponents;
|
|
59
|
+
},
|
|
60
|
+
|
|
46
61
|
processMessage(event) {
|
|
47
62
|
const {
|
|
48
63
|
data
|
|
@@ -142,6 +157,10 @@ function RenderContent(props) {
|
|
|
142
157
|
onMount(() => {
|
|
143
158
|
if (isBrowser()) {
|
|
144
159
|
if (isEditing()) {
|
|
160
|
+
Object.values(state.allRegisteredComponents).forEach(registeredComponent => {
|
|
161
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
162
|
+
window.parent?.postMessage(message, "*");
|
|
163
|
+
});
|
|
145
164
|
window.addEventListener("message", state.processMessage);
|
|
146
165
|
window.addEventListener("builder:component:stateChangeListenerActivated", state.emitStateUpdate);
|
|
147
166
|
}
|
|
@@ -192,6 +211,10 @@ function RenderContent(props) {
|
|
|
192
211
|
|
|
193
212
|
get apiKey() {
|
|
194
213
|
return props.apiKey;
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
get registeredComponents() {
|
|
217
|
+
return state.allRegisteredComponents;
|
|
195
218
|
}
|
|
196
219
|
|
|
197
220
|
}} component={BuilderContext.Provider}>
|
|
@@ -2,6 +2,7 @@ import { useContext, Show, onMount } from "solid-js";
|
|
|
2
2
|
import { Dynamic } from "solid-js/web";
|
|
3
3
|
import { createMutable } from "solid-js/store";
|
|
4
4
|
|
|
5
|
+
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
5
6
|
import { TARGET } from "../../constants/target.js";
|
|
6
7
|
import BuilderContext from "../../context/builder.context";
|
|
7
8
|
import { evaluate } from "../../functions/evaluate.js";
|
|
@@ -15,6 +16,10 @@ import { isBrowser } from "../../functions/is-browser.js";
|
|
|
15
16
|
import { isEditing } from "../../functions/is-editing.js";
|
|
16
17
|
import { isPreviewing } from "../../functions/is-previewing.js";
|
|
17
18
|
import { previewingModelName } from "../../functions/previewing-model-name.js";
|
|
19
|
+
import {
|
|
20
|
+
components,
|
|
21
|
+
createRegisterComponentMessage,
|
|
22
|
+
} from "../../functions/register-component.js";
|
|
18
23
|
import { track } from "../../functions/track.js";
|
|
19
24
|
import RenderBlocks from "../render-blocks.lite";
|
|
20
25
|
import RenderContentStyles from "./components/render-styles.lite";
|
|
@@ -44,9 +49,23 @@ function RenderContent(props) {
|
|
|
44
49
|
};
|
|
45
50
|
},
|
|
46
51
|
get context() {
|
|
47
|
-
return {} as
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
return {} as Dictionary<any>;
|
|
53
|
+
},
|
|
54
|
+
get allRegisteredComponents() {
|
|
55
|
+
const allComponentsArray = [
|
|
56
|
+
...getDefaultRegisteredComponents(), // While this `components` object is deprecated, we must maintain support for it.
|
|
57
|
+
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
58
|
+
// existing usage.
|
|
59
|
+
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
60
|
+
// which is the new standard way of providing custom components, and must therefore take precedence.
|
|
61
|
+
...components,
|
|
62
|
+
...(props.customComponents || []),
|
|
63
|
+
];
|
|
64
|
+
const allComponents = allComponentsArray.reduce(
|
|
65
|
+
(acc, curr) => ({ ...acc, [curr.info.name]: curr }),
|
|
66
|
+
{} as RegisteredComponents
|
|
67
|
+
);
|
|
68
|
+
return allComponents;
|
|
50
69
|
},
|
|
51
70
|
processMessage(event: MessageEvent) {
|
|
52
71
|
const { data } = event;
|
|
@@ -143,6 +162,12 @@ function RenderContent(props) {
|
|
|
143
162
|
onMount(() => {
|
|
144
163
|
if (isBrowser()) {
|
|
145
164
|
if (isEditing()) {
|
|
165
|
+
Object.values(state.allRegisteredComponents).forEach(
|
|
166
|
+
(registeredComponent) => {
|
|
167
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
168
|
+
window.parent?.postMessage(message, "*");
|
|
169
|
+
}
|
|
170
|
+
);
|
|
146
171
|
window.addEventListener("message", state.processMessage);
|
|
147
172
|
window.addEventListener(
|
|
148
173
|
"builder:component:stateChangeListenerActivated",
|
|
@@ -198,6 +223,9 @@ function RenderContent(props) {
|
|
|
198
223
|
get apiKey() {
|
|
199
224
|
return props.apiKey;
|
|
200
225
|
},
|
|
226
|
+
get registeredComponents() {
|
|
227
|
+
return state.allRegisteredComponents;
|
|
228
|
+
},
|
|
201
229
|
}}
|
|
202
230
|
component={BuilderContext.Provider}
|
|
203
231
|
>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Show } from "solid-js";
|
|
2
|
+
import { Dynamic } from "solid-js/web";
|
|
2
3
|
import { createMutable } from "solid-js/store";
|
|
3
4
|
import { TARGET } from "../constants/target.js";
|
|
4
5
|
|
|
@@ -15,7 +16,7 @@ function RenderInlinedStyles(props) {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
});
|
|
18
|
-
return <Show when={TARGET === "svelte"}>
|
|
19
|
+
return <Show fallback={<Dynamic component={state.tagName}>{props.styles}</Dynamic>} when={TARGET === "svelte"}>
|
|
19
20
|
<div innerHTML={state.injectedStyleScript}></div>
|
|
20
21
|
</Show>;
|
|
21
22
|
}
|
|
@@ -17,7 +17,10 @@ function RenderInlinedStyles(props) {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<Show
|
|
20
|
+
<Show
|
|
21
|
+
fallback={<Dynamic component={state.tagName}>{props.styles}</Dynamic>}
|
|
22
|
+
when={TARGET === "svelte"}
|
|
23
|
+
>
|
|
21
24
|
<div innerHTML={state.injectedStyleScript}></div>
|
|
22
25
|
</Show>
|
|
23
26
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as Button } from "../blocks/button/button.jsx";
|
|
2
|
+
import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info";
|
|
3
|
+
import { default as Columns } from "../blocks/columns/columns.jsx";
|
|
4
|
+
import { componentInfo as columnsComponentInfo } from "../blocks/columns/component-info";
|
|
5
|
+
import { componentInfo as fragmentComponentInfo } from "../blocks/fragment/component-info";
|
|
6
|
+
import { default as Fragment } from "../blocks/fragment/fragment.jsx";
|
|
7
|
+
import { componentInfo as imageComponentInfo } from "../blocks/image/component-info";
|
|
8
|
+
import { default as Image } from "../blocks/image/image.jsx";
|
|
9
|
+
import { componentInfo as sectionComponentInfo } from "../blocks/section/component-info";
|
|
10
|
+
import { default as Section } from "../blocks/section/section.jsx";
|
|
11
|
+
import { componentInfo as symbolComponentInfo } from "../blocks/symbol/component-info";
|
|
12
|
+
import { default as Symbol } from "../blocks/symbol/symbol.jsx";
|
|
13
|
+
import { componentInfo as textComponentInfo } from "../blocks/text/component-info";
|
|
14
|
+
import { default as Text } from "../blocks/text/text.jsx";
|
|
15
|
+
import { componentInfo as videoComponentInfo } from "../blocks/video/component-info";
|
|
16
|
+
import { default as Video } from "../blocks/video/video.jsx";
|
|
17
|
+
const getDefaultRegisteredComponents = () => [
|
|
18
|
+
{ component: Columns, info: columnsComponentInfo },
|
|
19
|
+
{ component: Image, info: imageComponentInfo },
|
|
20
|
+
{ component: Text, info: textComponentInfo },
|
|
21
|
+
{ component: Video, info: videoComponentInfo },
|
|
22
|
+
{ component: Symbol, info: symbolComponentInfo },
|
|
23
|
+
{ component: Button, info: buttonComponentInfo },
|
|
24
|
+
{ component: Section, info: sectionComponentInfo },
|
|
25
|
+
{ component: Fragment, info: fragmentComponentInfo }
|
|
26
|
+
];
|
|
27
|
+
export {
|
|
28
|
+
getDefaultRegisteredComponents
|
|
29
|
+
};
|
|
@@ -17,27 +17,26 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import {
|
|
21
|
-
const components =
|
|
20
|
+
import { fastClone } from "./fast-clone.js";
|
|
21
|
+
const components = [];
|
|
22
22
|
function registerComponent(component, info) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (isBrowser()) {
|
|
26
|
-
const sendInfo = prepareComponentInfoToSend(info);
|
|
27
|
-
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
28
|
-
type: "builder.registerComponent",
|
|
29
|
-
data: sendInfo
|
|
30
|
-
}, "*");
|
|
31
|
-
}
|
|
23
|
+
components.push({ component, info });
|
|
24
|
+
console.warn("registerComponent is deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.");
|
|
32
25
|
return component;
|
|
33
26
|
}
|
|
27
|
+
const createRegisterComponentMessage = ({
|
|
28
|
+
info
|
|
29
|
+
}) => ({
|
|
30
|
+
type: "builder.registerComponent",
|
|
31
|
+
data: prepareComponentInfoToSend(fastClone(info))
|
|
32
|
+
});
|
|
34
33
|
function prepareComponentInfoToSend(info) {
|
|
35
34
|
return __spreadValues(__spreadValues({}, info), info.inputs && {
|
|
36
35
|
inputs: info.inputs.map((input) => {
|
|
37
36
|
const keysToConvertFnToString = ["onChange", "showIf"];
|
|
38
37
|
for (const key of keysToConvertFnToString) {
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const fn = input[key];
|
|
39
|
+
if (fn && typeof fn === "function") {
|
|
41
40
|
input = __spreadProps(__spreadValues({}, input), {
|
|
42
41
|
[key]: `return (${fn.toString()}).apply(this, arguments)`
|
|
43
42
|
});
|
|
@@ -49,5 +48,6 @@ function prepareComponentInfoToSend(info) {
|
|
|
49
48
|
}
|
|
50
49
|
export {
|
|
51
50
|
components,
|
|
51
|
+
createRegisterComponentMessage,
|
|
52
52
|
registerComponent
|
|
53
53
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { default as default2 } from "../blocks/columns/
|
|
2
|
-
import { default as default3 } from "../blocks/image/
|
|
3
|
-
import { default as default4 } from "../blocks/text/
|
|
4
|
-
import { default as default5 } from "../blocks/video/
|
|
5
|
-
import { default as default6 } from "../blocks/symbol/
|
|
6
|
-
import { default as default7 } from "../blocks/button/
|
|
7
|
-
import { default as default8 } from "../blocks/section/
|
|
8
|
-
import { default as default9 } from "../blocks/fragment/
|
|
9
|
-
import { default as default10 } from "../components/render-content/
|
|
1
|
+
import { default as default2 } from "../blocks/columns/columns.jsx";
|
|
2
|
+
import { default as default3 } from "../blocks/image/image.jsx";
|
|
3
|
+
import { default as default4 } from "../blocks/text/text.jsx";
|
|
4
|
+
import { default as default5 } from "../blocks/video/video.jsx";
|
|
5
|
+
import { default as default6 } from "../blocks/symbol/symbol.jsx";
|
|
6
|
+
import { default as default7 } from "../blocks/button/button.jsx";
|
|
7
|
+
import { default as default8 } from "../blocks/section/section.jsx";
|
|
8
|
+
import { default as default9 } from "../blocks/fragment/fragment.jsx";
|
|
9
|
+
import { default as default10 } from "../components/render-content/render-content.jsx";
|
|
10
10
|
export {
|
|
11
11
|
default7 as Button,
|
|
12
12
|
default2 as Columns,
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import component from "./button.jsx";
|
|
3
|
-
import { componentInfo } from "./component-info.js";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import component from "./columns.jsx";
|
|
3
|
-
import { componentInfo } from "./component-info.js";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./custom-code.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./embed.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
package/src/blocks/form/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./form.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./fragment.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./image.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
package/src/blocks/img/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./img.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./input.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./raw-text.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./section.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./select.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./submit-button.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./symbol.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
package/src/blocks/text/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./text.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./textarea.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from "../../functions/register-component.js";
|
|
2
|
-
import { componentInfo } from "./component-info.js";
|
|
3
|
-
import component from "./video.jsx";
|
|
4
|
-
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
-
export {
|
|
6
|
-
stdin_default as default
|
|
7
|
-
};
|
package/vite.config.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import solidPlugin from 'vite-plugin-solid';
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [solidPlugin()],
|
|
7
|
-
publicDir: false,
|
|
8
|
-
build: {
|
|
9
|
-
outDir: 'pkg-dist',
|
|
10
|
-
lib: {
|
|
11
|
-
entry: 'src/index.js',
|
|
12
|
-
formats: ['es', 'cjs'],
|
|
13
|
-
fileName: (format) => `sdk-solid.${format}.js`,
|
|
14
|
-
},
|
|
15
|
-
// rollupOptions: {
|
|
16
|
-
// external: ['solid-styled-components'],
|
|
17
|
-
// }
|
|
18
|
-
},
|
|
19
|
-
});
|