@makeswift/runtime 0.28.7-canary.2 → 0.28.7-canary.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/api-resources-client.js +160 -0
- package/dist/cjs/api/api-resources-client.js.map +1 -0
- package/dist/cjs/api/client.js +20 -190
- package/dist/cjs/api/client.js.map +1 -1
- package/dist/cjs/api/graphql-api-client.js +39 -0
- package/dist/cjs/api/graphql-api-client.js.map +1 -0
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/client/index.js +3 -3
- package/dist/cjs/components/builtin/Form/Form.js +2 -2
- package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
- package/dist/cjs/controls/index.js +2 -2
- package/dist/cjs/controls/index.js.map +1 -1
- package/dist/cjs/next/fetch.js.map +1 -1
- package/dist/cjs/runtimes/react/components/GoogleFontLink.js +2 -2
- package/dist/cjs/runtimes/react/components/GoogleFontLink.js.map +1 -1
- package/dist/cjs/runtimes/react/components/hooks/use-page-snippets.js +2 -2
- package/dist/cjs/runtimes/react/components/hooks/use-page-snippets.js.map +1 -1
- package/dist/cjs/runtimes/react/components/page/PageHead.js +2 -2
- package/dist/cjs/runtimes/react/components/page/PageHead.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/makeswift-api.js +10 -10
- package/dist/cjs/runtimes/react/hooks/makeswift-api.js.map +1 -1
- package/dist/cjs/runtimes/react/{host-api-client.js → hooks/use-api-resources-client.js} +9 -9
- package/dist/cjs/runtimes/react/hooks/use-api-resources-client.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-cache-data.js +2 -2
- package/dist/cjs/runtimes/react/hooks/use-cache-data.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-graphql-api-client.js +35 -0
- package/dist/cjs/runtimes/react/hooks/use-graphql-api-client.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js +13 -34
- package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
- package/dist/cjs/runtimes/react/resource-resolver.js +52 -0
- package/dist/cjs/runtimes/react/resource-resolver.js.map +1 -0
- package/dist/cjs/runtimes/react/runtime-core.js +11 -6
- package/dist/cjs/runtimes/react/runtime-core.js.map +1 -1
- package/dist/cjs/slate/InlinePlugin/index.js +1 -1
- package/dist/cjs/slate/InlinePlugin/index.js.map +1 -1
- package/dist/cjs/slate/InlinePlugin/types.js +3 -3
- package/dist/cjs/slate/InlinePlugin/types.js.map +1 -1
- package/dist/cjs/slate/TextAlignPlugin/index.js +5 -5
- package/dist/cjs/slate/TextAlignPlugin/index.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/cjs/state/api-client/client-store.js +81 -0
- package/dist/cjs/state/api-client/client-store.js.map +1 -0
- package/dist/cjs/state/{makeswift-api-client.js → api-client/fetch-api-resource.js} +15 -101
- package/dist/cjs/state/api-client/fetch-api-resource.js.map +1 -0
- package/dist/cjs/state/api-client/state.js +89 -0
- package/dist/cjs/state/api-client/state.js.map +1 -0
- package/dist/cjs/state/api-client/store.js +36 -0
- package/dist/cjs/state/api-client/store.js.map +1 -0
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js +1 -1
- package/dist/cjs/state/middleware/makeswift-api-client-sync.js.map +1 -1
- package/dist/cjs/state/store.js +3 -3
- package/dist/cjs/state/store.js.map +1 -1
- package/dist/esm/api/api-resources-client.js +127 -0
- package/dist/esm/api/api-resources-client.js.map +1 -0
- package/dist/esm/api/client.js +19 -179
- package/dist/esm/api/client.js.map +1 -1
- package/dist/esm/api/graphql-api-client.js +15 -0
- package/dist/esm/api/graphql-api-client.js.map +1 -0
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/components/builtin/Form/Form.js +2 -2
- package/dist/esm/components/builtin/Form/Form.js.map +1 -1
- package/dist/esm/controls/index.js +2 -2
- package/dist/esm/controls/index.js.map +1 -1
- package/dist/esm/next/fetch.js.map +1 -1
- package/dist/esm/runtimes/react/components/GoogleFontLink.js +2 -2
- package/dist/esm/runtimes/react/components/GoogleFontLink.js.map +1 -1
- package/dist/esm/runtimes/react/components/hooks/use-page-snippets.js +2 -2
- package/dist/esm/runtimes/react/components/hooks/use-page-snippets.js.map +1 -1
- package/dist/esm/runtimes/react/components/page/PageHead.js +2 -2
- package/dist/esm/runtimes/react/components/page/PageHead.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/makeswift-api.js +10 -10
- package/dist/esm/runtimes/react/hooks/makeswift-api.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-api-resources-client.js +9 -0
- package/dist/esm/runtimes/react/hooks/use-api-resources-client.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-cache-data.js +2 -2
- package/dist/esm/runtimes/react/hooks/use-cache-data.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-graphql-api-client.js +11 -0
- package/dist/esm/runtimes/react/hooks/use-graphql-api-client.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-resource-resolver.js +13 -24
- package/dist/esm/runtimes/react/hooks/use-resource-resolver.js.map +1 -1
- package/dist/esm/runtimes/react/resource-resolver.js +28 -0
- package/dist/esm/runtimes/react/resource-resolver.js.map +1 -0
- package/dist/esm/runtimes/react/runtime-core.js +11 -6
- package/dist/esm/runtimes/react/runtime-core.js.map +1 -1
- package/dist/esm/slate/InlinePlugin/index.js +2 -2
- package/dist/esm/slate/InlinePlugin/index.js.map +1 -1
- package/dist/esm/slate/InlinePlugin/types.js +4 -4
- package/dist/esm/slate/InlinePlugin/types.js.map +1 -1
- package/dist/esm/slate/TextAlignPlugin/index.js +6 -6
- package/dist/esm/slate/TextAlignPlugin/index.js.map +1 -1
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/esm/state/api-client/client-store.js +49 -0
- package/dist/esm/state/api-client/client-store.js.map +1 -0
- package/dist/esm/state/api-client/fetch-api-resource.js +93 -0
- package/dist/esm/state/api-client/fetch-api-resource.js.map +1 -0
- package/dist/esm/state/api-client/state.js +52 -0
- package/dist/esm/state/api-client/state.js.map +1 -0
- package/dist/esm/state/api-client/store.js +12 -0
- package/dist/esm/state/api-client/store.js.map +1 -0
- package/dist/esm/state/middleware/makeswift-api-client-sync.js +1 -1
- package/dist/esm/state/middleware/makeswift-api-client-sync.js.map +1 -1
- package/dist/esm/state/store.js +3 -3
- package/dist/esm/state/store.js.map +1 -1
- package/dist/types/api/api-resources-client.d.ts +57 -0
- package/dist/types/api/api-resources-client.d.ts.map +1 -0
- package/dist/types/api/client.d.ts +10 -46
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/api/graphql-api-client.d.ts +9 -0
- package/dist/types/api/graphql-api-client.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +9 -9
- package/dist/types/controls/index.d.ts +1 -1
- package/dist/types/controls/index.d.ts.map +1 -1
- package/dist/types/next/fetch.d.ts +1 -1
- package/dist/types/next/fetch.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/GoogleFontLink.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/page/PageHead.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-api-resources-client.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-api-resources-client.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-graphql-api-client.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-graphql-api-client.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-resource-resolver.d.ts.map +1 -1
- package/dist/types/runtimes/react/resource-resolver.d.ts +10 -0
- package/dist/types/runtimes/react/resource-resolver.d.ts.map +1 -0
- package/dist/types/runtimes/react/runtime-core.d.ts +5 -3
- package/dist/types/runtimes/react/runtime-core.d.ts.map +1 -1
- package/dist/types/slate/InlinePlugin/types.d.ts +3 -3
- package/dist/types/slate/InlinePlugin/types.d.ts.map +1 -1
- package/dist/types/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-write-actions.d.ts +1 -1
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
- package/dist/types/state/api-client/client-store.d.ts +6 -0
- package/dist/types/state/api-client/client-store.d.ts.map +1 -0
- package/dist/types/state/api-client/fetch-api-resource.d.ts +11 -0
- package/dist/types/state/api-client/fetch-api-resource.d.ts.map +1 -0
- package/dist/types/state/api-client/state.d.ts +30 -0
- package/dist/types/state/api-client/state.d.ts.map +1 -0
- package/dist/types/state/api-client/store.d.ts +18 -0
- package/dist/types/state/api-client/store.d.ts.map +1 -0
- package/dist/types/state/middleware/makeswift-api-client-sync.d.ts +2 -2
- package/dist/types/state/middleware/makeswift-api-client-sync.d.ts.map +1 -1
- package/dist/types/state/store.d.ts +4 -4
- package/dist/types/state/store.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/runtimes/react/host-api-client.js.map +0 -1
- package/dist/cjs/state/makeswift-api-client.js.map +0 -1
- package/dist/esm/runtimes/react/host-api-client.js +0 -9
- package/dist/esm/runtimes/react/host-api-client.js.map +0 -1
- package/dist/esm/state/makeswift-api-client.js +0 -179
- package/dist/esm/state/makeswift-api-client.js.map +0 -1
- package/dist/types/runtimes/react/host-api-client.d.ts +0 -3
- package/dist/types/runtimes/react/host-api-client.d.ts.map +0 -1
- package/dist/types/state/makeswift-api-client.d.ts +0 -51
- package/dist/types/state/makeswift-api-client.d.ts.map +0 -1
package/dist/esm/state/store.js
CHANGED
|
@@ -94,7 +94,7 @@ function withMixin(mixin) {
|
|
|
94
94
|
function configureReadWriteStore({
|
|
95
95
|
name,
|
|
96
96
|
appOrigin,
|
|
97
|
-
|
|
97
|
+
apiResourcesClient,
|
|
98
98
|
preloadedState
|
|
99
99
|
}) {
|
|
100
100
|
const readWriteMiddlewareRef = {
|
|
@@ -138,7 +138,7 @@ function configureReadWriteStore({
|
|
|
138
138
|
name,
|
|
139
139
|
preloadedState,
|
|
140
140
|
middleware: () => [
|
|
141
|
-
makeswiftApiClientSyncMiddleware(
|
|
141
|
+
makeswiftApiClientSyncMiddleware(apiResourcesClient),
|
|
142
142
|
conditionalReadWriteMiddleware(readWriteMiddlewareRef)
|
|
143
143
|
],
|
|
144
144
|
enhancers: () => new Tuple(
|
|
@@ -150,7 +150,7 @@ function configureReadWriteStore({
|
|
|
150
150
|
})
|
|
151
151
|
),
|
|
152
152
|
withMixin({
|
|
153
|
-
|
|
153
|
+
apiResourcesClient,
|
|
154
154
|
loadReadWriteStateIfNeeded: async () => {
|
|
155
155
|
const { isReadOnly } = store.getState();
|
|
156
156
|
if (isReadOnly) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/store.ts"],"sourcesContent":["import {\n type Middleware,\n type StoreEnhancer,\n type MiddlewareAPI,\n Tuple,\n configureStore as configureReduxStore,\n combineReducers,\n compose,\n} from '@reduxjs/toolkit'\n\nimport { MakeswiftHostApiClient } from '../api/client'\n\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from './toolkit'\nimport { BuilderActionTypes } from './builder-api/actions'\nimport { HostActionTypes } from './host-api'\n\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { readOnlyElementTreeMiddleware } from './middleware/read-only-element-tree'\nimport { makeswiftApiClientSyncMiddleware } from './middleware/makeswift-api-client-sync'\nimport { type BreakpointWatch, breakpointWatchMixin } from './mixins/breakpoint-watch'\n\nimport { type Action } from './actions'\n\nimport { type State as ReadWriteState } from './read-write-state'\nimport * as ReadOnlyState from './read-only-state'\nimport {\n type State,\n type Dispatch,\n type ReadOnlyReducer,\n type ReadWriteDispatch,\n} from './unified-state'\n\nexport { type State } from './unified-state'\n\nconst configureStore = <Items extends readonly StoreEnhancer[] = []>({\n name,\n preloadedState,\n enhancers,\n middleware,\n}: {\n name: string\n preloadedState: Partial<State>\n enhancers: () => Tuple<Items>\n middleware?: () => Middleware[]\n}) => {\n const store = configureReduxStore({\n reducer: combineReducers(ReadOnlyState.reducers),\n preloadedState,\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat([\n readOnlyElementTreeMiddleware(),\n ...(middleware ? middleware() : []),\n ]),\n\n enhancers: getDefaultEnhancers => getDefaultEnhancers().concat(enhancers()),\n\n devTools: devToolsConfig({\n name: `${name} (${new Date().toISOString()})`,\n actionsDenylist: [\n HostActionTypes.BUILDER_POINTER_MOVE,\n BuilderActionTypes.HANDLE_POINTER_MOVE,\n BuilderActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n\n return store\n}\n\nexport function configureProtoStore({\n name,\n breakpoints,\n}: {\n name: string\n breakpoints: Breakpoints.Breakpoints | undefined\n}) {\n return configureStore({\n name,\n preloadedState: {\n breakpoints: Breakpoints.getInitialState(breakpoints),\n },\n enhancers: () => new Tuple(),\n })\n}\n\nexport type ProtoStore = ReturnType<typeof configureProtoStore>\n\ntype ReadWriteMiddleware = ReturnType<\n typeof import('./middleware/read-write').createReadWriteMiddleware\n>\n\ntype ReadWriteMiddlewareRef = {\n current: ReadWriteMiddleware | null\n}\n\nexport function conditionalReadWriteMiddleware(\n middlewareRef: ReadWriteMiddlewareRef,\n): Middleware<Dispatch, State, Dispatch> {\n let readWriteActionBuffer: Action[] = []\n let middlewares: ReadWriteMiddleware | null = null\n let enhancedDispatch: Dispatch | null = null\n\n return actionMiddleware(({ dispatch, getState }) => next => {\n return (action: Action) => {\n const state = getState()\n\n if (middlewareRef.current == null) {\n if (!state.isReadOnly) {\n // because switching to the read-write state is an asynchronous operation,\n // we need to buffer all actions dispatched after the isReadOnly state is\n // set to false but before the read-write middleware is installed\n readWriteActionBuffer.push(action)\n }\n\n return next(action)\n }\n\n if (state.isReadOnly) {\n console.error('Read-write state mismatch', {\n isReadOnly: state.isReadOnly,\n middlewareRef: middlewareRef.current,\n siteVersion: state.siteVersion,\n })\n }\n\n // build and cache the enhanced dispatch chain when read-write middleware is installed\n if (enhancedDispatch == null || middlewares !== middlewareRef.current) {\n middlewares = middlewareRef.current\n\n const middlewareApi = { dispatch, getState } as MiddlewareAPI<\n ReadWriteDispatch,\n ReadWriteState\n >\n\n enhancedDispatch = compose<Dispatch>(...middlewares.map(mw => mw(middlewareApi)))(next)\n }\n\n // dispatch buffered actions, if any\n if (readWriteActionBuffer.length > 0) {\n const readWriteActions = [...readWriteActionBuffer]\n readWriteActionBuffer = []\n\n // Note that we're rerunning the actions through the entire middleware chain,\n // including the read-only middleware and the reducers, some of which have\n // already processed these actions once. This is safe to do because actions that\n // are run as part of page initialization are idempotent.\n for (const bufferedAction of readWriteActions) {\n enhancedDispatch(bufferedAction)\n }\n }\n\n return enhancedDispatch(action)\n }\n })\n}\n\nexport interface ReadWriteStateMixin {\n readonly hostApiClient: MakeswiftHostApiClient\n\n loadReadWriteStateIfNeeded(): Promise<() => void>\n}\n\nfunction withMixin<M extends {}>(mixin: M): StoreEnhancer<M> {\n return next => (reducer, preloadedState?) => ({\n ...next(reducer, preloadedState),\n ...mixin,\n })\n}\n\nexport function configureReadWriteStore({\n name,\n appOrigin,\n hostApiClient,\n preloadedState,\n}: {\n name: string\n appOrigin: string\n hostApiClient: MakeswiftHostApiClient\n preloadedState: Partial<State>\n}) {\n const readWriteMiddlewareRef: ReadWriteMiddlewareRef = {\n current: null,\n }\n\n let refCount = 0\n let readWriteCleanup: (() => void) | null = null\n let readWriteSetupPromise: Promise<void> | null = null\n\n const loadReadWriteState = async (): Promise<void> => {\n if (readWriteCleanup != null) {\n return\n }\n\n if (readWriteSetupPromise != null) {\n await readWriteSetupPromise\n return\n }\n\n readWriteSetupPromise = (async () => {\n // import all the modules needed for read-write mode before proceeding with\n // the setup to avoid race conditions when `setup` is called concurrently\n // in two different page regions\n const { BuilderAPIProxy } = await import('./builder-api/proxy')\n const { createRootReducer, setupBuilderProxy } = await import('./read-write-state')\n const { createReadWriteMiddleware } = await import('./middleware/read-write')\n\n // IMPORTANT: only synchronous code after this point\n\n // with all modules imported, check if another concurrent setup already\n // initialized the read-write middleware\n if (readWriteMiddlewareRef.current != null) {\n return\n }\n\n store.replaceReducer(createRootReducer() as ReadOnlyReducer)\n\n const builderProxy = new BuilderAPIProxy({ appOrigin })\n readWriteMiddlewareRef.current = createReadWriteMiddleware({ builderProxy })\n\n const dispatch = store.dispatch as ReadWriteDispatch\n const builderProxyCleanup = dispatch(setupBuilderProxy(builderProxy))\n\n readWriteCleanup = () => {\n readWriteMiddlewareRef.current = null\n builderProxyCleanup()\n }\n })()\n\n try {\n await readWriteSetupPromise\n } finally {\n readWriteSetupPromise = null\n }\n }\n\n const store = configureStore({\n name,\n preloadedState,\n\n middleware: () => [\n makeswiftApiClientSyncMiddleware(hostApiClient),\n conditionalReadWriteMiddleware(readWriteMiddlewareRef),\n ],\n\n enhancers: () =>\n new Tuple(\n withMixin<BreakpointWatch>(\n breakpointWatchMixin({\n dispatch: (...args: Parameters<Dispatch>) => store.dispatch(...args),\n getState: (): State => store.getState(),\n subscribe: (listener): VoidFunction => store.subscribe(listener),\n }),\n ),\n\n withMixin<ReadWriteStateMixin>({\n hostApiClient,\n loadReadWriteStateIfNeeded: async () => {\n const { isReadOnly } = store.getState()\n\n if (isReadOnly) {\n if (refCount > 0) {\n console.error('Read-write state mismatch', { isReadOnly, refCount })\n }\n\n return () => {}\n }\n\n await loadReadWriteState()\n refCount += 1\n\n let didCleanup = false\n return () => {\n if (didCleanup) {\n return\n }\n\n didCleanup = true\n refCount -= 1\n if (refCount === 0 && readWriteCleanup != null) {\n readWriteCleanup()\n readWriteCleanup = null\n }\n }\n },\n }),\n ),\n })\n\n return store\n}\n\nexport type Store = ReturnType<typeof configureReadWriteStore>\n"],"mappings":"AAAA;AAAA,EAIE;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,OACK;AAIP,SAAS,kBAAkB,mBAAmB,sBAAsB;AACpE,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAEhC,YAAY,iBAAiB;AAE7B,SAAS,qCAAqC;AAC9C,SAAS,wCAAwC;AACjD,SAA+B,4BAA4B;A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AAAA,EACJ,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/store.ts"],"sourcesContent":["import {\n type Middleware,\n type StoreEnhancer,\n type MiddlewareAPI,\n Tuple,\n configureStore as configureReduxStore,\n combineReducers,\n compose,\n} from '@reduxjs/toolkit'\n\nimport { ApiResourcesClient } from '../api/api-resources-client'\n\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from './toolkit'\nimport { BuilderActionTypes } from './builder-api/actions'\nimport { HostActionTypes } from './host-api'\n\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { readOnlyElementTreeMiddleware } from './middleware/read-only-element-tree'\nimport { makeswiftApiClientSyncMiddleware } from './middleware/makeswift-api-client-sync'\nimport { type BreakpointWatch, breakpointWatchMixin } from './mixins/breakpoint-watch'\n\nimport { type Action } from './actions'\n\nimport { type State as ReadWriteState } from './read-write-state'\nimport * as ReadOnlyState from './read-only-state'\nimport {\n type State,\n type Dispatch,\n type ReadOnlyReducer,\n type ReadWriteDispatch,\n} from './unified-state'\n\nexport { type State } from './unified-state'\n\nconst configureStore = <Items extends readonly StoreEnhancer[] = []>({\n name,\n preloadedState,\n enhancers,\n middleware,\n}: {\n name: string\n preloadedState: Partial<State>\n enhancers: () => Tuple<Items>\n middleware?: () => Middleware[]\n}) => {\n const store = configureReduxStore({\n reducer: combineReducers(ReadOnlyState.reducers),\n preloadedState,\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat([\n readOnlyElementTreeMiddleware(),\n ...(middleware ? middleware() : []),\n ]),\n\n enhancers: getDefaultEnhancers => getDefaultEnhancers().concat(enhancers()),\n\n devTools: devToolsConfig({\n name: `${name} (${new Date().toISOString()})`,\n actionsDenylist: [\n HostActionTypes.BUILDER_POINTER_MOVE,\n BuilderActionTypes.HANDLE_POINTER_MOVE,\n BuilderActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n\n return store\n}\n\nexport function configureProtoStore({\n name,\n breakpoints,\n}: {\n name: string\n breakpoints: Breakpoints.Breakpoints | undefined\n}) {\n return configureStore({\n name,\n preloadedState: {\n breakpoints: Breakpoints.getInitialState(breakpoints),\n },\n enhancers: () => new Tuple(),\n })\n}\n\nexport type ProtoStore = ReturnType<typeof configureProtoStore>\n\ntype ReadWriteMiddleware = ReturnType<\n typeof import('./middleware/read-write').createReadWriteMiddleware\n>\n\ntype ReadWriteMiddlewareRef = {\n current: ReadWriteMiddleware | null\n}\n\nexport function conditionalReadWriteMiddleware(\n middlewareRef: ReadWriteMiddlewareRef,\n): Middleware<Dispatch, State, Dispatch> {\n let readWriteActionBuffer: Action[] = []\n let middlewares: ReadWriteMiddleware | null = null\n let enhancedDispatch: Dispatch | null = null\n\n return actionMiddleware(({ dispatch, getState }) => next => {\n return (action: Action) => {\n const state = getState()\n\n if (middlewareRef.current == null) {\n if (!state.isReadOnly) {\n // because switching to the read-write state is an asynchronous operation,\n // we need to buffer all actions dispatched after the isReadOnly state is\n // set to false but before the read-write middleware is installed\n readWriteActionBuffer.push(action)\n }\n\n return next(action)\n }\n\n if (state.isReadOnly) {\n console.error('Read-write state mismatch', {\n isReadOnly: state.isReadOnly,\n middlewareRef: middlewareRef.current,\n siteVersion: state.siteVersion,\n })\n }\n\n // build and cache the enhanced dispatch chain when read-write middleware is installed\n if (enhancedDispatch == null || middlewares !== middlewareRef.current) {\n middlewares = middlewareRef.current\n\n const middlewareApi = { dispatch, getState } as MiddlewareAPI<\n ReadWriteDispatch,\n ReadWriteState\n >\n\n enhancedDispatch = compose<Dispatch>(...middlewares.map(mw => mw(middlewareApi)))(next)\n }\n\n // dispatch buffered actions, if any\n if (readWriteActionBuffer.length > 0) {\n const readWriteActions = [...readWriteActionBuffer]\n readWriteActionBuffer = []\n\n // Note that we're rerunning the actions through the entire middleware chain,\n // including the read-only middleware and the reducers, some of which have\n // already processed these actions once. This is safe to do because actions that\n // are run as part of page initialization are idempotent.\n for (const bufferedAction of readWriteActions) {\n enhancedDispatch(bufferedAction)\n }\n }\n\n return enhancedDispatch(action)\n }\n })\n}\n\nexport interface ReadWriteStateMixin {\n readonly apiResourcesClient: ApiResourcesClient\n\n loadReadWriteStateIfNeeded(): Promise<() => void>\n}\n\nfunction withMixin<M extends {}>(mixin: M): StoreEnhancer<M> {\n return next => (reducer, preloadedState?) => ({\n ...next(reducer, preloadedState),\n ...mixin,\n })\n}\n\nexport function configureReadWriteStore({\n name,\n appOrigin,\n apiResourcesClient,\n preloadedState,\n}: {\n name: string\n appOrigin: string\n apiResourcesClient: ApiResourcesClient\n preloadedState: Partial<State>\n}) {\n const readWriteMiddlewareRef: ReadWriteMiddlewareRef = {\n current: null,\n }\n\n let refCount = 0\n let readWriteCleanup: (() => void) | null = null\n let readWriteSetupPromise: Promise<void> | null = null\n\n const loadReadWriteState = async (): Promise<void> => {\n if (readWriteCleanup != null) {\n return\n }\n\n if (readWriteSetupPromise != null) {\n await readWriteSetupPromise\n return\n }\n\n readWriteSetupPromise = (async () => {\n // import all the modules needed for read-write mode before proceeding with\n // the setup to avoid race conditions when `setup` is called concurrently\n // in two different page regions\n const { BuilderAPIProxy } = await import('./builder-api/proxy')\n const { createRootReducer, setupBuilderProxy } = await import('./read-write-state')\n const { createReadWriteMiddleware } = await import('./middleware/read-write')\n\n // IMPORTANT: only synchronous code after this point\n\n // with all modules imported, check if another concurrent setup already\n // initialized the read-write middleware\n if (readWriteMiddlewareRef.current != null) {\n return\n }\n\n store.replaceReducer(createRootReducer() as ReadOnlyReducer)\n\n const builderProxy = new BuilderAPIProxy({ appOrigin })\n readWriteMiddlewareRef.current = createReadWriteMiddleware({ builderProxy })\n\n const dispatch = store.dispatch as ReadWriteDispatch\n const builderProxyCleanup = dispatch(setupBuilderProxy(builderProxy))\n\n readWriteCleanup = () => {\n readWriteMiddlewareRef.current = null\n builderProxyCleanup()\n }\n })()\n\n try {\n await readWriteSetupPromise\n } finally {\n readWriteSetupPromise = null\n }\n }\n\n const store = configureStore({\n name,\n preloadedState,\n\n middleware: () => [\n makeswiftApiClientSyncMiddleware(apiResourcesClient),\n conditionalReadWriteMiddleware(readWriteMiddlewareRef),\n ],\n\n enhancers: () =>\n new Tuple(\n withMixin<BreakpointWatch>(\n breakpointWatchMixin({\n dispatch: (...args: Parameters<Dispatch>) => store.dispatch(...args),\n getState: (): State => store.getState(),\n subscribe: (listener): VoidFunction => store.subscribe(listener),\n }),\n ),\n\n withMixin<ReadWriteStateMixin>({\n apiResourcesClient,\n loadReadWriteStateIfNeeded: async () => {\n const { isReadOnly } = store.getState()\n\n if (isReadOnly) {\n if (refCount > 0) {\n console.error('Read-write state mismatch', { isReadOnly, refCount })\n }\n\n return () => {}\n }\n\n await loadReadWriteState()\n refCount += 1\n\n let didCleanup = false\n return () => {\n if (didCleanup) {\n return\n }\n\n didCleanup = true\n refCount -= 1\n if (refCount === 0 && readWriteCleanup != null) {\n readWriteCleanup()\n readWriteCleanup = null\n }\n }\n },\n }),\n ),\n })\n\n return store\n}\n\nexport type Store = ReturnType<typeof configureReadWriteStore>\n"],"mappings":"AAAA;AAAA,EAIE;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,OACK;AAIP,SAAS,kBAAkB,mBAAmB,sBAAsB;AACpE,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAEhC,YAAY,iBAAiB;AAE7B,SAAS,qCAAqC;AAC9C,SAAS,wCAAwC;AACjD,SAA+B,4BAA4B;AAK3D,YAAY,mBAAmB;AAU/B,MAAM,iBAAiB,CAA8C;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,QAAM,QAAQ,oBAAoB;AAAA,IAChC,SAAS,gBAAgB,cAAc,QAAQ;AAAA,IAC/C;AAAA,IAEA,YAAY,0BACV,qBAAqB,iBAAiB,EAAE,OAAO;AAAA,MAC7C,8BAA8B;AAAA,MAC9B,GAAI,aAAa,WAAW,IAAI,CAAC;AAAA,IACnC,CAAC;AAAA,IAEH,WAAW,yB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F;AAEA,QAAM,QAAQ,eAAe;AAAA,IAC3B;AAAA,IACA;AAAA,IAEA,YAAY,MAAM;AAAA,MAChB,iCAAiC,kBAAkB;AAAA,MACnD,+BAA+B,sBAAsB;AAAA,IACvD;AAAA,IAEA,WAAW,MACT,IAAI;AAAA,MACF;AAAA,QACE,qBAAqB;AAAA,UACnB,UAAU,IAAI,SAA+B,MAAM,SAAS,GAAG,IAAI;AAAA,UACnE,UAAU,MAAa,MAAM,SAAS;AAAA,UACtC,WAAW,CAAC,aAA2B,MAAM,UAAU,QAAQ;AAAA,QACjE,CAAC;AAAA,MACH;AAAA,MAEA,UAA+B;AAAA,QAC7B;AAAA,QACA,4BAA4B,YAAY;AACtC,gBAAM,EAAE,WAAW,IAAI,MAAM,SAAS;AAEtC,cAAI,YAAY;AACd,gBAAI,WAAW,GAAG;AAChB,sBAAQ,MAAM,6BAA6B,EAAE,YAAY,SAAS,CAAC;AAAA,YACrE;AAEA,mBAAO,MAAM;AAAA,YAAC;AAAA,UAChB;AAEA,gBAAM,mBAAmB;AACzB,sBAAY;AAEZ,cAAI,aAAa;AACjB,iBAAO,MAAM;AACX,gBAAI,YAAY;AACd;AAAA,YACF;AAEA,yBAAa;AACb,wBAAY;AACZ,gBAAI,aAAa,KAAK,oBAAoB,MAAM;AAC9C,+BAAiB;AACjB,iCAAmB;AAAA,YACrB;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACJ,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type FetchableValue } from '@makeswift/controls';
|
|
2
|
+
import { type Store as ApiClientStore } from '../state/api-client/store';
|
|
3
|
+
import * as ApiClientState from '../state/api-client/state';
|
|
4
|
+
import { type File, type GlobalElement, type LocalizedGlobalElement, type Page, type PagePathnameSlice, type Site, type Snippet, type Swatch, type Table, type Typography, APIResourceType } from './types';
|
|
5
|
+
export type CacheData = ApiClientState.SerializedState;
|
|
6
|
+
export declare const CacheData: {
|
|
7
|
+
empty(): CacheData;
|
|
8
|
+
};
|
|
9
|
+
export declare abstract class ApiResourcesClient {
|
|
10
|
+
readonly store: ApiClientStore;
|
|
11
|
+
readonly subscribe: ApiClientStore['subscribe'];
|
|
12
|
+
constructor({ store }: {
|
|
13
|
+
store: ApiClientStore;
|
|
14
|
+
});
|
|
15
|
+
abstract fetchSwatch(swatchId: string): Promise<Swatch | null>;
|
|
16
|
+
readSwatch(swatchId: string): Swatch | null;
|
|
17
|
+
resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null>;
|
|
18
|
+
abstract fetchFile(fileId: string): Promise<File | null>;
|
|
19
|
+
readFile(fileId: string): File | null;
|
|
20
|
+
resolveFile(fileId: string | undefined): FetchableValue<File | null>;
|
|
21
|
+
abstract fetchTypography(typographyId: string): Promise<Typography | null>;
|
|
22
|
+
readTypography(typographyId: string): Typography | null;
|
|
23
|
+
resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null>;
|
|
24
|
+
abstract fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null>;
|
|
25
|
+
readGlobalElement(globalElementId: string): GlobalElement | null;
|
|
26
|
+
abstract fetchLocalizedGlobalElement({ globalElementId, locale, }: {
|
|
27
|
+
globalElementId: string;
|
|
28
|
+
locale: string;
|
|
29
|
+
}): Promise<LocalizedGlobalElement | null>;
|
|
30
|
+
readLocalizedGlobalElement({ globalElementId, locale, }: {
|
|
31
|
+
globalElementId: string;
|
|
32
|
+
locale: string;
|
|
33
|
+
}): LocalizedGlobalElement | null;
|
|
34
|
+
readPagePathnameSlice({ pageId, locale, }: {
|
|
35
|
+
pageId: string;
|
|
36
|
+
locale: string | null;
|
|
37
|
+
}): PagePathnameSlice | null;
|
|
38
|
+
abstract fetchPagePathnameSlice({ pageId, locale, }: {
|
|
39
|
+
pageId: string;
|
|
40
|
+
locale: string | null;
|
|
41
|
+
}): Promise<PagePathnameSlice | null>;
|
|
42
|
+
resolvePagePathnameSlice({ pageId, locale, }: {
|
|
43
|
+
pageId: string | undefined;
|
|
44
|
+
locale: string | null;
|
|
45
|
+
}): FetchableValue<PagePathnameSlice | null>;
|
|
46
|
+
resolveResource<R>(type: APIResourceType, { id, read, fetch, }: {
|
|
47
|
+
id: string | undefined;
|
|
48
|
+
read: (id: string) => R | null;
|
|
49
|
+
fetch: (id: string) => Promise<R | null>;
|
|
50
|
+
}): FetchableValue<R | null>;
|
|
51
|
+
abstract fetchTable(tableId: string): Promise<Table | null>;
|
|
52
|
+
readTable(tableId: string): Table | null;
|
|
53
|
+
readSite(siteId: string): Site | null;
|
|
54
|
+
readPage(pageId: string): Page | null;
|
|
55
|
+
readSnippet(snippetId: string): Snippet | null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=api-resources-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-resources-client.d.ts","sourceRoot":"","sources":["../../../src/api/api-resources-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EACL,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,IAAI,EACT,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,UAAU,EACf,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,eAAe,CAAA;AAEtD,eAAO,MAAM,SAAS;aACX,SAAS;CAMnB,CAAA;AACD,8BAAsB,kBAAkB;IACtC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,CA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AIrC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;CAG/C"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
6
|
-
export declare const CacheData: {
|
|
7
|
-
empty(): CacheData;
|
|
8
|
-
};
|
|
1
|
+
import { type State as ApiClientState } from '../state/api-client/state';
|
|
2
|
+
import { type HttpFetch } from '../state/api-client/fetch-api-resource';
|
|
3
|
+
import { type File, type GlobalElement, type LocalizedGlobalElement, type PagePathnameSlice, type Swatch, type Table, type Typography } from './types';
|
|
4
|
+
import { ApiResourcesClient } from './api-resources-client';
|
|
5
|
+
export { CacheData } from './api-resources-client';
|
|
9
6
|
/**
|
|
10
7
|
* NOTE(miguel): This "client" is used to fetch Makeswift API resources needed for the host. For
|
|
11
8
|
* example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only
|
|
@@ -25,57 +22,24 @@ export declare const CacheData: {
|
|
|
25
22
|
* client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime
|
|
26
23
|
* snapshot for use in the builder, not the lives pages.
|
|
27
24
|
*/
|
|
28
|
-
export declare class MakeswiftHostApiClient {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
constructor({ uri, fetch, preloadedState, }: {
|
|
34
|
-
uri: string;
|
|
35
|
-
fetch: MakeswiftApiClient.HttpFetch;
|
|
36
|
-
preloadedState: Partial<MakeswiftApiClient.State>;
|
|
25
|
+
export declare class MakeswiftHostApiClient extends ApiResourcesClient {
|
|
26
|
+
readonly fetch: HttpFetch;
|
|
27
|
+
constructor({ fetch, preloadedState, }: {
|
|
28
|
+
fetch: HttpFetch;
|
|
29
|
+
preloadedState: Partial<ApiClientState>;
|
|
37
30
|
});
|
|
38
|
-
readSwatch(swatchId: string): Swatch | null;
|
|
39
31
|
fetchSwatch(swatchId: string): Promise<Swatch | null>;
|
|
40
|
-
resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null>;
|
|
41
|
-
readFile(fileId: string): File | null;
|
|
42
32
|
fetchFile(fileId: string): Promise<File | null>;
|
|
43
|
-
resolveFile(fileId: string | undefined): FetchableValue<File | null>;
|
|
44
|
-
readTypography(typographyId: string): Typography | null;
|
|
45
33
|
fetchTypography(typographyId: string): Promise<Typography | null>;
|
|
46
|
-
resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null>;
|
|
47
|
-
readGlobalElement(globalElementId: string): GlobalElement | null;
|
|
48
34
|
fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null>;
|
|
49
|
-
readLocalizedGlobalElement({ globalElementId, locale, }: {
|
|
50
|
-
globalElementId: string;
|
|
51
|
-
locale: string;
|
|
52
|
-
}): LocalizedGlobalElement | null;
|
|
53
35
|
fetchLocalizedGlobalElement({ globalElementId, locale, }: {
|
|
54
36
|
globalElementId: string;
|
|
55
37
|
locale: string;
|
|
56
38
|
}): Promise<LocalizedGlobalElement | null>;
|
|
57
|
-
readPagePathnameSlice({ pageId, locale, }: {
|
|
58
|
-
pageId: string;
|
|
59
|
-
locale: string | null;
|
|
60
|
-
}): PagePathnameSlice | null;
|
|
61
39
|
fetchPagePathnameSlice({ pageId, locale, }: {
|
|
62
40
|
pageId: string;
|
|
63
41
|
locale: string | null;
|
|
64
42
|
}): Promise<PagePathnameSlice | null>;
|
|
65
|
-
resolvePagePathnameSlice({ pageId, locale, }: {
|
|
66
|
-
pageId: string | undefined;
|
|
67
|
-
locale: string | null;
|
|
68
|
-
}): FetchableValue<PagePathnameSlice | null>;
|
|
69
|
-
resolveResource<R>(type: APIResourceType, { id, read, fetch, }: {
|
|
70
|
-
id: string | undefined;
|
|
71
|
-
read: (id: string) => R | null;
|
|
72
|
-
fetch: (id: string) => Promise<R | null>;
|
|
73
|
-
}): FetchableValue<R | null>;
|
|
74
|
-
readTable(tableId: string): Table | null;
|
|
75
43
|
fetchTable(tableId: string): Promise<Table | null>;
|
|
76
|
-
createTableRecord(tableId: string, columns: any): Promise<void>;
|
|
77
|
-
readSite(siteId: string): Site | null;
|
|
78
|
-
readPage(pageId: string): Page | null;
|
|
79
|
-
readSnippet(snippetId: string): Snippet | null;
|
|
80
44
|
}
|
|
81
45
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,wCAAwC,CAAA;AAGzF,OAAO,EACL,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,UAAU,EAEhB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;gBAEb,EACV,KAAK,EACL,cAAc,GACf,EAAE;QACD,KAAK,EAAE,SAAS,CAAA;QAChB,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;KACxC;IAQK,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIrD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAMjE,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAM1E,2BAA2B,CAAC,EAChC,eAAe,EACf,MAAM,GACP,EAAE;QACD,eAAe,EAAE,MAAM,CAAA;QACvB,MAAM,EAAE,MAAM,CAAA;KACf,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IAMpC,sBAAsB,CAAC,EAC3B,MAAM,EACN,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KACtB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAM/B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAGzD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphQLClient } from './graphql/client';
|
|
2
|
+
export declare class MakeswiftGraphQLApiClient {
|
|
3
|
+
readonly graphqlClient: GraphQLClient;
|
|
4
|
+
constructor({ endpoint }: {
|
|
5
|
+
endpoint: string;
|
|
6
|
+
});
|
|
7
|
+
createTableRecord(tableId: string, columns: any): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=graphql-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-api-client.d.ts","sourceRoot":"","sources":["../../../src/api/graphql-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAOhD,qBAAa,yBAAyB;IACpC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;gBAEzB,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE;IAIxC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAMtE"}
|
|
@@ -36,8 +36,8 @@ declare const makeswiftPageResultSchema: z.ZodObject<{
|
|
|
36
36
|
path: string;
|
|
37
37
|
id: string;
|
|
38
38
|
locale: string;
|
|
39
|
-
description: string | null;
|
|
40
39
|
title: string | null;
|
|
40
|
+
description: string | null;
|
|
41
41
|
canonicalUrl: string | null;
|
|
42
42
|
socialImageUrl: string | null;
|
|
43
43
|
sitemapPriority: number | null;
|
|
@@ -55,8 +55,8 @@ declare const makeswiftPageResultSchema: z.ZodObject<{
|
|
|
55
55
|
path: string;
|
|
56
56
|
id: string;
|
|
57
57
|
locale: string;
|
|
58
|
-
description: string | null;
|
|
59
58
|
title: string | null;
|
|
59
|
+
description: string | null;
|
|
60
60
|
canonicalUrl: string | null;
|
|
61
61
|
socialImageUrl: string | null;
|
|
62
62
|
sitemapPriority: number | null;
|
|
@@ -101,8 +101,8 @@ declare const makeswiftGetPagesResultAPISchema: z.ZodObject<{
|
|
|
101
101
|
path: string;
|
|
102
102
|
id: string;
|
|
103
103
|
locale: string;
|
|
104
|
-
description: string | null;
|
|
105
104
|
title: string | null;
|
|
105
|
+
description: string | null;
|
|
106
106
|
canonicalUrl: string | null;
|
|
107
107
|
socialImageUrl: string | null;
|
|
108
108
|
sitemapPriority: number | null;
|
|
@@ -120,8 +120,8 @@ declare const makeswiftGetPagesResultAPISchema: z.ZodObject<{
|
|
|
120
120
|
path: string;
|
|
121
121
|
id: string;
|
|
122
122
|
locale: string;
|
|
123
|
-
description: string | null;
|
|
124
123
|
title: string | null;
|
|
124
|
+
description: string | null;
|
|
125
125
|
canonicalUrl: string | null;
|
|
126
126
|
socialImageUrl: string | null;
|
|
127
127
|
sitemapPriority: number | null;
|
|
@@ -142,8 +142,8 @@ declare const makeswiftGetPagesResultAPISchema: z.ZodObject<{
|
|
|
142
142
|
path: string;
|
|
143
143
|
id: string;
|
|
144
144
|
locale: string;
|
|
145
|
-
description: string | null;
|
|
146
145
|
title: string | null;
|
|
146
|
+
description: string | null;
|
|
147
147
|
canonicalUrl: string | null;
|
|
148
148
|
socialImageUrl: string | null;
|
|
149
149
|
sitemapPriority: number | null;
|
|
@@ -164,8 +164,8 @@ declare const makeswiftGetPagesResultAPISchema: z.ZodObject<{
|
|
|
164
164
|
path: string;
|
|
165
165
|
id: string;
|
|
166
166
|
locale: string;
|
|
167
|
-
description: string | null;
|
|
168
167
|
title: string | null;
|
|
168
|
+
description: string | null;
|
|
169
169
|
canonicalUrl: string | null;
|
|
170
170
|
socialImageUrl: string | null;
|
|
171
171
|
sitemapPriority: number | null;
|
|
@@ -649,7 +649,7 @@ export declare class MakeswiftClient {
|
|
|
649
649
|
} & {
|
|
650
650
|
limit?: number | undefined;
|
|
651
651
|
after?: string | undefined;
|
|
652
|
-
sortBy?: "path" | "
|
|
652
|
+
sortBy?: "path" | "title" | "description" | "createdAt" | "updatedAt" | undefined;
|
|
653
653
|
sortDirection?: "desc" | "asc" | undefined;
|
|
654
654
|
includeOffline?: boolean | undefined;
|
|
655
655
|
pathPrefix?: string | undefined;
|
|
@@ -659,8 +659,8 @@ export declare class MakeswiftClient {
|
|
|
659
659
|
path: string;
|
|
660
660
|
id: string;
|
|
661
661
|
locale: string;
|
|
662
|
-
description: string | null;
|
|
663
662
|
title: string | null;
|
|
663
|
+
description: string | null;
|
|
664
664
|
canonicalUrl: string | null;
|
|
665
665
|
socialImageUrl: string | null;
|
|
666
666
|
sitemapPriority: number | null;
|
|
@@ -680,8 +680,8 @@ export declare class MakeswiftClient {
|
|
|
680
680
|
path: string;
|
|
681
681
|
id: string;
|
|
682
682
|
locale: string;
|
|
683
|
-
description: string | null;
|
|
684
683
|
title: string | null;
|
|
684
|
+
description: string | null;
|
|
685
685
|
canonicalUrl: string | null;
|
|
686
686
|
socialImageUrl: string | null;
|
|
687
687
|
sitemapPriority: number | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './control';
|
|
2
|
-
export { ControlDefinition, Checkbox, CheckboxDefinition, Code, CodeDefinition, Color, ColorDefinition, Combobox, ComboboxDefinition, Font, FontDefinition, Group, GroupDefinition, GroupControl, IconRadioGroupDefinition, type IconRadioGroupIcon,
|
|
2
|
+
export { ControlDefinition, Checkbox, CheckboxDefinition, Code, CodeDefinition, Color, ColorDefinition, Combobox, ComboboxDefinition, Font, FontDefinition, Group, GroupDefinition, GroupControl, IconRadioGroup, IconRadioGroupDefinition, type IconRadioGroupIcon, Image, ImageDefinition, List, ListDefinition, ListControl, Number, NumberDefinition, Select, SelectDefinition, Shape, ShapeDefinition, ShapeControl, Slider, SliderDefinition, Style, StyleDefinition, type StyleProperty, StyleControl, TextInput, TextInputDefinition, TextArea, TextAreaDefinition, unstable_Typography, unstable_TypographyDefinition, } from '@makeswift/controls';
|
|
3
3
|
export { Link, LinkDefinition } from './link';
|
|
4
4
|
export { RichTextV1Definition, RichTextV1Control } from './rich-text';
|
|
5
5
|
export { RichText, RichTextV2Definition, RichTextV2Control } from './rich-text-v2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AAEzB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,KAAK,EACL,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,KAAK,EACL,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AAEzB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,KAAK,EACL,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,KAAK,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,EACL,eAAe,EACf,IAAI,EACJ,cAAc,EACd,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,KAAK,EACL,eAAe,EACf,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,KAAK,EACL,eAAe,EACf,KAAK,aAAa,EAClB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/next/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/next/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAIvE,eAAO,MAAM,KAAK,EAAE,SACuD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleFontLink.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/GoogleFontLink.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAY3C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"GoogleFontLink.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/GoogleFontLink.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAY3C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,kDAkBtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHead.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/components/page/PageHead.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"PageHead.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/components/page/PageHead.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAS/D,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAS/D,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC,CAAA;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAa,EAAE,EAAE,KAAK,GAAG,SAAS,CAuG5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-api-resources-client.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-api-resources-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAItE,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-graphql-api-client.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-graphql-api-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAI3E,wBAAgB,4BAA4B,IAAI,yBAAyB,CAGxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-resource-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-resource-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-resource-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-resource-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAQ3D,wBAAgB,mBAAmB,IAAI,gBAAgB,CAiBtD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ResourceResolver } from '@makeswift/controls';
|
|
2
|
+
import { ApiResourcesClient } from '../../api/api-resources-client';
|
|
3
|
+
import { Store } from '../../state/store';
|
|
4
|
+
export declare const createResourceResolver: ({ store, apiClient, documentKey, locale, }: {
|
|
5
|
+
store: Store;
|
|
6
|
+
apiClient: ApiResourcesClient;
|
|
7
|
+
documentKey: string | null;
|
|
8
|
+
locale: string | null;
|
|
9
|
+
}) => ResourceResolver;
|
|
10
|
+
//# sourceMappingURL=resource-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-resolver.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/resource-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,eAAO,MAAM,sBAAsB,GAAI,4CAKpC;IACD,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,kBAAkB,CAAA;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB,KAAG,gBAmBF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SerializableReplacementContext } from '@makeswift/controls';
|
|
2
|
-
import
|
|
2
|
+
import { type HttpFetch } from '../../state/api-client/fetch-api-resource';
|
|
3
3
|
import { type SiteVersion } from '../../api/site-version';
|
|
4
4
|
import { Breakpoints, BreakpointsInput } from '../../state/modules/breakpoints';
|
|
5
5
|
import { type Element, type ElementData } from '../../state/read-only-state';
|
|
@@ -14,19 +14,21 @@ export declare class RuntimeCore {
|
|
|
14
14
|
readonly appOrigin: string;
|
|
15
15
|
readonly apiOrigin: string;
|
|
16
16
|
readonly requestKey: StoreKey | undefined;
|
|
17
|
-
readonly fetch:
|
|
17
|
+
readonly fetch: HttpFetch;
|
|
18
18
|
constructor({ appOrigin, apiOrigin, breakpoints, requestKey, fetch, }: {
|
|
19
19
|
appOrigin?: string;
|
|
20
20
|
apiOrigin?: string;
|
|
21
21
|
breakpoints?: BreakpointsInput;
|
|
22
22
|
requestKey?: StoreKey;
|
|
23
|
-
fetch:
|
|
23
|
+
fetch: HttpFetch;
|
|
24
24
|
});
|
|
25
25
|
getOrCreateStore({ siteVersion, locale }: StoreKey): Store;
|
|
26
26
|
retainStore({ siteVersion, locale }: StoreKey, store: Store): void;
|
|
27
27
|
releaseStore({ siteVersion, locale }: StoreKey, store: Store): void;
|
|
28
28
|
copyElementTree(elementTree: ElementData, replacementContext: SerializableReplacementContext): Element;
|
|
29
29
|
getBreakpoints(): Breakpoints;
|
|
30
|
+
get graphqlApiEndpoint(): string;
|
|
31
|
+
private createApiResourcesClient;
|
|
30
32
|
private shouldUsePersistentStore;
|
|
31
33
|
}
|
|
32
34
|
//# sourceMappingURL=runtime-core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-core.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAGzE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"runtime-core.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAGzE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EACL,WAAW,EACX,gBAAgB,EAEjB,MAAM,iCAAiC,CAAA;AAIxC,OAAO,EAAkB,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC5F,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,mBAAmB,CAAA;AAK1B,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AAID,qBAAa,WAAW;IAKtB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAM3B;IAEF,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;gBAEb,EACV,SAAuC,EACvC,SAAuC,EACvC,WAAW,EACX,UAAU,EACV,KAAK,GACN,EAAE;QACD,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,WAAW,CAAC,EAAE,gBAAgB,CAAA;QAC9B,UAAU,CAAC,EAAE,QAAQ,CAAA;QACrB,KAAK,EAAE,SAAS,CAAA;KACjB;IAYD,gBAAgB,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAG,KAAK;IA+B1D,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAalE,YAAY,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAanE,eAAe,CACb,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,8BAA8B,GACjD,OAAO;IAIV,cAAc,IAAI,WAAW;IAI7B,IAAI,kBAAkB,IAAI,MAAM,CAE/B;IAED,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,wBAAwB;CAKjC"}
|
|
@@ -3,15 +3,15 @@ import { Node, NodeEntry } from 'slate';
|
|
|
3
3
|
export type SupportedInlineType = Exclude<Slate.InlineType, 'link'>;
|
|
4
4
|
export type SupportedInline = Exclude<Slate.Inline, Slate.LinkElement>;
|
|
5
5
|
export declare const supportedInlineOptions: readonly [{
|
|
6
|
-
readonly icon: "
|
|
6
|
+
readonly icon: "Superscript";
|
|
7
7
|
readonly label: "Superscript";
|
|
8
8
|
readonly value: "superscript";
|
|
9
9
|
}, {
|
|
10
|
-
readonly icon: "
|
|
10
|
+
readonly icon: "Subscript";
|
|
11
11
|
readonly label: "Subscript";
|
|
12
12
|
readonly value: "subscript";
|
|
13
13
|
}, {
|
|
14
|
-
readonly icon: "
|
|
14
|
+
readonly icon: "Code";
|
|
15
15
|
readonly label: "Code";
|
|
16
16
|
readonly value: "code";
|
|
17
17
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/slate/InlinePlugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/slate/InlinePlugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEvC,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;AACnE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAgBzB,CAAA;AAEV,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,GAAG,MAAM,IAAI,mBAAmB,CAE7F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,eAAe,CAEzE;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,GACrB,KAAK,IAAI,SAAS,CAAC,eAAe,CAAC,CAErC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/slate/TextAlignPlugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAA;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/slate/TextAlignPlugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAA;AAClD,OAAO,EAAkB,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAS3D,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,iCAc3C,CAAA;AAED,wBAAgB,eAAe;;;;;;;;EAuD9B"}
|
|
@@ -3,7 +3,7 @@ import { type ThunkAction } from '@reduxjs/toolkit';
|
|
|
3
3
|
import { type Measurable } from '../../modules/read-write/box-models';
|
|
4
4
|
import { type DescriptorsByComponentType } from '../../modules/prop-controllers';
|
|
5
5
|
import { type DocumentPayload } from '../../shared-api';
|
|
6
|
-
import { type SerializedState as APIClientCache } from '../../
|
|
6
|
+
import { type SerializedState as APIClientCache } from '../../api-client/state';
|
|
7
7
|
export declare const ReadWriteActionTypes: {
|
|
8
8
|
readonly CHANGE_ELEMENT_TREE: "CHANGE_ELEMENT_TREE";
|
|
9
9
|
readonly REGISTER_MEASURABLE: "REGISTER_MEASURABLE";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-write-actions.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAEhF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,KAAK,eAAe,IAAI,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"read-write-actions.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAEhF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,KAAK,eAAe,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE/E,eAAO,MAAM,oBAAoB;;;;;;CAOvB,CAAA;AAEV,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,OAAO,oBAAoB,CAAC,mBAAmB,CAAA;IACrD,OAAO,EAAE;QACP,WAAW,EAAE,eAAe,CAAA;QAC5B,WAAW,EAAE,eAAe,CAAA;QAC5B,WAAW,EAAE,0BAA0B,CAAA;QACvC,SAAS,EAAE,SAAS,CAAA;KACrB,CAAA;CACF,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,OAAO,oBAAoB,CAAC,mBAAmB,CAAA;IACrD,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,CAAA;CAC7E,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,OAAO,oBAAoB,CAAC,qBAAqB,CAAA;IACvD,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CACrD,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,OAAO,oBAAoB,CAAC,uBAAuB,CAAA;IACzD,OAAO,EAAE,cAAc,CAAA;CACxB,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,OAAO,oBAAoB,CAAC,sBAAsB,CAAA;CACzD,CAAA;AAED,MAAM,MAAM,eAAe,GACvB,uBAAuB,GACvB,wBAAwB,GACxB,0BAA0B,GAC1B,oBAAoB,GACpB,mBAAmB,CAAA;AAEvB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,GAC1C,uBAAuB,CAKzB;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,UAAU,GACrB,wBAAwB,CAK1B;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,0BAA0B,CAE5B;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,UAAU,GACrB,WAAW,CAAC,MAAM,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,CAQ5D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,oBAAoB,CAElF;AAED,wBAAgB,mBAAmB,IAAI,mBAAmB,CAEzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-store.d.ts","sourceRoot":"","sources":["../../../../src/state/api-client/client-store.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,KAAK,EAAW,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AA2BpC,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,GACf,EAAE;IACD,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;CAC/B,GAAG,KAAK,CAiBR"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ThunkAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { type Action } from '../actions';
|
|
3
|
+
import { APIResourceType, type APIResource, type APIResourceLocale } from '../../api';
|
|
4
|
+
import { type State } from './state';
|
|
5
|
+
export type HttpFetch = (url: string | URL, init?: RequestInit) => Promise<Response>;
|
|
6
|
+
type Thunk<ReturnType> = ThunkAction<ReturnType, State, unknown, Action>;
|
|
7
|
+
export declare function fetchAPIResource<T extends APIResourceType>(resourceType: T, resourceId: string, fetch: HttpFetch, locale?: APIResourceLocale<T>): Thunk<Promise<Extract<APIResource, {
|
|
8
|
+
__typename: T;
|
|
9
|
+
}> | null>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=fetch-api-resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-api-resource.d.ts","sourceRoot":"","sources":["../../../../src/state/api-client/fetch-api-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAMnD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAA;AAIxC,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAQhB,KAAK,iBAAiB,EACvB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,KAAK,KAAK,EAA6D,MAAM,SAAS,CAAA;AAE/F,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEpF,KAAK,KAAK,CAAC,UAAU,IAAI,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAExE,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,eAAe,EACxD,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,SAAS,EAChB,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC5B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,UAAU,EAAE,CAAC,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAsGhE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ThunkDispatch } from '@reduxjs/toolkit';
|
|
2
|
+
import * as SiteVersionState from '../modules/site-version';
|
|
3
|
+
import * as LocaleState from '../modules/locale';
|
|
4
|
+
import * as APIResources from '../modules/api-resources';
|
|
5
|
+
import * as LocalizedResourcesMap from '../modules/localized-resources-map';
|
|
6
|
+
import { type Action } from '../actions';
|
|
7
|
+
import { APIResourceType, type APIResource, type APIResourceLocale } from '../../api';
|
|
8
|
+
export declare const reducer: import("@reduxjs/toolkit").Reducer<{
|
|
9
|
+
siteVersion: SiteVersionState.State;
|
|
10
|
+
locale: LocaleState.State;
|
|
11
|
+
apiResources: APIResources.State;
|
|
12
|
+
localizedResourcesMap: Map<string, Map<string, string | null>>;
|
|
13
|
+
}, Action | import("@reduxjs/toolkit").UnknownAction, Partial<{
|
|
14
|
+
siteVersion: SiteVersionState.State | undefined;
|
|
15
|
+
locale: LocaleState.State | undefined;
|
|
16
|
+
apiResources: APIResources.State | undefined;
|
|
17
|
+
localizedResourcesMap: Map<string, Map<string, string | null>> | undefined;
|
|
18
|
+
}>>;
|
|
19
|
+
export type State = ReturnType<typeof reducer>;
|
|
20
|
+
export type Dispatch = ThunkDispatch<State, unknown, Action>;
|
|
21
|
+
export type SerializedState = {
|
|
22
|
+
apiResources: APIResources.SerializedState;
|
|
23
|
+
localizedResourcesMap: LocalizedResourcesMap.SerializedState;
|
|
24
|
+
};
|
|
25
|
+
export declare function getLocalizedResourceId(state: State, locale: string, resourceId: string): string | undefined | null;
|
|
26
|
+
export declare function getHasAPIResource<T extends APIResourceType>(state: State, resourceType: APIResourceType, resourceId: string, locale?: APIResourceLocale<T>): boolean;
|
|
27
|
+
export declare function getAPIResource<T extends APIResourceType>(state: State, resourceType: T, resourceId: string, locale?: APIResourceLocale<T>): Extract<APIResource, {
|
|
28
|
+
__typename: T;
|
|
29
|
+
}> | null;
|
|
30
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/state/api-client/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEtE,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,qBAAqB,MAAM,oCAAoC,CAAA;AAE3E,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAErF,eAAO,MAAM,OAAO;;;;;;;;;;GAKlB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;AAC9C,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,YAAY,CAAC,eAAe,CAAA;IAC1C,qBAAqB,EAAE,qBAAqB,CAAC,eAAe,CAAA;CAC7D,CAAA;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,GAAG,IAAI,CAM3B;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,EACzD,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,eAAe,EAC7B,U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