@makeswift/runtime 0.17.0-canary.0 → 0.17.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/builder/serialization/control-serialization.js +2 -2
- package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
- package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
- package/dist/cjs/components/builtin/Box/register.js +1 -1
- package/dist/cjs/components/builtin/Box/register.js.map +1 -1
- package/dist/cjs/components/builtin/Root/Root.js.map +1 -1
- package/dist/cjs/components/builtin/Root/register.js +1 -1
- package/dist/cjs/components/builtin/Root/register.js.map +1 -1
- package/dist/cjs/controls/control.js +5 -4
- package/dist/cjs/controls/control.js.map +1 -1
- package/dist/cjs/controls/data.js +65 -0
- package/dist/cjs/controls/data.js.map +1 -0
- package/dist/cjs/controls/list.js.map +1 -1
- package/dist/cjs/controls/rich-text/dto-types.js.map +1 -1
- package/dist/cjs/controls/utils.js +42 -0
- package/dist/cjs/controls/utils.js.map +1 -0
- package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/prop-controllers/copy/rich-text.js.map +1 -1
- package/dist/cjs/prop-controllers/copy.js +4 -4
- package/dist/cjs/prop-controllers/copy.js.map +1 -1
- package/dist/cjs/prop-controllers/deleted.js +1 -0
- package/dist/cjs/prop-controllers/deleted.js.map +1 -1
- package/dist/cjs/prop-controllers/descriptors.js +0 -20
- package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
- package/dist/cjs/prop-controllers/index.js.map +1 -1
- package/dist/cjs/prop-controllers/instances.js +0 -3
- package/dist/cjs/prop-controllers/instances.js.map +1 -1
- package/dist/cjs/prop-controllers/introspection.js +6 -5
- package/dist/cjs/prop-controllers/introspection.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/ReadOnlyText.js.map +1 -1
- package/dist/cjs/runtimes/react/controls.js +11 -0
- package/dist/cjs/runtimes/react/controls.js.map +1 -1
- package/dist/cjs/utils/index-signature-hack.js +17 -0
- package/dist/cjs/utils/index-signature-hack.js.map +1 -0
- package/dist/esm/builder/serialization/control-serialization.js +2 -2
- package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
- package/dist/esm/components/builtin/Box/Box.js.map +1 -1
- package/dist/esm/components/builtin/Box/register.js +2 -1
- package/dist/esm/components/builtin/Box/register.js.map +1 -1
- package/dist/esm/components/builtin/Root/Root.js.map +1 -1
- package/dist/esm/components/builtin/Root/register.js +2 -2
- package/dist/esm/components/builtin/Root/register.js.map +1 -1
- package/dist/esm/controls/control.js +7 -6
- package/dist/esm/controls/control.js.map +1 -1
- package/dist/esm/controls/data.js +37 -0
- package/dist/esm/controls/data.js.map +1 -0
- package/dist/esm/controls/list.js.map +1 -1
- package/dist/esm/controls/rich-text/dto-types.js.map +1 -1
- package/dist/esm/controls/utils.js +18 -0
- package/dist/esm/controls/utils.js.map +1 -0
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/prop-controllers/copy/rich-text.js.map +1 -1
- package/dist/esm/prop-controllers/copy.js +6 -5
- package/dist/esm/prop-controllers/copy.js.map +1 -1
- package/dist/esm/prop-controllers/deleted.js +1 -0
- package/dist/esm/prop-controllers/deleted.js.map +1 -1
- package/dist/esm/prop-controllers/descriptors.js +0 -17
- package/dist/esm/prop-controllers/descriptors.js.map +1 -1
- package/dist/esm/prop-controllers/index.js.map +1 -1
- package/dist/esm/prop-controllers/instances.js +0 -3
- package/dist/esm/prop-controllers/instances.js.map +1 -1
- package/dist/esm/prop-controllers/introspection.js +8 -6
- package/dist/esm/prop-controllers/introspection.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/ReadOnlyText.js.map +1 -1
- package/dist/esm/runtimes/react/controls.js +11 -0
- package/dist/esm/runtimes/react/controls.js.map +1 -1
- package/dist/esm/utils/index-signature-hack.js +1 -0
- package/dist/esm/utils/index-signature-hack.js.map +1 -0
- package/dist/types/builder/serialization/control-serialization.d.ts +6 -6
- package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/Box.d.ts +19 -2
- package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Root/Root.d.ts +3 -3
- package/dist/types/components/builtin/Root/Root.d.ts.map +1 -1
- package/dist/types/components/hooks/useImagePropControllerData .d.ts +3 -0
- package/dist/types/components/hooks/useImagePropControllerData .d.ts.map +1 -0
- package/dist/types/components/hooks/useNumberPropControllerData copy.d.ts +3 -0
- package/dist/types/components/hooks/useNumberPropControllerData copy.d.ts.map +1 -0
- package/dist/types/controls/control.d.ts +2 -1
- package/dist/types/controls/control.d.ts.map +1 -1
- package/dist/types/controls/data.d.ts +91 -0
- package/dist/types/controls/data.d.ts.map +1 -0
- package/dist/types/controls/list.d.ts +1 -1
- package/dist/types/controls/list.d.ts.map +1 -1
- package/dist/types/controls/rich-text/dto-types.d.ts +2 -0
- package/dist/types/controls/rich-text/dto-types.d.ts.map +1 -1
- package/dist/types/controls/slot.test.d.ts +2 -0
- package/dist/types/controls/slot.test.d.ts.map +1 -0
- package/dist/types/controls/utils.d.ts +15 -0
- package/dist/types/controls/utils.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-font-prop-controller.test copy.d.ts +3 -0
- package/dist/types/next/components/tests/page-font-prop-controller.test copy.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-image-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-image-prop-controller.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-slot-control.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-slot-control.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-slot-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-slot-prop-controller.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/copy/rich-text.d.ts +1 -1
- package/dist/types/prop-controllers/copy/rich-text.d.ts.map +1 -1
- package/dist/types/prop-controllers/copy.d.ts.map +1 -1
- package/dist/types/prop-controllers/deleted.d.ts +10 -1
- package/dist/types/prop-controllers/deleted.d.ts.map +1 -1
- package/dist/types/prop-controllers/descriptors.d.ts +8 -45
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/prop-controllers/index.d.ts +1 -1
- package/dist/types/prop-controllers/index.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +1 -4
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/ReadOnlyText.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/utils/index-signature-hack.d.ts +4 -0
- package/dist/types/utils/index-signature-hack.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controls/list.ts"],"sourcesContent":["import {\n AnyPropController,\n createPropController,\n PropControllerMessage,\n Send,\n} from '../prop-controllers/instances'\nimport { PropController } from '../prop-controllers/base'\nimport { CopyContext, MergeTranslatableDataContext } from '../state/react-page'\nimport {\n ControlDefinition,\n ControlDefinitionData,\n getTranslatableData,\n mergeTranslatedData,\n} from './control'\nimport { ColorData, Data } from './types'\n\nimport { copy as controlCopy } from './control'\nimport {\n getElementChildren,\n getFileIds,\n getPageIds,\n getSwatchIds,\n getTypographyIds,\n} from '../prop-controllers/introspection'\nimport { CheckboxControlDefinition } from './checkbox'\nimport { NumberControlDefinition } from './number'\nimport { TextInputControlDefinition } from './text-input'\nimport { TextAreaControlDefinition } from './text-area'\nimport { SelectControlData, SelectControlDefinition } from './select'\nimport { ColorControlDefinition } from './color'\nimport { IconRadioGroupControlData, IconRadioGroupControlDefinition } from './icon-radio-group'\nimport { ImageControlData, ImageControlDefinition } from './image'\nimport { ComboboxControlData, ComboboxControlDefinition } from './combobox'\nimport { ShapeControlDefinition } from './shape'\nimport { LinkControlData, LinkControlDefinition } from './link'\nimport { RichTextControlData, RichTextControlDefinition } from './rich-text'\nimport { IndexSignatureHack } from '../prop-controllers/descriptors'\nimport { RichTextV2ControlData, RichTextV2ControlDefinition } from './rich-text-v2'\nimport { StyleControlData, StyleControlDefinition } from './style'\nimport { StyleV2ControlData, StyleV2ControlDefinition } from './style-v2'\nimport { TypographyControlData, TypographyControlDefinition } from './typography'\n\nexport type GetItemLabelControlData<T extends ControlDefinition> = T extends CheckboxControlDefinition\n ? boolean\n : T extends NumberControlDefinition\n ? number\n : T extends TextInputControlDefinition\n ? string\n : T extends TextAreaControlDefinition\n ? string\n : T extends SelectControlDefinition\n ? SelectControlData<T>\n : T extends ColorControlDefinition\n ? ColorData\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlData<T>\n : T extends ImageControlDefinition\n ? ImageControlData\n : T extends ComboboxControlDefinition\n ? ComboboxControlData<T>\n : T extends ShapeControlDefinition\n ? GetItemLabelShapeControlData<T>\n : T extends ListControlDefinition\n ? GetItemListControlData<T>\n : T extends LinkControlDefinition\n ? LinkControlData\n : T extends RichTextControlDefinition\n ? IndexSignatureHack<RichTextControlData>\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlData\n : T extends StyleControlDefinition\n ? StyleControlData\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlData\n : T extends TypographyControlDefinition\n ? TypographyControlData\n : never\n\nexport type GetItemLabelListControlItemData<T extends ListControlDefinition> = {\n id: string\n type?: T['config']['type']['type']\n value: GetItemLabelControlData<T['config']['type']>\n}\n\nexport type GetItemLabelShapeControlData<T extends ShapeControlDefinition = ShapeControlDefinition> = {\n [K in keyof T['config']['type']]?: GetItemLabelControlData<T['config']['type'][K]>\n}\n\nexport type GetItemListControlData<T extends ListControlDefinition = ListControlDefinition> =\n GetItemLabelListControlItemData<T>[]\n\nexport const ListControlType = 'makeswift::controls::list'\n\ntype ListControlConfig<T extends ControlDefinition = ControlDefinition> = {\n type: T\n label?: string\n getItemLabel?(item: GetItemLabelControlData<T> | undefined): string\n}\n\nexport type ListControlDefinition<C extends ListControlConfig = ListControlConfig> = {\n type: typeof ListControlType\n config: C\n}\n\nexport function List<T extends ControlDefinition, C extends ListControlConfig<T>>(\n config: C & { type: T },\n): ListControlDefinition<C> {\n return { type: ListControlType, config }\n}\n\nexport type ListControlItemData<T extends ListControlDefinition> = {\n id: string\n type?: T['config']['type']['type']\n value: ControlDefinitionData<T['config']['type']>\n}\n\nexport type ListControlData<T extends ListControlDefinition = ListControlDefinition> =\n ListControlItemData<T>[]\n\nexport const ListControlMessageType = {\n LIST_CONTROL_ITEM_CONTROL_MESSAGE: 'makeswift::controls::list::message::item-control-message',\n} as const\n\ntype ListControlItemControlMessage = {\n type: typeof ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE\n payload: { message: PropControllerMessage; itemId: string }\n}\n\nexport type ListControlMessage = ListControlItemControlMessage\n\nexport class ListControl<\n T extends ListControlDefinition = ListControlDefinition,\n> extends PropController<ListControlMessage> {\n controls: Map<string, AnyPropController>\n descriptor: ListControlDefinition\n send: Send<ListControlMessage>\n\n constructor(send: Send<ListControlMessage>, descriptor: T) {\n super(send)\n\n this.descriptor = descriptor\n this.send = send\n\n this.controls = new Map<string, AnyPropController>()\n }\n\n setItemsControl = (value: ListControlData<T> | undefined) => {\n const controls = new Map<string, AnyPropController>()\n\n if (value == null) return\n\n const shouldUpdate = () => {\n // If the length is different, should update\n if (value.length !== this.controls.size) return true\n // If this.controls does not have an itemId, should update\n if (!value.every(({ id }) => this.controls.has(id))) return true\n\n return false\n }\n\n if (!shouldUpdate()) return this.controls\n\n value.forEach(item => {\n const control = createPropController(this.descriptor.config.type, message =>\n this.send({\n type: ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE,\n payload: { message, itemId: item.id },\n }),\n )\n\n controls.set(item.id, control)\n })\n\n this.controls = controls\n\n return this.controls\n }\n\n recv = (message: ListControlMessage) => {\n switch (message.type) {\n case ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE: {\n const control = this.controls.get(message.payload.itemId)\n\n if (control == null) return\n\n // TODO: We're casting the type here as the arg0 type for control.recv is never\n const recv = control.recv as (arg0: PropControllerMessage) => void\n\n recv(message.payload.message)\n }\n }\n }\n}\n\nexport function copyListData(\n definition: ListControlDefinition,\n value: ListControlData | undefined,\n context: CopyContext,\n): ListControlData | undefined {\n if (value == null) return value\n\n return (\n value &&\n value.map(item => ({\n ...item,\n value: controlCopy(definition.config.type, item.value, context),\n }))\n )\n}\n\nfunction introspectListData<T>(\n definition: ListControlDefinition,\n value: ListControlData | undefined,\n func: (definition: ControlDefinition, data: Data) => T[],\n): T[] {\n if (value == null) return []\n\n return value.flatMap(item => func(definition.config.type, item.value))\n}\n\nexport function getListElementChildren(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getElementChildren)\n}\n\nexport function getListSwatchIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getSwatchIds)\n}\n\nexport function getListFileIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getFileIds)\n}\n\nexport function getListTypographyIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getTypographyIds)\n}\n\nexport function getListPageIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getPageIds)\n}\n\nexport function getListTranslatableData(definition: ListControlDefinition, data: ListControlData) {\n return Object.fromEntries(\n data.map(item => [item.id, getTranslatableData(definition.config.type, item.value)]),\n )\n}\n\nexport type ListControlTranslationDto = Record<string, ListControlData>\n\nexport function mergeListTranslatedData(\n definition: ListControlDefinition,\n data: ListControlData,\n translatedData: ListControlTranslationDto,\n context: MergeTranslatableDataContext,\n) {\n return data.map(item => {\n return {\n ...item,\n value: mergeTranslatedData(\n definition.config.type,\n item.value,\n translatedData[item.id],\n context,\n ),\n }\n })\n}\n"],"mappings":"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","names":["import_control","controlCopy"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/list.ts"],"sourcesContent":["import {\n AnyPropController,\n createPropController,\n PropControllerMessage,\n Send,\n} from '../prop-controllers/instances'\nimport { PropController } from '../prop-controllers/base'\nimport { CopyContext, MergeTranslatableDataContext } from '../state/react-page'\nimport {\n ControlDefinition,\n ControlDefinitionData,\n getTranslatableData,\n mergeTranslatedData,\n} from './control'\nimport { ColorData, Data } from './types'\n\nimport { copy as controlCopy } from './control'\nimport {\n getElementChildren,\n getFileIds,\n getPageIds,\n getSwatchIds,\n getTypographyIds,\n} from '../prop-controllers/introspection'\nimport { CheckboxControlDefinition } from './checkbox'\nimport { NumberControlDefinition } from './number'\nimport { TextInputControlDefinition } from './text-input'\nimport { TextAreaControlDefinition } from './text-area'\nimport { SelectControlData, SelectControlDefinition } from './select'\nimport { ColorControlDefinition } from './color'\nimport { IconRadioGroupControlData, IconRadioGroupControlDefinition } from './icon-radio-group'\nimport { ImageControlData, ImageControlDefinition } from './image'\nimport { ComboboxControlData, ComboboxControlDefinition } from './combobox'\nimport { ShapeControlDefinition } from './shape'\nimport { LinkControlData, LinkControlDefinition } from './link'\nimport { RichTextControlData, RichTextControlDefinition } from './rich-text'\nimport { RichTextV2ControlData, RichTextV2ControlDefinition } from './rich-text-v2'\nimport { StyleControlData, StyleControlDefinition } from './style'\nimport { StyleV2ControlData, StyleV2ControlDefinition } from './style-v2'\nimport { TypographyControlData, TypographyControlDefinition } from './typography'\nimport { IndexSignatureHack } from '../utils/index-signature-hack'\n\nexport type GetItemLabelControlData<T extends ControlDefinition> = T extends CheckboxControlDefinition\n ? boolean\n : T extends NumberControlDefinition\n ? number\n : T extends TextInputControlDefinition\n ? string\n : T extends TextAreaControlDefinition\n ? string\n : T extends SelectControlDefinition\n ? SelectControlData<T>\n : T extends ColorControlDefinition\n ? ColorData\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlData<T>\n : T extends ImageControlDefinition\n ? ImageControlData\n : T extends ComboboxControlDefinition\n ? ComboboxControlData<T>\n : T extends ShapeControlDefinition\n ? GetItemLabelShapeControlData<T>\n : T extends ListControlDefinition\n ? GetItemListControlData<T>\n : T extends LinkControlDefinition\n ? LinkControlData\n : T extends RichTextControlDefinition\n ? IndexSignatureHack<RichTextControlData>\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlData\n : T extends StyleControlDefinition\n ? StyleControlData\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlData\n : T extends TypographyControlDefinition\n ? TypographyControlData\n : never\n\nexport type GetItemLabelListControlItemData<T extends ListControlDefinition> = {\n id: string\n type?: T['config']['type']['type']\n value: GetItemLabelControlData<T['config']['type']>\n}\n\nexport type GetItemLabelShapeControlData<T extends ShapeControlDefinition = ShapeControlDefinition> = {\n [K in keyof T['config']['type']]?: GetItemLabelControlData<T['config']['type'][K]>\n}\n\nexport type GetItemListControlData<T extends ListControlDefinition = ListControlDefinition> =\n GetItemLabelListControlItemData<T>[]\n\nexport const ListControlType = 'makeswift::controls::list'\n\ntype ListControlConfig<T extends ControlDefinition = ControlDefinition> = {\n type: T\n label?: string\n getItemLabel?(item: GetItemLabelControlData<T> | undefined): string\n}\n\nexport type ListControlDefinition<C extends ListControlConfig = ListControlConfig> = {\n type: typeof ListControlType\n config: C\n}\n\nexport function List<T extends ControlDefinition, C extends ListControlConfig<T>>(\n config: C & { type: T },\n): ListControlDefinition<C> {\n return { type: ListControlType, config }\n}\n\nexport type ListControlItemData<T extends ListControlDefinition> = {\n id: string\n type?: T['config']['type']['type']\n value: ControlDefinitionData<T['config']['type']>\n}\n\nexport type ListControlData<T extends ListControlDefinition = ListControlDefinition> =\n ListControlItemData<T>[]\n\nexport const ListControlMessageType = {\n LIST_CONTROL_ITEM_CONTROL_MESSAGE: 'makeswift::controls::list::message::item-control-message',\n} as const\n\ntype ListControlItemControlMessage = {\n type: typeof ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE\n payload: { message: PropControllerMessage; itemId: string }\n}\n\nexport type ListControlMessage = ListControlItemControlMessage\n\nexport class ListControl<\n T extends ListControlDefinition = ListControlDefinition,\n> extends PropController<ListControlMessage> {\n controls: Map<string, AnyPropController>\n descriptor: ListControlDefinition\n send: Send<ListControlMessage>\n\n constructor(send: Send<ListControlMessage>, descriptor: T) {\n super(send)\n\n this.descriptor = descriptor\n this.send = send\n\n this.controls = new Map<string, AnyPropController>()\n }\n\n setItemsControl = (value: ListControlData<T> | undefined) => {\n const controls = new Map<string, AnyPropController>()\n\n if (value == null) return\n\n const shouldUpdate = () => {\n // If the length is different, should update\n if (value.length !== this.controls.size) return true\n // If this.controls does not have an itemId, should update\n if (!value.every(({ id }) => this.controls.has(id))) return true\n\n return false\n }\n\n if (!shouldUpdate()) return this.controls\n\n value.forEach(item => {\n const control = createPropController(this.descriptor.config.type, message =>\n this.send({\n type: ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE,\n payload: { message, itemId: item.id },\n }),\n )\n\n controls.set(item.id, control)\n })\n\n this.controls = controls\n\n return this.controls\n }\n\n recv = (message: ListControlMessage) => {\n switch (message.type) {\n case ListControlMessageType.LIST_CONTROL_ITEM_CONTROL_MESSAGE: {\n const control = this.controls.get(message.payload.itemId)\n\n if (control == null) return\n\n // TODO: We're casting the type here as the arg0 type for control.recv is never\n const recv = control.recv as (arg0: PropControllerMessage) => void\n\n recv(message.payload.message)\n }\n }\n }\n}\n\nexport function copyListData(\n definition: ListControlDefinition,\n value: ListControlData | undefined,\n context: CopyContext,\n): ListControlData | undefined {\n if (value == null) return value\n\n return (\n value &&\n value.map(item => ({\n ...item,\n value: controlCopy(definition.config.type, item.value, context),\n }))\n )\n}\n\nfunction introspectListData<T>(\n definition: ListControlDefinition,\n value: ListControlData | undefined,\n func: (definition: ControlDefinition, data: Data) => T[],\n): T[] {\n if (value == null) return []\n\n return value.flatMap(item => func(definition.config.type, item.value))\n}\n\nexport function getListElementChildren(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getElementChildren)\n}\n\nexport function getListSwatchIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getSwatchIds)\n}\n\nexport function getListFileIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getFileIds)\n}\n\nexport function getListTypographyIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getTypographyIds)\n}\n\nexport function getListPageIds(definition: ListControlDefinition, value: ListControlData) {\n return introspectListData(definition, value, getPageIds)\n}\n\nexport function getListTranslatableData(definition: ListControlDefinition, data: ListControlData) {\n return Object.fromEntries(\n data.map(item => [item.id, getTranslatableData(definition.config.type, item.value)]),\n )\n}\n\nexport type ListControlTranslationDto = Record<string, ListControlData>\n\nexport function mergeListTranslatedData(\n definition: ListControlDefinition,\n data: ListControlData,\n translatedData: ListControlTranslationDto,\n context: MergeTranslatableDataContext,\n) {\n return data.map(item => {\n return {\n ...item,\n value: mergeTranslatedData(\n definition.config.type,\n item.value,\n translatedData[item.id],\n context,\n ),\n }\n })\n}\n"],"mappings":"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","names":["import_control","controlCopy"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/controls/rich-text/dto-types.ts"],"sourcesContent":["import { BlockType, InlineType } from '../../slate'\n\nexport const ObjectType = {\n Value: 'value',\n Text: 'text',\n Inline: 'inline',\n Block: 'block',\n Document: 'document',\n Leaf: 'leaf',\n Selection: 'selection',\n Mark: 'mark',\n Range: 'range',\n Decoration: 'decoration',\n Annotation: 'annotation',\n Point: 'point',\n Operation: 'operation',\n} as const\n\nexport type ObjectType = typeof ObjectType[keyof typeof ObjectType]\n\nexport interface ValueJSON {\n object?: typeof ObjectType.Value | undefined\n document?: DocumentJSON | undefined\n selection?: SelectionJSON | undefined\n annotations?: { [key: string]: AnnotationJSON } | undefined\n data?: { [key: string]: any } | undefined\n}\nexport type RichTextDTO = ValueJSON\n\nexport interface DocumentJSON {\n object?: typeof ObjectType.Document | undefined\n nodes?: NodeJSON[] | undefined\n key?: string | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface BlockJSON {\n object?: typeof ObjectType.Block | undefined\n type: typeof BlockType[keyof typeof BlockType]\n key?: string | undefined\n nodes?: Array<BlockJSON | InlineJSON | TextJSON> | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface InlineJSON {\n object?: typeof ObjectType.Inline | undefined\n type: typeof InlineType[keyof typeof InlineType]\n key?: string | undefined\n nodes?: Array<InlineJSON | TextJSON> | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface TextJSON {\n object?: typeof ObjectType.Text | undefined\n key?: string | undefined\n text?: string | undefined\n marks?: MarkJSON[] | undefined\n}\n\nexport interface LeafJSON {\n object?: typeof ObjectType.Leaf | undefined\n marks?: MarkJSON[] | undefined\n text?: string | undefined\n}\nexport type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON\n\nexport interface SelectionJSON {\n object?: typeof ObjectType.Selection | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n isFocused?: boolean | undefined\n marks?: MarkJSON[] | undefined\n}\n\nexport interface MarkJSON {\n object?: typeof ObjectType.Mark | undefined\n type: string\n data?: { [key: string]: any } | undefined\n}\n\nexport interface RangeJSON {\n object?: typeof ObjectType.Range | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n}\n\nexport interface DecorationJSON {\n object?: typeof ObjectType.Decoration | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n type?: string | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface AnnotationJSON {\n object?: typeof ObjectType.Annotation | undefined\n key: string\n type: string\n data?: { [key: string]: any } | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n}\n\nexport interface PointJSON {\n object?: typeof ObjectType.Point | undefined\n key?: string | undefined\n offset?: number | undefined\n path?: number[] | undefined\n}\n\nexport interface OperationJSON {\n object?: typeof ObjectType.Operation | undefined\n type: string\n text?: string | undefined\n target?: number | undefined\n properties?: NodeJSON | ValueJSON | SelectionJSON | AnnotationJSON | undefined\n position?: number | undefined\n path?: number[] | undefined\n offset?: number | undefined\n node?: Node | undefined\n newProperties?: NodeJSON | ValueJSON | SelectionJSON | MarkJSON | AnnotationJSON | undefined\n newPath?: number[] | undefined\n mark?: MarkJSON | undefined\n data?: { [key: string]: any } | undefined\n annotation?: AnnotationJSON | undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../../src/controls/rich-text/dto-types.ts"],"sourcesContent":["import { BlockType, InlineType } from '../../slate'\nimport { IndexSignatureHack } from '../../utils/index-signature-hack'\n\nexport const ObjectType = {\n Value: 'value',\n Text: 'text',\n Inline: 'inline',\n Block: 'block',\n Document: 'document',\n Leaf: 'leaf',\n Selection: 'selection',\n Mark: 'mark',\n Range: 'range',\n Decoration: 'decoration',\n Annotation: 'annotation',\n Point: 'point',\n Operation: 'operation',\n} as const\n\nexport type ObjectType = typeof ObjectType[keyof typeof ObjectType]\n\nexport interface ValueJSON {\n object?: typeof ObjectType.Value | undefined\n document?: DocumentJSON | undefined\n selection?: SelectionJSON | undefined\n annotations?: { [key: string]: AnnotationJSON } | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport type RichTextDTO = ValueJSON\n\nexport type RichTextValue = IndexSignatureHack<RichTextDTO>\n\nexport interface DocumentJSON {\n object?: typeof ObjectType.Document | undefined\n nodes?: NodeJSON[] | undefined\n key?: string | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface BlockJSON {\n object?: typeof ObjectType.Block | undefined\n type: typeof BlockType[keyof typeof BlockType]\n key?: string | undefined\n nodes?: Array<BlockJSON | InlineJSON | TextJSON> | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface InlineJSON {\n object?: typeof ObjectType.Inline | undefined\n type: typeof InlineType[keyof typeof InlineType]\n key?: string | undefined\n nodes?: Array<InlineJSON | TextJSON> | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface TextJSON {\n object?: typeof ObjectType.Text | undefined\n key?: string | undefined\n text?: string | undefined\n marks?: MarkJSON[] | undefined\n}\n\nexport interface LeafJSON {\n object?: typeof ObjectType.Leaf | undefined\n marks?: MarkJSON[] | undefined\n text?: string | undefined\n}\nexport type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON\n\nexport interface SelectionJSON {\n object?: typeof ObjectType.Selection | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n isFocused?: boolean | undefined\n marks?: MarkJSON[] | undefined\n}\n\nexport interface MarkJSON {\n object?: typeof ObjectType.Mark | undefined\n type: string\n data?: { [key: string]: any } | undefined\n}\n\nexport interface RangeJSON {\n object?: typeof ObjectType.Range | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n}\n\nexport interface DecorationJSON {\n object?: typeof ObjectType.Decoration | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n type?: string | undefined\n data?: { [key: string]: any } | undefined\n}\n\nexport interface AnnotationJSON {\n object?: typeof ObjectType.Annotation | undefined\n key: string\n type: string\n data?: { [key: string]: any } | undefined\n anchor?: PointJSON | undefined\n focus?: PointJSON | undefined\n}\n\nexport interface PointJSON {\n object?: typeof ObjectType.Point | undefined\n key?: string | undefined\n offset?: number | undefined\n path?: number[] | undefined\n}\n\nexport interface OperationJSON {\n object?: typeof ObjectType.Operation | undefined\n type: string\n text?: string | undefined\n target?: number | undefined\n properties?: NodeJSON | ValueJSON | SelectionJSON | AnnotationJSON | undefined\n position?: number | undefined\n path?: number[] | undefined\n offset?: number | undefined\n node?: Node | undefined\n newProperties?: NodeJSON | ValueJSON | SelectionJSON | MarkJSON | AnnotationJSON | undefined\n newPath?: number[] | undefined\n mark?: MarkJSON | undefined\n data?: { [key: string]: any } | undefined\n annotation?: AnnotationJSON | undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,aAAa;AAAA,EACxB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,WAAW;AACb;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
createReplacementContextHelper: () => createReplacementContextHelper
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
function createReplacementContextHelper(options) {
|
|
25
|
+
return {
|
|
26
|
+
elementHtmlIds: options?.elementHtmlIds ?? /* @__PURE__ */ new Set(),
|
|
27
|
+
elementKeys: options?.elementKeys ?? /* @__PURE__ */ new Map(),
|
|
28
|
+
swatchIds: options?.swatchIds ?? /* @__PURE__ */ new Map(),
|
|
29
|
+
fileIds: options?.fileIds ?? /* @__PURE__ */ new Map(),
|
|
30
|
+
typographyIds: options?.typographyIds ?? /* @__PURE__ */ new Map(),
|
|
31
|
+
tableIds: options?.tableIds ?? /* @__PURE__ */ new Map(),
|
|
32
|
+
tableColumnIds: options?.tableColumnIds ?? /* @__PURE__ */ new Map(),
|
|
33
|
+
pageIds: options?.pageIds ?? /* @__PURE__ */ new Map(),
|
|
34
|
+
globalElementIds: options?.globalElementIds ?? /* @__PURE__ */ new Map(),
|
|
35
|
+
globalElementData: options?.globalElementData ?? /* @__PURE__ */ new Map()
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
createReplacementContextHelper
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/utils.ts"],"sourcesContent":["import { ReplacementContext } from '../state/react-page'\nimport { ElementData } from './data'\n\nexport function createReplacementContextHelper(options?: {\n elementHtmlIds?: Set<string>\n elementKeys?: Map<string, string>\n swatchIds?: Map<string, string>\n fileIds?: Map<string, string>\n typographyIds?: Map<string, string>\n tableIds?: Map<string, string>\n tableColumnIds?: Map<string, string>\n pageIds?: Map<string, string>\n globalElementIds?: Map<string, string>\n globalElementData?: Map<string, ElementData>\n}): ReplacementContext {\n return {\n elementHtmlIds: options?.elementHtmlIds ?? new Set<string>(),\n elementKeys: options?.elementKeys ?? new Map<string, string>(),\n swatchIds: options?.swatchIds ?? new Map<string, string>(),\n fileIds: options?.fileIds ?? new Map<string, string>(),\n typographyIds: options?.typographyIds ?? new Map<string, string>(),\n tableIds: options?.tableIds ?? new Map<string, string>(),\n tableColumnIds: options?.tableColumnIds ?? new Map<string, string>(),\n pageIds: options?.pageIds ?? new Map<string, string>(),\n globalElementIds: options?.globalElementIds ?? new Map<string, string>(),\n globalElementData: options?.globalElementData ?? new Map<string, ElementData>(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,+BAA+B,SAWxB;AACrB,SAAO;AAAA,IACL,gBAAgB,SAAS,kBAAkB,oBAAI,IAAY;AAAA,IAC3D,aAAa,SAAS,eAAe,oBAAI,IAAoB;AAAA,IAC7D,WAAW,SAAS,aAAa,oBAAI,IAAoB;AAAA,IACzD,SAAS,SAAS,WAAW,oBAAI,IAAoB;AAAA,IACrD,eAAe,SAAS,iBAAiB,oBAAI,IAAoB;AAAA,IACjE,UAAU,SAAS,YAAY,oBAAI,IAAoB;AAAA,IACvD,gBAAgB,SAAS,kBAAkB,oBAAI,IAAoB;AAAA,IACnE,SAAS,SAAS,WAAW,oBAAI,IAAoB;AAAA,IACrD,kBAAkB,SAAS,oBAAoB,oBAAI,IAAoB;AAAA,IACvE,mBAAmB,SAAS,qBAAqB,oBAAI,IAAyB;AAAA,EAChF;AACF;","names":[]}
|
|
@@ -36,7 +36,7 @@ async function handler(...args) {
|
|
|
36
36
|
const supportsPreviewMode = (0, import_ts_pattern.match)(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
|
|
37
37
|
const supportsDraftMode = (0, import_ts_pattern.match)(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
|
|
38
38
|
const body = {
|
|
39
|
-
version: "0.17.0-canary.
|
|
39
|
+
version: "0.17.0-canary.2",
|
|
40
40
|
previewMode: supportsPreviewMode,
|
|
41
41
|
draftMode: supportsDraftMode,
|
|
42
42
|
interactionMode: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/prop-controllers/copy/rich-text.ts"],"sourcesContent":["import { NodeJSON, InlineJSON, MarkJSON } from '../../controls'\nimport { CopyContext } from '../../state/react-page'\
|
|
1
|
+
{"version":3,"sources":["../../../../src/prop-controllers/copy/rich-text.ts"],"sourcesContent":["import { NodeJSON, InlineJSON, MarkJSON, RichTextValue } from '../../controls'\nimport { CopyContext } from '../../state/react-page'\n\nexport function copy(\n value: RichTextValue | undefined,\n context: CopyContext,\n): RichTextValue | undefined {\n if (value == null) return value\n\n return { ...value, document: value.document ? copyNode(value.document) : value.document }\n\n function copyNode<T extends NodeJSON>(node: T): T {\n switch (node.object) {\n case 'document':\n case 'block':\n case 'inline':\n // @ts-expect-error: TypeScript can't refine the generic type T, even though it can\n // refine NodeJSON.\n return copyInline(node)\n\n case 'text':\n return { ...node, marks: node.marks?.map(copyMark) }\n\n default:\n return node\n }\n }\n\n function copyInline(inline: InlineJSON): InlineJSON {\n switch (inline.type) {\n case 'link':\n return {\n ...inline,\n nodes: inline.nodes?.map(copyNode),\n data: inline.data ? copyLinkData(inline.data as any) : inline.data,\n }\n\n default:\n return { ...inline, nodes: inline.nodes?.map(copyNode) }\n }\n }\n\n function copyLinkData(data: any): any {\n switch (data.type) {\n case 'OPEN_PAGE': {\n const pageId = data.payload.pageId\n\n if (pageId == null) return data\n\n return {\n ...data,\n payload: {\n ...data.payload,\n pageId: context.replacementContext.pageIds.get(pageId) ?? data.payload.pageId,\n },\n }\n }\n\n case 'SCROLL_TO_ELEMENT': {\n const elementIdConfig = data.payload.elementIdConfig\n\n if (elementIdConfig == null) return data\n\n return {\n ...data,\n payload: {\n ...data.payload,\n elementIdConfig: {\n ...elementIdConfig,\n elementKey:\n context.replacementContext.elementKeys.get(elementIdConfig.elementKey) ??\n elementIdConfig.elementKey,\n },\n },\n }\n }\n\n default:\n return data\n }\n }\n\n function copyMark(mark: MarkJSON): MarkJSON {\n switch (mark.type) {\n case 'typography': {\n const typographyId = mark.data?.value.id\n\n return {\n ...mark,\n data: {\n ...mark.data,\n value: {\n ...mark.data?.value,\n id: context.replacementContext.typographyIds.get(typographyId) ?? typographyId,\n style: mark.data?.value.style.map((override: any) => ({\n ...override,\n value: {\n ...override.value,\n color:\n override.value.color == null\n ? override.value.color\n : {\n ...override.value.color,\n swatchId:\n context.replacementContext.swatchIds.get(\n override.value.color?.swatchId,\n ) ?? override.value.color?.swatchId,\n },\n },\n })),\n },\n },\n }\n }\n\n default:\n return mark\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,KACd,OACA,SAC2B;AAC3B,MAAI,SAAS;AAAM,WAAO;AAE1B,SAAO,EAAE,GAAG,OAAO,UAAU,MAAM,WAAW,SAAS,MAAM,QAAQ,IAAI,MAAM,SAAS;AAExF,WAAS,SAA6B,MAAY;AAChD,YAAQ,KAAK,QAAQ;AAAA,MACnB,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAGH,eAAO,WAAW,IAAI;AAAA,MAExB,KAAK;AACH,eAAO,EAAE,GAAG,MAAM,OAAO,KAAK,OAAO,IAAI,QAAQ,EAAE;AAAA,MAErD;AACE,eAAO;AAAA,IACX;AAAA,EACF;AAEA,WAAS,WAAW,QAAgC;AAClD,YAAQ,OAAO,MAAM;AAAA,MACnB,KAAK;AACH,eAAO;AAAA,UACL,GAAG;AAAA,UACH,OAAO,OAAO,OAAO,IAAI,QAAQ;AAAA,UACjC,MAAM,OAAO,OAAO,aAAa,OAAO,IAAW,IAAI,OAAO;AAAA,QAChE;AAAA,MAEF;AACE,eAAO,EAAE,GAAG,QAAQ,OAAO,OAAO,OAAO,IAAI,QAAQ,EAAE;AAAA,IAC3D;AAAA,EACF;AAEA,WAAS,aAAa,MAAgB;AACpC,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK,aAAa;AAChB,cAAM,SAAS,KAAK,QAAQ;AAE5B,YAAI,UAAU;AAAM,iBAAO;AAE3B,eAAO;AAAA,UACL,GAAG;AAAA,UACH,SAAS;AAAA,YACP,GAAG,KAAK;AAAA,YACR,QAAQ,QAAQ,mBAAmB,QAAQ,IAAI,MAAM,KAAK,KAAK,QAAQ;AAAA,UACzE;AAAA,QACF;AAAA,MACF;AAAA,MAEA,KAAK,qBAAqB;AACxB,cAAM,kBAAkB,KAAK,QAAQ;AAErC,YAAI,mBAAmB;AAAM,iBAAO;AAEpC,eAAO;AAAA,UACL,GAAG;AAAA,UACH,SAAS;AAAA,YACP,GAAG,KAAK;AAAA,YACR,iBAAiB;AAAA,cACf,GAAG;AAAA,cACH,YACE,QAAQ,mBAAmB,YAAY,IAAI,gBAAgB,UAAU,KACrE,gBAAgB;AAAA,YACpB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MAEA;AACE,eAAO;AAAA,IACX;AAAA,EACF;AAEA,WAAS,SAAS,MAA0B;AAC1C,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK,cAAc;AACjB,cAAM,eAAe,KAAK,MAAM,MAAM;AAEtC,eAAO;AAAA,UACL,GAAG;AAAA,UACH,MAAM;AAAA,YACJ,GAAG,KAAK;AAAA,YACR,OAAO;AAAA,cACL,GAAG,KAAK,MAAM;AAAA,cACd,IAAI,QAAQ,mBAAmB,cAAc,IAAI,YAAY,KAAK;AAAA,cAClE,OAAO,KAAK,MAAM,MAAM,MAAM,IAAI,CAAC,cAAmB;AAAA,gBACpD,GAAG;AAAA,gBACH,OAAO;AAAA,kBACL,GAAG,SAAS;AAAA,kBACZ,OACE,SAAS,MAAM,SAAS,OACpB,SAAS,MAAM,QACf;AAAA,oBACE,GAAG,SAAS,MAAM;AAAA,oBAClB,UACE,QAAQ,mBAAmB,UAAU;AAAA,sBACnC,SAAS,MAAM,OAAO;AAAA,oBACxB,KAAK,SAAS,MAAM,OAAO;AAAA,kBAC/B;AAAA,gBACR;AAAA,cACF,EAAE;AAAA,YACJ;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MAEA;AACE,eAAO;AAAA,IACX;AAAA,EACF;AACF;","names":[]}
|
|
@@ -23,7 +23,6 @@ __export(copy_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(copy_exports);
|
|
25
25
|
var import_backgrounds = require("./copy/backgrounds");
|
|
26
|
-
var import_grid = require("./copy/grid");
|
|
27
26
|
var import_prop_controllers = require("@makeswift/prop-controllers");
|
|
28
27
|
var import_image = require("./copy/image");
|
|
29
28
|
var import_images = require("./copy/images");
|
|
@@ -31,12 +30,13 @@ var import_rich_text = require("./copy/rich-text");
|
|
|
31
30
|
var import_element_id = require("./copy/element-id");
|
|
32
31
|
var import_prop_controllers2 = require("@makeswift/prop-controllers");
|
|
33
32
|
var import_prop_controllers3 = require("@makeswift/prop-controllers");
|
|
33
|
+
var import_deleted = require("./deleted");
|
|
34
34
|
function copy(descriptor, value, context) {
|
|
35
35
|
switch (descriptor.type) {
|
|
36
36
|
case "Backgrounds":
|
|
37
37
|
return (0, import_backgrounds.copy)(descriptor, value, context);
|
|
38
|
-
case
|
|
39
|
-
return (0,
|
|
38
|
+
case import_prop_controllers2.Types.Grid:
|
|
39
|
+
return (0, import_prop_controllers.copyGridPropControllerData)(value, context);
|
|
40
40
|
case import_prop_controllers2.Types.NavigationLinks:
|
|
41
41
|
return (0, import_prop_controllers3.copyNavigationLinksPropControllerData)(value, context);
|
|
42
42
|
case import_prop_controllers2.Types.Link:
|
|
@@ -55,7 +55,7 @@ function copy(descriptor, value, context) {
|
|
|
55
55
|
return (0, import_prop_controllers3.copyTablePropControllerData)(value, context);
|
|
56
56
|
case import_prop_controllers2.Types.Border:
|
|
57
57
|
return (0, import_prop_controllers.copyBorderPropControllerData)(value, context);
|
|
58
|
-
case
|
|
58
|
+
case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText:
|
|
59
59
|
return (0, import_rich_text.copy)(value, context);
|
|
60
60
|
case "ElementID":
|
|
61
61
|
return (0, import_element_id.copy)(value, context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/copy.ts"],"sourcesContent":["import { Descriptor } from './descriptors'\nimport { copy as backgroundsCopy } from './copy/backgrounds'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/copy.ts"],"sourcesContent":["import { Descriptor } from './descriptors'\nimport { copy as backgroundsCopy } from './copy/backgrounds'\nimport {\n copyLinkPropControllerData,\n copyShadowsPropControllerData,\n copyBorderPropControllerData,\n copyGridPropControllerData,\n} from '@makeswift/prop-controllers'\nimport { copy as imageCopy } from './copy/image'\nimport { copy as imagesCopy } from './copy/images'\nimport { copy as richTextCopy } from './copy/rich-text'\nimport { copy as elementIdCopy } from './copy/element-id'\nimport { CopyContext } from '../state/react-page'\nimport { Types as PropControllerTypes } from '@makeswift/prop-controllers'\nimport {\n copyResponsiveColorPropControllerData,\n copyTablePropControllerData,\n copyNavigationLinksPropControllerData,\n} from '@makeswift/prop-controllers'\nimport { DELETED_PROP_CONTROLLER_TYPES } from './deleted'\n\n// @note: note typing value, because would then have to type narrow `Data` per case\nexport function copy(descriptor: Descriptor, value: any, context: CopyContext) {\n switch (descriptor.type) {\n case 'Backgrounds':\n return backgroundsCopy(descriptor, value, context)\n case PropControllerTypes.Grid:\n return copyGridPropControllerData(value, context)\n case PropControllerTypes.NavigationLinks:\n return copyNavigationLinksPropControllerData(value, context)\n case PropControllerTypes.Link:\n return copyLinkPropControllerData(value, context)\n case 'Shadows':\n return copyShadowsPropControllerData(value, context)\n case 'Image':\n return imageCopy(descriptor, value, context)\n case 'Images':\n return imagesCopy(descriptor, value, context)\n case 'ResponsiveColor':\n return copyResponsiveColorPropControllerData(value, context)\n case PropControllerTypes.TableFormFields:\n return copyTablePropControllerData(value, context)\n case PropControllerTypes.Table:\n return copyTablePropControllerData(value, context)\n case PropControllerTypes.Border:\n return copyBorderPropControllerData(value, context)\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return richTextCopy(value, context)\n case 'ElementID':\n return elementIdCopy(value, context)\n default:\n return value\n }\n}\n\nexport function copyElementReference(value: string, context: CopyContext) {\n return context.replacementContext.globalElementIds.get(value) || value\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAwC;AACxC,8BAKO;AACP,mBAAkC;AAClC,oBAAmC;AACnC,uBAAqC;AACrC,wBAAsC;AAEtC,IAAAA,2BAA6C;AAC7C,IAAAA,2BAIO;AACP,qBAA8C;AAGvC,SAAS,KAAK,YAAwB,OAAY,SAAsB;AAC7E,UAAQ,WAAW,MAAM;AAAA,IACvB,KAAK;AACH,iBAAO,mBAAAC,MAAgB,YAAY,OAAO,OAAO;AAAA,IACnD,KAAK,yBAAAC,MAAoB;AACvB,iBAAO,oDAA2B,OAAO,OAAO;AAAA,IAClD,KAAK,yBAAAA,MAAoB;AACvB,iBAAO,gEAAsC,OAAO,OAAO;AAAA,IAC7D,KAAK,yBAAAA,MAAoB;AACvB,iBAAO,oDAA2B,OAAO,OAAO;AAAA,IAClD,KAAK;AACH,iBAAO,uDAA8B,OAAO,OAAO;AAAA,IACrD,KAAK;AACH,iBAAO,aAAAC,MAAU,YAAY,OAAO,OAAO;AAAA,IAC7C,KAAK;AACH,iBAAO,cAAAC,MAAW,YAAY,OAAO,OAAO;AAAA,IAC9C,KAAK;AACH,iBAAO,gEAAsC,OAAO,OAAO;AAAA,IAC7D,KAAK,yBAAAF,MAAoB;AACvB,iBAAO,sDAA4B,OAAO,OAAO;AAAA,IACnD,KAAK,yBAAAA,MAAoB;AACvB,iBAAO,sDAA4B,OAAO,OAAO;AAAA,IACnD,KAAK,yBAAAA,MAAoB;AACvB,iBAAO,sDAA6B,OAAO,OAAO;AAAA,IACpD,KAAK,6CAA8B;AACjC,iBAAO,iBAAAG,MAAa,OAAO,OAAO;AAAA,IACpC,KAAK;AACH,iBAAO,kBAAAC,MAAc,OAAO,OAAO;AAAA,IACrC;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,qBAAqB,OAAe,SAAsB;AACxE,SAAO,QAAQ,mBAAmB,iBAAiB,IAAI,KAAK,KAAK;AACnE;","names":["import_prop_controllers","backgroundsCopy","PropControllerTypes","imageCopy","imagesCopy","richTextCopy","elementIdCopy"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/deleted.ts"],"sourcesContent":["import { Data, DescriptorValueType, PanelDescriptor } from './descriptors'\n\nexport const DELETED_PROP_CONTROLLER_TYPES = {\n List: 'List',\n Shape: 'Shape',\n Typeahead: 'Typeahead',\n} as const\n\nexport type DeletedPropControllerDescriptor<T extends Data = Data> =\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\n\ntype ListValueItem<T extends Data> = { id: string; value?: T }\n\nexport type ListValue<T extends Data = Data> = ListValueItem<T>[]\n\nexport type ListOptions<T extends Data> = {\n type: PanelDescriptor<T>\n label?: string\n getItemLabel?: ((value: T | undefined) => string) | ((value: T | undefined) => Promise<string>)\n preset?: ListValue<T>\n defaultValue?: ListValue<T>\n}\n\nexport type ListDescriptor<T extends ListValue = ListValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\n}\n\nexport type ShapeValue<T extends Data = Data> = Record<string, T>\n\ntype ShapeOptions<T extends Record<string, PanelDescriptor>> = {\n type: T\n preset?: { [K in keyof T]?: DescriptorValueType<T[K]> }\n}\n\nexport type ShapeDescriptor<\n _T extends Record<string, Data>,\n U extends Record<string, PanelDescriptor>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: ShapeOptions<U>\n}\n\nexport type TypeaheadValue<T extends Data = Data> = {\n id: string\n label: string\n value: T\n}\n\nexport type TypeaheadOptions<T extends Data> = {\n getItems: (query: string) => Promise<TypeaheadValue<T>[]>\n label?: string\n preset?: TypeaheadValue<T>\n defaultValue?: TypeaheadValue<T>\n}\n\nexport type TypeaheadDescriptor<T extends TypeaheadValue = TypeaheadValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/deleted.ts"],"sourcesContent":["import { RichTextValue } from '../controls'\nimport { Data, DescriptorValueType, PanelDescriptor } from './descriptors'\n\nexport const DELETED_PROP_CONTROLLER_TYPES = {\n List: 'List',\n RichText: 'RichText',\n Shape: 'Shape',\n Typeahead: 'Typeahead',\n} as const\n\nexport type DeletedPropControllerDescriptor<T extends Data = Data> =\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | RichTextDescriptor<T>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\n\ntype ListValueItem<T extends Data> = { id: string; value?: T }\n\nexport type ListValue<T extends Data = Data> = ListValueItem<T>[]\n\nexport type ListOptions<T extends Data> = {\n type: PanelDescriptor<T>\n label?: string\n getItemLabel?: ((value: T | undefined) => string) | ((value: T | undefined) => Promise<string>)\n preset?: ListValue<T>\n defaultValue?: ListValue<T>\n}\n\nexport type ListDescriptor<T extends ListValue = ListValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\n}\n\nexport type RichTextOptions = { preset?: RichTextValue }\n\nexport type RichTextDescriptor<_T extends Data = RichTextValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: RichTextOptions\n}\n\nexport type ShapeValue<T extends Data = Data> = Record<string, T>\n\ntype ShapeOptions<T extends Record<string, PanelDescriptor>> = {\n type: T\n preset?: { [K in keyof T]?: DescriptorValueType<T[K]> }\n}\n\nexport type ShapeDescriptor<\n _T extends Record<string, Data>,\n U extends Record<string, PanelDescriptor>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: ShapeOptions<U>\n}\n\nexport type TypeaheadValue<T extends Data = Data> = {\n id: string\n label: string\n value: T\n}\n\nexport type TypeaheadOptions<T extends Data> = {\n getItems: (query: string) => Promise<TypeaheadValue<T>[]>\n label?: string\n preset?: TypeaheadValue<T>\n defaultValue?: TypeaheadValue<T>\n}\n\nexport type TypeaheadDescriptor<T extends TypeaheadValue = TypeaheadValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,gCAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO;AAAA,EACP,WAAW;AACb;","names":[]}
|
|
@@ -19,18 +19,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var descriptors_exports = {};
|
|
20
20
|
__export(descriptors_exports, {
|
|
21
21
|
Backgrounds: () => Backgrounds,
|
|
22
|
-
Grid: () => Grid,
|
|
23
22
|
Image: () => Image,
|
|
24
23
|
Images: () => Images,
|
|
25
24
|
ResponsiveIconRadioGroup: () => ResponsiveIconRadioGroup,
|
|
26
25
|
ResponsiveNumber: () => ResponsiveNumber,
|
|
27
26
|
ResponsiveOpacity: () => ResponsiveOpacity,
|
|
28
27
|
ResponsiveSelect: () => ResponsiveSelect,
|
|
29
|
-
RichText: () => RichText,
|
|
30
28
|
SocialLinks: () => SocialLinks,
|
|
31
29
|
TextInput: () => TextInput,
|
|
32
30
|
Types: () => Types,
|
|
33
|
-
mergeGridPropControllerTranslatedData: () => mergeGridPropControllerTranslatedData,
|
|
34
31
|
socialLinkTypesV0: () => socialLinkTypesV0,
|
|
35
32
|
socialLinkTypesV1: () => socialLinkTypesV1
|
|
36
33
|
});
|
|
@@ -38,14 +35,12 @@ module.exports = __toCommonJS(descriptors_exports);
|
|
|
38
35
|
var import_style2 = require("../controls/style");
|
|
39
36
|
const Types = {
|
|
40
37
|
Backgrounds: "Backgrounds",
|
|
41
|
-
Grid: "Grid",
|
|
42
38
|
Image: "Image",
|
|
43
39
|
Images: "Images",
|
|
44
40
|
ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
|
|
45
41
|
ResponsiveNumber: "ResponsiveNumber",
|
|
46
42
|
ResponsiveOpacity: "ResponsiveOpacity",
|
|
47
43
|
ResponsiveSelect: "ResponsiveSelect",
|
|
48
|
-
RichText: "RichText",
|
|
49
44
|
SocialLinks: "SocialLinks",
|
|
50
45
|
TextInput: "TextInput",
|
|
51
46
|
Style: import_style2.StyleControlType
|
|
@@ -53,15 +48,6 @@ const Types = {
|
|
|
53
48
|
function Backgrounds(options = {}) {
|
|
54
49
|
return { type: Types.Backgrounds, version: 1, options };
|
|
55
50
|
}
|
|
56
|
-
function Grid(options = {}) {
|
|
57
|
-
return { type: Types.Grid, options };
|
|
58
|
-
}
|
|
59
|
-
function mergeGridPropControllerTranslatedData(data, context) {
|
|
60
|
-
return {
|
|
61
|
-
...data,
|
|
62
|
-
elements: data.elements.map((element) => context.mergeTranslatedData(element))
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
51
|
function Image(options = {}) {
|
|
66
52
|
return { type: Types.Image, version: 1, options };
|
|
67
53
|
}
|
|
@@ -80,9 +66,6 @@ function ResponsiveOpacity(options = {}) {
|
|
|
80
66
|
function ResponsiveSelect(options) {
|
|
81
67
|
return { type: Types.ResponsiveSelect, options };
|
|
82
68
|
}
|
|
83
|
-
function RichText(options = {}) {
|
|
84
|
-
return { type: Types.RichText, options };
|
|
85
|
-
}
|
|
86
69
|
const socialLinkTypesV0 = [
|
|
87
70
|
"angellist",
|
|
88
71
|
"codepen",
|
|
@@ -118,18 +101,15 @@ function TextInput(options = {}) {
|
|
|
118
101
|
// Annotate the CommonJS export names for ESM import in node:
|
|
119
102
|
0 && (module.exports = {
|
|
120
103
|
Backgrounds,
|
|
121
|
-
Grid,
|
|
122
104
|
Image,
|
|
123
105
|
Images,
|
|
124
106
|
ResponsiveIconRadioGroup,
|
|
125
107
|
ResponsiveNumber,
|
|
126
108
|
ResponsiveOpacity,
|
|
127
109
|
ResponsiveSelect,
|
|
128
|
-
RichText,
|
|
129
110
|
SocialLinks,
|
|
130
111
|
TextInput,
|
|
131
112
|
Types,
|
|
132
|
-
mergeGridPropControllerTranslatedData,
|
|
133
113
|
socialLinkTypesV0,
|
|
134
114
|
socialLinkTypesV1
|
|
135
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/descriptors.ts"],"sourcesContent":["import { ResponsiveColor } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Element, Data, MergeTranslatableDataContext } from '../state/react-page'\nimport { NumberControlDefinition } from '../controls/number'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport { StyleControlType } from '../controls/style'\nimport {\n CheckboxControlDefinition,\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\n TextAreaControlDefinition,\n TextInputControlDefinition,\n StyleControlDefinition,\n RichTextV2ControlDefinition,\n StyleV2ControlDefinition,\n TypographyControlDefinition,\n} from '../controls'\nimport { TextInputControlValue } from '../runtimes/react/controls/text-input'\nimport { TextAreaControlValue } from '../runtimes/react/controls/text-area'\nimport { ColorControlValue } from '../runtimes/react/controls/color'\nimport { SelectControlValue } from '../runtimes/react/controls/select'\nimport { CheckboxControlValue } from '../runtimes/react/controls/checkbox'\nimport { ResolveImageControlValue } from '../runtimes/react/controls/image'\nimport { ShapeControlValue } from '../runtimes/react/controls/shape'\nimport { ListControlValue } from '../runtimes/react/controls/list'\nimport { ComboboxControlValue } from '../runtimes/react/controls/combobox'\nimport { LinkControlValue } from '../runtimes/react/controls/link'\nimport { SlotControlValue } from '../runtimes/react/controls/slot'\nimport { RichTextControlDefinition, RichTextDTO } from '../controls/rich-text'\nimport { RichTextControlValue } from '../runtimes/react/controls/rich-text/rich-text'\nimport { RichTextV2ControlValue } from '../runtimes/react/controls/rich-text-v2'\nimport { StyleV2ControlFormattedValue } from '../runtimes/react/controls/style-v2'\nimport { IconRadioGroupControlDefinition } from '../controls/icon-radio-group'\nimport { IconRadioGroupControlValue } from '../runtimes/react/controls/icon-radio-group'\nimport { TypographyControlValue } from '../runtimes/react/controls/typography'\nimport {\n BorderDescriptor,\n CheckboxDescriptor,\n LinkData,\n LinkDescriptor,\n ResolveLinkPropControllerValue,\n Types as PropControllerTypes,\n ColorData as Color,\n ResponsiveValueType,\n ShadowsDescriptor,\n ResolveShadowsPropControllerValue,\n ResponsiveValue,\n Options,\n ResponsiveLengthDescriptor,\n ResolveResponsiveLengthPropControllerValue,\n NumberDescriptor,\n ResolveNumberPropControllerValue,\n ResponsiveColorDescriptor,\n ResolveCheckboxPropControllerValue,\n BorderRadiusDescriptor,\n ResolveBorderPropControllerValue,\n ResolveBorderRadiusPropControllerValue,\n DateDescriptor,\n ResolveDatePropControllerValue,\n FontDescriptor,\n ResolveFontPropControllerValue,\n VideoDescriptor,\n ResolveVideoPropControllerValue,\n TableDescriptor,\n ResolveTablePropControllerValue,\n MarginDescriptor,\n ResolveMarginPropControllerValue,\n PaddingDescriptor,\n ResolvePaddingPropControllerValue,\n WidthDescriptor,\n ResolveWidthPropControllerValue,\n TextStyleDescriptor,\n ResolveTextStylePropControllerValue,\n NavigationLinksDescriptor,\n ResolveNavigationLinksPropControllerValue,\n TextAreaDescriptor,\n ResolveTextAreaPropControllerValue,\n ResolveGapXPropControllerValue,\n GapXDescriptor,\n ResolveGapYPropControllerValue,\n GapYDescriptor,\n ElementIDDescriptor,\n ResolveElementIDPropControllerValue,\n TableFormFieldsDescriptor,\n ResolveTableFormFieldsPropControllerValue,\n} from '@makeswift/prop-controllers'\n\nexport type { Data }\n\n// See https://github.com/microsoft/TypeScript/issues/15300\nexport type IndexSignatureHack<T> = T extends Record<string, any>\n ? { [K in keyof T]: IndexSignatureHack<T[K]> }\n : T\n\ntype IconName =\n | 'HeightAuto16'\n | 'HeightMatch16'\n | 'VerticalAlignStart16'\n | 'VerticalAlignMiddle16'\n | 'VerticalAlignEnd16'\n | 'VerticalAlignSpaceBetween16'\n | 'ButtonPill16'\n | 'ButtonRounded16'\n | 'ButtonSquare16'\n | 'SizeSmall16'\n | 'SizeMedium16'\n | 'SizeLarge16'\n | 'ArrowInside16'\n | 'ArrowCenter16'\n | 'ArrowOutside16'\n | 'CountdownSolid16'\n | 'CountdownSolidSplit16'\n | 'CountdownOutline16'\n | 'CountdownOutlineSplit16'\n | 'CountdownNaked16'\n | 'Sun16'\n | 'Moon16'\n | 'AlignLeft16'\n | 'AlignCenter16'\n | 'AlignRight16'\n | 'Star16'\n | 'StarCircle16'\n | 'StarRoundedSquare16'\n | 'StarSquare16'\n\nexport type Gap = { value: number; unit: 'px' }\n\nexport const Types = {\n Backgrounds: 'Backgrounds',\n Grid: 'Grid',\n Image: 'Image',\n Images: 'Images',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n RichText: 'RichText',\n SocialLinks: 'SocialLinks',\n TextInput: 'TextInput',\n Style: StyleControlType,\n} as const\n\ntype ColorBackground = { type: 'color'; id: string; payload: Color | null }\n\ntype GradientStop = { id: string; location: number; color: Color | null }\n\ntype Gradient = { angle?: number; isRadial?: boolean; stops: GradientStop[] }\n\ntype GradientBackground = { type: 'gradient'; id: string; payload: Gradient }\n\ntype BackgroundImagePosition = { x: number; y: number }\n\ntype BackgroundImageSize = 'cover' | 'contain' | 'auto'\n\ntype BackgroundImageRepeat = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat'\n\ntype BackgroundImageV0 = {\n imageId: ImageValueV0\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\ntype BackgroundImageV1 = {\n version: 1\n image: ImageValueV1\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\nexport type BackgroundImage = BackgroundImageV0 | BackgroundImageV1\n\ntype ImageBackgroundV0 = { type: 'image'; id: string; payload: BackgroundImageV0 }\n\ntype ImageBackgroundV1 = { type: 'image-v1'; id: string; payload: BackgroundImageV1 }\n\nexport type ImageBackground = ImageBackgroundV0 | ImageBackgroundV1\n\ntype BackgroundVideoAspectRatio = 'wide' | 'standard'\n\ntype BackgroundVideo = {\n url?: string\n maskColor?: Color | null\n opacity?: number\n zoom?: number\n aspectRatio?: BackgroundVideoAspectRatio\n parallax?: number\n}\n\ntype VideoBackground = { type: 'video'; id: string; payload: BackgroundVideo }\n\ntype Background = ColorBackground | GradientBackground | ImageBackground | VideoBackground\n\nexport type BackgroundsValue = ResponsiveValue<Background[]>\n\ntype BackgroundsOptions = Options<Record<string, never>>\n\nexport type BackgroundsDescriptor<_T = BackgroundsValue> = {\n type: typeof Types.Backgrounds\n version?: 1\n options: BackgroundsOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Backgrounds(options: BackgroundsOptions = {}): BackgroundsDescriptor {\n return { type: Types.Backgrounds, version: 1, options }\n}\n\ntype GridColumn = { count: number; spans: number[][] }\n\nexport type GridValue = { elements: Element[]; columns: ResponsiveValue<GridColumn> }\n\ntype GridOptions = Options<Record<string, never>>\n\ntype GridDescriptor<_T = GridValue> = { type: typeof Types.Grid; options: GridOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Grid(options: GridOptions = {}): GridDescriptor {\n return { type: Types.Grid, options }\n}\n\nexport function mergeGridPropControllerTranslatedData(\n data: GridValue,\n context: MergeTranslatableDataContext,\n) {\n return {\n ...data,\n elements: data.elements.map(element => context.mergeTranslatedData(element)),\n }\n}\n\nexport type ImageValueV0 = string\n\ntype ImageValueV1MakeswiftFile = {\n version: 1\n type: 'makeswift-file'\n id: string\n}\n\ntype ImageValueV1ExternalFile = {\n version: 1\n type: 'external-file'\n url: string\n width?: number | null\n height?: number | null\n}\n\nexport type ImageValueV1 = ImageValueV1MakeswiftFile | ImageValueV1ExternalFile\n\nexport type ImageValue = ImageValueV0 | ImageValueV1\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\nexport type ImageDescriptor<_T = ImageValue> = {\n type: typeof Types.Image\n version?: 1\n options: ImageOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Image(options: ImageOptions = {}): ImageDescriptor {\n return { type: Types.Image, version: 1, options }\n}\n\nexport type ImagesValueV0Item = {\n key: string\n props: {\n link?: LinkData\n file?: ImageValueV0\n altText?: string\n }\n}\n\nexport type ImagesValueV1Item = {\n key: string\n version: 1\n props: {\n link?: LinkData\n file?: ImageValueV1\n altText?: string\n }\n}\n\nexport type ImagesValueItem = ImagesValueV0Item | ImagesValueV1Item\n\nexport type ImagesValue = ImagesValueItem[]\n\ntype ImagesOptions = Options<{ preset?: ImagesValue }>\n\nexport type ImagesDescriptor<_T = ImagesValue> = {\n type: typeof Types.Images\n version?: 1\n options: ImagesOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Images(options: ImagesOptions = {}): ImagesDescriptor {\n return { type: Types.Images, version: 1, options }\n}\n\nexport type IconRadioGroupOption<T extends string> = { value: T; label: string; icon: IconName }\n\nexport type ResponsiveIconRadioGroupValue<T extends string = string> = ResponsiveValue<T>\n\nexport type ResponsiveIconRadioGroupOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> = ResponsiveIconRadioGroupValue<string>,\n> = {\n type: typeof Types.ResponsiveIconRadioGroup\n options: ResponsiveIconRadioGroupOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveIconRadioGroup<_T extends string, T extends _T, U extends T>(\n options: ResponsiveIconRadioGroupOptions<T, U>,\n): ResponsiveIconRadioGroupDescriptor<ResponsiveIconRadioGroupValue<T>> {\n return { type: Types.ResponsiveIconRadioGroup, options }\n}\n\nexport type ResponsiveNumberValue = ResponsiveValue<number>\n\nexport type ResponsiveNumberOptions = Options<{\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type ResponsiveNumberDescriptor<_T = ResponsiveNumberValue> = {\n type: typeof Types.ResponsiveNumber\n options: ResponsiveNumberOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveNumber(\n options: ResponsiveNumberOptions = {},\n): ResponsiveNumberDescriptor {\n return { type: Types.ResponsiveNumber, options }\n}\n\nexport type ResponsiveOpacityValue = ResponsiveValue<number>\n\ntype ResponsiveOpacityOptions = Options<Record<string, never>>\n\ntype ResponsiveOpacityDescriptor<_T = ResponsiveOpacityValue> = {\n type: typeof Types.ResponsiveOpacity\n options: ResponsiveOpacityOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveOpacity(\n options: ResponsiveOpacityOptions = {},\n): ResponsiveOpacityDescriptor {\n return { type: Types.ResponsiveOpacity, options }\n}\n\nexport type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>\n\nexport type SelectLabelOrientation = 'vertical' | 'horizontal'\n\nexport type SelectOption<T extends string> = { value: T; label: string }\n\nexport type ResponsiveSelectOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> = ResponsiveSelectValue<string>,\n> = {\n type: typeof Types.ResponsiveSelect\n options: ResponsiveSelectOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveSelect<_T extends string, T extends _T, U extends T>(\n options: ResponsiveSelectOptions<T, U>,\n): ResponsiveSelectDescriptor<ResponsiveSelectValue<T>> {\n return { type: Types.ResponsiveSelect, options }\n}\n\nexport type RichTextValue = IndexSignatureHack<RichTextDTO>\n\nexport type RichTextOptions = Options<{ preset?: RichTextValue }>\n\nexport type RichTextDescriptor<_T extends Data = RichTextValue> = {\n type: typeof Types.RichText\n options: RichTextOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function RichText(options: RichTextOptions = {}): RichTextDescriptor {\n return { type: Types.RichText, options }\n}\n\nexport const socialLinkTypesV0 = [\n 'angellist',\n 'codepen',\n 'discord',\n 'dribbble',\n 'facebook',\n 'github',\n 'instagram',\n 'linkedin',\n 'medium',\n 'pinterest',\n 'reddit',\n 'rss',\n 'snapchat',\n 'soundcloud',\n 'spotify',\n 'telegram',\n 'tumblr',\n 'twitch',\n 'twitter',\n 'vimeo',\n 'whatsapp',\n 'yelp',\n 'youtube',\n] as const\n\ntype SocialLinkTypeV0 = typeof socialLinkTypesV0[number]\n\nexport const socialLinkTypesV1 = [...socialLinkTypesV0, 'x', 'slack'] as const\n\ntype SocialLinkTypeV1 = typeof socialLinkTypesV1[number]\n\ntype SocialLinkV0 = { type: SocialLinkTypeV0; url: string }\n\ntype SocialLinkV1 = { type: SocialLinkTypeV1; url: string }\n\ntype SocialLinksLinkV0 = { id: string; payload: SocialLinkV0 }\n\ntype SocialLinksLinkV1 = { id: string; payload: SocialLinkV1 }\n\ntype SocialLinksValueV0 = { links: SocialLinksLinkV0[]; openInNewTab: boolean }\n\ntype SocialLinksValueV1 = { links: SocialLinksLinkV1[]; openInNewTab: boolean }\n\nexport type SocialLinksValue = SocialLinksValueV0 | SocialLinksValueV1\n\ntype SocialLinksOptions = Options<{ preset?: SocialLinksValueV1 }>\n\nexport type SocialLinksDescriptor<_T = SocialLinksValueV1> = {\n type: typeof Types.SocialLinks\n options: SocialLinksOptions\n version?: 1\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function SocialLinks(options: SocialLinksOptions = {}): SocialLinksDescriptor {\n return { type: Types.SocialLinks, options, version: 1 }\n}\n\nexport type TextInputValue = string\n\nexport type TextInputOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type TextInputDescriptor<_T = TextInputValue> = {\n type: typeof Types.TextInput\n options: TextInputOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextInput(options: TextInputOptions = {}): TextInputDescriptor {\n return { type: Types.TextInput, options }\n}\n\nexport type Descriptor<T extends Data = Data> =\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | GridDescriptor<T>\n | ImageDescriptor<T>\n | ImagesDescriptor<T>\n | LinkDescriptor<T>\n | MarginDescriptor<T>\n | NavigationLinksDescriptor<T>\n | NumberDescriptor<T>\n | PaddingDescriptor<T>\n | ResponsiveColorDescriptor<T>\n | ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> ? T : ResponsiveIconRadioGroupValue<string>\n >\n | ResponsiveLengthDescriptor<T>\n | ResponsiveNumberDescriptor<T>\n | ResponsiveOpacityDescriptor<T>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\n | RichTextDescriptor<T>\n | ShadowsDescriptor<T>\n | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\n | TextAreaDescriptor<T>\n | TextInputDescriptor<T>\n | TextStyleDescriptor<T>\n | VideoDescriptor<T>\n | WidthDescriptor<T>\n | StyleControlDefinition\n | StyleV2ControlDefinition\n | NumberControlDefinition\n | CheckboxControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | IconRadioGroupControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | LinkControlDefinition\n | SlotControlDefinition\n | RichTextControlDefinition\n | RichTextV2ControlDefinition\n | TypographyControlDefinition\n\nexport type PanelDescriptorType =\n | typeof Types.Backgrounds\n | typeof Types.ResponsiveIconRadioGroup\n | typeof PropControllerTypes.Margin\n | typeof PropControllerTypes.Padding\n | typeof PropControllerTypes.Shadows\n | typeof PropControllerTypes.Border\n | typeof PropControllerTypes.GapY\n | typeof PropControllerTypes.GapX\n | typeof PropControllerTypes.BorderRadius\n | typeof PropControllerTypes.Checkbox\n | typeof Types.TextInput\n | typeof PropControllerTypes.Link\n | typeof Types.ResponsiveSelect\n | typeof PropControllerTypes.ResponsiveColor\n | typeof PropControllerTypes.TextStyle\n | typeof Types.Images\n | typeof Types.ResponsiveNumber\n | typeof PropControllerTypes.Number\n | typeof PropControllerTypes.Date\n | typeof PropControllerTypes.Font\n | typeof PropControllerTypes.TextArea\n | typeof PropControllerTypes.Table\n | typeof Types.RichText\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof PropControllerTypes.Video\n | typeof PropControllerTypes.NavigationLinks\n\nexport type PanelDescriptor<T extends Data = Data> = Extract<\n Descriptor<T>,\n { type: PanelDescriptorType }\n>\n\nexport type DescriptorValueType<T extends Descriptor> = T extends NumberControlDefinition\n ? NumberControlValue<T>\n : T extends CheckboxControlDefinition\n ? CheckboxControlValue<T>\n : T extends TextInputControlDefinition\n ? TextInputControlValue<T>\n : T extends TextAreaControlDefinition\n ? TextAreaControlValue<T>\n : T extends SelectControlDefinition\n ? SelectControlValue<T>\n : T extends ColorControlDefinition\n ? ColorControlValue<T>\n : T extends StyleControlDefinition\n ? StyleControlFormattedValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlValue<T>\n : T extends ImageControlDefinition\n ? ResolveImageControlValue<T>\n : T extends ComboboxControlDefinition\n ? ComboboxControlValue<T>\n : T extends ShapeControlDefinition\n ? ShapeControlValue<T>\n : T extends ListControlDefinition\n ? ListControlValue<T>\n : T extends LinkControlDefinition\n ? LinkControlValue<T>\n : T extends SlotControlDefinition\n ? SlotControlValue\n : T extends RichTextControlDefinition\n ? RichTextControlValue\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends TypographyControlDefinition\n ? TypographyControlValue\n : T['type'] extends typeof PropControllerTypes.ResponsiveColor\n ? // TODO(miguel): We're not importing a resolver type from `@makeswift/prop-controllers` because\n // the resolved type is tightly coupled with the runtime (i.e., it's the result of an API call).\n // This means that we probably want to rethink how types are resolved and where that lives.\n ResponsiveColor | null | undefined\n : T['type'] extends typeof PropControllerTypes.Checkbox\n ? ResolveCheckboxPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Checkbox }>>\n : T['type'] extends typeof PropControllerTypes.Date\n ? ResolveDatePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Date }>>\n : T['type'] extends typeof PropControllerTypes.ElementID\n ? ResolveElementIDPropControllerValue<Extract<T, { type: typeof PropControllerTypes.ElementID }>>\n : T['type'] extends typeof PropControllerTypes.Font\n ? ResolveFontPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Font }>>\n : T['type'] extends typeof PropControllerTypes.GapX\n ? ResolveGapXPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapX }>>\n : T['type'] extends typeof PropControllerTypes.GapY\n ? ResolveGapYPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapY }>>\n : T['type'] extends typeof PropControllerTypes.Link\n ? ResolveLinkPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Link }>>\n : T['type'] extends typeof PropControllerTypes.Width\n ? ResolveWidthPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Width }>>\n : T['type'] extends typeof PropControllerTypes.Padding\n ? ResolvePaddingPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Padding }>>\n : T['type'] extends typeof PropControllerTypes.Margin\n ? ResolveMarginPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Margin }>>\n : T['type'] extends typeof PropControllerTypes.NavigationLinks\n ? ResolveNavigationLinksPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.NavigationLinks }>\n >\n : T['type'] extends typeof PropControllerTypes.BorderRadius\n ? ResolveBorderRadiusPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.BorderRadius }>\n >\n : T['type'] extends typeof PropControllerTypes.Shadows\n ? ResolveShadowsPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Shadows }>>\n : T['type'] extends typeof PropControllerTypes.ResponsiveLength\n ? ResolveResponsiveLengthPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.ResponsiveLength }>\n >\n : T['type'] extends typeof PropControllerTypes.Border\n ? ResolveBorderPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Border }>>\n : T['type'] extends typeof PropControllerTypes.Number\n ? ResolveNumberPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Number }>>\n : T['type'] extends typeof PropControllerTypes.Table\n ? ResolveTablePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Table }>>\n : T['type'] extends typeof PropControllerTypes.TableFormFields\n ? ResolveTableFormFieldsPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.TableFormFields }>\n >\n : T['type'] extends typeof PropControllerTypes.TextStyle\n ? ResolveTextStylePropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextStyle }>>\n : T['type'] extends typeof PropControllerTypes.TextArea\n ? ResolveTextAreaPropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextArea }>>\n : T['type'] extends typeof PropControllerTypes.Video\n ? ResolveVideoPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Video }>>\n : T extends Descriptor<infer U>\n ? U | undefined\n : never\n\nexport type PanelDescriptorValueType<T extends PanelDescriptor> = T extends PanelDescriptor<infer U>\n ? U\n : never\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAAA,gBAAiC;AAgI1B,MAAM,QAAQ;AAAA,EACnB,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AACT;AA0EO,SAAS,YAAY,UAA8B,CAAC,GAA0B;AACnF,SAAO,EAAE,MAAM,MAAM,aAAa,SAAS,GAAG,QAAQ;AACxD;AAcO,SAAS,KAAK,UAAuB,CAAC,GAAmB;AAC9D,SAAO,EAAE,MAAM,MAAM,MAAM,QAAQ;AACrC;AAEO,SAAS,sCACd,MACA,SACA;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,KAAK,SAAS,IAAI,aAAW,QAAQ,oBAAoB,OAAO,CAAC;AAAA,EAC7E;AACF;AAkCO,SAAS,MAAM,UAAwB,CAAC,GAAoB;AACjE,SAAO,EAAE,MAAM,MAAM,OAAO,SAAS,GAAG,QAAQ;AAClD;AAqCO,SAAS,OAAO,UAAyB,CAAC,GAAqB;AACpE,SAAO,EAAE,MAAM,MAAM,QAAQ,SAAS,GAAG,QAAQ;AACnD;AA4BO,SAAS,yBACd,SACsE;AACtE,SAAO,EAAE,MAAM,MAAM,0BAA0B,QAAQ;AACzD;AAuBO,SAAS,iBACd,UAAmC,CAAC,GACR;AAC5B,SAAO,EAAE,MAAM,MAAM,kBAAkB,QAAQ;AACjD;AAeO,SAAS,kBACd,UAAoC,CAAC,GACR;AAC7B,SAAO,EAAE,MAAM,MAAM,mBAAmB,QAAQ;AAClD;AA+BO,SAAS,iBACd,SACsD;AACtD,SAAO,EAAE,MAAM,MAAM,kBAAkB,QAAQ;AACjD;AAeO,SAAS,SAAS,UAA2B,CAAC,GAAuB;AAC1E,SAAO,EAAE,MAAM,MAAM,UAAU,QAAQ;AACzC;AAEO,MAAM,oBAAoB;AAAA,EAC/B;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;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,oBAAoB,CAAC,GAAG,mBAAmB,KAAK,OAAO;AA8B7D,SAAS,YAAY,UAA8B,CAAC,GAA0B;AACnF,SAAO,EAAE,MAAM,MAAM,aAAa,SAAS,SAAS,EAAE;AACxD;AAeO,SAAS,UAAU,UAA4B,CAAC,GAAwB;AAC7E,SAAO,EAAE,MAAM,MAAM,WAAW,QAAQ;AAC1C;","names":["import_style"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/descriptors.ts"],"sourcesContent":["import { ResponsiveColor } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Data } from '../state/react-page'\nimport { NumberControlDefinition } from '../controls/number'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport { StyleControlType } from '../controls/style'\nimport {\n CheckboxControlDefinition,\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\n TextAreaControlDefinition,\n TextInputControlDefinition,\n StyleControlDefinition,\n RichTextV2ControlDefinition,\n StyleV2ControlDefinition,\n TypographyControlDefinition,\n} from '../controls'\nimport { TextInputControlValue } from '../runtimes/react/controls/text-input'\nimport { TextAreaControlValue } from '../runtimes/react/controls/text-area'\nimport { ColorControlValue } from '../runtimes/react/controls/color'\nimport { SelectControlValue } from '../runtimes/react/controls/select'\nimport { CheckboxControlValue } from '../runtimes/react/controls/checkbox'\nimport { ResolveImageControlValue } from '../runtimes/react/controls/image'\nimport { ShapeControlValue } from '../runtimes/react/controls/shape'\nimport { ListControlValue } from '../runtimes/react/controls/list'\nimport { ComboboxControlValue } from '../runtimes/react/controls/combobox'\nimport { LinkControlValue } from '../runtimes/react/controls/link'\nimport { SlotControlValue } from '../runtimes/react/controls/slot'\nimport { RichTextControlDefinition } from '../controls/rich-text'\nimport { RichTextControlValue } from '../runtimes/react/controls/rich-text/rich-text'\nimport { RichTextV2ControlValue } from '../runtimes/react/controls/rich-text-v2'\nimport { StyleV2ControlFormattedValue } from '../runtimes/react/controls/style-v2'\nimport { IconRadioGroupControlDefinition } from '../controls/icon-radio-group'\nimport { IconRadioGroupControlValue } from '../runtimes/react/controls/icon-radio-group'\nimport { TypographyControlValue } from '../runtimes/react/controls/typography'\nimport {\n BorderDescriptor,\n CheckboxDescriptor,\n LinkData,\n LinkDescriptor,\n ResolveLinkPropControllerValue,\n Types as PropControllerTypes,\n ColorData as Color,\n ResponsiveValueType,\n ShadowsDescriptor,\n ResolveShadowsPropControllerValue,\n ResponsiveValue,\n Options,\n ResponsiveLengthDescriptor,\n ResolveResponsiveLengthPropControllerValue,\n NumberDescriptor,\n ResolveNumberPropControllerValue,\n ResponsiveColorDescriptor,\n ResolveCheckboxPropControllerValue,\n BorderRadiusDescriptor,\n ResolveBorderPropControllerValue,\n ResolveBorderRadiusPropControllerValue,\n DateDescriptor,\n ResolveDatePropControllerValue,\n FontDescriptor,\n ResolveFontPropControllerValue,\n VideoDescriptor,\n ResolveVideoPropControllerValue,\n TableDescriptor,\n ResolveTablePropControllerValue,\n MarginDescriptor,\n ResolveMarginPropControllerValue,\n PaddingDescriptor,\n ResolvePaddingPropControllerValue,\n WidthDescriptor,\n ResolveWidthPropControllerValue,\n TextStyleDescriptor,\n ResolveTextStylePropControllerValue,\n NavigationLinksDescriptor,\n ResolveNavigationLinksPropControllerValue,\n TextAreaDescriptor,\n ResolveTextAreaPropControllerValue,\n ResolveGapXPropControllerValue,\n GapXDescriptor,\n ResolveGapYPropControllerValue,\n GapYDescriptor,\n ElementIDDescriptor,\n ResolveElementIDPropControllerValue,\n TableFormFieldsDescriptor,\n ResolveTableFormFieldsPropControllerValue,\n GridDescriptor,\n ResolveGridPropControllerValue,\n} from '@makeswift/prop-controllers'\nimport { DeletedPropControllerDescriptor } from './deleted'\n\nexport type { Data }\n\ntype IconName =\n | 'HeightAuto16'\n | 'HeightMatch16'\n | 'VerticalAlignStart16'\n | 'VerticalAlignMiddle16'\n | 'VerticalAlignEnd16'\n | 'VerticalAlignSpaceBetween16'\n | 'ButtonPill16'\n | 'ButtonRounded16'\n | 'ButtonSquare16'\n | 'SizeSmall16'\n | 'SizeMedium16'\n | 'SizeLarge16'\n | 'ArrowInside16'\n | 'ArrowCenter16'\n | 'ArrowOutside16'\n | 'CountdownSolid16'\n | 'CountdownSolidSplit16'\n | 'CountdownOutline16'\n | 'CountdownOutlineSplit16'\n | 'CountdownNaked16'\n | 'Sun16'\n | 'Moon16'\n | 'AlignLeft16'\n | 'AlignCenter16'\n | 'AlignRight16'\n | 'Star16'\n | 'StarCircle16'\n | 'StarRoundedSquare16'\n | 'StarSquare16'\n\nexport type Gap = { value: number; unit: 'px' }\n\nexport const Types = {\n Backgrounds: 'Backgrounds',\n Image: 'Image',\n Images: 'Images',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n SocialLinks: 'SocialLinks',\n TextInput: 'TextInput',\n Style: StyleControlType,\n} as const\n\ntype ColorBackground = { type: 'color'; id: string; payload: Color | null }\n\ntype GradientStop = { id: string; location: number; color: Color | null }\n\ntype Gradient = { angle?: number; isRadial?: boolean; stops: GradientStop[] }\n\ntype GradientBackground = { type: 'gradient'; id: string; payload: Gradient }\n\ntype BackgroundImagePosition = { x: number; y: number }\n\ntype BackgroundImageSize = 'cover' | 'contain' | 'auto'\n\ntype BackgroundImageRepeat = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat'\n\ntype BackgroundImageV0 = {\n imageId: ImageValueV0\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\ntype BackgroundImageV1 = {\n version: 1\n image: ImageValueV1\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\nexport type BackgroundImage = BackgroundImageV0 | BackgroundImageV1\n\ntype ImageBackgroundV0 = { type: 'image'; id: string; payload: BackgroundImageV0 }\n\ntype ImageBackgroundV1 = { type: 'image-v1'; id: string; payload: BackgroundImageV1 }\n\nexport type ImageBackground = ImageBackgroundV0 | ImageBackgroundV1\n\ntype BackgroundVideoAspectRatio = 'wide' | 'standard'\n\ntype BackgroundVideo = {\n url?: string\n maskColor?: Color | null\n opacity?: number\n zoom?: number\n aspectRatio?: BackgroundVideoAspectRatio\n parallax?: number\n}\n\ntype VideoBackground = { type: 'video'; id: string; payload: BackgroundVideo }\n\ntype Background = ColorBackground | GradientBackground | ImageBackground | VideoBackground\n\nexport type BackgroundsValue = ResponsiveValue<Background[]>\n\ntype BackgroundsOptions = Options<Record<string, never>>\n\nexport type BackgroundsDescriptor<_T = BackgroundsValue> = {\n type: typeof Types.Backgrounds\n version?: 1\n options: BackgroundsOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Backgrounds(options: BackgroundsOptions = {}): BackgroundsDescriptor {\n return { type: Types.Backgrounds, version: 1, options }\n}\n\nexport type ImageValueV0 = string\n\ntype ImageValueV1MakeswiftFile = {\n version: 1\n type: 'makeswift-file'\n id: string\n}\n\ntype ImageValueV1ExternalFile = {\n version: 1\n type: 'external-file'\n url: string\n width?: number | null\n height?: number | null\n}\n\nexport type ImageValueV1 = ImageValueV1MakeswiftFile | ImageValueV1ExternalFile\n\nexport type ImageValue = ImageValueV0 | ImageValueV1\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\nexport type ImageDescriptor<_T = ImageValue> = {\n type: typeof Types.Image\n version?: 1\n options: ImageOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Image(options: ImageOptions = {}): ImageDescriptor {\n return { type: Types.Image, version: 1, options }\n}\n\nexport type ImagesValueV0Item = {\n key: string\n props: {\n link?: LinkData\n file?: ImageValueV0\n altText?: string\n }\n}\n\nexport type ImagesValueV1Item = {\n key: string\n version: 1\n props: {\n link?: LinkData\n file?: ImageValueV1\n altText?: string\n }\n}\n\nexport type ImagesValueItem = ImagesValueV0Item | ImagesValueV1Item\n\nexport type ImagesValue = ImagesValueItem[]\n\ntype ImagesOptions = Options<{ preset?: ImagesValue }>\n\nexport type ImagesDescriptor<_T = ImagesValue> = {\n type: typeof Types.Images\n version?: 1\n options: ImagesOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Images(options: ImagesOptions = {}): ImagesDescriptor {\n return { type: Types.Images, version: 1, options }\n}\n\nexport type IconRadioGroupOption<T extends string> = { value: T; label: string; icon: IconName }\n\nexport type ResponsiveIconRadioGroupValue<T extends string = string> = ResponsiveValue<T>\n\nexport type ResponsiveIconRadioGroupOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> = ResponsiveIconRadioGroupValue<string>,\n> = {\n type: typeof Types.ResponsiveIconRadioGroup\n options: ResponsiveIconRadioGroupOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveIconRadioGroup<_T extends string, T extends _T, U extends T>(\n options: ResponsiveIconRadioGroupOptions<T, U>,\n): ResponsiveIconRadioGroupDescriptor<ResponsiveIconRadioGroupValue<T>> {\n return { type: Types.ResponsiveIconRadioGroup, options }\n}\n\nexport type ResponsiveNumberValue = ResponsiveValue<number>\n\nexport type ResponsiveNumberOptions = Options<{\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type ResponsiveNumberDescriptor<_T = ResponsiveNumberValue> = {\n type: typeof Types.ResponsiveNumber\n options: ResponsiveNumberOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveNumber(\n options: ResponsiveNumberOptions = {},\n): ResponsiveNumberDescriptor {\n return { type: Types.ResponsiveNumber, options }\n}\n\nexport type ResponsiveOpacityValue = ResponsiveValue<number>\n\ntype ResponsiveOpacityOptions = Options<Record<string, never>>\n\ntype ResponsiveOpacityDescriptor<_T = ResponsiveOpacityValue> = {\n type: typeof Types.ResponsiveOpacity\n options: ResponsiveOpacityOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveOpacity(\n options: ResponsiveOpacityOptions = {},\n): ResponsiveOpacityDescriptor {\n return { type: Types.ResponsiveOpacity, options }\n}\n\nexport type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>\n\nexport type SelectLabelOrientation = 'vertical' | 'horizontal'\n\nexport type SelectOption<T extends string> = { value: T; label: string }\n\nexport type ResponsiveSelectOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> = ResponsiveSelectValue<string>,\n> = {\n type: typeof Types.ResponsiveSelect\n options: ResponsiveSelectOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveSelect<_T extends string, T extends _T, U extends T>(\n options: ResponsiveSelectOptions<T, U>,\n): ResponsiveSelectDescriptor<ResponsiveSelectValue<T>> {\n return { type: Types.ResponsiveSelect, options }\n}\n\nexport const socialLinkTypesV0 = [\n 'angellist',\n 'codepen',\n 'discord',\n 'dribbble',\n 'facebook',\n 'github',\n 'instagram',\n 'linkedin',\n 'medium',\n 'pinterest',\n 'reddit',\n 'rss',\n 'snapchat',\n 'soundcloud',\n 'spotify',\n 'telegram',\n 'tumblr',\n 'twitch',\n 'twitter',\n 'vimeo',\n 'whatsapp',\n 'yelp',\n 'youtube',\n] as const\n\ntype SocialLinkTypeV0 = typeof socialLinkTypesV0[number]\n\nexport const socialLinkTypesV1 = [...socialLinkTypesV0, 'x', 'slack'] as const\n\ntype SocialLinkTypeV1 = typeof socialLinkTypesV1[number]\n\ntype SocialLinkV0 = { type: SocialLinkTypeV0; url: string }\n\ntype SocialLinkV1 = { type: SocialLinkTypeV1; url: string }\n\ntype SocialLinksLinkV0 = { id: string; payload: SocialLinkV0 }\n\ntype SocialLinksLinkV1 = { id: string; payload: SocialLinkV1 }\n\ntype SocialLinksValueV0 = { links: SocialLinksLinkV0[]; openInNewTab: boolean }\n\ntype SocialLinksValueV1 = { links: SocialLinksLinkV1[]; openInNewTab: boolean }\n\nexport type SocialLinksValue = SocialLinksValueV0 | SocialLinksValueV1\n\ntype SocialLinksOptions = Options<{ preset?: SocialLinksValueV1 }>\n\nexport type SocialLinksDescriptor<_T = SocialLinksValueV1> = {\n type: typeof Types.SocialLinks\n options: SocialLinksOptions\n version?: 1\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function SocialLinks(options: SocialLinksOptions = {}): SocialLinksDescriptor {\n return { type: Types.SocialLinks, options, version: 1 }\n}\n\nexport type TextInputValue = string\n\nexport type TextInputOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type TextInputDescriptor<_T = TextInputValue> = {\n type: typeof Types.TextInput\n options: TextInputOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextInput(options: TextInputOptions = {}): TextInputDescriptor {\n return { type: Types.TextInput, options }\n}\n\nexport type Descriptor<T extends Data = Data> =\n | DeletedPropControllerDescriptor<T>\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | GridDescriptor<T>\n | ImageDescriptor<T>\n | ImagesDescriptor<T>\n | LinkDescriptor<T>\n | MarginDescriptor<T>\n | NavigationLinksDescriptor<T>\n | NumberDescriptor<T>\n | PaddingDescriptor<T>\n | ResponsiveColorDescriptor<T>\n | ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> ? T : ResponsiveIconRadioGroupValue<string>\n >\n | ResponsiveLengthDescriptor<T>\n | ResponsiveNumberDescriptor<T>\n | ResponsiveOpacityDescriptor<T>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\n | ShadowsDescriptor<T>\n | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\n | TextAreaDescriptor<T>\n | TextInputDescriptor<T>\n | TextStyleDescriptor<T>\n | VideoDescriptor<T>\n | WidthDescriptor<T>\n | StyleControlDefinition\n | StyleV2ControlDefinition\n | NumberControlDefinition\n | CheckboxControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | IconRadioGroupControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | LinkControlDefinition\n | SlotControlDefinition\n | RichTextControlDefinition\n | RichTextV2ControlDefinition\n | TypographyControlDefinition\n\nexport type PanelDescriptorType =\n | typeof Types.Backgrounds\n | typeof Types.ResponsiveIconRadioGroup\n | typeof PropControllerTypes.Margin\n | typeof PropControllerTypes.Padding\n | typeof PropControllerTypes.Shadows\n | typeof PropControllerTypes.Border\n | typeof PropControllerTypes.GapY\n | typeof PropControllerTypes.GapX\n | typeof PropControllerTypes.BorderRadius\n | typeof PropControllerTypes.Checkbox\n | typeof Types.TextInput\n | typeof PropControllerTypes.Link\n | typeof Types.ResponsiveSelect\n | typeof PropControllerTypes.ResponsiveColor\n | typeof PropControllerTypes.TextStyle\n | typeof Types.Images\n | typeof Types.ResponsiveNumber\n | typeof PropControllerTypes.Number\n | typeof PropControllerTypes.Date\n | typeof PropControllerTypes.Font\n | typeof PropControllerTypes.TextArea\n | typeof PropControllerTypes.Table\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof PropControllerTypes.Video\n | typeof PropControllerTypes.NavigationLinks\n\nexport type PanelDescriptor<T extends Data = Data> = Extract<\n Descriptor<T>,\n { type: PanelDescriptorType }\n>\n\nexport type DescriptorValueType<T extends Descriptor> = T extends NumberControlDefinition\n ? NumberControlValue<T>\n : T extends CheckboxControlDefinition\n ? CheckboxControlValue<T>\n : T extends TextInputControlDefinition\n ? TextInputControlValue<T>\n : T extends TextAreaControlDefinition\n ? TextAreaControlValue<T>\n : T extends SelectControlDefinition\n ? SelectControlValue<T>\n : T extends ColorControlDefinition\n ? ColorControlValue<T>\n : T extends StyleControlDefinition\n ? StyleControlFormattedValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlValue<T>\n : T extends ImageControlDefinition\n ? ResolveImageControlValue<T>\n : T extends ComboboxControlDefinition\n ? ComboboxControlValue<T>\n : T extends ShapeControlDefinition\n ? ShapeControlValue<T>\n : T extends ListControlDefinition\n ? ListControlValue<T>\n : T extends LinkControlDefinition\n ? LinkControlValue<T>\n : T extends SlotControlDefinition\n ? SlotControlValue\n : T extends RichTextControlDefinition\n ? RichTextControlValue\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends TypographyControlDefinition\n ? TypographyControlValue\n : T['type'] extends typeof PropControllerTypes.ResponsiveColor\n ? // TODO(miguel): We're not importing a resolver type from `@makeswift/prop-controllers` because\n // the resolved type is tightly coupled with the runtime (i.e., it's the result of an API call).\n // This means that we probably want to rethink how types are resolved and where that lives.\n ResponsiveColor | null | undefined\n : T['type'] extends typeof PropControllerTypes.Checkbox\n ? ResolveCheckboxPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Checkbox }>>\n : T['type'] extends typeof PropControllerTypes.Date\n ? ResolveDatePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Date }>>\n : T['type'] extends typeof PropControllerTypes.ElementID\n ? ResolveElementIDPropControllerValue<Extract<T, { type: typeof PropControllerTypes.ElementID }>>\n : T['type'] extends typeof PropControllerTypes.Font\n ? ResolveFontPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Font }>>\n : T['type'] extends typeof PropControllerTypes.GapX\n ? ResolveGapXPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapX }>>\n : T['type'] extends typeof PropControllerTypes.GapY\n ? ResolveGapYPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapY }>>\n : T['type'] extends typeof PropControllerTypes.Grid\n ? ResolveGridPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Grid }>>\n : T['type'] extends typeof PropControllerTypes.Link\n ? ResolveLinkPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Link }>>\n : T['type'] extends typeof PropControllerTypes.Width\n ? ResolveWidthPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Width }>>\n : T['type'] extends typeof PropControllerTypes.Padding\n ? ResolvePaddingPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Padding }>>\n : T['type'] extends typeof PropControllerTypes.Margin\n ? ResolveMarginPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Margin }>>\n : T['type'] extends typeof PropControllerTypes.NavigationLinks\n ? ResolveNavigationLinksPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.NavigationLinks }>\n >\n : T['type'] extends typeof PropControllerTypes.BorderRadius\n ? ResolveBorderRadiusPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.BorderRadius }>\n >\n : T['type'] extends typeof PropControllerTypes.Shadows\n ? ResolveShadowsPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Shadows }>>\n : T['type'] extends typeof PropControllerTypes.ResponsiveLength\n ? ResolveResponsiveLengthPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.ResponsiveLength }>\n >\n : T['type'] extends typeof PropControllerTypes.Border\n ? ResolveBorderPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Border }>>\n : T['type'] extends typeof PropControllerTypes.Number\n ? ResolveNumberPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Number }>>\n : T['type'] extends typeof PropControllerTypes.Table\n ? ResolveTablePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Table }>>\n : T['type'] extends typeof PropControllerTypes.TableFormFields\n ? ResolveTableFormFieldsPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.TableFormFields }>\n >\n : T['type'] extends typeof PropControllerTypes.TextStyle\n ? ResolveTextStylePropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextStyle }>>\n : T['type'] extends typeof PropControllerTypes.TextArea\n ? ResolveTextAreaPropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextArea }>>\n : T['type'] extends typeof PropControllerTypes.Video\n ? ResolveVideoPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Video }>>\n : T extends Descriptor<infer U>\n ? U | undefined\n : never\n\nexport type PanelDescriptorValueType<T extends PanelDescriptor> = T extends PanelDescriptor<infer U>\n ? U\n : never\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAAA,gBAAiC;AA8H1B,MAAM,QAAQ;AAAA,EACnB,aAAa;AAAA,EACb,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AACT;AA0EO,SAAS,YAAY,UAA8B,CAAC,GAA0B;AACnF,SAAO,EAAE,MAAM,MAAM,aAAa,SAAS,GAAG,QAAQ;AACxD;AAkCO,SAAS,MAAM,UAAwB,CAAC,GAAoB;AACjE,SAAO,EAAE,MAAM,MAAM,OAAO,SAAS,GAAG,QAAQ;AAClD;AAqCO,SAAS,OAAO,UAAyB,CAAC,GAAqB;AACpE,SAAO,EAAE,MAAM,MAAM,QAAQ,SAAS,GAAG,QAAQ;AACnD;AA4BO,SAAS,yBACd,SACsE;AACtE,SAAO,EAAE,MAAM,MAAM,0BAA0B,QAAQ;AACzD;AAuBO,SAAS,iBACd,UAAmC,CAAC,GACR;AAC5B,SAAO,EAAE,MAAM,MAAM,kBAAkB,QAAQ;AACjD;AAeO,SAAS,kBACd,UAAoC,CAAC,GACR;AAC7B,SAAO,EAAE,MAAM,MAAM,mBAAmB,QAAQ;AAClD;AA+BO,SAAS,iBACd,SACsD;AACtD,SAAO,EAAE,MAAM,MAAM,kBAAkB,QAAQ;AACjD;AAEO,MAAM,oBAAoB;AAAA,EAC/B;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;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,oBAAoB,CAAC,GAAG,mBAAmB,KAAK,OAAO;AA8B7D,SAAS,YAAY,UAA8B,CAAC,GAA0B;AACnF,SAAO,EAAE,MAAM,MAAM,aAAa,SAAS,SAAS,EAAE;AACxD;AAeO,SAAS,UAAU,UAA4B,CAAC,GAAwB;AAC7E,SAAO,EAAE,MAAM,MAAM,WAAW,QAAQ;AAC1C;","names":["import_style"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/index.ts"],"sourcesContent":["export type {\n Data,\n Descriptor as PropControllerDescriptor,\n DescriptorValueType as PropControllerDescriptorValueType,\n ResponsiveNumberDescriptor,\n ResponsiveNumberOptions,\n ResponsiveNumberValue,\n ResponsiveIconRadioGroupDescriptor,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectDescriptor,\n ResponsiveSelectValue,\n ImageDescriptor,\n ImageValue,\n ImageValueV0,\n ImageValueV1,\n ImagesDescriptor,\n ImagesValueV0Item,\n ImagesValueV1Item,\n ImagesValueItem,\n ImagesValue,\n ImageBackground,\n BackgroundsDescriptor,\n BackgroundImage,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/index.ts"],"sourcesContent":["export type {\n Data,\n Descriptor as PropControllerDescriptor,\n DescriptorValueType as PropControllerDescriptorValueType,\n ResponsiveNumberDescriptor,\n ResponsiveNumberOptions,\n ResponsiveNumberValue,\n ResponsiveIconRadioGroupDescriptor,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectDescriptor,\n ResponsiveSelectValue,\n ImageDescriptor,\n ImageValue,\n ImageValueV0,\n ImageValueV1,\n ImagesDescriptor,\n ImagesValueV0Item,\n ImagesValueV1Item,\n ImagesValueItem,\n ImagesValue,\n ImageBackground,\n BackgroundsDescriptor,\n BackgroundImage,\n TextInputDescriptor,\n TextInputValue,\n PanelDescriptor,\n PanelDescriptorType,\n PanelDescriptorValueType,\n SocialLinksDescriptor,\n SocialLinksValue,\n} from './descriptors'\nexport type {\n ResponsiveValueType,\n Device,\n DeviceOverride,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\nexport { socialLinkTypesV0, socialLinkTypesV1 } from './descriptors'\nexport * as Props from './descriptors'\nexport type {\n PropControllerMessage,\n RichTextPropControllerMessage,\n TableFormFieldsMessage,\n} from './instances'\nexport { RichTextPropControllerMessageType, TableFormFieldsMessageType } from './instances'\nexport * as Introspection from './introspection'\nexport { copy as imageCopy } from './copy/image'\nexport { copy as imagesCopy } from './copy/images'\nexport { copy as backgroundsCopy } from './copy/backgrounds'\nexport { DELETED_PROP_CONTROLLER_TYPES } from './deleted'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqCA,yBAAqD;AACrD,YAAuB;AAMvB,uBAA8E;AAC9E,oBAA+B;AAC/B,mBAAkC;AAClC,oBAAmC;AACnC,yBAAwC;AACxC,qBAA8C;","names":[]}
|
|
@@ -24,7 +24,6 @@ __export(instances_exports, {
|
|
|
24
24
|
createPropController: () => createPropController
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(instances_exports);
|
|
27
|
-
var import_descriptors = require("./descriptors");
|
|
28
27
|
var import_builder_edit_mode = require("../state/modules/builder-edit-mode");
|
|
29
28
|
var import_controls = require("../controls");
|
|
30
29
|
var import_base = require("./base");
|
|
@@ -112,8 +111,6 @@ class TableFormFieldsPropController extends import_base.PropController {
|
|
|
112
111
|
}
|
|
113
112
|
function createPropController(descriptor, send) {
|
|
114
113
|
switch (descriptor.type) {
|
|
115
|
-
case import_descriptors.Types.RichText:
|
|
116
|
-
return new RichTextPropController(send);
|
|
117
114
|
case import_prop_controllers.Types.TableFormFields:
|
|
118
115
|
return new TableFormFieldsPropController(send);
|
|
119
116
|
case import_controls.SlotControlType:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/instances.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { Descriptor, RichTextDescriptor, Types } from './descriptors'\nimport { BuilderEditMode } from '../state/modules/builder-edit-mode'\nimport { BoxModel } from '../state/modules/box-models'\nimport {\n ListControl,\n ListControlMessage,\n ListControlType,\n RichTextControl,\n RichTextControlMessage,\n RichTextControlType,\n ShapeControl,\n ShapeControlMessage,\n ShapeControlType,\n richTextDAOToDTO,\n RichTextDTO,\n SlotControl,\n SlotControlMessage,\n SlotControlType,\n StyleControl,\n StyleControlType,\n StyleControlMessage,\n RichTextV2ControlMessage,\n RichTextV2ControlType,\n RichTextV2Control,\n StyleV2Control,\n StyleV2ControlType,\n StyleV2ControlMessage,\n} from '../controls'\nimport { PropController } from './base'\nimport {\n Types as PropControllerTypes,\n TableFormFieldsDescriptor,\n} from '@makeswift/prop-controllers'\n\nexport const RichTextPropControllerMessageType = {\n CHANGE_BUILDER_EDIT_MODE: 'CHANGE_BUILDER_EDIT_MODE',\n INITIALIZE_EDITOR: 'INITIALIZE_EDITOR',\n CHANGE_EDITOR_VALUE: 'CHANGE_EDITOR_VALUE',\n FOCUS: 'FOCUS',\n BLUR: 'BLUR',\n UNDO: 'UNDO',\n REDO: 'REDO',\n CHANGE_BOX_MODEL: 'CHANGE_BOX_MODEL',\n} as const\n\ntype ChangeBuilderEditModeRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE\n editMode: BuilderEditMode\n}\n\ntype InitializeEditorRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.INITIALIZE_EDITOR\n value: RichTextDTO\n}\n\ntype ChangeEditorValueRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE\n value: RichTextDTO\n}\n\ntype FocusRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.FOCUS }\n\ntype BlurRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.BLUR }\n\ntype UndoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.UNDO }\n\ntype RedoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.REDO }\n\ntype ChangeBoxModelRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_BOX_MODEL\n payload: { boxModel: BoxModel | null }\n}\n\nexport type RichTextPropControllerMessage =\n | ChangeBuilderEditModeRichTextPropControllerMessage\n | InitializeEditorRichTextPropControllerMessage\n | ChangeEditorValueRichTextPropControllerMessage\n | FocusRichTextPropControllerMessage\n | BlurRichTextPropControllerMessage\n | UndoRichTextPropControllerMessage\n | RedoRichTextPropControllerMessage\n | ChangeBoxModelRichTextPropControllerMessage\n\nexport type PropControllerMessage =\n | RichTextPropControllerMessage\n | TableFormFieldsMessage\n | SlotControlMessage\n | RichTextControlMessage\n | RichTextV2ControlMessage\n | ListControlMessage\n | ShapeControlMessage\n | StyleControlMessage\n\nexport type Send<T = PropControllerMessage> = (message: T) => void\n\nclass DefaultPropController extends PropController {\n recv = (_message: PropControllerMessage) => {\n // Do nothing.\n }\n}\n\nclass RichTextPropController extends PropController<RichTextPropControllerMessage> {\n private editor: Editor | null = null\n\n recv = (message: RichTextPropControllerMessage) => {\n if (!this.editor) return\n switch (message.type) {\n case RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE: {\n switch (message.editMode) {\n case BuilderEditMode.BUILD:\n case BuilderEditMode.INTERACT:\n this.editor.deselectAndBlur()\n }\n break\n }\n case RichTextPropControllerMessageType.FOCUS: {\n this.editor.focusAndSelectAll()\n break\n }\n }\n }\n\n setSlateEditor(editor: Editor) {\n this.editor = editor\n\n this.send({\n type: RichTextPropControllerMessageType.INITIALIZE_EDITOR,\n value: richTextDAOToDTO(editor.children, editor.selection),\n })\n\n const _onChange = editor.onChange\n this.editor.onChange = options => {\n _onChange(options)\n\n // if onChange is local then it will include an operation(s)\n // that is the only case in which we want to push updates\n // this prevent infinite loops that can occur when collaborating\n if (options?.operation != null) {\n this.send({\n type: RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE,\n value: richTextDAOToDTO(editor.children, editor.selection),\n })\n }\n }\n }\n\n focus() {\n this.send({ type: RichTextPropControllerMessageType.FOCUS })\n }\n\n blur() {\n this.send({ type: RichTextPropControllerMessageType.BLUR })\n }\n\n undo() {\n this.send({ type: RichTextPropControllerMessageType.UNDO })\n }\n\n redo() {\n this.send({ type: RichTextPropControllerMessageType.REDO })\n }\n\n changeBoxModel(boxModel: BoxModel | null): void {\n this.send({ type: RichTextPropControllerMessageType.CHANGE_BOX_MODEL, payload: { boxModel } })\n }\n}\n\nexport const TableFormFieldsMessageType = {\n TABLE_FORM_LAYOUT_CHANGE: 'TABLE_FORM_LAYOUT_CHANGE',\n TABLE_FORM_FIELD_LAYOUT_CHANGE: 'TABLE_FORM_FIELD_LAYOUT_CHANGE',\n} as const\n\ntype TableLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE\n payload: { layout: BoxModel }\n}\n\ntype TableFieldLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE\n payload: { layout: BoxModel; index: number }\n}\n\nexport type TableFormFieldsMessage =\n | TableLayoutTableFormFieldsMessage\n | TableFieldLayoutTableFormFieldsMessage\n\nexport class TableFormFieldsPropController extends PropController<TableFormFieldsMessage> {\n recv = () => {}\n\n tableFormLayoutChange(payload: { layout: BoxModel }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE, payload })\n }\n\n tableFormFieldLayoutChange(payload: { layout: BoxModel; index: number }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE, payload })\n }\n}\n\ntype DescriptorPropController<T extends Descriptor> = T extends { type: typeof Types.RichText }\n ? RichTextPropController\n : T extends { type: typeof RichTextControlType }\n ? RichTextControl\n : T extends { type: typeof RichTextV2ControlType }\n ? RichTextV2Control\n : T extends { type: typeof PropControllerTypes.TableFormFields }\n ? TableFormFieldsPropController\n : DefaultPropController\n\nexport type DescriptorsPropControllers<T extends Record<string, Descriptor>> = {\n [K in keyof T]: undefined extends T[K]\n ? DescriptorPropController<Exclude<T[K], undefined>>\n : DescriptorPropController<T[K]>\n}\n\nexport type AnyPropController =\n | DefaultPropController\n | RichTextPropController\n | TableFormFieldsPropController\n | SlotControl\n | RichTextControl\n | RichTextV2Control\n | ListControl\n | ShapeControl\n | StyleControl\n | StyleV2Control\n\nexport function createPropController(\n descriptor: RichTextDescriptor,\n send: Send<RichTextPropControllerMessage>,\n): RichTextPropController\nexport function createPropController(\n descriptor: TableFormFieldsDescriptor,\n send: Send<TableFormFieldsMessage>,\n): TableFormFieldsPropController\nexport function createPropController(descriptor: Descriptor, send: Send): DefaultPropController\nexport function createPropController<T extends PropControllerMessage>(\n descriptor: Descriptor,\n send: Send<T>,\n): AnyPropController {\n switch (descriptor.type) {\n case Types.RichText:\n return new RichTextPropController(send as Send<RichTextPropControllerMessage>)\n\n case PropControllerTypes.TableFormFields:\n return new TableFormFieldsPropController(send as Send<TableFormFieldsMessage>)\n\n case SlotControlType:\n return new SlotControl(send as Send<SlotControlMessage>)\n\n case RichTextControlType:\n return new RichTextControl(send as Send<RichTextControlMessage>)\n\n case RichTextV2ControlType:\n return new RichTextV2Control(send as Send<RichTextV2ControlMessage>, descriptor)\n\n case ListControlType:\n return new ListControl(send as Send<ListControlMessage>, descriptor)\n\n case ShapeControlType:\n return new ShapeControl(send as Send<ShapeControlMessage>, descriptor)\n\n case StyleControlType:\n return new StyleControl(send as Send<StyleControlMessage>)\n\n case StyleV2ControlType:\n return new StyleV2Control(send as Send<StyleV2ControlMessage>, descriptor)\n\n default:\n return new DefaultPropController(send as Send)\n }\n}\n"],"mappings":"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","names":["PropControllerTypes"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/instances.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { Descriptor } from './descriptors'\nimport { BuilderEditMode } from '../state/modules/builder-edit-mode'\nimport { BoxModel } from '../state/modules/box-models'\nimport {\n ListControl,\n ListControlMessage,\n ListControlType,\n RichTextControl,\n RichTextControlMessage,\n RichTextControlType,\n ShapeControl,\n ShapeControlMessage,\n ShapeControlType,\n richTextDAOToDTO,\n RichTextDTO,\n SlotControl,\n SlotControlMessage,\n SlotControlType,\n StyleControl,\n StyleControlType,\n StyleControlMessage,\n RichTextV2ControlMessage,\n RichTextV2ControlType,\n RichTextV2Control,\n StyleV2Control,\n StyleV2ControlType,\n StyleV2ControlMessage,\n} from '../controls'\nimport { PropController } from './base'\nimport {\n Types as PropControllerTypes,\n TableFormFieldsDescriptor,\n} from '@makeswift/prop-controllers'\n\nexport const RichTextPropControllerMessageType = {\n CHANGE_BUILDER_EDIT_MODE: 'CHANGE_BUILDER_EDIT_MODE',\n INITIALIZE_EDITOR: 'INITIALIZE_EDITOR',\n CHANGE_EDITOR_VALUE: 'CHANGE_EDITOR_VALUE',\n FOCUS: 'FOCUS',\n BLUR: 'BLUR',\n UNDO: 'UNDO',\n REDO: 'REDO',\n CHANGE_BOX_MODEL: 'CHANGE_BOX_MODEL',\n} as const\n\ntype ChangeBuilderEditModeRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE\n editMode: BuilderEditMode\n}\n\ntype InitializeEditorRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.INITIALIZE_EDITOR\n value: RichTextDTO\n}\n\ntype ChangeEditorValueRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE\n value: RichTextDTO\n}\n\ntype FocusRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.FOCUS }\n\ntype BlurRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.BLUR }\n\ntype UndoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.UNDO }\n\ntype RedoRichTextPropControllerMessage = { type: typeof RichTextPropControllerMessageType.REDO }\n\ntype ChangeBoxModelRichTextPropControllerMessage = {\n type: typeof RichTextPropControllerMessageType.CHANGE_BOX_MODEL\n payload: { boxModel: BoxModel | null }\n}\n\nexport type RichTextPropControllerMessage =\n | ChangeBuilderEditModeRichTextPropControllerMessage\n | InitializeEditorRichTextPropControllerMessage\n | ChangeEditorValueRichTextPropControllerMessage\n | FocusRichTextPropControllerMessage\n | BlurRichTextPropControllerMessage\n | UndoRichTextPropControllerMessage\n | RedoRichTextPropControllerMessage\n | ChangeBoxModelRichTextPropControllerMessage\n\nexport type PropControllerMessage =\n | RichTextPropControllerMessage\n | TableFormFieldsMessage\n | SlotControlMessage\n | RichTextControlMessage\n | RichTextV2ControlMessage\n | ListControlMessage\n | ShapeControlMessage\n | StyleControlMessage\n\nexport type Send<T = PropControllerMessage> = (message: T) => void\n\nclass DefaultPropController extends PropController {\n recv = (_message: PropControllerMessage) => {\n // Do nothing.\n }\n}\n\nclass RichTextPropController extends PropController<RichTextPropControllerMessage> {\n private editor: Editor | null = null\n\n recv = (message: RichTextPropControllerMessage) => {\n if (!this.editor) return\n switch (message.type) {\n case RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE: {\n switch (message.editMode) {\n case BuilderEditMode.BUILD:\n case BuilderEditMode.INTERACT:\n this.editor.deselectAndBlur()\n }\n break\n }\n case RichTextPropControllerMessageType.FOCUS: {\n this.editor.focusAndSelectAll()\n break\n }\n }\n }\n\n setSlateEditor(editor: Editor) {\n this.editor = editor\n\n this.send({\n type: RichTextPropControllerMessageType.INITIALIZE_EDITOR,\n value: richTextDAOToDTO(editor.children, editor.selection),\n })\n\n const _onChange = editor.onChange\n this.editor.onChange = options => {\n _onChange(options)\n\n // if onChange is local then it will include an operation(s)\n // that is the only case in which we want to push updates\n // this prevent infinite loops that can occur when collaborating\n if (options?.operation != null) {\n this.send({\n type: RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE,\n value: richTextDAOToDTO(editor.children, editor.selection),\n })\n }\n }\n }\n\n focus() {\n this.send({ type: RichTextPropControllerMessageType.FOCUS })\n }\n\n blur() {\n this.send({ type: RichTextPropControllerMessageType.BLUR })\n }\n\n undo() {\n this.send({ type: RichTextPropControllerMessageType.UNDO })\n }\n\n redo() {\n this.send({ type: RichTextPropControllerMessageType.REDO })\n }\n\n changeBoxModel(boxModel: BoxModel | null): void {\n this.send({ type: RichTextPropControllerMessageType.CHANGE_BOX_MODEL, payload: { boxModel } })\n }\n}\n\nexport const TableFormFieldsMessageType = {\n TABLE_FORM_LAYOUT_CHANGE: 'TABLE_FORM_LAYOUT_CHANGE',\n TABLE_FORM_FIELD_LAYOUT_CHANGE: 'TABLE_FORM_FIELD_LAYOUT_CHANGE',\n} as const\n\ntype TableLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE\n payload: { layout: BoxModel }\n}\n\ntype TableFieldLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE\n payload: { layout: BoxModel; index: number }\n}\n\nexport type TableFormFieldsMessage =\n | TableLayoutTableFormFieldsMessage\n | TableFieldLayoutTableFormFieldsMessage\n\nexport class TableFormFieldsPropController extends PropController<TableFormFieldsMessage> {\n recv = () => {}\n\n tableFormLayoutChange(payload: { layout: BoxModel }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE, payload })\n }\n\n tableFormFieldLayoutChange(payload: { layout: BoxModel; index: number }) {\n this.send({ type: TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE, payload })\n }\n}\n\ntype DescriptorPropController<T extends Descriptor> = T extends { type: typeof RichTextControlType }\n ? RichTextControl\n : T extends { type: typeof RichTextV2ControlType }\n ? RichTextV2Control\n : T extends { type: typeof PropControllerTypes.TableFormFields }\n ? TableFormFieldsPropController\n : DefaultPropController\n\nexport type DescriptorsPropControllers<T extends Record<string, Descriptor>> = {\n [K in keyof T]: undefined extends T[K]\n ? DescriptorPropController<Exclude<T[K], undefined>>\n : DescriptorPropController<T[K]>\n}\n\nexport type AnyPropController =\n | DefaultPropController\n | RichTextPropController\n | TableFormFieldsPropController\n | SlotControl\n | RichTextControl\n | RichTextV2Control\n | ListControl\n | ShapeControl\n | StyleControl\n | StyleV2Control\n\nexport function createPropController(\n descriptor: TableFormFieldsDescriptor,\n send: Send<TableFormFieldsMessage>,\n): TableFormFieldsPropController\nexport function createPropController(descriptor: Descriptor, send: Send): DefaultPropController\nexport function createPropController<T extends PropControllerMessage>(\n descriptor: Descriptor,\n send: Send<T>,\n): AnyPropController {\n switch (descriptor.type) {\n case PropControllerTypes.TableFormFields:\n return new TableFormFieldsPropController(send as Send<TableFormFieldsMessage>)\n\n case SlotControlType:\n return new SlotControl(send as Send<SlotControlMessage>)\n\n case RichTextControlType:\n return new RichTextControl(send as Send<RichTextControlMessage>)\n\n case RichTextV2ControlType:\n return new RichTextV2Control(send as Send<RichTextV2ControlMessage>, descriptor)\n\n case ListControlType:\n return new ListControl(send as Send<ListControlMessage>, descriptor)\n\n case ShapeControlType:\n return new ShapeControl(send as Send<ShapeControlMessage>, descriptor)\n\n case StyleControlType:\n return new StyleControl(send as Send<StyleControlMessage>)\n\n case StyleV2ControlType:\n return new StyleV2Control(send as Send<StyleV2ControlMessage>, descriptor)\n\n default:\n return new DefaultPropController(send as Send)\n }\n}\n"],"mappings":"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","names":["PropControllerTypes"]}
|
|
@@ -36,12 +36,13 @@ var import_introspection2 = require("../controls/rich-text-v2/introspection");
|
|
|
36
36
|
var import_rich_text_v2 = require("../controls/rich-text-v2/rich-text-v2");
|
|
37
37
|
var import_ts_pattern = require("ts-pattern");
|
|
38
38
|
var import_prop_controllers = require("@makeswift/prop-controllers");
|
|
39
|
+
var import_deleted = require("./deleted");
|
|
39
40
|
function getElementChildren(descriptor, prop) {
|
|
40
41
|
if (prop == null)
|
|
41
42
|
return [];
|
|
42
43
|
switch (descriptor.type) {
|
|
43
|
-
case
|
|
44
|
-
return prop
|
|
44
|
+
case import_prop_controllers.Types.Grid:
|
|
45
|
+
return (0, import_prop_controllers.getGridPropControllerElementChildren)(prop);
|
|
45
46
|
case import_controls.SlotControlType:
|
|
46
47
|
return prop.elements;
|
|
47
48
|
case import_controls.ListControlType:
|
|
@@ -98,7 +99,7 @@ function getSwatchIds(descriptor, prop) {
|
|
|
98
99
|
case import_prop_controllers.Types.Shadows:
|
|
99
100
|
return (0, import_prop_controllers.getShadowsPropControllerDataSwatchIds)(prop);
|
|
100
101
|
case import_controls.RichTextControlType:
|
|
101
|
-
case
|
|
102
|
+
case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText: {
|
|
102
103
|
return (0, import_introspection.getRichTextSwatchIds)(prop);
|
|
103
104
|
}
|
|
104
105
|
case import_controls.ColorControlType: {
|
|
@@ -172,7 +173,7 @@ function getTypographyIds(descriptor, prop) {
|
|
|
172
173
|
return (0, import_controls.getTypographyTypographyIds)(prop);
|
|
173
174
|
}
|
|
174
175
|
case import_controls.RichTextControlType:
|
|
175
|
-
case
|
|
176
|
+
case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText: {
|
|
176
177
|
return (0, import_introspection.getRichTextTypographyIds)(prop);
|
|
177
178
|
}
|
|
178
179
|
case import_rich_text_v2.RichTextV2ControlType: {
|
|
@@ -224,7 +225,7 @@ function getPageIds(descriptor, prop) {
|
|
|
224
225
|
return (0, import_prop_controllers.getNavigationLinksPropControllerPageIds)(prop);
|
|
225
226
|
}
|
|
226
227
|
case import_controls.RichTextControlType:
|
|
227
|
-
case
|
|
228
|
+
case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText: {
|
|
228
229
|
return (0, import_introspection.getRichTextPageIds)(prop);
|
|
229
230
|
}
|
|
230
231
|
case import_rich_text_v2.RichTextV2ControlType: {
|