@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
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import BuilderContext from "../context/builder.context.js";
|
|
4
|
-
import { isEditing } from "../functions/is-editing.js";
|
|
5
|
-
import BlockStyles from "./render-block/block-styles.js";
|
|
6
|
-
import RenderBlock from "./render-block/render-block.js";
|
|
7
|
-
|
|
8
|
-
export default function RenderBlocks(props) {
|
|
9
|
-
function className() {
|
|
10
|
-
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function onClick() {
|
|
14
|
-
if (isEditing() && !props.blocks?.length) {
|
|
15
|
-
window.parent?.postMessage(
|
|
16
|
-
{
|
|
17
|
-
type: "builder.clickEmptyBlocks",
|
|
18
|
-
data: {
|
|
19
|
-
parentElementId: props.parent,
|
|
20
|
-
dataPath: props.path,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
"*"
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function onMouseEnter() {
|
|
29
|
-
if (isEditing() && !props.blocks?.length) {
|
|
30
|
-
window.parent?.postMessage(
|
|
31
|
-
{
|
|
32
|
-
type: "builder.hoverEmptyBlocks",
|
|
33
|
-
data: {
|
|
34
|
-
parentElementId: props.parent,
|
|
35
|
-
dataPath: props.path,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
"*"
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const builderContext = useContext(BuilderContext);
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
<div
|
|
48
|
-
className={className() + " div-05727d92"}
|
|
49
|
-
builder-path={props.path}
|
|
50
|
-
builder-parent-id={props.parent}
|
|
51
|
-
dataSet={{
|
|
52
|
-
class: className(),
|
|
53
|
-
}}
|
|
54
|
-
style={props.styleProp}
|
|
55
|
-
onClick={(event) => onClick()}
|
|
56
|
-
onMouseEnter={(event) => onMouseEnter()}
|
|
57
|
-
>
|
|
58
|
-
{props.blocks ? (
|
|
59
|
-
<>
|
|
60
|
-
{props.blocks?.map((block) => (
|
|
61
|
-
<RenderBlock
|
|
62
|
-
key={"render-block-" + block.id}
|
|
63
|
-
block={block}
|
|
64
|
-
context={builderContext}
|
|
65
|
-
/>
|
|
66
|
-
))}
|
|
67
|
-
</>
|
|
68
|
-
) : null}
|
|
69
|
-
|
|
70
|
-
{props.blocks ? (
|
|
71
|
-
<>
|
|
72
|
-
{props.blocks?.map((block) => (
|
|
73
|
-
<BlockStyles
|
|
74
|
-
key={"block-style-" + block.id}
|
|
75
|
-
block={block}
|
|
76
|
-
context={builderContext}
|
|
77
|
-
/>
|
|
78
|
-
))}
|
|
79
|
-
</>
|
|
80
|
-
) : null}
|
|
81
|
-
</div>
|
|
82
|
-
<style>{`.div-05727d92 {
|
|
83
|
-
display: flex;
|
|
84
|
-
flex-direction: column;
|
|
85
|
-
align-items: stretch;
|
|
86
|
-
}`}</style>
|
|
87
|
-
</>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import RenderInlinedStyles from "../../render-inlined-styles.js";
|
|
3
|
-
|
|
4
|
-
export default function RenderContentStyles(props) {
|
|
5
|
-
function getCssFromFont(font) {
|
|
6
|
-
// TODO: compute what font sizes are used and only load those.......
|
|
7
|
-
const family =
|
|
8
|
-
font.family +
|
|
9
|
-
(font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
10
|
-
const name = family.split(",")[0];
|
|
11
|
-
const url = font.fileUrl ?? font?.files?.regular;
|
|
12
|
-
let str = "";
|
|
13
|
-
if (url && family && name) {
|
|
14
|
-
str += `
|
|
15
|
-
@font-face {
|
|
16
|
-
font-family: "${family}";
|
|
17
|
-
src: local("${name}"), url('${url}') format('woff2');
|
|
18
|
-
font-display: fallback;
|
|
19
|
-
font-weight: 400;
|
|
20
|
-
}
|
|
21
|
-
`.trim();
|
|
22
|
-
}
|
|
23
|
-
if (font.files) {
|
|
24
|
-
for (const weight in font.files) {
|
|
25
|
-
const isNumber = String(Number(weight)) === weight;
|
|
26
|
-
if (!isNumber) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
// TODO: maybe limit number loaded
|
|
30
|
-
const weightUrl = font.files[weight];
|
|
31
|
-
if (weightUrl && weightUrl !== url) {
|
|
32
|
-
str += `
|
|
33
|
-
@font-face {
|
|
34
|
-
font-family: "${family}";
|
|
35
|
-
src: url('${weightUrl}') format('woff2');
|
|
36
|
-
font-display: fallback;
|
|
37
|
-
font-weight: ${weight};
|
|
38
|
-
}
|
|
39
|
-
`.trim();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return str;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getFontCss({ customFonts }) {
|
|
47
|
-
// TODO: flag for this
|
|
48
|
-
// if (!builder.allowCustomFonts) {
|
|
49
|
-
// return '';
|
|
50
|
-
// }
|
|
51
|
-
// TODO: separate internal data from external
|
|
52
|
-
return customFonts?.map((font) => getCssFromFont(font))?.join(" ") || "";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function injectedStyles() {
|
|
56
|
-
return `
|
|
57
|
-
${props.cssCode || ""}
|
|
58
|
-
${getFontCss({
|
|
59
|
-
customFonts: props.customFonts,
|
|
60
|
-
})}`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return <RenderInlinedStyles styles={injectedStyles()} />;
|
|
64
|
-
}
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useState, useContext, useRef, useEffect } from "react";
|
|
3
|
-
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
4
|
-
import { TARGET } from "../../constants/target.js";
|
|
5
|
-
import { evaluate } from "../../functions/evaluate.js";
|
|
6
|
-
import { getContent } from "../../functions/get-content/index.js";
|
|
7
|
-
import { fetch } from "../../functions/get-fetch.js";
|
|
8
|
-
import { isBrowser } from "../../functions/is-browser.js";
|
|
9
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
10
|
-
import { isPreviewing } from "../../functions/is-previewing.js";
|
|
11
|
-
import {
|
|
12
|
-
components,
|
|
13
|
-
createRegisterComponentMessage,
|
|
14
|
-
} from "../../functions/register-component.js";
|
|
15
|
-
import { _track } from "../../functions/track.js";
|
|
16
|
-
import RenderBlocks from "../render-blocks.js";
|
|
17
|
-
import RenderContentStyles from "./components/render-styles.js";
|
|
18
|
-
import BuilderContext from "../../context/builder.context.js";
|
|
19
|
-
import {
|
|
20
|
-
registerInsertMenu,
|
|
21
|
-
setupBrowserForEditing,
|
|
22
|
-
} from "../../scripts/init-editing.js";
|
|
23
|
-
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
24
|
-
|
|
25
|
-
export default function RenderContent(props) {
|
|
26
|
-
const elementRef = useRef(null);
|
|
27
|
-
const [forceReRenderCount, setForceReRenderCount] = useState(() => 0);
|
|
28
|
-
|
|
29
|
-
const [overrideContent, setOverrideContent] = useState(() => null);
|
|
30
|
-
|
|
31
|
-
function useContent() {
|
|
32
|
-
if (!props.content && !overrideContent) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
const mergedContent = {
|
|
36
|
-
...props.content,
|
|
37
|
-
...overrideContent,
|
|
38
|
-
data: {
|
|
39
|
-
...props.content?.data,
|
|
40
|
-
...props.data,
|
|
41
|
-
...overrideContent?.data,
|
|
42
|
-
},
|
|
43
|
-
meta: {
|
|
44
|
-
...props.content?.meta,
|
|
45
|
-
...overrideContent?.meta,
|
|
46
|
-
breakpoints:
|
|
47
|
-
useBreakpoints ||
|
|
48
|
-
overrideContent?.meta?.breakpoints ||
|
|
49
|
-
props.content?.meta?.breakpoints,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
return mergedContent;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const [update, setUpdate] = useState(() => 0);
|
|
56
|
-
|
|
57
|
-
const [useBreakpoints, setUseBreakpoints] = useState(() => null);
|
|
58
|
-
|
|
59
|
-
function canTrackToUse() {
|
|
60
|
-
return checkIsDefined(props.canTrack) ? props.canTrack : true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const [overrideState, setOverrideState] = useState(() => ({}));
|
|
64
|
-
|
|
65
|
-
function contentState() {
|
|
66
|
-
return {
|
|
67
|
-
...props.content?.data?.state,
|
|
68
|
-
...props.data,
|
|
69
|
-
...(props.locale
|
|
70
|
-
? {
|
|
71
|
-
locale: props.locale,
|
|
72
|
-
}
|
|
73
|
-
: {}),
|
|
74
|
-
...overrideState,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function contextContext() {
|
|
79
|
-
return props.context || {};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function allRegisteredComponents() {
|
|
83
|
-
const allComponentsArray = [
|
|
84
|
-
...getDefaultRegisteredComponents(),
|
|
85
|
-
// While this `components` object is deprecated, we must maintain support for it.
|
|
86
|
-
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
87
|
-
// existing usage.
|
|
88
|
-
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
89
|
-
// which is the new standard way of providing custom components, and must therefore take precedence.
|
|
90
|
-
...components,
|
|
91
|
-
...(props.customComponents || []),
|
|
92
|
-
];
|
|
93
|
-
const allComponents = allComponentsArray.reduce(
|
|
94
|
-
(acc, curr) => ({
|
|
95
|
-
...acc,
|
|
96
|
-
[curr.name]: curr,
|
|
97
|
-
}),
|
|
98
|
-
{}
|
|
99
|
-
);
|
|
100
|
-
return allComponents;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function processMessage(event) {
|
|
104
|
-
const { data } = event;
|
|
105
|
-
if (data) {
|
|
106
|
-
switch (data.type) {
|
|
107
|
-
case "builder.configureSdk": {
|
|
108
|
-
const messageContent = data.data;
|
|
109
|
-
const { breakpoints, contentId } = messageContent;
|
|
110
|
-
if (!contentId || contentId !== useContent?.()?.id) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
setUseBreakpoints(breakpoints);
|
|
114
|
-
setForceReRenderCount(forceReRenderCount + 1); // This is a hack to force Qwik to re-render.
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
case "builder.contentUpdate": {
|
|
118
|
-
const messageContent = data.data;
|
|
119
|
-
const key =
|
|
120
|
-
messageContent.key ||
|
|
121
|
-
messageContent.alias ||
|
|
122
|
-
messageContent.entry ||
|
|
123
|
-
messageContent.modelName;
|
|
124
|
-
const contentData = messageContent.data;
|
|
125
|
-
if (key === props.model) {
|
|
126
|
-
setOverrideContent(contentData);
|
|
127
|
-
setForceReRenderCount(forceReRenderCount + 1); // This is a hack to force Qwik to re-render.
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
case "builder.patchUpdates": {
|
|
133
|
-
// TODO
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function evaluateJsCode() {
|
|
141
|
-
// run any dynamic JS code attached to content
|
|
142
|
-
const jsCode = useContent?.()?.data?.jsCode;
|
|
143
|
-
if (jsCode) {
|
|
144
|
-
evaluate({
|
|
145
|
-
code: jsCode,
|
|
146
|
-
context: contextContext(),
|
|
147
|
-
state: contentState(),
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function httpReqsData() {
|
|
153
|
-
return {};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function onClick(_event) {
|
|
157
|
-
if (useContent()) {
|
|
158
|
-
const variationId = useContent?.()?.testVariationId;
|
|
159
|
-
const contentId = useContent?.()?.id;
|
|
160
|
-
_track({
|
|
161
|
-
type: "click",
|
|
162
|
-
canTrack: canTrackToUse(),
|
|
163
|
-
contentId,
|
|
164
|
-
apiKey: props.apiKey,
|
|
165
|
-
variationId: variationId !== contentId ? variationId : undefined,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function evalExpression(expression) {
|
|
171
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
|
|
172
|
-
evaluate({
|
|
173
|
-
code: group,
|
|
174
|
-
context: contextContext(),
|
|
175
|
-
state: contentState(),
|
|
176
|
-
})
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function handleRequest({ url, key }) {
|
|
181
|
-
fetch(url)
|
|
182
|
-
.then((response) => response.json())
|
|
183
|
-
.then((json) => {
|
|
184
|
-
const newOverrideState = {
|
|
185
|
-
...overrideState,
|
|
186
|
-
[key]: json,
|
|
187
|
-
};
|
|
188
|
-
setOverrideState(newOverrideState);
|
|
189
|
-
})
|
|
190
|
-
.catch((err) => {
|
|
191
|
-
console.log("error fetching dynamic data", url, err);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function runHttpRequests() {
|
|
196
|
-
const requests = useContent?.()?.data?.httpRequests ?? {};
|
|
197
|
-
Object.entries(requests).forEach(([key, url]) => {
|
|
198
|
-
if (url && (!httpReqsData()[key] || isEditing())) {
|
|
199
|
-
const evaluatedUrl = evalExpression(url);
|
|
200
|
-
handleRequest({
|
|
201
|
-
url: evaluatedUrl,
|
|
202
|
-
key,
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function emitStateUpdate() {
|
|
209
|
-
if (isEditing()) {
|
|
210
|
-
window.dispatchEvent(
|
|
211
|
-
new CustomEvent("builder:component:stateChange", {
|
|
212
|
-
detail: {
|
|
213
|
-
state: contentState(),
|
|
214
|
-
ref: {
|
|
215
|
-
name: props.model,
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
})
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function shouldRenderContentStyles() {
|
|
224
|
-
return Boolean(
|
|
225
|
-
(useContent?.()?.data?.cssCode ||
|
|
226
|
-
useContent?.()?.data?.customFonts?.length) &&
|
|
227
|
-
TARGET !== "reactNative"
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
useEffect(() => {
|
|
232
|
-
if (!props.apiKey) {
|
|
233
|
-
console.error(
|
|
234
|
-
"[Builder.io]: No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
if (isBrowser()) {
|
|
238
|
-
if (isEditing()) {
|
|
239
|
-
setForceReRenderCount(forceReRenderCount + 1);
|
|
240
|
-
registerInsertMenu();
|
|
241
|
-
setupBrowserForEditing({
|
|
242
|
-
...(props.locale
|
|
243
|
-
? {
|
|
244
|
-
locale: props.locale,
|
|
245
|
-
}
|
|
246
|
-
: {}),
|
|
247
|
-
...(props.includeRefs
|
|
248
|
-
? {
|
|
249
|
-
includeRefs: props.includeRefs,
|
|
250
|
-
}
|
|
251
|
-
: {}),
|
|
252
|
-
});
|
|
253
|
-
Object.values(allRegisteredComponents()).forEach(
|
|
254
|
-
(registeredComponent) => {
|
|
255
|
-
const message = createRegisterComponentMessage(registeredComponent);
|
|
256
|
-
window.parent?.postMessage(message, "*");
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
window.addEventListener("message", processMessage);
|
|
260
|
-
window.addEventListener(
|
|
261
|
-
"builder:component:stateChangeListenerActivated",
|
|
262
|
-
emitStateUpdate
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
if (useContent()) {
|
|
266
|
-
const variationId = useContent?.()?.testVariationId;
|
|
267
|
-
const contentId = useContent?.()?.id;
|
|
268
|
-
_track({
|
|
269
|
-
type: "impression",
|
|
270
|
-
canTrack: canTrackToUse(),
|
|
271
|
-
contentId,
|
|
272
|
-
apiKey: props.apiKey,
|
|
273
|
-
variationId: variationId !== contentId ? variationId : undefined,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// override normal content in preview mode
|
|
278
|
-
if (isPreviewing()) {
|
|
279
|
-
const searchParams = new URL(location.href).searchParams;
|
|
280
|
-
if (
|
|
281
|
-
props.model &&
|
|
282
|
-
searchParams.get("builder.preview") === props.model
|
|
283
|
-
) {
|
|
284
|
-
const previewApiKey =
|
|
285
|
-
searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
286
|
-
if (previewApiKey) {
|
|
287
|
-
getContent({
|
|
288
|
-
model: props.model,
|
|
289
|
-
apiKey: previewApiKey,
|
|
290
|
-
}).then((content) => {
|
|
291
|
-
if (content) {
|
|
292
|
-
setOverrideContent(content);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
evaluateJsCode();
|
|
299
|
-
runHttpRequests();
|
|
300
|
-
emitStateUpdate();
|
|
301
|
-
}
|
|
302
|
-
}, []);
|
|
303
|
-
|
|
304
|
-
useEffect(() => {
|
|
305
|
-
evaluateJsCode();
|
|
306
|
-
}, [useContent?.()?.data?.jsCode, contentState()]);
|
|
307
|
-
useEffect(() => {
|
|
308
|
-
runHttpRequests();
|
|
309
|
-
}, [useContent?.()?.data?.httpRequests]);
|
|
310
|
-
useEffect(() => {
|
|
311
|
-
emitStateUpdate();
|
|
312
|
-
}, [contentState()]);
|
|
313
|
-
|
|
314
|
-
useEffect(() => {
|
|
315
|
-
return () => {
|
|
316
|
-
if (isBrowser()) {
|
|
317
|
-
window.removeEventListener("message", processMessage);
|
|
318
|
-
window.removeEventListener(
|
|
319
|
-
"builder:component:stateChangeListenerActivated",
|
|
320
|
-
emitStateUpdate
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
}, []);
|
|
325
|
-
|
|
326
|
-
return (
|
|
327
|
-
<BuilderContext.Provider
|
|
328
|
-
value={{
|
|
329
|
-
get content() {
|
|
330
|
-
return useContent();
|
|
331
|
-
},
|
|
332
|
-
get state() {
|
|
333
|
-
return contentState();
|
|
334
|
-
},
|
|
335
|
-
get context() {
|
|
336
|
-
return contextContext();
|
|
337
|
-
},
|
|
338
|
-
get apiKey() {
|
|
339
|
-
return props.apiKey;
|
|
340
|
-
},
|
|
341
|
-
get registeredComponents() {
|
|
342
|
-
return allRegisteredComponents();
|
|
343
|
-
},
|
|
344
|
-
}}
|
|
345
|
-
>
|
|
346
|
-
{useContent() ? (
|
|
347
|
-
<>
|
|
348
|
-
<div
|
|
349
|
-
ref={elementRef}
|
|
350
|
-
onClick={(event) => onClick(event)}
|
|
351
|
-
builder-content-id={useContent?.()?.id}
|
|
352
|
-
builder-model={props.model}
|
|
353
|
-
>
|
|
354
|
-
{shouldRenderContentStyles() ? (
|
|
355
|
-
<RenderContentStyles
|
|
356
|
-
cssCode={useContent?.()?.data?.cssCode}
|
|
357
|
-
customFonts={useContent?.()?.data?.customFonts}
|
|
358
|
-
/>
|
|
359
|
-
) : null}
|
|
360
|
-
|
|
361
|
-
<RenderBlocks
|
|
362
|
-
blocks={useContent?.()?.data?.blocks}
|
|
363
|
-
key={forceReRenderCount}
|
|
364
|
-
/>
|
|
365
|
-
</div>
|
|
366
|
-
</>
|
|
367
|
-
) : null}
|
|
368
|
-
</BuilderContext.Provider>
|
|
369
|
-
);
|
|
370
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { TARGET } from "../constants/target.js";
|
|
3
|
-
|
|
4
|
-
export default function RenderInlinedStyles(props) {
|
|
5
|
-
function injectedStyleScript() {
|
|
6
|
-
return `<${tag()}>${props.styles}</${tag()}>`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function tag() {
|
|
10
|
-
// NOTE: we have to obfusctate the name of the tag due to a limitation in the svelte-preprocessor plugin.
|
|
11
|
-
// https://github.com/sveltejs/vite-plugin-svelte/issues/315#issuecomment-1109000027
|
|
12
|
-
return "sty" + "le";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const TagRef = tag();
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
{TARGET === "svelte" ? (
|
|
20
|
-
<>
|
|
21
|
-
<div dangerouslySetInnerHTML={{ __html: injectedStyleScript() }} />
|
|
22
|
-
</>
|
|
23
|
-
) : (
|
|
24
|
-
<TagRef>{props.styles}</TagRef>
|
|
25
|
-
)}
|
|
26
|
-
</>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { default as Button } from "../blocks/button/button.js";
|
|
18
|
-
import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info.js";
|
|
19
|
-
import { default as Columns } from "../blocks/columns/columns.js";
|
|
20
|
-
import { componentInfo as columnsComponentInfo } from "../blocks/columns/component-info.js";
|
|
21
|
-
import { componentInfo as fragmentComponentInfo } from "../blocks/fragment/component-info.js";
|
|
22
|
-
import { default as Fragment } from "../blocks/fragment/fragment.js";
|
|
23
|
-
import { componentInfo as imageComponentInfo } from "../blocks/image/component-info.js";
|
|
24
|
-
import { default as Image } from "../blocks/image/image.js";
|
|
25
|
-
import { componentInfo as sectionComponentInfo } from "../blocks/section/component-info.js";
|
|
26
|
-
import { default as Section } from "../blocks/section/section.js";
|
|
27
|
-
import { componentInfo as symbolComponentInfo } from "../blocks/symbol/component-info.js";
|
|
28
|
-
import { default as Symbol } from "../blocks/symbol/symbol.js";
|
|
29
|
-
import { componentInfo as textComponentInfo } from "../blocks/text/component-info.js";
|
|
30
|
-
import { default as Text } from "../blocks/text/text.js";
|
|
31
|
-
import { componentInfo as videoComponentInfo } from "../blocks/video/component-info.js";
|
|
32
|
-
import { default as Video } from "../blocks/video/video.js";
|
|
33
|
-
import { componentInfo as embedComponentInfo } from "../blocks/embed/component-info.js";
|
|
34
|
-
import { default as embed } from "../blocks/embed/embed.js";
|
|
35
|
-
import { default as Img } from "../blocks/img/img.js";
|
|
36
|
-
import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.js";
|
|
37
|
-
import { default as customCode } from "../blocks/custom-code/custom-code.js";
|
|
38
|
-
import { componentInfo as customCodeInfo } from "../blocks/custom-code/component-info.js";
|
|
39
|
-
const getDefaultRegisteredComponents = () => [
|
|
40
|
-
__spreadValues({ component: Columns }, columnsComponentInfo),
|
|
41
|
-
__spreadValues({ component: Image }, imageComponentInfo),
|
|
42
|
-
__spreadValues({ component: Img }, imgComponentInfo),
|
|
43
|
-
__spreadValues({ component: Text }, textComponentInfo),
|
|
44
|
-
__spreadValues({ component: Video }, videoComponentInfo),
|
|
45
|
-
__spreadValues({ component: Symbol }, symbolComponentInfo),
|
|
46
|
-
__spreadValues({ component: Button }, buttonComponentInfo),
|
|
47
|
-
__spreadValues({ component: Section }, sectionComponentInfo),
|
|
48
|
-
__spreadValues({ component: Fragment }, fragmentComponentInfo),
|
|
49
|
-
__spreadValues({ component: embed }, embedComponentInfo),
|
|
50
|
-
__spreadValues({ component: customCode }, customCodeInfo)
|
|
51
|
-
];
|
|
52
|
-
export {
|
|
53
|
-
getDefaultRegisteredComponents
|
|
54
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { fastClone } from "../functions/fast-clone";
|
|
2
|
-
const SIZES = {
|
|
3
|
-
small: {
|
|
4
|
-
min: 320,
|
|
5
|
-
default: 321,
|
|
6
|
-
max: 640
|
|
7
|
-
},
|
|
8
|
-
medium: {
|
|
9
|
-
min: 641,
|
|
10
|
-
default: 642,
|
|
11
|
-
max: 991
|
|
12
|
-
},
|
|
13
|
-
large: {
|
|
14
|
-
min: 990,
|
|
15
|
-
default: 991,
|
|
16
|
-
max: 1200
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
20
|
-
const getSizesForBreakpoints = ({ small, medium }) => {
|
|
21
|
-
const newSizes = fastClone(SIZES);
|
|
22
|
-
if (!small || !medium) {
|
|
23
|
-
return newSizes;
|
|
24
|
-
}
|
|
25
|
-
const smallMin = Math.floor(small / 2);
|
|
26
|
-
newSizes.small = {
|
|
27
|
-
max: small,
|
|
28
|
-
min: smallMin,
|
|
29
|
-
default: smallMin + 1
|
|
30
|
-
};
|
|
31
|
-
const mediumMin = newSizes.small.max + 1;
|
|
32
|
-
newSizes.medium = {
|
|
33
|
-
max: medium,
|
|
34
|
-
min: mediumMin,
|
|
35
|
-
default: mediumMin + 1
|
|
36
|
-
};
|
|
37
|
-
const largeMin = newSizes.medium.max + 1;
|
|
38
|
-
newSizes.large = {
|
|
39
|
-
max: 2e3,
|
|
40
|
-
min: largeMin,
|
|
41
|
-
default: largeMin + 1
|
|
42
|
-
};
|
|
43
|
-
return newSizes;
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
getMaxWidthQueryForSize,
|
|
47
|
-
getSizesForBreakpoints
|
|
48
|
-
};
|
package/src/constants/target.js
DELETED