@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
|
@@ -1,60 +1,34 @@
|
|
|
1
1
|
const componentInfo = {
|
|
2
2
|
name: "Form:Input",
|
|
3
3
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
4
|
-
inputs: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: "string",
|
|
33
|
-
required: true,
|
|
34
|
-
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "placeholder",
|
|
38
|
-
type: "string",
|
|
39
|
-
defaultValue: "Hello there",
|
|
40
|
-
helperText: "Text to display when there is no value"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "defaultValue",
|
|
44
|
-
type: "string"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "value",
|
|
48
|
-
type: "string",
|
|
49
|
-
advanced: true
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "required",
|
|
53
|
-
type: "boolean",
|
|
54
|
-
helperText: "Is this input required to be filled out to submit a form",
|
|
55
|
-
defaultValue: false
|
|
56
|
-
}
|
|
57
|
-
],
|
|
4
|
+
inputs: [{
|
|
5
|
+
name: "type",
|
|
6
|
+
type: "text",
|
|
7
|
+
enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
|
|
8
|
+
defaultValue: "text"
|
|
9
|
+
}, {
|
|
10
|
+
name: "name",
|
|
11
|
+
type: "string",
|
|
12
|
+
required: true,
|
|
13
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
14
|
+
}, {
|
|
15
|
+
name: "placeholder",
|
|
16
|
+
type: "string",
|
|
17
|
+
defaultValue: "Hello there",
|
|
18
|
+
helperText: "Text to display when there is no value"
|
|
19
|
+
}, {
|
|
20
|
+
name: "defaultValue",
|
|
21
|
+
type: "string"
|
|
22
|
+
}, {
|
|
23
|
+
name: "value",
|
|
24
|
+
type: "string",
|
|
25
|
+
advanced: true
|
|
26
|
+
}, {
|
|
27
|
+
name: "required",
|
|
28
|
+
type: "boolean",
|
|
29
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
30
|
+
defaultValue: false
|
|
31
|
+
}],
|
|
58
32
|
noWrap: true,
|
|
59
33
|
static: true,
|
|
60
34
|
defaultStyles: {
|
|
@@ -68,6 +42,4 @@ const componentInfo = {
|
|
|
68
42
|
borderColor: "#ccc"
|
|
69
43
|
}
|
|
70
44
|
};
|
|
71
|
-
export {
|
|
72
|
-
componentInfo
|
|
73
|
-
};
|
|
45
|
+
export { componentInfo }
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isEditing } from "../../functions/is-editing.js";
|
|
2
|
+
import { filterAttrs } from "../helpers.js";
|
|
2
3
|
|
|
3
4
|
function FormInputComponent(props) {
|
|
4
5
|
return (
|
|
5
6
|
<input
|
|
7
|
+
{...{}}
|
|
6
8
|
{...props.attributes}
|
|
7
9
|
key={
|
|
8
10
|
isEditing() && props.defaultValue ? props.defaultValue : "default-key"
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
const componentInfo = {
|
|
2
2
|
name: "Builder:RawText",
|
|
3
3
|
hideFromInsertMenu: true,
|
|
4
|
-
inputs: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
componentInfo
|
|
4
|
+
inputs: [{
|
|
5
|
+
name: "text",
|
|
6
|
+
bubble: true,
|
|
7
|
+
type: "longText",
|
|
8
|
+
required: true
|
|
9
|
+
}]
|
|
15
10
|
};
|
|
11
|
+
export { componentInfo }
|
|
@@ -2,20 +2,17 @@ const componentInfo = {
|
|
|
2
2
|
name: "Core:Section",
|
|
3
3
|
static: true,
|
|
4
4
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
5
|
-
inputs: [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
description: "Only render this section when in view"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
5
|
+
inputs: [{
|
|
6
|
+
name: "maxWidth",
|
|
7
|
+
type: "number",
|
|
8
|
+
defaultValue: 1200
|
|
9
|
+
}, {
|
|
10
|
+
name: "lazyLoad",
|
|
11
|
+
type: "boolean",
|
|
12
|
+
defaultValue: false,
|
|
13
|
+
advanced: true,
|
|
14
|
+
description: "Only render this section when in view"
|
|
15
|
+
}],
|
|
19
16
|
defaultStyles: {
|
|
20
17
|
paddingLeft: "20px",
|
|
21
18
|
paddingRight: "20px",
|
|
@@ -26,23 +23,19 @@ const componentInfo = {
|
|
|
26
23
|
marginLeft: "calc(50% - 50vw)"
|
|
27
24
|
},
|
|
28
25
|
canHaveChildren: true,
|
|
29
|
-
defaultChildren: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
|
|
41
|
-
}
|
|
26
|
+
defaultChildren: [{
|
|
27
|
+
"@type": "@builder.io/sdk:Element",
|
|
28
|
+
responsiveStyles: {
|
|
29
|
+
large: {
|
|
30
|
+
textAlign: "center"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
component: {
|
|
34
|
+
name: "Text",
|
|
35
|
+
options: {
|
|
36
|
+
text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
]
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
componentInfo
|
|
39
|
+
}]
|
|
48
40
|
};
|
|
41
|
+
export { componentInfo }
|
|
@@ -4,55 +4,41 @@ const componentInfo = {
|
|
|
4
4
|
defaultStyles: {
|
|
5
5
|
alignSelf: "flex-start"
|
|
6
6
|
},
|
|
7
|
-
inputs: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
subFields: [
|
|
13
|
-
{
|
|
14
|
-
name: "value",
|
|
15
|
-
type: "text",
|
|
16
|
-
required: true
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "name",
|
|
20
|
-
type: "text"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
defaultValue: [
|
|
24
|
-
{
|
|
25
|
-
value: "option 1"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
value: "option 2"
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "name",
|
|
34
|
-
type: "string",
|
|
35
|
-
required: true,
|
|
36
|
-
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "defaultValue",
|
|
40
|
-
type: "string"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
7
|
+
inputs: [{
|
|
8
|
+
name: "options",
|
|
9
|
+
type: "list",
|
|
10
|
+
required: true,
|
|
11
|
+
subFields: [{
|
|
43
12
|
name: "value",
|
|
44
|
-
type: "
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
13
|
+
type: "text",
|
|
14
|
+
required: true
|
|
15
|
+
}, {
|
|
16
|
+
name: "name",
|
|
17
|
+
type: "text"
|
|
18
|
+
}],
|
|
19
|
+
defaultValue: [{
|
|
20
|
+
value: "option 1"
|
|
21
|
+
}, {
|
|
22
|
+
value: "option 2"
|
|
23
|
+
}]
|
|
24
|
+
}, {
|
|
25
|
+
name: "name",
|
|
26
|
+
type: "string",
|
|
27
|
+
required: true,
|
|
28
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
29
|
+
}, {
|
|
30
|
+
name: "defaultValue",
|
|
31
|
+
type: "string"
|
|
32
|
+
}, {
|
|
33
|
+
name: "value",
|
|
34
|
+
type: "string",
|
|
35
|
+
advanced: true
|
|
36
|
+
}, {
|
|
37
|
+
name: "required",
|
|
38
|
+
type: "boolean",
|
|
39
|
+
defaultValue: false
|
|
40
|
+
}],
|
|
53
41
|
static: true,
|
|
54
42
|
noWrap: true
|
|
55
43
|
};
|
|
56
|
-
export {
|
|
57
|
-
componentInfo
|
|
58
|
-
};
|
|
44
|
+
export { componentInfo }
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { For } from "solid-js";
|
|
2
2
|
|
|
3
3
|
import { isEditing } from "../../functions/is-editing.js";
|
|
4
|
+
import { filterAttrs } from "../helpers.js";
|
|
4
5
|
|
|
5
6
|
function SelectComponent(props) {
|
|
6
7
|
return (
|
|
7
8
|
<select
|
|
9
|
+
{...{}}
|
|
8
10
|
{...props.attributes}
|
|
9
11
|
value={props.value}
|
|
10
12
|
key={
|
|
@@ -12,16 +12,12 @@ const componentInfo = {
|
|
|
12
12
|
borderRadius: "4px",
|
|
13
13
|
cursor: "pointer"
|
|
14
14
|
},
|
|
15
|
-
inputs: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
],
|
|
15
|
+
inputs: [{
|
|
16
|
+
name: "text",
|
|
17
|
+
type: "text",
|
|
18
|
+
defaultValue: "Click me"
|
|
19
|
+
}],
|
|
22
20
|
static: true,
|
|
23
21
|
noWrap: true
|
|
24
22
|
};
|
|
25
|
-
export {
|
|
26
|
-
componentInfo
|
|
27
|
-
};
|
|
23
|
+
export { componentInfo }
|
|
@@ -2,41 +2,34 @@ const componentInfo = {
|
|
|
2
2
|
name: "Symbol",
|
|
3
3
|
noWrap: true,
|
|
4
4
|
static: true,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
name: "useChildren",
|
|
35
|
-
hideFromUI: true,
|
|
36
|
-
type: "boolean"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
41
|
-
componentInfo
|
|
5
|
+
isRSC: true,
|
|
6
|
+
inputs: [{
|
|
7
|
+
name: "symbol",
|
|
8
|
+
type: "uiSymbol"
|
|
9
|
+
}, {
|
|
10
|
+
name: "dataOnly",
|
|
11
|
+
helperText: "Make this a data symbol that doesn't display any UI",
|
|
12
|
+
type: "boolean",
|
|
13
|
+
defaultValue: false,
|
|
14
|
+
advanced: true,
|
|
15
|
+
hideFromUI: true
|
|
16
|
+
}, {
|
|
17
|
+
name: "inheritState",
|
|
18
|
+
helperText: "Inherit the parent component state and data",
|
|
19
|
+
type: "boolean",
|
|
20
|
+
defaultValue: false,
|
|
21
|
+
advanced: true
|
|
22
|
+
}, {
|
|
23
|
+
name: "renderToLiquid",
|
|
24
|
+
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
25
|
+
type: "boolean",
|
|
26
|
+
defaultValue: false,
|
|
27
|
+
advanced: true,
|
|
28
|
+
hideFromUI: true
|
|
29
|
+
}, {
|
|
30
|
+
name: "useChildren",
|
|
31
|
+
hideFromUI: true,
|
|
32
|
+
type: "boolean"
|
|
33
|
+
}]
|
|
42
34
|
};
|
|
35
|
+
export { componentInfo }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value
|
|
10
|
+
}) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
18
|
+
var __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = value => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = value => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
import { getContent } from "../../functions/get-content/index.js";
|
|
39
|
+
import { logger } from "../../helpers/logger.js";
|
|
40
|
+
const fetchContent = _0 => __async(void 0, [_0], function* ({
|
|
41
|
+
builderContextValue,
|
|
42
|
+
symbol
|
|
43
|
+
}) {
|
|
44
|
+
if ((symbol == null ? void 0 : symbol.model) && (builderContextValue == null ? void 0 : builderContextValue.apiKey)) {
|
|
45
|
+
return getContent(__spreadValues({
|
|
46
|
+
model: symbol.model,
|
|
47
|
+
apiKey: builderContextValue.apiKey,
|
|
48
|
+
apiVersion: builderContextValue.apiVersion
|
|
49
|
+
}, (symbol == null ? void 0 : symbol.entry) && {
|
|
50
|
+
query: {
|
|
51
|
+
id: symbol.entry
|
|
52
|
+
}
|
|
53
|
+
})).catch(err => {
|
|
54
|
+
logger.error("Could not fetch symbol content: ", err);
|
|
55
|
+
return void 0;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return void 0;
|
|
59
|
+
});
|
|
60
|
+
export { fetchContent }
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onMount, on, createEffect, createSignal } from "solid-js";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { TARGET } from "../../constants/target";
|
|
7
|
-
import { logger } from "../../helpers/logger";
|
|
3
|
+
import ContentVariants from "../../components/content-variants/content-variants.jsx";
|
|
4
|
+
import { filterAttrs } from "../helpers.js";
|
|
5
|
+
import { fetchContent } from "./symbol.helpers.js";
|
|
8
6
|
|
|
9
7
|
function Symbol(props) {
|
|
10
|
-
const [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
9
|
+
|
|
10
|
+
function className() {
|
|
11
|
+
return [
|
|
12
|
+
...[props.attributes.class],
|
|
15
13
|
"builder-symbol",
|
|
16
14
|
props.symbol?.inline ? "builder-inline-symbol" : undefined,
|
|
17
15
|
props.symbol?.dynamic || props.dynamic
|
|
@@ -19,81 +17,46 @@ function Symbol(props) {
|
|
|
19
17
|
: undefined,
|
|
20
18
|
]
|
|
21
19
|
.filter(Boolean)
|
|
22
|
-
.join(" ")
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
26
|
-
|
|
27
|
-
function fetchContent() {
|
|
28
|
-
/**
|
|
29
|
-
* If:
|
|
30
|
-
* - we have a symbol prop
|
|
31
|
-
* - yet it does not have any content
|
|
32
|
-
* - and we have not already stored content from before
|
|
33
|
-
* - and it has a model name
|
|
34
|
-
*
|
|
35
|
-
* then we want to re-fetch the symbol content.
|
|
36
|
-
*/
|
|
37
|
-
if (
|
|
38
|
-
!contentToUse() &&
|
|
39
|
-
props.symbol?.model &&
|
|
40
|
-
// This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
41
|
-
builderContext?.apiKey
|
|
42
|
-
) {
|
|
43
|
-
getContent({
|
|
44
|
-
model: props.symbol.model,
|
|
45
|
-
apiKey: builderContext.apiKey,
|
|
46
|
-
apiVersion: builderContext.apiVersion,
|
|
47
|
-
...(props.symbol?.entry && {
|
|
48
|
-
query: {
|
|
49
|
-
id: props.symbol.entry,
|
|
50
|
-
},
|
|
51
|
-
}),
|
|
52
|
-
})
|
|
53
|
-
.then((response) => {
|
|
54
|
-
if (response) {
|
|
55
|
-
setContentToUse(response);
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
logger.error("Could not fetch symbol content: ", err);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
20
|
+
.join(" ");
|
|
62
21
|
}
|
|
63
22
|
|
|
64
|
-
|
|
23
|
+
function setContent() {
|
|
24
|
+
if (contentToUse()) return;
|
|
25
|
+
fetchContent({
|
|
26
|
+
symbol: props.symbol,
|
|
27
|
+
builderContextValue: props.builderContext,
|
|
28
|
+
}).then((newContent) => {
|
|
29
|
+
if (newContent) {
|
|
30
|
+
setContentToUse(newContent);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
65
34
|
|
|
66
35
|
onMount(() => {
|
|
67
|
-
|
|
36
|
+
setContent();
|
|
68
37
|
});
|
|
69
38
|
|
|
70
39
|
function onUpdateFn_0() {
|
|
71
|
-
|
|
40
|
+
setContent();
|
|
72
41
|
}
|
|
73
42
|
createEffect(on(() => [props.symbol], onUpdateFn_0));
|
|
74
43
|
|
|
75
44
|
return (
|
|
76
|
-
<div
|
|
77
|
-
|
|
78
|
-
{...props.attributes}
|
|
79
|
-
dataSet={{
|
|
80
|
-
class: className(),
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
<RenderContentVariants
|
|
45
|
+
<div class={className()} {...{}} {...props.attributes} {...{}}>
|
|
46
|
+
<ContentVariants
|
|
84
47
|
__isNestedRender={true}
|
|
85
|
-
apiVersion={builderContext.apiVersion}
|
|
86
|
-
apiKey={builderContext.apiKey}
|
|
87
|
-
context={builderContext.context}
|
|
88
|
-
customComponents={Object.values(
|
|
48
|
+
apiVersion={props.builderContext.apiVersion}
|
|
49
|
+
apiKey={props.builderContext.apiKey}
|
|
50
|
+
context={props.builderContext.context}
|
|
51
|
+
customComponents={Object.values(props.builderComponents)}
|
|
89
52
|
data={{
|
|
90
53
|
...props.symbol?.data,
|
|
91
|
-
...builderContext.localState,
|
|
54
|
+
...props.builderContext.localState,
|
|
92
55
|
...contentToUse()?.data?.state,
|
|
93
56
|
}}
|
|
94
57
|
model={props.symbol?.model}
|
|
95
58
|
content={contentToUse()}
|
|
96
|
-
></
|
|
59
|
+
></ContentVariants>
|
|
97
60
|
</div>
|
|
98
61
|
);
|
|
99
62
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
const componentInfo = {
|
|
2
2
|
name: "Text",
|
|
3
3
|
static: true,
|
|
4
|
+
isRSC: true,
|
|
4
5
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
5
|
-
inputs: [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
],
|
|
6
|
+
inputs: [{
|
|
7
|
+
name: "text",
|
|
8
|
+
type: "html",
|
|
9
|
+
required: true,
|
|
10
|
+
autoFocus: true,
|
|
11
|
+
bubble: true,
|
|
12
|
+
defaultValue: "Enter some text..."
|
|
13
|
+
}],
|
|
15
14
|
defaultStyles: {
|
|
16
15
|
lineHeight: "normal",
|
|
17
16
|
height: "auto",
|
|
18
17
|
textAlign: "center"
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
|
-
export {
|
|
22
|
-
componentInfo
|
|
23
|
-
};
|
|
20
|
+
export { componentInfo }
|