@makeswift/runtime 0.27.3 → 0.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/client/index.js +3 -3
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/client/index.js +3 -3
- package/package.json +3 -3
- package/dist/cjs/api/api-resources-client.js +0 -160
- package/dist/cjs/api/api-resources-client.js.map +0 -1
- package/dist/cjs/api/react.js +0 -256
- package/dist/cjs/api/react.js.map +0 -1
- package/dist/cjs/api-handler/handlers/webhook/diff-projection.js +0 -62
- package/dist/cjs/api-handler/handlers/webhook/diff-projection.js.map +0 -1
- package/dist/cjs/box-model.js +0 -33
- package/dist/cjs/box-model.js.map +0 -1
- package/dist/cjs/builder/serialization.js +0 -78
- package/dist/cjs/builder/serialization.js.map +0 -1
- package/dist/cjs/components/builtin/index.js +0 -84
- package/dist/cjs/components/builtin/index.js.map +0 -1
- package/dist/cjs/components/index.js +0 -25
- package/dist/cjs/components/index.js.map +0 -1
- package/dist/cjs/controls/rich-text-v2/translation.js +0 -187
- package/dist/cjs/controls/rich-text-v2/translation.js.map +0 -1
- package/dist/cjs/controls/serialization/base/index.js +0 -78
- package/dist/cjs/controls/serialization/base/index.js.map +0 -1
- package/dist/cjs/controls/serialization/base/visitor.js +0 -59
- package/dist/cjs/controls/serialization/base/visitor.js.map +0 -1
- package/dist/cjs/controls/serialization/index.js +0 -55
- package/dist/cjs/controls/serialization/index.js.map +0 -1
- package/dist/cjs/controls/serialization/message-port/function-serialization.js +0 -79
- package/dist/cjs/controls/serialization/message-port/function-serialization.js.map +0 -1
- package/dist/cjs/controls/serialization/message-port/index.js +0 -25
- package/dist/cjs/controls/serialization/message-port/index.js.map +0 -1
- package/dist/cjs/controls/serialization/message-port/visitor.js +0 -48
- package/dist/cjs/controls/serialization/message-port/visitor.js.map +0 -1
- package/dist/cjs/core/index.js +0 -57
- package/dist/cjs/core/index.js.map +0 -1
- package/dist/cjs/next/fetch.js +0 -30
- package/dist/cjs/next/fetch.js.map +0 -1
- package/dist/cjs/prop-controllers/index.js +0 -48
- package/dist/cjs/prop-controllers/index.js.map +0 -1
- package/dist/cjs/prop-controllers/serialization.js +0 -355
- package/dist/cjs/prop-controllers/serialization.js.map +0 -1
- package/dist/cjs/react.js +0 -40
- package/dist/cjs/react.js.map +0 -1
- package/dist/cjs/runtimes/react/components/LiveProvider.js +0 -50
- package/dist/cjs/runtimes/react/components/LiveProvider.js.map +0 -1
- package/dist/cjs/runtimes/react/components/MakeswiftFonts.js +0 -33
- package/dist/cjs/runtimes/react/components/MakeswiftFonts.js.map +0 -1
- package/dist/cjs/runtimes/react/components/PreviewProvider.js +0 -57
- package/dist/cjs/runtimes/react/components/PreviewProvider.js.map +0 -1
- package/dist/cjs/runtimes/react/components/hooks/use-builder-connection-ping.js +0 -67
- package/dist/cjs/runtimes/react/components/hooks/use-builder-connection-ping.js.map +0 -1
- package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js +0 -39
- package/dist/cjs/runtimes/react/hooks/use-current-breakpoint.js.map +0 -1
- package/dist/cjs/runtimes/react/hooks/use-is-preview.js +0 -33
- package/dist/cjs/runtimes/react/hooks/use-is-preview.js.map +0 -1
- package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js +0 -59
- package/dist/cjs/runtimes/react/lib/resolved-style-to-css.js.map +0 -1
- package/dist/cjs/runtimes/react/resource-resolver.js +0 -52
- package/dist/cjs/runtimes/react/resource-resolver.js.map +0 -1
- package/dist/cjs/state/actions/internal.js +0 -205
- package/dist/cjs/state/actions/internal.js.map +0 -1
- package/dist/cjs/state/actions.js +0 -423
- package/dist/cjs/state/actions.js.map +0 -1
- package/dist/cjs/state/api-client/client-store.js +0 -81
- package/dist/cjs/state/api-client/client-store.js.map +0 -1
- package/dist/cjs/state/api-client/fetch-api-resource.js +0 -125
- package/dist/cjs/state/api-client/fetch-api-resource.js.map +0 -1
- package/dist/cjs/state/api-client/state.js +0 -89
- package/dist/cjs/state/api-client/state.js.map +0 -1
- package/dist/cjs/state/api-client/store.js +0 -36
- package/dist/cjs/state/api-client/store.js.map +0 -1
- package/dist/cjs/state/builder-api/api.js +0 -17
- package/dist/cjs/state/builder-api/api.js.map +0 -1
- package/dist/cjs/state/builder-api/navigation-listener.js +0 -110
- package/dist/cjs/state/builder-api/navigation-listener.js.map +0 -1
- package/dist/cjs/state/mixins/breakpoint-watch.js +0 -72
- package/dist/cjs/state/mixins/breakpoint-watch.js.map +0 -1
- package/dist/cjs/state/mixins/setup-teardown.js +0 -35
- package/dist/cjs/state/mixins/setup-teardown.js.map +0 -1
- package/dist/cjs/state/modules/box-models.js +0 -127
- package/dist/cjs/state/modules/box-models.js.map +0 -1
- package/dist/cjs/state/modules/element-imperative-handles.js +0 -60
- package/dist/cjs/state/modules/element-imperative-handles.js.map +0 -1
- package/dist/cjs/state/modules/is-preview.js +0 -47
- package/dist/cjs/state/modules/is-preview.js.map +0 -1
- package/dist/cjs/state/modules/pointer.js +0 -47
- package/dist/cjs/state/modules/pointer.js.map +0 -1
- package/dist/cjs/state/modules/read-write-documents.js +0 -98
- package/dist/cjs/state/modules/read-write-documents.js.map +0 -1
- package/dist/cjs/state/react-builder-preview.js +0 -610
- package/dist/cjs/state/react-builder-preview.js.map +0 -1
- package/dist/cjs/state/react-page.js +0 -355
- package/dist/cjs/state/react-page.js.map +0 -1
- package/dist/cjs/utils/ref-counted-map.js +0 -120
- package/dist/cjs/utils/ref-counted-map.js.map +0 -1
- package/dist/esm/api/api-resources-client.js +0 -127
- package/dist/esm/api/api-resources-client.js.map +0 -1
- package/dist/esm/api/react.js +0 -223
- package/dist/esm/api/react.js.map +0 -1
- package/dist/esm/api-handler/handlers/webhook/diff-projection.js +0 -38
- package/dist/esm/api-handler/handlers/webhook/diff-projection.js.map +0 -1
- package/dist/esm/box-model.js +0 -7
- package/dist/esm/box-model.js.map +0 -1
- package/dist/esm/builder/serialization.js +0 -59
- package/dist/esm/builder/serialization.js.map +0 -1
- package/dist/esm/components/builtin/index.js +0 -34
- package/dist/esm/components/builtin/index.js.map +0 -1
- package/dist/esm/components/index.js +0 -3
- package/dist/esm/components/index.js.map +0 -1
- package/dist/esm/controls/rich-text-v2/translation.js +0 -152
- package/dist/esm/controls/rich-text-v2/translation.js.map +0 -1
- package/dist/esm/controls/serialization/base/index.js +0 -78
- package/dist/esm/controls/serialization/base/index.js.map +0 -1
- package/dist/esm/controls/serialization/base/visitor.js +0 -39
- package/dist/esm/controls/serialization/base/visitor.js.map +0 -1
- package/dist/esm/controls/serialization/index.js +0 -30
- package/dist/esm/controls/serialization/index.js.map +0 -1
- package/dist/esm/controls/serialization/message-port/function-serialization.js +0 -52
- package/dist/esm/controls/serialization/message-port/function-serialization.js.map +0 -1
- package/dist/esm/controls/serialization/message-port/index.js +0 -3
- package/dist/esm/controls/serialization/message-port/index.js.map +0 -1
- package/dist/esm/controls/serialization/message-port/visitor.js +0 -24
- package/dist/esm/controls/serialization/message-port/visitor.js.map +0 -1
- package/dist/esm/core/index.js +0 -35
- package/dist/esm/core/index.js.map +0 -1
- package/dist/esm/next/fetch.js +0 -6
- package/dist/esm/next/fetch.js.map +0 -1
- package/dist/esm/prop-controllers/index.js +0 -11
- package/dist/esm/prop-controllers/index.js.map +0 -1
- package/dist/esm/prop-controllers/serialization.js +0 -338
- package/dist/esm/prop-controllers/serialization.js.map +0 -1
- package/dist/esm/react.js +0 -11
- package/dist/esm/react.js.map +0 -1
- package/dist/esm/runtimes/react/components/LiveProvider.js +0 -20
- package/dist/esm/runtimes/react/components/LiveProvider.js.map +0 -1
- package/dist/esm/runtimes/react/components/MakeswiftFonts.js +0 -9
- package/dist/esm/runtimes/react/components/MakeswiftFonts.js.map +0 -1
- package/dist/esm/runtimes/react/components/PreviewProvider.js +0 -27
- package/dist/esm/runtimes/react/components/PreviewProvider.js.map +0 -1
- package/dist/esm/runtimes/react/components/hooks/use-builder-connection-ping.js +0 -43
- package/dist/esm/runtimes/react/components/hooks/use-builder-connection-ping.js.map +0 -1
- package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js +0 -15
- package/dist/esm/runtimes/react/hooks/use-current-breakpoint.js.map +0 -1
- package/dist/esm/runtimes/react/hooks/use-is-preview.js +0 -9
- package/dist/esm/runtimes/react/hooks/use-is-preview.js.map +0 -1
- package/dist/esm/runtimes/react/lib/resolved-style-to-css.js +0 -38
- package/dist/esm/runtimes/react/lib/resolved-style-to-css.js.map +0 -1
- package/dist/esm/runtimes/react/resource-resolver.js +0 -28
- package/dist/esm/runtimes/react/resource-resolver.js.map +0 -1
- package/dist/esm/state/actions/internal.js +0 -162
- package/dist/esm/state/actions/internal.js.map +0 -1
- package/dist/esm/state/actions.js +0 -349
- package/dist/esm/state/actions.js.map +0 -1
- package/dist/esm/state/api-client/client-store.js +0 -49
- package/dist/esm/state/api-client/client-store.js.map +0 -1
- package/dist/esm/state/api-client/fetch-api-resource.js +0 -93
- package/dist/esm/state/api-client/fetch-api-resource.js.map +0 -1
- package/dist/esm/state/api-client/state.js +0 -52
- package/dist/esm/state/api-client/state.js.map +0 -1
- package/dist/esm/state/api-client/store.js +0 -12
- package/dist/esm/state/api-client/store.js.map +0 -1
- package/dist/esm/state/builder-api/api.js +0 -1
- package/dist/esm/state/builder-api/api.js.map +0 -1
- package/dist/esm/state/builder-api/navigation-listener.js +0 -86
- package/dist/esm/state/builder-api/navigation-listener.js.map +0 -1
- package/dist/esm/state/mixins/breakpoint-watch.js +0 -48
- package/dist/esm/state/mixins/breakpoint-watch.js.map +0 -1
- package/dist/esm/state/mixins/setup-teardown.js +0 -11
- package/dist/esm/state/mixins/setup-teardown.js.map +0 -1
- package/dist/esm/state/modules/box-models.js +0 -98
- package/dist/esm/state/modules/box-models.js.map +0 -1
- package/dist/esm/state/modules/element-imperative-handles.js +0 -35
- package/dist/esm/state/modules/element-imperative-handles.js.map +0 -1
- package/dist/esm/state/modules/is-preview.js +0 -21
- package/dist/esm/state/modules/is-preview.js.map +0 -1
- package/dist/esm/state/modules/pointer.js +0 -22
- package/dist/esm/state/modules/pointer.js.map +0 -1
- package/dist/esm/state/modules/read-write-documents.js +0 -60
- package/dist/esm/state/modules/read-write-documents.js.map +0 -1
- package/dist/esm/state/react-builder-preview.js +0 -590
- package/dist/esm/state/react-builder-preview.js.map +0 -1
- package/dist/esm/state/react-page.js +0 -319
- package/dist/esm/state/react-page.js.map +0 -1
- package/dist/esm/utils/ref-counted-map.js +0 -96
- package/dist/esm/utils/ref-counted-map.js.map +0 -1
- package/dist/types/api/api-resources-client.d.ts +0 -57
- package/dist/types/api/api-resources-client.d.ts.map +0 -1
- package/dist/types/api/react.d.ts +0 -82
- package/dist/types/api/react.d.ts.map +0 -1
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +0 -201
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts.map +0 -1
- package/dist/types/box-model.d.ts +0 -3
- package/dist/types/box-model.d.ts.map +0 -1
- package/dist/types/builder/serialization.d.ts +0 -23
- package/dist/types/builder/serialization.d.ts.map +0 -1
- package/dist/types/builder/serialization.test.d.ts +0 -2
- package/dist/types/builder/serialization.test.d.ts.map +0 -1
- package/dist/types/client/tests/client.get-component-snapshots.test.d.ts +0 -2
- package/dist/types/client/tests/client.get-component-snapshots.test.d.ts.map +0 -1
- package/dist/types/client/tests/client.introspect-many.test.d.ts +0 -2
- package/dist/types/client/tests/client.introspect-many.test.d.ts.map +0 -1
- package/dist/types/components/builtin/index.d.ts +0 -17
- package/dist/types/components/builtin/index.d.ts.map +0 -1
- package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts +0 -3
- package/dist/types/components/hooks/__tests__/useMediaQuery.test.d.ts.map +0 -1
- package/dist/types/components/index.d.ts +0 -3
- package/dist/types/components/index.d.ts.map +0 -1
- package/dist/types/controls/rich-text-v2/translation.d.ts +0 -6
- package/dist/types/controls/rich-text-v2/translation.d.ts.map +0 -1
- package/dist/types/controls/serialization/base/index.d.ts +0 -10
- package/dist/types/controls/serialization/base/index.d.ts.map +0 -1
- package/dist/types/controls/serialization/base/visitor.d.ts +0 -7
- package/dist/types/controls/serialization/base/visitor.d.ts.map +0 -1
- package/dist/types/controls/serialization/index.d.ts +0 -10
- package/dist/types/controls/serialization/index.d.ts.map +0 -1
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts +0 -16
- package/dist/types/controls/serialization/message-port/function-serialization.d.ts.map +0 -1
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts +0 -2
- package/dist/types/controls/serialization/message-port/function-serialization.test.d.ts.map +0 -1
- package/dist/types/controls/serialization/message-port/index.d.ts +0 -3
- package/dist/types/controls/serialization/message-port/index.d.ts.map +0 -1
- package/dist/types/controls/serialization/message-port/visitor.d.ts +0 -7
- package/dist/types/controls/serialization/message-port/visitor.d.ts.map +0 -1
- package/dist/types/core/index.d.ts +0 -2
- package/dist/types/core/index.d.ts.map +0 -1
- package/dist/types/next/api-handler/config/pages-router.test.d.ts +0 -2
- package/dist/types/next/api-handler/config/pages-router.test.d.ts.map +0 -1
- package/dist/types/next/components/tests/controls/code-control.test.d.ts +0 -2
- package/dist/types/next/components/tests/controls/code-control.test.d.ts.map +0 -1
- package/dist/types/next/components/tests/makeswift-component-rendering.test.d.ts +0 -3
- package/dist/types/next/components/tests/makeswift-component-rendering.test.d.ts.map +0 -1
- package/dist/types/next/fetch.d.ts +0 -3
- package/dist/types/next/fetch.d.ts.map +0 -1
- package/dist/types/prop-controllers/index.d.ts +0 -8
- package/dist/types/prop-controllers/index.d.ts.map +0 -1
- package/dist/types/prop-controllers/serialization.d.ts +0 -228
- package/dist/types/prop-controllers/serialization.d.ts.map +0 -1
- package/dist/types/react.d.ts +0 -4
- package/dist/types/react.d.ts.map +0 -1
- package/dist/types/runtimes/react/components/LiveProvider.d.ts +0 -3
- package/dist/types/runtimes/react/components/LiveProvider.d.ts.map +0 -1
- package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts +0 -7
- package/dist/types/runtimes/react/components/MakeswiftFonts.d.ts.map +0 -1
- package/dist/types/runtimes/react/components/PreviewProvider.d.ts +0 -3
- package/dist/types/runtimes/react/components/PreviewProvider.d.ts.map +0 -1
- package/dist/types/runtimes/react/components/hooks/use-builder-connection-ping.d.ts +0 -4
- package/dist/types/runtimes/react/components/hooks/use-builder-connection-ping.d.ts.map +0 -1
- package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts +0 -3
- package/dist/types/runtimes/react/hooks/use-current-breakpoint.d.ts.map +0 -1
- package/dist/types/runtimes/react/hooks/use-is-preview.d.ts +0 -2
- package/dist/types/runtimes/react/hooks/use-is-preview.d.ts.map +0 -1
- package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts +0 -4
- package/dist/types/runtimes/react/lib/resolved-style-to-css.d.ts.map +0 -1
- package/dist/types/runtimes/react/resource-resolver.d.ts +0 -10
- package/dist/types/runtimes/react/resource-resolver.d.ts.map +0 -1
- package/dist/types/state/__tests__/react-page.test.d.ts +0 -2
- package/dist/types/state/__tests__/react-page.test.d.ts.map +0 -1
- package/dist/types/state/actions/internal.d.ts +0 -181
- package/dist/types/state/actions/internal.d.ts.map +0 -1
- package/dist/types/state/actions.d.ts +0 -461
- package/dist/types/state/actions.d.ts.map +0 -1
- package/dist/types/state/api-client/client-store.d.ts +0 -6
- package/dist/types/state/api-client/client-store.d.ts.map +0 -1
- package/dist/types/state/api-client/fetch-api-resource.d.ts +0 -11
- package/dist/types/state/api-client/fetch-api-resource.d.ts.map +0 -1
- package/dist/types/state/api-client/state.d.ts +0 -30
- package/dist/types/state/api-client/state.d.ts.map +0 -1
- package/dist/types/state/api-client/store.d.ts +0 -18
- package/dist/types/state/api-client/store.d.ts.map +0 -1
- package/dist/types/state/builder-api/api.d.ts +0 -9
- package/dist/types/state/builder-api/api.d.ts.map +0 -1
- package/dist/types/state/builder-api/navigation-listener.d.ts +0 -3
- package/dist/types/state/builder-api/navigation-listener.d.ts.map +0 -1
- package/dist/types/state/mixins/breakpoint-watch.d.ts +0 -11
- package/dist/types/state/mixins/breakpoint-watch.d.ts.map +0 -1
- package/dist/types/state/mixins/setup-teardown.d.ts +0 -7
- package/dist/types/state/mixins/setup-teardown.d.ts.map +0 -1
- package/dist/types/state/modules/box-models.d.ts +0 -23
- package/dist/types/state/modules/box-models.d.ts.map +0 -1
- package/dist/types/state/modules/element-imperative-handles.d.ts +0 -7
- package/dist/types/state/modules/element-imperative-handles.d.ts.map +0 -1
- package/dist/types/state/modules/is-preview.d.ts +0 -6
- package/dist/types/state/modules/is-preview.d.ts.map +0 -1
- package/dist/types/state/modules/pointer.d.ts +0 -12
- package/dist/types/state/modules/pointer.d.ts.map +0 -1
- package/dist/types/state/modules/read-write-documents.d.ts +0 -14
- package/dist/types/state/modules/read-write-documents.d.ts.map +0 -1
- package/dist/types/state/react-builder-preview.d.ts +0 -110
- package/dist/types/state/react-builder-preview.d.ts.map +0 -1
- package/dist/types/state/react-page.d.ts +0 -149
- package/dist/types/state/react-page.d.ts.map +0 -1
- package/dist/types/utils/__tests__/ref-counted-map.test.d.ts +0 -2
- package/dist/types/utils/__tests__/ref-counted-map.test.d.ts.map +0 -1
- package/dist/types/utils/ref-counted-map.d.ts +0 -32
- package/dist/types/utils/ref-counted-map.d.ts.map +0 -1
|
@@ -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.27.
|
|
31
|
+
version: "0.27.4",
|
|
32
32
|
interactionMode: true,
|
|
33
33
|
clientSideNavigation: false,
|
|
34
34
|
elementFromPoint: false,
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -210,7 +210,7 @@ Received "${apiKey}" instead.`
|
|
|
210
210
|
}
|
|
211
211
|
this.apiKey = apiKey;
|
|
212
212
|
this.graphqlClient = new import_client.GraphQLClient(new URL("graphql", runtime.apiOrigin).href, {
|
|
213
|
-
"makeswift-runtime-version": "0.27.
|
|
213
|
+
"makeswift-runtime-version": "0.27.4"
|
|
214
214
|
});
|
|
215
215
|
this.runtime = runtime;
|
|
216
216
|
}
|
|
@@ -222,7 +222,7 @@ Received "${apiKey}" instead.`
|
|
|
222
222
|
const requestHeaders = new Headers({
|
|
223
223
|
"x-api-key": this.apiKey,
|
|
224
224
|
"makeswift-site-api-key": this.apiKey,
|
|
225
|
-
"makeswift-runtime-version": "0.27.
|
|
225
|
+
"makeswift-runtime-version": "0.27.4"
|
|
226
226
|
});
|
|
227
227
|
if (siteVersion?.token) {
|
|
228
228
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -680,7 +680,7 @@ Received "${apiKey}" instead.`
|
|
|
680
680
|
headers: {
|
|
681
681
|
"x-api-key": this.apiKey,
|
|
682
682
|
"makeswift-site-api-key": this.apiKey,
|
|
683
|
-
"makeswift-runtime-version": "0.27.
|
|
683
|
+
"makeswift-runtime-version": "0.27.4",
|
|
684
684
|
"content-type": "application/json"
|
|
685
685
|
},
|
|
686
686
|
body: JSON.stringify({ token }),
|
|
@@ -8,7 +8,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
|
|
|
8
8
|
return ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
|
|
9
9
|
}
|
|
10
10
|
return ApiResponse.json({
|
|
11
|
-
version: "0.27.
|
|
11
|
+
version: "0.27.4",
|
|
12
12
|
interactionMode: true,
|
|
13
13
|
clientSideNavigation: false,
|
|
14
14
|
elementFromPoint: false,
|
package/dist/esm/client/index.js
CHANGED
|
@@ -194,7 +194,7 @@ Received "${apiKey}" instead.`
|
|
|
194
194
|
}
|
|
195
195
|
this.apiKey = apiKey;
|
|
196
196
|
this.graphqlClient = new GraphQLClient(new URL("graphql", runtime.apiOrigin).href, {
|
|
197
|
-
"makeswift-runtime-version": "0.27.
|
|
197
|
+
"makeswift-runtime-version": "0.27.4"
|
|
198
198
|
});
|
|
199
199
|
this.runtime = runtime;
|
|
200
200
|
}
|
|
@@ -206,7 +206,7 @@ Received "${apiKey}" instead.`
|
|
|
206
206
|
const requestHeaders = new Headers({
|
|
207
207
|
"x-api-key": this.apiKey,
|
|
208
208
|
"makeswift-site-api-key": this.apiKey,
|
|
209
|
-
"makeswift-runtime-version": "0.27.
|
|
209
|
+
"makeswift-runtime-version": "0.27.4"
|
|
210
210
|
});
|
|
211
211
|
if (siteVersion?.token) {
|
|
212
212
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -664,7 +664,7 @@ Received "${apiKey}" instead.`
|
|
|
664
664
|
headers: {
|
|
665
665
|
"x-api-key": this.apiKey,
|
|
666
666
|
"makeswift-site-api-key": this.apiKey,
|
|
667
|
-
"makeswift-runtime-version": "0.27.
|
|
667
|
+
"makeswift-runtime-version": "0.27.4",
|
|
668
668
|
"content-type": "application/json"
|
|
669
669
|
},
|
|
670
670
|
body: JSON.stringify({ token }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makeswift/runtime",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "makeswift/makeswift",
|
|
@@ -239,8 +239,8 @@
|
|
|
239
239
|
"uuid": "^9.0.0",
|
|
240
240
|
"zod": "^3.21.4",
|
|
241
241
|
"@makeswift/controls": "0.1.16",
|
|
242
|
-
"@makeswift/
|
|
243
|
-
"@makeswift/
|
|
242
|
+
"@makeswift/prop-controllers": "0.4.10",
|
|
243
|
+
"@makeswift/next-plugin": "0.6.1"
|
|
244
244
|
},
|
|
245
245
|
"devDependencies": {
|
|
246
246
|
"@emotion/jest": "^11.11.0",
|
|
@@ -1,160 +0,0 @@
|
|
|
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 api_resources_client_exports = {};
|
|
30
|
-
__export(api_resources_client_exports, {
|
|
31
|
-
ApiResourcesClient: () => ApiResourcesClient,
|
|
32
|
-
CacheData: () => CacheData
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(api_resources_client_exports);
|
|
35
|
-
var ApiClientState = __toESM(require("../state/api-client/state"));
|
|
36
|
-
var import_types = require("./types");
|
|
37
|
-
const CacheData = {
|
|
38
|
-
empty() {
|
|
39
|
-
return {
|
|
40
|
-
apiResources: {},
|
|
41
|
-
localizedResourcesMap: {}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
class ApiResourcesClient {
|
|
46
|
-
store;
|
|
47
|
-
subscribe;
|
|
48
|
-
constructor({ store }) {
|
|
49
|
-
this.store = store;
|
|
50
|
-
this.subscribe = this.store.subscribe;
|
|
51
|
-
}
|
|
52
|
-
readSwatch(swatchId) {
|
|
53
|
-
return ApiClientState.getAPIResource(this.store.getState(), import_types.APIResourceType.Swatch, swatchId);
|
|
54
|
-
}
|
|
55
|
-
resolveSwatch(swatchId) {
|
|
56
|
-
return this.resolveResource(import_types.APIResourceType.Swatch, {
|
|
57
|
-
id: swatchId,
|
|
58
|
-
read: (id) => this.readSwatch(id),
|
|
59
|
-
fetch: (id) => this.fetchSwatch(id)
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
readFile(fileId) {
|
|
63
|
-
return ApiClientState.getAPIResource(this.store.getState(), import_types.APIResourceType.File, fileId);
|
|
64
|
-
}
|
|
65
|
-
resolveFile(fileId) {
|
|
66
|
-
return this.resolveResource(import_types.APIResourceType.File, {
|
|
67
|
-
id: fileId,
|
|
68
|
-
read: (id) => this.readFile(id),
|
|
69
|
-
fetch: (id) => this.fetchFile(id)
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
readTypography(typographyId) {
|
|
73
|
-
return ApiClientState.getAPIResource(
|
|
74
|
-
this.store.getState(),
|
|
75
|
-
import_types.APIResourceType.Typography,
|
|
76
|
-
typographyId
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
resolveTypography(typographyId) {
|
|
80
|
-
return this.resolveResource(import_types.APIResourceType.Typography, {
|
|
81
|
-
id: typographyId,
|
|
82
|
-
read: (id) => this.readTypography(id),
|
|
83
|
-
fetch: (id) => this.fetchTypography(id)
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
readGlobalElement(globalElementId) {
|
|
87
|
-
return ApiClientState.getAPIResource(
|
|
88
|
-
this.store.getState(),
|
|
89
|
-
import_types.APIResourceType.GlobalElement,
|
|
90
|
-
globalElementId
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
readLocalizedGlobalElement({
|
|
94
|
-
globalElementId,
|
|
95
|
-
locale
|
|
96
|
-
}) {
|
|
97
|
-
return ApiClientState.getAPIResource(
|
|
98
|
-
this.store.getState(),
|
|
99
|
-
import_types.APIResourceType.LocalizedGlobalElement,
|
|
100
|
-
globalElementId,
|
|
101
|
-
locale
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
readPagePathnameSlice({
|
|
105
|
-
pageId,
|
|
106
|
-
locale
|
|
107
|
-
}) {
|
|
108
|
-
return ApiClientState.getAPIResource(
|
|
109
|
-
this.store.getState(),
|
|
110
|
-
import_types.APIResourceType.PagePathnameSlice,
|
|
111
|
-
pageId,
|
|
112
|
-
locale
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
resolvePagePathnameSlice({
|
|
116
|
-
pageId,
|
|
117
|
-
locale
|
|
118
|
-
}) {
|
|
119
|
-
return this.resolveResource(import_types.APIResourceType.PagePathnameSlice, {
|
|
120
|
-
id: pageId,
|
|
121
|
-
read: (id) => this.readPagePathnameSlice({ pageId: id, locale }),
|
|
122
|
-
fetch: (id) => this.fetchPagePathnameSlice({ pageId: id, locale })
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
resolveResource(type, {
|
|
126
|
-
id,
|
|
127
|
-
read,
|
|
128
|
-
fetch
|
|
129
|
-
}) {
|
|
130
|
-
const _read = () => id != null ? read(id) : null;
|
|
131
|
-
let lastValue = null;
|
|
132
|
-
return {
|
|
133
|
-
name: `${type}:${id}`,
|
|
134
|
-
readStable: () => lastValue = _read(),
|
|
135
|
-
subscribe: (onUpdate) => this.subscribe(() => {
|
|
136
|
-
if (_read() !== lastValue)
|
|
137
|
-
onUpdate();
|
|
138
|
-
}),
|
|
139
|
-
fetch: async () => id != null ? fetch(id) : null
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
readTable(tableId) {
|
|
143
|
-
return ApiClientState.getAPIResource(this.store.getState(), import_types.APIResourceType.Table, tableId);
|
|
144
|
-
}
|
|
145
|
-
readSite(siteId) {
|
|
146
|
-
return ApiClientState.getAPIResource(this.store.getState(), import_types.APIResourceType.Site, siteId);
|
|
147
|
-
}
|
|
148
|
-
readPage(pageId) {
|
|
149
|
-
return ApiClientState.getAPIResource(this.store.getState(), import_types.APIResourceType.Page, pageId);
|
|
150
|
-
}
|
|
151
|
-
readSnippet(snippetId) {
|
|
152
|
-
return ApiClientState.getAPIResource(this.store.getState(), import_types.APIResourceType.Snippet, snippetId);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
-
0 && (module.exports = {
|
|
157
|
-
ApiResourcesClient,
|
|
158
|
-
CacheData
|
|
159
|
-
});
|
|
160
|
-
//# sourceMappingURL=api-resources-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/api/api-resources-client.ts"],"sourcesContent":["import { type FetchableValue } from '@makeswift/controls'\n\nimport { type Store as ApiClientStore } from '../state/api-client/store'\nimport * as ApiClientState from '../state/api-client/state'\n\nimport {\n type File,\n type GlobalElement,\n type LocalizedGlobalElement,\n type Page,\n type PagePathnameSlice,\n type Site,\n type Snippet,\n type Swatch,\n type Table,\n type Typography,\n APIResourceType,\n} from './types'\n\nexport type CacheData = ApiClientState.SerializedState\n\nexport const CacheData = {\n empty(): CacheData {\n return {\n apiResources: {},\n localizedResourcesMap: {},\n }\n },\n}\nexport abstract class ApiResourcesClient {\n readonly store: ApiClientStore\n readonly subscribe: ApiClientStore['subscribe']\n\n constructor({ store }: { store: ApiClientStore }) {\n this.store = store\n this.subscribe = this.store.subscribe\n }\n\n abstract fetchSwatch(swatchId: string): Promise<Swatch | null>\n\n readSwatch(swatchId: string): Swatch | null {\n return ApiClientState.getAPIResource(this.store.getState(), APIResourceType.Swatch, swatchId)\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 abstract fetchFile(fileId: string): Promise<File | null>\n\n readFile(fileId: string): File | null {\n return ApiClientState.getAPIResource(this.store.getState(), APIResourceType.File, fileId)\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 abstract fetchTypography(typographyId: string): Promise<Typography | null>\n\n readTypography(typographyId: string): Typography | null {\n return ApiClientState.getAPIResource(\n this.store.getState(),\n APIResourceType.Typography,\n typographyId,\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 abstract fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null>\n\n readGlobalElement(globalElementId: string): GlobalElement | null {\n return ApiClientState.getAPIResource(\n this.store.getState(),\n APIResourceType.GlobalElement,\n globalElementId,\n )\n }\n\n abstract fetchLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): Promise<LocalizedGlobalElement | null>\n\n readLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): LocalizedGlobalElement | null {\n return ApiClientState.getAPIResource(\n this.store.getState(),\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n locale,\n )\n }\n\n readPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): PagePathnameSlice | null {\n return ApiClientState.getAPIResource(\n this.store.getState(),\n APIResourceType.PagePathnameSlice,\n pageId,\n locale,\n )\n }\n\n abstract fetchPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): Promise<PagePathnameSlice | null>\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 abstract fetchTable(tableId: string): Promise<Table | null>\n\n readTable(tableId: string): Table | null {\n return ApiClientState.getAPIResource(this.store.getState(), APIResourceType.Table, tableId)\n }\n\n readSite(siteId: string): Site | null {\n return ApiClientState.getAPIResource(this.store.getState(), APIResourceType.Site, siteId)\n }\n\n readPage(pageId: string): Page | null {\n return ApiClientState.getAPIResource(this.store.getState(), APIResourceType.Page, pageId)\n }\n\n readSnippet(snippetId: string): Snippet | null {\n return ApiClientState.getAPIResource(this.store.getState(), APIResourceType.Snippet, snippetId)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAgC;AAEhC,mBAYO;AAIA,MAAM,YAAY;AAAA,EACvB,QAAmB;AACjB,WAAO;AAAA,MACL,cAAc,CAAC;AAAA,MACf,uBAAuB,CAAC;AAAA,IAC1B;AAAA,EACF;AACF;AACO,MAAe,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAA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AAS,QAA6B;AACpC,WAAO,eAAe,eAAe,KAAK,MAAM,SAAS,GAAG,6BAAgB,MAAM,MAAM;AAAA,EAC1F;AAAA,EAEA,YAAY,WAAmC;AAC7C,WAAO,eAAe,eAAe,KAAK,MAAM,SAAS,GAAG,6BAAgB,SAAS,SAAS;AAAA,EAChG;AACF;","names":[]}
|
package/dist/cjs/api/react.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
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 react_exports = {};
|
|
30
|
-
__export(react_exports, {
|
|
31
|
-
CacheData: () => CacheData,
|
|
32
|
-
MakeswiftHostApiClient: () => MakeswiftHostApiClient
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(react_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
|
-
cacheData,
|
|
56
|
-
locale
|
|
57
|
-
}) {
|
|
58
|
-
this.graphqlClient = new import_client.GraphQLClient(uri);
|
|
59
|
-
this.makeswiftApiClient = MakeswiftApiClient.configureStore({
|
|
60
|
-
serializedState: cacheData,
|
|
61
|
-
defaultLocale: locale
|
|
62
|
-
});
|
|
63
|
-
this.fetch = fetch;
|
|
64
|
-
this.subscribe = this.makeswiftApiClient.subscribe;
|
|
65
|
-
}
|
|
66
|
-
readSwatch(swatchId) {
|
|
67
|
-
return MakeswiftApiClient.getAPIResource(
|
|
68
|
-
this.makeswiftApiClient.getState(),
|
|
69
|
-
import_types.APIResourceType.Swatch,
|
|
70
|
-
swatchId
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
async fetchSwatch(swatchId) {
|
|
74
|
-
return await this.makeswiftApiClient.dispatch(
|
|
75
|
-
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.Swatch, swatchId, this.fetch)
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
resolveSwatch(swatchId) {
|
|
79
|
-
return this.resolveResource(import_types.APIResourceType.Swatch, {
|
|
80
|
-
id: swatchId,
|
|
81
|
-
read: (id) => this.readSwatch(id),
|
|
82
|
-
fetch: (id) => this.fetchSwatch(id)
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
readFile(fileId) {
|
|
86
|
-
return MakeswiftApiClient.getAPIResource(
|
|
87
|
-
this.makeswiftApiClient.getState(),
|
|
88
|
-
import_types.APIResourceType.File,
|
|
89
|
-
fileId
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
async fetchFile(fileId) {
|
|
93
|
-
return await this.makeswiftApiClient.dispatch(
|
|
94
|
-
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.File, fileId, this.fetch)
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
resolveFile(fileId) {
|
|
98
|
-
return this.resolveResource(import_types.APIResourceType.File, {
|
|
99
|
-
id: fileId,
|
|
100
|
-
read: (id) => this.readFile(id),
|
|
101
|
-
fetch: (id) => this.fetchFile(id)
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
readTypography(typographyId) {
|
|
105
|
-
return MakeswiftApiClient.getAPIResource(
|
|
106
|
-
this.makeswiftApiClient.getState(),
|
|
107
|
-
import_types.APIResourceType.Typography,
|
|
108
|
-
typographyId
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
async fetchTypography(typographyId) {
|
|
112
|
-
return await this.makeswiftApiClient.dispatch(
|
|
113
|
-
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.Typography, typographyId, this.fetch)
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
resolveTypography(typographyId) {
|
|
117
|
-
return this.resolveResource(import_types.APIResourceType.Typography, {
|
|
118
|
-
id: typographyId,
|
|
119
|
-
read: (id) => this.readTypography(id),
|
|
120
|
-
fetch: (id) => this.fetchTypography(id)
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
readGlobalElement(globalElementId) {
|
|
124
|
-
return MakeswiftApiClient.getAPIResource(
|
|
125
|
-
this.makeswiftApiClient.getState(),
|
|
126
|
-
import_types.APIResourceType.GlobalElement,
|
|
127
|
-
globalElementId
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
async fetchGlobalElement(globalElementId) {
|
|
131
|
-
return await this.makeswiftApiClient.dispatch(
|
|
132
|
-
MakeswiftApiClient.fetchAPIResource(
|
|
133
|
-
import_types.APIResourceType.GlobalElement,
|
|
134
|
-
globalElementId,
|
|
135
|
-
this.fetch
|
|
136
|
-
)
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
readLocalizedGlobalElement({
|
|
140
|
-
globalElementId,
|
|
141
|
-
locale
|
|
142
|
-
}) {
|
|
143
|
-
return MakeswiftApiClient.getAPIResource(
|
|
144
|
-
this.makeswiftApiClient.getState(),
|
|
145
|
-
import_types.APIResourceType.LocalizedGlobalElement,
|
|
146
|
-
globalElementId,
|
|
147
|
-
locale
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
async fetchLocalizedGlobalElement({
|
|
151
|
-
globalElementId,
|
|
152
|
-
locale
|
|
153
|
-
}) {
|
|
154
|
-
return await this.makeswiftApiClient.dispatch(
|
|
155
|
-
MakeswiftApiClient.fetchAPIResource(
|
|
156
|
-
import_types.APIResourceType.LocalizedGlobalElement,
|
|
157
|
-
globalElementId,
|
|
158
|
-
this.fetch,
|
|
159
|
-
locale
|
|
160
|
-
)
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
readPagePathnameSlice({
|
|
164
|
-
pageId,
|
|
165
|
-
locale
|
|
166
|
-
}) {
|
|
167
|
-
return MakeswiftApiClient.getAPIResource(
|
|
168
|
-
this.makeswiftApiClient.getState(),
|
|
169
|
-
import_types.APIResourceType.PagePathnameSlice,
|
|
170
|
-
pageId,
|
|
171
|
-
locale
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
async fetchPagePathnameSlice({
|
|
175
|
-
pageId,
|
|
176
|
-
locale
|
|
177
|
-
}) {
|
|
178
|
-
return await this.makeswiftApiClient.dispatch(
|
|
179
|
-
MakeswiftApiClient.fetchAPIResource(
|
|
180
|
-
import_types.APIResourceType.PagePathnameSlice,
|
|
181
|
-
pageId,
|
|
182
|
-
this.fetch,
|
|
183
|
-
locale
|
|
184
|
-
)
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
resolvePagePathnameSlice({
|
|
188
|
-
pageId,
|
|
189
|
-
locale
|
|
190
|
-
}) {
|
|
191
|
-
return this.resolveResource(import_types.APIResourceType.PagePathnameSlice, {
|
|
192
|
-
id: pageId,
|
|
193
|
-
read: (id) => this.readPagePathnameSlice({ pageId: id, locale }),
|
|
194
|
-
fetch: (id) => this.fetchPagePathnameSlice({ pageId: id, locale })
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
resolveResource(type, {
|
|
198
|
-
id,
|
|
199
|
-
read,
|
|
200
|
-
fetch
|
|
201
|
-
}) {
|
|
202
|
-
const _read = () => id != null ? read(id) : null;
|
|
203
|
-
let lastValue = null;
|
|
204
|
-
return {
|
|
205
|
-
name: `${type}:${id}`,
|
|
206
|
-
readStable: () => lastValue = _read(),
|
|
207
|
-
subscribe: (onUpdate) => this.subscribe(() => {
|
|
208
|
-
if (_read() !== lastValue)
|
|
209
|
-
onUpdate();
|
|
210
|
-
}),
|
|
211
|
-
fetch: async () => id != null ? fetch(id) : null
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
readTable(tableId) {
|
|
215
|
-
return MakeswiftApiClient.getAPIResource(
|
|
216
|
-
this.makeswiftApiClient.getState(),
|
|
217
|
-
import_types.APIResourceType.Table,
|
|
218
|
-
tableId
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
async fetchTable(tableId) {
|
|
222
|
-
return await this.makeswiftApiClient.dispatch(
|
|
223
|
-
MakeswiftApiClient.fetchAPIResource(import_types.APIResourceType.Table, tableId, this.fetch)
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
async createTableRecord(tableId, columns) {
|
|
227
|
-
await this.graphqlClient.request(import_documents.CreateTableRecordMutation, { input: { data: { tableId, columns } } });
|
|
228
|
-
}
|
|
229
|
-
readSite(siteId) {
|
|
230
|
-
return MakeswiftApiClient.getAPIResource(
|
|
231
|
-
this.makeswiftApiClient.getState(),
|
|
232
|
-
import_types.APIResourceType.Site,
|
|
233
|
-
siteId
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
readPage(pageId) {
|
|
237
|
-
return MakeswiftApiClient.getAPIResource(
|
|
238
|
-
this.makeswiftApiClient.getState(),
|
|
239
|
-
import_types.APIResourceType.Page,
|
|
240
|
-
pageId
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
readSnippet(snippetId) {
|
|
244
|
-
return MakeswiftApiClient.getAPIResource(
|
|
245
|
-
this.makeswiftApiClient.getState(),
|
|
246
|
-
import_types.APIResourceType.Snippet,
|
|
247
|
-
snippetId
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
252
|
-
0 && (module.exports = {
|
|
253
|
-
CacheData,
|
|
254
|
-
MakeswiftHostApiClient
|
|
255
|
-
});
|
|
256
|
-
//# sourceMappingURL=react.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/api/react.ts"],"sourcesContent":["import { type FetchableValue } from '@makeswift/controls'\nimport * as MakeswiftApiClient from '../state/makeswift-api-client'\nimport {\n APIResourceType,\n File,\n GlobalElement,\n LocalizedGlobalElement,\n Page,\n PagePathnameSlice,\n Site,\n Snippet,\n Swatch,\n Table,\n Typography,\n} from './types'\nimport { GraphQLClient } from './graphql/client'\nimport { CreateTableRecordMutation } from './graphql/documents'\nimport {\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables,\n} from './graphql/generated/types'\n\nexport type CacheData = MakeswiftApiClient.SerializedState\n\nexport const CacheData = {\n empty(): CacheData {\n return {\n apiResources: {},\n localizedResourcesMap: {},\n }\n },\n}\n\n/**\n * NOTE(miguel): This \"client\" is used to fetch Makeswift API resources needed for the host. For\n * example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only\n * used by controls to transform API references to API resources.\n *\n * Moreover, its use should be reserved for the builder only, since for live pages all Makeswift\n * API resources should be embedded in the \"page snapshot\". In the builder, this client serves the\n * purpose of sending requests for API resources and keeping a cache so that changes that happen in\n * the builder, like modifying a swatch, can be sent via `postMessage` to the host and the cache can\n * immediately update the value and re-render.\n *\n * Furthermore, the API resources requested shouldn't be requested directly from the Makeswift API\n * as that would require those resources to not be authenticated since the requests come from the\n * browser when running the host. Instead, the requests should go to the host directly, at the\n * Makeswift API endpoint (i.g., `/api/makeswift/[...makeswift]` dynamic route) where the host's\n * API key can be used, securely, in the server. For this reason, this client should really be a\n * client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime\n * snapshot for use in the builder, not the lives pages.\n */\nexport class MakeswiftHostApiClient {\n graphqlClient: GraphQLClient\n makeswiftApiClient: MakeswiftApiClient.Store\n subscribe: MakeswiftApiClient.Store['subscribe']\n fetch: MakeswiftApiClient.HttpFetch\n\n constructor({\n uri,\n fetch,\n cacheData,\n locale,\n }: {\n uri: string\n fetch: MakeswiftApiClient.HttpFetch\n cacheData?: CacheData\n locale?: string\n }) {\n this.graphqlClient = new GraphQLClient(uri)\n this.makeswiftApiClient = MakeswiftApiClient.configureStore({\n serializedState: cacheData,\n defaultLocale: locale,\n })\n this.fetch = fetch\n this.subscribe = this.makeswiftApiClient.subscribe\n }\n\n readSwatch(swatchId: string): Swatch | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Swatch,\n swatchId,\n )\n }\n\n async fetchSwatch(swatchId: string): Promise<Swatch | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Swatch, swatchId, this.fetch),\n )\n }\n\n resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null> {\n return this.resolveResource(APIResourceType.Swatch, {\n id: swatchId,\n read: id => this.readSwatch(id),\n fetch: id => this.fetchSwatch(id),\n })\n }\n\n readFile(fileId: string): File | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.File,\n fileId,\n )\n }\n\n async fetchFile(fileId: string): Promise<File | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.File, fileId, this.fetch),\n )\n }\n\n resolveFile(fileId: string | undefined): FetchableValue<File | null> {\n return this.resolveResource(APIResourceType.File, {\n id: fileId,\n read: id => this.readFile(id),\n fetch: id => this.fetchFile(id),\n })\n }\n\n readTypography(typographyId: string): Typography | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Typography,\n typographyId,\n )\n }\n\n async fetchTypography(typographyId: string): Promise<Typography | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Typography, typographyId, this.fetch),\n )\n }\n\n resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null> {\n return this.resolveResource(APIResourceType.Typography, {\n id: typographyId,\n read: id => this.readTypography(id),\n fetch: id => this.fetchTypography(id),\n })\n }\n\n readGlobalElement(globalElementId: string): GlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.GlobalElement,\n globalElementId,\n )\n }\n\n async fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.GlobalElement,\n globalElementId,\n this.fetch,\n ),\n )\n }\n\n readLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): LocalizedGlobalElement | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n locale,\n )\n }\n\n async fetchLocalizedGlobalElement({\n globalElementId,\n locale,\n }: {\n globalElementId: string\n locale: string\n }): Promise<LocalizedGlobalElement | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.LocalizedGlobalElement,\n globalElementId,\n this.fetch,\n locale,\n ),\n )\n }\n\n readPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): PagePathnameSlice | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.PagePathnameSlice,\n pageId,\n locale,\n )\n }\n\n async fetchPagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string\n locale: string | null\n }): Promise<PagePathnameSlice | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(\n APIResourceType.PagePathnameSlice,\n pageId,\n this.fetch,\n locale,\n ),\n )\n }\n\n resolvePagePathnameSlice({\n pageId,\n locale,\n }: {\n pageId: string | undefined\n locale: string | null\n }): FetchableValue<PagePathnameSlice | null> {\n return this.resolveResource(APIResourceType.PagePathnameSlice, {\n id: pageId,\n read: id => this.readPagePathnameSlice({ pageId: id, locale }),\n fetch: id => this.fetchPagePathnameSlice({ pageId: id, locale }),\n })\n }\n\n resolveResource<R>(\n type: APIResourceType,\n {\n id,\n read,\n fetch,\n }: {\n id: string | undefined\n read: (id: string) => R | null\n fetch: (id: string) => Promise<R | null>\n },\n ): FetchableValue<R | null> {\n const _read = () => (id != null ? read(id) : null)\n let lastValue: R | null = null\n return {\n name: `${type}:${id}`,\n readStable: () => (lastValue = _read()),\n subscribe: (onUpdate: () => void) =>\n this.subscribe(() => {\n if (_read() !== lastValue) onUpdate()\n }),\n fetch: async () => (id != null ? fetch(id) : null),\n }\n }\n\n readTable(tableId: string): Table | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Table,\n tableId,\n )\n }\n\n async fetchTable(tableId: string): Promise<Table | null> {\n return await this.makeswiftApiClient.dispatch(\n MakeswiftApiClient.fetchAPIResource(APIResourceType.Table, tableId, this.fetch),\n )\n }\n\n async createTableRecord(tableId: string, columns: any): Promise<void> {\n await this.graphqlClient.request<\n CreateTableRecordMutationResult,\n CreateTableRecordMutationVariables\n >(CreateTableRecordMutation, { input: { data: { tableId, columns } } })\n }\n\n readSite(siteId: string): Site | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Site,\n siteId,\n )\n }\n\n readPage(pageId: string): Page | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Page,\n pageId,\n )\n }\n\n readSnippet(snippetId: string): Snippet | null {\n return MakeswiftApiClient.getAPIResource(\n this.makeswiftApiClient.getState(),\n APIResourceType.Snippet,\n snippetId,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAoC;AACpC,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,IACA;AAAA,EACF,GAKG;AACD,SAAK,gBAAgB,IAAI,4BAAc,GAAG;AAC1C,SAAK,qBAAqB,mBAAmB,eAAe;AAAA,MAC1D,iBAAiB;AAAA,MACjB,eAAe;AAAA,IACjB,CAAC;AACD,SAAK,QAAQ;AACb,SAAK,YAAY,KAA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AAE,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":[]}
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
package/dist/cjs/box-model.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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 box_model_exports = {};
|
|
20
|
-
__export(box_model_exports, {
|
|
21
|
-
createBox: () => import_box_models.createBox,
|
|
22
|
-
getBox: () => import_box_models.getBox,
|
|
23
|
-
parse: () => import_box_models.parse
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(box_model_exports);
|
|
26
|
-
var import_box_models = require("./state/modules/box-models");
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
createBox,
|
|
30
|
-
getBox,
|
|
31
|
-
parse
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=box-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/box-model.ts"],"sourcesContent":["export { createBox, getBox, parse } from './state/modules/box-models'\nexport type { BoxModelHandle, BoxModel } from './state/modules/box-models'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAyC;","names":[]}
|