@builder.io/sdk-qwik 0.0.16 → 0.0.17
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/lib/index.qwik.cjs +218 -510
- package/lib/index.qwik.mjs +218 -510
- package/package.json +6 -5
- package/types/blocks/button/button.d.ts +9 -0
- package/types/blocks/button/component-info.d.ts +2 -0
- package/types/blocks/columns/columns.d.ts +32 -0
- package/types/blocks/columns/component-info.d.ts +2 -0
- package/types/blocks/custom-code/component-info.d.ts +2 -0
- package/types/blocks/custom-code/custom-code.d.ts +7 -0
- package/types/blocks/embed/component-info.d.ts +2 -0
- package/types/blocks/embed/embed.d.ts +6 -0
- package/types/blocks/embed/helpers.d.ts +1 -0
- package/types/blocks/form/component-info.d.ts +2 -0
- package/types/blocks/fragment/component-info.d.ts +2 -0
- package/types/blocks/fragment/fragment.d.ts +7 -0
- package/types/blocks/image/component-info.d.ts +2 -0
- package/types/blocks/image/image.d.ts +25 -0
- package/types/blocks/image/image.helpers.d.ts +1 -0
- package/types/blocks/img/component-info.d.ts +2 -0
- package/types/blocks/img/img.d.ts +10 -0
- package/types/blocks/input/component-info.d.ts +2 -0
- package/types/blocks/input/input.d.ts +11 -0
- package/types/blocks/raw-text/component-info.d.ts +2 -0
- package/types/blocks/raw-text/raw-text.d.ts +6 -0
- package/types/blocks/section/component-info.d.ts +2 -0
- package/types/blocks/section/section.d.ts +8 -0
- package/types/blocks/select/component-info.d.ts +2 -0
- package/types/blocks/select/select.d.ts +12 -0
- package/types/blocks/submit-button/component-info.d.ts +2 -0
- package/types/blocks/submit-button/submit-button.d.ts +6 -0
- package/types/blocks/symbol/component-info.d.ts +2 -0
- package/types/blocks/symbol/symbol.d.ts +20 -0
- package/types/blocks/text/component-info.d.ts +2 -0
- package/types/blocks/text/text.d.ts +5 -0
- package/types/blocks/textarea/component-info.d.ts +2 -0
- package/types/blocks/textarea/textarea.d.ts +9 -0
- package/types/blocks/util.d.ts +1 -0
- package/types/blocks/video/component-info.d.ts +2 -0
- package/types/blocks/video/video.d.ts +25 -0
- package/types/components/render-block/block-styles.d.ts +12 -0
- package/types/components/render-block/render-block.d.ts +32 -0
- package/types/components/render-block/render-block.helpers.d.ts +1 -0
- package/types/components/render-block/render-component.d.ts +12 -0
- package/types/components/render-block/render-repeated-block.d.ts +17 -0
- package/types/components/render-block/types.d.ts +6 -0
- package/types/components/render-blocks.d.ts +12 -0
- package/types/components/render-content/components/render-styles.d.ts +19 -0
- package/types/components/render-content/index.d.ts +1 -0
- package/types/components/render-content/render-content.d.ts +33 -0
- package/types/components/render-inlined-styles.d.ts +9 -0
- package/types/constants/builder-registered-components.d.ts +6 -0
- package/types/constants/device-sizes.d.ts +2 -0
- package/types/constants/target.d.ts +2 -0
- package/types/context/builder.context.d.ts +2 -0
- package/types/context/types.d.ts +16 -0
- package/types/functions/camel-to-kebab-case.d.ts +1 -0
- package/types/functions/convert-style-object.d.ts +1 -0
- package/types/functions/evaluate.d.ts +5 -0
- package/types/functions/event-handler-name.d.ts +1 -0
- package/types/functions/get-block-actions.d.ts +9 -0
- package/types/functions/get-block-component-options.d.ts +2 -0
- package/types/functions/get-block-properties.d.ts +5 -0
- package/types/functions/get-block-styles.d.ts +2 -0
- package/types/functions/get-block-tag.d.ts +10 -0
- package/types/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/types/functions/get-builder-search-params/index.d.ts +6 -0
- package/types/functions/get-content/ab-testing.d.ts +3 -0
- package/types/functions/get-content/fn.test.d.ts +1 -0
- package/types/functions/get-content/index.d.ts +9 -0
- package/types/functions/get-content/types.d.ts +26 -0
- package/types/functions/get-fetch.d.ts +1 -0
- package/types/functions/get-global-this.d.ts +1 -0
- package/types/functions/get-processed-block.d.ts +10 -0
- package/types/functions/get-processed-block.test.d.ts +1 -0
- package/types/functions/if-target.d.ts +7 -0
- package/types/functions/is-browser.d.ts +1 -0
- package/types/functions/is-editing.d.ts +1 -0
- package/types/functions/is-iframe.d.ts +1 -0
- package/types/functions/is-previewing.d.ts +1 -0
- package/types/functions/mark-mutable.d.ts +2 -0
- package/types/functions/on-change.d.ts +7 -0
- package/types/functions/on-change.test.d.ts +1 -0
- package/types/functions/register-component.d.ts +14 -0
- package/types/functions/register.d.ts +16 -0
- package/types/functions/sanitize-styles.d.ts +4 -0
- package/types/functions/set-editor-settings.d.ts +4 -0
- package/types/functions/set.d.ts +7 -0
- package/types/functions/set.test.d.ts +1 -0
- package/types/functions/track.d.ts +21 -0
- package/types/functions/transform-block.d.ts +2 -0
- package/types/helpers/cookie.d.ts +9 -0
- package/types/helpers/css.d.ts +1 -0
- package/types/helpers/flatten.d.ts +6 -0
- package/types/helpers/localStorage.d.ts +9 -0
- package/types/helpers/nullable.d.ts +2 -0
- package/types/helpers/sessionId.d.ts +7 -0
- package/types/helpers/time.d.ts +1 -0
- package/types/helpers/url.d.ts +6 -0
- package/types/helpers/url.test.d.ts +1 -0
- package/types/helpers/uuid.d.ts +8 -0
- package/types/helpers/visitorId.d.ts +8 -0
- package/types/index-helpers/blocks-exports.d.ts +10 -0
- package/types/index-helpers/top-of-file.d.ts +1 -0
- package/types/index.d.ts +10 -0
- package/types/scripts/init-editing.d.ts +2 -0
- package/types/types/builder-block.d.ts +57 -0
- package/types/types/builder-content.d.ts +38 -0
- package/types/types/can-track.d.ts +3 -0
- package/types/types/components.d.ts +177 -0
- package/types/types/deep-partial.d.ts +3 -0
- package/types/types/element.d.ts +59 -0
- package/types/types/targets.d.ts +3 -0
- package/types/types/typescript.d.ts +4 -0
- package/types-hacks.d.ts +6 -0
- package/.yarn/cache/@builder.io-qwik-npm-0.0.103-bdc7786a46-98363e9103.zip +0 -0
- package/.yarn/cache/@gar-promisify-npm-1.1.3-ac1a325862-4059f790e2.zip +0 -0
- package/.yarn/cache/@npmcli-fs-npm-2.1.2-08d434e77b-405074965e.zip +0 -0
- package/.yarn/cache/@npmcli-move-file-npm-2.0.1-b593d8f741-52dc02259d.zip +0 -0
- package/.yarn/cache/@tootallnate-once-npm-2.0.0-e36cf4f140-ad87447820.zip +0 -0
- package/.yarn/cache/@types-node-npm-18.7.6-c1eafa3d9a-5122988c32.zip +0 -0
- package/.yarn/cache/abbrev-npm-1.1.1-3659247eab-a4a97ec07d.zip +0 -0
- package/.yarn/cache/agent-base-npm-6.0.2-428f325a93-f52b6872cc.zip +0 -0
- package/.yarn/cache/agentkeepalive-npm-4.2.1-b86a9fb343-39cb49ed8c.zip +0 -0
- package/.yarn/cache/aggregate-error-npm-3.1.0-415a406f4e-1101a33f21.zip +0 -0
- package/.yarn/cache/ansi-regex-npm-5.0.1-c963a48615-2aa4bb54ca.zip +0 -0
- package/.yarn/cache/aproba-npm-2.0.0-8716bcfde6-5615cadcfb.zip +0 -0
- package/.yarn/cache/are-we-there-yet-npm-3.0.1-3395b1512f-52590c2486.zip +0 -0
- package/.yarn/cache/balanced-match-npm-1.0.2-a53c126459-9706c088a2.zip +0 -0
- package/.yarn/cache/brace-expansion-npm-1.1.11-fb95eb05ad-faf34a7bb0.zip +0 -0
- package/.yarn/cache/brace-expansion-npm-2.0.1-17aa2616f9-a61e7cd2e8.zip +0 -0
- package/.yarn/cache/cacache-npm-16.1.2-0d36d1aaf1-defe1d6f55.zip +0 -0
- package/.yarn/cache/chownr-npm-2.0.0-638f1c9c61-c57cf9dd07.zip +0 -0
- package/.yarn/cache/clean-stack-npm-2.2.0-a8ce435a5c-2ac8cd2b2f.zip +0 -0
- package/.yarn/cache/color-support-npm-1.1.3-3be5c53455-9b73568176.zip +0 -0
- package/.yarn/cache/concat-map-npm-0.0.1-85a921b7ee-902a9f5d89.zip +0 -0
- package/.yarn/cache/console-control-strings-npm-1.1.0-e3160e5275-8755d76787.zip +0 -0
- package/.yarn/cache/debug-npm-4.3.4-4513954577-3dbad3f94e.zip +0 -0
- package/.yarn/cache/delegates-npm-1.0.0-9b1942d75f-a51744d9b5.zip +0 -0
- package/.yarn/cache/depd-npm-1.1.2-b0c8414da7-6b406620d2.zip +0 -0
- package/.yarn/cache/emoji-regex-npm-8.0.0-213764015c-d4c5c39d5a.zip +0 -0
- package/.yarn/cache/encoding-npm-0.1.13-82a1837d30-bb98632f8f.zip +0 -0
- package/.yarn/cache/env-paths-npm-2.2.1-7c7577428c-65b5df55a8.zip +0 -0
- package/.yarn/cache/err-code-npm-2.0.3-082e0ff9a7-8b7b1be20d.zip +0 -0
- package/.yarn/cache/esbuild-darwin-arm64-npm-0.14.54-ec53803fa6-8.zip +0 -0
- package/.yarn/cache/esbuild-npm-0.14.54-b3dcd8a41e-49e360b118.zip +0 -0
- package/.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip +0 -0
- package/.yarn/cache/fs.realpath-npm-1.0.0-c8f05d8126-99ddea01a7.zip +0 -0
- package/.yarn/cache/fsevents-npm-2.3.2-a881d6ac9f-97ade64e75.zip +0 -0
- package/.yarn/cache/fsevents-patch-3340e2eb10-8.zip +0 -0
- package/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-b32fbaebb3.zip +0 -0
- package/.yarn/cache/gauge-npm-4.0.4-8f878385e9-788b6bfe52.zip +0 -0
- package/.yarn/cache/glob-npm-7.2.3-2d866d17a5-29452e97b3.zip +0 -0
- package/.yarn/cache/glob-npm-8.0.3-750f909025-50bcdea19d.zip +0 -0
- package/.yarn/cache/graceful-fs-npm-4.2.10-79c70989ca-3f109d70ae.zip +0 -0
- package/.yarn/cache/has-npm-1.0.3-b7f00631c1-b9ad53d53b.zip +0 -0
- package/.yarn/cache/has-unicode-npm-2.0.1-893adb4747-1eab07a743.zip +0 -0
- package/.yarn/cache/http-cache-semantics-npm-4.1.0-860520a31f-974de94a81.zip +0 -0
- package/.yarn/cache/http-proxy-agent-npm-5.0.0-7f1f121b83-e2ee1ff165.zip +0 -0
- package/.yarn/cache/https-proxy-agent-npm-5.0.1-42d65f358e-571fccdf38.zip +0 -0
- package/.yarn/cache/humanize-ms-npm-1.2.1-e942bd7329-9c7a74a282.zip +0 -0
- package/.yarn/cache/iconv-lite-npm-0.6.3-24b8aae27e-3f60d47a5c.zip +0 -0
- package/.yarn/cache/imurmurhash-npm-0.1.4-610c5068a0-7cae75c8cd.zip +0 -0
- package/.yarn/cache/indent-string-npm-4.0.0-7b717435b2-824cfb9929.zip +0 -0
- package/.yarn/cache/infer-owner-npm-1.0.4-685ac3d2af-181e732764.zip +0 -0
- package/.yarn/cache/inflight-npm-1.0.6-ccedb4b908-f4f76aa072.zip +0 -0
- package/.yarn/cache/inherits-npm-2.0.4-c66b3957a0-4a48a73384.zip +0 -0
- package/.yarn/cache/ip-npm-2.0.0-204facb3cc-cfcfac6b87.zip +0 -0
- package/.yarn/cache/is-core-module-npm-2.10.0-6dff9310aa-0f3f77811f.zip +0 -0
- package/.yarn/cache/is-fullwidth-code-point-npm-3.0.0-1ecf4ebee5-44a30c2945.zip +0 -0
- package/.yarn/cache/is-lambda-npm-1.0.1-7ab55bc8a8-93a32f0194.zip +0 -0
- package/.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip +0 -0
- package/.yarn/cache/lru-cache-npm-6.0.0-b4c8668fe1-f97f499f89.zip +0 -0
- package/.yarn/cache/lru-cache-npm-7.14.0-354cf654ec-efdd329f2c.zip +0 -0
- package/.yarn/cache/make-fetch-happen-npm-10.2.1-f1cc7cd2df-2332eb9a8e.zip +0 -0
- package/.yarn/cache/minimatch-npm-3.1.2-9405269906-c154e56640.zip +0 -0
- package/.yarn/cache/minimatch-npm-5.1.0-34f6240621-15ce53d31a.zip +0 -0
- package/.yarn/cache/minipass-collect-npm-1.0.2-3b4676eab5-14df761028.zip +0 -0
- package/.yarn/cache/minipass-fetch-npm-2.1.1-c4a8efdb09-1aae0c2240.zip +0 -0
- package/.yarn/cache/minipass-flush-npm-1.0.5-efe79d9826-56269a0b22.zip +0 -0
- package/.yarn/cache/minipass-npm-3.3.5-a555b091e7-f89f02bcaa.zip +0 -0
- package/.yarn/cache/minipass-pipeline-npm-1.2.4-5924cb077f-b14240dac0.zip +0 -0
- package/.yarn/cache/minipass-sized-npm-1.0.3-306d86f432-79076749fc.zip +0 -0
- package/.yarn/cache/minizlib-npm-2.1.2-ea89cd0cfb-f1fdeac0b0.zip +0 -0
- package/.yarn/cache/mkdirp-npm-1.0.4-37f6ef56b9-a96865108c.zip +0 -0
- package/.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip +0 -0
- package/.yarn/cache/ms-npm-2.1.3-81ff3cfac1-aa92de6080.zip +0 -0
- package/.yarn/cache/nanoid-npm-3.3.4-3d250377d6-2fddd6dee9.zip +0 -0
- package/.yarn/cache/negotiator-npm-0.6.3-9d50e36171-b8ffeb1e26.zip +0 -0
- package/.yarn/cache/node-gyp-npm-9.1.0-2091059b31-1437fa4a87.zip +0 -0
- package/.yarn/cache/nopt-npm-5.0.0-304b40fbfe-d35fdec187.zip +0 -0
- package/.yarn/cache/npmlog-npm-6.0.2-e0e69455c7-ae238cd264.zip +0 -0
- package/.yarn/cache/once-npm-1.4.0-ccf03ef07a-cd0a885013.zip +0 -0
- package/.yarn/cache/p-map-npm-4.0.0-4677ae07c7-cb0ab21ec0.zip +0 -0
- package/.yarn/cache/path-is-absolute-npm-1.0.1-31bc695ffd-060840f92c.zip +0 -0
- package/.yarn/cache/path-parse-npm-1.0.7-09564527b7-49abf3d811.zip +0 -0
- package/.yarn/cache/picocolors-npm-1.0.0-d81e0b1927-a2e8092dd8.zip +0 -0
- package/.yarn/cache/postcss-npm-8.4.16-7367383579-10eee25efd.zip +0 -0
- package/.yarn/cache/promise-inflight-npm-1.0.1-5bb925afac-2274948309.zip +0 -0
- package/.yarn/cache/promise-retry-npm-2.0.1-871f0b01b7-f96a3f6d90.zip +0 -0
- package/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-d4ea81502d.zip +0 -0
- package/.yarn/cache/resolve-npm-1.22.1-3980488690-07af5fc1e8.zip +0 -0
- package/.yarn/cache/resolve-patch-46f9469d0d-5656f4d0be.zip +0 -0
- package/.yarn/cache/retry-npm-0.12.0-72ac7fb4cc-623bd7d2e5.zip +0 -0
- package/.yarn/cache/rimraf-npm-3.0.2-2cb7dac69a-87f4164e39.zip +0 -0
- package/.yarn/cache/rollup-npm-2.78.0-09284f4c78-01b5a7ae08.zip +0 -0
- package/.yarn/cache/safe-buffer-npm-5.2.1-3481c8aa9b-b99c4b41fd.zip +0 -0
- package/.yarn/cache/safer-buffer-npm-2.1.2-8d5c0b705e-cab8f25ae6.zip +0 -0
- package/.yarn/cache/semver-npm-7.3.7-3bfe704194-2fa3e87756.zip +0 -0
- package/.yarn/cache/set-blocking-npm-2.0.0-49e2cffa24-6e65a05f7c.zip +0 -0
- package/.yarn/cache/signal-exit-npm-3.0.7-bd270458a3-a2f098f247.zip +0 -0
- package/.yarn/cache/smart-buffer-npm-4.2.0-5ac3f668bb-b5167a7142.zip +0 -0
- package/.yarn/cache/socks-npm-2.7.0-cc1cb019db-0b5d94e2b3.zip +0 -0
- package/.yarn/cache/socks-proxy-agent-npm-7.0.0-7aacf32ea0-7205543701.zip +0 -0
- package/.yarn/cache/source-map-js-npm-1.0.2-ee4f9f9b30-c049a7fc4d.zip +0 -0
- package/.yarn/cache/ssri-npm-9.0.1-33ce27f4f8-fb58f5e46b.zip +0 -0
- package/.yarn/cache/string-width-npm-4.2.3-2c27177bae-e52c10dc3f.zip +0 -0
- package/.yarn/cache/string_decoder-npm-1.3.0-2422117fd0-8417646695.zip +0 -0
- package/.yarn/cache/strip-ansi-npm-6.0.1-caddc7cb40-f3cd25890a.zip +0 -0
- package/.yarn/cache/supports-preserve-symlinks-flag-npm-1.0.0-f17c4d0028-53b1e247e6.zip +0 -0
- package/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-a04c07bb9e.zip +0 -0
- package/.yarn/cache/typescript-npm-4.7.4-65aa6ffb42-5750181b1c.zip +0 -0
- package/.yarn/cache/typescript-patch-ae154b3216-96d3030cb0.zip +0 -0
- package/.yarn/cache/unique-filename-npm-1.1.1-c885c5095b-cf4998c922.zip +0 -0
- package/.yarn/cache/unique-slug-npm-2.0.2-f6ba1ddeb7-5b6876a645.zip +0 -0
- package/.yarn/cache/util-deprecate-npm-1.0.2-e3fe1a219c-474acf1146.zip +0 -0
- package/.yarn/cache/vite-npm-3.0.2-a17ab24a12-10aebec0df.zip +0 -0
- package/.yarn/cache/which-npm-2.0.2-320ddf72f7-1a5c563d3c.zip +0 -0
- package/.yarn/cache/wide-align-npm-1.1.5-889d77e592-d5fc37cd56.zip +0 -0
- package/.yarn/cache/wrappy-npm-1.0.2-916de4d4b3-159da4805f.zip +0 -0
- package/.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/DEVELOPER.md +0 -118
- package/src/blocks/button/button.jsx +0 -27
- package/src/blocks/button/component-info.js +0 -41
- package/src/blocks/columns/columns.jsx +0 -102
- package/src/blocks/columns/component-info.js +0 -242
- package/src/blocks/custom-code/component-info.js +0 -31
- package/src/blocks/custom-code/custom-code.jsx +0 -71
- package/src/blocks/embed/component-info.js +0 -44
- package/src/blocks/embed/embed.jsx +0 -63
- package/src/blocks/embed/helpers.js +0 -9
- package/src/blocks/form/component-info.js +0 -262
- package/src/blocks/form/form.jsx +0 -303
- package/src/blocks/fragment/component-info.js +0 -11
- package/src/blocks/fragment/fragment.jsx +0 -11
- package/src/blocks/image/component-info.js +0 -151
- package/src/blocks/image/image.helpers.js +0 -48
- package/src/blocks/image/image.jsx +0 -110
- package/src/blocks/img/component-info.js +0 -20
- package/src/blocks/img/img.jsx +0 -19
- package/src/blocks/input/component-info.js +0 -74
- package/src/blocks/input/input.jsx +0 -21
- package/src/blocks/raw-text/component-info.js +0 -16
- package/src/blocks/raw-text/raw-text.jsx +0 -12
- package/src/blocks/section/component-info.js +0 -49
- package/src/blocks/section/section.jsx +0 -20
- package/src/blocks/select/component-info.js +0 -59
- package/src/blocks/select/select.jsx +0 -24
- package/src/blocks/submit-button/component-info.js +0 -28
- package/src/blocks/submit-button/submit-button.jsx +0 -11
- package/src/blocks/symbol/component-info.js +0 -43
- package/src/blocks/symbol/symbol.jsx +0 -78
- package/src/blocks/text/component-info.js +0 -24
- package/src/blocks/text/text.jsx +0 -7
- package/src/blocks/textarea/component-info.js +0 -47
- package/src/blocks/textarea/textarea.jsx +0 -15
- package/src/blocks/util.js +0 -7
- package/src/blocks/video/component-info.js +0 -106
- package/src/blocks/video/video.jsx +0 -53
- package/src/components/render-block/block-styles.jsx +0 -60
- package/src/components/render-block/render-block.helpers.js +0 -23
- package/src/components/render-block/render-block.jsx +0 -220
- package/src/components/render-block/render-component.jsx +0 -35
- package/src/components/render-block/render-repeated-block.jsx +0 -40
- package/src/components/render-block/types.js +0 -0
- package/src/components/render-blocks.jsx +0 -93
- package/src/components/render-content/components/render-styles.jsx +0 -76
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/render-content.jsx +0 -368
- package/src/components/render-inlined-styles.jsx +0 -26
- package/src/constants/builder-registered-components.js +0 -51
- package/src/constants/device-sizes.js +0 -21
- package/src/constants/target.js +0 -4
- package/src/context/builder.context.js +0 -5
- package/src/functions/camel-to-kebab-case.js +0 -4
- package/src/functions/convert-style-object.js +0 -6
- package/src/functions/evaluate.js +0 -28
- package/src/functions/event-handler-name.js +0 -7
- package/src/functions/get-block-actions.js +0 -23
- package/src/functions/get-block-component-options.js +0 -28
- package/src/functions/get-block-properties.js +0 -29
- package/src/functions/get-block-styles.js +0 -34
- package/src/functions/get-block-tag.js +0 -6
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-builder-search-params/index.js +0 -33
- package/src/functions/get-content/ab-testing.js +0 -38
- package/src/functions/get-content/fn.test.js +0 -31
- package/src/functions/get-content/index.js +0 -96
- package/src/functions/get-content/types.js +0 -0
- package/src/functions/get-fetch.js +0 -34
- package/src/functions/get-global-this.js +0 -18
- package/src/functions/get-processed-block.js +0 -57
- package/src/functions/get-processed-block.test.js +0 -32
- package/src/functions/if-target.js +0 -15
- package/src/functions/is-browser.js +0 -6
- package/src/functions/is-editing.js +0 -7
- package/src/functions/is-iframe.js +0 -7
- package/src/functions/is-previewing.js +0 -14
- package/src/functions/mark-mutable.js +0 -14
- package/src/functions/on-change.js +0 -27
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/register-component.js +0 -72
- package/src/functions/register.js +0 -29
- package/src/functions/sanitize-styles.js +0 -5
- package/src/functions/set-editor-settings.js +0 -15
- package/src/functions/set.js +0 -11
- package/src/functions/set.test.js +0 -16
- package/src/functions/track.js +0 -115
- package/src/functions/transform-block.js +0 -6
- package/src/helpers/cookie.js +0 -59
- package/src/helpers/css.js +0 -12
- package/src/helpers/flatten.js +0 -34
- package/src/helpers/localStorage.js +0 -34
- package/src/helpers/nullable.js +0 -4
- package/src/helpers/sessionId.js +0 -26
- package/src/helpers/time.js +0 -5
- package/src/helpers/url.js +0 -10
- package/src/helpers/url.test.js +0 -15
- package/src/helpers/uuid.js +0 -13
- package/src/helpers/visitorId.js +0 -33
- package/src/index-helpers/blocks-exports.js +0 -22
- package/src/index-helpers/top-of-file.js +0 -4
- package/src/index.js +0 -10
- package/src/scripts/init-editing.js +0 -79
- package/src/types/builder-block.js +0 -0
- package/src/types/builder-content.js +0 -0
- package/src/types/can-track.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
- package/tsconfig.json +0 -110
- package/types.d.ts +0 -8
- package/vite.config.ts +0 -17
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Symbol",
|
|
3
|
-
noWrap: true,
|
|
4
|
-
static: true,
|
|
5
|
-
builtIn: true,
|
|
6
|
-
inputs: [
|
|
7
|
-
{
|
|
8
|
-
name: "symbol",
|
|
9
|
-
type: "uiSymbol"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: "dataOnly",
|
|
13
|
-
helperText: "Make this a data symbol that doesn't display any UI",
|
|
14
|
-
type: "boolean",
|
|
15
|
-
defaultValue: false,
|
|
16
|
-
advanced: true,
|
|
17
|
-
hideFromUI: true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "inheritState",
|
|
21
|
-
helperText: "Inherit the parent component state and data",
|
|
22
|
-
type: "boolean",
|
|
23
|
-
defaultValue: false,
|
|
24
|
-
advanced: true
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "renderToLiquid",
|
|
28
|
-
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
29
|
-
type: "boolean",
|
|
30
|
-
defaultValue: false,
|
|
31
|
-
advanced: true,
|
|
32
|
-
hideFromUI: true
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "useChildren",
|
|
36
|
-
hideFromUI: true,
|
|
37
|
-
type: "boolean"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
};
|
|
41
|
-
export {
|
|
42
|
-
componentInfo
|
|
43
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import RenderContent from "../../components/render-content/render-content";
|
|
4
|
-
import BuilderContext from "../../context/builder.context";
|
|
5
|
-
import { getContent } from "../../functions/get-content/index.js";
|
|
6
|
-
import { markMutable } from "../../functions/mark-mutable";
|
|
7
|
-
import {
|
|
8
|
-
Fragment,
|
|
9
|
-
component$,
|
|
10
|
-
h,
|
|
11
|
-
useClientEffect$,
|
|
12
|
-
useContext,
|
|
13
|
-
useStore,
|
|
14
|
-
useWatch$,
|
|
15
|
-
} from "@builder.io/qwik";
|
|
16
|
-
export const Symbol = component$((props) => {
|
|
17
|
-
const builderContext = useContext(BuilderContext);
|
|
18
|
-
const state = useStore({ className: "builder-symbol", content: null });
|
|
19
|
-
useClientEffect$(() => {
|
|
20
|
-
state.content = props.symbol?.content;
|
|
21
|
-
});
|
|
22
|
-
useWatch$(({ track }) => {
|
|
23
|
-
props && track(props, "symbol");
|
|
24
|
-
state && track(state, "content");
|
|
25
|
-
const symbolToUse = props.symbol;
|
|
26
|
-
/**
|
|
27
|
-
* If:
|
|
28
|
-
* - we have a symbol prop
|
|
29
|
-
* - yet it does not have any content
|
|
30
|
-
* - and we have not already stored content from before
|
|
31
|
-
* - and it has a model name
|
|
32
|
-
*
|
|
33
|
-
* then we want to re-fetch the symbol content.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
symbolToUse &&
|
|
38
|
-
!symbolToUse.content &&
|
|
39
|
-
!state.content &&
|
|
40
|
-
symbolToUse.model
|
|
41
|
-
) {
|
|
42
|
-
getContent({
|
|
43
|
-
model: symbolToUse.model,
|
|
44
|
-
apiKey: builderContext.apiKey,
|
|
45
|
-
query: {
|
|
46
|
-
id: symbolToUse.entry,
|
|
47
|
-
},
|
|
48
|
-
}).then((response) => {
|
|
49
|
-
state.content = response;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return (
|
|
54
|
-
<div
|
|
55
|
-
{...props.attributes}
|
|
56
|
-
dataSet={{
|
|
57
|
-
class: state.className,
|
|
58
|
-
}}
|
|
59
|
-
class={state.className}
|
|
60
|
-
>
|
|
61
|
-
<RenderContent
|
|
62
|
-
apiKey={builderContext.apiKey}
|
|
63
|
-
context={builderContext.context}
|
|
64
|
-
customComponents={markMutable(
|
|
65
|
-
Object.values(builderContext.registeredComponents)
|
|
66
|
-
)}
|
|
67
|
-
data={markMutable({
|
|
68
|
-
...props.symbol?.data,
|
|
69
|
-
...builderContext.state,
|
|
70
|
-
...props.symbol?.content?.data?.state,
|
|
71
|
-
})}
|
|
72
|
-
model={props.symbol?.model}
|
|
73
|
-
content={markMutable(state.content)}
|
|
74
|
-
></RenderContent>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
export default Symbol;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Text",
|
|
3
|
-
static: true,
|
|
4
|
-
builtIn: true,
|
|
5
|
-
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
6
|
-
inputs: [
|
|
7
|
-
{
|
|
8
|
-
name: "text",
|
|
9
|
-
type: "html",
|
|
10
|
-
required: true,
|
|
11
|
-
autoFocus: true,
|
|
12
|
-
bubble: true,
|
|
13
|
-
defaultValue: "Enter some text..."
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
defaultStyles: {
|
|
17
|
-
lineHeight: "normal",
|
|
18
|
-
height: "auto",
|
|
19
|
-
textAlign: "center"
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
componentInfo
|
|
24
|
-
};
|
package/src/blocks/text/text.jsx
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Form:TextArea",
|
|
3
|
-
builtIn: true,
|
|
4
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
5
|
-
inputs: [
|
|
6
|
-
{
|
|
7
|
-
advanced: true,
|
|
8
|
-
name: "value",
|
|
9
|
-
type: "string"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: "name",
|
|
13
|
-
type: "string",
|
|
14
|
-
required: true,
|
|
15
|
-
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "defaultValue",
|
|
19
|
-
type: "string"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "placeholder",
|
|
23
|
-
type: "string",
|
|
24
|
-
defaultValue: "Hello there"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "required",
|
|
28
|
-
type: "boolean",
|
|
29
|
-
defaultValue: false
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
defaultStyles: {
|
|
33
|
-
paddingTop: "10px",
|
|
34
|
-
paddingBottom: "10px",
|
|
35
|
-
paddingLeft: "10px",
|
|
36
|
-
paddingRight: "10px",
|
|
37
|
-
borderRadius: "3px",
|
|
38
|
-
borderWidth: "1px",
|
|
39
|
-
borderStyle: "solid",
|
|
40
|
-
borderColor: "#ccc"
|
|
41
|
-
},
|
|
42
|
-
static: true,
|
|
43
|
-
noWrap: true
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
componentInfo
|
|
47
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import { Fragment, component$, h } from "@builder.io/qwik";
|
|
4
|
-
export const Textarea = component$((props) => {
|
|
5
|
-
return (
|
|
6
|
-
<textarea
|
|
7
|
-
{...props.attributes}
|
|
8
|
-
placeholder={props.placeholder}
|
|
9
|
-
name={props.name}
|
|
10
|
-
value={props.value}
|
|
11
|
-
defaultValue={props.defaultValue}
|
|
12
|
-
></textarea>
|
|
13
|
-
);
|
|
14
|
-
});
|
|
15
|
-
export default Textarea;
|
package/src/blocks/util.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Video",
|
|
3
|
-
canHaveChildren: true,
|
|
4
|
-
builtIn: true,
|
|
5
|
-
defaultStyles: {
|
|
6
|
-
minHeight: "20px",
|
|
7
|
-
minWidth: "20px"
|
|
8
|
-
},
|
|
9
|
-
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
|
|
10
|
-
inputs: [
|
|
11
|
-
{
|
|
12
|
-
name: "video",
|
|
13
|
-
type: "file",
|
|
14
|
-
allowedFileTypes: ["mp4"],
|
|
15
|
-
bubble: true,
|
|
16
|
-
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "posterImage",
|
|
21
|
-
type: "file",
|
|
22
|
-
allowedFileTypes: ["jpeg", "png"],
|
|
23
|
-
helperText: "Image to show before the video plays"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "autoPlay",
|
|
27
|
-
type: "boolean",
|
|
28
|
-
defaultValue: true
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: "controls",
|
|
32
|
-
type: "boolean",
|
|
33
|
-
defaultValue: false
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "muted",
|
|
37
|
-
type: "boolean",
|
|
38
|
-
defaultValue: true
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "loop",
|
|
42
|
-
type: "boolean",
|
|
43
|
-
defaultValue: true
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "playsInline",
|
|
47
|
-
type: "boolean",
|
|
48
|
-
defaultValue: true
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "fit",
|
|
52
|
-
type: "text",
|
|
53
|
-
defaultValue: "cover",
|
|
54
|
-
enum: ["contain", "cover", "fill", "auto"]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "fitContent",
|
|
58
|
-
type: "boolean",
|
|
59
|
-
helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
|
|
60
|
-
defaultValue: true,
|
|
61
|
-
advanced: true
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "position",
|
|
65
|
-
type: "text",
|
|
66
|
-
defaultValue: "center",
|
|
67
|
-
enum: [
|
|
68
|
-
"center",
|
|
69
|
-
"top",
|
|
70
|
-
"left",
|
|
71
|
-
"right",
|
|
72
|
-
"bottom",
|
|
73
|
-
"top left",
|
|
74
|
-
"top right",
|
|
75
|
-
"bottom left",
|
|
76
|
-
"bottom right"
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "height",
|
|
81
|
-
type: "number",
|
|
82
|
-
advanced: true
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "width",
|
|
86
|
-
type: "number",
|
|
87
|
-
advanced: true
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "aspectRatio",
|
|
91
|
-
type: "number",
|
|
92
|
-
advanced: true,
|
|
93
|
-
defaultValue: 0.7004048582995948
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: "lazyLoad",
|
|
97
|
-
type: "boolean",
|
|
98
|
-
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
99
|
-
defaultValue: true,
|
|
100
|
-
advanced: true
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
};
|
|
104
|
-
export {
|
|
105
|
-
componentInfo
|
|
106
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import { Fragment, component$, h } from "@builder.io/qwik";
|
|
4
|
-
export const videoProps = function videoProps(props, state) {
|
|
5
|
-
return {
|
|
6
|
-
...(props.autoPlay === true
|
|
7
|
-
? {
|
|
8
|
-
autoPlay: true,
|
|
9
|
-
}
|
|
10
|
-
: {}),
|
|
11
|
-
...(props.muted === true
|
|
12
|
-
? {
|
|
13
|
-
muted: true,
|
|
14
|
-
}
|
|
15
|
-
: {}),
|
|
16
|
-
...(props.controls === true
|
|
17
|
-
? {
|
|
18
|
-
controls: true,
|
|
19
|
-
}
|
|
20
|
-
: {}),
|
|
21
|
-
...(props.loop === true
|
|
22
|
-
? {
|
|
23
|
-
loop: true,
|
|
24
|
-
}
|
|
25
|
-
: {}),
|
|
26
|
-
...(props.playsInline === true
|
|
27
|
-
? {
|
|
28
|
-
playsInline: true,
|
|
29
|
-
}
|
|
30
|
-
: {}),
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export const Video = component$((props) => {
|
|
34
|
-
const state = {};
|
|
35
|
-
return (
|
|
36
|
-
<video
|
|
37
|
-
{...videoProps(props, state)}
|
|
38
|
-
style={{
|
|
39
|
-
width: "100%",
|
|
40
|
-
height: "100%",
|
|
41
|
-
...props.attributes?.style,
|
|
42
|
-
objectFit: props.fit,
|
|
43
|
-
objectPosition: props.position,
|
|
44
|
-
// Hack to get object fit to work as expected and
|
|
45
|
-
// not have the video overflow
|
|
46
|
-
borderRadius: 1,
|
|
47
|
-
}}
|
|
48
|
-
src={props.video || "no-src"}
|
|
49
|
-
poster={props.posterImage}
|
|
50
|
-
></video>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
export default Video;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
|
|
4
|
-
import { TARGET } from "../../constants/target.js";
|
|
5
|
-
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
6
|
-
import { convertStyleMaptoCSS } from "../../helpers/css.js";
|
|
7
|
-
import RenderInlinedStyles from "../render-inlined-styles";
|
|
8
|
-
import { Fragment, h } from "@builder.io/qwik";
|
|
9
|
-
export const useBlock = function useBlock(props, state) {
|
|
10
|
-
return getProcessedBlock({
|
|
11
|
-
block: props.block,
|
|
12
|
-
state: props.context.state,
|
|
13
|
-
context: props.context.context,
|
|
14
|
-
shouldEvaluateBindings: true,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
export const css = function css(props, state) {
|
|
18
|
-
const styles = useBlock(props, state).responsiveStyles;
|
|
19
|
-
const largeStyles = styles?.large;
|
|
20
|
-
const mediumStyles = styles?.medium;
|
|
21
|
-
const smallStyles = styles?.small;
|
|
22
|
-
return `
|
|
23
|
-
${
|
|
24
|
-
largeStyles
|
|
25
|
-
? `.${useBlock(props, state).id} {${convertStyleMaptoCSS(
|
|
26
|
-
largeStyles
|
|
27
|
-
)}}`
|
|
28
|
-
: ""
|
|
29
|
-
}
|
|
30
|
-
${
|
|
31
|
-
mediumStyles
|
|
32
|
-
? `${getMaxWidthQueryForSize("medium")} {
|
|
33
|
-
.${useBlock(props, state).id} {${convertStyleMaptoCSS(
|
|
34
|
-
mediumStyles
|
|
35
|
-
)}}
|
|
36
|
-
}`
|
|
37
|
-
: ""
|
|
38
|
-
}
|
|
39
|
-
${
|
|
40
|
-
smallStyles
|
|
41
|
-
? `${getMaxWidthQueryForSize("small")} {
|
|
42
|
-
.${useBlock(props, state).id} {${convertStyleMaptoCSS(
|
|
43
|
-
smallStyles
|
|
44
|
-
)}}
|
|
45
|
-
}`
|
|
46
|
-
: ""
|
|
47
|
-
}
|
|
48
|
-
}`;
|
|
49
|
-
};
|
|
50
|
-
export const BlockStyles = (props) => {
|
|
51
|
-
const state = {};
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
{TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" ? (
|
|
55
|
-
<RenderInlinedStyles styles={css(props, state)}></RenderInlinedStyles>
|
|
56
|
-
) : null}
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
export default BlockStyles;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const EMPTY_HTML_ELEMENTS = [
|
|
2
|
-
"area",
|
|
3
|
-
"base",
|
|
4
|
-
"br",
|
|
5
|
-
"col",
|
|
6
|
-
"embed",
|
|
7
|
-
"hr",
|
|
8
|
-
"img",
|
|
9
|
-
"input",
|
|
10
|
-
"keygen",
|
|
11
|
-
"link",
|
|
12
|
-
"meta",
|
|
13
|
-
"param",
|
|
14
|
-
"source",
|
|
15
|
-
"track",
|
|
16
|
-
"wbr"
|
|
17
|
-
];
|
|
18
|
-
const isEmptyHtmlElement = (tagName) => {
|
|
19
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
isEmptyHtmlElement
|
|
23
|
-
};
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import { evaluate } from "../../functions/evaluate.js";
|
|
4
|
-
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
5
|
-
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
6
|
-
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
7
|
-
import { getBlockStyles } from "../../functions/get-block-styles.js";
|
|
8
|
-
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
9
|
-
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
10
|
-
import BlockStyles from "./block-styles";
|
|
11
|
-
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
12
|
-
import RenderComponent from "./render-component";
|
|
13
|
-
import RenderRepeatedBlock from "./render-repeated-block";
|
|
14
|
-
import { Fragment, h } from "@builder.io/qwik";
|
|
15
|
-
export const component = function component(props, state) {
|
|
16
|
-
const componentName = getProcessedBlock({
|
|
17
|
-
block: props.block,
|
|
18
|
-
state: props.context.state,
|
|
19
|
-
context: props.context.context,
|
|
20
|
-
shouldEvaluateBindings: false,
|
|
21
|
-
}).component?.name;
|
|
22
|
-
|
|
23
|
-
if (!componentName) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const ref = props.context.registeredComponents[componentName];
|
|
28
|
-
|
|
29
|
-
if (!ref) {
|
|
30
|
-
// TODO: Public doc page with more info about this message
|
|
31
|
-
console.warn(`
|
|
32
|
-
Could not find a registered component named "${componentName}".
|
|
33
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
34
|
-
return undefined;
|
|
35
|
-
} else {
|
|
36
|
-
return ref;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const componentInfo = function componentInfo(props, state) {
|
|
40
|
-
if (component(props, state)) {
|
|
41
|
-
const { component: _, ...info } = component(props, state);
|
|
42
|
-
return info;
|
|
43
|
-
} else {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export const componentRef = function componentRef(props, state) {
|
|
48
|
-
return component(props, state)?.component;
|
|
49
|
-
};
|
|
50
|
-
export const tagName = function tagName(props, state) {
|
|
51
|
-
return getBlockTag(useBlock(props, state));
|
|
52
|
-
};
|
|
53
|
-
export const useBlock = function useBlock(props, state) {
|
|
54
|
-
return repeatItemData(props, state)
|
|
55
|
-
? props.block
|
|
56
|
-
: getProcessedBlock({
|
|
57
|
-
block: props.block,
|
|
58
|
-
state: props.context.state,
|
|
59
|
-
context: props.context.context,
|
|
60
|
-
shouldEvaluateBindings: true,
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
export const attributes = function attributes(props, state) {
|
|
64
|
-
return {
|
|
65
|
-
...getBlockProperties(useBlock(props, state)),
|
|
66
|
-
...getBlockActions({
|
|
67
|
-
block: useBlock(props, state),
|
|
68
|
-
state: props.context.state,
|
|
69
|
-
context: props.context.context,
|
|
70
|
-
}),
|
|
71
|
-
style: getBlockStyles(useBlock(props, state)),
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
export const shouldWrap = function shouldWrap(props, state) {
|
|
75
|
-
return !componentInfo(props, state)?.noWrap;
|
|
76
|
-
};
|
|
77
|
-
export const componentOptions = function componentOptions(props, state) {
|
|
78
|
-
return {
|
|
79
|
-
...getBlockComponentOptions(useBlock(props, state)),
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
|
|
83
|
-
* they are provided to the component itself directly.
|
|
84
|
-
*/
|
|
85
|
-
...(shouldWrap(props, state)
|
|
86
|
-
? {}
|
|
87
|
-
: {
|
|
88
|
-
attributes: attributes(props, state),
|
|
89
|
-
}),
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export const renderComponentProps = function renderComponentProps(
|
|
93
|
-
props,
|
|
94
|
-
state
|
|
95
|
-
) {
|
|
96
|
-
return {
|
|
97
|
-
blockChildren: children(props, state),
|
|
98
|
-
componentRef: componentRef(props, state),
|
|
99
|
-
componentOptions: componentOptions(props, state),
|
|
100
|
-
context: props.context,
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
export const children = function children(props, state) {
|
|
104
|
-
// TO-DO: When should `canHaveChildren` dictate rendering?
|
|
105
|
-
// This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,
|
|
106
|
-
// but still receive and need to render children.
|
|
107
|
-
// return state.componentInfo?.canHaveChildren ? state.useBlock.children : [];
|
|
108
|
-
return useBlock(props, state).children ?? [];
|
|
109
|
-
};
|
|
110
|
-
export const childrenWithoutParentComponent =
|
|
111
|
-
function childrenWithoutParentComponent(props, state) {
|
|
112
|
-
/**
|
|
113
|
-
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
114
|
-
* we render them outside of `componentRef`.
|
|
115
|
-
* NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
|
|
116
|
-
* blocks, and the children will be repeated within those blocks.
|
|
117
|
-
*/
|
|
118
|
-
const shouldRenderChildrenOutsideRef =
|
|
119
|
-
!componentRef(props, state) && !repeatItemData(props, state);
|
|
120
|
-
return shouldRenderChildrenOutsideRef ? children(props, state) : [];
|
|
121
|
-
};
|
|
122
|
-
export const repeatItemData = function repeatItemData(props, state) {
|
|
123
|
-
/**
|
|
124
|
-
* we don't use `state.useBlock` here because the processing done within its logic includes evaluating the block's bindings,
|
|
125
|
-
* which will not work if there is a repeat.
|
|
126
|
-
*/
|
|
127
|
-
const { repeat, ...blockWithoutRepeat } = props.block;
|
|
128
|
-
|
|
129
|
-
if (!repeat?.collection) {
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const itemsArray = evaluate({
|
|
134
|
-
code: repeat.collection,
|
|
135
|
-
state: props.context.state,
|
|
136
|
-
context: props.context.context,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
if (!Array.isArray(itemsArray)) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const collectionName = repeat.collection.split(".").pop();
|
|
144
|
-
const itemNameToUse =
|
|
145
|
-
repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
146
|
-
const repeatArray = itemsArray.map((item, index) => ({
|
|
147
|
-
context: {
|
|
148
|
-
...props.context,
|
|
149
|
-
state: {
|
|
150
|
-
...props.context.state,
|
|
151
|
-
$index: index,
|
|
152
|
-
$item: item,
|
|
153
|
-
[itemNameToUse]: item,
|
|
154
|
-
[`$${itemNameToUse}Index`]: index,
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
block: blockWithoutRepeat,
|
|
158
|
-
}));
|
|
159
|
-
return repeatArray;
|
|
160
|
-
};
|
|
161
|
-
export const RenderBlock = (props) => {
|
|
162
|
-
const state = {};
|
|
163
|
-
state.tagName = tagName(props, state);
|
|
164
|
-
return (
|
|
165
|
-
<>
|
|
166
|
-
{shouldWrap(props, state) ? (
|
|
167
|
-
!isEmptyHtmlElement(tagName(props, state)) ? (
|
|
168
|
-
<state.tagName {...attributes(props, state)}>
|
|
169
|
-
{repeatItemData(props, state)
|
|
170
|
-
? (repeatItemData(props, state) || []).map((data, index) => {
|
|
171
|
-
return (
|
|
172
|
-
<RenderRepeatedBlock
|
|
173
|
-
key={index}
|
|
174
|
-
repeatContext={data.context}
|
|
175
|
-
block={data.block}
|
|
176
|
-
></RenderRepeatedBlock>
|
|
177
|
-
);
|
|
178
|
-
})
|
|
179
|
-
: null}
|
|
180
|
-
{!repeatItemData(props, state) ? (
|
|
181
|
-
<RenderComponent
|
|
182
|
-
{...renderComponentProps(props, state)}
|
|
183
|
-
></RenderComponent>
|
|
184
|
-
) : null}
|
|
185
|
-
{(childrenWithoutParentComponent(props, state) || []).map(
|
|
186
|
-
(child) => {
|
|
187
|
-
return (
|
|
188
|
-
<RenderBlock
|
|
189
|
-
key={"render-block-" + child.id}
|
|
190
|
-
block={child}
|
|
191
|
-
context={props.context}
|
|
192
|
-
></RenderBlock>
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
)}
|
|
196
|
-
{(childrenWithoutParentComponent(props, state) || []).map(
|
|
197
|
-
(child) => {
|
|
198
|
-
return (
|
|
199
|
-
<BlockStyles
|
|
200
|
-
key={"block-style-" + child.id}
|
|
201
|
-
block={child}
|
|
202
|
-
context={props.context}
|
|
203
|
-
></BlockStyles>
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
)}
|
|
207
|
-
</state.tagName>
|
|
208
|
-
) : (
|
|
209
|
-
<state.tagName {...attributes(props, state)}></state.tagName>
|
|
210
|
-
)
|
|
211
|
-
) : (
|
|
212
|
-
<RenderComponent
|
|
213
|
-
{...renderComponentProps(props, state)}
|
|
214
|
-
context={props.context}
|
|
215
|
-
></RenderComponent>
|
|
216
|
-
)}
|
|
217
|
-
</>
|
|
218
|
-
);
|
|
219
|
-
};
|
|
220
|
-
export default RenderBlock;
|