@makeswift/runtime 0.22.0 → 0.22.1
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/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/state/actions.js +29 -4
- package/dist/cjs/state/actions.js.map +1 -1
- package/dist/cjs/state/modules/element-trees.js +281 -0
- package/dist/cjs/state/modules/element-trees.js.map +1 -0
- package/dist/cjs/state/modules/prop-controllers.js.map +1 -1
- package/dist/cjs/state/modules/read-only-documents.js.map +1 -1
- package/dist/cjs/state/modules/read-write-documents.js.map +1 -1
- package/dist/cjs/state/react-builder-preview.js +83 -41
- package/dist/cjs/state/react-builder-preview.js.map +1 -1
- package/dist/cjs/state/react-page.js +31 -76
- package/dist/cjs/state/react-page.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/state/actions.js +26 -4
- package/dist/esm/state/actions.js.map +1 -1
- package/dist/esm/state/modules/element-trees.js +249 -0
- package/dist/esm/state/modules/element-trees.js.map +1 -0
- package/dist/esm/state/modules/prop-controllers.js.map +1 -1
- package/dist/esm/state/modules/read-only-documents.js.map +1 -1
- package/dist/esm/state/modules/read-write-documents.js.map +1 -1
- package/dist/esm/state/react-builder-preview.js +64 -20
- package/dist/esm/state/react-builder-preview.js.map +1 -1
- package/dist/esm/state/react-page.js +30 -81
- package/dist/esm/state/react-page.js.map +1 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +4 -4
- package/dist/types/locale.d.ts +1 -1
- package/dist/types/state/__tests__/fixtures/operations.d.ts +8 -0
- package/dist/types/state/__tests__/fixtures/operations.d.ts.map +1 -0
- package/dist/types/state/__tests__/fixtures/root-elements.d.ts +4 -0
- package/dist/types/state/__tests__/fixtures/root-elements.d.ts.map +1 -0
- package/dist/types/state/__tests__/react-builder-preview.test.d.ts.map +1 -0
- package/dist/types/state/__tests__/react-page.test.d.ts.map +1 -0
- package/dist/types/state/actions.d.ts +40 -10
- package/dist/types/state/actions.d.ts.map +1 -1
- package/dist/types/state/modules/__tests__/element-trees.test.d.ts +2 -0
- package/dist/types/state/modules/__tests__/element-trees.test.d.ts.map +1 -0
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts +1545 -0
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts.map +1 -0
- package/dist/types/state/modules/element-trees.d.ts +25 -0
- package/dist/types/state/modules/element-trees.d.ts.map +1 -0
- package/dist/types/state/modules/prop-controllers.d.ts +7 -5
- package/dist/types/state/modules/prop-controllers.d.ts.map +1 -1
- package/dist/types/state/modules/read-only-documents.d.ts +1 -1
- package/dist/types/state/modules/read-only-documents.d.ts.map +1 -1
- package/dist/types/state/modules/read-write-documents.d.ts +2 -2
- package/dist/types/state/modules/read-write-documents.d.ts.map +1 -1
- package/dist/types/state/react-builder-preview.d.ts +8 -5
- package/dist/types/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/state/react-page.d.ts +12 -10
- package/dist/types/state/react-page.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/types/state/react-builder-preview.test.d.ts.map +0 -1
- package/dist/types/state/react-page.test.d.ts.map +0 -1
- /package/dist/types/state/{react-builder-preview.test.d.ts → __tests__/react-builder-preview.test.d.ts} +0 -0
- /package/dist/types/state/{react-page.test.d.ts → __tests__/react-page.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/react-page.ts"],"sourcesContent":["import {\n applyMiddleware,\n createStore,\n PreloadedState,\n Store as ReduxStore,\n combineReducers,\n} from 'redux'\n\nimport thunk, { ThunkDispatch } from 'redux-thunk'\n\nimport {\n createReplacementContext,\n type SerializableReplacementContext,\n type ReplacementContext,\n type TranslationDto,\n type MergeTranslatableDataContext,\n type MergeContext,\n} from '@makeswift/controls'\n\nimport * as Documents from './modules/read-only-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsPreview from './modules/is-preview'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Breakpoints from './modules/breakpoints'\nimport * as Introspection from '../prop-controllers/introspection'\nimport { Action } from './actions'\nimport { copyElementReference } from '../prop-controllers/copy'\nimport {\n copy as copyFromControl,\n getTranslatableData,\n merge,\n mergeTranslatedData,\n} from '../controls/control'\n\nexport type {\n Data,\n Document,\n DocumentReference,\n Element,\n ElementData,\n ElementReference,\n} from './modules/read-only-documents'\n\nexport {\n createDocument,\n createDocumentReference,\n isElementReference,\n} from './modules/read-only-documents'\n\nexport type { ComponentType } from './modules/react-components'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n isPreview: IsPreview.reducer,\n builderEditMode: BuilderEditMode.reducer,\n breakpoints: Breakpoints.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getReactComponentsStateSlice(state: State): ReactComponents.State {\n return state.reactComponents\n}\n\nexport function getReactComponent(\n state: State,\n type: string,\n): ReactComponents.ComponentType | null {\n return ReactComponents.getReactComponent(getReactComponentsStateSlice(state), type)\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllerDescriptors(\n state: State,\n): Map<string, Record<string, PropControllers.PropControllerDescriptor>> {\n return PropControllers.getPropControllerDescriptors(getPropControllersStateSlice(state))\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nexport function getPropControllers(state: State, documentKey: string, elementKey: string) {\n return PropControllerHandles.getPropControllers(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nfunction normalizeElement(\n element: Documents.Element,\n descriptors: Map<string, Record<string, PropControllers.PropControllerDescriptor>>,\n): Map<string, Documents.Element> {\n const elements = new Map<string, Documents.Element>()\n const remaining = [element]\n let current: Documents.Element | undefined\n\n while ((current = remaining.pop())) {\n elements.set(current.key, current)\n\n if (Documents.isElementReference(current)) continue\n\n const elementDescriptors = descriptors.get(current.type)\n\n if (elementDescriptors == null) continue\n\n const parent = current\n const children = Object.entries(elementDescriptors).reduce((acc, [propName, descriptor]) => {\n return [...acc, ...Introspection.getElementChildren(descriptor, parent.props[propName])]\n }, [] as Documents.Element[])\n\n remaining.push(...children)\n }\n\n return elements\n}\n\nfunction getDocumentElements(state: State, documentKey: string): Map<string, Documents.Element> {\n const document = getDocument(state, documentKey)\n const descriptors = getPropControllerDescriptors(state)\n\n if (document == null) return new Map()\n\n return normalizeElement(document.rootElement, descriptors)\n}\n\n/**\n * Returns all document keys sorted by depth, i.e., parent documents come before child documents.\n *\n * @todo Make this selector more efficient.\n */\nexport function getDocumentKeysSortedByDepth(state: State): string[] {\n const documents = Documents.getDocuments(getDocumentsStateSlice(state))\n const keys = Array.from(documents.keys())\n\n if (keys.length < 2) return keys\n\n const elements = new Map<string, Map<string, Documents.Element>>()\n\n keys.forEach(key => {\n elements.set(key, getDocumentElements(state, key))\n })\n\n keys.sort((a, b) => (elements.get(a)?.has(b) ? -1 : 1))\n\n return keys\n}\n\nexport function getElement(\n state: State,\n documentKey: string,\n elementKey: string,\n): Documents.Element | null {\n return getDocumentElements(state, documentKey).get(elementKey) ?? null\n}\n\nexport function getElementPropControllerDescriptors(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n return getComponentPropControllerDescriptors(state, element.type)\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n const descriptors = getComponentPropControllerDescriptors(state, element.type)\n\n if (descriptors == null) return null\n\n const elementId = Object.entries(descriptors).reduce(\n (acc, [propName, descriptor]) => {\n if (acc != null) return acc\n\n return Introspection.getElementId(descriptor, element.props[propName])\n },\n null as string | null,\n )\n\n return elementId\n}\n\nexport function copyElementTree(\n state: State,\n elementTree: Documents.ElementData,\n replacementContext: SerializableReplacementContext,\n) {\n /*\n * This is structured a bit weird.\n *\n * This is done so that we can pass a callable function into some of the copy functions\n * themselves, to enable mutual recursion.\n *\n * Consider the slot control. It has to iterate through its elements, and for each of them,\n * call some version of the below function.\n *\n * That is how the recursing through the tree happens.\n */\n function copyElementTreeNode(state: State, replacementContext: ReplacementContext) {\n return function (node: Documents.Element) {\n const context = {\n replacementContext,\n copyElement: copyElementTreeNode(state, replacementContext),\n }\n\n if (Documents.isElementReference(node)) {\n return { ...node, value: copyElementReference(node.value, context) }\n }\n\n const descriptors = getComponentPropControllerDescriptors(state, node.type)\n\n if (descriptors == null) return node\n\n for (const [propKey, descriptor] of Object.entries(descriptors)) {\n node.props[propKey] = copyFromControl(descriptor, node.props[propKey], context)\n }\n\n return node\n }\n }\n\n const copy = JSON.parse(JSON.stringify(elementTree)) as Documents.ElementData\n\n return copyElementTreeNode(state, createReplacementContext(replacementContext))(copy)\n}\n\nfunction* traverseElementTree(\n state: State,\n elementTree: Documents.ElementData,\n): Generator<Documents.Element> {\n yield elementTree\n\n if (Documents.isElementReference(elementTree)) return\n\n const descriptors = getComponentPropControllerDescriptors(state, elementTree.type)\n\n if (descriptors == null) return\n\n for (const [propKey, descriptor] of Object.entries(descriptors)) {\n const children = Introspection.getElementChildren(descriptor, elementTree.props[propKey])\n\n for (const child of children) {\n if (!Documents.isElementReference(child)) yield* traverseElementTree(state, child)\n\n yield child\n }\n }\n}\n\nexport function getElementTreeTranslatableData(\n state: State,\n elementTree: Documents.ElementData,\n): Record<string, Documents.Data> {\n const translatableData: Record<string, Documents.Data> = {}\n\n for (const element of traverseElementTree(state, elementTree)) {\n if (Documents.isElementReference(element)) continue\n\n const descriptors = getComponentPropControllerDescriptors(state, element.type)\n\n if (descriptors == null) continue\n\n Object.entries(descriptors).forEach(([propName, descriptor]) => {\n const translatablePropData = getTranslatableData(descriptor, element.props[propName])\n\n if (translatablePropData != null) {\n translatableData[`${element.key}:${propName}`] = translatablePropData\n }\n })\n }\n\n return translatableData\n}\n\nexport function mergeElementTreeTranslatedData(\n state: State,\n elementTree: Documents.ElementData,\n translatedData: TranslationDto,\n): Documents.Element {\n function merge(state: State, translatedData: TranslationDto) {\n return function (node: Documents.Element): Documents.Element {\n if (Documents.isElementReference(node)) return node\n\n const elementDescriptors = getPropControllerDescriptors(state)\n const descriptors = elementDescriptors.get(node.type)\n\n if (descriptors == null) {\n throw new Error(`Can't merge element of type \"${node.type}\" because it has no descriptors`)\n }\n\n const context: MergeTranslatableDataContext = {\n translatedData,\n mergeTranslatedData: merge(state, translatedData),\n }\n const props = {} as Record<string, Documents.Data>\n\n for (const propName of Object.keys(descriptors)) {\n const descriptor = descriptors[propName]\n\n props[propName] = mergeTranslatedData(\n descriptor,\n node.props[propName],\n translatedData[`${node.key}:${propName}`],\n context,\n )\n }\n\n return { ...node, props }\n }\n }\n return merge(state, translatedData)(elementTree)\n}\n\nexport function mergeElement(\n state: State,\n baseElement: Documents.Element,\n overrideElement: Documents.Element,\n): Documents.Element {\n if (baseElement.type !== overrideElement.type || baseElement.key !== overrideElement.key) {\n throw new Error(`Can't merge elements of different types or keys`)\n }\n\n if (Documents.isElementReference(overrideElement)) return overrideElement\n\n if (Documents.isElementReference(baseElement)) return baseElement\n\n const elementDescriptors = getPropControllerDescriptors(state)\n const descriptors = elementDescriptors.get(baseElement.type)\n\n if (descriptors == null) {\n throw new Error(\n `Can't merge element of type \"${baseElement.type}\" because it has no descriptors`,\n )\n }\n\n const mergedProps = {} as Record<string, Documents.Data>\n\n for (const propName of Object.keys(descriptors)) {\n const descriptor = descriptors[propName]\n const context: MergeContext = {\n mergeElement(base, override) {\n return mergeElement(state, base, override)\n },\n }\n\n mergedProps[propName] = merge(\n descriptor,\n baseElement.props[propName],\n overrideElement.props[propName],\n context,\n )\n }\n\n return { ...baseElement, props: mergedProps }\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state.isInBuilder\n}\n\nexport function getIsPreview(state: State): boolean {\n return IsPreview.getIsPreview(state.isPreview)\n}\n\nexport function getBuilderEditMode(state: State): BuilderEditMode.State {\n return state.builderEditMode\n}\n\nexport function getBreakpoints(state: State): Breakpoints.State {\n return state.breakpoints\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n rootElements,\n preloadedState,\n breakpoints,\n}: {\n rootElements?: Map<string, Documents.Element>\n preloadedState?: PreloadedState<State>\n breakpoints?: Breakpoints.State\n} = {}): Store {\n return createStore(\n reducer,\n {\n ...preloadedState,\n documents: Documents.getInitialState({ rootElements }),\n breakpoints: Breakpoints.getInitialState(breakpoints ?? preloadedState?.breakpoints),\n },\n applyMiddleware(thunk),\n )\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAEP,OAAO,WAA8B;AAErC;AAAA,EACE;AAAA,OAMK;AAEP,YAAY,eAAe;AAC3B,YAAY,qBAAqB;AACjC,YAAY,oBAAoB;AAChC,YAAY,qBAAqB;AACjC,YAAY,2BAA2B;AACvC,YAAY,iBAAiB;AAC7B,YAAY,eAAe;AAC3B,YAAY,qBAAqB;AACjC,YA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AC9B;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,aAAa,OAAO,YAAY;AAC9C;AAEO,SAAS,eAAe,OAAuB;AACpD,SAAO,MAAM;AACf;AAEO,SAAS,aAAa,OAAuB;AAClD,SAAO,UAAU,aAAa,MAAM,SAAS;AAC/C;AAEO,SAAS,mBAAmB,OAAqC;AACtE,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAAiC;AAC9D,SAAO,MAAM;AACf;AAMO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,IAII,CAAC,GAAU;AACb,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,WAAW,UAAU,gBAAgB,EAAE,aAAa,CAAC;AAAA,MACrD,aAAa,YAAY,gBAAgB,eAAe,gBAAgB,WAAW;AAAA,IACrF;AAAA,IACA,gBAAgB,KAAK;AAAA,EACvB;AACF;","names":["state","replacementContext","merge","translatedData"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/react-page.ts"],"sourcesContent":["import { type Store as ReduxStore, applyMiddleware, createStore, combineReducers } from 'redux'\n\nimport { createSelector } from 'reselect'\n\nimport thunk, { ThunkDispatch } from 'redux-thunk'\n\nimport {\n createReplacementContext,\n type SerializableReplacementContext,\n type ReplacementContext,\n type TranslationDto,\n type MergeTranslatableDataContext,\n type MergeContext,\n} from '@makeswift/controls'\n\nimport * as Documents from './modules/read-only-documents'\nimport * as ElementTrees from './modules/element-trees'\nimport * as ReactComponents from './modules/react-components'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsPreview from './modules/is-preview'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Breakpoints from './modules/breakpoints'\nimport { type Action } from './actions'\nimport { copyElementReference } from '../prop-controllers/copy'\nimport {\n copy as copyFromControl,\n getTranslatableData,\n merge,\n mergeTranslatedData,\n} from '../controls/control'\n\nexport type {\n Data,\n Document,\n DocumentReference,\n Element,\n ElementData,\n ElementReference,\n} from './modules/read-only-documents'\n\nexport {\n createDocument,\n createDocumentReference,\n isElementReference,\n} from './modules/read-only-documents'\n\nexport type { ComponentType } from './modules/react-components'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n elementTrees: ElementTrees.reducer,\n reactComponents: ReactComponents.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n isPreview: IsPreview.reducer,\n builderEditMode: BuilderEditMode.reducer,\n breakpoints: Breakpoints.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getElementTreesSlice(state: State): ElementTrees.State {\n return state.elementTrees\n}\n\nexport function getElements(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elements'] {\n return ElementTrees.getElements(getElementTreesSlice(state), documentKey)\n}\n\nexport function getElementIds(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elementIds'] {\n return ElementTrees.getElementIds(getElementTreesSlice(state), documentKey)\n}\n\nfunction getReactComponentsStateSlice(state: State): ReactComponents.State {\n return state.reactComponents\n}\n\nexport function getReactComponent(\n state: State,\n type: string,\n): ReactComponents.ComponentType | null {\n return ReactComponents.getReactComponent(getReactComponentsStateSlice(state), type)\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllerDescriptors(state: State): PropControllers.State {\n return PropControllers.getPropControllerDescriptors(getPropControllersStateSlice(state))\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): PropControllers.DescriptorsByProp | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nexport function getPropControllers(state: State, documentKey: string, elementKey: string) {\n return PropControllerHandles.getPropControllers(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\n/**\n * Returns all document keys sorted by depth, i.e., parent documents come before child documents.\n */\nexport const getDocumentKeysSortedByDepth: (state: State) => string[] = createSelector(\n [getDocumentsStateSlice, getElementTreesSlice],\n (documents, elementTrees) => {\n return [...documents.keys()].sort((a, b) => (elementTrees.get(a)?.elements.has(b) ? -1 : 1))\n },\n)\n\nexport function getElement(\n state: State,\n documentKey: string,\n elementKey: string,\n): Documents.Element | null {\n return ElementTrees.getElement(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return ElementTrees.getElementId(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementPropControllerDescriptors(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n return getComponentPropControllerDescriptors(state, element.type)\n}\n\nexport function copyElementTree(\n state: State,\n elementTree: Documents.ElementData,\n replacementContext: SerializableReplacementContext,\n) {\n /*\n * This is structured a bit weird.\n *\n * This is done so that we can pass a callable function into some of the copy functions\n * themselves, to enable mutual recursion.\n *\n * Consider the slot control. It has to iterate through its elements, and for each of them,\n * call some version of the below function.\n *\n * That is how the recursing through the tree happens.\n */\n function copyElementTreeNode(state: State, replacementContext: ReplacementContext) {\n return function (node: Documents.Element) {\n const context = {\n replacementContext,\n copyElement: copyElementTreeNode(state, replacementContext),\n }\n\n if (Documents.isElementReference(node)) {\n return { ...node, value: copyElementReference(node.value, context) }\n }\n\n const descriptors = getComponentPropControllerDescriptors(state, node.type)\n\n if (descriptors == null) return node\n\n for (const [propKey, descriptor] of Object.entries(descriptors)) {\n node.props[propKey] = copyFromControl(descriptor, node.props[propKey], context)\n }\n\n return node\n }\n }\n\n const copy = JSON.parse(JSON.stringify(elementTree)) as Documents.ElementData\n\n return copyElementTreeNode(state, createReplacementContext(replacementContext))(copy)\n}\n\nexport function getElementTreeTranslatableData(\n state: State,\n elementTree: Documents.ElementData,\n): Record<string, Documents.Data> {\n const translatableData: Record<string, Documents.Data> = {}\n const descriptors = getPropControllerDescriptors(state)\n\n for (const element of ElementTrees.traverseElementTree(elementTree, descriptors)) {\n if (Documents.isElementReference(element)) continue\n\n const elementPescriptors = descriptors.get(element.type)\n if (elementPescriptors == null) continue\n\n Object.entries(elementPescriptors).forEach(([propName, descriptor]) => {\n const translatablePropData = getTranslatableData(descriptor, element.props[propName])\n\n if (translatablePropData != null) {\n translatableData[`${element.key}:${propName}`] = translatablePropData\n }\n })\n }\n\n return translatableData\n}\n\nexport function mergeElementTreeTranslatedData(\n state: State,\n elementTree: Documents.ElementData,\n translatedData: TranslationDto,\n): Documents.Element {\n function merge(state: State, translatedData: TranslationDto) {\n return function (node: Documents.Element): Documents.Element {\n if (Documents.isElementReference(node)) return node\n\n const elementDescriptors = getPropControllerDescriptors(state)\n const descriptors = elementDescriptors.get(node.type)\n\n if (descriptors == null) {\n throw new Error(`Can't merge element of type \"${node.type}\" because it has no descriptors`)\n }\n\n const context: MergeTranslatableDataContext = {\n translatedData,\n mergeTranslatedData: merge(state, translatedData),\n }\n const props = {} as Record<string, Documents.Data>\n\n for (const propName of Object.keys(descriptors)) {\n const descriptor = descriptors[propName]\n\n props[propName] = mergeTranslatedData(\n descriptor,\n node.props[propName],\n translatedData[`${node.key}:${propName}`],\n context,\n )\n }\n\n return { ...node, props }\n }\n }\n return merge(state, translatedData)(elementTree)\n}\n\nexport function mergeElement(\n state: State,\n baseElement: Documents.Element,\n overrideElement: Documents.Element,\n): Documents.Element {\n if (baseElement.type !== overrideElement.type || baseElement.key !== overrideElement.key) {\n throw new Error(`Can't merge elements of different types or keys`)\n }\n\n if (Documents.isElementReference(overrideElement)) return overrideElement\n\n if (Documents.isElementReference(baseElement)) return baseElement\n\n const elementDescriptors = getPropControllerDescriptors(state)\n const descriptors = elementDescriptors.get(baseElement.type)\n\n if (descriptors == null) {\n throw new Error(\n `Can't merge element of type \"${baseElement.type}\" because it has no descriptors`,\n )\n }\n\n const mergedProps = {} as Record<string, Documents.Data>\n\n for (const propName of Object.keys(descriptors)) {\n const descriptor = descriptors[propName]\n const context: MergeContext = {\n mergeElement(base, override) {\n return mergeElement(state, base, override)\n },\n }\n\n mergedProps[propName] = merge(\n descriptor,\n baseElement.props[propName],\n overrideElement.props[propName],\n context,\n )\n }\n\n return { ...baseElement, props: mergedProps }\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state.isInBuilder\n}\n\nexport function getIsPreview(state: State): boolean {\n return IsPreview.getIsPreview(state.isPreview)\n}\n\nexport function getBuilderEditMode(state: State): BuilderEditMode.State {\n return state.builderEditMode\n}\n\nexport function getBreakpoints(state: State): Breakpoints.State {\n return state.breakpoints\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n rootElements,\n preloadedState,\n breakpoints,\n}: {\n rootElements?: Map<string, Documents.Element>\n preloadedState?: Partial<State>\n breakpoints?: Breakpoints.State\n} = {}): Store {\n return createStore(\n reducer,\n {\n ...preloadedState,\n documents: Documents.getInitialState({ rootElements }),\n elementTrees: ElementTrees.getInitialState(rootElements, preloadedState?.propControllers),\n breakpoints: Breakpoints.getInitialState(breakpoints ?? preloadedState?.breakpoints),\n },\n applyMiddleware(thunk),\n )\n}\n"],"mappings":"AAAA,SAAmC,iBAAiB,aAAa,uBAAuB;AAExF,SAAS,sBAAsB;AAE/B,OAAO,WAA8B;AAErC;AAAA,EACE;AAAA,OAMK;AAEP,YAAY,eAAe;AAC3B,YAAY,kBAAkB;AAC9B,Y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G,aAAa,OAAO,YAAY;AAC9C;AAEO,SAAS,eAAe,OAAuB;AACpD,SAAO,MAAM;AACf;AAEO,SAAS,aAAa,OAAuB;AAClD,SAAO,UAAU,aAAa,MAAM,SAAS;AAC/C;AAEO,SAAS,mBAAmB,OAAqC;AACtE,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAAiC;AAC9D,SAAO,MAAM;AACf;AAMO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,IAII,CAAC,GAAU;AACb,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,WAAW,UAAU,gBAAgB,EAAE,aAAa,CAAC;AAAA,MACrD,cAAc,aAAa,gBAAgB,cAAc,gBAAgB,eAAe;AAAA,MACxF,aAAa,YAAY,gBAAgB,eAAe,gBAAgB,WAAW;AAAA,IACrF;AAAA,IACA,gBAAgB,KAAK;AAAA,EACvB;AACF;","names":["state","replacementContext","merge","translatedData"]}
|
|
@@ -469,7 +469,7 @@ declare class Definition extends BaseRichTextDefinition<ReactNode, Config, Insta
|
|
|
469
469
|
}>>>;
|
|
470
470
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
471
471
|
}, "strip", z.ZodTypeAny, {
|
|
472
|
-
object?: "
|
|
472
|
+
object?: "document" | "operation" | "value" | "text" | "block" | "inline" | "leaf" | "selection" | "mark" | "range" | "decoration" | "annotation" | "point" | undefined;
|
|
473
473
|
document?: {
|
|
474
474
|
object?: "document" | undefined;
|
|
475
475
|
nodes?: any[] | undefined;
|
|
@@ -523,7 +523,7 @@ declare class Definition extends BaseRichTextDefinition<ReactNode, Config, Insta
|
|
|
523
523
|
}> | undefined;
|
|
524
524
|
data?: Record<string, any> | undefined;
|
|
525
525
|
}, {
|
|
526
|
-
object?: "
|
|
526
|
+
object?: "document" | "operation" | "value" | "text" | "block" | "inline" | "leaf" | "selection" | "mark" | "range" | "decoration" | "annotation" | "point" | undefined;
|
|
527
527
|
document?: {
|
|
528
528
|
object?: "document" | undefined;
|
|
529
529
|
nodes?: any[] | undefined;
|
|
@@ -695,7 +695,7 @@ declare class Definition extends BaseRichTextDefinition<ReactNode, Config, Insta
|
|
|
695
695
|
}>>>;
|
|
696
696
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
697
697
|
}, "strip", z.ZodTypeAny, {
|
|
698
|
-
object?: "
|
|
698
|
+
object?: "document" | "operation" | "value" | "text" | "block" | "inline" | "leaf" | "selection" | "mark" | "range" | "decoration" | "annotation" | "point" | undefined;
|
|
699
699
|
document?: {
|
|
700
700
|
object?: "document" | undefined;
|
|
701
701
|
nodes?: any[] | undefined;
|
|
@@ -749,7 +749,7 @@ declare class Definition extends BaseRichTextDefinition<ReactNode, Config, Insta
|
|
|
749
749
|
}> | undefined;
|
|
750
750
|
data?: Record<string, any> | undefined;
|
|
751
751
|
}, {
|
|
752
|
-
object?: "
|
|
752
|
+
object?: "document" | "operation" | "value" | "text" | "block" | "inline" | "leaf" | "selection" | "mark" | "range" | "decoration" | "annotation" | "point" | undefined;
|
|
753
753
|
document?: {
|
|
754
754
|
object?: "document" | undefined;
|
|
755
755
|
nodes?: any[] | undefined;
|