@builder.io/sdk-react-native 1.0.31-2 → 1.0.32
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/commonjs/blocks/image/component-info.js +5 -0
- package/lib/browser/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/browser/commonjs/components/block/block.helpers.js +27 -7
- package/lib/browser/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/browser/commonjs/components/block/block.js +9 -13
- package/lib/browser/commonjs/components/block/block.js.map +1 -1
- package/lib/browser/commonjs/components/block/components/block-wrapper.js.map +1 -1
- package/lib/browser/commonjs/components/content/components/enable-editor.js +9 -9
- package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/commonjs/components/content/components/styles.helpers.js +2 -2
- package/lib/browser/commonjs/components/content/components/styles.helpers.js.map +1 -1
- package/lib/browser/commonjs/components/content/content.js +0 -1
- package/lib/browser/commonjs/components/content/content.js.map +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
- package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/browser/commonjs/functions/get-block-actions.js +1 -2
- package/lib/browser/commonjs/functions/get-block-actions.js.map +1 -1
- package/lib/browser/commonjs/functions/get-block-component-options.js +1 -5
- package/lib/browser/commonjs/functions/get-block-component-options.js.map +1 -1
- package/lib/browser/commonjs/functions/get-content/index.js +1 -2
- package/lib/browser/commonjs/functions/get-content/index.js.map +1 -1
- package/lib/browser/commonjs/helpers/cookie.js +2 -12
- package/lib/browser/commonjs/helpers/cookie.js.map +1 -1
- package/lib/browser/module/blocks/image/component-info.js +5 -0
- package/lib/browser/module/blocks/image/component-info.js.map +1 -1
- package/lib/browser/module/components/block/block.helpers.js +22 -4
- package/lib/browser/module/components/block/block.helpers.js.map +1 -1
- package/lib/browser/module/components/block/block.js +10 -14
- package/lib/browser/module/components/block/block.js.map +1 -1
- package/lib/browser/module/components/block/components/block-wrapper.js.map +1 -1
- package/lib/browser/module/components/content/components/enable-editor.js +9 -9
- package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/module/components/content/components/styles.helpers.js +2 -2
- package/lib/browser/module/components/content/components/styles.helpers.js.map +1 -1
- package/lib/browser/module/components/content/content.js +0 -1
- package/lib/browser/module/components/content/content.js.map +1 -1
- package/lib/browser/module/constants/sdk-version.js +1 -1
- package/lib/browser/module/constants/sdk-version.js.map +1 -1
- package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
- package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/browser/module/functions/get-block-actions.js +1 -2
- package/lib/browser/module/functions/get-block-actions.js.map +1 -1
- package/lib/browser/module/functions/get-block-component-options.js +1 -5
- package/lib/browser/module/functions/get-block-component-options.js.map +1 -1
- package/lib/browser/module/functions/get-content/index.js +1 -2
- package/lib/browser/module/functions/get-content/index.js.map +1 -1
- package/lib/browser/module/helpers/cookie.js +2 -11
- package/lib/browser/module/helpers/cookie.js.map +1 -1
- package/lib/browser/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/browser/typescript/blocks/image/image.types.d.ts +1 -0
- package/lib/browser/typescript/blocks/image/image.types.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/block.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/block.helpers.d.ts +20 -2
- package/lib/browser/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/components/block-wrapper.d.ts +0 -1
- package/lib/browser/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.d.ts +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts.map +1 -1
- package/lib/browser/typescript/functions/get-block-component-options.d.ts.map +1 -1
- package/lib/browser/typescript/helpers/cookie.d.ts +0 -1
- package/lib/browser/typescript/helpers/cookie.d.ts.map +1 -1
- package/lib/edge/commonjs/blocks/image/component-info.js +5 -0
- package/lib/edge/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/edge/commonjs/components/block/block.helpers.js +27 -7
- package/lib/edge/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/edge/commonjs/components/block/block.js +9 -13
- package/lib/edge/commonjs/components/block/block.js.map +1 -1
- package/lib/edge/commonjs/components/block/components/block-wrapper.js.map +1 -1
- package/lib/edge/commonjs/components/content/components/enable-editor.js +9 -9
- package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/commonjs/components/content/components/styles.helpers.js +2 -2
- package/lib/edge/commonjs/components/content/components/styles.helpers.js.map +1 -1
- package/lib/edge/commonjs/components/content/content.js +0 -1
- package/lib/edge/commonjs/components/content/content.js.map +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
- package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/edge/commonjs/functions/get-block-actions.js +1 -2
- package/lib/edge/commonjs/functions/get-block-actions.js.map +1 -1
- package/lib/edge/commonjs/functions/get-block-component-options.js +1 -5
- package/lib/edge/commonjs/functions/get-block-component-options.js.map +1 -1
- package/lib/edge/commonjs/functions/get-content/index.js +1 -2
- package/lib/edge/commonjs/functions/get-content/index.js.map +1 -1
- package/lib/edge/commonjs/helpers/cookie.js +2 -12
- package/lib/edge/commonjs/helpers/cookie.js.map +1 -1
- package/lib/edge/module/blocks/image/component-info.js +5 -0
- package/lib/edge/module/blocks/image/component-info.js.map +1 -1
- package/lib/edge/module/components/block/block.helpers.js +22 -4
- package/lib/edge/module/components/block/block.helpers.js.map +1 -1
- package/lib/edge/module/components/block/block.js +10 -14
- package/lib/edge/module/components/block/block.js.map +1 -1
- package/lib/edge/module/components/block/components/block-wrapper.js.map +1 -1
- package/lib/edge/module/components/content/components/enable-editor.js +9 -9
- package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/module/components/content/components/styles.helpers.js +2 -2
- package/lib/edge/module/components/content/components/styles.helpers.js.map +1 -1
- package/lib/edge/module/components/content/content.js +0 -1
- package/lib/edge/module/components/content/content.js.map +1 -1
- package/lib/edge/module/constants/sdk-version.js +1 -1
- package/lib/edge/module/constants/sdk-version.js.map +1 -1
- package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
- package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/edge/module/functions/get-block-actions.js +1 -2
- package/lib/edge/module/functions/get-block-actions.js.map +1 -1
- package/lib/edge/module/functions/get-block-component-options.js +1 -5
- package/lib/edge/module/functions/get-block-component-options.js.map +1 -1
- package/lib/edge/module/functions/get-content/index.js +1 -2
- package/lib/edge/module/functions/get-content/index.js.map +1 -1
- package/lib/edge/module/helpers/cookie.js +2 -11
- package/lib/edge/module/helpers/cookie.js.map +1 -1
- package/lib/edge/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/edge/typescript/blocks/image/image.types.d.ts +1 -0
- package/lib/edge/typescript/blocks/image/image.types.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/block.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/block.helpers.d.ts +20 -2
- package/lib/edge/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/components/block-wrapper.d.ts +0 -1
- package/lib/edge/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.d.ts +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts.map +1 -1
- package/lib/edge/typescript/functions/get-block-component-options.d.ts.map +1 -1
- package/lib/edge/typescript/helpers/cookie.d.ts +0 -1
- package/lib/edge/typescript/helpers/cookie.d.ts.map +1 -1
- package/lib/node/commonjs/blocks/image/component-info.js +5 -0
- package/lib/node/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/node/commonjs/components/block/block.helpers.js +27 -7
- package/lib/node/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/node/commonjs/components/block/block.js +9 -13
- package/lib/node/commonjs/components/block/block.js.map +1 -1
- package/lib/node/commonjs/components/block/components/block-wrapper.js.map +1 -1
- package/lib/node/commonjs/components/content/components/enable-editor.js +9 -9
- package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/commonjs/components/content/components/styles.helpers.js +2 -2
- package/lib/node/commonjs/components/content/components/styles.helpers.js.map +1 -1
- package/lib/node/commonjs/components/content/content.js +0 -1
- package/lib/node/commonjs/components/content/content.js.map +1 -1
- package/lib/node/commonjs/constants/sdk-version.js +1 -1
- package/lib/node/commonjs/constants/sdk-version.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
- package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/node/commonjs/functions/get-block-actions.js +1 -2
- package/lib/node/commonjs/functions/get-block-actions.js.map +1 -1
- package/lib/node/commonjs/functions/get-block-component-options.js +1 -5
- package/lib/node/commonjs/functions/get-block-component-options.js.map +1 -1
- package/lib/node/commonjs/functions/get-content/index.js +1 -2
- package/lib/node/commonjs/functions/get-content/index.js.map +1 -1
- package/lib/node/commonjs/helpers/cookie.js +2 -12
- package/lib/node/commonjs/helpers/cookie.js.map +1 -1
- package/lib/node/module/blocks/image/component-info.js +5 -0
- package/lib/node/module/blocks/image/component-info.js.map +1 -1
- package/lib/node/module/components/block/block.helpers.js +22 -4
- package/lib/node/module/components/block/block.helpers.js.map +1 -1
- package/lib/node/module/components/block/block.js +10 -14
- package/lib/node/module/components/block/block.js.map +1 -1
- package/lib/node/module/components/block/components/block-wrapper.js.map +1 -1
- package/lib/node/module/components/content/components/enable-editor.js +9 -9
- package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/module/components/content/components/styles.helpers.js +2 -2
- package/lib/node/module/components/content/components/styles.helpers.js.map +1 -1
- package/lib/node/module/components/content/content.js +0 -1
- package/lib/node/module/components/content/content.js.map +1 -1
- package/lib/node/module/constants/sdk-version.js +1 -1
- package/lib/node/module/constants/sdk-version.js.map +1 -1
- package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
- package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/node/module/functions/get-block-actions.js +1 -2
- package/lib/node/module/functions/get-block-actions.js.map +1 -1
- package/lib/node/module/functions/get-block-component-options.js +1 -5
- package/lib/node/module/functions/get-block-component-options.js.map +1 -1
- package/lib/node/module/functions/get-content/index.js +1 -2
- package/lib/node/module/functions/get-content/index.js.map +1 -1
- package/lib/node/module/helpers/cookie.js +2 -11
- package/lib/node/module/helpers/cookie.js.map +1 -1
- package/lib/node/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/node/typescript/blocks/image/image.types.d.ts +1 -0
- package/lib/node/typescript/blocks/image/image.types.d.ts.map +1 -1
- package/lib/node/typescript/components/block/block.d.ts.map +1 -1
- package/lib/node/typescript/components/block/block.helpers.d.ts +20 -2
- package/lib/node/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/node/typescript/components/block/components/block-wrapper.d.ts +0 -1
- package/lib/node/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.d.ts +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/node/typescript/components/content/content.d.ts.map +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts.map +1 -1
- package/lib/node/typescript/functions/get-block-component-options.d.ts.map +1 -1
- package/lib/node/typescript/helpers/cookie.d.ts +0 -1
- package/lib/node/typescript/helpers/cookie.d.ts.map +1 -1
- package/package.json +5 -8
- package/lib/node/index.cjs +0 -6910
- package/lib/node/index.mjs +0 -7477
- package/src/blocks/BaseText.tsx +0 -17
- package/src/blocks/accordion/accordion.tsx +0 -181
- package/src/blocks/accordion/accordion.types.ts +0 -12
- package/src/blocks/accordion/component-info.ts +0 -124
- package/src/blocks/accordion/helpers.ts +0 -3
- package/src/blocks/accordion/index.ts +0 -1
- package/src/blocks/button/button.tsx +0 -56
- package/src/blocks/button/button.types.ts +0 -7
- package/src/blocks/button/component-info.ts +0 -35
- package/src/blocks/button/index.ts +0 -1
- package/src/blocks/columns/columns.tsx +0 -199
- package/src/blocks/columns/columns.types.ts +0 -14
- package/src/blocks/columns/component-info.ts +0 -219
- package/src/blocks/columns/helpers.ts +0 -3
- package/src/blocks/columns/index.ts +0 -1
- package/src/blocks/custom-code/component-info.ts +0 -24
- package/src/blocks/custom-code/custom-code.tsx +0 -71
- package/src/blocks/custom-code/index.ts +0 -1
- package/src/blocks/embed/component-info.ts +0 -38
- package/src/blocks/embed/embed.tsx +0 -62
- package/src/blocks/embed/helpers.ts +0 -2
- package/src/blocks/embed/index.ts +0 -1
- package/src/blocks/form/form/component-info.ts +0 -233
- package/src/blocks/form/form/form.tsx +0 -324
- package/src/blocks/form/form/index.ts +0 -1
- package/src/blocks/form/input/component-info.ts +0 -47
- package/src/blocks/form/input/index.ts +0 -1
- package/src/blocks/form/input/input.tsx +0 -49
- package/src/blocks/form/select/component-info.ts +0 -44
- package/src/blocks/form/select/index.ts +0 -1
- package/src/blocks/form/select/select.tsx +0 -54
- package/src/blocks/form/submit-button/component-info.ts +0 -27
- package/src/blocks/form/submit-button/index.ts +0 -1
- package/src/blocks/form/submit-button/submit-button.tsx +0 -34
- package/src/blocks/fragment/component-info.ts +0 -8
- package/src/blocks/fragment/fragment.tsx +0 -18
- package/src/blocks/fragment/fragment.types.ts +0 -5
- package/src/blocks/fragment/index.ts +0 -1
- package/src/blocks/helpers.ts +0 -43
- package/src/blocks/image/component-info.ts +0 -124
- package/src/blocks/image/image.helpers.ts +0 -47
- package/src/blocks/image/image.tsx +0 -65
- package/src/blocks/image/image.types.ts +0 -19
- package/src/blocks/image/index.ts +0 -1
- package/src/blocks/img/component-info.ts +0 -16
- package/src/blocks/img/img.tsx +0 -55
- package/src/blocks/img/index.ts +0 -1
- package/src/blocks/raw-text/component-info.ts +0 -11
- package/src/blocks/raw-text/index.ts +0 -1
- package/src/blocks/raw-text/raw-text.tsx +0 -1
- package/src/blocks/section/component-info.ts +0 -41
- package/src/blocks/section/index.ts +0 -1
- package/src/blocks/section/section.tsx +0 -39
- package/src/blocks/section/section.types.ts +0 -6
- package/src/blocks/slot/component-info.ts +0 -15
- package/src/blocks/slot/index.ts +0 -1
- package/src/blocks/slot/slot.tsx +0 -42
- package/src/blocks/symbol/component-info.ts +0 -35
- package/src/blocks/symbol/index.ts +0 -1
- package/src/blocks/symbol/symbol.helpers.ts +0 -47
- package/src/blocks/symbol/symbol.tsx +0 -100
- package/src/blocks/symbol/symbol.types.ts +0 -17
- package/src/blocks/tabs/component-info.ts +0 -139
- package/src/blocks/tabs/index.ts +0 -1
- package/src/blocks/tabs/tabs.tsx +0 -79
- package/src/blocks/tabs/tabs.types.ts +0 -13
- package/src/blocks/text/component-info.ts +0 -20
- package/src/blocks/text/index.ts +0 -1
- package/src/blocks/text/text.tsx +0 -105
- package/src/blocks/text/text.types.ts +0 -4
- package/src/blocks/textarea/component-info.ts +0 -38
- package/src/blocks/textarea/index.ts +0 -1
- package/src/blocks/textarea/textarea.tsx +0 -41
- package/src/blocks/video/component-info.ts +0 -83
- package/src/blocks/video/index.ts +0 -1
- package/src/blocks/video/video.tsx +0 -70
- package/src/blocks/video/video.types.ts +0 -21
- package/src/components/block/animator.ts +0 -220
- package/src/components/block/block.helpers.ts +0 -106
- package/src/components/block/block.tsx +0 -235
- package/src/components/block/components/block-styles.tsx +0 -136
- package/src/components/block/components/block-wrapper.tsx +0 -53
- package/src/components/block/components/component-ref/component-ref.helpers.ts +0 -55
- package/src/components/block/components/component-ref/component-ref.tsx +0 -66
- package/src/components/block/components/interactive-element.tsx +0 -53
- package/src/components/block/components/repeated-block.tsx +0 -37
- package/src/components/block/types.ts +0 -6
- package/src/components/blocks/blocks-wrapper.tsx +0 -93
- package/src/components/blocks/blocks.tsx +0 -57
- package/src/components/blocks/blocks.types.ts +0 -7
- package/src/components/blocks/index.ts +0 -1
- package/src/components/content/components/enable-editor.tsx +0 -471
- package/src/components/content/components/styles.helpers.ts +0 -101
- package/src/components/content/components/styles.tsx +0 -42
- package/src/components/content/content.helpers.ts +0 -40
- package/src/components/content/content.tsx +0 -151
- package/src/components/content/content.types.ts +0 -13
- package/src/components/content/contentProps.types.ts +0 -17
- package/src/components/content/index.ts +0 -1
- package/src/components/content/wrap-component-ref.ts +0 -6
- package/src/components/content-variants/content-variants.tsx +0 -146
- package/src/components/content-variants/content-variants.types.ts +0 -84
- package/src/components/content-variants/helpers.ts +0 -72
- package/src/components/content-variants/index.ts +0 -1
- package/src/components/content-variants/inlined-fns.ts +0 -22
- package/src/components/dynamic-div.tsx +0 -30
- package/src/components/dynamic-renderer/dynamic-renderer.helpers.ts +0 -7
- package/src/components/dynamic-renderer/dynamic-renderer.tsx +0 -47
- package/src/components/error-boundary.tsx +0 -38
- package/src/components/inlined-script.tsx +0 -10
- package/src/components/inlined-styles.tsx +0 -10
- package/src/constants/builder-registered-components.ts +0 -59
- package/src/constants/device-sizes.ts +0 -59
- package/src/constants/extra-components.ts +0 -1
- package/src/constants/sdk-version.ts +0 -1
- package/src/constants/target.ts +0 -3
- package/src/context/builder.context.ts +0 -15
- package/src/context/components.context.ts +0 -3
- package/src/context/index.ts +0 -1
- package/src/context/types.ts +0 -38
- package/src/functions/apply-patch-with-mutation.ts +0 -61
- package/src/functions/camel-to-kebab-case.ts +0 -1
- package/src/functions/deopt.ts +0 -6
- package/src/functions/evaluate/browser-runtime/browser.ts +0 -61
- package/src/functions/evaluate/browser-runtime/index.ts +0 -1
- package/src/functions/evaluate/choose-eval.ts +0 -23
- package/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +0 -2891
- package/src/functions/evaluate/edge-runtime/edge-runtime.ts +0 -96
- package/src/functions/evaluate/edge-runtime/index.ts +0 -1
- package/src/functions/evaluate/evaluate.ts +0 -76
- package/src/functions/evaluate/helpers.ts +0 -56
- package/src/functions/evaluate/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/init.ts +0 -33
- package/src/functions/evaluate/node-runtime/node-runtime.ts +0 -176
- package/src/functions/evaluate/node-runtime/safeDynamicRequire.ts +0 -14
- package/src/functions/evaluate/placeholder-runtime.ts +0 -4
- package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +0 -16
- package/src/functions/event-handler-name.ts +0 -4
- package/src/functions/extract-text-styles.ts +0 -24
- package/src/functions/fast-clone.ts +0 -4
- package/src/functions/fetch-builder-props.ts +0 -75
- package/src/functions/get-block-actions-handler.ts +0 -17
- package/src/functions/get-block-actions.ts +0 -35
- package/src/functions/get-block-component-options.ts +0 -11
- package/src/functions/get-block-properties.ts +0 -62
- package/src/functions/get-builder-search-params/index.ts +0 -33
- package/src/functions/get-class-prop-name.ts +0 -15
- package/src/functions/get-content/generate-content-url.ts +0 -88
- package/src/functions/get-content/index.ts +0 -99
- package/src/functions/get-content/types.ts +0 -157
- package/src/functions/get-env.ts +0 -5
- package/src/functions/get-fetch.ts +0 -11
- package/src/functions/get-global-this.ts +0 -16
- package/src/functions/get-processed-block.ts +0 -70
- package/src/functions/get-style.ts +0 -38
- package/src/functions/get.ts +0 -4
- package/src/functions/is-browser.ts +0 -3
- package/src/functions/is-edge-runtime.ts +0 -9
- package/src/functions/is-editing.ts +0 -8
- package/src/functions/is-from-trusted-host.ts +0 -8
- package/src/functions/is-iframe.ts +0 -4
- package/src/functions/is-node-runtime.ts +0 -8
- package/src/functions/is-previewing.ts +0 -16
- package/src/functions/on-change.ts +0 -29
- package/src/functions/register-component.ts +0 -30
- package/src/functions/register.ts +0 -44
- package/src/functions/set-editor-settings.ts +0 -15
- package/src/functions/set.ts +0 -14
- package/src/functions/track/helpers.ts +0 -51
- package/src/functions/track/index.ts +0 -131
- package/src/functions/track/interaction.ts +0 -63
- package/src/functions/transform-block-properties.ts +0 -33
- package/src/functions/transform-block.ts +0 -30
- package/src/functions/transform-style-property.ts +0 -296
- package/src/helpers/ab-tests.ts +0 -166
- package/src/helpers/canTrack.ts +0 -2
- package/src/helpers/cookie.ts +0 -109
- package/src/helpers/css.ts +0 -33
- package/src/helpers/flatten.ts +0 -41
- package/src/helpers/localStorage.ts +0 -36
- package/src/helpers/logger.ts +0 -7
- package/src/helpers/nullable.ts +0 -2
- package/src/helpers/omit.ts +0 -7
- package/src/helpers/preview-lru-cache/get.ts +0 -4
- package/src/helpers/preview-lru-cache/helpers.ts +0 -1
- package/src/helpers/preview-lru-cache/init.ts +0 -7
- package/src/helpers/preview-lru-cache/set.ts +0 -12
- package/src/helpers/preview-lru-cache/types.ts +0 -1
- package/src/helpers/search/search.ts +0 -18
- package/src/helpers/sessionId.ts +0 -37
- package/src/helpers/subscribe-to-editor.ts +0 -95
- package/src/helpers/time.ts +0 -2
- package/src/helpers/url.ts +0 -15
- package/src/helpers/uuid.ts +0 -17
- package/src/helpers/visitorId.ts +0 -37
- package/src/index-helpers/blocks-exports.ts +0 -16
- package/src/index-helpers/top-of-file.ts +0 -2
- package/src/index.ts +0 -15
- package/src/scripts/init-editing.ts +0 -119
- package/src/server-index.ts +0 -43
- package/src/types/api-version.ts +0 -2
- package/src/types/builder-block.ts +0 -89
- package/src/types/builder-content.ts +0 -47
- package/src/types/builder-props.ts +0 -12
- package/src/types/can-track.ts +0 -3
- package/src/types/components.ts +0 -119
- package/src/types/deep-partial.ts +0 -1
- package/src/types/element.ts +0 -57
- package/src/types/enforced-partials.ts +0 -19
- package/src/types/input.ts +0 -123
- package/src/types/targets.ts +0 -1
- package/src/types/typescript.ts +0 -9
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// TO-DO: This file breaks due to this issue:
|
|
2
|
-
// https://github.com/expo/web-examples/issues/73
|
|
3
|
-
// For now, we do not import it elsewhere to avoid crashing Expo servers on web when importing the SDK.
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { View } from 'react-native';
|
|
6
|
-
import ReactVideo from 'react-native-video';
|
|
7
|
-
|
|
8
|
-
// Subset of Image props, many are irrelevant for native (such as altText, etc)
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @typedef {{
|
|
12
|
-
* attributes?: any;
|
|
13
|
-
* video?: string;
|
|
14
|
-
* autoPlay?: boolean;
|
|
15
|
-
* controls?: boolean;
|
|
16
|
-
* muted?: boolean;
|
|
17
|
-
* loop?: boolean;
|
|
18
|
-
* playsInline?: boolean;
|
|
19
|
-
* aspectRatio?: number;
|
|
20
|
-
* fit?: 'contain' | 'cover' | 'stretch';
|
|
21
|
-
* position?:
|
|
22
|
-
* | 'center'
|
|
23
|
-
* | 'top'
|
|
24
|
-
* | 'left'
|
|
25
|
-
* | 'right'
|
|
26
|
-
* | 'bottom'
|
|
27
|
-
* | 'top left'
|
|
28
|
-
* | 'top right'
|
|
29
|
-
* | 'bottom left'
|
|
30
|
-
* | 'bottom right';
|
|
31
|
-
* posterImage?: string;
|
|
32
|
-
* children?: any;
|
|
33
|
-
* }} VideoProps
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
// TODO: support children by wrapping in a View
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @param {VideoProps} props
|
|
40
|
-
*/
|
|
41
|
-
export default function Video(props) {
|
|
42
|
-
return (
|
|
43
|
-
<View style={{ position: 'relative' }}>
|
|
44
|
-
<ReactVideo
|
|
45
|
-
paused={!props.autoPlay}
|
|
46
|
-
controls={props.controls}
|
|
47
|
-
muted={props.muted}
|
|
48
|
-
repeat={props.loop}
|
|
49
|
-
poster={props.posterImage}
|
|
50
|
-
posterResizeMode={props.fit || 'contain'}
|
|
51
|
-
resizeMode={props.fit || ('contain')}
|
|
52
|
-
style={{
|
|
53
|
-
position: 'absolute',
|
|
54
|
-
top: 0,
|
|
55
|
-
bottom: 0,
|
|
56
|
-
left: 0,
|
|
57
|
-
right: 0,
|
|
58
|
-
zIndex: 1,
|
|
59
|
-
}}
|
|
60
|
-
source={{ uri: props.video }}
|
|
61
|
-
/>
|
|
62
|
-
<View
|
|
63
|
-
style={{
|
|
64
|
-
width: '100%',
|
|
65
|
-
paddingTop: `${props.aspectRatio * 100}%`,
|
|
66
|
-
}}
|
|
67
|
-
/>
|
|
68
|
-
</View>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { BuilderBlock } from '../../types/builder-block';
|
|
2
|
-
export interface VideoProps {
|
|
3
|
-
attributes?: any;
|
|
4
|
-
video?: string;
|
|
5
|
-
autoPlay?: boolean;
|
|
6
|
-
controls?: boolean;
|
|
7
|
-
muted?: boolean;
|
|
8
|
-
loop?: boolean;
|
|
9
|
-
playsInline?: boolean;
|
|
10
|
-
aspectRatio?: number;
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
fit?: 'contain' | 'cover' | 'fill';
|
|
14
|
-
preload?: 'auto' | 'metadata' | 'none';
|
|
15
|
-
position?: 'center' | 'top' | 'left' | 'right' | 'bottom' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
|
|
16
|
-
posterImage?: string;
|
|
17
|
-
lazyLoad?: boolean;
|
|
18
|
-
children?: any;
|
|
19
|
-
fitContent?: boolean;
|
|
20
|
-
builderBlock?: BuilderBlock;
|
|
21
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { camelToKebabCase } from '../../functions/camel-to-kebab-case';
|
|
2
|
-
import type { BuilderAnimation } from '../../types/builder-block';
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
|
-
function throttle(func: Function, wait: number, options: any = {}) {
|
|
6
|
-
let context: any;
|
|
7
|
-
let args: any;
|
|
8
|
-
let result: any;
|
|
9
|
-
let timeout = (null as any);
|
|
10
|
-
let previous = 0;
|
|
11
|
-
const later = function () {
|
|
12
|
-
previous = options.leading === false ? 0 : Date.now();
|
|
13
|
-
timeout = null;
|
|
14
|
-
result = func.apply(context, args);
|
|
15
|
-
if (!timeout) context = args = null;
|
|
16
|
-
};
|
|
17
|
-
return function (this: any) {
|
|
18
|
-
const now = Date.now();
|
|
19
|
-
if (!previous && options.leading === false) previous = now;
|
|
20
|
-
const remaining = wait - (now - previous);
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
22
|
-
context = this;
|
|
23
|
-
// eslint-disable-next-line prefer-rest-params
|
|
24
|
-
args = arguments;
|
|
25
|
-
if (remaining <= 0 || remaining > wait) {
|
|
26
|
-
if (timeout) {
|
|
27
|
-
clearTimeout(timeout);
|
|
28
|
-
timeout = null;
|
|
29
|
-
}
|
|
30
|
-
previous = now;
|
|
31
|
-
result = func.apply(context, args);
|
|
32
|
-
if (!timeout) context = args = null;
|
|
33
|
-
} else if (!timeout && options.trailing !== false) {
|
|
34
|
-
timeout = setTimeout(later, remaining);
|
|
35
|
-
}
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function assign(target: object, ..._args: any[]) {
|
|
40
|
-
const to = Object(target);
|
|
41
|
-
for (let index = 1; index < arguments.length; index++) {
|
|
42
|
-
// eslint-disable-next-line prefer-rest-params
|
|
43
|
-
const nextSource = arguments[index];
|
|
44
|
-
if (nextSource != null) {
|
|
45
|
-
// Skip over if undefined or null
|
|
46
|
-
for (const nextKey in nextSource) {
|
|
47
|
-
// Avoid bugs when hasOwnProperty is shadowed
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
49
|
-
to[nextKey] = nextSource[nextKey];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return to;
|
|
55
|
-
}
|
|
56
|
-
export function bindAnimations(animations: BuilderAnimation[]) {
|
|
57
|
-
for (const animation of animations) {
|
|
58
|
-
switch (animation.trigger) {
|
|
59
|
-
case 'pageLoad':
|
|
60
|
-
triggerAnimation(animation);
|
|
61
|
-
break;
|
|
62
|
-
case 'scrollInView':
|
|
63
|
-
bindScrollInViewAnimation(animation);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function warnElementNotPresent(id: string) {
|
|
69
|
-
console.warn(`Cannot animate element: element with ID ${id} not found!`);
|
|
70
|
-
}
|
|
71
|
-
function augmentAnimation(animation: BuilderAnimation, element: HTMLElement) {
|
|
72
|
-
const stylesUsed = getAllStylesUsed(animation);
|
|
73
|
-
const computedStyle: any = getComputedStyle(element);
|
|
74
|
-
// const computedStyle = getComputedStyle(element);
|
|
75
|
-
// // FIXME: this will break if original load is in one reponsive size then resize to another hmmm
|
|
76
|
-
// Need to use transform instead of left since left can change on screen sizes
|
|
77
|
-
const firstStyles = animation.steps[0].styles;
|
|
78
|
-
const lastStyles = animation.steps[animation.steps.length - 1]!.styles;
|
|
79
|
-
const bothStyles = [firstStyles, lastStyles];
|
|
80
|
-
|
|
81
|
-
// FIXME: this won't work as expected for augmented animations - may need the editor itself to manage this
|
|
82
|
-
for (const styles of bothStyles) {
|
|
83
|
-
for (const style of stylesUsed) {
|
|
84
|
-
if (!(style in styles)) {
|
|
85
|
-
styles[(style as any)] = computedStyle[style];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function getAllStylesUsed(animation: BuilderAnimation) {
|
|
91
|
-
const properties: (keyof CSSStyleDeclaration)[] = [];
|
|
92
|
-
for (const step of animation.steps) {
|
|
93
|
-
for (const key in step.styles) {
|
|
94
|
-
if (properties.indexOf((key as any)) === -1) {
|
|
95
|
-
properties.push((key as any));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return properties;
|
|
100
|
-
}
|
|
101
|
-
export function triggerAnimation(animation: BuilderAnimation) {
|
|
102
|
-
// TODO: do for ALL elements
|
|
103
|
-
const elements = (Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || '')) as HTMLElement[]);
|
|
104
|
-
if (!elements.length) {
|
|
105
|
-
warnElementNotPresent(animation.elementId || animation.id || '');
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
Array.from(elements).forEach(element => {
|
|
109
|
-
augmentAnimation(animation, element);
|
|
110
|
-
// TODO: do this properly, may have other animations of different properties
|
|
111
|
-
|
|
112
|
-
// TODO: only override the properties
|
|
113
|
-
// TODO: if there is an entrance and hover animation, the transition duration will get effed
|
|
114
|
-
// element.setAttribute('style', '');
|
|
115
|
-
|
|
116
|
-
// const styledUsed = this.getAllStylesUsed(animation);
|
|
117
|
-
element.style.transition = 'none';
|
|
118
|
-
element.style.transitionDelay = '0';
|
|
119
|
-
assign(element.style, animation.steps[0].styles);
|
|
120
|
-
// TODO: queue/batch these timeouts
|
|
121
|
-
// TODO: only include properties explicitly set in the animation
|
|
122
|
-
// using Object.keys(styles)
|
|
123
|
-
setTimeout(() => {
|
|
124
|
-
element.style.transition = `all ${animation.duration}s ${camelToKebabCase(animation.easing)}`;
|
|
125
|
-
if (animation.delay) {
|
|
126
|
-
element.style.transitionDelay = animation.delay + 's';
|
|
127
|
-
}
|
|
128
|
-
assign(element.style, animation.steps[1].styles);
|
|
129
|
-
// TODO: maybe remove/reset transitoin property after animation duration
|
|
130
|
-
|
|
131
|
-
// TODO: queue timers
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
// TODO: what if has other transition (reset back to what it was)
|
|
134
|
-
element.style.transition = '';
|
|
135
|
-
element.style.transitionDelay = '';
|
|
136
|
-
}, (animation.delay || 0) * 1000 + animation.duration * 1000 + 100);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// TODO: unbind on element remove
|
|
142
|
-
export function bindScrollInViewAnimation(animation: BuilderAnimation) {
|
|
143
|
-
// TODO: apply to ALL matching elements
|
|
144
|
-
const elements = (Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || '')) as HTMLElement[]);
|
|
145
|
-
if (!elements.length) {
|
|
146
|
-
warnElementNotPresent(animation.elementId || animation.id || '');
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// TODO: if server side rendered and scrolled into view don't animate...
|
|
151
|
-
Array.from(elements).forEach(element => {
|
|
152
|
-
augmentAnimation(animation, element);
|
|
153
|
-
let triggered = false;
|
|
154
|
-
let pendingAnimation = false;
|
|
155
|
-
function immediateOnScroll() {
|
|
156
|
-
if (!triggered && isScrolledIntoView(element)) {
|
|
157
|
-
triggered = true;
|
|
158
|
-
pendingAnimation = true;
|
|
159
|
-
setTimeout(() => {
|
|
160
|
-
assign(element!.style, animation.steps[1].styles);
|
|
161
|
-
if (!animation.repeat) {
|
|
162
|
-
document.removeEventListener('scroll', onScroll);
|
|
163
|
-
}
|
|
164
|
-
setTimeout(() => {
|
|
165
|
-
pendingAnimation = false;
|
|
166
|
-
if (!animation.repeat) {
|
|
167
|
-
element.style.transition = '';
|
|
168
|
-
element.style.transitionDelay = '';
|
|
169
|
-
}
|
|
170
|
-
}, (animation.duration + (animation.delay || 0)) * 1000 + 100);
|
|
171
|
-
});
|
|
172
|
-
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
173
|
-
// we want to repeat the animation every time the the element is out of view and back again
|
|
174
|
-
triggered = false;
|
|
175
|
-
assign(element!.style, animation.steps[0].styles);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// TODO: roll all of these in one for more efficiency of checking all the rects
|
|
180
|
-
const onScroll = throttle(immediateOnScroll, 200, {
|
|
181
|
-
leading: false
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// TODO: fully in view or partially
|
|
185
|
-
function isScrolledIntoView(elem: HTMLElement) {
|
|
186
|
-
const rect = elem.getBoundingClientRect();
|
|
187
|
-
const windowHeight = window.innerHeight;
|
|
188
|
-
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
189
|
-
const threshold = thresholdPercent * windowHeight;
|
|
190
|
-
|
|
191
|
-
// TODO: partial in view? or what if element is larger than screen itself
|
|
192
|
-
return rect.bottom > threshold && rect.top < windowHeight - threshold // Element is peeking top or bottom
|
|
193
|
-
// (rect.top > 0 && rect.bottom < window.innerHeight) || // element fits within the screen and is fully on screen (not hanging off at all)
|
|
194
|
-
// (rect.top < 0 && rect.bottom > window.innerHeight) // element is larger than the screen and hangs over the top and bottom
|
|
195
|
-
;
|
|
196
|
-
}
|
|
197
|
-
const defaultState = animation.steps[0].styles;
|
|
198
|
-
function attachDefaultState() {
|
|
199
|
-
assign(element!.style, defaultState);
|
|
200
|
-
}
|
|
201
|
-
attachDefaultState();
|
|
202
|
-
|
|
203
|
-
// TODO: queue/batch these timeouts!
|
|
204
|
-
setTimeout(() => {
|
|
205
|
-
element.style.transition = `all ${animation.duration}s ${camelToKebabCase(animation.easing)}`;
|
|
206
|
-
if (animation.delay) {
|
|
207
|
-
element.style.transitionDelay = animation.delay + 's';
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// TODO: one listener for everything
|
|
212
|
-
document.addEventListener('scroll', onScroll, ({
|
|
213
|
-
capture: true,
|
|
214
|
-
passive: true
|
|
215
|
-
} as any));
|
|
216
|
-
|
|
217
|
-
// Do an initial check
|
|
218
|
-
immediateOnScroll();
|
|
219
|
-
});
|
|
220
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { BuilderContextInterface, RegisteredComponent, RegisteredComponents } from '../../context/types';
|
|
2
|
-
import { evaluate } from '../../functions/evaluate/index';
|
|
3
|
-
import { extractTextStyles } from '../../functions/extract-text-styles';
|
|
4
|
-
import { getProcessedBlock } from '../../functions/get-processed-block';
|
|
5
|
-
import { getStyle } from '../../functions/get-style';
|
|
6
|
-
import type { BuilderBlock } from '../../types/builder-block';
|
|
7
|
-
import type { RepeatData } from './types';
|
|
8
|
-
export const getComponent = ({
|
|
9
|
-
block,
|
|
10
|
-
context,
|
|
11
|
-
registeredComponents
|
|
12
|
-
}: {
|
|
13
|
-
block: BuilderBlock;
|
|
14
|
-
context: BuilderContextInterface;
|
|
15
|
-
registeredComponents: RegisteredComponents;
|
|
16
|
-
}) => {
|
|
17
|
-
const componentName = getProcessedBlock({
|
|
18
|
-
block,
|
|
19
|
-
localState: context.localState,
|
|
20
|
-
rootState: context.rootState,
|
|
21
|
-
rootSetState: context.rootSetState,
|
|
22
|
-
context: context.context,
|
|
23
|
-
shouldEvaluateBindings: false
|
|
24
|
-
}).component?.name;
|
|
25
|
-
if (!componentName) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const ref = registeredComponents[componentName];
|
|
29
|
-
if (!ref) {
|
|
30
|
-
// TODO: Public doc page with more info about this message
|
|
31
|
-
console.warn(`
|
|
32
|
-
Could not find a registered component named "${componentName}".
|
|
33
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
34
|
-
return undefined;
|
|
35
|
-
} else {
|
|
36
|
-
return ref;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const getRepeatItemData = ({
|
|
40
|
-
block,
|
|
41
|
-
context
|
|
42
|
-
}: {
|
|
43
|
-
block: BuilderBlock;
|
|
44
|
-
context: BuilderContextInterface;
|
|
45
|
-
}): RepeatData[] | undefined => {
|
|
46
|
-
/**
|
|
47
|
-
* we don't use `state.processedBlock` here because the processing done within its logic includes evaluating the block's bindings,
|
|
48
|
-
* which will not work if there is a repeat.
|
|
49
|
-
*/
|
|
50
|
-
const {
|
|
51
|
-
repeat,
|
|
52
|
-
...blockWithoutRepeat
|
|
53
|
-
} = block;
|
|
54
|
-
if (!repeat?.collection) {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
const itemsArray = evaluate({
|
|
58
|
-
code: repeat.collection,
|
|
59
|
-
localState: context.localState,
|
|
60
|
-
rootState: context.rootState,
|
|
61
|
-
rootSetState: context.rootSetState,
|
|
62
|
-
context: context.context,
|
|
63
|
-
enableCache: true
|
|
64
|
-
});
|
|
65
|
-
if (!Array.isArray(itemsArray)) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
const collectionName = repeat.collection.split('.').pop();
|
|
69
|
-
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + 'Item' : 'item');
|
|
70
|
-
const repeatArray = itemsArray.map<RepeatData>((item, index) => ({
|
|
71
|
-
context: {
|
|
72
|
-
...context,
|
|
73
|
-
localState: {
|
|
74
|
-
...context.localState,
|
|
75
|
-
$index: index,
|
|
76
|
-
$item: item,
|
|
77
|
-
[itemNameToUse]: item,
|
|
78
|
-
[`$${itemNameToUse}Index`]: index
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
block: blockWithoutRepeat
|
|
82
|
-
}));
|
|
83
|
-
return repeatArray;
|
|
84
|
-
};
|
|
85
|
-
export const getInheritedStyles = ({
|
|
86
|
-
block,
|
|
87
|
-
context
|
|
88
|
-
}: {
|
|
89
|
-
block: BuilderBlock;
|
|
90
|
-
context: BuilderContextInterface;
|
|
91
|
-
}) => {
|
|
92
|
-
const style = getStyle({
|
|
93
|
-
block,
|
|
94
|
-
context
|
|
95
|
-
});
|
|
96
|
-
if (!style) {
|
|
97
|
-
return {};
|
|
98
|
-
}
|
|
99
|
-
return extractTextStyles(style);
|
|
100
|
-
};
|
|
101
|
-
export const shouldPassLinkComponent = (block: RegisteredComponent | null | undefined) => {
|
|
102
|
-
return block && (block.isRSC || ['Core:Button', 'Symbol', 'Columns', 'Form:Form', 'Builder: Tabs', 'Builder:Accordion'].includes(block.name));
|
|
103
|
-
};
|
|
104
|
-
export const shouldPassRegisteredComponents = (block: RegisteredComponent | null | undefined) => {
|
|
105
|
-
return block && (block.isRSC || ['Symbol', 'Columns', 'Form:Form', 'Builder: Tabs', 'Builder:Accordion'].includes(block.name));
|
|
106
|
-
}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import BaseText from "../../blocks/BaseText";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import {
|
|
4
|
-
FlatList,
|
|
5
|
-
ScrollView,
|
|
6
|
-
View,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Image,
|
|
9
|
-
Text,
|
|
10
|
-
Pressable,
|
|
11
|
-
TextInput,
|
|
12
|
-
} from "react-native";
|
|
13
|
-
import { useEffect } from "react";
|
|
14
|
-
|
|
15
|
-
export type BlockProps = {
|
|
16
|
-
block: BuilderBlock;
|
|
17
|
-
context: BuilderContextInterface;
|
|
18
|
-
registeredComponents: RegisteredComponents;
|
|
19
|
-
linkComponent: any;
|
|
20
|
-
};
|
|
21
|
-
import type {
|
|
22
|
-
BuilderContextInterface,
|
|
23
|
-
RegisteredComponents,
|
|
24
|
-
} from "../../context/types";
|
|
25
|
-
import { getBlockComponentOptions } from "../../functions/get-block-component-options";
|
|
26
|
-
import { getProcessedBlock } from "../../functions/get-processed-block";
|
|
27
|
-
import type { BuilderBlock } from "../../types/builder-block";
|
|
28
|
-
import DynamicDiv from "../dynamic-div";
|
|
29
|
-
import { bindAnimations } from "./animator";
|
|
30
|
-
import {
|
|
31
|
-
getComponent,
|
|
32
|
-
getInheritedStyles,
|
|
33
|
-
getRepeatItemData,
|
|
34
|
-
shouldPassLinkComponent,
|
|
35
|
-
shouldPassRegisteredComponents,
|
|
36
|
-
} from "./block.helpers";
|
|
37
|
-
import BlockStyles from "./components/block-styles";
|
|
38
|
-
import BlockWrapper from "./components/block-wrapper";
|
|
39
|
-
import type { ComponentProps } from "./components/component-ref/component-ref.helpers";
|
|
40
|
-
import ComponentRef from "./components/component-ref/component-ref";
|
|
41
|
-
import RepeatedBlock from "./components/repeated-block";
|
|
42
|
-
|
|
43
|
-
function Block(props: BlockProps) {
|
|
44
|
-
function blockComponent() {
|
|
45
|
-
return getComponent({
|
|
46
|
-
block: props.block,
|
|
47
|
-
context: props.context,
|
|
48
|
-
registeredComponents: props.registeredComponents,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function repeatItem() {
|
|
53
|
-
return getRepeatItemData({
|
|
54
|
-
block: props.block,
|
|
55
|
-
context: props.context,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function processedBlock() {
|
|
60
|
-
return props.block.repeat?.collection
|
|
61
|
-
? props.block
|
|
62
|
-
: getProcessedBlock({
|
|
63
|
-
block: props.block,
|
|
64
|
-
localState: props.context.localState,
|
|
65
|
-
rootState: props.context.rootState,
|
|
66
|
-
rootSetState: props.context.rootSetState,
|
|
67
|
-
context: props.context.context,
|
|
68
|
-
shouldEvaluateBindings: true,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function Tag() {
|
|
73
|
-
const shouldUseLink =
|
|
74
|
-
props.block.tagName === "a" ||
|
|
75
|
-
processedBlock().properties?.href ||
|
|
76
|
-
processedBlock().href;
|
|
77
|
-
if (shouldUseLink) {
|
|
78
|
-
return props.linkComponent || BaseText;
|
|
79
|
-
}
|
|
80
|
-
return View;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function canShowBlock() {
|
|
84
|
-
if (props.block.repeat?.collection) {
|
|
85
|
-
if (repeatItem?.()?.length) return true;
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
const shouldHide =
|
|
89
|
-
"hide" in processedBlock() ? processedBlock().hide : false;
|
|
90
|
-
const shouldShow =
|
|
91
|
-
"show" in processedBlock() ? processedBlock().show : true;
|
|
92
|
-
return shouldShow && !shouldHide;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function childrenWithoutParentComponent() {
|
|
96
|
-
/**
|
|
97
|
-
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
98
|
-
* we render them outside of `componentRef`.
|
|
99
|
-
* NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
|
|
100
|
-
* blocks, and the children will be repeated within those blocks.
|
|
101
|
-
*/
|
|
102
|
-
const shouldRenderChildrenOutsideRef =
|
|
103
|
-
!blockComponent?.()?.component && !repeatItem();
|
|
104
|
-
return shouldRenderChildrenOutsideRef
|
|
105
|
-
? processedBlock().children ?? []
|
|
106
|
-
: [];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function componentRefProps() {
|
|
110
|
-
return {
|
|
111
|
-
blockChildren: processedBlock().children ?? [],
|
|
112
|
-
componentRef: blockComponent?.()?.component,
|
|
113
|
-
componentOptions: {
|
|
114
|
-
...getBlockComponentOptions(processedBlock()),
|
|
115
|
-
builderContext: props.context,
|
|
116
|
-
...(shouldPassLinkComponent(blockComponent())
|
|
117
|
-
? {
|
|
118
|
-
builderLinkComponent: props.linkComponent,
|
|
119
|
-
}
|
|
120
|
-
: {}),
|
|
121
|
-
...(shouldPassRegisteredComponents(blockComponent())
|
|
122
|
-
? {
|
|
123
|
-
builderComponents: props.registeredComponents,
|
|
124
|
-
}
|
|
125
|
-
: {}),
|
|
126
|
-
},
|
|
127
|
-
context: {
|
|
128
|
-
...props.context,
|
|
129
|
-
inheritedStyles: getInheritedStyles({
|
|
130
|
-
block: processedBlock(),
|
|
131
|
-
context: props.context,
|
|
132
|
-
}),
|
|
133
|
-
} as any,
|
|
134
|
-
linkComponent: props.linkComponent,
|
|
135
|
-
registeredComponents: props.registeredComponents,
|
|
136
|
-
builderBlock: processedBlock(),
|
|
137
|
-
includeBlockProps: blockComponent?.()?.noWrap === true,
|
|
138
|
-
isInteractive: !blockComponent?.()?.isRSC,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
const blockId = processedBlock().id;
|
|
144
|
-
const animations = processedBlock().animations;
|
|
145
|
-
if (animations && blockId) {
|
|
146
|
-
bindAnimations(
|
|
147
|
-
animations.map((animation) => ({
|
|
148
|
-
...animation,
|
|
149
|
-
elementId: blockId,
|
|
150
|
-
}))
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}, []);
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<>
|
|
157
|
-
{canShowBlock() ? (
|
|
158
|
-
<>
|
|
159
|
-
<BlockStyles block={props.block} context={props.context} />
|
|
160
|
-
{!blockComponent?.()?.noWrap ? (
|
|
161
|
-
<>
|
|
162
|
-
{!repeatItem() ? (
|
|
163
|
-
<BlockWrapper
|
|
164
|
-
Wrapper={Tag()}
|
|
165
|
-
block={processedBlock()}
|
|
166
|
-
context={props.context}
|
|
167
|
-
linkComponent={props.linkComponent}
|
|
168
|
-
>
|
|
169
|
-
<ComponentRef
|
|
170
|
-
componentRef={componentRefProps().componentRef}
|
|
171
|
-
componentOptions={componentRefProps().componentOptions}
|
|
172
|
-
blockChildren={componentRefProps().blockChildren}
|
|
173
|
-
context={componentRefProps().context}
|
|
174
|
-
registeredComponents={
|
|
175
|
-
componentRefProps().registeredComponents
|
|
176
|
-
}
|
|
177
|
-
linkComponent={componentRefProps().linkComponent}
|
|
178
|
-
builderBlock={componentRefProps().builderBlock}
|
|
179
|
-
includeBlockProps={componentRefProps().includeBlockProps}
|
|
180
|
-
isInteractive={componentRefProps().isInteractive}
|
|
181
|
-
/>
|
|
182
|
-
{childrenWithoutParentComponent()?.map((child) => (
|
|
183
|
-
<Block
|
|
184
|
-
key={child.id}
|
|
185
|
-
block={child}
|
|
186
|
-
registeredComponents={props.registeredComponents}
|
|
187
|
-
linkComponent={props.linkComponent}
|
|
188
|
-
context={
|
|
189
|
-
{
|
|
190
|
-
...props.context,
|
|
191
|
-
inheritedStyles: getInheritedStyles({
|
|
192
|
-
block: processedBlock(),
|
|
193
|
-
context: props.context,
|
|
194
|
-
}),
|
|
195
|
-
} as any
|
|
196
|
-
}
|
|
197
|
-
/>
|
|
198
|
-
))}
|
|
199
|
-
</BlockWrapper>
|
|
200
|
-
) : (
|
|
201
|
-
<>
|
|
202
|
-
{repeatItem()?.map((data, index) => (
|
|
203
|
-
<RepeatedBlock
|
|
204
|
-
key={index}
|
|
205
|
-
repeatContext={data.context}
|
|
206
|
-
block={data.block}
|
|
207
|
-
registeredComponents={props.registeredComponents}
|
|
208
|
-
linkComponent={props.linkComponent}
|
|
209
|
-
/>
|
|
210
|
-
))}
|
|
211
|
-
</>
|
|
212
|
-
)}
|
|
213
|
-
</>
|
|
214
|
-
) : (
|
|
215
|
-
<>
|
|
216
|
-
<ComponentRef
|
|
217
|
-
componentRef={componentRefProps().componentRef}
|
|
218
|
-
componentOptions={componentRefProps().componentOptions}
|
|
219
|
-
blockChildren={componentRefProps().blockChildren}
|
|
220
|
-
context={componentRefProps().context}
|
|
221
|
-
registeredComponents={componentRefProps().registeredComponents}
|
|
222
|
-
linkComponent={componentRefProps().linkComponent}
|
|
223
|
-
builderBlock={componentRefProps().builderBlock}
|
|
224
|
-
includeBlockProps={componentRefProps().includeBlockProps}
|
|
225
|
-
isInteractive={componentRefProps().isInteractive}
|
|
226
|
-
/>
|
|
227
|
-
</>
|
|
228
|
-
)}
|
|
229
|
-
</>
|
|
230
|
-
) : null}
|
|
231
|
-
</>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export default Block;
|