@builder.io/sdk-react 0.1.1 → 0.1.3
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/dist/react/blocks/BaseText.js +7 -0
- package/dist/react/blocks/button/button.js +9 -0
- package/dist/react/blocks/button/component-info.js +39 -0
- package/dist/react/blocks/columns/columns.js +131 -0
- package/dist/react/blocks/columns/component-info.js +241 -0
- package/dist/react/blocks/custom-code/component-info.js +29 -0
- package/dist/react/blocks/custom-code/custom-code.js +49 -0
- package/dist/react/blocks/embed/component-info.js +44 -0
- package/dist/react/blocks/embed/embed.js +40 -0
- package/dist/react/blocks/embed/helpers.js +7 -0
- package/dist/react/blocks/form/component-info.js +260 -0
- package/dist/react/blocks/form/form.js +201 -0
- package/dist/react/blocks/fragment/component-info.js +9 -0
- package/dist/react/blocks/fragment/fragment.js +4 -0
- package/dist/react/blocks/image/component-info.js +149 -0
- package/dist/react/blocks/image/image.helpers.js +46 -0
- package/dist/react/blocks/image/image.js +82 -0
- package/dist/react/blocks/img/component-info.js +18 -0
- package/dist/react/blocks/img/img.js +8 -0
- package/dist/react/blocks/input/component-info.js +72 -0
- package/dist/react/blocks/input/input.js +5 -0
- package/dist/react/blocks/raw-text/component-info.js +14 -0
- package/dist/react/blocks/raw-text/raw-text.js +4 -0
- package/dist/react/blocks/section/component-info.js +47 -0
- package/dist/react/blocks/section/section.js +17 -0
- package/dist/react/blocks/select/component-info.js +57 -0
- package/dist/react/blocks/select/select.js +5 -0
- package/dist/react/blocks/submit-button/component-info.js +26 -0
- package/dist/react/blocks/submit-button/submit-button.js +4 -0
- package/dist/react/blocks/symbol/component-info.js +41 -0
- package/dist/react/blocks/symbol/symbol.js +63 -0
- package/dist/react/blocks/text/component-info.js +22 -0
- package/dist/react/blocks/text/text.js +4 -0
- package/dist/react/blocks/textarea/component-info.js +45 -0
- package/dist/react/blocks/textarea/textarea.js +4 -0
- package/dist/react/blocks/util.js +6 -0
- package/dist/react/blocks/video/component-info.js +104 -0
- package/dist/react/blocks/video/video.js +48 -0
- package/dist/react/components/render-block/block-styles.js +48 -0
- package/dist/react/components/render-block/render-block.helpers.js +104 -0
- package/dist/react/components/render-block/render-block.js +122 -0
- package/dist/react/components/render-block/render-component-with-context.js +27 -0
- package/dist/react/components/render-block/render-component.js +10 -0
- package/dist/react/components/render-block/render-repeated-block.js +15 -0
- package/dist/react/components/render-block/types.js +1 -0
- package/dist/react/components/render-blocks.js +45 -0
- package/dist/react/components/render-content/builder-editing.js +4 -0
- package/dist/react/components/render-content/components/render-styles.js +59 -0
- package/dist/react/components/render-content/index.js +2 -0
- package/dist/react/components/render-content/render-content.js +285 -0
- package/dist/react/components/render-inlined-styles.js +15 -0
- package/dist/react/constants/builder-registered-components.js +52 -0
- package/dist/react/constants/device-sizes.js +45 -0
- package/dist/react/constants/target.js +2 -0
- package/dist/react/context/builder.context.js +10 -0
- package/dist/react/context/types.js +1 -0
- package/dist/react/functions/camel-to-kebab-case.js +2 -0
- package/dist/react/functions/evaluate.js +22 -0
- package/dist/react/functions/event-handler-name.js +5 -0
- package/dist/react/functions/extract-text-styles.js +20 -0
- package/dist/react/functions/fast-clone.js +2 -0
- package/dist/react/functions/get-block-actions-handler.js +9 -0
- package/dist/react/functions/get-block-actions.js +16 -0
- package/dist/react/functions/get-block-component-options.js +26 -0
- package/dist/react/functions/get-block-properties.js +48 -0
- package/dist/react/functions/get-block-tag.js +4 -0
- package/dist/react/functions/get-builder-search-params/fn.test.js +13 -0
- package/dist/react/functions/get-builder-search-params/index.js +33 -0
- package/dist/react/functions/get-content/ab-testing.js +86 -0
- package/dist/react/functions/get-content/generate-content-url.js +41 -0
- package/dist/react/functions/get-content/generate-content-url.test.js +31 -0
- package/dist/react/functions/get-content/index.js +64 -0
- package/dist/react/functions/get-content/types.js +1 -0
- package/dist/react/functions/get-fetch.js +12 -0
- package/dist/react/functions/get-global-this.js +16 -0
- package/dist/react/functions/get-processed-block.js +49 -0
- package/dist/react/functions/get-processed-block.test.js +32 -0
- package/dist/react/functions/get-react-native-block-styles.js +27 -0
- package/dist/react/functions/if-target.js +10 -0
- package/dist/react/functions/is-browser.js +4 -0
- package/dist/react/functions/is-editing.js +5 -0
- package/dist/react/functions/is-iframe.js +5 -0
- package/dist/react/functions/is-previewing.js +12 -0
- package/dist/react/functions/on-change.js +24 -0
- package/dist/react/functions/on-change.test.js +19 -0
- package/dist/react/functions/register-component.js +60 -0
- package/dist/react/functions/register.js +28 -0
- package/dist/react/functions/sanitize-react-native-block-styles.js +68 -0
- package/dist/react/functions/set-editor-settings.js +13 -0
- package/dist/react/functions/set.js +9 -0
- package/dist/react/functions/set.test.js +16 -0
- package/dist/react/functions/track/helpers.js +50 -0
- package/dist/react/functions/track/index.js +120 -0
- package/dist/react/functions/track/interaction.js +48 -0
- package/dist/react/functions/track.js +116 -0
- package/dist/react/functions/transform-block-properties.js +4 -0
- package/dist/react/functions/transform-block.js +4 -0
- package/dist/react/helpers/ab-tests.js +6 -0
- package/dist/react/helpers/cookie.js +70 -0
- package/dist/react/helpers/css.js +28 -0
- package/dist/react/helpers/flatten.js +32 -0
- package/dist/react/helpers/localStorage.js +27 -0
- package/dist/react/helpers/nullable.js +2 -0
- package/dist/react/helpers/sessionId.js +46 -0
- package/dist/react/helpers/time.js +3 -0
- package/dist/react/helpers/url.js +11 -0
- package/dist/react/helpers/url.test.js +21 -0
- package/dist/react/helpers/uuid.js +10 -0
- package/dist/react/helpers/visitorId.js +28 -0
- package/dist/react/index-helpers/blocks-exports.js +11 -0
- package/dist/react/index-helpers/top-of-file.js +2 -0
- package/dist/react/index.js +12 -0
- package/dist/react/scripts/init-editing.js +93 -0
- package/dist/react/types/builder-block.js +1 -0
- package/dist/react/types/builder-content.js +1 -0
- package/dist/react/types/can-track.js +1 -0
- package/dist/react/types/components.js +1 -0
- package/dist/react/types/deep-partial.js +1 -0
- package/dist/react/types/element.js +1 -0
- package/dist/react/types/targets.js +1 -0
- package/dist/react/types/typescript.js +1 -0
- package/dist/rsc/blocks/BaseText.js +7 -0
- package/dist/rsc/blocks/button/button.js +10 -0
- package/dist/rsc/blocks/button/component-info.js +39 -0
- package/dist/rsc/blocks/columns/columns.js +136 -0
- package/dist/rsc/blocks/columns/component-info.js +241 -0
- package/dist/rsc/blocks/custom-code/component-info.js +29 -0
- package/dist/rsc/blocks/custom-code/custom-code.js +45 -0
- package/dist/rsc/blocks/embed/component-info.js +44 -0
- package/dist/rsc/blocks/embed/embed.js +36 -0
- package/dist/rsc/blocks/embed/helpers.js +7 -0
- package/dist/rsc/blocks/form/component-info.js +260 -0
- package/dist/rsc/blocks/form/form.js +204 -0
- package/dist/rsc/blocks/fragment/component-info.js +9 -0
- package/dist/rsc/blocks/fragment/fragment.js +5 -0
- package/dist/rsc/blocks/image/component-info.js +149 -0
- package/dist/rsc/blocks/image/image.helpers.js +46 -0
- package/dist/rsc/blocks/image/image.js +85 -0
- package/dist/rsc/blocks/img/component-info.js +18 -0
- package/dist/rsc/blocks/img/img.js +9 -0
- package/dist/rsc/blocks/input/component-info.js +72 -0
- package/dist/rsc/blocks/input/input.js +6 -0
- package/dist/rsc/blocks/raw-text/component-info.js +14 -0
- package/dist/rsc/blocks/raw-text/raw-text.js +5 -0
- package/dist/rsc/blocks/section/component-info.js +47 -0
- package/dist/rsc/blocks/section/section.js +18 -0
- package/dist/rsc/blocks/select/component-info.js +57 -0
- package/dist/rsc/blocks/select/select.js +6 -0
- package/dist/rsc/blocks/submit-button/component-info.js +26 -0
- package/dist/rsc/blocks/submit-button/submit-button.js +5 -0
- package/dist/rsc/blocks/symbol/component-info.js +41 -0
- package/dist/rsc/blocks/symbol/symbol.js +37 -0
- package/dist/rsc/blocks/text/component-info.js +22 -0
- package/dist/rsc/blocks/text/text.js +5 -0
- package/dist/rsc/blocks/textarea/component-info.js +45 -0
- package/dist/rsc/blocks/textarea/textarea.js +5 -0
- package/dist/rsc/blocks/util.js +6 -0
- package/dist/rsc/blocks/video/component-info.js +104 -0
- package/dist/rsc/blocks/video/video.js +51 -0
- package/dist/rsc/components/render-block/block-styles.js +51 -0
- package/dist/rsc/components/render-block/render-block.helpers.js +104 -0
- package/dist/rsc/components/render-block/render-block.js +126 -0
- package/dist/rsc/components/render-block/render-component-with-context.js +27 -0
- package/dist/rsc/components/render-block/render-component.js +11 -0
- package/dist/rsc/components/render-block/render-repeated-block.js +15 -0
- package/dist/rsc/components/render-block/types.js +1 -0
- package/dist/rsc/components/render-blocks.js +47 -0
- package/dist/rsc/components/render-content/builder-editing.js +5 -0
- package/dist/rsc/components/render-content/components/render-styles.js +62 -0
- package/dist/rsc/components/render-content/index.js +2 -0
- package/dist/rsc/components/render-content/render-content.js +201 -0
- package/dist/rsc/components/render-inlined-styles.js +18 -0
- package/dist/rsc/constants/builder-registered-components.js +52 -0
- package/dist/rsc/constants/device-sizes.js +45 -0
- package/dist/rsc/constants/target.js +2 -0
- package/dist/rsc/context/builder.context.js +9 -0
- package/dist/rsc/context/types.js +1 -0
- package/dist/rsc/functions/camel-to-kebab-case.js +2 -0
- package/dist/rsc/functions/evaluate.js +4 -0
- package/dist/rsc/functions/event-handler-name.js +5 -0
- package/dist/rsc/functions/extract-text-styles.js +20 -0
- package/dist/rsc/functions/fast-clone.js +2 -0
- package/dist/rsc/functions/get-block-actions-handler.js +9 -0
- package/dist/rsc/functions/get-block-actions.js +16 -0
- package/dist/rsc/functions/get-block-component-options.js +26 -0
- package/dist/rsc/functions/get-block-properties.js +48 -0
- package/dist/rsc/functions/get-block-tag.js +4 -0
- package/dist/rsc/functions/get-builder-search-params/fn.test.js +13 -0
- package/dist/rsc/functions/get-builder-search-params/index.js +33 -0
- package/dist/rsc/functions/get-content/ab-testing.js +86 -0
- package/dist/rsc/functions/get-content/generate-content-url.js +41 -0
- package/dist/rsc/functions/get-content/generate-content-url.test.js +31 -0
- package/dist/rsc/functions/get-content/index.js +64 -0
- package/dist/rsc/functions/get-content/types.js +1 -0
- package/dist/rsc/functions/get-fetch.js +12 -0
- package/dist/rsc/functions/get-global-this.js +16 -0
- package/dist/rsc/functions/get-processed-block.js +49 -0
- package/dist/rsc/functions/get-processed-block.test.js +32 -0
- package/dist/rsc/functions/get-react-native-block-styles.js +27 -0
- package/dist/rsc/functions/if-target.js +10 -0
- package/dist/rsc/functions/is-browser.js +4 -0
- package/dist/rsc/functions/is-editing.js +5 -0
- package/dist/rsc/functions/is-iframe.js +5 -0
- package/dist/rsc/functions/is-previewing.js +12 -0
- package/dist/rsc/functions/on-change.js +24 -0
- package/dist/rsc/functions/on-change.test.js +19 -0
- package/dist/rsc/functions/register-component.js +60 -0
- package/dist/rsc/functions/register.js +28 -0
- package/dist/rsc/functions/sanitize-react-native-block-styles.js +68 -0
- package/dist/rsc/functions/set-editor-settings.js +13 -0
- package/dist/rsc/functions/set.js +9 -0
- package/dist/rsc/functions/set.test.js +16 -0
- package/dist/rsc/functions/track/helpers.js +50 -0
- package/dist/rsc/functions/track/index.js +120 -0
- package/dist/rsc/functions/track/interaction.js +48 -0
- package/dist/rsc/functions/track.js +116 -0
- package/dist/rsc/functions/transform-block-properties.js +4 -0
- package/dist/rsc/functions/transform-block.js +4 -0
- package/dist/rsc/helpers/ab-tests.js +6 -0
- package/dist/rsc/helpers/cookie.js +70 -0
- package/dist/rsc/helpers/css.js +28 -0
- package/dist/rsc/helpers/flatten.js +32 -0
- package/dist/rsc/helpers/localStorage.js +27 -0
- package/dist/rsc/helpers/nullable.js +2 -0
- package/dist/rsc/helpers/sessionId.js +46 -0
- package/dist/rsc/helpers/time.js +3 -0
- package/dist/rsc/helpers/url.js +11 -0
- package/dist/rsc/helpers/url.test.js +21 -0
- package/dist/rsc/helpers/uuid.js +10 -0
- package/dist/rsc/helpers/visitorId.js +28 -0
- package/dist/rsc/index-helpers/blocks-exports.js +11 -0
- package/dist/rsc/index-helpers/top-of-file.js +2 -0
- package/dist/rsc/index.js +12 -0
- package/dist/rsc/scripts/init-editing.js +93 -0
- package/dist/rsc/types/builder-block.js +1 -0
- package/dist/rsc/types/builder-content.js +1 -0
- package/dist/rsc/types/can-track.js +1 -0
- package/dist/rsc/types/components.js +1 -0
- package/dist/rsc/types/deep-partial.js +1 -0
- package/dist/rsc/types/element.js +1 -0
- package/dist/rsc/types/targets.js +1 -0
- package/dist/rsc/types/typescript.js +1 -0
- package/package.json +11 -6
- package/packages/_rsc/src/blocks/BaseText.jsx +10 -0
- package/packages/_rsc/src/blocks/button/button.jsx +29 -0
- package/packages/_rsc/src/blocks/columns/{columns.js → columns.jsx} +80 -61
- package/packages/_rsc/src/blocks/custom-code/custom-code.jsx +55 -0
- package/packages/_rsc/src/blocks/embed/embed.jsx +43 -0
- package/packages/_rsc/src/blocks/form/form.jsx +259 -0
- package/packages/_rsc/src/blocks/fragment/fragment.jsx +7 -0
- package/packages/_rsc/src/blocks/image/image.jsx +124 -0
- package/packages/_rsc/src/blocks/img/img.jsx +19 -0
- package/packages/_rsc/src/blocks/input/input.jsx +21 -0
- package/packages/_rsc/src/blocks/raw-text/raw-text.jsx +12 -0
- package/packages/_rsc/src/blocks/section/section.jsx +29 -0
- package/packages/_rsc/src/blocks/select/select.jsx +22 -0
- package/packages/_rsc/src/blocks/submit-button/submit-button.jsx +11 -0
- package/packages/_rsc/src/blocks/symbol/symbol.jsx +56 -0
- package/packages/_rsc/src/blocks/text/text.jsx +12 -0
- package/packages/_rsc/src/blocks/textarea/textarea.jsx +15 -0
- package/packages/_rsc/src/blocks/video/video.jsx +61 -0
- package/packages/_rsc/src/components/render-block/block-styles.jsx +72 -0
- package/packages/_rsc/src/components/render-block/render-block.jsx +251 -0
- package/packages/_rsc/src/components/render-block/render-component-with-context.jsx +38 -0
- package/packages/_rsc/src/components/render-block/render-component.jsx +37 -0
- package/packages/_rsc/src/components/render-block/render-repeated-block.jsx +36 -0
- package/packages/_rsc/src/components/render-blocks.jsx +90 -0
- package/packages/_rsc/src/components/render-content/builder-editing.jsx +7 -0
- package/packages/_rsc/src/components/render-content/components/render-styles.jsx +70 -0
- package/packages/_rsc/src/components/render-content/render-content.jsx +259 -0
- package/packages/_rsc/src/components/render-inlined-styles.jsx +33 -0
- package/packages/_rsc/src/helpers/cookie.js +4 -2
- package/packages/_rsc/src/helpers/localStorage.js +1 -0
- package/packages/_rsc/src/helpers/sessionId.js +4 -1
- package/packages/_rsc/src/helpers/url.js +3 -0
- package/packages/_rsc/src/helpers/url.test.js +6 -0
- package/packages/_rsc/src/helpers/visitorId.js +1 -0
- package/packages/react/src/blocks/BaseText.jsx +9 -0
- package/packages/react/src/blocks/button/button.jsx +27 -0
- package/packages/react/src/blocks/button/component-info.js +41 -0
- package/packages/react/src/blocks/columns/columns.jsx +172 -0
- package/packages/react/src/blocks/columns/component-info.js +242 -0
- package/packages/react/src/blocks/custom-code/component-info.js +31 -0
- package/packages/react/src/blocks/custom-code/custom-code.jsx +64 -0
- package/packages/react/src/blocks/embed/component-info.js +44 -0
- package/packages/react/src/blocks/embed/embed.jsx +49 -0
- package/packages/react/src/blocks/embed/helpers.js +9 -0
- package/packages/react/src/blocks/form/component-info.js +262 -0
- package/packages/react/src/blocks/form/form.jsx +253 -0
- package/packages/react/src/blocks/fragment/component-info.js +11 -0
- package/packages/react/src/blocks/fragment/fragment.jsx +5 -0
- package/packages/react/src/blocks/image/component-info.js +151 -0
- package/packages/react/src/blocks/image/image.helpers.js +48 -0
- package/packages/react/src/blocks/image/image.jsx +120 -0
- package/packages/react/src/blocks/img/component-info.js +20 -0
- package/packages/react/src/blocks/img/img.jsx +17 -0
- package/packages/react/src/blocks/input/component-info.js +74 -0
- package/packages/react/src/blocks/input/input.jsx +19 -0
- package/packages/react/src/blocks/raw-text/component-info.js +16 -0
- package/packages/react/src/blocks/raw-text/raw-text.jsx +10 -0
- package/packages/react/src/blocks/section/component-info.js +49 -0
- package/packages/react/src/blocks/section/section.jsx +27 -0
- package/packages/react/src/blocks/select/component-info.js +59 -0
- package/packages/react/src/blocks/select/select.jsx +20 -0
- package/packages/react/src/blocks/submit-button/component-info.js +28 -0
- package/packages/react/src/blocks/submit-button/submit-button.jsx +9 -0
- package/packages/react/src/blocks/symbol/component-info.js +43 -0
- package/packages/react/src/blocks/symbol/symbol.jsx +86 -0
- package/packages/react/src/blocks/text/component-info.js +24 -0
- package/packages/react/src/blocks/text/text.jsx +10 -0
- package/packages/react/src/blocks/textarea/component-info.js +47 -0
- package/packages/react/src/blocks/textarea/textarea.jsx +13 -0
- package/packages/react/src/blocks/util.js +8 -0
- package/packages/react/src/blocks/video/component-info.js +106 -0
- package/packages/react/src/blocks/video/video.jsx +58 -0
- package/packages/react/src/components/render-block/block-styles.jsx +69 -0
- package/packages/react/src/components/render-block/render-block.helpers.js +113 -0
- package/packages/react/src/components/render-block/render-block.jsx +184 -0
- package/packages/react/src/components/render-block/render-component.jsx +33 -0
- package/packages/react/src/components/render-block/render-repeated-block.jsx +21 -0
- package/packages/react/src/components/render-block/types.js +0 -0
- package/packages/react/src/components/render-blocks.jsx +89 -0
- package/packages/react/src/components/render-content/builder-editing.jsx +5 -0
- package/packages/react/src/components/render-content/components/render-styles.jsx +64 -0
- package/packages/react/src/components/render-content/index.js +4 -0
- package/packages/react/src/components/render-content/render-content.jsx +372 -0
- package/packages/react/src/components/render-inlined-styles.jsx +28 -0
- package/packages/react/src/constants/builder-registered-components.js +54 -0
- package/packages/react/src/constants/device-sizes.js +48 -0
- package/packages/react/src/constants/target.js +4 -0
- package/packages/react/src/context/builder.context.js +12 -0
- package/packages/react/src/context/types.js +0 -0
- package/packages/react/src/functions/camel-to-kebab-case.js +4 -0
- package/packages/react/src/functions/evaluate.js +29 -0
- package/packages/react/src/functions/event-handler-name.js +7 -0
- package/packages/react/src/functions/extract-text-styles.js +22 -0
- package/packages/react/src/functions/fast-clone.js +4 -0
- package/packages/react/src/functions/get-block-actions-handler.js +11 -0
- package/packages/react/src/functions/get-block-actions.js +18 -0
- package/packages/{_rsc/src/blocks/textarea/textarea.js → react/src/functions/get-block-component-options.js} +6 -10
- package/packages/react/src/functions/get-block-properties.js +50 -0
- package/packages/react/src/functions/get-block-tag.js +6 -0
- package/packages/react/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/packages/react/src/functions/get-builder-search-params/index.js +38 -0
- package/packages/react/src/functions/get-content/ab-testing.js +99 -0
- package/packages/react/src/functions/get-content/generate-content-url.js +55 -0
- package/packages/react/src/functions/get-content/generate-content-url.test.js +31 -0
- package/packages/react/src/functions/get-content/index.js +65 -0
- package/packages/react/src/functions/get-content/types.js +0 -0
- package/packages/react/src/functions/get-fetch.js +14 -0
- package/packages/react/src/functions/get-global-this.js +18 -0
- package/packages/react/src/functions/get-processed-block.js +59 -0
- package/packages/react/src/functions/get-processed-block.test.js +32 -0
- package/packages/{_rsc/src/blocks/BaseText.js → react/src/functions/get-react-native-block-styles.js} +14 -8
- package/packages/react/src/functions/if-target.js +15 -0
- package/packages/react/src/functions/is-browser.js +6 -0
- package/packages/react/src/functions/is-editing.js +7 -0
- package/packages/react/src/functions/is-iframe.js +7 -0
- package/packages/react/src/functions/is-previewing.js +14 -0
- package/packages/react/src/functions/on-change.js +27 -0
- package/packages/react/src/functions/on-change.test.js +19 -0
- package/packages/react/src/functions/register-component.js +68 -0
- package/packages/react/src/functions/register.js +29 -0
- package/packages/react/src/functions/sanitize-react-native-block-styles.js +66 -0
- package/packages/react/src/functions/set-editor-settings.js +15 -0
- package/packages/react/src/functions/set.js +11 -0
- package/packages/react/src/functions/set.test.js +16 -0
- package/packages/react/src/functions/track/helpers.js +50 -0
- package/packages/react/src/functions/track/index.js +128 -0
- package/packages/react/src/functions/track/interaction.js +53 -0
- package/packages/react/src/functions/transform-block-properties.js +6 -0
- package/packages/react/src/functions/transform-block.js +6 -0
- package/packages/react/src/helpers/ab-tests.js +16 -0
- package/packages/react/src/helpers/cookie.js +81 -0
- package/packages/react/src/helpers/css.js +34 -0
- package/packages/{_rsc/src/blocks/input/input.js → react/src/helpers/flatten.js} +12 -14
- package/packages/react/src/helpers/localStorage.js +35 -0
- package/packages/react/src/helpers/nullable.js +4 -0
- package/packages/react/src/helpers/sessionId.js +52 -0
- package/packages/react/src/helpers/time.js +5 -0
- package/packages/react/src/helpers/url.js +13 -0
- package/packages/react/src/helpers/url.test.js +21 -0
- package/packages/react/src/helpers/uuid.js +13 -0
- package/packages/react/src/helpers/visitorId.js +34 -0
- package/packages/react/src/index-helpers/blocks-exports.js +22 -0
- package/packages/react/src/index-helpers/top-of-file.js +4 -0
- package/packages/react/src/index.js +14 -0
- package/packages/react/src/scripts/init-editing.js +93 -0
- package/packages/react/src/types/builder-block.js +0 -0
- package/packages/react/src/types/builder-content.js +0 -0
- package/packages/react/src/types/can-track.js +0 -0
- package/packages/react/src/types/components.js +0 -0
- package/packages/react/src/types/deep-partial.js +0 -0
- package/packages/react/src/types/element.js +0 -0
- package/packages/react/src/types/targets.js +0 -0
- package/packages/react/src/types/typescript.js +0 -0
- package/packages/rsc/src/blocks/BaseText.jsx +10 -0
- package/packages/rsc/src/blocks/button/button.jsx +29 -0
- package/packages/rsc/src/blocks/button/component-info.js +41 -0
- package/packages/rsc/src/blocks/columns/columns.jsx +172 -0
- package/packages/rsc/src/blocks/columns/component-info.js +242 -0
- package/packages/rsc/src/blocks/custom-code/component-info.js +31 -0
- package/packages/rsc/src/blocks/custom-code/custom-code.jsx +55 -0
- package/packages/rsc/src/blocks/embed/component-info.js +44 -0
- package/packages/rsc/src/blocks/embed/embed.jsx +43 -0
- package/packages/rsc/src/blocks/embed/helpers.js +9 -0
- package/packages/rsc/src/blocks/form/component-info.js +262 -0
- package/packages/rsc/src/blocks/form/form.jsx +259 -0
- package/packages/rsc/src/blocks/fragment/component-info.js +11 -0
- package/packages/rsc/src/blocks/fragment/fragment.jsx +7 -0
- package/packages/rsc/src/blocks/image/component-info.js +151 -0
- package/packages/rsc/src/blocks/image/image.helpers.js +48 -0
- package/packages/rsc/src/blocks/image/image.jsx +122 -0
- package/packages/rsc/src/blocks/img/component-info.js +20 -0
- package/packages/rsc/src/blocks/img/img.jsx +19 -0
- package/packages/rsc/src/blocks/input/component-info.js +74 -0
- package/packages/rsc/src/blocks/input/input.jsx +21 -0
- package/packages/rsc/src/blocks/raw-text/component-info.js +16 -0
- package/packages/rsc/src/blocks/raw-text/raw-text.jsx +12 -0
- package/packages/rsc/src/blocks/section/component-info.js +49 -0
- package/packages/rsc/src/blocks/section/section.jsx +29 -0
- package/packages/rsc/src/blocks/select/component-info.js +59 -0
- package/packages/rsc/src/blocks/select/select.jsx +22 -0
- package/packages/rsc/src/blocks/submit-button/component-info.js +28 -0
- package/packages/rsc/src/blocks/submit-button/submit-button.jsx +11 -0
- package/packages/rsc/src/blocks/symbol/component-info.js +43 -0
- package/packages/rsc/src/blocks/symbol/symbol.jsx +56 -0
- package/packages/rsc/src/blocks/text/component-info.js +24 -0
- package/packages/rsc/src/blocks/text/text.jsx +12 -0
- package/packages/rsc/src/blocks/textarea/component-info.js +47 -0
- package/packages/rsc/src/blocks/textarea/textarea.jsx +15 -0
- package/packages/rsc/src/blocks/util.js +8 -0
- package/packages/rsc/src/blocks/video/component-info.js +106 -0
- package/packages/rsc/src/blocks/video/video.jsx +61 -0
- package/packages/rsc/src/components/render-block/block-styles.jsx +72 -0
- package/packages/rsc/src/components/render-block/render-block.helpers.js +113 -0
- package/packages/rsc/src/components/render-block/render-block.jsx +183 -0
- package/packages/rsc/src/components/render-block/render-component.jsx +37 -0
- package/packages/rsc/src/components/render-block/render-repeated-block.jsx +24 -0
- package/packages/rsc/src/components/render-block/types.js +0 -0
- package/packages/rsc/src/components/render-blocks.jsx +90 -0
- package/packages/rsc/src/components/render-content/builder-editing.jsx +7 -0
- package/packages/rsc/src/components/render-content/components/render-styles.jsx +70 -0
- package/packages/rsc/src/components/render-content/index.js +4 -0
- package/packages/rsc/src/components/render-content/render-content.jsx +245 -0
- package/packages/rsc/src/components/render-inlined-styles.jsx +33 -0
- package/packages/rsc/src/constants/builder-registered-components.js +54 -0
- package/packages/rsc/src/constants/device-sizes.js +48 -0
- package/packages/rsc/src/constants/target.js +4 -0
- package/packages/rsc/src/context/builder.context.js +11 -0
- package/packages/rsc/src/context/types.js +0 -0
- package/packages/rsc/src/functions/camel-to-kebab-case.js +4 -0
- package/packages/rsc/src/functions/evaluate.js +6 -0
- package/packages/rsc/src/functions/event-handler-name.js +7 -0
- package/packages/rsc/src/functions/extract-text-styles.js +22 -0
- package/packages/rsc/src/functions/fast-clone.js +4 -0
- package/packages/rsc/src/functions/get-block-actions-handler.js +11 -0
- package/packages/rsc/src/functions/get-block-actions.js +18 -0
- package/packages/{_rsc/src/blocks/text/text.js → rsc/src/functions/get-block-component-options.js} +8 -7
- package/packages/rsc/src/functions/get-block-properties.js +50 -0
- package/packages/rsc/src/functions/get-block-tag.js +6 -0
- package/packages/rsc/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/packages/rsc/src/functions/get-builder-search-params/index.js +38 -0
- package/packages/rsc/src/functions/get-content/ab-testing.js +99 -0
- package/packages/rsc/src/functions/get-content/generate-content-url.js +55 -0
- package/packages/rsc/src/functions/get-content/generate-content-url.test.js +31 -0
- package/packages/rsc/src/functions/get-content/index.js +65 -0
- package/packages/rsc/src/functions/get-content/types.js +0 -0
- package/packages/rsc/src/functions/get-fetch.js +14 -0
- package/packages/rsc/src/functions/get-global-this.js +18 -0
- package/packages/rsc/src/functions/get-processed-block.js +59 -0
- package/packages/rsc/src/functions/get-processed-block.test.js +32 -0
- package/packages/{_rsc/src/blocks/raw-text/raw-text.js → rsc/src/functions/get-react-native-block-styles.js} +14 -9
- package/packages/rsc/src/functions/if-target.js +15 -0
- package/packages/rsc/src/functions/is-browser.js +6 -0
- package/packages/rsc/src/functions/is-editing.js +7 -0
- package/packages/rsc/src/functions/is-iframe.js +7 -0
- package/packages/rsc/src/functions/is-previewing.js +14 -0
- package/packages/rsc/src/functions/on-change.js +27 -0
- package/packages/rsc/src/functions/on-change.test.js +19 -0
- package/packages/rsc/src/functions/register-component.js +68 -0
- package/packages/rsc/src/functions/register.js +29 -0
- package/packages/rsc/src/functions/sanitize-react-native-block-styles.js +66 -0
- package/packages/rsc/src/functions/set-editor-settings.js +15 -0
- package/packages/rsc/src/functions/set.js +11 -0
- package/packages/rsc/src/functions/set.test.js +16 -0
- package/packages/rsc/src/functions/track/helpers.js +50 -0
- package/packages/rsc/src/functions/track/index.js +128 -0
- package/packages/rsc/src/functions/track/interaction.js +53 -0
- package/packages/rsc/src/functions/transform-block-properties.js +6 -0
- package/packages/rsc/src/functions/transform-block.js +6 -0
- package/packages/rsc/src/helpers/ab-tests.js +16 -0
- package/packages/rsc/src/helpers/cookie.js +81 -0
- package/packages/rsc/src/helpers/css.js +34 -0
- package/packages/{_rsc/src/blocks/section/section.js → rsc/src/helpers/flatten.js} +12 -18
- package/packages/rsc/src/helpers/localStorage.js +35 -0
- package/packages/rsc/src/helpers/nullable.js +4 -0
- package/packages/rsc/src/helpers/sessionId.js +52 -0
- package/packages/rsc/src/helpers/time.js +5 -0
- package/packages/rsc/src/helpers/url.js +13 -0
- package/packages/rsc/src/helpers/url.test.js +21 -0
- package/packages/rsc/src/helpers/uuid.js +13 -0
- package/packages/rsc/src/helpers/visitorId.js +34 -0
- package/packages/rsc/src/index-helpers/blocks-exports.js +22 -0
- package/packages/rsc/src/index-helpers/top-of-file.js +2 -0
- package/packages/rsc/src/index.js +14 -0
- package/packages/rsc/src/scripts/init-editing.js +93 -0
- package/packages/rsc/src/types/builder-block.js +0 -0
- package/packages/rsc/src/types/builder-content.js +0 -0
- package/packages/rsc/src/types/can-track.js +0 -0
- package/packages/rsc/src/types/components.js +0 -0
- package/packages/rsc/src/types/deep-partial.js +0 -0
- package/packages/rsc/src/types/element.js +0 -0
- package/packages/rsc/src/types/targets.js +0 -0
- package/packages/rsc/src/types/typescript.js +0 -0
- package/src/blocks/BaseText.jsx +4 -7
- package/src/blocks/button/button.jsx +25 -32
- package/src/blocks/columns/columns.jsx +83 -59
- package/src/blocks/custom-code/custom-code.jsx +29 -15
- package/src/blocks/embed/embed.jsx +15 -11
- package/src/blocks/form/form.jsx +184 -148
- package/src/blocks/fragment/fragment.jsx +3 -5
- package/src/blocks/image/image.jsx +80 -56
- package/src/blocks/img/img.jsx +14 -29
- package/src/blocks/input/input.jsx +16 -32
- package/src/blocks/raw-text/raw-text.jsx +8 -9
- package/src/blocks/section/section.jsx +25 -37
- package/src/blocks/select/select.jsx +17 -32
- package/src/blocks/submit-button/submit-button.jsx +7 -23
- package/src/blocks/symbol/symbol.jsx +59 -48
- package/src/blocks/text/text.jsx +8 -8
- package/src/blocks/textarea/textarea.jsx +11 -29
- package/src/blocks/video/video.jsx +52 -48
- package/src/components/render-block/block-styles.jsx +48 -29
- package/src/components/render-block/render-block.jsx +150 -100
- package/src/components/render-block/render-component-with-context.jsx +35 -32
- package/src/components/render-block/render-component.jsx +30 -32
- package/src/components/render-block/render-repeated-block.jsx +30 -30
- package/src/components/render-blocks.jsx +73 -47
- package/src/components/render-content/builder-editing.jsx +3 -5
- package/src/components/render-content/components/render-styles.jsx +21 -15
- package/src/components/render-content/index.js +1 -1
- package/src/components/render-content/render-content.jsx +209 -134
- package/src/components/render-inlined-styles.jsx +19 -8
- package/src/constants/builder-registered-components.js +11 -11
- package/src/helpers/cookie.js +4 -2
- package/src/helpers/localStorage.js +1 -0
- package/src/helpers/sessionId.js +4 -1
- package/src/helpers/url.js +3 -0
- package/src/helpers/url.test.js +6 -0
- package/src/helpers/visitorId.js +1 -0
- package/src/index-helpers/blocks-exports.js +10 -10
- package/tsconfig.base.json +18 -0
- package/tsconfig.react.json +7 -0
- package/tsconfig.rsc.json +7 -0
- package/packages/_rsc/src/blocks/button/button.js +0 -35
- package/packages/_rsc/src/blocks/custom-code/custom-code.js +0 -63
- package/packages/_rsc/src/blocks/embed/embed.js +0 -55
- package/packages/_rsc/src/blocks/form/form.js +0 -222
- package/packages/_rsc/src/blocks/fragment/fragment.js +0 -24
- package/packages/_rsc/src/blocks/image/image.js +0 -101
- package/packages/_rsc/src/blocks/img/img.js +0 -33
- package/packages/_rsc/src/blocks/select/select.js +0 -36
- package/packages/_rsc/src/blocks/submit-button/submit-button.js +0 -26
- package/packages/_rsc/src/blocks/symbol/symbol.js +0 -60
- package/packages/_rsc/src/blocks/video/video.js +0 -57
- package/packages/_rsc/src/components/render-block/block-styles.js +0 -70
- package/packages/_rsc/src/components/render-block/render-block.js +0 -211
- package/packages/_rsc/src/components/render-block/render-component-with-context.js +0 -51
- package/packages/_rsc/src/components/render-block/render-component.js +0 -43
- package/packages/_rsc/src/components/render-block/render-repeated-block.js +0 -49
- package/packages/_rsc/src/components/render-blocks.js +0 -80
- package/packages/_rsc/src/components/render-content/builder-editing.js +0 -35
- package/packages/_rsc/src/components/render-content/components/render-styles.js +0 -78
- package/packages/_rsc/src/components/render-content/render-content.js +0 -215
- package/packages/_rsc/src/components/render-inlined-styles.js +0 -36
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./index-helpers/top-of-file.js";
|
|
2
|
+
import "./scripts/init-editing.js";
|
|
3
|
+
export * from "./index-helpers/blocks-exports.js";
|
|
4
|
+
export * from "./functions/is-editing.js";
|
|
5
|
+
export * from "./functions/is-previewing.js";
|
|
6
|
+
export * from "./functions/register-component.js";
|
|
7
|
+
export * from "./functions/register.js";
|
|
8
|
+
export * from "./functions/set-editor-settings.js";
|
|
9
|
+
export * from "./functions/get-content/index.js";
|
|
10
|
+
export * from "./functions/get-builder-search-params/index.js";
|
|
11
|
+
import { track } from "./functions/track/index.js";
|
|
12
|
+
export { track };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { TARGET } from "../constants/target.js";
|
|
2
|
+
import { isBrowser } from "../functions/is-browser.js";
|
|
3
|
+
import { register } from "../functions/register.js";
|
|
4
|
+
const registerInsertMenu = () => {
|
|
5
|
+
register("insertMenu", {
|
|
6
|
+
name: "_default",
|
|
7
|
+
default: true,
|
|
8
|
+
items: [
|
|
9
|
+
{ name: "Box" },
|
|
10
|
+
{ name: "Text" },
|
|
11
|
+
{ name: "Image" },
|
|
12
|
+
{ name: "Columns" },
|
|
13
|
+
...TARGET === "reactNative" ? [] : [
|
|
14
|
+
{ name: "Core:Section" },
|
|
15
|
+
{ name: "Core:Button" },
|
|
16
|
+
{ name: "Embed" },
|
|
17
|
+
{ name: "Custom Code" }
|
|
18
|
+
]
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
let isSetupForEditing = false;
|
|
23
|
+
const setupBrowserForEditing = (options = {}) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (isSetupForEditing) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
isSetupForEditing = true;
|
|
29
|
+
if (isBrowser()) {
|
|
30
|
+
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
31
|
+
type: "builder.sdkInfo",
|
|
32
|
+
data: {
|
|
33
|
+
target: TARGET,
|
|
34
|
+
supportsPatchUpdates: false,
|
|
35
|
+
supportsAddBlockScoping: true,
|
|
36
|
+
supportsCustomBreakpoints: true
|
|
37
|
+
}
|
|
38
|
+
}, "*");
|
|
39
|
+
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
40
|
+
type: "builder.updateContent",
|
|
41
|
+
data: {
|
|
42
|
+
options
|
|
43
|
+
}
|
|
44
|
+
}, "*");
|
|
45
|
+
window.addEventListener("message", ({ data }) => {
|
|
46
|
+
var _a2, _b2;
|
|
47
|
+
if (!(data == null ? void 0 : data.type)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
switch (data.type) {
|
|
51
|
+
case "builder.evaluate": {
|
|
52
|
+
const text = data.data.text;
|
|
53
|
+
const args = data.data.arguments || [];
|
|
54
|
+
const id = data.data.id;
|
|
55
|
+
const fn = new Function(text);
|
|
56
|
+
let result;
|
|
57
|
+
let error = null;
|
|
58
|
+
try {
|
|
59
|
+
result = fn.apply(null, args);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
error = err;
|
|
63
|
+
}
|
|
64
|
+
if (error) {
|
|
65
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage({
|
|
66
|
+
type: "builder.evaluateError",
|
|
67
|
+
data: { id, error: error.message }
|
|
68
|
+
}, "*");
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (result && typeof result.then === "function") {
|
|
72
|
+
result.then((finalResult) => {
|
|
73
|
+
var _a3;
|
|
74
|
+
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
75
|
+
type: "builder.evaluateResult",
|
|
76
|
+
data: { id, result: finalResult }
|
|
77
|
+
}, "*");
|
|
78
|
+
}).catch(console.error);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
82
|
+
type: "builder.evaluateResult",
|
|
83
|
+
data: { result, id }
|
|
84
|
+
}, "*");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export { registerInsertMenu, setupBrowserForEditing };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import BuilderContext from "../context/builder.context.js";
|
|
3
|
+
export default function BaseText(props) {
|
|
4
|
+
const _context = { ...props["_context"] };
|
|
5
|
+
const builderContext = _context["BuilderContext"];
|
|
6
|
+
return React.createElement("span", { style: builderContext.inheritedStyles }, props.text);
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export default function Button(props) {
|
|
3
|
+
const _context = { ...props["_context"] };
|
|
4
|
+
return (React.createElement(React.Fragment, null,
|
|
5
|
+
props.link ? (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement("a", { role: "button", ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined }, props.text))) : (React.createElement("button", { className: "button-12870b9c", ...props.attributes }, props.text)),
|
|
7
|
+
React.createElement("style", null, `.button-12870b9c {
|
|
8
|
+
all: unset;
|
|
9
|
+
}`)));
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Core:Button",
|
|
3
|
+
builtIn: true,
|
|
4
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
5
|
+
defaultStyles: {
|
|
6
|
+
appearance: "none",
|
|
7
|
+
paddingTop: "15px",
|
|
8
|
+
paddingBottom: "15px",
|
|
9
|
+
paddingLeft: "25px",
|
|
10
|
+
paddingRight: "25px",
|
|
11
|
+
backgroundColor: "#000000",
|
|
12
|
+
color: "white",
|
|
13
|
+
borderRadius: "4px",
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
cursor: "pointer"
|
|
16
|
+
},
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
name: "text",
|
|
20
|
+
type: "text",
|
|
21
|
+
defaultValue: "Click me!",
|
|
22
|
+
bubble: true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "link",
|
|
26
|
+
type: "url",
|
|
27
|
+
bubble: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "openLinkInNewTab",
|
|
31
|
+
type: "boolean",
|
|
32
|
+
defaultValue: false,
|
|
33
|
+
friendlyName: "Open link in new tab"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
static: true,
|
|
37
|
+
noWrap: true
|
|
38
|
+
};
|
|
39
|
+
export { componentInfo };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import RenderBlocks from "../../components/render-blocks.js";
|
|
3
|
+
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
4
|
+
import RenderInlinedStyles from "../../components/render-inlined-styles.js";
|
|
5
|
+
import { TARGET } from "../../constants/target.js";
|
|
6
|
+
import { convertStyleMapToCSS } from "../../helpers/css";
|
|
7
|
+
export default function Columns(props) {
|
|
8
|
+
const _context = { ...props["_context"] };
|
|
9
|
+
const state = {
|
|
10
|
+
getGutterSize() {
|
|
11
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
12
|
+
},
|
|
13
|
+
getColumns() {
|
|
14
|
+
return props.columns || [];
|
|
15
|
+
},
|
|
16
|
+
getWidth(index) {
|
|
17
|
+
const columns = state.getColumns();
|
|
18
|
+
return columns[index]?.width || 100 / columns.length;
|
|
19
|
+
},
|
|
20
|
+
getColumnCssWidth(index) {
|
|
21
|
+
const columns = state.getColumns();
|
|
22
|
+
const gutterSize = state.getGutterSize();
|
|
23
|
+
const subtractWidth = (gutterSize * (columns.length - 1)) / columns.length;
|
|
24
|
+
return `calc(${state.getWidth(index)}% - ${subtractWidth}px)`;
|
|
25
|
+
},
|
|
26
|
+
maybeApplyForTablet(prop) {
|
|
27
|
+
const _stackColumnsAt = props.stackColumnsAt || "tablet";
|
|
28
|
+
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
29
|
+
},
|
|
30
|
+
get columnsCssVars() {
|
|
31
|
+
const flexDir = props.stackColumnsAt === "never"
|
|
32
|
+
? "inherit"
|
|
33
|
+
: props.reverseColumnsWhenStacked
|
|
34
|
+
? "column-reverse"
|
|
35
|
+
: "column";
|
|
36
|
+
return {
|
|
37
|
+
"--flex-dir": flexDir,
|
|
38
|
+
"--flex-dir-tablet": state.maybeApplyForTablet(flexDir),
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
get columnCssVars() {
|
|
42
|
+
const width = "100%";
|
|
43
|
+
const marginLeft = "0";
|
|
44
|
+
return {
|
|
45
|
+
"--column-width": width,
|
|
46
|
+
"--column-margin-left": marginLeft,
|
|
47
|
+
"--column-width-tablet": state.maybeApplyForTablet(width),
|
|
48
|
+
"--column-margin-left-tablet": state.maybeApplyForTablet(marginLeft),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
getWidthForBreakpointSize(size) {
|
|
52
|
+
const breakpointSizes = getSizesForBreakpoints(props.customBreakpoints || {});
|
|
53
|
+
return breakpointSizes[size].max;
|
|
54
|
+
},
|
|
55
|
+
get columnStyleObjects() {
|
|
56
|
+
return {
|
|
57
|
+
columns: {
|
|
58
|
+
small: {
|
|
59
|
+
flexDirection: "var(--flex-dir)",
|
|
60
|
+
alignItems: "stretch",
|
|
61
|
+
},
|
|
62
|
+
medium: {
|
|
63
|
+
flexDirection: "var(--flex-dir-tablet)",
|
|
64
|
+
alignItems: "stretch",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
column: {
|
|
68
|
+
small: {
|
|
69
|
+
width: "var(--column-width) !important",
|
|
70
|
+
marginLeft: "var(--column-margin-left) !important",
|
|
71
|
+
},
|
|
72
|
+
medium: {
|
|
73
|
+
width: "var(--column-width-tablet) !important",
|
|
74
|
+
marginLeft: "var(--column-margin-left-tablet) !important",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
get columnsStyles() {
|
|
80
|
+
return `
|
|
81
|
+
@media (max-width: ${state.getWidthForBreakpointSize("medium")}px) {
|
|
82
|
+
.${props.builderBlock.id}-breakpoints {
|
|
83
|
+
${convertStyleMapToCSS(state.columnStyleObjects.columns.medium)}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
87
|
+
${convertStyleMapToCSS(state.columnStyleObjects.column.medium)}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (max-width: ${state.getWidthForBreakpointSize("small")}px) {
|
|
92
|
+
.${props.builderBlock.id}-breakpoints {
|
|
93
|
+
${convertStyleMapToCSS(state.columnStyleObjects.columns.small)}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
97
|
+
${convertStyleMapToCSS(state.columnStyleObjects.column.small)}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
`;
|
|
101
|
+
},
|
|
102
|
+
get reactNativeColumnsStyles() {
|
|
103
|
+
return this.columnStyleObjects.columns.small;
|
|
104
|
+
},
|
|
105
|
+
get reactNativeColumnStyles() {
|
|
106
|
+
return this.columnStyleObjects.column.small;
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
return (React.createElement(React.Fragment, null,
|
|
110
|
+
React.createElement("div", { className: `builder-columns ${props.builderBlock.id}-breakpoints` +
|
|
111
|
+
" div-540739f0", style: {
|
|
112
|
+
...(TARGET === "reactNative" ? state.reactNativeColumnsStyles : {}),
|
|
113
|
+
...state.columnsCssVars,
|
|
114
|
+
} },
|
|
115
|
+
TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
116
|
+
React.createElement(RenderInlinedStyles, { styles: state.columnsStyles, _context: _context }))) : null,
|
|
117
|
+
props.columns?.map((column, index) => (React.createElement("div", { className: "builder-column div-540739f0-2", style: {
|
|
118
|
+
width: state.getColumnCssWidth(index),
|
|
119
|
+
marginLeft: `${index === 0 ? 0 : state.getGutterSize()}px`,
|
|
120
|
+
...(TARGET === "reactNative"
|
|
121
|
+
? state.reactNativeColumnStyles
|
|
122
|
+
: {}),
|
|
123
|
+
...state.columnCssVars,
|
|
124
|
+
}, key: index },
|
|
125
|
+
React.createElement(RenderBlocks, { blocks: column.blocks, path: `component.options.columns.${index}.blocks`, parent: props.builderBlock.id, styleProp: {
|
|
126
|
+
flexGrow: "1",
|
|
127
|
+
}, _context: _context }))))),
|
|
128
|
+
React.createElement("style", null, `.div-540739f0 {
|
|
129
|
+
display: flex;
|
|
130
|
+
line-height: normal;
|
|
131
|
+
}.div-540739f0-2 {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
align-items: stretch;
|
|
135
|
+
}`)));
|
|
136
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { serializeFn } from "../util.js";
|
|
2
|
+
const componentInfo = {
|
|
3
|
+
name: "Columns",
|
|
4
|
+
builtIn: true,
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
name: "columns",
|
|
8
|
+
type: "array",
|
|
9
|
+
broadcast: true,
|
|
10
|
+
subFields: [
|
|
11
|
+
{
|
|
12
|
+
name: "blocks",
|
|
13
|
+
type: "array",
|
|
14
|
+
hideFromUI: true,
|
|
15
|
+
defaultValue: [
|
|
16
|
+
{
|
|
17
|
+
"@type": "@builder.io/sdk:Element",
|
|
18
|
+
responsiveStyles: {
|
|
19
|
+
large: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
alignItems: "stretch",
|
|
23
|
+
flexShrink: "0",
|
|
24
|
+
position: "relative",
|
|
25
|
+
marginTop: "30px",
|
|
26
|
+
textAlign: "center",
|
|
27
|
+
lineHeight: "normal",
|
|
28
|
+
height: "auto",
|
|
29
|
+
minHeight: "20px",
|
|
30
|
+
minWidth: "20px",
|
|
31
|
+
overflow: "hidden"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
component: {
|
|
35
|
+
name: "Image",
|
|
36
|
+
options: {
|
|
37
|
+
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
38
|
+
backgroundPosition: "center",
|
|
39
|
+
backgroundSize: "cover",
|
|
40
|
+
aspectRatio: 0.7004048582995948
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"@type": "@builder.io/sdk:Element",
|
|
46
|
+
responsiveStyles: {
|
|
47
|
+
large: {
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexDirection: "column",
|
|
50
|
+
alignItems: "stretch",
|
|
51
|
+
flexShrink: "0",
|
|
52
|
+
position: "relative",
|
|
53
|
+
marginTop: "30px",
|
|
54
|
+
textAlign: "center",
|
|
55
|
+
lineHeight: "normal",
|
|
56
|
+
height: "auto"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
component: {
|
|
60
|
+
name: "Text",
|
|
61
|
+
options: {
|
|
62
|
+
text: "<p>Enter some text...</p>"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "width",
|
|
70
|
+
type: "number",
|
|
71
|
+
hideFromUI: true,
|
|
72
|
+
helperText: "Width %, e.g. set to 50 to fill half of the space"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "link",
|
|
76
|
+
type: "url",
|
|
77
|
+
helperText: "Optionally set a url that clicking this column will link to"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
defaultValue: [
|
|
81
|
+
{
|
|
82
|
+
blocks: [
|
|
83
|
+
{
|
|
84
|
+
"@type": "@builder.io/sdk:Element",
|
|
85
|
+
responsiveStyles: {
|
|
86
|
+
large: {
|
|
87
|
+
display: "flex",
|
|
88
|
+
flexDirection: "column",
|
|
89
|
+
alignItems: "stretch",
|
|
90
|
+
flexShrink: "0",
|
|
91
|
+
position: "relative",
|
|
92
|
+
marginTop: "30px",
|
|
93
|
+
textAlign: "center",
|
|
94
|
+
lineHeight: "normal",
|
|
95
|
+
height: "auto",
|
|
96
|
+
minHeight: "20px",
|
|
97
|
+
minWidth: "20px",
|
|
98
|
+
overflow: "hidden"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
component: {
|
|
102
|
+
name: "Image",
|
|
103
|
+
options: {
|
|
104
|
+
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
105
|
+
backgroundPosition: "center",
|
|
106
|
+
backgroundSize: "cover",
|
|
107
|
+
aspectRatio: 0.7004048582995948
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"@type": "@builder.io/sdk:Element",
|
|
113
|
+
responsiveStyles: {
|
|
114
|
+
large: {
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
alignItems: "stretch",
|
|
118
|
+
flexShrink: "0",
|
|
119
|
+
position: "relative",
|
|
120
|
+
marginTop: "30px",
|
|
121
|
+
textAlign: "center",
|
|
122
|
+
lineHeight: "normal",
|
|
123
|
+
height: "auto"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
component: {
|
|
127
|
+
name: "Text",
|
|
128
|
+
options: {
|
|
129
|
+
text: "<p>Enter some text...</p>"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
blocks: [
|
|
137
|
+
{
|
|
138
|
+
"@type": "@builder.io/sdk:Element",
|
|
139
|
+
responsiveStyles: {
|
|
140
|
+
large: {
|
|
141
|
+
display: "flex",
|
|
142
|
+
flexDirection: "column",
|
|
143
|
+
alignItems: "stretch",
|
|
144
|
+
flexShrink: "0",
|
|
145
|
+
position: "relative",
|
|
146
|
+
marginTop: "30px",
|
|
147
|
+
textAlign: "center",
|
|
148
|
+
lineHeight: "normal",
|
|
149
|
+
height: "auto",
|
|
150
|
+
minHeight: "20px",
|
|
151
|
+
minWidth: "20px",
|
|
152
|
+
overflow: "hidden"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
component: {
|
|
156
|
+
name: "Image",
|
|
157
|
+
options: {
|
|
158
|
+
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
159
|
+
backgroundPosition: "center",
|
|
160
|
+
backgroundSize: "cover",
|
|
161
|
+
aspectRatio: 0.7004048582995948
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"@type": "@builder.io/sdk:Element",
|
|
167
|
+
responsiveStyles: {
|
|
168
|
+
large: {
|
|
169
|
+
display: "flex",
|
|
170
|
+
flexDirection: "column",
|
|
171
|
+
alignItems: "stretch",
|
|
172
|
+
flexShrink: "0",
|
|
173
|
+
position: "relative",
|
|
174
|
+
marginTop: "30px",
|
|
175
|
+
textAlign: "center",
|
|
176
|
+
lineHeight: "normal",
|
|
177
|
+
height: "auto"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
component: {
|
|
181
|
+
name: "Text",
|
|
182
|
+
options: {
|
|
183
|
+
text: "<p>Enter some text...</p>"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
onChange: serializeFn((options) => {
|
|
191
|
+
function clearWidths() {
|
|
192
|
+
columns.forEach((col) => {
|
|
193
|
+
col.delete("width");
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const columns = options.get("columns");
|
|
197
|
+
if (Array.isArray(columns)) {
|
|
198
|
+
const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
|
|
199
|
+
if (containsColumnWithWidth) {
|
|
200
|
+
const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
|
|
201
|
+
if (containsColumnWithoutWidth) {
|
|
202
|
+
clearWidths();
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const sumWidths = columns.reduce((memo, col) => {
|
|
206
|
+
return memo + col.get("width");
|
|
207
|
+
}, 0);
|
|
208
|
+
const widthsDontAddUp = sumWidths !== 100;
|
|
209
|
+
if (widthsDontAddUp) {
|
|
210
|
+
clearWidths();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "space",
|
|
219
|
+
type: "number",
|
|
220
|
+
defaultValue: 20,
|
|
221
|
+
helperText: "Size of gap between columns",
|
|
222
|
+
advanced: true
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "stackColumnsAt",
|
|
226
|
+
type: "string",
|
|
227
|
+
defaultValue: "tablet",
|
|
228
|
+
helperText: "Convert horizontal columns to vertical at what device size",
|
|
229
|
+
enum: ["tablet", "mobile", "never"],
|
|
230
|
+
advanced: true
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: "reverseColumnsWhenStacked",
|
|
234
|
+
type: "boolean",
|
|
235
|
+
defaultValue: false,
|
|
236
|
+
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
237
|
+
advanced: true
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
};
|
|
241
|
+
export { componentInfo };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Custom Code",
|
|
3
|
+
static: true,
|
|
4
|
+
builtIn: true,
|
|
5
|
+
requiredPermissions: ["editCode"],
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "code",
|
|
9
|
+
type: "html",
|
|
10
|
+
required: true,
|
|
11
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
12
|
+
code: true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "replaceNodes",
|
|
16
|
+
type: "boolean",
|
|
17
|
+
helperText: "Preserve server rendered dom nodes",
|
|
18
|
+
advanced: true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "scriptsClientOnly",
|
|
22
|
+
type: "boolean",
|
|
23
|
+
defaultValue: false,
|
|
24
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
25
|
+
advanced: true
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
export { componentInfo };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export default function CustomCode(props) {
|
|
3
|
+
const _context = { ...props["_context"] };
|
|
4
|
+
const state = {
|
|
5
|
+
scriptsInserted: [],
|
|
6
|
+
scriptsRun: [],
|
|
7
|
+
findAndRunScripts() {
|
|
8
|
+
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
9
|
+
if (elem && elem.getElementsByTagName && typeof window !== "undefined") {
|
|
10
|
+
const scripts = elem.getElementsByTagName("script");
|
|
11
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
12
|
+
const script = scripts[i];
|
|
13
|
+
if (script.src) {
|
|
14
|
+
if (state.scriptsInserted.includes(script.src)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
state.scriptsInserted.push(script.src);
|
|
18
|
+
const newScript = document.createElement("script");
|
|
19
|
+
newScript.async = true;
|
|
20
|
+
newScript.src = script.src;
|
|
21
|
+
document.head.appendChild(newScript);
|
|
22
|
+
}
|
|
23
|
+
else if (!script.type ||
|
|
24
|
+
[
|
|
25
|
+
"text/javascript",
|
|
26
|
+
"application/javascript",
|
|
27
|
+
"application/ecmascript",
|
|
28
|
+
].includes(script.type)) {
|
|
29
|
+
if (state.scriptsRun.includes(script.innerText)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
state.scriptsRun.push(script.innerText);
|
|
34
|
+
new Function(script.innerText)();
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.warn("`CustomCode`: Error running script:", error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
return (React.createElement("div", { className: "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), dangerouslySetInnerHTML: { __html: props.code } }));
|
|
45
|
+
}
|