@makeswift/runtime 0.16.0-canary.3 → 0.16.0-canary.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/cjs/builder/serialization/control-serialization.js +11 -10
  2. package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
  3. package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
  4. package/dist/cjs/components/builtin/Box/register.js +2 -2
  5. package/dist/cjs/components/builtin/Box/register.js.map +1 -1
  6. package/dist/cjs/components/builtin/Button/Button.js.map +1 -1
  7. package/dist/cjs/components/builtin/Carousel/Carousel.js.map +1 -1
  8. package/dist/cjs/components/builtin/Carousel/register.js +1 -1
  9. package/dist/cjs/components/builtin/Carousel/register.js.map +1 -1
  10. package/dist/cjs/components/builtin/Countdown/Countdown.js.map +1 -1
  11. package/dist/cjs/components/builtin/Countdown/register.js +1 -1
  12. package/dist/cjs/components/builtin/Countdown/register.js.map +1 -1
  13. package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
  14. package/dist/cjs/components/builtin/Embed/register.js +1 -1
  15. package/dist/cjs/components/builtin/Embed/register.js.map +1 -1
  16. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  17. package/dist/cjs/components/builtin/Form/register.js +1 -1
  18. package/dist/cjs/components/builtin/Form/register.js.map +1 -1
  19. package/dist/cjs/components/builtin/Image/Image.js.map +1 -1
  20. package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
  21. package/dist/cjs/components/builtin/Navigation/components/MobileMenu/index.js.map +1 -1
  22. package/dist/cjs/components/builtin/Navigation/register.js +2 -2
  23. package/dist/cjs/components/builtin/Navigation/register.js.map +1 -1
  24. package/dist/cjs/components/builtin/Root/Root.js.map +1 -1
  25. package/dist/cjs/components/builtin/Root/register.js +6 -5
  26. package/dist/cjs/components/builtin/Root/register.js.map +1 -1
  27. package/dist/cjs/components/builtin/SocialLinks/SocialLinks.js.map +1 -1
  28. package/dist/cjs/components/builtin/SocialLinks/register.js +1 -1
  29. package/dist/cjs/components/builtin/SocialLinks/register.js.map +1 -1
  30. package/dist/cjs/components/hooks/useGapXPropControllerData.js +34 -0
  31. package/dist/cjs/components/hooks/useGapXPropControllerData.js.map +1 -0
  32. package/dist/cjs/components/hooks/useGapYPropControllerData.js +34 -0
  33. package/dist/cjs/components/hooks/useGapYPropControllerData.js.map +1 -0
  34. package/dist/cjs/components/hooks/useLinkPropControllerData.js +1 -1
  35. package/dist/cjs/components/hooks/useLinkPropControllerData.js.map +1 -1
  36. package/dist/cjs/components/hooks/useNavigationLinksPropControllerData.js +34 -0
  37. package/dist/cjs/components/hooks/useNavigationLinksPropControllerData.js.map +1 -0
  38. package/dist/cjs/components/hooks/useTextAreaPropControllerData.js +34 -0
  39. package/dist/cjs/components/hooks/useTextAreaPropControllerData.js.map +1 -0
  40. package/dist/cjs/components/shared/Link/index.js.map +1 -1
  41. package/dist/cjs/controls/control.js +3 -3
  42. package/dist/cjs/controls/control.js.map +1 -1
  43. package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
  44. package/dist/cjs/prop-controllers/copy.js +2 -3
  45. package/dist/cjs/prop-controllers/copy.js.map +1 -1
  46. package/dist/cjs/prop-controllers/deleted.js +33 -0
  47. package/dist/cjs/prop-controllers/deleted.js.map +1 -0
  48. package/dist/cjs/prop-controllers/descriptors.js +0 -109
  49. package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
  50. package/dist/cjs/prop-controllers/index.js +3 -0
  51. package/dist/cjs/prop-controllers/index.js.map +1 -1
  52. package/dist/cjs/prop-controllers/introspection.js +4 -72
  53. package/dist/cjs/prop-controllers/introspection.js.map +1 -1
  54. package/dist/cjs/runtimes/react/components/PreviewProvider.js +4 -0
  55. package/dist/cjs/runtimes/react/components/PreviewProvider.js.map +1 -1
  56. package/dist/cjs/runtimes/react/controls.js +44 -0
  57. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  58. package/dist/cjs/state/react-builder-preview.js +95 -38
  59. package/dist/cjs/state/react-builder-preview.js.map +1 -1
  60. package/dist/esm/builder/serialization/control-serialization.js +13 -10
  61. package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
  62. package/dist/esm/components/builtin/Box/Box.js.map +1 -1
  63. package/dist/esm/components/builtin/Box/register.js +4 -2
  64. package/dist/esm/components/builtin/Box/register.js.map +1 -1
  65. package/dist/esm/components/builtin/Button/Button.js.map +1 -1
  66. package/dist/esm/components/builtin/Carousel/Carousel.js.map +1 -1
  67. package/dist/esm/components/builtin/Carousel/register.js +9 -2
  68. package/dist/esm/components/builtin/Carousel/register.js.map +1 -1
  69. package/dist/esm/components/builtin/Countdown/Countdown.js.map +1 -1
  70. package/dist/esm/components/builtin/Countdown/register.js +2 -1
  71. package/dist/esm/components/builtin/Countdown/register.js.map +1 -1
  72. package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
  73. package/dist/esm/components/builtin/Embed/register.js +2 -2
  74. package/dist/esm/components/builtin/Embed/register.js.map +1 -1
  75. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  76. package/dist/esm/components/builtin/Form/register.js +2 -1
  77. package/dist/esm/components/builtin/Form/register.js.map +1 -1
  78. package/dist/esm/components/builtin/Image/Image.js.map +1 -1
  79. package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
  80. package/dist/esm/components/builtin/Navigation/components/MobileMenu/index.js.map +1 -1
  81. package/dist/esm/components/builtin/Navigation/register.js +5 -3
  82. package/dist/esm/components/builtin/Navigation/register.js.map +1 -1
  83. package/dist/esm/components/builtin/Root/Root.js.map +1 -1
  84. package/dist/esm/components/builtin/Root/register.js +3 -2
  85. package/dist/esm/components/builtin/Root/register.js.map +1 -1
  86. package/dist/esm/components/builtin/SocialLinks/SocialLinks.js.map +1 -1
  87. package/dist/esm/components/builtin/SocialLinks/register.js +2 -2
  88. package/dist/esm/components/builtin/SocialLinks/register.js.map +1 -1
  89. package/dist/esm/components/hooks/useGapXPropControllerData.js +12 -0
  90. package/dist/esm/components/hooks/useGapXPropControllerData.js.map +1 -0
  91. package/dist/esm/components/hooks/useGapYPropControllerData.js +12 -0
  92. package/dist/esm/components/hooks/useGapYPropControllerData.js.map +1 -0
  93. package/dist/esm/components/hooks/useLinkPropControllerData.js +2 -2
  94. package/dist/esm/components/hooks/useLinkPropControllerData.js.map +1 -1
  95. package/dist/esm/components/hooks/useNavigationLinksPropControllerData.js +12 -0
  96. package/dist/esm/components/hooks/useNavigationLinksPropControllerData.js.map +1 -0
  97. package/dist/esm/components/hooks/useTextAreaPropControllerData.js +12 -0
  98. package/dist/esm/components/hooks/useTextAreaPropControllerData.js.map +1 -0
  99. package/dist/esm/components/shared/Link/index.js.map +1 -1
  100. package/dist/esm/controls/control.js +3 -3
  101. package/dist/esm/controls/control.js.map +1 -1
  102. package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
  103. package/dist/esm/prop-controllers/copy.js +4 -4
  104. package/dist/esm/prop-controllers/copy.js.map +1 -1
  105. package/dist/esm/prop-controllers/deleted.js +9 -0
  106. package/dist/esm/prop-controllers/deleted.js.map +1 -0
  107. package/dist/esm/prop-controllers/descriptors.js +0 -96
  108. package/dist/esm/prop-controllers/descriptors.js.map +1 -1
  109. package/dist/esm/prop-controllers/index.js +2 -0
  110. package/dist/esm/prop-controllers/index.js.map +1 -1
  111. package/dist/esm/prop-controllers/introspection.js +7 -83
  112. package/dist/esm/prop-controllers/introspection.js.map +1 -1
  113. package/dist/esm/runtimes/react/components/PreviewProvider.js +4 -0
  114. package/dist/esm/runtimes/react/components/PreviewProvider.js.map +1 -1
  115. package/dist/esm/runtimes/react/controls.js +44 -0
  116. package/dist/esm/runtimes/react/controls.js.map +1 -1
  117. package/dist/esm/state/react-builder-preview.js +105 -45
  118. package/dist/esm/state/react-builder-preview.js.map +1 -1
  119. package/dist/types/builder/serialization/control-serialization.d.ts +24 -23
  120. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
  121. package/dist/types/components/builtin/Box/Box.d.ts +15 -3
  122. package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
  123. package/dist/types/components/builtin/Box/register.d.ts.map +1 -1
  124. package/dist/types/components/builtin/Button/Button.d.ts +12 -12
  125. package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
  126. package/dist/types/components/builtin/Carousel/Carousel.d.ts +3 -2
  127. package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  128. package/dist/types/components/builtin/Carousel/register.d.ts.map +1 -1
  129. package/dist/types/components/builtin/Countdown/Countdown.d.ts +3 -3
  130. package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
  131. package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -1
  132. package/dist/types/components/builtin/Embed/Embed.d.ts +2 -2
  133. package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
  134. package/dist/types/components/builtin/Form/Form.d.ts +4 -4
  135. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  136. package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
  137. package/dist/types/components/builtin/Image/Image.d.ts +2 -2
  138. package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
  139. package/dist/types/components/builtin/Navigation/Navigation.d.ts +5 -5
  140. package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  141. package/dist/types/components/builtin/Navigation/components/MobileMenu/index.d.ts +2 -3
  142. package/dist/types/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
  143. package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
  144. package/dist/types/components/builtin/Root/Root.d.ts +4 -3
  145. package/dist/types/components/builtin/Root/Root.d.ts.map +1 -1
  146. package/dist/types/components/builtin/Root/register.d.ts.map +1 -1
  147. package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts +3 -2
  148. package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
  149. package/dist/types/components/hooks/useGapXPropControllerData.d.ts +3 -0
  150. package/dist/types/components/hooks/useGapXPropControllerData.d.ts.map +1 -0
  151. package/dist/types/components/hooks/useGapYPropControllerData.d.ts +3 -0
  152. package/dist/types/components/hooks/useGapYPropControllerData.d.ts.map +1 -0
  153. package/dist/types/components/hooks/useLinkPropControllerData.d.ts +2 -2
  154. package/dist/types/components/hooks/useLinkPropControllerData.d.ts.map +1 -1
  155. package/dist/types/components/hooks/useNavigationLinksPropControllerData.d.ts +3 -0
  156. package/dist/types/components/hooks/useNavigationLinksPropControllerData.d.ts.map +1 -0
  157. package/dist/types/components/hooks/useTextAreaPropControllerData.d.ts +3 -0
  158. package/dist/types/components/hooks/useTextAreaPropControllerData.d.ts.map +1 -0
  159. package/dist/types/components/shared/Link/index.d.ts +2 -2
  160. package/dist/types/components/shared/Link/index.d.ts.map +1 -1
  161. package/dist/types/next/components/tests/page-gap-x-prop-controller.test.d.ts +3 -0
  162. package/dist/types/next/components/tests/page-gap-x-prop-controller.test.d.ts.map +1 -0
  163. package/dist/types/next/components/tests/page-gap-y-prop-controller.test.d.ts +3 -0
  164. package/dist/types/next/components/tests/page-gap-y-prop-controller.test.d.ts.map +1 -0
  165. package/dist/types/next/components/tests/page-link-prop-controller.test.d.ts +3 -0
  166. package/dist/types/next/components/tests/page-link-prop-controller.test.d.ts.map +1 -0
  167. package/dist/types/next/components/tests/page-navigation-links-prop-controller.test.d.ts +3 -0
  168. package/dist/types/next/components/tests/page-navigation-links-prop-controller.test.d.ts.map +1 -0
  169. package/dist/types/next/components/tests/page-text-area-prop-controller.test.d.ts +3 -0
  170. package/dist/types/next/components/tests/page-text-area-prop-controller.test.d.ts.map +1 -0
  171. package/dist/types/prop-controllers/copy.d.ts.map +1 -1
  172. package/dist/types/prop-controllers/deleted.d.ts +51 -0
  173. package/dist/types/prop-controllers/deleted.d.ts.map +1 -0
  174. package/dist/types/prop-controllers/descriptors.d.ts +14 -188
  175. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  176. package/dist/types/prop-controllers/index.d.ts +2 -1
  177. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  178. package/dist/types/prop-controllers/introspection.d.ts.map +1 -1
  179. package/dist/types/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
  180. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  181. package/dist/types/state/react-builder-preview.d.ts +11 -3
  182. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  183. package/package.json +2 -2
  184. package/dist/cjs/prop-controllers/copy/navigation-links.js +0 -58
  185. package/dist/cjs/prop-controllers/copy/navigation-links.js.map +0 -1
  186. package/dist/esm/prop-controllers/copy/navigation-links.js +0 -34
  187. package/dist/esm/prop-controllers/copy/navigation-links.js.map +0 -1
  188. package/dist/types/prop-controllers/copy/navigation-links.d.ts +0 -4
  189. package/dist/types/prop-controllers/copy/navigation-links.d.ts.map +0 -1
  190. package/dist/types/prop-controllers/copy/navigation-links.test.d.ts +0 -2
  191. package/dist/types/prop-controllers/copy/navigation-links.test.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/state/react-builder-preview.ts"],"sourcesContent":["import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\n\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\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 Pointer from './modules/pointer'\nimport * as ElementImperativeHandles from './modules/element-imperative-handles'\nimport * as Breakpoints from './modules/breakpoints'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n handlePointerMove,\n elementFromPointChange,\n setBreakpoints,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController } from '../prop-controllers/instances'\nimport { PropController } from '../prop-controllers/base'\nimport { serializeControls } from '../builder'\nimport { MakeswiftHostApiClient } from '../api/react'\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nexport const reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.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 pointer: Pointer.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n breakpoints: Breakpoints.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction 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\nfunction getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nfunction getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nfunction getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingPointerMoveEvent(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n window.document.documentElement.addEventListener('pointermove', handlePointerMoveEvent)\n\n return () => {\n window.document.documentElement.removeEventListener('pointermove', handlePointerMoveEvent)\n }\n\n function handlePointerMoveEvent({ clientX, clientY }: PointerEvent) {\n dispatch(handlePointerMove({ clientX, clientY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): ThunkAction<() => void, State, unknown, Action> {\n return (_dispatch, getState) => {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.removeEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction elementKeysFromElementFromPoint(\n elementFromPoint: Element | null,\n): ThunkAction<{ documentKey: string; elementKey: string } | null, State, unknown, Action> {\n return (_dispatch, getState) => {\n if (elementFromPoint == null) return null\n\n const elementImperativeHandles = getElementImperativeHandlesContainingElement(\n getState(),\n elementFromPoint,\n )\n const acendingDepthDocumentKeys = ReactPage.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = acendingDepthDocumentKeys.slice().reverse()\n\n let currentElement: Element | null = elementFromPoint\n let keys = null\n\n while (currentElement != null) {\n for (const documentKey of descendingDepthDocumentKeys) {\n const byElementKey = elementImperativeHandles.get(documentKey)\n\n if (byElementKey == null) continue\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n if (elementImperativeHandle.getDomNode() === currentElement) {\n return { documentKey, elementKey }\n }\n }\n }\n\n currentElement = currentElement.parentElement\n }\n\n return keys\n }\n}\n\nfunction startPollingElementFromPoint(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n let lastElementFromPoint: Element | null = null\n let animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameRequestId)\n }\n\n function handleAnimationFrameRequest() {\n const pointer = getPointer(getState())\n const elementFromPoint =\n pointer == null ? null : document.elementFromPoint(pointer.x, pointer.y)\n\n if (elementFromPoint !== lastElementFromPoint) {\n lastElementFromPoint = elementFromPoint\n\n const keys = dispatch(elementKeysFromElementFromPoint(elementFromPoint))\n\n dispatch(elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents())\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent())\n const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(\n client: MakeswiftHostApiClient,\n): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n let cleanUp = () => {}\n\n if (typeof window === 'undefined') return cleanUp\n\n const messageChannel = new window.MessageChannel()\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n const breakpoints = ReactPage.getBreakpoints(state)\n messageChannel.port1.postMessage(setBreakpoints(breakpoints))\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n case ActionTypes.HANDLE_POINTER_MOVE:\n case ActionTypes.ELEMENT_FROM_POINT_CHANGE:\n case ActionTypes.SET_LOCALE:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.SET_BUILDER_EDIT_MODE:\n messageChannel.port1.postMessage(action)\n window.getSelection()?.removeAllRanges()\n break\n\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n client.setLocalizedResourceId(action.payload)\n break\n }\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nexport function propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey, componentHandle } = action.payload\n const element = ReactPage.getElement(getState(), documentKey, elementKey)\n const propControllers = dispatch(\n createAndRegisterPropControllers(documentKey, elementKey),\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(componentHandle)\n ) {\n dispatch(registerPropControllersHandle(documentKey, elementKey, componentHandle))\n componentHandle.setPropControllers(propControllers)\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n\n break\n }\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nfunction makeswiftApiClientSyncMiddleware(\n client: MakeswiftHostApiClient,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n client.makeswiftApiClient.dispatch(action)\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n rootElements,\n preloadedState,\n client,\n}: {\n rootElements?: Map<string, Documents.Element>\n preloadedState?: PreloadedState<State>\n client: MakeswiftHostApiClient\n}): Store {\n const initialState: PreloadedState<State> = {\n ...preloadedState,\n documents: Documents.getInitialState({ rootElements }),\n isPreview: IsPreview.getInitialState(true),\n }\n\n return createStore(\n reducer,\n initialState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(client),\n propControllerHandlesMiddleware(),\n makeswiftApiClientSyncMiddleware(client),\n ),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBASO;AACP,yBAAkD;AAElD,uBAAsB;AAEtB,gBAA2B;AAC3B,sBAAiC;AACjC,gBAA2B;AAC3B,qBAAgC;AAChC,sBAAiC;AACjC,4BAAuC;AACvC,kBAA6B;AAC7B,gBAA2B;AAC3B,sBAAiC;AACjC,cAAyB;AACzB,+BAA0C;AAC1C,kBAA6B;AAC7B,gBAA2B;AAC3B,qBAiBO;AACP,IAAAA,kBAA4B;AAC5B,uBAAqC;AAErC,qBAAkC;AAMlC,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AA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,GAIU;AACR,QAAM,eAAsC;AAAA,IAC1C,GAAG;AAAA,IACH,WAAW,UAAU,gBAAgB,EAAE,aAAa,CAAC;AAAA,IACrD,WAAW,UAAU,gBAAgB,IAAI;AAAA,EAC3C;AAEA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,QACA;AAAA,MACE,mBAAAC;AAAA,MACA,2BAA2B;AAAA,MAC3B,yBAAyB,MAAM;AAAA,MAC/B,gCAAgC;AAAA,MAChC,iCAAiC,MAAM;AAAA,IACzC;AAAA,EACF;AACF;","names":["import_actions","deepEqual","thunk"]}
1
+ {"version":3,"sources":["../../../src/state/react-builder-preview.ts"],"sourcesContent":["import {\n applyMiddleware,\n combineReducers,\n createStore,\n compose,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n StoreEnhancer,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\n\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\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 Pointer from './modules/pointer'\nimport * as ElementImperativeHandles from './modules/element-imperative-handles'\nimport * as Breakpoints from './modules/breakpoints'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n elementFromPointChange,\n handleWheel,\n handlePointerMove,\n messageBuilderPropController,\n registerBuilderComponent,\n registerComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n setBreakpoints,\n setIsInBuilder,\n unregisterBuilderComponent,\n unregisterComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController } from '../prop-controllers/instances'\nimport { PropController } from '../prop-controllers/base'\nimport { serializeControls } from '../builder'\nimport { MakeswiftHostApiClient } from '../api/react'\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nexport const reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.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 pointer: Pointer.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n breakpoints: Breakpoints.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction 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\nfunction getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nfunction getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nfunction getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingPointerMoveEvent(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n window.document.documentElement.addEventListener('pointermove', handlePointerMoveEvent)\n\n return () => {\n window.document.documentElement.removeEventListener('pointermove', handlePointerMoveEvent)\n }\n\n function handlePointerMoveEvent({ clientX, clientY }: PointerEvent) {\n dispatch(handlePointerMove({ clientX, clientY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): ThunkAction<() => void, State, unknown, Action> {\n return (_dispatch, getState) => {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.removeEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction elementKeysFromElementFromPoint(\n elementFromPoint: Element | null,\n): ThunkAction<{ documentKey: string; elementKey: string } | null, State, unknown, Action> {\n return (_dispatch, getState) => {\n if (elementFromPoint == null) return null\n\n const elementImperativeHandles = getElementImperativeHandlesContainingElement(\n getState(),\n elementFromPoint,\n )\n const acendingDepthDocumentKeys = ReactPage.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = acendingDepthDocumentKeys.slice().reverse()\n\n let currentElement: Element | null = elementFromPoint\n let keys = null\n\n while (currentElement != null) {\n for (const documentKey of descendingDepthDocumentKeys) {\n const byElementKey = elementImperativeHandles.get(documentKey)\n\n if (byElementKey == null) continue\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n if (elementImperativeHandle.getDomNode() === currentElement) {\n return { documentKey, elementKey }\n }\n }\n }\n\n currentElement = currentElement.parentElement\n }\n\n return keys\n }\n}\n\nfunction startPollingElementFromPoint(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n let lastElementFromPoint: Element | null = null\n let animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameRequestId)\n }\n\n function handleAnimationFrameRequest() {\n const pointer = getPointer(getState())\n const elementFromPoint =\n pointer == null ? null : document.elementFromPoint(pointer.x, pointer.y)\n\n if (elementFromPoint !== lastElementFromPoint) {\n lastElementFromPoint = elementFromPoint\n\n const keys = dispatch(elementKeysFromElementFromPoint(elementFromPoint))\n\n dispatch(elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction registerBuilderComponents(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const state = getState()\n const componentsMeta = getComponentsMeta(state)\n\n componentsMeta.forEach((meta, type) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(state, type)\n if (propControllerDescriptors != null) {\n dispatch(registerComponent(type, meta, propControllerDescriptors))\n }\n })\n\n return () => {\n componentsMeta.forEach((_, componentType) => {\n dispatch(unregisterComponent(componentType))\n })\n }\n }\n}\n\nexport interface IMessageChannel {\n postMessage(message: any, transferables?: Transferable[]): void\n dispatchBuffered(): void\n}\n\nexport function initialize(\n channel: IMessageChannel,\n): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents())\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent())\n const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint())\n const unregisterBuilderComponents = dispatch(registerBuilderComponents())\n\n const breakpoints = ReactPage.getBreakpoints(getState())\n dispatch(setBreakpoints(breakpoints))\n dispatch(setIsInBuilder(true))\n channel.dispatchBuffered()\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n unregisterBuilderComponents()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(\n client: MakeswiftHostApiClient,\n channel: IMessageChannel,\n): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n if (typeof window === 'undefined') return () => {}\n\n let cleanUp = () => {}\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n case ActionTypes.HANDLE_POINTER_MOVE:\n case ActionTypes.ELEMENT_FROM_POINT_CHANGE:\n case ActionTypes.SET_LOCALE:\n case ActionTypes.SET_BREAKPOINTS:\n channel.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n channel.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n channel.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.SET_BUILDER_EDIT_MODE:\n channel.postMessage(action)\n window.getSelection()?.removeAllRanges()\n break\n\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n client.setLocalizedResourceId(action.payload)\n break\n }\n\n case ActionTypes.INIT:\n // dispatched by the parent window after establishing the connection\n cleanUp = dispatch(initialize(channel))\n break\n\n case ActionTypes.CLEAN_UP:\n // dispatched by the parent window on disconnect\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nexport function propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey, componentHandle } = action.payload\n const element = ReactPage.getElement(getState(), documentKey, elementKey)\n const propControllers = dispatch(\n createAndRegisterPropControllers(documentKey, elementKey),\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(componentHandle)\n ) {\n dispatch(registerPropControllersHandle(documentKey, elementKey, componentHandle))\n componentHandle.setPropControllers(propControllers)\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n\n break\n }\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nfunction makeswiftApiClientSyncMiddleware(\n client: MakeswiftHostApiClient,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n client.makeswiftApiClient.dispatch(action)\n\n return next(action)\n }\n }\n}\n\nclass MessageChannel {\n private channel: MessagePort | null = null\n private bufferedMessages: [Action, Transferable[]?][] = []\n\n public postMessage(message: any, transferables?: Transferable[]) {\n if (this.channel) {\n this.channel.postMessage(message, transferables ?? [])\n } else {\n this.bufferedMessages.push([message, transferables])\n }\n }\n\n public setup(onMessage: (event: MessageEvent<Action>) => void) {\n const channel = new window.MessageChannel()\n channel.port1.onmessage = onMessage\n\n // connect channel to the parent window, see\n // https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\n window.parent.postMessage(channel.port2, '*', [channel.port2])\n\n this.channel = channel.port1\n }\n\n public dispatchBuffered() {\n console.assert(this.channel != null, 'channel is not setup')\n\n this.bufferedMessages.forEach(([message, transferables]) => {\n this.channel?.postMessage(message, transferables ?? [])\n })\n\n this.bufferedMessages = []\n }\n\n public teardown() {\n if (this.channel) {\n this.channel.onmessage = null\n this.channel.close()\n }\n }\n}\n\nfunction setupMessageChannel(channel: MessageChannel): ThunkAction<void, State, unknown, Action> {\n return dispatch => {\n channel.setup((event: MessageEvent<Action>) => dispatch(event.data))\n }\n}\n\ninterface SetupTeardownMixin {\n setup: () => void\n teardown: () => void\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch } & SetupTeardownMixin\n\nfunction withSetupTeardown(\n setup: () => void,\n teardown: () => void,\n): StoreEnhancer<SetupTeardownMixin> {\n return next => (reducer, preloadedState?) => ({\n ...next(reducer, preloadedState),\n setup,\n teardown,\n })\n}\n\nexport function configureStore({\n rootElements,\n preloadedState,\n client,\n}: {\n rootElements?: Map<string, Documents.Element>\n preloadedState?: PreloadedState<State>\n client: MakeswiftHostApiClient\n}): Store {\n const initialState: PreloadedState<State> = {\n ...preloadedState,\n documents: Documents.getInitialState({ rootElements }),\n isPreview: IsPreview.getInitialState(true),\n }\n\n const channel = new MessageChannel()\n const store = createStore(\n reducer,\n initialState,\n compose(\n withSetupTeardown(\n () => {\n const dispatch = store.dispatch as Dispatch\n dispatch(setupMessageChannel(channel))\n },\n () => channel.teardown(),\n ),\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(client, channel),\n propControllerHandlesMiddleware(),\n makeswiftApiClientSyncMiddleware(client),\n ),\n ),\n )\n\n return store\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAWO;AACP,yBAAkD;AAElD,uBAAsB;AAEtB,gBAA2B;AAC3B,sBAAiC;AACjC,gBAA2B;AAC3B,qBAAgC;AAChC,sBAAiC;AACjC,4BAAuC;AACvC,kBAA6B;AAC7B,gBAA2B;AAC3B,sBAAiC;AACjC,cAAyB;AACzB,+BAA0C;AAC1C,kBAA6B;AAC7B,gBAA2B;AAC3B,qBAmBO;AACP,IAAAA,kBAA4B;AAC5B,uBAAqC;AAErC,qBAAkC;AAMlC,wBAAyC;AAElC,MAAM,cAAU,8BAAgB;AAAA,EACrC,WAAW,UAAU;AAAA,EACrB,iBAAiB,gBAAgB;AAAA,EACjC,WAAW,UAAU;AAAA,EACrB,gBAAgB,eAAe;AAAA,EAC/B,iBAAiB,gBAAgB;AAAA,EACjC,uBAAuB,sBAAsB;AAAA,EAC7C,aAAa,YAAY;AAAA,EACzB,WAAW,UAAU;AAAA,EACrB,iBAAiB,gBAAgB;AAAA,EACjC,SAAS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AA,UACA;AAAA,QACE,mBAAAC;AAAA,QACA,2BAA2B;AAAA,QAC3B,yBAAyB,QAAQ,OAAO;AAAA,QACxC,gCAAgC;AAAA,QAChC,iCAAiC,MAAM;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":["import_actions","deepEqual","reducer","thunk"]}
@@ -8,6 +8,9 @@ import {
8
8
  import {
9
9
  Props as Controls
10
10
  } from "../../prop-controllers";
11
+ import {
12
+ DELETED_PROP_CONTROLLER_TYPES
13
+ } from "../../prop-controllers/deleted";
11
14
  import {
12
15
  deserializeComboboxControlDefinition,
13
16
  serializeComboboxControlDefinition
@@ -311,15 +314,15 @@ function serializeControl(control) {
311
314
  switch (control.type) {
312
315
  case PropControllerTypes.Checkbox:
313
316
  return serializeCheckboxControl(control);
314
- case Controls.Types.List:
317
+ case DELETED_PROP_CONTROLLER_TYPES.List:
315
318
  return serializeListControl(control);
316
- case Controls.Types.Shape:
319
+ case DELETED_PROP_CONTROLLER_TYPES.Shape:
317
320
  return serializeShapeControl(control);
318
- case Controls.Types.Typeahead:
321
+ case DELETED_PROP_CONTROLLER_TYPES.Typeahead:
319
322
  return serializeTypeaheadControl(control);
320
- case Controls.Types.GapX:
323
+ case PropControllerTypes.GapX:
321
324
  return serializeGapXControl(control);
322
- case Controls.Types.GapY:
325
+ case PropControllerTypes.GapY:
323
326
  return serializeGapYControl(control);
324
327
  case PropControllerTypes.ResponsiveColor:
325
328
  return serializeResponsiveColorControl(control);
@@ -363,15 +366,15 @@ function deserializeControl(serializedControl) {
363
366
  switch (serializedControl.type) {
364
367
  case PropControllerTypes.Checkbox:
365
368
  return deserializeCheckboxControl(serializedControl);
366
- case Controls.Types.List:
369
+ case DELETED_PROP_CONTROLLER_TYPES.List:
367
370
  return deserializeListControl(serializedControl);
368
- case Controls.Types.Shape:
371
+ case DELETED_PROP_CONTROLLER_TYPES.Shape:
369
372
  return deserializeShapeControl(serializedControl);
370
- case Controls.Types.Typeahead:
373
+ case DELETED_PROP_CONTROLLER_TYPES.Typeahead:
371
374
  return deserializeTypeaheadControl(serializedControl);
372
- case Controls.Types.GapX:
375
+ case PropControllerTypes.GapX:
373
376
  return deserializeGapXControl(serializedControl);
374
- case Controls.Types.GapY:
377
+ case PropControllerTypes.GapY:
375
378
  return deserializeGapYControl(serializedControl);
376
379
  case PropControllerTypes.ResponsiveColor:
377
380
  return deserializeResponsiveColorControl(serializedControl);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/builder/serialization/control-serialization.ts"],"sourcesContent":["import {\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n} from '@makeswift/prop-controllers'\nimport {\n ComboboxControlDefinition,\n ComboboxControlType,\n ListControlDefinition,\n ListControlType,\n RichTextV2ControlDefinition,\n RichTextV2ControlType,\n ShapeControlDefinition,\n ShapeControlType,\n StyleV2ControlDefinition,\n StyleV2ControlType,\n} from '../../controls'\nimport {\n Data,\n Device,\n Gap,\n GapXDescriptor as GapXControl,\n GapXValue as GapXControlValue,\n GapYDescriptor as GapYControl,\n GapYValue as GapYControlValue,\n ImageDescriptor as ImageControl,\n ImageValue as ImageControlValue,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ResponsiveNumberDescriptor as ResponsiveNumberControl,\n ResponsiveNumberValue as ResponsiveNumberControlValue,\n ResponsiveIconRadioGroupDescriptor as ResponsiveIconRadioGroupControl,\n ResponsiveIconRadioGroupValue as ResponsiveIconRadioGroupControlValue,\n ResponsiveSelectDescriptor as ResponsiveSelectControl,\n ResponsiveSelectValue as ResponsiveSelectControlValue,\n RichTextDescriptor as RichTextControl,\n RichTextValue as RichTextControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TextInputDescriptor as TextInputControl,\n TextInputValue as TextInputControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n PropControllerDescriptor as Control,\n Props as Controls,\n} from '../../prop-controllers'\nimport {\n IconRadioGroupOption,\n SelectLabelOrientation,\n SelectOption,\n} from '../../prop-controllers/descriptors'\nimport {\n deserializeComboboxControlDefinition,\n serializeComboboxControlDefinition,\n} from './controls/combobox'\nimport { deserializeListControlDefinition, serializeListControlDefinition } from './controls/list'\nimport { deserializeRichTextControlV2, serializeRichTextControlV2 } from './controls/rich-text-v2'\nimport {\n deserializeShapeControlDefinition,\n serializeShapeControlDefinition,\n} from './controls/shape'\nimport { deserializeStyleV2Control, serializeStyleV2Control } from './controls/style-v2'\nimport { Deserialize, Serialize } from './controls/types'\nimport {\n DeserializedFunction,\n deserializeFunction,\n isSerializedFunction,\n SerializedFunction,\n serializeFunction,\n} from './function-serialization'\nimport {\n LinkData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n Types as PropControllerTypes,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n ResponsiveLengthDescriptor,\n NumberOptions,\n NumberPropControllerData,\n NumberDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveColorDescriptor,\n CheckboxPropControllerData,\n CheckboxDescriptor as CheckboxControl,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n} from '@makeswift/prop-controllers'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof Controls.Types.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof Controls.Types.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof Controls.Types.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof Controls.Types.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = getItemLabel && deserializeFunction(getItemLabel)\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof Controls.Types.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof Controls.Types.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = getItems && deserializeFunction(getItems)\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype GapXControlConfig = {\n preset?: GapXControlValue\n label?: string\n defaultValue?: Gap\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapXControl<_T = GapXControlValue> = {\n type: typeof Controls.Types.GapX\n options: SerializedConfig<GapXControlConfig>\n}\n\nfunction serializeGapXControl(control: GapXControl): [SerializedGapXControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapXControl<_T = GapXControlValue> = {\n type: typeof Controls.Types.GapX\n options: DeserializedConfig<GapXControlConfig>\n}\n\nfunction deserializeGapXControl(serializedControl: SerializedGapXControl): DeserializedGapXControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYControlValue\n label?: string\n defaultValue?: Gap\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYControlValue> = {\n type: typeof Controls.Types.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYControl): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYControlValue> = {\n type: typeof Controls.Types.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveNumberControlConfig = {\n preset?: ResponsiveNumberControlValue\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedResponsiveNumberControl<_T = ResponsiveNumberControlValue> = {\n type: typeof Controls.Types.ResponsiveNumber\n options: SerializedConfig<ResponsiveNumberControlConfig>\n}\n\nfunction serializeResponsiveNumberControl(\n control: ResponsiveNumberControl,\n): [SerializedResponsiveNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveNumberControl<_T = ResponsiveNumberControlValue> = {\n type: typeof Controls.Types.ResponsiveNumber\n options: DeserializedConfig<ResponsiveNumberControlConfig>\n}\n\nfunction deserializeResponsiveNumberControl(\n serializedControl: SerializedResponsiveNumberControl,\n): DeserializedResponsiveNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype ResponsiveIconRadioGroupControlConfig<T extends string = string, U extends T = T> = {\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}\n\ntype SerializedResponsiveIconRadioGroupControl<_T = ResponsiveIconRadioGroupControlValue> = {\n type: typeof Controls.Types.ResponsiveIconRadioGroup\n options: SerializedConfig<ResponsiveIconRadioGroupControlConfig>\n}\n\nfunction serializeResponsiveIconRadioGroupControl(\n control: ResponsiveIconRadioGroupControl,\n): [SerializedResponsiveIconRadioGroupControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveIconRadioGroupControl<_T = ResponsiveIconRadioGroupControlValue> = {\n type: typeof Controls.Types.ResponsiveIconRadioGroup\n options: DeserializedConfig<ResponsiveIconRadioGroupControlConfig>\n}\n\nfunction deserializeResponsiveIconRadioGroupControl(\n serializedControl: SerializedResponsiveIconRadioGroupControl,\n): DeserializedResponsiveIconRadioGroupControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof Controls.Types.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof Controls.Types.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveSelectControl<_T = ResponsiveSelectControlValue> = {\n type: typeof Controls.Types.ResponsiveSelect\n options: SerializedConfig<ResponsiveSelectControlConfig>\n}\n\nfunction serializeResponsiveSelectControl(\n control: ResponsiveSelectControl,\n): [SerializedResponsiveSelectControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype ResponsiveSelectControlConfig<T extends string = string, U extends T = T> = {\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}\n\ntype DeserializedResponsiveSelectControl<_T = ResponsiveSelectControlValue> = {\n type: typeof Controls.Types.ResponsiveSelect\n options: DeserializedConfig<ResponsiveSelectControlConfig>\n}\n\nfunction deserializeResponsiveSelectControl(\n serializedControl: SerializedResponsiveSelectControl,\n): DeserializedResponsiveSelectControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof Controls.Types.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof Controls.Types.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof Controls.Types.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof Controls.Types.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedControl<T extends Data = Data> =\n | Exclude<\n Control<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | GapXControl<T>\n | GapYControl<T>\n | ResponsiveNumberControl<T>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | ResponsiveIconRadioGroupControl<\n T extends ResponsiveIconRadioGroupControlValue ? T : ResponsiveIconRadioGroupControlValue\n >\n | ResponsiveSelectControl<\n T extends ResponsiveSelectControlValue ? T : ResponsiveSelectControlValue\n >\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n | RichTextV2ControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | StyleV2ControlDefinition\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedGapXControl<T>\n | SerializedGapYControl<T>\n | SerializedResponsiveNumberControl<T>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedResponsiveIconRadioGroupControl<T>\n | SerializedResponsiveSelectControl<T>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n | Serialize<RichTextV2ControlDefinition>\n | Serialize<ComboboxControlDefinition>\n | Serialize<ShapeControlDefinition>\n | Serialize<ListControlDefinition>\n | Serialize<StyleV2ControlDefinition>\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedControl<T extends Data = Data> =\n | Exclude<\n Control<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | GapXControl<T>\n | GapYControl<T>\n | ResponsiveNumberControl<T>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | ResponsiveIconRadioGroupControl<\n T extends ResponsiveIconRadioGroupControlValue ? T : ResponsiveIconRadioGroupControlValue\n >\n | ResponsiveSelectControl<\n T extends ResponsiveSelectControlValue ? T : ResponsiveSelectControlValue\n >\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n | RichTextV2ControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | StyleV2ControlDefinition\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedGapXControl<T>\n | DeserializedGapYControl<T>\n | DeserializedResponsiveNumberControl<T>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedResponsiveIconRadioGroupControl<T>\n | DeserializedResponsiveSelectControl<T>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n | Deserialize<Serialize<RichTextV2ControlDefinition>>\n | Deserialize<Serialize<ComboboxControlDefinition>>\n | Deserialize<Serialize<ShapeControlDefinition>>\n | Deserialize<Serialize<ListControlDefinition>>\n | Deserialize<Serialize<StyleV2ControlDefinition>>\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeControl<T extends Data>(\n control: Control<T>,\n): [SerializedControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case Controls.Types.List:\n return serializeListControl(control)\n\n case Controls.Types.Shape:\n return serializeShapeControl(control)\n\n case Controls.Types.Typeahead:\n return serializeTypeaheadControl(control)\n\n case Controls.Types.GapX:\n return serializeGapXControl(control)\n\n case Controls.Types.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case Controls.Types.ResponsiveNumber:\n return serializeResponsiveNumberControl(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case Controls.Types.ResponsiveIconRadioGroup:\n return serializeResponsiveIconRadioGroupControl(control)\n\n case Controls.Types.ResponsiveSelect:\n return serializeResponsiveSelectControl(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case Controls.Types.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case Controls.Types.Image:\n return serializeImageControl(control)\n\n case Controls.Types.RichText:\n return serializeRichTextControl(control)\n\n case RichTextV2ControlType:\n return serializeRichTextControlV2(control)\n\n case StyleV2ControlType:\n return serializeStyleV2Control(control)\n\n case ComboboxControlType:\n return serializeComboboxControlDefinition(control)\n\n case ShapeControlType:\n return serializeShapeControlDefinition(control)\n\n case ListControlType:\n return serializeListControlDefinition(control)\n\n default:\n return [control, []]\n }\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n): DeserializedControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case Controls.Types.List:\n return deserializeListControl(serializedControl)\n\n case Controls.Types.Shape:\n return deserializeShapeControl(serializedControl)\n\n case Controls.Types.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case Controls.Types.GapX:\n return deserializeGapXControl(serializedControl)\n\n case Controls.Types.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case Controls.Types.ResponsiveNumber:\n return deserializeResponsiveNumberControl(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case Controls.Types.ResponsiveIconRadioGroup:\n return deserializeResponsiveIconRadioGroupControl(serializedControl)\n\n case Controls.Types.ResponsiveSelect:\n return deserializeResponsiveSelectControl(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case Controls.Types.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case Controls.Types.Image:\n return deserializeImageControl(serializedControl)\n\n case Controls.Types.RichText:\n return deserializeRichTextControl(serializedControl)\n\n case RichTextV2ControlType:\n return deserializeRichTextControlV2(serializedControl)\n\n case StyleV2ControlType:\n return deserializeStyleV2Control(serializedControl)\n\n case ComboboxControlType:\n return deserializeComboboxControlDefinition(serializedControl)\n\n case ShapeControlType:\n return deserializeShapeControlDefinition(serializedControl)\n\n case ListControlType:\n return deserializeListControlDefinition(serializedControl)\n\n default:\n return serializedControl\n }\n}\n\nexport function serializeControls(\n controls: Record<string, Control>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, SerializedControl>,\n): Record<string, DeserializedControl> {\n return Object.entries(serializedControls).reduce(\n (deserializedControls, [key, serializedControl]) => {\n return { ...deserializedControls, [key]: deserializeControl(serializedControl) }\n },\n {} as Record<string, DeserializedControl>,\n )\n}\n"],"mappings":"AAIA;AAAA,EAEE;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAgCE,SAAS;AAAA,OACJ;AAMP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kCAAkC,sCAAsC;AACjF,SAAS,8BAA8B,kCAAkC;AACzE;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B,+BAA+B;AAEnE;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAIE,SAAS;AAAA,OAaJ;AAeP,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;AAIxB,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKA,QAAO,MAAM;AAC/C,UAAM,CAAC,mBAAmB,8BAA8B,IAAI,iBAAiBA,QAAO;AAEpF,mBAAe,GAAwB,IAAI;AAC3C,kBAAc,KAAK,GAAG,8BAA8B;AAAA,EACtD,CAAC;AAGD,SAAO,CAAC,EAAE,GAAG,SAAS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IAEjD,KAAK,oBAAoB;AACvB,aAAO,uBAAuB,iBAAiB;AAAA,IAEjD,KAAK,SAAS,MAAM;AAClB,aAAO,4BAA4B,iBAAiB;AAAA,IAEtD,KAAK,oBAAoB;AACvB,aAAO,4BAA4B,iBAAiB;AAAA,IAEtD,KAAK,SAAS,MAAM;AAClB,aAAO,wBAAwB,iBAAiB;AAAA,IAElD,KAAK,SAAS,MAAM;AAClB,aAAO,2BAA2B,iBAAiB;AAAA,IAErD,KAAK;AACH,aAAO,6BAA6B,iBAAiB;AAAA,IAEvD,KAAK;AACH,aAAO,0BAA0B,iBAAiB;AAAA,IAEpD,KAAK;AACH,aAAO,qCAAqC,iBAAiB;AAAA,IAE/D,KAAK;AACH,aAAO,kCAAkC,iBAAiB;AAAA,IAE5D,KAAK;AACH,aAAO,iCAAiC,iBAAiB;AAAA,IAE3D;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,kBACd,UACqD;AACrD,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,CAAC,aAAa,gBAAgB,GAAG,CAAC,KAAK,OAAO,MAAM;AACnD,YAAM,CAAC,mBAAmB,aAAa,IAAI,iBAAiB,OAAO;AAEnE,aAAO,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,GAAG,kBAAkB,GAAG,CAAC,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAAA,IAC/F;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAEO,SAAS,oBACd,oBACqC;AACrC,SAAO,OAAO,QAAQ,kBAAkB,EAAE;AAAA,IACxC,CAAC,sBAAsB,CAAC,KAAK,iBAAiB,MAAM;AAClD,aAAO,EAAE,GAAG,sBAAsB,CAAC,GAAG,GAAG,mBAAmB,iBAAiB,EAAE;AAAA,IACjF;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["control"]}
1
+ {"version":3,"sources":["../../../../src/builder/serialization/control-serialization.ts"],"sourcesContent":["import {\n GapData,\n GapXDescriptor,\n GapXPropControllerData,\n GapYDescriptor,\n GapYPropControllerData,\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n} from '@makeswift/prop-controllers'\nimport {\n ComboboxControlDefinition,\n ComboboxControlType,\n ListControlDefinition,\n ListControlType,\n RichTextV2ControlDefinition,\n RichTextV2ControlType,\n ShapeControlDefinition,\n ShapeControlType,\n StyleV2ControlDefinition,\n StyleV2ControlType,\n} from '../../controls'\nimport {\n Data,\n Device,\n ImageDescriptor as ImageControl,\n ImageValue as ImageControlValue,\n ResponsiveNumberDescriptor as ResponsiveNumberControl,\n ResponsiveNumberValue as ResponsiveNumberControlValue,\n ResponsiveIconRadioGroupDescriptor as ResponsiveIconRadioGroupControl,\n ResponsiveIconRadioGroupValue as ResponsiveIconRadioGroupControlValue,\n ResponsiveSelectDescriptor as ResponsiveSelectControl,\n ResponsiveSelectValue as ResponsiveSelectControlValue,\n RichTextDescriptor as RichTextControl,\n RichTextValue as RichTextControlValue,\n TextInputDescriptor as TextInputControl,\n TextInputValue as TextInputControlValue,\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n PropControllerDescriptor as Control,\n Props as Controls,\n} from '../../prop-controllers'\nimport {\n DELETED_PROP_CONTROLLER_TYPES,\n DeletedPropControllerDescriptor,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n} from '../../prop-controllers/deleted'\nimport {\n IconRadioGroupOption,\n SelectLabelOrientation,\n SelectOption,\n} from '../../prop-controllers/descriptors'\nimport {\n deserializeComboboxControlDefinition,\n serializeComboboxControlDefinition,\n} from './controls/combobox'\nimport { deserializeListControlDefinition, serializeListControlDefinition } from './controls/list'\nimport { deserializeRichTextControlV2, serializeRichTextControlV2 } from './controls/rich-text-v2'\nimport {\n deserializeShapeControlDefinition,\n serializeShapeControlDefinition,\n} from './controls/shape'\nimport { deserializeStyleV2Control, serializeStyleV2Control } from './controls/style-v2'\nimport { Deserialize, Serialize } from './controls/types'\nimport {\n DeserializedFunction,\n deserializeFunction,\n isSerializedFunction,\n SerializedFunction,\n serializeFunction,\n} from './function-serialization'\nimport {\n LinkData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n Types as PropControllerTypes,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n ResponsiveLengthDescriptor,\n NumberOptions,\n NumberPropControllerData,\n NumberDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveColorDescriptor,\n CheckboxPropControllerData,\n CheckboxDescriptor as CheckboxControl,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n} from '@makeswift/prop-controllers'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = getItemLabel && deserializeFunction(getItemLabel)\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = getItems && deserializeFunction(getItems)\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype GapXControlConfig = {\n preset?: GapXPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapXControl<_T = GapXPropControllerData> = {\n type: typeof PropControllerTypes.GapX\n options: SerializedConfig<GapXControlConfig>\n}\n\nfunction serializeGapXControl(control: GapXDescriptor): [SerializedGapXControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapXControl<_T = GapXPropControllerData> = {\n type: typeof PropControllerTypes.GapX\n options: DeserializedConfig<GapXControlConfig>\n}\n\nfunction deserializeGapXControl(serializedControl: SerializedGapXControl): DeserializedGapXControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYDescriptor): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveNumberControlConfig = {\n preset?: ResponsiveNumberControlValue\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedResponsiveNumberControl<_T = ResponsiveNumberControlValue> = {\n type: typeof Controls.Types.ResponsiveNumber\n options: SerializedConfig<ResponsiveNumberControlConfig>\n}\n\nfunction serializeResponsiveNumberControl(\n control: ResponsiveNumberControl,\n): [SerializedResponsiveNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveNumberControl<_T = ResponsiveNumberControlValue> = {\n type: typeof Controls.Types.ResponsiveNumber\n options: DeserializedConfig<ResponsiveNumberControlConfig>\n}\n\nfunction deserializeResponsiveNumberControl(\n serializedControl: SerializedResponsiveNumberControl,\n): DeserializedResponsiveNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype ResponsiveIconRadioGroupControlConfig<T extends string = string, U extends T = T> = {\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}\n\ntype SerializedResponsiveIconRadioGroupControl<_T = ResponsiveIconRadioGroupControlValue> = {\n type: typeof Controls.Types.ResponsiveIconRadioGroup\n options: SerializedConfig<ResponsiveIconRadioGroupControlConfig>\n}\n\nfunction serializeResponsiveIconRadioGroupControl(\n control: ResponsiveIconRadioGroupControl,\n): [SerializedResponsiveIconRadioGroupControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveIconRadioGroupControl<_T = ResponsiveIconRadioGroupControlValue> = {\n type: typeof Controls.Types.ResponsiveIconRadioGroup\n options: DeserializedConfig<ResponsiveIconRadioGroupControlConfig>\n}\n\nfunction deserializeResponsiveIconRadioGroupControl(\n serializedControl: SerializedResponsiveIconRadioGroupControl,\n): DeserializedResponsiveIconRadioGroupControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof Controls.Types.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof Controls.Types.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveSelectControl<_T = ResponsiveSelectControlValue> = {\n type: typeof Controls.Types.ResponsiveSelect\n options: SerializedConfig<ResponsiveSelectControlConfig>\n}\n\nfunction serializeResponsiveSelectControl(\n control: ResponsiveSelectControl,\n): [SerializedResponsiveSelectControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype ResponsiveSelectControlConfig<T extends string = string, U extends T = T> = {\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}\n\ntype DeserializedResponsiveSelectControl<_T = ResponsiveSelectControlValue> = {\n type: typeof Controls.Types.ResponsiveSelect\n options: DeserializedConfig<ResponsiveSelectControlConfig>\n}\n\nfunction deserializeResponsiveSelectControl(\n serializedControl: SerializedResponsiveSelectControl,\n): DeserializedResponsiveSelectControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof Controls.Types.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof Controls.Types.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof Controls.Types.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof Controls.Types.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedControl<T extends Data = Data> =\n | Exclude<\n Control<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | ResponsiveNumberControl<T>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | ResponsiveIconRadioGroupControl<\n T extends ResponsiveIconRadioGroupControlValue ? T : ResponsiveIconRadioGroupControlValue\n >\n | ResponsiveSelectControl<\n T extends ResponsiveSelectControlValue ? T : ResponsiveSelectControlValue\n >\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n | RichTextV2ControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | StyleV2ControlDefinition\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedGapXControl<T>\n | SerializedGapYControl<T>\n | SerializedResponsiveNumberControl<T>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedResponsiveIconRadioGroupControl<T>\n | SerializedResponsiveSelectControl<T>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n | Serialize<RichTextV2ControlDefinition>\n | Serialize<ComboboxControlDefinition>\n | Serialize<ShapeControlDefinition>\n | Serialize<ListControlDefinition>\n | Serialize<StyleV2ControlDefinition>\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedControl<T extends Data = Data> =\n | Exclude<\n Control<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | ResponsiveNumberControl<T>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | ResponsiveIconRadioGroupControl<\n T extends ResponsiveIconRadioGroupControlValue ? T : ResponsiveIconRadioGroupControlValue\n >\n | ResponsiveSelectControl<\n T extends ResponsiveSelectControlValue ? T : ResponsiveSelectControlValue\n >\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n | RichTextV2ControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | StyleV2ControlDefinition\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedGapXControl<T>\n | DeserializedGapYControl<T>\n | DeserializedResponsiveNumberControl<T>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedResponsiveIconRadioGroupControl<T>\n | DeserializedResponsiveSelectControl<T>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n | Deserialize<Serialize<RichTextV2ControlDefinition>>\n | Deserialize<Serialize<ComboboxControlDefinition>>\n | Deserialize<Serialize<ShapeControlDefinition>>\n | Deserialize<Serialize<ListControlDefinition>>\n | Deserialize<Serialize<StyleV2ControlDefinition>>\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeControl<T extends Data>(\n control: Control<T> | DeletedPropControllerDescriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return serializeListControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return serializeShapeControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return serializeTypeaheadControl(control)\n\n case PropControllerTypes.GapX:\n return serializeGapXControl(control)\n\n case PropControllerTypes.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case Controls.Types.ResponsiveNumber:\n return serializeResponsiveNumberControl(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case Controls.Types.ResponsiveIconRadioGroup:\n return serializeResponsiveIconRadioGroupControl(control)\n\n case Controls.Types.ResponsiveSelect:\n return serializeResponsiveSelectControl(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case Controls.Types.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case Controls.Types.Image:\n return serializeImageControl(control)\n\n case Controls.Types.RichText:\n return serializeRichTextControl(control)\n\n case RichTextV2ControlType:\n return serializeRichTextControlV2(control)\n\n case StyleV2ControlType:\n return serializeStyleV2Control(control)\n\n case ComboboxControlType:\n return serializeComboboxControlDefinition(control)\n\n case ShapeControlType:\n return serializeShapeControlDefinition(control)\n\n case ListControlType:\n return serializeListControlDefinition(control)\n\n default:\n return [control, []]\n }\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n): DeserializedControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return deserializeListControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return deserializeShapeControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case PropControllerTypes.GapX:\n return deserializeGapXControl(serializedControl)\n\n case PropControllerTypes.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case Controls.Types.ResponsiveNumber:\n return deserializeResponsiveNumberControl(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case Controls.Types.ResponsiveIconRadioGroup:\n return deserializeResponsiveIconRadioGroupControl(serializedControl)\n\n case Controls.Types.ResponsiveSelect:\n return deserializeResponsiveSelectControl(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case Controls.Types.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case Controls.Types.Image:\n return deserializeImageControl(serializedControl)\n\n case Controls.Types.RichText:\n return deserializeRichTextControl(serializedControl)\n\n case RichTextV2ControlType:\n return deserializeRichTextControlV2(serializedControl)\n\n case StyleV2ControlType:\n return deserializeStyleV2Control(serializedControl)\n\n case ComboboxControlType:\n return deserializeComboboxControlDefinition(serializedControl)\n\n case ShapeControlType:\n return deserializeShapeControlDefinition(serializedControl)\n\n case ListControlType:\n return deserializeListControlDefinition(serializedControl)\n\n default:\n return serializedControl\n }\n}\n\nexport function serializeControls(\n controls: Record<string, Control>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, SerializedControl>,\n): Record<string, DeserializedControl> {\n return Object.entries(serializedControls).reduce(\n (deserializedControls, [key, serializedControl]) => {\n return { ...deserializedControls, [key]: deserializeControl(serializedControl) }\n },\n {} as Record<string, DeserializedControl>,\n )\n}\n"],"mappings":"AASA;AAAA,EAEE;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAmBE,SAAS;AAAA,OACJ;AACP;AAAA,EACE;AAAA,OAUK;AAMP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kCAAkC,sCAAsC;AACjF,SAAS,8BAA8B,kCAAkC;AACzE;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B,+BAA+B;AAEnE;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAIE,SAAS;AAAA,OAaJ;AAeP,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;AAIxB,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKA,QAAO,MAAM;AAC/C,UAAM,CAAC,mBAAmB,8BAA8B,IAAI,iBAAiBA,QAAO;AAEpF,mBAAe,GAAwB,IAAI;AAC3C,kBAAc,KAAK,GAAG,8BAA8B;AAAA,EACtD,CAAC;AAGD,S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'use client'\n\nimport {\n forwardRef,\n Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react'\nimport { cx } from '@emotion/css'\nimport { v4 as uuid } from 'uuid'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { areBoxAnimationPropsEqual, BoxAnimationProps, useBoxAnimation } from './animations'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n GridValue,\n GapYValue,\n GapXValue,\n BackgroundsValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, parse, createBox } from '../../../box-model'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: ElementIDValue\n backgrounds?: BackgroundsValue\n width?: string\n height?: ResponsiveIconRadioGroupValue<'auto' | 'stretch'>\n verticalAlign?: ResponsiveIconRadioGroupValue<\n 'flex-start' | 'center' | 'flex-end' | 'space-between'\n >\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n rowGap?: GapYValue\n columnGap?: GapXValue\n hidePlaceholder?: boolean\n children?: GridValue\n} & BoxAnimationProps\n\nconst Box = forwardRef(function Box(\n {\n id,\n backgrounds,\n width,\n height,\n margin,\n padding,\n border,\n children,\n borderRadius,\n boxShadow,\n rowGap,\n columnGap,\n hidePlaceholder,\n verticalAlign,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemStaggerDuration,\n }: Props,\n ref: Ref<BoxModelHandle>,\n) {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const boxElementObjectRef = useRef<HTMLElement | null>(null)\n const [animationClassName, replayAnimation, setElement] = useBoxAnimation(\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n )\n const boxElementCallbackRef = useCallback((current: HTMLElement | null) => {\n boxElementObjectRef.current = current\n\n setElement(current)\n }, [])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n return boxElementObjectRef.current\n },\n getBoxModel() {\n const paddingBoxElement = innerRef.current\n const borderBoxElement = innerRef.current\n const marginBoxElement = boxElementObjectRef.current\n const borderBox = innerRef.current?.getBoundingClientRect()\n const paddingBoxComputedStyle =\n paddingBoxElement?.ownerDocument.defaultView?.getComputedStyle(paddingBoxElement)\n const borderBoxComputedStyle =\n borderBoxElement?.ownerDocument.defaultView?.getComputedStyle(borderBoxElement)\n const marginBoxComputedStyle =\n marginBoxElement?.ownerDocument.defaultView?.getComputedStyle(marginBoxElement)\n const padding = paddingBoxComputedStyle && {\n top: parse(paddingBoxComputedStyle.paddingTop),\n right: parse(paddingBoxComputedStyle.paddingRight),\n bottom: parse(paddingBoxComputedStyle.paddingBottom),\n left: parse(paddingBoxComputedStyle.paddingLeft),\n }\n const border = borderBoxComputedStyle && {\n top: parse(borderBoxComputedStyle.borderTopWidth),\n right: parse(borderBoxComputedStyle.borderRightWidth),\n bottom: parse(borderBoxComputedStyle.borderBottomWidth),\n left: parse(borderBoxComputedStyle.borderLeftWidth),\n }\n const margin = marginBoxComputedStyle && {\n top: parse(marginBoxComputedStyle.marginTop),\n right: parse(marginBoxComputedStyle.marginRight),\n bottom: parse(marginBoxComputedStyle.marginBottom),\n left: parse(marginBoxComputedStyle.marginLeft),\n }\n\n return borderBox ? createBox({ borderBox, padding, border, margin }) : null\n },\n }),\n [],\n )\n\n const gridItemClassName = useStyle(\n useResponsiveStyle([verticalAlign], ([alignItems = 'flex-start']) => ({ alignItems })),\n )\n\n const [key, setKey] = useState(() => uuid())\n\n const animationProps = {\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n }\n\n const prevAnimationProps = useRef(animationProps)\n useEffect(() => {\n if (!areBoxAnimationPropsEqual(prevAnimationProps.current, animationProps)) {\n replayAnimation()\n setKey(uuid())\n prevAnimationProps.current = animationProps\n }\n }, [replayAnimation, animationProps])\n\n return (\n <BackgroundsContainer\n ref={boxElementCallbackRef}\n id={id}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(useResponsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n animationClassName,\n )}\n backgrounds={backgrounds}\n >\n <div\n ref={innerRef}\n key={key}\n className={cx(\n padding,\n boxShadow,\n border,\n useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' }),\n useStyle(\n useResponsiveStyle([verticalAlign], ([alignContent = 'flex-start']) => ({\n alignContent,\n })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n className={gridItemClassName}\n grid={children.columns}\n index={index}\n itemAnimateDuration={itemAnimateDuration}\n itemAnimateDelay={itemAnimateDelay}\n itemStaggerDuration={itemStaggerDuration}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder hide={hidePlaceholder} />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Box\n"],"mappings":";AAuMc;AArMd;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,MAAM,YAAY;AAE3B,SAAS,eAAe;AACxB,OAAO,iBAAiB;AACxB,SAAS,2BAA8C,uBAAuB;AAS9E,SAAyB,OAAO,iBAAiB;AACjD,OAAO,0BAA0B;AACjC,SAAS,0BAA0B;AACnC,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAqBzB,MAAM,MAAM,WAAW,SAASA,KAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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OAAO,OAAO,CAAC;AAAA,YAC7D;AAAA,cACE,mBAAmB,CAAC,aAAa,GAAG,CAAC,CAAC,eAAe,YAAY,OAAO;AAAA,gBACtE;AAAA,cACF,EAAE;AAAA,YACJ;AAAA,UACF;AAAA,UAEC,sBAAY,SAAS,SAAS,SAAS,IACtC,SAAS,SAAS,IAAI,CAAC,OAAO,UAC5B;AAAA,YAAC;AAAA;AAAA,cAEC,WAAW;AAAA,cACX,MAAM,SAAS;AAAA,cACf;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cAEA,8BAAC,WAAQ,SAAS,OAAO;AAAA;AAAA,YAVpB,MAAM;AAAA,UAWb,CACD,IAED,oBAAC,eAAY,MAAM,iBAAiB;AAAA;AAAA,QA9BjC;AAAA,MAgCP;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,cAAQ;","names":["Box","padding","border","margin"]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Box/Box.tsx"],"sourcesContent":["'use client'\n\nimport {\n forwardRef,\n Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react'\nimport { cx } from '@emotion/css'\nimport { v4 as uuid } from 'uuid'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { areBoxAnimationPropsEqual, BoxAnimationProps, useBoxAnimation } from './animations'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n GridValue,\n BackgroundsValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, parse, createBox } from '../../../box-model'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { ResponsiveGapData } from '@makeswift/prop-controllers'\n\ntype Props = {\n id?: ElementIDValue\n backgrounds?: BackgroundsValue\n width?: string\n height?: ResponsiveIconRadioGroupValue<'auto' | 'stretch'>\n verticalAlign?: ResponsiveIconRadioGroupValue<\n 'flex-start' | 'center' | 'flex-end' | 'space-between'\n >\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n rowGap?: ResponsiveGapData\n columnGap?: ResponsiveGapData\n hidePlaceholder?: boolean\n children?: GridValue\n} & BoxAnimationProps\n\nconst Box = forwardRef(function Box(\n {\n id,\n backgrounds,\n width,\n height,\n margin,\n padding,\n border,\n children,\n borderRadius,\n boxShadow,\n rowGap,\n columnGap,\n hidePlaceholder,\n verticalAlign,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemStaggerDuration,\n }: Props,\n ref: Ref<BoxModelHandle>,\n) {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const boxElementObjectRef = useRef<HTMLElement | null>(null)\n const [animationClassName, replayAnimation, setElement] = useBoxAnimation(\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n )\n const boxElementCallbackRef = useCallback((current: HTMLElement | null) => {\n boxElementObjectRef.current = current\n\n setElement(current)\n }, [])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n return boxElementObjectRef.current\n },\n getBoxModel() {\n const paddingBoxElement = innerRef.current\n const borderBoxElement = innerRef.current\n const marginBoxElement = boxElementObjectRef.current\n const borderBox = innerRef.current?.getBoundingClientRect()\n const paddingBoxComputedStyle =\n paddingBoxElement?.ownerDocument.defaultView?.getComputedStyle(paddingBoxElement)\n const borderBoxComputedStyle =\n borderBoxElement?.ownerDocument.defaultView?.getComputedStyle(borderBoxElement)\n const marginBoxComputedStyle =\n marginBoxElement?.ownerDocument.defaultView?.getComputedStyle(marginBoxElement)\n const padding = paddingBoxComputedStyle && {\n top: parse(paddingBoxComputedStyle.paddingTop),\n right: parse(paddingBoxComputedStyle.paddingRight),\n bottom: parse(paddingBoxComputedStyle.paddingBottom),\n left: parse(paddingBoxComputedStyle.paddingLeft),\n }\n const border = borderBoxComputedStyle && {\n top: parse(borderBoxComputedStyle.borderTopWidth),\n right: parse(borderBoxComputedStyle.borderRightWidth),\n bottom: parse(borderBoxComputedStyle.borderBottomWidth),\n left: parse(borderBoxComputedStyle.borderLeftWidth),\n }\n const margin = marginBoxComputedStyle && {\n top: parse(marginBoxComputedStyle.marginTop),\n right: parse(marginBoxComputedStyle.marginRight),\n bottom: parse(marginBoxComputedStyle.marginBottom),\n left: parse(marginBoxComputedStyle.marginLeft),\n }\n\n return borderBox ? createBox({ borderBox, padding, border, margin }) : null\n },\n }),\n [],\n )\n\n const gridItemClassName = useStyle(\n useResponsiveStyle([verticalAlign], ([alignItems = 'flex-start']) => ({ alignItems })),\n )\n\n const [key, setKey] = useState(() => uuid())\n\n const animationProps = {\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n }\n\n const prevAnimationProps = useRef(animationProps)\n useEffect(() => {\n if (!areBoxAnimationPropsEqual(prevAnimationProps.current, animationProps)) {\n replayAnimation()\n setKey(uuid())\n prevAnimationProps.current = animationProps\n }\n }, [replayAnimation, animationProps])\n\n return (\n <BackgroundsContainer\n ref={boxElementCallbackRef}\n id={id}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(useResponsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n animationClassName,\n )}\n backgrounds={backgrounds}\n >\n <div\n ref={innerRef}\n key={key}\n className={cx(\n padding,\n boxShadow,\n border,\n useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' }),\n useStyle(\n useResponsiveStyle([verticalAlign], ([alignContent = 'flex-start']) => ({\n alignContent,\n })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n className={gridItemClassName}\n grid={children.columns}\n index={index}\n itemAnimateDuration={itemAnimateDuration}\n itemAnimateDelay={itemAnimateDelay}\n itemStaggerDuration={itemStaggerDuration}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder hide={hidePlaceholder} />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Box\n"],"mappings":";AAsMc;AApMd;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,MAAM,YAAY;AAE3B,SAAS,eAAe;AACxB,OAAO,iBAAiB;AACxB,SAAS,2BAA8C,uBAAuB;AAO9E,SAAyB,OAAO,iBAAiB;AACjD,OAAO,0BAA0B;AACjC,SAAS,0BAA0B;AACnC,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAsBzB,MAAM,MAAM,WAAW,SAASA,KAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,KACA;AACA,QAAM,WAAW,OAA8B,IAAI;AACnD,QAAM,sBAAsB,OAA2B,IAAI;AAC3D,QAAM,CAAC,oBAAoB,iBAAiB,UAAU,IAAI;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,QAAM,wBAAwB,YAAY,CAAC,YAAgC;AACzE,wBAAoB,UAAU;AAE9B,eAAW,OAAO;AAAA,EACpB,GAAG,CAAC,CAAC;AAEL;AAAA,IACE;AAAA,IACA,OAAO;AAAA,MACL,aAAa;AACX,eAAO,oBAAoB;AAAA,MAC7B;AAAA,MACA,cAAc;AACZ,cAAM,oBAAoB,SAAS;AACnC,cAAM,mBAAmB,SAAS;AAClC,cAAM,mBAA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 -2,6 +2,8 @@ import {
2
2
  Border,
3
3
  BorderRadius,
4
4
  Checkbox,
5
+ GapX,
6
+ GapY,
5
7
  Margin,
6
8
  Padding,
7
9
  Shadows,
@@ -76,10 +78,10 @@ function registerComponent(runtime) {
76
78
  border: Border({ format: Border.Format.ClassName }),
77
79
  borderRadius: BorderRadius({ format: BorderRadius.Format.ClassName }),
78
80
  boxShadow: Shadows({ format: Shadows.Format.ClassName }),
79
- rowGap: Props.GapY((props) => ({
81
+ rowGap: GapY((props) => ({
80
82
  hidden: props.children == null
81
83
  })),
82
- columnGap: Props.GapX((props) => ({
84
+ columnGap: GapX((props) => ({
83
85
  hidden: props.children == null
84
86
  })),
85
87
  boxAnimateType: Props.ResponsiveSelect({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Box/register.ts"],"sourcesContent":["import {\n Border,\n BorderRadius,\n Checkbox,\n Margin,\n Padding,\n Shadows,\n Width,\n} from '@makeswift/prop-controllers'\nimport { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport {\n BoxAnimateIn,\n DEFAULT_BOX_ANIMATE_DELAY,\n DEFAULT_BOX_ANIMATE_DURATION,\n DEFAULT_ITEM_ANIMATE_DELAY,\n DEFAULT_ITEM_STAGGER_DURATION,\n} from './constants'\nimport { lazy } from 'react'\nimport { ResponsiveSelectValue } from '../../../prop-controllers/descriptors'\n\nexport function registerComponent(runtime: ReactRuntime) {\n function isHiddenBasedOnAnimationType(\n props: Record<string, unknown>,\n deviceId: string,\n property: 'boxAnimateType' | 'itemAnimateType',\n ): boolean {\n const animateIn = props[property] as ResponsiveSelectValue<BoxAnimateIn> | undefined\n return (\n (findBreakpointOverride<BoxAnimateIn>(runtime.getBreakpoints(), animateIn, deviceId)?.value ??\n 'none') === 'none'\n )\n }\n const isHiddenBasedOnBoxAnimation = (props: Record<string, unknown>, deviceId: string) =>\n isHiddenBasedOnAnimationType(props, deviceId, 'boxAnimateType')\n const isHiddenBasedOnItemAnimation = (props: Record<string, unknown>, deviceId: string) =>\n isHiddenBasedOnAnimationType(props, deviceId, 'itemAnimateType')\n\n return runtime.registerComponent(\n lazy(() => import('./Box')),\n {\n type: MakeswiftComponentType.Box,\n label: 'Box',\n props: {\n id: Props.ElementID(),\n backgrounds: Props.Backgrounds(),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n height: Props.ResponsiveIconRadioGroup({\n label: 'Height',\n options: [\n { value: 'auto', label: 'Auto', icon: 'HeightAuto16' },\n { value: 'stretch', label: 'Stretch', icon: 'HeightMatch16' },\n ],\n defaultValue: 'auto',\n }),\n verticalAlign: Props.ResponsiveIconRadioGroup({\n label: 'Align items',\n options: [\n { value: 'flex-start', label: 'Top', icon: 'VerticalAlignStart16' },\n { value: 'center', label: 'Middle', icon: 'VerticalAlignMiddle16' },\n { value: 'flex-end', label: 'Bottom', icon: 'VerticalAlignEnd16' },\n {\n value: 'space-between',\n label: 'Space between',\n icon: 'VerticalAlignSpaceBetween16',\n },\n ],\n defaultValue: 'flex-start',\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n padding: Padding({\n format: Padding.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n paddingTop: { value: 10, unit: 'px' },\n paddingRight: { value: 10, unit: 'px' },\n paddingBottom: { value: 10, unit: 'px' },\n paddingLeft: { value: 10, unit: 'px' },\n },\n },\n ],\n }),\n border: Border({ format: Border.Format.ClassName }),\n borderRadius: BorderRadius({ format: BorderRadius.Format.ClassName }),\n boxShadow: Shadows({ format: Shadows.Format.ClassName }),\n rowGap: Props.GapY(props => ({\n hidden: props.children == null,\n })),\n columnGap: Props.GapX(props => ({\n hidden: props.children == null,\n })),\n boxAnimateType: Props.ResponsiveSelect({\n label: 'Animate box in',\n labelOrientation: 'vertical',\n options: [\n { value: 'none', label: 'None' },\n { value: 'fadeIn', label: 'Fade in' },\n { value: 'fadeRight', label: 'Fade right' },\n { value: 'fadeDown', label: 'Fade down' },\n { value: 'fadeLeft', label: 'Fade left' },\n { value: 'fadeUp', label: 'Fade up' },\n { value: 'blurIn', label: 'Blur in' },\n { value: 'scaleUp', label: 'Scale up' },\n { value: 'scaleDown', label: 'Scale down' },\n ],\n defaultValue: 'none',\n }),\n boxAnimateDuration: Props.ResponsiveNumber((props, device) => ({\n label: 'Box duration',\n defaultValue: DEFAULT_BOX_ANIMATE_DURATION,\n min: 0.1,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnBoxAnimation(props, device),\n })),\n boxAnimateDelay: Props.ResponsiveNumber((props, device) => ({\n label: 'Box delay',\n defaultValue: DEFAULT_BOX_ANIMATE_DELAY,\n min: 0,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnBoxAnimation(props, device),\n })),\n itemAnimateType: Props.ResponsiveSelect({\n label: 'Animate items in',\n labelOrientation: 'vertical',\n options: [\n { value: 'none', label: 'None' },\n { value: 'fadeIn', label: 'Fade in' },\n { value: 'fadeRight', label: 'Fade right' },\n { value: 'fadeDown', label: 'Fade down' },\n { value: 'fadeLeft', label: 'Fade left' },\n { value: 'fadeUp', label: 'Fade up' },\n { value: 'blurIn', label: 'Blur in' },\n { value: 'scaleUp', label: 'Scale up' },\n { value: 'scaleDown', label: 'Scale down' },\n ],\n defaultValue: 'none',\n }),\n itemAnimateDuration: Props.ResponsiveNumber((props, device) => ({\n label: 'Items duration',\n defaultValue: DEFAULT_BOX_ANIMATE_DURATION,\n min: 0.1,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnItemAnimation(props, device),\n })),\n itemAnimateDelay: Props.ResponsiveNumber((props, device) => ({\n label: 'Items delay',\n defaultValue: DEFAULT_ITEM_ANIMATE_DELAY,\n min: 0,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnItemAnimation(props, device),\n })),\n itemStaggerDuration: Props.ResponsiveNumber((props, device) => ({\n label: 'Stagger',\n min: 0,\n step: 0.05,\n suffix: 's',\n defaultValue: DEFAULT_ITEM_STAGGER_DURATION,\n hidden: isHiddenBasedOnItemAnimation(props, device),\n })),\n hidePlaceholder: Checkbox(props => ({\n label: 'Hide placeholder',\n hidden: props.children != null,\n })),\n children: Props.Grid(),\n },\n },\n )\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AAEtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AAGd,SAAS,kBAAkB,SAAuB;AACvD,WAAS,6BACP,OACA,UACA,UACS;AACT,UAAM,YAAY,MAAM,QAAQ;AAChC,YACG,uBAAqC,QAAQ,eAAe,GAAG,WAAW,QAAQ,GAAG,SACpF,YAAY;AAAA,EAElB;AACA,QAAM,8BAA8B,CAAC,OAAgC,aACnE,6BAA6B,OAAO,UAAU,gBAAgB;AAChE,QAAM,+BAA+B,CAAC,OAAgC,aACpE,6BAA6B,OAAO,UAAU,iBAAiB;AAEjE,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,OAAO,CAAC;AAAA,IAC1B;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,aAAa,MAAM,YAAY;AAAA,QAC/B,OAAO,MAAM;AAAA,UACX,QAAQ,MAAM,OAAO;AAAA,UACrB,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,MAAM,yBAAyB;AAAA,UACrC,OAAO;AAAA,UACP,SAAS;AAAA,YACP,EAAE,OAAO,QAAQ,OAAO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OAAO,YAAY;AAAA,YACxC,EAAE,OAAO,YAAY,OAAO,YAAY;AAAA,YACxC,EAAE,OAAO,UAAU,OAAO,UAAU;AAAA,YACpC,EAAE,OAAO,UAAU,OAAO,UAAU;AAAA,YACpC,EAAE,OAAO,WAAW,OAAO,WAAW;AAAA,YACtC,EAAE,OAAO,aAAa,OAAO,aAAa;AAAA,UAC5C;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,QACD,qBAAqB,MAAM,iBAAiB,CAAC,OAAO,YAAY;AAAA,UAC9D,OAAO;AAAA,UACP,cAAc;AAAA,UACd,KAAK;AAAA,UACL,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,QAAQ,6BAA6B,OAAO,MAAM;AAAA,QACpD,EAAE;AAAA,QACF,kBAAkB,MAAM,iBAAiB,CAAC,OAAO,YAAY;AAAA,UAC3D,OAAO;AAAA,UACP,cAAc;AAAA,UACd,KAAK;AAAA,UACL,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,QAAQ,6BAA6B,OAAO,MAAM;AAAA,QACpD,EAAE;AAAA,QACF,qBAAqB,MAAM,iBAAiB,CAAC,OAAO,YAAY;AAAA,UAC9D,OAAO;AAAA,UACP,KAAK;AAAA,UACL,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,cAAc;AAAA,UACd,QAAQ,6BAA6B,OAAO,MAAM;AAAA,QACpD,EAAE;AAAA,QACF,iBAAiB,SAAS,YAAU;AAAA,UAClC,OAAO;AAAA,UACP,QAAQ,MAAM,YAAY;AAAA,QAC5B,EAAE;AAAA,QACF,UAAU,MAAM,KAAK;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Box/register.ts"],"sourcesContent":["import {\n Border,\n BorderRadius,\n Checkbox,\n GapX,\n GapY,\n Margin,\n Padding,\n Shadows,\n Width,\n} from '@makeswift/prop-controllers'\nimport { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport {\n BoxAnimateIn,\n DEFAULT_BOX_ANIMATE_DELAY,\n DEFAULT_BOX_ANIMATE_DURATION,\n DEFAULT_ITEM_ANIMATE_DELAY,\n DEFAULT_ITEM_STAGGER_DURATION,\n} from './constants'\nimport { lazy } from 'react'\nimport { ResponsiveSelectValue } from '../../../prop-controllers/descriptors'\n\nexport function registerComponent(runtime: ReactRuntime) {\n function isHiddenBasedOnAnimationType(\n props: Record<string, unknown>,\n deviceId: string,\n property: 'boxAnimateType' | 'itemAnimateType',\n ): boolean {\n const animateIn = props[property] as ResponsiveSelectValue<BoxAnimateIn> | undefined\n return (\n (findBreakpointOverride<BoxAnimateIn>(runtime.getBreakpoints(), animateIn, deviceId)?.value ??\n 'none') === 'none'\n )\n }\n const isHiddenBasedOnBoxAnimation = (props: Record<string, unknown>, deviceId: string) =>\n isHiddenBasedOnAnimationType(props, deviceId, 'boxAnimateType')\n const isHiddenBasedOnItemAnimation = (props: Record<string, unknown>, deviceId: string) =>\n isHiddenBasedOnAnimationType(props, deviceId, 'itemAnimateType')\n\n return runtime.registerComponent(\n lazy(() => import('./Box')),\n {\n type: MakeswiftComponentType.Box,\n label: 'Box',\n props: {\n id: Props.ElementID(),\n backgrounds: Props.Backgrounds(),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n height: Props.ResponsiveIconRadioGroup({\n label: 'Height',\n options: [\n { value: 'auto', label: 'Auto', icon: 'HeightAuto16' },\n { value: 'stretch', label: 'Stretch', icon: 'HeightMatch16' },\n ],\n defaultValue: 'auto',\n }),\n verticalAlign: Props.ResponsiveIconRadioGroup({\n label: 'Align items',\n options: [\n { value: 'flex-start', label: 'Top', icon: 'VerticalAlignStart16' },\n { value: 'center', label: 'Middle', icon: 'VerticalAlignMiddle16' },\n { value: 'flex-end', label: 'Bottom', icon: 'VerticalAlignEnd16' },\n {\n value: 'space-between',\n label: 'Space between',\n icon: 'VerticalAlignSpaceBetween16',\n },\n ],\n defaultValue: 'flex-start',\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n padding: Padding({\n format: Padding.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n paddingTop: { value: 10, unit: 'px' },\n paddingRight: { value: 10, unit: 'px' },\n paddingBottom: { value: 10, unit: 'px' },\n paddingLeft: { value: 10, unit: 'px' },\n },\n },\n ],\n }),\n border: Border({ format: Border.Format.ClassName }),\n borderRadius: BorderRadius({ format: BorderRadius.Format.ClassName }),\n boxShadow: Shadows({ format: Shadows.Format.ClassName }),\n rowGap: GapY(props => ({\n hidden: props.children == null,\n })),\n columnGap: GapX(props => ({\n hidden: props.children == null,\n })),\n boxAnimateType: Props.ResponsiveSelect({\n label: 'Animate box in',\n labelOrientation: 'vertical',\n options: [\n { value: 'none', label: 'None' },\n { value: 'fadeIn', label: 'Fade in' },\n { value: 'fadeRight', label: 'Fade right' },\n { value: 'fadeDown', label: 'Fade down' },\n { value: 'fadeLeft', label: 'Fade left' },\n { value: 'fadeUp', label: 'Fade up' },\n { value: 'blurIn', label: 'Blur in' },\n { value: 'scaleUp', label: 'Scale up' },\n { value: 'scaleDown', label: 'Scale down' },\n ],\n defaultValue: 'none',\n }),\n boxAnimateDuration: Props.ResponsiveNumber((props, device) => ({\n label: 'Box duration',\n defaultValue: DEFAULT_BOX_ANIMATE_DURATION,\n min: 0.1,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnBoxAnimation(props, device),\n })),\n boxAnimateDelay: Props.ResponsiveNumber((props, device) => ({\n label: 'Box delay',\n defaultValue: DEFAULT_BOX_ANIMATE_DELAY,\n min: 0,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnBoxAnimation(props, device),\n })),\n itemAnimateType: Props.ResponsiveSelect({\n label: 'Animate items in',\n labelOrientation: 'vertical',\n options: [\n { value: 'none', label: 'None' },\n { value: 'fadeIn', label: 'Fade in' },\n { value: 'fadeRight', label: 'Fade right' },\n { value: 'fadeDown', label: 'Fade down' },\n { value: 'fadeLeft', label: 'Fade left' },\n { value: 'fadeUp', label: 'Fade up' },\n { value: 'blurIn', label: 'Blur in' },\n { value: 'scaleUp', label: 'Scale up' },\n { value: 'scaleDown', label: 'Scale down' },\n ],\n defaultValue: 'none',\n }),\n itemAnimateDuration: Props.ResponsiveNumber((props, device) => ({\n label: 'Items duration',\n defaultValue: DEFAULT_BOX_ANIMATE_DURATION,\n min: 0.1,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnItemAnimation(props, device),\n })),\n itemAnimateDelay: Props.ResponsiveNumber((props, device) => ({\n label: 'Items delay',\n defaultValue: DEFAULT_ITEM_ANIMATE_DELAY,\n min: 0,\n step: 0.05,\n suffix: 's',\n hidden: isHiddenBasedOnItemAnimation(props, device),\n })),\n itemStaggerDuration: Props.ResponsiveNumber((props, device) => ({\n label: 'Stagger',\n min: 0,\n step: 0.05,\n suffix: 's',\n defaultValue: DEFAULT_ITEM_STAGGER_DURATION,\n hidden: isHiddenBasedOnItemAnimation(props, device),\n })),\n hidePlaceholder: Checkbox(props => ({\n label: 'Hide placeholder',\n hidden: props.children != null,\n })),\n children: Props.Grid(),\n },\n },\n )\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AAEtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AAGd,SAAS,kBAAkB,SAAuB;AACvD,WAAS,6BACP,OACA,UACA,UACS;AACT,UAAM,YAAY,MAAM,QAAQ;AAChC,YACG,uBAAqC,QAAQ,eAAe,GAAG,WAAW,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