@builder.io/sdk-react 0.4.5 → 0.5.1-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/dist/{sdk/blocks → blocks}/BaseText.d.ts +0 -1
- package/dist/{sdk/blocks → blocks}/BaseText.js +2 -2
- package/dist/{sdk/blocks → blocks}/button/button.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/button/button.js +3 -5
- package/dist/blocks/button/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/button/component-info.js +9 -13
- package/dist/blocks/columns/columns.d.ts +16 -0
- package/dist/{sdk/blocks → blocks}/columns/columns.js +13 -19
- package/dist/blocks/columns/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/columns/component-info.js +62 -83
- package/dist/blocks/custom-code/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/custom-code/component-info.js +7 -11
- package/dist/{sdk/blocks → blocks}/custom-code/custom-code.d.ts +0 -1
- package/dist/{sdk/blocks → blocks}/custom-code/custom-code.js +1 -1
- package/dist/blocks/embed/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/embed/component-info.js +8 -15
- package/dist/{sdk/blocks → blocks}/embed/embed.d.ts +0 -1
- package/dist/{sdk/blocks → blocks}/embed/embed.js +1 -1
- package/dist/blocks/embed/helpers.js +2 -0
- package/dist/blocks/form/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/form/component-info.js +94 -129
- package/dist/blocks/form/form.d.ts +2 -0
- package/dist/blocks/form/form.js +6 -0
- package/dist/blocks/fragment/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/fragment/component-info.js +1 -1
- package/dist/{sdk/blocks → blocks}/fragment/fragment.d.ts +0 -1
- package/dist/{sdk/blocks → blocks}/fragment/fragment.js +1 -1
- package/dist/blocks/helpers.d.ts +13 -0
- package/dist/blocks/helpers.js +40 -0
- package/dist/blocks/image/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/image/component-info.js +33 -63
- package/dist/{sdk/blocks → blocks}/image/image.d.ts +0 -1
- package/dist/{sdk/blocks → blocks}/image/image.helpers.js +2 -11
- package/dist/{sdk/blocks → blocks}/image/image.js +7 -7
- package/dist/blocks/img/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/img/component-info.js +4 -6
- package/dist/{sdk/blocks → blocks}/img/img.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/img/img.js +1 -1
- package/dist/blocks/input/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/input/component-info.js +15 -40
- package/dist/{sdk/blocks → blocks}/input/input.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/input/input.js +1 -1
- package/dist/blocks/raw-text/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/raw-text/component-info.js +3 -5
- package/dist/{sdk/blocks → blocks}/raw-text/raw-text.d.ts +0 -1
- package/dist/blocks/raw-text/raw-text.js +6 -0
- package/dist/blocks/section/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/section/component-info.js +13 -18
- package/dist/{sdk/blocks → blocks}/section/section.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/section/section.js +1 -1
- package/dist/blocks/select/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/select/component-info.js +22 -34
- package/dist/{sdk/blocks → blocks}/select/select.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/select/select.js +1 -1
- package/dist/blocks/submit-button/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/submit-button/component-info.js +5 -7
- package/dist/{sdk/blocks → blocks}/submit-button/submit-button.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/submit-button/submit-button.js +1 -1
- package/dist/blocks/symbol/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/symbol/component-info.js +12 -17
- package/dist/blocks/symbol/symbol.d.ts +23 -0
- package/dist/blocks/symbol/symbol.helpers.d.ts +14 -0
- package/dist/blocks/symbol/symbol.helpers.js +31 -0
- package/dist/blocks/symbol/symbol.js +45 -0
- package/dist/blocks/text/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/text/component-info.js +6 -7
- package/dist/{sdk/blocks → blocks}/text/text.d.ts +0 -1
- package/dist/{sdk/blocks → blocks}/text/text.js +2 -2
- package/dist/blocks/textarea/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/textarea/component-info.js +13 -19
- package/dist/{sdk/blocks → blocks}/textarea/textarea.d.ts +3 -2
- package/dist/{sdk/blocks → blocks}/textarea/textarea.js +1 -1
- package/dist/blocks/video/component-info.d.ts +2 -0
- package/dist/{sdk/blocks → blocks}/video/component-info.js +35 -55
- package/dist/{sdk/blocks → blocks}/video/video.d.ts +1 -1
- package/dist/{sdk/blocks → blocks}/video/video.js +2 -2
- package/dist/{sdk/components → components}/block/block.d.ts +2 -4
- package/dist/components/block/block.helpers.d.ts +13 -0
- package/dist/{sdk/components → components}/block/block.helpers.js +12 -29
- package/dist/components/block/block.js +94 -0
- package/dist/{sdk/components → components}/block/components/block-styles.d.ts +0 -1
- package/dist/{sdk/components → components}/block/components/block-styles.js +1 -1
- package/dist/components/block/components/block-wrapper.d.ts +16 -0
- package/dist/components/block/components/block-wrapper.js +36 -0
- package/dist/components/block/components/component-ref/component-ref.d.ts +3 -0
- package/dist/components/block/components/component-ref/component-ref.helpers.d.ts +28 -0
- package/dist/components/block/components/component-ref/component-ref.helpers.js +22 -0
- package/dist/components/block/components/component-ref/component-ref.js +23 -0
- package/dist/components/block/components/interactive-element.d.ts +11 -0
- package/dist/components/block/components/interactive-element.js +20 -0
- package/dist/components/block/components/repeated-block.d.ts +9 -0
- package/dist/{sdk/components → components}/block/components/repeated-block.js +3 -3
- package/dist/{sdk/components → components}/blocks/blocks-wrapper.d.ts +2 -5
- package/dist/{sdk/components → components}/blocks/blocks-wrapper.js +3 -3
- package/dist/components/blocks/blocks.d.ts +8 -0
- package/dist/{sdk/components → components}/blocks/blocks.js +9 -3
- package/dist/components/content/components/enable-editor.d.ts +9 -0
- package/dist/{sdk/components → components}/content/components/enable-editor.js +31 -39
- package/dist/{sdk/components/content/components/content-styles.d.ts → components/content/components/styles.d.ts} +1 -2
- package/dist/{sdk/components/content/components/content-styles.helpers.d.ts → components/content/components/styles.helpers.d.ts} +1 -1
- package/dist/{sdk/components/content/components/content-styles.helpers.js → components/content/components/styles.helpers.js} +3 -4
- package/dist/{sdk/components/content/components/content-styles.js → components/content/components/styles.js} +3 -3
- package/dist/components/content/content.d.ts +3 -0
- package/dist/components/content/content.helpers.d.ts +7 -0
- package/dist/components/content/content.helpers.js +30 -0
- package/dist/{sdk/components → components}/content/content.js +26 -40
- package/dist/{sdk/components/render-content/render-content.types.d.ts → components/content/content.types.d.ts} +4 -4
- package/dist/components/content-variants/content-variants.d.ts +9 -0
- package/dist/{sdk/components/render-content-variants/render-content-variants.js → components/content-variants/content-variants.js} +23 -22
- package/dist/{sdk/components/render-content-variants/render-content-variants.types.d.ts → components/content-variants/content-variants.types.d.ts} +5 -5
- package/dist/{sdk/components/render-content-variants → components/content-variants}/helpers.d.ts +7 -7
- package/dist/{sdk/components/render-content-variants → components/content-variants}/helpers.js +13 -22
- package/dist/{sdk/components → components}/inlined-script.d.ts +0 -1
- package/dist/{sdk/components → components}/inlined-script.js +1 -1
- package/dist/{sdk/components → components}/inlined-styles.d.ts +0 -1
- package/dist/{sdk/components → components}/inlined-styles.js +1 -1
- package/dist/{sdk/constants → constants}/builder-registered-components.js +34 -13
- package/dist/{sdk/constants → constants}/device-sizes.js +9 -8
- package/dist/constants/sdk-version.d.ts +1 -0
- package/dist/constants/sdk-version.js +1 -0
- package/dist/{sdk/context → context}/builder.context.js +1 -1
- package/dist/context/components.context.d.ts +3 -0
- package/dist/context/components.context.js +2 -0
- package/dist/{sdk/context → context}/types.d.ts +1 -1
- package/dist/functions/acorn_interpreter.d.ts +1 -0
- package/dist/functions/acorn_interpreter.js +3027 -0
- package/dist/functions/apply-patch-with-mutation.d.ts +10 -0
- package/dist/functions/apply-patch-with-mutation.js +54 -0
- package/dist/functions/apply-patch-with-mutation.test.js +53 -0
- package/dist/functions/evaluate/acorn.d.ts +0 -0
- package/dist/functions/evaluate/acorn.js +2432 -0
- package/dist/{sdk/functions → functions/evaluate}/evaluate.d.ts +5 -2
- package/dist/functions/evaluate/evaluate.js +70 -0
- package/dist/functions/evaluate/evaluate.test.js +23 -0
- package/dist/functions/evaluate/index.d.ts +1 -0
- package/dist/functions/evaluate/index.js +1 -0
- package/dist/functions/evaluate/interpreter.d.ts +2 -0
- package/dist/functions/evaluate/interpreter.js +3853 -0
- package/dist/functions/evaluate/non-node-runtime.d.ts +2 -0
- package/dist/functions/evaluate/non-node-runtime.js +84 -0
- package/dist/functions/evaluate/types.d.ts +10 -0
- package/dist/functions/evaluate.d.ts +23 -0
- package/dist/{sdk/functions → functions}/evaluate.js +28 -9
- package/dist/{sdk/functions → functions}/evaluate.test.js +11 -5
- package/dist/{sdk/functions → functions}/extract-text-styles.js +2 -14
- package/dist/{sdk/functions → functions}/get-block-actions-handler.js +3 -3
- package/dist/{sdk/functions → functions}/get-block-actions.d.ts +1 -0
- package/dist/functions/get-block-actions.js +28 -0
- package/dist/{sdk/functions → functions}/get-block-component-options.js +1 -1
- package/dist/functions/get-block-properties.d.ts +6 -0
- package/dist/{sdk/functions → functions}/get-block-properties.js +15 -9
- package/dist/{sdk/functions → functions}/get-builder-search-params/fn.test.js +1 -1
- package/dist/{sdk/functions → functions}/get-builder-search-params/index.js +3 -7
- package/dist/{sdk/functions → functions}/get-content/generate-content-url.js +7 -5
- package/dist/{sdk/functions → functions}/get-content/generate-content-url.test.js +31 -17
- package/dist/{sdk/functions → functions}/get-content/index.d.ts +2 -6
- package/dist/{sdk/functions → functions}/get-content/index.js +26 -6
- package/dist/functions/get-content/processCookies.d.ts +2 -0
- package/dist/functions/get-content/processCookies.js +3 -0
- package/dist/{sdk/functions → functions}/get-processed-block.d.ts +1 -1
- package/dist/{sdk/functions → functions}/get-processed-block.js +11 -7
- package/dist/{sdk/functions → functions}/get-processed-block.test.js +8 -6
- package/dist/{sdk/functions → functions}/get-react-native-block-styles.d.ts +1 -1
- package/dist/{sdk/functions → functions}/get-react-native-block-styles.js +2 -2
- package/dist/{sdk/functions → functions}/if-target.d.ts +1 -1
- package/dist/{sdk/functions → functions}/if-target.js +1 -1
- package/dist/functions/is-editing.js +5 -0
- package/dist/functions/is-non-node-server.d.ts +4 -0
- package/dist/functions/is-non-node-server.js +8 -0
- package/dist/{sdk/functions → functions}/on-change.js +1 -1
- package/dist/{sdk/functions → functions}/on-change.test.js +13 -3
- package/dist/{sdk/functions → functions}/register-component.d.ts +2 -1
- package/dist/functions/register-component.js +38 -0
- package/dist/{sdk/functions → functions}/register.js +2 -2
- package/dist/{sdk/functions → functions}/sanitize-react-native-block-styles.js +13 -5
- package/dist/{sdk/functions → functions}/set-editor-settings.js +1 -1
- package/dist/functions/set.js +14 -0
- package/dist/{sdk/functions → functions}/set.test.js +9 -3
- package/dist/{sdk/functions → functions}/track/helpers.js +6 -11
- package/dist/{sdk/functions → functions}/track/index.js +26 -14
- package/dist/{sdk/functions → functions}/track/interaction.js +15 -16
- package/dist/functions/transform-block-properties.d.ts +1 -0
- package/dist/{sdk/functions → functions}/transform-block-properties.js +2 -0
- package/dist/{sdk/helpers → helpers}/ab-tests.d.ts +2 -2
- package/dist/{sdk/helpers → helpers}/ab-tests.js +42 -30
- package/dist/{sdk/helpers → helpers}/canTrack.js +1 -1
- package/dist/{sdk/helpers → helpers}/cookie.d.ts +2 -2
- package/dist/{sdk/helpers → helpers}/cookie.js +13 -26
- package/dist/{sdk/helpers → helpers}/css.d.ts +1 -1
- package/dist/{sdk/helpers → helpers}/css.js +1 -1
- package/dist/{sdk/helpers → helpers}/flatten.js +8 -8
- package/dist/{sdk/helpers → helpers}/localStorage.d.ts +2 -2
- package/dist/{sdk/helpers → helpers}/localStorage.js +2 -2
- package/dist/{sdk/helpers → helpers}/logger.js +1 -1
- package/dist/helpers/preview-lru-cache/get.d.ts +1 -0
- package/dist/helpers/preview-lru-cache/get.js +7 -0
- package/dist/helpers/preview-lru-cache/helpers.d.ts +1 -0
- package/dist/helpers/preview-lru-cache/helpers.js +9 -0
- package/dist/helpers/preview-lru-cache/init.d.ts +6 -0
- package/dist/helpers/preview-lru-cache/init.js +15 -0
- package/dist/helpers/preview-lru-cache/set.d.ts +7 -0
- package/dist/helpers/preview-lru-cache/set.js +9 -0
- package/dist/helpers/preview-lru-cache/types.d.ts +12 -0
- package/dist/helpers/preview-lru-cache/types.js +6 -0
- package/dist/{sdk/helpers → helpers}/sessionId.d.ts +2 -2
- package/dist/{sdk/helpers → helpers}/sessionId.js +11 -4
- package/dist/{sdk/helpers → helpers}/uuid.js +1 -1
- package/dist/{sdk/helpers → helpers}/visitorId.d.ts +1 -1
- package/dist/{sdk/helpers → helpers}/visitorId.js +7 -4
- package/dist/{sdk/index-helpers → index-helpers}/blocks-exports.d.ts +2 -2
- package/dist/{sdk/index-helpers → index-helpers}/blocks-exports.js +2 -2
- package/dist/{sdk/index.d.ts → index.d.ts} +2 -2
- package/dist/{sdk/index.js → index.js} +1 -1
- package/dist/scripts/init-editing.js +110 -0
- package/dist/types/builder-props.d.ts +9 -0
- package/dist/{sdk/types → types}/components.d.ts +8 -2
- package/dist/{sdk/types → types}/enforced-partials.d.ts +1 -1
- package/dist/types/targets.d.ts +1 -0
- package/dist/{sdk/types → types}/typescript.d.ts +3 -0
- package/package.json +8 -16
- package/server/package.json +5 -0
- package/dist/sdk/blocks/button/component-info.d.ts +0 -2
- package/dist/sdk/blocks/columns/columns.d.ts +0 -16
- package/dist/sdk/blocks/columns/component-info.d.ts +0 -2
- package/dist/sdk/blocks/custom-code/component-info.d.ts +0 -2
- package/dist/sdk/blocks/embed/component-info.d.ts +0 -2
- package/dist/sdk/blocks/embed/helpers.js +0 -6
- package/dist/sdk/blocks/form/component-info.d.ts +0 -2
- package/dist/sdk/blocks/form/form.d.ts +0 -40
- package/dist/sdk/blocks/form/form.js +0 -203
- package/dist/sdk/blocks/fragment/component-info.d.ts +0 -2
- package/dist/sdk/blocks/image/component-info.d.ts +0 -2
- package/dist/sdk/blocks/img/component-info.d.ts +0 -2
- package/dist/sdk/blocks/input/component-info.d.ts +0 -2
- package/dist/sdk/blocks/raw-text/component-info.d.ts +0 -2
- package/dist/sdk/blocks/raw-text/raw-text.js +0 -6
- package/dist/sdk/blocks/section/component-info.d.ts +0 -2
- package/dist/sdk/blocks/select/component-info.d.ts +0 -2
- package/dist/sdk/blocks/submit-button/component-info.d.ts +0 -2
- package/dist/sdk/blocks/symbol/component-info.d.ts +0 -2
- package/dist/sdk/blocks/symbol/symbol.d.ts +0 -21
- package/dist/sdk/blocks/symbol/symbol.js +0 -71
- package/dist/sdk/blocks/text/component-info.d.ts +0 -2
- package/dist/sdk/blocks/textarea/component-info.d.ts +0 -2
- package/dist/sdk/blocks/util.d.ts +0 -4
- package/dist/sdk/blocks/util.js +0 -13
- package/dist/sdk/blocks/video/component-info.d.ts +0 -2
- package/dist/sdk/components/block/block.helpers.d.ts +0 -12
- package/dist/sdk/components/block/block.js +0 -124
- package/dist/sdk/components/block/components/component.d.ts +0 -20
- package/dist/sdk/components/block/components/component.js +0 -11
- package/dist/sdk/components/block/components/repeated-block.d.ts +0 -11
- package/dist/sdk/components/blocks/blocks.d.ts +0 -10
- package/dist/sdk/components/content/components/enable-editor.d.ts +0 -13
- package/dist/sdk/components/content/content.d.ts +0 -4
- package/dist/sdk/components/content/content.helpers.d.ts +0 -7
- package/dist/sdk/components/content/content.helpers.js +0 -30
- package/dist/sdk/components/content/content.types.d.ts +0 -38
- package/dist/sdk/components/content-variants/content-variants.d.ts +0 -5
- package/dist/sdk/components/content-variants/content-variants.js +0 -37
- package/dist/sdk/components/content-variants/helpers.d.ts +0 -17
- package/dist/sdk/components/content-variants/helpers.js +0 -184
- package/dist/sdk/components/render-block/block-styles.d.ts +0 -9
- package/dist/sdk/components/render-block/block-styles.js +0 -66
- package/dist/sdk/components/render-block/render-block.d.ts +0 -9
- package/dist/sdk/components/render-block/render-block.helpers.d.ts +0 -12
- package/dist/sdk/components/render-block/render-block.helpers.js +0 -86
- package/dist/sdk/components/render-block/render-block.js +0 -115
- package/dist/sdk/components/render-block/render-component.d.ts +0 -17
- package/dist/sdk/components/render-block/render-component.js +0 -11
- package/dist/sdk/components/render-block/render-repeated-block.d.ts +0 -9
- package/dist/sdk/components/render-block/render-repeated-block.js +0 -11
- package/dist/sdk/components/render-block/types.d.ts +0 -6
- package/dist/sdk/components/render-blocks.d.ts +0 -10
- package/dist/sdk/components/render-blocks.js +0 -45
- package/dist/sdk/components/render-content/builder-editing.d.ts +0 -3
- package/dist/sdk/components/render-content/builder-editing.js +0 -6
- package/dist/sdk/components/render-content/components/render-styles.d.ts +0 -9
- package/dist/sdk/components/render-content/components/render-styles.helpers.d.ts +0 -15
- package/dist/sdk/components/render-content/components/render-styles.helpers.js +0 -59
- package/dist/sdk/components/render-content/components/render-styles.js +0 -32
- package/dist/sdk/components/render-content/index.d.ts +0 -1
- package/dist/sdk/components/render-content/index.js +0 -1
- package/dist/sdk/components/render-content/render-content.d.ts +0 -4
- package/dist/sdk/components/render-content/render-content.helpers.d.ts +0 -7
- package/dist/sdk/components/render-content/render-content.helpers.js +0 -30
- package/dist/sdk/components/render-content/render-content.js +0 -343
- package/dist/sdk/components/render-content/wrap-component-ref.d.ts +0 -6
- package/dist/sdk/components/render-content/wrap-component-ref.js +0 -6
- package/dist/sdk/components/render-content-variants/render-content-variants.d.ts +0 -10
- package/dist/sdk/components/render-inlined-styles.d.ts +0 -7
- package/dist/sdk/components/render-inlined-styles.js +0 -6
- package/dist/sdk/constants/sdk-version.d.ts +0 -1
- package/dist/sdk/constants/sdk-version.js +0 -1
- package/dist/sdk/functions/get-block-actions.js +0 -15
- package/dist/sdk/functions/get-block-properties.d.ts +0 -7
- package/dist/sdk/functions/get-content/ab-testing.d.ts +0 -5
- package/dist/sdk/functions/get-content/ab-testing.js +0 -78
- package/dist/sdk/functions/is-editing.js +0 -7
- package/dist/sdk/functions/register-component.js +0 -26
- package/dist/sdk/functions/set.js +0 -21
- package/dist/sdk/functions/transform-block-properties.d.ts +0 -1
- package/dist/sdk/scripts/init-editing.js +0 -102
- package/dist/sdk/types/builder-props.d.ts +0 -10
- package/dist/sdk/types/targets.d.ts +0 -3
- package/dist/server/functions/get-builder-search-params/index.d.ts +0 -6
- package/dist/server/functions/get-builder-search-params/index.js +0 -36
- package/dist/server/functions/get-content/ab-testing.d.ts +0 -5
- package/dist/server/functions/get-content/ab-testing.js +0 -78
- package/dist/server/functions/get-content/generate-content-url.d.ts +0 -2
- package/dist/server/functions/get-content/generate-content-url.js +0 -31
- package/dist/server/functions/get-content/generate-content-url.test.d.ts +0 -1
- package/dist/server/functions/get-content/generate-content-url.test.js +0 -82
- package/dist/server/functions/get-content/index.d.ts +0 -11
- package/dist/server/functions/get-content/index.js +0 -40
- package/dist/server/functions/get-content/types.d.ts +0 -45
- package/dist/server/functions/get-fetch.d.ts +0 -1
- package/dist/server/functions/get-fetch.js +0 -11
- package/dist/server/functions/get-global-this.d.ts +0 -4
- package/dist/server/functions/get-global-this.js +0 -15
- package/dist/server/functions/is-browser.d.ts +0 -1
- package/dist/server/functions/is-browser.js +0 -3
- package/dist/server/helpers/ab-tests.d.ts +0 -8
- package/dist/server/helpers/ab-tests.js +0 -5
- package/dist/server/helpers/cookie.d.ts +0 -15
- package/dist/server/helpers/cookie.js +0 -65
- package/dist/server/helpers/flatten.d.ts +0 -6
- package/dist/server/helpers/flatten.js +0 -19
- package/dist/server/helpers/logger.d.ts +0 -5
- package/dist/server/helpers/logger.js +0 -6
- package/dist/server/helpers/nullable.d.ts +0 -2
- package/dist/server/helpers/nullable.js +0 -1
- package/dist/server/helpers/url.d.ts +0 -6
- package/dist/server/helpers/url.js +0 -15
- package/dist/server/types/api-version.d.ts +0 -2
- package/dist/server/types/api-version.js +0 -1
- package/dist/server/types/builder-block.d.ts +0 -66
- package/dist/server/types/builder-block.js +0 -1
- package/dist/server/types/builder-content.d.ts +0 -46
- package/dist/server/types/builder-content.js +0 -1
- package/dist/server/types/can-track.d.ts +0 -3
- package/dist/server/types/can-track.js +0 -1
- package/dist/server/types/input.d.ts +0 -121
- package/dist/server/types/input.js +0 -1
- package/dist/server/types/typescript.d.ts +0 -5
- package/dist/server/types/typescript.js +0 -1
- /package/dist/{sdk/blocks → blocks}/embed/helpers.d.ts +0 -0
- /package/dist/{sdk/blocks → blocks}/image/image.helpers.d.ts +0 -0
- /package/dist/{sdk/components → components}/block/types.d.ts +0 -0
- /package/dist/{sdk/components → components}/block/types.js +0 -0
- /package/dist/{sdk/components/render-block/types.js → components/content/content.types.js} +0 -0
- /package/dist/{sdk/components → components}/content/index.d.ts +0 -0
- /package/dist/{sdk/components → components}/content/index.js +0 -0
- /package/dist/{sdk/components → components}/content/wrap-component-ref.d.ts +0 -0
- /package/dist/{sdk/components → components}/content/wrap-component-ref.js +0 -0
- /package/dist/{sdk/components/content/content.types.js → components/content-variants/content-variants.types.js} +0 -0
- /package/dist/{sdk/constants → constants}/builder-registered-components.d.ts +0 -0
- /package/dist/{sdk/constants → constants}/device-sizes.d.ts +0 -0
- /package/dist/{sdk/constants → constants}/target.d.ts +0 -0
- /package/dist/{sdk/constants → constants}/target.js +0 -0
- /package/dist/{sdk/context → context}/builder.context.d.ts +0 -0
- /package/dist/{sdk/context → context}/types.js +0 -0
- /package/dist/{sdk/components/render-content-variants/render-content-variants.types.js → functions/apply-patch-with-mutation.test.d.ts} +0 -0
- /package/dist/{sdk/functions → functions}/camel-to-kebab-case.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/camel-to-kebab-case.js +0 -0
- /package/dist/{sdk/components/render-content/render-content.types.js → functions/evaluate/evaluate.test.d.ts} +0 -0
- /package/dist/{sdk/functions/get-content → functions/evaluate}/types.js +0 -0
- /package/dist/{sdk/functions → functions}/evaluate.test.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/event-handler-name.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/event-handler-name.js +0 -0
- /package/dist/{sdk/functions → functions}/extract-text-styles.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/fast-clone.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/fast-clone.js +0 -0
- /package/dist/{sdk/functions → functions}/get-block-actions-handler.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-block-component-options.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-builder-search-params/fn.test.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-builder-search-params/index.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-content/generate-content-url.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-content/generate-content-url.test.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-content/types.d.ts +0 -0
- /package/dist/{server/functions → functions}/get-content/types.js +0 -0
- /package/dist/{sdk/functions → functions}/get-fetch.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-fetch.js +0 -0
- /package/dist/{sdk/functions → functions}/get-global-this.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/get-global-this.js +0 -0
- /package/dist/{sdk/functions → functions}/get-processed-block.test.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/is-browser.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/is-browser.js +0 -0
- /package/dist/{sdk/functions → functions}/is-editing.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/is-iframe.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/is-iframe.js +0 -0
- /package/dist/{sdk/functions → functions}/is-previewing.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/is-previewing.js +0 -0
- /package/dist/{sdk/functions → functions}/on-change.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/on-change.test.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/register.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/sanitize-react-native-block-styles.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/set-editor-settings.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/set.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/set.test.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/track/helpers.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/track/index.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/track/interaction.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/transform-block.d.ts +0 -0
- /package/dist/{sdk/functions → functions}/transform-block.js +0 -0
- /package/dist/{sdk/helpers → helpers}/canTrack.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/flatten.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/logger.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/nullable.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/nullable.js +0 -0
- /package/dist/{sdk/helpers → helpers}/time.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/time.js +0 -0
- /package/dist/{sdk/helpers → helpers}/url.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/url.js +0 -0
- /package/dist/{sdk/helpers → helpers}/url.test.d.ts +0 -0
- /package/dist/{sdk/helpers → helpers}/url.test.js +0 -0
- /package/dist/{sdk/helpers → helpers}/uuid.d.ts +0 -0
- /package/dist/{sdk/index-helpers → index-helpers}/top-of-file.d.ts +0 -0
- /package/dist/{sdk/index-helpers → index-helpers}/top-of-file.js +0 -0
- /package/dist/{sdk/scripts → scripts}/init-editing.d.ts +0 -0
- /package/dist/{sdk/types → types}/api-version.d.ts +0 -0
- /package/dist/{sdk/types → types}/api-version.js +0 -0
- /package/dist/{sdk/types → types}/builder-block.d.ts +0 -0
- /package/dist/{sdk/types → types}/builder-block.js +0 -0
- /package/dist/{sdk/types → types}/builder-content.d.ts +0 -0
- /package/dist/{sdk/types → types}/builder-content.js +0 -0
- /package/dist/{sdk/types → types}/builder-props.js +0 -0
- /package/dist/{sdk/types → types}/can-track.d.ts +0 -0
- /package/dist/{sdk/types → types}/can-track.js +0 -0
- /package/dist/{sdk/types → types}/components.js +0 -0
- /package/dist/{sdk/types → types}/deep-partial.d.ts +0 -0
- /package/dist/{sdk/types → types}/deep-partial.js +0 -0
- /package/dist/{sdk/types → types}/element.d.ts +0 -0
- /package/dist/{sdk/types → types}/element.js +0 -0
- /package/dist/{sdk/types → types}/enforced-partials.js +0 -0
- /package/dist/{sdk/types → types}/input.d.ts +0 -0
- /package/dist/{sdk/types → types}/input.js +0 -0
- /package/dist/{sdk/types → types}/targets.js +0 -0
- /package/dist/{sdk/types → types}/typescript.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
function Text(props) {
|
|
4
|
-
return (React.createElement("span", { className: "builder-text", dangerouslySetInnerHTML: { __html: props.text?.toString() }, style: {
|
|
4
|
+
return (React.createElement("span", { className: "builder-text", dangerouslySetInnerHTML: { __html: props.text?.toString() || "" }, style: {
|
|
5
5
|
outline: "none",
|
|
6
6
|
} }));
|
|
7
7
|
}
|
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
export const componentInfo = {
|
|
2
2
|
name: 'Form:TextArea',
|
|
3
3
|
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3',
|
|
4
|
-
inputs: [
|
|
5
|
-
{
|
|
4
|
+
inputs: [{
|
|
6
5
|
advanced: true,
|
|
7
6
|
name: 'value',
|
|
8
|
-
type: 'string'
|
|
9
|
-
},
|
|
10
|
-
{
|
|
7
|
+
type: 'string'
|
|
8
|
+
}, {
|
|
11
9
|
name: 'name',
|
|
12
10
|
type: 'string',
|
|
13
11
|
required: true,
|
|
14
|
-
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
15
|
-
},
|
|
16
|
-
{
|
|
12
|
+
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
13
|
+
}, {
|
|
17
14
|
name: 'defaultValue',
|
|
18
|
-
type: 'string'
|
|
19
|
-
},
|
|
20
|
-
{
|
|
15
|
+
type: 'string'
|
|
16
|
+
}, {
|
|
21
17
|
name: 'placeholder',
|
|
22
18
|
type: 'string',
|
|
23
|
-
defaultValue: 'Hello there'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
19
|
+
defaultValue: 'Hello there'
|
|
20
|
+
}, {
|
|
26
21
|
name: 'required',
|
|
27
22
|
type: 'boolean',
|
|
28
|
-
defaultValue: false
|
|
29
|
-
},
|
|
30
|
-
],
|
|
23
|
+
defaultValue: false
|
|
24
|
+
}],
|
|
31
25
|
defaultStyles: {
|
|
32
26
|
paddingTop: '10px',
|
|
33
27
|
paddingBottom: '10px',
|
|
@@ -36,8 +30,8 @@ export const componentInfo = {
|
|
|
36
30
|
borderRadius: '3px',
|
|
37
31
|
borderWidth: '1px',
|
|
38
32
|
borderStyle: 'solid',
|
|
39
|
-
borderColor: '#ccc'
|
|
33
|
+
borderColor: '#ccc'
|
|
40
34
|
},
|
|
41
35
|
static: true,
|
|
42
|
-
noWrap: true
|
|
36
|
+
noWrap: true
|
|
43
37
|
};
|
|
@@ -3,100 +3,80 @@ export const componentInfo = {
|
|
|
3
3
|
canHaveChildren: true,
|
|
4
4
|
defaultStyles: {
|
|
5
5
|
minHeight: '20px',
|
|
6
|
-
minWidth: '20px'
|
|
6
|
+
minWidth: '20px'
|
|
7
7
|
},
|
|
8
8
|
image: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb',
|
|
9
|
-
inputs: [
|
|
10
|
-
{
|
|
9
|
+
inputs: [{
|
|
11
10
|
name: 'video',
|
|
12
11
|
type: 'file',
|
|
13
12
|
allowedFileTypes: ['mp4'],
|
|
14
13
|
bubble: true,
|
|
15
14
|
defaultValue: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',
|
|
16
|
-
required: true
|
|
17
|
-
},
|
|
18
|
-
{
|
|
15
|
+
required: true
|
|
16
|
+
}, {
|
|
19
17
|
name: 'posterImage',
|
|
20
18
|
type: 'file',
|
|
21
19
|
allowedFileTypes: ['jpeg', 'png'],
|
|
22
|
-
helperText: 'Image to show before the video plays'
|
|
23
|
-
},
|
|
24
|
-
{
|
|
20
|
+
helperText: 'Image to show before the video plays'
|
|
21
|
+
}, {
|
|
25
22
|
name: 'autoPlay',
|
|
26
23
|
type: 'boolean',
|
|
27
|
-
defaultValue: true
|
|
28
|
-
},
|
|
29
|
-
{
|
|
24
|
+
defaultValue: true
|
|
25
|
+
}, {
|
|
30
26
|
name: 'controls',
|
|
31
27
|
type: 'boolean',
|
|
32
|
-
defaultValue: false
|
|
33
|
-
},
|
|
34
|
-
{
|
|
28
|
+
defaultValue: false
|
|
29
|
+
}, {
|
|
35
30
|
name: 'muted',
|
|
36
31
|
type: 'boolean',
|
|
37
|
-
defaultValue: true
|
|
38
|
-
},
|
|
39
|
-
{
|
|
32
|
+
defaultValue: true
|
|
33
|
+
}, {
|
|
40
34
|
name: 'loop',
|
|
41
35
|
type: 'boolean',
|
|
42
|
-
defaultValue: true
|
|
43
|
-
},
|
|
44
|
-
{
|
|
36
|
+
defaultValue: true
|
|
37
|
+
}, {
|
|
45
38
|
name: 'playsInline',
|
|
46
39
|
type: 'boolean',
|
|
47
|
-
defaultValue: true
|
|
48
|
-
},
|
|
49
|
-
{
|
|
40
|
+
defaultValue: true
|
|
41
|
+
}, {
|
|
50
42
|
name: 'fit',
|
|
51
43
|
type: 'text',
|
|
52
44
|
defaultValue: 'cover',
|
|
53
|
-
enum: ['contain', 'cover', 'fill', 'auto']
|
|
54
|
-
},
|
|
55
|
-
|
|
45
|
+
enum: ['contain', 'cover', 'fill', 'auto']
|
|
46
|
+
}, {
|
|
47
|
+
name: 'preload',
|
|
48
|
+
type: 'text',
|
|
49
|
+
defaultValue: 'metadata',
|
|
50
|
+
enum: ['auto', 'metadata', 'none']
|
|
51
|
+
}, {
|
|
56
52
|
name: 'fitContent',
|
|
57
53
|
type: 'boolean',
|
|
58
54
|
helperText: 'When child blocks are provided, fit to them instead of using the aspect ratio',
|
|
59
55
|
defaultValue: true,
|
|
60
|
-
advanced: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
56
|
+
advanced: true
|
|
57
|
+
}, {
|
|
63
58
|
name: 'position',
|
|
64
59
|
type: 'text',
|
|
65
60
|
defaultValue: 'center',
|
|
66
|
-
enum: [
|
|
67
|
-
|
|
68
|
-
'top',
|
|
69
|
-
'left',
|
|
70
|
-
'right',
|
|
71
|
-
'bottom',
|
|
72
|
-
'top left',
|
|
73
|
-
'top right',
|
|
74
|
-
'bottom left',
|
|
75
|
-
'bottom right',
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
61
|
+
enum: ['center', 'top', 'left', 'right', 'bottom', 'top left', 'top right', 'bottom left', 'bottom right']
|
|
62
|
+
}, {
|
|
79
63
|
name: 'height',
|
|
80
64
|
type: 'number',
|
|
81
|
-
advanced: true
|
|
82
|
-
},
|
|
83
|
-
{
|
|
65
|
+
advanced: true
|
|
66
|
+
}, {
|
|
84
67
|
name: 'width',
|
|
85
68
|
type: 'number',
|
|
86
|
-
advanced: true
|
|
87
|
-
},
|
|
88
|
-
{
|
|
69
|
+
advanced: true
|
|
70
|
+
}, {
|
|
89
71
|
name: 'aspectRatio',
|
|
90
72
|
type: 'number',
|
|
91
73
|
advanced: true,
|
|
92
|
-
defaultValue: 0.7004048582995948
|
|
93
|
-
},
|
|
94
|
-
{
|
|
74
|
+
defaultValue: 0.7004048582995948
|
|
75
|
+
}, {
|
|
95
76
|
name: 'lazyLoad',
|
|
96
77
|
type: 'boolean',
|
|
97
78
|
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
98
79
|
defaultValue: true,
|
|
99
|
-
advanced: true
|
|
100
|
-
}
|
|
101
|
-
],
|
|
80
|
+
advanced: true
|
|
81
|
+
}]
|
|
102
82
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface VideoProps {
|
|
3
2
|
attributes?: any;
|
|
4
3
|
video?: string;
|
|
@@ -11,6 +10,7 @@ export interface VideoProps {
|
|
|
11
10
|
width?: number;
|
|
12
11
|
height?: number;
|
|
13
12
|
fit?: "contain" | "cover" | "fill";
|
|
13
|
+
preload?: "auto" | "metadata" | "none";
|
|
14
14
|
position?: "center" | "top" | "left" | "right" | "bottom" | "top left" | "top right" | "bottom left" | "bottom right";
|
|
15
15
|
posterImage?: string;
|
|
16
16
|
lazyLoad?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
function Video(props) {
|
|
4
4
|
function videoProps() {
|
|
@@ -36,7 +36,7 @@ function Video(props) {
|
|
|
36
36
|
...videoProps(),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
return (React.createElement("video", { ...spreadProps(), style: {
|
|
39
|
+
return (React.createElement("video", { ...spreadProps(), preload: props.preload || "metadata", style: {
|
|
40
40
|
width: "100%",
|
|
41
41
|
height: "100%",
|
|
42
42
|
...props.attributes?.style,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export type BlockProps = {
|
|
3
2
|
block: BuilderBlock;
|
|
4
3
|
context: BuilderContextInterface;
|
|
5
|
-
|
|
4
|
+
registeredComponents: RegisteredComponents;
|
|
6
5
|
};
|
|
7
|
-
import type { BuilderContextInterface,
|
|
6
|
+
import type { BuilderContextInterface, RegisteredComponents } from "../../context/types.js";
|
|
8
7
|
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
9
|
-
import type { Dictionary } from "../../types/typescript.js";
|
|
10
8
|
declare function Block(props: BlockProps): JSX.Element;
|
|
11
9
|
export default Block;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types.js';
|
|
2
|
+
import type { BuilderBlock } from '../../types/builder-block.js';
|
|
3
|
+
import type { RepeatData } from './types.js';
|
|
4
|
+
export declare const isEmptyHtmlElement: (tagName: unknown) => boolean;
|
|
5
|
+
export declare const getComponent: ({ block, context, registeredComponents }: {
|
|
6
|
+
block: BuilderBlock;
|
|
7
|
+
context: BuilderContextInterface;
|
|
8
|
+
registeredComponents: RegisteredComponents;
|
|
9
|
+
}) => import("../../context/types.js").RegisteredComponent;
|
|
10
|
+
export declare const getRepeatItemData: ({ block, context }: {
|
|
11
|
+
block: BuilderBlock;
|
|
12
|
+
context: BuilderContextInterface;
|
|
13
|
+
}) => RepeatData[] | undefined;
|
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
import { evaluate } from '../../functions/evaluate';
|
|
2
|
-
import { getProcessedBlock } from '../../functions/get-processed-block';
|
|
2
|
+
import { getProcessedBlock } from '../../functions/get-processed-block.js';
|
|
3
3
|
/**
|
|
4
4
|
* https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
|
|
5
5
|
*/
|
|
6
|
-
const EMPTY_HTML_ELEMENTS = [
|
|
7
|
-
'area',
|
|
8
|
-
'base',
|
|
9
|
-
'br',
|
|
10
|
-
'col',
|
|
11
|
-
'embed',
|
|
12
|
-
'hr',
|
|
13
|
-
'img',
|
|
14
|
-
'input',
|
|
15
|
-
'keygen',
|
|
16
|
-
'link',
|
|
17
|
-
'meta',
|
|
18
|
-
'param',
|
|
19
|
-
'source',
|
|
20
|
-
'track',
|
|
21
|
-
'wbr',
|
|
22
|
-
];
|
|
6
|
+
const EMPTY_HTML_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
23
7
|
export const isEmptyHtmlElement = (tagName) => {
|
|
24
|
-
return
|
|
25
|
-
EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase()));
|
|
8
|
+
return typeof tagName === 'string' && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
26
9
|
};
|
|
27
|
-
export const getComponent = ({ block, context, }) => {
|
|
10
|
+
export const getComponent = ({ block, context, registeredComponents }) => {
|
|
28
11
|
const componentName = getProcessedBlock({
|
|
29
12
|
block,
|
|
30
13
|
localState: context.localState,
|
|
31
14
|
rootState: context.rootState,
|
|
32
15
|
rootSetState: context.rootSetState,
|
|
33
16
|
context: context.context,
|
|
34
|
-
shouldEvaluateBindings: false
|
|
17
|
+
shouldEvaluateBindings: false
|
|
35
18
|
}).component?.name;
|
|
36
19
|
if (!componentName) {
|
|
37
20
|
return null;
|
|
38
21
|
}
|
|
39
|
-
const ref =
|
|
22
|
+
const ref = registeredComponents[componentName];
|
|
40
23
|
if (!ref) {
|
|
41
24
|
// TODO: Public doc page with more info about this message
|
|
42
25
|
console.warn(`
|
|
@@ -48,9 +31,9 @@ export const getComponent = ({ block, context, }) => {
|
|
|
48
31
|
return ref;
|
|
49
32
|
}
|
|
50
33
|
};
|
|
51
|
-
export const getRepeatItemData = ({ block, context
|
|
34
|
+
export const getRepeatItemData = ({ block, context }) => {
|
|
52
35
|
/**
|
|
53
|
-
* we don't use `state.
|
|
36
|
+
* we don't use `state.processedBlock` here because the processing done within its logic includes evaluating the block's bindings,
|
|
54
37
|
* which will not work if there is a repeat.
|
|
55
38
|
*/
|
|
56
39
|
const { repeat, ...blockWithoutRepeat } = block;
|
|
@@ -62,7 +45,7 @@ export const getRepeatItemData = ({ block, context, }) => {
|
|
|
62
45
|
localState: context.localState,
|
|
63
46
|
rootState: context.rootState,
|
|
64
47
|
rootSetState: context.rootSetState,
|
|
65
|
-
context: context.context
|
|
48
|
+
context: context.context
|
|
66
49
|
});
|
|
67
50
|
if (!Array.isArray(itemsArray)) {
|
|
68
51
|
return undefined;
|
|
@@ -77,10 +60,10 @@ export const getRepeatItemData = ({ block, context, }) => {
|
|
|
77
60
|
$index: index,
|
|
78
61
|
$item: item,
|
|
79
62
|
[itemNameToUse]: item,
|
|
80
|
-
[`$${itemNameToUse}Index`]: index
|
|
81
|
-
}
|
|
63
|
+
[`$${itemNameToUse}Index`]: index
|
|
64
|
+
}
|
|
82
65
|
},
|
|
83
|
-
block: blockWithoutRepeat
|
|
66
|
+
block: blockWithoutRepeat
|
|
84
67
|
}));
|
|
85
68
|
return repeatArray;
|
|
86
69
|
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
5
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
6
|
+
import BlockStyles from "./components/block-styles";
|
|
7
|
+
import { getComponent, getRepeatItemData, isEmptyHtmlElement, } from "./block.helpers.js";
|
|
8
|
+
import RepeatedBlock from "./components/repeated-block";
|
|
9
|
+
import ComponentRef from "./components/component-ref/component-ref";
|
|
10
|
+
import BlockWrapper from "./components/block-wrapper";
|
|
11
|
+
function Block(props) {
|
|
12
|
+
function blockComponent() {
|
|
13
|
+
return getComponent({
|
|
14
|
+
block: props.block,
|
|
15
|
+
context: props.context,
|
|
16
|
+
registeredComponents: props.registeredComponents,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function repeatItem() {
|
|
20
|
+
return getRepeatItemData({
|
|
21
|
+
block: props.block,
|
|
22
|
+
context: props.context,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function processedBlock() {
|
|
26
|
+
return repeatItem()
|
|
27
|
+
? props.block
|
|
28
|
+
: getProcessedBlock({
|
|
29
|
+
block: props.block,
|
|
30
|
+
localState: props.context.localState,
|
|
31
|
+
rootState: props.context.rootState,
|
|
32
|
+
rootSetState: props.context.rootSetState,
|
|
33
|
+
context: props.context.context,
|
|
34
|
+
shouldEvaluateBindings: true,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function Tag() {
|
|
38
|
+
return props.block.tagName || "div";
|
|
39
|
+
}
|
|
40
|
+
function canShowBlock() {
|
|
41
|
+
if ("hide" in processedBlock()) {
|
|
42
|
+
return !processedBlock().hide;
|
|
43
|
+
}
|
|
44
|
+
if ("show" in processedBlock()) {
|
|
45
|
+
return processedBlock().show;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
function childrenWithoutParentComponent() {
|
|
50
|
+
/**
|
|
51
|
+
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
52
|
+
* we render them outside of `componentRef`.
|
|
53
|
+
* NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
|
|
54
|
+
* blocks, and the children will be repeated within those blocks.
|
|
55
|
+
*/
|
|
56
|
+
const shouldRenderChildrenOutsideRef = !blockComponent?.()?.component && !repeatItem();
|
|
57
|
+
return shouldRenderChildrenOutsideRef
|
|
58
|
+
? processedBlock().children ?? []
|
|
59
|
+
: [];
|
|
60
|
+
}
|
|
61
|
+
function componentRefProps() {
|
|
62
|
+
return {
|
|
63
|
+
blockChildren: processedBlock().children ?? [],
|
|
64
|
+
componentRef: blockComponent?.()?.component,
|
|
65
|
+
componentOptions: {
|
|
66
|
+
...getBlockComponentOptions(processedBlock()),
|
|
67
|
+
builderContext: props.context,
|
|
68
|
+
...(blockComponent?.()?.name === "Symbol" ||
|
|
69
|
+
blockComponent?.()?.name === "Columns"
|
|
70
|
+
? {
|
|
71
|
+
builderComponents: props.registeredComponents,
|
|
72
|
+
}
|
|
73
|
+
: {}),
|
|
74
|
+
},
|
|
75
|
+
context: childrenContext,
|
|
76
|
+
registeredComponents: props.registeredComponents,
|
|
77
|
+
builderBlock: processedBlock(),
|
|
78
|
+
includeBlockProps: blockComponent?.()?.noWrap === true,
|
|
79
|
+
isInteractive: !blockComponent?.()?.isRSC,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const [childrenContext, setChildrenContext] = useState(() => props.context);
|
|
83
|
+
return (React.createElement(React.Fragment, null, canShowBlock() ? (React.createElement(React.Fragment, null, !blockComponent?.()?.noWrap ? (React.createElement(React.Fragment, null,
|
|
84
|
+
isEmptyHtmlElement(Tag()) ? (React.createElement(React.Fragment, null,
|
|
85
|
+
React.createElement(BlockWrapper, { Wrapper: Tag(), block: processedBlock(), context: props.context, hasChildren: false }))) : null,
|
|
86
|
+
!isEmptyHtmlElement(Tag()) && repeatItem() ? (React.createElement(React.Fragment, null, repeatItem()?.map((data, index) => (React.createElement(RepeatedBlock, { key: index, repeatContext: data.context, block: data.block, registeredComponents: props.registeredComponents }))))) : null,
|
|
87
|
+
!isEmptyHtmlElement(Tag()) && !repeatItem() ? (React.createElement(React.Fragment, null,
|
|
88
|
+
React.createElement(BlockWrapper, { Wrapper: Tag(), block: processedBlock(), context: props.context, hasChildren: true },
|
|
89
|
+
React.createElement(ComponentRef, { ...componentRefProps() }),
|
|
90
|
+
childrenWithoutParentComponent()?.map((child) => (React.createElement(Block, { key: "block-" + child.id, block: child, context: childrenContext, registeredComponents: props.registeredComponents }))),
|
|
91
|
+
childrenWithoutParentComponent()?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: childrenContext })))))) : null)) : (React.createElement(React.Fragment, null,
|
|
92
|
+
React.createElement(ComponentRef, { ...componentRefProps() }))))) : null));
|
|
93
|
+
}
|
|
94
|
+
export default Block;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This import is used by the Svelte SDK. Do not remove.
|
|
3
|
+
*/ type BlockWrapperProps = {
|
|
4
|
+
Wrapper: string;
|
|
5
|
+
block: BuilderBlock;
|
|
6
|
+
context: BuilderContextInterface;
|
|
7
|
+
hasChildren: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* This component renders a block's wrapper HTML element (from the block's `tagName` property).
|
|
11
|
+
* It reuses the exact same logic as the `InteractiveElement` component, but we need to have 2 separate components for
|
|
12
|
+
* Svelte's sake, as it needs to know at compile-time whether to use: * - `<svelte:element>` (for HTML element) or * - `<svelte:component>` (for custom components) */ import type { PropsWithChildren } from "../../../types/typescript.js";
|
|
13
|
+
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
14
|
+
import type { BuilderContextInterface } from "../../../context/types.js";
|
|
15
|
+
declare function BlockWrapper(props: PropsWithChildren<BlockWrapperProps>): JSX.Element;
|
|
16
|
+
export default BlockWrapper;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { getBlockActions } from "../../../functions/get-block-actions.js";
|
|
4
|
+
import { getBlockProperties } from "../../../functions/get-block-properties.js";
|
|
5
|
+
function BlockWrapper(props) {
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
" ",
|
|
8
|
+
props.hasChildren ? (React.createElement(React.Fragment, null,
|
|
9
|
+
React.createElement(props.Wrapper, { ...getBlockProperties({
|
|
10
|
+
block: props.block,
|
|
11
|
+
context: props.context,
|
|
12
|
+
}), ...getBlockActions({
|
|
13
|
+
block: props.block,
|
|
14
|
+
rootState: props.context.rootState,
|
|
15
|
+
rootSetState: props.context.rootSetState,
|
|
16
|
+
localState: props.context.localState,
|
|
17
|
+
context: props.context.context,
|
|
18
|
+
stripPrefix: true,
|
|
19
|
+
}) },
|
|
20
|
+
" ",
|
|
21
|
+
props.children,
|
|
22
|
+
" "))) : (React.createElement(React.Fragment, null,
|
|
23
|
+
React.createElement(props.Wrapper, { ...getBlockProperties({
|
|
24
|
+
block: props.block,
|
|
25
|
+
context: props.context,
|
|
26
|
+
}), ...getBlockActions({
|
|
27
|
+
block: props.block,
|
|
28
|
+
rootState: props.context.rootState,
|
|
29
|
+
rootSetState: props.context.rootSetState,
|
|
30
|
+
localState: props.context.localState,
|
|
31
|
+
context: props.context.context,
|
|
32
|
+
stripPrefix: true,
|
|
33
|
+
}) }))),
|
|
34
|
+
" "));
|
|
35
|
+
}
|
|
36
|
+
export default BlockWrapper;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BuilderContextInterface, RegisteredComponents } from '../../../../context/types.js';
|
|
2
|
+
import type { BuilderBlock } from '../../../../types/builder-block.js';
|
|
3
|
+
import type { PropsWithBuilderData } from '../../../../types/builder-props.js';
|
|
4
|
+
import type { InteractiveElementProps } from '../interactive-element';
|
|
5
|
+
type ComponentOptions = PropsWithBuilderData<{
|
|
6
|
+
[index: string]: any;
|
|
7
|
+
attributes?: {
|
|
8
|
+
[index: string]: any;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
export interface ComponentProps {
|
|
12
|
+
componentRef: any;
|
|
13
|
+
componentOptions: ComponentOptions;
|
|
14
|
+
blockChildren: BuilderBlock[];
|
|
15
|
+
context: BuilderContextInterface;
|
|
16
|
+
registeredComponents: RegisteredComponents;
|
|
17
|
+
builderBlock: BuilderBlock;
|
|
18
|
+
includeBlockProps: boolean;
|
|
19
|
+
isInteractive: boolean | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare const getWrapperProps: ({ componentOptions, builderBlock, context, componentRef, includeBlockProps, isInteractive, contextValue }: Omit<ComponentProps, "registeredComponents" | "blockChildren"> & {
|
|
22
|
+
contextValue: BuilderContextInterface;
|
|
23
|
+
}) => InteractiveElementProps | {
|
|
24
|
+
attributes?: any;
|
|
25
|
+
builderBlock: BuilderBlock;
|
|
26
|
+
builderContext: BuilderContextInterface;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getBlockProperties } from '../../../../functions/get-block-properties.js';
|
|
2
|
+
export const getWrapperProps = ({ componentOptions, builderBlock, context, componentRef, includeBlockProps, isInteractive, contextValue }) => {
|
|
3
|
+
const interactiveElementProps = {
|
|
4
|
+
Wrapper: componentRef,
|
|
5
|
+
block: builderBlock,
|
|
6
|
+
context,
|
|
7
|
+
wrapperProps: componentOptions
|
|
8
|
+
};
|
|
9
|
+
return isInteractive ? interactiveElementProps : {
|
|
10
|
+
...componentOptions,
|
|
11
|
+
/**
|
|
12
|
+
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
13
|
+
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
14
|
+
*/
|
|
15
|
+
...(includeBlockProps ? {
|
|
16
|
+
attributes: getBlockProperties({
|
|
17
|
+
block: builderBlock,
|
|
18
|
+
context: contextValue
|
|
19
|
+
})
|
|
20
|
+
} : {})
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import BlockStyles from "../block-styles";
|
|
5
|
+
import Block from "../../block";
|
|
6
|
+
import InteractiveElement from "../interactive-element";
|
|
7
|
+
import { getWrapperProps } from "./component-ref.helpers.js";
|
|
8
|
+
function ComponentRef(props) {
|
|
9
|
+
const [Wrapper, setWrapper] = useState(() => props.isInteractive ? InteractiveElement : props.componentRef);
|
|
10
|
+
return (React.createElement(React.Fragment, null, props.componentRef ? (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement(Wrapper, { ...getWrapperProps({
|
|
12
|
+
componentOptions: props.componentOptions,
|
|
13
|
+
builderBlock: props.builderBlock,
|
|
14
|
+
context: props.context,
|
|
15
|
+
componentRef: props.componentRef,
|
|
16
|
+
includeBlockProps: props.includeBlockProps,
|
|
17
|
+
isInteractive: props.isInteractive,
|
|
18
|
+
contextValue: props.context,
|
|
19
|
+
}) },
|
|
20
|
+
props.blockChildren?.map((child) => (React.createElement(Block, { key: "block-" + child.id, block: child, context: props.context, registeredComponents: props.registeredComponents }))),
|
|
21
|
+
props.blockChildren?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: props.context })))))) : null));
|
|
22
|
+
}
|
|
23
|
+
export default ComponentRef;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type InteractiveElementProps = {
|
|
2
|
+
Wrapper: any;
|
|
3
|
+
block: BuilderBlock;
|
|
4
|
+
context: BuilderContextInterface;
|
|
5
|
+
wrapperProps: object;
|
|
6
|
+
};
|
|
7
|
+
import type { BuilderContextInterface } from "../../../context/types.js";
|
|
8
|
+
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
9
|
+
import type { PropsWithChildren } from "../../../types/typescript.js";
|
|
10
|
+
declare function InteractiveElement(props: PropsWithChildren<InteractiveElementProps>): JSX.Element;
|
|
11
|
+
export default InteractiveElement;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { getBlockActions } from "../../../functions/get-block-actions.js";
|
|
4
|
+
import { getBlockProperties } from "../../../functions/get-block-properties.js";
|
|
5
|
+
function InteractiveElement(props) {
|
|
6
|
+
return (React.createElement(props.Wrapper, { ...props.wrapperProps, attributes: {
|
|
7
|
+
...getBlockProperties({
|
|
8
|
+
block: props.block,
|
|
9
|
+
context: props.context,
|
|
10
|
+
}),
|
|
11
|
+
...getBlockActions({
|
|
12
|
+
block: props.block,
|
|
13
|
+
rootState: props.context.rootState,
|
|
14
|
+
rootSetState: props.context.rootSetState,
|
|
15
|
+
localState: props.context.localState,
|
|
16
|
+
context: props.context.context,
|
|
17
|
+
}),
|
|
18
|
+
} }, props.children));
|
|
19
|
+
}
|
|
20
|
+
export default InteractiveElement;
|