@builder.io/sdk-solid 0.4.5 → 0.5.1
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/blocks/BaseText.jsx +1 -1
- package/src/blocks/button/button.jsx +5 -3
- package/src/blocks/button/component-info.js +16 -22
- package/src/blocks/columns/columns.jsx +12 -21
- package/src/blocks/columns/component-info.js +203 -226
- package/src/blocks/custom-code/component-info.js +19 -25
- package/src/blocks/embed/component-info.js +31 -37
- package/src/blocks/embed/helpers.js +3 -9
- package/src/blocks/form/component-info.js +174 -212
- package/src/blocks/form/form.jsx +1 -268
- package/src/blocks/fragment/component-info.js +1 -3
- package/src/blocks/helpers.js +27 -0
- package/src/blocks/image/component-info.js +105 -133
- package/src/blocks/image/image.helpers.js +3 -5
- package/src/blocks/img/component-info.js +8 -12
- package/src/blocks/img/img.jsx +2 -0
- package/src/blocks/input/component-info.js +29 -57
- package/src/blocks/input/input.jsx +2 -0
- package/src/blocks/raw-text/component-info.js +7 -11
- package/src/blocks/raw-text/raw-text.jsx +2 -2
- package/src/blocks/section/component-info.js +24 -31
- package/src/blocks/section/section.jsx +3 -0
- package/src/blocks/select/component-info.js +34 -48
- package/src/blocks/select/select.jsx +2 -0
- package/src/blocks/submit-button/component-info.js +6 -10
- package/src/blocks/submit-button/submit-button.jsx +3 -1
- package/src/blocks/symbol/component-info.js +30 -37
- package/src/blocks/symbol/symbol.helpers.js +60 -0
- package/src/blocks/symbol/symbol.jsx +31 -68
- package/src/blocks/text/component-info.js +10 -13
- package/src/blocks/text/text.jsx +1 -1
- package/src/blocks/textarea/component-info.js +22 -30
- package/src/blocks/textarea/textarea.jsx +3 -0
- package/src/blocks/video/component-info.js +74 -96
- package/src/blocks/video/video.jsx +1 -0
- package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
- package/src/components/{render-block/render-block.jsx → block/block.jsx} +65 -80
- package/src/components/{render-block → block/components}/block-styles.jsx +16 -16
- package/src/components/block/components/block-wrapper.jsx +50 -0
- package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
- package/src/components/block/components/component-ref/component-ref.jsx +58 -0
- package/src/components/block/components/interactive-element.jsx +30 -0
- package/src/components/block/components/repeated-block.jsx +20 -0
- package/src/components/blocks/blocks-wrapper.jsx +66 -0
- package/src/components/blocks/blocks.jsx +57 -0
- package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +86 -175
- package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
- package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +4 -4
- package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
- package/src/components/content/content.jsx +136 -0
- package/src/components/content/index.js +2 -0
- package/src/components/content/wrap-component-ref.js +2 -0
- package/src/components/{render-content-variants/render-content-variants.jsx → content-variants/content-variants.jsx} +19 -22
- package/src/components/{render-content-variants → content-variants}/helpers.js +28 -40
- package/src/constants/builder-registered-components.js +34 -25
- package/src/constants/device-sizes.js +6 -6
- package/src/constants/sdk-version.js +1 -1
- package/src/context/builder.context.js +1 -1
- package/src/context/components.context.js +5 -0
- package/src/functions/apply-patch-with-mutation.js +66 -0
- package/src/functions/camel-to-kebab-case.js +2 -4
- package/src/functions/evaluate/acorn.js +1595 -0
- package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
- package/src/functions/evaluate/index.js +2 -0
- package/src/functions/evaluate/interpreter.js +2801 -0
- package/src/functions/evaluate/non-node-runtime.js +92 -0
- package/src/functions/evaluate/types.js +0 -0
- package/src/functions/event-handler-name.js +2 -4
- package/src/functions/extract-text-styles.js +4 -12
- package/src/functions/fast-clone.js +2 -4
- package/src/functions/get-block-actions-handler.js +3 -5
- package/src/functions/get-block-actions.js +15 -4
- package/src/functions/get-block-component-options.js +11 -12
- package/src/functions/get-block-properties.js +29 -19
- package/src/functions/get-builder-search-params/index.js +5 -10
- package/src/functions/get-content/generate-content-url.js +17 -19
- package/src/functions/get-content/index.js +43 -29
- package/src/functions/get-fetch.js +1 -3
- package/src/functions/get-global-this.js +1 -3
- package/src/functions/get-processed-block.js +12 -13
- package/src/functions/get-react-native-block-styles.js +11 -12
- package/src/functions/if-target.js +1 -3
- package/src/functions/is-browser.js +1 -3
- package/src/functions/is-editing.js +1 -3
- package/src/functions/is-iframe.js +1 -3
- package/src/functions/is-non-node-server.js +9 -0
- package/src/functions/is-previewing.js +1 -3
- package/src/functions/on-change.js +1 -4
- package/src/functions/register-component.js +34 -42
- package/src/functions/register.js +1 -3
- package/src/functions/sanitize-react-native-block-styles.js +22 -17
- package/src/functions/set-editor-settings.js +1 -3
- package/src/functions/set.js +1 -3
- package/src/functions/track/helpers.js +3 -5
- package/src/functions/track/index.js +45 -43
- package/src/functions/track/interaction.js +11 -7
- package/src/functions/transform-block-properties.js +1 -3
- package/src/functions/transform-block.js +1 -3
- package/src/helpers/ab-tests.js +45 -28
- package/src/helpers/canTrack.js +3 -5
- package/src/helpers/cookie.js +15 -24
- package/src/helpers/css.js +3 -7
- package/src/helpers/flatten.js +15 -18
- package/src/helpers/localStorage.js +1 -4
- package/src/helpers/logger.js +1 -3
- package/src/helpers/nullable.js +2 -4
- package/src/helpers/preview-lru-cache/get.js +8 -0
- package/src/helpers/preview-lru-cache/helpers.js +10 -0
- package/src/helpers/preview-lru-cache/init.js +10 -0
- package/src/helpers/preview-lru-cache/set.js +35 -0
- package/src/helpers/preview-lru-cache/types.js +0 -0
- package/src/helpers/sessionId.js +14 -11
- package/src/helpers/time.js +1 -3
- package/src/helpers/url.js +2 -4
- package/src/helpers/uuid.js +4 -6
- package/src/helpers/visitorId.js +8 -7
- package/src/index-helpers/blocks-exports.js +3 -14
- package/src/index-helpers/top-of-file.js +1 -3
- package/src/index.js +2 -17
- package/src/scripts/init-editing.js +62 -48
- package/src/types/api-version.js +1 -3
- package/src/types/builder-props.js +0 -0
- package/src/blocks/util.js +0 -8
- package/src/components/render-block/render-component.jsx +0 -40
- package/src/components/render-block/render-repeated-block.jsx +0 -16
- package/src/components/render-blocks.jsx +0 -100
- package/src/components/render-content/builder-editing.jsx +0 -5
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/wrap-component-ref.js +0 -4
- package/src/functions/evaluate.test.js +0 -17
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-content/generate-content-url.test.js +0 -97
- package/src/functions/get-processed-block.test.js +0 -34
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/set.test.js +0 -16
- package/src/helpers/url.test.js +0 -21
- /package/src/components/{render-block → block}/types.js +0 -0
- /package/src/components/{render-content/render-content.types.js → content/content.types.js} +0 -0
- /package/src/components/{render-content-variants/render-content-variants.types.js → content-variants/content-variants.types.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### 0.5.1
|
|
2
|
+
|
|
3
|
+
- Fix: make `RenderBlocks` properties `context` and `registeredComponents` optional for external use.
|
|
4
|
+
|
|
5
|
+
### 0.5.0
|
|
6
|
+
|
|
7
|
+
- Feature: Added support for rudimentary data-bindings in Non-Node.js (edge, serverless, etc.) server runtimes.
|
|
8
|
+
|
|
1
9
|
### 0.4.5
|
|
2
10
|
|
|
3
11
|
- Fix: show dynamic symbols correctly in Preview mode.
|
package/package.json
CHANGED
package/src/blocks/BaseText.jsx
CHANGED
|
@@ -2,22 +2,23 @@ import { Show } from "solid-js";
|
|
|
2
2
|
|
|
3
3
|
import { css } from "solid-styled-components";
|
|
4
4
|
|
|
5
|
+
import { filterAttrs } from "../helpers.js";
|
|
6
|
+
|
|
5
7
|
function Button(props) {
|
|
6
8
|
return (
|
|
7
9
|
<Show
|
|
8
10
|
fallback={
|
|
9
11
|
<button
|
|
10
12
|
class={
|
|
11
|
-
/**
|
|
12
|
-
* We have to explicitly provide `class` so that Mitosis knows to merge it with `css`.
|
|
13
|
-
*/
|
|
14
13
|
props.attributes.class +
|
|
15
14
|
" " +
|
|
16
15
|
css({
|
|
17
16
|
all: "unset",
|
|
18
17
|
})
|
|
19
18
|
}
|
|
19
|
+
{...{}}
|
|
20
20
|
{...props.attributes}
|
|
21
|
+
style={props.attributes.style}
|
|
21
22
|
>
|
|
22
23
|
{props.text}
|
|
23
24
|
</button>
|
|
@@ -26,6 +27,7 @@ function Button(props) {
|
|
|
26
27
|
>
|
|
27
28
|
<a
|
|
28
29
|
role="button"
|
|
30
|
+
{...{}}
|
|
29
31
|
{...props.attributes}
|
|
30
32
|
href={props.link}
|
|
31
33
|
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
@@ -13,28 +13,22 @@ const componentInfo = {
|
|
|
13
13
|
textAlign: "center",
|
|
14
14
|
cursor: "pointer"
|
|
15
15
|
},
|
|
16
|
-
inputs: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
defaultValue: false,
|
|
32
|
-
friendlyName: "Open link in new tab"
|
|
33
|
-
}
|
|
34
|
-
],
|
|
16
|
+
inputs: [{
|
|
17
|
+
name: "text",
|
|
18
|
+
type: "text",
|
|
19
|
+
defaultValue: "Click me!",
|
|
20
|
+
bubble: true
|
|
21
|
+
}, {
|
|
22
|
+
name: "link",
|
|
23
|
+
type: "url",
|
|
24
|
+
bubble: true
|
|
25
|
+
}, {
|
|
26
|
+
name: "openLinkInNewTab",
|
|
27
|
+
type: "boolean",
|
|
28
|
+
defaultValue: false,
|
|
29
|
+
friendlyName: "Open link in new tab"
|
|
30
|
+
}],
|
|
35
31
|
static: true,
|
|
36
32
|
noWrap: true
|
|
37
33
|
};
|
|
38
|
-
export {
|
|
39
|
-
componentInfo
|
|
40
|
-
};
|
|
34
|
+
export { componentInfo }
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Show, For, createSignal } from "solid-js";
|
|
2
2
|
|
|
3
3
|
import { css } from "solid-styled-components";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
5
|
+
import Blocks from "../../components/blocks/blocks.jsx";
|
|
6
|
+
import { getSizesForBreakpoints } from "../../constants/device-sizes.js";
|
|
7
7
|
import InlinedStyles from "../../components/inlined-styles.jsx";
|
|
8
8
|
import { TARGET } from "../../constants/target.js";
|
|
9
|
-
import BuilderContext from "../../context/builder.context.js";
|
|
10
9
|
|
|
11
10
|
function Columns(props) {
|
|
12
11
|
const [gutterSize, setGutterSize] = createSignal(
|
|
@@ -43,11 +42,6 @@ function Columns(props) {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
function columnsCssVars() {
|
|
46
|
-
if (TARGET === "reactNative") {
|
|
47
|
-
return {
|
|
48
|
-
flexDirection: flexDir(),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
45
|
return {
|
|
52
46
|
"--flex-dir": flexDir(),
|
|
53
47
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -68,9 +62,10 @@ function Columns(props) {
|
|
|
68
62
|
const gutterPixels = `${gutter}px`;
|
|
69
63
|
const mobileWidth = "100%";
|
|
70
64
|
const mobileMarginLeft = 0;
|
|
65
|
+
const marginLeftKey = "margin-left";
|
|
71
66
|
return {
|
|
72
67
|
width,
|
|
73
|
-
|
|
68
|
+
[marginLeftKey]: gutterPixels,
|
|
74
69
|
"--column-width-mobile": getMobileStyle({
|
|
75
70
|
stackedStyle: mobileWidth,
|
|
76
71
|
desktopStyle: width,
|
|
@@ -92,7 +87,7 @@ function Columns(props) {
|
|
|
92
87
|
|
|
93
88
|
function getWidthForBreakpointSize(size) {
|
|
94
89
|
const breakpointSizes = getSizesForBreakpoints(
|
|
95
|
-
builderContext.content?.meta?.breakpoints || {}
|
|
90
|
+
props.builderContext.content?.meta?.breakpoints || {}
|
|
96
91
|
);
|
|
97
92
|
return breakpointSizes[size].max;
|
|
98
93
|
}
|
|
@@ -125,8 +120,6 @@ function Columns(props) {
|
|
|
125
120
|
`;
|
|
126
121
|
}
|
|
127
122
|
|
|
128
|
-
const builderContext = useContext(BuilderContext);
|
|
129
|
-
|
|
130
123
|
return (
|
|
131
124
|
<div
|
|
132
125
|
class={
|
|
@@ -138,9 +131,7 @@ function Columns(props) {
|
|
|
138
131
|
})
|
|
139
132
|
}
|
|
140
133
|
style={columnsCssVars()}
|
|
141
|
-
|
|
142
|
-
"builder-block-name": "builder-columns",
|
|
143
|
-
}}
|
|
134
|
+
{...{}}
|
|
144
135
|
>
|
|
145
136
|
<Show when={TARGET !== "reactNative"}>
|
|
146
137
|
<InlinedStyles styles={columnsStyles()}></InlinedStyles>
|
|
@@ -159,19 +150,19 @@ function Columns(props) {
|
|
|
159
150
|
})
|
|
160
151
|
}
|
|
161
152
|
style={columnCssVars(index)}
|
|
162
|
-
|
|
163
|
-
"builder-block-name": "builder-column",
|
|
164
|
-
}}
|
|
153
|
+
{...{}}
|
|
165
154
|
key={index}
|
|
166
155
|
>
|
|
167
|
-
<
|
|
156
|
+
<Blocks
|
|
168
157
|
blocks={column.blocks}
|
|
169
158
|
path={`component.options.columns.${index}.blocks`}
|
|
170
159
|
parent={props.builderBlock.id}
|
|
171
160
|
styleProp={{
|
|
172
161
|
flexGrow: "1",
|
|
173
162
|
}}
|
|
174
|
-
|
|
163
|
+
context={props.builderContext}
|
|
164
|
+
registeredComponents={props.builderComponents}
|
|
165
|
+
></Blocks>
|
|
175
166
|
</div>
|
|
176
167
|
);
|
|
177
168
|
}}
|
|
@@ -1,241 +1,218 @@
|
|
|
1
|
-
import { serializeFn } from "../util.js";
|
|
2
1
|
const componentInfo = {
|
|
3
2
|
name: "Columns",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
isRSC: true,
|
|
4
|
+
inputs: [{
|
|
5
|
+
name: "columns",
|
|
6
|
+
type: "array",
|
|
7
|
+
broadcast: true,
|
|
8
|
+
subFields: [{
|
|
9
|
+
name: "blocks",
|
|
7
10
|
type: "array",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
]
|
|
11
|
+
hideFromUI: true,
|
|
12
|
+
defaultValue: [{
|
|
13
|
+
"@type": "@builder.io/sdk:Element",
|
|
14
|
+
responsiveStyles: {
|
|
15
|
+
large: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
alignItems: "stretch",
|
|
19
|
+
flexShrink: "0",
|
|
20
|
+
position: "relative",
|
|
21
|
+
marginTop: "30px",
|
|
22
|
+
textAlign: "center",
|
|
23
|
+
lineHeight: "normal",
|
|
24
|
+
height: "auto",
|
|
25
|
+
minHeight: "20px",
|
|
26
|
+
minWidth: "20px",
|
|
27
|
+
overflow: "hidden"
|
|
28
|
+
}
|
|
66
29
|
},
|
|
67
|
-
{
|
|
68
|
-
name: "
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
30
|
+
component: {
|
|
31
|
+
name: "Image",
|
|
32
|
+
options: {
|
|
33
|
+
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
34
|
+
backgroundPosition: "center",
|
|
35
|
+
backgroundSize: "cover",
|
|
36
|
+
aspectRatio: 0.7004048582995948
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
"@type": "@builder.io/sdk:Element",
|
|
41
|
+
responsiveStyles: {
|
|
42
|
+
large: {
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
alignItems: "stretch",
|
|
46
|
+
flexShrink: "0",
|
|
47
|
+
position: "relative",
|
|
48
|
+
marginTop: "30px",
|
|
49
|
+
textAlign: "center",
|
|
50
|
+
lineHeight: "normal",
|
|
51
|
+
height: "auto"
|
|
52
|
+
}
|
|
72
53
|
},
|
|
73
|
-
{
|
|
74
|
-
name: "
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
component: {
|
|
55
|
+
name: "Text",
|
|
56
|
+
options: {
|
|
57
|
+
text: "<p>Enter some text...</p>"
|
|
58
|
+
}
|
|
77
59
|
}
|
|
78
|
-
]
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
]
|
|
60
|
+
}]
|
|
61
|
+
}, {
|
|
62
|
+
name: "width",
|
|
63
|
+
type: "number",
|
|
64
|
+
hideFromUI: true,
|
|
65
|
+
helperText: "Width %, e.g. set to 50 to fill half of the space"
|
|
66
|
+
}, {
|
|
67
|
+
name: "link",
|
|
68
|
+
type: "url",
|
|
69
|
+
helperText: "Optionally set a url that clicking this column will link to"
|
|
70
|
+
}],
|
|
71
|
+
defaultValue: [{
|
|
72
|
+
blocks: [{
|
|
73
|
+
"@type": "@builder.io/sdk:Element",
|
|
74
|
+
responsiveStyles: {
|
|
75
|
+
large: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
alignItems: "stretch",
|
|
79
|
+
flexShrink: "0",
|
|
80
|
+
position: "relative",
|
|
81
|
+
marginTop: "30px",
|
|
82
|
+
textAlign: "center",
|
|
83
|
+
lineHeight: "normal",
|
|
84
|
+
height: "auto",
|
|
85
|
+
minHeight: "20px",
|
|
86
|
+
minWidth: "20px",
|
|
87
|
+
overflow: "hidden"
|
|
88
|
+
}
|
|
133
89
|
},
|
|
134
|
-
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
90
|
+
component: {
|
|
91
|
+
name: "Image",
|
|
92
|
+
options: {
|
|
93
|
+
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
94
|
+
backgroundPosition: "center",
|
|
95
|
+
backgroundSize: "cover",
|
|
96
|
+
aspectRatio: 0.7004048582995948
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
"@type": "@builder.io/sdk:Element",
|
|
101
|
+
responsiveStyles: {
|
|
102
|
+
large: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
flexDirection: "column",
|
|
105
|
+
alignItems: "stretch",
|
|
106
|
+
flexShrink: "0",
|
|
107
|
+
position: "relative",
|
|
108
|
+
marginTop: "30px",
|
|
109
|
+
textAlign: "center",
|
|
110
|
+
lineHeight: "normal",
|
|
111
|
+
height: "auto"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
component: {
|
|
115
|
+
name: "Text",
|
|
116
|
+
options: {
|
|
117
|
+
text: "<p>Enter some text...</p>"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}]
|
|
121
|
+
}, {
|
|
122
|
+
blocks: [{
|
|
123
|
+
"@type": "@builder.io/sdk:Element",
|
|
124
|
+
responsiveStyles: {
|
|
125
|
+
large: {
|
|
126
|
+
display: "flex",
|
|
127
|
+
flexDirection: "column",
|
|
128
|
+
alignItems: "stretch",
|
|
129
|
+
flexShrink: "0",
|
|
130
|
+
position: "relative",
|
|
131
|
+
marginTop: "30px",
|
|
132
|
+
textAlign: "center",
|
|
133
|
+
lineHeight: "normal",
|
|
134
|
+
height: "auto",
|
|
135
|
+
minHeight: "20px",
|
|
136
|
+
minWidth: "20px",
|
|
137
|
+
overflow: "hidden"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
component: {
|
|
141
|
+
name: "Image",
|
|
142
|
+
options: {
|
|
143
|
+
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
144
|
+
backgroundPosition: "center",
|
|
145
|
+
backgroundSize: "cover",
|
|
146
|
+
aspectRatio: 0.7004048582995948
|
|
147
|
+
}
|
|
187
148
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
149
|
+
}, {
|
|
150
|
+
"@type": "@builder.io/sdk:Element",
|
|
151
|
+
responsiveStyles: {
|
|
152
|
+
large: {
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "column",
|
|
155
|
+
alignItems: "stretch",
|
|
156
|
+
flexShrink: "0",
|
|
157
|
+
position: "relative",
|
|
158
|
+
marginTop: "30px",
|
|
159
|
+
textAlign: "center",
|
|
160
|
+
lineHeight: "normal",
|
|
161
|
+
height: "auto"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
component: {
|
|
165
|
+
name: "Text",
|
|
166
|
+
options: {
|
|
167
|
+
text: "<p>Enter some text...</p>"
|
|
168
|
+
}
|
|
194
169
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
170
|
+
}]
|
|
171
|
+
}],
|
|
172
|
+
onChange: options => {
|
|
173
|
+
function clearWidths() {
|
|
174
|
+
columns.forEach(col => {
|
|
175
|
+
col.delete("width");
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const columns = options.get("columns");
|
|
179
|
+
if (Array.isArray(columns)) {
|
|
180
|
+
const containsColumnWithWidth = !!columns.find(col => col.get("width"));
|
|
181
|
+
if (containsColumnWithWidth) {
|
|
182
|
+
const containsColumnWithoutWidth = !!columns.find(col => !col.get("width"));
|
|
183
|
+
if (containsColumnWithoutWidth) {
|
|
184
|
+
clearWidths();
|
|
185
|
+
} else {
|
|
186
|
+
const sumWidths = columns.reduce((memo, col) => {
|
|
187
|
+
return memo + col.get("width");
|
|
188
|
+
}, 0);
|
|
189
|
+
const widthsDontAddUp = sumWidths !== 100;
|
|
190
|
+
if (widthsDontAddUp) {
|
|
201
191
|
clearWidths();
|
|
202
|
-
} else {
|
|
203
|
-
const sumWidths = columns.reduce((memo, col) => {
|
|
204
|
-
return memo + col.get("width");
|
|
205
|
-
}, 0);
|
|
206
|
-
const widthsDontAddUp = sumWidths !== 100;
|
|
207
|
-
if (widthsDontAddUp) {
|
|
208
|
-
clearWidths();
|
|
209
|
-
}
|
|
210
192
|
}
|
|
211
193
|
}
|
|
212
194
|
}
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: "space",
|
|
217
|
-
type: "number",
|
|
218
|
-
defaultValue: 20,
|
|
219
|
-
helperText: "Size of gap between columns",
|
|
220
|
-
advanced: true
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: "stackColumnsAt",
|
|
224
|
-
type: "string",
|
|
225
|
-
defaultValue: "tablet",
|
|
226
|
-
helperText: "Convert horizontal columns to vertical at what device size",
|
|
227
|
-
enum: ["tablet", "mobile", "never"],
|
|
228
|
-
advanced: true
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: "reverseColumnsWhenStacked",
|
|
232
|
-
type: "boolean",
|
|
233
|
-
defaultValue: false,
|
|
234
|
-
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
235
|
-
advanced: true
|
|
195
|
+
}
|
|
236
196
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
197
|
+
}, {
|
|
198
|
+
name: "space",
|
|
199
|
+
type: "number",
|
|
200
|
+
defaultValue: 20,
|
|
201
|
+
helperText: "Size of gap between columns",
|
|
202
|
+
advanced: true
|
|
203
|
+
}, {
|
|
204
|
+
name: "stackColumnsAt",
|
|
205
|
+
type: "string",
|
|
206
|
+
defaultValue: "tablet",
|
|
207
|
+
helperText: "Convert horizontal columns to vertical at what device size",
|
|
208
|
+
enum: ["tablet", "mobile", "never"],
|
|
209
|
+
advanced: true
|
|
210
|
+
}, {
|
|
211
|
+
name: "reverseColumnsWhenStacked",
|
|
212
|
+
type: "boolean",
|
|
213
|
+
defaultValue: false,
|
|
214
|
+
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
215
|
+
advanced: true
|
|
216
|
+
}]
|
|
241
217
|
};
|
|
218
|
+
export { componentInfo }
|