@makeswift/runtime 0.14.5 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/react.js +3 -17
- package/dist/cjs/api/react.js.map +1 -1
- package/dist/cjs/api/resource-types.js +24 -0
- package/dist/cjs/api/resource-types.js.map +1 -0
- package/dist/cjs/components/builtin/Box/Box.js +1 -0
- package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
- package/dist/cjs/components/builtin/Box/animations.js +1 -0
- package/dist/cjs/components/builtin/Box/animations.js.map +1 -1
- package/dist/cjs/components/builtin/Box/register.js +2 -3
- package/dist/cjs/components/builtin/Box/register.js.map +1 -1
- package/dist/cjs/components/builtin/Button/register.js +2 -3
- package/dist/cjs/components/builtin/Button/register.js.map +1 -1
- package/dist/cjs/components/builtin/Carousel/Carousel.js +1 -0
- package/dist/cjs/components/builtin/Carousel/Carousel.js.map +1 -1
- package/dist/cjs/components/builtin/Carousel/register.js +2 -3
- package/dist/cjs/components/builtin/Carousel/register.js.map +1 -1
- package/dist/cjs/components/builtin/Countdown/Countdown.js +1 -0
- package/dist/cjs/components/builtin/Countdown/Countdown.js.map +1 -1
- package/dist/cjs/components/builtin/Countdown/register.js +2 -3
- package/dist/cjs/components/builtin/Countdown/register.js.map +1 -1
- package/dist/cjs/components/builtin/Divider/register.js +2 -3
- package/dist/cjs/components/builtin/Divider/register.js.map +1 -1
- package/dist/cjs/components/builtin/Embed/Embed.js +1 -0
- package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/cjs/components/builtin/Embed/register.js +2 -3
- package/dist/cjs/components/builtin/Embed/register.js.map +1 -1
- package/dist/cjs/components/builtin/Form/Form.js +3 -2
- package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
- package/dist/cjs/components/builtin/Form/context/FormContext.js +1 -0
- package/dist/cjs/components/builtin/Form/context/FormContext.js.map +1 -1
- package/dist/cjs/components/builtin/Form/register.js +2 -3
- package/dist/cjs/components/builtin/Form/register.js.map +1 -1
- package/dist/cjs/components/builtin/Image/Image.js +1 -0
- package/dist/cjs/components/builtin/Image/Image.js.map +1 -1
- package/dist/cjs/components/builtin/Image/register.js +2 -3
- package/dist/cjs/components/builtin/Image/register.js.map +1 -1
- package/dist/cjs/components/builtin/Navigation/Navigation.js +1 -0
- package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
- package/dist/cjs/components/builtin/Navigation/register.js +2 -3
- package/dist/cjs/components/builtin/Navigation/register.js.map +1 -1
- package/dist/cjs/components/builtin/Root/register.js +2 -3
- package/dist/cjs/components/builtin/Root/register.js.map +1 -1
- package/dist/cjs/components/builtin/SocialLinks/register.js +2 -3
- package/dist/cjs/components/builtin/SocialLinks/register.js.map +1 -1
- package/dist/cjs/components/builtin/Text/register.js +2 -3
- package/dist/cjs/components/builtin/Text/register.js.map +1 -1
- package/dist/cjs/components/builtin/Video/Video.js +1 -0
- package/dist/cjs/components/builtin/Video/Video.js.map +1 -1
- package/dist/cjs/components/builtin/Video/register.js +2 -3
- package/dist/cjs/components/builtin/Video/register.js.map +1 -1
- package/dist/cjs/components/hooks/usePageSnippets.js +93 -0
- package/dist/cjs/components/hooks/usePageSnippets.js.map +1 -0
- package/dist/cjs/components/hooks/useRouterLocaleSync.js +49 -0
- package/dist/cjs/components/hooks/useRouterLocaleSync.js.map +1 -0
- package/dist/cjs/components/page/BodySnippet.js +1 -1
- package/dist/cjs/components/page/BodySnippet.js.map +1 -1
- package/dist/cjs/components/page/HeadSnippet.js +134 -0
- package/dist/cjs/components/page/HeadSnippet.js.map +1 -0
- package/dist/cjs/components/page/Page.js +9 -178
- package/dist/cjs/components/page/Page.js.map +1 -1
- package/dist/cjs/components/page/PageHead.js +109 -0
- package/dist/cjs/components/page/PageHead.js.map +1 -0
- package/dist/cjs/components/shared/BackgroundsContainer/index.js +1 -0
- package/dist/cjs/components/shared/BackgroundsContainer/index.js.map +1 -1
- package/dist/cjs/components/shared/Link/index.js +5 -1
- package/dist/cjs/components/shared/Link/index.js.map +1 -1
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/element-tree.js +17 -8
- package/dist/cjs/next/api-handler/handlers/element-tree.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/fonts.js +7 -2
- package/dist/cjs/next/api-handler/handlers/fonts.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/manifest.js +20 -8
- package/dist/cjs/next/api-handler/handlers/manifest.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/merge-translated-data.js +17 -6
- package/dist/cjs/next/api-handler/handlers/merge-translated-data.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/proxy-draft-mode.js +69 -0
- package/dist/cjs/next/api-handler/handlers/proxy-draft-mode.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/proxy-preview-mode.js +55 -44
- package/dist/cjs/next/api-handler/handlers/proxy-preview-mode.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/revalidate.js +27 -16
- package/dist/cjs/next/api-handler/handlers/revalidate.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/translatable-data.js +16 -5
- package/dist/cjs/next/api-handler/handlers/translatable-data.js.map +1 -1
- package/dist/cjs/next/api-handler/index.js +68 -34
- package/dist/cjs/next/api-handler/index.js.map +1 -1
- package/dist/cjs/next/client.js +3 -2
- package/dist/cjs/next/client.js.map +1 -1
- package/dist/cjs/next/components/head-tags.js +77 -0
- package/dist/cjs/next/components/head-tags.js.map +1 -0
- package/dist/cjs/next/components/page.js +56 -0
- package/dist/cjs/next/components/page.js.map +1 -0
- package/dist/cjs/next/context/makeswift-host-api-client.js +46 -0
- package/dist/cjs/next/context/makeswift-host-api-client.js.map +1 -0
- package/dist/cjs/next/context/react-runtime.js +44 -0
- package/dist/cjs/next/context/react-runtime.js.map +1 -0
- package/dist/cjs/next/draft-mode/draft-mode-script.js +123 -0
- package/dist/cjs/next/draft-mode/draft-mode-script.js.map +1 -0
- package/dist/cjs/next/draft-mode/index.js +56 -0
- package/dist/cjs/next/draft-mode/index.js.map +1 -0
- package/dist/cjs/next/hooks/use-is-pages-router.js +37 -0
- package/dist/cjs/next/hooks/use-is-pages-router.js.map +1 -0
- package/dist/cjs/next/index.js +10 -36
- package/dist/cjs/next/index.js.map +1 -1
- package/dist/cjs/next/preview-mode.js +4 -2
- package/dist/cjs/next/preview-mode.js.map +1 -1
- package/dist/cjs/next/root-style-registry.js +90 -0
- package/dist/cjs/next/root-style-registry.js.map +1 -0
- package/dist/cjs/next/server.js +8 -2
- package/dist/cjs/next/server.js.map +1 -1
- package/dist/cjs/runtimes/react/components/Element.js +1 -0
- package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
- package/dist/cjs/runtimes/react/components/LiveProvider.js +6 -13
- package/dist/cjs/runtimes/react/components/LiveProvider.js.map +1 -1
- package/dist/cjs/runtimes/react/components/PreviewProvider.js +6 -8
- package/dist/cjs/runtimes/react/components/PreviewProvider.js.map +1 -1
- package/dist/cjs/runtimes/react/components/RuntimeProvider.js +3 -3
- package/dist/cjs/runtimes/react/components/RuntimeProvider.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/link.js +1 -1
- package/dist/cjs/runtimes/react/controls/link.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -4
- 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 +4 -11
- package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/makeswift-api.js +11 -10
- package/dist/cjs/runtimes/react/hooks/makeswift-api.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-document-key.js +1 -0
- package/dist/cjs/runtimes/react/hooks/use-document-key.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-page-id.js +1 -0
- package/dist/cjs/runtimes/react/hooks/use-page-id.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-store.js +1 -0
- package/dist/cjs/runtimes/react/hooks/use-store.js.map +1 -1
- package/dist/cjs/runtimes/react/use-global-style.js +15 -10
- package/dist/cjs/runtimes/react/use-global-style.js.map +1 -1
- package/dist/cjs/runtimes/react/use-style.js +7 -6
- package/dist/cjs/runtimes/react/use-style.js.map +1 -1
- package/dist/cjs/state/actions.js +0 -25
- package/dist/cjs/state/actions.js.map +1 -1
- package/dist/cjs/state/react-builder-preview.js +1 -24
- package/dist/cjs/state/react-builder-preview.js.map +1 -1
- package/dist/esm/api/react.js +2 -14
- package/dist/esm/api/react.js.map +1 -1
- package/dist/esm/api/resource-types.js +8 -0
- package/dist/esm/api/resource-types.js.map +1 -0
- package/dist/esm/components/builtin/Box/Box.js +1 -0
- package/dist/esm/components/builtin/Box/Box.js.map +1 -1
- package/dist/esm/components/builtin/Box/animations.js +1 -0
- package/dist/esm/components/builtin/Box/animations.js.map +1 -1
- package/dist/esm/components/builtin/Box/register.js +2 -3
- package/dist/esm/components/builtin/Box/register.js.map +1 -1
- package/dist/esm/components/builtin/Button/register.js +2 -3
- package/dist/esm/components/builtin/Button/register.js.map +1 -1
- package/dist/esm/components/builtin/Carousel/Carousel.js +1 -0
- package/dist/esm/components/builtin/Carousel/Carousel.js.map +1 -1
- package/dist/esm/components/builtin/Carousel/register.js +2 -3
- package/dist/esm/components/builtin/Carousel/register.js.map +1 -1
- package/dist/esm/components/builtin/Countdown/Countdown.js +1 -0
- package/dist/esm/components/builtin/Countdown/Countdown.js.map +1 -1
- package/dist/esm/components/builtin/Countdown/register.js +2 -3
- package/dist/esm/components/builtin/Countdown/register.js.map +1 -1
- package/dist/esm/components/builtin/Divider/register.js +2 -3
- package/dist/esm/components/builtin/Divider/register.js.map +1 -1
- package/dist/esm/components/builtin/Embed/Embed.js +1 -0
- package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/esm/components/builtin/Embed/register.js +2 -3
- package/dist/esm/components/builtin/Embed/register.js.map +1 -1
- package/dist/esm/components/builtin/Form/Form.js +3 -2
- package/dist/esm/components/builtin/Form/Form.js.map +1 -1
- package/dist/esm/components/builtin/Form/context/FormContext.js +1 -0
- package/dist/esm/components/builtin/Form/context/FormContext.js.map +1 -1
- package/dist/esm/components/builtin/Form/register.js +2 -3
- package/dist/esm/components/builtin/Form/register.js.map +1 -1
- package/dist/esm/components/builtin/Image/Image.js +1 -0
- package/dist/esm/components/builtin/Image/Image.js.map +1 -1
- package/dist/esm/components/builtin/Image/register.js +2 -3
- package/dist/esm/components/builtin/Image/register.js.map +1 -1
- package/dist/esm/components/builtin/Navigation/Navigation.js +1 -0
- package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/builtin/Navigation/register.js +2 -3
- package/dist/esm/components/builtin/Navigation/register.js.map +1 -1
- package/dist/esm/components/builtin/Root/register.js +2 -3
- package/dist/esm/components/builtin/Root/register.js.map +1 -1
- package/dist/esm/components/builtin/SocialLinks/register.js +2 -3
- package/dist/esm/components/builtin/SocialLinks/register.js.map +1 -1
- package/dist/esm/components/builtin/Text/register.js +2 -3
- package/dist/esm/components/builtin/Text/register.js.map +1 -1
- package/dist/esm/components/builtin/Video/Video.js +1 -0
- package/dist/esm/components/builtin/Video/Video.js.map +1 -1
- package/dist/esm/components/builtin/Video/register.js +2 -3
- package/dist/esm/components/builtin/Video/register.js.map +1 -1
- package/dist/esm/components/hooks/usePageSnippets.js +59 -0
- package/dist/esm/components/hooks/usePageSnippets.js.map +1 -0
- package/dist/esm/components/hooks/useRouterLocaleSync.js +25 -0
- package/dist/esm/components/hooks/useRouterLocaleSync.js.map +1 -0
- package/dist/esm/components/page/BodySnippet.js +1 -1
- package/dist/esm/components/page/BodySnippet.js.map +1 -1
- package/dist/esm/components/page/HeadSnippet.js +100 -0
- package/dist/esm/components/page/HeadSnippet.js.map +1 -0
- package/dist/esm/components/page/Page.js +7 -166
- package/dist/esm/components/page/Page.js.map +1 -1
- package/dist/esm/components/page/PageHead.js +85 -0
- package/dist/esm/components/page/PageHead.js.map +1 -0
- package/dist/esm/components/shared/BackgroundsContainer/index.js +1 -0
- package/dist/esm/components/shared/BackgroundsContainer/index.js.map +1 -1
- package/dist/esm/components/shared/Link/index.js +5 -1
- package/dist/esm/components/shared/Link/index.js.map +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/element-tree.js +17 -8
- package/dist/esm/next/api-handler/handlers/element-tree.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/fonts.js +7 -2
- package/dist/esm/next/api-handler/handlers/fonts.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/manifest.js +20 -8
- package/dist/esm/next/api-handler/handlers/manifest.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/merge-translated-data.js +17 -6
- package/dist/esm/next/api-handler/handlers/merge-translated-data.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/proxy-draft-mode.js +49 -0
- package/dist/esm/next/api-handler/handlers/proxy-draft-mode.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/proxy-preview-mode.js +55 -44
- package/dist/esm/next/api-handler/handlers/proxy-preview-mode.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/revalidate.js +27 -16
- package/dist/esm/next/api-handler/handlers/revalidate.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/translatable-data.js +16 -5
- package/dist/esm/next/api-handler/handlers/translatable-data.js.map +1 -1
- package/dist/esm/next/api-handler/index.js +68 -34
- package/dist/esm/next/api-handler/index.js.map +1 -1
- package/dist/esm/next/client.js +3 -2
- package/dist/esm/next/client.js.map +1 -1
- package/dist/esm/next/components/head-tags.js +40 -0
- package/dist/esm/next/components/head-tags.js.map +1 -0
- package/dist/esm/next/components/page.js +32 -0
- package/dist/esm/next/components/page.js.map +1 -0
- package/dist/esm/next/context/makeswift-host-api-client.js +21 -0
- package/dist/esm/next/context/makeswift-host-api-client.js.map +1 -0
- package/dist/esm/next/context/react-runtime.js +19 -0
- package/dist/esm/next/context/react-runtime.js.map +1 -0
- package/dist/esm/next/draft-mode/draft-mode-script.js +99 -0
- package/dist/esm/next/draft-mode/draft-mode-script.js.map +1 -0
- package/dist/esm/next/draft-mode/index.js +30 -0
- package/dist/esm/next/draft-mode/index.js.map +1 -0
- package/dist/esm/next/hooks/use-is-pages-router.js +13 -0
- package/dist/esm/next/hooks/use-is-pages-router.js.map +1 -0
- package/dist/esm/next/index.js +5 -32
- package/dist/esm/next/index.js.map +1 -1
- package/dist/esm/next/preview-mode.js +2 -1
- package/dist/esm/next/preview-mode.js.map +1 -1
- package/dist/esm/next/root-style-registry.js +55 -0
- package/dist/esm/next/root-style-registry.js.map +1 -0
- package/dist/esm/next/server.js +5 -1
- package/dist/esm/next/server.js.map +1 -1
- package/dist/esm/runtimes/react/components/Element.js +1 -0
- package/dist/esm/runtimes/react/components/Element.js.map +1 -1
- package/dist/esm/runtimes/react/components/LiveProvider.js +6 -13
- package/dist/esm/runtimes/react/components/LiveProvider.js.map +1 -1
- package/dist/esm/runtimes/react/components/PreviewProvider.js +6 -8
- package/dist/esm/runtimes/react/components/PreviewProvider.js.map +1 -1
- package/dist/esm/runtimes/react/components/RuntimeProvider.js +3 -3
- package/dist/esm/runtimes/react/components/RuntimeProvider.js.map +1 -1
- package/dist/esm/runtimes/react/controls/link.js +1 -1
- package/dist/esm/runtimes/react/controls/link.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +3 -5
- 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 +4 -11
- package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/makeswift-api.js +11 -10
- package/dist/esm/runtimes/react/hooks/makeswift-api.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-document-key.js +1 -0
- package/dist/esm/runtimes/react/hooks/use-document-key.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-page-id.js +1 -0
- package/dist/esm/runtimes/react/hooks/use-page-id.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-store.js +1 -0
- package/dist/esm/runtimes/react/hooks/use-store.js.map +1 -1
- package/dist/esm/runtimes/react/use-global-style.js +8 -3
- package/dist/esm/runtimes/react/use-global-style.js.map +1 -1
- package/dist/esm/runtimes/react/use-style.js +2 -1
- package/dist/esm/runtimes/react/use-style.js.map +1 -1
- package/dist/esm/state/actions.js +0 -22
- package/dist/esm/state/actions.js.map +1 -1
- package/dist/esm/state/react-builder-preview.js +2 -28
- package/dist/esm/state/react-builder-preview.js.map +1 -1
- package/dist/types/api/react.d.ts +1 -9
- package/dist/types/api/react.d.ts.map +1 -1
- package/dist/types/api/resource-types.d.ts +20 -0
- package/dist/types/api/resource-types.d.ts.map +1 -0
- package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/animations.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Button/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/components/builtin/Carousel/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Divider/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/components/builtin/Embed/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/components/builtin/Form/context/FormContext.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/components/builtin/Image/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Root/register.d.ts.map +1 -1
- package/dist/types/components/builtin/SocialLinks/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Video/Video.d.ts.map +1 -1
- package/dist/types/components/builtin/Video/register.d.ts.map +1 -1
- package/dist/types/components/hooks/usePageSnippets.d.ts +36 -0
- package/dist/types/components/hooks/usePageSnippets.d.ts.map +1 -0
- package/dist/types/components/hooks/useRouterLocaleSync.d.ts +2 -0
- package/dist/types/components/hooks/useRouterLocaleSync.d.ts.map +1 -0
- package/dist/types/components/page/BodySnippet.d.ts.map +1 -1
- package/dist/types/components/page/HeadSnippet.d.ts +7 -0
- package/dist/types/components/page/HeadSnippet.d.ts.map +1 -0
- package/dist/types/components/page/Page.d.ts.map +1 -1
- package/dist/types/components/page/PageHead.d.ts +8 -0
- package/dist/types/components/page/PageHead.d.ts.map +1 -0
- package/dist/types/components/shared/BackgroundsContainer/index.d.ts.map +1 -1
- package/dist/types/components/shared/Link/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/element-tree.d.ts +9 -1
- package/dist/types/next/api-handler/handlers/element-tree.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/fonts.d.ts +10 -1
- package/dist/types/next/api-handler/handlers/fonts.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/manifest.d.ts +9 -0
- package/dist/types/next/api-handler/handlers/manifest.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/merge-translated-data.d.ts +7 -0
- package/dist/types/next/api-handler/handlers/merge-translated-data.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/proxy-draft-mode.d.ts +20 -0
- package/dist/types/next/api-handler/handlers/proxy-draft-mode.d.ts.map +1 -0
- package/dist/types/next/api-handler/handlers/proxy-preview-mode.d.ts +14 -2
- package/dist/types/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/revalidate.d.ts +9 -0
- package/dist/types/next/api-handler/handlers/revalidate.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/translatable-data.d.ts +7 -0
- package/dist/types/next/api-handler/handlers/translatable-data.d.ts.map +1 -1
- package/dist/types/next/api-handler/index.d.ts +11 -3
- package/dist/types/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/next/client.d.ts.map +1 -1
- package/dist/types/next/components/head-tags.d.ts +19 -0
- package/dist/types/next/components/head-tags.d.ts.map +1 -0
- package/dist/types/next/components/page.d.ts +7 -0
- package/dist/types/next/components/page.d.ts.map +1 -0
- package/dist/types/next/context/makeswift-host-api-client.d.ts +8 -0
- package/dist/types/next/context/makeswift-host-api-client.d.ts.map +1 -0
- package/dist/types/next/context/react-runtime.d.ts +8 -0
- package/dist/types/next/context/react-runtime.d.ts.map +1 -0
- package/dist/types/next/draft-mode/draft-mode-script.d.ts +6 -0
- package/dist/types/next/draft-mode/draft-mode-script.d.ts.map +1 -0
- package/dist/types/next/draft-mode/index.d.ts +15 -0
- package/dist/types/next/draft-mode/index.d.ts.map +1 -0
- package/dist/types/next/hooks/use-is-pages-router.d.ts +2 -0
- package/dist/types/next/hooks/use-is-pages-router.d.ts.map +1 -0
- package/dist/types/next/index.d.ts +4 -9
- package/dist/types/next/index.d.ts.map +1 -1
- package/dist/types/next/preview-mode.d.ts +1 -1
- package/dist/types/next/preview-mode.d.ts.map +1 -1
- package/dist/types/next/root-style-registry.d.ts +7 -0
- package/dist/types/next/root-style-registry.d.ts.map +1 -0
- package/dist/types/next/server.d.ts +2 -0
- package/dist/types/next/server.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/LiveProvider.d.ts +3 -5
- package/dist/types/runtimes/react/components/LiveProvider.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/PreviewProvider.d.ts +3 -5
- package/dist/types/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/RuntimeProvider.d.ts +2 -2
- package/dist/types/runtimes/react/components/RuntimeProvider.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/link.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/makeswift-api.d.ts +2 -1
- package/dist/types/runtimes/react/hooks/makeswift-api.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-document-key.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-page-id.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
- package/dist/types/runtimes/react/use-global-style.d.ts.map +1 -1
- package/dist/types/runtimes/react/use-style.d.ts.map +1 -1
- package/dist/types/state/actions.d.ts +1 -19
- package/dist/types/state/actions.d.ts.map +1 -1
- package/dist/types/state/react-builder-preview.d.ts +3 -3
- package/dist/types/state/react-builder-preview.d.ts.map +1 -1
- package/next/plugin/package.json +1 -0
- package/package.json +6 -10
- package/dist/cjs/next/dynamic.js +0 -52
- package/dist/cjs/next/dynamic.js.map +0 -1
- package/dist/esm/next/dynamic.js +0 -31
- package/dist/esm/next/dynamic.js.map +0 -1
- package/dist/types/next/dynamic.d.ts +0 -13
- package/dist/types/next/dynamic.d.ts.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { useEffect, useRef } from "react";
|
|
2
3
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
3
|
-
import {
|
|
4
|
+
import { useMakeswiftHostApiClient } from "../../../next/context/makeswift-host-api-client";
|
|
4
5
|
function useSwatch(swatchId) {
|
|
5
|
-
const client =
|
|
6
|
+
const client = useMakeswiftHostApiClient();
|
|
6
7
|
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
7
8
|
const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
8
9
|
useEffect(() => {
|
|
@@ -12,7 +13,7 @@ function useSwatch(swatchId) {
|
|
|
12
13
|
return swatch;
|
|
13
14
|
}
|
|
14
15
|
function useSwatches(swatchIds) {
|
|
15
|
-
const client =
|
|
16
|
+
const client = useMakeswiftHostApiClient();
|
|
16
17
|
const lastSnapshot = useRef();
|
|
17
18
|
function getSnapshot() {
|
|
18
19
|
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
@@ -28,7 +29,7 @@ function useSwatches(swatchIds) {
|
|
|
28
29
|
return swatches;
|
|
29
30
|
}
|
|
30
31
|
function useFile(fileId) {
|
|
31
|
-
const client =
|
|
32
|
+
const client = useMakeswiftHostApiClient();
|
|
32
33
|
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
33
34
|
const file = useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
34
35
|
useEffect(() => {
|
|
@@ -38,7 +39,7 @@ function useFile(fileId) {
|
|
|
38
39
|
return file;
|
|
39
40
|
}
|
|
40
41
|
function useFiles(fileIds) {
|
|
41
|
-
const client =
|
|
42
|
+
const client = useMakeswiftHostApiClient();
|
|
42
43
|
const lastSnapshot = useRef();
|
|
43
44
|
function getSnapshot() {
|
|
44
45
|
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
@@ -54,7 +55,7 @@ function useFiles(fileIds) {
|
|
|
54
55
|
return files;
|
|
55
56
|
}
|
|
56
57
|
function useTypography(typographyId) {
|
|
57
|
-
const client =
|
|
58
|
+
const client = useMakeswiftHostApiClient();
|
|
58
59
|
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
59
60
|
const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
60
61
|
useEffect(() => {
|
|
@@ -64,7 +65,7 @@ function useTypography(typographyId) {
|
|
|
64
65
|
return typography;
|
|
65
66
|
}
|
|
66
67
|
function useGlobalElement(globalElementId) {
|
|
67
|
-
const client =
|
|
68
|
+
const client = useMakeswiftHostApiClient();
|
|
68
69
|
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
69
70
|
const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
70
71
|
useEffect(() => {
|
|
@@ -74,7 +75,7 @@ function useGlobalElement(globalElementId) {
|
|
|
74
75
|
return globalElement;
|
|
75
76
|
}
|
|
76
77
|
function useLocalizedGlobalElement(globalElementId) {
|
|
77
|
-
const client =
|
|
78
|
+
const client = useMakeswiftHostApiClient();
|
|
78
79
|
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
79
80
|
const localizedGlobalElement = useSyncExternalStore(
|
|
80
81
|
client.subscribe,
|
|
@@ -89,7 +90,7 @@ function useLocalizedGlobalElement(globalElementId) {
|
|
|
89
90
|
return localizedGlobalElement;
|
|
90
91
|
}
|
|
91
92
|
function usePagePathnameSlice(pageId) {
|
|
92
|
-
const client =
|
|
93
|
+
const client = useMakeswiftHostApiClient();
|
|
93
94
|
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
94
95
|
const pagePathnameSlice = useSyncExternalStore(
|
|
95
96
|
client.subscribe,
|
|
@@ -103,7 +104,7 @@ function usePagePathnameSlice(pageId) {
|
|
|
103
104
|
return pagePathnameSlice;
|
|
104
105
|
}
|
|
105
106
|
function useTable(tableId) {
|
|
106
|
-
const client =
|
|
107
|
+
const client = useMakeswiftHostApiClient();
|
|
107
108
|
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
108
109
|
const table = useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
109
110
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/makeswift-api.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/makeswift-api.ts"],"sourcesContent":["'use client'\n\nimport { useEffect, useRef } from 'react'\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\nimport {\n File,\n GlobalElement,\n LocalizedGlobalElement,\n Swatch,\n Table,\n Typography,\n} from '../../../api'\nimport { PagePathnameSlice } from '../../../api/resource-types'\nimport { useMakeswiftHostApiClient } from '../../../next/context/makeswift-host-api-client'\n\nexport function useSwatch(swatchId: string | null): Swatch | null {\n const client = useMakeswiftHostApiClient()\n const readSwatch = () => (swatchId == null ? null : client.readSwatch(swatchId))\n const swatch = useSyncExternalStore(client.subscribe, readSwatch, readSwatch)\n\n useEffect(() => {\n if (swatchId != null) client.fetchSwatch(swatchId).catch(console.error)\n }, [client, swatchId])\n\n return swatch\n}\n\nexport function useSwatches(swatchIds: string[]): (Swatch | null)[] {\n const client = useMakeswiftHostApiClient()\n const lastSnapshot = useRef<(Swatch | null)[]>()\n\n function getSnapshot() {\n const swatches = swatchIds.map(swatchId => client.readSwatch(swatchId))\n\n if (\n lastSnapshot.current != null &&\n lastSnapshot.current.length === swatches.length &&\n lastSnapshot.current.every((swatch, idx) => swatches[idx] === swatch)\n ) {\n return lastSnapshot.current\n }\n\n return (lastSnapshot.current = swatches)\n }\n\n const swatches = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot)\n\n useEffect(() => {\n Promise.all(swatchIds.map(swatchId => client.fetchSwatch(swatchId))).catch(console.error)\n }, [client, swatchIds])\n\n return swatches\n}\n\nexport function useFile(fileId: string | null): File | null {\n const client = useMakeswiftHostApiClient()\n const readFile = () => (fileId == null ? null : client.readFile(fileId))\n const file = useSyncExternalStore(client.subscribe, readFile, readFile)\n\n useEffect(() => {\n if (fileId != null) client.fetchFile(fileId)\n }, [client, fileId])\n\n return file\n}\n\nexport function useFiles(fileIds: string[]): (File | null)[] {\n const client = useMakeswiftHostApiClient()\n const lastSnapshot = useRef<(File | null)[]>()\n\n function getSnapshot() {\n const files = fileIds.map(fileId => client.readFile(fileId))\n\n if (\n lastSnapshot.current != null &&\n lastSnapshot.current.length === files.length &&\n lastSnapshot.current.every((file, idx) => files[idx] === file)\n ) {\n return lastSnapshot.current\n }\n\n return (lastSnapshot.current = files)\n }\n\n const files = useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot)\n\n useEffect(() => {\n Promise.all(fileIds.map(fileId => client.fetchFile(fileId))).catch(console.error)\n }, [client, fileIds])\n\n return files\n}\n\nexport function useTypography(typographyId: string | null): Typography | null {\n const client = useMakeswiftHostApiClient()\n const readTypography = () => (typographyId == null ? null : client.readTypography(typographyId))\n const typography = useSyncExternalStore(client.subscribe, readTypography, readTypography)\n\n useEffect(() => {\n if (typographyId != null) client.fetchTypography(typographyId).catch(console.error)\n }, [client, typographyId])\n\n return typography\n}\n\nexport function useGlobalElement(globalElementId: string | null): GlobalElement | null {\n const client = useMakeswiftHostApiClient()\n const readGlobalElement = () =>\n globalElementId == null ? null : client.readGlobalElement(globalElementId)\n const globalElement = useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement)\n\n useEffect(() => {\n if (globalElementId != null) client.fetchGlobalElement(globalElementId).catch(console.error)\n }, [client, globalElementId])\n\n return globalElement\n}\n\nexport function useLocalizedGlobalElement(\n globalElementId: string | null,\n): LocalizedGlobalElement | null {\n const client = useMakeswiftHostApiClient()\n const readLocalizedGlobalElement = () =>\n globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId)\n const localizedGlobalElement = useSyncExternalStore(\n client.subscribe,\n readLocalizedGlobalElement,\n readLocalizedGlobalElement,\n )\n\n useEffect(() => {\n if (globalElementId != null) {\n client.fetchLocalizedGlobalElement(globalElementId).catch(console.error)\n }\n }, [client, globalElementId])\n\n return localizedGlobalElement\n}\n\nexport function usePagePathnameSlice(pageId: string | null): PagePathnameSlice | null {\n const client = useMakeswiftHostApiClient()\n const readPagePathnameSlice = () => (pageId == null ? null : client.readPagePathnameSlice(pageId))\n const pagePathnameSlice = useSyncExternalStore(\n client.subscribe,\n readPagePathnameSlice,\n readPagePathnameSlice,\n )\n\n useEffect(() => {\n if (pageId != null) client.fetchPagePathnameSlice(pageId).catch(console.error)\n }, [client, pageId])\n\n return pagePathnameSlice\n}\n\nexport function useTable(tableId: string | null): Table | null {\n const client = useMakeswiftHostApiClient()\n const readTable = () => (tableId == null ? null : client.readTable(tableId))\n const table = useSyncExternalStore(client.subscribe, readTable, readTable)\n\n useEffect(() => {\n if (tableId != null) client.fetchTable(tableId).catch(console.error)\n }, [client, tableId])\n\n return table\n}\n"],"mappings":";AAEA,SAAS,WAAW,cAAc;AAClC,SAAS,4BAA4B;AAUrC,SAAS,iCAAiC;AAEnC,SAAS,UAAU,UAAwC;AAChE,QAAM,SAAS,0BAA0B;AACzC,QAAM,aAAa,MAAO,YAAY,OAAO,OAAO,OAAO,WAAW,QAAQ;AAC9E,QAAM,SAAS,qBAAqB,OAAO,WAAW,YAAY,UAAU;AAE5E,YAAU,MAAM;AACd,QAAI,YAAY;AAAM,aAAO,YAAY,QAAQ,EAAE,MAAM,QAAQ,KAAK;AAAA,EACxE,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,SAAO;AACT;AAEO,SAAS,YAAY,WAAwC;AAClE,QAAM,SAAS,0BAA0B;AACzC,QAAM,eAAe,OAA0B;AAE/C,WAAS,cAAc;AACrB,UAAMA,YAAW,UAAU,IAAI,cAAY,OAAO,WAAW,QAAQ,CAAC;AAEtE,QACE,aAAa,WAAW,QACxB,aAAa,QAAQ,WAAWA,UAAS,UACzC,aAAa,QAAQ,MAAM,CAAC,QAAQ,QAAQA,UAAS,GAAG,MAAM,MAAM,GACpE;AACA,aAAO,aAAa;AAAA,IACtB;AAEA,WAAQ,aAAa,UAAUA;AAAA,EACjC;AAEA,QAAM,WAAW,qBAAqB,OAAO,WAAW,aAAa,WAAW;AAEhF,YAAU,MAAM;AACd,YAAQ,IAAI,UAAU,IAAI,cAAY,OAAO,YAAY,QAAQ,CAAC,CAAC,EAA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,WAAW,WAAW,SAAS;AAEzE,YAAU,MAAM;AACd,QAAI,WAAW;AAAM,aAAO,WAAW,OAAO,EAAE,MAAM,QAAQ,KAAK;AAAA,EACrE,GAAG,CAAC,QAAQ,OAAO,CAAC;AAEpB,SAAO;AACT;","names":["swatches","files"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-document-key.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-document-key.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\n\nexport const DocumentContext = createContext<string | null>(null)\n\nexport function useDocumentKey(): string | null {\n return useContext(DocumentContext)\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAEnC,MAAM,kBAAkB,cAA6B,IAAI;AAEzD,SAAS,iBAAgC;AAC9C,SAAO,WAAW,eAAe;AACnC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-page-id.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-page-id.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\n\nexport const PageContext = createContext<string | null>(null)\n\nfunction usePageIdOrNull(): string | null {\n return useContext(PageContext)\n}\n\nexport function usePageId(): string {\n const pageIdOrNull = usePageIdOrNull()\n\n if (pageIdOrNull == null) throw new Error('`usePageId` must be used with `<PageProvider>`')\n\n return pageIdOrNull\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAEnC,MAAM,cAAc,cAA6B,IAAI;AAE5D,SAAS,kBAAiC;AACxC,SAAO,WAAW,WAAW;AAC/B;AAEO,SAAS,YAAoB;AAClC,QAAM,eAAe,gBAAgB;AAErC,MAAI,gBAAgB;AAAM,UAAM,IAAI,MAAM,gDAAgD;AAE1F,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-store.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-store.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport { ReactRuntime } from '../react-runtime'\nimport { Store } from '../../../state/react-page'\n\nexport const StoreContext = createContext(ReactRuntime.store)\n\nexport function useStore(): Store {\n return useContext(StoreContext)\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAC1C,SAAS,oBAAoB;AAGtB,MAAM,eAAe,cAAc,aAAa,KAAK;AAErD,SAAS,WAAkB;AAChC,SAAO,WAAW,YAAY;AAChC;","names":[]}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useRef } from "react";
|
|
3
|
-
import { cache, injectGlobal } from "@emotion/css";
|
|
4
4
|
import { serializeStyles } from "@emotion/serialize";
|
|
5
5
|
import { insertStyles } from "@emotion/utils";
|
|
6
|
+
import { useCache } from "../../next/root-style-registry";
|
|
6
7
|
const isServer = typeof window === "undefined";
|
|
7
8
|
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
8
9
|
const useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect;
|
|
9
10
|
function useGlobalStyle(...args) {
|
|
10
|
-
|
|
11
|
-
return injectGlobal(args);
|
|
11
|
+
const cache = useCache();
|
|
12
12
|
const serialized = serializeStyles(args, cache.registered);
|
|
13
|
+
if (isServer) {
|
|
14
|
+
if (cache.inserted[serialized.name] === void 0) {
|
|
15
|
+
cache.insert("", serialized, cache.sheet, true);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
13
18
|
const sheetRef = useRef();
|
|
14
19
|
useInsertionEffect(() => {
|
|
15
20
|
const key = `${cache.key}-global`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/use-global-style.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/use-global-style.ts"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useRef } from 'react'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\nimport { useCache } from '../../next/root-style-registry'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n const cache = useCache()\n const serialized = serializeStyles(args, cache.registered)\n\n if (isServer) {\n if (cache.inserted[serialized.name] === undefined) {\n cache.insert('', serialized, cache.sheet, true)\n }\n }\n\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\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,QAAQ,eAAe;AAAM;AAE1C,QAAI,aAAa;AACf,eAAS,UAAU,CAAC,OAAO,KAAK;AAEhC;AAAA,IACF;AAEA,QAAI,WAAW,QAAQ,MAAM;AAC3B,mBAAa,OAAO,WAAW,MAAM,IAAI;AAAA,IAC3C;AAEA,QAAI,MAAM,KAAK,SAAS,GAAG;AACzB,YAAM,UAAU,MAAM,KAAK,MAAM,KAAK,SAAS,CAAC,EAAE;AAElD,YAAM,SAAS;AAEf,YAAM,MAAM;AAAA,IACd;AAEA,UAAM,OAAO,IAAI,YAAY,OAAO,KAAK;AAAA,EAC3C,CAAC;AACH;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { cache } from "@emotion/css";
|
|
3
2
|
import { serializeStyles } from "@emotion/serialize";
|
|
4
3
|
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
4
|
+
import { useCache } from "../../next/root-style-registry";
|
|
5
5
|
const isServer = typeof window === "undefined";
|
|
6
6
|
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
7
7
|
const useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect;
|
|
8
8
|
function useStyle(style) {
|
|
9
|
+
const cache = useCache();
|
|
9
10
|
const serialized = serializeStyles([style], cache.registered);
|
|
10
11
|
registerStyles(cache, serialized, false);
|
|
11
12
|
useInsertionEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/use-style.ts"],"sourcesContent":["import React from 'react'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/use-style.ts"],"sourcesContent":["import React from 'react'\nimport { CSSObject } from '@emotion/css'\nimport { serializeStyles } from '@emotion/serialize'\nimport { registerStyles, insertStyles } from '@emotion/utils'\nimport { useCache } from '../../next/root-style-registry'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useStyle(style: CSSObject): string {\n const cache = useCache()\n const serialized = serializeStyles([style], cache.registered)\n\n registerStyles(cache, serialized, false)\n\n useInsertionEffect(() => {\n insertStyles(cache, serialized, false)\n })\n\n if (isServer) insertStyles(cache, serialized, false)\n\n return `${cache.key}-${serialized.name}`\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAElB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,gBAAgB;AAEzB,MAAM,WAAW,OAAO,WAAW;AACnC,MAAM,8BAA8B;AACpC,MAAM,qBAAqB,MAAM,2BAA2B,KAAK,MAAM;AAEhE,SAAS,SAAS,OAA0B;AACjD,QAAM,QAAQ,SAAS;AACvB,QAAM,aAAa,gBAAgB,CAAC,KAAK,GAAG,MAAM,UAAU;AAE5D,iBAAe,OAAO,YAAY,KAAK;AAEvC,qBAAmB,MAAM;AACvB,iBAAa,OAAO,YAAY,KAAK;AAAA,EACvC,CAAC;AAED,MAAI;AAAU,iBAAa,OAAO,YAAY,KAAK;AAEnD,SAAO,GAAG,MAAM,GAAG,IAAI,WAAW,IAAI;AACxC;","names":[]}
|
|
@@ -36,9 +36,6 @@ const ActionTypes = {
|
|
|
36
36
|
SET_BUILDER_EDIT_MODE: "SET_BUILDER_EDIT_MODE",
|
|
37
37
|
MAKESWIFT_CONNECTION_INIT: "MAKESWIFT_CONNECTION_INIT",
|
|
38
38
|
MAKESWIFT_CONNECTION_CHECK: "MAKESWIFT_CONNECTION_CHECK",
|
|
39
|
-
CHANGE_PATHNAME: "CHANGE_PATHNAME",
|
|
40
|
-
CHANGE_PATHNAME_START: "CHANGE_PATHNAME_START",
|
|
41
|
-
CHANGE_PATHNAME_COMPLETE: "CHANGE_PATHNAME_COMPLETE",
|
|
42
39
|
BUILDER_POINTER_MOVE: "BUILDER_POINTER_MOVE",
|
|
43
40
|
ELEMENT_FROM_POINT_CHANGE: "ELEMENT_FROM_POINT_CHANGE",
|
|
44
41
|
SET_BREAKPOINTS: "SET_BREAKPOINTS",
|
|
@@ -225,22 +222,6 @@ function setBuilderEditMode(editMode) {
|
|
|
225
222
|
payload: { editMode }
|
|
226
223
|
};
|
|
227
224
|
}
|
|
228
|
-
function changePathname(pathname) {
|
|
229
|
-
return {
|
|
230
|
-
type: ActionTypes.CHANGE_PATHNAME,
|
|
231
|
-
payload: { pathname }
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function changePathnameStart() {
|
|
235
|
-
return {
|
|
236
|
-
type: ActionTypes.CHANGE_PATHNAME_START
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function changePathnameComplete() {
|
|
240
|
-
return {
|
|
241
|
-
type: ActionTypes.CHANGE_PATHNAME_COMPLETE
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
225
|
function builderPointerMove(pointer) {
|
|
245
226
|
return { type: ActionTypes.BUILDER_POINTER_MOVE, payload: { pointer } };
|
|
246
227
|
}
|
|
@@ -274,9 +255,6 @@ export {
|
|
|
274
255
|
changeDocumentElementScrollTop,
|
|
275
256
|
changeDocumentElementSize,
|
|
276
257
|
changeElementBoxModels,
|
|
277
|
-
changePathname,
|
|
278
|
-
changePathnameComplete,
|
|
279
|
-
changePathnameStart,
|
|
280
258
|
cleanUp,
|
|
281
259
|
elementFromPointChange,
|
|
282
260
|
evictApiResource,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/actions.ts"],"sourcesContent":["import type { Operation } from 'ot-json0'\n\nimport type { Document } from './modules/read-only-documents'\nimport type { ComponentType } from './modules/react-components'\nimport type { Measurable, BoxModel } from './modules/box-models'\nimport type { ThunkAction } from 'redux-thunk'\nimport { ComponentMeta } from './modules/components-meta'\nimport { PropControllerDescriptor } from '../prop-controllers'\nimport type { Size } from './react-builder-preview'\nimport type { PropControllersHandle } from './modules/prop-controller-handles'\nimport type { PropControllerMessage } from '../prop-controllers/instances'\nimport type { PropController } from '../prop-controllers/base'\nimport type { APIResource, APIResourceType } from '../api/graphql/types'\nimport type { SerializedControl } from '../builder'\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\nimport { BuilderEditMode } from './modules/builder-edit-mode'\nimport type { Point } from './modules/pointer'\nimport { Breakpoints } from './modules/breakpoints'\nimport { LocaleString, localeStringSchema } from '../locale'\n\nexport const ActionTypes = {\n INIT: 'INIT',\n CLEAN_UP: 'CLEAN_UP',\n\n REGISTER_DOCUMENT: 'REGISTER_DOCUMENT',\n UNREGISTER_DOCUMENT: 'UNREGISTER_DOCUMENT',\n\n CHANGE_DOCUMENT: 'CHANGE_DOCUMENT',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n\n REGISTER_BUILDER_COMPONENT: 'REGISTER_BUILDER_COMPONENT',\n UNREGISTER_BUILDER_COMPONENT: 'UNREGISTER_BUILDER_COMPONENT',\n\n REGISTER_REACT_COMPONENT: 'REGISTER_REACT_COMPONENT',\n UNREGISTER_REACT_COMPONENT: 'UNREGISTER_REACT_COMPONENT',\n\n MOUNT_COMPONENT: 'MOUNT_COMPONENT',\n UNMOUNT_COMPONENT: 'UNMOUNT_COMPONENT',\n\n REGISTER_COMPONENT_HANDLE: 'REGISTER_COMPONENT_HANDLE',\n UNREGISTER_COMPONENT_HANDLE: 'UNREGISTER_COMPONENT_HANDLE',\n\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n CHANGE_ELEMENT_BOX_MODELS: 'CHANGE_ELEMENT_BOX_MODELS',\n\n CHANGE_DOCUMENT_ELEMENT_SIZE: 'CHANGE_DOCUMENT_ELEMENT_SIZE',\n CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP: 'CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP',\n SCROLL_DOCUMENT_ELEMENT: 'SCROLL_DOCUMENT_ELEMENT',\n\n REGISTER_PROP_CONTROLLERS_HANDLE: 'REGISTER_PROP_CONTROLLERS_HANDLE',\n UNREGISTER_PROP_CONTROLLERS_HANDLE: 'UNREGISTER_PROP_CONTROLLERS_HANDLE',\n REGISTER_PROP_CONTROLLERS: 'REGISTER_PROP_CONTROLLERS',\n UNREGISTER_PROP_CONTROLLERS: 'UNREGISTER_PROP_CONTROLLERS',\n MESSAGE_HOST_PROP_CONTROLLER: 'MESSAGE_HOST_PROP_CONTROLLER',\n MESSAGE_BUILDER_PROP_CONTROLLER: 'MESSAGE_BUILDER_PROP_CONTROLLER',\n\n CHANGE_API_RESOURCE: 'CHANGE_API_RESOURCE',\n EVICT_API_RESOURCE: 'EVICT_API_RESOURCE',\n\n SET_IS_IN_BUILDER: 'SET_IS_IN_BUILDER',\n\n HANDLE_WHEEL: 'HANDLE_WHEEL',\n HANDLE_POINTER_MOVE: 'HANDLE_POINTER_MOVE',\n\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n SET_BUILDER_EDIT_MODE: 'SET_BUILDER_EDIT_MODE',\n MAKESWIFT_CONNECTION_INIT: 'MAKESWIFT_CONNECTION_INIT',\n MAKESWIFT_CONNECTION_CHECK: 'MAKESWIFT_CONNECTION_CHECK',\n\n CHANGE_PATHNAME: 'CHANGE_PATHNAME',\n CHANGE_PATHNAME_START: 'CHANGE_PATHNAME_START',\n CHANGE_PATHNAME_COMPLETE: 'CHANGE_PATHNAME_COMPLETE',\n\n BUILDER_POINTER_MOVE: 'BUILDER_POINTER_MOVE',\n ELEMENT_FROM_POINT_CHANGE: 'ELEMENT_FROM_POINT_CHANGE',\n\n SET_BREAKPOINTS: 'SET_BREAKPOINTS',\n\n SET_LOCALE: 'SET_LOCALE',\n\n SET_LOCALIZED_RESOURCE_ID: 'SET_LOCALIZED_RESOURCE_ID',\n} as const\n\ntype InitAction = { type: typeof ActionTypes.INIT }\n\ntype CleanUpAction = { type: typeof ActionTypes.CLEAN_UP }\n\ntype RegisterDocumentAction = {\n type: typeof ActionTypes.REGISTER_DOCUMENT\n payload: { documentKey: string; document: Document }\n}\n\ntype UnregisterDocumentAction = {\n type: typeof ActionTypes.UNREGISTER_DOCUMENT\n payload: { documentKey: string }\n}\n\ntype ChangeDocumentAction = {\n type: typeof ActionTypes.CHANGE_DOCUMENT\n payload: { documentKey: string; operation: Operation }\n}\n\ntype RegisterComponentAction = {\n type: typeof ActionTypes.REGISTER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n propControllerDescriptors: Record<string, PropControllerDescriptor>\n }\n}\n\ntype UnregisterComponentAction = {\n type: typeof ActionTypes.UNREGISTER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterBuilderComponentAction = {\n type: typeof ActionTypes.REGISTER_BUILDER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n serializedControls: Record<string, SerializedControl>\n }\n}\n\ntype UnregisterBuilderComponentAction = {\n type: typeof ActionTypes.UNREGISTER_BUILDER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterReactComponentAction = {\n type: typeof ActionTypes.REGISTER_REACT_COMPONENT\n payload: { type: string; component: ComponentType }\n}\n\ntype UnregisterReactComponentAction = {\n type: typeof ActionTypes.UNREGISTER_REACT_COMPONENT\n payload: { type: string }\n}\n\ntype MountComponentAction = {\n type: typeof ActionTypes.MOUNT_COMPONENT\n payload: { documentKey: string; elementKey: string }\n}\n\ntype UnmountComponentAction = {\n type: typeof ActionTypes.UNMOUNT_COMPONENT\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterComponentHandleAction = {\n type: typeof ActionTypes.REGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string; componentHandle: ElementImperativeHandle }\n}\n\ntype UnregisterComponentHandleAction = {\n type: typeof ActionTypes.UNREGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof ActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof ActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype ChangeElementBoxModelsAction = {\n type: typeof ActionTypes.CHANGE_ELEMENT_BOX_MODELS\n payload: { changedElementBoxModels: Map<string, Map<string, BoxModel | null>> }\n}\n\ntype ChangeDocumentElementSizeAction = {\n type: typeof ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE\n payload: { size: Size }\n}\n\ntype ChangeDocumentElementScrollTopAction = {\n type: typeof ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP\n payload: { scrollTop: number }\n}\n\ntype ScrollDocumentElementAction = {\n type: typeof ActionTypes.SCROLL_DOCUMENT_ELEMENT\n payload: { scrollTopDelta: number }\n}\n\ntype RegisterPropControllersHandleAction = {\n type: typeof ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string; handle: PropControllersHandle }\n}\n\ntype UnregisterPropControllersHandleAction = {\n type: typeof ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersAction = {\n type: typeof ActionTypes.REGISTER_PROP_CONTROLLERS\n payload: {\n documentKey: string\n elementKey: string\n propControllers: Record<string, PropController>\n }\n}\n\ntype UnregisterPropControllersAction = {\n type: typeof ActionTypes.UNREGISTER_PROP_CONTROLLERS\n payload: { documentKey: string; elementKey: string }\n}\n\ntype MessageHostPropControllerAction<T = PropControllerMessage> = {\n type: typeof ActionTypes.MESSAGE_HOST_PROP_CONTROLLER\n payload: { documentKey: string; elementKey: string; propName: string; message: T }\n}\n\ntype MessageBuilderPropControllerAction<T = PropControllerMessage> = {\n type: typeof ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER\n payload: { documentKey: string; elementKey: string; propName: string; message: T }\n}\n\ntype ChangeAPIResourceAction = {\n type: typeof ActionTypes.CHANGE_API_RESOURCE\n payload: { resource: APIResource }\n}\n\ntype EvictAPIResourceAction = {\n type: typeof ActionTypes.EVICT_API_RESOURCE\n payload: { id: string }\n}\n\ntype SetIsInBuilderAction = {\n type: typeof ActionTypes.SET_IS_IN_BUILDER\n payload: boolean\n}\n\ntype HandleWheelAction = {\n type: typeof ActionTypes.HANDLE_WHEEL\n payload: { deltaX: number; deltaY: number }\n}\n\ntype HandlePointerMoveAction = {\n type: typeof ActionTypes.HANDLE_POINTER_MOVE\n payload: { clientX: number; clientY: number }\n}\n\ntype APIResourceFulfilledAction = {\n type: typeof ActionTypes.API_RESOURCE_FULFILLED\n payload: { resourceType: APIResourceType; resourceId: string; resource: APIResource | null }\n}\n\ntype SetBuilderEditModeAction = {\n type: typeof ActionTypes.SET_BUILDER_EDIT_MODE\n payload: { editMode: BuilderEditMode }\n}\n\ntype ChangePathnameAction = {\n type: typeof ActionTypes.CHANGE_PATHNAME\n payload: { pathname: string }\n}\n\ntype ChangePathnameStartAction = {\n type: typeof ActionTypes.CHANGE_PATHNAME_START\n}\n\ntype ChangePathnameCompleteAction = {\n type: typeof ActionTypes.CHANGE_PATHNAME_COMPLETE\n}\n\ntype BuilderPointerMoveAction = {\n type: typeof ActionTypes.BUILDER_POINTER_MOVE\n payload: { pointer: Point | null }\n}\n\ntype ElementFromPointChangeAction = {\n type: typeof ActionTypes.ELEMENT_FROM_POINT_CHANGE\n payload: { keys: { documentKey: string; elementKey: string } | null }\n}\n\nexport type SetBreakpointsAction = {\n type: typeof ActionTypes.SET_BREAKPOINTS\n payload: { breakpoints: Breakpoints }\n}\n\ntype SetLocaleAction = {\n type: typeof ActionTypes.SET_LOCALE\n payload: { locale: LocaleString; pathname?: string }\n}\n\ntype SetLocalizedResourceIdAction = {\n type: typeof ActionTypes.SET_LOCALIZED_RESOURCE_ID\n payload: { resourceId: string; localizedResourceId: string | null }\n}\n\nexport type Action =\n | InitAction\n | CleanUpAction\n | ChangeDocumentAction\n | RegisterDocumentAction\n | UnregisterDocumentAction\n | RegisterComponentAction\n | UnregisterComponentAction\n | RegisterBuilderComponentAction\n | UnregisterBuilderComponentAction\n | RegisterReactComponentAction\n | UnregisterReactComponentAction\n | MountComponentAction\n | UnmountComponentAction\n | RegisterComponentHandleAction\n | UnregisterComponentHandleAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | ChangeElementBoxModelsAction\n | ChangeDocumentElementSizeAction\n | ChangeDocumentElementScrollTopAction\n | ScrollDocumentElementAction\n | RegisterPropControllersHandleAction\n | UnregisterPropControllersHandleAction\n | RegisterPropControllersAction\n | UnregisterPropControllersAction\n | MessageHostPropControllerAction\n | MessageBuilderPropControllerAction\n | ChangeAPIResourceAction\n | EvictAPIResourceAction\n | SetIsInBuilderAction\n | HandleWheelAction\n | HandlePointerMoveAction\n | APIResourceFulfilledAction\n | SetBuilderEditModeAction\n | ChangePathnameAction\n | ChangePathnameStartAction\n | ChangePathnameCompleteAction\n | BuilderPointerMoveAction\n | ElementFromPointChangeAction\n | SetBreakpointsAction\n | SetLocaleAction\n | SetLocalizedResourceIdAction\n\nexport function init(): InitAction {\n return { type: ActionTypes.INIT }\n}\n\nexport function cleanUp(): CleanUpAction {\n return { type: ActionTypes.CLEAN_UP }\n}\n\nexport function registerDocument(document: Document): RegisterDocumentAction {\n return { type: ActionTypes.REGISTER_DOCUMENT, payload: { documentKey: document.key, document } }\n}\n\nexport function unregisterDocument(documentKey: string): UnregisterDocumentAction {\n return { type: ActionTypes.UNREGISTER_DOCUMENT, payload: { documentKey } }\n}\n\nexport function registerDocumentEffect(\n document: Document,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerDocument(document))\n\n return () => {\n dispatch(unregisterDocument(document.key))\n }\n }\n}\n\nexport function changeDocument(documentKey: string, operation: Operation): ChangeDocumentAction {\n return { type: ActionTypes.CHANGE_DOCUMENT, payload: { documentKey, operation } }\n}\n\nexport function registerComponent(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): RegisterComponentAction {\n return {\n type: ActionTypes.REGISTER_COMPONENT,\n payload: { type, meta, propControllerDescriptors },\n }\n}\n\nexport function unregisterComponent(type: string): UnregisterComponentAction {\n return { type: ActionTypes.UNREGISTER_COMPONENT, payload: { type } }\n}\n\nexport function registerComponentEffect(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerComponent(type, meta, propControllerDescriptors))\n\n return () => {\n dispatch(unregisterComponent(type))\n }\n }\n}\n\nexport function registerBuilderComponent(\n type: string,\n meta: ComponentMeta,\n serializedControls: Record<string, SerializedControl>,\n): RegisterBuilderComponentAction {\n return {\n type: ActionTypes.REGISTER_BUILDER_COMPONENT,\n payload: { type, meta, serializedControls },\n }\n}\n\nexport function unregisterBuilderComponent(type: string): UnregisterBuilderComponentAction {\n return { type: ActionTypes.UNREGISTER_BUILDER_COMPONENT, payload: { type } }\n}\n\nfunction registerReactComponent(\n type: string,\n component: ComponentType,\n): RegisterReactComponentAction {\n return { type: ActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } }\n}\n\nfunction unregisterReactComponent(type: string): UnregisterReactComponentAction {\n return { type: ActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } }\n}\n\nexport function registerReactComponentEffect(\n type: string,\n component: ComponentType,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerReactComponent(type, component))\n\n return () => {\n dispatch(unregisterReactComponent(type))\n }\n }\n}\n\nexport function mountComponent(documentKey: string, elementKey: string): MountComponentAction {\n return { type: ActionTypes.MOUNT_COMPONENT, payload: { documentKey, elementKey } }\n}\n\nexport function unmountComponent(documentKey: string, elementKey: string): UnmountComponentAction {\n return { type: ActionTypes.UNMOUNT_COMPONENT, payload: { documentKey, elementKey } }\n}\n\nexport function mountComponentEffect(\n documentKey: string,\n elementKey: string,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(mountComponent(documentKey, elementKey))\n\n return () => {\n dispatch(unmountComponent(documentKey, elementKey))\n }\n }\n}\n\nexport function registerComponentHandle(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): RegisterComponentHandleAction {\n return {\n type: ActionTypes.REGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey, componentHandle },\n }\n}\n\nfunction unregisterComponentHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterComponentHandleAction {\n return { type: ActionTypes.UNREGISTER_COMPONENT_HANDLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerComponentHandleEffect(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerComponentHandle(documentKey, elementKey, componentHandle))\n\n return () => {\n dispatch(unregisterComponentHandle(documentKey, elementKey))\n }\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return { type: ActionTypes.REGISTER_MEASURABLE, payload: { documentKey, elementKey, measurable } }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: ActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function changeElementBoxModels(\n changedElementBoxModels: Map<string, Map<string, BoxModel | null>>,\n): ChangeElementBoxModelsAction {\n return { type: ActionTypes.CHANGE_ELEMENT_BOX_MODELS, payload: { changedElementBoxModels } }\n}\n\nexport function changeDocumentElementSize(size: Size): ChangeDocumentElementSizeAction {\n return { type: ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE, payload: { size } }\n}\n\nexport function changeDocumentElementScrollTop(\n scrollTop: number,\n): ChangeDocumentElementScrollTopAction {\n return { type: ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP, payload: { scrollTop } }\n}\n\nexport function scrollDocumentElement(scrollTopDelta: number): ScrollDocumentElementAction {\n return { type: ActionTypes.SCROLL_DOCUMENT_ELEMENT, payload: { scrollTopDelta } }\n}\n\nexport function registerPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllersHandle,\n): RegisterPropControllersHandleAction {\n return {\n type: ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey, handle },\n }\n}\n\nexport function unregisterPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersHandleAction {\n return {\n type: ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerPropControllers(\n documentKey: string,\n elementKey: string,\n propControllers: Record<string, PropController>,\n): RegisterPropControllersAction {\n return {\n type: ActionTypes.REGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey, propControllers },\n }\n}\n\nexport function unregisterPropControllers(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersAction {\n return { type: ActionTypes.UNREGISTER_PROP_CONTROLLERS, payload: { documentKey, elementKey } }\n}\n\nexport function messageHostPropController<T>(\n documentKey: string,\n elementKey: string,\n propName: string,\n message: T,\n): MessageHostPropControllerAction<T> {\n return {\n type: ActionTypes.MESSAGE_HOST_PROP_CONTROLLER,\n payload: { documentKey, elementKey, propName, message },\n }\n}\n\nexport function messageBuilderPropController<T>(\n documentKey: string,\n elementKey: string,\n propName: string,\n message: T,\n): MessageBuilderPropControllerAction<T> {\n return {\n type: ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER,\n payload: { documentKey, elementKey, propName, message },\n }\n}\n\nexport function changeApiResource(resource: APIResource): ChangeAPIResourceAction {\n return { type: ActionTypes.CHANGE_API_RESOURCE, payload: { resource } }\n}\n\nexport function evictApiResource(id: string): EvictAPIResourceAction {\n return { type: ActionTypes.EVICT_API_RESOURCE, payload: { id } }\n}\n\nexport function setIsInBuilder(isInBuilder: boolean): SetIsInBuilderAction {\n return { type: ActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder }\n}\n\nexport function handleWheel(payload: { deltaX: number; deltaY: number }): HandleWheelAction {\n return { type: ActionTypes.HANDLE_WHEEL, payload }\n}\n\nexport function handlePointerMove(payload: {\n clientX: number\n clientY: number\n}): HandlePointerMoveAction {\n return { type: ActionTypes.HANDLE_POINTER_MOVE, payload }\n}\n\nexport function apiResourceFulfilled(\n resourceType: APIResourceType,\n resourceId: string,\n resource: APIResource | null,\n): APIResourceFulfilledAction {\n return {\n type: ActionTypes.API_RESOURCE_FULFILLED,\n payload: { resourceType, resourceId, resource },\n }\n}\n\nexport function setBuilderEditMode(editMode: BuilderEditMode): SetBuilderEditModeAction {\n return {\n type: ActionTypes.SET_BUILDER_EDIT_MODE,\n payload: { editMode },\n }\n}\n\nexport function changePathname(pathname: string): ChangePathnameAction {\n return {\n type: ActionTypes.CHANGE_PATHNAME,\n payload: { pathname },\n }\n}\n\nexport function changePathnameStart(): ChangePathnameStartAction {\n return {\n type: ActionTypes.CHANGE_PATHNAME_START,\n }\n}\n\nexport function changePathnameComplete(): ChangePathnameCompleteAction {\n return {\n type: ActionTypes.CHANGE_PATHNAME_COMPLETE,\n }\n}\n\nexport function builderPointerMove(pointer: Point | null): BuilderPointerMoveAction {\n return { type: ActionTypes.BUILDER_POINTER_MOVE, payload: { pointer } }\n}\n\nexport function elementFromPointChange(\n keys: {\n documentKey: string\n elementKey: string\n } | null,\n): ElementFromPointChangeAction {\n return { type: ActionTypes.ELEMENT_FROM_POINT_CHANGE, payload: { keys } }\n}\n\nexport function setBreakpoints(breakpoints: Breakpoints): SetBreakpointsAction {\n return { type: ActionTypes.SET_BREAKPOINTS, payload: { breakpoints } }\n}\n\nexport function setLocale(locale: Intl.Locale, pathname?: string): SetLocaleAction {\n return {\n type: ActionTypes.SET_LOCALE,\n payload: { locale: localeStringSchema.parse(locale.toString()), pathname },\n }\n}\n\nexport function setLocalizedResourceId({\n resourceId,\n localizedResourceId,\n}: {\n resourceId: string\n localizedResourceId: string | null\n}): SetLocalizedResourceIdAction {\n return {\n type: ActionTypes.SET_LOCALIZED_RESOURCE_ID,\n payload: { resourceId, localizedResourceId },\n }\n}\n"],"mappings":"AAkBA,SAAuB,0BAA0B;AAE1C,MAAM,cAAc;AAAA,EACzB,MAAM;AAAA,EACN,UAAU;AAAA,EAEV,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EAErB,iBAAiB;AAAA,EAEjB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EAEtB,4BAA4B;AAAA,EAC5B,8BAA8B;AAAA,EAE9B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EAEnB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAE7B,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EAEvB,2BAA2B;AAAA,EAE3B,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EACpC,yBAAyB;AAAA,EAEzB,kCAAkC;AAAA,EAClC,oCAAoC;AAAA,EACpC,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,iCAAiC;AAAA,EAEjC,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EAEpB,mBAAmB;AAAA,EAEnB,cAAc;AAAA,EACd,qBAAqB;AAAA,EAErB,wBAAwB;AAAA,EAExB,uBAAuB;AAAA,EACvB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAE5B,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAE1B,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,iBAAiB;AAAA,EAEjB,YAAY;AAAA,EAEZ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B,SAAiD;AAClF,SAAO,EAAE,MAAM,YAAY,sBAAsB,SAAS,EAAE,QAAQ,EAAE;AACxE;AAEO,SAAS,uBACd,MAI8B;AAC9B,SAAO,EAAE,MAAM,YAAY,2BAA2B,SAAS,EAAE,KAAK,EAAE;AAC1E;AAEO,SAAS,eAAe,aAAgD;AAC7E,SAAO,EAAE,MAAM,YAAY,iBAAiB,SAAS,EAAE,YAAY,EAAE;AACvE;AAEO,SAAS,UAAU,QAAqB,UAAoC;AACjF,SAAO;AAAA,IACL,MAAM,YAAY;AAAA,IAClB,SAAS,EAAE,QAAQ,mBAAmB,MAAM,OAAO,SAAS,CAAC,GAAG,SAAS;AAAA,EAC3E;AACF;AAEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AACF,GAGiC;AAC/B,SAAO;AAAA,IACL,MAAM,YAAY;AAAA,IAClB,SAAS,EAAE,YAAY,oBAAoB;AAAA,EAC7C;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/actions.ts"],"sourcesContent":["import type { Operation } from 'ot-json0'\n\nimport type { Document } from './modules/read-only-documents'\nimport type { ComponentType } from './modules/react-components'\nimport type { Measurable, BoxModel } from './modules/box-models'\nimport type { ThunkAction } from 'redux-thunk'\nimport { ComponentMeta } from './modules/components-meta'\nimport { PropControllerDescriptor } from '../prop-controllers'\nimport type { Size } from './react-builder-preview'\nimport type { PropControllersHandle } from './modules/prop-controller-handles'\nimport type { PropControllerMessage } from '../prop-controllers/instances'\nimport type { PropController } from '../prop-controllers/base'\nimport type { APIResource, APIResourceType } from '../api/graphql/types'\nimport type { SerializedControl } from '../builder'\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\nimport { BuilderEditMode } from './modules/builder-edit-mode'\nimport type { Point } from './modules/pointer'\nimport { Breakpoints } from './modules/breakpoints'\nimport { LocaleString, localeStringSchema } from '../locale'\n\nexport const ActionTypes = {\n INIT: 'INIT',\n CLEAN_UP: 'CLEAN_UP',\n\n REGISTER_DOCUMENT: 'REGISTER_DOCUMENT',\n UNREGISTER_DOCUMENT: 'UNREGISTER_DOCUMENT',\n\n CHANGE_DOCUMENT: 'CHANGE_DOCUMENT',\n\n REGISTER_COMPONENT: 'REGISTER_COMPONENT',\n UNREGISTER_COMPONENT: 'UNREGISTER_COMPONENT',\n\n REGISTER_BUILDER_COMPONENT: 'REGISTER_BUILDER_COMPONENT',\n UNREGISTER_BUILDER_COMPONENT: 'UNREGISTER_BUILDER_COMPONENT',\n\n REGISTER_REACT_COMPONENT: 'REGISTER_REACT_COMPONENT',\n UNREGISTER_REACT_COMPONENT: 'UNREGISTER_REACT_COMPONENT',\n\n MOUNT_COMPONENT: 'MOUNT_COMPONENT',\n UNMOUNT_COMPONENT: 'UNMOUNT_COMPONENT',\n\n REGISTER_COMPONENT_HANDLE: 'REGISTER_COMPONENT_HANDLE',\n UNREGISTER_COMPONENT_HANDLE: 'UNREGISTER_COMPONENT_HANDLE',\n\n REGISTER_MEASURABLE: 'REGISTER_MEASURABLE',\n UNREGISTER_MEASURABLE: 'UNREGISTER_MEASURABLE',\n\n CHANGE_ELEMENT_BOX_MODELS: 'CHANGE_ELEMENT_BOX_MODELS',\n\n CHANGE_DOCUMENT_ELEMENT_SIZE: 'CHANGE_DOCUMENT_ELEMENT_SIZE',\n CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP: 'CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP',\n SCROLL_DOCUMENT_ELEMENT: 'SCROLL_DOCUMENT_ELEMENT',\n\n REGISTER_PROP_CONTROLLERS_HANDLE: 'REGISTER_PROP_CONTROLLERS_HANDLE',\n UNREGISTER_PROP_CONTROLLERS_HANDLE: 'UNREGISTER_PROP_CONTROLLERS_HANDLE',\n REGISTER_PROP_CONTROLLERS: 'REGISTER_PROP_CONTROLLERS',\n UNREGISTER_PROP_CONTROLLERS: 'UNREGISTER_PROP_CONTROLLERS',\n MESSAGE_HOST_PROP_CONTROLLER: 'MESSAGE_HOST_PROP_CONTROLLER',\n MESSAGE_BUILDER_PROP_CONTROLLER: 'MESSAGE_BUILDER_PROP_CONTROLLER',\n\n CHANGE_API_RESOURCE: 'CHANGE_API_RESOURCE',\n EVICT_API_RESOURCE: 'EVICT_API_RESOURCE',\n\n SET_IS_IN_BUILDER: 'SET_IS_IN_BUILDER',\n\n HANDLE_WHEEL: 'HANDLE_WHEEL',\n HANDLE_POINTER_MOVE: 'HANDLE_POINTER_MOVE',\n\n API_RESOURCE_FULFILLED: 'API_RESOURCE_FULFILLED',\n\n SET_BUILDER_EDIT_MODE: 'SET_BUILDER_EDIT_MODE',\n MAKESWIFT_CONNECTION_INIT: 'MAKESWIFT_CONNECTION_INIT',\n MAKESWIFT_CONNECTION_CHECK: 'MAKESWIFT_CONNECTION_CHECK',\n\n BUILDER_POINTER_MOVE: 'BUILDER_POINTER_MOVE',\n ELEMENT_FROM_POINT_CHANGE: 'ELEMENT_FROM_POINT_CHANGE',\n\n SET_BREAKPOINTS: 'SET_BREAKPOINTS',\n\n SET_LOCALE: 'SET_LOCALE',\n\n SET_LOCALIZED_RESOURCE_ID: 'SET_LOCALIZED_RESOURCE_ID',\n} as const\n\ntype InitAction = { type: typeof ActionTypes.INIT }\n\ntype CleanUpAction = { type: typeof ActionTypes.CLEAN_UP }\n\ntype RegisterDocumentAction = {\n type: typeof ActionTypes.REGISTER_DOCUMENT\n payload: { documentKey: string; document: Document }\n}\n\ntype UnregisterDocumentAction = {\n type: typeof ActionTypes.UNREGISTER_DOCUMENT\n payload: { documentKey: string }\n}\n\ntype ChangeDocumentAction = {\n type: typeof ActionTypes.CHANGE_DOCUMENT\n payload: { documentKey: string; operation: Operation }\n}\n\ntype RegisterComponentAction = {\n type: typeof ActionTypes.REGISTER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n propControllerDescriptors: Record<string, PropControllerDescriptor>\n }\n}\n\ntype UnregisterComponentAction = {\n type: typeof ActionTypes.UNREGISTER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterBuilderComponentAction = {\n type: typeof ActionTypes.REGISTER_BUILDER_COMPONENT\n payload: {\n type: string\n meta: ComponentMeta\n serializedControls: Record<string, SerializedControl>\n }\n}\n\ntype UnregisterBuilderComponentAction = {\n type: typeof ActionTypes.UNREGISTER_BUILDER_COMPONENT\n payload: { type: string }\n}\n\ntype RegisterReactComponentAction = {\n type: typeof ActionTypes.REGISTER_REACT_COMPONENT\n payload: { type: string; component: ComponentType }\n}\n\ntype UnregisterReactComponentAction = {\n type: typeof ActionTypes.UNREGISTER_REACT_COMPONENT\n payload: { type: string }\n}\n\ntype MountComponentAction = {\n type: typeof ActionTypes.MOUNT_COMPONENT\n payload: { documentKey: string; elementKey: string }\n}\n\ntype UnmountComponentAction = {\n type: typeof ActionTypes.UNMOUNT_COMPONENT\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterComponentHandleAction = {\n type: typeof ActionTypes.REGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string; componentHandle: ElementImperativeHandle }\n}\n\ntype UnregisterComponentHandleAction = {\n type: typeof ActionTypes.UNREGISTER_COMPONENT_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterMeasurableAction = {\n type: typeof ActionTypes.REGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string; measurable: Measurable }\n}\n\ntype UnregisterMeasurableAction = {\n type: typeof ActionTypes.UNREGISTER_MEASURABLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype ChangeElementBoxModelsAction = {\n type: typeof ActionTypes.CHANGE_ELEMENT_BOX_MODELS\n payload: { changedElementBoxModels: Map<string, Map<string, BoxModel | null>> }\n}\n\ntype ChangeDocumentElementSizeAction = {\n type: typeof ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE\n payload: { size: Size }\n}\n\ntype ChangeDocumentElementScrollTopAction = {\n type: typeof ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP\n payload: { scrollTop: number }\n}\n\ntype ScrollDocumentElementAction = {\n type: typeof ActionTypes.SCROLL_DOCUMENT_ELEMENT\n payload: { scrollTopDelta: number }\n}\n\ntype RegisterPropControllersHandleAction = {\n type: typeof ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string; handle: PropControllersHandle }\n}\n\ntype UnregisterPropControllersHandleAction = {\n type: typeof ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE\n payload: { documentKey: string; elementKey: string }\n}\n\ntype RegisterPropControllersAction = {\n type: typeof ActionTypes.REGISTER_PROP_CONTROLLERS\n payload: {\n documentKey: string\n elementKey: string\n propControllers: Record<string, PropController>\n }\n}\n\ntype UnregisterPropControllersAction = {\n type: typeof ActionTypes.UNREGISTER_PROP_CONTROLLERS\n payload: { documentKey: string; elementKey: string }\n}\n\ntype MessageHostPropControllerAction<T = PropControllerMessage> = {\n type: typeof ActionTypes.MESSAGE_HOST_PROP_CONTROLLER\n payload: { documentKey: string; elementKey: string; propName: string; message: T }\n}\n\ntype MessageBuilderPropControllerAction<T = PropControllerMessage> = {\n type: typeof ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER\n payload: { documentKey: string; elementKey: string; propName: string; message: T }\n}\n\ntype ChangeAPIResourceAction = {\n type: typeof ActionTypes.CHANGE_API_RESOURCE\n payload: { resource: APIResource }\n}\n\ntype EvictAPIResourceAction = {\n type: typeof ActionTypes.EVICT_API_RESOURCE\n payload: { id: string }\n}\n\ntype SetIsInBuilderAction = {\n type: typeof ActionTypes.SET_IS_IN_BUILDER\n payload: boolean\n}\n\ntype HandleWheelAction = {\n type: typeof ActionTypes.HANDLE_WHEEL\n payload: { deltaX: number; deltaY: number }\n}\n\ntype HandlePointerMoveAction = {\n type: typeof ActionTypes.HANDLE_POINTER_MOVE\n payload: { clientX: number; clientY: number }\n}\n\ntype APIResourceFulfilledAction = {\n type: typeof ActionTypes.API_RESOURCE_FULFILLED\n payload: { resourceType: APIResourceType; resourceId: string; resource: APIResource | null }\n}\n\ntype SetBuilderEditModeAction = {\n type: typeof ActionTypes.SET_BUILDER_EDIT_MODE\n payload: { editMode: BuilderEditMode }\n}\n\ntype BuilderPointerMoveAction = {\n type: typeof ActionTypes.BUILDER_POINTER_MOVE\n payload: { pointer: Point | null }\n}\n\ntype ElementFromPointChangeAction = {\n type: typeof ActionTypes.ELEMENT_FROM_POINT_CHANGE\n payload: { keys: { documentKey: string; elementKey: string } | null }\n}\n\nexport type SetBreakpointsAction = {\n type: typeof ActionTypes.SET_BREAKPOINTS\n payload: { breakpoints: Breakpoints }\n}\n\ntype SetLocaleAction = {\n type: typeof ActionTypes.SET_LOCALE\n payload: { locale: LocaleString; pathname?: string }\n}\n\ntype SetLocalizedResourceIdAction = {\n type: typeof ActionTypes.SET_LOCALIZED_RESOURCE_ID\n payload: { resourceId: string; localizedResourceId: string | null }\n}\n\nexport type Action =\n | InitAction\n | CleanUpAction\n | ChangeDocumentAction\n | RegisterDocumentAction\n | UnregisterDocumentAction\n | RegisterComponentAction\n | UnregisterComponentAction\n | RegisterBuilderComponentAction\n | UnregisterBuilderComponentAction\n | RegisterReactComponentAction\n | UnregisterReactComponentAction\n | MountComponentAction\n | UnmountComponentAction\n | RegisterComponentHandleAction\n | UnregisterComponentHandleAction\n | RegisterMeasurableAction\n | UnregisterMeasurableAction\n | ChangeElementBoxModelsAction\n | ChangeDocumentElementSizeAction\n | ChangeDocumentElementScrollTopAction\n | ScrollDocumentElementAction\n | RegisterPropControllersHandleAction\n | UnregisterPropControllersHandleAction\n | RegisterPropControllersAction\n | UnregisterPropControllersAction\n | MessageHostPropControllerAction\n | MessageBuilderPropControllerAction\n | ChangeAPIResourceAction\n | EvictAPIResourceAction\n | SetIsInBuilderAction\n | HandleWheelAction\n | HandlePointerMoveAction\n | APIResourceFulfilledAction\n | SetBuilderEditModeAction\n | BuilderPointerMoveAction\n | ElementFromPointChangeAction\n | SetBreakpointsAction\n | SetLocaleAction\n | SetLocalizedResourceIdAction\n\nexport function init(): InitAction {\n return { type: ActionTypes.INIT }\n}\n\nexport function cleanUp(): CleanUpAction {\n return { type: ActionTypes.CLEAN_UP }\n}\n\nexport function registerDocument(document: Document): RegisterDocumentAction {\n return { type: ActionTypes.REGISTER_DOCUMENT, payload: { documentKey: document.key, document } }\n}\n\nexport function unregisterDocument(documentKey: string): UnregisterDocumentAction {\n return { type: ActionTypes.UNREGISTER_DOCUMENT, payload: { documentKey } }\n}\n\nexport function registerDocumentEffect(\n document: Document,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerDocument(document))\n\n return () => {\n dispatch(unregisterDocument(document.key))\n }\n }\n}\n\nexport function changeDocument(documentKey: string, operation: Operation): ChangeDocumentAction {\n return { type: ActionTypes.CHANGE_DOCUMENT, payload: { documentKey, operation } }\n}\n\nexport function registerComponent(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): RegisterComponentAction {\n return {\n type: ActionTypes.REGISTER_COMPONENT,\n payload: { type, meta, propControllerDescriptors },\n }\n}\n\nexport function unregisterComponent(type: string): UnregisterComponentAction {\n return { type: ActionTypes.UNREGISTER_COMPONENT, payload: { type } }\n}\n\nexport function registerComponentEffect(\n type: string,\n meta: ComponentMeta,\n propControllerDescriptors: Record<string, PropControllerDescriptor>,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerComponent(type, meta, propControllerDescriptors))\n\n return () => {\n dispatch(unregisterComponent(type))\n }\n }\n}\n\nexport function registerBuilderComponent(\n type: string,\n meta: ComponentMeta,\n serializedControls: Record<string, SerializedControl>,\n): RegisterBuilderComponentAction {\n return {\n type: ActionTypes.REGISTER_BUILDER_COMPONENT,\n payload: { type, meta, serializedControls },\n }\n}\n\nexport function unregisterBuilderComponent(type: string): UnregisterBuilderComponentAction {\n return { type: ActionTypes.UNREGISTER_BUILDER_COMPONENT, payload: { type } }\n}\n\nfunction registerReactComponent(\n type: string,\n component: ComponentType,\n): RegisterReactComponentAction {\n return { type: ActionTypes.REGISTER_REACT_COMPONENT, payload: { type, component } }\n}\n\nfunction unregisterReactComponent(type: string): UnregisterReactComponentAction {\n return { type: ActionTypes.UNREGISTER_REACT_COMPONENT, payload: { type } }\n}\n\nexport function registerReactComponentEffect(\n type: string,\n component: ComponentType,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerReactComponent(type, component))\n\n return () => {\n dispatch(unregisterReactComponent(type))\n }\n }\n}\n\nexport function mountComponent(documentKey: string, elementKey: string): MountComponentAction {\n return { type: ActionTypes.MOUNT_COMPONENT, payload: { documentKey, elementKey } }\n}\n\nexport function unmountComponent(documentKey: string, elementKey: string): UnmountComponentAction {\n return { type: ActionTypes.UNMOUNT_COMPONENT, payload: { documentKey, elementKey } }\n}\n\nexport function mountComponentEffect(\n documentKey: string,\n elementKey: string,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(mountComponent(documentKey, elementKey))\n\n return () => {\n dispatch(unmountComponent(documentKey, elementKey))\n }\n }\n}\n\nexport function registerComponentHandle(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): RegisterComponentHandleAction {\n return {\n type: ActionTypes.REGISTER_COMPONENT_HANDLE,\n payload: { documentKey, elementKey, componentHandle },\n }\n}\n\nfunction unregisterComponentHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterComponentHandleAction {\n return { type: ActionTypes.UNREGISTER_COMPONENT_HANDLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerComponentHandleEffect(\n documentKey: string,\n elementKey: string,\n componentHandle: ElementImperativeHandle,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerComponentHandle(documentKey, elementKey, componentHandle))\n\n return () => {\n dispatch(unregisterComponentHandle(documentKey, elementKey))\n }\n }\n}\n\nexport function registerMeasurable(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): RegisterMeasurableAction {\n return { type: ActionTypes.REGISTER_MEASURABLE, payload: { documentKey, elementKey, measurable } }\n}\n\nexport function unregisterMeasurable(\n documentKey: string,\n elementKey: string,\n): UnregisterMeasurableAction {\n return { type: ActionTypes.UNREGISTER_MEASURABLE, payload: { documentKey, elementKey } }\n}\n\nexport function registerMeasurableEffect(\n documentKey: string,\n elementKey: string,\n measurable: Measurable,\n): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n dispatch(registerMeasurable(documentKey, elementKey, measurable))\n\n return () => {\n dispatch(unregisterMeasurable(documentKey, elementKey))\n }\n }\n}\n\nexport function changeElementBoxModels(\n changedElementBoxModels: Map<string, Map<string, BoxModel | null>>,\n): ChangeElementBoxModelsAction {\n return { type: ActionTypes.CHANGE_ELEMENT_BOX_MODELS, payload: { changedElementBoxModels } }\n}\n\nexport function changeDocumentElementSize(size: Size): ChangeDocumentElementSizeAction {\n return { type: ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE, payload: { size } }\n}\n\nexport function changeDocumentElementScrollTop(\n scrollTop: number,\n): ChangeDocumentElementScrollTopAction {\n return { type: ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP, payload: { scrollTop } }\n}\n\nexport function scrollDocumentElement(scrollTopDelta: number): ScrollDocumentElementAction {\n return { type: ActionTypes.SCROLL_DOCUMENT_ELEMENT, payload: { scrollTopDelta } }\n}\n\nexport function registerPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllersHandle,\n): RegisterPropControllersHandleAction {\n return {\n type: ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey, handle },\n }\n}\n\nexport function unregisterPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersHandleAction {\n return {\n type: ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE,\n payload: { documentKey, elementKey },\n }\n}\n\nexport function registerPropControllers(\n documentKey: string,\n elementKey: string,\n propControllers: Record<string, PropController>,\n): RegisterPropControllersAction {\n return {\n type: ActionTypes.REGISTER_PROP_CONTROLLERS,\n payload: { documentKey, elementKey, propControllers },\n }\n}\n\nexport function unregisterPropControllers(\n documentKey: string,\n elementKey: string,\n): UnregisterPropControllersAction {\n return { type: ActionTypes.UNREGISTER_PROP_CONTROLLERS, payload: { documentKey, elementKey } }\n}\n\nexport function messageHostPropController<T>(\n documentKey: string,\n elementKey: string,\n propName: string,\n message: T,\n): MessageHostPropControllerAction<T> {\n return {\n type: ActionTypes.MESSAGE_HOST_PROP_CONTROLLER,\n payload: { documentKey, elementKey, propName, message },\n }\n}\n\nexport function messageBuilderPropController<T>(\n documentKey: string,\n elementKey: string,\n propName: string,\n message: T,\n): MessageBuilderPropControllerAction<T> {\n return {\n type: ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER,\n payload: { documentKey, elementKey, propName, message },\n }\n}\n\nexport function changeApiResource(resource: APIResource): ChangeAPIResourceAction {\n return { type: ActionTypes.CHANGE_API_RESOURCE, payload: { resource } }\n}\n\nexport function evictApiResource(id: string): EvictAPIResourceAction {\n return { type: ActionTypes.EVICT_API_RESOURCE, payload: { id } }\n}\n\nexport function setIsInBuilder(isInBuilder: boolean): SetIsInBuilderAction {\n return { type: ActionTypes.SET_IS_IN_BUILDER, payload: isInBuilder }\n}\n\nexport function handleWheel(payload: { deltaX: number; deltaY: number }): HandleWheelAction {\n return { type: ActionTypes.HANDLE_WHEEL, payload }\n}\n\nexport function handlePointerMove(payload: {\n clientX: number\n clientY: number\n}): HandlePointerMoveAction {\n return { type: ActionTypes.HANDLE_POINTER_MOVE, payload }\n}\n\nexport function apiResourceFulfilled(\n resourceType: APIResourceType,\n resourceId: string,\n resource: APIResource | null,\n): APIResourceFulfilledAction {\n return {\n type: ActionTypes.API_RESOURCE_FULFILLED,\n payload: { resourceType, resourceId, resource },\n }\n}\n\nexport function setBuilderEditMode(editMode: BuilderEditMode): SetBuilderEditModeAction {\n return {\n type: ActionTypes.SET_BUILDER_EDIT_MODE,\n payload: { editMode },\n }\n}\n\nexport function builderPointerMove(pointer: Point | null): BuilderPointerMoveAction {\n return { type: ActionTypes.BUILDER_POINTER_MOVE, payload: { pointer } }\n}\n\nexport function elementFromPointChange(\n keys: {\n documentKey: string\n elementKey: string\n } | null,\n): ElementFromPointChangeAction {\n return { type: ActionTypes.ELEMENT_FROM_POINT_CHANGE, payload: { keys } }\n}\n\nexport function setBreakpoints(breakpoints: Breakpoints): SetBreakpointsAction {\n return { type: ActionTypes.SET_BREAKPOINTS, payload: { breakpoints } }\n}\n\nexport function setLocale(locale: Intl.Locale, pathname?: string): SetLocaleAction {\n return {\n type: ActionTypes.SET_LOCALE,\n payload: { locale: localeStringSchema.parse(locale.toString()), pathname },\n }\n}\n\nexport function setLocalizedResourceId({\n resourceId,\n localizedResourceId,\n}: {\n resourceId: string\n localizedResourceId: string | null\n}): SetLocalizedResourceIdAction {\n return {\n type: ActionTypes.SET_LOCALIZED_RESOURCE_ID,\n payload: { resourceId, localizedResourceId },\n }\n}\n"],"mappings":"AAkBA,SAAuB,0BAA0B;AAE1C,MAAM,cAAc;AAAA,EACzB,MAAM;AAAA,EACN,UAAU;AAAA,EAEV,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EAErB,iBAAiB;AAAA,EAEjB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EAEtB,4BAA4B;AAAA,EAC5B,8BAA8B;AAAA,EAE9B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAE5B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EAEnB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAE7B,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EAEvB,2BAA2B;AAAA,EAE3B,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EACpC,yBAAyB;AAAA,EAEzB,kCAAkC;AAAA,EAClC,oCAAoC;AAAA,EACpC,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,iCAAiC;AAAA,EAEjC,qBAAqB;AAAA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mB,SAAiD;AAClF,SAAO,EAAE,MAAM,YAAY,sBAAsB,SAAS,EAAE,QAAQ,EAAE;AACxE;AAEO,SAAS,uBACd,MAI8B;AAC9B,SAAO,EAAE,MAAM,YAAY,2BAA2B,SAAS,EAAE,KAAK,EAAE;AAC1E;AAEO,SAAS,eAAe,aAAgD;AAC7E,SAAO,EAAE,MAAM,YAAY,iBAAiB,SAAS,EAAE,YAAY,EAAE;AACvE;AAEO,SAAS,UAAU,QAAqB,UAAoC;AACjF,SAAO;AAAA,IACL,MAAM,YAAY;AAAA,IAClB,SAAS,EAAE,QAAQ,mBAAmB,MAAM,OAAO,SAAS,CAAC,GAAG,SAAS;AAAA,EAC3E;AACF;AAEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AACF,GAGiC;AAC/B,SAAO;AAAA,IACL,MAAM,YAAY;AAAA,IAClB,SAAS,EAAE,YAAY,oBAAoB;AAAA,EAC7C;AACF;","names":[]}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
createStore
|
|
5
5
|
} from "redux";
|
|
6
6
|
import thunk from "redux-thunk";
|
|
7
|
-
import Router from "next/router";
|
|
8
7
|
import deepEqual from "../utils/deepEqual";
|
|
9
8
|
import * as Documents from "./modules/read-write-documents";
|
|
10
9
|
import * as ReactComponents from "./modules/react-components";
|
|
@@ -33,11 +32,8 @@ import {
|
|
|
33
32
|
setIsInBuilder,
|
|
34
33
|
handleWheel,
|
|
35
34
|
handlePointerMove,
|
|
36
|
-
changePathnameStart,
|
|
37
|
-
changePathnameComplete,
|
|
38
35
|
elementFromPointChange,
|
|
39
|
-
setBreakpoints
|
|
40
|
-
setLocale
|
|
36
|
+
setBreakpoints
|
|
41
37
|
} from "./actions";
|
|
42
38
|
import { ActionTypes } from "./actions";
|
|
43
39
|
import { createPropController } from "../prop-controllers/instances";
|
|
@@ -363,16 +359,6 @@ function messageChannelMiddleware(client) {
|
|
|
363
359
|
});
|
|
364
360
|
const breakpoints = ReactPage.getBreakpoints(state);
|
|
365
361
|
messageChannel.port1.postMessage(setBreakpoints(breakpoints));
|
|
366
|
-
const routerLocale = Router.locale;
|
|
367
|
-
if (routerLocale != null) {
|
|
368
|
-
messageChannel.port1.postMessage(setLocale(new Intl.Locale(routerLocale)));
|
|
369
|
-
}
|
|
370
|
-
Router.events.on("routeChangeStart", () => {
|
|
371
|
-
messageChannel.port1.postMessage(changePathnameStart());
|
|
372
|
-
});
|
|
373
|
-
Router.events.on("routeChangeComplete", () => {
|
|
374
|
-
messageChannel.port1.postMessage(changePathnameComplete());
|
|
375
|
-
});
|
|
376
362
|
return (action) => {
|
|
377
363
|
switch (action.type) {
|
|
378
364
|
case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:
|
|
@@ -383,6 +369,7 @@ function messageChannelMiddleware(client) {
|
|
|
383
369
|
case ActionTypes.HANDLE_WHEEL:
|
|
384
370
|
case ActionTypes.HANDLE_POINTER_MOVE:
|
|
385
371
|
case ActionTypes.ELEMENT_FROM_POINT_CHANGE:
|
|
372
|
+
case ActionTypes.SET_LOCALE:
|
|
386
373
|
messageChannel.port1.postMessage(action);
|
|
387
374
|
break;
|
|
388
375
|
case ActionTypes.REGISTER_COMPONENT: {
|
|
@@ -407,19 +394,6 @@ function messageChannelMiddleware(client) {
|
|
|
407
394
|
messageChannel.port1.postMessage(action);
|
|
408
395
|
window.getSelection()?.removeAllRanges();
|
|
409
396
|
break;
|
|
410
|
-
case ActionTypes.SET_LOCALE: {
|
|
411
|
-
const { pathname: currentPathname, query } = Router;
|
|
412
|
-
const pathname = (action.payload.pathname ?? currentPathname).replace(/^\//, "/");
|
|
413
|
-
Router.replace({ pathname, query }, void 0, { locale: action.payload.locale });
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
case ActionTypes.CHANGE_PATHNAME: {
|
|
417
|
-
const pathname = action.payload.pathname.replace(/^\//, "/");
|
|
418
|
-
const currentPathname = Router.asPath.replace(/^\//, "/");
|
|
419
|
-
if (pathname !== currentPathname)
|
|
420
|
-
Router.push(pathname);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
397
|
case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {
|
|
424
398
|
client.setLocalizedResourceId(action.payload);
|
|
425
399
|
break;
|