@makeswift/runtime 0.25.4-canary.3 → 0.25.4
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/cjs/api/api-resources-client.js +160 -0
- package/dist/cjs/api/api-resources-client.js.map +1 -0
- package/dist/cjs/api/client.js +90 -0
- package/dist/cjs/api/client.js.map +1 -0
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/api-handler/handlers/webhook/diff-projection.js +62 -0
- package/dist/cjs/api-handler/handlers/webhook/diff-projection.js.map +1 -0
- package/dist/cjs/builder/breakpoints/index.js +31 -0
- package/dist/cjs/builder/breakpoints/index.js.map +1 -0
- package/dist/cjs/builder/core/index.js +57 -0
- package/dist/cjs/builder/core/index.js.map +1 -0
- package/dist/cjs/builder/host-api.js +56 -0
- package/dist/cjs/builder/host-api.js.map +1 -0
- package/dist/cjs/builder/host-to-builder-actions.js +41 -0
- package/dist/cjs/builder/host-to-builder-actions.js.map +1 -0
- package/dist/cjs/builder/serialization.js +78 -0
- package/dist/cjs/builder/serialization.js.map +1 -0
- package/dist/cjs/components/builtin/Carousel/Carousel.js +2 -5
- package/dist/cjs/components/builtin/Carousel/Carousel.js.map +1 -1
- package/dist/cjs/controls/control.js +1 -3
- package/dist/cjs/controls/control.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js +15 -2
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/translation.js +187 -0
- package/dist/cjs/controls/rich-text-v2/translation.js.map +1 -0
- package/dist/cjs/controls/serialization/base/index.js +78 -0
- package/dist/cjs/controls/serialization/base/index.js.map +1 -0
- package/dist/cjs/controls/serialization/base/visitor.js +59 -0
- package/dist/cjs/controls/serialization/base/visitor.js.map +1 -0
- package/dist/cjs/controls/serialization/index.js +55 -0
- package/dist/cjs/controls/serialization/index.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/function-serialization.js +79 -0
- package/dist/cjs/controls/serialization/message-port/function-serialization.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/index.js +25 -0
- package/dist/cjs/controls/serialization/message-port/index.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/visitor.js +48 -0
- package/dist/cjs/controls/serialization/message-port/visitor.js.map +1 -0
- package/dist/cjs/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.js +72 -0
- package/dist/cjs/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.js.map +1 -0
- package/dist/cjs/controls/visitors/message-port-serializer/function-serialization.js +79 -0
- package/dist/cjs/controls/visitors/message-port-serializer/function-serialization.js.map +1 -0
- package/dist/cjs/controls/visitors/message-port-serializer/index.js +36 -0
- package/dist/cjs/controls/visitors/message-port-serializer/index.js.map +1 -0
- package/dist/cjs/next/api-handler/config/pages-router.js +1 -1
- package/dist/cjs/next/api-handler/config/pages-router.js.map +1 -1
- package/dist/cjs/next/components/tests/makeswift-component/fixtures.js +101 -0
- package/dist/cjs/next/components/tests/makeswift-component/fixtures.js.map +1 -0
- package/dist/cjs/next/fetch.js +30 -0
- package/dist/cjs/next/fetch.js.map +1 -0
- package/dist/cjs/next/runtime.js +35 -0
- package/dist/cjs/next/runtime.js.map +1 -0
- package/dist/cjs/next/testing/react-runtime.js +29 -0
- package/dist/cjs/next/testing/react-runtime.js.map +1 -0
- package/dist/cjs/prop-controllers/serialization.js +355 -0
- package/dist/cjs/prop-controllers/serialization.js.map +1 -0
- package/dist/cjs/react/builtins/box.js +42 -0
- package/dist/cjs/react/builtins/box.js.map +1 -0
- package/dist/cjs/react/builtins/button.js +42 -0
- package/dist/cjs/react/builtins/button.js.map +1 -0
- package/dist/cjs/react/builtins/carousel.js +42 -0
- package/dist/cjs/react/builtins/carousel.js.map +1 -0
- package/dist/cjs/react/builtins/countdown.js +42 -0
- package/dist/cjs/react/builtins/countdown.js.map +1 -0
- package/dist/cjs/react/builtins/divider.js +42 -0
- package/dist/cjs/react/builtins/divider.js.map +1 -0
- package/dist/cjs/react/builtins/embed.js +42 -0
- package/dist/cjs/react/builtins/embed.js.map +1 -0
- package/dist/cjs/react/builtins/form.js +42 -0
- package/dist/cjs/react/builtins/form.js.map +1 -0
- package/dist/cjs/react/builtins/image.js +42 -0
- package/dist/cjs/react/builtins/image.js.map +1 -0
- package/dist/cjs/react/builtins/index.js +29 -0
- package/dist/cjs/react/builtins/index.js.map +1 -0
- package/dist/cjs/react/builtins/navigation.js +42 -0
- package/dist/cjs/react/builtins/navigation.js.map +1 -0
- package/dist/cjs/react/builtins/root.js +42 -0
- package/dist/cjs/react/builtins/root.js.map +1 -0
- package/dist/cjs/react/builtins/slot.js +42 -0
- package/dist/cjs/react/builtins/slot.js.map +1 -0
- package/dist/cjs/react/builtins/social-links.js +42 -0
- package/dist/cjs/react/builtins/social-links.js.map +1 -0
- package/dist/cjs/react/builtins/text.js +42 -0
- package/dist/cjs/react/builtins/text.js.map +1 -0
- package/dist/cjs/react/builtins/video.js +42 -0
- package/dist/cjs/react/builtins/video.js.map +1 -0
- package/dist/cjs/react/core/index.js +29 -0
- package/dist/cjs/react/core/index.js.map +1 -0
- package/dist/cjs/react/index.js +29 -0
- package/dist/cjs/react/index.js.map +1 -0
- package/dist/cjs/runtimes/react/components/GoogleFontLink.js +55 -0
- package/dist/cjs/runtimes/react/components/GoogleFontLink.js.map +1 -0
- package/dist/cjs/runtimes/react/components/MakeswiftFonts.js +33 -0
- package/dist/cjs/runtimes/react/components/MakeswiftFonts.js.map +1 -0
- package/dist/cjs/runtimes/react/components/activity-with-fallback.js +54 -0
- package/dist/cjs/runtimes/react/components/activity-with-fallback.js.map +1 -0
- package/dist/cjs/runtimes/react/components/page/index.js +13 -3
- package/dist/cjs/runtimes/react/components/page/index.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-async-effect.js +55 -0
- package/dist/cjs/runtimes/react/hooks/use-async-effect.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-builtin-suspense.js +33 -0
- package/dist/cjs/runtimes/react/hooks/use-builtin-suspense.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js +39 -0
- package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-is-read-only.js +33 -0
- package/dist/cjs/runtimes/react/hooks/use-is-read-only.js.map +1 -0
- package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js +59 -0
- package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js.map +1 -0
- package/dist/cjs/runtimes/react/react-runtime-core.js +72 -0
- package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -0
- package/dist/cjs/runtimes/react/resource-resolver.js +52 -0
- package/dist/cjs/runtimes/react/resource-resolver.js.map +1 -0
- package/dist/cjs/runtimes/react/testing/react-runtime.js +33 -0
- package/dist/cjs/runtimes/react/testing/react-runtime.js.map +1 -0
- package/dist/cjs/runtimes/react/utils/google-fonts-url.js +49 -0
- package/dist/cjs/runtimes/react/utils/google-fonts-url.js.map +1 -0
- package/dist/cjs/state/actions/index.js +42 -0
- package/dist/cjs/state/actions/index.js.map +1 -0
- package/dist/cjs/state/actions/internal/index.js +34 -0
- package/dist/cjs/state/actions/internal/index.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-only-actions.js +195 -0
- package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js +76 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -0
- package/dist/cjs/state/actions/internal.js +205 -0
- package/dist/cjs/state/actions/internal.js.map +1 -0
- package/dist/cjs/state/api-client/client-store.js +81 -0
- package/dist/cjs/state/api-client/client-store.js.map +1 -0
- package/dist/cjs/state/api-client/fetch-api-resource.js +125 -0
- package/dist/cjs/state/api-client/fetch-api-resource.js.map +1 -0
- package/dist/cjs/state/api-client/state.js +89 -0
- package/dist/cjs/state/api-client/state.js.map +1 -0
- package/dist/cjs/state/api-client/store.js +36 -0
- package/dist/cjs/state/api-client/store.js.map +1 -0
- package/dist/cjs/state/builder-api/actions.js +161 -0
- package/dist/cjs/state/builder-api/actions.js.map +1 -0
- package/dist/cjs/state/builder-api/api.js +17 -0
- package/dist/cjs/state/builder-api/api.js.map +1 -0
- package/dist/cjs/state/builder-api/message-channel.js +98 -0
- package/dist/cjs/state/builder-api/message-channel.js.map +1 -0
- package/dist/cjs/state/builder-api/navigation-listener.js +110 -0
- package/dist/cjs/state/builder-api/navigation-listener.js.map +1 -0
- package/dist/cjs/state/builder-api/proxy.js +72 -0
- package/dist/cjs/state/builder-api/proxy.js.map +1 -0
- package/dist/cjs/state/host-api.js +117 -0
- package/dist/cjs/state/host-api.js.map +1 -0
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js +37 -0
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js.map +1 -0
- package/dist/cjs/state/middleware/read-only-element-tree.js +52 -0
- package/dist/cjs/state/middleware/read-only-element-tree.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/element-size.js +40 -0
- package/dist/cjs/state/middleware/read-write/builder-api/element-size.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js +85 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +281 -0
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/index.js +40 -0
- package/dist/cjs/state/middleware/read-write/index.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/measure-box-models.js +71 -0
- package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +114 -0
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/update-element-tree.js +59 -0
- package/dist/cjs/state/middleware/read-write/update-element-tree.js.map +1 -0
- package/dist/cjs/state/mixins/breakpoint-watch.js +72 -0
- package/dist/cjs/state/mixins/breakpoint-watch.js.map +1 -0
- package/dist/cjs/state/modules/is-read-only.js +50 -0
- package/dist/cjs/state/modules/is-read-only.js.map +1 -0
- package/dist/cjs/state/modules/locale.js +50 -0
- package/dist/cjs/state/modules/locale.js.map +1 -0
- package/dist/cjs/state/modules/read-write/box-models.js +144 -0
- package/dist/cjs/state/modules/read-write/box-models.js.map +1 -0
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js +61 -0
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -0
- package/dist/cjs/state/modules/read-write/pointer.js +48 -0
- package/dist/cjs/state/modules/read-write/pointer.js.map +1 -0
- package/dist/cjs/state/modules/read-write/read-write-documents.js +98 -0
- package/dist/cjs/state/modules/read-write/read-write-documents.js.map +1 -0
- package/dist/cjs/state/modules/site-version.js +47 -0
- package/dist/cjs/state/modules/site-version.js.map +1 -0
- package/dist/cjs/state/ops/copy-element-tree.js +67 -0
- package/dist/cjs/state/ops/copy-element-tree.js.map +1 -0
- package/dist/cjs/state/ops/merge-element.js +73 -0
- package/dist/cjs/state/ops/merge-element.js.map +1 -0
- package/dist/cjs/state/read-only-state.js +231 -0
- package/dist/cjs/state/read-only-state.js.map +1 -0
- package/dist/cjs/state/read-write-state.js +128 -0
- package/dist/cjs/state/read-write-state.js.map +1 -0
- package/dist/cjs/state/shared-api.js +63 -0
- package/dist/cjs/state/shared-api.js.map +1 -0
- package/dist/cjs/state/store.js +219 -0
- package/dist/cjs/state/store.js.map +1 -0
- package/dist/cjs/state/translations/get.js +61 -0
- package/dist/cjs/state/translations/get.js.map +1 -0
- package/dist/cjs/state/translations/merge.js +91 -0
- package/dist/cjs/state/translations/merge.js.map +1 -0
- package/dist/cjs/state/unified-state.js +17 -0
- package/dist/cjs/state/unified-state.js.map +1 -0
- package/dist/cjs/translations/index.js +32 -0
- package/dist/cjs/translations/index.js.map +1 -0
- package/dist/cjs/utils/deferred.js +39 -0
- package/dist/cjs/utils/deferred.js.map +1 -0
- package/dist/cjs/utils/ref-counted-map.js +120 -0
- package/dist/cjs/utils/ref-counted-map.js.map +1 -0
- package/dist/esm/api/api-resources-client.js +127 -0
- package/dist/esm/api/api-resources-client.js.map +1 -0
- package/dist/esm/api/client.js +67 -0
- package/dist/esm/api/client.js.map +1 -0
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/api-handler/handlers/webhook/diff-projection.js +38 -0
- package/dist/esm/api-handler/handlers/webhook/diff-projection.js.map +1 -0
- package/dist/esm/builder/breakpoints/index.js +9 -0
- package/dist/esm/builder/breakpoints/index.js.map +1 -0
- package/dist/esm/builder/core/index.js +35 -0
- package/dist/esm/builder/core/index.js.map +1 -0
- package/dist/esm/builder/host-api.js +31 -0
- package/dist/esm/builder/host-api.js.map +1 -0
- package/dist/esm/builder/host-to-builder-actions.js +18 -0
- package/dist/esm/builder/host-to-builder-actions.js.map +1 -0
- package/dist/esm/builder/serialization.js +59 -0
- package/dist/esm/builder/serialization.js.map +1 -0
- package/dist/esm/components/builtin/Carousel/Carousel.js +1 -4
- package/dist/esm/components/builtin/Carousel/Carousel.js.map +1 -1
- package/dist/esm/controls/control.js +1 -3
- package/dist/esm/controls/control.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js +17 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/translation.js +152 -0
- package/dist/esm/controls/rich-text-v2/translation.js.map +1 -0
- package/dist/esm/controls/serialization/base/index.js +78 -0
- package/dist/esm/controls/serialization/base/index.js.map +1 -0
- package/dist/esm/controls/serialization/base/visitor.js +39 -0
- package/dist/esm/controls/serialization/base/visitor.js.map +1 -0
- package/dist/esm/controls/serialization/index.js +30 -0
- package/dist/esm/controls/serialization/index.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/function-serialization.js +52 -0
- package/dist/esm/controls/serialization/message-port/function-serialization.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/index.js +3 -0
- package/dist/esm/controls/serialization/message-port/index.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/visitor.js +24 -0
- package/dist/esm/controls/serialization/message-port/visitor.js.map +1 -0
- package/dist/esm/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.js +53 -0
- package/dist/esm/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.js.map +1 -0
- package/dist/esm/controls/visitors/message-port-serializer/function-serialization.js +52 -0
- package/dist/esm/controls/visitors/message-port-serializer/function-serialization.js.map +1 -0
- package/dist/esm/controls/visitors/message-port-serializer/index.js +13 -0
- package/dist/esm/controls/visitors/message-port-serializer/index.js.map +1 -0
- package/dist/esm/next/api-handler/config/pages-router.js +1 -1
- package/dist/esm/next/api-handler/config/pages-router.js.map +1 -1
- package/dist/esm/next/components/tests/makeswift-component/fixtures.js +60 -0
- package/dist/esm/next/components/tests/makeswift-component/fixtures.js.map +1 -0
- package/dist/esm/next/fetch.js +6 -0
- package/dist/esm/next/fetch.js.map +1 -0
- package/dist/esm/next/runtime.js +11 -0
- package/dist/esm/next/runtime.js.map +1 -0
- package/dist/esm/next/testing/react-runtime.js +5 -0
- package/dist/esm/next/testing/react-runtime.js.map +1 -0
- package/dist/esm/prop-controllers/serialization.js +338 -0
- package/dist/esm/prop-controllers/serialization.js.map +1 -0
- package/dist/esm/react/builtins/box.js +7 -0
- package/dist/esm/react/builtins/box.js.map +1 -0
- package/dist/esm/react/builtins/button.js +7 -0
- package/dist/esm/react/builtins/button.js.map +1 -0
- package/dist/esm/react/builtins/carousel.js +7 -0
- package/dist/esm/react/builtins/carousel.js.map +1 -0
- package/dist/esm/react/builtins/countdown.js +7 -0
- package/dist/esm/react/builtins/countdown.js.map +1 -0
- package/dist/esm/react/builtins/divider.js +7 -0
- package/dist/esm/react/builtins/divider.js.map +1 -0
- package/dist/esm/react/builtins/embed.js +7 -0
- package/dist/esm/react/builtins/embed.js.map +1 -0
- package/dist/esm/react/builtins/form.js +7 -0
- package/dist/esm/react/builtins/form.js.map +1 -0
- package/dist/esm/react/builtins/image.js +7 -0
- package/dist/esm/react/builtins/image.js.map +1 -0
- package/dist/esm/react/builtins/index.js +5 -0
- package/dist/esm/react/builtins/index.js.map +1 -0
- package/dist/esm/react/builtins/navigation.js +7 -0
- package/dist/esm/react/builtins/navigation.js.map +1 -0
- package/dist/esm/react/builtins/root.js +7 -0
- package/dist/esm/react/builtins/root.js.map +1 -0
- package/dist/esm/react/builtins/slot.js +7 -0
- package/dist/esm/react/builtins/slot.js.map +1 -0
- package/dist/esm/react/builtins/social-links.js +7 -0
- package/dist/esm/react/builtins/social-links.js.map +1 -0
- package/dist/esm/react/builtins/text.js +7 -0
- package/dist/esm/react/builtins/text.js.map +1 -0
- package/dist/esm/react/builtins/video.js +7 -0
- package/dist/esm/react/builtins/video.js.map +1 -0
- package/dist/esm/react/core/index.js +5 -0
- package/dist/esm/react/core/index.js.map +1 -0
- package/dist/esm/react/index.js +5 -0
- package/dist/esm/react/index.js.map +1 -0
- package/dist/esm/runtimes/react/components/GoogleFontLink.js +35 -0
- package/dist/esm/runtimes/react/components/GoogleFontLink.js.map +1 -0
- package/dist/esm/runtimes/react/components/MakeswiftFonts.js +9 -0
- package/dist/esm/runtimes/react/components/MakeswiftFonts.js.map +1 -0
- package/dist/esm/runtimes/react/components/activity-with-fallback.js +19 -0
- package/dist/esm/runtimes/react/components/activity-with-fallback.js.map +1 -0
- package/dist/esm/runtimes/react/components/page/index.js +16 -4
- package/dist/esm/runtimes/react/components/page/index.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-async-effect.js +31 -0
- package/dist/esm/runtimes/react/hooks/use-async-effect.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-builtin-suspense.js +9 -0
- package/dist/esm/runtimes/react/hooks/use-builtin-suspense.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js +15 -0
- package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-is-read-only.js +9 -0
- package/dist/esm/runtimes/react/hooks/use-is-read-only.js.map +1 -0
- package/dist/esm/runtimes/react/lib/resolved-style-to-css.js +38 -0
- package/dist/esm/runtimes/react/lib/resolved-style-to-css.js.map +1 -0
- package/dist/esm/runtimes/react/react-runtime-core.js +51 -0
- package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -0
- package/dist/esm/runtimes/react/resource-resolver.js +28 -0
- package/dist/esm/runtimes/react/resource-resolver.js.map +1 -0
- package/dist/esm/runtimes/react/testing/react-runtime.js +9 -0
- package/dist/esm/runtimes/react/testing/react-runtime.js.map +1 -0
- package/dist/esm/runtimes/react/utils/google-fonts-url.js +23 -0
- package/dist/esm/runtimes/react/utils/google-fonts-url.js.map +1 -0
- package/dist/esm/state/actions/index.js +17 -0
- package/dist/esm/state/actions/index.js.map +1 -0
- package/dist/esm/state/actions/internal/index.js +10 -0
- package/dist/esm/state/actions/internal/index.js.map +1 -0
- package/dist/esm/state/actions/internal/read-only-actions.js +153 -0
- package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -0
- package/dist/esm/state/actions/internal/read-write-actions.js +46 -0
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -0
- package/dist/esm/state/actions/internal.js +162 -0
- package/dist/esm/state/actions/internal.js.map +1 -0
- package/dist/esm/state/api-client/client-store.js +49 -0
- package/dist/esm/state/api-client/client-store.js.map +1 -0
- package/dist/esm/state/api-client/fetch-api-resource.js +93 -0
- package/dist/esm/state/api-client/fetch-api-resource.js.map +1 -0
- package/dist/esm/state/api-client/state.js +52 -0
- package/dist/esm/state/api-client/state.js.map +1 -0
- package/dist/esm/state/api-client/store.js +12 -0
- package/dist/esm/state/api-client/store.js.map +1 -0
- package/dist/esm/state/builder-api/actions.js +119 -0
- package/dist/esm/state/builder-api/actions.js.map +1 -0
- package/dist/esm/state/builder-api/api.js +1 -0
- package/dist/esm/state/builder-api/api.js.map +1 -0
- package/dist/esm/state/builder-api/message-channel.js +74 -0
- package/dist/esm/state/builder-api/message-channel.js.map +1 -0
- package/dist/esm/state/builder-api/navigation-listener.js +86 -0
- package/dist/esm/state/builder-api/navigation-listener.js.map +1 -0
- package/dist/esm/state/builder-api/proxy.js +48 -0
- package/dist/esm/state/builder-api/proxy.js.map +1 -0
- package/dist/esm/state/host-api.js +81 -0
- package/dist/esm/state/host-api.js.map +1 -0
- package/dist/esm/state/middleware/makeswift-api-client-sync.js +13 -0
- package/dist/esm/state/middleware/makeswift-api-client-sync.js.map +1 -0
- package/dist/esm/state/middleware/read-only-element-tree.js +28 -0
- package/dist/esm/state/middleware/read-only-element-tree.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/element-size.js +16 -0
- package/dist/esm/state/middleware/read-write/builder-api/element-size.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js +61 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +254 -0
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -0
- package/dist/esm/state/middleware/read-write/index.js +16 -0
- package/dist/esm/state/middleware/read-write/index.js.map +1 -0
- package/dist/esm/state/middleware/read-write/measure-box-models.js +37 -0
- package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -0
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js +80 -0
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -0
- package/dist/esm/state/middleware/read-write/update-element-tree.js +35 -0
- package/dist/esm/state/middleware/read-write/update-element-tree.js.map +1 -0
- package/dist/esm/state/mixins/breakpoint-watch.js +48 -0
- package/dist/esm/state/mixins/breakpoint-watch.js.map +1 -0
- package/dist/esm/state/modules/is-read-only.js +24 -0
- package/dist/esm/state/modules/is-read-only.js.map +1 -0
- package/dist/esm/state/modules/locale.js +24 -0
- package/dist/esm/state/modules/locale.js.map +1 -0
- package/dist/esm/state/modules/read-write/box-models.js +114 -0
- package/dist/esm/state/modules/read-write/box-models.js.map +1 -0
- package/dist/esm/state/modules/read-write/element-imperative-handles.js +36 -0
- package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -0
- package/dist/esm/state/modules/read-write/pointer.js +23 -0
- package/dist/esm/state/modules/read-write/pointer.js.map +1 -0
- package/dist/esm/state/modules/read-write/read-write-documents.js +60 -0
- package/dist/esm/state/modules/read-write/read-write-documents.js.map +1 -0
- package/dist/esm/state/modules/site-version.js +21 -0
- package/dist/esm/state/modules/site-version.js.map +1 -0
- package/dist/esm/state/ops/copy-element-tree.js +37 -0
- package/dist/esm/state/ops/copy-element-tree.js.map +1 -0
- package/dist/esm/state/ops/merge-element.js +39 -0
- package/dist/esm/state/ops/merge-element.js.map +1 -0
- package/dist/esm/state/read-only-state.js +176 -0
- package/dist/esm/state/read-only-state.js.map +1 -0
- package/dist/esm/state/read-write-state.js +82 -0
- package/dist/esm/state/read-write-state.js.map +1 -0
- package/dist/esm/state/shared-api.js +35 -0
- package/dist/esm/state/shared-api.js.map +1 -0
- package/dist/esm/state/store.js +188 -0
- package/dist/esm/state/store.js.map +1 -0
- package/dist/esm/state/translations/get.js +27 -0
- package/dist/esm/state/translations/get.js.map +1 -0
- package/dist/esm/state/translations/merge.js +59 -0
- package/dist/esm/state/translations/merge.js.map +1 -0
- package/dist/esm/state/unified-state.js +1 -0
- package/dist/esm/state/unified-state.js.map +1 -0
- package/dist/esm/translations/index.js +7 -0
- package/dist/esm/translations/index.js.map +1 -0
- package/dist/esm/utils/deferred.js +15 -0
- package/dist/esm/utils/deferred.js.map +1 -0
- package/dist/esm/utils/ref-counted-map.js +96 -0
- package/dist/esm/utils/ref-counted-map.js.map +1 -0
- package/dist/types/api/api-resources-client.d.ts +57 -0
- package/dist/types/api/api-resources-client.d.ts.map +1 -0
- package/dist/types/api/client.d.ts +49 -0
- package/dist/types/api/client.d.ts.map +1 -0
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +201 -0
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts.map +1 -0
- package/dist/types/builder/breakpoints/index.d.ts +2 -0
- package/dist/types/builder/breakpoints/index.d.ts.map +1 -0
- package/dist/types/builder/core/index.d.ts +2 -0
- package/dist/types/builder/core/index.d.ts.map +1 -0
- package/dist/types/builder/host-api.d.ts +3 -0
- package/dist/types/builder/host-api.d.ts.map +1 -0
- package/dist/types/builder/host-to-builder-actions.d.ts +28 -0
- package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -0
- package/dist/types/builder/serialization.d.ts +23 -0
- package/dist/types/builder/serialization.d.ts.map +1 -0
- package/dist/types/builder/serialization.test.d.ts +2 -0
- package/dist/types/builder/serialization.test.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +11 -11
- package/dist/types/client/tests/client.get-component-snapshots.test.d.ts +2 -0
- package/dist/types/client/tests/client.get-component-snapshots.test.d.ts.map +1 -0
- package/dist/types/client/tests/client.get-fonts.test.d.ts +2 -0
- package/dist/types/client/tests/client.get-fonts.test.d.ts.map +1 -0
- package/dist/types/client/tests/client.introspect-many.test.d.ts +2 -0
- package/dist/types/client/tests/client.introspect-many.test.d.ts.map +1 -0
- package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts +3 -0
- package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts.map +1 -0
- package/dist/types/controls/control.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +12 -11
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/translation.d.ts +6 -0
- package/dist/types/controls/rich-text-v2/translation.d.ts.map +1 -0
- package/dist/types/controls/serialization/base/index.d.ts +10 -0
- package/dist/types/controls/serialization/base/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/base/visitor.d.ts +7 -0
- package/dist/types/controls/serialization/base/visitor.d.ts.map +1 -0
- package/dist/types/controls/serialization/index.d.ts +10 -0
- package/dist/types/controls/serialization/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts +16 -0
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts +2 -0
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/index.d.ts +3 -0
- package/dist/types/controls/serialization/message-port/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/visitor.d.ts +7 -0
- package/dist/types/controls/serialization/message-port/visitor.d.ts.map +1 -0
- package/dist/types/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.d.ts +9 -0
- package/dist/types/controls/visitors/message-port-serializer/client-message-port-serialization-visitor.d.ts.map +1 -0
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.d.ts +16 -0
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.d.ts.map +1 -0
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.test.d.ts +2 -0
- package/dist/types/controls/visitors/message-port-serializer/function-serialization.test.d.ts.map +1 -0
- package/dist/types/controls/visitors/message-port-serializer/index.d.ts +3 -0
- package/dist/types/controls/visitors/message-port-serializer/index.d.ts.map +1 -0
- package/dist/types/next/api-handler/config/pages-router.test.d.ts +2 -0
- package/dist/types/next/api-handler/config/pages-router.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/controls/code-control.test.d.ts +2 -0
- package/dist/types/next/components/tests/controls/code-control.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts +27 -0
- package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts.map +1 -0
- package/dist/types/next/components/tests/makeswift-component/rendering.react18.test.d.ts +3 -0
- package/dist/types/next/components/tests/makeswift-component/rendering.react18.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/makeswift-component/rendering.test.d.ts +3 -0
- package/dist/types/next/components/tests/makeswift-component/rendering.test.d.ts.map +1 -0
- package/dist/types/next/fetch.d.ts +3 -0
- package/dist/types/next/fetch.d.ts.map +1 -0
- package/dist/types/next/runtime.d.ts +10 -0
- package/dist/types/next/runtime.d.ts.map +1 -0
- package/dist/types/next/testing/react-runtime.d.ts +2 -0
- package/dist/types/next/testing/react-runtime.d.ts.map +1 -0
- package/dist/types/prop-controllers/serialization.d.ts +228 -0
- package/dist/types/prop-controllers/serialization.d.ts.map +1 -0
- package/dist/types/react/builtins/box.d.ts +3 -0
- package/dist/types/react/builtins/box.d.ts.map +1 -0
- package/dist/types/react/builtins/button.d.ts +3 -0
- package/dist/types/react/builtins/button.d.ts.map +1 -0
- package/dist/types/react/builtins/carousel.d.ts +3 -0
- package/dist/types/react/builtins/carousel.d.ts.map +1 -0
- package/dist/types/react/builtins/countdown.d.ts +3 -0
- package/dist/types/react/builtins/countdown.d.ts.map +1 -0
- package/dist/types/react/builtins/divider.d.ts +3 -0
- package/dist/types/react/builtins/divider.d.ts.map +1 -0
- package/dist/types/react/builtins/embed.d.ts +3 -0
- package/dist/types/react/builtins/embed.d.ts.map +1 -0
- package/dist/types/react/builtins/form.d.ts +3 -0
- package/dist/types/react/builtins/form.d.ts.map +1 -0
- package/dist/types/react/builtins/image.d.ts +3 -0
- package/dist/types/react/builtins/image.d.ts.map +1 -0
- package/dist/types/react/builtins/index.d.ts +2 -0
- package/dist/types/react/builtins/index.d.ts.map +1 -0
- package/dist/types/react/builtins/navigation.d.ts +3 -0
- package/dist/types/react/builtins/navigation.d.ts.map +1 -0
- package/dist/types/react/builtins/root.d.ts +3 -0
- package/dist/types/react/builtins/root.d.ts.map +1 -0
- package/dist/types/react/builtins/slot.d.ts +3 -0
- package/dist/types/react/builtins/slot.d.ts.map +1 -0
- package/dist/types/react/builtins/social-links.d.ts +3 -0
- package/dist/types/react/builtins/social-links.d.ts.map +1 -0
- package/dist/types/react/builtins/text.d.ts +3 -0
- package/dist/types/react/builtins/text.d.ts.map +1 -0
- package/dist/types/react/builtins/video.d.ts +3 -0
- package/dist/types/react/builtins/video.d.ts.map +1 -0
- package/dist/types/react/core/index.d.ts +2 -0
- package/dist/types/react/core/index.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/GoogleFontLink.d.ts +14 -0
- package/dist/types/runtimes/react/components/GoogleFontLink.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts +7 -0
- package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/activity-with-fallback.d.ts +13 -0
- package/dist/types/runtimes/react/components/activity-with-fallback.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/page/index.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/__tests__/use-async-effect.test.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/__tests__/use-async-effect.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-async-effect.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-async-effect.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-builtin-suspense.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/use-builtin-suspense.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-is-read-only.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/use-is-read-only.d.ts.map +1 -0
- package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts +4 -0
- package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts.map +1 -0
- package/dist/types/runtimes/react/react-runtime-core.d.ts +24 -0
- package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -0
- package/dist/types/runtimes/react/resource-resolver.d.ts +10 -0
- package/dist/types/runtimes/react/resource-resolver.d.ts.map +1 -0
- package/dist/types/runtimes/react/testing/react-runtime.d.ts +6 -0
- package/dist/types/runtimes/react/testing/react-runtime.d.ts.map +1 -0
- package/dist/types/runtimes/react/utils/google-fonts-url.d.ts +6 -0
- package/dist/types/runtimes/react/utils/google-fonts-url.d.ts.map +1 -0
- package/dist/types/slate/BlockPlugin/index.d.ts +13 -1
- package/dist/types/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/InlinePlugin/index.d.ts +13 -1
- package/dist/types/slate/InlinePlugin/index.d.ts.map +1 -1
- package/dist/types/slate/LinkPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/TextAlignPlugin/index.d.ts +13 -1
- package/dist/types/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts +5 -0
- package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts.map +1 -0
- package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts +3 -0
- package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts.map +1 -0
- package/dist/types/state/__tests__/get-translatable-content.test.d.ts +2 -0
- package/dist/types/state/__tests__/get-translatable-content.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/merge-element-tree-translated-data.test.d.ts +2 -0
- package/dist/types/state/__tests__/merge-element-tree-translated-data.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/merge-element.test.d.ts +2 -0
- package/dist/types/state/__tests__/merge-element.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/store.read-write-state.test.d.ts +2 -0
- package/dist/types/state/__tests__/store.read-write-state.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/test-store.d.ts +31 -0
- package/dist/types/state/__tests__/test-store.d.ts.map +1 -0
- package/dist/types/state/actions/index.d.ts +61 -0
- package/dist/types/state/actions/index.d.ts.map +1 -0
- package/dist/types/state/actions/internal/index.d.ts +29 -0
- package/dist/types/state/actions/internal/index.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-only-actions.d.ts +171 -0
- package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-write-actions.d.ts +53 -0
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -0
- package/dist/types/state/actions/internal.d.ts +181 -0
- package/dist/types/state/actions/internal.d.ts.map +1 -0
- package/dist/types/state/api-client/client-store.d.ts +6 -0
- package/dist/types/state/api-client/client-store.d.ts.map +1 -0
- package/dist/types/state/api-client/fetch-api-resource.d.ts +11 -0
- package/dist/types/state/api-client/fetch-api-resource.d.ts.map +1 -0
- package/dist/types/state/api-client/state.d.ts +30 -0
- package/dist/types/state/api-client/state.d.ts.map +1 -0
- package/dist/types/state/api-client/store.d.ts +18 -0
- package/dist/types/state/api-client/store.d.ts.map +1 -0
- package/dist/types/state/builder-api/actions.d.ts +156 -0
- package/dist/types/state/builder-api/actions.d.ts.map +1 -0
- package/dist/types/state/builder-api/api.d.ts +9 -0
- package/dist/types/state/builder-api/api.d.ts.map +1 -0
- package/dist/types/state/builder-api/message-channel.d.ts +14 -0
- package/dist/types/state/builder-api/message-channel.d.ts.map +1 -0
- package/dist/types/state/builder-api/navigation-listener.d.ts +3 -0
- package/dist/types/state/builder-api/navigation-listener.d.ts.map +1 -0
- package/dist/types/state/builder-api/proxy.d.ts +16 -0
- package/dist/types/state/builder-api/proxy.d.ts.map +1 -0
- package/dist/types/state/host-api.d.ts +109 -0
- package/dist/types/state/host-api.d.ts.map +1 -0
- package/dist/types/state/middleware/makeswift-api-client-sync.d.ts +5 -0
- package/dist/types/state/middleware/makeswift-api-client-sync.d.ts.map +1 -0
- package/dist/types/state/middleware/read-only-element-tree.d.ts +4 -0
- package/dist/types/state/middleware/read-only-element-tree.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/element-size.d.ts +12 -0
- package/dist/types/state/middleware/read-write/builder-api/element-size.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/index.d.ts +5 -0
- package/dist/types/state/middleware/read-write/builder-api/index.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts +6 -0
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/index.d.ts +5 -0
- package/dist/types/state/middleware/read-write/index.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/measure-box-models.d.ts +4 -0
- package/dist/types/state/middleware/read-write/measure-box-models.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts +4 -0
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/update-element-tree.d.ts +4 -0
- package/dist/types/state/middleware/read-write/update-element-tree.d.ts.map +1 -0
- package/dist/types/state/mixins/breakpoint-watch.d.ts +11 -0
- package/dist/types/state/mixins/breakpoint-watch.d.ts.map +1 -0
- package/dist/types/state/modules/is-read-only.d.ts +6 -0
- package/dist/types/state/modules/is-read-only.d.ts.map +1 -0
- package/dist/types/state/modules/locale.d.ts +6 -0
- package/dist/types/state/modules/locale.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/box-models.d.ts +26 -0
- package/dist/types/state/modules/read-write/box-models.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/element-imperative-handles.d.ts +6 -0
- package/dist/types/state/modules/read-write/element-imperative-handles.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/pointer.d.ts +11 -0
- package/dist/types/state/modules/read-write/pointer.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/read-write-documents.d.ts +14 -0
- package/dist/types/state/modules/read-write/read-write-documents.d.ts.map +1 -0
- package/dist/types/state/modules/site-version.d.ts +7 -0
- package/dist/types/state/modules/site-version.d.ts.map +1 -0
- package/dist/types/state/ops/copy-element-tree.d.ts +37 -0
- package/dist/types/state/ops/copy-element-tree.d.ts.map +1 -0
- package/dist/types/state/ops/merge-element.d.ts +4 -0
- package/dist/types/state/ops/merge-element.d.ts.map +1 -0
- package/dist/types/state/read-only-state.d.ts +131 -0
- package/dist/types/state/read-only-state.d.ts.map +1 -0
- package/dist/types/state/read-write-state.d.ts +62 -0
- package/dist/types/state/read-write-state.d.ts.map +1 -0
- package/dist/types/state/shared-api.d.ts +50 -0
- package/dist/types/state/shared-api.d.ts.map +1 -0
- package/dist/types/state/store.d.ts +86 -0
- package/dist/types/state/store.d.ts.map +1 -0
- package/dist/types/state/translations/get.d.ts +4 -0
- package/dist/types/state/translations/get.d.ts.map +1 -0
- package/dist/types/state/translations/merge.d.ts +7 -0
- package/dist/types/state/translations/merge.d.ts.map +1 -0
- package/dist/types/state/unified-state.d.ts +9 -0
- package/dist/types/state/unified-state.d.ts.map +1 -0
- package/dist/types/translations/index.d.ts +6 -0
- package/dist/types/translations/index.d.ts.map +1 -0
- package/dist/types/utils/__tests__/ref-counted-map.test.d.ts +2 -0
- package/dist/types/utils/__tests__/ref-counted-map.test.d.ts.map +1 -0
- package/dist/types/utils/deferred.d.ts +7 -0
- package/dist/types/utils/deferred.d.ts.map +1 -0
- package/dist/types/utils/ref-counted-map.d.ts +32 -0
- package/dist/types/utils/ref-counted-map.d.ts.map +1 -0
- package/package.json +8 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const GOOGLE_FONTS_BASE = "https://fonts.googleapis.com/css";
|
|
2
|
+
function getGoogleFontsParamFromFonts(fonts) {
|
|
3
|
+
return fonts.map(({ family, variants }) => `${family.replace(/ /g, "+")}:${variants.join()}`).join("|");
|
|
4
|
+
}
|
|
5
|
+
function getGoogleFontsParamFromSite(site) {
|
|
6
|
+
return site.googleFonts.edges.filter((edge) => edge != null).map(({ activeVariants, node: { family, variants } }) => {
|
|
7
|
+
const activeVariantSpecifiers = variants.filter(
|
|
8
|
+
(variant) => activeVariants.some((activeVariant) => activeVariant.specifier === variant.specifier)
|
|
9
|
+
).map((variant) => variant.specifier).join();
|
|
10
|
+
return `${family.replace(/ /g, "+")}:${activeVariantSpecifiers}`;
|
|
11
|
+
}).join("|");
|
|
12
|
+
}
|
|
13
|
+
function getGoogleFontsUrl(param) {
|
|
14
|
+
if (param === "")
|
|
15
|
+
return "";
|
|
16
|
+
return `${GOOGLE_FONTS_BASE}?family=${param}&display=swap`;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
getGoogleFontsParamFromFonts,
|
|
20
|
+
getGoogleFontsParamFromSite,
|
|
21
|
+
getGoogleFontsUrl
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=google-fonts-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/utils/google-fonts-url.ts"],"sourcesContent":["import { type Site } from '../../../api'\nimport { type Font } from '../../../client'\n\n/*\n Much of the logic here is a duplicate of what's done for font management in the\n `PageHead` component.\n\n Right now these utils are being used by an experimental component (`GoogleFontLink`)\n that we don't yet want to put on the critical path for rendering Makeswift pages.\n*/\n\nconst GOOGLE_FONTS_BASE = 'https://fonts.googleapis.com/css'\n\nexport function getGoogleFontsParamFromFonts(fonts: Font[]): string {\n return fonts\n .map(({ family, variants }) => `${family.replace(/ /g, '+')}:${variants.join()}`)\n .join('|')\n}\n\nexport function getGoogleFontsParamFromSite(site: Site): string {\n return site.googleFonts.edges\n .filter((edge): edge is NonNullable<typeof edge> => edge != null)\n .map(({ activeVariants, node: { family, variants } }) => {\n const activeVariantSpecifiers = variants\n .filter(variant =>\n activeVariants.some(activeVariant => activeVariant.specifier === variant.specifier),\n )\n .map(variant => variant.specifier)\n .join()\n return `${family.replace(/ /g, '+')}:${activeVariantSpecifiers}`\n })\n .join('|')\n}\n\nexport function getGoogleFontsUrl(param: string): string {\n if (param === '') return ''\n return `${GOOGLE_FONTS_BASE}?family=${param}&display=swap`\n}\n"],"mappings":"AAWA,MAAM,oBAAoB;AAEnB,SAAS,6BAA6B,OAAuB;AAClE,SAAO,MACJ,IAAI,CAAC,EAAE,QAAQ,SAAS,MAAM,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,IAAI,SAAS,KAAK,CAAC,EAAE,EAC/E,KAAK,GAAG;AACb;AAEO,SAAS,4BAA4B,MAAoB;AAC9D,SAAO,KAAK,YAAY,MACrB,OAAO,CAAC,SAA2C,QAAQ,IAAI,EAC/D,IAAI,CAAC,EAAE,gBAAgB,MAAM,EAAE,QAAQ,SAAS,EAAE,MAAM;AACvD,UAAM,0BAA0B,SAC7B;AAAA,MAAO,aACN,eAAe,KAAK,mBAAiB,cAAc,cAAc,QAAQ,SAAS;AAAA,IACpF,EACC,IAAI,aAAW,QAAQ,SAAS,EAChC,KAAK;AACR,WAAO,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,IAAI,uBAAuB;AAAA,EAChE,CAAC,EACA,KAAK,GAAG;AACb;AAEO,SAAS,kBAAkB,OAAuB;AACvD,MAAI,UAAU;AAAI,WAAO;AACzB,SAAO,GAAG,iBAAiB,WAAW,KAAK;AAC7C;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isAction } from "@reduxjs/toolkit";
|
|
2
|
+
import { BuilderActionTypes } from "../builder-api/actions";
|
|
3
|
+
import { HostActionTypes } from "../host-api";
|
|
4
|
+
import { InternalActionTypes } from "./internal";
|
|
5
|
+
const ActionTypes = {
|
|
6
|
+
...HostActionTypes,
|
|
7
|
+
...BuilderActionTypes,
|
|
8
|
+
...InternalActionTypes
|
|
9
|
+
};
|
|
10
|
+
function isKnownAction(action) {
|
|
11
|
+
return isAction(action) && Object.hasOwn(ActionTypes, action.type);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
ActionTypes,
|
|
15
|
+
isKnownAction
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/actions/index.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\nimport { type BuilderAction, BuilderActionTypes } from '../builder-api/actions'\nimport { type HostAction, HostActionTypes } from '../host-api'\n\nimport { type InternalAction, InternalActionTypes } from './internal'\n\nexport { type UnknownAction } from '@reduxjs/toolkit'\nexport { type DocumentPayload } from '../shared-api'\n\nexport const ActionTypes = {\n ...HostActionTypes,\n ...BuilderActionTypes,\n ...InternalActionTypes,\n} as const\n\nexport type Action = HostAction | BuilderAction | InternalAction\n\nexport function isKnownAction(action: unknown): action is Action {\n return isAction(action) && Object.hasOwn(ActionTypes, action.type)\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,SAA6B,0BAA0B;AACvD,SAA0B,uBAAuB;AAEjD,SAA8B,2BAA2B;AAKlD,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,SAAS,cAAc,QAAmC;AAC/D,SAAO,SAAS,MAAM,KAAK,OAAO,OAAO,aAAa,OAAO,IAAI;AACnE;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReadOnlyActionTypes } from "./read-only-actions";
|
|
2
|
+
import { ReadWriteActionTypes } from "./read-write-actions";
|
|
3
|
+
const InternalActionTypes = {
|
|
4
|
+
...ReadOnlyActionTypes,
|
|
5
|
+
...ReadWriteActionTypes
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
InternalActionTypes
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/state/actions/internal/index.ts"],"sourcesContent":["import { type ReadOnlyAction, ReadOnlyActionTypes } from './read-only-actions'\nimport { type ReadWriteAction, ReadWriteActionTypes } from './read-write-actions'\n\nexport const InternalActionTypes = {\n ...ReadOnlyActionTypes,\n ...ReadWriteActionTypes,\n} as const\n\nexport type InternalAction = ReadOnlyAction | ReadWriteAction\n"],"mappings":"AAAA,SAA8B,2BAA2B;AACzD,SAA+B,4BAA4B;AAEpD,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { localeStringSchema } from "../../../locale";
|
|
2
|
+
const ReadOnlyActionTypes = {
|
|
3
|
+
// TODO: this one should be a read-write action and we should refuse
|
|
4
|
+
// to fetch resources on the client in read-only mode
|
|
5
|
+
API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
|
|
6
|
+
CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
|
|
7
|
+
DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
|
|
8
|
+
REGISTER_COMPONENT: "REGISTER_COMPONENT",
|
|
9
|
+
UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
|
|
10
|
+
REGISTER_COMPONENT_HANDLE: "REGISTER_COMPONENT_HANDLE",
|
|
11
|
+
UNREGISTER_COMPONENT_HANDLE: "UNREGISTER_COMPONENT_HANDLE",
|
|
12
|
+
REGISTER_PROP_CONTROLLERS: "REGISTER_PROP_CONTROLLERS",
|
|
13
|
+
UNREGISTER_PROP_CONTROLLERS: "UNREGISTER_PROP_CONTROLLERS",
|
|
14
|
+
REGISTER_PROP_CONTROLLERS_HANDLE: "REGISTER_PROP_CONTROLLERS_HANDLE",
|
|
15
|
+
UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE",
|
|
16
|
+
REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
|
|
17
|
+
UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
|
|
18
|
+
SET_BREAKPOINTS: "SET_BREAKPOINTS",
|
|
19
|
+
UPDATE_CLIENT_BREAKPOINT: "UPDATE_CLIENT_BREAKPOINT",
|
|
20
|
+
SET_LOCALE: "SET_LOCALE",
|
|
21
|
+
SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
|
|
22
|
+
SET_IS_READ_ONLY: "SET_IS_READ_ONLY"
|
|
23
|
+
};
|
|
24
|
+
function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
|
|
25
|
+
return {
|
|
26
|
+
type: ReadOnlyActionTypes.API_RESOURCE_FULFILLED,
|
|
27
|
+
payload: { resourceType, resourceId, resource, locale }
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function createElementTree(payload) {
|
|
31
|
+
return {
|
|
32
|
+
type: ReadOnlyActionTypes.CREATE_ELEMENT_TREE,
|
|
33
|
+
payload
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function deleteElementTree(payload) {
|
|
37
|
+
return { type: ReadOnlyActionTypes.DELETE_ELEMENT_TREE, payload };
|
|
38
|
+
}
|
|
39
|
+
function registerComponent(type, meta, propControllerDescriptors) {
|
|
40
|
+
return {
|
|
41
|
+
type: ReadOnlyActionTypes.REGISTER_COMPONENT,
|
|
42
|
+
payload: { type, meta, propControllerDescriptors }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function unregisterComponent(type) {
|
|
46
|
+
return { type: ReadOnlyActionTypes.UNREGISTER_COMPONENT, payload: { type } };
|
|
47
|
+
}
|
|
48
|
+
function registerComponentEffect(type, meta, propControllerDescriptors) {
|
|
49
|
+
return (dispatch) => {
|
|
50
|
+
dispatch(registerComponent(type, meta, propControllerDescriptors));
|
|
51
|
+
return () => {
|
|
52
|
+
dispatch(unregisterComponent(type));
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function registerComponentHandle(documentKey, elementKey, componentHandle) {
|
|
57
|
+
return {
|
|
58
|
+
type: ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE,
|
|
59
|
+
payload: { documentKey, elementKey, componentHandle }
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function unregisterComponentHandle(documentKey, elementKey) {
|
|
63
|
+
return {
|
|
64
|
+
type: ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE,
|
|
65
|
+
payload: { documentKey, elementKey }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function registerComponentHandleEffect(documentKey, elementKey, componentHandle) {
|
|
69
|
+
return (dispatch) => {
|
|
70
|
+
dispatch(registerComponentHandle(documentKey, elementKey, componentHandle));
|
|
71
|
+
return () => {
|
|
72
|
+
dispatch(unregisterComponentHandle(documentKey, elementKey));
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function registerPropControllersHandle(documentKey, elementKey, handle) {
|
|
77
|
+
return {
|
|
78
|
+
type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
|
|
79
|
+
payload: { documentKey, elementKey, handle }
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function unregisterPropControllersHandle(documentKey, elementKey) {
|
|
83
|
+
return {
|
|
84
|
+
type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
|
|
85
|
+
payload: { documentKey, elementKey }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function registerPropControllers(documentKey, elementKey, propControllers) {
|
|
89
|
+
return {
|
|
90
|
+
type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS,
|
|
91
|
+
payload: { documentKey, elementKey, propControllers }
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function unregisterPropControllers(documentKey, elementKey) {
|
|
95
|
+
return {
|
|
96
|
+
type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS,
|
|
97
|
+
payload: { documentKey, elementKey }
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function registerReactComponent(type, component) {
|
|
101
|
+
return { type: ReadOnlyActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
|
|
102
|
+
}
|
|
103
|
+
function unregisterReactComponent(type) {
|
|
104
|
+
return { type: ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
|
|
105
|
+
}
|
|
106
|
+
function registerReactComponentEffect(type, component) {
|
|
107
|
+
return (dispatch) => {
|
|
108
|
+
dispatch(registerReactComponent(type, component));
|
|
109
|
+
return () => {
|
|
110
|
+
dispatch(unregisterReactComponent(type));
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function setBreakpoints(breakpoints) {
|
|
115
|
+
return { type: ReadOnlyActionTypes.SET_BREAKPOINTS, payload: { breakpoints } };
|
|
116
|
+
}
|
|
117
|
+
function updateClientBreakpoint() {
|
|
118
|
+
return { type: ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT };
|
|
119
|
+
}
|
|
120
|
+
function setLocale(locale, pathname) {
|
|
121
|
+
return {
|
|
122
|
+
type: ReadOnlyActionTypes.SET_LOCALE,
|
|
123
|
+
payload: { locale: localeStringSchema.parse(locale.toString()), pathname }
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function setIsInBuilder(isInBuilder) {
|
|
127
|
+
return { type: ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
|
|
128
|
+
}
|
|
129
|
+
function setIsReadOnly(isReadOnly) {
|
|
130
|
+
return { type: ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly };
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
ReadOnlyActionTypes,
|
|
134
|
+
apiResourceFulfilled,
|
|
135
|
+
createElementTree,
|
|
136
|
+
deleteElementTree,
|
|
137
|
+
registerComponent,
|
|
138
|
+
registerComponentEffect,
|
|
139
|
+
registerComponentHandle,
|
|
140
|
+
registerComponentHandleEffect,
|
|
141
|
+
registerPropControllers,
|
|
142
|
+
registerPropControllersHandle,
|
|
143
|
+
registerReactComponentEffect,
|
|
144
|
+
setBreakpoints,
|
|
145
|
+
setIsInBuilder,
|
|
146
|
+
setIsReadOnly,
|
|
147
|
+
setLocale,
|
|
148
|
+
unregisterComponent,
|
|
149
|
+
unregisterPropControllers,
|
|
150
|
+
unregisterPropControllersHandle,
|
|
151
|
+
updateClientBreakpoint
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=read-only-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/state/actions/internal/read-only-actions.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { ControlInstance } from '@makeswift/controls'\n\nimport { ElementImperativeHandle } from '../../../runtimes/react/element-imperative-handle'\n\nimport { type APIResource, APIResourceType, APIResourceLocale } from '../../../api/types'\nimport { type Descriptor as PropControllerDescriptor } from '../../../prop-controllers/descriptors'\n\nimport { type Breakpoints } from '../../modules/breakpoints'\nimport { type ComponentMeta } from '../../modules/components-meta'\nimport { type PropControllersHandle } from '../../modules/prop-controller-handles'\nimport { type ComponentType } from '../../modules/react-components'\nimport { type DescriptorsByComponentType } from '../../modules/prop-controllers'\n\nimport { type LocaleString, localeStringSchema } from '../../../locale'\nimport { type DocumentPayload } from '../../shared-api'\n\nexport const ReadOnlyActionTypes = {\n // TODO: this one should be a read-write action and we should refuse\n // to fetch resources on the client in read-only mode\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n CREATE_ELEMENT_TREE: 'CREATE_ELEMENT_TREE',\n DELETE_ELEMENT_TREE: 'DELETE_ELEMENT_TREE',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n REGISTER_COMPONENT_HANDLE: 'REGISTER_COMPONENT_HANDLE',\n UNREGISTER_COMPONENT_HANDLE: 'UNREGISTER_COMPONENT_HANDLE',\n\n REGISTER_PROP_CONTROLLERS: 'REGISTER_PROP_CONTROLLERS',\n UNREGISTER_PROP_CONTROLLERS: 'UNREGISTER_PROP_CONTROLLERS',\n REGISTER_PROP_CONTROLLERS_HANDLE: 'REGISTER_PROP_CONTROLLERS_HANDLE',\n UNREGISTER_PROP_CONTROLLERS_HANDLE: 'UNREGISTER_PROP_CONTROLLERS_HANDLE',\n\n REGISTER_REACT_COMPONENT: 'REGISTER_REACT_COMPONENT',\n UNREGISTER_REACT_COMPONENT: 'UNREGISTER_REACT_COMPONENT',\n\n SET_BREAKPOINTS: 'SET_BREAKPOINTS',\n UPDATE_CLIENT_BREAKPOINT: 'UPDATE_CLIENT_BREAKPOINT',\n\n SET_LOCALE: 'SET_LOCALE',\n\n SET_IS_IN_BUILDER: 'SET_IS_IN_BUILDER',\n SET_IS_READ_ONLY: 'SET_IS_READ_ONLY',\n} as const\n\ntype APIResourceFulfilledAction = {\n type: typeof ReadOnlyActionTypes.API_RESOURCE_FULFILLED\n payload: {\n resourceType: APIResourceType\n resourceId: string\n resource: APIResource | null\n locale?: string | null\n }\n}\n\ntype CreateElementTreeAction = {\n type: typeof ReadOnlyActionTypes.CREATE_ELEMENT_TREE\n payload: { document: DocumentPayload; descriptors: DescriptorsByComponentType }\n}\n\ntype DeleteElementTreeAction = {\n type: typeof ReadOnlyActionTypes.DELETE_ELEMENT_TREE\n payload: { documentKey: string }\n}\n\nexport type RegisterComponentAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n propControllerDescriptors: Record<string, PropControllerDescriptor>\n }\n}\n\nexport type UnregisterComponentAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterComponentHandleAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string; componentHandle: ElementImperativeHandle }\n}\n\ntype UnregisterComponentHandleAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersHandleAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string; handle: PropControllersHandle }\n}\n\ntype UnregisterPropControllersHandleAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS\n payload: {\n documentKey: string\n elementKey: string\n propControllers: Record<string, ControlInstance>\n }\n}\n\ntype UnregisterPropControllersAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterReactComponentAction = {\n type: typeof ReadOnlyActionTypes.REGISTER_REACT_COMPONENT\n payload: { type: string; component: ComponentType }\n}\n\ntype UnregisterReactComponentAction = {\n type: typeof ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT\n payload: { type: string }\n}\n\nexport type SetBreakpointsAction = {\n type: typeof ReadOnlyActionTypes.SET_BREAKPOINTS\n payload: { breakpoints: Breakpoints }\n}\n\ntype UpdateClientBreakpointAction = {\n type: typeof ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT\n}\n\nexport type SetLocaleAction = {\n type: typeof ReadOnlyActionTypes.SET_LOCALE\n payload: { locale: LocaleString; pathname?: string }\n}\n\ntype SetIsInBuilderAction = {\n type: typeof ReadOnlyActionTypes.SET_IS_IN_BUILDER\n payload: boolean\n}\n\ntype SetIsReadOnlyAction = {\n type: typeof ReadOnlyActionTypes.SET_IS_READ_ONLY\n payload: boolean\n}\n\nexport type ReadOnlyAction =\n | APIResourceFulfilledAction\n | CreateElementTreeAction\n | DeleteElementTreeAction\n | RegisterComponentAction\n | UnregisterComponentAction\n | RegisterComponentHandleAction\n | UnregisterComponentHandleAction\n | RegisterPropControllersHandleAction\n | UnregisterPropControllersHandleAction\n | RegisterPropControllersAction\n | UnregisterPropControllersAction\n | RegisterReactComponentAction\n | UnregisterReactComponentAction\n | SetBreakpointsAction\n | UpdateClientBreakpointAction\n | SetLocaleAction\n | SetIsInBuilderAction\n | SetIsReadOnlyAction\n\nexport function apiResourceFulfilled<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n resource: APIResource | null,\n locale?: APIResourceLocale<T>,\n): APIResourceFulfilledAction {\n return {\n type: ReadOnlyActionTypes.API_RESOURCE_FULFILLED,\n payload: { resourceType, resourceId, resource, locale },\n }\n}\n\nexport function createElementTree(\n payload: CreateElementTreeAction['payload'],\n): CreateElementTreeAction {\n return {\n type: ReadOnlyActionTypes.CREATE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function deleteElementTree(\n payload: DeleteElementTreeAction['payload'],\n): DeleteElementTreeAction {\n return { type: ReadOnlyActionTypes.DELETE_ELEMENT_TREE, payload }\n}\n\nexport function registerComponent(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): RegisterComponentAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_COMPONENT,\n payload: { type, meta, propControllerDescriptors },\n }\n}\n\nexport function unregisterComponent(type: string): UnregisterComponentAction {\n return { type: ReadOnlyActionTypes.UNREGISTER_COMPONENT, payload: { type } }\n}\n\nexport function registerComponentEffect(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): ThunkAction<() => void, unknown, unknown, ReadOnlyAction> {\n return dispatch => {\n dispatch(registerComponent(type, meta, propControllerDescriptors))\n\n return () => {\n dispatch(unregisterComponent(type))\n }\n }\n}\n\nexport function registerComponentHandle(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): RegisterComponentHandleAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey, componentHandle },\n }\n}\n\nfunction unregisterComponentHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterComponentHandleAction {\n return {\n type: ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerComponentHandleEffect(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): ThunkAction<() => void, unknown, unknown, ReadOnlyAction> {\n return dispatch => {\n dispatch(registerComponentHandle(documentKey, elementKey, componentHandle))\n\n return () => {\n dispatch(unregisterComponentHandle(documentKey, elementKey))\n }\n }\n}\n\nexport function registerPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllersHandle,\n): RegisterPropControllersHandleAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey, handle },\n }\n}\n\nexport function unregisterPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersHandleAction {\n return {\n type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerPropControllers(\n documentKey: string,\n elementKey: string,\n propControllers: Record<string, ControlInstance>,\n): RegisterPropControllersAction {\n return {\n type: ReadOnlyActionTypes.REGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey, propControllers },\n }\n}\n\nexport function unregisterPropControllers(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersAction {\n return {\n type: ReadOnlyActionTypes.UNREGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey },\n }\n}\n\nfunction registerReactComponent(\n type: string,\n component: ComponentType,\n): RegisterReactComponentAction {\n return { type: ReadOnlyActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } }\n}\n\nfunction unregisterReactComponent(type: string): UnregisterReactComponentAction {\n return { type: ReadOnlyActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } }\n}\n\nexport function registerReactComponentEffect(\n type: string,\n component: ComponentType,\n): ThunkAction<() => void, unknown, unknown, ReadOnlyAction> {\n return dispatch => {\n dispatch(registerReactComponent(type, component))\n\n return () => {\n dispatch(unregisterReactComponent(type))\n }\n }\n}\n\nexport function setBreakpoints(breakpoints: Breakpoints): SetBreakpointsAction {\n return { type: ReadOnlyActionTypes.SET_BREAKPOINTS, payload: { breakpoints } }\n}\n\nexport function updateClientBreakpoint(): UpdateClientBreakpointAction {\n return { type: ReadOnlyActionTypes.UPDATE_CLIENT_BREAKPOINT }\n}\n\nexport function setLocale(locale: Intl.Locale, pathname?: string): SetLocaleAction {\n return {\n type: ReadOnlyActionTypes.SET_LOCALE,\n payload: { locale: localeStringSchema.parse(locale.toString()), pathname },\n }\n}\n\nexport function setIsInBuilder(isInBuilder: boolean): SetIsInBuilderAction {\n return { type: ReadOnlyActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder }\n}\n\nexport function setIsReadOnly(isReadOnly: boolean): SetIsReadOnlyAction {\n return { type: ReadOnlyActionTypes.SET_IS_READ_ONLY, payload: isReadOnly }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const ReadWriteActionTypes = {
|
|
2
|
+
CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE",
|
|
3
|
+
REGISTER_MEASURABLE: "REGISTER_MEASURABLE",
|
|
4
|
+
UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE",
|
|
5
|
+
UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE",
|
|
6
|
+
CLEAR_API_CLIENT_CACHE: "CLEAR_API_CLIENT_CACHE"
|
|
7
|
+
};
|
|
8
|
+
function changeElementTree(payload) {
|
|
9
|
+
return {
|
|
10
|
+
type: ReadWriteActionTypes.CHANGE_ELEMENT_TREE,
|
|
11
|
+
payload
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function registerMeasurable(documentKey, elementKey, measurable) {
|
|
15
|
+
return {
|
|
16
|
+
type: ReadWriteActionTypes.REGISTER_MEASURABLE,
|
|
17
|
+
payload: { documentKey, elementKey, measurable }
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function unregisterMeasurable(documentKey, elementKey) {
|
|
21
|
+
return { type: ReadWriteActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } };
|
|
22
|
+
}
|
|
23
|
+
function registerMeasurableEffect(documentKey, elementKey, measurable) {
|
|
24
|
+
return (dispatch) => {
|
|
25
|
+
dispatch(registerMeasurable(documentKey, elementKey, measurable));
|
|
26
|
+
return () => {
|
|
27
|
+
dispatch(unregisterMeasurable(documentKey, elementKey));
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function updateAPIClientCache(payload) {
|
|
32
|
+
return { type: ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE, payload };
|
|
33
|
+
}
|
|
34
|
+
function clearAPIClientCache() {
|
|
35
|
+
return { type: ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE };
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
ReadWriteActionTypes,
|
|
39
|
+
changeElementTree,
|
|
40
|
+
clearAPIClientCache,
|
|
41
|
+
registerMeasurable,
|
|
42
|
+
registerMeasurableEffect,
|
|
43
|
+
unregisterMeasurable,
|
|
44
|
+
updateAPIClientCache
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=read-write-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { type Measurable } from '../../modules/read-write/box-models'\nimport { type DescriptorsByComponentType } from '../../modules/prop-controllers'\n\nimport { type DocumentPayload } from '../../shared-api'\nimport { type SerializedState as APIClientCache } from '../../api-client/state'\n\nexport const ReadWriteActionTypes = {\n CHANGE_ELEMENT_TREE: 'CHANGE_ELEMENT_TREE',\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n UPDATE_API_CLIENT_CACHE: 'UPDATE_API_CLIENT_CACHE',\n CLEAR_API_CLIENT_CACHE: 'CLEAR_API_CLIENT_CACHE',\n} as const\n\ntype ChangeElementTreeAction = {\n type: typeof ReadWriteActionTypes.CHANGE_ELEMENT_TREE\n payload: {\n oldDocument: DocumentPayload\n newDocument: DocumentPayload\n descriptors: DescriptorsByComponentType\n operation: Operation\n }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof ReadWriteActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof ReadWriteActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype UpdateAPIClientCache = {\n type: typeof ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE\n payload: APIClientCache\n}\n\ntype ClearAPIClientCache = {\n type: typeof ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE\n}\n\nexport type ReadWriteAction =\n | ChangeElementTreeAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | UpdateAPIClientCache\n | ClearAPIClientCache\n\nexport function changeElementTree(\n payload: ChangeElementTreeAction['payload'],\n): ChangeElementTreeAction {\n return {\n type: ReadWriteActionTypes.CHANGE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return {\n type: ReadWriteActionTypes.REGISTER_MEASURABLE,\n payload: { documentKey, elementKey, measurable },\n }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: ReadWriteActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, ReadWriteAction> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function updateAPIClientCache(payload: APIClientCache): UpdateAPIClientCache {\n return { type: ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE, payload }\n}\n\nexport function clearAPIClientCache(): ClearAPIClientCache {\n return { type: ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE }\n}\n"],"mappings":"AASO,MAAM,uBAAuB;AAAA,EAClC,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EAEvB,yBAAyB;AAAA,EACzB,wBAAwB;AAC1B;AAsCO,SAAS,kBACd,SACyB;AACzB,SAAO;AAAA,IACL,MAAM,qBAAqB;AAAA,IAC3B;AAAA,EACF;AACF;AAEO,SAAS,mBACd,aACA,YACA,YAC0B;AAC1B,SAAO;AAAA,IACL,MAAM,qBAAqB;AAAA,IAC3B,SAAS,EAAE,aAAa,YAAY,WAAW;AAAA,EACjD;AACF;AAEO,SAAS,qBACd,aACA,YAC4B;AAC5B,SAAO,EAAE,MAAM,qBAAqB,uBAAuB,SAAS,EAAE,aAAa,WAAW,EAAE;AAClG;AAEO,SAAS,yBACd,aACA,YACA,YAC4D;AAC5D,SAAO,cAAY;AACjB,aAAS,mBAAmB,aAAa,YAAY,UAAU,CAAC;AAEhE,WAAO,MAAM;AACX,eAAS,qBAAqB,aAAa,UAAU,CAAC;AAAA,IACxD;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA+C;AAClF,SAAO,EAAE,MAAM,qBAAqB,yBAAyB,QAAQ;AACvE;AAEO,SAAS,sBAA2C;AACzD,SAAO,EAAE,MAAM,qBAAqB,uBAAuB;AAC7D;","names":[]}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const InternalActionTypes = {
|
|
2
|
+
API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED",
|
|
3
|
+
CREATE_ELEMENT_TREE: "CREATE_ELEMENT_TREE",
|
|
4
|
+
DELETE_ELEMENT_TREE: "DELETE_ELEMENT_TREE",
|
|
5
|
+
CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE",
|
|
6
|
+
REGISTER_COMPONENT: "REGISTER_COMPONENT",
|
|
7
|
+
UNREGISTER_COMPONENT: "UNREGISTER_COMPONENT",
|
|
8
|
+
REGISTER_COMPONENT_HANDLE: "REGISTER_COMPONENT_HANDLE",
|
|
9
|
+
UNREGISTER_COMPONENT_HANDLE: "UNREGISTER_COMPONENT_HANDLE",
|
|
10
|
+
REGISTER_MEASURABLE: "REGISTER_MEASURABLE",
|
|
11
|
+
UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE",
|
|
12
|
+
REGISTER_PROP_CONTROLLERS: "REGISTER_PROP_CONTROLLERS",
|
|
13
|
+
UNREGISTER_PROP_CONTROLLERS: "UNREGISTER_PROP_CONTROLLERS",
|
|
14
|
+
REGISTER_PROP_CONTROLLERS_HANDLE: "REGISTER_PROP_CONTROLLERS_HANDLE",
|
|
15
|
+
UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE",
|
|
16
|
+
REGISTER_REACT_COMPONENT: "REGISTER_REACT_COMPONENT",
|
|
17
|
+
UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT",
|
|
18
|
+
SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER",
|
|
19
|
+
UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE"
|
|
20
|
+
};
|
|
21
|
+
function apiResourceFulfilled(resourceType, resourceId, resource, locale) {
|
|
22
|
+
return {
|
|
23
|
+
type: InternalActionTypes.API_RESOURCE_FULFILLED,
|
|
24
|
+
payload: { resourceType, resourceId, resource, locale }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function createElementTree(payload) {
|
|
28
|
+
return {
|
|
29
|
+
type: InternalActionTypes.CREATE_ELEMENT_TREE,
|
|
30
|
+
payload
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function deleteElementTree(payload) {
|
|
34
|
+
return { type: InternalActionTypes.DELETE_ELEMENT_TREE, payload };
|
|
35
|
+
}
|
|
36
|
+
function changeElementTree(payload) {
|
|
37
|
+
return {
|
|
38
|
+
type: InternalActionTypes.CHANGE_ELEMENT_TREE,
|
|
39
|
+
payload
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function registerComponent(type, meta, propControllerDescriptors) {
|
|
43
|
+
return {
|
|
44
|
+
type: InternalActionTypes.REGISTER_COMPONENT,
|
|
45
|
+
payload: { type, meta, propControllerDescriptors }
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function unregisterComponent(type) {
|
|
49
|
+
return { type: InternalActionTypes.UNREGISTER_COMPONENT, payload: { type } };
|
|
50
|
+
}
|
|
51
|
+
function registerComponentEffect(type, meta, propControllerDescriptors) {
|
|
52
|
+
return (dispatch) => {
|
|
53
|
+
dispatch(registerComponent(type, meta, propControllerDescriptors));
|
|
54
|
+
return () => {
|
|
55
|
+
dispatch(unregisterComponent(type));
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function registerComponentHandle(documentKey, elementKey, componentHandle) {
|
|
60
|
+
return {
|
|
61
|
+
type: InternalActionTypes.REGISTER_COMPONENT_HANDLE,
|
|
62
|
+
payload: { documentKey, elementKey, componentHandle }
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function unregisterComponentHandle(documentKey, elementKey) {
|
|
66
|
+
return {
|
|
67
|
+
type: InternalActionTypes.UNREGISTER_COMPONENT_HANDLE,
|
|
68
|
+
payload: { documentKey, elementKey }
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function registerComponentHandleEffect(documentKey, elementKey, componentHandle) {
|
|
72
|
+
return (dispatch) => {
|
|
73
|
+
dispatch(registerComponentHandle(documentKey, elementKey, componentHandle));
|
|
74
|
+
return () => {
|
|
75
|
+
dispatch(unregisterComponentHandle(documentKey, elementKey));
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function registerMeasurable(documentKey, elementKey, measurable) {
|
|
80
|
+
return {
|
|
81
|
+
type: InternalActionTypes.REGISTER_MEASURABLE,
|
|
82
|
+
payload: { documentKey, elementKey, measurable }
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function unregisterMeasurable(documentKey, elementKey) {
|
|
86
|
+
return { type: InternalActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } };
|
|
87
|
+
}
|
|
88
|
+
function registerMeasurableEffect(documentKey, elementKey, measurable) {
|
|
89
|
+
return (dispatch) => {
|
|
90
|
+
dispatch(registerMeasurable(documentKey, elementKey, measurable));
|
|
91
|
+
return () => {
|
|
92
|
+
dispatch(unregisterMeasurable(documentKey, elementKey));
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function registerPropControllersHandle(documentKey, elementKey, handle) {
|
|
97
|
+
return {
|
|
98
|
+
type: InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,
|
|
99
|
+
payload: { documentKey, elementKey, handle }
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function unregisterPropControllersHandle(documentKey, elementKey) {
|
|
103
|
+
return {
|
|
104
|
+
type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,
|
|
105
|
+
payload: { documentKey, elementKey }
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function registerPropControllers(documentKey, elementKey, propControllers) {
|
|
109
|
+
return {
|
|
110
|
+
type: InternalActionTypes.REGISTER_PROP_CONTROLLERS,
|
|
111
|
+
payload: { documentKey, elementKey, propControllers }
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function unregisterPropControllers(documentKey, elementKey) {
|
|
115
|
+
return {
|
|
116
|
+
type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS,
|
|
117
|
+
payload: { documentKey, elementKey }
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function registerReactComponent(type, component) {
|
|
121
|
+
return { type: InternalActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } };
|
|
122
|
+
}
|
|
123
|
+
function unregisterReactComponent(type) {
|
|
124
|
+
return { type: InternalActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } };
|
|
125
|
+
}
|
|
126
|
+
function registerReactComponentEffect(type, component) {
|
|
127
|
+
return (dispatch) => {
|
|
128
|
+
dispatch(registerReactComponent(type, component));
|
|
129
|
+
return () => {
|
|
130
|
+
dispatch(unregisterReactComponent(type));
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function setIsInBuilder(isInBuilder) {
|
|
135
|
+
return { type: InternalActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder };
|
|
136
|
+
}
|
|
137
|
+
function updateAPIClientCache(payload) {
|
|
138
|
+
return { type: InternalActionTypes.UPDATE_API_CLIENT_CACHE, payload };
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
InternalActionTypes,
|
|
142
|
+
apiResourceFulfilled,
|
|
143
|
+
changeElementTree,
|
|
144
|
+
createElementTree,
|
|
145
|
+
deleteElementTree,
|
|
146
|
+
registerComponent,
|
|
147
|
+
registerComponentEffect,
|
|
148
|
+
registerComponentHandle,
|
|
149
|
+
registerComponentHandleEffect,
|
|
150
|
+
registerMeasurable,
|
|
151
|
+
registerMeasurableEffect,
|
|
152
|
+
registerPropControllers,
|
|
153
|
+
registerPropControllersHandle,
|
|
154
|
+
registerReactComponentEffect,
|
|
155
|
+
setIsInBuilder,
|
|
156
|
+
unregisterComponent,
|
|
157
|
+
unregisterMeasurable,
|
|
158
|
+
unregisterPropControllers,
|
|
159
|
+
unregisterPropControllersHandle,
|
|
160
|
+
updateAPIClientCache
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/actions/internal.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { ControlInstance } from '@makeswift/controls'\n\nimport { ElementImperativeHandle } from '../../runtimes/react/element-imperative-handle'\n\nimport { type APIResource, APIResourceType, APIResourceLocale } from '../../api/types'\nimport { type Descriptor as PropControllerDescriptor } from '../../prop-controllers/descriptors'\n\nimport { type Measurable } from '../modules/box-models'\nimport { type ComponentMeta } from '../modules/components-meta'\nimport { type PropControllersHandle } from '../modules/prop-controller-handles'\nimport { type ComponentType } from '../modules/react-components'\nimport { type DescriptorsByComponentType } from '../modules/prop-controllers'\n\nimport { type DocumentPayload } from '../shared-api'\nimport { type SerializedState as APIClientCache } from '../makeswift-api-client'\n\nexport const InternalActionTypes = {\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n CREATE_ELEMENT_TREE: 'CREATE_ELEMENT_TREE',\n DELETE_ELEMENT_TREE: 'DELETE_ELEMENT_TREE',\n CHANGE_ELEMENT_TREE: 'CHANGE_ELEMENT_TREE',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n\n REGISTER_COMPONENT_HANDLE: 'REGISTER_COMPONENT_HANDLE',\n UNREGISTER_COMPONENT_HANDLE: 'UNREGISTER_COMPONENT_HANDLE',\n\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n REGISTER_PROP_CONTROLLERS: 'REGISTER_PROP_CONTROLLERS',\n UNREGISTER_PROP_CONTROLLERS: 'UNREGISTER_PROP_CONTROLLERS',\n\n REGISTER_PROP_CONTROLLERS_HANDLE: 'REGISTER_PROP_CONTROLLERS_HANDLE',\n UNREGISTER_PROP_CONTROLLERS_HANDLE: 'UNREGISTER_PROP_CONTROLLERS_HANDLE',\n\n REGISTER_REACT_COMPONENT: 'REGISTER_REACT_COMPONENT',\n UNREGISTER_REACT_COMPONENT: 'UNREGISTER_REACT_COMPONENT',\n\n SET_IS_IN_BUILDER: 'SET_IS_IN_BUILDER',\n\n UPDATE_API_CLIENT_CACHE: 'UPDATE_API_CLIENT_CACHE',\n} as const\n\ntype APIResourceFulfilledAction = {\n type: typeof InternalActionTypes.API_RESOURCE_FULFILLED\n payload: {\n resourceType: APIResourceType\n resourceId: string\n resource: APIResource | null\n locale?: string | null\n }\n}\n\ntype CreateElementTreeAction = {\n type: typeof InternalActionTypes.CREATE_ELEMENT_TREE\n payload: { document: DocumentPayload; descriptors: DescriptorsByComponentType }\n}\n\ntype DeleteElementTreeAction = {\n type: typeof InternalActionTypes.DELETE_ELEMENT_TREE\n payload: { documentKey: string }\n}\n\ntype ChangeElementTreeAction = {\n type: typeof InternalActionTypes.CHANGE_ELEMENT_TREE\n payload: {\n oldDocument: DocumentPayload\n newDocument: DocumentPayload\n descriptors: DescriptorsByComponentType\n operation: Operation\n }\n}\n\nexport type RegisterComponentAction = {\n type: typeof InternalActionTypes.REGISTER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n propControllerDescriptors: Record<string, PropControllerDescriptor>\n }\n}\n\nexport type UnregisterComponentAction = {\n type: typeof InternalActionTypes.UNREGISTER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterComponentHandleAction = {\n type: typeof InternalActionTypes.REGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string; componentHandle: ElementImperativeHandle }\n}\n\ntype UnregisterComponentHandleAction = {\n type: typeof InternalActionTypes.UNREGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof InternalActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof InternalActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersHandleAction = {\n type: typeof InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string; handle: PropControllersHandle }\n}\n\ntype UnregisterPropControllersHandleAction = {\n type: typeof InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersAction = {\n type: typeof InternalActionTypes.REGISTER_PROP_CONTROLLERS\n payload: {\n documentKey: string\n elementKey: string\n propControllers: Record<string, ControlInstance>\n }\n}\n\ntype UnregisterPropControllersAction = {\n type: typeof InternalActionTypes.UNREGISTER_PROP_CONTROLLERS\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterReactComponentAction = {\n type: typeof InternalActionTypes.REGISTER_REACT_COMPONENT\n payload: { type: string; component: ComponentType }\n}\n\ntype UnregisterReactComponentAction = {\n type: typeof InternalActionTypes.UNREGISTER_REACT_COMPONENT\n payload: { type: string }\n}\n\ntype SetIsInBuilderAction = {\n type: typeof InternalActionTypes.SET_IS_IN_BUILDER\n payload: boolean\n}\n\ntype UpdateAPIClientCache = {\n type: typeof InternalActionTypes.UPDATE_API_CLIENT_CACHE\n payload: APIClientCache\n}\n\nexport type InternalAction =\n | APIResourceFulfilledAction\n | CreateElementTreeAction\n | DeleteElementTreeAction\n | ChangeElementTreeAction\n | RegisterComponentAction\n | UnregisterComponentAction\n | RegisterComponentHandleAction\n | UnregisterComponentHandleAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | RegisterPropControllersHandleAction\n | UnregisterPropControllersHandleAction\n | RegisterPropControllersAction\n | UnregisterPropControllersAction\n | RegisterReactComponentAction\n | UnregisterReactComponentAction\n | SetIsInBuilderAction\n | UpdateAPIClientCache\n\nexport function apiResourceFulfilled<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n resource: APIResource | null,\n locale?: APIResourceLocale<T>,\n): APIResourceFulfilledAction {\n return {\n type: InternalActionTypes.API_RESOURCE_FULFILLED,\n payload: { resourceType, resourceId, resource, locale },\n }\n}\n\nexport function createElementTree(\n payload: CreateElementTreeAction['payload'],\n): CreateElementTreeAction {\n return {\n type: InternalActionTypes.CREATE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function deleteElementTree(\n payload: DeleteElementTreeAction['payload'],\n): DeleteElementTreeAction {\n return { type: InternalActionTypes.DELETE_ELEMENT_TREE, payload }\n}\n\nexport function changeElementTree(\n payload: ChangeElementTreeAction['payload'],\n): ChangeElementTreeAction {\n return {\n type: InternalActionTypes.CHANGE_ELEMENT_TREE,\n payload,\n }\n}\n\nexport function registerComponent(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): RegisterComponentAction {\n return {\n type: InternalActionTypes.REGISTER_COMPONENT,\n payload: { type, meta, propControllerDescriptors },\n }\n}\n\nexport function unregisterComponent(type: string): UnregisterComponentAction {\n return { type: InternalActionTypes.UNREGISTER_COMPONENT, payload: { type } }\n}\n\nexport function registerComponentEffect(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): ThunkAction<() => void, unknown, unknown, InternalAction> {\n return dispatch => {\n dispatch(registerComponent(type, meta, propControllerDescriptors))\n\n return () => {\n dispatch(unregisterComponent(type))\n }\n }\n}\n\nexport function registerComponentHandle(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): RegisterComponentHandleAction {\n return {\n type: InternalActionTypes.REGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey, componentHandle },\n }\n}\n\nfunction unregisterComponentHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterComponentHandleAction {\n return {\n type: InternalActionTypes.UNREGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerComponentHandleEffect(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): ThunkAction<() => void, unknown, unknown, InternalAction> {\n return dispatch => {\n dispatch(registerComponentHandle(documentKey, elementKey, componentHandle))\n\n return () => {\n dispatch(unregisterComponentHandle(documentKey, elementKey))\n }\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return {\n type: InternalActionTypes.REGISTER_MEASURABLE,\n payload: { documentKey, elementKey, measurable },\n }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: InternalActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, InternalAction> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function registerPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllersHandle,\n): RegisterPropControllersHandleAction {\n return {\n type: InternalActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey, handle },\n }\n}\n\nexport function unregisterPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersHandleAction {\n return {\n type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerPropControllers(\n documentKey: string,\n elementKey: string,\n propControllers: Record<string, ControlInstance>,\n): RegisterPropControllersAction {\n return {\n type: InternalActionTypes.REGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey, propControllers },\n }\n}\n\nexport function unregisterPropControllers(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersAction {\n return {\n type: InternalActionTypes.UNREGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey },\n }\n}\n\nfunction registerReactComponent(\n type: string,\n component: ComponentType,\n): RegisterReactComponentAction {\n return { type: InternalActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } }\n}\n\nfunction unregisterReactComponent(type: string): UnregisterReactComponentAction {\n return { type: InternalActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } }\n}\n\nexport function registerReactComponentEffect(\n type: string,\n component: ComponentType,\n): ThunkAction<() => void, unknown, unknown, InternalAction> {\n return dispatch => {\n dispatch(registerReactComponent(type, component))\n\n return () => {\n dispatch(unregisterReactComponent(type))\n }\n }\n}\n\nexport function setIsInBuilder(isInBuilder: boolean): SetIsInBuilderAction {\n return { type: InternalActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder }\n}\n\nexport function updateAPIClientCache(payload: APIClientCache): UpdateAPIClientCache {\n return { type: InternalActionTypes.UPDATE_API_CLIENT_CACHE, payload }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
configureStore as configureReduxStore
|
|
3
|
+
} from "@reduxjs/toolkit";
|
|
4
|
+
import * as LocaleState from "../modules/locale";
|
|
5
|
+
import { ActionTypes } from "../actions";
|
|
6
|
+
import { actionMiddleware, middlewareOptions, devToolsConfig } from "../toolkit";
|
|
7
|
+
import { reducer } from "./state";
|
|
8
|
+
function defaultLocaleMiddleware() {
|
|
9
|
+
return actionMiddleware(({ getState }) => (next) => {
|
|
10
|
+
return (action) => {
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case ActionTypes.CHANGE_API_RESOURCE:
|
|
13
|
+
case ActionTypes.EVICT_API_RESOURCE:
|
|
14
|
+
case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {
|
|
15
|
+
const { locale } = action.payload;
|
|
16
|
+
return next({
|
|
17
|
+
...action,
|
|
18
|
+
payload: {
|
|
19
|
+
...action.payload,
|
|
20
|
+
locale: locale ?? LocaleState.getLocale(getState().locale)
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return next(action);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function configureClientStore({
|
|
30
|
+
preloadedState
|
|
31
|
+
}) {
|
|
32
|
+
return configureReduxStore({
|
|
33
|
+
reducer,
|
|
34
|
+
preloadedState,
|
|
35
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware(middlewareOptions).concat(defaultLocaleMiddleware()),
|
|
36
|
+
devTools: devToolsConfig({
|
|
37
|
+
name: `API client store (${(/* @__PURE__ */ new Date()).toISOString()})`,
|
|
38
|
+
actionsDenylist: [
|
|
39
|
+
ActionTypes.BUILDER_POINTER_MOVE,
|
|
40
|
+
ActionTypes.HANDLE_POINTER_MOVE,
|
|
41
|
+
ActionTypes.ELEMENT_FROM_POINT_CHANGE
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
configureClientStore
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=client-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/api-client/client-store.ts"],"sourcesContent":["import {\n configureStore as configureReduxStore,\n type ThunkMiddleware,\n UnknownAction,\n} from '@reduxjs/toolkit'\n\nimport * as LocaleState from '../modules/locale'\n\nimport { type Action, ActionTypes } from '../actions'\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from '../toolkit'\n\nimport { type State, reducer } from './state'\nimport { type Store } from './store'\n\n// FIXME: this middleware can be removed once we've upgraded the builder\n// to always provide the locale when dispatching resource actions\nfunction defaultLocaleMiddleware(): ThunkMiddleware<State, UnknownAction> {\n return actionMiddleware(({ getState }) => next => {\n return (action: Action) => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE:\n case ActionTypes.EVICT_API_RESOURCE:\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { locale } = action.payload\n return next({\n ...action,\n payload: {\n ...action.payload,\n locale: locale ?? LocaleState.getLocale(getState().locale),\n },\n } as Action)\n }\n }\n\n return next(action)\n }\n })\n}\n\nexport function configureClientStore({\n preloadedState,\n}: {\n preloadedState: Partial<State>\n}): Store {\n return configureReduxStore({\n reducer,\n preloadedState,\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat(defaultLocaleMiddleware()),\n\n devTools: devToolsConfig({\n name: `API client store (${new Date().toISOString()})`,\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n}\n"],"mappings":"AAAA;AAAA,EACE,kBAAkB;AAAA,OAGb;AAEP,YAAY,iBAAiB;AAE7B,SAAsB,mBAAmB;AACzC,SAAS,kBAAkB,mBAAmB,sBAAsB;AAEpE,SAAqB,eAAe;AAKpC,SAAS,0BAAiE;AACxE,SAAO,iBAAiB,CAAC,EAAE,SAAS,MAAM,UAAQ;AAChD,WAAO,CAAC,WAAmB;AACzB,cAAQ,OAAO,MAAM;AAAA,QACnB,KAAK,YAAY;AAAA,QACjB,KAAK,YAAY;AAAA,QACjB,KAAK,YAAY,2BAA2B;AAC1C,gBAAM,EAAE,OAAO,IAAI,OAAO;AAC1B,iBAAO,KAAK;AAAA,YACV,GAAG;AAAA,YACH,SAAS;AAAA,cACP,GAAG,OAAO;AAAA,cACV,QAAQ,UAAU,YAAY,UAAU,SAAS,EAAE,MAAM;AAAA,YAC3D;AAAA,UACF,CAAW;AAAA,QACb;AAAA,MACF;AAEA,aAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF,CAAC;AACH;AAEO,SAAS,qBAAqB;AAAA,EACnC;AACF,GAEU;AACR,SAAO,oBAAoB;AAAA,IACzB;AAAA,IACA;AAAA,IAEA,YAAY,0BACV,qBAAqB,iBAAiB,EAAE,OAAO,wBAAwB,CAAC;AAAA,IAE1E,UAAU,eAAe;AAAA,MACvB,MAAM,sBAAqB,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,MACnD,iBAAiB;AAAA,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ApiHandlerHeaders, serializeSiteVersion } from "../../api/site-version";
|
|
2
|
+
import * as SiteVersionState from "../modules/site-version";
|
|
3
|
+
import { apiResourceFulfilled } from "../actions/internal/read-only-actions";
|
|
4
|
+
import { setLocalizedResourceId } from "../host-api";
|
|
5
|
+
import {
|
|
6
|
+
APIResourceType
|
|
7
|
+
} from "../../api";
|
|
8
|
+
import { getHasAPIResource, getAPIResource, getLocalizedResourceId } from "./state";
|
|
9
|
+
function fetchAPIResource(resourceType, resourceId, fetch, locale) {
|
|
10
|
+
const fetchVersioned = async (url, version) => {
|
|
11
|
+
const response = await fetch(url, {
|
|
12
|
+
headers: {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
...version != null ? { [ApiHandlerHeaders.SiteVersion]: serializeSiteVersion(version) } : {}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
if (response.status === 404)
|
|
18
|
+
return null;
|
|
19
|
+
if (!response.ok)
|
|
20
|
+
throw new Error(response.statusText);
|
|
21
|
+
if (response.headers.get("content-type")?.includes("application/json") !== true) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Expected JSON response from "${url}" but got "${response.headers.get("content-type")}"`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return response.json();
|
|
27
|
+
};
|
|
28
|
+
return async (dispatch, getState) => {
|
|
29
|
+
const state = getState();
|
|
30
|
+
const version = SiteVersionState.getSiteVersion(state.siteVersion);
|
|
31
|
+
if (getHasAPIResource(state, resourceType, resourceId, locale)) {
|
|
32
|
+
return getAPIResource(state, resourceType, resourceId, locale);
|
|
33
|
+
}
|
|
34
|
+
let resource;
|
|
35
|
+
switch (resourceType) {
|
|
36
|
+
case APIResourceType.Swatch:
|
|
37
|
+
resource = await fetchVersioned(`/api/makeswift/swatches/${resourceId}`, version);
|
|
38
|
+
break;
|
|
39
|
+
case APIResourceType.File:
|
|
40
|
+
resource = await fetchVersioned(`/api/makeswift/files/${resourceId}`, version);
|
|
41
|
+
break;
|
|
42
|
+
case APIResourceType.Typography:
|
|
43
|
+
resource = await fetchVersioned(
|
|
44
|
+
`/api/makeswift/typographies/${resourceId}`,
|
|
45
|
+
version
|
|
46
|
+
);
|
|
47
|
+
break;
|
|
48
|
+
case APIResourceType.GlobalElement:
|
|
49
|
+
resource = await fetchVersioned(
|
|
50
|
+
`/api/makeswift/global-elements/${resourceId}`,
|
|
51
|
+
version
|
|
52
|
+
);
|
|
53
|
+
break;
|
|
54
|
+
case APIResourceType.LocalizedGlobalElement: {
|
|
55
|
+
if (locale == null)
|
|
56
|
+
throw new Error("Locale is required to fetch LocalizedGlobalElement");
|
|
57
|
+
if (getLocalizedResourceId(state, locale, resourceId) === null) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
resource = await fetchVersioned(
|
|
61
|
+
`/api/makeswift/localized-global-elements/${resourceId}/${locale}`,
|
|
62
|
+
version
|
|
63
|
+
);
|
|
64
|
+
dispatch(
|
|
65
|
+
setLocalizedResourceId({
|
|
66
|
+
locale,
|
|
67
|
+
resourceId,
|
|
68
|
+
localizedResourceId: resource?.id ?? null
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case APIResourceType.PagePathnameSlice: {
|
|
74
|
+
const url = new URL(`/api/makeswift/page-pathname-slices/${resourceId}`, "http://n");
|
|
75
|
+
if (locale != null)
|
|
76
|
+
url.searchParams.set("locale", locale);
|
|
77
|
+
resource = await fetchVersioned(url.pathname + url.search, version);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case APIResourceType.Table:
|
|
81
|
+
resource = await fetchVersioned(`/api/makeswift/tables/${resourceId}`, version);
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
resource = null;
|
|
85
|
+
}
|
|
86
|
+
dispatch(apiResourceFulfilled(resourceType, resourceId, resource, locale));
|
|
87
|
+
return resource;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
fetchAPIResource
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=fetch-api-resource.js.map
|