@makeswift/runtime 0.26.4 → 0.26.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/client.js +252 -0
- package/dist/cjs/api/client.js.map +1 -0
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/api-handler/handlers/webhook/diff-projection.js +62 -0
- package/dist/cjs/api-handler/handlers/webhook/diff-projection.js.map +1 -0
- package/dist/cjs/builder/serialization.js +78 -0
- package/dist/cjs/builder/serialization.js.map +1 -0
- package/dist/cjs/client/index.js +3 -3
- package/dist/cjs/controls/serialization/base/index.js +78 -0
- package/dist/cjs/controls/serialization/base/index.js.map +1 -0
- package/dist/cjs/controls/serialization/base/visitor.js +59 -0
- package/dist/cjs/controls/serialization/base/visitor.js.map +1 -0
- package/dist/cjs/controls/serialization/index.js +55 -0
- package/dist/cjs/controls/serialization/index.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/function-serialization.js +79 -0
- package/dist/cjs/controls/serialization/message-port/function-serialization.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/index.js +25 -0
- package/dist/cjs/controls/serialization/message-port/index.js.map +1 -0
- package/dist/cjs/controls/serialization/message-port/visitor.js +48 -0
- package/dist/cjs/controls/serialization/message-port/visitor.js.map +1 -0
- package/dist/cjs/next/api-handler/config/pages-router.js +1 -1
- package/dist/cjs/next/api-handler/config/pages-router.js.map +1 -1
- package/dist/cjs/next/fetch.js +30 -0
- package/dist/cjs/next/fetch.js.map +1 -0
- package/dist/cjs/next/runtime.js +35 -0
- package/dist/cjs/next/runtime.js.map +1 -0
- package/dist/cjs/next/testing/react-runtime.js +29 -0
- package/dist/cjs/next/testing/react-runtime.js.map +1 -0
- package/dist/cjs/prop-controllers/serialization.js +355 -0
- package/dist/cjs/prop-controllers/serialization.js.map +1 -0
- package/dist/cjs/runtimes/react/components/GoogleFontLink.js +55 -0
- package/dist/cjs/runtimes/react/components/GoogleFontLink.js.map +1 -0
- package/dist/cjs/runtimes/react/components/MakeswiftFonts.js +33 -0
- package/dist/cjs/runtimes/react/components/MakeswiftFonts.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-async-effect.js +55 -0
- package/dist/cjs/runtimes/react/hooks/use-async-effect.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js +39 -0
- package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-is-read-only.js +33 -0
- package/dist/cjs/runtimes/react/hooks/use-is-read-only.js.map +1 -0
- package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js +59 -0
- package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js.map +1 -0
- package/dist/cjs/runtimes/react/testing/react-runtime.js +33 -0
- package/dist/cjs/runtimes/react/testing/react-runtime.js.map +1 -0
- package/dist/cjs/runtimes/react/utils/google-fonts-url.js +49 -0
- package/dist/cjs/runtimes/react/utils/google-fonts-url.js.map +1 -0
- package/dist/cjs/state/actions/internal/index.js +34 -0
- package/dist/cjs/state/actions/internal/index.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-only-actions.js +195 -0
- package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js +76 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -0
- package/dist/cjs/state/builder-api/api.js +17 -0
- package/dist/cjs/state/builder-api/api.js.map +1 -0
- package/dist/cjs/state/builder-api/navigation-listener.js +110 -0
- package/dist/cjs/state/builder-api/navigation-listener.js.map +1 -0
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js +37 -0
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js.map +1 -0
- package/dist/cjs/state/middleware/read-only-element-tree.js +52 -0
- package/dist/cjs/state/middleware/read-only-element-tree.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/element-size.js +40 -0
- package/dist/cjs/state/middleware/read-write/builder-api/element-size.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js +85 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +281 -0
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/index.js +40 -0
- package/dist/cjs/state/middleware/read-write/index.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/measure-box-models.js +71 -0
- package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +114 -0
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/update-element-tree.js +59 -0
- package/dist/cjs/state/middleware/read-write/update-element-tree.js.map +1 -0
- package/dist/cjs/state/mixins/breakpoint-watch.js +72 -0
- package/dist/cjs/state/mixins/breakpoint-watch.js.map +1 -0
- package/dist/cjs/state/modules/is-read-only.js +50 -0
- package/dist/cjs/state/modules/is-read-only.js.map +1 -0
- package/dist/cjs/state/modules/locale.js +50 -0
- package/dist/cjs/state/modules/locale.js.map +1 -0
- package/dist/cjs/state/modules/read-write/box-models.js +144 -0
- package/dist/cjs/state/modules/read-write/box-models.js.map +1 -0
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js +61 -0
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -0
- package/dist/cjs/state/modules/read-write/pointer.js +48 -0
- package/dist/cjs/state/modules/read-write/pointer.js.map +1 -0
- package/dist/cjs/state/modules/read-write/read-write-documents.js +98 -0
- package/dist/cjs/state/modules/read-write/read-write-documents.js.map +1 -0
- package/dist/cjs/state/modules/site-version.js +47 -0
- package/dist/cjs/state/modules/site-version.js.map +1 -0
- package/dist/cjs/state/ops/copy-element-tree.js +67 -0
- package/dist/cjs/state/ops/copy-element-tree.js.map +1 -0
- package/dist/cjs/state/ops/merge-element.js +73 -0
- package/dist/cjs/state/ops/merge-element.js.map +1 -0
- package/dist/cjs/state/read-only-state.js +231 -0
- package/dist/cjs/state/read-only-state.js.map +1 -0
- package/dist/cjs/state/read-write-state.js +128 -0
- package/dist/cjs/state/read-write-state.js.map +1 -0
- package/dist/cjs/state/store.js +219 -0
- package/dist/cjs/state/store.js.map +1 -0
- package/dist/cjs/state/unified-state.js +17 -0
- package/dist/cjs/state/unified-state.js.map +1 -0
- package/dist/cjs/translations/index.js +32 -0
- package/dist/cjs/translations/index.js.map +1 -0
- package/dist/cjs/utils/deferred.js +39 -0
- package/dist/cjs/utils/deferred.js.map +1 -0
- package/dist/cjs/utils/ref-counted-map.js +120 -0
- package/dist/cjs/utils/ref-counted-map.js.map +1 -0
- package/dist/esm/api/client.js +219 -0
- package/dist/esm/api/client.js.map +1 -0
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/api-handler/handlers/webhook/diff-projection.js +38 -0
- package/dist/esm/api-handler/handlers/webhook/diff-projection.js.map +1 -0
- package/dist/esm/builder/serialization.js +59 -0
- package/dist/esm/builder/serialization.js.map +1 -0
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/controls/serialization/base/index.js +78 -0
- package/dist/esm/controls/serialization/base/index.js.map +1 -0
- package/dist/esm/controls/serialization/base/visitor.js +39 -0
- package/dist/esm/controls/serialization/base/visitor.js.map +1 -0
- package/dist/esm/controls/serialization/index.js +30 -0
- package/dist/esm/controls/serialization/index.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/function-serialization.js +52 -0
- package/dist/esm/controls/serialization/message-port/function-serialization.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/index.js +3 -0
- package/dist/esm/controls/serialization/message-port/index.js.map +1 -0
- package/dist/esm/controls/serialization/message-port/visitor.js +24 -0
- package/dist/esm/controls/serialization/message-port/visitor.js.map +1 -0
- package/dist/esm/next/api-handler/config/pages-router.js +1 -1
- package/dist/esm/next/api-handler/config/pages-router.js.map +1 -1
- package/dist/esm/next/fetch.js +6 -0
- package/dist/esm/next/fetch.js.map +1 -0
- package/dist/esm/next/runtime.js +11 -0
- package/dist/esm/next/runtime.js.map +1 -0
- package/dist/esm/next/testing/react-runtime.js +5 -0
- package/dist/esm/next/testing/react-runtime.js.map +1 -0
- package/dist/esm/prop-controllers/serialization.js +338 -0
- package/dist/esm/prop-controllers/serialization.js.map +1 -0
- package/dist/esm/runtimes/react/components/GoogleFontLink.js +35 -0
- package/dist/esm/runtimes/react/components/GoogleFontLink.js.map +1 -0
- package/dist/esm/runtimes/react/components/MakeswiftFonts.js +9 -0
- package/dist/esm/runtimes/react/components/MakeswiftFonts.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-async-effect.js +31 -0
- package/dist/esm/runtimes/react/hooks/use-async-effect.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js +15 -0
- package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-is-read-only.js +9 -0
- package/dist/esm/runtimes/react/hooks/use-is-read-only.js.map +1 -0
- package/dist/esm/runtimes/react/lib/resolved-style-to-css.js +38 -0
- package/dist/esm/runtimes/react/lib/resolved-style-to-css.js.map +1 -0
- package/dist/esm/runtimes/react/testing/react-runtime.js +9 -0
- package/dist/esm/runtimes/react/testing/react-runtime.js.map +1 -0
- package/dist/esm/runtimes/react/utils/google-fonts-url.js +23 -0
- package/dist/esm/runtimes/react/utils/google-fonts-url.js.map +1 -0
- package/dist/esm/state/actions/internal/index.js +10 -0
- package/dist/esm/state/actions/internal/index.js.map +1 -0
- package/dist/esm/state/actions/internal/read-only-actions.js +153 -0
- package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -0
- package/dist/esm/state/actions/internal/read-write-actions.js +46 -0
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -0
- package/dist/esm/state/builder-api/api.js +1 -0
- package/dist/esm/state/builder-api/api.js.map +1 -0
- package/dist/esm/state/builder-api/navigation-listener.js +86 -0
- package/dist/esm/state/builder-api/navigation-listener.js.map +1 -0
- package/dist/esm/state/middleware/makeswift-api-client-sync.js +13 -0
- package/dist/esm/state/middleware/makeswift-api-client-sync.js.map +1 -0
- package/dist/esm/state/middleware/read-only-element-tree.js +28 -0
- package/dist/esm/state/middleware/read-only-element-tree.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/element-size.js +16 -0
- package/dist/esm/state/middleware/read-write/builder-api/element-size.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js +61 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +254 -0
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -0
- package/dist/esm/state/middleware/read-write/index.js +16 -0
- package/dist/esm/state/middleware/read-write/index.js.map +1 -0
- package/dist/esm/state/middleware/read-write/measure-box-models.js +37 -0
- package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -0
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js +80 -0
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -0
- package/dist/esm/state/middleware/read-write/update-element-tree.js +35 -0
- package/dist/esm/state/middleware/read-write/update-element-tree.js.map +1 -0
- package/dist/esm/state/mixins/breakpoint-watch.js +48 -0
- package/dist/esm/state/mixins/breakpoint-watch.js.map +1 -0
- package/dist/esm/state/modules/is-read-only.js +24 -0
- package/dist/esm/state/modules/is-read-only.js.map +1 -0
- package/dist/esm/state/modules/locale.js +24 -0
- package/dist/esm/state/modules/locale.js.map +1 -0
- package/dist/esm/state/modules/read-write/box-models.js +114 -0
- package/dist/esm/state/modules/read-write/box-models.js.map +1 -0
- package/dist/esm/state/modules/read-write/element-imperative-handles.js +36 -0
- package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -0
- package/dist/esm/state/modules/read-write/pointer.js +23 -0
- package/dist/esm/state/modules/read-write/pointer.js.map +1 -0
- package/dist/esm/state/modules/read-write/read-write-documents.js +60 -0
- package/dist/esm/state/modules/read-write/read-write-documents.js.map +1 -0
- package/dist/esm/state/modules/site-version.js +21 -0
- package/dist/esm/state/modules/site-version.js.map +1 -0
- package/dist/esm/state/ops/copy-element-tree.js +37 -0
- package/dist/esm/state/ops/copy-element-tree.js.map +1 -0
- package/dist/esm/state/ops/merge-element.js +39 -0
- package/dist/esm/state/ops/merge-element.js.map +1 -0
- package/dist/esm/state/read-only-state.js +176 -0
- package/dist/esm/state/read-only-state.js.map +1 -0
- package/dist/esm/state/read-write-state.js +82 -0
- package/dist/esm/state/read-write-state.js.map +1 -0
- package/dist/esm/state/store.js +188 -0
- package/dist/esm/state/store.js.map +1 -0
- package/dist/esm/state/unified-state.js +1 -0
- package/dist/esm/state/unified-state.js.map +1 -0
- package/dist/esm/translations/index.js +7 -0
- package/dist/esm/translations/index.js.map +1 -0
- package/dist/esm/utils/deferred.js +15 -0
- package/dist/esm/utils/deferred.js.map +1 -0
- package/dist/esm/utils/ref-counted-map.js +96 -0
- package/dist/esm/utils/ref-counted-map.js.map +1 -0
- package/dist/types/api/client.d.ts +81 -0
- package/dist/types/api/client.d.ts.map +1 -0
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +201 -0
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts.map +1 -0
- package/dist/types/builder/serialization.d.ts +23 -0
- package/dist/types/builder/serialization.d.ts.map +1 -0
- package/dist/types/builder/serialization.test.d.ts +2 -0
- package/dist/types/builder/serialization.test.d.ts.map +1 -0
- package/dist/types/client/tests/client.get-component-snapshots.test.d.ts +2 -0
- package/dist/types/client/tests/client.get-component-snapshots.test.d.ts.map +1 -0
- package/dist/types/client/tests/client.get-fonts.test.d.ts +2 -0
- package/dist/types/client/tests/client.get-fonts.test.d.ts.map +1 -0
- package/dist/types/client/tests/client.introspect-many.test.d.ts +2 -0
- package/dist/types/client/tests/client.introspect-many.test.d.ts.map +1 -0
- package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts +3 -0
- package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts.map +1 -0
- package/dist/types/controls/serialization/base/index.d.ts +10 -0
- package/dist/types/controls/serialization/base/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/base/visitor.d.ts +7 -0
- package/dist/types/controls/serialization/base/visitor.d.ts.map +1 -0
- package/dist/types/controls/serialization/index.d.ts +10 -0
- package/dist/types/controls/serialization/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts +16 -0
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts +2 -0
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/index.d.ts +3 -0
- package/dist/types/controls/serialization/message-port/index.d.ts.map +1 -0
- package/dist/types/controls/serialization/message-port/visitor.d.ts +7 -0
- package/dist/types/controls/serialization/message-port/visitor.d.ts.map +1 -0
- package/dist/types/next/api-handler/config/pages-router.test.d.ts +2 -0
- package/dist/types/next/api-handler/config/pages-router.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/controls/code-control.test.d.ts +2 -0
- package/dist/types/next/components/tests/controls/code-control.test.d.ts.map +1 -0
- package/dist/types/next/fetch.d.ts +3 -0
- package/dist/types/next/fetch.d.ts.map +1 -0
- package/dist/types/next/runtime.d.ts +10 -0
- package/dist/types/next/runtime.d.ts.map +1 -0
- package/dist/types/next/testing/react-runtime.d.ts +2 -0
- package/dist/types/next/testing/react-runtime.d.ts.map +1 -0
- package/dist/types/prop-controllers/serialization.d.ts +228 -0
- package/dist/types/prop-controllers/serialization.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/GoogleFontLink.d.ts +14 -0
- package/dist/types/runtimes/react/components/GoogleFontLink.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts +7 -0
- package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/__tests__/use-async-effect.test.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/__tests__/use-async-effect.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-async-effect.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-async-effect.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-is-read-only.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/use-is-read-only.d.ts.map +1 -0
- package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts +4 -0
- package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts.map +1 -0
- package/dist/types/runtimes/react/testing/react-runtime.d.ts +6 -0
- package/dist/types/runtimes/react/testing/react-runtime.d.ts.map +1 -0
- package/dist/types/runtimes/react/utils/google-fonts-url.d.ts +6 -0
- package/dist/types/runtimes/react/utils/google-fonts-url.d.ts.map +1 -0
- package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts +5 -0
- package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts.map +1 -0
- package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts +3 -0
- package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts.map +1 -0
- package/dist/types/state/__tests__/get-translatable-content.test.d.ts +2 -0
- package/dist/types/state/__tests__/get-translatable-content.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/merge-element.test.d.ts +2 -0
- package/dist/types/state/__tests__/merge-element.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/store.read-write-state.test.d.ts +2 -0
- package/dist/types/state/__tests__/store.read-write-state.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/test-store.d.ts +31 -0
- package/dist/types/state/__tests__/test-store.d.ts.map +1 -0
- package/dist/types/state/actions/internal/index.d.ts +29 -0
- package/dist/types/state/actions/internal/index.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-only-actions.d.ts +171 -0
- package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-write-actions.d.ts +53 -0
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -0
- package/dist/types/state/builder-api/api.d.ts +9 -0
- package/dist/types/state/builder-api/api.d.ts.map +1 -0
- package/dist/types/state/builder-api/navigation-listener.d.ts +3 -0
- package/dist/types/state/builder-api/navigation-listener.d.ts.map +1 -0
- package/dist/types/state/middleware/makeswift-api-client-sync.d.ts +5 -0
- package/dist/types/state/middleware/makeswift-api-client-sync.d.ts.map +1 -0
- package/dist/types/state/middleware/read-only-element-tree.d.ts +4 -0
- package/dist/types/state/middleware/read-only-element-tree.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/element-size.d.ts +12 -0
- package/dist/types/state/middleware/read-write/builder-api/element-size.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/index.d.ts +5 -0
- package/dist/types/state/middleware/read-write/builder-api/index.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts +6 -0
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/index.d.ts +5 -0
- package/dist/types/state/middleware/read-write/index.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/measure-box-models.d.ts +4 -0
- package/dist/types/state/middleware/read-write/measure-box-models.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts +4 -0
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/update-element-tree.d.ts +4 -0
- package/dist/types/state/middleware/read-write/update-element-tree.d.ts.map +1 -0
- package/dist/types/state/mixins/breakpoint-watch.d.ts +11 -0
- package/dist/types/state/mixins/breakpoint-watch.d.ts.map +1 -0
- package/dist/types/state/modules/is-read-only.d.ts +6 -0
- package/dist/types/state/modules/is-read-only.d.ts.map +1 -0
- package/dist/types/state/modules/locale.d.ts +6 -0
- package/dist/types/state/modules/locale.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/box-models.d.ts +26 -0
- package/dist/types/state/modules/read-write/box-models.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/element-imperative-handles.d.ts +6 -0
- package/dist/types/state/modules/read-write/element-imperative-handles.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/pointer.d.ts +11 -0
- package/dist/types/state/modules/read-write/pointer.d.ts.map +1 -0
- package/dist/types/state/modules/read-write/read-write-documents.d.ts +14 -0
- package/dist/types/state/modules/read-write/read-write-documents.d.ts.map +1 -0
- package/dist/types/state/modules/site-version.d.ts +7 -0
- package/dist/types/state/modules/site-version.d.ts.map +1 -0
- package/dist/types/state/ops/copy-element-tree.d.ts +37 -0
- package/dist/types/state/ops/copy-element-tree.d.ts.map +1 -0
- package/dist/types/state/ops/merge-element.d.ts +4 -0
- package/dist/types/state/ops/merge-element.d.ts.map +1 -0
- package/dist/types/state/read-only-state.d.ts +131 -0
- package/dist/types/state/read-only-state.d.ts.map +1 -0
- package/dist/types/state/read-write-state.d.ts +62 -0
- package/dist/types/state/read-write-state.d.ts.map +1 -0
- package/dist/types/state/store.d.ts +86 -0
- package/dist/types/state/store.d.ts.map +1 -0
- package/dist/types/state/unified-state.d.ts +9 -0
- package/dist/types/state/unified-state.d.ts.map +1 -0
- package/dist/types/translations/index.d.ts +6 -0
- package/dist/types/translations/index.d.ts.map +1 -0
- package/dist/types/utils/__tests__/ref-counted-map.test.d.ts +2 -0
- package/dist/types/utils/__tests__/ref-counted-map.test.d.ts.map +1 -0
- package/dist/types/utils/deferred.d.ts +7 -0
- package/dist/types/utils/deferred.d.ts.map +1 -0
- package/dist/types/utils/ref-counted-map.d.ts +32 -0
- package/dist/types/utils/ref-counted-map.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,252 @@
|
|
|
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 client_exports = {};
|
|
30
|
+
__export(client_exports, {
|
|
31
|
+
CacheData: () => CacheData,
|
|
32
|
+
MakeswiftHostApiClient: () => MakeswiftHostApiClient
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(client_exports);
|
|
35
|
+
var MakeswiftApiClient = __toESM(require("../state/makeswift-api-client"));
|
|
36
|
+
var import_types = require("./types");
|
|
37
|
+
var import_client = require("./graphql/client");
|
|
38
|
+
var import_documents = require("./graphql/documents");
|
|
39
|
+
const CacheData = {
|
|
40
|
+
empty() {
|
|
41
|
+
return {
|
|
42
|
+
apiResources: {},
|
|
43
|
+
localizedResourcesMap: {}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
class MakeswiftHostApiClient {
|
|
48
|
+
graphqlClient;
|
|
49
|
+
makeswiftApiClient;
|
|
50
|
+
subscribe;
|
|
51
|
+
fetch;
|
|
52
|
+
constructor({
|
|
53
|
+
uri,
|
|
54
|
+
fetch,
|
|
55
|
+
preloadedState
|
|
56
|
+
}) {
|
|
57
|
+
this.graphqlClient = new import_client.GraphQLClient(uri);
|
|
58
|
+
this.makeswiftApiClient = MakeswiftApiClient.configureStore({ preloadedState });
|
|
59
|
+
this.fetch = fetch;
|
|
60
|
+
this.subscribe = this.makeswiftApiClient.subscribe;
|
|
61
|
+
}
|
|
62
|
+
readSwatch(swatchId) {
|
|
63
|
+
return MakeswiftApiClient.getAPIResource(
|
|
64
|
+
this.makeswiftApiClient.getState(),
|
|
65
|
+
import_types.APIResourceType.Swatch,
|
|
66
|
+
swatchId
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
async fetchSwatch(swatchId) {
|
|
70
|
+
return await this.makeswiftApiClient.dispatch(
|
|
71
|
+
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.Swatch, swatchId, this.fetch)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
resolveSwatch(swatchId) {
|
|
75
|
+
return this.resolveResource(import_types.APIResourceType.Swatch, {
|
|
76
|
+
id: swatchId,
|
|
77
|
+
read: (id) => this.readSwatch(id),
|
|
78
|
+
fetch: (id) => this.fetchSwatch(id)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
readFile(fileId) {
|
|
82
|
+
return MakeswiftApiClient.getAPIResource(
|
|
83
|
+
this.makeswiftApiClient.getState(),
|
|
84
|
+
import_types.APIResourceType.File,
|
|
85
|
+
fileId
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
async fetchFile(fileId) {
|
|
89
|
+
return await this.makeswiftApiClient.dispatch(
|
|
90
|
+
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.File, fileId, this.fetch)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
resolveFile(fileId) {
|
|
94
|
+
return this.resolveResource(import_types.APIResourceType.File, {
|
|
95
|
+
id: fileId,
|
|
96
|
+
read: (id) => this.readFile(id),
|
|
97
|
+
fetch: (id) => this.fetchFile(id)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
readTypography(typographyId) {
|
|
101
|
+
return MakeswiftApiClient.getAPIResource(
|
|
102
|
+
this.makeswiftApiClient.getState(),
|
|
103
|
+
import_types.APIResourceType.Typography,
|
|
104
|
+
typographyId
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
async fetchTypography(typographyId) {
|
|
108
|
+
return await this.makeswiftApiClient.dispatch(
|
|
109
|
+
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.Typography, typographyId, this.fetch)
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
resolveTypography(typographyId) {
|
|
113
|
+
return this.resolveResource(import_types.APIResourceType.Typography, {
|
|
114
|
+
id: typographyId,
|
|
115
|
+
read: (id) => this.readTypography(id),
|
|
116
|
+
fetch: (id) => this.fetchTypography(id)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
readGlobalElement(globalElementId) {
|
|
120
|
+
return MakeswiftApiClient.getAPIResource(
|
|
121
|
+
this.makeswiftApiClient.getState(),
|
|
122
|
+
import_types.APIResourceType.GlobalElement,
|
|
123
|
+
globalElementId
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
async fetchGlobalElement(globalElementId) {
|
|
127
|
+
return await this.makeswiftApiClient.dispatch(
|
|
128
|
+
MakeswiftApiClient.fetchAPIResource(
|
|
129
|
+
import_types.APIResourceType.GlobalElement,
|
|
130
|
+
globalElementId,
|
|
131
|
+
this.fetch
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
readLocalizedGlobalElement({
|
|
136
|
+
globalElementId,
|
|
137
|
+
locale
|
|
138
|
+
}) {
|
|
139
|
+
return MakeswiftApiClient.getAPIResource(
|
|
140
|
+
this.makeswiftApiClient.getState(),
|
|
141
|
+
import_types.APIResourceType.LocalizedGlobalElement,
|
|
142
|
+
globalElementId,
|
|
143
|
+
locale
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
async fetchLocalizedGlobalElement({
|
|
147
|
+
globalElementId,
|
|
148
|
+
locale
|
|
149
|
+
}) {
|
|
150
|
+
return await this.makeswiftApiClient.dispatch(
|
|
151
|
+
MakeswiftApiClient.fetchAPIResource(
|
|
152
|
+
import_types.APIResourceType.LocalizedGlobalElement,
|
|
153
|
+
globalElementId,
|
|
154
|
+
this.fetch,
|
|
155
|
+
locale
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
readPagePathnameSlice({
|
|
160
|
+
pageId,
|
|
161
|
+
locale
|
|
162
|
+
}) {
|
|
163
|
+
return MakeswiftApiClient.getAPIResource(
|
|
164
|
+
this.makeswiftApiClient.getState(),
|
|
165
|
+
import_types.APIResourceType.PagePathnameSlice,
|
|
166
|
+
pageId,
|
|
167
|
+
locale
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
async fetchPagePathnameSlice({
|
|
171
|
+
pageId,
|
|
172
|
+
locale
|
|
173
|
+
}) {
|
|
174
|
+
return await this.makeswiftApiClient.dispatch(
|
|
175
|
+
MakeswiftApiClient.fetchAPIResource(
|
|
176
|
+
import_types.APIResourceType.PagePathnameSlice,
|
|
177
|
+
pageId,
|
|
178
|
+
this.fetch,
|
|
179
|
+
locale
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
resolvePagePathnameSlice({
|
|
184
|
+
pageId,
|
|
185
|
+
locale
|
|
186
|
+
}) {
|
|
187
|
+
return this.resolveResource(import_types.APIResourceType.PagePathnameSlice, {
|
|
188
|
+
id: pageId,
|
|
189
|
+
read: (id) => this.readPagePathnameSlice({ pageId: id, locale }),
|
|
190
|
+
fetch: (id) => this.fetchPagePathnameSlice({ pageId: id, locale })
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
resolveResource(type, {
|
|
194
|
+
id,
|
|
195
|
+
read,
|
|
196
|
+
fetch
|
|
197
|
+
}) {
|
|
198
|
+
const _read = () => id != null ? read(id) : null;
|
|
199
|
+
let lastValue = null;
|
|
200
|
+
return {
|
|
201
|
+
name: `${type}:${id}`,
|
|
202
|
+
readStable: () => lastValue = _read(),
|
|
203
|
+
subscribe: (onUpdate) => this.subscribe(() => {
|
|
204
|
+
if (_read() !== lastValue)
|
|
205
|
+
onUpdate();
|
|
206
|
+
}),
|
|
207
|
+
fetch: async () => id != null ? fetch(id) : null
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
readTable(tableId) {
|
|
211
|
+
return MakeswiftApiClient.getAPIResource(
|
|
212
|
+
this.makeswiftApiClient.getState(),
|
|
213
|
+
import_types.APIResourceType.Table,
|
|
214
|
+
tableId
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
async fetchTable(tableId) {
|
|
218
|
+
return await this.makeswiftApiClient.dispatch(
|
|
219
|
+
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.Table, tableId, this.fetch)
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
async createTableRecord(tableId, columns) {
|
|
223
|
+
await this.graphqlClient.request(import_documents.CreateTableRecordMutation, { input: { data: { tableId, columns } } });
|
|
224
|
+
}
|
|
225
|
+
readSite(siteId) {
|
|
226
|
+
return MakeswiftApiClient.getAPIResource(
|
|
227
|
+
this.makeswiftApiClient.getState(),
|
|
228
|
+
import_types.APIResourceType.Site,
|
|
229
|
+
siteId
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
readPage(pageId) {
|
|
233
|
+
return MakeswiftApiClient.getAPIResource(
|
|
234
|
+
this.makeswiftApiClient.getState(),
|
|
235
|
+
import_types.APIResourceType.Page,
|
|
236
|
+
pageId
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
readSnippet(snippetId) {
|
|
240
|
+
return MakeswiftApiClient.getAPIResource(
|
|
241
|
+
this.makeswiftApiClient.getState(),
|
|
242
|
+
import_types.APIResourceType.Snippet,
|
|
243
|
+
snippetId
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
248
|
+
0 && (module.exports = {
|
|
249
|
+
CacheData,
|
|
250
|
+
MakeswiftHostApiClient
|
|
251
|
+
});
|
|
252
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/api/client.ts"],"sourcesContent":["import { type FetchableValue } from '@makeswift/controls'\n\nimport * as MakeswiftApiClient from '../state/makeswift-api-client'\n\nimport {\n APIResourceType,\n File,\n GlobalElement,\n LocalizedGlobalElement,\n Page,\n PagePathnameSlice,\n Site,\n Snippet,\n Swatch,\n Table,\n Typography,\n} from './types'\nimport { GraphQLClient } from './graphql/client'\nimport { CreateTableRecordMutation } from './graphql/documents'\nimport {\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables,\n} from './graphql/generated/types'\n\nexport type CacheData = MakeswiftApiClient.SerializedState\n\nexport const CacheData = {\n empty(): CacheData {\n return {\n apiResources: {},\n localizedResourcesMap: {},\n }\n },\n}\n\n/**\n * NOTE(miguel): This \"client\" is used to fetch Makeswift API resources needed for the host. For\n * example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only\n * used by controls to transform API references to API resources.\n *\n * Moreover, its use should be reserved for the builder only, since for live pages all Makeswift\n * API resources should be embedded in the \"page snapshot\". In the builder, this client serves the\n * purpose of sending requests for API resources and keeping a cache so that changes that happen in\n * the builder, like modifying a swatch, can be sent via `postMessage` to the host and the cache can\n * immediately update the value and re-render.\n *\n * Furthermore, the API resources requested shouldn't be requested directly from the Makeswift API\n * as that would require those resources to not be authenticated since the requests come from the\n * browser when running the host. Instead, the requests should go to the host directly, at the\n * Makeswift API endpoint (i.g., `/api/makeswift/[...makeswift]` dynamic route) where the host's\n * API key can be used, securely, in the server. For this reason, this client should really be a\n * client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime\n * snapshot for use in the builder, not the lives pages.\n */\nexport class MakeswiftHostApiClient {\n graphqlClient: GraphQLClient\n makeswiftApiClient: MakeswiftApiClient.Store\n subscribe: MakeswiftApiClient.Store['subscribe']\n fetch: MakeswiftApiClient.HttpFetch\n\n constructor({\n uri,\n fetch,\n preloadedState,\n }: {\n uri: string\n fetch: MakeswiftApiClient.HttpFetch\n preloadedState: Partial<MakeswiftApiClient.State>\n }) {\n this.graphqlClient = new GraphQLClient(uri)\n this.makeswiftApiClient = MakeswiftApiClient.configureStore({ preloadedState })\n this.fetch = fetch\n this.subscribe = this.makeswiftApiClient.subscribe\n }\n\n readSwatch(swatchId: string): Swatch | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Swatch,\n swatchId,\n )\n }\n\n async fetchSwatch(swatchId: string): Promise<Swatch | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Swatch, swatchId, this.fetch),\n )\n }\n\n resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null> {\n return this.resolveResource(APIResourceType.Swatch, {\n id: swatchId,\n read: id => this.readSwatch(id),\n fetch: id => this.fetchSwatch(id),\n })\n }\n\n readFile(fileId: string): File | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.File,\n fileId,\n )\n }\n\n async fetchFile(fileId: string): Promise<File | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.File, fileId, this.fetch),\n )\n }\n\n resolveFile(fileId: string | undefined): FetchableValue<File | null> {\n return this.resolveResource(APIResourceType.File, {\n id: fileId,\n read: id => this.readFile(id),\n fetch: id => this.fetchFile(id),\n })\n }\n\n readTypography(typographyId: string): Typography | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Typography,\n typographyId,\n )\n }\n\n async fetchTypography(typographyId: string): Promise<Typography | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Typography, typographyId, this.fetch),\n )\n }\n\n resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null> {\n return this.resolveResource(APIResourceType.Typography, {\n id: typographyId,\n read: id => this.readTypography(id),\n fetch: id => this.fetchTypography(id),\n })\n }\n\n readGlobalElement(globalElementId: string): GlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.GlobalElement,\n globalElementId,\n )\n }\n\n async fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.GlobalElement,\n globalElementId,\n this.fetch,\n ),\n )\n }\n\n readLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): LocalizedGlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n locale,\n )\n }\n\n async fetchLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): Promise<LocalizedGlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n this.fetch,\n locale,\n ),\n )\n }\n\n readPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): PagePathnameSlice | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.PagePathnameSlice,\n pageId,\n locale,\n )\n }\n\n async fetchPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): Promise<PagePathnameSlice | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.PagePathnameSlice,\n pageId,\n this.fetch,\n locale,\n ),\n )\n }\n\n resolvePagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string | undefined\n locale: string | null\n }): FetchableValue<PagePathnameSlice | null> {\n return this.resolveResource(APIResourceType.PagePathnameSlice, {\n id: pageId,\n read: id => this.readPagePathnameSlice({ pageId: id, locale }),\n fetch: id => this.fetchPagePathnameSlice({ pageId: id, locale }),\n })\n }\n\n resolveResource<R>(\n type: APIResourceType,\n {\n id,\n read,\n fetch,\n }: {\n id: string | undefined\n read: (id: string) => R | null\n fetch: (id: string) => Promise<R | null>\n },\n ): FetchableValue<R | null> {\n const _read = () => (id != null ? read(id) : null)\n let lastValue: R | null = null\n return {\n name: `${type}:${id}`,\n readStable: () => (lastValue = _read()),\n subscribe: (onUpdate: () => void) =>\n this.subscribe(() => {\n if (_read() !== lastValue) onUpdate()\n }),\n fetch: async () => (id != null ? fetch(id) : null),\n }\n }\n\n readTable(tableId: string): Table | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Table,\n tableId,\n )\n }\n\n async fetchTable(tableId: string): Promise<Table | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Table, tableId, this.fetch),\n )\n }\n\n async createTableRecord(tableId: string, columns: any): Promise<void> {\n await this.graphqlClient.request<\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables\n >(CreateTableRecordMutation, { input: { data: { tableId, columns } } })\n }\n\n readSite(siteId: string): Site | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Site,\n siteId,\n )\n }\n\n readPage(pageId: string): Page | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Page,\n pageId,\n )\n }\n\n readSnippet(snippetId: string): Snippet | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Snippet,\n snippetId,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAoC;AAEpC,mBAYO;AACP,oBAA8B;AAC9B,uBAA0C;AAQnC,MAAM,YAAY;AAAA,EACvB,QAAmB;AACjB,WAAO;AAAA,MACL,cAAc,CAAC;AAAA,MACf,uBAAuB,CAAC;AAAA,IAC1B;AAAA,EACF;AACF;AAqBO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAIG;AACD,SAAK,gBAAgB,IAAI,4BAAc,GAAG;AAC1C,SAAK,qBAAqB,mBAAmB,eAAe,EAAE,eAAe,CAAC;AAC9E,SAAK,QAAQ;AACb,SAAK,YAAY,KAAK,mBAAmB;AAAA,EAC3C;AAAA,EAEA,WAAW,UAAiC;AAC1C,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,YAAY,UAA0C;AAC1D,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,6BAAgB,QAAQ,UAAU,KAAK,KAAK;AAAA,IAClF;AAAA,EACF;AAAA,EAEA,cAAc,UAA6D;AACzE,WAAO,KAAK,gBAAgB,6BAAgB,QAAQ;AAAA,MAClD,IAAI;AAAA,MACJ,MAAM,QAAM,KAAK,WAAW,EAAE;AAAA,MAC9B,OAAO,QAAM,KAAK,YAAY,EAAE;AAAA,IAClC,CAAC;AAAA,EACH;AAAA,EAEA,SAAS,QAA6B;AACpC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,UAAU,QAAsC;AACpD,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,6BAAgB,MAAM,QAAQ,KAAK,KAAK;AAAA,IAC9E;AAAA,EACF;AAAA,EAEA,YAAY,QAAyD;AACnE,WAAO,KAAK,gBAAgB,6BAAgB,MAAM;AAAA,MAChD,IAAI;AAAA,MACJ,MAAM,QAAM,KAAK,SAAS,EAAE;AAAA,MAC5B,OAAO,QAAM,KAAK,UAAU,EAAE;AAAA,IAChC,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,cAAyC;AACtD,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,gBAAgB,cAAkD;AACtE,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,6BAAgB,YAAY,cAAc,KAAK,KAAK;AAAA,IAC1F;AAAA,EACF;AAAA,EAEA,kBAAkB,cAAqE;AACrF,WAAO,KAAK,gBAAgB,6BAAgB,YAAY;AAAA,MACtD,IAAI;AAAA,MACJ,MAAM,QAAM,KAAK,eAAe,EAAE;AAAA,MAClC,OAAO,QAAM,KAAK,gBAAgB,EAAE;AAAA,IACtC,CAAC;AAAA,EACH;AAAA,EAEA,kBAAkB,iBAA+C;AAC/D,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,mBAAmB,iBAAwD;AAC/E,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB;AAAA,QACjB,6BAAgB;AAAA,QAChB;AAAA,QACA,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAAA,EAEA,2BAA2B;AAAA,IACzB;AAAA,IACA;AAAA,EACF,GAGkC;AAChC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,4BAA4B;AAAA,IAChC;AAAA,IACA;AAAA,EACF,GAG2C;AACzC,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB;AAAA,QACjB,6BAAgB;AAAA,QAChB;AAAA,QACA,KAAK;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,sBAAsB;AAAA,IACpB;AAAA,IACA;AAAA,EACF,GAG6B;AAC3B,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,uBAAuB;AAAA,IAC3B;AAAA,IACA;AAAA,EACF,GAGsC;AACpC,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB;AAAA,QACjB,6BAAgB;AAAA,QAChB;AAAA,QACA,KAAK;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,yBAAyB;AAAA,IACvB;AAAA,IACA;AAAA,EACF,GAG6C;AAC3C,WAAO,KAAK,gBAAgB,6BAAgB,mBAAmB;AAAA,MAC7D,IAAI;AAAA,MACJ,MAAM,QAAM,KAAK,sBAAsB,EAAE,QAAQ,IAAI,OAAO,CAAC;AAAA,MAC7D,OAAO,QAAM,KAAK,uBAAuB,EAAE,QAAQ,IAAI,OAAO,CAAC;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,gBACE,MACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAK0B;AAC1B,UAAM,QAAQ,MAAO,MAAM,OAAO,KAAK,EAAE,IAAI;AAC7C,QAAI,YAAsB;AAC1B,WAAO;AAAA,MACL,MAAM,GAAG,IAAI,IAAI,EAAE;AAAA,MACnB,YAAY,MAAO,YAAY,MAAM;AAAA,MACrC,WAAW,CAAC,aACV,KAAK,UAAU,MAAM;AACnB,YAAI,MAAM,MAAM;AAAW,mBAAS;AAAA,MACtC,CAAC;AAAA,MACH,OAAO,YAAa,MAAM,OAAO,MAAM,EAAE,IAAI;AAAA,IAC/C;AAAA,EACF;AAAA,EAEA,UAAU,SAA+B;AACvC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,WAAW,SAAwC;AACvD,WAAO,MAAM,KAAK,mBAAmB;AAAA,MACnC,mBAAmB,iBAAiB,6BAAgB,OAAO,SAAS,KAAK,KAAK;AAAA,IAChF;AAAA,EACF;AAAA,EAEA,MAAM,kBAAkB,SAAiB,SAA6B;AACpE,UAAM,KAAK,cAAc,QAGvB,4CAA2B,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,QAAQ,EAAE,EAAE,CAAC;AAAA,EACxE;AAAA,EAEA,SAAS,QAA6B;AACpC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,SAAS,QAA6B;AACpC,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,YAAY,WAAmC;AAC7C,WAAO,mBAAmB;AAAA,MACxB,KAAK,mBAAmB,SAAS;AAAA,MACjC,6BAAgB;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -28,7 +28,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
|
|
|
28
28
|
return import_request_response.ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
|
|
29
29
|
}
|
|
30
30
|
return import_request_response.ApiResponse.json({
|
|
31
|
-
version: "0.26.
|
|
31
|
+
version: "0.26.5",
|
|
32
32
|
interactionMode: true,
|
|
33
33
|
clientSideNavigation: false,
|
|
34
34
|
elementFromPoint: false,
|
|
@@ -0,0 +1,62 @@
|
|
|
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 diff_projection_exports = {};
|
|
20
|
+
__export(diff_projection_exports, {
|
|
21
|
+
diffProjectionSchema: () => diffProjectionSchema
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(diff_projection_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const changeTypeSchema = import_zod.z.enum(["created", "updated", "deleted"]);
|
|
26
|
+
const componentChangeSchema = import_zod.z.object({
|
|
27
|
+
id: import_zod.z.string(),
|
|
28
|
+
locale: import_zod.z.string().nullable(),
|
|
29
|
+
changeType: changeTypeSchema
|
|
30
|
+
});
|
|
31
|
+
const pageChangeSchema = import_zod.z.object({
|
|
32
|
+
pageId: import_zod.z.string().uuid(),
|
|
33
|
+
locale: import_zod.z.string().nullable(),
|
|
34
|
+
changeType: changeTypeSchema,
|
|
35
|
+
pathname: import_zod.z.string(),
|
|
36
|
+
previousPathname: import_zod.z.string().optional()
|
|
37
|
+
});
|
|
38
|
+
const globalElementChangeSchema = import_zod.z.object({
|
|
39
|
+
id: import_zod.z.string().uuid(),
|
|
40
|
+
locale: import_zod.z.string().nullable(),
|
|
41
|
+
changeType: changeTypeSchema
|
|
42
|
+
});
|
|
43
|
+
const swatchChangeSchema = import_zod.z.object({
|
|
44
|
+
id: import_zod.z.string().uuid(),
|
|
45
|
+
changeType: changeTypeSchema
|
|
46
|
+
});
|
|
47
|
+
const typographyChangeSchema = import_zod.z.object({
|
|
48
|
+
id: import_zod.z.string().uuid(),
|
|
49
|
+
changeType: changeTypeSchema
|
|
50
|
+
});
|
|
51
|
+
const diffProjectionSchema = import_zod.z.object({
|
|
52
|
+
components: import_zod.z.array(componentChangeSchema),
|
|
53
|
+
pages: import_zod.z.array(pageChangeSchema),
|
|
54
|
+
globalElements: import_zod.z.array(globalElementChangeSchema),
|
|
55
|
+
swatches: import_zod.z.array(swatchChangeSchema),
|
|
56
|
+
typographies: import_zod.z.array(typographyChangeSchema)
|
|
57
|
+
}).passthrough();
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
diffProjectionSchema
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=diff-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/api-handler/handlers/webhook/diff-projection.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst changeTypeSchema = z.enum(['created', 'updated', 'deleted'])\n\n// `locale` is null for the default locale. We'd prefer explicit locale strings\n// (e.g. \"en-US\"), but both server and runtime treat the default locale as null\n// today — changing that requires a broader localization rework.\nconst componentChangeSchema = z.object({\n id: z.string(),\n locale: z.string().nullable(),\n changeType: changeTypeSchema,\n})\n\nconst pageChangeSchema = z.object({\n pageId: z.string().uuid(),\n locale: z.string().nullable(),\n changeType: changeTypeSchema,\n pathname: z.string(),\n previousPathname: z.string().optional(),\n})\n\nconst globalElementChangeSchema = z.object({\n id: z.string().uuid(),\n locale: z.string().nullable(),\n changeType: changeTypeSchema,\n})\n\nconst swatchChangeSchema = z.object({\n id: z.string().uuid(),\n changeType: changeTypeSchema,\n})\n\nconst typographyChangeSchema = z.object({\n id: z.string().uuid(),\n changeType: changeTypeSchema,\n})\n\nexport const diffProjectionSchema = z\n .object({\n components: z.array(componentChangeSchema),\n pages: z.array(pageChangeSchema),\n globalElements: z.array(globalElementChangeSchema),\n swatches: z.array(swatchChangeSchema),\n typographies: z.array(typographyChangeSchema),\n })\n // passthrough() preserves unknown resource types the server may add in the\n // future (e.g. `fonts`), so onPublish consumers can access them without a\n // runtime upgrade.\n .passthrough()\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAElB,MAAM,mBAAmB,aAAE,KAAK,CAAC,WAAW,WAAW,SAAS,CAAC;AAKjE,MAAM,wBAAwB,aAAE,OAAO;AAAA,EACrC,IAAI,aAAE,OAAO;AAAA,EACb,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,YAAY;AACd,CAAC;AAED,MAAM,mBAAmB,aAAE,OAAO;AAAA,EAChC,QAAQ,aAAE,OAAO,EAAE,KAAK;AAAA,EACxB,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,YAAY;AAAA,EACZ,UAAU,aAAE,OAAO;AAAA,EACnB,kBAAkB,aAAE,OAAO,EAAE,SAAS;AACxC,CAAC;AAED,MAAM,4BAA4B,aAAE,OAAO;AAAA,EACzC,IAAI,aAAE,OAAO,EAAE,KAAK;AAAA,EACpB,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,YAAY;AACd,CAAC;AAED,MAAM,qBAAqB,aAAE,OAAO;AAAA,EAClC,IAAI,aAAE,OAAO,EAAE,KAAK;AAAA,EACpB,YAAY;AACd,CAAC;AAED,MAAM,yBAAyB,aAAE,OAAO;AAAA,EACtC,IAAI,aAAE,OAAO,EAAE,KAAK;AAAA,EACpB,YAAY;AACd,CAAC;AAEM,MAAM,uBAAuB,aACjC,OAAO;AAAA,EACN,YAAY,aAAE,MAAM,qBAAqB;AAAA,EACzC,OAAO,aAAE,MAAM,gBAAgB;AAAA,EAC/B,gBAAgB,aAAE,MAAM,yBAAyB;AAAA,EACjD,UAAU,aAAE,MAAM,kBAAkB;AAAA,EACpC,cAAc,aAAE,MAAM,sBAAsB;AAC9C,CAAC,EAIA,YAAY;","names":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var serialization_exports = {};
|
|
21
|
+
__export(serialization_exports, {
|
|
22
|
+
deserializeControl: () => deserializeControl,
|
|
23
|
+
deserializeControls: () => deserializeControls,
|
|
24
|
+
serializeControl: () => serializeControl,
|
|
25
|
+
serializeControls: () => serializeControls
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(serialization_exports);
|
|
28
|
+
var import_controls = require("@makeswift/controls");
|
|
29
|
+
var import_serialization = require("../prop-controllers/serialization");
|
|
30
|
+
var import_descriptors = require("../prop-controllers/descriptors");
|
|
31
|
+
var import_base = require("../controls/serialization/base");
|
|
32
|
+
var import_message_port = require("../controls/serialization/message-port");
|
|
33
|
+
var import_serialization2 = require("../controls/serialization");
|
|
34
|
+
__reExport(serialization_exports, require("../prop-controllers/serialization"), module.exports);
|
|
35
|
+
function serializeControl(control) {
|
|
36
|
+
if ((0, import_descriptors.isLegacyDescriptor)(control)) {
|
|
37
|
+
return (0, import_serialization.serializeLegacyControl)(control);
|
|
38
|
+
}
|
|
39
|
+
const messagePortVisitor = new import_message_port.ClientMessagePortSerializationVisitor();
|
|
40
|
+
const serializedControl = control.accept(messagePortVisitor);
|
|
41
|
+
return [serializedControl, messagePortVisitor.getTransferables()];
|
|
42
|
+
}
|
|
43
|
+
function isSerializedLegacyControl(control) {
|
|
44
|
+
return "options" in control;
|
|
45
|
+
}
|
|
46
|
+
function deserializeControl(serializedControl, options) {
|
|
47
|
+
if (isSerializedLegacyControl(serializedControl)) {
|
|
48
|
+
const record = options?.plugins ? (0, import_controls.deserializeObject)(serializedControl, options?.plugins) : serializedControl;
|
|
49
|
+
return (0, import_serialization.deserializeLegacyControl)(record);
|
|
50
|
+
}
|
|
51
|
+
const plugins = [import_message_port.functionDeserializationPlugin, ...options?.plugins ?? []];
|
|
52
|
+
return (0, import_base.deserializeControl)(serializedControl, { plugins });
|
|
53
|
+
}
|
|
54
|
+
function serializeControls(controls) {
|
|
55
|
+
return Object.entries(controls).reduce(
|
|
56
|
+
([accControls, accTransferables], [key, control]) => {
|
|
57
|
+
const [serializedControl, transferables] = serializeControl(control);
|
|
58
|
+
return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]];
|
|
59
|
+
},
|
|
60
|
+
[{}, []]
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function deserializeControls(serializedControls, { onError, plugins } = {}) {
|
|
64
|
+
return (0, import_serialization2.deserializeControlRecords)(
|
|
65
|
+
serializedControls,
|
|
66
|
+
(serializedControl, options) => deserializeControl(serializedControl, options),
|
|
67
|
+
{ onError, plugins }
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
deserializeControl,
|
|
73
|
+
deserializeControls,
|
|
74
|
+
serializeControl,
|
|
75
|
+
serializeControls,
|
|
76
|
+
...require("../prop-controllers/serialization")
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=serialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/builder/serialization.ts"],"sourcesContent":["import {\n type Data,\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n DeserializationPlugin,\n deserializeObject,\n} from '@makeswift/controls'\n\nimport {\n type SerializedLegacyControl,\n type DeserializedLegacyControl,\n serializeLegacyControl,\n deserializeLegacyControl,\n} from '../prop-controllers/serialization'\n\nimport { type Descriptor, isLegacyDescriptor } from '../prop-controllers/descriptors'\n\nimport { deserializeControl as deserializeUnifiedControl } from '../controls/serialization/base'\nimport {\n type DeserializedFunction,\n type SerializedFunction,\n ClientMessagePortSerializationVisitor,\n functionDeserializationPlugin,\n} from '../controls/serialization/message-port'\n\nimport {\n type DeserializeControlRecordsOptions,\n deserializeControlRecords,\n} from '../controls/serialization'\n\nexport * from '../prop-controllers/serialization'\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport function serializeControl<T extends Data>(\n control: Descriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const messagePortVisitor = new ClientMessagePortSerializationVisitor()\n const serializedControl = control.accept(messagePortVisitor)\n return [serializedControl, messagePortVisitor.getTransferables()]\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport type DeserializeControlOptions = {\n plugins?: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n options?: DeserializeControlOptions,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n // Parity with controls deserialization logic below: \"preprocess\" serialized\n // legacy controls if the caller provided custom deserialization plugins\n const record = options?.plugins\n ? deserializeObject(serializedControl, options?.plugins)\n : serializedControl\n return deserializeLegacyControl(record as SerializedLegacyControl<T>)\n }\n\n const plugins = [functionDeserializationPlugin, ...(options?.plugins ?? [])]\n return deserializeUnifiedControl(serializedControl, { plugins })\n}\n\nexport function serializeControls(\n controls: Record<string, Descriptor>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, unknown>,\n { onError, plugins }: DeserializeControlRecordsOptions = {},\n): Record<string, DeserializedControl> {\n return deserializeControlRecords<DeserializedControl>(\n serializedControls,\n (serializedControl, options) => deserializeControl(serializedControl, options),\n { onError, plugins },\n )\n}\n\ntype AnyFunction = (...args: any[]) => any\n\nexport type Serialize<T> = T extends AnyFunction\n ? SerializedFunction<T>\n : T extends Record<string, unknown>\n ? { [K in keyof T]: Serialize<T[K]> }\n : T\n\nexport type Deserialize<T> =\n T extends SerializedFunction<infer U>\n ? DeserializedFunction<U>\n : T extends Record<string, unknown>\n ? { [K in keyof T]: Deserialize<T[K]> }\n : T\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMO;AAEP,2BAKO;AAEP,yBAAoD;AAEpD,kBAAgE;AAChE,0BAKO;AAEP,IAAAA,wBAGO;AAEP,kCAAc,8CA9Bd;AAsCO,SAAS,iBACd,SACwC;AACxC,UAAI,uCAAmB,OAAO,GAAG;AAC/B,eAAO,6CAAuB,OAAO;AAAA,EACvC;AAEA,QAAM,qBAAqB,IAAI,0DAAsC;AACrE,QAAM,oBAAoB,QAAQ,OAAO,kBAAkB;AAC3D,SAAO,CAAC,mBAAmB,mBAAmB,iBAAiB,CAAC;AAClE;AAEA,SAAS,0BACP,SACuC;AACvC,SAAO,aAAa;AACtB;AAMO,SAAS,mBACd,mBACA,SACwB;AACxB,MAAI,0BAA0B,iBAAiB,GAAG;AAGhD,UAAM,SAAS,SAAS,cACpB,mCAAkB,mBAAmB,SAAS,OAAO,IACrD;AACJ,eAAO,+CAAyB,MAAoC;AAAA,EACtE;AAEA,QAAM,UAAU,CAAC,mDAA+B,GAAI,SAAS,WAAW,CAAC,CAAE;AAC3E,aAAO,YAAAC,oBAA0B,mBAAmB,EAAE,QAAQ,CAAC;AACjE;AAEO,SAAS,kBACd,UACqD;AACrD,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,CAAC,aAAa,gBAAgB,GAAG,CAAC,KAAK,OAAO,MAAM;AACnD,YAAM,CAAC,mBAAmB,aAAa,IAAI,iBAAiB,OAAO;AAEnE,aAAO,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,GAAG,kBAAkB,GAAG,CAAC,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAAA,IAC/F;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAEO,SAAS,oBACd,oBACA,EAAE,SAAS,QAAQ,IAAsC,CAAC,GACrB;AACrC,aAAO;AAAA,IACL;AAAA,IACA,CAAC,mBAAmB,YAAY,mBAAmB,mBAAmB,OAAO;AAAA,IAC7E,EAAE,SAAS,QAAQ;AAAA,EACrB;AACF;","names":["import_serialization","deserializeUnifiedControl"]}
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -212,7 +212,7 @@ Received "${apiKey}" instead.`
|
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
214
|
this.graphqlClient = new import_client.GraphQLClient(new URL("graphql", apiOrigin).href, {
|
|
215
|
-
"makeswift-runtime-version": "0.26.
|
|
215
|
+
"makeswift-runtime-version": "0.26.5"
|
|
216
216
|
});
|
|
217
217
|
this.runtime = runtime;
|
|
218
218
|
}
|
|
@@ -221,7 +221,7 @@ Received "${apiKey}" instead.`
|
|
|
221
221
|
const requestHeaders = new Headers({
|
|
222
222
|
"x-api-key": this.apiKey,
|
|
223
223
|
"makeswift-site-api-key": this.apiKey,
|
|
224
|
-
"makeswift-runtime-version": "0.26.
|
|
224
|
+
"makeswift-runtime-version": "0.26.5"
|
|
225
225
|
});
|
|
226
226
|
if (siteVersion?.token) {
|
|
227
227
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -668,7 +668,7 @@ Received "${apiKey}" instead.`
|
|
|
668
668
|
headers: {
|
|
669
669
|
"x-api-key": this.apiKey,
|
|
670
670
|
"makeswift-site-api-key": this.apiKey,
|
|
671
|
-
"makeswift-runtime-version": "0.26.
|
|
671
|
+
"makeswift-runtime-version": "0.26.5",
|
|
672
672
|
"content-type": "application/json"
|
|
673
673
|
},
|
|
674
674
|
body: JSON.stringify({ token }),
|
|
@@ -0,0 +1,78 @@
|
|
|
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 base_exports = {};
|
|
20
|
+
__export(base_exports, {
|
|
21
|
+
deserializeControl: () => deserializeControl,
|
|
22
|
+
deserializeUnifiedControlDef: () => deserializeUnifiedControlDef,
|
|
23
|
+
serializeControls: () => serializeControls
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(base_exports);
|
|
26
|
+
var import_controls = require("@makeswift/controls");
|
|
27
|
+
var import__ = require("../../index");
|
|
28
|
+
function serializeControls(controls, visitor) {
|
|
29
|
+
return Object.entries(controls).reduce(
|
|
30
|
+
(acc, [key, control]) => {
|
|
31
|
+
return { ...acc, [key]: control.accept(visitor) };
|
|
32
|
+
},
|
|
33
|
+
{}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function deserializeControl(serializedControl, options) {
|
|
37
|
+
const plugins = options?.plugins ?? [];
|
|
38
|
+
return deserializeUnifiedControlDef((0, import_controls.deserializeRecord)(serializedControl, plugins));
|
|
39
|
+
}
|
|
40
|
+
function deserializeUnifiedControlDef(record) {
|
|
41
|
+
const deserializeMethod = {
|
|
42
|
+
[import__.CheckboxDefinition.type]: import__.CheckboxDefinition.deserialize,
|
|
43
|
+
[import__.CodeDefinition.type]: import__.CodeDefinition.deserialize,
|
|
44
|
+
[import__.ColorDefinition.type]: import__.ColorDefinition.deserialize,
|
|
45
|
+
[import__.ComboboxDefinition.type]: import__.ComboboxDefinition.deserialize,
|
|
46
|
+
[import__.FontDefinition.type]: import__.FontDefinition.deserialize,
|
|
47
|
+
[import__.GroupDefinition.type]: (record2) => import__.GroupDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
48
|
+
[import__.IconRadioGroupDefinition.type]: import__.IconRadioGroupDefinition.deserialize,
|
|
49
|
+
[import__.ImageDefinition.type]: import__.ImageDefinition.deserialize,
|
|
50
|
+
[import__.LinkDefinition.type]: import__.LinkDefinition.deserialize,
|
|
51
|
+
[import__.ListDefinition.type]: (record2) => import__.ListDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
52
|
+
[import__.NumberDefinition.type]: import__.NumberDefinition.deserialize,
|
|
53
|
+
[import__.RichTextV1Definition.type]: import__.RichTextV1Definition.deserialize,
|
|
54
|
+
[import__.RichTextV2Definition.type]: (record2) => import__.RichTextV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
55
|
+
[import__.SelectDefinition.type]: import__.SelectDefinition.deserialize,
|
|
56
|
+
[import__.ShapeDefinition.type]: (record2) => import__.ShapeDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
57
|
+
[import__.SliderDefinition.type]: import__.SliderDefinition.deserialize,
|
|
58
|
+
[import_controls.ShapeV2Definition.type]: (record2) => import_controls.ShapeV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
59
|
+
[import__.SlotDefinition.type]: import__.SlotDefinition.deserialize,
|
|
60
|
+
[import__.StyleDefinition.type]: import__.StyleDefinition.deserialize,
|
|
61
|
+
[import__.StyleV2Definition.type]: (record2) => import__.StyleV2Definition.deserialize(record2, deserializeUnifiedControlDef),
|
|
62
|
+
[import__.TextAreaDefinition.type]: import__.TextAreaDefinition.deserialize,
|
|
63
|
+
[import__.TextInputDefinition.type]: import__.TextInputDefinition.deserialize,
|
|
64
|
+
[import__.unstable_TypographyDefinition.type]: import__.unstable_TypographyDefinition.deserialize
|
|
65
|
+
};
|
|
66
|
+
const deserialize = deserializeMethod[record.type] ?? null;
|
|
67
|
+
if (deserialize == null) {
|
|
68
|
+
throw new Error(`Unknown control type: ${record.type}`);
|
|
69
|
+
}
|
|
70
|
+
return deserialize(record);
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
deserializeControl,
|
|
75
|
+
deserializeUnifiedControlDef,
|
|
76
|
+
serializeControls
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/base/index.ts"],"sourcesContent":["import {\n ControlDefinition,\n type SerializedRecord,\n type DeserializedRecord,\n ShapeV2Definition,\n DeserializationPlugin,\n deserializeRecord,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n CodeDefinition,\n ColorDefinition,\n ComboboxDefinition,\n FontDefinition,\n GroupDefinition,\n IconRadioGroupDefinition,\n ImageDefinition,\n LinkDefinition,\n ListDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SliderDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../index'\n\nimport { BaseControlSerializationVisitor } from './visitor'\n\nexport { type SerializedRecord, type DeserializedRecord } from '@makeswift/controls'\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n visitor: BaseControlSerializationVisitor,\n): Record<string, SerializedRecord> {\n return Object.entries(controls).reduce<Record<string, SerializedRecord>>(\n (acc, [key, control]) => {\n return { ...acc, [key]: control.accept(visitor) }\n },\n {},\n )\n}\n\nexport type DeserializeControlOptions = {\n plugins: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl(\n serializedControl: SerializedRecord,\n options: DeserializeControlOptions,\n): ControlDefinition {\n const plugins = options?.plugins ?? []\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl, plugins))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): ControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => ControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [CodeDefinition.type]: CodeDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [FontDefinition.type]: FontDefinition.deserialize,\n [GroupDefinition.type]: record =>\n GroupDefinition.deserialize(record, deserializeUnifiedControlDef),\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [ListDefinition.type]: record =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: record =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ShapeDefinition.type]: record =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [SliderDefinition.type]: SliderDefinition.deserialize,\n [ShapeV2Definition.type]: record =>\n ShapeV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [StyleV2Definition.type]: record =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAOO;AAEP,eAuBO;AAMA,SAAS,kBACd,UACA,SACkC;AAClC,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,KAAK,CAAC,KAAK,OAAO,MAAM;AACvB,aAAO,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,QAAQ,OAAO,OAAO,EAAE;AAAA,IAClD;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAMO,SAAS,mBACd,mBACA,SACmB;AACnB,QAAM,UAAU,SAAS,WAAW,CAAC;AAErC,SAAO,iCAA6B,mCAAkB,mBAAmB,OAAO,CAAC;AACnF;AAEO,SAAS,6BAA6B,QAA+C;AAE1F,QAAM,oBAAuD;AAAA,IAC3D,CAAC,4BAAmB,IAAI,GAAG,4BAAmB;AAAA,IAC9C,CAAC,wBAAe,IAAI,GAAG,wBAAe;AAAA,IACtC,CAAC,yBAAgB,IAAI,GAAG,yBAAgB;AAAA,IACxC,CAAC,4BAAmB,IAAI,GAAG,4BAAmB;AAAA,IAC9C,CAAC,wBAAe,IAAI,GAAG,wBAAe;AAAA,IACtC,CAAC,yBAAgB,IAAI,GAAG,CAAAA,YACtB,yBAAgB,YAAYA,SAAQ,4BAA4B;AAAA,IAClE,CAAC,kCAAyB,IAAI,GAAG,kCAAyB;AAAA,IAC1D,CAAC,yBAAgB,IAAI,GAAG,yBAAgB;AAAA,IACxC,CAAC,wBAAe,IAAI,GAAG,wBAAe;AAAA,IACtC,CAAC,wBAAe,IAAI,GAAG,CAAAA,YACrB,wBAAe,YAAYA,SAAQ,4BAA4B;AAAA,IACjE,CAAC,0BAAiB,IAAI,GAAG,0BAAiB;AAAA,IAC1C,CAAC,8BAAqB,IAAI,GAAG,8BAAqB;AAAA,IAClD,CAAC,8BAAqB,IAAI,GAAG,CAAAA,YAC3B,8BAAqB,YAAYA,SAAQ,4BAA4B;AAAA,IACvE,CAAC,0BAAiB,IAAI,GAAG,0BAAiB;AAAA,IAC1C,CAAC,yBAAgB,IAAI,GAAG,CAAAA,YACtB,yBAAgB,YAAYA,SAAQ,4BAA4B;AAAA,IAClE,CAAC,0BAAiB,IAAI,GAAG,0BAAiB;AAAA,IAC1C,CAAC,kCAAkB,IAAI,GAAG,CAAAA,YACxB,kCAAkB,YAAYA,SAAQ,4BAA4B;AAAA,IACpE,CAAC,wBAAe,IAAI,GAAG,wBAAe;AAAA,IACtC,CAAC,yBAAgB,IAAI,GAAG,yBAAgB;AAAA,IACxC,CAAC,2BAAkB,IAAI,GAAG,CAAAA,YACxB,2BAAkB,YAAYA,SAAQ,4BAA4B;AAAA,IACpE,CAAC,4BAAmB,IAAI,GAAG,4BAAmB;AAAA,IAC9C,CAAC,6BAAoB,IAAI,GAAG,6BAAoB;AAAA,IAChD,CAAC,uCAA8B,IAAI,GAAG,uCAA8B;AAAA,EACtE;AAEA,QAAM,cAAc,kBAAkB,OAAO,IAAI,KAAK;AACtD,MAAI,eAAe,MAAM;AACvB,UAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,EAAE;AAAA,EACxD;AAEA,SAAO,YAAY,MAAM;AAC3B;","names":["record"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 visitor_exports = {};
|
|
20
|
+
__export(visitor_exports, {
|
|
21
|
+
BaseControlSerializationVisitor: () => BaseControlSerializationVisitor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(visitor_exports);
|
|
24
|
+
var import_controls = require("@makeswift/controls");
|
|
25
|
+
var import_rich_text_v2 = require("../../rich-text-v2");
|
|
26
|
+
class BaseControlSerializationVisitor extends import_controls.ControlSerializationVisitor {
|
|
27
|
+
constructor(plugins) {
|
|
28
|
+
const serializeDefinitionPlugin = {
|
|
29
|
+
match: (val) => val instanceof import_controls.ControlDefinition,
|
|
30
|
+
serialize: (val) => val.accept(this)
|
|
31
|
+
};
|
|
32
|
+
super([serializeDefinitionPlugin, ...plugins]);
|
|
33
|
+
}
|
|
34
|
+
visitRichTextV2(def) {
|
|
35
|
+
const { plugins, ...config } = def.config;
|
|
36
|
+
const pluginDefs = plugins.map(
|
|
37
|
+
({ control }) => control ? {
|
|
38
|
+
control: {
|
|
39
|
+
definition: control.definition,
|
|
40
|
+
// FIXME: remove getValue/onChange stubs once we released a version of the builder
|
|
41
|
+
// built against the runtime where these can be optional
|
|
42
|
+
getValue: () => void 0,
|
|
43
|
+
onChange: () => {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} : {}
|
|
47
|
+
);
|
|
48
|
+
const serialized = (0, import_controls.serializeObject)(
|
|
49
|
+
{ config: { ...config, plugins: pluginDefs } },
|
|
50
|
+
this.serializationPlugins
|
|
51
|
+
);
|
|
52
|
+
return { ...serialized, type: import_rich_text_v2.RichTextV2Definition.type };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
BaseControlSerializationVisitor
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/base/visitor.ts"],"sourcesContent":["import {\n ControlDefinition,\n SerializedRecord,\n serializeObject,\n SerializationPlugin,\n ControlSerializationVisitor,\n} from '@makeswift/controls'\n\nimport { RichTextV2Definition } from '../../rich-text-v2'\n\nexport class BaseControlSerializationVisitor extends ControlSerializationVisitor {\n constructor(plugins: SerializationPlugin<any>[]) {\n const serializeDefinitionPlugin: SerializationPlugin<ControlDefinition> = {\n match: (val: unknown) => val instanceof ControlDefinition,\n serialize: (val: ControlDefinition) => val.accept(this),\n }\n\n super([serializeDefinitionPlugin, ...plugins])\n }\n\n visitRichTextV2(def: RichTextV2Definition): SerializedRecord {\n const { plugins, ...config } = def.config\n\n // serialize only the plugin control definition, if any\n const pluginDefs = plugins.map(({ control }) =>\n control\n ? {\n control: {\n definition: control.definition,\n // FIXME: remove getValue/onChange stubs once we released a version of the builder\n // built against the runtime where these can be optional\n getValue: () => undefined,\n onChange: () => {},\n },\n }\n : {},\n )\n\n const serialized = serializeObject(\n { config: { ...config, plugins: pluginDefs } },\n this.serializationPlugins,\n ) as SerializedRecord\n\n return { ...serialized, type: RichTextV2Definition.type }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMO;AAEP,0BAAqC;AAE9B,MAAM,wCAAwC,4CAA4B;AAAA,EAC/E,YAAY,SAAqC;AAC/C,UAAM,4BAAoE;AAAA,MACxE,OAAO,CAAC,QAAiB,eAAe;AAAA,MACxC,WAAW,CAAC,QAA2B,IAAI,OAAO,IAAI;AAAA,IACxD;AAEA,UAAM,CAAC,2BAA2B,GAAG,OAAO,CAAC;AAAA,EAC/C;AAAA,EAEA,gBAAgB,KAA6C;AAC3D,UAAM,EAAE,SAAS,GAAG,OAAO,IAAI,IAAI;AAGnC,UAAM,aAAa,QAAQ;AAAA,MAAI,CAAC,EAAE,QAAQ,MACxC,UACI;AAAA,QACE,SAAS;AAAA,UACP,YAAY,QAAQ;AAAA;AAAA;AAAA,UAGpB,UAAU,MAAM;AAAA,UAChB,UAAU,MAAM;AAAA,UAAC;AAAA,QACnB;AAAA,MACF,IACA,CAAC;AAAA,IACP;AAEA,UAAM,iBAAa;AAAA,MACjB,EAAE,QAAQ,EAAE,GAAG,QAAQ,SAAS,WAAW,EAAE;AAAA,MAC7C,KAAK;AAAA,IACP;AAEA,WAAO,EAAE,GAAG,YAAY,MAAM,yCAAqB,KAAK;AAAA,EAC1D;AACF;","names":[]}
|