@makeswift/runtime 0.26.4-canary.1 → 0.26.5
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/client.js +2 -13
- package/dist/cjs/api/client.js.map +1 -1
- package/dist/cjs/api/react.js +256 -0
- package/dist/cjs/api/react.js.map +1 -0
- package/dist/cjs/api-handler/handlers/element-tree.js.map +1 -1
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/api-handler/handlers/merge-translated-data.js.map +1 -1
- package/dist/cjs/api-handler/handlers/translatable-data.js.map +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/host-to-builder-actions.js +3 -3
- package/dist/cjs/builder/host-to-builder-actions.js.map +1 -1
- package/dist/cjs/builder/index.js +2 -2
- package/dist/cjs/builder/index.js.map +1 -1
- package/dist/cjs/builder/serialization.js +78 -0
- package/dist/cjs/builder/serialization.js.map +1 -0
- package/dist/cjs/client/index.js +8 -8
- package/dist/cjs/client/index.js.map +1 -1
- package/dist/cjs/components/builtin/Box/Box.js +1 -1
- package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
- package/dist/cjs/components/builtin/Form/Form.js +1 -1
- package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
- package/dist/cjs/components/hooks/useTableFormFieldRefs.js +1 -1
- package/dist/cjs/components/hooks/useTableFormFieldRefs.js.map +1 -1
- 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/next/api-handler/config/app-router.js +10 -1
- package/dist/cjs/next/api-handler/config/app-router.js.map +1 -1
- 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/framework-provider/index.js +1 -1
- package/dist/cjs/next/components/framework-provider/index.js.map +1 -1
- package/dist/cjs/next/components/tests/controls/color-control/fixtures.js.map +1 -1
- package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js +2 -1
- package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
- package/dist/cjs/next/components/tests/controls/rich-text-v2-control/fixtures.js.map +1 -1
- package/dist/cjs/next/components/tests/makeswift-component/fixtures.js +2 -1
- package/dist/cjs/next/components/tests/makeswift-component/fixtures.js.map +1 -1
- package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js +3 -2
- package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
- 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/element-data.js +3 -3
- package/dist/cjs/next/testing/element-data.js.map +1 -1
- package/dist/cjs/next/testing/index.js +0 -2
- package/dist/cjs/next/testing/index.js.map +1 -1
- package/dist/cjs/next/testing/page-rendering.js +3 -3
- package/dist/cjs/next/testing/page-rendering.js.map +1 -1
- package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
- package/dist/cjs/prop-controllers/instances.js.map +1 -1
- package/dist/cjs/prop-controllers/serialization.js +355 -0
- package/dist/cjs/prop-controllers/serialization.js.map +1 -0
- package/dist/cjs/runtimes/react/components/Document.js +2 -2
- package/dist/cjs/runtimes/react/components/Document.js.map +1 -1
- package/dist/cjs/runtimes/react/components/DocumentRoot.js.map +1 -1
- package/dist/cjs/runtimes/react/components/Element.js +2 -2
- package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
- package/dist/cjs/runtimes/react/components/ElementData.js.map +1 -1
- package/dist/cjs/runtimes/react/components/ElementReference.js.map +1 -1
- package/dist/cjs/runtimes/react/components/ElementRegistration.js +2 -2
- package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
- 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/MakeswiftComponent.js +2 -2
- package/dist/cjs/runtimes/react/components/MakeswiftComponent.js.map +1 -1
- 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/RuntimeProvider.js +5 -6
- package/dist/cjs/runtimes/react/components/RuntimeProvider.js.map +1 -1
- package/dist/cjs/runtimes/react/components/framework-context.js +13 -3
- package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/page/Page.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +3 -2
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/runtimes/react/controls.js +2 -2
- package/dist/cjs/runtimes/react/controls.js.map +1 -1
- package/dist/cjs/runtimes/react/element-imperative-handle.js +1 -1
- package/dist/cjs/runtimes/react/element-imperative-handle.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-breakpoints.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-breakpoints.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-builder-edit-mode.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-builder-edit-mode.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-cache-data.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-cache-data.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-component.js +3 -3
- package/dist/cjs/runtimes/react/hooks/use-component.js.map +1 -1
- 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-dispatch.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-document.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-document.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-element-id.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-element-id.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-is-in-builder.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-is-in-builder.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-is-preview.js +33 -0
- package/dist/cjs/runtimes/react/hooks/use-is-preview.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-register-document.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-selector.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-store.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-universal-dispatch.js.map +1 -1
- package/dist/cjs/runtimes/react/host-api-client.js +3 -4
- package/dist/cjs/runtimes/react/host-api-client.js.map +1 -1
- package/dist/cjs/runtimes/react/index.js +3 -3
- package/dist/cjs/runtimes/react/index.js.map +1 -1
- 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/poll-box-model.js +1 -1
- package/dist/cjs/runtimes/react/poll-box-model.js.map +1 -1
- package/dist/cjs/runtimes/react/react-runtime-core.js +3 -3
- package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
- package/dist/cjs/runtimes/react/runtime-core.js +2 -4
- package/dist/cjs/runtimes/react/runtime-core.js.map +1 -1
- package/dist/cjs/runtimes/react/testing/react-runtime.js +3 -2
- package/dist/cjs/runtimes/react/testing/react-runtime.js.map +1 -1
- package/dist/cjs/runtimes/react/utils/can-accept-ref.js.map +1 -1
- 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/internal/read-only-actions.js +25 -17
- package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-write-actions.js +7 -1
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/cjs/state/actions/internal.js +205 -0
- package/dist/cjs/state/actions/internal.js.map +1 -0
- package/dist/cjs/state/builder-api/actions.js +8 -11
- package/dist/cjs/state/builder-api/actions.js.map +1 -1
- 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/navigation-listener.js +110 -0
- package/dist/cjs/state/builder-api/navigation-listener.js.map +1 -0
- package/dist/cjs/state/host-api.js.map +1 -1
- package/dist/cjs/state/makeswift-api-client.js +20 -34
- package/dist/cjs/state/makeswift-api-client.js.map +1 -1
- package/dist/cjs/state/middleware/{read-write/makeswift-api-client-sync.js → makeswift-api-client-sync.js} +1 -1
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js +11 -2
- package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +3 -0
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
- 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/{prop-controller-handles.js → read-write/prop-controller-handles.js} +8 -8
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.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/api-resources.js +4 -7
- package/dist/cjs/state/modules/api-resources.js.map +1 -1
- package/dist/cjs/state/modules/box-models.js +127 -0
- package/dist/cjs/state/modules/box-models.js.map +1 -0
- package/dist/cjs/state/modules/breakpoints.js +1 -2
- package/dist/cjs/state/modules/breakpoints.js.map +1 -1
- package/dist/cjs/state/modules/builder-edit-mode.js +1 -2
- package/dist/cjs/state/modules/builder-edit-mode.js.map +1 -1
- package/dist/cjs/state/modules/components-meta.js +2 -3
- package/dist/cjs/state/modules/components-meta.js.map +1 -1
- package/dist/cjs/state/modules/element-imperative-handles.js +60 -0
- package/dist/cjs/state/modules/element-imperative-handles.js.map +1 -0
- package/dist/cjs/state/modules/element-trees.js +3 -5
- package/dist/cjs/state/modules/element-trees.js.map +1 -1
- package/dist/cjs/state/modules/is-in-builder.js +1 -2
- package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
- package/dist/cjs/state/modules/is-preview.js +47 -0
- package/dist/cjs/state/modules/is-preview.js.map +1 -0
- package/dist/cjs/state/modules/locale.js +1 -4
- package/dist/cjs/state/modules/locale.js.map +1 -1
- package/dist/cjs/state/modules/localized-resources-map.js +2 -4
- package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
- package/dist/cjs/state/modules/pointer.js +47 -0
- package/dist/cjs/state/modules/pointer.js.map +1 -0
- package/dist/cjs/state/modules/prop-controllers.js +2 -3
- package/dist/cjs/state/modules/prop-controllers.js.map +1 -1
- package/dist/cjs/state/modules/react-components.js +2 -3
- package/dist/cjs/state/modules/react-components.js.map +1 -1
- package/dist/cjs/state/modules/read-only-documents.js +2 -3
- package/dist/cjs/state/modules/read-only-documents.js.map +1 -1
- package/dist/cjs/state/modules/read-write/box-models.js +17 -2
- package/dist/cjs/state/modules/read-write/box-models.js.map +1 -1
- package/dist/cjs/state/modules/read-write-documents.js +98 -0
- package/dist/cjs/state/modules/read-write-documents.js.map +1 -0
- package/dist/cjs/state/modules/site-version.js +0 -3
- package/dist/cjs/state/modules/site-version.js.map +1 -1
- package/dist/cjs/state/react-builder-preview.js +508 -18
- package/dist/cjs/state/react-builder-preview.js.map +1 -1
- package/dist/cjs/state/react-page.js +250 -6
- package/dist/cjs/state/react-page.js.map +1 -1
- package/dist/cjs/state/read-only-state.js +23 -1
- package/dist/cjs/state/read-only-state.js.map +1 -1
- package/dist/cjs/state/read-write-state.js +9 -2
- package/dist/cjs/state/read-write-state.js.map +1 -1
- package/dist/cjs/state/shared-api.js.map +1 -1
- package/dist/cjs/state/store.js +219 -0
- package/dist/cjs/state/store.js.map +1 -0
- package/dist/cjs/state/translations/get.js +2 -2
- package/dist/cjs/state/translations/get.js.map +1 -1
- package/dist/cjs/state/translations/merge.js +2 -2
- package/dist/cjs/state/translations/merge.js.map +1 -1
- 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/unstable-framework-support/index.js +4 -2
- package/dist/cjs/unstable-framework-support/index.js.map +1 -1
- 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/client.js +2 -13
- package/dist/esm/api/client.js.map +1 -1
- package/dist/esm/api/react.js +223 -0
- package/dist/esm/api/react.js.map +1 -0
- package/dist/esm/api-handler/handlers/element-tree.js.map +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/api-handler/handlers/merge-translated-data.js.map +1 -1
- package/dist/esm/api-handler/handlers/translatable-data.js.map +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/host-to-builder-actions.js +4 -4
- package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
- package/dist/esm/builder/index.js +1 -1
- package/dist/esm/builder/index.js.map +1 -1
- package/dist/esm/builder/serialization.js +59 -0
- package/dist/esm/builder/serialization.js.map +1 -0
- package/dist/esm/client/index.js +5 -5
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/components/builtin/Box/Box.js +1 -1
- package/dist/esm/components/builtin/Box/Box.js.map +1 -1
- package/dist/esm/components/builtin/Form/Form.js +1 -1
- package/dist/esm/components/builtin/Form/Form.js.map +1 -1
- package/dist/esm/components/hooks/useTableFormFieldRefs.js +1 -1
- package/dist/esm/components/hooks/useTableFormFieldRefs.js.map +1 -1
- 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/next/api-handler/config/app-router.js +10 -1
- package/dist/esm/next/api-handler/config/app-router.js.map +1 -1
- 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/framework-provider/index.js +5 -2
- package/dist/esm/next/components/framework-provider/index.js.map +1 -1
- package/dist/esm/next/components/tests/controls/color-control/fixtures.js.map +1 -1
- package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js +2 -1
- package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
- package/dist/esm/next/components/tests/controls/rich-text-v2-control/fixtures.js.map +1 -1
- package/dist/esm/next/components/tests/makeswift-component/fixtures.js +2 -1
- package/dist/esm/next/components/tests/makeswift-component/fixtures.js.map +1 -1
- package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js +3 -2
- package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
- 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/element-data.js +1 -1
- package/dist/esm/next/testing/element-data.js.map +1 -1
- package/dist/esm/next/testing/index.js +0 -1
- package/dist/esm/next/testing/index.js.map +1 -1
- package/dist/esm/next/testing/page-rendering.js +3 -3
- package/dist/esm/next/testing/page-rendering.js.map +1 -1
- package/dist/esm/prop-controllers/descriptors.js.map +1 -1
- package/dist/esm/prop-controllers/instances.js.map +1 -1
- package/dist/esm/prop-controllers/serialization.js +338 -0
- package/dist/esm/prop-controllers/serialization.js.map +1 -0
- package/dist/esm/runtimes/react/components/Document.js +1 -1
- package/dist/esm/runtimes/react/components/Document.js.map +1 -1
- package/dist/esm/runtimes/react/components/DocumentRoot.js.map +1 -1
- package/dist/esm/runtimes/react/components/Element.js +1 -3
- package/dist/esm/runtimes/react/components/Element.js.map +1 -1
- package/dist/esm/runtimes/react/components/ElementData.js.map +1 -1
- package/dist/esm/runtimes/react/components/ElementReference.js.map +1 -1
- package/dist/esm/runtimes/react/components/ElementRegistration.js +1 -1
- package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
- 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/MakeswiftComponent.js +1 -1
- package/dist/esm/runtimes/react/components/MakeswiftComponent.js.map +1 -1
- 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/RuntimeProvider.js +4 -5
- package/dist/esm/runtimes/react/components/RuntimeProvider.js.map +1 -1
- package/dist/esm/runtimes/react/components/framework-context.js +14 -2
- package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/page/Page.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +3 -2
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/runtimes/react/controls.js +2 -2
- package/dist/esm/runtimes/react/controls.js.map +1 -1
- package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
- package/dist/esm/runtimes/react/element-imperative-handle.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-breakpoints.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-breakpoints.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-builder-edit-mode.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-builder-edit-mode.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-cache-data.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-cache-data.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-component.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-component.js.map +1 -1
- 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-dispatch.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-document.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-document.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-element-id.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-element-id.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-is-in-builder.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-is-in-builder.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-is-preview.js +9 -0
- package/dist/esm/runtimes/react/hooks/use-is-preview.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-register-document.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js +2 -2
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-resource-resolver.js +1 -1
- package/dist/esm/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-selector.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-store.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-universal-dispatch.js.map +1 -1
- package/dist/esm/runtimes/react/host-api-client.js +2 -3
- package/dist/esm/runtimes/react/host-api-client.js.map +1 -1
- package/dist/esm/runtimes/react/index.js +2 -2
- package/dist/esm/runtimes/react/index.js.map +1 -1
- 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/poll-box-model.js +1 -1
- package/dist/esm/runtimes/react/poll-box-model.js.map +1 -1
- package/dist/esm/runtimes/react/react-runtime-core.js +1 -4
- package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
- package/dist/esm/runtimes/react/runtime-core.js +5 -3
- package/dist/esm/runtimes/react/runtime-core.js.map +1 -1
- package/dist/esm/runtimes/react/testing/react-runtime.js +3 -2
- package/dist/esm/runtimes/react/testing/react-runtime.js.map +1 -1
- package/dist/esm/runtimes/react/utils/can-accept-ref.js.map +1 -1
- 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/internal/read-only-actions.js +21 -14
- package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/esm/state/actions/internal/read-write-actions.js +6 -1
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/esm/state/actions/internal.js +162 -0
- package/dist/esm/state/actions/internal.js.map +1 -0
- package/dist/esm/state/builder-api/actions.js +7 -8
- package/dist/esm/state/builder-api/actions.js.map +1 -1
- 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/navigation-listener.js +86 -0
- package/dist/esm/state/builder-api/navigation-listener.js.map +1 -0
- package/dist/esm/state/host-api.js.map +1 -1
- package/dist/esm/state/makeswift-api-client.js +19 -33
- package/dist/esm/state/makeswift-api-client.js.map +1 -1
- package/dist/esm/state/middleware/{read-write/makeswift-api-client-sync.js → makeswift-api-client-sync.js} +1 -1
- package/dist/esm/state/middleware/makeswift-api-client-sync.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js +11 -2
- package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -1
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +3 -0
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
- 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/{prop-controller-handles.js → read-write/prop-controller-handles.js} +8 -8
- package/dist/esm/state/middleware/read-write/prop-controller-handles.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/api-resources.js +5 -8
- package/dist/esm/state/modules/api-resources.js.map +1 -1
- package/dist/esm/state/modules/box-models.js +98 -0
- package/dist/esm/state/modules/box-models.js.map +1 -0
- package/dist/esm/state/modules/breakpoints.js +2 -3
- package/dist/esm/state/modules/breakpoints.js.map +1 -1
- package/dist/esm/state/modules/builder-edit-mode.js +2 -3
- package/dist/esm/state/modules/builder-edit-mode.js.map +1 -1
- package/dist/esm/state/modules/components-meta.js +3 -4
- package/dist/esm/state/modules/components-meta.js.map +1 -1
- package/dist/esm/state/modules/element-imperative-handles.js +35 -0
- package/dist/esm/state/modules/element-imperative-handles.js.map +1 -0
- package/dist/esm/state/modules/element-trees.js +4 -6
- package/dist/esm/state/modules/element-trees.js.map +1 -1
- package/dist/esm/state/modules/is-in-builder.js +2 -3
- package/dist/esm/state/modules/is-in-builder.js.map +1 -1
- package/dist/esm/state/modules/is-preview.js +21 -0
- package/dist/esm/state/modules/is-preview.js.map +1 -0
- package/dist/esm/state/modules/locale.js +1 -4
- package/dist/esm/state/modules/locale.js.map +1 -1
- package/dist/esm/state/modules/localized-resources-map.js +3 -5
- package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
- package/dist/esm/state/modules/pointer.js +22 -0
- package/dist/esm/state/modules/pointer.js.map +1 -0
- package/dist/esm/state/modules/prop-controllers.js +3 -4
- package/dist/esm/state/modules/prop-controllers.js.map +1 -1
- package/dist/esm/state/modules/react-components.js +3 -4
- package/dist/esm/state/modules/react-components.js.map +1 -1
- package/dist/esm/state/modules/read-only-documents.js +6 -4
- package/dist/esm/state/modules/read-only-documents.js.map +1 -1
- package/dist/esm/state/modules/read-write/box-models.js +16 -2
- package/dist/esm/state/modules/read-write/box-models.js.map +1 -1
- package/dist/esm/state/modules/read-write-documents.js +60 -0
- package/dist/esm/state/modules/read-write-documents.js.map +1 -0
- package/dist/esm/state/modules/site-version.js +0 -3
- package/dist/esm/state/modules/site-version.js.map +1 -1
- package/dist/esm/state/react-builder-preview.js +500 -15
- package/dist/esm/state/react-builder-preview.js.map +1 -1
- package/dist/esm/state/react-page.js +240 -7
- package/dist/esm/state/react-page.js.map +1 -1
- package/dist/esm/state/read-only-state.js +20 -1
- package/dist/esm/state/read-only-state.js.map +1 -1
- package/dist/esm/state/read-write-state.js +7 -1
- package/dist/esm/state/read-write-state.js.map +1 -1
- package/dist/esm/state/shared-api.js.map +1 -1
- package/dist/esm/state/store.js +188 -0
- package/dist/esm/state/store.js.map +1 -0
- package/dist/esm/state/translations/get.js +1 -1
- package/dist/esm/state/translations/get.js.map +1 -1
- package/dist/esm/state/translations/merge.js +1 -1
- package/dist/esm/state/translations/merge.js.map +1 -1
- 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/unstable-framework-support/index.js +4 -2
- package/dist/esm/unstable-framework-support/index.js.map +1 -1
- 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/client.d.ts +2 -5
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/api/react.d.ts +82 -0
- package/dist/types/api/react.d.ts.map +1 -0
- package/dist/types/api-handler/handlers/element-tree.d.ts +1 -1
- package/dist/types/api-handler/handlers/element-tree.d.ts.map +1 -1
- package/dist/types/api-handler/handlers/merge-translated-data.d.ts +1 -1
- package/dist/types/api-handler/handlers/merge-translated-data.d.ts.map +1 -1
- package/dist/types/api-handler/handlers/translatable-data.d.ts +1 -1
- package/dist/types/api-handler/handlers/translatable-data.d.ts.map +1 -1
- 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/api-handler/handlers/webhook/types.d.ts +4 -4
- package/dist/types/builder/host-to-builder-actions.d.ts +2 -2
- package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
- package/dist/types/builder/index.d.ts +2 -2
- package/dist/types/builder/index.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/client/index.d.ts.map +1 -1
- 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/Box/Box.d.ts +1 -1
- package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts +1 -1
- package/dist/types/components/builtin/Form/Form.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/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/locale.d.ts +1 -1
- package/dist/types/next/api-handler/config/app-router.d.ts.map +1 -1
- 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/framework-provider/index.d.ts.map +1 -1
- 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/controls/color-control/fixtures.d.ts +1 -1
- package/dist/types/next/components/tests/controls/color-control/fixtures.d.ts.map +1 -1
- package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts +3 -3
- package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts.map +1 -1
- package/dist/types/next/components/tests/controls/rich-text-v2-control/fixtures.d.ts +1 -1
- package/dist/types/next/components/tests/controls/rich-text-v2-control/fixtures.d.ts.map +1 -1
- package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts +1 -1
- package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts.map +1 -1
- package/dist/types/next/components/tests/prop-controllers/page-prop-controller.d.ts +1 -1
- package/dist/types/next/components/tests/prop-controllers/page-prop-controller.d.ts.map +1 -1
- 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/element-data.d.ts +1 -1
- package/dist/types/next/testing/element-data.d.ts.map +1 -1
- package/dist/types/next/testing/index.d.ts +0 -1
- package/dist/types/next/testing/index.d.ts.map +1 -1
- package/dist/types/next/testing/page-rendering.d.ts.map +1 -1
- package/dist/types/prop-controllers/descriptors.d.ts +1 -1
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +1 -1
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/prop-controllers/serialization.d.ts +228 -0
- package/dist/types/prop-controllers/serialization.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/Document.d.ts +1 -1
- package/dist/types/runtimes/react/components/Document.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/DocumentRoot.d.ts +1 -1
- package/dist/types/runtimes/react/components/DocumentRoot.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/Element.d.ts +1 -1
- package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/ElementData.d.ts +1 -1
- package/dist/types/runtimes/react/components/ElementData.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/ElementReference.d.ts +1 -1
- package/dist/types/runtimes/react/components/ElementReference.d.ts.map +1 -1
- 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/RuntimeProvider.d.ts +1 -1
- package/dist/types/runtimes/react/components/RuntimeProvider.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/framework-context.d.ts +4 -2
- package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/page/Page.d.ts +1 -1
- package/dist/types/runtimes/react/components/page/Page.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls.d.ts +2 -2
- package/dist/types/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
- package/dist/types/runtimes/react/element-imperative-handle.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-cache-data.d.ts +1 -1
- package/dist/types/runtimes/react/hooks/use-cache-data.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-component.d.ts +1 -1
- package/dist/types/runtimes/react/hooks/use-component.d.ts.map +1 -1
- 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-dispatch.d.ts +3 -3
- package/dist/types/runtimes/react/hooks/use-dispatch.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-document.d.ts +1 -1
- package/dist/types/runtimes/react/hooks/use-document.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-is-preview.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/use-is-preview.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-register-document.d.ts +1 -1
- package/dist/types/runtimes/react/hooks/use-register-document.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-selector.d.ts +3 -3
- package/dist/types/runtimes/react/hooks/use-selector.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-store.d.ts +4 -4
- package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-universal-dispatch.d.ts +1 -1
- package/dist/types/runtimes/react/hooks/use-universal-dispatch.d.ts.map +1 -1
- package/dist/types/runtimes/react/host-api-client.d.ts +1 -1
- package/dist/types/runtimes/react/host-api-client.d.ts.map +1 -1
- package/dist/types/runtimes/react/index.d.ts +1 -1
- package/dist/types/runtimes/react/index.d.ts.map +1 -1
- 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/poll-box-model.d.ts +1 -1
- package/dist/types/runtimes/react/poll-box-model.d.ts.map +1 -1
- package/dist/types/runtimes/react/react-runtime-core.d.ts +1 -1
- package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
- package/dist/types/runtimes/react/runtime-core.d.ts +1 -2
- package/dist/types/runtimes/react/runtime-core.d.ts.map +1 -1
- package/dist/types/runtimes/react/testing/react-runtime.d.ts +4 -1
- package/dist/types/runtimes/react/testing/react-runtime.d.ts.map +1 -1
- package/dist/types/runtimes/react/utils/can-accept-ref.d.ts +1 -1
- package/dist/types/runtimes/react/utils/can-accept-ref.d.ts.map +1 -1
- 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/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__/react-page.test.d.ts +2 -0
- package/dist/types/state/__tests__/react-page.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 +5 -8
- package/dist/types/state/actions/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/index.d.ts +4 -2
- package/dist/types/state/actions/internal/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-only-actions.d.ts +25 -13
- package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-write-actions.d.ts +6 -1
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
- 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/builder-api/actions.d.ts +14 -14
- package/dist/types/state/builder-api/actions.d.ts.map +1 -1
- 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/navigation-listener.d.ts +3 -0
- package/dist/types/state/builder-api/navigation-listener.d.ts.map +1 -0
- package/dist/types/state/host-api.d.ts +1 -1
- package/dist/types/state/host-api.d.ts.map +1 -1
- package/dist/types/state/makeswift-api-client.d.ts +2 -11
- package/dist/types/state/makeswift-api-client.d.ts.map +1 -1
- 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-write/builder-api/index.d.ts.map +1 -1
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -1
- 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/{prop-controller-handles.d.ts → read-write/prop-controller-handles.d.ts} +1 -1
- package/dist/types/state/middleware/read-write/prop-controller-handles.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/api-resources.d.ts.map +1 -1
- package/dist/types/state/modules/box-models.d.ts +23 -0
- package/dist/types/state/modules/box-models.d.ts.map +1 -0
- package/dist/types/state/modules/breakpoints.d.ts.map +1 -1
- package/dist/types/state/modules/builder-edit-mode.d.ts.map +1 -1
- package/dist/types/state/modules/components-meta.d.ts.map +1 -1
- package/dist/types/state/modules/element-imperative-handles.d.ts +7 -0
- package/dist/types/state/modules/element-imperative-handles.d.ts.map +1 -0
- package/dist/types/state/modules/element-trees.d.ts.map +1 -1
- package/dist/types/state/modules/is-in-builder.d.ts.map +1 -1
- package/dist/types/state/modules/is-preview.d.ts +6 -0
- package/dist/types/state/modules/is-preview.d.ts.map +1 -0
- package/dist/types/state/modules/locale.d.ts.map +1 -1
- package/dist/types/state/modules/localized-resources-map.d.ts.map +1 -1
- package/dist/types/state/modules/pointer.d.ts +12 -0
- package/dist/types/state/modules/pointer.d.ts.map +1 -0
- package/dist/types/state/modules/prop-controllers.d.ts.map +1 -1
- package/dist/types/state/modules/react-components.d.ts.map +1 -1
- package/dist/types/state/modules/read-only-documents.d.ts.map +1 -1
- package/dist/types/state/modules/read-write/box-models.d.ts +12 -9
- package/dist/types/state/modules/read-write/box-models.d.ts.map +1 -1
- package/dist/types/state/modules/read-write-documents.d.ts +14 -0
- package/dist/types/state/modules/read-write-documents.d.ts.map +1 -0
- package/dist/types/state/modules/site-version.d.ts.map +1 -1
- package/dist/types/state/react-builder-preview.d.ts +93 -26
- package/dist/types/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/state/react-page.d.ts +136 -20
- package/dist/types/state/react-page.d.ts.map +1 -1
- package/dist/types/state/read-only-state.d.ts +10 -1
- package/dist/types/state/read-only-state.d.ts.map +1 -1
- package/dist/types/state/read-write-state.d.ts +12 -6
- package/dist/types/state/read-write-state.d.ts.map +1 -1
- package/dist/types/state/shared-api.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/state/translations/get.d.ts.map +1 -1
- package/dist/types/state/translations/merge.d.ts +1 -1
- package/dist/types/state/translations/merge.d.ts.map +1 -1
- 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/unstable-framework-support/index.d.ts +1 -1
- package/dist/types/unstable-framework-support/index.d.ts.map +1 -1
- 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 +3 -3
- package/dist/cjs/state/middleware/prop-controller-handles.js.map +0 -1
- package/dist/cjs/state/middleware/read-write/makeswift-api-client-sync.js.map +0 -1
- package/dist/esm/state/middleware/prop-controller-handles.js.map +0 -1
- package/dist/esm/state/middleware/read-write/makeswift-api-client-sync.js.map +0 -1
- package/dist/types/state/middleware/prop-controller-handles.d.ts.map +0 -1
- package/dist/types/state/middleware/read-write/makeswift-api-client-sync.d.ts +0 -5
- package/dist/types/state/middleware/read-write/makeswift-api-client-sync.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/api/client.ts"],"sourcesContent":["import { type FetchableValue } from '@makeswift/controls'\n\nimport * as MakeswiftApiClient from '../state/makeswift-api-client'\nimport { setLocale } from '../state/shared-api'\nimport { resetLocaleState } from '../state/actions/internal/read-only-actions'\nimport { setSiteVersion } from '../state/actions/internal/read-only-actions'\n\nimport {\n APIResourceType,\n File,\n GlobalElement,\n LocalizedGlobalElement,\n Page,\n PagePathnameSlice,\n Site,\n Snippet,\n Swatch,\n Table,\n Typography,\n} from './types'\nimport { GraphQLClient } from './graphql/client'\nimport { CreateTableRecordMutation } from './graphql/documents'\nimport {\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables,\n} from './graphql/generated/types'\nimport { SiteVersion } from './site-version'\n\nexport type CacheData = MakeswiftApiClient.SerializedState\n\nexport const CacheData = {\n empty(): CacheData {\n return {\n apiResources: {},\n localizedResourcesMap: {},\n }\n },\n}\n\n/**\n * NOTE(miguel): This \"client\" is used to fetch Makeswift API resources needed for the host. For\n * example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only\n * used by controls to transform API references to API resources.\n *\n * Moreover, its use should be reserved for the builder only, since for live pages all Makeswift\n * API resources should be embedded in the \"page snapshot\". In the builder, this client serves the\n * purpose of sending requests for API resources and keeping a cache so that changes that happen in\n * the builder, like modifying a swatch, can be sent via `postMessage` to the host and the cache can\n * immediately update the value and re-render.\n *\n * Furthermore, the API resources requested shouldn't be requested directly from the Makeswift API\n * as that would require those resources to not be authenticated since the requests come from the\n * browser when running the host. Instead, the requests should go to the host directly, at the\n * Makeswift API endpoint (i.g., `/api/makeswift/[...makeswift]` dynamic route) where the host's\n * API key can be used, securely, in the server. For this reason, this client should really be a\n * client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime\n * snapshot for use in the builder, not the lives pages.\n */\nexport class MakeswiftHostApiClient {\n graphqlClient: GraphQLClient\n makeswiftApiClient: MakeswiftApiClient.Store\n subscribe: MakeswiftApiClient.Store['subscribe']\n fetch: MakeswiftApiClient.HttpFetch\n\n constructor({\n uri,\n fetch,\n cacheData,\n locale,\n siteVersion,\n }: {\n uri: string\n fetch: MakeswiftApiClient.HttpFetch\n cacheData?: CacheData\n locale?: string\n siteVersion: SiteVersion | null\n }) {\n this.graphqlClient = new GraphQLClient(uri)\n this.makeswiftApiClient = MakeswiftApiClient.configureStore({\n serializedState: cacheData,\n })\n this.fetch = fetch\n this.subscribe = this.makeswiftApiClient.subscribe\n\n this.makeswiftApiClient.dispatch(\n locale != null ? setLocale(new Intl.Locale(locale)) : resetLocaleState(),\n )\n\n this.makeswiftApiClient.dispatch(setSiteVersion(siteVersion))\n }\n\n readSwatch(swatchId: string): Swatch | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Swatch,\n swatchId,\n )\n }\n\n async fetchSwatch(swatchId: string): Promise<Swatch | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Swatch, swatchId, this.fetch),\n )\n }\n\n resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null> {\n return this.resolveResource(APIResourceType.Swatch, {\n id: swatchId,\n read: id => this.readSwatch(id),\n fetch: id => this.fetchSwatch(id),\n })\n }\n\n readFile(fileId: string): File | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.File,\n fileId,\n )\n }\n\n async fetchFile(fileId: string): Promise<File | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.File, fileId, this.fetch),\n )\n }\n\n resolveFile(fileId: string | undefined): FetchableValue<File | null> {\n return this.resolveResource(APIResourceType.File, {\n id: fileId,\n read: id => this.readFile(id),\n fetch: id => this.fetchFile(id),\n })\n }\n\n readTypography(typographyId: string): Typography | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Typography,\n typographyId,\n )\n }\n\n async fetchTypography(typographyId: string): Promise<Typography | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Typography, typographyId, this.fetch),\n )\n }\n\n resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null> {\n return this.resolveResource(APIResourceType.Typography, {\n id: typographyId,\n read: id => this.readTypography(id),\n fetch: id => this.fetchTypography(id),\n })\n }\n\n readGlobalElement(globalElementId: string): GlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.GlobalElement,\n globalElementId,\n )\n }\n\n async fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.GlobalElement,\n globalElementId,\n this.fetch,\n ),\n )\n }\n\n readLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): LocalizedGlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n locale,\n )\n }\n\n async fetchLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): Promise<LocalizedGlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n this.fetch,\n locale,\n ),\n )\n }\n\n readPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): PagePathnameSlice | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.PagePathnameSlice,\n pageId,\n locale,\n )\n }\n\n async fetchPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): Promise<PagePathnameSlice | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.PagePathnameSlice,\n pageId,\n this.fetch,\n locale,\n ),\n )\n }\n\n resolvePagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string | undefined\n locale: string | null\n }): FetchableValue<PagePathnameSlice | null> {\n return this.resolveResource(APIResourceType.PagePathnameSlice, {\n id: pageId,\n read: id => this.readPagePathnameSlice({ pageId: id, locale }),\n fetch: id => this.fetchPagePathnameSlice({ pageId: id, locale }),\n })\n }\n\n resolveResource<R>(\n type: APIResourceType,\n {\n id,\n read,\n fetch,\n }: {\n id: string | undefined\n read: (id: string) => R | null\n fetch: (id: string) => Promise<R | null>\n },\n ): FetchableValue<R | null> {\n const _read = () => (id != null ? read(id) : null)\n let lastValue: R | null = null\n return {\n name: `${type}:${id}`,\n readStable: () => (lastValue = _read()),\n subscribe: (onUpdate: () => void) =>\n this.subscribe(() => {\n if (_read() !== lastValue) onUpdate()\n }),\n fetch: async () => (id != null ? fetch(id) : null),\n }\n }\n\n readTable(tableId: string): Table | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Table,\n tableId,\n )\n }\n\n async fetchTable(tableId: string): Promise<Table | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Table, tableId, this.fetch),\n )\n }\n\n async createTableRecord(tableId: string, columns: any): Promise<void> {\n await this.graphqlClient.request<\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables\n >(CreateTableRecordMutation, { input: { data: { tableId, columns } } })\n }\n\n readSite(siteId: string): Site | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Site,\n siteId,\n )\n }\n\n readPage(pageId: string): Page | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Page,\n pageId,\n )\n }\n\n readSnippet(snippetId: string): Snippet | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Snippet,\n snippetId,\n )\n }\n}\n"],"mappings":"AAEA,YAAY,wBAAwB;AACpC,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAE/B;AAAA,EACE;AAAA,OAWK;AACP,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AASnC,MAAM,YAAY;AAAA,EACvB,QAAmB;AACjB,WAAO;AAAA,MACL,cAAc,CAAC;AAAA,MACf,uBAAuB,CAAC;AAAA,IAC1B;AAAA,EACF;AACF;AAqBO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAMG;AACD,SAAK,gBAAgB,IAAI,c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AAA,EAEA,MAAM,WAAW,SAAwC;AACvD,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,gBAAgB,OAAO,SAAS,KAAK,KAAK;AAAA,IAChF;AAAA,EACF;AAAA,EAEA,MAAM,kBAAkB,SAAiB,SAA6B;AACpE,UAAM,KAAK,cAAc,QAGvB,2BAA2B,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,QAAQ,EAAE,EAAE,CAAC;AAAA,EACxE;AAAA,EAEA,SAAS,QAA6B;AACpC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,SAAS,QAA6B;AACpC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,YAAY,WAAmC;AAC7C,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/api/client.ts"],"sourcesContent":["import { type FetchableValue } from '@makeswift/controls'\n\nimport * as MakeswiftApiClient from '../state/makeswift-api-client'\n\nimport {\n APIResourceType,\n File,\n GlobalElement,\n LocalizedGlobalElement,\n Page,\n PagePathnameSlice,\n Site,\n Snippet,\n Swatch,\n Table,\n Typography,\n} from './types'\nimport { GraphQLClient } from './graphql/client'\nimport { CreateTableRecordMutation } from './graphql/documents'\nimport {\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables,\n} from './graphql/generated/types'\n\nexport type CacheData = MakeswiftApiClient.SerializedState\n\nexport const CacheData = {\n empty(): CacheData {\n return {\n apiResources: {},\n localizedResourcesMap: {},\n }\n },\n}\n\n/**\n * NOTE(miguel): This \"client\" is used to fetch Makeswift API resources needed for the host. For\n * example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only\n * used by controls to transform API references to API resources.\n *\n * Moreover, its use should be reserved for the builder only, since for live pages all Makeswift\n * API resources should be embedded in the \"page snapshot\". In the builder, this client serves the\n * purpose of sending requests for API resources and keeping a cache so that changes that happen in\n * the builder, like modifying a swatch, can be sent via `postMessage` to the host and the cache can\n * immediately update the value and re-render.\n *\n * Furthermore, the API resources requested shouldn't be requested directly from the Makeswift API\n * as that would require those resources to not be authenticated since the requests come from the\n * browser when running the host. Instead, the requests should go to the host directly, at the\n * Makeswift API endpoint (i.g., `/api/makeswift/[...makeswift]` dynamic route) where the host's\n * API key can be used, securely, in the server. For this reason, this client should really be a\n * client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime\n * snapshot for use in the builder, not the lives pages.\n */\nexport class MakeswiftHostApiClient {\n graphqlClient: GraphQLClient\n makeswiftApiClient: MakeswiftApiClient.Store\n subscribe: MakeswiftApiClient.Store['subscribe']\n fetch: MakeswiftApiClient.HttpFetch\n\n constructor({\n uri,\n fetch,\n preloadedState,\n }: {\n uri: string\n fetch: MakeswiftApiClient.HttpFetch\n preloadedState: Partial<MakeswiftApiClient.State>\n }) {\n this.graphqlClient = new GraphQLClient(uri)\n this.makeswiftApiClient = MakeswiftApiClient.configureStore({ preloadedState })\n this.fetch = fetch\n this.subscribe = this.makeswiftApiClient.subscribe\n }\n\n readSwatch(swatchId: string): Swatch | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Swatch,\n swatchId,\n )\n }\n\n async fetchSwatch(swatchId: string): Promise<Swatch | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Swatch, swatchId, this.fetch),\n )\n }\n\n resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null> {\n return this.resolveResource(APIResourceType.Swatch, {\n id: swatchId,\n read: id => this.readSwatch(id),\n fetch: id => this.fetchSwatch(id),\n })\n }\n\n readFile(fileId: string): File | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.File,\n fileId,\n )\n }\n\n async fetchFile(fileId: string): Promise<File | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.File, fileId, this.fetch),\n )\n }\n\n resolveFile(fileId: string | undefined): FetchableValue<File | null> {\n return this.resolveResource(APIResourceType.File, {\n id: fileId,\n read: id => this.readFile(id),\n fetch: id => this.fetchFile(id),\n })\n }\n\n readTypography(typographyId: string): Typography | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Typography,\n typographyId,\n )\n }\n\n async fetchTypography(typographyId: string): Promise<Typography | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Typography, typographyId, this.fetch),\n )\n }\n\n resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null> {\n return this.resolveResource(APIResourceType.Typography, {\n id: typographyId,\n read: id => this.readTypography(id),\n fetch: id => this.fetchTypography(id),\n })\n }\n\n readGlobalElement(globalElementId: string): GlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.GlobalElement,\n globalElementId,\n )\n }\n\n async fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.GlobalElement,\n globalElementId,\n this.fetch,\n ),\n )\n }\n\n readLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): LocalizedGlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n locale,\n )\n }\n\n async fetchLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): Promise<LocalizedGlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n this.fetch,\n locale,\n ),\n )\n }\n\n readPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): PagePathnameSlice | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.PagePathnameSlice,\n pageId,\n locale,\n )\n }\n\n async fetchPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): Promise<PagePathnameSlice | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.PagePathnameSlice,\n pageId,\n this.fetch,\n locale,\n ),\n )\n }\n\n resolvePagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string | undefined\n locale: string | null\n }): FetchableValue<PagePathnameSlice | null> {\n return this.resolveResource(APIResourceType.PagePathnameSlice, {\n id: pageId,\n read: id => this.readPagePathnameSlice({ pageId: id, locale }),\n fetch: id => this.fetchPagePathnameSlice({ pageId: id, locale }),\n })\n }\n\n resolveResource<R>(\n type: APIResourceType,\n {\n id,\n read,\n fetch,\n }: {\n id: string | undefined\n read: (id: string) => R | null\n fetch: (id: string) => Promise<R | null>\n },\n ): FetchableValue<R | null> {\n const _read = () => (id != null ? read(id) : null)\n let lastValue: R | null = null\n return {\n name: `${type}:${id}`,\n readStable: () => (lastValue = _read()),\n subscribe: (onUpdate: () => void) =>\n this.subscribe(() => {\n if (_read() !== lastValue) onUpdate()\n }),\n fetch: async () => (id != null ? fetch(id) : null),\n }\n }\n\n readTable(tableId: string): Table | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Table,\n tableId,\n )\n }\n\n async fetchTable(tableId: string): Promise<Table | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Table, tableId, this.fetch),\n )\n }\n\n async createTableRecord(tableId: string, columns: any): Promise<void> {\n await this.graphqlClient.request<\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables\n >(CreateTableRecordMutation, { input: { data: { tableId, columns } } })\n }\n\n readSite(siteId: string): Site | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Site,\n siteId,\n )\n }\n\n readPage(pageId: string): Page | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Page,\n pageId,\n )\n }\n\n readSnippet(snippetId: string): Snippet | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Snippet,\n snippetId,\n )\n }\n}\n"],"mappings":"AAEA,YAAY,wBAAwB;AAEpC;AAAA,EACE;AAAA,OAWK;AACP,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAQnC,MAAM,YAAY;AAAA,EACvB,QAAmB;AACjB,WAAO;AAAA,MACL,cAAc,CAAC;AAAA,MACf,uBAAuB,CAAC;AAAA,IAC1B;AAAA,EACF;AACF;AAqBO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAIG;AACD,SAAK,gBAAgB,IAAI,cAAc,GAAG;AAC1C,SAAK,qBAAqB,mBAAmB,eAAe,EAAE,eAAe,CAAC;AAC9E,SAAK,QAAQ;AACb,SAAK,YAAY,KAAK,mBAAmB;AAAA,EAC3C;AAAA,EAEA,WAAW,UAAiC;AAC1C,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,YAAY,UAA0C;AAC1D,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,gBAAgB,QAAQ,UAAU,KAAK,KAAK;AAAA,IAClF;AAAA,EACF;AAAA,EAEA,cAAc,UAA6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mB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import * as MakeswiftApiClient from "../state/makeswift-api-client";
|
|
2
|
+
import {
|
|
3
|
+
APIResourceType
|
|
4
|
+
} from "./types";
|
|
5
|
+
import { GraphQLClient } from "./graphql/client";
|
|
6
|
+
import { CreateTableRecordMutation } from "./graphql/documents";
|
|
7
|
+
const CacheData = {
|
|
8
|
+
empty() {
|
|
9
|
+
return {
|
|
10
|
+
apiResources: {},
|
|
11
|
+
localizedResourcesMap: {}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
class MakeswiftHostApiClient {
|
|
16
|
+
graphqlClient;
|
|
17
|
+
makeswiftApiClient;
|
|
18
|
+
subscribe;
|
|
19
|
+
fetch;
|
|
20
|
+
constructor({
|
|
21
|
+
uri,
|
|
22
|
+
fetch,
|
|
23
|
+
cacheData,
|
|
24
|
+
locale
|
|
25
|
+
}) {
|
|
26
|
+
this.graphqlClient = new GraphQLClient(uri);
|
|
27
|
+
this.makeswiftApiClient = MakeswiftApiClient.configureStore({
|
|
28
|
+
serializedState: cacheData,
|
|
29
|
+
defaultLocale: locale
|
|
30
|
+
});
|
|
31
|
+
this.fetch = fetch;
|
|
32
|
+
this.subscribe = this.makeswiftApiClient.subscribe;
|
|
33
|
+
}
|
|
34
|
+
readSwatch(swatchId) {
|
|
35
|
+
return MakeswiftApiClient.getAPIResource(
|
|
36
|
+
this.makeswiftApiClient.getState(),
|
|
37
|
+
APIResourceType.Swatch,
|
|
38
|
+
swatchId
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
async fetchSwatch(swatchId) {
|
|
42
|
+
return await this.makeswiftApiClient.dispatch(
|
|
43
|
+
MakeswiftApiClient.fetchAPIResource(APIResourceType.Swatch, swatchId, this.fetch)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
resolveSwatch(swatchId) {
|
|
47
|
+
return this.resolveResource(APIResourceType.Swatch, {
|
|
48
|
+
id: swatchId,
|
|
49
|
+
read: (id) => this.readSwatch(id),
|
|
50
|
+
fetch: (id) => this.fetchSwatch(id)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
readFile(fileId) {
|
|
54
|
+
return MakeswiftApiClient.getAPIResource(
|
|
55
|
+
this.makeswiftApiClient.getState(),
|
|
56
|
+
APIResourceType.File,
|
|
57
|
+
fileId
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
async fetchFile(fileId) {
|
|
61
|
+
return await this.makeswiftApiClient.dispatch(
|
|
62
|
+
MakeswiftApiClient.fetchAPIResource(APIResourceType.File, fileId, this.fetch)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
resolveFile(fileId) {
|
|
66
|
+
return this.resolveResource(APIResourceType.File, {
|
|
67
|
+
id: fileId,
|
|
68
|
+
read: (id) => this.readFile(id),
|
|
69
|
+
fetch: (id) => this.fetchFile(id)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
readTypography(typographyId) {
|
|
73
|
+
return MakeswiftApiClient.getAPIResource(
|
|
74
|
+
this.makeswiftApiClient.getState(),
|
|
75
|
+
APIResourceType.Typography,
|
|
76
|
+
typographyId
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
async fetchTypography(typographyId) {
|
|
80
|
+
return await this.makeswiftApiClient.dispatch(
|
|
81
|
+
MakeswiftApiClient.fetchAPIResource(APIResourceType.Typography, typographyId, this.fetch)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
resolveTypography(typographyId) {
|
|
85
|
+
return this.resolveResource(APIResourceType.Typography, {
|
|
86
|
+
id: typographyId,
|
|
87
|
+
read: (id) => this.readTypography(id),
|
|
88
|
+
fetch: (id) => this.fetchTypography(id)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
readGlobalElement(globalElementId) {
|
|
92
|
+
return MakeswiftApiClient.getAPIResource(
|
|
93
|
+
this.makeswiftApiClient.getState(),
|
|
94
|
+
APIResourceType.GlobalElement,
|
|
95
|
+
globalElementId
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
async fetchGlobalElement(globalElementId) {
|
|
99
|
+
return await this.makeswiftApiClient.dispatch(
|
|
100
|
+
MakeswiftApiClient.fetchAPIResource(
|
|
101
|
+
APIResourceType.GlobalElement,
|
|
102
|
+
globalElementId,
|
|
103
|
+
this.fetch
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
readLocalizedGlobalElement({
|
|
108
|
+
globalElementId,
|
|
109
|
+
locale
|
|
110
|
+
}) {
|
|
111
|
+
return MakeswiftApiClient.getAPIResource(
|
|
112
|
+
this.makeswiftApiClient.getState(),
|
|
113
|
+
APIResourceType.LocalizedGlobalElement,
|
|
114
|
+
globalElementId,
|
|
115
|
+
locale
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
async fetchLocalizedGlobalElement({
|
|
119
|
+
globalElementId,
|
|
120
|
+
locale
|
|
121
|
+
}) {
|
|
122
|
+
return await this.makeswiftApiClient.dispatch(
|
|
123
|
+
MakeswiftApiClient.fetchAPIResource(
|
|
124
|
+
APIResourceType.LocalizedGlobalElement,
|
|
125
|
+
globalElementId,
|
|
126
|
+
this.fetch,
|
|
127
|
+
locale
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
readPagePathnameSlice({
|
|
132
|
+
pageId,
|
|
133
|
+
locale
|
|
134
|
+
}) {
|
|
135
|
+
return MakeswiftApiClient.getAPIResource(
|
|
136
|
+
this.makeswiftApiClient.getState(),
|
|
137
|
+
APIResourceType.PagePathnameSlice,
|
|
138
|
+
pageId,
|
|
139
|
+
locale
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
async fetchPagePathnameSlice({
|
|
143
|
+
pageId,
|
|
144
|
+
locale
|
|
145
|
+
}) {
|
|
146
|
+
return await this.makeswiftApiClient.dispatch(
|
|
147
|
+
MakeswiftApiClient.fetchAPIResource(
|
|
148
|
+
APIResourceType.PagePathnameSlice,
|
|
149
|
+
pageId,
|
|
150
|
+
this.fetch,
|
|
151
|
+
locale
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
resolvePagePathnameSlice({
|
|
156
|
+
pageId,
|
|
157
|
+
locale
|
|
158
|
+
}) {
|
|
159
|
+
return this.resolveResource(APIResourceType.PagePathnameSlice, {
|
|
160
|
+
id: pageId,
|
|
161
|
+
read: (id) => this.readPagePathnameSlice({ pageId: id, locale }),
|
|
162
|
+
fetch: (id) => this.fetchPagePathnameSlice({ pageId: id, locale })
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
resolveResource(type, {
|
|
166
|
+
id,
|
|
167
|
+
read,
|
|
168
|
+
fetch
|
|
169
|
+
}) {
|
|
170
|
+
const _read = () => id != null ? read(id) : null;
|
|
171
|
+
let lastValue = null;
|
|
172
|
+
return {
|
|
173
|
+
name: `${type}:${id}`,
|
|
174
|
+
readStable: () => lastValue = _read(),
|
|
175
|
+
subscribe: (onUpdate) => this.subscribe(() => {
|
|
176
|
+
if (_read() !== lastValue)
|
|
177
|
+
onUpdate();
|
|
178
|
+
}),
|
|
179
|
+
fetch: async () => id != null ? fetch(id) : null
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
readTable(tableId) {
|
|
183
|
+
return MakeswiftApiClient.getAPIResource(
|
|
184
|
+
this.makeswiftApiClient.getState(),
|
|
185
|
+
APIResourceType.Table,
|
|
186
|
+
tableId
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
async fetchTable(tableId) {
|
|
190
|
+
return await this.makeswiftApiClient.dispatch(
|
|
191
|
+
MakeswiftApiClient.fetchAPIResource(APIResourceType.Table, tableId, this.fetch)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
async createTableRecord(tableId, columns) {
|
|
195
|
+
await this.graphqlClient.request(CreateTableRecordMutation, { input: { data: { tableId, columns } } });
|
|
196
|
+
}
|
|
197
|
+
readSite(siteId) {
|
|
198
|
+
return MakeswiftApiClient.getAPIResource(
|
|
199
|
+
this.makeswiftApiClient.getState(),
|
|
200
|
+
APIResourceType.Site,
|
|
201
|
+
siteId
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
readPage(pageId) {
|
|
205
|
+
return MakeswiftApiClient.getAPIResource(
|
|
206
|
+
this.makeswiftApiClient.getState(),
|
|
207
|
+
APIResourceType.Page,
|
|
208
|
+
pageId
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
readSnippet(snippetId) {
|
|
212
|
+
return MakeswiftApiClient.getAPIResource(
|
|
213
|
+
this.makeswiftApiClient.getState(),
|
|
214
|
+
APIResourceType.Snippet,
|
|
215
|
+
snippetId
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
CacheData,
|
|
221
|
+
MakeswiftHostApiClient
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/api/react.ts"],"sourcesContent":["import { type FetchableValue } from '@makeswift/controls'\nimport * as MakeswiftApiClient from '../state/makeswift-api-client'\nimport {\n APIResourceType,\n File,\n GlobalElement,\n LocalizedGlobalElement,\n Page,\n PagePathnameSlice,\n Site,\n Snippet,\n Swatch,\n Table,\n Typography,\n} from './types'\nimport { GraphQLClient } from './graphql/client'\nimport { CreateTableRecordMutation } from './graphql/documents'\nimport {\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables,\n} from './graphql/generated/types'\n\nexport type CacheData = MakeswiftApiClient.SerializedState\n\nexport const CacheData = {\n empty(): CacheData {\n return {\n apiResources: {},\n localizedResourcesMap: {},\n }\n },\n}\n\n/**\n * NOTE(miguel): This \"client\" is used to fetch Makeswift API resources needed for the host. For\n * example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only\n * used by controls to transform API references to API resources.\n *\n * Moreover, its use should be reserved for the builder only, since for live pages all Makeswift\n * API resources should be embedded in the \"page snapshot\". In the builder, this client serves the\n * purpose of sending requests for API resources and keeping a cache so that changes that happen in\n * the builder, like modifying a swatch, can be sent via `postMessage` to the host and the cache can\n * immediately update the value and re-render.\n *\n * Furthermore, the API resources requested shouldn't be requested directly from the Makeswift API\n * as that would require those resources to not be authenticated since the requests come from the\n * browser when running the host. Instead, the requests should go to the host directly, at the\n * Makeswift API endpoint (i.g., `/api/makeswift/[...makeswift]` dynamic route) where the host's\n * API key can be used, securely, in the server. For this reason, this client should really be a\n * client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime\n * snapshot for use in the builder, not the lives pages.\n */\nexport class MakeswiftHostApiClient {\n graphqlClient: GraphQLClient\n makeswiftApiClient: MakeswiftApiClient.Store\n subscribe: MakeswiftApiClient.Store['subscribe']\n fetch: MakeswiftApiClient.HttpFetch\n\n constructor({\n uri,\n fetch,\n cacheData,\n locale,\n }: {\n uri: string\n fetch: MakeswiftApiClient.HttpFetch\n cacheData?: CacheData\n locale?: string\n }) {\n this.graphqlClient = new GraphQLClient(uri)\n this.makeswiftApiClient = MakeswiftApiClient.configureStore({\n serializedState: cacheData,\n defaultLocale: locale,\n })\n this.fetch = fetch\n this.subscribe = this.makeswiftApiClient.subscribe\n }\n\n readSwatch(swatchId: string): Swatch | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Swatch,\n swatchId,\n )\n }\n\n async fetchSwatch(swatchId: string): Promise<Swatch | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Swatch, swatchId, this.fetch),\n )\n }\n\n resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null> {\n return this.resolveResource(APIResourceType.Swatch, {\n id: swatchId,\n read: id => this.readSwatch(id),\n fetch: id => this.fetchSwatch(id),\n })\n }\n\n readFile(fileId: string): File | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.File,\n fileId,\n )\n }\n\n async fetchFile(fileId: string): Promise<File | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.File, fileId, this.fetch),\n )\n }\n\n resolveFile(fileId: string | undefined): FetchableValue<File | null> {\n return this.resolveResource(APIResourceType.File, {\n id: fileId,\n read: id => this.readFile(id),\n fetch: id => this.fetchFile(id),\n })\n }\n\n readTypography(typographyId: string): Typography | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Typography,\n typographyId,\n )\n }\n\n async fetchTypography(typographyId: string): Promise<Typography | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Typography, typographyId, this.fetch),\n )\n }\n\n resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null> {\n return this.resolveResource(APIResourceType.Typography, {\n id: typographyId,\n read: id => this.readTypography(id),\n fetch: id => this.fetchTypography(id),\n })\n }\n\n readGlobalElement(globalElementId: string): GlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.GlobalElement,\n globalElementId,\n )\n }\n\n async fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.GlobalElement,\n globalElementId,\n this.fetch,\n ),\n )\n }\n\n readLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): LocalizedGlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n locale,\n )\n }\n\n async fetchLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): Promise<LocalizedGlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n this.fetch,\n locale,\n ),\n )\n }\n\n readPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): PagePathnameSlice | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.PagePathnameSlice,\n pageId,\n locale,\n )\n }\n\n async fetchPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): Promise<PagePathnameSlice | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.PagePathnameSlice,\n pageId,\n this.fetch,\n locale,\n ),\n )\n }\n\n resolvePagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string | undefined\n locale: string | null\n }): FetchableValue<PagePathnameSlice | null> {\n return this.resolveResource(APIResourceType.PagePathnameSlice, {\n id: pageId,\n read: id => this.readPagePathnameSlice({ pageId: id, locale }),\n fetch: id => this.fetchPagePathnameSlice({ pageId: id, locale }),\n })\n }\n\n resolveResource<R>(\n type: APIResourceType,\n {\n id,\n read,\n fetch,\n }: {\n id: string | undefined\n read: (id: string) => R | null\n fetch: (id: string) => Promise<R | null>\n },\n ): FetchableValue<R | null> {\n const _read = () => (id != null ? read(id) : null)\n let lastValue: R | null = null\n return {\n name: `${type}:${id}`,\n readStable: () => (lastValue = _read()),\n subscribe: (onUpdate: () => void) =>\n this.subscribe(() => {\n if (_read() !== lastValue) onUpdate()\n }),\n fetch: async () => (id != null ? fetch(id) : null),\n }\n }\n\n readTable(tableId: string): Table | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Table,\n tableId,\n )\n }\n\n async fetchTable(tableId: string): Promise<Table | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Table, tableId, this.fetch),\n )\n }\n\n async createTableRecord(tableId: string, columns: any): Promise<void> {\n await this.graphqlClient.request<\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables\n >(CreateTableRecordMutation, { input: { data: { tableId, columns } } })\n }\n\n readSite(siteId: string): Site | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Site,\n siteId,\n )\n }\n\n readPage(pageId: string): Page | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Page,\n pageId,\n )\n }\n\n readSnippet(snippetId: string): Snippet | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Snippet,\n snippetId,\n )\n }\n}\n"],"mappings":"AACA,YAAY,wBAAwB;AACpC;AAAA,EACE;AAAA,OAWK;AACP,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAQnC,MAAM,YAAY;AAAA,EACvB,QAAmB;AACjB,WAAO;AAAA,MACL,cAAc,CAAC;AAAA,MACf,uBAAuB,CAAC;AAAA,IAC1B;AAAA,EACF;AACF;AAqBO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,SAAK,gBAAgB,IAAI,cAAc,GAAG;AAC1C,SAAK,qBAAqB,mBAAmB,eAAe;AAAA,MAC1D,iBAAiB;AAAA,MACjB,eAAe;AAAA,IACjB,CAAC;AACD,SAAK,QAAQ;AACb,SAAK,YAAY,KAAK,mBAAmB;AAAA,EAC3C;AAAA,EAEA,WAAW,UAAiC;AAC1C,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,YAAY,UAA0C;AAC1D,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,gBAAgB,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MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,YAAY,WAAmC;AAC7C,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,gBAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api-handler/handlers/element-tree.ts"],"sourcesContent":["import { ReactRuntimeCore } from '../../runtimes/react/react-runtime-core'\nimport { type Element } from '../../state/
|
|
1
|
+
{"version":3,"sources":["../../../../src/api-handler/handlers/element-tree.ts"],"sourcesContent":["import { ReactRuntimeCore } from '../../runtimes/react/react-runtime-core'\nimport { type Element } from '../../state/react-page'\nimport { type ApiRequest, ApiResponse, type ErrorResponseBody } from '../request-response'\n\nexport async function elementTreeHandler(\n req: ApiRequest,\n { runtime }: { runtime: ReactRuntimeCore },\n): Promise<ApiResponse<{ elementTree: Element } | ErrorResponseBody>> {\n const body = await req.json()\n const { elementTree, replacementContext } = body\n\n if (elementTree == null) {\n return ApiResponse.json({ message: 'elementTree must be defined' }, { status: 400 })\n }\n\n if (replacementContext == null) {\n return ApiResponse.json({ message: 'replacementContext must be defined' }, { status: 400 })\n }\n\n const generatedElementTree = runtime.copyElementTree(elementTree, replacementContext)\n return ApiResponse.json({ elementTree: generatedElementTree })\n}\n"],"mappings":"AAEA,SAA0B,mBAA2C;AAErE,eAAsB,mBACpB,KACA,EAAE,QAAQ,GAC0D;AACpE,QAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,QAAM,EAAE,aAAa,mBAAmB,IAAI;AAE5C,MAAI,eAAe,MAAM;AACvB,WAAO,YAAY,KAAK,EAAE,SAAS,8BAA8B,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EACrF;AAEA,MAAI,sBAAsB,MAAM;AAC9B,WAAO,YAAY,KAAK,EAAE,SAAS,qCAAqC,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC5F;AAEA,QAAM,uBAAuB,QAAQ,gBAAgB,aAAa,kBAAkB;AACpF,SAAO,YAAY,KAAK,EAAE,aAAa,qBAAqB,CAAC;AAC/D;","names":[]}
|
|
@@ -8,7 +8,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
|
|
|
8
8
|
return ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
|
|
9
9
|
}
|
|
10
10
|
return ApiResponse.json({
|
|
11
|
-
version: "0.26.
|
|
11
|
+
version: "0.26.5",
|
|
12
12
|
interactionMode: true,
|
|
13
13
|
clientSideNavigation: false,
|
|
14
14
|
elementFromPoint: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api-handler/handlers/merge-translated-data.ts"],"sourcesContent":["import { type Element } from '../../state/
|
|
1
|
+
{"version":3,"sources":["../../../../src/api-handler/handlers/merge-translated-data.ts"],"sourcesContent":["import { type Element } from '../../state/react-page'\nimport { MakeswiftClient } from '../../client'\nimport { type ApiRequest, ApiResponse, type ErrorResponseBody } from '../request-response'\nimport isErrorWithMessage from '../../utils/isErrorWithMessage'\n\ntype TranslatedData = { elementTree: Element }\n\nexport async function mergeTranslatedDataHandler(\n req: ApiRequest,\n { client }: { client: MakeswiftClient },\n): Promise<ApiResponse<TranslatedData | ErrorResponseBody>> {\n const body = await req.json()\n const { translatedData, elementTree } = body\n\n if (translatedData == null) {\n return ApiResponse.json({ message: 'translatedData must be defined' }, { status: 400 })\n }\n\n if (elementTree == null) {\n return ApiResponse.json({ message: 'elementTree must be defined' }, { status: 400 })\n }\n\n try {\n const translatedElementTree = client.mergeTranslatedData(elementTree, translatedData)\n return ApiResponse.json({ elementTree: translatedElementTree })\n } catch (error) {\n if (isErrorWithMessage(error)) {\n return ApiResponse.json({ message: error.message }, { status: 500 })\n }\n return ApiResponse.json({ message: 'Error merging translated data' }, { status: 500 })\n }\n}\n"],"mappings":"AAEA,SAA0B,mBAA2C;AACrE,OAAO,wBAAwB;AAI/B,eAAsB,2BACpB,KACA,EAAE,OAAO,GACiD;AAC1D,QAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,QAAM,EAAE,gBAAgB,YAAY,IAAI;AAExC,MAAI,kBAAkB,MAAM;AAC1B,WAAO,YAAY,KAAK,EAAE,SAAS,iCAAiC,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EACxF;AAEA,MAAI,eAAe,MAAM;AACvB,WAAO,YAAY,KAAK,EAAE,SAAS,8BAA8B,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EACrF;AAEA,MAAI;AACF,UAAM,wBAAwB,OAAO,oBAAoB,aAAa,cAAc;AACpF,WAAO,YAAY,KAAK,EAAE,aAAa,sBAAsB,CAAC;AAAA,EAChE,SAAS,OAAO;AACd,QAAI,mBAAmB,KAAK,GAAG;AAC7B,aAAO,YAAY,KAAK,EAAE,SAAS,MAAM,QAAQ,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,IACrE;AACA,WAAO,YAAY,KAAK,EAAE,SAAS,gCAAgC,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EACvF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api-handler/handlers/translatable-data.ts"],"sourcesContent":["import { type Data } from '../../state/
|
|
1
|
+
{"version":3,"sources":["../../../../src/api-handler/handlers/translatable-data.ts"],"sourcesContent":["import { type Data } from '../../state/react-page'\nimport { MakeswiftClient } from '../../client'\nimport { type ApiRequest, ApiResponse } from '../request-response'\n\ntype TranslatableDataResult = { translatableData: Record<string, Data> }\ntype TranslatableDataError = { message: string }\n\nexport type TranslatableDataResponse = TranslatableDataResult | TranslatableDataError\n\nexport async function translatableDataHandler(\n req: ApiRequest,\n { client }: { client: MakeswiftClient },\n): Promise<ApiResponse> {\n const body = await req.json()\n\n const { elementTree } = body\n\n if (elementTree == null) {\n return ApiResponse.json({ message: 'elementTree must be defined.' }, { status: 400 })\n }\n\n try {\n let translatableData = client.getTranslatableData(elementTree)\n return ApiResponse.json({ translatableData })\n } catch (error) {\n return ApiResponse.json({ message: 'Failed to get translatable data.' }, { status: 500 })\n }\n}\n"],"mappings":"AAEA,SAA0B,mBAAmB;AAO7C,eAAsB,wBACpB,KACA,EAAE,OAAO,GACa;AACtB,QAAM,OAAO,MAAM,IAAI,KAAK;AAE5B,QAAM,EAAE,YAAY,IAAI;AAExB,MAAI,eAAe,MAAM;AACvB,WAAO,YAAY,KAAK,EAAE,SAAS,+BAA+B,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EACtF;AAEA,MAAI;AACF,QAAI,mBAAmB,OAAO,oBAAoB,WAAW;AAC7D,WAAO,YAAY,KAAK,EAAE,iBAAiB,CAAC;AAAA,EAC9C,SAAS,OAAO;AACd,WAAO,YAAY,KAAK,EAAE,SAAS,mCAAmC,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC1F;AACF;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const changeTypeSchema = z.enum(["created", "updated", "deleted"]);
|
|
3
|
+
const componentChangeSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
locale: z.string().nullable(),
|
|
6
|
+
changeType: changeTypeSchema
|
|
7
|
+
});
|
|
8
|
+
const pageChangeSchema = z.object({
|
|
9
|
+
pageId: z.string().uuid(),
|
|
10
|
+
locale: z.string().nullable(),
|
|
11
|
+
changeType: changeTypeSchema,
|
|
12
|
+
pathname: z.string(),
|
|
13
|
+
previousPathname: z.string().optional()
|
|
14
|
+
});
|
|
15
|
+
const globalElementChangeSchema = z.object({
|
|
16
|
+
id: z.string().uuid(),
|
|
17
|
+
locale: z.string().nullable(),
|
|
18
|
+
changeType: changeTypeSchema
|
|
19
|
+
});
|
|
20
|
+
const swatchChangeSchema = z.object({
|
|
21
|
+
id: z.string().uuid(),
|
|
22
|
+
changeType: changeTypeSchema
|
|
23
|
+
});
|
|
24
|
+
const typographyChangeSchema = z.object({
|
|
25
|
+
id: z.string().uuid(),
|
|
26
|
+
changeType: changeTypeSchema
|
|
27
|
+
});
|
|
28
|
+
const diffProjectionSchema = z.object({
|
|
29
|
+
components: z.array(componentChangeSchema),
|
|
30
|
+
pages: z.array(pageChangeSchema),
|
|
31
|
+
globalElements: z.array(globalElementChangeSchema),
|
|
32
|
+
swatches: z.array(swatchChangeSchema),
|
|
33
|
+
typographies: z.array(typographyChangeSchema)
|
|
34
|
+
}).passthrough();
|
|
35
|
+
export {
|
|
36
|
+
diffProjectionSchema
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=diff-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/api-handler/handlers/webhook/diff-projection.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst changeTypeSchema = z.enum(['created', 'updated', 'deleted'])\n\n// `locale` is null for the default locale. We'd prefer explicit locale strings\n// (e.g. \"en-US\"), but both server and runtime treat the default locale as null\n// today — changing that requires a broader localization rework.\nconst componentChangeSchema = z.object({\n id: z.string(),\n locale: z.string().nullable(),\n changeType: changeTypeSchema,\n})\n\nconst pageChangeSchema = z.object({\n pageId: z.string().uuid(),\n locale: z.string().nullable(),\n changeType: changeTypeSchema,\n pathname: z.string(),\n previousPathname: z.string().optional(),\n})\n\nconst globalElementChangeSchema = z.object({\n id: z.string().uuid(),\n locale: z.string().nullable(),\n changeType: changeTypeSchema,\n})\n\nconst swatchChangeSchema = z.object({\n id: z.string().uuid(),\n changeType: changeTypeSchema,\n})\n\nconst typographyChangeSchema = z.object({\n id: z.string().uuid(),\n changeType: changeTypeSchema,\n})\n\nexport const diffProjectionSchema = z\n .object({\n components: z.array(componentChangeSchema),\n pages: z.array(pageChangeSchema),\n globalElements: z.array(globalElementChangeSchema),\n swatches: z.array(swatchChangeSchema),\n typographies: z.array(typographyChangeSchema),\n })\n // passthrough() preserves unknown resource types the server may add in the\n // future (e.g. `fonts`), so onPublish consumers can access them without a\n // runtime upgrade.\n .passthrough()\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,MAAM,mBAAmB,EAAE,KAAK,CAAC,WAAW,WAAW,SAAS,CAAC;AAKjE,MAAM,wBAAwB,EAAE,OAAO;AAAA,EACrC,IAAI,EAAE,OAAO;AAAA,EACb,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,YAAY;AACd,CAAC;AAED,MAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,QAAQ,EAAE,OAAO,EAAE,KAAK;AAAA,EACxB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,YAAY;AAAA,EACZ,UAAU,EAAE,OAAO;AAAA,EACnB,kBAAkB,EAAE,OAAO,EAAE,SAAS;AACxC,CAAC;AAED,MAAM,4BAA4B,EAAE,OAAO;AAAA,EACzC,IAAI,EAAE,OAAO,EAAE,KAAK;AAAA,EACpB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,YAAY;AACd,CAAC;AAED,MAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,IAAI,EAAE,OAAO,EAAE,KAAK;AAAA,EACpB,YAAY;AACd,CAAC;AAED,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,IAAI,EAAE,OAAO,EAAE,KAAK;AAAA,EACpB,YAAY;AACd,CAAC;AAEM,MAAM,uBAAuB,EACjC,OAAO;AAAA,EACN,YAAY,EAAE,MAAM,qBAAqB;AAAA,EACzC,OAAO,EAAE,MAAM,gBAAgB;AAAA,EAC/B,gBAAgB,EAAE,MAAM,yBAAyB;AAAA,EACjD,UAAU,EAAE,MAAM,kBAAkB;AAAA,EACpC,cAAc,EAAE,MAAM,sBAAsB;AAC9C,CAAC,EAIA,YAAY;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isAction } from "@reduxjs/toolkit";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "../state/actions/internal
|
|
3
|
+
InternalActionTypes
|
|
4
|
+
} from "../state/actions/internal";
|
|
5
5
|
import { BuilderActionTypes } from "../state/builder-api/actions";
|
|
6
6
|
const HostToBuilderActionTypes = {
|
|
7
7
|
...BuilderActionTypes,
|
|
8
|
-
REGISTER_COMPONENT:
|
|
9
|
-
UNREGISTER_COMPONENT:
|
|
8
|
+
REGISTER_COMPONENT: InternalActionTypes.REGISTER_COMPONENT,
|
|
9
|
+
UNREGISTER_COMPONENT: InternalActionTypes.UNREGISTER_COMPONENT
|
|
10
10
|
};
|
|
11
11
|
function isHostToBuilderAction(action) {
|
|
12
12
|
return isAction(action) && Object.hasOwn(HostToBuilderActionTypes, action.type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/builder/host-to-builder-actions.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\n// in the past, we reused the same action type for registering components both internally\n// and in the builder; they have been since split into two separate action types,\n// REGISTER_COMPONENT and REGISTER_BUILDER_COMPONENT, but we still have to expose what\n// are now internal actions to the builder for backward compatibility with the older runtimes\nimport {\n type RegisterComponentAction,\n type UnregisterComponentAction,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/builder/host-to-builder-actions.ts"],"sourcesContent":["import { isAction } from '@reduxjs/toolkit'\n\n// in the past, we reused the same action type for registering components both internally\n// and in the builder; they have been since split into two separate action types,\n// REGISTER_COMPONENT and REGISTER_BUILDER_COMPONENT, but we still have to expose what\n// are now internal actions to the builder for backward compatibility with the older runtimes\nimport {\n type RegisterComponentAction,\n type UnregisterComponentAction,\n InternalActionTypes,\n} from '../state/actions/internal'\n\nimport { type BuilderAction, BuilderActionTypes } from '../state/builder-api/actions'\n\nexport const HostToBuilderActionTypes = {\n ...BuilderActionTypes,\n REGISTER_COMPONENT: InternalActionTypes.REGISTER_COMPONENT,\n UNREGISTER_COMPONENT: InternalActionTypes.UNREGISTER_COMPONENT,\n} as const\n\nexport type HostToBuilderAction =\n | BuilderAction\n | RegisterComponentAction\n | UnregisterComponentAction\n\nexport function isHostToBuilderAction(action: unknown): action is HostToBuilderAction {\n return isAction(action) && Object.hasOwn(HostToBuilderActionTypes, action.type)\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AAMzB;AAAA,EAGE;AAAA,OACK;AAEP,SAA6B,0BAA0B;AAEhD,MAAM,2BAA2B;AAAA,EACtC,GAAG;AAAA,EACH,oBAAoB,oBAAoB;AAAA,EACxC,sBAAsB,oBAAoB;AAC5C;AAOO,SAAS,sBAAsB,QAAgD;AACpF,SAAO,SAAS,MAAM,KAAK,OAAO,OAAO,0BAA0B,OAAO,IAAI;AAChF;","names":[]}
|
|
@@ -2,7 +2,7 @@ export * from "./serialization";
|
|
|
2
2
|
export * from "./unstructured-introspection";
|
|
3
3
|
export * from "./host-to-builder-actions";
|
|
4
4
|
export * from "./host-api";
|
|
5
|
-
import { createBaseDocument } from "../state/
|
|
5
|
+
import { createBaseDocument } from "../state/react-page";
|
|
6
6
|
import * as Props from "../prop-controllers/descriptors";
|
|
7
7
|
import { TableFormFieldsMessageType } from "../prop-controllers/instances";
|
|
8
8
|
import * as Introspection from "../prop-controllers/introspection";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/builder/index.ts"],"sourcesContent":["export * from './serialization'\nexport * from './unstructured-introspection'\nexport * from './host-to-builder-actions'\nexport * from './host-api'\n\nexport { type Operation } from '../state/modules/read-write
|
|
1
|
+
{"version":3,"sources":["../../../src/builder/index.ts"],"sourcesContent":["export * from './serialization'\nexport * from './unstructured-introspection'\nexport * from './host-to-builder-actions'\nexport * from './host-api'\n\nexport { type Operation } from '../state/modules/read-write-documents'\n\nexport { createBaseDocument } from '../state/react-page'\n\nexport type {\n Descriptor as PropControllerDescriptor,\n DescriptorValueType as PropControllerDescriptorValueType,\n PanelDescriptor,\n PanelDescriptorType,\n PanelDescriptorValueType,\n} from '../prop-controllers/descriptors'\n\nexport * as Props from '../prop-controllers/descriptors'\nexport type { PropControllerMessage, TableFormFieldsMessage } from '../prop-controllers/instances'\nexport { TableFormFieldsMessageType } from '../prop-controllers/instances'\nexport * as Introspection from '../prop-controllers/introspection'\nexport { DELETED_PROP_CONTROLLER_TYPES } from '../prop-controllers/deleted'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAId,SAAS,0BAA0B;AAUnC,YAAY,WAAW;AAEvB,SAAS,kCAAkC;AAC3C,YAAY,mBAAmB;AAC/B,SAAS,qCAAqC;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deserializeObject
|
|
3
|
+
} from "@makeswift/controls";
|
|
4
|
+
import {
|
|
5
|
+
serializeLegacyControl,
|
|
6
|
+
deserializeLegacyControl
|
|
7
|
+
} from "../prop-controllers/serialization";
|
|
8
|
+
import { isLegacyDescriptor } from "../prop-controllers/descriptors";
|
|
9
|
+
import { deserializeControl as deserializeUnifiedControl } from "../controls/serialization/base";
|
|
10
|
+
import {
|
|
11
|
+
ClientMessagePortSerializationVisitor,
|
|
12
|
+
functionDeserializationPlugin
|
|
13
|
+
} from "../controls/serialization/message-port";
|
|
14
|
+
import {
|
|
15
|
+
deserializeControlRecords
|
|
16
|
+
} from "../controls/serialization";
|
|
17
|
+
export * from "../prop-controllers/serialization";
|
|
18
|
+
function serializeControl(control) {
|
|
19
|
+
if (isLegacyDescriptor(control)) {
|
|
20
|
+
return serializeLegacyControl(control);
|
|
21
|
+
}
|
|
22
|
+
const messagePortVisitor = new ClientMessagePortSerializationVisitor();
|
|
23
|
+
const serializedControl = control.accept(messagePortVisitor);
|
|
24
|
+
return [serializedControl, messagePortVisitor.getTransferables()];
|
|
25
|
+
}
|
|
26
|
+
function isSerializedLegacyControl(control) {
|
|
27
|
+
return "options" in control;
|
|
28
|
+
}
|
|
29
|
+
function deserializeControl(serializedControl, options) {
|
|
30
|
+
if (isSerializedLegacyControl(serializedControl)) {
|
|
31
|
+
const record = options?.plugins ? deserializeObject(serializedControl, options?.plugins) : serializedControl;
|
|
32
|
+
return deserializeLegacyControl(record);
|
|
33
|
+
}
|
|
34
|
+
const plugins = [functionDeserializationPlugin, ...options?.plugins ?? []];
|
|
35
|
+
return deserializeUnifiedControl(serializedControl, { plugins });
|
|
36
|
+
}
|
|
37
|
+
function serializeControls(controls) {
|
|
38
|
+
return Object.entries(controls).reduce(
|
|
39
|
+
([accControls, accTransferables], [key, control]) => {
|
|
40
|
+
const [serializedControl, transferables] = serializeControl(control);
|
|
41
|
+
return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]];
|
|
42
|
+
},
|
|
43
|
+
[{}, []]
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function deserializeControls(serializedControls, { onError, plugins } = {}) {
|
|
47
|
+
return deserializeControlRecords(
|
|
48
|
+
serializedControls,
|
|
49
|
+
(serializedControl, options) => deserializeControl(serializedControl, options),
|
|
50
|
+
{ onError, plugins }
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
deserializeControl,
|
|
55
|
+
deserializeControls,
|
|
56
|
+
serializeControl,
|
|
57
|
+
serializeControls
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=serialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/builder/serialization.ts"],"sourcesContent":["import {\n type Data,\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n DeserializationPlugin,\n deserializeObject,\n} from '@makeswift/controls'\n\nimport {\n type SerializedLegacyControl,\n type DeserializedLegacyControl,\n serializeLegacyControl,\n deserializeLegacyControl,\n} from '../prop-controllers/serialization'\n\nimport { type Descriptor, isLegacyDescriptor } from '../prop-controllers/descriptors'\n\nimport { deserializeControl as deserializeUnifiedControl } from '../controls/serialization/base'\nimport {\n type DeserializedFunction,\n type SerializedFunction,\n ClientMessagePortSerializationVisitor,\n functionDeserializationPlugin,\n} from '../controls/serialization/message-port'\n\nimport {\n type DeserializeControlRecordsOptions,\n deserializeControlRecords,\n} from '../controls/serialization'\n\nexport * from '../prop-controllers/serialization'\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport function serializeControl<T extends Data>(\n control: Descriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const messagePortVisitor = new ClientMessagePortSerializationVisitor()\n const serializedControl = control.accept(messagePortVisitor)\n return [serializedControl, messagePortVisitor.getTransferables()]\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport type DeserializeControlOptions = {\n plugins?: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n options?: DeserializeControlOptions,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n // Parity with controls deserialization logic below: \"preprocess\" serialized\n // legacy controls if the caller provided custom deserialization plugins\n const record = options?.plugins\n ? deserializeObject(serializedControl, options?.plugins)\n : serializedControl\n return deserializeLegacyControl(record as SerializedLegacyControl<T>)\n }\n\n const plugins = [functionDeserializationPlugin, ...(options?.plugins ?? [])]\n return deserializeUnifiedControl(serializedControl, { plugins })\n}\n\nexport function serializeControls(\n controls: Record<string, Descriptor>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, unknown>,\n { onError, plugins }: DeserializeControlRecordsOptions = {},\n): Record<string, DeserializedControl> {\n return deserializeControlRecords<DeserializedControl>(\n serializedControls,\n (serializedControl, options) => deserializeControl(serializedControl, options),\n { onError, plugins },\n )\n}\n\ntype AnyFunction = (...args: any[]) => any\n\nexport type Serialize<T> = T extends AnyFunction\n ? SerializedFunction<T>\n : T extends Record<string, unknown>\n ? { [K in keyof T]: Serialize<T[K]> }\n : T\n\nexport type Deserialize<T> =\n T extends SerializedFunction<infer U>\n ? DeserializedFunction<U>\n : T extends Record<string, unknown>\n ? { [K in keyof T]: Deserialize<T[K]> }\n : T\n"],"mappings":"AAAA;AAAA,EAKE;AAAA,OACK;AAEP;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAEP,SAA0B,0BAA0B;AAEpD,SAAS,sBAAsB,iCAAiC;AAChE;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EAEE;AAAA,OACK;AAEP,cAAc;AAQP,SAAS,iBACd,SACwC;AACxC,MAAI,mBAAmB,OAAO,GAAG;AAC/B,WAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,QAAM,qBAAqB,IAAI,sCAAsC;AACrE,QAAM,oBAAoB,QAAQ,OAAO,kBAAkB;AAC3D,SAAO,CAAC,mBAAmB,mBAAmB,iBAAiB,CAAC;AAClE;AAEA,SAAS,0BACP,SACuC;AACvC,SAAO,aAAa;AACtB;AAMO,SAAS,mBACd,mBACA,SACwB;AACxB,MAAI,0BAA0B,iBAAiB,GAAG;AAGhD,UAAM,SAAS,SAAS,UACpB,kBAAkB,mBAAmB,SAAS,OAAO,IACrD;AACJ,WAAO,yBAAyB,MAAoC;AAAA,EACtE;AAEA,QAAM,UAAU,CAAC,+BAA+B,GAAI,SAAS,WAAW,CAAC,CAAE;AAC3E,SAAO,0BAA0B,mBAAmB,EAAE,QAAQ,CAAC;AACjE;AAEO,SAAS,kBACd,UACqD;AACrD,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,CAAC,aAAa,gBAAgB,GAAG,CAAC,KAAK,OAAO,MAAM;AACnD,YAAM,CAAC,mBAAmB,aAAa,IAAI,iBAAiB,OAAO;AAEnE,aAAO,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,GAAG,kBAAkB,GAAG,CAAC,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAAA,IAC/F;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAEO,SAAS,oBACd,oBACA,EAAE,SAAS,QAAQ,IAAsC,CAAC,GACrB;AACrC,SAAO;AAAA,IACL;AAAA,IACA,CAAC,mBAAmB,YAAY,mBAAmB,mBAAmB,OAAO;AAAA,IAC7E,EAAE,SAAS,QAAQ;AAAA,EACrB;AACF;","names":[]}
|
package/dist/esm/client/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "../api";
|
|
5
5
|
import { GraphQLClient } from "../api/graphql/client";
|
|
6
6
|
import { FileQuery, IntrospectedResourcesQuery, TableQuery } from "../api/graphql/documents";
|
|
7
|
-
import { CacheData } from "../api/
|
|
7
|
+
import { CacheData } from "../api/react";
|
|
8
8
|
import {
|
|
9
9
|
getElementChildren,
|
|
10
10
|
getSwatchIds,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
getPropControllerDescriptors,
|
|
18
18
|
isElementReference
|
|
19
|
-
} from "../state/
|
|
19
|
+
} from "../state/react-page";
|
|
20
20
|
import { toIterablePaginationResult } from "../utils/pagination";
|
|
21
21
|
import { deterministicUUID } from "../utils/deterministic-uuid";
|
|
22
22
|
import { Schema } from "@makeswift/controls";
|
|
@@ -196,7 +196,7 @@ Received "${apiKey}" instead.`
|
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
this.graphqlClient = new GraphQLClient(new URL("graphql", apiOrigin).href, {
|
|
199
|
-
"makeswift-runtime-version": "0.26.
|
|
199
|
+
"makeswift-runtime-version": "0.26.5"
|
|
200
200
|
});
|
|
201
201
|
this.runtime = runtime;
|
|
202
202
|
}
|
|
@@ -205,7 +205,7 @@ Received "${apiKey}" instead.`
|
|
|
205
205
|
const requestHeaders = new Headers({
|
|
206
206
|
"x-api-key": this.apiKey,
|
|
207
207
|
"makeswift-site-api-key": this.apiKey,
|
|
208
|
-
"makeswift-runtime-version": "0.26.
|
|
208
|
+
"makeswift-runtime-version": "0.26.5"
|
|
209
209
|
});
|
|
210
210
|
if (siteVersion?.token) {
|
|
211
211
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -652,7 +652,7 @@ Received "${apiKey}" instead.`
|
|
|
652
652
|
headers: {
|
|
653
653
|
"x-api-key": this.apiKey,
|
|
654
654
|
"makeswift-site-api-key": this.apiKey,
|
|
655
|
-
"makeswift-runtime-version": "0.26.
|
|
655
|
+
"makeswift-runtime-version": "0.26.5",
|
|
656
656
|
"content-type": "application/json"
|
|
657
657
|
},
|
|
658
658
|
body: JSON.stringify({ token }),
|