@builder.io/sdk-solid 0.0.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/README.md +3 -0
- package/package.json +9 -0
- package/src/blocks/button.js +41 -0
- package/src/blocks/button.lite.tsx +18 -0
- package/src/blocks/columns.js +133 -0
- package/src/blocks/columns.lite.tsx +96 -0
- package/src/blocks/custom-code.js +72 -0
- package/src/blocks/custom-code.lite.tsx +65 -0
- package/src/blocks/embed.js +62 -0
- package/src/blocks/embed.lite.tsx +57 -0
- package/src/blocks/form.js +355 -0
- package/src/blocks/form.lite.tsx +291 -0
- package/src/blocks/fragment.js +15 -0
- package/src/blocks/fragment.lite.tsx +3 -0
- package/src/blocks/image.js +136 -0
- package/src/blocks/image.lite.tsx +81 -0
- package/src/blocks/img.js +39 -0
- package/src/blocks/img.lite.tsx +16 -0
- package/src/blocks/input.js +45 -0
- package/src/blocks/input.lite.tsx +18 -0
- package/src/blocks/raw-text.js +25 -0
- package/src/blocks/raw-text.lite.tsx +8 -0
- package/src/blocks/section.js +24 -0
- package/src/blocks/section.lite.tsx +16 -0
- package/src/blocks/select.js +57 -0
- package/src/blocks/select.lite.tsx +23 -0
- package/src/blocks/submit-button.js +18 -0
- package/src/blocks/submit-button.lite.tsx +7 -0
- package/src/blocks/symbol.js +69 -0
- package/src/blocks/symbol.lite.tsx +37 -0
- package/src/blocks/text.js +15 -0
- package/src/blocks/text.lite.tsx +3 -0
- package/src/blocks/textarea.js +34 -0
- package/src/blocks/textarea.lite.tsx +11 -0
- package/src/blocks/video.js +54 -0
- package/src/blocks/video.lite.tsx +24 -0
- package/src/components/block-styles.js +3 -0
- package/src/components/block-styles.lite.tsx +3 -0
- package/src/components/error-boundary.js +3 -0
- package/src/components/error-boundary.lite.tsx +3 -0
- package/src/components/render-block.js +154 -0
- package/src/components/render-block.lite.tsx +108 -0
- package/src/components/render-blocks.js +104 -0
- package/src/components/render-blocks.lite.tsx +72 -0
- package/src/components/render-content.js +314 -0
- package/src/components/render-content.lite.tsx +289 -0
- package/src/constants/device-sizes.js +39 -0
- package/src/context/builder.context.js +10 -0
- package/src/functions/evaluate.js +28 -0
- package/src/functions/event-handler-name.js +7 -0
- package/src/functions/get-block-actions.js +23 -0
- package/src/functions/get-block-component-options.js +23 -0
- package/src/functions/get-block-properties.js +29 -0
- package/src/functions/get-block-styles.js +42 -0
- package/src/functions/get-block-tag.js +6 -0
- package/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/src/functions/get-builder-search-params/index.js +22 -0
- package/src/functions/get-content/fn.test.js +31 -0
- package/src/functions/get-content/index.js +137 -0
- package/src/functions/get-fetch.js +12 -0
- package/src/functions/get-global-this.js +18 -0
- package/src/functions/get-processed-block.js +46 -0
- package/src/functions/get-processed-block.test.js +31 -0
- package/src/functions/get-target.js +6 -0
- package/src/functions/if-target.js +6 -0
- package/src/functions/is-browser.js +6 -0
- package/src/functions/is-editing.js +7 -0
- package/src/functions/is-iframe.js +7 -0
- package/src/functions/is-previewing.js +14 -0
- package/src/functions/is-react-native.js +6 -0
- package/src/functions/macro-eval.js +5 -0
- package/src/functions/on-change.js +27 -0
- package/src/functions/on-change.test.js +19 -0
- package/src/functions/previewing-model-name.js +11 -0
- package/src/functions/register-component.js +53 -0
- package/src/functions/register.js +29 -0
- package/src/functions/set-editor-settings.js +15 -0
- package/src/functions/set.js +11 -0
- package/src/functions/set.test.js +16 -0
- package/src/functions/track.js +22 -0
- package/src/functions/transform-block.js +6 -0
- package/src/index-helpers/blocks-exports.js +20 -0
- package/src/index-helpers/top-of-file.js +4 -0
- package/src/index.js +13 -0
- package/src/scripts/init-editing.js +70 -0
- package/src/types/builder-block.js +0 -0
- package/src/types/builder-content.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/typescript.js +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
+
import { insert as _$insert } from "solid-js/web";
|
|
4
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
5
|
+
import { effect as _$effect } from "solid-js/web";
|
|
6
|
+
import { memo as _$memo } from "solid-js/web";
|
|
7
|
+
|
|
8
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<div> </div>`, 2),
|
|
9
|
+
_tmpl$2 = /*#__PURE__*/_$template(`<div></div>`, 2),
|
|
10
|
+
_tmpl$3 = /*#__PURE__*/_$template(`<div><picture><img loading="lazy"><source></picture></div>`, 6);
|
|
11
|
+
|
|
12
|
+
import { Show } from "solid-js";
|
|
13
|
+
import { css } from "solid-styled-components";
|
|
14
|
+
export default function Image(props) {
|
|
15
|
+
return (() => {
|
|
16
|
+
const _el$ = _tmpl$3.cloneNode(true),
|
|
17
|
+
_el$2 = _el$.firstChild,
|
|
18
|
+
_el$3 = _el$2.firstChild,
|
|
19
|
+
_el$4 = _el$3.nextSibling;
|
|
20
|
+
|
|
21
|
+
_$insert(_el$, _$createComponent(Show, {
|
|
22
|
+
get when() {
|
|
23
|
+
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
get children() {
|
|
27
|
+
const _el$5 = _tmpl$.cloneNode(true);
|
|
28
|
+
|
|
29
|
+
_$effect(_p$ => {
|
|
30
|
+
const _v$ = css({
|
|
31
|
+
width: "100%",
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
fontSize: "0"
|
|
34
|
+
}),
|
|
35
|
+
_v$2 = props.aspectRatio * 100 + "%";
|
|
36
|
+
|
|
37
|
+
_v$ !== _p$._v$ && (_el$5.className = _p$._v$ = _v$);
|
|
38
|
+
_v$2 !== _p$._v$2 && _el$5.style.setProperty("paddingTop", _p$._v$2 = _v$2);
|
|
39
|
+
return _p$;
|
|
40
|
+
}, {
|
|
41
|
+
_v$: undefined,
|
|
42
|
+
_v$2: undefined
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return _el$5;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}), null);
|
|
49
|
+
|
|
50
|
+
_$insert(_el$, _$createComponent(Show, {
|
|
51
|
+
get when() {
|
|
52
|
+
return props.builderBlock?.children?.length && props.fitContent;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
get children() {
|
|
56
|
+
return props.children;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}), null);
|
|
60
|
+
|
|
61
|
+
_$insert(_el$, _$createComponent(Show, {
|
|
62
|
+
get when() {
|
|
63
|
+
return !props.fitContent;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
get children() {
|
|
67
|
+
const _el$6 = _tmpl$2.cloneNode(true);
|
|
68
|
+
|
|
69
|
+
_$insert(_el$6, () => props.children);
|
|
70
|
+
|
|
71
|
+
_$effect(() => _el$6.className = css({
|
|
72
|
+
display: "flex",
|
|
73
|
+
flexDirection: "column",
|
|
74
|
+
alignItems: "stretch",
|
|
75
|
+
position: "absolute",
|
|
76
|
+
top: "0",
|
|
77
|
+
left: "0",
|
|
78
|
+
width: "100%",
|
|
79
|
+
height: "100%"
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
return _el$6;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}), null);
|
|
86
|
+
|
|
87
|
+
_$effect(_p$ => {
|
|
88
|
+
const _v$3 = css({
|
|
89
|
+
position: "relative"
|
|
90
|
+
}),
|
|
91
|
+
_v$4 = "builder-image" + (props.class ? " " + props.class : "") + " " + css({
|
|
92
|
+
opacity: "1",
|
|
93
|
+
transition: "opacity 0.2s ease-in-out",
|
|
94
|
+
position: "absolute",
|
|
95
|
+
height: "100%",
|
|
96
|
+
width: "100%",
|
|
97
|
+
top: "0px",
|
|
98
|
+
left: "0px"
|
|
99
|
+
}),
|
|
100
|
+
_v$5 = props.altText,
|
|
101
|
+
_v$6 = props.altText ? "presentation" : undefined,
|
|
102
|
+
_v$7 = props.backgroundSize || "center",
|
|
103
|
+
_v$8 = props.backgroundSize || "cover",
|
|
104
|
+
_v$9 = props.image,
|
|
105
|
+
_v$10 = props.srcset,
|
|
106
|
+
_v$11 = props.sizes,
|
|
107
|
+
_v$12 = props.srcset;
|
|
108
|
+
|
|
109
|
+
_v$3 !== _p$._v$3 && (_el$.className = _p$._v$3 = _v$3);
|
|
110
|
+
_v$4 !== _p$._v$4 && (_el$3.className = _p$._v$4 = _v$4);
|
|
111
|
+
_v$5 !== _p$._v$5 && _$setAttribute(_el$3, "alt", _p$._v$5 = _v$5);
|
|
112
|
+
_v$6 !== _p$._v$6 && _$setAttribute(_el$3, "aria-role", _p$._v$6 = _v$6);
|
|
113
|
+
_v$7 !== _p$._v$7 && _el$3.style.setProperty("objectPosition", _p$._v$7 = _v$7);
|
|
114
|
+
_v$8 !== _p$._v$8 && _el$3.style.setProperty("objectFit", _p$._v$8 = _v$8);
|
|
115
|
+
_v$9 !== _p$._v$9 && _$setAttribute(_el$3, "src", _p$._v$9 = _v$9);
|
|
116
|
+
_v$10 !== _p$._v$10 && _$setAttribute(_el$3, "srcset", _p$._v$10 = _v$10);
|
|
117
|
+
_v$11 !== _p$._v$11 && _$setAttribute(_el$3, "sizes", _p$._v$11 = _v$11);
|
|
118
|
+
_v$12 !== _p$._v$12 && _$setAttribute(_el$4, "srcset", _p$._v$12 = _v$12);
|
|
119
|
+
return _p$;
|
|
120
|
+
}, {
|
|
121
|
+
_v$3: undefined,
|
|
122
|
+
_v$4: undefined,
|
|
123
|
+
_v$5: undefined,
|
|
124
|
+
_v$6: undefined,
|
|
125
|
+
_v$7: undefined,
|
|
126
|
+
_v$8: undefined,
|
|
127
|
+
_v$9: undefined,
|
|
128
|
+
_v$10: undefined,
|
|
129
|
+
_v$11: undefined,
|
|
130
|
+
_v$12: undefined
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return _el$;
|
|
134
|
+
})();
|
|
135
|
+
}import { registerComponent } from '../functions/register-component';
|
|
136
|
+
registerComponent(Image, {name:'Image',static: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',defaultStyles:{position:'relative',minHeight:'20px',minWidth:'20px',overflow:'hidden'},canHaveChildren:true,inputs:[{name:'image',type:'file',bubble:true,allowedFileTypes:['jpeg','jpg','png','svg'],required:true,defaultValue:'https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',onChange:" const DEFAULT_ASPECT_RATIO = 0.7041; options.delete('srcset'); options.delete('noWebp'); function loadImage(url, timeout) { return new Promise((resolve, reject) => { const img = document.createElement('img'); let loaded = false; img.onload = () => { loaded = true; resolve(img); }; img.addEventListener('error', event => { console.warn('Image load failed', event.error); reject(event.error); }); img.src = url; setTimeout(() => { if (!loaded) { reject(new Error('Image load timed out')); } }, timeout); }); } function round(num) { return Math.round(num * 1000) / 1000; } const value = options.get('image'); const aspectRatio = options.get('aspectRatio'); // For SVG images - don't render as webp, keep them as SVG fetch(value) .then(res => res.blob()) .then(blob => { if (blob.type.includes('svg')) { options.set('noWebp', true); } }); if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) { return loadImage(value).then(img => { const possiblyUpdatedAspectRatio = options.get('aspectRatio'); if ( options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO) ) { if (img.width && img.height) { options.set('aspectRatio', round(img.height / img.width)); options.set('height', img.height); options.set('width', img.width); } } }); }"},{name:'backgroundSize',type:'text',defaultValue:'cover',enum:[{label:'contain',value:'contain',helperText:'The image should never get cropped'},{label:'cover',value:'cover',helperText:"The image should fill it's box, cropping when needed"}]},{name:'backgroundPosition',type:'text',defaultValue:'center',enum:['center','top','left','right','bottom','top left','top right','bottom left','bottom right']},{name:'altText',type:'string',helperText:'Text to display when the user has images off'},{name:'height',type:'number',hideFromUI:true},{name:'width',type:'number',hideFromUI:true},{name:'sizes',type:'string',hideFromUI:true},{name:'srcset',type:'string',hideFromUI:true},{name:'lazy',type:'boolean',defaultValue:true,hideFromUI:true},{name:'fitContent',type:'boolean',helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:true},{name:'aspectRatio',type:'number',helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:true,defaultValue:0.7041}]});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Show } from "solid-js";
|
|
2
|
+
|
|
3
|
+
import { css } from "solid-styled-components";
|
|
4
|
+
|
|
5
|
+
export default function Image(props) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
class={css({
|
|
9
|
+
position: "relative",
|
|
10
|
+
})}
|
|
11
|
+
>
|
|
12
|
+
<picture>
|
|
13
|
+
<img
|
|
14
|
+
class={
|
|
15
|
+
"builder-image" +
|
|
16
|
+
(props.class ? " " + props.class : "") +
|
|
17
|
+
" " +
|
|
18
|
+
css({
|
|
19
|
+
opacity: "1",
|
|
20
|
+
transition: "opacity 0.2s ease-in-out",
|
|
21
|
+
position: "absolute",
|
|
22
|
+
height: "100%",
|
|
23
|
+
width: "100%",
|
|
24
|
+
top: "0px",
|
|
25
|
+
left: "0px",
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
loading="lazy"
|
|
29
|
+
alt={props.altText}
|
|
30
|
+
aria-role={props.altText ? "presentation" : undefined}
|
|
31
|
+
style={{
|
|
32
|
+
objectPosition: props.backgroundSize || "center",
|
|
33
|
+
objectFit: props.backgroundSize || "cover",
|
|
34
|
+
}}
|
|
35
|
+
src={props.image}
|
|
36
|
+
srcset={props.srcset}
|
|
37
|
+
sizes={props.sizes}
|
|
38
|
+
/>
|
|
39
|
+
<source srcSet={props.srcset} />
|
|
40
|
+
</picture>
|
|
41
|
+
<Show
|
|
42
|
+
when={
|
|
43
|
+
props.aspectRatio &&
|
|
44
|
+
!(props.fitContent && props.builderBlock?.children?.length)
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
class={css({
|
|
49
|
+
width: "100%",
|
|
50
|
+
pointerEvents: "none",
|
|
51
|
+
fontSize: "0",
|
|
52
|
+
})}
|
|
53
|
+
style={{
|
|
54
|
+
paddingTop: props.aspectRatio * 100 + "%",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{" "}
|
|
58
|
+
</div>
|
|
59
|
+
</Show>
|
|
60
|
+
<Show when={props.builderBlock?.children?.length && props.fitContent}>
|
|
61
|
+
{props.children}
|
|
62
|
+
</Show>
|
|
63
|
+
<Show when={!props.fitContent}>
|
|
64
|
+
<div
|
|
65
|
+
class={css({
|
|
66
|
+
display: "flex",
|
|
67
|
+
flexDirection: "column",
|
|
68
|
+
alignItems: "stretch",
|
|
69
|
+
position: "absolute",
|
|
70
|
+
top: "0",
|
|
71
|
+
left: "0",
|
|
72
|
+
width: "100%",
|
|
73
|
+
height: "100%",
|
|
74
|
+
})}
|
|
75
|
+
>
|
|
76
|
+
{props.children}
|
|
77
|
+
</div>
|
|
78
|
+
</Show>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
+
import { effect as _$effect } from "solid-js/web";
|
|
4
|
+
import { spread as _$spread } from "solid-js/web";
|
|
5
|
+
|
|
6
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<img>`, 1);
|
|
7
|
+
|
|
8
|
+
import { isEditing } from "../functions/is-editing";
|
|
9
|
+
export default function ImgComponent(props) {
|
|
10
|
+
return (() => {
|
|
11
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
+
|
|
13
|
+
_$spread(_el$, () => props.attributes, false, false);
|
|
14
|
+
|
|
15
|
+
_$effect(_p$ => {
|
|
16
|
+
const _v$ = props.backgroundSize || "cover",
|
|
17
|
+
_v$2 = props.backgroundPosition || "center",
|
|
18
|
+
_v$3 = isEditing() && props.imgSrc || "default-key",
|
|
19
|
+
_v$4 = props.altText,
|
|
20
|
+
_v$5 = props.imgSrc;
|
|
21
|
+
|
|
22
|
+
_v$ !== _p$._v$ && _el$.style.setProperty("objectFit", _p$._v$ = _v$);
|
|
23
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("objectPosition", _p$._v$2 = _v$2);
|
|
24
|
+
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "key", _p$._v$3 = _v$3);
|
|
25
|
+
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "alt", _p$._v$4 = _v$4);
|
|
26
|
+
_v$5 !== _p$._v$5 && _$setAttribute(_el$, "src", _p$._v$5 = _v$5);
|
|
27
|
+
return _p$;
|
|
28
|
+
}, {
|
|
29
|
+
_v$: undefined,
|
|
30
|
+
_v$2: undefined,
|
|
31
|
+
_v$3: undefined,
|
|
32
|
+
_v$4: undefined,
|
|
33
|
+
_v$5: undefined
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return _el$;
|
|
37
|
+
})();
|
|
38
|
+
}import { registerComponent } from '../functions/register-component';
|
|
39
|
+
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});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isEditing } from "../functions/is-editing";
|
|
2
|
+
|
|
3
|
+
export default function ImgComponent(props) {
|
|
4
|
+
return (
|
|
5
|
+
<img
|
|
6
|
+
{...props.attributes}
|
|
7
|
+
style={{
|
|
8
|
+
objectFit: props.backgroundSize || "cover",
|
|
9
|
+
objectPosition: props.backgroundPosition || "center",
|
|
10
|
+
}}
|
|
11
|
+
key={(isEditing() && props.imgSrc) || "default-key"}
|
|
12
|
+
alt={props.altText}
|
|
13
|
+
src={props.imgSrc}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
+
import { effect as _$effect } from "solid-js/web";
|
|
4
|
+
import { spread as _$spread } from "solid-js/web";
|
|
5
|
+
|
|
6
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<input>`, 1);
|
|
7
|
+
|
|
8
|
+
import { isEditing } from "../functions/is-editing";
|
|
9
|
+
export default function FormInputComponent(props) {
|
|
10
|
+
return (() => {
|
|
11
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
+
|
|
13
|
+
_$spread(_el$, () => props.attributes, false, false);
|
|
14
|
+
|
|
15
|
+
_$effect(_p$ => {
|
|
16
|
+
const _v$ = isEditing() && props.defaultValue ? props.defaultValue : "default-key",
|
|
17
|
+
_v$2 = props.placeholder,
|
|
18
|
+
_v$3 = props.type,
|
|
19
|
+
_v$4 = props.name,
|
|
20
|
+
_v$5 = props.value,
|
|
21
|
+
_v$6 = props.defaultValue,
|
|
22
|
+
_v$7 = props.required;
|
|
23
|
+
|
|
24
|
+
_v$ !== _p$._v$ && _$setAttribute(_el$, "key", _p$._v$ = _v$);
|
|
25
|
+
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "placeholder", _p$._v$2 = _v$2);
|
|
26
|
+
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "type", _p$._v$3 = _v$3);
|
|
27
|
+
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "name", _p$._v$4 = _v$4);
|
|
28
|
+
_v$5 !== _p$._v$5 && (_el$.value = _p$._v$5 = _v$5);
|
|
29
|
+
_v$6 !== _p$._v$6 && _$setAttribute(_el$, "defaultvalue", _p$._v$6 = _v$6);
|
|
30
|
+
_v$7 !== _p$._v$7 && (_el$.required = _p$._v$7 = _v$7);
|
|
31
|
+
return _p$;
|
|
32
|
+
}, {
|
|
33
|
+
_v$: undefined,
|
|
34
|
+
_v$2: undefined,
|
|
35
|
+
_v$3: undefined,
|
|
36
|
+
_v$4: undefined,
|
|
37
|
+
_v$5: undefined,
|
|
38
|
+
_v$6: undefined,
|
|
39
|
+
_v$7: undefined
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return _el$;
|
|
43
|
+
})();
|
|
44
|
+
}import { registerComponent } from '../functions/register-component';
|
|
45
|
+
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'}});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isEditing } from "../functions/is-editing";
|
|
2
|
+
|
|
3
|
+
export default function FormInputComponent(props) {
|
|
4
|
+
return (
|
|
5
|
+
<input
|
|
6
|
+
{...props.attributes}
|
|
7
|
+
key={
|
|
8
|
+
isEditing() && props.defaultValue ? props.defaultValue : "default-key"
|
|
9
|
+
}
|
|
10
|
+
placeholder={props.placeholder}
|
|
11
|
+
type={props.type}
|
|
12
|
+
name={props.name}
|
|
13
|
+
value={props.value}
|
|
14
|
+
defaultValue={props.defaultValue}
|
|
15
|
+
required={props.required}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { effect as _$effect } from "solid-js/web";
|
|
3
|
+
|
|
4
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<span></span>`, 2);
|
|
5
|
+
|
|
6
|
+
export default function RawText(props) {
|
|
7
|
+
return (() => {
|
|
8
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
9
|
+
|
|
10
|
+
_$effect(_p$ => {
|
|
11
|
+
const _v$ = props.attributes?.class || props.attributes?.className,
|
|
12
|
+
_v$2 = props.text || "";
|
|
13
|
+
|
|
14
|
+
_v$ !== _p$._v$ && (_el$.className = _p$._v$ = _v$);
|
|
15
|
+
_v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
|
|
16
|
+
return _p$;
|
|
17
|
+
}, {
|
|
18
|
+
_v$: undefined,
|
|
19
|
+
_v$2: undefined
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return _el$;
|
|
23
|
+
})();
|
|
24
|
+
}import { registerComponent } from '../functions/register-component';
|
|
25
|
+
registerComponent(RawText, {name:'Builder:RawText',hideFromInsertMenu:true,builtIn:true,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { style as _$style } from "solid-js/web";
|
|
3
|
+
import { effect as _$effect } from "solid-js/web";
|
|
4
|
+
import { insert as _$insert } from "solid-js/web";
|
|
5
|
+
import { spread as _$spread } from "solid-js/web";
|
|
6
|
+
|
|
7
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<section></section>`, 2);
|
|
8
|
+
|
|
9
|
+
export default function SectionComponent(props) {
|
|
10
|
+
return (() => {
|
|
11
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
+
|
|
13
|
+
_$spread(_el$, () => props.attributes, false, true);
|
|
14
|
+
|
|
15
|
+
_$insert(_el$, () => props.children);
|
|
16
|
+
|
|
17
|
+
_$effect(_$p => _$style(_el$, props.maxWidth && typeof props.maxWidth === "number" ? {
|
|
18
|
+
maxWidth: props.maxWidth
|
|
19
|
+
} : undefined, _$p));
|
|
20
|
+
|
|
21
|
+
return _el$;
|
|
22
|
+
})();
|
|
23
|
+
}import { registerComponent } from '../functions/register-component';
|
|
24
|
+
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>"}}}]});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function SectionComponent(props) {
|
|
2
|
+
return (
|
|
3
|
+
<section
|
|
4
|
+
{...props.attributes}
|
|
5
|
+
style={
|
|
6
|
+
props.maxWidth && typeof props.maxWidth === "number"
|
|
7
|
+
? {
|
|
8
|
+
maxWidth: props.maxWidth,
|
|
9
|
+
}
|
|
10
|
+
: undefined
|
|
11
|
+
}
|
|
12
|
+
>
|
|
13
|
+
{props.children}
|
|
14
|
+
</section>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { memo as _$memo } from "solid-js/web";
|
|
3
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
4
|
+
import { effect as _$effect } from "solid-js/web";
|
|
5
|
+
import { insert as _$insert } from "solid-js/web";
|
|
6
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
7
|
+
import { spread as _$spread } from "solid-js/web";
|
|
8
|
+
|
|
9
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<select></select>`, 2),
|
|
10
|
+
_tmpl$2 = /*#__PURE__*/_$template(`<option></option>`, 2);
|
|
11
|
+
|
|
12
|
+
import { For } from "solid-js";
|
|
13
|
+
import { isEditing } from "../functions/is-editing";
|
|
14
|
+
export default function SelectComponent(props) {
|
|
15
|
+
return (() => {
|
|
16
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
17
|
+
|
|
18
|
+
_$spread(_el$, () => props.attributes, false, true);
|
|
19
|
+
|
|
20
|
+
_$insert(_el$, _$createComponent(For, {
|
|
21
|
+
get each() {
|
|
22
|
+
return props.options;
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
children: (option, index) => (() => {
|
|
26
|
+
const _el$2 = _tmpl$2.cloneNode(true);
|
|
27
|
+
|
|
28
|
+
_$insert(_el$2, () => option.name || option.value);
|
|
29
|
+
|
|
30
|
+
_$effect(() => _el$2.value = option.value);
|
|
31
|
+
|
|
32
|
+
return _el$2;
|
|
33
|
+
})()
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
_$effect(_p$ => {
|
|
37
|
+
const _v$ = props.value,
|
|
38
|
+
_v$2 = isEditing() && props.defaultValue ? props.defaultValue : "default-key",
|
|
39
|
+
_v$3 = props.defaultValue,
|
|
40
|
+
_v$4 = props.name;
|
|
41
|
+
|
|
42
|
+
_v$ !== _p$._v$ && (_el$.value = _p$._v$ = _v$);
|
|
43
|
+
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "key", _p$._v$2 = _v$2);
|
|
44
|
+
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "defaultvalue", _p$._v$3 = _v$3);
|
|
45
|
+
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "name", _p$._v$4 = _v$4);
|
|
46
|
+
return _p$;
|
|
47
|
+
}, {
|
|
48
|
+
_v$: undefined,
|
|
49
|
+
_v$2: undefined,
|
|
50
|
+
_v$3: undefined,
|
|
51
|
+
_v$4: undefined
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return _el$;
|
|
55
|
+
})();
|
|
56
|
+
}import { registerComponent } from '../functions/register-component';
|
|
57
|
+
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});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { For } from "solid-js";
|
|
2
|
+
|
|
3
|
+
import { isEditing } from "../functions/is-editing";
|
|
4
|
+
|
|
5
|
+
export default function SelectComponent(props) {
|
|
6
|
+
return (
|
|
7
|
+
<select
|
|
8
|
+
{...props.attributes}
|
|
9
|
+
value={props.value}
|
|
10
|
+
key={
|
|
11
|
+
isEditing() && props.defaultValue ? props.defaultValue : "default-key"
|
|
12
|
+
}
|
|
13
|
+
defaultValue={props.defaultValue}
|
|
14
|
+
name={props.name}
|
|
15
|
+
>
|
|
16
|
+
<For each={props.options}>
|
|
17
|
+
{(option, index) => (
|
|
18
|
+
<option value={option.value}>{option.name || option.value}</option>
|
|
19
|
+
)}
|
|
20
|
+
</For>
|
|
21
|
+
</select>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { insert as _$insert } from "solid-js/web";
|
|
3
|
+
import { spread as _$spread } from "solid-js/web";
|
|
4
|
+
|
|
5
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<button type="submit"></button>`, 2);
|
|
6
|
+
|
|
7
|
+
export default function SubmitButton(props) {
|
|
8
|
+
return (() => {
|
|
9
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
10
|
+
|
|
11
|
+
_$spread(_el$, () => props.attributes, false, true);
|
|
12
|
+
|
|
13
|
+
_$insert(_el$, () => props.text);
|
|
14
|
+
|
|
15
|
+
return _el$;
|
|
16
|
+
})();
|
|
17
|
+
}import { registerComponent } from '../functions/register-component';
|
|
18
|
+
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});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
+
import { effect as _$effect } from "solid-js/web";
|
|
4
|
+
import { insert as _$insert } from "solid-js/web";
|
|
5
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
6
|
+
import { spread as _$spread } from "solid-js/web";
|
|
7
|
+
|
|
8
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<div></div>`, 2);
|
|
9
|
+
|
|
10
|
+
import { createMutable } from "solid-js/store";
|
|
11
|
+
import RenderContent from "../components/render-content";
|
|
12
|
+
import BuilderContext from "../context/builder.context";
|
|
13
|
+
export default function Symbol(props) {
|
|
14
|
+
const state = createMutable({
|
|
15
|
+
className: "builder-symbol",
|
|
16
|
+
content: null
|
|
17
|
+
});
|
|
18
|
+
const builderContext = useContext(BuilderContext);
|
|
19
|
+
onMount(() => {
|
|
20
|
+
state.content = props.symbol?.content;
|
|
21
|
+
});
|
|
22
|
+
return (() => {
|
|
23
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
24
|
+
|
|
25
|
+
_$spread(_el$, () => props.attributes, false, true);
|
|
26
|
+
|
|
27
|
+
_$insert(_el$, _$createComponent(RenderContent, {
|
|
28
|
+
get apiKey() {
|
|
29
|
+
return builderContext.apiKey;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
get context() {
|
|
33
|
+
return builderContext.context;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
get data() {
|
|
37
|
+
return { ...props.symbol?.data,
|
|
38
|
+
...builderContext.state,
|
|
39
|
+
...props.symbol?.state.content?.data?.state
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
get model() {
|
|
44
|
+
return props.symbol?.model;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
get content() {
|
|
48
|
+
return state.content;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
_$effect(_p$ => {
|
|
54
|
+
const _v$ = state.className,
|
|
55
|
+
_v$2 = {
|
|
56
|
+
class: state.className
|
|
57
|
+
};
|
|
58
|
+
_v$ !== _p$._v$ && (_el$.className = _p$._v$ = _v$);
|
|
59
|
+
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "dataset", _p$._v$2 = _v$2);
|
|
60
|
+
return _p$;
|
|
61
|
+
}, {
|
|
62
|
+
_v$: undefined,
|
|
63
|
+
_v$2: undefined
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return _el$;
|
|
67
|
+
})();
|
|
68
|
+
}import { registerComponent } from '../functions/register-component';
|
|
69
|
+
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'}]});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createMutable } from "solid-js/store";
|
|
2
|
+
|
|
3
|
+
import RenderContent from "../components/render-content.lite";
|
|
4
|
+
import BuilderContext from "../context/builder.context.lite";
|
|
5
|
+
import { getContent } from "../functions/get-content";
|
|
6
|
+
|
|
7
|
+
export default function Symbol(props) {
|
|
8
|
+
const state = createMutable({ className: "builder-symbol", content: null });
|
|
9
|
+
|
|
10
|
+
const builderContext = useContext(BuilderContext);
|
|
11
|
+
|
|
12
|
+
onMount(() => {
|
|
13
|
+
state.content = props.symbol?.content;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
class={state.className}
|
|
19
|
+
{...props.attributes}
|
|
20
|
+
dataSet={{
|
|
21
|
+
class: state.className,
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
<RenderContent
|
|
25
|
+
apiKey={builderContext.apiKey}
|
|
26
|
+
context={builderContext.context}
|
|
27
|
+
data={{
|
|
28
|
+
...props.symbol?.data,
|
|
29
|
+
...builderContext.state,
|
|
30
|
+
...props.symbol?.state.content?.data?.state,
|
|
31
|
+
}}
|
|
32
|
+
model={props.symbol?.model}
|
|
33
|
+
content={state.content}
|
|
34
|
+
></RenderContent>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { effect as _$effect } from "solid-js/web";
|
|
3
|
+
|
|
4
|
+
const _tmpl$ = /*#__PURE__*/_$template(`<div></div>`, 2);
|
|
5
|
+
|
|
6
|
+
export default function Text(props) {
|
|
7
|
+
return (() => {
|
|
8
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
9
|
+
|
|
10
|
+
_$effect(() => _el$.innerHTML = props.text);
|
|
11
|
+
|
|
12
|
+
return _el$;
|
|
13
|
+
})();
|
|
14
|
+
}import { registerComponent } from '../functions/register-component';
|
|
15
|
+
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'}});
|