@makeswift/runtime 0.23.12 → 0.23.14
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/graphql/fragments.js +40 -0
- package/dist/cjs/api/graphql/fragments.js.map +1 -0
- package/dist/cjs/api/graphql/types.js +40 -0
- package/dist/cjs/api/graphql/types.js.map +1 -0
- package/dist/cjs/api/resource-types.js +24 -0
- package/dist/cjs/api/resource-types.js.map +1 -0
- package/dist/cjs/builder/serialization/controls/combobox.js +45 -0
- package/dist/cjs/builder/serialization/controls/combobox.js.map +1 -0
- package/dist/cjs/builder/serialization/controls/list.js +50 -0
- package/dist/cjs/builder/serialization/controls/list.js.map +1 -0
- package/dist/cjs/builder/serialization/controls/rich-text-v2.js +106 -0
- package/dist/cjs/builder/serialization/controls/rich-text-v2.js.map +1 -0
- package/dist/cjs/builder/serialization/controls/shape.js +54 -0
- package/dist/cjs/builder/serialization/controls/shape.js.map +1 -0
- package/dist/cjs/builder/serialization/controls/style-v2.js +62 -0
- package/dist/cjs/builder/serialization/controls/style-v2.js.map +1 -0
- package/dist/cjs/builder/unstructured-introspection/__fixtures__/element-containing-resources.js +899 -0
- package/dist/cjs/builder/unstructured-introspection/__fixtures__/element-containing-resources.js.map +1 -0
- package/dist/cjs/builder/unstructured-introspection/__fixtures__/index.js +23 -0
- package/dist/cjs/builder/unstructured-introspection/__fixtures__/index.js.map +1 -0
- package/dist/cjs/builder/unstructured-introspection/index.js +29 -0
- package/dist/cjs/builder/unstructured-introspection/index.js.map +1 -0
- package/dist/cjs/builder/unstructured-introspection/unstructured-introspection.js +85 -0
- package/dist/cjs/builder/unstructured-introspection/unstructured-introspection.js.map +1 -0
- package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js +1 -0
- package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
- package/dist/cjs/controls/checkbox.js +41 -0
- package/dist/cjs/controls/checkbox.js.map +1 -0
- package/dist/cjs/controls/color.js +55 -0
- package/dist/cjs/controls/color.js.map +1 -0
- package/dist/cjs/controls/combobox.js +34 -0
- package/dist/cjs/controls/combobox.js.map +1 -0
- package/dist/cjs/controls/control-data-type-key.js +29 -0
- package/dist/cjs/controls/control-data-type-key.js.map +1 -0
- package/dist/cjs/controls/icon-radio-group.js +45 -0
- package/dist/cjs/controls/icon-radio-group.js.map +1 -0
- package/dist/cjs/controls/image.js +34 -0
- package/dist/cjs/controls/image.js.map +1 -0
- package/dist/cjs/controls/list.js +156 -0
- package/dist/cjs/controls/list.js.map +1 -0
- package/dist/cjs/controls/number.js +41 -0
- package/dist/cjs/controls/number.js.map +1 -0
- package/dist/cjs/controls/rich-text/copy.js +121 -0
- package/dist/cjs/controls/rich-text/copy.js.map +1 -0
- package/dist/cjs/controls/rich-text/dto-types.js +43 -0
- package/dist/cjs/controls/rich-text/dto-types.js.map +1 -0
- package/dist/cjs/controls/rich-text/dto.js +228 -0
- package/dist/cjs/controls/rich-text/dto.js.map +1 -0
- package/dist/cjs/controls/rich-text/fixtures/blockquote.js +77 -0
- package/dist/cjs/controls/rich-text/fixtures/blockquote.js.map +1 -0
- package/dist/cjs/controls/rich-text/fixtures/empty-blocks.js +176 -0
- package/dist/cjs/controls/rich-text/fixtures/empty-blocks.js.map +1 -0
- package/dist/cjs/controls/rich-text/fixtures/index.js +27 -0
- package/dist/cjs/controls/rich-text/fixtures/index.js.map +1 -0
- package/dist/cjs/controls/rich-text/fixtures/list.js +137 -0
- package/dist/cjs/controls/rich-text/fixtures/list.js.map +1 -0
- package/dist/cjs/controls/rich-text/fixtures/typography.js +926 -0
- package/dist/cjs/controls/rich-text/fixtures/typography.js.map +1 -0
- package/dist/cjs/controls/rich-text/fixtures/v2-data-types.js +114 -0
- package/dist/cjs/controls/rich-text/fixtures/v2-data-types.js.map +1 -0
- package/dist/cjs/controls/rich-text/introspection.js +104 -0
- package/dist/cjs/controls/rich-text/introspection.js.map +1 -0
- package/dist/cjs/controls/rich-text-v2/copy.js +115 -0
- package/dist/cjs/controls/rich-text-v2/copy.js.map +1 -0
- package/dist/cjs/controls/rich-text-v2/dto.js +44 -0
- package/dist/cjs/controls/rich-text-v2/dto.js.map +1 -0
- package/dist/cjs/controls/rich-text-v2/introspection.js +69 -0
- package/dist/cjs/controls/rich-text-v2/introspection.js.map +1 -0
- package/dist/cjs/controls/select.js +34 -0
- package/dist/cjs/controls/select.js.map +1 -0
- package/dist/cjs/controls/shape.js +149 -0
- package/dist/cjs/controls/shape.js.map +1 -0
- package/dist/cjs/controls/style-v2.js +74 -0
- package/dist/cjs/controls/style-v2.js.map +1 -0
- package/dist/cjs/controls/style.js +125 -0
- package/dist/cjs/controls/style.js.map +1 -0
- package/dist/cjs/controls/text-area.js +41 -0
- package/dist/cjs/controls/text-area.js.map +1 -0
- package/dist/cjs/controls/text-input.js +41 -0
- package/dist/cjs/controls/text-input.js.map +1 -0
- package/dist/cjs/controls/types.js +17 -0
- package/dist/cjs/controls/types.js.map +1 -0
- package/dist/cjs/controls/typography.js +47 -0
- package/dist/cjs/controls/typography.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/clear-draft.js +64 -0
- package/dist/cjs/next/api-handler/handlers/clear-draft.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/next/api-handler/handlers/redirect-draft.js +77 -0
- package/dist/cjs/next/api-handler/handlers/redirect-draft.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/redirect-preview.js +68 -0
- package/dist/cjs/next/api-handler/handlers/redirect-preview.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/utils/draft.js +53 -0
- package/dist/cjs/next/api-handler/handlers/utils/draft.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/webhook/site-published.js +2 -4
- package/dist/cjs/next/api-handler/handlers/webhook/site-published.js.map +1 -1
- package/dist/cjs/next/cache.js +29 -0
- package/dist/cjs/next/cache.js.map +1 -0
- package/dist/cjs/next/client.js +2 -2
- package/dist/cjs/next/client.js.map +1 -1
- 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/hooks/use-sync-cache-data.js +41 -0
- package/dist/cjs/next/hooks/use-sync-cache-data.js.map +1 -0
- package/dist/cjs/prop-controllers/base.js +34 -0
- package/dist/cjs/prop-controllers/base.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/backgrounds.js +86 -0
- package/dist/cjs/prop-controllers/copy/backgrounds.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/element-id.js +36 -0
- package/dist/cjs/prop-controllers/copy/element-id.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/grid.js +36 -0
- package/dist/cjs/prop-controllers/copy/grid.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/image.js +35 -0
- package/dist/cjs/prop-controllers/copy/image.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/images.js +49 -0
- package/dist/cjs/prop-controllers/copy/images.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/navigation-links.js +58 -0
- package/dist/cjs/prop-controllers/copy/navigation-links.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/rich-text.js +121 -0
- package/dist/cjs/prop-controllers/copy/rich-text.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/table-form-fields.js +39 -0
- package/dist/cjs/prop-controllers/copy/table-form-fields.js.map +1 -0
- package/dist/cjs/prop-controllers/copy/table.js +33 -0
- package/dist/cjs/prop-controllers/copy/table.js.map +1 -0
- package/dist/cjs/runtimes/react/components/DocumentReference.js +42 -0
- package/dist/cjs/runtimes/react/components/DocumentReference.js.map +1 -0
- package/dist/cjs/runtimes/react/components/draft-switcher/draft-switcher.js +72 -0
- package/dist/cjs/runtimes/react/components/draft-switcher/draft-switcher.js.map +1 -0
- package/dist/cjs/runtimes/react/components/draft-switcher/draft-toolbar.js +79 -0
- package/dist/cjs/runtimes/react/components/draft-switcher/draft-toolbar.js.map +1 -0
- package/dist/cjs/runtimes/react/components/hooks/use-builder-connection-ping.js +67 -0
- package/dist/cjs/runtimes/react/components/hooks/use-builder-connection-ping.js.map +1 -0
- package/dist/cjs/runtimes/react/components/hooks/use-builder-handshake.js +45 -0
- package/dist/cjs/runtimes/react/components/hooks/use-builder-handshake.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/checkbox.js +34 -0
- package/dist/cjs/runtimes/react/controls/checkbox.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/color.js +58 -0
- package/dist/cjs/runtimes/react/controls/color.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/combobox.js +31 -0
- package/dist/cjs/runtimes/react/controls/combobox.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/icon-radio-group.js +31 -0
- package/dist/cjs/runtimes/react/controls/icon-radio-group.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/image.js +53 -0
- package/dist/cjs/runtimes/react/controls/image.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/link.js +110 -0
- package/dist/cjs/runtimes/react/controls/link.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/list.js +58 -0
- package/dist/cjs/runtimes/react/controls/list.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/number.js +34 -0
- package/dist/cjs/runtimes/react/controls/number.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/select.js +31 -0
- package/dist/cjs/runtimes/react/controls/select.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/shape.js +44 -0
- package/dist/cjs/runtimes/react/controls/shape.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/style-v2.js +92 -0
- package/dist/cjs/runtimes/react/controls/style-v2.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/text-area.js +34 -0
- package/dist/cjs/runtimes/react/controls/text-area.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/text-input.js +34 -0
- package/dist/cjs/runtimes/react/controls/text-input.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-document-key.js +36 -0
- package/dist/cjs/runtimes/react/hooks/use-document-key.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-head-marker.js +40 -0
- package/dist/cjs/runtimes/react/hooks/use-head-marker.js.map +1 -0
- package/dist/cjs/slate/LinkPlugin/linkPluginWithoutRenderElement.js +48 -0
- package/dist/cjs/slate/LinkPlugin/linkPluginWithoutRenderElement.js.map +1 -0
- package/dist/cjs/state/makeswift-api-client.js +2 -2
- package/dist/cjs/state/makeswift-api-client.js.map +1 -1
- package/dist/cjs/utils/coalesce.js +33 -0
- package/dist/cjs/utils/coalesce.js.map +1 -0
- package/dist/cjs/utils/index-signature-hack.js +17 -0
- package/dist/cjs/utils/index-signature-hack.js.map +1 -0
- package/dist/cjs/utils/shallowMerge.js +44 -0
- package/dist/cjs/utils/shallowMerge.js.map +1 -0
- package/dist/cjs/utils/tests/breakpoint-test-util.js +35 -0
- package/dist/cjs/utils/tests/breakpoint-test-util.js.map +1 -0
- package/dist/cjs/utils/tests/element-data-test-test.js +75 -0
- package/dist/cjs/utils/tests/element-data-test-test.js.map +1 -0
- package/dist/esm/api/graphql/fragments.js +6 -0
- package/dist/esm/api/graphql/fragments.js.map +1 -0
- package/dist/esm/api/graphql/types.js +16 -0
- package/dist/esm/api/graphql/types.js.map +1 -0
- package/dist/esm/api/resource-types.js +8 -0
- package/dist/esm/api/resource-types.js.map +1 -0
- package/dist/esm/builder/serialization/controls/combobox.js +20 -0
- package/dist/esm/builder/serialization/controls/combobox.js.map +1 -0
- package/dist/esm/builder/serialization/controls/list.js +25 -0
- package/dist/esm/builder/serialization/controls/list.js.map +1 -0
- package/dist/esm/builder/serialization/controls/rich-text-v2.js +81 -0
- package/dist/esm/builder/serialization/controls/rich-text-v2.js.map +1 -0
- package/dist/esm/builder/serialization/controls/shape.js +32 -0
- package/dist/esm/builder/serialization/controls/shape.js.map +1 -0
- package/dist/esm/builder/serialization/controls/style-v2.js +37 -0
- package/dist/esm/builder/serialization/controls/style-v2.js.map +1 -0
- package/dist/esm/builder/unstructured-introspection/__fixtures__/element-containing-resources.js +875 -0
- package/dist/esm/builder/unstructured-introspection/__fixtures__/element-containing-resources.js.map +1 -0
- package/dist/esm/builder/unstructured-introspection/__fixtures__/index.js +2 -0
- package/dist/esm/builder/unstructured-introspection/__fixtures__/index.js.map +1 -0
- package/dist/esm/builder/unstructured-introspection/index.js +5 -0
- package/dist/esm/builder/unstructured-introspection/index.js.map +1 -0
- package/dist/esm/builder/unstructured-introspection/unstructured-introspection.js +61 -0
- package/dist/esm/builder/unstructured-introspection/unstructured-introspection.js.map +1 -0
- package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js +1 -0
- package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
- package/dist/esm/controls/checkbox.js +14 -0
- package/dist/esm/controls/checkbox.js.map +1 -0
- package/dist/esm/controls/color.js +27 -0
- package/dist/esm/controls/color.js.map +1 -0
- package/dist/esm/controls/combobox.js +9 -0
- package/dist/esm/controls/combobox.js.map +1 -0
- package/dist/esm/controls/control-data-type-key.js +5 -0
- package/dist/esm/controls/control-data-type-key.js.map +1 -0
- package/dist/esm/controls/icon-radio-group.js +19 -0
- package/dist/esm/controls/icon-radio-group.js.map +1 -0
- package/dist/esm/controls/image.js +10 -0
- package/dist/esm/controls/image.js.map +1 -0
- package/dist/esm/controls/list.js +132 -0
- package/dist/esm/controls/list.js.map +1 -0
- package/dist/esm/controls/number.js +14 -0
- package/dist/esm/controls/number.js.map +1 -0
- package/dist/esm/controls/rich-text/copy.js +97 -0
- package/dist/esm/controls/rich-text/copy.js.map +1 -0
- package/dist/esm/controls/rich-text/dto-types.js +19 -0
- package/dist/esm/controls/rich-text/dto-types.js.map +1 -0
- package/dist/esm/controls/rich-text/dto.js +203 -0
- package/dist/esm/controls/rich-text/dto.js.map +1 -0
- package/dist/esm/controls/rich-text/fixtures/blockquote.js +53 -0
- package/dist/esm/controls/rich-text/fixtures/blockquote.js.map +1 -0
- package/dist/esm/controls/rich-text/fixtures/empty-blocks.js +151 -0
- package/dist/esm/controls/rich-text/fixtures/empty-blocks.js.map +1 -0
- package/dist/esm/controls/rich-text/fixtures/index.js +4 -0
- package/dist/esm/controls/rich-text/fixtures/index.js.map +1 -0
- package/dist/esm/controls/rich-text/fixtures/list.js +113 -0
- package/dist/esm/controls/rich-text/fixtures/list.js.map +1 -0
- package/dist/esm/controls/rich-text/fixtures/typography.js +902 -0
- package/dist/esm/controls/rich-text/fixtures/typography.js.map +1 -0
- package/dist/esm/controls/rich-text/fixtures/v2-data-types.js +90 -0
- package/dist/esm/controls/rich-text/fixtures/v2-data-types.js.map +1 -0
- package/dist/esm/controls/rich-text/introspection.js +78 -0
- package/dist/esm/controls/rich-text/introspection.js.map +1 -0
- package/dist/esm/controls/rich-text-v2/copy.js +91 -0
- package/dist/esm/controls/rich-text-v2/copy.js.map +1 -0
- package/dist/esm/controls/rich-text-v2/dto.js +19 -0
- package/dist/esm/controls/rich-text-v2/dto.js.map +1 -0
- package/dist/esm/controls/rich-text-v2/introspection.js +43 -0
- package/dist/esm/controls/rich-text-v2/introspection.js.map +1 -0
- package/dist/esm/controls/select.js +9 -0
- package/dist/esm/controls/select.js.map +1 -0
- package/dist/esm/controls/shape.js +125 -0
- package/dist/esm/controls/shape.js.map +1 -0
- package/dist/esm/controls/style-v2.js +48 -0
- package/dist/esm/controls/style-v2.js.map +1 -0
- package/dist/esm/controls/style.js +95 -0
- package/dist/esm/controls/style.js.map +1 -0
- package/dist/esm/controls/text-area.js +14 -0
- package/dist/esm/controls/text-area.js.map +1 -0
- package/dist/esm/controls/text-input.js +14 -0
- package/dist/esm/controls/text-input.js.map +1 -0
- package/dist/esm/controls/types.js +1 -0
- package/dist/esm/controls/types.js.map +1 -0
- package/dist/esm/controls/typography.js +20 -0
- package/dist/esm/controls/typography.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/clear-draft.js +50 -0
- package/dist/esm/next/api-handler/handlers/clear-draft.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/next/api-handler/handlers/redirect-draft.js +63 -0
- package/dist/esm/next/api-handler/handlers/redirect-draft.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/redirect-preview.js +54 -0
- package/dist/esm/next/api-handler/handlers/redirect-preview.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/utils/draft.js +24 -0
- package/dist/esm/next/api-handler/handlers/utils/draft.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/webhook/site-published.js +1 -2
- package/dist/esm/next/api-handler/handlers/webhook/site-published.js.map +1 -1
- package/dist/esm/next/cache.js +5 -0
- package/dist/esm/next/cache.js.map +1 -0
- package/dist/esm/next/client.js +1 -1
- package/dist/esm/next/client.js.map +1 -1
- 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/hooks/use-sync-cache-data.js +17 -0
- package/dist/esm/next/hooks/use-sync-cache-data.js.map +1 -0
- package/dist/esm/prop-controllers/base.js +10 -0
- package/dist/esm/prop-controllers/base.js.map +1 -0
- package/dist/esm/prop-controllers/copy/backgrounds.js +62 -0
- package/dist/esm/prop-controllers/copy/backgrounds.js.map +1 -0
- package/dist/esm/prop-controllers/copy/element-id.js +12 -0
- package/dist/esm/prop-controllers/copy/element-id.js.map +1 -0
- package/dist/esm/prop-controllers/copy/grid.js +12 -0
- package/dist/esm/prop-controllers/copy/grid.js.map +1 -0
- package/dist/esm/prop-controllers/copy/image.js +11 -0
- package/dist/esm/prop-controllers/copy/image.js.map +1 -0
- package/dist/esm/prop-controllers/copy/images.js +25 -0
- package/dist/esm/prop-controllers/copy/images.js.map +1 -0
- package/dist/esm/prop-controllers/copy/navigation-links.js +34 -0
- package/dist/esm/prop-controllers/copy/navigation-links.js.map +1 -0
- package/dist/esm/prop-controllers/copy/rich-text.js +97 -0
- package/dist/esm/prop-controllers/copy/rich-text.js.map +1 -0
- package/dist/esm/prop-controllers/copy/table-form-fields.js +15 -0
- package/dist/esm/prop-controllers/copy/table-form-fields.js.map +1 -0
- package/dist/esm/prop-controllers/copy/table.js +9 -0
- package/dist/esm/prop-controllers/copy/table.js.map +1 -0
- package/dist/esm/runtimes/react/components/DocumentReference.js +18 -0
- package/dist/esm/runtimes/react/components/DocumentReference.js.map +1 -0
- package/dist/esm/runtimes/react/components/draft-switcher/draft-switcher.js +48 -0
- package/dist/esm/runtimes/react/components/draft-switcher/draft-switcher.js.map +1 -0
- package/dist/esm/runtimes/react/components/draft-switcher/draft-toolbar.js +55 -0
- package/dist/esm/runtimes/react/components/draft-switcher/draft-toolbar.js.map +1 -0
- package/dist/esm/runtimes/react/components/hooks/use-builder-connection-ping.js +43 -0
- package/dist/esm/runtimes/react/components/hooks/use-builder-connection-ping.js.map +1 -0
- package/dist/esm/runtimes/react/components/hooks/use-builder-handshake.js +21 -0
- package/dist/esm/runtimes/react/components/hooks/use-builder-handshake.js.map +1 -0
- package/dist/esm/runtimes/react/controls/checkbox.js +13 -0
- package/dist/esm/runtimes/react/controls/checkbox.js.map +1 -0
- package/dist/esm/runtimes/react/controls/color.js +24 -0
- package/dist/esm/runtimes/react/controls/color.js.map +1 -0
- package/dist/esm/runtimes/react/controls/combobox.js +7 -0
- package/dist/esm/runtimes/react/controls/combobox.js.map +1 -0
- package/dist/esm/runtimes/react/controls/icon-radio-group.js +7 -0
- package/dist/esm/runtimes/react/controls/icon-radio-group.js.map +1 -0
- package/dist/esm/runtimes/react/controls/image.js +29 -0
- package/dist/esm/runtimes/react/controls/image.js.map +1 -0
- package/dist/esm/runtimes/react/controls/link.js +76 -0
- package/dist/esm/runtimes/react/controls/link.js.map +1 -0
- package/dist/esm/runtimes/react/controls/list.js +34 -0
- package/dist/esm/runtimes/react/controls/list.js.map +1 -0
- package/dist/esm/runtimes/react/controls/number.js +13 -0
- package/dist/esm/runtimes/react/controls/number.js.map +1 -0
- package/dist/esm/runtimes/react/controls/select.js +7 -0
- package/dist/esm/runtimes/react/controls/select.js.map +1 -0
- package/dist/esm/runtimes/react/controls/shape.js +20 -0
- package/dist/esm/runtimes/react/controls/shape.js.map +1 -0
- package/dist/esm/runtimes/react/controls/style-v2.js +72 -0
- package/dist/esm/runtimes/react/controls/style-v2.js.map +1 -0
- package/dist/esm/runtimes/react/controls/text-area.js +13 -0
- package/dist/esm/runtimes/react/controls/text-area.js.map +1 -0
- package/dist/esm/runtimes/react/controls/text-input.js +13 -0
- package/dist/esm/runtimes/react/controls/text-input.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-document-key.js +11 -0
- package/dist/esm/runtimes/react/hooks/use-document-key.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-head-marker.js +16 -0
- package/dist/esm/runtimes/react/hooks/use-head-marker.js.map +1 -0
- package/dist/esm/slate/LinkPlugin/linkPluginWithoutRenderElement.js +24 -0
- package/dist/esm/slate/LinkPlugin/linkPluginWithoutRenderElement.js.map +1 -0
- package/dist/esm/state/makeswift-api-client.js +1 -1
- package/dist/esm/state/makeswift-api-client.js.map +1 -1
- package/dist/esm/utils/coalesce.js +13 -0
- package/dist/esm/utils/coalesce.js.map +1 -0
- package/dist/esm/utils/index-signature-hack.js +1 -0
- package/dist/esm/utils/index-signature-hack.js.map +1 -0
- package/dist/esm/utils/shallowMerge.js +14 -0
- package/dist/esm/utils/shallowMerge.js.map +1 -0
- package/dist/esm/utils/tests/breakpoint-test-util.js +9 -0
- package/dist/esm/utils/tests/breakpoint-test-util.js.map +1 -0
- package/dist/esm/utils/tests/element-data-test-test.js +50 -0
- package/dist/esm/utils/tests/element-data-test-test.js.map +1 -0
- package/dist/types/api/graphql/fragments.d.ts +4 -0
- package/dist/types/api/graphql/fragments.d.ts.map +1 -0
- package/dist/types/api/graphql/types.d.ts +8 -0
- package/dist/types/api/graphql/types.d.ts.map +1 -0
- package/dist/types/api/resource-types.d.ts +20 -0
- package/dist/types/api/resource-types.d.ts.map +1 -0
- package/dist/types/builder/serialization/controls/combobox.d.ts +5 -0
- package/dist/types/builder/serialization/controls/combobox.d.ts.map +1 -0
- package/dist/types/builder/serialization/controls/list.d.ts +5 -0
- package/dist/types/builder/serialization/controls/list.d.ts.map +1 -0
- package/dist/types/builder/serialization/controls/rich-text-v2.d.ts +5 -0
- package/dist/types/builder/serialization/controls/rich-text-v2.d.ts.map +1 -0
- package/dist/types/builder/serialization/controls/shape.d.ts +5 -0
- package/dist/types/builder/serialization/controls/shape.d.ts.map +1 -0
- package/dist/types/builder/serialization/controls/style-v2.d.ts +5 -0
- package/dist/types/builder/serialization/controls/style-v2.d.ts.map +1 -0
- package/dist/types/builder/unstructured-introspection/__fixtures__/element-containing-resources.d.ts +3 -0
- package/dist/types/builder/unstructured-introspection/__fixtures__/element-containing-resources.d.ts.map +1 -0
- package/dist/types/builder/unstructured-introspection/__fixtures__/index.d.ts +2 -0
- package/dist/types/builder/unstructured-introspection/__fixtures__/index.d.ts.map +1 -0
- package/dist/types/builder/unstructured-introspection/index.d.ts +2 -0
- package/dist/types/builder/unstructured-introspection/index.d.ts.map +1 -0
- package/dist/types/builder/unstructured-introspection/unstructured-introspection.d.ts +10 -0
- package/dist/types/builder/unstructured-introspection/unstructured-introspection.d.ts.map +1 -0
- package/dist/types/builder/unstructured-introspection/unstructured-introspection.test.d.ts +2 -0
- package/dist/types/builder/unstructured-introspection/unstructured-introspection.test.d.ts.map +1 -0
- package/dist/types/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
- package/dist/types/controls/checkbox.d.ts +21 -0
- package/dist/types/controls/checkbox.d.ts.map +1 -0
- package/dist/types/controls/color.d.ts +25 -0
- package/dist/types/controls/color.d.ts.map +1 -0
- package/dist/types/controls/combobox.d.ts +22 -0
- package/dist/types/controls/combobox.d.ts.map +1 -0
- package/dist/types/controls/control-data-type-key.d.ts +2 -0
- package/dist/types/controls/control-data-type-key.d.ts.map +1 -0
- package/dist/types/controls/icon-radio-group.d.ts +32 -0
- package/dist/types/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/controls/image.d.ts +4 -0
- package/dist/types/controls/image.d.ts.map +1 -0
- package/dist/types/controls/image.test.d.ts +2 -0
- package/dist/types/controls/image.test.d.ts.map +1 -0
- package/dist/types/controls/link.test.d.ts +2 -0
- package/dist/types/controls/link.test.d.ts.map +1 -0
- package/dist/types/controls/list.d.ts +78 -0
- package/dist/types/controls/list.d.ts.map +1 -0
- package/dist/types/controls/number.d.ts +26 -0
- package/dist/types/controls/number.d.ts.map +1 -0
- package/dist/types/controls/rich-text/__tests__/copy.test.d.ts +2 -0
- package/dist/types/controls/rich-text/__tests__/copy.test.d.ts.map +1 -0
- package/dist/types/controls/rich-text/__tests__/dto.test.d.ts +2 -0
- package/dist/types/controls/rich-text/__tests__/dto.test.d.ts.map +1 -0
- package/dist/types/controls/rich-text/__tests__/introspection.test.d.ts +2 -0
- package/dist/types/controls/rich-text/__tests__/introspection.test.d.ts.map +1 -0
- package/dist/types/controls/rich-text/copy.d.ts +4 -0
- package/dist/types/controls/rich-text/copy.d.ts.map +1 -0
- package/dist/types/controls/rich-text/dto-types.d.ts +132 -0
- package/dist/types/controls/rich-text/dto-types.d.ts.map +1 -0
- package/dist/types/controls/rich-text/dto.d.ts +8 -0
- package/dist/types/controls/rich-text/dto.d.ts.map +1 -0
- package/dist/types/controls/rich-text/fixtures/blockquote.d.ts +3 -0
- package/dist/types/controls/rich-text/fixtures/blockquote.d.ts.map +1 -0
- package/dist/types/controls/rich-text/fixtures/empty-blocks.d.ts +4 -0
- package/dist/types/controls/rich-text/fixtures/empty-blocks.d.ts.map +1 -0
- package/dist/types/controls/rich-text/fixtures/index.d.ts +4 -0
- package/dist/types/controls/rich-text/fixtures/index.d.ts.map +1 -0
- package/dist/types/controls/rich-text/fixtures/list.d.ts +3 -0
- package/dist/types/controls/rich-text/fixtures/list.d.ts.map +1 -0
- package/dist/types/controls/rich-text/fixtures/typography.d.ts +3 -0
- package/dist/types/controls/rich-text/fixtures/typography.d.ts.map +1 -0
- package/dist/types/controls/rich-text/fixtures/v2-data-types.d.ts +3 -0
- package/dist/types/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -0
- package/dist/types/controls/rich-text/introspection.d.ts +5 -0
- package/dist/types/controls/rich-text/introspection.d.ts.map +1 -0
- package/dist/types/controls/rich-text-v2/copy.d.ts +4 -0
- package/dist/types/controls/rich-text-v2/copy.d.ts.map +1 -0
- package/dist/types/controls/rich-text-v2/dto.d.ts +5 -0
- package/dist/types/controls/rich-text-v2/dto.d.ts.map +1 -0
- package/dist/types/controls/rich-text-v2/introspection.d.ts +5 -0
- package/dist/types/controls/rich-text-v2/introspection.d.ts.map +1 -0
- package/dist/types/controls/select.d.ts +22 -0
- package/dist/types/controls/select.d.ts.map +1 -0
- package/dist/types/controls/shape.d.ts +50 -0
- package/dist/types/controls/shape.d.ts.map +1 -0
- package/dist/types/controls/style-v2.d.ts +64 -0
- package/dist/types/controls/style-v2.d.ts.map +1 -0
- package/dist/types/controls/style.d.ts +179 -0
- package/dist/types/controls/style.d.ts.map +1 -0
- package/dist/types/controls/text-area.d.ts +22 -0
- package/dist/types/controls/text-area.d.ts.map +1 -0
- package/dist/types/controls/text-input.d.ts +22 -0
- package/dist/types/controls/text-input.d.ts.map +1 -0
- package/dist/types/controls/types.d.ts +14 -0
- package/dist/types/controls/types.d.ts.map +1 -0
- package/dist/types/controls/typography.d.ts +33 -0
- package/dist/types/controls/typography.d.ts.map +1 -0
- package/dist/types/locale.d.ts +1 -1
- package/dist/types/next/api-handler/handlers/clear-draft.d.ts +20 -0
- package/dist/types/next/api-handler/handlers/clear-draft.d.ts.map +1 -0
- package/dist/types/next/api-handler/handlers/redirect-draft.d.ts +18 -0
- package/dist/types/next/api-handler/handlers/redirect-draft.d.ts.map +1 -0
- package/dist/types/next/api-handler/handlers/redirect-preview.d.ts +18 -0
- package/dist/types/next/api-handler/handlers/redirect-preview.d.ts.map +1 -0
- package/dist/types/next/api-handler/handlers/utils/draft.d.ts +16 -0
- package/dist/types/next/api-handler/handlers/utils/draft.d.ts.map +1 -0
- package/dist/types/next/api-handler/handlers/webhook/site-published.d.ts +1 -2
- package/dist/types/next/api-handler/handlers/webhook/site-published.d.ts.map +1 -1
- package/dist/types/next/api-handler/handlers/webhook/types.d.ts +12 -12
- package/dist/types/next/cache.d.ts +2 -0
- package/dist/types/next/cache.d.ts.map +1 -0
- package/dist/types/next/client.d.ts +8 -8
- package/dist/types/next/components/tests/controls/color-control.test.d.ts +3 -0
- package/dist/types/next/components/tests/controls/color-control.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/controls/style-control.test.d.ts +2 -0
- package/dist/types/next/components/tests/controls/style-control.test.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/hooks/use-sync-cache-data.d.ts +3 -0
- package/dist/types/next/hooks/use-sync-cache-data.d.ts.map +1 -0
- package/dist/types/prop-controllers/base.d.ts +7 -0
- package/dist/types/prop-controllers/base.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/backgrounds.d.ts +4 -0
- package/dist/types/prop-controllers/copy/backgrounds.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/element-id.d.ts +3 -0
- package/dist/types/prop-controllers/copy/element-id.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/grid.d.ts +4 -0
- package/dist/types/prop-controllers/copy/grid.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/image.d.ts +4 -0
- package/dist/types/prop-controllers/copy/image.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/image.test.d.ts +2 -0
- package/dist/types/prop-controllers/copy/image.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/images.d.ts +4 -0
- package/dist/types/prop-controllers/copy/images.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/images.test.d.ts +2 -0
- package/dist/types/prop-controllers/copy/images.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/navigation-links.d.ts +4 -0
- package/dist/types/prop-controllers/copy/navigation-links.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/navigation-links.test.d.ts +2 -0
- package/dist/types/prop-controllers/copy/navigation-links.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/rich-text.d.ts +4 -0
- package/dist/types/prop-controllers/copy/rich-text.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/rich-text.test.d.ts +2 -0
- package/dist/types/prop-controllers/copy/rich-text.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/table-form-fields.d.ts +4 -0
- package/dist/types/prop-controllers/copy/table-form-fields.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/table-form-fields.test.d.ts +2 -0
- package/dist/types/prop-controllers/copy/table-form-fields.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/table.d.ts +4 -0
- package/dist/types/prop-controllers/copy/table.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/table.test.d.ts +2 -0
- package/dist/types/prop-controllers/copy/table.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/DocumentReference.d.ts +9 -0
- package/dist/types/runtimes/react/components/DocumentReference.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/draft-switcher/draft-switcher.d.ts +4 -0
- package/dist/types/runtimes/react/components/draft-switcher/draft-switcher.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/draft-switcher/draft-toolbar.d.ts +6 -0
- package/dist/types/runtimes/react/components/draft-switcher/draft-toolbar.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/hooks/use-builder-connection-ping.d.ts +4 -0
- package/dist/types/runtimes/react/components/hooks/use-builder-connection-ping.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/hooks/use-builder-handshake.d.ts +4 -0
- package/dist/types/runtimes/react/components/hooks/use-builder-handshake.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/checkbox.d.ts +4 -0
- package/dist/types/runtimes/react/controls/checkbox.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/color.d.ts +4 -0
- package/dist/types/runtimes/react/controls/color.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/combobox.d.ts +4 -0
- package/dist/types/runtimes/react/controls/combobox.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/icon-radio-group.d.ts +4 -0
- package/dist/types/runtimes/react/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/image.d.ts +4 -0
- package/dist/types/runtimes/react/controls/image.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/link.d.ts +4 -0
- package/dist/types/runtimes/react/controls/link.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/list.d.ts +12 -0
- package/dist/types/runtimes/react/controls/list.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/number.d.ts +4 -0
- package/dist/types/runtimes/react/controls/number.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/select.d.ts +4 -0
- package/dist/types/runtimes/react/controls/select.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/shape.d.ts +12 -0
- package/dist/types/runtimes/react/controls/shape.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/style-v2.d.ts +13 -0
- package/dist/types/runtimes/react/controls/style-v2.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/text-area.d.ts +4 -0
- package/dist/types/runtimes/react/controls/text-area.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/text-input.d.ts +4 -0
- package/dist/types/runtimes/react/controls/text-input.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-document-key.d.ts +4 -0
- package/dist/types/runtimes/react/hooks/use-document-key.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-head-marker.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-head-marker.d.ts.map +1 -0
- package/dist/types/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts +16 -0
- package/dist/types/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts.map +1 -0
- package/dist/types/state/react-builder-preview.test.d.ts +2 -0
- package/dist/types/state/react-builder-preview.test.d.ts.map +1 -0
- package/dist/types/state/react-page.test.d.ts +2 -0
- package/dist/types/state/react-page.test.d.ts.map +1 -0
- package/dist/types/utils/coalesce.d.ts +3 -0
- package/dist/types/utils/coalesce.d.ts.map +1 -0
- package/dist/types/utils/index-signature-hack.d.ts +4 -0
- package/dist/types/utils/index-signature-hack.d.ts.map +1 -0
- package/dist/types/utils/shallowMerge.d.ts +2 -0
- package/dist/types/utils/shallowMerge.d.ts.map +1 -0
- package/dist/types/utils/tests/breakpoint-test-util.d.ts +4 -0
- package/dist/types/utils/tests/breakpoint-test-util.d.ts.map +1 -0
- package/dist/types/utils/tests/element-data-test-test.d.ts +51 -0
- package/dist/types/utils/tests/element-data-test-test.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -42,7 +42,7 @@ var APIResources = __toESM(require("./modules/api-resources"));
|
|
|
42
42
|
var LocalizedResourcesMap = __toESM(require("./modules/localized-resources-map"));
|
|
43
43
|
var import_actions = require("./actions");
|
|
44
44
|
var import_api = require("../api");
|
|
45
|
-
var
|
|
45
|
+
var import_cache = require("../next/cache");
|
|
46
46
|
var import_site_version = require("../api/site-version");
|
|
47
47
|
const reducer = (0, import_redux.combineReducers)({
|
|
48
48
|
apiResources: APIResources.reducer,
|
|
@@ -87,7 +87,7 @@ async function fetchJson(url, siteVersion) {
|
|
|
87
87
|
"Content-Type": "application/json",
|
|
88
88
|
[import_site_version.API_HANDLER_SITE_VERSION_HEADER]: siteVersion
|
|
89
89
|
},
|
|
90
|
-
next: { tags: [
|
|
90
|
+
next: { tags: [import_cache.MAKESWIFT_CACHE_TAG] }
|
|
91
91
|
});
|
|
92
92
|
if (response.status === 404)
|
|
93
93
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/makeswift-api-client.ts"],"sourcesContent":["import {\n applyMiddleware,\n createStore,\n combineReducers,\n type Dispatch as ReduxDispatch,\n type Store as ReduxStore,\n type Middleware,\n} from 'redux'\nimport thunk, { type ThunkAction, type ThunkDispatch } from 'redux-thunk'\n\nimport { composeWithDevToolsDevelopmentOnly } from '@redux-devtools/extension'\n\nimport { serializeState } from '../utils/serializeState'\n\nimport * as APIResources from './modules/api-resources'\nimport * as LocalizedResourcesMap from './modules/localized-resources-map'\nimport { type Action, ActionTypes, apiResourceFulfilled, setLocalizedResourceId } from './actions'\nimport {\n APIResourceType,\n type APIResource,\n type Swatch,\n type File,\n type Typography,\n type GlobalElement,\n type PagePathnameSlice,\n type Table,\n type LocalizedGlobalElement,\n type APIResourceLocale,\n} from '../api'\nimport { MAKESWIFT_CACHE_TAG } from '../next/api-handler/handlers/webhook/site-published'\nimport { API_HANDLER_SITE_VERSION_HEADER, MakeswiftSiteVersion } from '../api/site-version'\n\nconst reducer = combineReducers({\n apiResources: APIResources.reducer,\n localizedResourcesMap: LocalizedResourcesMap.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nexport type SerializedState = {\n apiResources: APIResources.SerializedState\n localizedResourcesMap: LocalizedResourcesMap.SerializedState\n}\n\nfunction getLocalizedResourceId(\n state: State,\n locale: string,\n resourceId: string,\n): string | undefined | null {\n return LocalizedResourcesMap.getLocalizedResourceId(\n state.localizedResourcesMap,\n locale,\n resourceId,\n )\n}\n\nexport function getHasAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: APIResourceType,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): boolean {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return false\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return (\n localizedId != null &&\n APIResources.getHasAPIResource(state.apiResources, resourceType, localizedId, locale)\n )\n\n default:\n return APIResources.getHasAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\nexport function getAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: T,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): Extract<APIResource, { __typename: T }> | null {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return null\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return localizedId != null\n ? APIResources.getAPIResource(state.apiResources, resourceType, localizedId, locale)\n : null\n\n default:\n return APIResources.getAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\ntype Thunk<ReturnType> = ThunkAction<ReturnType, State, unknown, Action>\n\nasync function fetchJson<T>(url: string, siteVersion: MakeswiftSiteVersion): Promise<T | null> {\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n [API_HANDLER_SITE_VERSION_HEADER]: siteVersion,\n },\n next: { tags: [MAKESWIFT_CACHE_TAG] },\n })\n\n if (response.status === 404) return null\n\n if (!response.ok) throw new Error(response.statusText)\n\n if (response.headers.get('content-type')?.includes('application/json') !== true) {\n throw new Error(\n `Expected JSON response from \"${url}\" but got \"${response.headers.get('content-type')}\"`,\n )\n }\n\n return response.json()\n}\n\nexport function fetchAPIResource<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n siteVersion: MakeswiftSiteVersion,\n locale?: APIResourceLocale<T>,\n): Thunk<Promise<Extract<APIResource, { __typename: T }> | null>> {\n return async (dispatch, getState) => {\n const state = getState()\n\n if (getHasAPIResource(state, resourceType, resourceId, locale)) {\n return getAPIResource(state, resourceType, resourceId, locale)\n }\n\n let resource: APIResource | null\n\n switch (resourceType) {\n case APIResourceType.Swatch:\n resource = await fetchJson<Swatch>(`/api/makeswift/swatches/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.File:\n resource = await fetchJson<File>(`/api/makeswift/files/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.Typography:\n resource = await fetchJson<Typography>(\n `/api/makeswift/typographies/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.GlobalElement:\n resource = await fetchJson<GlobalElement>(\n `/api/makeswift/global-elements/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.LocalizedGlobalElement: {\n if (locale == null) throw new Error('Locale is required to fetch LocalizedGlobalElement')\n\n // If `getLocalizedResourceId` returns null, it means we have tried to fetch the resource,\n // but the resource is not available. If we haven't fetched it yet, it'll return undefined.\n if (getLocalizedResourceId(state, locale, resourceId) === null) {\n return null\n }\n\n resource = await fetchJson<LocalizedGlobalElement>(\n `/api/makeswift/localized-global-elements/${resourceId}/${locale}`,\n siteVersion,\n )\n\n dispatch(\n setLocalizedResourceId({\n locale,\n resourceId,\n localizedResourceId: resource?.id ?? null,\n }),\n )\n\n break\n }\n\n case APIResourceType.PagePathnameSlice: {\n const url = new URL(`/api/makeswift/page-pathname-slices/${resourceId}`, 'http://n')\n\n if (locale != null) url.searchParams.set('locale', locale)\n\n resource = await fetchJson<PagePathnameSlice>(url.pathname + url.search, siteVersion)\n break\n }\n\n case APIResourceType.Table:\n resource = await fetchJson<Table>(`/api/makeswift/tables/${resourceId}`, siteVersion)\n break\n\n default:\n resource = null\n }\n\n dispatch(apiResourceFulfilled(resourceType, resourceId, resource, locale))\n\n return resource as Extract<APIResource, { __typename: T }> | null\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\n// FIXME: this middleware can be removed once we've upgraded the builder\n// to always provide the locale when dispatching resource actions\nfunction defaultLocaleMiddleware(\n defaultLocale: string | undefined,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE:\n case ActionTypes.EVICT_API_RESOURCE:\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { locale } = action.payload\n return next({\n ...action,\n payload: { ...action.payload, locale: locale ?? defaultLocale },\n } as Action)\n }\n }\n\n return next(action)\n }\n }\n}\n\nexport function configureStore({\n defaultLocale,\n serializedState,\n}: {\n defaultLocale: string | undefined\n serializedState?: SerializedState\n}): Store {\n const composeEnhancers = composeWithDevToolsDevelopmentOnly({\n name: `API client store (${new Date().toISOString()})`,\n serialize: true,\n stateSanitizer: (state: any) => serializeState(state),\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n })\n\n return createStore(\n reducer,\n {\n apiResources: APIResources.getInitialState(serializedState?.apiResources),\n localizedResourcesMap: LocalizedResourcesMap.getInitialState(\n serializedState?.localizedResourcesMap,\n ),\n },\n composeEnhancers(applyMiddleware(thunk, defaultLocaleMiddleware(defaultLocale))),\n )\n}\n"],"mappings":"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","names":["thunk"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/makeswift-api-client.ts"],"sourcesContent":["import {\n applyMiddleware,\n createStore,\n combineReducers,\n type Dispatch as ReduxDispatch,\n type Store as ReduxStore,\n type Middleware,\n} from 'redux'\nimport thunk, { type ThunkAction, type ThunkDispatch } from 'redux-thunk'\n\nimport { composeWithDevToolsDevelopmentOnly } from '@redux-devtools/extension'\n\nimport { serializeState } from '../utils/serializeState'\n\nimport * as APIResources from './modules/api-resources'\nimport * as LocalizedResourcesMap from './modules/localized-resources-map'\nimport { type Action, ActionTypes, apiResourceFulfilled, setLocalizedResourceId } from './actions'\nimport {\n APIResourceType,\n type APIResource,\n type Swatch,\n type File,\n type Typography,\n type GlobalElement,\n type PagePathnameSlice,\n type Table,\n type LocalizedGlobalElement,\n type APIResourceLocale,\n} from '../api'\nimport { MAKESWIFT_CACHE_TAG } from '../next/cache'\nimport { API_HANDLER_SITE_VERSION_HEADER, MakeswiftSiteVersion } from '../api/site-version'\n\nconst reducer = combineReducers({\n apiResources: APIResources.reducer,\n localizedResourcesMap: LocalizedResourcesMap.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nexport type SerializedState = {\n apiResources: APIResources.SerializedState\n localizedResourcesMap: LocalizedResourcesMap.SerializedState\n}\n\nfunction getLocalizedResourceId(\n state: State,\n locale: string,\n resourceId: string,\n): string | undefined | null {\n return LocalizedResourcesMap.getLocalizedResourceId(\n state.localizedResourcesMap,\n locale,\n resourceId,\n )\n}\n\nexport function getHasAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: APIResourceType,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): boolean {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return false\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return (\n localizedId != null &&\n APIResources.getHasAPIResource(state.apiResources, resourceType, localizedId, locale)\n )\n\n default:\n return APIResources.getHasAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\nexport function getAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: T,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): Extract<APIResource, { __typename: T }> | null {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return null\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return localizedId != null\n ? APIResources.getAPIResource(state.apiResources, resourceType, localizedId, locale)\n : null\n\n default:\n return APIResources.getAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\ntype Thunk<ReturnType> = ThunkAction<ReturnType, State, unknown, Action>\n\nasync function fetchJson<T>(url: string, siteVersion: MakeswiftSiteVersion): Promise<T | null> {\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n [API_HANDLER_SITE_VERSION_HEADER]: siteVersion,\n },\n next: { tags: [MAKESWIFT_CACHE_TAG] },\n })\n\n if (response.status === 404) return null\n\n if (!response.ok) throw new Error(response.statusText)\n\n if (response.headers.get('content-type')?.includes('application/json') !== true) {\n throw new Error(\n `Expected JSON response from \"${url}\" but got \"${response.headers.get('content-type')}\"`,\n )\n }\n\n return response.json()\n}\n\nexport function fetchAPIResource<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n siteVersion: MakeswiftSiteVersion,\n locale?: APIResourceLocale<T>,\n): Thunk<Promise<Extract<APIResource, { __typename: T }> | null>> {\n return async (dispatch, getState) => {\n const state = getState()\n\n if (getHasAPIResource(state, resourceType, resourceId, locale)) {\n return getAPIResource(state, resourceType, resourceId, locale)\n }\n\n let resource: APIResource | null\n\n switch (resourceType) {\n case APIResourceType.Swatch:\n resource = await fetchJson<Swatch>(`/api/makeswift/swatches/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.File:\n resource = await fetchJson<File>(`/api/makeswift/files/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.Typography:\n resource = await fetchJson<Typography>(\n `/api/makeswift/typographies/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.GlobalElement:\n resource = await fetchJson<GlobalElement>(\n `/api/makeswift/global-elements/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.LocalizedGlobalElement: {\n if (locale == null) throw new Error('Locale is required to fetch LocalizedGlobalElement')\n\n // If `getLocalizedResourceId` returns null, it means we have tried to fetch the resource,\n // but the resource is not available. If we haven't fetched it yet, it'll return undefined.\n if (getLocalizedResourceId(state, locale, resourceId) === null) {\n return null\n }\n\n resource = await fetchJson<LocalizedGlobalElement>(\n `/api/makeswift/localized-global-elements/${resourceId}/${locale}`,\n siteVersion,\n )\n\n dispatch(\n setLocalizedResourceId({\n locale,\n resourceId,\n localizedResourceId: resource?.id ?? null,\n }),\n )\n\n break\n }\n\n case APIResourceType.PagePathnameSlice: {\n const url = new URL(`/api/makeswift/page-pathname-slices/${resourceId}`, 'http://n')\n\n if (locale != null) url.searchParams.set('locale', locale)\n\n resource = await fetchJson<PagePathnameSlice>(url.pathname + url.search, siteVersion)\n break\n }\n\n case APIResourceType.Table:\n resource = await fetchJson<Table>(`/api/makeswift/tables/${resourceId}`, siteVersion)\n break\n\n default:\n resource = null\n }\n\n dispatch(apiResourceFulfilled(resourceType, resourceId, resource, locale))\n\n return resource as Extract<APIResource, { __typename: T }> | null\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\n// FIXME: this middleware can be removed once we've upgraded the builder\n// to always provide the locale when dispatching resource actions\nfunction defaultLocaleMiddleware(\n defaultLocale: string | undefined,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE:\n case ActionTypes.EVICT_API_RESOURCE:\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { locale } = action.payload\n return next({\n ...action,\n payload: { ...action.payload, locale: locale ?? defaultLocale },\n } as Action)\n }\n }\n\n return next(action)\n }\n }\n}\n\nexport function configureStore({\n defaultLocale,\n serializedState,\n}: {\n defaultLocale: string | undefined\n serializedState?: SerializedState\n}): Store {\n const composeEnhancers = composeWithDevToolsDevelopmentOnly({\n name: `API client store (${new Date().toISOString()})`,\n serialize: true,\n stateSanitizer: (state: any) => serializeState(state),\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n })\n\n return createStore(\n reducer,\n {\n apiResources: APIResources.getInitialState(serializedState?.apiResources),\n localizedResourcesMap: LocalizedResourcesMap.getInitialState(\n serializedState?.localizedResourcesMap,\n ),\n },\n composeEnhancers(applyMiddleware(thunk, defaultLocaleMiddleware(defaultLocale))),\n )\n}\n"],"mappings":"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","names":["thunk"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var coalesce_exports = {};
|
|
20
|
+
__export(coalesce_exports, {
|
|
21
|
+
default: () => coalesce_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(coalesce_exports);
|
|
24
|
+
const coalesce = (...args) => {
|
|
25
|
+
let i;
|
|
26
|
+
for (i = 0; i < args.length - 1; i += 1) {
|
|
27
|
+
if (args[i] != null)
|
|
28
|
+
return args[i];
|
|
29
|
+
}
|
|
30
|
+
return args[i];
|
|
31
|
+
};
|
|
32
|
+
var coalesce_default = coalesce;
|
|
33
|
+
//# sourceMappingURL=coalesce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/coalesce.ts"],"sourcesContent":["const coalesce = <T>(...args: Array<T>): T => {\n let i: number\n\n for (i = 0; i < args.length - 1; i += 1) {\n if (args[i] != null) return args[i]\n }\n\n return args[i]\n}\n\nexport default coalesce\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,WAAW,IAAO,SAAsB;AAC5C,MAAI;AAEJ,OAAK,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG;AACvC,QAAI,KAAK,CAAC,KAAK;AAAM,aAAO,KAAK,CAAC;AAAA,EACpC;AAEA,SAAO,KAAK,CAAC;AACf;AAEA,IAAO,mBAAQ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var index_signature_hack_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(index_signature_hack_exports);
|
|
17
|
+
//# sourceMappingURL=index-signature-hack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/index-signature-hack.ts"],"sourcesContent":["// See https://github.com/microsoft/TypeScript/issues/15300\nexport type IndexSignatureHack<T> = T extends Record<string, any>\n ? { [K in keyof T]: IndexSignatureHack<T[K]> }\n : T\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var shallowMerge_exports = {};
|
|
30
|
+
__export(shallowMerge_exports, {
|
|
31
|
+
default: () => shallowMerge
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(shallowMerge_exports);
|
|
34
|
+
var import_keys = __toESM(require("./keys"));
|
|
35
|
+
var import_coalesce = __toESM(require("./coalesce"));
|
|
36
|
+
function shallowMerge(a, b) {
|
|
37
|
+
const bKeys = (0, import_keys.default)(b);
|
|
38
|
+
const merged = { ...a };
|
|
39
|
+
bKeys.forEach((key) => {
|
|
40
|
+
merged[key] = (0, import_coalesce.default)(merged[key], b[key]);
|
|
41
|
+
});
|
|
42
|
+
return merged;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=shallowMerge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/shallowMerge.ts"],"sourcesContent":["import keys from './keys'\nimport coalesce from './coalesce'\n\nexport default function shallowMerge<\n A extends Record<string, unknown>,\n B extends Record<string, unknown>,\n>(a: A, b: B): A & B {\n const bKeys = keys(b)\n const merged = { ...a } as A & B\n\n bKeys.forEach(key => {\n // @ts-expect-error: `coalesce` returns `null | undefined` regardless of input guarantees.\n merged[key] = coalesce(merged[key], b[key])\n })\n\n return merged\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,sBAAqB;AAEN,SAAR,aAGL,GAAM,GAAa;AACnB,QAAM,YAAQ,YAAAA,SAAK,CAAC;AACpB,QAAM,SAAS,EAAE,GAAG,EAAE;AAEtB,QAAM,QAAQ,SAAO;AAEnB,WAAO,GAAG,QAAI,gBAAAC,SAAS,OAAO,GAAG,GAAG,EAAE,GAAG,CAAC;AAAA,EAC5C,CAAC;AAED,SAAO;AACT;","names":["keys","coalesce"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var breakpoint_test_util_exports = {};
|
|
20
|
+
__export(breakpoint_test_util_exports, {
|
|
21
|
+
DESKTOP_MEDIA_QUERY: () => DESKTOP_MEDIA_QUERY,
|
|
22
|
+
MOBILE_MEDIA_QUERY: () => MOBILE_MEDIA_QUERY,
|
|
23
|
+
TABLET_MEDIA_QUERY: () => TABLET_MEDIA_QUERY
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(breakpoint_test_util_exports);
|
|
26
|
+
const DESKTOP_MEDIA_QUERY = "only screen and (min-width: 769px)";
|
|
27
|
+
const TABLET_MEDIA_QUERY = "only screen and (min-width: 769px)";
|
|
28
|
+
const MOBILE_MEDIA_QUERY = "only screen and (min-width: 769px)";
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
DESKTOP_MEDIA_QUERY,
|
|
32
|
+
MOBILE_MEDIA_QUERY,
|
|
33
|
+
TABLET_MEDIA_QUERY
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=breakpoint-test-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/tests/breakpoint-test-util.ts"],"sourcesContent":["export const DESKTOP_MEDIA_QUERY = 'only screen and (min-width: 769px)'\nexport const TABLET_MEDIA_QUERY = 'only screen and (min-width: 769px)'\nexport const MOBILE_MEDIA_QUERY = 'only screen and (min-width: 769px)'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var element_data_test_test_exports = {};
|
|
20
|
+
__export(element_data_test_test_exports, {
|
|
21
|
+
createMakeswiftPageSnapshot: () => createMakeswiftPageSnapshot,
|
|
22
|
+
createRootComponent: () => createRootComponent
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(element_data_test_test_exports);
|
|
25
|
+
var import_crypto = require("crypto");
|
|
26
|
+
var import_components = require("../../components");
|
|
27
|
+
function createRootComponent(elements, rootId) {
|
|
28
|
+
return {
|
|
29
|
+
key: rootId ?? (0, import_crypto.randomUUID)(),
|
|
30
|
+
type: import_components.MakeswiftComponentType.Root,
|
|
31
|
+
props: {
|
|
32
|
+
children: {
|
|
33
|
+
columns: [
|
|
34
|
+
{
|
|
35
|
+
deviceId: "desktop",
|
|
36
|
+
value: {
|
|
37
|
+
count: 12,
|
|
38
|
+
spans: elements?.map(() => [12])
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
elements
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function createMakeswiftPageSnapshot(elementData, {
|
|
48
|
+
cacheData = {},
|
|
49
|
+
locale = null
|
|
50
|
+
} = {}) {
|
|
51
|
+
return {
|
|
52
|
+
document: {
|
|
53
|
+
id: "test-page-id",
|
|
54
|
+
site: { id: "test-site-id" },
|
|
55
|
+
data: elementData,
|
|
56
|
+
snippets: [],
|
|
57
|
+
fonts: [],
|
|
58
|
+
meta: {},
|
|
59
|
+
seo: {},
|
|
60
|
+
localizedPages: [],
|
|
61
|
+
locale
|
|
62
|
+
},
|
|
63
|
+
cacheData: {
|
|
64
|
+
apiResources: {},
|
|
65
|
+
localizedResourcesMap: {},
|
|
66
|
+
...cacheData
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
createMakeswiftPageSnapshot,
|
|
73
|
+
createRootComponent
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=element-data-test-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/tests/element-data-test-test.ts"],"sourcesContent":["import { randomUUID } from 'crypto'\nimport { type MakeswiftPageSnapshot } from '../../next'\nimport { type ElementData } from '../../state/react-page'\nimport { MakeswiftComponentType } from '../../components'\n\nexport function createRootComponent(elements: ElementData[], rootId?: string) {\n return {\n key: rootId ?? randomUUID(),\n type: MakeswiftComponentType.Root,\n props: {\n children: {\n columns: [\n {\n deviceId: 'desktop',\n value: {\n count: 12,\n spans: elements?.map(() => [12]),\n },\n },\n ],\n elements,\n },\n },\n }\n}\n\nexport function createMakeswiftPageSnapshot(\n elementData: ElementData,\n {\n cacheData = {},\n locale = null,\n }: { cacheData?: Partial<MakeswiftPageSnapshot['cacheData']>; locale?: string | null } = {},\n): MakeswiftPageSnapshot {\n return {\n document: {\n id: 'test-page-id',\n site: { id: 'test-site-id' },\n data: elementData,\n snippets: [],\n fonts: [],\n meta: {},\n seo: {},\n localizedPages: [],\n locale,\n },\n cacheData: {\n apiResources: {},\n localizedResourcesMap: {},\n ...cacheData,\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAG3B,wBAAuC;AAEhC,SAAS,oBAAoB,UAAyB,QAAiB;AAC5E,SAAO;AAAA,IACL,KAAK,cAAU,0BAAW;AAAA,IAC1B,MAAM,yCAAuB;AAAA,IAC7B,OAAO;AAAA,MACL,UAAU;AAAA,QACR,SAAS;AAAA,UACP;AAAA,YACE,UAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO;AAAA,cACP,OAAO,UAAU,IAAI,MAAM,CAAC,EAAE,CAAC;AAAA,YACjC;AAAA,UACF;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,4BACd,aACA;AAAA,EACE,YAAY,CAAC;AAAA,EACb,SAAS;AACX,IAAyF,CAAC,GACnE;AACvB,SAAO;AAAA,IACL,UAAU;AAAA,MACR,IAAI;AAAA,MACJ,MAAM,EAAE,IAAI,eAAe;AAAA,MAC3B,MAAM;AAAA,MACN,UAAU,CAAC;AAAA,MACX,OAAO,CAAC;AAAA,MACR,MAAM,CAAC;AAAA,MACP,KAAK,CAAC;AAAA,MACN,gBAAgB,CAAC;AAAA,MACjB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,cAAc,CAAC;AAAA,MACf,uBAAuB,CAAC;AAAA,MACxB,GAAG;AAAA,IACL;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/graphql/fragments.ts"],"sourcesContent":["import { DocumentNode } from 'graphql'\nimport { APIResourceType } from '..'\nimport * as FragmentDocumentNodes from './generated/fragment-document-nodes'\n\nexport const Fragments: Record<APIResourceType, DocumentNode> = FragmentDocumentNodes\n"],"mappings":"AAEA,YAAY,2BAA2B;AAEhC,MAAM,YAAmD;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const APIResourceType = {
|
|
2
|
+
Swatch: "Swatch",
|
|
3
|
+
File: "File",
|
|
4
|
+
Typography: "Typography",
|
|
5
|
+
PagePathnameSlice: "PagePathnameSlice",
|
|
6
|
+
GlobalElement: "GlobalElement",
|
|
7
|
+
LocalizedGlobalElement: "LocalizedGlobalElement",
|
|
8
|
+
Table: "Table",
|
|
9
|
+
Snippet: "Snippet",
|
|
10
|
+
Page: "Page",
|
|
11
|
+
Site: "Site"
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
APIResourceType
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/graphql/types.ts"],"sourcesContent":["import {\n SwatchFragment as Swatch,\n FileFragment as File,\n TypographyFragment as Typography,\n PagePathnameSliceFragment as PagePathnameSlice,\n GlobalElementFragment as GlobalElement,\n LocalizedGlobalElementFragment as LocalizedGlobalElement,\n TableFragment as Table,\n SnippetFragment as Snippet,\n PageFragment as Page,\n SiteFragment as Site,\n} from './generated/types'\n\nexport type {\n Swatch,\n File,\n Typography,\n PagePathnameSlice,\n GlobalElement,\n LocalizedGlobalElement,\n Table,\n Snippet,\n Page,\n Site,\n}\n\nexport type APIResource =\n | Swatch\n | File\n | Typography\n | PagePathnameSlice\n | GlobalElement\n | LocalizedGlobalElement\n | Table\n | Snippet\n | Page\n | Site\n\nexport const APIResourceType: { [R in APIResource as R['__typename']]: R['__typename'] } = {\n Swatch: 'Swatch',\n File: 'File',\n Typography: 'Typography',\n PagePathnameSlice: 'PagePathnameSlice',\n GlobalElement: 'GlobalElement',\n LocalizedGlobalElement: 'LocalizedGlobalElement',\n Table: 'Table',\n Snippet: 'Snippet',\n Page: 'Page',\n Site: 'Site',\n}\n\nexport type APIResourceType = typeof APIResourceType[keyof typeof APIResourceType]\n"],"mappings":"AAsCO,MAAM,kBAA8E;AAAA,EACzF,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,wBAAwB;AAAA,EACxB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AACR;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/api/resource-types.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst pagePathnameSliceSchema = z.object({\n id: z.string(),\n pathname: z.string(),\n localizedPathname: z.string().optional().nullable(),\n __typename: z.literal('PagePathnameSlice'),\n})\n\nexport type PagePathnameSlice = z.infer<typeof pagePathnameSliceSchema>\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,MAAM,0BAA0B,EAAE,OAAO;AAAA,EACvC,IAAI,EAAE,OAAO;AAAA,EACb,UAAU,EAAE,OAAO;AAAA,EACnB,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,YAAY,EAAE,QAAQ,mBAAmB;AAC3C,CAAC;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { deserializeFunction, serializeFunction } from "../function-serialization";
|
|
2
|
+
function serializeComboboxControlDefinition(definition) {
|
|
3
|
+
const transferables = [];
|
|
4
|
+
const getOptions = definition.config.getOptions && serializeFunction(definition.config.getOptions);
|
|
5
|
+
if (getOptions)
|
|
6
|
+
transferables.push(getOptions);
|
|
7
|
+
return [{ ...definition, config: { ...definition.config, getOptions } }, transferables];
|
|
8
|
+
}
|
|
9
|
+
function deserializeComboboxControlDefinition(definition) {
|
|
10
|
+
const getOptions = definition.config.getOptions && deserializeFunction(definition.config.getOptions);
|
|
11
|
+
return {
|
|
12
|
+
...definition,
|
|
13
|
+
config: { ...definition.config, getOptions }
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
deserializeComboboxControlDefinition,
|
|
18
|
+
serializeComboboxControlDefinition
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/builder/serialization/controls/combobox.ts"],"sourcesContent":["import { ComboboxControlDefinition } from '../../../controls'\nimport { deserializeFunction, serializeFunction } from '../function-serialization'\nimport { Deserialize, Serialize } from './types'\n\nexport function serializeComboboxControlDefinition(\n definition: ComboboxControlDefinition,\n): [Serialize<ComboboxControlDefinition>, Transferable[]] {\n const transferables = []\n const getOptions = definition.config.getOptions && serializeFunction(definition.config.getOptions)\n\n if (getOptions) transferables.push(getOptions)\n\n return [{ ...definition, config: { ...definition.config, getOptions } }, transferables] as [\n Serialize<ComboboxControlDefinition>,\n Transferable[],\n ]\n}\n\nexport function deserializeComboboxControlDefinition(\n definition: Serialize<ComboboxControlDefinition>,\n): Deserialize<Serialize<ComboboxControlDefinition>> {\n const getOptions =\n definition.config.getOptions && deserializeFunction(definition.config.getOptions)\n\n return {\n ...definition,\n config: { ...definition.config, getOptions },\n } as Deserialize<Serialize<ComboboxControlDefinition>>\n}\n"],"mappings":"AACA,SAAS,qBAAqB,yBAAyB;AAGhD,SAAS,mCACd,YACwD;AACxD,QAAM,gBAAgB,CAAC;AACvB,QAAM,aAAa,WAAW,OAAO,cAAc,kBAAkB,WAAW,OAAO,UAAU;AAEjG,MAAI;AAAY,kBAAc,KAAK,UAAU;AAE7C,SAAO,CAAC,EAAE,GAAG,YAAY,QAAQ,EAAE,GAAG,WAAW,QAAQ,WAAW,EAAE,GAAG,aAAa;AAIxF;AAEO,SAAS,qCACd,YACmD;AACnD,QAAM,aACJ,WAAW,OAAO,cAAc,oBAAoB,WAAW,OAAO,UAAU;AAElF,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,EAAE,GAAG,WAAW,QAAQ,WAAW;AAAA,EAC7C;AACF;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { deserializeControl, serializeControl } from "../control-serialization";
|
|
2
|
+
import { deserializeFunction, serializeFunction } from "../function-serialization";
|
|
3
|
+
function serializeListControlDefinition(definition) {
|
|
4
|
+
const [type, transferables] = serializeControl(definition.config.type);
|
|
5
|
+
const getItemLabel = definition.config.getItemLabel && serializeFunction(definition.config.getItemLabel);
|
|
6
|
+
if (getItemLabel)
|
|
7
|
+
transferables.push(getItemLabel);
|
|
8
|
+
return [
|
|
9
|
+
{ ...definition, config: { ...definition.config, type, getItemLabel } },
|
|
10
|
+
transferables
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
function deserializeListControlDefinition(definition) {
|
|
14
|
+
const type = deserializeControl(definition.config.type);
|
|
15
|
+
const getItemLabel = definition.config.getItemLabel && deserializeFunction(definition.config.getItemLabel);
|
|
16
|
+
return {
|
|
17
|
+
...definition,
|
|
18
|
+
config: { ...definition.config, type, getItemLabel }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
deserializeListControlDefinition,
|
|
23
|
+
serializeListControlDefinition
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/builder/serialization/controls/list.ts"],"sourcesContent":["import { ListControlDefinition } from '../../../controls'\nimport { deserializeControl, serializeControl } from '../control-serialization'\nimport { deserializeFunction, serializeFunction } from '../function-serialization'\nimport { Deserialize, Serialize } from './types'\n\nexport function serializeListControlDefinition(\n definition: ListControlDefinition,\n): [Serialize<ListControlDefinition>, Transferable[]] {\n const [type, transferables] = serializeControl(definition.config.type)\n const getItemLabel =\n definition.config.getItemLabel && serializeFunction(definition.config.getItemLabel)\n\n if (getItemLabel) transferables.push(getItemLabel)\n\n return [\n { ...definition, config: { ...definition.config, type, getItemLabel } },\n transferables,\n ] as [Serialize<ListControlDefinition>, Transferable[]]\n}\n\nexport function deserializeListControlDefinition(\n definition: Serialize<ListControlDefinition>,\n): Deserialize<Serialize<ListControlDefinition>> {\n const type = deserializeControl(definition.config.type)\n const getItemLabel =\n definition.config.getItemLabel && deserializeFunction(definition.config.getItemLabel)\n\n return {\n ...definition,\n config: { ...definition.config, type, getItemLabel },\n } as Deserialize<Serialize<ListControlDefinition>>\n}\n"],"mappings":"AACA,SAAS,oBAAoB,wBAAwB;AACrD,SAAS,qBAAqB,yBAAyB;AAGhD,SAAS,+BACd,YACoD;AACpD,QAAM,CAAC,MAAM,aAAa,IAAI,iBAAiB,WAAW,OAAO,IAAI;AACrE,QAAM,eACJ,WAAW,OAAO,gBAAgB,kBAAkB,WAAW,OAAO,YAAY;AAEpF,MAAI;AAAc,kBAAc,KAAK,YAAY;AAEjD,SAAO;AAAA,IACL,EAAE,GAAG,YAAY,QAAQ,EAAE,GAAG,WAAW,QAAQ,MAAM,aAAa,EAAE;AAAA,IACtE;AAAA,EACF;AACF;AAEO,SAAS,iCACd,YAC+C;AAC/C,QAAM,OAAO,mBAAmB,WAAW,OAAO,IAAI;AACtD,QAAM,eACJ,WAAW,OAAO,gBAAgB,oBAAoB,WAAW,OAAO,YAAY;AAEtF,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,EAAE,GAAG,WAAW,QAAQ,MAAM,aAAa;AAAA,EACrD;AACF;","names":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { deserializeControl, serializeControl } from "../control-serialization";
|
|
2
|
+
import { deserializeFunction, serializeFunction } from "../function-serialization";
|
|
3
|
+
function serializeRichTextControlV2(definition) {
|
|
4
|
+
const { plugins, ...config } = definition.config;
|
|
5
|
+
const transferables = [];
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
...definition,
|
|
9
|
+
config: {
|
|
10
|
+
...config,
|
|
11
|
+
plugins: plugins?.map((plugin) => {
|
|
12
|
+
const onKeyDown = plugin.onKeyDown && serializeFunction(plugin.onKeyDown);
|
|
13
|
+
if (onKeyDown)
|
|
14
|
+
transferables.push(onKeyDown);
|
|
15
|
+
const withPlugin = plugin.withPlugin && serializeFunction(plugin.withPlugin);
|
|
16
|
+
if (withPlugin)
|
|
17
|
+
transferables.push(withPlugin);
|
|
18
|
+
if (plugin.control) {
|
|
19
|
+
const [definition2, pluginTransferables] = serializeControl(plugin.control.definition);
|
|
20
|
+
transferables.push(...pluginTransferables);
|
|
21
|
+
const getValue = serializeFunction(plugin.control.getValue);
|
|
22
|
+
if (getValue)
|
|
23
|
+
transferables.push(getValue);
|
|
24
|
+
const onChange = serializeFunction(plugin.control.onChange);
|
|
25
|
+
if (onChange)
|
|
26
|
+
transferables.push(onChange);
|
|
27
|
+
return {
|
|
28
|
+
control: {
|
|
29
|
+
definition: definition2,
|
|
30
|
+
onChange,
|
|
31
|
+
getValue
|
|
32
|
+
},
|
|
33
|
+
onKeyDown,
|
|
34
|
+
withPlugin
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
onKeyDown,
|
|
39
|
+
withPlugin
|
|
40
|
+
};
|
|
41
|
+
}) ?? []
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
transferables
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function deserializeRichTextControlV2(definition) {
|
|
48
|
+
return {
|
|
49
|
+
...definition,
|
|
50
|
+
config: {
|
|
51
|
+
...definition.config,
|
|
52
|
+
plugins: definition.config.plugins?.map((plugin) => {
|
|
53
|
+
const onKeyDown = plugin.onKeyDown && deserializeFunction(plugin.onKeyDown);
|
|
54
|
+
const withPlugin = plugin.withPlugin && deserializeFunction(plugin.withPlugin);
|
|
55
|
+
if (plugin.control) {
|
|
56
|
+
const definition2 = deserializeControl(plugin.control.definition);
|
|
57
|
+
const getValue = deserializeFunction(plugin.control.getValue);
|
|
58
|
+
const onChange = deserializeFunction(plugin.control.onChange);
|
|
59
|
+
return {
|
|
60
|
+
control: {
|
|
61
|
+
definition: definition2,
|
|
62
|
+
onChange,
|
|
63
|
+
getValue
|
|
64
|
+
},
|
|
65
|
+
onKeyDown,
|
|
66
|
+
withPlugin
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
onKeyDown,
|
|
71
|
+
withPlugin
|
|
72
|
+
};
|
|
73
|
+
}) ?? []
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
deserializeRichTextControlV2,
|
|
79
|
+
serializeRichTextControlV2
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=rich-text-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/builder/serialization/controls/rich-text-v2.ts"],"sourcesContent":["import { RichTextV2ControlDefinition } from '../../../controls'\nimport { deserializeControl, serializeControl } from '../control-serialization'\nimport { deserializeFunction, serializeFunction } from '../function-serialization'\nimport { Deserialize, Serialize } from './types'\n\nexport function serializeRichTextControlV2(\n definition: RichTextV2ControlDefinition,\n): [Serialize<RichTextV2ControlDefinition>, Transferable[]] {\n const { plugins, ...config } = definition.config\n const transferables: Transferable[] = []\n\n return [\n {\n ...definition,\n config: {\n ...config,\n plugins:\n plugins?.map(plugin => {\n const onKeyDown = plugin.onKeyDown && serializeFunction(plugin.onKeyDown)\n if (onKeyDown) transferables.push(onKeyDown)\n const withPlugin = plugin.withPlugin && serializeFunction(plugin.withPlugin)\n if (withPlugin) transferables.push(withPlugin)\n\n if (plugin.control) {\n const [definition, pluginTransferables] = serializeControl(plugin.control.definition)\n transferables.push(...pluginTransferables)\n const getValue = serializeFunction(plugin.control.getValue)\n if (getValue) transferables.push(getValue)\n const onChange = serializeFunction(plugin.control.onChange)\n if (onChange) transferables.push(onChange)\n\n return {\n control: {\n definition,\n onChange,\n getValue,\n },\n onKeyDown,\n withPlugin,\n }\n }\n\n return {\n onKeyDown,\n withPlugin,\n }\n }) ?? [],\n },\n },\n transferables,\n ] as [Serialize<RichTextV2ControlDefinition>, Transferable[]]\n}\n\nexport function deserializeRichTextControlV2(\n definition: Serialize<RichTextV2ControlDefinition>,\n): Deserialize<Serialize<RichTextV2ControlDefinition>> {\n return {\n ...definition,\n config: {\n ...definition.config,\n plugins:\n definition.config.plugins?.map(plugin => {\n // TODO: you shouldn't need to cast all the functions\n // There is a type missmatch where functions within the plugin aren't typed as Serialize<T>\n // This prevents them from being used with `deserializeFunction`\n const onKeyDown = plugin.onKeyDown && deserializeFunction(plugin.onKeyDown as any)\n const withPlugin = plugin.withPlugin && deserializeFunction(plugin.withPlugin as any)\n\n if (plugin.control) {\n const definition = deserializeControl(plugin.control.definition as any)\n const getValue = deserializeFunction(plugin.control.getValue as any)\n const onChange = deserializeFunction(plugin.control.onChange as any)\n\n return {\n control: {\n definition,\n onChange,\n getValue,\n },\n onKeyDown,\n withPlugin,\n }\n }\n\n return {\n onKeyDown,\n withPlugin,\n }\n }) ?? [],\n },\n } as Deserialize<Serialize<RichTextV2ControlDefinition>>\n}\n"],"mappings":"AACA,SAAS,oBAAoB,wBAAwB;AACrD,SAAS,qBAAqB,yBAAyB;AAGhD,SAAS,2BACd,YAC0D;AAC1D,QAAM,EAAE,SAAS,GAAG,OAAO,IAAI,WAAW;AAC1C,QAAM,gBAAgC,CAAC;AAEvC,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,QAAQ;AAAA,QACN,GAAG;AAAA,QACH,SACE,SAAS,IAAI,YAAU;AACrB,gBAAM,YAAY,OAAO,aAAa,kBAAkB,OAAO,SAAS;AACxE,cAAI;AAAW,0BAAc,KAAK,SAAS;AAC3C,gBAAM,aAAa,OAAO,cAAc,kBAAkB,OAAO,UAAU;AAC3E,cAAI;AAAY,0BAAc,KAAK,UAAU;AAE7C,cAAI,OAAO,SAAS;AAClB,kBAAM,CAACA,aAAY,mBAAmB,IAAI,iBAAiB,OAAO,QAAQ,UAAU;AACpF,0BAAc,KAAK,GAAG,mBAAmB;AACzC,kBAAM,WAAW,kBAAkB,OAAO,QAAQ,QAAQ;AAC1D,gBAAI;AAAU,4BAAc,KAAK,QAAQ;AACzC,kBAAM,WAAW,kBAAkB,OAAO,QAAQ,QAAQ;AAC1D,gBAAI;AAAU,4BAAc,KAAK,QAAQ;AAEzC,mBAAO;AAAA,cACL,SAAS;AAAA,gBACP,YAAAA;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAEA,iBAAO;AAAA,YACL;AAAA,YACA;AAAA,UACF;AAAA,QACF,CAAC,KAAK,CAAC;AAAA,MACX;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,6BACd,YACqD;AACrD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ;AAAA,MACN,GAAG,WAAW;AAAA,MACd,SACE,WAAW,OAAO,SAAS,IAAI,YAAU;AAIvC,cAAM,YAAY,OAAO,aAAa,oBAAoB,OAAO,SAAgB;AACjF,cAAM,aAAa,OAAO,cAAc,oBAAoB,OAAO,UAAiB;AAEpF,YAAI,OAAO,SAAS;AAClB,gBAAMA,cAAa,mBAAmB,OAAO,QAAQ,UAAiB;AACtE,gBAAM,WAAW,oBAAoB,OAAO,QAAQ,QAAe;AACnE,gBAAM,WAAW,oBAAoB,OAAO,QAAQ,QAAe;AAEnE,iBAAO;AAAA,YACL,SAAS;AAAA,cACP,YAAAA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAEA,eAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,MACF,CAAC,KAAK,CAAC;AAAA,IACX;AAAA,EACF;AACF;","names":["definition"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deserializeControl,
|
|
3
|
+
serializeControl
|
|
4
|
+
} from "../control-serialization";
|
|
5
|
+
function serializeShapeControlDefinition(definition) {
|
|
6
|
+
const [type, transferables] = Object.entries(definition.config.type).reduce(
|
|
7
|
+
([type2, transferables2], [key, value]) => {
|
|
8
|
+
const [serializedType, serializedTransferables] = serializeControl(value);
|
|
9
|
+
type2[key] = serializedType;
|
|
10
|
+
transferables2.push(...serializedTransferables);
|
|
11
|
+
return [type2, transferables2];
|
|
12
|
+
},
|
|
13
|
+
[{}, []]
|
|
14
|
+
);
|
|
15
|
+
return [{ ...definition, config: { ...definition.config, type } }, transferables];
|
|
16
|
+
}
|
|
17
|
+
function deserializeShapeControlDefinition(definition) {
|
|
18
|
+
const type = Object.entries(definition.config.type).reduce((type2, [key, value]) => {
|
|
19
|
+
const serializedType = deserializeControl(value);
|
|
20
|
+
type2[key] = serializedType;
|
|
21
|
+
return type2;
|
|
22
|
+
}, {});
|
|
23
|
+
return {
|
|
24
|
+
...definition,
|
|
25
|
+
config: { ...definition.config, type }
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
deserializeShapeControlDefinition,
|
|
30
|
+
serializeShapeControlDefinition
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/builder/serialization/controls/shape.ts"],"sourcesContent":["import { ShapeControlDefinition } from '../../../controls'\nimport {\n deserializeControl,\n DeserializedControl,\n serializeControl,\n SerializedControl,\n} from '../control-serialization'\nimport { Deserialize, Serialize } from './types'\n\nexport function serializeShapeControlDefinition(\n definition: ShapeControlDefinition,\n): [Serialize<ShapeControlDefinition>, Transferable[]] {\n const [type, transferables] = Object.entries(definition.config.type).reduce(\n ([type, transferables], [key, value]) => {\n const [serializedType, serializedTransferables] = serializeControl(value)\n\n type[key] = serializedType\n transferables.push(...serializedTransferables)\n\n return [type, transferables]\n },\n [{} as Record<string, SerializedControl>, [] as Transferable[]],\n )\n\n return [{ ...definition, config: { ...definition.config, type } }, transferables] as [\n Serialize<ShapeControlDefinition>,\n Transferable[],\n ]\n}\n\nexport function deserializeShapeControlDefinition(\n definition: Serialize<ShapeControlDefinition>,\n): Deserialize<Serialize<ShapeControlDefinition>> {\n const type = Object.entries(definition.config.type).reduce((type, [key, value]) => {\n const serializedType = deserializeControl(value)\n\n type[key] = serializedType\n\n return type\n }, {} as Record<string, DeserializedControl>)\n\n return {\n ...definition,\n config: { ...definition.config, type },\n } as Deserialize<Serialize<ShapeControlDefinition>>\n}\n"],"mappings":"AACA;AAAA,EACE;AAAA,EAEA;AAAA,OAEK;AAGA,SAAS,gCACd,YACqD;AACrD,QAAM,CAAC,MAAM,aAAa,IAAI,OAAO,QAAQ,WAAW,OAAO,IAAI,EAAE;AAAA,IACnE,CAAC,CAACA,OAAMC,cAAa,GAAG,CAAC,KAAK,KAAK,MAAM;AACvC,YAAM,CAAC,gBAAgB,uBAAuB,IAAI,iBAAiB,KAAK;AAExE,MAAAD,MAAK,GAAG,IAAI;AACZ,MAAAC,eAAc,KAAK,GAAG,uBAAuB;AAE7C,aAAO,CAACD,OAAMC,cAAa;AAAA,IAC7B;AAAA,IACA,CAAC,CAAC,GAAwC,CAAC,CAAmB;AAAA,EAChE;AAEA,SAAO,CAAC,EAAE,GAAG,YAAY,QAAQ,EAAE,GAAG,WAAW,QAAQ,KAAK,EAAE,GAAG,aAAa;AAIlF;AAEO,SAAS,kCACd,YACgD;AAChD,QAAM,OAAO,OAAO,QAAQ,WAAW,OAAO,IAAI,EAAE,OAAO,CAACD,OAAM,CAAC,KAAK,KAAK,MAAM;AACjF,UAAM,iBAAiB,mBAAmB,KAAK;AAE/C,IAAAA,MAAK,GAAG,IAAI;AAEZ,WAAOA;AAAA,EACT,GAAG,CAAC,CAAwC;AAE5C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,EAAE,GAAG,WAAW,QAAQ,KAAK;AAAA,EACvC;AACF;","names":["type","transferables"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { deserializeControl, serializeControl } from "../control-serialization";
|
|
2
|
+
import { deserializeFunction, serializeFunction } from "../function-serialization";
|
|
3
|
+
function serializeStyleV2Control(definition) {
|
|
4
|
+
const [type, transferables] = serializeControl(definition.config.type);
|
|
5
|
+
const getStyle = definition.config.getStyle && serializeFunction(definition.config.getStyle);
|
|
6
|
+
if (getStyle) {
|
|
7
|
+
transferables.push(getStyle);
|
|
8
|
+
}
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
...definition,
|
|
12
|
+
config: {
|
|
13
|
+
...definition.config,
|
|
14
|
+
type,
|
|
15
|
+
getStyle
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
transferables
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
function deserializeStyleV2Control(definition) {
|
|
22
|
+
const type = deserializeControl(definition.config.type);
|
|
23
|
+
const getStyle = definition.config.getStyle && deserializeFunction(definition.config.getStyle);
|
|
24
|
+
return {
|
|
25
|
+
...definition,
|
|
26
|
+
config: {
|
|
27
|
+
...definition.config,
|
|
28
|
+
getStyle,
|
|
29
|
+
type
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
deserializeStyleV2Control,
|
|
35
|
+
serializeStyleV2Control
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=style-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/builder/serialization/controls/style-v2.ts"],"sourcesContent":["import { StyleV2ControlDefinition } from '../../../controls'\nimport { deserializeControl, serializeControl } from '../control-serialization'\nimport { deserializeFunction, serializeFunction } from '../function-serialization'\nimport { Serialize, Deserialize } from './types'\n\nexport function serializeStyleV2Control(\n definition: StyleV2ControlDefinition,\n): [Serialize<StyleV2ControlDefinition>, Transferable[]] {\n const [type, transferables] = serializeControl(definition.config.type)\n const getStyle = definition.config.getStyle && serializeFunction(definition.config.getStyle)\n\n if (getStyle) {\n transferables.push(getStyle)\n }\n\n return [\n {\n ...definition,\n config: {\n ...definition.config,\n type,\n getStyle,\n },\n },\n transferables,\n ] as [Serialize<StyleV2ControlDefinition>, Transferable[]]\n}\n\nexport function deserializeStyleV2Control(\n definition: Serialize<StyleV2ControlDefinition>,\n): Deserialize<Serialize<StyleV2ControlDefinition>> {\n const type = deserializeControl(definition.config.type)\n const getStyle = definition.config.getStyle && deserializeFunction(definition.config.getStyle)\n\n return {\n ...definition,\n config: {\n ...definition.config,\n getStyle,\n type,\n },\n } as Deserialize<Serialize<StyleV2ControlDefinition>>\n}\n"],"mappings":"AACA,SAAS,oBAAoB,wBAAwB;AACrD,SAAS,qBAAqB,yBAAyB;AAGhD,SAAS,wBACd,YACuD;AACvD,QAAM,CAAC,MAAM,aAAa,IAAI,iBAAiB,WAAW,OAAO,IAAI;AACrE,QAAM,WAAW,WAAW,OAAO,YAAY,kBAAkB,WAAW,OAAO,QAAQ;AAE3F,MAAI,UAAU;AACZ,kBAAc,KAAK,QAAQ;AAAA,EAC7B;AAEA,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,QAAQ;AAAA,QACN,GAAG,WAAW;AAAA,QACd;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,0BACd,YACkD;AAClD,QAAM,OAAO,mBAAmB,WAAW,OAAO,IAAI;AACtD,QAAM,WAAW,WAAW,OAAO,YAAY,oBAAoB,WAAW,OAAO,QAAQ;AAE7F,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ;AAAA,MACN,GAAG,WAAW;AAAA,MACd;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|