@builder.io/sdk-react 0.2.1 → 0.2.3-0
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/CHANGELOG.md +6 -0
- package/dist/react/blocks/BaseText.d.ts +2 -0
- package/dist/react/blocks/BaseText.js +1 -0
- package/dist/react/blocks/button/button.d.ts +2 -0
- package/dist/react/blocks/button/button.js +1 -0
- package/dist/react/blocks/button/component-info.d.ts +38 -0
- package/dist/react/blocks/columns/columns.d.ts +2 -0
- package/dist/react/blocks/columns/columns.js +1 -0
- package/dist/react/blocks/columns/component-info.d.ts +176 -0
- package/dist/react/blocks/custom-code/component-info.d.ts +31 -0
- package/dist/react/blocks/custom-code/custom-code.d.ts +2 -0
- package/dist/react/blocks/custom-code/custom-code.js +1 -0
- package/dist/react/blocks/embed/component-info.d.ts +22 -0
- package/dist/react/blocks/embed/embed.d.ts +2 -0
- package/dist/react/blocks/embed/embed.js +1 -0
- package/dist/react/blocks/embed/helpers.d.ts +1 -0
- package/dist/react/blocks/form/component-info.d.ts +235 -0
- package/dist/react/blocks/form/form.d.ts +2 -0
- package/dist/react/blocks/form/form.js +1 -0
- package/dist/react/blocks/fragment/component-info.d.ts +8 -0
- package/dist/react/blocks/fragment/fragment.d.ts +2 -0
- package/dist/react/blocks/fragment/fragment.js +1 -0
- package/dist/react/blocks/image/component-info.d.ts +114 -0
- package/dist/react/blocks/image/image.d.ts +2 -0
- package/dist/react/blocks/image/image.helpers.d.ts +1 -0
- package/dist/react/blocks/image/image.js +1 -0
- package/dist/react/blocks/img/component-info.d.ts +15 -0
- package/dist/react/blocks/img/img.d.ts +2 -0
- package/dist/react/blocks/img/img.js +1 -0
- package/dist/react/blocks/input/component-info.d.ts +66 -0
- package/dist/react/blocks/input/input.d.ts +2 -0
- package/dist/react/blocks/input/input.js +1 -0
- package/dist/react/blocks/raw-text/component-info.d.ts +10 -0
- package/dist/react/blocks/raw-text/raw-text.d.ts +2 -0
- package/dist/react/blocks/raw-text/raw-text.js +1 -0
- package/dist/react/blocks/section/component-info.d.ts +43 -0
- package/dist/react/blocks/section/section.d.ts +2 -0
- package/dist/react/blocks/section/section.js +1 -0
- package/dist/react/blocks/select/component-info.d.ts +61 -0
- package/dist/react/blocks/select/select.d.ts +2 -0
- package/dist/react/blocks/select/select.js +1 -0
- package/dist/react/blocks/submit-button/component-info.d.ts +23 -0
- package/dist/react/blocks/submit-button/submit-button.d.ts +2 -0
- package/dist/react/blocks/submit-button/submit-button.js +1 -0
- package/dist/react/blocks/symbol/component-info.d.ts +35 -0
- package/dist/react/blocks/symbol/symbol.d.ts +2 -0
- package/dist/react/blocks/symbol/symbol.js +3 -1
- package/dist/react/blocks/text/component-info.d.ts +19 -0
- package/dist/react/blocks/text/text.d.ts +2 -0
- package/dist/react/blocks/text/text.js +1 -0
- package/dist/react/blocks/textarea/component-info.d.ts +53 -0
- package/dist/react/blocks/textarea/textarea.d.ts +2 -0
- package/dist/react/blocks/textarea/textarea.js +1 -0
- package/dist/react/blocks/util.d.ts +1 -0
- package/dist/react/blocks/video/component-info.d.ts +80 -0
- package/dist/react/blocks/video/video.d.ts +2 -0
- package/dist/react/blocks/video/video.js +1 -0
- package/dist/react/components/render-block/block-styles.d.ts +2 -0
- package/dist/react/components/render-block/block-styles.js +1 -0
- package/dist/react/components/render-block/render-block.d.ts +2 -0
- package/dist/react/components/render-block/render-block.helpers.d.ts +13 -0
- package/dist/react/components/render-block/render-block.js +3 -3
- package/dist/react/components/render-block/render-component.d.ts +2 -0
- package/dist/react/components/render-block/render-component.js +1 -0
- package/dist/react/components/render-block/render-repeated-block.d.ts +2 -0
- package/dist/react/components/render-block/render-repeated-block.js +1 -0
- package/dist/react/components/render-blocks.d.ts +2 -0
- package/dist/react/components/render-blocks.js +1 -0
- package/dist/react/components/render-content/builder-editing.d.ts +2 -0
- package/dist/react/components/render-content/builder-editing.js +1 -0
- package/dist/react/components/render-content/components/render-styles.d.ts +2 -0
- package/dist/react/components/render-content/components/render-styles.helpers.d.ts +7 -0
- package/dist/react/components/render-content/components/render-styles.js +1 -0
- package/dist/react/components/render-content/index.d.ts +2 -0
- package/dist/react/components/render-content/render-content.d.ts +2 -0
- package/dist/react/components/render-content/render-content.helpers.d.ts +9 -0
- package/dist/react/components/render-content/render-content.js +9 -7
- package/dist/react/components/render-content-variants/helpers.js +98 -0
- package/dist/react/components/render-content-variants/render-content-variants.js +45 -0
- package/dist/react/components/render-inlined-styles.d.ts +2 -0
- package/dist/react/components/render-inlined-styles.js +1 -0
- package/dist/react/constants/builder-registered-components.d.ts +1 -0
- package/dist/react/constants/device-sizes.d.ts +21 -0
- package/dist/react/constants/target.d.ts +1 -0
- package/dist/react/context/builder.context.d.ts +11 -0
- package/dist/react/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/react/functions/evaluate.d.ts +7 -0
- package/dist/react/functions/event-handler-name.d.ts +1 -0
- package/dist/react/functions/extract-text-styles.d.ts +1 -0
- package/dist/react/functions/fast-clone.d.ts +1 -0
- package/dist/react/functions/get-block-actions-handler.d.ts +1 -0
- package/dist/react/functions/get-block-actions.d.ts +1 -0
- package/dist/react/functions/get-block-component-options.d.ts +1 -0
- package/dist/react/functions/get-block-properties.d.ts +1 -0
- package/dist/react/functions/get-block-properties.js +4 -1
- package/dist/react/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/react/functions/get-builder-search-params/index.d.ts +4 -0
- package/dist/react/functions/get-content/ab-testing.d.ts +1 -0
- package/dist/react/functions/get-content/generate-content-url.d.ts +1 -0
- package/dist/react/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/react/functions/get-content/index.d.ts +2 -0
- package/dist/react/functions/get-content/index.js +22 -15
- package/dist/react/functions/get-fetch.d.ts +1 -0
- package/dist/react/functions/get-global-this.d.ts +1 -0
- package/dist/react/functions/get-processed-block.d.ts +6 -0
- package/dist/react/functions/get-processed-block.test.d.ts +1 -0
- package/dist/react/functions/get-react-native-block-styles.d.ts +5 -0
- package/dist/react/functions/if-target.d.ts +5 -0
- package/dist/react/functions/is-browser.d.ts +1 -0
- package/dist/react/functions/is-editing.d.ts +1 -0
- package/dist/react/functions/is-iframe.d.ts +1 -0
- package/dist/react/functions/is-previewing.d.ts +1 -0
- package/dist/react/functions/on-change.d.ts +2 -0
- package/dist/react/functions/on-change.test.d.ts +1 -0
- package/dist/react/functions/register-component.d.ts +6 -0
- package/dist/react/functions/register.d.ts +1 -0
- package/dist/react/functions/sanitize-react-native-block-styles.d.ts +1 -0
- package/dist/react/functions/set-editor-settings.d.ts +1 -0
- package/dist/react/functions/set.d.ts +1 -0
- package/dist/react/functions/set.test.d.ts +1 -0
- package/dist/react/functions/track/helpers.d.ts +5 -0
- package/dist/react/functions/track/index.d.ts +2 -0
- package/dist/react/functions/track/index.js +2 -1
- package/dist/react/functions/track/interaction.d.ts +14 -0
- package/dist/react/functions/transform-block-properties.d.ts +1 -0
- package/dist/react/functions/transform-block.d.ts +1 -0
- package/dist/react/helpers/ab-tests.d.ts +9 -0
- package/dist/react/helpers/cookie.d.ts +2 -0
- package/dist/react/helpers/css.d.ts +7 -0
- package/dist/react/helpers/flatten.d.ts +1 -0
- package/dist/react/helpers/localStorage.d.ts +9 -0
- package/dist/react/helpers/logger.d.ts +5 -0
- package/dist/react/helpers/logger.js +7 -0
- package/dist/react/helpers/nullable.d.ts +1 -0
- package/dist/react/helpers/sessionId.d.ts +6 -0
- package/dist/react/helpers/time.d.ts +1 -0
- package/dist/react/helpers/url.d.ts +1 -0
- package/dist/react/helpers/url.test.d.ts +1 -0
- package/dist/react/helpers/uuid.d.ts +2 -0
- package/dist/react/helpers/visitorId.d.ts +8 -0
- package/dist/react/index-helpers/blocks-exports.d.ts +11 -0
- package/dist/react/index-helpers/top-of-file.d.ts +2 -0
- package/{src/index.js → dist/react/index.d.ts} +2 -5
- package/dist/react/scripts/init-editing.d.ts +2 -0
- package/dist/react/types/api-version.d.ts +1 -0
- package/dist/react/types/targets.d.ts +0 -0
- package/dist/react/types/typescript.d.ts +0 -0
- package/dist/rsc/blocks/BaseText.d.ts +2 -0
- package/dist/rsc/blocks/button/button.d.ts +2 -0
- package/dist/rsc/blocks/button/component-info.d.ts +38 -0
- package/dist/rsc/blocks/columns/columns.d.ts +2 -0
- package/dist/rsc/blocks/columns/component-info.d.ts +176 -0
- package/dist/rsc/blocks/custom-code/component-info.d.ts +31 -0
- package/dist/rsc/blocks/custom-code/custom-code.d.ts +2 -0
- package/dist/rsc/blocks/embed/component-info.d.ts +22 -0
- package/dist/rsc/blocks/embed/embed.d.ts +2 -0
- package/dist/rsc/blocks/embed/helpers.d.ts +1 -0
- package/dist/rsc/blocks/form/component-info.d.ts +235 -0
- package/dist/rsc/blocks/form/form.d.ts +2 -0
- package/dist/rsc/blocks/fragment/component-info.d.ts +8 -0
- package/dist/rsc/blocks/fragment/fragment.d.ts +2 -0
- package/dist/rsc/blocks/image/component-info.d.ts +114 -0
- package/dist/rsc/blocks/image/image.d.ts +2 -0
- package/dist/rsc/blocks/image/image.helpers.d.ts +1 -0
- package/dist/rsc/blocks/img/component-info.d.ts +15 -0
- package/dist/rsc/blocks/img/img.d.ts +2 -0
- package/dist/rsc/blocks/input/component-info.d.ts +66 -0
- package/dist/rsc/blocks/input/input.d.ts +2 -0
- package/dist/rsc/blocks/raw-text/component-info.d.ts +10 -0
- package/dist/rsc/blocks/raw-text/raw-text.d.ts +2 -0
- package/dist/rsc/blocks/section/component-info.d.ts +43 -0
- package/dist/rsc/blocks/section/section.d.ts +2 -0
- package/dist/rsc/blocks/select/component-info.d.ts +61 -0
- package/dist/rsc/blocks/select/select.d.ts +2 -0
- package/dist/rsc/blocks/submit-button/component-info.d.ts +23 -0
- package/dist/rsc/blocks/submit-button/submit-button.d.ts +2 -0
- package/dist/rsc/blocks/symbol/component-info.d.ts +35 -0
- package/dist/rsc/blocks/symbol/symbol.d.ts +2 -0
- package/dist/rsc/blocks/symbol/symbol.js +2 -1
- package/dist/rsc/blocks/text/component-info.d.ts +19 -0
- package/dist/rsc/blocks/text/text.d.ts +2 -0
- package/dist/rsc/blocks/textarea/component-info.d.ts +53 -0
- package/dist/rsc/blocks/textarea/textarea.d.ts +2 -0
- package/dist/rsc/blocks/util.d.ts +1 -0
- package/dist/rsc/blocks/video/component-info.d.ts +80 -0
- package/dist/rsc/blocks/video/video.d.ts +2 -0
- package/dist/rsc/components/render-block/block-styles.d.ts +2 -0
- package/dist/rsc/components/render-block/render-block.d.ts +2 -0
- package/dist/rsc/components/render-block/render-block.helpers.d.ts +10 -0
- package/dist/rsc/components/render-block/render-block.js +2 -3
- package/dist/rsc/components/render-block/render-component.d.ts +2 -0
- package/dist/rsc/components/render-block/render-repeated-block.d.ts +2 -0
- package/dist/rsc/components/render-block/types.d.ts +0 -0
- package/dist/rsc/components/render-blocks.d.ts +2 -0
- package/dist/rsc/components/render-content/builder-editing.d.ts +27 -0
- package/dist/rsc/components/render-content/components/render-styles.d.ts +2 -0
- package/dist/rsc/components/render-content/components/render-styles.helpers.d.ts +7 -0
- package/dist/rsc/components/render-content/index.d.ts +2 -0
- package/dist/rsc/components/render-content/render-content.d.ts +2 -0
- package/dist/rsc/components/render-content/render-content.helpers.d.ts +9 -0
- package/dist/rsc/components/render-content/render-content.js +1 -0
- package/dist/rsc/components/render-content/render-content.types.d.ts +0 -0
- package/dist/rsc/components/render-content-variants/helpers.js +99 -0
- package/dist/rsc/components/render-content-variants/render-content-variants.js +45 -0
- package/dist/rsc/components/render-inlined-styles.d.ts +2 -0
- package/dist/rsc/constants/builder-registered-components.d.ts +1 -0
- package/dist/rsc/constants/device-sizes.d.ts +21 -0
- package/dist/rsc/constants/target.d.ts +1 -0
- package/dist/rsc/context/builder.context.d.ts +11 -0
- package/dist/rsc/context/types.d.ts +0 -0
- package/dist/rsc/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/rsc/functions/evaluate.d.ts +1 -0
- package/dist/rsc/functions/event-handler-name.d.ts +1 -0
- package/dist/rsc/functions/extract-text-styles.d.ts +1 -0
- package/dist/rsc/functions/fast-clone.d.ts +1 -0
- package/dist/rsc/functions/get-block-actions-handler.d.ts +1 -0
- package/dist/rsc/functions/get-block-actions.d.ts +1 -0
- package/dist/rsc/functions/get-block-component-options.d.ts +1 -0
- package/dist/rsc/functions/get-block-properties.d.ts +1 -0
- package/dist/rsc/functions/get-block-properties.js +4 -1
- package/dist/rsc/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/rsc/functions/get-builder-search-params/index.d.ts +4 -0
- package/dist/rsc/functions/get-content/ab-testing.d.ts +1 -0
- package/dist/rsc/functions/get-content/generate-content-url.d.ts +1 -0
- package/dist/rsc/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/rsc/functions/get-content/index.d.ts +2 -0
- package/dist/rsc/functions/get-content/index.js +22 -15
- package/dist/rsc/functions/get-content/types.d.ts +0 -0
- package/dist/rsc/functions/get-fetch.d.ts +1 -0
- package/dist/rsc/functions/get-global-this.d.ts +1 -0
- package/dist/rsc/functions/get-processed-block.d.ts +6 -0
- package/dist/rsc/functions/get-processed-block.test.d.ts +1 -0
- package/dist/rsc/functions/get-react-native-block-styles.d.ts +5 -0
- package/dist/rsc/functions/if-target.d.ts +5 -0
- package/dist/rsc/functions/is-browser.d.ts +1 -0
- package/dist/rsc/functions/is-editing.d.ts +1 -0
- package/dist/rsc/functions/is-iframe.d.ts +1 -0
- package/dist/rsc/functions/is-previewing.d.ts +1 -0
- package/dist/rsc/functions/on-change.d.ts +2 -0
- package/dist/rsc/functions/on-change.test.d.ts +1 -0
- package/dist/rsc/functions/register-component.d.ts +6 -0
- package/dist/rsc/functions/register.d.ts +1 -0
- package/dist/rsc/functions/sanitize-react-native-block-styles.d.ts +1 -0
- package/dist/rsc/functions/set-editor-settings.d.ts +1 -0
- package/dist/rsc/functions/set.d.ts +1 -0
- package/dist/rsc/functions/set.test.d.ts +1 -0
- package/dist/rsc/functions/track/helpers.d.ts +5 -0
- package/dist/rsc/functions/track/index.d.ts +2 -0
- package/dist/rsc/functions/track/index.js +2 -1
- package/dist/rsc/functions/track/interaction.d.ts +14 -0
- package/dist/rsc/functions/transform-block-properties.d.ts +1 -0
- package/dist/rsc/functions/transform-block.d.ts +1 -0
- package/dist/rsc/helpers/ab-tests.d.ts +9 -0
- package/dist/rsc/helpers/cookie.d.ts +2 -0
- package/dist/rsc/helpers/css.d.ts +7 -0
- package/dist/rsc/helpers/flatten.d.ts +1 -0
- package/dist/rsc/helpers/localStorage.d.ts +9 -0
- package/dist/rsc/helpers/logger.d.ts +5 -0
- package/dist/rsc/helpers/logger.js +7 -0
- package/dist/rsc/helpers/nullable.d.ts +1 -0
- package/dist/rsc/helpers/sessionId.d.ts +6 -0
- package/dist/rsc/helpers/time.d.ts +1 -0
- package/dist/rsc/helpers/url.d.ts +1 -0
- package/dist/rsc/helpers/url.test.d.ts +1 -0
- package/dist/rsc/helpers/uuid.d.ts +2 -0
- package/dist/rsc/helpers/visitorId.d.ts +8 -0
- package/dist/rsc/index-helpers/blocks-exports.d.ts +11 -0
- package/dist/rsc/index-helpers/top-of-file.d.ts +2 -0
- package/dist/rsc/index.d.ts +11 -0
- package/dist/rsc/scripts/init-editing.d.ts +2 -0
- package/dist/rsc/types/api-version.d.ts +1 -0
- package/dist/rsc/types/builder-block.d.ts +0 -0
- package/dist/rsc/types/builder-content.d.ts +0 -0
- package/dist/rsc/types/can-track.d.ts +0 -0
- package/dist/rsc/types/components.d.ts +0 -0
- package/dist/rsc/types/deep-partial.d.ts +0 -0
- package/dist/rsc/types/element.d.ts +0 -0
- package/dist/rsc/types/input.d.ts +0 -0
- package/dist/rsc/types/targets.d.ts +0 -0
- package/dist/rsc/types/typescript.d.ts +0 -0
- package/package.json +4 -10
- package/packages/react/src/blocks/BaseText.jsx +1 -0
- package/packages/react/src/blocks/button/button.jsx +1 -0
- package/packages/react/src/blocks/columns/columns.jsx +1 -0
- package/packages/react/src/blocks/custom-code/custom-code.jsx +1 -0
- package/packages/react/src/blocks/embed/embed.jsx +1 -0
- package/packages/react/src/blocks/form/form.jsx +1 -0
- package/packages/react/src/blocks/fragment/fragment.jsx +1 -0
- package/packages/react/src/blocks/image/image.jsx +1 -0
- package/packages/react/src/blocks/img/img.jsx +1 -0
- package/packages/react/src/blocks/input/input.jsx +1 -0
- package/packages/react/src/blocks/raw-text/raw-text.jsx +1 -0
- package/packages/react/src/blocks/section/section.jsx +1 -0
- package/packages/react/src/blocks/select/select.jsx +1 -0
- package/packages/react/src/blocks/submit-button/submit-button.jsx +1 -0
- package/packages/react/src/blocks/symbol/symbol.jsx +3 -1
- package/packages/react/src/blocks/text/text.jsx +1 -0
- package/packages/react/src/blocks/textarea/textarea.jsx +1 -0
- package/packages/react/src/blocks/video/video.jsx +1 -0
- package/packages/react/src/components/render-block/block-styles.jsx +1 -0
- package/packages/react/src/components/render-block/render-block.jsx +3 -3
- package/packages/react/src/components/render-block/render-component.jsx +1 -0
- package/packages/react/src/components/render-block/render-repeated-block.jsx +1 -0
- package/packages/react/src/components/render-blocks.jsx +1 -0
- package/packages/react/src/components/render-content/builder-editing.jsx +1 -0
- package/packages/react/src/components/render-content/components/render-styles.jsx +1 -0
- package/packages/react/src/components/render-content/render-content.jsx +12 -8
- package/packages/react/src/components/render-inlined-styles.jsx +1 -0
- package/packages/react/src/functions/get-block-properties.js +4 -1
- package/packages/react/src/functions/get-content/index.js +21 -15
- package/packages/react/src/functions/track/index.js +2 -1
- package/packages/react/src/helpers/logger.js +9 -0
- package/packages/rsc/src/blocks/symbol/symbol.jsx +2 -4
- package/packages/rsc/src/components/render-block/render-block.jsx +2 -3
- package/packages/rsc/src/components/render-content/render-content.jsx +1 -0
- package/packages/rsc/src/functions/get-block-properties.js +4 -1
- package/packages/rsc/src/functions/get-content/index.js +21 -15
- package/packages/rsc/src/functions/track/index.js +2 -1
- package/packages/rsc/src/helpers/logger.js +9 -0
- package/tsconfig.base.json +8 -3
- package/src/blocks/BaseText.jsx +0 -9
- package/src/blocks/button/button.jsx +0 -27
- package/src/blocks/button/component-info.js +0 -41
- package/src/blocks/columns/columns.jsx +0 -172
- package/src/blocks/columns/component-info.js +0 -242
- package/src/blocks/custom-code/component-info.js +0 -31
- package/src/blocks/custom-code/custom-code.jsx +0 -64
- package/src/blocks/embed/component-info.js +0 -44
- package/src/blocks/embed/embed.jsx +0 -49
- package/src/blocks/embed/helpers.js +0 -9
- package/src/blocks/form/component-info.js +0 -262
- package/src/blocks/form/form.jsx +0 -253
- package/src/blocks/fragment/component-info.js +0 -11
- package/src/blocks/fragment/fragment.jsx +0 -5
- package/src/blocks/image/component-info.js +0 -151
- package/src/blocks/image/image.helpers.js +0 -48
- package/src/blocks/image/image.jsx +0 -122
- package/src/blocks/img/component-info.js +0 -20
- package/src/blocks/img/img.jsx +0 -17
- package/src/blocks/input/component-info.js +0 -74
- package/src/blocks/input/input.jsx +0 -19
- package/src/blocks/raw-text/component-info.js +0 -16
- package/src/blocks/raw-text/raw-text.jsx +0 -10
- package/src/blocks/section/component-info.js +0 -49
- package/src/blocks/section/section.jsx +0 -27
- package/src/blocks/select/component-info.js +0 -59
- package/src/blocks/select/select.jsx +0 -20
- package/src/blocks/submit-button/component-info.js +0 -28
- package/src/blocks/submit-button/submit-button.jsx +0 -9
- package/src/blocks/symbol/component-info.js +0 -43
- package/src/blocks/symbol/symbol.jsx +0 -84
- package/src/blocks/text/component-info.js +0 -24
- package/src/blocks/text/text.jsx +0 -10
- package/src/blocks/textarea/component-info.js +0 -47
- package/src/blocks/textarea/textarea.jsx +0 -13
- package/src/blocks/util.js +0 -8
- package/src/blocks/video/component-info.js +0 -106
- package/src/blocks/video/video.jsx +0 -58
- package/src/components/render-block/block-styles.jsx +0 -69
- package/src/components/render-block/render-block.helpers.js +0 -23
- package/src/components/render-block/render-block.jsx +0 -252
- package/src/components/render-block/render-component-with-context.jsx +0 -38
- package/src/components/render-block/render-component.jsx +0 -33
- package/src/components/render-block/render-repeated-block.jsx +0 -33
- package/src/components/render-blocks.jsx +0 -89
- package/src/components/render-content/builder-editing.jsx +0 -5
- package/src/components/render-content/components/render-styles.jsx +0 -64
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/render-content.jsx +0 -370
- package/src/components/render-inlined-styles.jsx +0 -28
- package/src/constants/builder-registered-components.js +0 -54
- package/src/constants/device-sizes.js +0 -48
- package/src/constants/target.js +0 -4
- package/src/context/builder.context.js +0 -12
- package/src/functions/camel-to-kebab-case.js +0 -4
- package/src/functions/evaluate.js +0 -29
- package/src/functions/event-handler-name.js +0 -7
- package/src/functions/extract-text-styles.js +0 -22
- package/src/functions/fast-clone.js +0 -4
- package/src/functions/get-block-actions-handler.js +0 -11
- package/src/functions/get-block-actions.js +0 -18
- package/src/functions/get-block-component-options.js +0 -28
- package/src/functions/get-block-properties.js +0 -50
- package/src/functions/get-block-tag.js +0 -6
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-builder-search-params/index.js +0 -38
- package/src/functions/get-content/ab-testing.js +0 -99
- package/src/functions/get-content/generate-content-url.js +0 -55
- package/src/functions/get-content/generate-content-url.test.js +0 -31
- package/src/functions/get-content/index.js +0 -65
- package/src/functions/get-fetch.js +0 -14
- package/src/functions/get-global-this.js +0 -18
- package/src/functions/get-processed-block.js +0 -59
- package/src/functions/get-processed-block.test.js +0 -32
- package/src/functions/get-react-native-block-styles.js +0 -33
- package/src/functions/if-target.js +0 -15
- package/src/functions/is-browser.js +0 -6
- package/src/functions/is-editing.js +0 -7
- package/src/functions/is-iframe.js +0 -7
- package/src/functions/is-previewing.js +0 -14
- package/src/functions/on-change.js +0 -27
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/register-component.js +0 -68
- package/src/functions/register.js +0 -29
- package/src/functions/sanitize-react-native-block-styles.js +0 -66
- package/src/functions/set-editor-settings.js +0 -15
- package/src/functions/set.js +0 -11
- package/src/functions/set.test.js +0 -16
- package/src/functions/track.js +0 -124
- package/src/functions/transform-block-properties.js +0 -6
- package/src/functions/transform-block.js +0 -6
- package/src/helpers/ab-tests.js +0 -16
- package/src/helpers/cookie.js +0 -81
- package/src/helpers/css.js +0 -34
- package/src/helpers/flatten.js +0 -34
- package/src/helpers/localStorage.js +0 -35
- package/src/helpers/nullable.js +0 -4
- package/src/helpers/sessionId.js +0 -52
- package/src/helpers/time.js +0 -5
- package/src/helpers/url.js +0 -13
- package/src/helpers/url.test.js +0 -21
- package/src/helpers/uuid.js +0 -13
- package/src/helpers/visitorId.js +0 -34
- package/src/index-helpers/blocks-exports.js +0 -22
- package/src/index-helpers/top-of-file.js +0 -4
- package/src/scripts/init-editing.js +0 -93
- /package/{src/components/render-block/types.js → dist/react/components/render-block/types.d.ts} +0 -0
- /package/{src/context/types.js → dist/react/components/render-content/render-content.types.d.ts} +0 -0
- /package/{src/functions/get-content/types.js → dist/react/context/types.d.ts} +0 -0
- /package/{src/types/builder-block.js → dist/react/functions/get-content/types.d.ts} +0 -0
- /package/{src/types/builder-content.js → dist/react/types/builder-block.d.ts} +0 -0
- /package/{src/types/can-track.js → dist/react/types/builder-content.d.ts} +0 -0
- /package/{src/types/components.js → dist/react/types/can-track.d.ts} +0 -0
- /package/{src/types/deep-partial.js → dist/react/types/components.d.ts} +0 -0
- /package/{src/types/element.js → dist/react/types/deep-partial.d.ts} +0 -0
- /package/{src/types/targets.js → dist/react/types/element.d.ts} +0 -0
- /package/{src/types/typescript.js → dist/react/types/input.d.ts} +0 -0
package/src/blocks/text/text.jsx
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Form:TextArea",
|
|
3
|
-
builtIn: true,
|
|
4
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
5
|
-
inputs: [
|
|
6
|
-
{
|
|
7
|
-
advanced: true,
|
|
8
|
-
name: "value",
|
|
9
|
-
type: "string"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: "name",
|
|
13
|
-
type: "string",
|
|
14
|
-
required: true,
|
|
15
|
-
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "defaultValue",
|
|
19
|
-
type: "string"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "placeholder",
|
|
23
|
-
type: "string",
|
|
24
|
-
defaultValue: "Hello there"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "required",
|
|
28
|
-
type: "boolean",
|
|
29
|
-
defaultValue: false
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
defaultStyles: {
|
|
33
|
-
paddingTop: "10px",
|
|
34
|
-
paddingBottom: "10px",
|
|
35
|
-
paddingLeft: "10px",
|
|
36
|
-
paddingRight: "10px",
|
|
37
|
-
borderRadius: "3px",
|
|
38
|
-
borderWidth: "1px",
|
|
39
|
-
borderStyle: "solid",
|
|
40
|
-
borderColor: "#ccc"
|
|
41
|
-
},
|
|
42
|
-
static: true,
|
|
43
|
-
noWrap: true
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
componentInfo
|
|
47
|
-
};
|
package/src/blocks/util.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const serializeFn = (fnValue) => {
|
|
2
|
-
const fnStr = fnValue.toString().trim();
|
|
3
|
-
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4
|
-
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
5
|
-
};
|
|
6
|
-
export {
|
|
7
|
-
serializeFn
|
|
8
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Video",
|
|
3
|
-
canHaveChildren: true,
|
|
4
|
-
builtIn: true,
|
|
5
|
-
defaultStyles: {
|
|
6
|
-
minHeight: "20px",
|
|
7
|
-
minWidth: "20px"
|
|
8
|
-
},
|
|
9
|
-
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",
|
|
10
|
-
inputs: [
|
|
11
|
-
{
|
|
12
|
-
name: "video",
|
|
13
|
-
type: "file",
|
|
14
|
-
allowedFileTypes: ["mp4"],
|
|
15
|
-
bubble: true,
|
|
16
|
-
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "posterImage",
|
|
21
|
-
type: "file",
|
|
22
|
-
allowedFileTypes: ["jpeg", "png"],
|
|
23
|
-
helperText: "Image to show before the video plays"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "autoPlay",
|
|
27
|
-
type: "boolean",
|
|
28
|
-
defaultValue: true
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: "controls",
|
|
32
|
-
type: "boolean",
|
|
33
|
-
defaultValue: false
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "muted",
|
|
37
|
-
type: "boolean",
|
|
38
|
-
defaultValue: true
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "loop",
|
|
42
|
-
type: "boolean",
|
|
43
|
-
defaultValue: true
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "playsInline",
|
|
47
|
-
type: "boolean",
|
|
48
|
-
defaultValue: true
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "fit",
|
|
52
|
-
type: "text",
|
|
53
|
-
defaultValue: "cover",
|
|
54
|
-
enum: ["contain", "cover", "fill", "auto"]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "fitContent",
|
|
58
|
-
type: "boolean",
|
|
59
|
-
helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
|
|
60
|
-
defaultValue: true,
|
|
61
|
-
advanced: true
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "position",
|
|
65
|
-
type: "text",
|
|
66
|
-
defaultValue: "center",
|
|
67
|
-
enum: [
|
|
68
|
-
"center",
|
|
69
|
-
"top",
|
|
70
|
-
"left",
|
|
71
|
-
"right",
|
|
72
|
-
"bottom",
|
|
73
|
-
"top left",
|
|
74
|
-
"top right",
|
|
75
|
-
"bottom left",
|
|
76
|
-
"bottom right"
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "height",
|
|
81
|
-
type: "number",
|
|
82
|
-
advanced: true
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "width",
|
|
86
|
-
type: "number",
|
|
87
|
-
advanced: true
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "aspectRatio",
|
|
91
|
-
type: "number",
|
|
92
|
-
advanced: true,
|
|
93
|
-
defaultValue: 0.7004048582995948
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: "lazyLoad",
|
|
97
|
-
type: "boolean",
|
|
98
|
-
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
99
|
-
defaultValue: true,
|
|
100
|
-
advanced: true
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
};
|
|
104
|
-
export {
|
|
105
|
-
componentInfo
|
|
106
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
export default 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
|
-
|
|
34
|
-
function spreadProps() {
|
|
35
|
-
return {
|
|
36
|
-
...props.attributes,
|
|
37
|
-
...videoProps(),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<video
|
|
43
|
-
{...spreadProps()}
|
|
44
|
-
style={{
|
|
45
|
-
width: "100%",
|
|
46
|
-
height: "100%",
|
|
47
|
-
...props.attributes?.style,
|
|
48
|
-
objectFit: props.fit,
|
|
49
|
-
objectPosition: props.position,
|
|
50
|
-
// Hack to get object fit to work as expected and
|
|
51
|
-
// not have the video overflow
|
|
52
|
-
borderRadius: 1,
|
|
53
|
-
}}
|
|
54
|
-
src={props.video || "no-src"}
|
|
55
|
-
poster={props.posterImage}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
getMaxWidthQueryForSize,
|
|
4
|
-
getSizesForBreakpoints,
|
|
5
|
-
} from "../../constants/device-sizes.js";
|
|
6
|
-
import { TARGET } from "../../constants/target.js";
|
|
7
|
-
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
8
|
-
import { createCssClass } from "../../helpers/css.js";
|
|
9
|
-
import RenderInlinedStyles from "../render-inlined-styles.js";
|
|
10
|
-
|
|
11
|
-
export default function BlockStyles(props) {
|
|
12
|
-
function useBlock() {
|
|
13
|
-
return getProcessedBlock({
|
|
14
|
-
block: props.block,
|
|
15
|
-
state: props.context.state,
|
|
16
|
-
context: props.context.context,
|
|
17
|
-
shouldEvaluateBindings: true,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function css() {
|
|
22
|
-
const styles = useBlock().responsiveStyles;
|
|
23
|
-
const content = props.context.content;
|
|
24
|
-
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
|
|
25
|
-
content?.meta?.breakpoints || {}
|
|
26
|
-
);
|
|
27
|
-
const largeStyles = styles?.large;
|
|
28
|
-
const mediumStyles = styles?.medium;
|
|
29
|
-
const smallStyles = styles?.small;
|
|
30
|
-
const className = useBlock().id;
|
|
31
|
-
const largeStylesClass = largeStyles
|
|
32
|
-
? createCssClass({
|
|
33
|
-
className,
|
|
34
|
-
styles: largeStyles,
|
|
35
|
-
})
|
|
36
|
-
: "";
|
|
37
|
-
const mediumStylesClass = mediumStyles
|
|
38
|
-
? createCssClass({
|
|
39
|
-
className,
|
|
40
|
-
styles: mediumStyles,
|
|
41
|
-
mediaQuery: getMaxWidthQueryForSize(
|
|
42
|
-
"medium",
|
|
43
|
-
sizesWithUpdatedBreakpoints
|
|
44
|
-
),
|
|
45
|
-
})
|
|
46
|
-
: "";
|
|
47
|
-
const smallStylesClass = smallStyles
|
|
48
|
-
? createCssClass({
|
|
49
|
-
className,
|
|
50
|
-
styles: smallStyles,
|
|
51
|
-
mediaQuery: getMaxWidthQueryForSize(
|
|
52
|
-
"small",
|
|
53
|
-
sizesWithUpdatedBreakpoints
|
|
54
|
-
),
|
|
55
|
-
})
|
|
56
|
-
: "";
|
|
57
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<>
|
|
62
|
-
{TARGET !== "reactNative" && css() ? (
|
|
63
|
-
<>
|
|
64
|
-
<RenderInlinedStyles styles={css()} />
|
|
65
|
-
</>
|
|
66
|
-
) : null}
|
|
67
|
-
</>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const EMPTY_HTML_ELEMENTS = [
|
|
2
|
-
"area",
|
|
3
|
-
"base",
|
|
4
|
-
"br",
|
|
5
|
-
"col",
|
|
6
|
-
"embed",
|
|
7
|
-
"hr",
|
|
8
|
-
"img",
|
|
9
|
-
"input",
|
|
10
|
-
"keygen",
|
|
11
|
-
"link",
|
|
12
|
-
"meta",
|
|
13
|
-
"param",
|
|
14
|
-
"source",
|
|
15
|
-
"track",
|
|
16
|
-
"wbr"
|
|
17
|
-
];
|
|
18
|
-
const isEmptyHtmlElement = (tagName) => {
|
|
19
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
isEmptyHtmlElement
|
|
23
|
-
};
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
4
|
-
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
5
|
-
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
6
|
-
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
7
|
-
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
8
|
-
import { evaluate } from "../../functions/evaluate.js";
|
|
9
|
-
import BlockStyles from "./block-styles.js";
|
|
10
|
-
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
11
|
-
import RenderRepeatedBlock from "./render-repeated-block.js";
|
|
12
|
-
import { TARGET } from "../../constants/target.js";
|
|
13
|
-
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
14
|
-
import RenderComponentWithContext from "./render-component-with-context.js";
|
|
15
|
-
import RenderComponent from "./render-component.js";
|
|
16
|
-
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
17
|
-
|
|
18
|
-
export default function RenderBlock(props) {
|
|
19
|
-
function component() {
|
|
20
|
-
const componentName = getProcessedBlock({
|
|
21
|
-
block: props.block,
|
|
22
|
-
state: props.context.state,
|
|
23
|
-
context: props.context.context,
|
|
24
|
-
shouldEvaluateBindings: false,
|
|
25
|
-
}).component?.name;
|
|
26
|
-
if (!componentName) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const ref = props.context.registeredComponents[componentName];
|
|
30
|
-
if (!ref) {
|
|
31
|
-
// TODO: Public doc page with more info about this message
|
|
32
|
-
console.warn(`
|
|
33
|
-
Could not find a registered component named "${componentName}".
|
|
34
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
35
|
-
return undefined;
|
|
36
|
-
} else {
|
|
37
|
-
return ref;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function tag() {
|
|
42
|
-
return getBlockTag(useBlock());
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function useBlock() {
|
|
46
|
-
return repeatItemData()
|
|
47
|
-
? props.block
|
|
48
|
-
: getProcessedBlock({
|
|
49
|
-
block: props.block,
|
|
50
|
-
state: props.context.state,
|
|
51
|
-
context: props.context.context,
|
|
52
|
-
shouldEvaluateBindings: true,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function actions() {
|
|
57
|
-
return getBlockActions({
|
|
58
|
-
block: useBlock(),
|
|
59
|
-
state: props.context.state,
|
|
60
|
-
context: props.context.context,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function attributes() {
|
|
65
|
-
const blockProperties = getBlockProperties(useBlock());
|
|
66
|
-
return {
|
|
67
|
-
...blockProperties,
|
|
68
|
-
...(TARGET === "reactNative"
|
|
69
|
-
? {
|
|
70
|
-
style: getReactNativeBlockStyles({
|
|
71
|
-
block: useBlock(),
|
|
72
|
-
context: props.context,
|
|
73
|
-
blockStyles: blockProperties.style,
|
|
74
|
-
}),
|
|
75
|
-
}
|
|
76
|
-
: {}),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function shouldWrap() {
|
|
81
|
-
return !component?.()?.noWrap;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function renderComponentProps() {
|
|
85
|
-
return {
|
|
86
|
-
blockChildren: useChildren(),
|
|
87
|
-
componentRef: component?.()?.component,
|
|
88
|
-
componentOptions: {
|
|
89
|
-
...getBlockComponentOptions(useBlock()),
|
|
90
|
-
/**
|
|
91
|
-
* These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
|
|
92
|
-
* they are provided to the component itself directly.
|
|
93
|
-
*/
|
|
94
|
-
...(shouldWrap()
|
|
95
|
-
? {}
|
|
96
|
-
: {
|
|
97
|
-
attributes: {
|
|
98
|
-
...attributes(),
|
|
99
|
-
...actions(),
|
|
100
|
-
},
|
|
101
|
-
}),
|
|
102
|
-
customBreakpoints: childrenContext?.()?.content?.meta?.breakpoints,
|
|
103
|
-
},
|
|
104
|
-
context: childrenContext(),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function useChildren() {
|
|
109
|
-
// TO-DO: When should `canHaveChildren` dictate rendering?
|
|
110
|
-
// This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,
|
|
111
|
-
// but still receive and need to render children.
|
|
112
|
-
// return state.componentInfo?.canHaveChildren ? useBlock().children : [];
|
|
113
|
-
return useBlock().children ?? [];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function childrenWithoutParentComponent() {
|
|
117
|
-
/**
|
|
118
|
-
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
119
|
-
* we render them outside of `componentRef`.
|
|
120
|
-
* NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
|
|
121
|
-
* blocks, and the children will be repeated within those blocks.
|
|
122
|
-
*/
|
|
123
|
-
const shouldRenderChildrenOutsideRef =
|
|
124
|
-
!component?.()?.component && !repeatItemData();
|
|
125
|
-
return shouldRenderChildrenOutsideRef ? useChildren() : [];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function repeatItemData() {
|
|
129
|
-
/**
|
|
130
|
-
* we don't use `useBlock()` here because the processing done within its logic includes evaluating the block's bindings,
|
|
131
|
-
* which will not work if there is a repeat.
|
|
132
|
-
*/
|
|
133
|
-
const { repeat, ...blockWithoutRepeat } = props.block;
|
|
134
|
-
if (!repeat?.collection) {
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
const itemsArray = evaluate({
|
|
138
|
-
code: repeat.collection,
|
|
139
|
-
state: props.context.state,
|
|
140
|
-
context: props.context.context,
|
|
141
|
-
});
|
|
142
|
-
if (!Array.isArray(itemsArray)) {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
const collectionName = repeat.collection.split(".").pop();
|
|
146
|
-
const itemNameToUse =
|
|
147
|
-
repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
148
|
-
const repeatArray = itemsArray.map((item, index) => ({
|
|
149
|
-
context: {
|
|
150
|
-
...props.context,
|
|
151
|
-
state: {
|
|
152
|
-
...props.context.state,
|
|
153
|
-
$index: index,
|
|
154
|
-
$item: item,
|
|
155
|
-
[itemNameToUse]: item,
|
|
156
|
-
[`$${itemNameToUse}Index`]: index,
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
block: blockWithoutRepeat,
|
|
160
|
-
}));
|
|
161
|
-
return repeatArray;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function inheritedTextStyles() {
|
|
165
|
-
if (TARGET !== "reactNative") {
|
|
166
|
-
return {};
|
|
167
|
-
}
|
|
168
|
-
const styles = getReactNativeBlockStyles({
|
|
169
|
-
block: useBlock(),
|
|
170
|
-
context: props.context,
|
|
171
|
-
blockStyles: attributes().style,
|
|
172
|
-
});
|
|
173
|
-
return extractTextStyles(styles);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function childrenContext() {
|
|
177
|
-
return {
|
|
178
|
-
apiKey: props.context.apiKey,
|
|
179
|
-
state: props.context.state,
|
|
180
|
-
content: props.context.content,
|
|
181
|
-
context: props.context.context,
|
|
182
|
-
registeredComponents: props.context.registeredComponents,
|
|
183
|
-
inheritedStyles: inheritedTextStyles(),
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function renderComponentTag() {
|
|
188
|
-
if (TARGET === "reactNative") {
|
|
189
|
-
return RenderComponentWithContext;
|
|
190
|
-
} else if (TARGET === "vue3") {
|
|
191
|
-
// vue3 expects a string for the component tag
|
|
192
|
-
return "RenderComponent";
|
|
193
|
-
} else {
|
|
194
|
-
return RenderComponent;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const [componentInfo, setComponentInfo] = useState(() => null);
|
|
199
|
-
|
|
200
|
-
const RenderComponentTagRef = renderComponentTag();
|
|
201
|
-
const TagRef = tag();
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<>
|
|
205
|
-
{shouldWrap() ? (
|
|
206
|
-
<>
|
|
207
|
-
{isEmptyHtmlElement(tag()) ? (
|
|
208
|
-
<>
|
|
209
|
-
<TagRef {...attributes()} {...actions()} />
|
|
210
|
-
</>
|
|
211
|
-
) : null}
|
|
212
|
-
{!isEmptyHtmlElement(tag()) && repeatItemData() ? (
|
|
213
|
-
<>
|
|
214
|
-
{repeatItemData()?.map((data, index) => (
|
|
215
|
-
<RenderRepeatedBlock
|
|
216
|
-
key={index}
|
|
217
|
-
repeatContext={data.context}
|
|
218
|
-
block={data.block}
|
|
219
|
-
/>
|
|
220
|
-
))}
|
|
221
|
-
</>
|
|
222
|
-
) : null}
|
|
223
|
-
{!isEmptyHtmlElement(tag()) && !repeatItemData() ? (
|
|
224
|
-
<>
|
|
225
|
-
<TagRef {...attributes()} {...actions()}>
|
|
226
|
-
<RenderComponentTagRef {...renderComponentProps()} />
|
|
227
|
-
|
|
228
|
-
{childrenWithoutParentComponent()?.map((child) => (
|
|
229
|
-
<RenderBlock
|
|
230
|
-
key={"render-block-" + child.id}
|
|
231
|
-
block={child}
|
|
232
|
-
context={childrenContext()}
|
|
233
|
-
/>
|
|
234
|
-
))}
|
|
235
|
-
|
|
236
|
-
{childrenWithoutParentComponent()?.map((child) => (
|
|
237
|
-
<BlockStyles
|
|
238
|
-
key={"block-style-" + child.id}
|
|
239
|
-
block={child}
|
|
240
|
-
context={childrenContext()}
|
|
241
|
-
/>
|
|
242
|
-
))}
|
|
243
|
-
</TagRef>
|
|
244
|
-
</>
|
|
245
|
-
) : null}
|
|
246
|
-
</>
|
|
247
|
-
) : (
|
|
248
|
-
<RenderComponentTagRef {...renderComponentProps()} />
|
|
249
|
-
)}
|
|
250
|
-
</>
|
|
251
|
-
);
|
|
252
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import BuilderContext from "../../context/builder.context.js";
|
|
4
|
-
import RenderComponent from "./render-component.js";
|
|
5
|
-
|
|
6
|
-
export default function RenderComponentWithContext(props) {
|
|
7
|
-
return (
|
|
8
|
-
<BuilderContext.Provider
|
|
9
|
-
value={{
|
|
10
|
-
get content() {
|
|
11
|
-
return props.context.content;
|
|
12
|
-
},
|
|
13
|
-
get state() {
|
|
14
|
-
return props.context.state;
|
|
15
|
-
},
|
|
16
|
-
get context() {
|
|
17
|
-
return props.context.context;
|
|
18
|
-
},
|
|
19
|
-
get apiKey() {
|
|
20
|
-
return props.context.apiKey;
|
|
21
|
-
},
|
|
22
|
-
get registeredComponents() {
|
|
23
|
-
return props.context.registeredComponents;
|
|
24
|
-
},
|
|
25
|
-
get inheritedStyles() {
|
|
26
|
-
return props.context.inheritedStyles;
|
|
27
|
-
},
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<RenderComponent
|
|
31
|
-
componentRef={props.componentRef}
|
|
32
|
-
componentOptions={props.componentOptions}
|
|
33
|
-
blockChildren={props.blockChildren}
|
|
34
|
-
context={props.context}
|
|
35
|
-
/>
|
|
36
|
-
</BuilderContext.Provider>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import BlockStyles from "./block-styles.js";
|
|
3
|
-
import RenderBlock from "./render-block.js";
|
|
4
|
-
|
|
5
|
-
export default function RenderComponent(props) {
|
|
6
|
-
const ComponentRefRef = props.componentRef;
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
{props.componentRef ? (
|
|
11
|
-
<>
|
|
12
|
-
<ComponentRefRef {...props.componentOptions}>
|
|
13
|
-
{props.blockChildren?.map((child) => (
|
|
14
|
-
<RenderBlock
|
|
15
|
-
key={"render-block-" + child.id}
|
|
16
|
-
block={child}
|
|
17
|
-
context={props.context}
|
|
18
|
-
/>
|
|
19
|
-
))}
|
|
20
|
-
|
|
21
|
-
{props.blockChildren?.map((child) => (
|
|
22
|
-
<BlockStyles
|
|
23
|
-
key={"block-style-" + child.id}
|
|
24
|
-
block={child}
|
|
25
|
-
context={props.context}
|
|
26
|
-
/>
|
|
27
|
-
))}
|
|
28
|
-
</ComponentRefRef>
|
|
29
|
-
</>
|
|
30
|
-
) : null}
|
|
31
|
-
</>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import BuilderContext from "../../context/builder.context.js";
|
|
4
|
-
import RenderBlock from "./render-block.js";
|
|
5
|
-
|
|
6
|
-
export default function RenderRepeatedBlock(props) {
|
|
7
|
-
return (
|
|
8
|
-
<BuilderContext.Provider
|
|
9
|
-
value={{
|
|
10
|
-
get content() {
|
|
11
|
-
return props.repeatContext.content;
|
|
12
|
-
},
|
|
13
|
-
get state() {
|
|
14
|
-
return props.repeatContext.state;
|
|
15
|
-
},
|
|
16
|
-
get context() {
|
|
17
|
-
return props.repeatContext.context;
|
|
18
|
-
},
|
|
19
|
-
get apiKey() {
|
|
20
|
-
return props.repeatContext.apiKey;
|
|
21
|
-
},
|
|
22
|
-
get registeredComponents() {
|
|
23
|
-
return props.repeatContext.registeredComponents;
|
|
24
|
-
},
|
|
25
|
-
get inheritedStyles() {
|
|
26
|
-
return props.repeatContext.inheritedStyles;
|
|
27
|
-
},
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<RenderBlock block={props.block} context={props.repeatContext} />
|
|
31
|
-
</BuilderContext.Provider>
|
|
32
|
-
);
|
|
33
|
-
}
|