@builder.io/sdk-solid 0.0.3 → 0.0.6
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 -2
- package/src/blocks/button.jsx +8 -0
- package/src/blocks/button.lite.tsx +11 -15
- package/src/blocks/{columns.js → columns.jsx} +39 -81
- package/src/blocks/columns.lite.tsx +28 -23
- package/src/blocks/{custom-code.js → custom-code.jsx} +5 -25
- package/src/blocks/custom-code.lite.tsx +3 -1
- package/src/blocks/{embed.js → embed.jsx} +5 -15
- package/src/blocks/embed.lite.tsx +3 -1
- package/src/blocks/{form.js → form.jsx} +34 -136
- package/src/blocks/form.lite.tsx +7 -2
- package/src/blocks/fragment.jsx +6 -0
- package/src/blocks/fragment.lite.tsx +3 -1
- package/src/blocks/{image.js → image.jsx} +47 -138
- package/src/blocks/image.lite.tsx +3 -1
- package/src/blocks/img.jsx +11 -0
- package/src/blocks/img.lite.tsx +3 -1
- package/src/blocks/input.jsx +8 -0
- package/src/blocks/input.lite.tsx +3 -1
- package/src/blocks/raw-text.jsx +6 -0
- package/src/blocks/raw-text.lite.tsx +3 -1
- package/src/blocks/{section.js → section.jsx} +9 -23
- package/src/blocks/section.lite.tsx +3 -1
- package/src/blocks/select.jsx +17 -0
- package/src/blocks/select.lite.tsx +9 -4
- package/src/blocks/submit-button.jsx +8 -0
- package/src/blocks/submit-button.lite.tsx +3 -1
- package/src/blocks/symbol.jsx +25 -0
- package/src/blocks/symbol.lite.tsx +4 -2
- package/src/blocks/text.jsx +6 -0
- package/src/blocks/text.lite.tsx +3 -1
- package/src/blocks/textarea.jsx +6 -0
- package/src/blocks/textarea.lite.tsx +3 -1
- package/src/blocks/video.jsx +15 -0
- package/src/blocks/video.lite.tsx +3 -1
- package/src/components/block-styles.jsx +5 -0
- package/src/components/block-styles.lite.tsx +3 -1
- package/src/components/error-boundary.jsx +5 -0
- package/src/components/error-boundary.lite.tsx +3 -1
- package/src/components/{render-block.js → render-block.jsx} +30 -70
- package/src/components/render-block.lite.tsx +11 -3
- package/src/components/render-blocks.jsx +57 -0
- package/src/components/render-blocks.lite.tsx +7 -4
- package/src/components/render-content/components/render-styles.jsx +73 -0
- package/src/components/render-content/components/render-styles.lite.tsx +72 -0
- package/src/components/render-content/render-content.jsx +210 -0
- package/src/components/{render-content.lite.tsx → render-content/render-content.lite.tsx} +22 -78
- package/src/constants/target.js +4 -0
- package/src/functions/if-target.js +11 -2
- package/src/functions/track.js +2 -2
- package/src/index-helpers/blocks-exports.js +1 -1
- package/src/scripts/init-editing.js +3 -2
- package/src/types/targets.js +0 -0
- package/src/blocks/button.js +0 -41
- package/src/blocks/fragment.js +0 -15
- package/src/blocks/img.js +0 -39
- package/src/blocks/input.js +0 -45
- package/src/blocks/raw-text.js +0 -25
- package/src/blocks/select.js +0 -57
- package/src/blocks/submit-button.js +0 -18
- package/src/blocks/symbol.js +0 -69
- package/src/blocks/text.js +0 -15
- package/src/blocks/textarea.js +0 -34
- package/src/blocks/video.js +0 -54
- package/src/components/block-styles.js +0 -3
- package/src/components/error-boundary.js +0 -3
- package/src/components/render-blocks.js +0 -104
- package/src/components/render-content.js +0 -314
- package/src/functions/get-target.js +0 -6
- package/src/functions/is-react-native.js +0 -6
|
@@ -2,25 +2,24 @@ import { useContext, Show, onMount } from "solid-js";
|
|
|
2
2
|
import { Dynamic } from "solid-js/web";
|
|
3
3
|
import { createMutable } from "solid-js/store";
|
|
4
4
|
|
|
5
|
-
import { isBrowser } from "
|
|
6
|
-
import BuilderContext from "
|
|
7
|
-
import { track } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { getContent } from "../functions/get-content";
|
|
5
|
+
import { isBrowser } from "../../functions/is-browser";
|
|
6
|
+
import BuilderContext from "../../context/builder.context";
|
|
7
|
+
import { track } from "../../functions/track";
|
|
8
|
+
import { isEditing } from "../../functions/is-editing";
|
|
9
|
+
import { isPreviewing } from "../../functions/is-previewing";
|
|
10
|
+
import { previewingModelName } from "../../functions/previewing-model-name";
|
|
11
|
+
import { getContent } from "../../functions/get-content";
|
|
13
12
|
import {
|
|
14
13
|
convertSearchParamsToQueryObject,
|
|
15
14
|
getBuilderSearchParams,
|
|
16
|
-
} from "
|
|
17
|
-
import RenderBlocks from "
|
|
18
|
-
import { evaluate } from "
|
|
19
|
-
import { getFetch } from "
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
} from "../../functions/get-builder-search-params";
|
|
16
|
+
import RenderBlocks from "../render-blocks.lite";
|
|
17
|
+
import { evaluate } from "../../functions/evaluate";
|
|
18
|
+
import { getFetch } from "../../functions/get-fetch";
|
|
19
|
+
import { TARGET } from "../../constants/target";
|
|
20
|
+
import RenderStyles from "./components/render-styles.lite";
|
|
21
|
+
|
|
22
|
+
function RenderContent(props) {
|
|
24
23
|
const state = createMutable({
|
|
25
24
|
get useContent() {
|
|
26
25
|
const mergedContent: BuilderContent = {
|
|
@@ -49,63 +48,6 @@ export default function RenderContent(props) {
|
|
|
49
48
|
[index: string]: any;
|
|
50
49
|
};
|
|
51
50
|
},
|
|
52
|
-
getCssFromFont(font: any, data?: any) {
|
|
53
|
-
// TODO: compute what font sizes are used and only load those.......
|
|
54
|
-
const family =
|
|
55
|
-
font.family +
|
|
56
|
-
(font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
57
|
-
const name = family.split(",")[0];
|
|
58
|
-
const url = font.fileUrl ?? font?.files?.regular;
|
|
59
|
-
let str = "";
|
|
60
|
-
|
|
61
|
-
if (url && family && name) {
|
|
62
|
-
str += `
|
|
63
|
-
@font-face {
|
|
64
|
-
font-family: "${family}";
|
|
65
|
-
src: local("${name}"), url('${url}') format('woff2');
|
|
66
|
-
font-display: fallback;
|
|
67
|
-
font-weight: 400;
|
|
68
|
-
}
|
|
69
|
-
`.trim();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (font.files) {
|
|
73
|
-
for (const weight in font.files) {
|
|
74
|
-
const isNumber = String(Number(weight)) === weight;
|
|
75
|
-
|
|
76
|
-
if (!isNumber) {
|
|
77
|
-
continue;
|
|
78
|
-
} // TODO: maybe limit number loaded
|
|
79
|
-
|
|
80
|
-
const weightUrl = font.files[weight];
|
|
81
|
-
|
|
82
|
-
if (weightUrl && weightUrl !== url) {
|
|
83
|
-
str += `
|
|
84
|
-
@font-face {
|
|
85
|
-
font-family: "${family}";
|
|
86
|
-
src: url('${weightUrl}') format('woff2');
|
|
87
|
-
font-display: fallback;
|
|
88
|
-
font-weight: ${weight};
|
|
89
|
-
}
|
|
90
|
-
`.trim();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return str;
|
|
96
|
-
},
|
|
97
|
-
getFontCss(data?: any) {
|
|
98
|
-
// TODO: flag for this
|
|
99
|
-
// if (!this.builder.allowCustomFonts) {
|
|
100
|
-
// return '';
|
|
101
|
-
// }
|
|
102
|
-
// TODO: separate internal data from external
|
|
103
|
-
return (
|
|
104
|
-
data?.customFonts
|
|
105
|
-
?.map((font: any) => this.getCssFromFont(font, data))
|
|
106
|
-
?.join(" ") || ""
|
|
107
|
-
);
|
|
108
|
-
},
|
|
109
51
|
processMessage(event: MessageEvent) {
|
|
110
52
|
const { data } = event;
|
|
111
53
|
|
|
@@ -271,13 +213,13 @@ export default function RenderContent(props) {
|
|
|
271
213
|
when={
|
|
272
214
|
(state.useContent?.data?.cssCode ||
|
|
273
215
|
state.useContent?.data?.customFonts?.length) &&
|
|
274
|
-
|
|
216
|
+
TARGET !== "reactNative"
|
|
275
217
|
}
|
|
276
218
|
>
|
|
277
|
-
<
|
|
278
|
-
{state.useContent.data.cssCode}
|
|
279
|
-
{state.
|
|
280
|
-
|
|
219
|
+
<RenderStyles
|
|
220
|
+
cssCode={state.useContent.data.cssCode}
|
|
221
|
+
customFonts={state.useContent.data.customFonts}
|
|
222
|
+
></RenderStyles>
|
|
281
223
|
</Show>
|
|
282
224
|
<RenderBlocks blocks={state.useContent?.data?.blocks}></RenderBlocks>
|
|
283
225
|
</div>
|
|
@@ -285,3 +227,5 @@ export default function RenderContent(props) {
|
|
|
285
227
|
</Dynamic>
|
|
286
228
|
);
|
|
287
229
|
}
|
|
230
|
+
|
|
231
|
+
export default RenderContent;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TARGET } from "../constants/target";
|
|
2
|
+
function ifTarget({
|
|
3
|
+
targets,
|
|
4
|
+
doThing,
|
|
5
|
+
elseThing
|
|
6
|
+
}) {
|
|
7
|
+
if (TARGET && targets.includes(TARGET)) {
|
|
8
|
+
return doThing();
|
|
9
|
+
} else {
|
|
10
|
+
return elseThing == null ? void 0 : elseThing();
|
|
11
|
+
}
|
|
3
12
|
}
|
|
4
13
|
export {
|
|
5
14
|
ifTarget
|
package/src/functions/track.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { TARGET } from "../constants/target";
|
|
1
2
|
import { isBrowser } from "./is-browser";
|
|
2
3
|
import { isEditing } from "./is-editing";
|
|
3
|
-
import { isReactNative } from "./is-react-native";
|
|
4
4
|
function track(event, properties) {
|
|
5
5
|
if (isEditing()) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
|
-
if (!(isBrowser() ||
|
|
8
|
+
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
return fetch(`https://builder.io/api/v1/track`, {
|
|
@@ -6,7 +6,7 @@ import { default as default6 } from "../blocks/symbol";
|
|
|
6
6
|
import { default as default7 } from "../blocks/button";
|
|
7
7
|
import { default as default8 } from "../blocks/section";
|
|
8
8
|
import { default as default9 } from "../blocks/fragment";
|
|
9
|
-
import { default as default10 } from "../components/render-content";
|
|
9
|
+
import { default as default10 } from "../components/render-content/render-content";
|
|
10
10
|
export {
|
|
11
11
|
default7 as Button,
|
|
12
12
|
default2 as Columns,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { TARGET } from "../constants/target";
|
|
2
3
|
import { isBrowser } from "../functions/is-browser";
|
|
3
4
|
import { register } from "../functions/register";
|
|
4
5
|
register("insertMenu", {
|
|
@@ -9,7 +10,7 @@ register("insertMenu", {
|
|
|
9
10
|
{ name: "Text" },
|
|
10
11
|
{ name: "Image" },
|
|
11
12
|
{ name: "Columns" },
|
|
12
|
-
...
|
|
13
|
+
...TARGET === "reactNative" ? [] : [
|
|
13
14
|
{ name: "Core:Section" },
|
|
14
15
|
{ name: "Core:Button" },
|
|
15
16
|
{ name: "Embed" },
|
|
@@ -21,7 +22,7 @@ if (isBrowser()) {
|
|
|
21
22
|
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
22
23
|
type: "builder.sdkInfo",
|
|
23
24
|
data: {
|
|
24
|
-
target:
|
|
25
|
+
target: TARGET,
|
|
25
26
|
supportsPatchUpdates: false
|
|
26
27
|
}
|
|
27
28
|
}, "*");
|
|
File without changes
|
package/src/blocks/button.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { createComponent as _$createComponent } 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 { spread as _$spread } from "solid-js/web";
|
|
7
|
-
|
|
8
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<a role="button"></a>`, 2);
|
|
9
|
-
|
|
10
|
-
import { Show } from "solid-js";
|
|
11
|
-
export default function Button(props) {
|
|
12
|
-
return _$createComponent(Show, {
|
|
13
|
-
get when() {
|
|
14
|
-
return props.link;
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
get children() {
|
|
18
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
19
|
-
|
|
20
|
-
_$spread(_el$, () => props.attributes, false, true);
|
|
21
|
-
|
|
22
|
-
_$insert(_el$, () => props.text);
|
|
23
|
-
|
|
24
|
-
_$effect(_p$ => {
|
|
25
|
-
const _v$ = props.link,
|
|
26
|
-
_v$2 = props.openLinkInNewTab ? "_blank" : undefined;
|
|
27
|
-
|
|
28
|
-
_v$ !== _p$._v$ && _$setAttribute(_el$, "href", _p$._v$ = _v$);
|
|
29
|
-
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "target", _p$._v$2 = _v$2);
|
|
30
|
-
return _p$;
|
|
31
|
-
}, {
|
|
32
|
-
_v$: undefined,
|
|
33
|
-
_v$2: undefined
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return _el$;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
}import { registerComponent } from '../functions/register-component';
|
|
41
|
-
registerComponent(Button, {name:'Core:Button',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13',defaultStyles:{appearance:'none',paddingTop:'15px',paddingBottom:'15px',paddingLeft:'25px',paddingRight:'25px',backgroundColor:'#000000',color:'white',borderRadius:'4px',textAlign:'center',cursor:'pointer'},inputs:[{name:'text',type:'text',defaultValue:'Click me!',bubble:true},{name:'link',type:'url',bubble:true},{name:'openLinkInNewTab',type:'boolean',defaultValue:false,friendlyName:'Open link in new tab'}],static:true,noWrap:true});
|
package/src/blocks/fragment.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { insert as _$insert } from "solid-js/web";
|
|
3
|
-
|
|
4
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<span></span>`, 2);
|
|
5
|
-
|
|
6
|
-
export default function FragmentComponent(props) {
|
|
7
|
-
return (() => {
|
|
8
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
9
|
-
|
|
10
|
-
_$insert(_el$, () => props.children);
|
|
11
|
-
|
|
12
|
-
return _el$;
|
|
13
|
-
})();
|
|
14
|
-
}import { registerComponent } from '../functions/register-component';
|
|
15
|
-
registerComponent(FragmentComponent, {name:'Fragment',static:true,hidden:true,builtIn:true,canHaveChildren:true,noWrap:true});
|
package/src/blocks/img.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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("object-fit", _p$._v$ = _v$);
|
|
23
|
-
_v$2 !== _p$._v$2 && _el$.style.setProperty("object-position", _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});
|
package/src/blocks/input.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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'}});
|
package/src/blocks/raw-text.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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}]});
|
package/src/blocks/select.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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});
|
|
@@ -1,18 +0,0 @@
|
|
|
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});
|
package/src/blocks/symbol.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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'}]});
|
package/src/blocks/text.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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'}});
|
package/src/blocks/textarea.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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(`<textarea></textarea>`, 2);
|
|
7
|
-
|
|
8
|
-
export default function Textarea(props) {
|
|
9
|
-
return (() => {
|
|
10
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
11
|
-
|
|
12
|
-
_$spread(_el$, () => props.attributes, false, false);
|
|
13
|
-
|
|
14
|
-
_$effect(_p$ => {
|
|
15
|
-
const _v$ = props.placeholder,
|
|
16
|
-
_v$2 = props.name,
|
|
17
|
-
_v$3 = props.value,
|
|
18
|
-
_v$4 = props.defaultValue;
|
|
19
|
-
_v$ !== _p$._v$ && _$setAttribute(_el$, "placeholder", _p$._v$ = _v$);
|
|
20
|
-
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "name", _p$._v$2 = _v$2);
|
|
21
|
-
_v$3 !== _p$._v$3 && (_el$.value = _p$._v$3 = _v$3);
|
|
22
|
-
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "defaultvalue", _p$._v$4 = _v$4);
|
|
23
|
-
return _p$;
|
|
24
|
-
}, {
|
|
25
|
-
_v$: undefined,
|
|
26
|
-
_v$2: undefined,
|
|
27
|
-
_v$3: undefined,
|
|
28
|
-
_v$4: undefined
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
return _el$;
|
|
32
|
-
})();
|
|
33
|
-
}import { registerComponent } from '../functions/register-component';
|
|
34
|
-
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.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
-
import { style as _$style } from "solid-js/web";
|
|
4
|
-
import { effect as _$effect } from "solid-js/web";
|
|
5
|
-
import { spread as _$spread } from "solid-js/web";
|
|
6
|
-
|
|
7
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<video preload="none"></video>`, 2);
|
|
8
|
-
|
|
9
|
-
export default function Video(props) {
|
|
10
|
-
return (() => {
|
|
11
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
-
|
|
13
|
-
_$spread(_el$, () => props.attributes, false, false);
|
|
14
|
-
|
|
15
|
-
_$effect(_p$ => {
|
|
16
|
-
const _v$ = {
|
|
17
|
-
width: "100%",
|
|
18
|
-
height: "100%",
|
|
19
|
-
...props.attributes?.style,
|
|
20
|
-
"object-fit": props.fit,
|
|
21
|
-
"object-position": props.position,
|
|
22
|
-
// Hack to get object fit to work as expected and
|
|
23
|
-
// not have the video overflow
|
|
24
|
-
"border-radius": 1
|
|
25
|
-
},
|
|
26
|
-
_v$2 = props.video || "no-src",
|
|
27
|
-
_v$3 = props.posterImage,
|
|
28
|
-
_v$4 = props.autoPlay,
|
|
29
|
-
_v$5 = props.muted,
|
|
30
|
-
_v$6 = props.controls,
|
|
31
|
-
_v$7 = props.loop;
|
|
32
|
-
|
|
33
|
-
_p$._v$ = _$style(_el$, _v$, _p$._v$);
|
|
34
|
-
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "key", _p$._v$2 = _v$2);
|
|
35
|
-
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "poster", _p$._v$3 = _v$3);
|
|
36
|
-
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "autoplay", _p$._v$4 = _v$4);
|
|
37
|
-
_v$5 !== _p$._v$5 && (_el$.muted = _p$._v$5 = _v$5);
|
|
38
|
-
_v$6 !== _p$._v$6 && (_el$.controls = _p$._v$6 = _v$6);
|
|
39
|
-
_v$7 !== _p$._v$7 && (_el$.loop = _p$._v$7 = _v$7);
|
|
40
|
-
return _p$;
|
|
41
|
-
}, {
|
|
42
|
-
_v$: undefined,
|
|
43
|
-
_v$2: undefined,
|
|
44
|
-
_v$3: undefined,
|
|
45
|
-
_v$4: undefined,
|
|
46
|
-
_v$5: undefined,
|
|
47
|
-
_v$6: undefined,
|
|
48
|
-
_v$7: undefined
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return _el$;
|
|
52
|
-
})();
|
|
53
|
-
}import { registerComponent } from '../functions/register-component';
|
|
54
|
-
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}]});
|