@builder.io/sdk-solid 0.0.8 → 0.0.9
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 +1 -1
- package/src/blocks/button/button.jsx +13 -0
- package/src/blocks/button/button.lite.tsx +20 -0
- package/src/blocks/button/component-info.js +41 -0
- package/src/blocks/button/index.js +7 -0
- package/src/blocks/columns/columns.jsx +91 -0
- package/src/blocks/{columns.lite.tsx → columns/columns.lite.tsx} +4 -3
- package/src/blocks/columns/component-info.js +217 -0
- package/src/blocks/columns/index.js +7 -0
- package/src/blocks/custom-code/component-info.js +31 -0
- package/src/blocks/{custom-code.jsx → custom-code/custom-code.jsx} +1 -2
- package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.lite.tsx} +0 -0
- package/src/blocks/custom-code/index.js +7 -0
- package/src/blocks/embed/component-info.js +24 -0
- package/src/blocks/{embed.jsx → embed/embed.jsx} +1 -2
- package/src/blocks/{embed.lite.tsx → embed/embed.lite.tsx} +0 -0
- package/src/blocks/embed/index.js +7 -0
- package/src/blocks/form/component-info.js +262 -0
- package/src/blocks/{form.jsx → form/form.jsx} +8 -8
- package/src/blocks/{form.lite.tsx → form/form.lite.tsx} +7 -6
- package/src/blocks/form/index.js +7 -0
- package/src/blocks/fragment/component-info.js +11 -0
- package/src/blocks/fragment/fragment.jsx +5 -0
- package/src/blocks/{fragment.lite.tsx → fragment/fragment.lite.tsx} +0 -0
- package/src/blocks/fragment/index.js +7 -0
- package/src/blocks/image/component-info.js +104 -0
- package/src/blocks/image/image.jsx +54 -0
- package/src/blocks/image/image.lite.tsx +83 -0
- package/src/blocks/image/index.js +7 -0
- package/src/blocks/img/component-info.js +20 -0
- package/src/blocks/img/img.jsx +10 -0
- package/src/blocks/{img.lite.tsx → img/img.lite.tsx} +1 -1
- package/src/blocks/img/index.js +7 -0
- package/src/blocks/input/component-info.js +74 -0
- package/src/blocks/input/index.js +7 -0
- package/src/blocks/input/input.jsx +7 -0
- package/src/blocks/{input.lite.tsx → input/input.lite.tsx} +1 -1
- package/src/blocks/raw-text/component-info.js +16 -0
- package/src/blocks/raw-text/index.js +7 -0
- package/src/blocks/raw-text/raw-text.jsx +5 -0
- package/src/blocks/{raw-text.lite.tsx → raw-text/raw-text.lite.tsx} +0 -0
- package/src/blocks/section/component-info.js +49 -0
- package/src/blocks/section/index.js +7 -0
- package/src/blocks/section/section.jsx +9 -0
- package/src/blocks/{section.lite.tsx → section/section.lite.tsx} +0 -0
- package/src/blocks/select/component-info.js +59 -0
- package/src/blocks/select/index.js +7 -0
- package/src/blocks/select/select.jsx +16 -0
- package/src/blocks/{select.lite.tsx → select/select.lite.tsx} +1 -1
- package/src/blocks/submit-button/component-info.js +28 -0
- package/src/blocks/submit-button/index.js +7 -0
- package/src/blocks/submit-button/submit-button.jsx +7 -0
- package/src/blocks/{submit-button.lite.tsx → submit-button/submit-button.lite.tsx} +0 -0
- package/src/blocks/symbol/component-info.js +42 -0
- package/src/blocks/symbol/index.js +7 -0
- package/src/blocks/symbol/symbol.jsx +24 -0
- package/src/blocks/{symbol.lite.tsx → symbol/symbol.lite.tsx} +3 -3
- package/src/blocks/text/component-info.js +24 -0
- package/src/blocks/text/index.js +7 -0
- package/src/blocks/text/text.jsx +5 -0
- package/src/blocks/{text.lite.tsx → text/text.lite.tsx} +0 -0
- package/src/blocks/textarea/component-info.js +47 -0
- package/src/blocks/textarea/index.js +7 -0
- package/src/blocks/textarea/textarea.jsx +5 -0
- package/src/blocks/{textarea.lite.tsx → textarea/textarea.lite.tsx} +0 -0
- package/src/blocks/video/component-info.js +106 -0
- package/src/blocks/video/index.js +7 -0
- package/src/blocks/video/video.jsx +14 -0
- package/src/blocks/{video.lite.tsx → video/video.lite.tsx} +0 -0
- package/src/components/render-block/block-styles.jsx +36 -0
- package/src/components/render-block/block-styles.lite.tsx +38 -0
- package/src/components/{render-block.jsx → render-block/render-block.jsx} +13 -10
- package/src/components/{render-block.lite.tsx → render-block/render-block.lite.tsx} +13 -10
- package/src/components/render-blocks.jsx +1 -1
- package/src/components/render-blocks.lite.tsx +1 -1
- package/src/components/render-content/components/render-styles.jsx +6 -5
- package/src/components/render-content/components/render-styles.lite.tsx +9 -5
- package/src/components/render-content/render-content.jsx +16 -15
- package/src/components/render-content/render-content.lite.tsx +19 -18
- package/src/functions/get-builder-search-params/fn.test.js +1 -1
- package/src/functions/get-content/index.js +2 -1
- package/src/functions/get-fetch.js +28 -6
- package/src/index.js +10 -13
- package/src/scripts/init-editing.js +69 -60
- package/src/blocks/button.jsx +0 -8
- package/src/blocks/button.lite.tsx +0 -14
- package/src/blocks/columns.jsx +0 -91
- package/src/blocks/fragment.jsx +0 -6
- package/src/blocks/image.jsx +0 -120
- package/src/blocks/image.lite.tsx +0 -171
- package/src/blocks/img.jsx +0 -11
- package/src/blocks/input.jsx +0 -8
- package/src/blocks/raw-text.jsx +0 -6
- package/src/blocks/section.jsx +0 -10
- package/src/blocks/select.jsx +0 -17
- package/src/blocks/submit-button.jsx +0 -8
- package/src/blocks/symbol.jsx +0 -25
- package/src/blocks/text.jsx +0 -6
- package/src/blocks/textarea.jsx +0 -6
- package/src/blocks/video.jsx +0 -15
- package/src/components/block-styles.jsx +0 -5
- package/src/components/block-styles.lite.tsx +0 -5
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Show } from "solid-js";
|
|
2
|
+
|
|
3
|
+
function Button(props) {
|
|
4
|
+
return <>
|
|
5
|
+
<Show 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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Show } from "solid-js";
|
|
2
|
+
|
|
3
|
+
function Button(props) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<Show when={props.link}>
|
|
7
|
+
<a
|
|
8
|
+
{...props.attributes}
|
|
9
|
+
role="button"
|
|
10
|
+
href={props.link}
|
|
11
|
+
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
12
|
+
>
|
|
13
|
+
{props.text}
|
|
14
|
+
</a>
|
|
15
|
+
</Show>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default Button;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerComponent } from "../../functions/register-component";
|
|
2
|
+
import component from "./button";
|
|
3
|
+
import { componentInfo } from "./component-info";
|
|
4
|
+
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
+
export {
|
|
6
|
+
stdin_default as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
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;
|
|
@@ -3,7 +3,7 @@ import { For } from "solid-js";
|
|
|
3
3
|
import { createMutable } from "solid-js/store";
|
|
4
4
|
import { css } from "solid-styled-components";
|
|
5
5
|
|
|
6
|
-
import RenderBlocks from "
|
|
6
|
+
import RenderBlocks from "../../components/render-blocks.lite";
|
|
7
7
|
|
|
8
8
|
function Columns(props) {
|
|
9
9
|
const state = createMutable({
|
|
@@ -25,8 +25,9 @@ function Columns(props) {
|
|
|
25
25
|
return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
|
|
26
26
|
},
|
|
27
27
|
maybeApplyForTablet(prop: string) {
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const _stackColumnsAt = props.stackColumnsAt || "tablet";
|
|
29
|
+
|
|
30
|
+
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
30
31
|
},
|
|
31
32
|
get columnsCssVars() {
|
|
32
33
|
const flexDir =
|
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerComponent } from "../../functions/register-component";
|
|
2
|
+
import component from "./columns";
|
|
3
|
+
import { componentInfo } from "./component-info";
|
|
4
|
+
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
+
export {
|
|
6
|
+
stdin_default as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
};
|
|
@@ -48,5 +48,4 @@ function CustomCode(props) {
|
|
|
48
48
|
return <div class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")} ref={elem} innerHTML={props.code}></div>;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export default CustomCode;
|
|
52
|
-
registerComponent(CustomCode, {name:'Custom Code',static:true,builtIn:true,requiredPermissions:['editCode'],inputs:[{name:'code',type:'html',required:true,defaultValue:'<p>Hello there, I am custom HTML code!</p>',code:true},{name:'replaceNodes',type:'boolean',helperText:'Preserve server rendered dom nodes',advanced:true},{name:'scriptsClientOnly',type:'boolean',defaultValue:false,helperText:'Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads',advanced:true}]});
|
|
51
|
+
export default CustomCode;
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerComponent } from "../../functions/register-component";
|
|
2
|
+
import { componentInfo } from "./component-info";
|
|
3
|
+
import component from "./custom-code";
|
|
4
|
+
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
+
export {
|
|
6
|
+
stdin_default as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Embed",
|
|
3
|
+
static: true,
|
|
4
|
+
builtIn: true,
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
name: "url",
|
|
8
|
+
type: "url",
|
|
9
|
+
required: true,
|
|
10
|
+
defaultValue: "",
|
|
11
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
12
|
+
onChange: " const url = options.get('url'); if (url) { options.set('content', 'Loading...'); // TODO: get this out of here! const apiKey = 'ae0e60e78201a3f2b0de4b'; return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`) .then(res => res.json()) .then(data => { if (options.get('url') === url) { if (data.html) { options.set('content', data.html); } else { options.set('content', 'Invalid url, please try another'); } } }) .catch(err => { options.set( 'content', 'There was an error embedding this URL, please try again or another URL' ); }); } else { options.delete('content'); } "
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "content",
|
|
16
|
+
type: "html",
|
|
17
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
18
|
+
hideFromUI: true
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
componentInfo
|
|
24
|
+
};
|
|
@@ -48,5 +48,4 @@ function Embed(props) {
|
|
|
48
48
|
return <div ref={elem} innerHTML={props.content}></div>;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export default Embed;
|
|
52
|
-
registerComponent(Embed, {name:'Embed',static:true,builtIn:true,inputs:[{name:'url',type:'url',required:true,defaultValue:'',helperText:'e.g. enter a youtube url, google map, etc',onChange:" const url = options.get('url'); if (url) { options.set('content', 'Loading...'); // TODO: get this out of here! const apiKey = 'ae0e60e78201a3f2b0de4b'; return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`) .then(res => res.json()) .then(data => { if (options.get('url') === url) { if (data.html) { options.set('content', data.html); } else { options.set('content', 'Invalid url, please try another'); } } }) .catch(err => { options.set( 'content', 'There was an error embedding this URL, please try again or another URL' ); }); } else { options.delete('content'); } "},{name:'content',type:'html',defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:true}]});
|
|
51
|
+
export default Embed;
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerComponent } from "../../functions/register-component";
|
|
2
|
+
import { componentInfo } from "./component-info";
|
|
3
|
+
import component from "./embed";
|
|
4
|
+
var stdin_default = registerComponent(component, componentInfo);
|
|
5
|
+
export {
|
|
6
|
+
stdin_default as default
|
|
7
|
+
};
|