@builder.io/sdk-react-nextjs 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/lib/browser/USE_CLIENT_BUNDLE-12f42430.js +23 -0
- package/lib/browser/USE_CLIENT_BUNDLE-a8b60f05.mjs +664 -0
- package/lib/browser/USE_SERVER_BUNDLE-9abdf89a.js +1 -0
- package/lib/browser/USE_SERVER_BUNDLE-df74a63e.mjs +11 -0
- package/lib/browser/bundle-0ec2f27e.js +76 -0
- package/lib/browser/bundle-474f2dd7.mjs +2419 -0
- package/lib/browser/index.cjs +1 -0
- package/lib/browser/index.mjs +34 -0
- package/lib/edge/USE_CLIENT_BUNDLE-71a5598d.mjs +664 -0
- package/lib/edge/USE_CLIENT_BUNDLE-ec253910.js +23 -0
- package/lib/edge/USE_SERVER_BUNDLE-7cbf6eb1.js +1 -0
- package/lib/edge/USE_SERVER_BUNDLE-fdc79a6a.mjs +11 -0
- package/lib/edge/bundle-5d80175b.js +96 -0
- package/lib/edge/bundle-9492bb4e.mjs +4863 -0
- package/lib/edge/index.cjs +1 -0
- package/lib/edge/index.mjs +34 -0
- package/lib/node/USE_CLIENT_BUNDLE-12f42430.js +23 -0
- package/lib/node/USE_CLIENT_BUNDLE-a8b60f05.mjs +664 -0
- package/lib/node/USE_SERVER_BUNDLE-9abdf89a.js +1 -0
- package/lib/node/USE_SERVER_BUNDLE-df74a63e.mjs +11 -0
- package/lib/node/bundle-0ec2f27e.js +76 -0
- package/lib/node/bundle-474f2dd7.mjs +2419 -0
- package/lib/node/index.cjs +1 -0
- package/lib/node/index.mjs +34 -0
- package/package.json +100 -13
- package/types/constants/sdk-version.d.ts +1 -0
- package/types/functions/deopt.d.ts +4 -0
- package/types/functions/evaluate/browser-runtime/index.d.ts +1 -0
- package/{dist → types}/functions/fetch-builder-props.d.ts +2 -1
- package/{dist → types}/functions/get-content/index.d.ts +4 -5
- package/{dist → types}/index-helpers/blocks-exports.d.ts +2 -2
- package/dist/blocks/button/button.js +0 -12
- package/dist/blocks/button/component-info.js +0 -34
- package/dist/blocks/columns/columns.js +0 -119
- 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/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/section/component-info.js +0 -40
- package/dist/blocks/section/section.js +0 -17
- 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 -29
- package/dist/blocks/text/component-info.js +0 -19
- package/dist/blocks/text/text.js +0 -7
- 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 -92
- 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 -21
- package/dist/components/block/components/interactive-element.js +0 -20
- package/dist/components/block/components/repeated-block.js +0 -7
- package/dist/components/block/types.js +0 -1
- package/dist/components/blocks/blocks-wrapper.js +0 -38
- package/dist/components/blocks/blocks.js +0 -10
- package/dist/components/content/components/enable-editor.js +0 -250
- package/dist/components/content/components/styles.helpers.js +0 -58
- package/dist/components/content/components/styles.js +0 -30
- package/dist/components/content/content.helpers.js +0 -30
- package/dist/components/content/content.js +0 -74
- package/dist/components/content/content.types.js +0 -1
- package/dist/components/content/wrap-component-ref.js +0 -6
- package/dist/components/content-variants/content-variants.js +0 -45
- 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 -5
- package/dist/components/inlined-styles.js +0 -5
- 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/camel-to-kebab-case.js +0 -1
- package/dist/functions/evaluate/browser-runtime/browser.js +0 -31
- 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/non-node-runtime/acorn-interpreter.d.ts +0 -2
- 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/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 -9
- package/dist/helpers/preview-lru-cache/helpers.js +0 -9
- package/dist/helpers/preview-lru-cache/init.js +0 -15
- package/dist/helpers/preview-lru-cache/set.js +0 -7
- package/dist/helpers/preview-lru-cache/types.js +0 -6
- package/dist/helpers/sessionId.js +0 -30
- 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/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/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/section/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/section/section.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/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/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/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/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/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/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/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
|
-
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;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { evaluate } from '../../functions/evaluate/index.js';
|
|
2
|
-
import { getProcessedBlock } from '../../functions/get-processed-block.js';
|
|
3
|
-
/**
|
|
4
|
-
* https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
|
|
5
|
-
*/
|
|
6
|
-
const EMPTY_HTML_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
7
|
-
export const isEmptyHtmlElement = (tagName) => {
|
|
8
|
-
return typeof tagName === 'string' && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
9
|
-
};
|
|
10
|
-
export const getComponent = ({ block, context, registeredComponents }) => {
|
|
11
|
-
const componentName = getProcessedBlock({
|
|
12
|
-
block,
|
|
13
|
-
localState: context.localState,
|
|
14
|
-
rootState: context.rootState,
|
|
15
|
-
rootSetState: context.rootSetState,
|
|
16
|
-
context: context.context,
|
|
17
|
-
shouldEvaluateBindings: false
|
|
18
|
-
}).component?.name;
|
|
19
|
-
if (!componentName) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const ref = registeredComponents[componentName];
|
|
23
|
-
if (!ref) {
|
|
24
|
-
// TODO: Public doc page with more info about this message
|
|
25
|
-
console.warn(`
|
|
26
|
-
Could not find a registered component named "${componentName}".
|
|
27
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return ref;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
export const getRepeatItemData = ({ block, context }) => {
|
|
35
|
-
/**
|
|
36
|
-
* we don't use `state.processedBlock` here because the processing done within its logic includes evaluating the block's bindings,
|
|
37
|
-
* which will not work if there is a repeat.
|
|
38
|
-
*/
|
|
39
|
-
const { repeat, ...blockWithoutRepeat } = block;
|
|
40
|
-
if (!repeat?.collection) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
const itemsArray = evaluate({
|
|
44
|
-
code: repeat.collection,
|
|
45
|
-
localState: context.localState,
|
|
46
|
-
rootState: context.rootState,
|
|
47
|
-
rootSetState: context.rootSetState,
|
|
48
|
-
context: context.context
|
|
49
|
-
});
|
|
50
|
-
if (!Array.isArray(itemsArray)) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
const collectionName = repeat.collection.split('.').pop();
|
|
54
|
-
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + 'Item' : 'item');
|
|
55
|
-
const repeatArray = itemsArray.map((item, index) => ({
|
|
56
|
-
context: {
|
|
57
|
-
...context,
|
|
58
|
-
localState: {
|
|
59
|
-
...context.localState,
|
|
60
|
-
$index: index,
|
|
61
|
-
$item: item,
|
|
62
|
-
[itemNameToUse]: item,
|
|
63
|
-
[`$${itemNameToUse}Index`]: index
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
block: blockWithoutRepeat
|
|
67
|
-
}));
|
|
68
|
-
return repeatArray;
|
|
69
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
3
|
-
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
4
|
-
import BlockStyles from "./components/block-styles";
|
|
5
|
-
import { getComponent, getRepeatItemData, isEmptyHtmlElement, } from "./block.helpers.js";
|
|
6
|
-
import RepeatedBlock from "./components/repeated-block";
|
|
7
|
-
import ComponentRef from "./components/component-ref/component-ref";
|
|
8
|
-
import BlockWrapper from "./components/block-wrapper";
|
|
9
|
-
function Block(props) {
|
|
10
|
-
const blockComponent = function blockComponent() {
|
|
11
|
-
return getComponent({
|
|
12
|
-
block: props.block,
|
|
13
|
-
context: props.context,
|
|
14
|
-
registeredComponents: props.registeredComponents,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
const repeatItem = function repeatItem() {
|
|
18
|
-
return getRepeatItemData({
|
|
19
|
-
block: props.block,
|
|
20
|
-
context: props.context,
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
const processedBlock = function processedBlock() {
|
|
24
|
-
return repeatItem()
|
|
25
|
-
? props.block
|
|
26
|
-
: getProcessedBlock({
|
|
27
|
-
block: props.block,
|
|
28
|
-
localState: props.context.localState,
|
|
29
|
-
rootState: props.context.rootState,
|
|
30
|
-
rootSetState: props.context.rootSetState,
|
|
31
|
-
context: props.context.context,
|
|
32
|
-
shouldEvaluateBindings: true,
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
const Tag = function Tag() {
|
|
36
|
-
return props.block.tagName || "div";
|
|
37
|
-
};
|
|
38
|
-
const canShowBlock = function canShowBlock() {
|
|
39
|
-
if ("hide" in processedBlock()) {
|
|
40
|
-
return !processedBlock().hide;
|
|
41
|
-
}
|
|
42
|
-
if ("show" in processedBlock()) {
|
|
43
|
-
return processedBlock().show;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
};
|
|
47
|
-
const childrenWithoutParentComponent = function childrenWithoutParentComponent() {
|
|
48
|
-
/**
|
|
49
|
-
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
50
|
-
* we render them outside of `componentRef`.
|
|
51
|
-
* NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
|
|
52
|
-
* blocks, and the children will be repeated within those blocks.
|
|
53
|
-
*/
|
|
54
|
-
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
55
|
-
return shouldRenderChildrenOutsideRef
|
|
56
|
-
? processedBlock().children ?? []
|
|
57
|
-
: [];
|
|
58
|
-
};
|
|
59
|
-
const componentRefProps = function componentRefProps() {
|
|
60
|
-
return {
|
|
61
|
-
blockChildren: processedBlock().children ?? [],
|
|
62
|
-
componentRef: blockComponent()?.component,
|
|
63
|
-
componentOptions: {
|
|
64
|
-
...getBlockComponentOptions(processedBlock()),
|
|
65
|
-
builderContext: props.context,
|
|
66
|
-
...(blockComponent()?.name === "Symbol" ||
|
|
67
|
-
blockComponent()?.name === "Columns"
|
|
68
|
-
? {
|
|
69
|
-
builderComponents: props.registeredComponents,
|
|
70
|
-
}
|
|
71
|
-
: {}),
|
|
72
|
-
},
|
|
73
|
-
context: childrenContext,
|
|
74
|
-
registeredComponents: props.registeredComponents,
|
|
75
|
-
builderBlock: processedBlock(),
|
|
76
|
-
includeBlockProps: blockComponent()?.noWrap === true,
|
|
77
|
-
isInteractive: !blockComponent()?.isRSC,
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
const childrenContext = props.context;
|
|
81
|
-
return (React.createElement(React.Fragment, null, canShowBlock() ? (React.createElement(React.Fragment, null, !blockComponent()?.noWrap ? (React.createElement(React.Fragment, null,
|
|
82
|
-
isEmptyHtmlElement(Tag()) ? (React.createElement(React.Fragment, null,
|
|
83
|
-
React.createElement(BlockWrapper, { Wrapper: Tag(), block: processedBlock(), context: props.context, hasChildren: false }))) : null,
|
|
84
|
-
!isEmptyHtmlElement(Tag()) && repeatItem() ? (React.createElement(React.Fragment, null, repeatItem()?.map((data, index) => (React.createElement(RepeatedBlock, { key: index, repeatContext: data.context, block: data.block, registeredComponents: props.registeredComponents }))))) : null,
|
|
85
|
-
!isEmptyHtmlElement(Tag()) && !repeatItem() ? (React.createElement(React.Fragment, null,
|
|
86
|
-
React.createElement(BlockWrapper, { Wrapper: Tag(), block: processedBlock(), context: props.context, hasChildren: true },
|
|
87
|
-
React.createElement(ComponentRef, { ...componentRefProps() }),
|
|
88
|
-
childrenWithoutParentComponent()?.map((child) => (React.createElement(Block, { key: "block-" + child.id, block: child, context: childrenContext, registeredComponents: props.registeredComponents }))),
|
|
89
|
-
childrenWithoutParentComponent()?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: childrenContext })))))) : null)) : (React.createElement(React.Fragment, null,
|
|
90
|
-
React.createElement(ComponentRef, { ...componentRefProps() }))))) : null));
|
|
91
|
-
}
|
|
92
|
-
export default Block;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { getMaxWidthQueryForSize, getSizesForBreakpoints, } from "../../../constants/device-sizes.js";
|
|
5
|
-
import { TARGET } from "../../../constants/target.js";
|
|
6
|
-
import { getProcessedBlock } from "../../../functions/get-processed-block.js";
|
|
7
|
-
import { createCssClass } from "../../../helpers/css.js";
|
|
8
|
-
import { checkIsDefined } from "../../../helpers/nullable.js";
|
|
9
|
-
import InlinedStyles from "../../inlined-styles";
|
|
10
|
-
function BlockStyles(props) {
|
|
11
|
-
const [processedBlock, setProcessedBlock] = useState(() => getProcessedBlock({
|
|
12
|
-
block: props.block,
|
|
13
|
-
localState: props.context.localState,
|
|
14
|
-
rootState: props.context.rootState,
|
|
15
|
-
rootSetState: props.context.rootSetState,
|
|
16
|
-
context: props.context.context,
|
|
17
|
-
shouldEvaluateBindings: true,
|
|
18
|
-
}));
|
|
19
|
-
function canShowBlock() {
|
|
20
|
-
// only render styles for blocks that are visible
|
|
21
|
-
if (checkIsDefined(processedBlock.hide)) {
|
|
22
|
-
return !processedBlock.hide;
|
|
23
|
-
}
|
|
24
|
-
if (checkIsDefined(processedBlock.show)) {
|
|
25
|
-
return processedBlock.show;
|
|
26
|
-
}
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
function css() {
|
|
30
|
-
const styles = processedBlock.responsiveStyles;
|
|
31
|
-
const content = props.context.content;
|
|
32
|
-
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
33
|
-
const largeStyles = styles?.large;
|
|
34
|
-
const mediumStyles = styles?.medium;
|
|
35
|
-
const smallStyles = styles?.small;
|
|
36
|
-
const className = processedBlock.id;
|
|
37
|
-
if (!className) {
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
const largeStylesClass = largeStyles
|
|
41
|
-
? createCssClass({
|
|
42
|
-
className,
|
|
43
|
-
styles: largeStyles,
|
|
44
|
-
})
|
|
45
|
-
: "";
|
|
46
|
-
const mediumStylesClass = mediumStyles
|
|
47
|
-
? createCssClass({
|
|
48
|
-
className,
|
|
49
|
-
styles: mediumStyles,
|
|
50
|
-
mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints),
|
|
51
|
-
})
|
|
52
|
-
: "";
|
|
53
|
-
const smallStylesClass = smallStyles
|
|
54
|
-
? createCssClass({
|
|
55
|
-
className,
|
|
56
|
-
styles: smallStyles,
|
|
57
|
-
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints),
|
|
58
|
-
})
|
|
59
|
-
: "";
|
|
60
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
61
|
-
}
|
|
62
|
-
return (React.createElement(React.Fragment, null, TARGET !== "reactNative" && css() && canShowBlock() ? (React.createElement(React.Fragment, null,
|
|
63
|
-
React.createElement(InlinedStyles, { styles: css() }))) : null));
|
|
64
|
-
}
|
|
65
|
-
export default BlockStyles;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { getBlockActions } from "../../../functions/get-block-actions.js";
|
|
4
|
-
import { getBlockProperties } from "../../../functions/get-block-properties.js";
|
|
5
|
-
function BlockWrapper(props) {
|
|
6
|
-
return (React.createElement(React.Fragment, null,
|
|
7
|
-
" ",
|
|
8
|
-
props.hasChildren ? (React.createElement(React.Fragment, null,
|
|
9
|
-
React.createElement(props.Wrapper, { ...getBlockProperties({
|
|
10
|
-
block: props.block,
|
|
11
|
-
context: props.context,
|
|
12
|
-
}), ...getBlockActions({
|
|
13
|
-
block: props.block,
|
|
14
|
-
rootState: props.context.rootState,
|
|
15
|
-
rootSetState: props.context.rootSetState,
|
|
16
|
-
localState: props.context.localState,
|
|
17
|
-
context: props.context.context,
|
|
18
|
-
stripPrefix: true,
|
|
19
|
-
}) },
|
|
20
|
-
" ",
|
|
21
|
-
props.children,
|
|
22
|
-
" "))) : (React.createElement(React.Fragment, null,
|
|
23
|
-
React.createElement(props.Wrapper, { ...getBlockProperties({
|
|
24
|
-
block: props.block,
|
|
25
|
-
context: props.context,
|
|
26
|
-
}), ...getBlockActions({
|
|
27
|
-
block: props.block,
|
|
28
|
-
rootState: props.context.rootState,
|
|
29
|
-
rootSetState: props.context.rootSetState,
|
|
30
|
-
localState: props.context.localState,
|
|
31
|
-
context: props.context.context,
|
|
32
|
-
stripPrefix: true,
|
|
33
|
-
}) }))),
|
|
34
|
-
" "));
|
|
35
|
-
}
|
|
36
|
-
export default BlockWrapper;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getBlockProperties } from '../../../../functions/get-block-properties.js';
|
|
2
|
-
export const getWrapperProps = ({ componentOptions, builderBlock, context, componentRef, includeBlockProps, isInteractive, contextValue }) => {
|
|
3
|
-
const interactiveElementProps = {
|
|
4
|
-
Wrapper: componentRef,
|
|
5
|
-
block: builderBlock,
|
|
6
|
-
context,
|
|
7
|
-
wrapperProps: componentOptions
|
|
8
|
-
};
|
|
9
|
-
return isInteractive ? interactiveElementProps : {
|
|
10
|
-
...componentOptions,
|
|
11
|
-
/**
|
|
12
|
-
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
13
|
-
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
14
|
-
*/
|
|
15
|
-
...(includeBlockProps ? {
|
|
16
|
-
attributes: getBlockProperties({
|
|
17
|
-
block: builderBlock,
|
|
18
|
-
context: contextValue
|
|
19
|
-
})
|
|
20
|
-
} : {})
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import BlockStyles from "../block-styles";
|
|
3
|
-
import Block from "../../block";
|
|
4
|
-
import InteractiveElement from "../interactive-element";
|
|
5
|
-
import { getWrapperProps } from "./component-ref.helpers.js";
|
|
6
|
-
function ComponentRef(props) {
|
|
7
|
-
const Wrapper = props.isInteractive ? InteractiveElement : props.componentRef;
|
|
8
|
-
return (React.createElement(React.Fragment, null, props.componentRef ? (React.createElement(React.Fragment, null,
|
|
9
|
-
React.createElement(Wrapper, { ...getWrapperProps({
|
|
10
|
-
componentOptions: props.componentOptions,
|
|
11
|
-
builderBlock: props.builderBlock,
|
|
12
|
-
context: props.context,
|
|
13
|
-
componentRef: props.componentRef,
|
|
14
|
-
includeBlockProps: props.includeBlockProps,
|
|
15
|
-
isInteractive: props.isInteractive,
|
|
16
|
-
contextValue: props.context,
|
|
17
|
-
}) },
|
|
18
|
-
props.blockChildren?.map((child) => (React.createElement(Block, { key: "block-" + child.id, block: child, context: props.context, registeredComponents: props.registeredComponents }))),
|
|
19
|
-
props.blockChildren?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: props.context })))))) : null));
|
|
20
|
-
}
|
|
21
|
-
export default ComponentRef;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { getBlockActions } from "../../../functions/get-block-actions.js";
|
|
4
|
-
import { getBlockProperties } from "../../../functions/get-block-properties.js";
|
|
5
|
-
function InteractiveElement(props) {
|
|
6
|
-
return (React.createElement(props.Wrapper, { ...props.wrapperProps, attributes: {
|
|
7
|
-
...getBlockProperties({
|
|
8
|
-
block: props.block,
|
|
9
|
-
context: props.context,
|
|
10
|
-
}),
|
|
11
|
-
...getBlockActions({
|
|
12
|
-
block: props.block,
|
|
13
|
-
rootState: props.context.rootState,
|
|
14
|
-
rootSetState: props.context.rootSetState,
|
|
15
|
-
localState: props.context.localState,
|
|
16
|
-
context: props.context.context,
|
|
17
|
-
}),
|
|
18
|
-
} }, props.children));
|
|
19
|
-
}
|
|
20
|
-
export default InteractiveElement;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import Block from "../block";
|
|
3
|
-
function RepeatedBlock(props) {
|
|
4
|
-
const store = props.repeatContext;
|
|
5
|
-
return (React.createElement(Block, { block: props.block, context: store, registeredComponents: props.registeredComponents }));
|
|
6
|
-
}
|
|
7
|
-
export default RepeatedBlock;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
4
|
-
function BlocksWrapper(props) {
|
|
5
|
-
function className() {
|
|
6
|
-
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
7
|
-
}
|
|
8
|
-
function onClick() {
|
|
9
|
-
if (isEditing() && !props.blocks?.length) {
|
|
10
|
-
window.parent?.postMessage({
|
|
11
|
-
type: "builder.clickEmptyBlocks",
|
|
12
|
-
data: {
|
|
13
|
-
parentElementId: props.parent,
|
|
14
|
-
dataPath: props.path,
|
|
15
|
-
},
|
|
16
|
-
}, "*");
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function onMouseEnter() {
|
|
20
|
-
if (isEditing() && !props.blocks?.length) {
|
|
21
|
-
window.parent?.postMessage({
|
|
22
|
-
type: "builder.hoverEmptyBlocks",
|
|
23
|
-
data: {
|
|
24
|
-
parentElementId: props.parent,
|
|
25
|
-
dataPath: props.path,
|
|
26
|
-
},
|
|
27
|
-
}, "*");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return (React.createElement(React.Fragment, null,
|
|
31
|
-
React.createElement("div", { className: className() + " div-5821bd52", "builder-path": props.path, "builder-parent-id": props.parent, style: props.styleProp, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter(), onKeyPress: (event) => onClick() }, props.children),
|
|
32
|
-
React.createElement("style", null, `.div-5821bd52 {
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
align-items: stretch;
|
|
36
|
-
}`)));
|
|
37
|
-
}
|
|
38
|
-
export default BlocksWrapper;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import BlockStyles from "../block/components/block-styles";
|
|
3
|
-
import Block from "../block/block";
|
|
4
|
-
import BlocksWrapper from "./blocks-wrapper";
|
|
5
|
-
function Blocks(props) {
|
|
6
|
-
return (React.createElement(BlocksWrapper, { blocks: props.blocks, parent: props.parent, path: props.path, styleProp: props.styleProp },
|
|
7
|
-
props.blocks ? (React.createElement(React.Fragment, null, props.blocks?.map((block) => (React.createElement(Block, { key: "render-block-" + block.id, block: block, context: props.context, registeredComponents: props.registeredComponents }))))) : null,
|
|
8
|
-
props.blocks ? (React.createElement(React.Fragment, null, props.blocks?.map((block) => (React.createElement(BlockStyles, { key: "block-style-" + block.id, block: block, context: props.context }))))) : null));
|
|
9
|
-
}
|
|
10
|
-
export default Blocks;
|