@builder.io/sdk-solid 0.0.7 → 0.0.8-0
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 +7 -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} +14 -13
- package/src/components/{render-block.lite.tsx → render-block/render-block.lite.tsx} +13 -10
- package/src/components/render-blocks.jsx +2 -2
- package/src/components/render-blocks.lite.tsx +2 -2
- 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 +19 -18
- package/src/components/render-content/render-content.lite.tsx +20 -19
- package/src/components/render-inlined-styles.jsx +23 -0
- package/src/components/render-inlined-styles.lite.tsx +26 -0
- package/src/functions/evaluate.js +2 -2
- package/src/functions/get-block-actions.js +2 -2
- package/src/functions/get-builder-search-params/fn.test.js +1 -1
- package/src/functions/get-content/index.js +3 -2
- package/src/functions/get-fetch.js +29 -7
- package/src/functions/get-processed-block.js +3 -3
- package/src/functions/get-processed-block.test.js +1 -1
- package/src/functions/if-target.js +1 -1
- package/src/functions/is-editing.js +1 -1
- package/src/functions/is-iframe.js +1 -1
- package/src/functions/is-previewing.js +2 -2
- package/src/functions/on-change.test.js +1 -1
- package/src/functions/previewing-model-name.js +1 -1
- package/src/functions/register-component.js +1 -1
- package/src/functions/register.js +1 -1
- package/src/functions/set-editor-settings.js +1 -1
- package/src/functions/set.test.js +1 -1
- package/src/functions/track.js +3 -3
- package/src/index-helpers/blocks-exports.js +8 -8
- package/src/index.js +10 -13
- package/src/scripts/init-editing.js +72 -63
- package/src/blocks/button.jsx +0 -8
- package/src/blocks/button.lite.tsx +0 -14
- package/src/blocks/columns.jsx +0 -96
- 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
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { createMutable } from "solid-js/store";
|
|
4
|
-
import { css } from "solid-styled-components";
|
|
5
|
-
|
|
6
|
-
function Image(props) {
|
|
7
|
-
const state = createMutable({
|
|
8
|
-
updateQueryParam: function updateQueryParam(uri = "", key, value) {
|
|
9
|
-
const re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
|
10
|
-
const separator = uri.indexOf("?") !== -1 ? "&" : "?";
|
|
11
|
-
|
|
12
|
-
if (uri.match(re)) {
|
|
13
|
-
return uri.replace(
|
|
14
|
-
re,
|
|
15
|
-
"$1" + key + "=" + encodeURIComponent(value) + "$2"
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return uri + separator + key + "=" + encodeURIComponent(value);
|
|
20
|
-
},
|
|
21
|
-
removeProtocol: function removeProtocol(path) {
|
|
22
|
-
return path.replace(/http(s)?:/, "");
|
|
23
|
-
},
|
|
24
|
-
getShopifyImageUrl: function getShopifyImageUrl(src, size) {
|
|
25
|
-
if (!src || !src?.match(/cdn\.shopify\.com/) || !size) {
|
|
26
|
-
return src;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (size === "master") {
|
|
30
|
-
return state.removeProtocol(src);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const match = src.match(
|
|
34
|
-
/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
if (match) {
|
|
38
|
-
const prefix = src.split(match[0]);
|
|
39
|
-
const suffix = match[3];
|
|
40
|
-
const useSize = size.match("x") ? size : `${size}x`;
|
|
41
|
-
return state.removeProtocol(`${prefix[0]}_${useSize}${suffix}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return null;
|
|
45
|
-
},
|
|
46
|
-
getSrcSet: function getSrcSet(url) {
|
|
47
|
-
if (!url) {
|
|
48
|
-
return url;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const sizes = [100, 200, 400, 800, 1200, 1600, 2000];
|
|
52
|
-
|
|
53
|
-
if (url.match(/builder\.io/)) {
|
|
54
|
-
let srcUrl = url;
|
|
55
|
-
const widthInSrc = Number(url.split("?width=")[1]);
|
|
56
|
-
|
|
57
|
-
if (!isNaN(widthInSrc)) {
|
|
58
|
-
srcUrl = `${srcUrl} ${widthInSrc}w`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return sizes
|
|
62
|
-
.filter((size) => size !== widthInSrc)
|
|
63
|
-
.map(
|
|
64
|
-
(size) => `${state.updateQueryParam(url, "width", size)} ${size}w`
|
|
65
|
-
)
|
|
66
|
-
.concat([srcUrl])
|
|
67
|
-
.join(", ");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (url.match(/cdn\.shopify\.com/)) {
|
|
71
|
-
return sizes
|
|
72
|
-
.map((size) => [
|
|
73
|
-
state.getShopifyImageUrl(url, `${size}x${size}`),
|
|
74
|
-
size,
|
|
75
|
-
])
|
|
76
|
-
.filter(([sizeUrl]) => !!sizeUrl)
|
|
77
|
-
.map(([sizeUrl, size]) => `${sizeUrl} ${size}w`)
|
|
78
|
-
.concat([url])
|
|
79
|
-
.join(", ");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return url;
|
|
83
|
-
},
|
|
84
|
-
useSrcSet: function useSrcSet() {
|
|
85
|
-
return props.srcset || state.getSrcSet(props.image) || "";
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div
|
|
91
|
-
class={css({
|
|
92
|
-
position: "relative",
|
|
93
|
-
})}
|
|
94
|
-
>
|
|
95
|
-
<picture>
|
|
96
|
-
<img
|
|
97
|
-
class={
|
|
98
|
-
"builder-image" +
|
|
99
|
-
(props.class ? " " + props.class : "") +
|
|
100
|
-
" " +
|
|
101
|
-
css({
|
|
102
|
-
opacity: "1",
|
|
103
|
-
transition: "opacity 0.2s ease-in-out",
|
|
104
|
-
position: "absolute",
|
|
105
|
-
height: "100%",
|
|
106
|
-
width: "100%",
|
|
107
|
-
top: "0px",
|
|
108
|
-
left: "0px",
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
loading="lazy"
|
|
112
|
-
alt={props.altText}
|
|
113
|
-
aria-role={props.altText ? "presentation" : undefined}
|
|
114
|
-
style={{
|
|
115
|
-
"object-position": props.backgroundSize || "center",
|
|
116
|
-
"object-fit": props.backgroundSize || "cover",
|
|
117
|
-
}}
|
|
118
|
-
src={props.image}
|
|
119
|
-
srcset={props.srcset || state.getSrcSet(props.image)}
|
|
120
|
-
sizes={props.sizes}
|
|
121
|
-
/>
|
|
122
|
-
<Show when={!props.noWebp && state.useSrcSet().includes("builder.io")}>
|
|
123
|
-
<source
|
|
124
|
-
type="image/webp"
|
|
125
|
-
srcSet={state.useSrcSet().replace(/\?/g, "?format=webp&")}
|
|
126
|
-
/>
|
|
127
|
-
</Show>
|
|
128
|
-
</picture>
|
|
129
|
-
<Show
|
|
130
|
-
when={
|
|
131
|
-
props.aspectRatio &&
|
|
132
|
-
!(props.fitContent && props.builderBlock?.children?.length)
|
|
133
|
-
}
|
|
134
|
-
>
|
|
135
|
-
<div
|
|
136
|
-
class={css({
|
|
137
|
-
width: "100%",
|
|
138
|
-
pointerEvents: "none",
|
|
139
|
-
fontSize: "0",
|
|
140
|
-
})}
|
|
141
|
-
style={{
|
|
142
|
-
"padding-top": props.aspectRatio * 100 + "%",
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
{" "}
|
|
146
|
-
</div>
|
|
147
|
-
</Show>
|
|
148
|
-
<Show when={props.builderBlock?.children?.length && props.fitContent}>
|
|
149
|
-
{props.children}
|
|
150
|
-
</Show>
|
|
151
|
-
<Show when={!props.fitContent}>
|
|
152
|
-
<div
|
|
153
|
-
class={css({
|
|
154
|
-
display: "flex",
|
|
155
|
-
flexDirection: "column",
|
|
156
|
-
alignItems: "stretch",
|
|
157
|
-
position: "absolute",
|
|
158
|
-
top: "0",
|
|
159
|
-
left: "0",
|
|
160
|
-
width: "100%",
|
|
161
|
-
height: "100%",
|
|
162
|
-
})}
|
|
163
|
-
>
|
|
164
|
-
{props.children}
|
|
165
|
-
</div>
|
|
166
|
-
</Show>
|
|
167
|
-
</div>
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export default Image;
|
package/src/blocks/img.jsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isEditing } from "../functions/is-editing";
|
|
2
|
-
|
|
3
|
-
function ImgComponent(props) {
|
|
4
|
-
return <img {...props.attributes} style={{
|
|
5
|
-
"object-fit": props.backgroundSize || "cover",
|
|
6
|
-
"object-position": props.backgroundPosition || "center"
|
|
7
|
-
}} key={isEditing() && props.imgSrc || "default-key"} alt={props.altText} src={props.imgSrc} />;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default ImgComponent;import { registerComponent } from '../functions/register-component';
|
|
11
|
-
registerComponent(ImgComponent, {name:'Raw:Img',hideFromInsertMenu:true,builtIn:true,image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',inputs:[{name:'image',bubble:true,type:'file',allowedFileTypes:['jpeg','jpg','png','svg'],required:true}],noWrap:true,static:true});
|
package/src/blocks/input.jsx
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { isEditing } from "../functions/is-editing";
|
|
2
|
-
|
|
3
|
-
function FormInputComponent(props) {
|
|
4
|
-
return <input {...props.attributes} key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"} placeholder={props.placeholder} type={props.type} name={props.name} value={props.value} defaultValue={props.defaultValue} required={props.required} />;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default FormInputComponent;import { registerComponent } from '../functions/register-component';
|
|
8
|
-
registerComponent(FormInputComponent, {name:'Form:Input',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',inputs:[{name:'type',type:'text',enum:['text','number','email','url','checkbox','radio','range','date','datetime-local','search','tel','time','file','month','week','password','color','hidden'],defaultValue:'text'},{name:'name',type:'string',required:true,helperText:'Every input in a form needs a unique name describing what it takes, e.g. "email"'},{name:'placeholder',type:'string',defaultValue:'Hello there',helperText:'Text to display when there is no value'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',helperText:'Is this input required to be filled out to submit a form',defaultValue:false}],noWrap:true,static:true,defaultStyles:{paddingTop:'10px',paddingBottom:'10px',paddingLeft:'10px',paddingRight:'10px',borderRadius:'3px',borderWidth:'1px',borderStyle:'solid',borderColor:'#ccc'}});
|
package/src/blocks/raw-text.jsx
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function RawText(props) {
|
|
2
|
-
return <span class={props.attributes?.class || props.attributes?.className} innerHTML={props.text || ""}></span>;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export default RawText;import { registerComponent } from '../functions/register-component';
|
|
6
|
-
registerComponent(RawText, {name:'Builder:RawText',hideFromInsertMenu:true,builtIn:true,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
|
package/src/blocks/section.jsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
function SectionComponent(props) {
|
|
2
|
-
return <section {...props.attributes} style={props.maxWidth && typeof props.maxWidth === "number" ? {
|
|
3
|
-
"max-width": props.maxWidth
|
|
4
|
-
} : undefined}>
|
|
5
|
-
{props.children}
|
|
6
|
-
</section>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default SectionComponent;import { registerComponent } from '../functions/register-component';
|
|
10
|
-
registerComponent(SectionComponent, {name:'Core:Section',static:true,builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a',inputs:[{name:'maxWidth',type:'number',defaultValue:1200},{name:'lazyLoad',type:'boolean',defaultValue:false,advanced:true,description:'Only render this section when in view'}],defaultStyles:{paddingLeft:'20px',paddingRight:'20px',paddingTop:'50px',paddingBottom:'50px',marginTop:'0px',width:'100vw',marginLeft:'calc(50% - 50vw)'},canHaveChildren:true,defaultChildren:[{'@type':'@builder.io/sdk:Element',responsiveStyles:{large:{textAlign:'center'}},component:{name:'Text',options:{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>"}}}]});
|
package/src/blocks/select.jsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { For } from "solid-js";
|
|
2
|
-
import { isEditing } from "../functions/is-editing";
|
|
3
|
-
|
|
4
|
-
function SelectComponent(props) {
|
|
5
|
-
return <select {...props.attributes} value={props.value} key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"} defaultValue={props.defaultValue} name={props.name}>
|
|
6
|
-
<For each={props.options}>
|
|
7
|
-
{(option, _index) => {
|
|
8
|
-
const index = _index();
|
|
9
|
-
|
|
10
|
-
return <option value={option.value}>{option.name || option.value}</option>;
|
|
11
|
-
}}
|
|
12
|
-
</For>
|
|
13
|
-
</select>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default SelectComponent;import { registerComponent } from '../functions/register-component';
|
|
17
|
-
registerComponent(SelectComponent, {name:'Form:Select',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',defaultStyles:{alignSelf:'flex-start'},inputs:[{name:'options',type:'list',required:true,subFields:[{name:'value',type:'text',required:true},{name:'name',type:'text'}],defaultValue:[{value:'option 1'},{value:'option 2'}]},{name:'name',type:'string',required:true,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',defaultValue:false}],static:true,noWrap:true});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
function SubmitButton(props) {
|
|
2
|
-
return <button {...props.attributes} type="submit">
|
|
3
|
-
{props.text}
|
|
4
|
-
</button>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default SubmitButton;import { registerComponent } from '../functions/register-component';
|
|
8
|
-
registerComponent(SubmitButton, {name:'Form:SubmitButton',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98',defaultStyles:{appearance:'none',paddingTop:'15px',paddingBottom:'15px',paddingLeft:'25px',paddingRight:'25px',backgroundColor:'#3898EC',color:'white',borderRadius:'4px',cursor:'pointer'},inputs:[{name:'text',type:'text',defaultValue:'Click me'}],static:true,noWrap:true});
|
package/src/blocks/symbol.jsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createMutable } from "solid-js/store";
|
|
2
|
-
import RenderContent from "../components/render-content/render-content";
|
|
3
|
-
import BuilderContext from "../context/builder.context";
|
|
4
|
-
|
|
5
|
-
function Symbol(props) {
|
|
6
|
-
const state = createMutable({
|
|
7
|
-
className: "builder-symbol",
|
|
8
|
-
content: null
|
|
9
|
-
});
|
|
10
|
-
const builderContext = useContext(BuilderContext);
|
|
11
|
-
onMount(() => {
|
|
12
|
-
state.content = props.symbol?.content;
|
|
13
|
-
});
|
|
14
|
-
return <div class={state.className} {...props.attributes} dataSet={{
|
|
15
|
-
class: state.className
|
|
16
|
-
}}>
|
|
17
|
-
<RenderContent apiKey={builderContext.apiKey} context={builderContext.context} data={{ ...props.symbol?.data,
|
|
18
|
-
...builderContext.state,
|
|
19
|
-
...props.symbol?.state.content?.data?.state
|
|
20
|
-
}} model={props.symbol?.model} content={state.content}></RenderContent>
|
|
21
|
-
</div>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default Symbol;import { registerComponent } from '../functions/register-component';
|
|
25
|
-
registerComponent(Symbol, {name:'Symbol',noWrap:true,static:true,inputs:[{name:'symbol',type:'uiSymbol'},{name:'dataOnly',helperText:"Make this a data symbol that doesn't display any UI",type:'boolean',defaultValue:false,advanced:true,hideFromUI:true},{name:'inheritState',helperText:'Inherit the parent component state and data',type:'boolean',defaultValue:false,advanced:true},{name:'renderToLiquid',helperText:'Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting',type:'boolean',defaultValue:false,advanced:true,hideFromUI:true},{name:'useChildren',hideFromUI:true,type:'boolean'}]});
|
package/src/blocks/text.jsx
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function Text(props) {
|
|
2
|
-
return <div innerHTML={props.text}></div>;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export default Text;import { registerComponent } from '../functions/register-component';
|
|
6
|
-
registerComponent(Text, {name:'Text',static:true,builtIn:true,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',inputs:[{name:'text',type:'html',required:true,autoFocus:true,bubble:true,defaultValue:'Enter some text...'}],defaultStyles:{lineHeight:'normal',height:'auto',textAlign:'center'}});
|
package/src/blocks/textarea.jsx
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function Textarea(props) {
|
|
2
|
-
return <textarea {...props.attributes} placeholder={props.placeholder} name={props.name} value={props.value} defaultValue={props.defaultValue}></textarea>;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export default Textarea;import { registerComponent } from '../functions/register-component';
|
|
6
|
-
registerComponent(Textarea, {name:'Form:TextArea',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3',inputs:[{advanced:true,name:'value',type:'string'},{name:'name',type:'string',required:true,helperText:'Every input in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'placeholder',type:'string',defaultValue:'Hello there'},{name:'required',type:'boolean',defaultValue:false}],defaultStyles:{paddingTop:'10px',paddingBottom:'10px',paddingLeft:'10px',paddingRight:'10px',borderRadius:'3px',borderWidth:'1px',borderStyle:'solid',borderColor:'#ccc'},static:true,noWrap:true});
|
package/src/blocks/video.jsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function Video(props) {
|
|
2
|
-
return <video {...props.attributes} preload="none" style={{
|
|
3
|
-
width: "100%",
|
|
4
|
-
height: "100%",
|
|
5
|
-
...props.attributes?.style,
|
|
6
|
-
"object-fit": props.fit,
|
|
7
|
-
"object-position": props.position,
|
|
8
|
-
// Hack to get object fit to work as expected and
|
|
9
|
-
// not have the video overflow
|
|
10
|
-
"border-radius": 1
|
|
11
|
-
}} key={props.video || "no-src"} poster={props.posterImage} autoPlay={props.autoPlay} muted={props.muted} controls={props.controls} loop={props.loop}></video>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default Video;import { registerComponent } from '../functions/register-component';
|
|
15
|
-
registerComponent(Video, {name:'Video',canHaveChildren:true,builtIn:true,defaultStyles:{minHeight:'20px',minWidth:'20px'},image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb',inputs:[{name:'video',type:'file',allowedFileTypes:['mp4'],bubble:true,defaultValue:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',required:true},{name:'posterImage',type:'file',allowedFileTypes:['jpeg','png'],helperText:'Image to show before the video plays'},{name:'autoPlay',type:'boolean',defaultValue:true},{name:'controls',type:'boolean',defaultValue:false},{name:'muted',type:'boolean',defaultValue:true},{name:'loop',type:'boolean',defaultValue:true},{name:'playsInline',type:'boolean',defaultValue:true},{name:'fit',type:'text',defaultValue:'cover',enum:['contain','cover','fill','auto']},{name:'fitContent',type:'boolean',helperText:'When child blocks are provided, fit to them instead of using the aspect ratio',defaultValue:true,advanced:true},{name:'position',type:'text',defaultValue:'center',enum:['center','top','left','right','bottom','top left','top right','bottom left','bottom right']},{name:'height',type:'number',advanced:true},{name:'width',type:'number',advanced:true},{name:'aspectRatio',type:'number',advanced:true,defaultValue:0.7004048582995948},{name:'lazyLoad',type:'boolean',helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:true,advanced:true}]});
|