@builder.io/sdk-solid 0.0.8-4 → 0.0.8-5
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/package.json +4 -1
- package/entry-point/index.jsx +0 -5
- package/src/blocks/button/button.jsx +0 -13
- package/src/blocks/button/button.lite.tsx +0 -23
- package/src/blocks/button/component-info.js +0 -41
- package/src/blocks/columns/columns.jsx +0 -91
- package/src/blocks/columns/columns.lite.tsx +0 -102
- package/src/blocks/columns/component-info.js +0 -217
- package/src/blocks/custom-code/component-info.js +0 -31
- package/src/blocks/custom-code/custom-code.jsx +0 -52
- package/src/blocks/custom-code/custom-code.lite.tsx +0 -69
- package/src/blocks/embed/component-info.js +0 -24
- package/src/blocks/embed/embed.jsx +0 -52
- package/src/blocks/embed/embed.lite.tsx +0 -61
- package/src/blocks/form/component-info.js +0 -262
- package/src/blocks/form/form.jsx +0 -253
- package/src/blocks/form/form.lite.tsx +0 -293
- package/src/blocks/fragment/component-info.js +0 -11
- package/src/blocks/fragment/fragment.jsx +0 -5
- package/src/blocks/fragment/fragment.lite.tsx +0 -5
- package/src/blocks/image/component-info.js +0 -104
- package/src/blocks/image/image.jsx +0 -54
- package/src/blocks/image/image.lite.tsx +0 -83
- package/src/blocks/img/component-info.js +0 -20
- package/src/blocks/img/img.jsx +0 -10
- package/src/blocks/img/img.lite.tsx +0 -18
- package/src/blocks/input/component-info.js +0 -74
- package/src/blocks/input/input.jsx +0 -7
- package/src/blocks/input/input.lite.tsx +0 -20
- package/src/blocks/raw-text/component-info.js +0 -16
- package/src/blocks/raw-text/raw-text.jsx +0 -5
- package/src/blocks/raw-text/raw-text.lite.tsx +0 -10
- package/src/blocks/section/component-info.js +0 -49
- package/src/blocks/section/section.jsx +0 -9
- package/src/blocks/section/section.lite.tsx +0 -18
- package/src/blocks/select/component-info.js +0 -59
- package/src/blocks/select/select.jsx +0 -16
- package/src/blocks/select/select.lite.tsx +0 -28
- package/src/blocks/submit-button/component-info.js +0 -28
- package/src/blocks/submit-button/submit-button.jsx +0 -7
- package/src/blocks/submit-button/submit-button.lite.tsx +0 -9
- package/src/blocks/symbol/component-info.js +0 -42
- package/src/blocks/symbol/symbol.jsx +0 -25
- package/src/blocks/symbol/symbol.lite.tsx +0 -41
- package/src/blocks/text/component-info.js +0 -24
- package/src/blocks/text/text.jsx +0 -5
- package/src/blocks/text/text.lite.tsx +0 -5
- package/src/blocks/textarea/component-info.js +0 -47
- package/src/blocks/textarea/textarea.jsx +0 -5
- package/src/blocks/textarea/textarea.lite.tsx +0 -13
- package/src/blocks/video/component-info.js +0 -106
- package/src/blocks/video/video.jsx +0 -14
- package/src/blocks/video/video.lite.tsx +0 -26
- package/src/components/error-boundary.jsx +0 -5
- package/src/components/error-boundary.lite.tsx +0 -5
- package/src/components/render-block/block-styles.jsx +0 -36
- package/src/components/render-block/block-styles.lite.tsx +0 -38
- package/src/components/render-block/render-block.jsx +0 -125
- package/src/components/render-block/render-block.lite.tsx +0 -137
- package/src/components/render-blocks.jsx +0 -57
- package/src/components/render-blocks.lite.tsx +0 -75
- package/src/components/render-content/components/render-styles.jsx +0 -74
- package/src/components/render-content/components/render-styles.lite.tsx +0 -76
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/render-content.jsx +0 -234
- package/src/components/render-content/render-content.lite.tsx +0 -260
- package/src/components/render-inlined-styles.jsx +0 -24
- package/src/components/render-inlined-styles.lite.tsx +0 -29
- package/src/constants/builder-registered-components.js +0 -29
- package/src/constants/device-sizes.js +0 -39
- package/src/constants/target.js +0 -4
- package/src/context/builder.context.js +0 -11
- package/src/functions/evaluate.js +0 -28
- package/src/functions/event-handler-name.js +0 -7
- package/src/functions/fast-clone.js +0 -4
- package/src/functions/get-block-actions.js +0 -23
- package/src/functions/get-block-component-options.js +0 -23
- package/src/functions/get-block-properties.js +0 -29
- package/src/functions/get-block-styles.js +0 -42
- package/src/functions/get-block-tag.js +0 -6
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-builder-search-params/index.js +0 -22
- package/src/functions/get-content/fn.test.js +0 -31
- package/src/functions/get-content/index.js +0 -138
- package/src/functions/get-fetch.js +0 -34
- package/src/functions/get-global-this.js +0 -18
- package/src/functions/get-processed-block.js +0 -46
- package/src/functions/get-processed-block.test.js +0 -31
- package/src/functions/if-target.js +0 -15
- package/src/functions/is-browser.js +0 -6
- package/src/functions/is-editing.js +0 -7
- package/src/functions/is-iframe.js +0 -7
- package/src/functions/is-previewing.js +0 -14
- package/src/functions/macro-eval.js +0 -5
- package/src/functions/on-change.js +0 -27
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/previewing-model-name.js +0 -11
- package/src/functions/register-component.js +0 -53
- package/src/functions/register.js +0 -29
- package/src/functions/set-editor-settings.js +0 -15
- package/src/functions/set.js +0 -11
- package/src/functions/set.test.js +0 -16
- package/src/functions/track.js +0 -22
- package/src/functions/transform-block.js +0 -6
- package/src/index-helpers/blocks-exports.js +0 -20
- package/src/index-helpers/top-of-file.js +0 -4
- package/src/index.js +0 -10
- package/src/scripts/init-editing.js +0 -80
- package/src/types/builder-block.js +0 -0
- package/src/types/builder-content.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-solid",
|
|
3
|
-
"version": "0.0.8-
|
|
3
|
+
"version": "0.0.8-5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./entry-point/index.jsx",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./entry-point/index.jsx"
|
|
10
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src/**, entry-point/**"
|
|
13
|
+
],
|
|
11
14
|
"scripts": {
|
|
12
15
|
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
13
16
|
},
|
package/entry-point/index.jsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
|
-
function Button(props) {
|
|
4
|
-
return <>
|
|
5
|
-
<Show fallback={<span {...props.attributes}>{props.text}</span>} when={props.link}>
|
|
6
|
-
<a {...props.attributes} role="button" href={props.link} target={props.openLinkInNewTab ? "_blank" : undefined}>
|
|
7
|
-
{props.text}
|
|
8
|
-
</a>
|
|
9
|
-
</Show>
|
|
10
|
-
</>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Button;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
|
-
function Button(props) {
|
|
4
|
-
return (
|
|
5
|
-
<>
|
|
6
|
-
<Show
|
|
7
|
-
fallback={<span {...props.attributes}>{props.text}</span>}
|
|
8
|
-
when={props.link}
|
|
9
|
-
>
|
|
10
|
-
<a
|
|
11
|
-
{...props.attributes}
|
|
12
|
-
role="button"
|
|
13
|
-
href={props.link}
|
|
14
|
-
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
15
|
-
>
|
|
16
|
-
{props.text}
|
|
17
|
-
</a>
|
|
18
|
-
</Show>
|
|
19
|
-
</>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default Button;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Core:Button",
|
|
3
|
-
builtIn: true,
|
|
4
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
5
|
-
defaultStyles: {
|
|
6
|
-
appearance: "none",
|
|
7
|
-
paddingTop: "15px",
|
|
8
|
-
paddingBottom: "15px",
|
|
9
|
-
paddingLeft: "25px",
|
|
10
|
-
paddingRight: "25px",
|
|
11
|
-
backgroundColor: "#000000",
|
|
12
|
-
color: "white",
|
|
13
|
-
borderRadius: "4px",
|
|
14
|
-
textAlign: "center",
|
|
15
|
-
cursor: "pointer"
|
|
16
|
-
},
|
|
17
|
-
inputs: [
|
|
18
|
-
{
|
|
19
|
-
name: "text",
|
|
20
|
-
type: "text",
|
|
21
|
-
defaultValue: "Click me!",
|
|
22
|
-
bubble: true
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "link",
|
|
26
|
-
type: "url",
|
|
27
|
-
bubble: true
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "openLinkInNewTab",
|
|
31
|
-
type: "boolean",
|
|
32
|
-
defaultValue: false,
|
|
33
|
-
friendlyName: "Open link in new tab"
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
static: true,
|
|
37
|
-
noWrap: true
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
componentInfo
|
|
41
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { For } from "solid-js";
|
|
2
|
-
import { createMutable } from "solid-js/store";
|
|
3
|
-
import { css } from "solid-styled-components";
|
|
4
|
-
import RenderBlocks from "../../components/render-blocks";
|
|
5
|
-
|
|
6
|
-
function Columns(props) {
|
|
7
|
-
const state = createMutable({
|
|
8
|
-
getGutterSize() {
|
|
9
|
-
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
getColumns() {
|
|
13
|
-
return props.columns || [];
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
getWidth(index) {
|
|
17
|
-
const columns = this.getColumns();
|
|
18
|
-
return columns[index]?.width || 100 / columns.length;
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
getColumnCssWidth(index) {
|
|
22
|
-
const columns = this.getColumns();
|
|
23
|
-
const gutterSize = this.getGutterSize();
|
|
24
|
-
const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
|
|
25
|
-
return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
maybeApplyForTablet(prop) {
|
|
29
|
-
const _stackColumnsAt = props.stackColumnsAt || "tablet";
|
|
30
|
-
|
|
31
|
-
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
get columnsCssVars() {
|
|
35
|
-
const flexDir = props.stackColumnsAt === "never" ? "inherit" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
36
|
-
return {
|
|
37
|
-
"--flex-dir": flexDir,
|
|
38
|
-
"--flex-dir-tablet": this.maybeApplyForTablet(flexDir)
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
get columnCssVars() {
|
|
43
|
-
const width = "100%";
|
|
44
|
-
const marginLeft = "0";
|
|
45
|
-
return {
|
|
46
|
-
"--column-width": width,
|
|
47
|
-
"--column-margin-left": marginLeft,
|
|
48
|
-
"--column-width-tablet": this.maybeApplyForTablet(width),
|
|
49
|
-
"--column-margin-left-tablet": this.maybeApplyForTablet(marginLeft)
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
return <div class={css({
|
|
55
|
-
display: "flex",
|
|
56
|
-
alignItems: "stretch",
|
|
57
|
-
lineHeight: "normal",
|
|
58
|
-
"@media (max-width: 999px)": {
|
|
59
|
-
flexDirection: "var(--flex-dir-tablet)"
|
|
60
|
-
},
|
|
61
|
-
"@media (max-width: 639px)": {
|
|
62
|
-
flexDirection: "var(--flex-dir)"
|
|
63
|
-
}
|
|
64
|
-
})} style={state.columnsCssVars}>
|
|
65
|
-
<For each={props.columns}>
|
|
66
|
-
{(column, _index) => {
|
|
67
|
-
const index = _index();
|
|
68
|
-
|
|
69
|
-
return <div class={css({
|
|
70
|
-
flexGrow: "1",
|
|
71
|
-
"@media (max-width: 999px)": {
|
|
72
|
-
width: "var(--column-width-tablet) !important",
|
|
73
|
-
marginLeft: "var(--column-margin-left-tablet) !important"
|
|
74
|
-
},
|
|
75
|
-
"@media (max-width: 639px)": {
|
|
76
|
-
width: "var(--column-width) !important",
|
|
77
|
-
marginLeft: "var(--column-margin-left) !important"
|
|
78
|
-
}
|
|
79
|
-
})} style={{
|
|
80
|
-
width: state.getColumnCssWidth(index),
|
|
81
|
-
"margin-left": `${index === 0 ? 0 : state.getGutterSize()}px`,
|
|
82
|
-
...state.columnCssVars
|
|
83
|
-
}}>
|
|
84
|
-
<RenderBlocks blocks={column.blocks}></RenderBlocks>
|
|
85
|
-
</div>;
|
|
86
|
-
}}
|
|
87
|
-
</For>
|
|
88
|
-
</div>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export default Columns;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { For } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { createMutable } from "solid-js/store";
|
|
4
|
-
import { css } from "solid-styled-components";
|
|
5
|
-
|
|
6
|
-
import RenderBlocks from "../../components/render-blocks.lite";
|
|
7
|
-
|
|
8
|
-
function Columns(props) {
|
|
9
|
-
const state = createMutable({
|
|
10
|
-
getGutterSize() {
|
|
11
|
-
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
12
|
-
},
|
|
13
|
-
getColumns() {
|
|
14
|
-
return props.columns || [];
|
|
15
|
-
},
|
|
16
|
-
getWidth(index: number) {
|
|
17
|
-
const columns = this.getColumns();
|
|
18
|
-
return columns[index]?.width || 100 / columns.length;
|
|
19
|
-
},
|
|
20
|
-
getColumnCssWidth(index: number) {
|
|
21
|
-
const columns = this.getColumns();
|
|
22
|
-
const gutterSize = this.getGutterSize();
|
|
23
|
-
const subtractWidth =
|
|
24
|
-
(gutterSize * (columns.length - 1)) / columns.length;
|
|
25
|
-
return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
|
|
26
|
-
},
|
|
27
|
-
maybeApplyForTablet(prop: string) {
|
|
28
|
-
const _stackColumnsAt = props.stackColumnsAt || "tablet";
|
|
29
|
-
|
|
30
|
-
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
31
|
-
},
|
|
32
|
-
get columnsCssVars() {
|
|
33
|
-
const flexDir =
|
|
34
|
-
props.stackColumnsAt === "never"
|
|
35
|
-
? "inherit"
|
|
36
|
-
: props.reverseColumnsWhenStacked
|
|
37
|
-
? "column-reverse"
|
|
38
|
-
: "column";
|
|
39
|
-
return {
|
|
40
|
-
"--flex-dir": flexDir,
|
|
41
|
-
"--flex-dir-tablet": this.maybeApplyForTablet(flexDir),
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
get columnCssVars() {
|
|
45
|
-
const width = "100%";
|
|
46
|
-
const marginLeft = "0";
|
|
47
|
-
return {
|
|
48
|
-
"--column-width": width,
|
|
49
|
-
"--column-margin-left": marginLeft,
|
|
50
|
-
"--column-width-tablet": this.maybeApplyForTablet(width),
|
|
51
|
-
"--column-margin-left-tablet": this.maybeApplyForTablet(marginLeft),
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div
|
|
58
|
-
class={css({
|
|
59
|
-
display: "flex",
|
|
60
|
-
alignItems: "stretch",
|
|
61
|
-
lineHeight: "normal",
|
|
62
|
-
"@media (max-width: 999px)": {
|
|
63
|
-
flexDirection: "var(--flex-dir-tablet)",
|
|
64
|
-
},
|
|
65
|
-
"@media (max-width: 639px)": {
|
|
66
|
-
flexDirection: "var(--flex-dir)",
|
|
67
|
-
},
|
|
68
|
-
})}
|
|
69
|
-
style={state.columnsCssVars}
|
|
70
|
-
>
|
|
71
|
-
<For each={props.columns}>
|
|
72
|
-
{(column, _index) => {
|
|
73
|
-
const index = _index();
|
|
74
|
-
return (
|
|
75
|
-
<div
|
|
76
|
-
class={css({
|
|
77
|
-
flexGrow: "1",
|
|
78
|
-
"@media (max-width: 999px)": {
|
|
79
|
-
width: "var(--column-width-tablet) !important",
|
|
80
|
-
marginLeft: "var(--column-margin-left-tablet) !important",
|
|
81
|
-
},
|
|
82
|
-
"@media (max-width: 639px)": {
|
|
83
|
-
width: "var(--column-width) !important",
|
|
84
|
-
marginLeft: "var(--column-margin-left) !important",
|
|
85
|
-
},
|
|
86
|
-
})}
|
|
87
|
-
style={{
|
|
88
|
-
width: state.getColumnCssWidth(index),
|
|
89
|
-
"margin-left": `${index === 0 ? 0 : state.getGutterSize()}px`,
|
|
90
|
-
...state.columnCssVars,
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
<RenderBlocks blocks={column.blocks}></RenderBlocks>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
}}
|
|
97
|
-
</For>
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export default Columns;
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Columns",
|
|
3
|
-
builtIn: true,
|
|
4
|
-
inputs: [
|
|
5
|
-
{
|
|
6
|
-
name: "columns",
|
|
7
|
-
type: "array",
|
|
8
|
-
broadcast: true,
|
|
9
|
-
subFields: [
|
|
10
|
-
{
|
|
11
|
-
name: "blocks",
|
|
12
|
-
type: "array",
|
|
13
|
-
hideFromUI: true,
|
|
14
|
-
defaultValue: [
|
|
15
|
-
{
|
|
16
|
-
"@type": "@builder.io/sdk:Element",
|
|
17
|
-
responsiveStyles: {
|
|
18
|
-
large: {
|
|
19
|
-
display: "flex",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
alignItems: "stretch",
|
|
22
|
-
flexShrink: "0",
|
|
23
|
-
position: "relative",
|
|
24
|
-
marginTop: "30px",
|
|
25
|
-
textAlign: "center",
|
|
26
|
-
lineHeight: "normal",
|
|
27
|
-
height: "auto",
|
|
28
|
-
minHeight: "20px",
|
|
29
|
-
minWidth: "20px",
|
|
30
|
-
overflow: "hidden"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
component: {
|
|
34
|
-
name: "Image",
|
|
35
|
-
options: {
|
|
36
|
-
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
37
|
-
backgroundPosition: "center",
|
|
38
|
-
backgroundSize: "cover",
|
|
39
|
-
aspectRatio: 0.7004048582995948
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"@type": "@builder.io/sdk:Element",
|
|
45
|
-
responsiveStyles: {
|
|
46
|
-
large: {
|
|
47
|
-
display: "flex",
|
|
48
|
-
flexDirection: "column",
|
|
49
|
-
alignItems: "stretch",
|
|
50
|
-
flexShrink: "0",
|
|
51
|
-
position: "relative",
|
|
52
|
-
marginTop: "30px",
|
|
53
|
-
textAlign: "center",
|
|
54
|
-
lineHeight: "normal",
|
|
55
|
-
height: "auto"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
component: {
|
|
59
|
-
name: "Text",
|
|
60
|
-
options: {
|
|
61
|
-
text: "<p>Enter some text...</p>"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "width",
|
|
69
|
-
type: "number",
|
|
70
|
-
hideFromUI: true,
|
|
71
|
-
helperText: "Width %, e.g. set to 50 to fill half of the space"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: "link",
|
|
75
|
-
type: "url",
|
|
76
|
-
helperText: "Optionally set a url that clicking this column will link to"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
defaultValue: [
|
|
80
|
-
{
|
|
81
|
-
blocks: [
|
|
82
|
-
{
|
|
83
|
-
"@type": "@builder.io/sdk:Element",
|
|
84
|
-
responsiveStyles: {
|
|
85
|
-
large: {
|
|
86
|
-
display: "flex",
|
|
87
|
-
flexDirection: "column",
|
|
88
|
-
alignItems: "stretch",
|
|
89
|
-
flexShrink: "0",
|
|
90
|
-
position: "relative",
|
|
91
|
-
marginTop: "30px",
|
|
92
|
-
textAlign: "center",
|
|
93
|
-
lineHeight: "normal",
|
|
94
|
-
height: "auto",
|
|
95
|
-
minHeight: "20px",
|
|
96
|
-
minWidth: "20px",
|
|
97
|
-
overflow: "hidden"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
component: {
|
|
101
|
-
name: "Image",
|
|
102
|
-
options: {
|
|
103
|
-
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
104
|
-
backgroundPosition: "center",
|
|
105
|
-
backgroundSize: "cover",
|
|
106
|
-
aspectRatio: 0.7004048582995948
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"@type": "@builder.io/sdk:Element",
|
|
112
|
-
responsiveStyles: {
|
|
113
|
-
large: {
|
|
114
|
-
display: "flex",
|
|
115
|
-
flexDirection: "column",
|
|
116
|
-
alignItems: "stretch",
|
|
117
|
-
flexShrink: "0",
|
|
118
|
-
position: "relative",
|
|
119
|
-
marginTop: "30px",
|
|
120
|
-
textAlign: "center",
|
|
121
|
-
lineHeight: "normal",
|
|
122
|
-
height: "auto"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
component: {
|
|
126
|
-
name: "Text",
|
|
127
|
-
options: {
|
|
128
|
-
text: "<p>Enter some text...</p>"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
blocks: [
|
|
136
|
-
{
|
|
137
|
-
"@type": "@builder.io/sdk:Element",
|
|
138
|
-
responsiveStyles: {
|
|
139
|
-
large: {
|
|
140
|
-
display: "flex",
|
|
141
|
-
flexDirection: "column",
|
|
142
|
-
alignItems: "stretch",
|
|
143
|
-
flexShrink: "0",
|
|
144
|
-
position: "relative",
|
|
145
|
-
marginTop: "30px",
|
|
146
|
-
textAlign: "center",
|
|
147
|
-
lineHeight: "normal",
|
|
148
|
-
height: "auto",
|
|
149
|
-
minHeight: "20px",
|
|
150
|
-
minWidth: "20px",
|
|
151
|
-
overflow: "hidden"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
component: {
|
|
155
|
-
name: "Image",
|
|
156
|
-
options: {
|
|
157
|
-
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
158
|
-
backgroundPosition: "center",
|
|
159
|
-
backgroundSize: "cover",
|
|
160
|
-
aspectRatio: 0.7004048582995948
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"@type": "@builder.io/sdk:Element",
|
|
166
|
-
responsiveStyles: {
|
|
167
|
-
large: {
|
|
168
|
-
display: "flex",
|
|
169
|
-
flexDirection: "column",
|
|
170
|
-
alignItems: "stretch",
|
|
171
|
-
flexShrink: "0",
|
|
172
|
-
position: "relative",
|
|
173
|
-
marginTop: "30px",
|
|
174
|
-
textAlign: "center",
|
|
175
|
-
lineHeight: "normal",
|
|
176
|
-
height: "auto"
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
component: {
|
|
180
|
-
name: "Text",
|
|
181
|
-
options: {
|
|
182
|
-
text: "<p>Enter some text...</p>"
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
onChange: " function clearWidths() { columns.forEach(col => { col.delete('width'); }); } const columns = options.get('columns') as Array<Map<String, any>>; if (Array.isArray(columns)) { const containsColumnWithWidth = !!columns.find(col => col.get('width')); if (containsColumnWithWidth) { const containsColumnWithoutWidth = !!columns.find(col => !col.get('width')); if (containsColumnWithoutWidth) { clearWidths(); } else { const sumWidths = columns.reduce((memo, col) => { return memo + col.get('width'); }, 0); const widthsDontAddUp = sumWidths !== 100; if (widthsDontAddUp) { clearWidths(); } } } } "
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: "space",
|
|
193
|
-
type: "number",
|
|
194
|
-
defaultValue: 20,
|
|
195
|
-
helperText: "Size of gap between columns",
|
|
196
|
-
advanced: true
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: "stackColumnsAt",
|
|
200
|
-
type: "string",
|
|
201
|
-
defaultValue: "tablet",
|
|
202
|
-
helperText: "Convert horizontal columns to vertical at what device size",
|
|
203
|
-
enum: ["tablet", "mobile", "never"],
|
|
204
|
-
advanced: true
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: "reverseColumnsWhenStacked",
|
|
208
|
-
type: "boolean",
|
|
209
|
-
defaultValue: false,
|
|
210
|
-
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
211
|
-
advanced: true
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
};
|
|
215
|
-
export {
|
|
216
|
-
componentInfo
|
|
217
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Custom Code",
|
|
3
|
-
static: true,
|
|
4
|
-
builtIn: true,
|
|
5
|
-
requiredPermissions: ["editCode"],
|
|
6
|
-
inputs: [
|
|
7
|
-
{
|
|
8
|
-
name: "code",
|
|
9
|
-
type: "html",
|
|
10
|
-
required: true,
|
|
11
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
12
|
-
code: true
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: "replaceNodes",
|
|
16
|
-
type: "boolean",
|
|
17
|
-
helperText: "Preserve server rendered dom nodes",
|
|
18
|
-
advanced: true
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "scriptsClientOnly",
|
|
22
|
-
type: "boolean",
|
|
23
|
-
defaultValue: false,
|
|
24
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
25
|
-
advanced: true
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
componentInfo
|
|
31
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { onMount } from "solid-js";
|
|
2
|
-
import { createMutable } from "solid-js/store";
|
|
3
|
-
|
|
4
|
-
function CustomCode(props) {
|
|
5
|
-
const state = createMutable({
|
|
6
|
-
scriptsInserted: [],
|
|
7
|
-
scriptsRun: [],
|
|
8
|
-
|
|
9
|
-
findAndRunScripts() {
|
|
10
|
-
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
11
|
-
if (elem && typeof window !== "undefined") {
|
|
12
|
-
/** @type {HTMLScriptElement[]} */
|
|
13
|
-
const scripts = elem.getElementsByTagName("script");
|
|
14
|
-
|
|
15
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
16
|
-
const script = scripts[i];
|
|
17
|
-
|
|
18
|
-
if (script.src) {
|
|
19
|
-
if (state.scriptsInserted.includes(script.src)) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
state.scriptsInserted.push(script.src);
|
|
24
|
-
const newScript = document.createElement("script");
|
|
25
|
-
newScript.async = true;
|
|
26
|
-
newScript.src = script.src;
|
|
27
|
-
document.head.appendChild(newScript);
|
|
28
|
-
} else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
|
|
29
|
-
if (state.scriptsRun.includes(script.innerText)) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
state.scriptsRun.push(script.innerText);
|
|
35
|
-
new Function(script.innerText)();
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
const elem = useRef();
|
|
46
|
-
onMount(() => {
|
|
47
|
-
state.findAndRunScripts();
|
|
48
|
-
});
|
|
49
|
-
return <div class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")} ref={elem} innerHTML={props.code}></div>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default CustomCode;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { onMount } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { createMutable } from "solid-js/store";
|
|
4
|
-
|
|
5
|
-
function CustomCode(props) {
|
|
6
|
-
const state = createMutable({
|
|
7
|
-
scriptsInserted: [],
|
|
8
|
-
scriptsRun: [],
|
|
9
|
-
findAndRunScripts() {
|
|
10
|
-
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
11
|
-
if (elem && typeof window !== "undefined") {
|
|
12
|
-
/** @type {HTMLScriptElement[]} */
|
|
13
|
-
const scripts = elem.getElementsByTagName("script");
|
|
14
|
-
|
|
15
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
16
|
-
const script = scripts[i];
|
|
17
|
-
|
|
18
|
-
if (script.src) {
|
|
19
|
-
if (state.scriptsInserted.includes(script.src)) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
state.scriptsInserted.push(script.src);
|
|
24
|
-
const newScript = document.createElement("script");
|
|
25
|
-
newScript.async = true;
|
|
26
|
-
newScript.src = script.src;
|
|
27
|
-
document.head.appendChild(newScript);
|
|
28
|
-
} else if (
|
|
29
|
-
!script.type ||
|
|
30
|
-
[
|
|
31
|
-
"text/javascript",
|
|
32
|
-
"application/javascript",
|
|
33
|
-
"application/ecmascript",
|
|
34
|
-
].includes(script.type)
|
|
35
|
-
) {
|
|
36
|
-
if (state.scriptsRun.includes(script.innerText)) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
state.scriptsRun.push(script.innerText);
|
|
42
|
-
new Function(script.innerText)();
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const elem = useRef();
|
|
53
|
-
|
|
54
|
-
onMount(() => {
|
|
55
|
-
state.findAndRunScripts();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div
|
|
60
|
-
class={
|
|
61
|
-
"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")
|
|
62
|
-
}
|
|
63
|
-
ref={elem}
|
|
64
|
-
innerHTML={props.code}
|
|
65
|
-
></div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default CustomCode;
|