@builder.io/sdk-react 0.5.9 → 0.6.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 +0 -4
- package/lib/browser/index.cjs +97 -0
- package/lib/browser/index.mjs +2598 -0
- package/lib/browser/server-entry-2e639417.js +2 -0
- package/lib/browser/server-entry-f7504f89.mjs +534 -0
- package/lib/browser/server-entry.cjs +1 -0
- package/lib/browser/server-entry.mjs +16 -0
- package/lib/edge/index.cjs +117 -0
- package/lib/edge/index.mjs +5042 -0
- package/lib/edge/server-entry-2e639417.js +2 -0
- package/lib/edge/server-entry-f7504f89.mjs +534 -0
- package/lib/edge/server-entry.cjs +1 -0
- package/lib/edge/server-entry.mjs +16 -0
- package/lib/node/index.cjs +97 -0
- package/lib/node/index.mjs +2598 -0
- package/lib/node/server-entry-2e639417.js +2 -0
- package/lib/node/server-entry-f7504f89.mjs +534 -0
- package/lib/node/server-entry.cjs +1 -0
- package/lib/node/server-entry.mjs +16 -0
- package/package.json +101 -11
- package/types/constants/sdk-version.d.ts +1 -0
- package/types/functions/deopt.d.ts +4 -0
- package/types/functions/evaluate/edge-runtime/edge-runtime.d.ts +2 -0
- package/types/functions/evaluate/edge-runtime/index.d.ts +1 -0
- package/types/functions/evaluate/placeholder-runtime.d.ts +2 -0
- package/{dist → types}/functions/fetch-builder-props.d.ts +2 -1
- package/{dist → types}/functions/get-content/index.d.ts +4 -5
- package/types/functions/is-edge-runtime.d.ts +4 -0
- package/{dist → types}/index-helpers/blocks-exports.d.ts +2 -2
- package/dist/blocks/BaseText.js +0 -9
- package/dist/blocks/button/button.js +0 -12
- package/dist/blocks/button/component-info.js +0 -34
- package/dist/blocks/columns/columns.js +0 -121
- package/dist/blocks/columns/component-info.js +0 -219
- package/dist/blocks/custom-code/component-info.js +0 -23
- package/dist/blocks/custom-code/custom-code.js +0 -51
- package/dist/blocks/embed/component-info.js +0 -39
- package/dist/blocks/embed/embed.js +0 -42
- package/dist/blocks/embed/helpers.js +0 -2
- package/dist/blocks/form/component-info.js +0 -232
- package/dist/blocks/form/form.js +0 -6
- package/dist/blocks/fragment/component-info.js +0 -7
- package/dist/blocks/fragment/fragment.js +0 -6
- package/dist/blocks/helpers.js +0 -40
- package/dist/blocks/image/component-info.js +0 -122
- package/dist/blocks/image/image.helpers.js +0 -47
- package/dist/blocks/image/image.js +0 -82
- package/dist/blocks/img/component-info.js +0 -15
- package/dist/blocks/img/img.js +0 -10
- package/dist/blocks/input/component-info.js +0 -46
- package/dist/blocks/input/input.js +0 -7
- package/dist/blocks/raw-text/component-info.js +0 -10
- package/dist/blocks/raw-text/raw-text.js +0 -6
- package/dist/blocks/section/component-info.js +0 -40
- package/dist/blocks/section/section.js +0 -17
- package/dist/blocks/select/component-info.js +0 -43
- package/dist/blocks/select/select.js +0 -7
- package/dist/blocks/submit-button/component-info.js +0 -26
- package/dist/blocks/submit-button/submit-button.js +0 -6
- package/dist/blocks/symbol/component-info.js +0 -34
- package/dist/blocks/symbol/symbol.helpers.js +0 -31
- package/dist/blocks/symbol/symbol.js +0 -45
- package/dist/blocks/text/component-info.js +0 -19
- package/dist/blocks/text/text.js +0 -8
- package/dist/blocks/textarea/component-info.js +0 -37
- package/dist/blocks/textarea/textarea.js +0 -6
- package/dist/blocks/video/component-info.js +0 -82
- package/dist/blocks/video/video.js +0 -50
- package/dist/components/block/block.helpers.js +0 -69
- package/dist/components/block/block.js +0 -94
- package/dist/components/block/components/block-styles.js +0 -65
- package/dist/components/block/components/block-wrapper.js +0 -36
- package/dist/components/block/components/component-ref/component-ref.helpers.js +0 -22
- package/dist/components/block/components/component-ref/component-ref.js +0 -23
- package/dist/components/block/components/interactive-element.js +0 -20
- package/dist/components/block/components/repeated-block.js +0 -11
- package/dist/components/block/types.js +0 -1
- package/dist/components/blocks/blocks-wrapper.js +0 -38
- package/dist/components/blocks/blocks.js +0 -17
- package/dist/components/content/components/enable-editor.js +0 -271
- package/dist/components/content/components/styles.helpers.js +0 -58
- package/dist/components/content/components/styles.js +0 -32
- package/dist/components/content/content.helpers.js +0 -30
- package/dist/components/content/content.js +0 -85
- package/dist/components/content/content.types.js +0 -1
- package/dist/components/content/index.js +0 -1
- package/dist/components/content/wrap-component-ref.js +0 -6
- package/dist/components/content-variants/content-variants.js +0 -52
- package/dist/components/content-variants/content-variants.types.js +0 -1
- package/dist/components/content-variants/helpers.js +0 -189
- package/dist/components/inlined-script.js +0 -6
- package/dist/components/inlined-styles.js +0 -6
- package/dist/constants/builder-registered-components.js +0 -60
- package/dist/constants/device-sizes.js +0 -45
- package/dist/constants/sdk-version.d.ts +0 -1
- package/dist/constants/sdk-version.js +0 -1
- package/dist/constants/target.js +0 -2
- package/dist/context/builder.context.js +0 -12
- package/dist/context/components.context.js +0 -2
- package/dist/context/types.js +0 -1
- package/dist/functions/apply-patch-with-mutation.js +0 -54
- package/dist/functions/camel-to-kebab-case.js +0 -1
- package/dist/functions/evaluate/browser-runtime/browser.js +0 -31
- package/dist/functions/evaluate/browser-runtime/index.js +0 -1
- package/dist/functions/evaluate/evaluate.js +0 -47
- package/dist/functions/evaluate/helpers.js +0 -10
- package/dist/functions/evaluate/index.js +0 -1
- package/dist/functions/evaluate/node-runtime/index.js +0 -1
- package/dist/functions/evaluate/non-node-runtime/acorn-interpreter.js +0 -3111
- package/dist/functions/evaluate/non-node-runtime/index.d.ts +0 -1
- package/dist/functions/evaluate/non-node-runtime/index.js +0 -2
- package/dist/functions/evaluate/non-node-runtime/non-node-runtime.d.ts +0 -2
- package/dist/functions/evaluate/non-node-runtime/non-node-runtime.js +0 -83
- package/dist/functions/event-handler-name.js +0 -4
- package/dist/functions/extract-text-styles.js +0 -22
- package/dist/functions/fast-clone.js +0 -4
- package/dist/functions/fetch-builder-props.js +0 -25
- package/dist/functions/get-block-actions-handler.js +0 -10
- package/dist/functions/get-block-actions.js +0 -28
- package/dist/functions/get-block-component-options.js +0 -10
- package/dist/functions/get-block-properties.js +0 -72
- package/dist/functions/get-builder-search-params/index.js +0 -38
- package/dist/functions/get-content/generate-content-url.js +0 -33
- package/dist/functions/get-content/index.js +0 -100
- package/dist/functions/get-content/types.js +0 -1
- package/dist/functions/get-fetch.js +0 -11
- package/dist/functions/get-global-this.js +0 -15
- package/dist/functions/get-processed-block.js +0 -46
- package/dist/functions/get-react-native-block-styles.js +0 -17
- package/dist/functions/is-browser.js +0 -3
- package/dist/functions/is-editing.js +0 -5
- package/dist/functions/is-iframe.js +0 -4
- package/dist/functions/is-non-node-server.d.ts +0 -4
- package/dist/functions/is-non-node-server.js +0 -8
- package/dist/functions/is-previewing.js +0 -11
- package/dist/functions/on-change.js +0 -28
- package/dist/functions/register-component.js +0 -38
- package/dist/functions/register.js +0 -27
- package/dist/functions/sanitize-react-native-block-styles.js +0 -61
- package/dist/functions/set-editor-settings.js +0 -12
- package/dist/functions/set.js +0 -14
- package/dist/functions/track/helpers.js +0 -51
- package/dist/functions/track/index.js +0 -71
- package/dist/functions/track/interaction.js +0 -53
- package/dist/functions/transform-block-properties.js +0 -5
- package/dist/functions/transform-block.js +0 -4
- package/dist/helpers/ab-tests.js +0 -122
- package/dist/helpers/canTrack.js +0 -2
- package/dist/helpers/cookie.js +0 -55
- package/dist/helpers/css.js +0 -27
- package/dist/helpers/flatten.js +0 -19
- package/dist/helpers/localStorage.js +0 -24
- package/dist/helpers/logger.js +0 -7
- package/dist/helpers/nullable.js +0 -1
- package/dist/helpers/preview-lru-cache/get.js +0 -3
- package/dist/helpers/preview-lru-cache/helpers.js +0 -0
- package/dist/helpers/preview-lru-cache/init.js +0 -6
- package/dist/helpers/preview-lru-cache/set.js +0 -5
- package/dist/helpers/preview-lru-cache/types.js +0 -0
- package/dist/helpers/sessionId.js +0 -30
- package/dist/helpers/time.js +0 -2
- package/dist/helpers/url.js +0 -15
- package/dist/helpers/uuid.js +0 -15
- package/dist/helpers/visitorId.js +0 -30
- package/dist/index-helpers/blocks-exports.js +0 -19
- package/dist/index-helpers/top-of-file.js +0 -4
- package/dist/index.js +0 -7
- package/dist/scripts/init-editing.js +0 -110
- package/dist/server-index.js +0 -10
- package/dist/types/api-version.js +0 -1
- package/dist/types/builder-block.js +0 -1
- package/dist/types/builder-content.js +0 -1
- package/dist/types/builder-props.js +0 -1
- package/dist/types/can-track.js +0 -1
- package/dist/types/components.js +0 -1
- package/dist/types/deep-partial.js +0 -1
- package/dist/types/element.js +0 -1
- package/dist/types/enforced-partials.js +0 -1
- package/dist/types/input.js +0 -1
- package/dist/types/targets.js +0 -1
- package/dist/types/typescript.js +0 -1
- /package/{dist → types}/blocks/BaseText.d.ts +0 -0
- /package/{dist → types}/blocks/button/button.d.ts +0 -0
- /package/{dist → types}/blocks/button/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/columns/columns.d.ts +0 -0
- /package/{dist → types}/blocks/columns/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/custom-code/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/custom-code/custom-code.d.ts +0 -0
- /package/{dist → types}/blocks/embed/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/embed/embed.d.ts +0 -0
- /package/{dist → types}/blocks/embed/helpers.d.ts +0 -0
- /package/{dist → types}/blocks/form/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/form/form.d.ts +0 -0
- /package/{dist → types}/blocks/fragment/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/fragment/fragment.d.ts +0 -0
- /package/{dist → types}/blocks/helpers.d.ts +0 -0
- /package/{dist → types}/blocks/image/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/image/image.d.ts +0 -0
- /package/{dist → types}/blocks/image/image.helpers.d.ts +0 -0
- /package/{dist → types}/blocks/img/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/img/img.d.ts +0 -0
- /package/{dist → types}/blocks/input/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/input/input.d.ts +0 -0
- /package/{dist → types}/blocks/raw-text/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/raw-text/raw-text.d.ts +0 -0
- /package/{dist → types}/blocks/section/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/section/section.d.ts +0 -0
- /package/{dist → types}/blocks/select/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/select/select.d.ts +0 -0
- /package/{dist → types}/blocks/submit-button/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/submit-button/submit-button.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/symbol.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/symbol.helpers.d.ts +0 -0
- /package/{dist → types}/blocks/text/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/text/text.d.ts +0 -0
- /package/{dist → types}/blocks/textarea/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/textarea/textarea.d.ts +0 -0
- /package/{dist → types}/blocks/video/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/video/video.d.ts +0 -0
- /package/{dist → types}/components/block/block.d.ts +0 -0
- /package/{dist → types}/components/block/block.helpers.d.ts +0 -0
- /package/{dist → types}/components/block/components/block-styles.d.ts +0 -0
- /package/{dist → types}/components/block/components/block-wrapper.d.ts +0 -0
- /package/{dist → types}/components/block/components/component-ref/component-ref.d.ts +0 -0
- /package/{dist → types}/components/block/components/component-ref/component-ref.helpers.d.ts +0 -0
- /package/{dist → types}/components/block/components/interactive-element.d.ts +0 -0
- /package/{dist → types}/components/block/components/repeated-block.d.ts +0 -0
- /package/{dist → types}/components/block/types.d.ts +0 -0
- /package/{dist → types}/components/blocks/blocks-wrapper.d.ts +0 -0
- /package/{dist → types}/components/blocks/blocks.d.ts +0 -0
- /package/{dist → types}/components/content/components/enable-editor.d.ts +0 -0
- /package/{dist → types}/components/content/components/styles.d.ts +0 -0
- /package/{dist → types}/components/content/components/styles.helpers.d.ts +0 -0
- /package/{dist → types}/components/content/content.d.ts +0 -0
- /package/{dist → types}/components/content/content.helpers.d.ts +0 -0
- /package/{dist → types}/components/content/content.types.d.ts +0 -0
- /package/{dist → types}/components/content/index.d.ts +0 -0
- /package/{dist → types}/components/content/wrap-component-ref.d.ts +0 -0
- /package/{dist → types}/components/content-variants/content-variants.d.ts +0 -0
- /package/{dist → types}/components/content-variants/content-variants.types.d.ts +0 -0
- /package/{dist → types}/components/content-variants/helpers.d.ts +0 -0
- /package/{dist → types}/components/inlined-script.d.ts +0 -0
- /package/{dist → types}/components/inlined-styles.d.ts +0 -0
- /package/{dist → types}/constants/builder-registered-components.d.ts +0 -0
- /package/{dist → types}/constants/device-sizes.d.ts +0 -0
- /package/{dist → types}/constants/target.d.ts +0 -0
- /package/{dist → types}/context/builder.context.d.ts +0 -0
- /package/{dist → types}/context/components.context.d.ts +0 -0
- /package/{dist → types}/context/types.d.ts +0 -0
- /package/{dist → types}/functions/apply-patch-with-mutation.d.ts +0 -0
- /package/{dist → types}/functions/camel-to-kebab-case.d.ts +0 -0
- /package/{dist → types}/functions/evaluate/browser-runtime/browser.d.ts +0 -0
- /package/{dist → types}/functions/evaluate/browser-runtime/index.d.ts +0 -0
- /package/{dist/functions/evaluate/non-node-runtime → types/functions/evaluate/edge-runtime}/acorn-interpreter.d.ts +0 -0
- /package/{dist → types}/functions/evaluate/evaluate.d.ts +0 -0
- /package/{dist → types}/functions/evaluate/helpers.d.ts +0 -0
- /package/{dist → types}/functions/evaluate/index.d.ts +0 -0
- /package/{dist → types}/functions/evaluate/node-runtime/index.d.ts +0 -0
- /package/{dist → types}/functions/event-handler-name.d.ts +0 -0
- /package/{dist → types}/functions/extract-text-styles.d.ts +0 -0
- /package/{dist → types}/functions/fast-clone.d.ts +0 -0
- /package/{dist → types}/functions/get-block-actions-handler.d.ts +0 -0
- /package/{dist → types}/functions/get-block-actions.d.ts +0 -0
- /package/{dist → types}/functions/get-block-component-options.d.ts +0 -0
- /package/{dist → types}/functions/get-block-properties.d.ts +0 -0
- /package/{dist → types}/functions/get-builder-search-params/index.d.ts +0 -0
- /package/{dist → types}/functions/get-content/generate-content-url.d.ts +0 -0
- /package/{dist → types}/functions/get-content/types.d.ts +0 -0
- /package/{dist → types}/functions/get-fetch.d.ts +0 -0
- /package/{dist → types}/functions/get-global-this.d.ts +0 -0
- /package/{dist → types}/functions/get-processed-block.d.ts +0 -0
- /package/{dist → types}/functions/get-react-native-block-styles.d.ts +0 -0
- /package/{dist → types}/functions/is-browser.d.ts +0 -0
- /package/{dist → types}/functions/is-editing.d.ts +0 -0
- /package/{dist → types}/functions/is-iframe.d.ts +0 -0
- /package/{dist → types}/functions/is-previewing.d.ts +0 -0
- /package/{dist → types}/functions/on-change.d.ts +0 -0
- /package/{dist → types}/functions/register-component.d.ts +0 -0
- /package/{dist → types}/functions/register.d.ts +0 -0
- /package/{dist → types}/functions/sanitize-react-native-block-styles.d.ts +0 -0
- /package/{dist → types}/functions/set-editor-settings.d.ts +0 -0
- /package/{dist → types}/functions/set.d.ts +0 -0
- /package/{dist → types}/functions/track/helpers.d.ts +0 -0
- /package/{dist → types}/functions/track/index.d.ts +0 -0
- /package/{dist → types}/functions/track/interaction.d.ts +0 -0
- /package/{dist → types}/functions/transform-block-properties.d.ts +0 -0
- /package/{dist → types}/functions/transform-block.d.ts +0 -0
- /package/{dist → types}/helpers/ab-tests.d.ts +0 -0
- /package/{dist → types}/helpers/canTrack.d.ts +0 -0
- /package/{dist → types}/helpers/cookie.d.ts +0 -0
- /package/{dist → types}/helpers/css.d.ts +0 -0
- /package/{dist → types}/helpers/flatten.d.ts +0 -0
- /package/{dist → types}/helpers/localStorage.d.ts +0 -0
- /package/{dist → types}/helpers/logger.d.ts +0 -0
- /package/{dist → types}/helpers/nullable.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/get.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/helpers.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/init.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/set.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/types.d.ts +0 -0
- /package/{dist → types}/helpers/sessionId.d.ts +0 -0
- /package/{dist → types}/helpers/time.d.ts +0 -0
- /package/{dist → types}/helpers/url.d.ts +0 -0
- /package/{dist → types}/helpers/uuid.d.ts +0 -0
- /package/{dist → types}/helpers/visitorId.d.ts +0 -0
- /package/{dist → types}/index-helpers/top-of-file.d.ts +0 -0
- /package/{dist → types}/index.d.ts +0 -0
- /package/{dist → types}/scripts/init-editing.d.ts +0 -0
- /package/{dist → types}/server-index.d.ts +0 -0
- /package/{dist → types}/types/api-version.d.ts +0 -0
- /package/{dist → types}/types/builder-block.d.ts +0 -0
- /package/{dist → types}/types/builder-content.d.ts +0 -0
- /package/{dist → types}/types/builder-props.d.ts +0 -0
- /package/{dist → types}/types/can-track.d.ts +0 -0
- /package/{dist → types}/types/components.d.ts +0 -0
- /package/{dist → types}/types/deep-partial.d.ts +0 -0
- /package/{dist → types}/types/element.d.ts +0 -0
- /package/{dist → types}/types/enforced-partials.d.ts +0 -0
- /package/{dist → types}/types/input.d.ts +0 -0
- /package/{dist → types}/types/targets.d.ts +0 -0
- /package/{dist → types}/types/typescript.d.ts +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { getSrcSet } from "./image.helpers.js";
|
|
4
|
-
function Image(props) {
|
|
5
|
-
function srcSetToUse() {
|
|
6
|
-
const imageToUse = props.image || props.src;
|
|
7
|
-
const url = imageToUse;
|
|
8
|
-
if (!url ||
|
|
9
|
-
// We can auto add srcset for cdn.builder.io and shopify
|
|
10
|
-
// images, otherwise you can supply this prop manually
|
|
11
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
12
|
-
return props.srcset;
|
|
13
|
-
}
|
|
14
|
-
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
15
|
-
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
16
|
-
console.debug("Removed given srcset");
|
|
17
|
-
return getSrcSet(url);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else if (props.image && !props.srcset) {
|
|
21
|
-
return getSrcSet(url);
|
|
22
|
-
}
|
|
23
|
-
return getSrcSet(url);
|
|
24
|
-
}
|
|
25
|
-
function webpSrcSet() {
|
|
26
|
-
if (srcSetToUse?.()?.match(/builder\.io/) && !props.noWebp) {
|
|
27
|
-
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return "";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function aspectRatioCss() {
|
|
34
|
-
const aspectRatioStyles = {
|
|
35
|
-
position: "absolute",
|
|
36
|
-
height: "100%",
|
|
37
|
-
width: "100%",
|
|
38
|
-
left: "0px",
|
|
39
|
-
top: "0px",
|
|
40
|
-
};
|
|
41
|
-
const out = props.aspectRatio ? aspectRatioStyles : undefined;
|
|
42
|
-
return out;
|
|
43
|
-
}
|
|
44
|
-
return (React.createElement(React.Fragment, null,
|
|
45
|
-
React.createElement(React.Fragment, null,
|
|
46
|
-
React.createElement("picture", null,
|
|
47
|
-
webpSrcSet() ? (React.createElement(React.Fragment, null,
|
|
48
|
-
React.createElement("source", { type: "image/webp", srcSet: webpSrcSet() }))) : null,
|
|
49
|
-
React.createElement("img", { loading: "lazy", alt: props.altText, role: props.altText ? "presentation" : undefined, style: {
|
|
50
|
-
objectPosition: props.backgroundPosition || "center",
|
|
51
|
-
objectFit: props.backgroundSize || "cover",
|
|
52
|
-
...aspectRatioCss(),
|
|
53
|
-
}, className: "builder-image" +
|
|
54
|
-
(props.className ? " " + props.className : "") +
|
|
55
|
-
" img-ef11a6be", src: props.image, srcSet: srcSetToUse(), sizes: props.sizes })),
|
|
56
|
-
props.aspectRatio &&
|
|
57
|
-
!(props.builderBlock?.children?.length && props.fitContent) ? (React.createElement(React.Fragment, null,
|
|
58
|
-
React.createElement("div", { className: "builder-image-sizer div-ef11a6be", style: {
|
|
59
|
-
paddingTop: props.aspectRatio * 100 + "%",
|
|
60
|
-
} }))) : null,
|
|
61
|
-
props.builderBlock?.children?.length && props.fitContent ? (React.createElement(React.Fragment, null, props.children)) : null,
|
|
62
|
-
!props.fitContent && props.children ? (React.createElement(React.Fragment, null,
|
|
63
|
-
React.createElement("div", { className: "div-ef11a6be-2" }, props.children))) : null),
|
|
64
|
-
React.createElement("style", null, `.img-ef11a6be {
|
|
65
|
-
opacity: 1;
|
|
66
|
-
transition: opacity 0.2s ease-in-out;
|
|
67
|
-
}.div-ef11a6be {
|
|
68
|
-
width: 100%;
|
|
69
|
-
pointer-events: none;
|
|
70
|
-
font-size: 0;
|
|
71
|
-
}.div-ef11a6be-2 {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
align-items: stretch;
|
|
75
|
-
position: absolute;
|
|
76
|
-
top: 0;
|
|
77
|
-
left: 0;
|
|
78
|
-
width: 100%;
|
|
79
|
-
height: 100%;
|
|
80
|
-
}`)));
|
|
81
|
-
}
|
|
82
|
-
export default Image;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
// friendlyName?
|
|
3
|
-
name: 'Raw:Img',
|
|
4
|
-
hideFromInsertMenu: true,
|
|
5
|
-
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',
|
|
6
|
-
inputs: [{
|
|
7
|
-
name: 'image',
|
|
8
|
-
bubble: true,
|
|
9
|
-
type: 'file',
|
|
10
|
-
allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'gif', 'webp'],
|
|
11
|
-
required: true
|
|
12
|
-
}],
|
|
13
|
-
noWrap: true,
|
|
14
|
-
static: true
|
|
15
|
-
};
|
package/dist/blocks/img/img.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
4
|
-
function ImgComponent(props) {
|
|
5
|
-
return (React.createElement("img", { style: {
|
|
6
|
-
objectFit: props.backgroundSize || "cover",
|
|
7
|
-
objectPosition: props.backgroundPosition || "center",
|
|
8
|
-
}, key: (isEditing() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...{}, ...props.attributes }));
|
|
9
|
-
}
|
|
10
|
-
export default ImgComponent;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Form:Input',
|
|
3
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',
|
|
4
|
-
inputs: [{
|
|
5
|
-
name: 'type',
|
|
6
|
-
type: 'text',
|
|
7
|
-
enum: ['text', 'number', 'email', 'url', 'checkbox', 'radio', 'range', 'date', 'datetime-local', 'search', 'tel', 'time', 'file', 'month', 'week', 'password', 'color', 'hidden'],
|
|
8
|
-
defaultValue: 'text'
|
|
9
|
-
}, {
|
|
10
|
-
name: 'name',
|
|
11
|
-
type: 'string',
|
|
12
|
-
required: true,
|
|
13
|
-
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
14
|
-
}, {
|
|
15
|
-
name: 'placeholder',
|
|
16
|
-
type: 'string',
|
|
17
|
-
defaultValue: 'Hello there',
|
|
18
|
-
helperText: 'Text to display when there is no value'
|
|
19
|
-
},
|
|
20
|
-
// TODO: handle value vs default value automatically like ng-model
|
|
21
|
-
{
|
|
22
|
-
name: 'defaultValue',
|
|
23
|
-
type: 'string'
|
|
24
|
-
}, {
|
|
25
|
-
name: 'value',
|
|
26
|
-
type: 'string',
|
|
27
|
-
advanced: true
|
|
28
|
-
}, {
|
|
29
|
-
name: 'required',
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
helperText: 'Is this input required to be filled out to submit a form',
|
|
32
|
-
defaultValue: false
|
|
33
|
-
}],
|
|
34
|
-
noWrap: true,
|
|
35
|
-
static: true,
|
|
36
|
-
defaultStyles: {
|
|
37
|
-
paddingTop: '10px',
|
|
38
|
-
paddingBottom: '10px',
|
|
39
|
-
paddingLeft: '10px',
|
|
40
|
-
paddingRight: '10px',
|
|
41
|
-
borderRadius: '3px',
|
|
42
|
-
borderWidth: '1px',
|
|
43
|
-
borderStyle: 'solid',
|
|
44
|
-
borderColor: '#ccc'
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
4
|
-
function FormInputComponent(props) {
|
|
5
|
-
return (React.createElement("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 }));
|
|
6
|
-
}
|
|
7
|
-
export default FormInputComponent;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Core:Section',
|
|
3
|
-
static: true,
|
|
4
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a',
|
|
5
|
-
inputs: [{
|
|
6
|
-
name: 'maxWidth',
|
|
7
|
-
type: 'number',
|
|
8
|
-
defaultValue: 1200
|
|
9
|
-
}, {
|
|
10
|
-
name: 'lazyLoad',
|
|
11
|
-
type: 'boolean',
|
|
12
|
-
defaultValue: false,
|
|
13
|
-
advanced: true,
|
|
14
|
-
description: 'Only render this section when in view'
|
|
15
|
-
}],
|
|
16
|
-
defaultStyles: {
|
|
17
|
-
paddingLeft: '20px',
|
|
18
|
-
paddingRight: '20px',
|
|
19
|
-
paddingTop: '50px',
|
|
20
|
-
paddingBottom: '50px',
|
|
21
|
-
marginTop: '0px',
|
|
22
|
-
width: '100vw',
|
|
23
|
-
marginLeft: 'calc(50% - 50vw)'
|
|
24
|
-
},
|
|
25
|
-
canHaveChildren: true,
|
|
26
|
-
defaultChildren: [{
|
|
27
|
-
'@type': '@builder.io/sdk:Element',
|
|
28
|
-
responsiveStyles: {
|
|
29
|
-
large: {
|
|
30
|
-
textAlign: 'center'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
component: {
|
|
34
|
-
name: 'Text',
|
|
35
|
-
options: {
|
|
36
|
-
text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}]
|
|
40
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
function SectionComponent(props) {
|
|
4
|
-
return (React.createElement("section", { ...{}, ...props.attributes, style: {
|
|
5
|
-
width: "100%",
|
|
6
|
-
alignSelf: "stretch",
|
|
7
|
-
flexGrow: 1,
|
|
8
|
-
boxSizing: "border-box",
|
|
9
|
-
maxWidth: props.maxWidth || 1200,
|
|
10
|
-
display: "flex",
|
|
11
|
-
flexDirection: "column",
|
|
12
|
-
alignItems: "stretch",
|
|
13
|
-
marginLeft: "auto",
|
|
14
|
-
marginRight: "auto",
|
|
15
|
-
} }, props.children));
|
|
16
|
-
}
|
|
17
|
-
export default SectionComponent;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Form:Select',
|
|
3
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',
|
|
4
|
-
defaultStyles: {
|
|
5
|
-
alignSelf: 'flex-start'
|
|
6
|
-
},
|
|
7
|
-
inputs: [{
|
|
8
|
-
name: 'options',
|
|
9
|
-
type: 'list',
|
|
10
|
-
required: true,
|
|
11
|
-
subFields: [{
|
|
12
|
-
name: 'value',
|
|
13
|
-
type: 'text',
|
|
14
|
-
required: true
|
|
15
|
-
}, {
|
|
16
|
-
name: 'name',
|
|
17
|
-
type: 'text'
|
|
18
|
-
}],
|
|
19
|
-
defaultValue: [{
|
|
20
|
-
value: 'option 1'
|
|
21
|
-
}, {
|
|
22
|
-
value: 'option 2'
|
|
23
|
-
}]
|
|
24
|
-
}, {
|
|
25
|
-
name: 'name',
|
|
26
|
-
type: 'string',
|
|
27
|
-
required: true,
|
|
28
|
-
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
29
|
-
}, {
|
|
30
|
-
name: 'defaultValue',
|
|
31
|
-
type: 'string'
|
|
32
|
-
}, {
|
|
33
|
-
name: 'value',
|
|
34
|
-
type: 'string',
|
|
35
|
-
advanced: true
|
|
36
|
-
}, {
|
|
37
|
-
name: 'required',
|
|
38
|
-
type: 'boolean',
|
|
39
|
-
defaultValue: false
|
|
40
|
-
}],
|
|
41
|
-
static: true,
|
|
42
|
-
noWrap: true
|
|
43
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
4
|
-
function SelectComponent(props) {
|
|
5
|
-
return (React.createElement("select", { ...{}, ...props.attributes, value: props.value, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, props.options?.map((option) => (React.createElement("option", { value: option.value }, option.name || option.value)))));
|
|
6
|
-
}
|
|
7
|
-
export default SelectComponent;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Form:SubmitButton',
|
|
3
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98',
|
|
4
|
-
defaultStyles: {
|
|
5
|
-
appearance: 'none',
|
|
6
|
-
paddingTop: '15px',
|
|
7
|
-
paddingBottom: '15px',
|
|
8
|
-
paddingLeft: '25px',
|
|
9
|
-
paddingRight: '25px',
|
|
10
|
-
backgroundColor: '#3898EC',
|
|
11
|
-
color: 'white',
|
|
12
|
-
borderRadius: '4px',
|
|
13
|
-
cursor: 'pointer'
|
|
14
|
-
},
|
|
15
|
-
inputs: [{
|
|
16
|
-
name: 'text',
|
|
17
|
-
type: 'text',
|
|
18
|
-
defaultValue: 'Click me'
|
|
19
|
-
}],
|
|
20
|
-
static: true,
|
|
21
|
-
noWrap: true
|
|
22
|
-
// TODO: optional children? maybe as optional form input
|
|
23
|
-
// that only shows if advanced setting is flipped
|
|
24
|
-
// TODO: defaultChildren
|
|
25
|
-
// canHaveChildren: true,
|
|
26
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Symbol',
|
|
3
|
-
noWrap: true,
|
|
4
|
-
static: true,
|
|
5
|
-
isRSC: true,
|
|
6
|
-
inputs: [{
|
|
7
|
-
name: 'symbol',
|
|
8
|
-
type: 'uiSymbol'
|
|
9
|
-
}, {
|
|
10
|
-
name: 'dataOnly',
|
|
11
|
-
helperText: "Make this a data symbol that doesn't display any UI",
|
|
12
|
-
type: 'boolean',
|
|
13
|
-
defaultValue: false,
|
|
14
|
-
advanced: true,
|
|
15
|
-
hideFromUI: true
|
|
16
|
-
}, {
|
|
17
|
-
name: 'inheritState',
|
|
18
|
-
helperText: 'Inherit the parent component state and data',
|
|
19
|
-
type: 'boolean',
|
|
20
|
-
defaultValue: false,
|
|
21
|
-
advanced: true
|
|
22
|
-
}, {
|
|
23
|
-
name: 'renderToLiquid',
|
|
24
|
-
helperText: 'Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting',
|
|
25
|
-
type: 'boolean',
|
|
26
|
-
defaultValue: false,
|
|
27
|
-
advanced: true,
|
|
28
|
-
hideFromUI: true
|
|
29
|
-
}, {
|
|
30
|
-
name: 'useChildren',
|
|
31
|
-
hideFromUI: true,
|
|
32
|
-
type: 'boolean'
|
|
33
|
-
}]
|
|
34
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { logger } from '../../helpers/logger.js';
|
|
2
|
-
import { fetchOneEntry } from '../../index.js';
|
|
3
|
-
export const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
|
|
4
|
-
/**
|
|
5
|
-
* If:
|
|
6
|
-
* - we have a symbol prop
|
|
7
|
-
* - yet it does not have any content
|
|
8
|
-
* - and we have not already stored content from before
|
|
9
|
-
* - and it has a model name
|
|
10
|
-
*
|
|
11
|
-
* then we want to re-fetch the symbol content.
|
|
12
|
-
*/
|
|
13
|
-
if (symbol?.model &&
|
|
14
|
-
// This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
15
|
-
builderContextValue?.apiKey) {
|
|
16
|
-
return fetchOneEntry({
|
|
17
|
-
model: symbol.model,
|
|
18
|
-
apiKey: builderContextValue.apiKey,
|
|
19
|
-
apiVersion: builderContextValue.apiVersion,
|
|
20
|
-
...(symbol?.entry && {
|
|
21
|
-
query: {
|
|
22
|
-
id: symbol.entry
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
}).catch(err => {
|
|
26
|
-
logger.error('Could not fetch symbol content: ', err);
|
|
27
|
-
return undefined;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return undefined;
|
|
31
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import ContentVariants from "../../components/content-variants/content-variants";
|
|
5
|
-
import { fetchSymbolContent } from "./symbol.helpers.js";
|
|
6
|
-
function Symbol(props) {
|
|
7
|
-
function className() {
|
|
8
|
-
return [
|
|
9
|
-
...[props.attributes.className],
|
|
10
|
-
"builder-symbol",
|
|
11
|
-
props.symbol?.inline ? "builder-inline-symbol" : undefined,
|
|
12
|
-
props.symbol?.dynamic || props.dynamic
|
|
13
|
-
? "builder-dynamic-symbol"
|
|
14
|
-
: undefined,
|
|
15
|
-
]
|
|
16
|
-
.filter(Boolean)
|
|
17
|
-
.join(" ");
|
|
18
|
-
}
|
|
19
|
-
const [contentToUse, setContentToUse] = useState(() => props.symbol?.content);
|
|
20
|
-
function setContent() {
|
|
21
|
-
if (contentToUse)
|
|
22
|
-
return;
|
|
23
|
-
fetchSymbolContent({
|
|
24
|
-
symbol: props.symbol,
|
|
25
|
-
builderContextValue: props.builderContext,
|
|
26
|
-
}).then((newContent) => {
|
|
27
|
-
if (newContent) {
|
|
28
|
-
setContentToUse(newContent);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
setContent();
|
|
34
|
-
}, []);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
setContent();
|
|
37
|
-
}, [props.symbol]);
|
|
38
|
-
return (React.createElement("div", { ...{}, ...props.attributes, ...{}, className: className() },
|
|
39
|
-
React.createElement(ContentVariants, { __isNestedRender: true, apiVersion: props.builderContext.apiVersion, apiKey: props.builderContext.apiKey, context: props.builderContext.context, customComponents: Object.values(props.builderComponents), data: {
|
|
40
|
-
...props.symbol?.data,
|
|
41
|
-
...props.builderContext.localState,
|
|
42
|
-
...contentToUse?.data?.state,
|
|
43
|
-
}, model: props.symbol?.model, content: contentToUse })));
|
|
44
|
-
}
|
|
45
|
-
export default Symbol;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Text',
|
|
3
|
-
static: true,
|
|
4
|
-
isRSC: true,
|
|
5
|
-
image: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929',
|
|
6
|
-
inputs: [{
|
|
7
|
-
name: 'text',
|
|
8
|
-
type: 'html',
|
|
9
|
-
required: true,
|
|
10
|
-
autoFocus: true,
|
|
11
|
-
bubble: true,
|
|
12
|
-
defaultValue: 'Enter some text...'
|
|
13
|
-
}],
|
|
14
|
-
defaultStyles: {
|
|
15
|
-
lineHeight: 'normal',
|
|
16
|
-
height: 'auto',
|
|
17
|
-
textAlign: 'center'
|
|
18
|
-
}
|
|
19
|
-
};
|
package/dist/blocks/text/text.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
function Text(props) {
|
|
4
|
-
return (React.createElement("span", { className: "builder-text", dangerouslySetInnerHTML: { __html: props.text?.toString() || "" }, style: {
|
|
5
|
-
outline: "none",
|
|
6
|
-
}, ...{} }));
|
|
7
|
-
}
|
|
8
|
-
export default Text;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Form:TextArea',
|
|
3
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3',
|
|
4
|
-
inputs: [{
|
|
5
|
-
advanced: true,
|
|
6
|
-
name: 'value',
|
|
7
|
-
type: 'string'
|
|
8
|
-
}, {
|
|
9
|
-
name: 'name',
|
|
10
|
-
type: 'string',
|
|
11
|
-
required: true,
|
|
12
|
-
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
13
|
-
}, {
|
|
14
|
-
name: 'defaultValue',
|
|
15
|
-
type: 'string'
|
|
16
|
-
}, {
|
|
17
|
-
name: 'placeholder',
|
|
18
|
-
type: 'string',
|
|
19
|
-
defaultValue: 'Hello there'
|
|
20
|
-
}, {
|
|
21
|
-
name: 'required',
|
|
22
|
-
type: 'boolean',
|
|
23
|
-
defaultValue: false
|
|
24
|
-
}],
|
|
25
|
-
defaultStyles: {
|
|
26
|
-
paddingTop: '10px',
|
|
27
|
-
paddingBottom: '10px',
|
|
28
|
-
paddingLeft: '10px',
|
|
29
|
-
paddingRight: '10px',
|
|
30
|
-
borderRadius: '3px',
|
|
31
|
-
borderWidth: '1px',
|
|
32
|
-
borderStyle: 'solid',
|
|
33
|
-
borderColor: '#ccc'
|
|
34
|
-
},
|
|
35
|
-
static: true,
|
|
36
|
-
noWrap: true
|
|
37
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
function Textarea(props) {
|
|
4
|
-
return (React.createElement("textarea", { ...{}, ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
5
|
-
}
|
|
6
|
-
export default Textarea;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Video',
|
|
3
|
-
canHaveChildren: true,
|
|
4
|
-
defaultStyles: {
|
|
5
|
-
minHeight: '20px',
|
|
6
|
-
minWidth: '20px'
|
|
7
|
-
},
|
|
8
|
-
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',
|
|
9
|
-
inputs: [{
|
|
10
|
-
name: 'video',
|
|
11
|
-
type: 'file',
|
|
12
|
-
allowedFileTypes: ['mp4'],
|
|
13
|
-
bubble: true,
|
|
14
|
-
defaultValue: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',
|
|
15
|
-
required: true
|
|
16
|
-
}, {
|
|
17
|
-
name: 'posterImage',
|
|
18
|
-
type: 'file',
|
|
19
|
-
allowedFileTypes: ['jpeg', 'png'],
|
|
20
|
-
helperText: 'Image to show before the video plays'
|
|
21
|
-
}, {
|
|
22
|
-
name: 'autoPlay',
|
|
23
|
-
type: 'boolean',
|
|
24
|
-
defaultValue: true
|
|
25
|
-
}, {
|
|
26
|
-
name: 'controls',
|
|
27
|
-
type: 'boolean',
|
|
28
|
-
defaultValue: false
|
|
29
|
-
}, {
|
|
30
|
-
name: 'muted',
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
defaultValue: true
|
|
33
|
-
}, {
|
|
34
|
-
name: 'loop',
|
|
35
|
-
type: 'boolean',
|
|
36
|
-
defaultValue: true
|
|
37
|
-
}, {
|
|
38
|
-
name: 'playsInline',
|
|
39
|
-
type: 'boolean',
|
|
40
|
-
defaultValue: true
|
|
41
|
-
}, {
|
|
42
|
-
name: 'fit',
|
|
43
|
-
type: 'text',
|
|
44
|
-
defaultValue: 'cover',
|
|
45
|
-
enum: ['contain', 'cover', 'fill', 'auto']
|
|
46
|
-
}, {
|
|
47
|
-
name: 'preload',
|
|
48
|
-
type: 'text',
|
|
49
|
-
defaultValue: 'metadata',
|
|
50
|
-
enum: ['auto', 'metadata', 'none']
|
|
51
|
-
}, {
|
|
52
|
-
name: 'fitContent',
|
|
53
|
-
type: 'boolean',
|
|
54
|
-
helperText: 'When child blocks are provided, fit to them instead of using the aspect ratio',
|
|
55
|
-
defaultValue: true,
|
|
56
|
-
advanced: true
|
|
57
|
-
}, {
|
|
58
|
-
name: 'position',
|
|
59
|
-
type: 'text',
|
|
60
|
-
defaultValue: 'center',
|
|
61
|
-
enum: ['center', 'top', 'left', 'right', 'bottom', 'top left', 'top right', 'bottom left', 'bottom right']
|
|
62
|
-
}, {
|
|
63
|
-
name: 'height',
|
|
64
|
-
type: 'number',
|
|
65
|
-
advanced: true
|
|
66
|
-
}, {
|
|
67
|
-
name: 'width',
|
|
68
|
-
type: 'number',
|
|
69
|
-
advanced: true
|
|
70
|
-
}, {
|
|
71
|
-
name: 'aspectRatio',
|
|
72
|
-
type: 'number',
|
|
73
|
-
advanced: true,
|
|
74
|
-
defaultValue: 0.7004048582995948
|
|
75
|
-
}, {
|
|
76
|
-
name: 'lazyLoad',
|
|
77
|
-
type: 'boolean',
|
|
78
|
-
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
79
|
-
defaultValue: true,
|
|
80
|
-
advanced: true
|
|
81
|
-
}]
|
|
82
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
function Video(props) {
|
|
4
|
-
function videoProps() {
|
|
5
|
-
return {
|
|
6
|
-
...(props.autoPlay === true
|
|
7
|
-
? {
|
|
8
|
-
autoPlay: true,
|
|
9
|
-
}
|
|
10
|
-
: {}),
|
|
11
|
-
...(props.muted === true
|
|
12
|
-
? {
|
|
13
|
-
muted: true,
|
|
14
|
-
}
|
|
15
|
-
: {}),
|
|
16
|
-
...(props.controls === true
|
|
17
|
-
? {
|
|
18
|
-
controls: true,
|
|
19
|
-
}
|
|
20
|
-
: {}),
|
|
21
|
-
...(props.loop === true
|
|
22
|
-
? {
|
|
23
|
-
loop: true,
|
|
24
|
-
}
|
|
25
|
-
: {}),
|
|
26
|
-
...(props.playsInline === true
|
|
27
|
-
? {
|
|
28
|
-
playsInline: true,
|
|
29
|
-
}
|
|
30
|
-
: {}),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function spreadProps() {
|
|
34
|
-
return {
|
|
35
|
-
...props.attributes,
|
|
36
|
-
...videoProps(),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return (React.createElement("video", { ...spreadProps(), preload: props.preload || "metadata", style: {
|
|
40
|
-
width: "100%",
|
|
41
|
-
height: "100%",
|
|
42
|
-
...props.attributes?.style,
|
|
43
|
-
objectFit: props.fit,
|
|
44
|
-
objectPosition: props.position,
|
|
45
|
-
// Hack to get object fit to work as expected and
|
|
46
|
-
// not have the video overflow
|
|
47
|
-
borderRadius: 1,
|
|
48
|
-
}, src: props.video || "no-src", poster: props.posterImage }));
|
|
49
|
-
}
|
|
50
|
-
export default Video;
|