@builder.io/sdk-react 0.4.5 → 0.5.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/{sdk/components → components}/blocks/blocks.d.ts +2 -4
- package/dist/{sdk/components → components}/blocks/blocks.js +2 -2
- 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/components/content/content.js +79 -0
- 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/{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 +6 -13
- 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/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.js +0 -97
- 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
|
@@ -5,13 +5,12 @@ export const componentInfo = {
|
|
|
5
5
|
responsiveStyles: {
|
|
6
6
|
large: {
|
|
7
7
|
marginTop: '15px',
|
|
8
|
-
paddingBottom: '15px'
|
|
9
|
-
}
|
|
10
|
-
}
|
|
8
|
+
paddingBottom: '15px'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
11
|
},
|
|
12
12
|
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5',
|
|
13
|
-
inputs: [
|
|
14
|
-
{
|
|
13
|
+
inputs: [{
|
|
15
14
|
name: 'sendSubmissionsTo',
|
|
16
15
|
type: 'string',
|
|
17
16
|
// TODO: save to builder data and user can download as csv
|
|
@@ -19,249 +18,215 @@ export const componentInfo = {
|
|
|
19
18
|
// so you can edit details and high level mode at same time...
|
|
20
19
|
// Later - more integrations like mailchimp
|
|
21
20
|
// /api/v1/form-submit?to=mailchimp
|
|
22
|
-
enum: [
|
|
23
|
-
{
|
|
21
|
+
enum: [{
|
|
24
22
|
label: 'Send to email',
|
|
25
23
|
value: 'email',
|
|
26
|
-
helperText: 'Send form submissions to the email address of your choosing'
|
|
27
|
-
},
|
|
28
|
-
{
|
|
24
|
+
helperText: 'Send form submissions to the email address of your choosing'
|
|
25
|
+
}, {
|
|
29
26
|
label: 'Custom',
|
|
30
27
|
value: 'custom',
|
|
31
|
-
helperText: 'Handle where the form requests go manually with a little code, e.g. to your own custom backend'
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
{
|
|
28
|
+
helperText: 'Handle where the form requests go manually with a little code, e.g. to your own custom backend'
|
|
29
|
+
}],
|
|
30
|
+
defaultValue: 'email'
|
|
31
|
+
}, {
|
|
37
32
|
name: 'sendSubmissionsToEmail',
|
|
38
33
|
type: 'string',
|
|
39
34
|
required: true,
|
|
35
|
+
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
40
36
|
defaultValue: 'your@email.com',
|
|
41
|
-
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
37
|
+
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
38
|
+
}, {
|
|
44
39
|
name: 'sendWithJs',
|
|
45
40
|
type: 'boolean',
|
|
46
41
|
helperText: 'Set to false to use basic html form action',
|
|
47
42
|
defaultValue: true,
|
|
48
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
43
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
44
|
+
}, {
|
|
51
45
|
name: 'name',
|
|
52
46
|
type: 'string',
|
|
53
|
-
defaultValue: 'My form'
|
|
47
|
+
defaultValue: 'My form'
|
|
54
48
|
// advanced: true
|
|
55
|
-
},
|
|
56
|
-
{
|
|
49
|
+
}, {
|
|
57
50
|
name: 'action',
|
|
58
51
|
type: 'string',
|
|
59
52
|
helperText: 'URL to send the form data to',
|
|
60
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
61
|
-
},
|
|
62
|
-
{
|
|
53
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
54
|
+
}, {
|
|
63
55
|
name: 'contentType',
|
|
64
56
|
type: 'string',
|
|
65
57
|
defaultValue: 'application/json',
|
|
66
58
|
advanced: true,
|
|
67
59
|
// TODO: do automatically if file input
|
|
68
|
-
enum: [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
'application/x-www-form-urlencoded',
|
|
72
|
-
],
|
|
73
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
60
|
+
enum: ['application/json', 'multipart/form-data', 'application/x-www-form-urlencoded'],
|
|
61
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
62
|
+
}, {
|
|
76
63
|
name: 'method',
|
|
77
64
|
type: 'string',
|
|
78
65
|
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
79
66
|
defaultValue: 'POST',
|
|
80
|
-
advanced: true
|
|
81
|
-
},
|
|
82
|
-
{
|
|
67
|
+
advanced: true
|
|
68
|
+
}, {
|
|
83
69
|
name: 'previewState',
|
|
84
70
|
type: 'string',
|
|
85
71
|
// TODO: persist: false flag
|
|
86
72
|
enum: ['unsubmitted', 'sending', 'success', 'error'],
|
|
87
73
|
defaultValue: 'unsubmitted',
|
|
88
74
|
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
89
|
-
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
90
|
-
},
|
|
91
|
-
{
|
|
75
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
76
|
+
}, {
|
|
92
77
|
name: 'successUrl',
|
|
93
78
|
type: 'url',
|
|
94
79
|
helperText: 'Optional URL to redirect the user to on form submission success',
|
|
95
|
-
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
96
|
-
},
|
|
97
|
-
{
|
|
80
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
81
|
+
}, {
|
|
98
82
|
name: 'resetFormOnSubmit',
|
|
99
83
|
type: 'boolean',
|
|
100
84
|
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
101
|
-
advanced: true
|
|
102
|
-
},
|
|
103
|
-
{
|
|
85
|
+
advanced: true
|
|
86
|
+
}, {
|
|
104
87
|
name: 'successMessage',
|
|
105
88
|
type: 'uiBlocks',
|
|
106
89
|
hideFromUI: true,
|
|
107
|
-
defaultValue: [
|
|
108
|
-
{
|
|
90
|
+
defaultValue: [{
|
|
109
91
|
'@type': '@builder.io/sdk:Element',
|
|
110
92
|
responsiveStyles: {
|
|
111
93
|
large: {
|
|
112
|
-
marginTop: '10px'
|
|
113
|
-
}
|
|
94
|
+
marginTop: '10px'
|
|
95
|
+
}
|
|
114
96
|
},
|
|
115
97
|
component: {
|
|
116
98
|
name: 'Text',
|
|
117
99
|
options: {
|
|
118
|
-
text: '<span>Thanks!</span>'
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
{
|
|
100
|
+
text: '<span>Thanks!</span>'
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}]
|
|
104
|
+
}, {
|
|
125
105
|
name: 'validate',
|
|
126
106
|
type: 'boolean',
|
|
127
107
|
defaultValue: true,
|
|
128
|
-
advanced: true
|
|
129
|
-
},
|
|
130
|
-
{
|
|
108
|
+
advanced: true
|
|
109
|
+
}, {
|
|
131
110
|
name: 'errorMessagePath',
|
|
132
111
|
type: 'text',
|
|
133
112
|
advanced: true,
|
|
134
|
-
helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
|
|
135
|
-
},
|
|
136
|
-
{
|
|
113
|
+
helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
|
|
114
|
+
}, {
|
|
137
115
|
name: 'errorMessage',
|
|
138
116
|
type: 'uiBlocks',
|
|
139
117
|
hideFromUI: true,
|
|
140
|
-
defaultValue: [
|
|
141
|
-
{
|
|
118
|
+
defaultValue: [{
|
|
142
119
|
'@type': '@builder.io/sdk:Element',
|
|
143
120
|
responsiveStyles: {
|
|
144
121
|
large: {
|
|
145
|
-
marginTop: '10px'
|
|
146
|
-
}
|
|
122
|
+
marginTop: '10px'
|
|
123
|
+
}
|
|
147
124
|
},
|
|
148
125
|
bindings: {
|
|
149
|
-
'component.options.text': 'state.formErrorMessage || block.component.options.text'
|
|
126
|
+
'component.options.text': 'state.formErrorMessage || block.component.options.text'
|
|
150
127
|
},
|
|
151
128
|
component: {
|
|
152
129
|
name: 'Text',
|
|
153
130
|
options: {
|
|
154
|
-
text: '<span>Form submission error :( Please check your answers and try again</span>'
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
{
|
|
131
|
+
text: '<span>Form submission error :( Please check your answers and try again</span>'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}]
|
|
135
|
+
}, {
|
|
161
136
|
name: 'sendingMessage',
|
|
162
137
|
type: 'uiBlocks',
|
|
163
138
|
hideFromUI: true,
|
|
164
|
-
defaultValue: [
|
|
165
|
-
{
|
|
139
|
+
defaultValue: [{
|
|
166
140
|
'@type': '@builder.io/sdk:Element',
|
|
167
141
|
responsiveStyles: {
|
|
168
142
|
large: {
|
|
169
|
-
marginTop: '10px'
|
|
170
|
-
}
|
|
143
|
+
marginTop: '10px'
|
|
144
|
+
}
|
|
171
145
|
},
|
|
172
146
|
component: {
|
|
173
147
|
name: 'Text',
|
|
174
148
|
options: {
|
|
175
|
-
text: '<span>Sending...</span>'
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
{
|
|
149
|
+
text: '<span>Sending...</span>'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}]
|
|
153
|
+
}, {
|
|
182
154
|
name: 'customHeaders',
|
|
183
155
|
type: 'map',
|
|
184
156
|
valueType: {
|
|
185
|
-
type: 'string'
|
|
157
|
+
type: 'string'
|
|
186
158
|
},
|
|
187
159
|
advanced: true,
|
|
188
|
-
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
189
|
-
},
|
|
190
|
-
],
|
|
160
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
161
|
+
}],
|
|
191
162
|
noWrap: true,
|
|
192
163
|
canHaveChildren: true,
|
|
193
|
-
defaultChildren: [
|
|
194
|
-
{
|
|
164
|
+
defaultChildren: [{
|
|
195
165
|
'@type': '@builder.io/sdk:Element',
|
|
196
166
|
responsiveStyles: {
|
|
197
167
|
large: {
|
|
198
|
-
marginTop: '10px'
|
|
199
|
-
}
|
|
168
|
+
marginTop: '10px'
|
|
169
|
+
}
|
|
200
170
|
},
|
|
201
171
|
component: {
|
|
202
172
|
name: 'Text',
|
|
203
173
|
options: {
|
|
204
|
-
text: '<span>Enter your name</span>'
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
174
|
+
text: '<span>Enter your name</span>'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}, {
|
|
209
178
|
'@type': '@builder.io/sdk:Element',
|
|
210
179
|
responsiveStyles: {
|
|
211
180
|
large: {
|
|
212
|
-
marginTop: '10px'
|
|
213
|
-
}
|
|
181
|
+
marginTop: '10px'
|
|
182
|
+
}
|
|
214
183
|
},
|
|
215
184
|
component: {
|
|
216
185
|
name: 'Form:Input',
|
|
217
186
|
options: {
|
|
218
187
|
name: 'name',
|
|
219
|
-
placeholder: 'Jane Doe'
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
{
|
|
188
|
+
placeholder: 'Jane Doe'
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
224
192
|
'@type': '@builder.io/sdk:Element',
|
|
225
193
|
responsiveStyles: {
|
|
226
194
|
large: {
|
|
227
|
-
marginTop: '10px'
|
|
228
|
-
}
|
|
195
|
+
marginTop: '10px'
|
|
196
|
+
}
|
|
229
197
|
},
|
|
230
198
|
component: {
|
|
231
199
|
name: 'Text',
|
|
232
200
|
options: {
|
|
233
|
-
text: '<span>Enter your email</span>'
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
{
|
|
201
|
+
text: '<span>Enter your email</span>'
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
238
205
|
'@type': '@builder.io/sdk:Element',
|
|
239
206
|
responsiveStyles: {
|
|
240
207
|
large: {
|
|
241
|
-
marginTop: '10px'
|
|
242
|
-
}
|
|
208
|
+
marginTop: '10px'
|
|
209
|
+
}
|
|
243
210
|
},
|
|
244
211
|
component: {
|
|
245
212
|
name: 'Form:Input',
|
|
246
213
|
options: {
|
|
247
214
|
name: 'email',
|
|
248
|
-
placeholder: 'jane@doe.com'
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
{
|
|
215
|
+
placeholder: 'jane@doe.com'
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
253
219
|
'@type': '@builder.io/sdk:Element',
|
|
254
220
|
responsiveStyles: {
|
|
255
221
|
large: {
|
|
256
|
-
marginTop: '10px'
|
|
257
|
-
}
|
|
222
|
+
marginTop: '10px'
|
|
223
|
+
}
|
|
258
224
|
},
|
|
259
225
|
component: {
|
|
260
226
|
name: 'Form:SubmitButton',
|
|
261
227
|
options: {
|
|
262
|
-
text: 'Submit'
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
],
|
|
228
|
+
text: 'Submit'
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}]
|
|
267
232
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function filterAttrs(attrs: {
|
|
2
|
+
[index: string]: any;
|
|
3
|
+
}, prefix: string, isEvent: boolean): {
|
|
4
|
+
[index: string]: any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Svelte SDK: workaround to dynamically provide event handlers to components/elements.
|
|
8
|
+
* https://svelte.dev/repl/1246699e266f41218a8eeb45b9b58b54?version=3.24.1
|
|
9
|
+
*/
|
|
10
|
+
export declare function setAttrs(node: HTMLElement, attrs?: Record<string, (event: Event) => void>): {
|
|
11
|
+
update(attrs?: {}): void;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export function filterAttrs(attrs = {}, prefix, isEvent) {
|
|
2
|
+
const result = {};
|
|
3
|
+
for (const attr in attrs) {
|
|
4
|
+
if (!attrs[attr])
|
|
5
|
+
continue;
|
|
6
|
+
if (isEvent && !attr.startsWith(prefix))
|
|
7
|
+
continue;
|
|
8
|
+
const eventName = isEvent ? attr.replace(prefix, '') : attr;
|
|
9
|
+
result[eventName] = attrs[attr];
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Svelte SDK: workaround to dynamically provide event handlers to components/elements.
|
|
15
|
+
* https://svelte.dev/repl/1246699e266f41218a8eeb45b9b58b54?version=3.24.1
|
|
16
|
+
*/
|
|
17
|
+
export function setAttrs(node, attrs = {}) {
|
|
18
|
+
const attrKeys = Object.keys(attrs);
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {string} attr
|
|
22
|
+
*/
|
|
23
|
+
const setup = (attr) => node.addEventListener(attr, attrs[attr]);
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {string} attr
|
|
27
|
+
*/
|
|
28
|
+
const teardown = (attr) => node.removeEventListener(attr, attrs[attr]);
|
|
29
|
+
attrKeys.forEach(setup);
|
|
30
|
+
return {
|
|
31
|
+
update(attrs = {}) {
|
|
32
|
+
const attrKeys = Object.keys(attrs);
|
|
33
|
+
attrKeys.forEach(teardown);
|
|
34
|
+
attrKeys.forEach(setup);
|
|
35
|
+
},
|
|
36
|
+
destroy() {
|
|
37
|
+
attrKeys.forEach(teardown);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { serializeFn } from '../util.js';
|
|
2
1
|
export const componentInfo = {
|
|
3
2
|
name: 'Image',
|
|
4
3
|
static: true,
|
|
@@ -7,18 +6,17 @@ export const componentInfo = {
|
|
|
7
6
|
position: 'relative',
|
|
8
7
|
minHeight: '20px',
|
|
9
8
|
minWidth: '20px',
|
|
10
|
-
overflow: 'hidden'
|
|
9
|
+
overflow: 'hidden'
|
|
11
10
|
},
|
|
12
11
|
canHaveChildren: true,
|
|
13
|
-
inputs: [
|
|
14
|
-
{
|
|
12
|
+
inputs: [{
|
|
15
13
|
name: 'image',
|
|
16
14
|
type: 'file',
|
|
17
15
|
bubble: true,
|
|
18
16
|
allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
|
|
19
17
|
required: true,
|
|
20
18
|
defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
|
|
21
|
-
onChange:
|
|
19
|
+
onChange: (options) => {
|
|
22
20
|
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
23
21
|
options.delete('srcset');
|
|
24
22
|
options.delete('noWebp');
|
|
@@ -30,7 +28,7 @@ export const componentInfo = {
|
|
|
30
28
|
loaded = true;
|
|
31
29
|
resolve(img);
|
|
32
30
|
};
|
|
33
|
-
img.addEventListener('error',
|
|
31
|
+
img.addEventListener('error', event => {
|
|
34
32
|
console.warn('Image load failed', event.error);
|
|
35
33
|
reject(event.error);
|
|
36
34
|
});
|
|
@@ -48,19 +46,15 @@ export const componentInfo = {
|
|
|
48
46
|
const value = options.get('image');
|
|
49
47
|
const aspectRatio = options.get('aspectRatio');
|
|
50
48
|
// For SVG images - don't render as webp, keep them as SVG
|
|
51
|
-
fetch(value)
|
|
52
|
-
.then((res) => res.blob())
|
|
53
|
-
.then((blob) => {
|
|
49
|
+
fetch(value).then(res => res.blob()).then(blob => {
|
|
54
50
|
if (blob.type.includes('svg')) {
|
|
55
51
|
options.set('noWebp', true);
|
|
56
52
|
}
|
|
57
53
|
});
|
|
58
54
|
if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
59
|
-
return loadImage(value).then(
|
|
55
|
+
return loadImage(value).then(img => {
|
|
60
56
|
const possiblyUpdatedAspectRatio = options.get('aspectRatio');
|
|
61
|
-
if (options.get('image') === value &&
|
|
62
|
-
(!possiblyUpdatedAspectRatio ||
|
|
63
|
-
possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
57
|
+
if (options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
64
58
|
if (img.width && img.height) {
|
|
65
59
|
options.set('aspectRatio', round(img.height / img.width));
|
|
66
60
|
options.set('height', img.height);
|
|
@@ -69,84 +63,60 @@ export const componentInfo = {
|
|
|
69
63
|
}
|
|
70
64
|
});
|
|
71
65
|
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
{
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
75
68
|
name: 'backgroundSize',
|
|
76
69
|
type: 'text',
|
|
77
70
|
defaultValue: 'cover',
|
|
78
|
-
enum: [
|
|
79
|
-
{
|
|
71
|
+
enum: [{
|
|
80
72
|
label: 'contain',
|
|
81
73
|
value: 'contain',
|
|
82
|
-
helperText: 'The image should never get cropped'
|
|
83
|
-
},
|
|
84
|
-
{
|
|
74
|
+
helperText: 'The image should never get cropped'
|
|
75
|
+
}, {
|
|
85
76
|
label: 'cover',
|
|
86
77
|
value: 'cover',
|
|
87
|
-
helperText: "The image should fill it's box, cropping when needed"
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
{
|
|
78
|
+
helperText: "The image should fill it's box, cropping when needed"
|
|
79
|
+
}]
|
|
80
|
+
}, {
|
|
92
81
|
name: 'backgroundPosition',
|
|
93
82
|
type: 'text',
|
|
94
83
|
defaultValue: 'center',
|
|
95
|
-
enum: [
|
|
96
|
-
|
|
97
|
-
'top',
|
|
98
|
-
'left',
|
|
99
|
-
'right',
|
|
100
|
-
'bottom',
|
|
101
|
-
'top left',
|
|
102
|
-
'top right',
|
|
103
|
-
'bottom left',
|
|
104
|
-
'bottom right',
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
84
|
+
enum: ['center', 'top', 'left', 'right', 'bottom', 'top left', 'top right', 'bottom left', 'bottom right']
|
|
85
|
+
}, {
|
|
108
86
|
name: 'altText',
|
|
109
87
|
type: 'string',
|
|
110
|
-
helperText: 'Text to display when the user has images off'
|
|
111
|
-
},
|
|
112
|
-
{
|
|
88
|
+
helperText: 'Text to display when the user has images off'
|
|
89
|
+
}, {
|
|
113
90
|
name: 'height',
|
|
114
91
|
type: 'number',
|
|
115
|
-
hideFromUI: true
|
|
116
|
-
},
|
|
117
|
-
{
|
|
92
|
+
hideFromUI: true
|
|
93
|
+
}, {
|
|
118
94
|
name: 'width',
|
|
119
95
|
type: 'number',
|
|
120
|
-
hideFromUI: true
|
|
121
|
-
},
|
|
122
|
-
{
|
|
96
|
+
hideFromUI: true
|
|
97
|
+
}, {
|
|
123
98
|
name: 'sizes',
|
|
124
99
|
type: 'string',
|
|
125
|
-
hideFromUI: true
|
|
126
|
-
},
|
|
127
|
-
{
|
|
100
|
+
hideFromUI: true
|
|
101
|
+
}, {
|
|
128
102
|
name: 'srcset',
|
|
129
103
|
type: 'string',
|
|
130
|
-
hideFromUI: true
|
|
131
|
-
},
|
|
132
|
-
{
|
|
104
|
+
hideFromUI: true
|
|
105
|
+
}, {
|
|
133
106
|
name: 'lazy',
|
|
134
107
|
type: 'boolean',
|
|
135
108
|
defaultValue: true,
|
|
136
|
-
hideFromUI: true
|
|
137
|
-
},
|
|
138
|
-
{
|
|
109
|
+
hideFromUI: true
|
|
110
|
+
}, {
|
|
139
111
|
name: 'fitContent',
|
|
140
112
|
type: 'boolean',
|
|
141
113
|
helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
|
|
142
|
-
defaultValue: true
|
|
143
|
-
},
|
|
144
|
-
{
|
|
114
|
+
defaultValue: true
|
|
115
|
+
}, {
|
|
145
116
|
name: 'aspectRatio',
|
|
146
117
|
type: 'number',
|
|
147
118
|
helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
|
|
148
119
|
advanced: true,
|
|
149
|
-
defaultValue: 0.7041
|
|
150
|
-
}
|
|
151
|
-
],
|
|
120
|
+
defaultValue: 0.7041
|
|
121
|
+
}]
|
|
152
122
|
};
|
|
@@ -38,19 +38,10 @@ export function getSrcSet(url) {
|
|
|
38
38
|
if (!isNaN(widthInSrc)) {
|
|
39
39
|
srcUrl = `${srcUrl} ${widthInSrc}w`;
|
|
40
40
|
}
|
|
41
|
-
return sizes
|
|
42
|
-
.filter((size) => size !== widthInSrc)
|
|
43
|
-
.map((size) => `${updateQueryParam(url, 'width', size)} ${size}w`)
|
|
44
|
-
.concat([srcUrl])
|
|
45
|
-
.join(', ');
|
|
41
|
+
return sizes.filter(size => size !== widthInSrc).map(size => `${updateQueryParam(url, 'width', size)} ${size}w`).concat([srcUrl]).join(', ');
|
|
46
42
|
}
|
|
47
43
|
if (url.match(/cdn\.shopify\.com/)) {
|
|
48
|
-
return sizes
|
|
49
|
-
.map((size) => [getShopifyImageUrl(url, `${size}x${size}`), size])
|
|
50
|
-
.filter(([sizeUrl]) => !!sizeUrl)
|
|
51
|
-
.map(([sizeUrl, size]) => `${sizeUrl} ${size}w`)
|
|
52
|
-
.concat([url])
|
|
53
|
-
.join(', ');
|
|
44
|
+
return sizes.map(size => [getShopifyImageUrl(url, `${size}x${size}`), size]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([url]).join(', ');
|
|
54
45
|
}
|
|
55
46
|
return url;
|
|
56
47
|
}
|