@builder.io/sdk-solid 0.0.8-10 → 0.0.8-13
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 +5 -1
- package/package.json +1 -1
- package/src/blocks/columns/columns.jsx +1 -1
- package/src/blocks/custom-code/custom-code.jsx +1 -2
- package/src/blocks/embed/embed.jsx +1 -2
- package/src/blocks/form/form.jsx +2 -2
- package/src/blocks/image/image.jsx +2 -2
- package/src/blocks/symbol/symbol.jsx +1 -1
- package/src/components/render-block/block-styles.jsx +19 -4
- package/src/components/render-block/render-block.jsx +30 -30
- package/src/components/render-block/render-component.jsx +27 -0
- package/src/components/render-blocks.jsx +12 -2
- package/src/components/render-content/components/render-styles.jsx +1 -1
- package/src/components/render-content/render-content.jsx +2 -2
- package/src/functions/get-block-component-options.js +6 -1
- package/src/index-helpers/blocks-exports.js +2 -0
- package/src/blocks/button/button.lite.tsx +0 -23
- package/src/blocks/columns/columns.lite.tsx +0 -109
- package/src/blocks/custom-code/custom-code.lite.tsx +0 -69
- package/src/blocks/embed/embed.lite.tsx +0 -61
- package/src/blocks/form/form.lite.tsx +0 -296
- package/src/blocks/fragment/fragment.lite.tsx +0 -5
- package/src/blocks/image/image.lite.tsx +0 -86
- package/src/blocks/img/img.lite.tsx +0 -18
- package/src/blocks/input/input.lite.tsx +0 -20
- package/src/blocks/raw-text/raw-text.lite.tsx +0 -10
- package/src/blocks/section/section.lite.tsx +0 -18
- package/src/blocks/select/select.lite.tsx +0 -28
- package/src/blocks/submit-button/submit-button.lite.tsx +0 -9
- package/src/blocks/symbol/symbol.lite.tsx +0 -41
- package/src/blocks/text/text.lite.tsx +0 -5
- package/src/blocks/textarea/textarea.lite.tsx +0 -13
- package/src/blocks/video/video.lite.tsx +0 -26
- package/src/components/error-boundary.lite.tsx +0 -5
- package/src/components/render-block/block-styles.lite.tsx +0 -38
- package/src/components/render-block/render-block.lite.tsx +0 -154
- package/src/components/render-blocks.lite.tsx +0 -75
- package/src/components/render-content/components/render-styles.lite.tsx +0 -76
- package/src/components/render-content/render-content.lite.tsx +0 -262
- package/src/components/render-inlined-styles.lite.tsx +0 -29
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { Show, For } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { createMutable } from "solid-js/store";
|
|
4
|
-
import { css } from "solid-styled-components";
|
|
5
|
-
|
|
6
|
-
import RenderBlock from "../../components/render-block/render-block.lite";
|
|
7
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
8
|
-
|
|
9
|
-
function FormComponent(props) {
|
|
10
|
-
const state = createMutable({
|
|
11
|
-
formState: "unsubmitted",
|
|
12
|
-
responseData: null,
|
|
13
|
-
formErrorMessage: "",
|
|
14
|
-
get submissionState() {
|
|
15
|
-
return (isEditing() && props.previewState) || state.formState;
|
|
16
|
-
},
|
|
17
|
-
onSubmit(
|
|
18
|
-
event: Event & {
|
|
19
|
-
currentTarget: HTMLFormElement;
|
|
20
|
-
}
|
|
21
|
-
) {
|
|
22
|
-
const sendWithJs =
|
|
23
|
-
props.sendWithJs || props.sendSubmissionsTo === "email";
|
|
24
|
-
|
|
25
|
-
if (props.sendSubmissionsTo === "zapier") {
|
|
26
|
-
event.preventDefault();
|
|
27
|
-
} else if (sendWithJs) {
|
|
28
|
-
if (!(props.action || props.sendSubmissionsTo === "email")) {
|
|
29
|
-
event.preventDefault();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
const el = event.currentTarget;
|
|
35
|
-
const headers = props.customHeaders || {};
|
|
36
|
-
let body: any;
|
|
37
|
-
const formData = new FormData(el); // TODO: maybe support null
|
|
38
|
-
|
|
39
|
-
const formPairs: {
|
|
40
|
-
key: string;
|
|
41
|
-
value: File | boolean | number | string | FileList;
|
|
42
|
-
}[] = Array.from(
|
|
43
|
-
event.currentTarget.querySelectorAll("input,select,textarea")
|
|
44
|
-
)
|
|
45
|
-
.filter((el) => !!(el as HTMLInputElement).name)
|
|
46
|
-
.map((el) => {
|
|
47
|
-
let value: any;
|
|
48
|
-
const key = (el as HTMLImageElement).name;
|
|
49
|
-
|
|
50
|
-
if (el instanceof HTMLInputElement) {
|
|
51
|
-
if (el.type === "radio") {
|
|
52
|
-
if (el.checked) {
|
|
53
|
-
value = el.name;
|
|
54
|
-
return {
|
|
55
|
-
key,
|
|
56
|
-
value,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
} else if (el.type === "checkbox") {
|
|
60
|
-
value = el.checked;
|
|
61
|
-
} else if (el.type === "number" || el.type === "range") {
|
|
62
|
-
const num = el.valueAsNumber;
|
|
63
|
-
|
|
64
|
-
if (!isNaN(num)) {
|
|
65
|
-
value = num;
|
|
66
|
-
}
|
|
67
|
-
} else if (el.type === "file") {
|
|
68
|
-
// TODO: one vs multiple files
|
|
69
|
-
value = el.files;
|
|
70
|
-
} else {
|
|
71
|
-
value = el.value;
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
value = (el as HTMLInputElement).value;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
key,
|
|
79
|
-
value,
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
let contentType = props.contentType;
|
|
83
|
-
|
|
84
|
-
if (props.sendSubmissionsTo === "email") {
|
|
85
|
-
contentType = "multipart/form-data";
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
Array.from(formPairs).forEach(({ value }) => {
|
|
89
|
-
if (
|
|
90
|
-
value instanceof File ||
|
|
91
|
-
(Array.isArray(value) && value[0] instanceof File) ||
|
|
92
|
-
value instanceof FileList
|
|
93
|
-
) {
|
|
94
|
-
contentType = "multipart/form-data";
|
|
95
|
-
}
|
|
96
|
-
}); // TODO: send as urlEncoded or multipart by default
|
|
97
|
-
// because of ease of use and reliability in browser API
|
|
98
|
-
// for encoding the form?
|
|
99
|
-
|
|
100
|
-
if (contentType !== "application/json") {
|
|
101
|
-
body = formData;
|
|
102
|
-
} else {
|
|
103
|
-
// Json
|
|
104
|
-
const json = {};
|
|
105
|
-
Array.from(formPairs).forEach(({ value, key }) => {
|
|
106
|
-
set(json, key, value);
|
|
107
|
-
});
|
|
108
|
-
body = JSON.stringify(json);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (contentType && contentType !== "multipart/form-data") {
|
|
112
|
-
if (
|
|
113
|
-
/* Zapier doesn't allow content-type header to be sent from browsers */
|
|
114
|
-
!(sendWithJs && props.action?.includes("zapier.com"))
|
|
115
|
-
) {
|
|
116
|
-
headers["content-type"] = contentType;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const presubmitEvent = new CustomEvent("presubmit", {
|
|
121
|
-
detail: {
|
|
122
|
-
body,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (formRef) {
|
|
127
|
-
formRef.dispatchEvent(presubmitEvent);
|
|
128
|
-
|
|
129
|
-
if (presubmitEvent.defaultPrevented) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
state.formState = "sending";
|
|
135
|
-
const formUrl = `${
|
|
136
|
-
builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"
|
|
137
|
-
}/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(
|
|
138
|
-
props.sendSubmissionsToEmail || ""
|
|
139
|
-
)}&name=${encodeURIComponent(props.name || "")}`;
|
|
140
|
-
fetch(
|
|
141
|
-
props.sendSubmissionsTo === "email" ? formUrl : props.action!,
|
|
142
|
-
/* TODO: throw error if no action URL */
|
|
143
|
-
{
|
|
144
|
-
body,
|
|
145
|
-
headers,
|
|
146
|
-
method: props.method || "post",
|
|
147
|
-
}
|
|
148
|
-
).then(
|
|
149
|
-
async (res) => {
|
|
150
|
-
let body;
|
|
151
|
-
const contentType = res.headers.get("content-type");
|
|
152
|
-
|
|
153
|
-
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
154
|
-
body = await res.json();
|
|
155
|
-
} else {
|
|
156
|
-
body = await res.text();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (!res.ok && props.errorMessagePath) {
|
|
160
|
-
/* TODO: allow supplying an error formatter function */
|
|
161
|
-
let message = get(body, props.errorMessagePath);
|
|
162
|
-
|
|
163
|
-
if (message) {
|
|
164
|
-
if (typeof message !== "string") {
|
|
165
|
-
/* TODO: ideally convert json to yaml so it woul dbe like
|
|
166
|
-
error: - email has been taken */
|
|
167
|
-
message = JSON.stringify(message);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
state.formErrorMessage = message;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
state.responseData = body;
|
|
175
|
-
state.formState = res.ok ? "success" : "error";
|
|
176
|
-
|
|
177
|
-
if (res.ok) {
|
|
178
|
-
const submitSuccessEvent = new CustomEvent("submit:success", {
|
|
179
|
-
detail: {
|
|
180
|
-
res,
|
|
181
|
-
body,
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
if (formRef) {
|
|
186
|
-
formRef.dispatchEvent(submitSuccessEvent);
|
|
187
|
-
|
|
188
|
-
if (submitSuccessEvent.defaultPrevented) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
/* TODO: option to turn this on/off? */
|
|
192
|
-
|
|
193
|
-
if (props.resetFormOnSubmit !== false) {
|
|
194
|
-
formRef.reset();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/* TODO: client side route event first that can be preventDefaulted */
|
|
198
|
-
|
|
199
|
-
if (props.successUrl) {
|
|
200
|
-
if (formRef) {
|
|
201
|
-
const event = new CustomEvent("route", {
|
|
202
|
-
detail: {
|
|
203
|
-
url: props.successUrl,
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
formRef.dispatchEvent(event);
|
|
207
|
-
|
|
208
|
-
if (!event.defaultPrevented) {
|
|
209
|
-
location.href = props.successUrl;
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
location.href = props.successUrl;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
(err) => {
|
|
218
|
-
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
219
|
-
detail: {
|
|
220
|
-
error: err,
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
if (formRef) {
|
|
225
|
-
formRef.dispatchEvent(submitErrorEvent);
|
|
226
|
-
|
|
227
|
-
if (submitErrorEvent.defaultPrevented) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
state.responseData = err;
|
|
233
|
-
state.formState = "error";
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
const formRef = useRef();
|
|
241
|
-
|
|
242
|
-
return (
|
|
243
|
-
<form
|
|
244
|
-
{...props.attributes}
|
|
245
|
-
validate={props.validate}
|
|
246
|
-
ref={formRef}
|
|
247
|
-
action={!props.sendWithJs && props.action}
|
|
248
|
-
method={props.method}
|
|
249
|
-
name={props.name}
|
|
250
|
-
onSubmit={(event) => state.onSubmit(event)}
|
|
251
|
-
>
|
|
252
|
-
<Show when={props.builderBlock && props.builderBlock.children}>
|
|
253
|
-
<For each={props.builderBlock?.children}>
|
|
254
|
-
{(block, _index) => {
|
|
255
|
-
const index = _index();
|
|
256
|
-
return <RenderBlock block={block}></RenderBlock>;
|
|
257
|
-
}}
|
|
258
|
-
</For>
|
|
259
|
-
</Show>
|
|
260
|
-
<Show when={state.submissionState === "error"}>
|
|
261
|
-
<BuilderBlocks
|
|
262
|
-
dataPath="errorMessage"
|
|
263
|
-
blocks={props.errorMessage}
|
|
264
|
-
></BuilderBlocks>
|
|
265
|
-
</Show>
|
|
266
|
-
<Show when={state.submissionState === "sending"}>
|
|
267
|
-
<BuilderBlocks
|
|
268
|
-
dataPath="sendingMessage"
|
|
269
|
-
blocks={props.sendingMessage}
|
|
270
|
-
></BuilderBlocks>
|
|
271
|
-
</Show>
|
|
272
|
-
<Show when={state.submissionState === "error" && state.responseData}>
|
|
273
|
-
<pre
|
|
274
|
-
class={
|
|
275
|
-
"builder-form-error-text " +
|
|
276
|
-
css({
|
|
277
|
-
padding: "10px",
|
|
278
|
-
color: "red",
|
|
279
|
-
textAlign: "center",
|
|
280
|
-
})
|
|
281
|
-
}
|
|
282
|
-
>
|
|
283
|
-
{JSON.stringify(state.responseData, null, 2)}
|
|
284
|
-
</pre>
|
|
285
|
-
</Show>
|
|
286
|
-
<Show when={state.submissionState === "success"}>
|
|
287
|
-
<BuilderBlocks
|
|
288
|
-
dataPath="successMessage"
|
|
289
|
-
blocks={props.successMessage}
|
|
290
|
-
></BuilderBlocks>
|
|
291
|
-
</Show>
|
|
292
|
-
</form>
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
export default FormComponent;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { css } from "solid-styled-components";
|
|
4
|
-
|
|
5
|
-
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.className ? " " + props.className : "") +
|
|
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
|
-
role={props.altText ? "presentation" : undefined}
|
|
31
|
-
style={{
|
|
32
|
-
"object-position": props.backgroundSize || "center",
|
|
33
|
-
"object-fit": 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={
|
|
49
|
-
"builder-image-sizer " +
|
|
50
|
-
css({
|
|
51
|
-
width: "100%",
|
|
52
|
-
pointerEvents: "none",
|
|
53
|
-
fontSize: "0",
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
style={{
|
|
57
|
-
"padding-top": props.aspectRatio * 100 + "%",
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
{" "}
|
|
61
|
-
</div>
|
|
62
|
-
</Show>
|
|
63
|
-
<Show when={props.builderBlock?.children?.length && props.fitContent}>
|
|
64
|
-
{props.children}
|
|
65
|
-
</Show>
|
|
66
|
-
<Show when={!props.fitContent}>
|
|
67
|
-
<div
|
|
68
|
-
class={css({
|
|
69
|
-
display: "flex",
|
|
70
|
-
flexDirection: "column",
|
|
71
|
-
alignItems: "stretch",
|
|
72
|
-
position: "absolute",
|
|
73
|
-
top: "0",
|
|
74
|
-
left: "0",
|
|
75
|
-
width: "100%",
|
|
76
|
-
height: "100%",
|
|
77
|
-
})}
|
|
78
|
-
>
|
|
79
|
-
{props.children}
|
|
80
|
-
</div>
|
|
81
|
-
</Show>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export default Image;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
2
|
-
|
|
3
|
-
function ImgComponent(props) {
|
|
4
|
-
return (
|
|
5
|
-
<img
|
|
6
|
-
{...props.attributes}
|
|
7
|
-
style={{
|
|
8
|
-
"object-fit": props.backgroundSize || "cover",
|
|
9
|
-
"object-position": props.backgroundPosition || "center",
|
|
10
|
-
}}
|
|
11
|
-
key={(isEditing() && props.imgSrc) || "default-key"}
|
|
12
|
-
alt={props.altText}
|
|
13
|
-
src={props.imgSrc}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default ImgComponent;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
2
|
-
|
|
3
|
-
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
|
-
}
|
|
19
|
-
|
|
20
|
-
export default FormInputComponent;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function SectionComponent(props) {
|
|
2
|
-
return (
|
|
3
|
-
<section
|
|
4
|
-
{...props.attributes}
|
|
5
|
-
style={
|
|
6
|
-
props.maxWidth && typeof props.maxWidth === "number"
|
|
7
|
-
? {
|
|
8
|
-
"max-width": props.maxWidth,
|
|
9
|
-
}
|
|
10
|
-
: undefined
|
|
11
|
-
}
|
|
12
|
-
>
|
|
13
|
-
{props.children}
|
|
14
|
-
</section>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default SectionComponent;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { For } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
4
|
-
|
|
5
|
-
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
|
-
const index = _index();
|
|
19
|
-
return (
|
|
20
|
-
<option value={option.value}>{option.name || option.value}</option>
|
|
21
|
-
);
|
|
22
|
-
}}
|
|
23
|
-
</For>
|
|
24
|
-
</select>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default SelectComponent;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useContext, onMount } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { createMutable } from "solid-js/store";
|
|
4
|
-
|
|
5
|
-
import RenderContent from "../../components/render-content/render-content.lite";
|
|
6
|
-
import BuilderContext from "../../context/builder.context";
|
|
7
|
-
import { getContent } from "../../functions/get-content/index.js";
|
|
8
|
-
|
|
9
|
-
function Symbol(props) {
|
|
10
|
-
const state = createMutable({ className: "builder-symbol", content: null });
|
|
11
|
-
|
|
12
|
-
const builderContext = useContext(BuilderContext);
|
|
13
|
-
|
|
14
|
-
onMount(() => {
|
|
15
|
-
state.content = props.symbol?.content;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div
|
|
20
|
-
class={state.className}
|
|
21
|
-
{...props.attributes}
|
|
22
|
-
dataSet={{
|
|
23
|
-
class: state.className,
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
<RenderContent
|
|
27
|
-
apiKey={builderContext.apiKey}
|
|
28
|
-
context={builderContext.context}
|
|
29
|
-
data={{
|
|
30
|
-
...props.symbol?.data,
|
|
31
|
-
...builderContext.state,
|
|
32
|
-
...props.symbol?.content?.data?.state,
|
|
33
|
-
}}
|
|
34
|
-
model={props.symbol?.model}
|
|
35
|
-
content={state.content}
|
|
36
|
-
></RenderContent>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default Symbol;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
function Video(props) {
|
|
2
|
-
return (
|
|
3
|
-
<video
|
|
4
|
-
{...props.attributes}
|
|
5
|
-
preload="none"
|
|
6
|
-
style={{
|
|
7
|
-
width: "100%",
|
|
8
|
-
height: "100%",
|
|
9
|
-
...props.attributes?.style,
|
|
10
|
-
"object-fit": props.fit,
|
|
11
|
-
"object-position": props.position,
|
|
12
|
-
// Hack to get object fit to work as expected and
|
|
13
|
-
// not have the video overflow
|
|
14
|
-
"border-radius": 1,
|
|
15
|
-
}}
|
|
16
|
-
key={props.video || "no-src"}
|
|
17
|
-
poster={props.posterImage}
|
|
18
|
-
autoPlay={props.autoPlay}
|
|
19
|
-
muted={props.muted}
|
|
20
|
-
controls={props.controls}
|
|
21
|
-
loop={props.loop}
|
|
22
|
-
></video>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default Video;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createMutable } from "solid-js/store";
|
|
2
|
-
|
|
3
|
-
import RenderInlinedStyles from "../render-inlined-styles.lite";
|
|
4
|
-
|
|
5
|
-
function BlockStyles(props) {
|
|
6
|
-
const state = createMutable({
|
|
7
|
-
camelToKebabCase(string: string) {
|
|
8
|
-
return string
|
|
9
|
-
.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
|
|
10
|
-
.toLowerCase();
|
|
11
|
-
},
|
|
12
|
-
get css() {
|
|
13
|
-
// TODO: media queries
|
|
14
|
-
const styleObject = props.block.responsiveStyles?.large;
|
|
15
|
-
|
|
16
|
-
if (!styleObject) {
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let str = `.${props.block.id} {`;
|
|
21
|
-
|
|
22
|
-
for (const key in styleObject) {
|
|
23
|
-
const value = styleObject[key];
|
|
24
|
-
|
|
25
|
-
if (typeof value === "string") {
|
|
26
|
-
str += `${state.camelToKebabCase(key)}: ${value};`;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
str += "}";
|
|
31
|
-
return str;
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return <RenderInlinedStyles styles={state.css}></RenderInlinedStyles>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default BlockStyles;
|