@makeswift/runtime 0.20.4-canary.0 → 0.20.4-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 +14 -2
- package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/utils/deepEqual.js +2 -29
- package/dist/cjs/utils/deepEqual.js.map +1 -1
- package/dist/cjs/utils/is.js +3 -6
- package/dist/cjs/utils/is.js.map +1 -1
- package/dist/cjs/utils/partition.js +48 -0
- package/dist/cjs/utils/partition.js.map +1 -0
- package/dist/cjs/utils/shallowEqual.js +2 -28
- package/dist/cjs/utils/shallowEqual.js.map +1 -1
- package/dist/esm/builder/serialization/control-serialization.js +13 -2
- package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/utils/deepEqual.js +1 -18
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/is.js +3 -6
- package/dist/esm/utils/is.js.map +1 -1
- package/dist/esm/utils/partition.js +23 -0
- package/dist/esm/utils/partition.js.map +1 -0
- package/dist/esm/utils/shallowEqual.js +1 -17
- package/dist/esm/utils/shallowEqual.js.map +1 -1
- package/dist/types/builder/serialization/control-serialization.d.ts +6 -2
- package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/utils/__tests__/partition.test.d.ts +2 -0
- package/dist/types/utils/__tests__/partition.test.d.ts.map +1 -0
- package/dist/types/utils/deepEqual.d.ts +1 -1
- package/dist/types/utils/deepEqual.d.ts.map +1 -1
- package/dist/types/utils/is.d.ts +2 -1
- package/dist/types/utils/is.d.ts.map +1 -1
- package/dist/types/utils/partition.d.ts +19 -0
- package/dist/types/utils/partition.d.ts.map +1 -0
- package/dist/types/utils/shallowEqual.d.ts +1 -1
- package/dist/types/utils/shallowEqual.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -22,6 +22,7 @@ __export(control_serialization_exports, {
|
|
|
22
22
|
deserializeControls: () => deserializeControls,
|
|
23
23
|
deserializeLegacyControl: () => deserializeLegacyControl,
|
|
24
24
|
deserializeUnifiedControlDef: () => deserializeUnifiedControlDef,
|
|
25
|
+
isSerializedControl: () => isSerializedControl,
|
|
25
26
|
serializeControl: () => serializeControl,
|
|
26
27
|
serializeControls: () => serializeControls
|
|
27
28
|
});
|
|
@@ -277,6 +278,9 @@ function serializeControl(control) {
|
|
|
277
278
|
const [serializedControl, transferables] = control.serialize();
|
|
278
279
|
return [serializedControl, transferables];
|
|
279
280
|
}
|
|
281
|
+
function isSerializedControl(control) {
|
|
282
|
+
return control != null && typeof control === "object" && "type" in control && typeof control.type === "string";
|
|
283
|
+
}
|
|
280
284
|
function serializeLegacyControl(control) {
|
|
281
285
|
switch (control.type) {
|
|
282
286
|
case import_prop_controllers3.Types.Checkbox:
|
|
@@ -406,17 +410,24 @@ function serializeControls(controls) {
|
|
|
406
410
|
[{}, []]
|
|
407
411
|
);
|
|
408
412
|
}
|
|
409
|
-
function deserializeControls(serializedControls, {
|
|
413
|
+
function deserializeControls(serializedControls, {
|
|
414
|
+
onError
|
|
415
|
+
} = {}) {
|
|
410
416
|
return Object.entries(serializedControls).reduce(
|
|
411
417
|
(deserializedControls, [key, serializedControl]) => {
|
|
412
418
|
try {
|
|
419
|
+
if (!isSerializedControl(serializedControl)) {
|
|
420
|
+
throw new Error(
|
|
421
|
+
`Expected serialized control data, got ${JSON.stringify(serializedControl)}`
|
|
422
|
+
);
|
|
423
|
+
}
|
|
413
424
|
const deserializedControl = deserializeControl(serializedControl);
|
|
414
425
|
return { ...deserializedControls, [key]: deserializedControl };
|
|
415
426
|
} catch (err) {
|
|
416
427
|
const error = err instanceof Error ? new Error(`Could not deserialize control for "${key}": ${err.message}`, {
|
|
417
428
|
cause: err
|
|
418
429
|
}) : new Error(`Could not deserialize control for "${key}", unknown error: ${err}`);
|
|
419
|
-
onError?.(error);
|
|
430
|
+
onError?.(error, { key, serializedControl });
|
|
420
431
|
return deserializedControls;
|
|
421
432
|
}
|
|
422
433
|
},
|
|
@@ -429,6 +440,7 @@ function deserializeControls(serializedControls, { onError } = {}) {
|
|
|
429
440
|
deserializeControls,
|
|
430
441
|
deserializeLegacyControl,
|
|
431
442
|
deserializeUnifiedControlDef,
|
|
443
|
+
isSerializedControl,
|
|
432
444
|
serializeControl,
|
|
433
445
|
serializeControls
|
|
434
446
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/builder/serialization/control-serialization.ts"],"sourcesContent":["import {\n GapData,\n GapX,\n GapYDescriptor,\n GapYPropControllerData,\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n ResponsiveIconRadioGroup,\n ResponsiveNumber,\n ResponsiveSelect,\n type Descriptor,\n type PropDef,\n type OptionsType,\n} from '@makeswift/prop-controllers'\n\nimport {\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n type RichTextValue as RichTextControlValue,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n ColorDefinition,\n ComboboxDefinition,\n ImageDefinition,\n IconRadioGroupDefinition,\n ListDefinition,\n LinkDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../controls'\n\nimport {\n Data,\n Device,\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n PropControllerDescriptor as ControlDefinition,\n} from '../../prop-controllers'\n\nimport {\n DELETED_PROP_CONTROLLER_TYPES,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n RichTextDescriptor as RichTextControl,\n} from '../../prop-controllers/deleted'\n\nimport {\n DeserializedFunction,\n deserializeFunction,\n isSerializedFunction,\n SerializedFunction,\n serializeFunction,\n} from './function-serialization'\n\nimport {\n LinkData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n Types as PropControllerTypes,\n ImageDescriptor as ImageControl,\n ImageData as ImageControlValue,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n ResponsiveLengthDescriptor,\n NumberOptions,\n NumberPropControllerData,\n NumberDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveColorDescriptor,\n CheckboxPropControllerData,\n CheckboxDescriptor as CheckboxControl,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n TextInputDescriptor as TextInputControl,\n} from '@makeswift/prop-controllers'\n\nimport { type LegacyDescriptor, isLegacyDescriptor } from '../../prop-controllers/descriptors'\nimport { deserializeRecord, type DeserializedRecord } from '@makeswift/controls'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = getItemLabel && deserializeFunction(getItemLabel)\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = getItems && deserializeFunction(getItems)\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\nexport type DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype SerializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: SerializedConfig<OptionsType<P>>\n}\n\nfunction serializeControlDef<P extends PropDef>(\n control: Descriptor<P>,\n): [SerializedControlDef<P>, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\nexport type DeserializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: DeserializedConfig<OptionsType<P>>\n}\n\nfunction deserializeControlDef<P extends PropDef>(\n serializedControl: SerializedControlDef<P>,\n): DeserializedControlDef<P> {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYDescriptor): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype TextInputControlValue = string\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedControlDef<typeof GapX>\n | SerializedGapYControl<T>\n | SerializedControlDef<typeof ResponsiveNumber>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedControlDef<typeof ResponsiveIconRadioGroup>\n | SerializedControlDef<typeof ResponsiveSelect>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedControlDef<typeof GapX>\n | DeserializedGapYControl<T>\n | DeserializedControlDef<typeof ResponsiveNumber>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedControlDef<typeof ResponsiveIconRadioGroup>\n | DeserializedControlDef<typeof ResponsiveSelect>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeControl<T extends Data>(\n control: ControlDefinition<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const [serializedControl, transferables] = control.serialize()\n return [serializedControl, transferables]\n}\n\nfunction serializeLegacyControl<T extends Data>(\n control: LegacyDescriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return serializeListControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return serializeShapeControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return serializeTypeaheadControl(control) as [SerializedControl<T>, Transferable[]]\n\n case PropControllerTypes.GapX:\n return serializeControlDef<typeof GapX>(control)\n\n case PropControllerTypes.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case PropControllerTypes.ResponsiveNumber:\n return serializeControlDef<typeof ResponsiveNumber>(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return serializeControlDef<typeof ResponsiveIconRadioGroup>(control)\n\n case PropControllerTypes.ResponsiveSelect:\n return serializeControlDef<typeof ResponsiveSelect>(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case PropControllerTypes.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case PropControllerTypes.Image:\n return serializeImageControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return serializeRichTextControl(control)\n\n default:\n return [control, []]\n }\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport function deserializeLegacyControl<T extends Data>(\n serializedControl: SerializedLegacyControl<T>,\n): DeserializedControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return deserializeListControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return deserializeShapeControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case PropControllerTypes.GapX:\n return deserializeControlDef<typeof GapX>(serializedControl)\n\n case PropControllerTypes.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case PropControllerTypes.ResponsiveNumber:\n return deserializeControlDef<typeof ResponsiveNumber>(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return deserializeControlDef<typeof ResponsiveIconRadioGroup>(serializedControl)\n\n case PropControllerTypes.ResponsiveSelect:\n return deserializeControlDef<typeof ResponsiveSelect>(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case PropControllerTypes.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case PropControllerTypes.Image:\n return deserializeImageControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return deserializeRichTextControl(serializedControl)\n\n default:\n return serializedControl\n }\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n return deserializeLegacyControl(serializedControl)\n }\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): UnifiedControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => UnifiedControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [ListDefinition.type]: (record: DeserializedRecord) =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [ShapeDefinition.type]: (record: DeserializedRecord) =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [StyleV2Definition.type]: (record: DeserializedRecord) =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: (record: DeserializedRecord) =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, SerializedControl>,\n { onError }: { onError?: (err: Error) => void } = {},\n): Record<string, DeserializedControl> {\n return Object.entries(serializedControls).reduce(\n (deserializedControls, [key, serializedControl]) => {\n try {\n const deserializedControl = deserializeControl(serializedControl)\n return { ...deserializedControls, [key]: deserializedControl }\n } catch (err: unknown) {\n const error =\n err instanceof Error\n ? new Error(`Could not deserialize control for \"${key}\": ${err.message}`, {\n cause: err,\n })\n : new Error(`Could not deserialize control for \"${key}\", unknown error: ${err}`)\n\n onError?.(error)\n\n return deserializedControls\n }\n },\n {} as Record<string, DeserializedControl>,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA,IAAAA,mBAmBO;AAWP,qBAWO;AAEP,oCAMO;AAEP,IAAAC,2BAoBO;AAEP,yBAA0D;AAC1D,IAAAD,mBAA2D;AAe3D,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;AAIxB,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKE,QAAO,MAAM;AAC/C,UAAM,CAAC,mBAAmB,8BAA8B,IAAI,iBAAiBA,QAAO;AAEpF,mBAAe,GAAwB,IAAI;AAC3C,kBAAc,KAAK,GAAG,8BAA8B;AAAA,EACtD,CAAC;AAGD,SAAO,CAAC,EAAE,GAAG,SAAS,SAAS,EAAE,GAAG,QAAQ,SAAS,MAAM,eAAe,EAAE,GAAG,aAAa;AAC9F;AAeA,SAAS,wBAIP,SAI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"sources":["../../../../src/builder/serialization/control-serialization.ts"],"sourcesContent":["import {\n GapData,\n GapX,\n GapYDescriptor,\n GapYPropControllerData,\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n ResponsiveIconRadioGroup,\n ResponsiveNumber,\n ResponsiveSelect,\n type Descriptor,\n type PropDef,\n type OptionsType,\n} from '@makeswift/prop-controllers'\n\nimport {\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n type RichTextValue as RichTextControlValue,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n ColorDefinition,\n ComboboxDefinition,\n ImageDefinition,\n IconRadioGroupDefinition,\n ListDefinition,\n LinkDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../controls'\n\nimport {\n Data,\n Device,\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n PropControllerDescriptor as ControlDefinition,\n} from '../../prop-controllers'\n\nimport {\n DELETED_PROP_CONTROLLER_TYPES,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n RichTextDescriptor as RichTextControl,\n} from '../../prop-controllers/deleted'\n\nimport {\n DeserializedFunction,\n deserializeFunction,\n isSerializedFunction,\n SerializedFunction,\n serializeFunction,\n} from './function-serialization'\n\nimport {\n LinkData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n Types as PropControllerTypes,\n ImageDescriptor as ImageControl,\n ImageData as ImageControlValue,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n ResponsiveLengthDescriptor,\n NumberOptions,\n NumberPropControllerData,\n NumberDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveColorDescriptor,\n CheckboxPropControllerData,\n CheckboxDescriptor as CheckboxControl,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n TextInputDescriptor as TextInputControl,\n} from '@makeswift/prop-controllers'\n\nimport { type LegacyDescriptor, isLegacyDescriptor } from '../../prop-controllers/descriptors'\nimport { deserializeRecord, type DeserializedRecord } from '@makeswift/controls'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = getItemLabel && deserializeFunction(getItemLabel)\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = getItems && deserializeFunction(getItems)\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\nexport type DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype SerializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: SerializedConfig<OptionsType<P>>\n}\n\nfunction serializeControlDef<P extends PropDef>(\n control: Descriptor<P>,\n): [SerializedControlDef<P>, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\nexport type DeserializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: DeserializedConfig<OptionsType<P>>\n}\n\nfunction deserializeControlDef<P extends PropDef>(\n serializedControl: SerializedControlDef<P>,\n): DeserializedControlDef<P> {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYDescriptor): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype TextInputControlValue = string\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedControlDef<typeof GapX>\n | SerializedGapYControl<T>\n | SerializedControlDef<typeof ResponsiveNumber>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedControlDef<typeof ResponsiveIconRadioGroup>\n | SerializedControlDef<typeof ResponsiveSelect>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedControlDef<typeof GapX>\n | DeserializedGapYControl<T>\n | DeserializedControlDef<typeof ResponsiveNumber>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedControlDef<typeof ResponsiveIconRadioGroup>\n | DeserializedControlDef<typeof ResponsiveSelect>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeControl<T extends Data>(\n control: ControlDefinition<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const [serializedControl, transferables] = control.serialize()\n return [serializedControl, transferables]\n}\n\nexport function isSerializedControl(control: unknown): control is SerializedControl {\n return (\n control != null &&\n typeof control === 'object' &&\n 'type' in control &&\n typeof control.type === 'string'\n )\n}\n\nfunction serializeLegacyControl<T extends Data>(\n control: LegacyDescriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return serializeListControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return serializeShapeControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return serializeTypeaheadControl(control) as [SerializedControl<T>, Transferable[]]\n\n case PropControllerTypes.GapX:\n return serializeControlDef<typeof GapX>(control)\n\n case PropControllerTypes.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case PropControllerTypes.ResponsiveNumber:\n return serializeControlDef<typeof ResponsiveNumber>(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return serializeControlDef<typeof ResponsiveIconRadioGroup>(control)\n\n case PropControllerTypes.ResponsiveSelect:\n return serializeControlDef<typeof ResponsiveSelect>(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case PropControllerTypes.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case PropControllerTypes.Image:\n return serializeImageControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return serializeRichTextControl(control)\n\n default:\n return [control, []]\n }\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport function deserializeLegacyControl<T extends Data>(\n serializedControl: SerializedLegacyControl<T>,\n): DeserializedControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return deserializeListControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return deserializeShapeControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case PropControllerTypes.GapX:\n return deserializeControlDef<typeof GapX>(serializedControl)\n\n case PropControllerTypes.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case PropControllerTypes.ResponsiveNumber:\n return deserializeControlDef<typeof ResponsiveNumber>(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return deserializeControlDef<typeof ResponsiveIconRadioGroup>(serializedControl)\n\n case PropControllerTypes.ResponsiveSelect:\n return deserializeControlDef<typeof ResponsiveSelect>(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case PropControllerTypes.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case PropControllerTypes.Image:\n return deserializeImageControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return deserializeRichTextControl(serializedControl)\n\n default:\n return serializedControl\n }\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n return deserializeLegacyControl(serializedControl)\n }\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): UnifiedControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => UnifiedControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [ListDefinition.type]: (record: DeserializedRecord) =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [ShapeDefinition.type]: (record: DeserializedRecord) =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [StyleV2Definition.type]: (record: DeserializedRecord) =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: (record: DeserializedRecord) =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, unknown>,\n {\n onError,\n }: { onError?: (err: Error, context: { key: string; serializedControl: unknown }) => void } = {},\n): Record<string, DeserializedControl> {\n return Object.entries(serializedControls).reduce(\n (deserializedControls, [key, serializedControl]) => {\n try {\n if (!isSerializedControl(serializedControl)) {\n throw new Error(\n `Expected serialized control data, got ${JSON.stringify(serializedControl)}`,\n )\n }\n const deserializedControl = deserializeControl(serializedControl)\n return { ...deserializedControls, [key]: deserializedControl }\n } catch (err: unknown) {\n const error =\n err instanceof Error\n ? new Error(`Could not deserialize control for \"${key}\": ${err.message}`, {\n cause: err,\n })\n : new Error(`Could not deserialize control for \"${key}\", unknown error: ${err}`)\n\n onError?.(error, { key, serializedControl })\n\n return deserializedControls\n }\n },\n {} as Record<string, DeserializedControl>,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA,IAAAA,mBAmBO;AAWP,qBAWO;AAEP,oCAMO;AAEP,IAAAC,2BAoBO;AAEP,yBAA0D;AAC1D,IAAAD,mBAA2D;AAe3D,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;AAIxB,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKE,QAAO,MAAM;AAC/C,UAAM,CAAC,mBAAmB,8BAA8B,IAAI,iBAAiBA,QAAO;AAEpF,mBAAe,GAAwB,IAAI;AAC3C,kBAAc,KAAK,GAAG,8BAA8B;AAAA,EACtD,CAAC;AAGD,SAAO,CAAC,EAAE,GAAG,SAAS,SAAS,EAAE,GAAG,QAAQ,SAAS,MAAM,eAAe,EAAE,GAAG,aAAa;AAC9F;AAeA,SAAS,wBAIP,SAIA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,mBAAmB,CAAC;AAI1B,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKA,QAAO,MAAM;A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C;AAE3C,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["import_controls","import_prop_controllers","control","PropControllerTypes","record"]}
|
|
@@ -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.20.4-canary.
|
|
39
|
+
version: "0.20.4-canary.2",
|
|
40
40
|
previewMode: supportsPreviewMode,
|
|
41
41
|
draftMode: supportsDraftMode,
|
|
42
42
|
interactionMode: true,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,37 +15,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var deepEqual_exports = {};
|
|
30
20
|
__export(deepEqual_exports, {
|
|
31
21
|
default: () => deepEqual_default
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(deepEqual_exports);
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
const deepEqual = (a, b) => {
|
|
37
|
-
if ((0, import_shallowEqual.default)(a, b))
|
|
38
|
-
return true;
|
|
39
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
40
|
-
return false;
|
|
41
|
-
const keysA = Object.keys(a);
|
|
42
|
-
const keysB = Object.keys(b);
|
|
43
|
-
if (keysA.length !== keysB.length)
|
|
44
|
-
return false;
|
|
45
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
46
|
-
if (!hasOwnProperty.call(b, keysA[i]) || // @ts-expect-error: {}[string] is OK.
|
|
47
|
-
!deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
};
|
|
52
|
-
var deepEqual_default = deepEqual;
|
|
24
|
+
var import_controls = require("@makeswift/controls");
|
|
25
|
+
var deepEqual_default = import_controls.deepEqual;
|
|
53
26
|
//# sourceMappingURL=deepEqual.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/deepEqual.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/deepEqual.ts"],"sourcesContent":["import { deepEqual } from '@makeswift/controls'\n\nexport default deepEqual\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0B;AAE1B,IAAO,oBAAQ;","names":[]}
|
package/dist/cjs/utils/is.js
CHANGED
|
@@ -18,12 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var is_exports = {};
|
|
20
20
|
__export(is_exports, {
|
|
21
|
-
default: () =>
|
|
21
|
+
default: () => is_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(is_exports);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
27
|
-
return x !== x && y !== y;
|
|
28
|
-
}
|
|
24
|
+
var import_controls = require("@makeswift/controls");
|
|
25
|
+
var is_default = import_controls.is;
|
|
29
26
|
//# sourceMappingURL=is.js.map
|
package/dist/cjs/utils/is.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/is.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/is.ts"],"sourcesContent":["import { is } from '@makeswift/controls'\n\nexport default is\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAmB;AAEnB,IAAO,aAAQ;","names":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 partition_exports = {};
|
|
20
|
+
__export(partition_exports, {
|
|
21
|
+
partition: () => partition,
|
|
22
|
+
partitionRecord: () => partitionRecord
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(partition_exports);
|
|
25
|
+
function partition(array, predicate) {
|
|
26
|
+
return array.reduce(
|
|
27
|
+
(result, value) => {
|
|
28
|
+
result[predicate(value) ? 0 : 1].push(value);
|
|
29
|
+
return result;
|
|
30
|
+
},
|
|
31
|
+
[[], []]
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function partitionRecord(obj, predicate) {
|
|
35
|
+
return Object.entries(obj).reduce(
|
|
36
|
+
(result, [key, value]) => {
|
|
37
|
+
result[predicate(value) ? 0 : 1][key] = value;
|
|
38
|
+
return result;
|
|
39
|
+
},
|
|
40
|
+
[{}, {}]
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
partition,
|
|
46
|
+
partitionRecord
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=partition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/partition.ts"],"sourcesContent":["type Predicate<T, U extends T> = (value: T) => value is U\n\n/**\n * Splits the array into two based on the predicate's result. Returns a tuple of arrays with\n * matching and non-matching elements, maintaining the original order within each group.\n *\n * If the predicate includes a type assertion, the resulting arrays will be typed accordingly.\n */\nexport function partition<T, U extends T>(\n array: readonly T[],\n predicate: Predicate<T, U>,\n): [U[], Exclude<T, U>[]]\n\nexport function partition<T>(array: readonly T[], predicate: (value: T) => boolean): [T[], T[]]\n\nexport function partition(\n array: readonly unknown[],\n predicate: (value: unknown) => boolean,\n): [unknown[], unknown[]] {\n return array.reduce(\n (result: [unknown[], unknown[]], value) => {\n result[predicate(value) ? 0 : 1].push(value)\n return result\n },\n [[], []],\n )\n}\n\ntype R = Record<string, unknown>\n\n/**\n * Splits the record into two based on the predicate's result. Returns a tuple of records with\n * matching and non-matching elements.\n *\n * If the predicate includes a type assertion, the resulting records will be typed accordingly.\n */\nexport function partitionRecord<T, U extends T>(\n obj: Record<string, T>,\n predicate: Predicate<T, U>,\n): [Record<string, U>, Record<string, Exclude<T, U>>]\n\nexport function partitionRecord<T>(\n obj: Record<string, T>,\n predicate: (value: T) => boolean,\n): [Record<string, T>, Record<string, T>]\n\nexport function partitionRecord(obj: R, predicate: (value: unknown) => boolean): [R, R] {\n return Object.entries(obj).reduce(\n (result, [key, value]) => {\n result[predicate(value) ? 0 : 1][key] = value\n return result\n },\n [{}, {}] as [R, R],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,UACd,OACA,WACwB;AACxB,SAAO,MAAM;AAAA,IACX,CAAC,QAAgC,UAAU;AACzC,aAAO,UAAU,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,KAAK;AAC3C,aAAO;AAAA,IACT;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAoBO,SAAS,gBAAgB,KAAQ,WAAgD;AACtF,SAAO,OAAO,QAAQ,GAAG,EAAE;AAAA,IACzB,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM;AACxB,aAAO,UAAU,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI;AACxC,aAAO;AAAA,IACT;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,36 +15,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var shallowEqual_exports = {};
|
|
30
20
|
__export(shallowEqual_exports, {
|
|
31
21
|
default: () => shallowEqual_default
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(shallowEqual_exports);
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
const shallowEqual = (a, b) => {
|
|
37
|
-
if ((0, import_is.default)(a, b))
|
|
38
|
-
return true;
|
|
39
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
40
|
-
return false;
|
|
41
|
-
const keysA = Object.keys(a);
|
|
42
|
-
const keysB = Object.keys(b);
|
|
43
|
-
if (keysA.length !== keysB.length)
|
|
44
|
-
return false;
|
|
45
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
46
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !(0, import_is.default)(a[keysA[i]], b[keysA[i]]))
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
};
|
|
51
|
-
var shallowEqual_default = shallowEqual;
|
|
24
|
+
var import_controls = require("@makeswift/controls");
|
|
25
|
+
var shallowEqual_default = import_controls.shallowEqual;
|
|
52
26
|
//# sourceMappingURL=shallowEqual.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/shallowEqual.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/shallowEqual.ts"],"sourcesContent":["import { shallowEqual } from '@makeswift/controls'\n\nexport default shallowEqual\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6B;AAE7B,IAAO,uBAAQ;","names":[]}
|
|
@@ -276,6 +276,9 @@ function serializeControl(control) {
|
|
|
276
276
|
const [serializedControl, transferables] = control.serialize();
|
|
277
277
|
return [serializedControl, transferables];
|
|
278
278
|
}
|
|
279
|
+
function isSerializedControl(control) {
|
|
280
|
+
return control != null && typeof control === "object" && "type" in control && typeof control.type === "string";
|
|
281
|
+
}
|
|
279
282
|
function serializeLegacyControl(control) {
|
|
280
283
|
switch (control.type) {
|
|
281
284
|
case PropControllerTypes.Checkbox:
|
|
@@ -405,17 +408,24 @@ function serializeControls(controls) {
|
|
|
405
408
|
[{}, []]
|
|
406
409
|
);
|
|
407
410
|
}
|
|
408
|
-
function deserializeControls(serializedControls, {
|
|
411
|
+
function deserializeControls(serializedControls, {
|
|
412
|
+
onError
|
|
413
|
+
} = {}) {
|
|
409
414
|
return Object.entries(serializedControls).reduce(
|
|
410
415
|
(deserializedControls, [key, serializedControl]) => {
|
|
411
416
|
try {
|
|
417
|
+
if (!isSerializedControl(serializedControl)) {
|
|
418
|
+
throw new Error(
|
|
419
|
+
`Expected serialized control data, got ${JSON.stringify(serializedControl)}`
|
|
420
|
+
);
|
|
421
|
+
}
|
|
412
422
|
const deserializedControl = deserializeControl(serializedControl);
|
|
413
423
|
return { ...deserializedControls, [key]: deserializedControl };
|
|
414
424
|
} catch (err) {
|
|
415
425
|
const error = err instanceof Error ? new Error(`Could not deserialize control for "${key}": ${err.message}`, {
|
|
416
426
|
cause: err
|
|
417
427
|
}) : new Error(`Could not deserialize control for "${key}", unknown error: ${err}`);
|
|
418
|
-
onError?.(error);
|
|
428
|
+
onError?.(error, { key, serializedControl });
|
|
419
429
|
return deserializedControls;
|
|
420
430
|
}
|
|
421
431
|
},
|
|
@@ -427,6 +437,7 @@ export {
|
|
|
427
437
|
deserializeControls,
|
|
428
438
|
deserializeLegacyControl,
|
|
429
439
|
deserializeUnifiedControlDef,
|
|
440
|
+
isSerializedControl,
|
|
430
441
|
serializeControl,
|
|
431
442
|
serializeControls
|
|
432
443
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/builder/serialization/control-serialization.ts"],"sourcesContent":["import {\n GapData,\n GapX,\n GapYDescriptor,\n GapYPropControllerData,\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n ResponsiveIconRadioGroup,\n ResponsiveNumber,\n ResponsiveSelect,\n type Descriptor,\n type PropDef,\n type OptionsType,\n} from '@makeswift/prop-controllers'\n\nimport {\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n type RichTextValue as RichTextControlValue,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n ColorDefinition,\n ComboboxDefinition,\n ImageDefinition,\n IconRadioGroupDefinition,\n ListDefinition,\n LinkDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../controls'\n\nimport {\n Data,\n Device,\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n PropControllerDescriptor as ControlDefinition,\n} from '../../prop-controllers'\n\nimport {\n DELETED_PROP_CONTROLLER_TYPES,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n RichTextDescriptor as RichTextControl,\n} from '../../prop-controllers/deleted'\n\nimport {\n DeserializedFunction,\n deserializeFunction,\n isSerializedFunction,\n SerializedFunction,\n serializeFunction,\n} from './function-serialization'\n\nimport {\n LinkData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n Types as PropControllerTypes,\n ImageDescriptor as ImageControl,\n ImageData as ImageControlValue,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n ResponsiveLengthDescriptor,\n NumberOptions,\n NumberPropControllerData,\n NumberDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveColorDescriptor,\n CheckboxPropControllerData,\n CheckboxDescriptor as CheckboxControl,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n TextInputDescriptor as TextInputControl,\n} from '@makeswift/prop-controllers'\n\nimport { type LegacyDescriptor, isLegacyDescriptor } from '../../prop-controllers/descriptors'\nimport { deserializeRecord, type DeserializedRecord } from '@makeswift/controls'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = getItemLabel && deserializeFunction(getItemLabel)\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = getItems && deserializeFunction(getItems)\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\nexport type DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype SerializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: SerializedConfig<OptionsType<P>>\n}\n\nfunction serializeControlDef<P extends PropDef>(\n control: Descriptor<P>,\n): [SerializedControlDef<P>, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\nexport type DeserializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: DeserializedConfig<OptionsType<P>>\n}\n\nfunction deserializeControlDef<P extends PropDef>(\n serializedControl: SerializedControlDef<P>,\n): DeserializedControlDef<P> {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYDescriptor): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype TextInputControlValue = string\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedControlDef<typeof GapX>\n | SerializedGapYControl<T>\n | SerializedControlDef<typeof ResponsiveNumber>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedControlDef<typeof ResponsiveIconRadioGroup>\n | SerializedControlDef<typeof ResponsiveSelect>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedControlDef<typeof GapX>\n | DeserializedGapYControl<T>\n | DeserializedControlDef<typeof ResponsiveNumber>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedControlDef<typeof ResponsiveIconRadioGroup>\n | DeserializedControlDef<typeof ResponsiveSelect>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeControl<T extends Data>(\n control: ControlDefinition<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const [serializedControl, transferables] = control.serialize()\n return [serializedControl, transferables]\n}\n\nfunction serializeLegacyControl<T extends Data>(\n control: LegacyDescriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return serializeListControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return serializeShapeControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return serializeTypeaheadControl(control) as [SerializedControl<T>, Transferable[]]\n\n case PropControllerTypes.GapX:\n return serializeControlDef<typeof GapX>(control)\n\n case PropControllerTypes.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case PropControllerTypes.ResponsiveNumber:\n return serializeControlDef<typeof ResponsiveNumber>(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return serializeControlDef<typeof ResponsiveIconRadioGroup>(control)\n\n case PropControllerTypes.ResponsiveSelect:\n return serializeControlDef<typeof ResponsiveSelect>(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case PropControllerTypes.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case PropControllerTypes.Image:\n return serializeImageControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return serializeRichTextControl(control)\n\n default:\n return [control, []]\n }\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport function deserializeLegacyControl<T extends Data>(\n serializedControl: SerializedLegacyControl<T>,\n): DeserializedControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return deserializeListControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return deserializeShapeControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case PropControllerTypes.GapX:\n return deserializeControlDef<typeof GapX>(serializedControl)\n\n case PropControllerTypes.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case PropControllerTypes.ResponsiveNumber:\n return deserializeControlDef<typeof ResponsiveNumber>(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return deserializeControlDef<typeof ResponsiveIconRadioGroup>(serializedControl)\n\n case PropControllerTypes.ResponsiveSelect:\n return deserializeControlDef<typeof ResponsiveSelect>(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case PropControllerTypes.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case PropControllerTypes.Image:\n return deserializeImageControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return deserializeRichTextControl(serializedControl)\n\n default:\n return serializedControl\n }\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n return deserializeLegacyControl(serializedControl)\n }\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): UnifiedControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => UnifiedControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [ListDefinition.type]: (record: DeserializedRecord) =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [ShapeDefinition.type]: (record: DeserializedRecord) =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [StyleV2Definition.type]: (record: DeserializedRecord) =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: (record: DeserializedRecord) =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, SerializedControl>,\n { onError }: { onError?: (err: Error) => void } = {},\n): Record<string, DeserializedControl> {\n return Object.entries(serializedControls).reduce(\n (deserializedControls, [key, serializedControl]) => {\n try {\n const deserializedControl = deserializeControl(serializedControl)\n return { ...deserializedControls, [key]: deserializedControl }\n } catch (err: unknown) {\n const error =\n err instanceof Error\n ? new Error(`Could not deserialize control for \"${key}\": ${err.message}`, {\n cause: err,\n })\n : new Error(`Could not deserialize control for \"${key}\", unknown error: ${err}`)\n\n onError?.(error)\n\n return deserializedControls\n }\n },\n {} as Record<string, DeserializedControl>,\n )\n}\n"],"mappings":"AAqBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWP;AAAA,EACE;AAAA,OAUK;AAEP;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP;AAAA,EAIE,SAAS;AAAA,OAgBJ;AAEP,SAAgC,0BAA0B;AAC1D,SAAS,yBAAkD;AAe3D,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;A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Ef,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["control","record"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/builder/serialization/control-serialization.ts"],"sourcesContent":["import {\n GapData,\n GapX,\n GapYDescriptor,\n GapYPropControllerData,\n ResponsiveLengthOptions,\n ResponsiveLengthPropControllerData,\n ResponsiveIconRadioGroup,\n ResponsiveNumber,\n ResponsiveSelect,\n type Descriptor,\n type PropDef,\n type OptionsType,\n} from '@makeswift/prop-controllers'\n\nimport {\n ControlDefinition as UnifiedControlDefinition,\n type SerializedRecord,\n type RichTextValue as RichTextControlValue,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n ColorDefinition,\n ComboboxDefinition,\n ImageDefinition,\n IconRadioGroupDefinition,\n ListDefinition,\n LinkDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../controls'\n\nimport {\n Data,\n Device,\n PanelDescriptor as PanelControl,\n PanelDescriptorType as PanelControlType,\n PanelDescriptorValueType as PanelControlValueType,\n PropControllerDescriptor as ControlDefinition,\n} from '../../prop-controllers'\n\nimport {\n DELETED_PROP_CONTROLLER_TYPES,\n ListDescriptor as ListControl,\n ListOptions as ListControlConfig,\n ListValue as ListControlValue,\n ShapeDescriptor as ShapeControl,\n ShapeValue as ShapeControlValue,\n TypeaheadDescriptor as TypeaheadControl,\n TypeaheadOptions as TypeaheadControlConfig,\n TypeaheadValue as TypeaheadControlValue,\n RichTextDescriptor as RichTextControl,\n} from '../../prop-controllers/deleted'\n\nimport {\n DeserializedFunction,\n deserializeFunction,\n isSerializedFunction,\n SerializedFunction,\n serializeFunction,\n} from './function-serialization'\n\nimport {\n LinkData,\n DateDescriptor as DateControl,\n DatePropControllerData,\n Types as PropControllerTypes,\n ImageDescriptor as ImageControl,\n ImageData as ImageControlValue,\n LinkDescriptor as LinkControl,\n LinkPropControllerData,\n ResponsiveLengthDescriptor,\n NumberOptions,\n NumberPropControllerData,\n NumberDescriptor,\n ResponsiveColorPropControllerData,\n ResponsiveColorDescriptor,\n CheckboxPropControllerData,\n CheckboxDescriptor as CheckboxControl,\n TextStyleDescriptor as TextStyleControl,\n TextStylePropControllerData,\n TextInputDescriptor as TextInputControl,\n} from '@makeswift/prop-controllers'\n\nimport { type LegacyDescriptor, isLegacyDescriptor } from '../../prop-controllers/descriptors'\nimport { deserializeRecord, type DeserializedRecord } from '@makeswift/controls'\n\ntype SerializedShapeControlConfig<T extends Record<string, SerializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: SerializedPanelControlValueType<T[K]> }\n}\n\ntype SerializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: SerializedShapeControlConfig<U>\n}\n\nfunction serializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, PanelControl>,\n>(\n control: ShapeControl<T, U>,\n): [\n SerializedShapeControl<\n T,\n { [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>> }\n >,\n Transferable[],\n] {\n const { type } = control.options\n const transferables: Transferable[] = []\n const serializedType = {} as {\n [K in keyof U]: SerializedPanelControl<PanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n const [serializedControl, serializedControlTransferables] = serializeControl(control)\n\n serializedType[key as keyof typeof type] = serializedControl as SerializedPanelControl\n transferables.push(...serializedControlTransferables)\n })\n\n // @ts-expect-error: preset types are incompatible\n return [{ ...control, options: { ...control.options, type: serializedType } }, transferables]\n}\n\ntype DeserializedShapeControlConfig<T extends Record<string, DeserializedPanelControl>> = {\n type: T\n preset?: { [K in keyof T]?: DeserializedPanelControlValueType<T[K]> }\n}\n\ntype DeserializedShapeControl<\n _T extends Record<string, Data>,\n U extends Record<string, DeserializedPanelControl>,\n> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Shape\n options: DeserializedShapeControlConfig<U>\n}\n\nfunction deserializeShapeControl<\n T extends Record<string, Data>,\n U extends Record<string, SerializedPanelControl>,\n>(\n control: SerializedShapeControl<T, U>,\n): DeserializedShapeControl<\n T,\n { [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>> }\n> {\n const { type } = control.options\n const deserializedType = {} as {\n [K in keyof U]: DeserializedPanelControl<SerializedPanelControlValueType<U[K]>>\n }\n\n Object.entries(type).forEach(([key, control]) => {\n deserializedType[key as keyof typeof type] = deserializeControl(\n control,\n ) as DeserializedPanelControl\n })\n\n // @ts-expect-error: preset types are incompatible\n return { ...control, options: { ...control.options, type: deserializedType } }\n}\n\ntype SerializedListControlConfig<T extends Data> = {\n type: SerializedPanelControl<T>\n label?: string\n getItemLabel?: SerializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype SerializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: SerializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction serializeListControl<T extends Data>(\n control: ListControl<ListControlValue<T>>,\n): [SerializedListControl<ListControlValue<T>>, Transferable[]] {\n const { type, getItemLabel } = control.options\n const transferables: Transferable[] = []\n\n const [serializedType, serializedTypeTransferables] = serializeControl(type)\n const serializedGetItemLabel = getItemLabel && serializeFunction(getItemLabel)\n\n transferables.push(...serializedTypeTransferables)\n if (serializedGetItemLabel != null) transferables.push(serializedGetItemLabel)\n\n return [\n {\n ...control,\n options: {\n ...control.options,\n type: serializedType as SerializedPanelControl,\n getItemLabel: serializedGetItemLabel,\n },\n },\n transferables,\n ]\n}\n\ntype DeserializedListControlConfig<T extends Data> = {\n type: DeserializedPanelControl<T>\n label?: string\n getItemLabel?: DeserializedFunction<Exclude<ListControlConfig<T>['getItemLabel'], undefined>>\n preset?: ListControlValue<T>\n defaultValue?: ListControlValue<T>\n}\n\ntype DeserializedListControl<T extends ListControlValue = ListControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.List\n options: DeserializedListControlConfig<T extends ListControlValue<infer U> ? U : never>\n}\n\nfunction deserializeListControl<T extends Data>(\n serializedControl: SerializedListControl<ListControlValue<T>>,\n): DeserializedListControl<ListControlValue<T>> {\n const { type, getItemLabel } = serializedControl.options\n\n const deserializedType = deserializeControl(type) as DeserializedPanelControl\n const deserializedGetItemLabel = getItemLabel && deserializeFunction(getItemLabel)\n\n return {\n ...serializedControl,\n options: {\n ...serializedControl.options,\n type: deserializedType,\n getItemLabel: deserializedGetItemLabel,\n },\n }\n}\n\ntype SerializedTypeaheadControlConfig<T extends Data> = {\n getItems: SerializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype SerializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: SerializedTypeaheadControlConfig<T['value']>\n}\n\nfunction serializeTypeaheadControl<T extends Data>(\n control: TypeaheadControl<TypeaheadControlValue<T>>,\n): [SerializedTypeaheadControl<TypeaheadControlValue<T>>, Transferable[]] {\n const { getItems } = control.options\n\n const serializedGetItems = getItems && serializeFunction(getItems)\n\n return [\n { ...control, options: { ...control.options, getItems: serializedGetItems } },\n serializedGetItems == null ? [] : [serializedGetItems],\n ]\n}\n\ntype DeserializedTypeaheadControlConfig<T extends Data> = {\n getItems: DeserializedFunction<TypeaheadControlConfig<T>['getItems']>\n label?: string\n preset?: TypeaheadControlValue<T>\n defaultValue?: TypeaheadControlValue<T>\n}\n\ntype DeserializedTypeaheadControl<T extends TypeaheadControlValue = TypeaheadControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: DeserializedTypeaheadControlConfig<T['value']>\n}\n\nfunction deserializeTypeaheadControl<T extends Data>(\n serializedControl: SerializedTypeaheadControl<TypeaheadControlValue<T>>,\n): DeserializedTypeaheadControl<TypeaheadControlValue<T>> {\n const { getItems } = serializedControl.options\n\n const deserializedGetItems = getItems && deserializeFunction(getItems)\n\n return {\n ...serializedControl,\n options: { ...serializedControl.options, getItems: deserializedGetItems },\n }\n}\n\ntype SerializedConfig<T> =\n | T\n | SerializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\nexport type DeserializedConfig<T> =\n | T\n | DeserializedFunction<(props: Record<string, unknown>, deviceMode: Device) => T>\n\ntype SerializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: SerializedConfig<OptionsType<P>>\n}\n\nfunction serializeControlDef<P extends PropDef>(\n control: Descriptor<P>,\n): [SerializedControlDef<P>, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\nexport type DeserializedControlDef<P extends PropDef> = Descriptor<P> & {\n options: DeserializedConfig<OptionsType<P>>\n}\n\nfunction deserializeControlDef<P extends PropDef>(\n serializedControl: SerializedControlDef<P>,\n): DeserializedControlDef<P> {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype GapYControlConfig = {\n preset?: GapYPropControllerData\n label?: string\n defaultValue?: GapData\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}\n\ntype SerializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: SerializedConfig<GapYControlConfig>\n}\n\nfunction serializeGapYControl(control: GapYDescriptor): [SerializedGapYControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedGapYControl<_T = GapYPropControllerData> = {\n type: typeof PropControllerTypes.GapY\n options: DeserializedConfig<GapYControlConfig>\n}\n\nfunction deserializeGapYControl(serializedControl: SerializedGapYControl): DeserializedGapYControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype CheckboxControlConfig = {\n preset?: CheckboxPropControllerData\n label: string\n hidden?: boolean\n}\n\ntype SerializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: SerializedConfig<CheckboxControlConfig>\n}\n\nfunction serializeCheckboxControl(\n control: CheckboxControl,\n): [SerializedCheckboxControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedCheckboxControl<_T = CheckboxPropControllerData> = {\n type: typeof PropControllerTypes.Checkbox\n options: DeserializedConfig<CheckboxControlConfig>\n}\n\nfunction deserializeCheckboxControl(\n serializedControl: SerializedCheckboxControl,\n): DeserializedCheckboxControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ResponsiveColorControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype SerializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: SerializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction serializeResponsiveColorControl(\n control: ResponsiveColorDescriptor,\n): [SerializedResponsiveColorControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveColorControl<_T = ResponsiveColorPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveColor\n options: DeserializedConfig<ResponsiveColorControlConfig>\n}\n\nfunction deserializeResponsiveColorControl(\n serializedControl: SerializedResponsiveColorControl,\n): DeserializedResponsiveColorControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\ntype SerializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: SerializedConfig<NumberOptions>\n}\n\nfunction serializeNumberControl(\n control: NumberDescriptor,\n): [SerializedNumberControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedNumberControl<_T = NumberPropControllerData> = {\n type: typeof PropControllerTypes.Number\n options: DeserializedConfig<NumberOptions>\n}\n\nfunction deserializeNumberControl(\n serializedControl: SerializedNumberControl,\n): DeserializedNumberControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype DateControlConfig = { preset?: DatePropControllerData }\n\ntype SerializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: SerializedConfig<DateControlConfig>\n}\n\nfunction serializeDateControl(control: DateControl): [SerializedDateControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedDateControl<_T = DatePropControllerData> = {\n type: typeof PropControllerTypes.Date\n options: DeserializedConfig<DateControlConfig>\n}\n\nfunction deserializeDateControl(serializedControl: SerializedDateControl): DeserializedDateControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype LinkControlConfig = {\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkPropControllerData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}\n\ntype SerializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: SerializedConfig<LinkControlConfig>\n}\n\nfunction serializeLinkControl(control: LinkControl): [SerializedLinkControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedLinkControl<_T = LinkPropControllerData> = {\n type: typeof PropControllerTypes.Link\n options: DeserializedConfig<LinkControlConfig>\n}\n\nfunction deserializeLinkControl(serializedControl: SerializedLinkControl): DeserializedLinkControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype TextInputControlConfig = { label?: string; placeholder?: string; hidden?: boolean }\n\ntype TextInputControlValue = string\n\ntype SerializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: SerializedConfig<TextInputControlConfig>\n}\n\nfunction serializeTextInputControl(\n control: TextInputControl,\n): [SerializedTextInputControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedTextInputControl<_T = TextInputControlValue> = {\n type: typeof PropControllerTypes.TextInput\n options: DeserializedConfig<TextInputControlConfig>\n}\n\nfunction deserializeTextInputControl(\n serializedControl: SerializedTextInputControl,\n): DeserializedTextInputControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: SerializedConfig<ResponsiveLengthOptions>\n}\n\nfunction serializeResponsiveLengthControl(\n control: ResponsiveLengthDescriptor,\n): [SerializedResponsiveLengthControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedResponsiveLengthControl<_T = ResponsiveLengthPropControllerData> = {\n type: typeof PropControllerTypes.ResponsiveLength\n options: DeserializedConfig<ResponsiveLengthOptions>\n}\n\nfunction deserializeResponsiveLengthControl(\n serializedControl: SerializedResponsiveLengthControl,\n): DeserializedResponsiveLengthControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype SerializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: SerializedConfig<TextStyleControlConfig>\n}\n\nfunction serializeTextStyleControl(\n control: TextStyleControl,\n): [SerializedTextStyleControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype TextStyleControlConfig = {\n preset?: TextStylePropControllerData\n label?: string\n hidden?: boolean\n}\n\ntype DeserializedTextStyleControl<_T = TextStylePropControllerData> = {\n type: typeof PropControllerTypes.TextStyle\n options: DeserializedConfig<TextStyleControlConfig>\n}\n\nfunction deserializeTextStyleControl(\n serializedControl: SerializedTextStyleControl,\n): DeserializedTextStyleControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype ImageControlConfig = { label?: string; hidden?: boolean }\n\ntype SerializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: SerializedConfig<ImageControlConfig>\n}\n\nfunction serializeImageControl(control: ImageControl): [SerializedImageControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedImageControl<_T = ImageControlValue> = {\n type: typeof PropControllerTypes.Image\n options: DeserializedConfig<ImageControlConfig>\n}\n\nfunction deserializeImageControl(\n serializedControl: SerializedImageControl,\n): DeserializedImageControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\ntype RichTextControlConfig = { preset?: RichTextControlValue }\n\ntype SerializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: SerializedConfig<RichTextControlConfig>\n}\n\nfunction serializeRichTextControl(\n control: RichTextControl,\n): [SerializedRichTextControl, Transferable[]] {\n const { options } = control\n\n if (typeof options !== 'function') return [{ ...control, options }, []]\n\n const serializedOptions = serializeFunction(options)\n\n return [{ ...control, options: serializedOptions }, [serializedOptions]]\n}\n\ntype DeserializedRichTextControl<_T = RichTextControlValue> = {\n type: typeof DELETED_PROP_CONTROLLER_TYPES.RichText\n options: DeserializedConfig<RichTextControlConfig>\n}\n\nfunction deserializeRichTextControl(\n serializedControl: SerializedRichTextControl,\n): DeserializedRichTextControl {\n const { options } = serializedControl\n\n if (!isSerializedFunction(options)) return { ...serializedControl, options }\n\n const deserializedOptions = deserializeFunction(options)\n\n return { ...serializedControl, options: deserializedOptions }\n}\n\nexport type SerializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | SerializedListControl<T extends ListControlValue ? T : ListControlValue>\n | SerializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | SerializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | SerializedControlDef<typeof GapX>\n | SerializedGapYControl<T>\n | SerializedControlDef<typeof ResponsiveNumber>\n | SerializedCheckboxControl<T>\n | SerializedResponsiveColorControl<T>\n | SerializedNumberControl<T>\n | SerializedControlDef<typeof ResponsiveIconRadioGroup>\n | SerializedControlDef<typeof ResponsiveSelect>\n | SerializedResponsiveLengthControl<T>\n | SerializedDateControl<T>\n | SerializedLinkControl<T>\n | SerializedTextInputControl<T>\n | SerializedTextStyleControl<T>\n | SerializedImageControl<T>\n | SerializedRichTextControl<T>\n\nexport type SerializedControl<T extends Data = Data> = SerializedLegacyControl<T> | SerializedRecord\n\ntype SerializedPanelControl<T extends Data = Data> = Extract<\n SerializedControl<T>,\n { type: PanelControlType }\n>\n\ntype SerializedPanelControlValueType<T extends SerializedPanelControl> =\n T extends SerializedPanelControl<infer U> ? U : never\n\nexport type DeserializedLegacyControl<T extends Data = Data> =\n | Exclude<\n LegacyDescriptor<T>,\n | ListControl<T extends ListControlValue ? T : ListControlValue>\n | ShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | TypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | Descriptor<typeof GapX>\n | GapYDescriptor<T>\n | Descriptor<typeof ResponsiveNumber>\n | CheckboxControl<T>\n | ResponsiveColorDescriptor<T>\n | NumberDescriptor<T>\n | Descriptor<typeof ResponsiveIconRadioGroup>\n | Descriptor<typeof ResponsiveSelect>\n | ResponsiveLengthDescriptor<T>\n | DateControl<T>\n | LinkControl<T>\n | TextInputControl<T>\n | TextStyleControl<T>\n | ImageControl<T>\n | RichTextControl<T>\n >\n | DeserializedListControl<T extends ListControlValue ? T : ListControlValue>\n | DeserializedShapeControl<T extends ShapeControlValue ? T : ShapeControlValue, any>\n | DeserializedTypeaheadControl<T extends TypeaheadControlValue ? T : TypeaheadControlValue>\n | DeserializedControlDef<typeof GapX>\n | DeserializedGapYControl<T>\n | DeserializedControlDef<typeof ResponsiveNumber>\n | DeserializedCheckboxControl<T>\n | DeserializedResponsiveColorControl<T>\n | DeserializedNumberControl<T>\n | DeserializedControlDef<typeof ResponsiveIconRadioGroup>\n | DeserializedControlDef<typeof ResponsiveSelect>\n | DeserializedResponsiveLengthControl<T>\n | DeserializedDateControl<T>\n | DeserializedLinkControl<T>\n | DeserializedTextInputControl<T>\n | DeserializedTextStyleControl<T>\n | DeserializedImageControl<T>\n | DeserializedRichTextControl<T>\n\nexport type DeserializedControl<T extends Data = Data> =\n | DeserializedLegacyControl<T>\n | UnifiedControlDefinition\n\nexport type DeserializedPanelControl<T extends Data = Data> = Extract<\n DeserializedControl<T>,\n { type: PanelControlType }\n>\n\ntype DeserializedPanelControlValueType<T extends DeserializedPanelControl> =\n T extends DeserializedPanelControl<infer U> ? U : never\n\nexport function serializeControl<T extends Data>(\n control: ControlDefinition<T>,\n): [SerializedControl<T>, Transferable[]] {\n if (isLegacyDescriptor(control)) {\n return serializeLegacyControl(control)\n }\n\n const [serializedControl, transferables] = control.serialize()\n return [serializedControl, transferables]\n}\n\nexport function isSerializedControl(control: unknown): control is SerializedControl {\n return (\n control != null &&\n typeof control === 'object' &&\n 'type' in control &&\n typeof control.type === 'string'\n )\n}\n\nfunction serializeLegacyControl<T extends Data>(\n control: LegacyDescriptor<T>,\n): [SerializedControl<T>, Transferable[]] {\n switch (control.type) {\n case PropControllerTypes.Checkbox:\n return serializeCheckboxControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return serializeListControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return serializeShapeControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return serializeTypeaheadControl(control) as [SerializedControl<T>, Transferable[]]\n\n case PropControllerTypes.GapX:\n return serializeControlDef<typeof GapX>(control)\n\n case PropControllerTypes.GapY:\n return serializeGapYControl(control)\n\n case PropControllerTypes.ResponsiveColor:\n return serializeResponsiveColorControl(control)\n\n case PropControllerTypes.ResponsiveNumber:\n return serializeControlDef<typeof ResponsiveNumber>(control)\n\n case PropControllerTypes.Number:\n return serializeNumberControl(control)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return serializeControlDef<typeof ResponsiveIconRadioGroup>(control)\n\n case PropControllerTypes.ResponsiveSelect:\n return serializeControlDef<typeof ResponsiveSelect>(control)\n\n case PropControllerTypes.ResponsiveLength:\n return serializeResponsiveLengthControl(control)\n\n case PropControllerTypes.Date:\n return serializeDateControl(control)\n\n case PropControllerTypes.Link:\n return serializeLinkControl(control)\n\n case PropControllerTypes.TextInput:\n return serializeTextInputControl(control)\n\n case PropControllerTypes.TextStyle:\n return serializeTextStyleControl(control)\n\n case PropControllerTypes.Image:\n return serializeImageControl(control)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return serializeRichTextControl(control)\n\n default:\n return [control, []]\n }\n}\n\nfunction isSerializedLegacyControl<T extends Data>(\n control: SerializedControl<T>,\n): control is SerializedLegacyControl<T> {\n return 'options' in control\n}\n\nexport function deserializeLegacyControl<T extends Data>(\n serializedControl: SerializedLegacyControl<T>,\n): DeserializedControl<T> {\n switch (serializedControl.type) {\n case PropControllerTypes.Checkbox:\n return deserializeCheckboxControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.List:\n return deserializeListControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Shape:\n return deserializeShapeControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.Typeahead:\n return deserializeTypeaheadControl(serializedControl)\n\n case PropControllerTypes.GapX:\n return deserializeControlDef<typeof GapX>(serializedControl)\n\n case PropControllerTypes.GapY:\n return deserializeGapYControl(serializedControl)\n\n case PropControllerTypes.ResponsiveColor:\n return deserializeResponsiveColorControl(serializedControl)\n\n case PropControllerTypes.ResponsiveNumber:\n return deserializeControlDef<typeof ResponsiveNumber>(serializedControl)\n\n case PropControllerTypes.Number:\n return deserializeNumberControl(serializedControl)\n\n case PropControllerTypes.ResponsiveIconRadioGroup:\n return deserializeControlDef<typeof ResponsiveIconRadioGroup>(serializedControl)\n\n case PropControllerTypes.ResponsiveSelect:\n return deserializeControlDef<typeof ResponsiveSelect>(serializedControl)\n\n case PropControllerTypes.ResponsiveLength:\n return deserializeResponsiveLengthControl(serializedControl)\n\n case PropControllerTypes.Date:\n return deserializeDateControl(serializedControl)\n\n case PropControllerTypes.Link:\n return deserializeLinkControl(serializedControl)\n\n case PropControllerTypes.TextInput:\n return deserializeTextInputControl(serializedControl)\n\n case PropControllerTypes.TextStyle:\n return deserializeTextStyleControl(serializedControl)\n\n case PropControllerTypes.Image:\n return deserializeImageControl(serializedControl)\n\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\n return deserializeRichTextControl(serializedControl)\n\n default:\n return serializedControl\n }\n}\n\nexport function deserializeControl<T extends Data>(\n serializedControl: SerializedControl<T>,\n): DeserializedControl<T> {\n if (isSerializedLegacyControl(serializedControl)) {\n return deserializeLegacyControl(serializedControl)\n }\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): UnifiedControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => UnifiedControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [ListDefinition.type]: (record: DeserializedRecord) =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [ShapeDefinition.type]: (record: DeserializedRecord) =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [StyleV2Definition.type]: (record: DeserializedRecord) =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: (record: DeserializedRecord) =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n): [Record<string, SerializedControl>, Transferable[]] {\n return Object.entries(controls).reduce(\n ([accControls, accTransferables], [key, control]) => {\n const [serializedControl, transferables] = serializeControl(control)\n\n return [{ ...accControls, [key]: serializedControl }, [...accTransferables, ...transferables]]\n },\n [{}, []] as [Record<string, SerializedControl>, Transferable[]],\n )\n}\n\nexport function deserializeControls(\n serializedControls: Record<string, unknown>,\n {\n onError,\n }: { onError?: (err: Error, context: { key: string; serializedControl: unknown }) => void } = {},\n): Record<string, DeserializedControl> {\n return Object.entries(serializedControls).reduce(\n (deserializedControls, [key, serializedControl]) => {\n try {\n if (!isSerializedControl(serializedControl)) {\n throw new Error(\n `Expected serialized control data, got ${JSON.stringify(serializedControl)}`,\n )\n }\n const deserializedControl = deserializeControl(serializedControl)\n return { ...deserializedControls, [key]: deserializedControl }\n } catch (err: unknown) {\n const error =\n err instanceof Error\n ? new Error(`Could not deserialize control for \"${key}\": ${err.message}`, {\n cause: err,\n })\n : new Error(`Could not deserialize control for \"${key}\", unknown error: ${err}`)\n\n onError?.(error, { key, serializedControl })\n\n return deserializedControls\n }\n },\n {} as Record<string, DeserializedControl>,\n )\n}\n"],"mappings":"AAqBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWP;AAAA,EACE;AAAA,OAUK;AAEP;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP;AAAA,EAIE,SAAS;AAAA,OAgBJ;AAEP,SAAgC,0BAA0B;AAC1D,SAAS,yBAAkD;AAe3D,SAAS,sBAIP,SAOA;AACA,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,gBAAgC,CAAC;AACvC,QAAM,iBAAiB,CAAC;AAIxB,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAKA,QAAO,MAAM;AAC/C,UAAM,CAAC,mBAAmB,8BAA8B,IAAI,iBAAiBA,QAAO;AAEpF,mBAAe,GAAwB,IAAI;AAC3C,kBAAc,KAAK,GAAG,8BAA8B;AAAA,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qBAAqB,GAAG,EAAE;AAEnF,kBAAU,OAAO,EAAE,KAAK,kBAAkB,CAAC;AAE3C,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["control","record"]}
|
|
@@ -13,7 +13,7 @@ async function handler(...args) {
|
|
|
13
13
|
const supportsPreviewMode = match(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
|
|
14
14
|
const supportsDraftMode = match(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
|
|
15
15
|
const body = {
|
|
16
|
-
version: "0.20.4-canary.
|
|
16
|
+
version: "0.20.4-canary.2",
|
|
17
17
|
previewMode: supportsPreviewMode,
|
|
18
18
|
draftMode: supportsDraftMode,
|
|
19
19
|
interactionMode: true,
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { hasOwnProperty } = Object.prototype;
|
|
3
|
-
const deepEqual = (a, b) => {
|
|
4
|
-
if (shallowEqual(a, b))
|
|
5
|
-
return true;
|
|
6
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
7
|
-
return false;
|
|
8
|
-
const keysA = Object.keys(a);
|
|
9
|
-
const keysB = Object.keys(b);
|
|
10
|
-
if (keysA.length !== keysB.length)
|
|
11
|
-
return false;
|
|
12
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
13
|
-
if (!hasOwnProperty.call(b, keysA[i]) || // @ts-expect-error: {}[string] is OK.
|
|
14
|
-
!deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
18
|
-
};
|
|
1
|
+
import { deepEqual } from "@makeswift/controls";
|
|
19
2
|
var deepEqual_default = deepEqual;
|
|
20
3
|
export {
|
|
21
4
|
deepEqual_default as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/deepEqual.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/deepEqual.ts"],"sourcesContent":["import { deepEqual } from '@makeswift/controls'\n\nexport default deepEqual\n"],"mappings":"AAAA,SAAS,iBAAiB;AAE1B,IAAO,oBAAQ;","names":[]}
|
package/dist/esm/utils/is.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
4
|
-
return x !== x && y !== y;
|
|
5
|
-
}
|
|
1
|
+
import { is } from "@makeswift/controls";
|
|
2
|
+
var is_default = is;
|
|
6
3
|
export {
|
|
7
|
-
|
|
4
|
+
is_default as default
|
|
8
5
|
};
|
|
9
6
|
//# sourceMappingURL=is.js.map
|
package/dist/esm/utils/is.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/is.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/is.ts"],"sourcesContent":["import { is } from '@makeswift/controls'\n\nexport default is\n"],"mappings":"AAAA,SAAS,UAAU;AAEnB,IAAO,aAAQ;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function partition(array, predicate) {
|
|
2
|
+
return array.reduce(
|
|
3
|
+
(result, value) => {
|
|
4
|
+
result[predicate(value) ? 0 : 1].push(value);
|
|
5
|
+
return result;
|
|
6
|
+
},
|
|
7
|
+
[[], []]
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function partitionRecord(obj, predicate) {
|
|
11
|
+
return Object.entries(obj).reduce(
|
|
12
|
+
(result, [key, value]) => {
|
|
13
|
+
result[predicate(value) ? 0 : 1][key] = value;
|
|
14
|
+
return result;
|
|
15
|
+
},
|
|
16
|
+
[{}, {}]
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
partition,
|
|
21
|
+
partitionRecord
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=partition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/partition.ts"],"sourcesContent":["type Predicate<T, U extends T> = (value: T) => value is U\n\n/**\n * Splits the array into two based on the predicate's result. Returns a tuple of arrays with\n * matching and non-matching elements, maintaining the original order within each group.\n *\n * If the predicate includes a type assertion, the resulting arrays will be typed accordingly.\n */\nexport function partition<T, U extends T>(\n array: readonly T[],\n predicate: Predicate<T, U>,\n): [U[], Exclude<T, U>[]]\n\nexport function partition<T>(array: readonly T[], predicate: (value: T) => boolean): [T[], T[]]\n\nexport function partition(\n array: readonly unknown[],\n predicate: (value: unknown) => boolean,\n): [unknown[], unknown[]] {\n return array.reduce(\n (result: [unknown[], unknown[]], value) => {\n result[predicate(value) ? 0 : 1].push(value)\n return result\n },\n [[], []],\n )\n}\n\ntype R = Record<string, unknown>\n\n/**\n * Splits the record into two based on the predicate's result. Returns a tuple of records with\n * matching and non-matching elements.\n *\n * If the predicate includes a type assertion, the resulting records will be typed accordingly.\n */\nexport function partitionRecord<T, U extends T>(\n obj: Record<string, T>,\n predicate: Predicate<T, U>,\n): [Record<string, U>, Record<string, Exclude<T, U>>]\n\nexport function partitionRecord<T>(\n obj: Record<string, T>,\n predicate: (value: T) => boolean,\n): [Record<string, T>, Record<string, T>]\n\nexport function partitionRecord(obj: R, predicate: (value: unknown) => boolean): [R, R] {\n return Object.entries(obj).reduce(\n (result, [key, value]) => {\n result[predicate(value) ? 0 : 1][key] = value\n return result\n },\n [{}, {}] as [R, R],\n )\n}\n"],"mappings":"AAeO,SAAS,UACd,OACA,WACwB;AACxB,SAAO,MAAM;AAAA,IACX,CAAC,QAAgC,UAAU;AACzC,aAAO,UAAU,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,KAAK;AAC3C,aAAO;AAAA,IACT;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAoBO,SAAS,gBAAgB,KAAQ,WAAgD;AACtF,SAAO,OAAO,QAAQ,GAAG,EAAE;AAAA,IACzB,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM;AACxB,aAAO,UAAU,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI;AACxC,aAAO;AAAA,IACT;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { hasOwnProperty } = Object.prototype;
|
|
3
|
-
const shallowEqual = (a, b) => {
|
|
4
|
-
if (is(a, b))
|
|
5
|
-
return true;
|
|
6
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
7
|
-
return false;
|
|
8
|
-
const keysA = Object.keys(a);
|
|
9
|
-
const keysB = Object.keys(b);
|
|
10
|
-
if (keysA.length !== keysB.length)
|
|
11
|
-
return false;
|
|
12
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
13
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return true;
|
|
17
|
-
};
|
|
1
|
+
import { shallowEqual } from "@makeswift/controls";
|
|
18
2
|
var shallowEqual_default = shallowEqual;
|
|
19
3
|
export {
|
|
20
4
|
shallowEqual_default as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/shallowEqual.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/shallowEqual.ts"],"sourcesContent":["import { shallowEqual } from '@makeswift/controls'\n\nexport default shallowEqual\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,IAAO,uBAAQ;","names":[]}
|
|
@@ -227,12 +227,16 @@ export type DeserializedPanelControl<T extends Data = Data> = Extract<Deserializ
|
|
|
227
227
|
}>;
|
|
228
228
|
type DeserializedPanelControlValueType<T extends DeserializedPanelControl> = T extends DeserializedPanelControl<infer U> ? U : never;
|
|
229
229
|
export declare function serializeControl<T extends Data>(control: ControlDefinition<T>): [SerializedControl<T>, Transferable[]];
|
|
230
|
+
export declare function isSerializedControl(control: unknown): control is SerializedControl;
|
|
230
231
|
export declare function deserializeLegacyControl<T extends Data>(serializedControl: SerializedLegacyControl<T>): DeserializedControl<T>;
|
|
231
232
|
export declare function deserializeControl<T extends Data>(serializedControl: SerializedControl<T>): DeserializedControl<T>;
|
|
232
233
|
export declare function deserializeUnifiedControlDef(record: DeserializedRecord): UnifiedControlDefinition;
|
|
233
234
|
export declare function serializeControls(controls: Record<string, ControlDefinition>): [Record<string, SerializedControl>, Transferable[]];
|
|
234
|
-
export declare function deserializeControls(serializedControls: Record<string,
|
|
235
|
-
onError?: (err: Error
|
|
235
|
+
export declare function deserializeControls(serializedControls: Record<string, unknown>, { onError, }?: {
|
|
236
|
+
onError?: (err: Error, context: {
|
|
237
|
+
key: string;
|
|
238
|
+
serializedControl: unknown;
|
|
239
|
+
}) => void;
|
|
236
240
|
}): Record<string, DeserializedControl>;
|
|
237
241
|
export {};
|
|
238
242
|
//# sourceMappingURL=control-serialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-serialization.d.ts","sourceRoot":"","sources":["../../../../src/builder/serialization/control-serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,IAAI,EACJ,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EACjB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAC7C,KAAK,gBAAgB,EACrB,KAAK,aAAa,IAAI,oBAAoB,EAC3C,MAAM,qBAAqB,CAAA;AAuB5B,OAAO,EACL,IAAI,EACJ,MAAM,EAEN,mBAAmB,IAAI,gBAAgB,EAEvC,wBAAwB,IAAI,iBAAiB,EAC9C,MA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D;AAED,wBAAgB,mBAAmB,CACjC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACrD,EAAE,OAAO,EAAE,GAAE;IAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;CAAO,GACnD,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAqBrC"}
|
|
1
|
+
{"version":3,"file":"control-serialization.d.ts","sourceRoot":"","sources":["../../../../src/builder/serialization/control-serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,IAAI,EACJ,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EACjB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAC7C,KAAK,gBAAgB,EACrB,KAAK,aAAa,IAAI,oBAAoB,EAC3C,MAAM,qBAAqB,CAAA;AAuB5B,OAAO,EACL,IAAI,EACJ,MAAM,EAEN,mBAAmB,IAAI,gBAAgB,EAEvC,wBAAwB,IAAI,iBAAiB,EAC9C,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EACL,6BAA6B,EAC7B,cAAc,IAAI,WAAW,EAC7B,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,gBAAgB,EAC7B,eAAe,IAAI,YAAY,EAC/B,UAAU,IAAI,iBAAiB,EAC/B,mBAAmB,IAAI,gBAAgB,EACvC,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,IAAI,qBAAqB,EACvC,kBAAkB,IAAI,eAAe,EACtC,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EACL,oBAAoB,EAGpB,kBAAkB,EAEnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EACL,QAAQ,EACR,cAAc,IAAI,WAAW,EAC7B,sBAAsB,EACtB,KA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d.ts","sourceRoot":"","sources":["../../../../src/utils/__tests__/partition.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepEqual.d.ts","sourceRoot":"","sources":["../../../src/utils/deepEqual.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deepEqual.d.ts","sourceRoot":"","sources":["../../../src/utils/deepEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,eAAe,SAAS,CAAA"}
|
package/dist/types/utils/is.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../../src/utils/is.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../../src/utils/is.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAA;AAExC,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type Predicate<T, U extends T> = (value: T) => value is U;
|
|
2
|
+
/**
|
|
3
|
+
* Splits the array into two based on the predicate's result. Returns a tuple of arrays with
|
|
4
|
+
* matching and non-matching elements, maintaining the original order within each group.
|
|
5
|
+
*
|
|
6
|
+
* If the predicate includes a type assertion, the resulting arrays will be typed accordingly.
|
|
7
|
+
*/
|
|
8
|
+
export declare function partition<T, U extends T>(array: readonly T[], predicate: Predicate<T, U>): [U[], Exclude<T, U>[]];
|
|
9
|
+
export declare function partition<T>(array: readonly T[], predicate: (value: T) => boolean): [T[], T[]];
|
|
10
|
+
/**
|
|
11
|
+
* Splits the record into two based on the predicate's result. Returns a tuple of records with
|
|
12
|
+
* matching and non-matching elements.
|
|
13
|
+
*
|
|
14
|
+
* If the predicate includes a type assertion, the resulting records will be typed accordingly.
|
|
15
|
+
*/
|
|
16
|
+
export declare function partitionRecord<T, U extends T>(obj: Record<string, T>, predicate: Predicate<T, U>): [Record<string, U>, Record<string, Exclude<T, U>>];
|
|
17
|
+
export declare function partitionRecord<T>(obj: Record<string, T>, predicate: (value: T) => boolean): [Record<string, T>, Record<string, T>];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=partition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition.d.ts","sourceRoot":"","sources":["../../../src/utils/partition.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EACtC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;AAEzB,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;AAiB/F;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EAC5C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACtB,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAErD,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACtB,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAC/B,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shallowEqual.d.ts","sourceRoot":"","sources":["../../../src/utils/shallowEqual.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shallowEqual.d.ts","sourceRoot":"","sources":["../../../src/utils/shallowEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,eAAe,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makeswift/runtime",
|
|
3
|
-
"version": "0.20.4-canary.
|
|
3
|
+
"version": "0.20.4-canary.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -149,9 +149,9 @@
|
|
|
149
149
|
"use-sync-external-store": "^1.0.0-rc.0",
|
|
150
150
|
"uuid": "^9.0.0",
|
|
151
151
|
"zod": "^3.21.4",
|
|
152
|
-
"@makeswift/controls": "0.1.
|
|
152
|
+
"@makeswift/controls": "0.1.3-canary.0",
|
|
153
153
|
"@makeswift/next-plugin": "0.3.0",
|
|
154
|
-
"@makeswift/prop-controllers": "0.3.
|
|
154
|
+
"@makeswift/prop-controllers": "0.3.4-canary.0"
|
|
155
155
|
},
|
|
156
156
|
"devDependencies": {
|
|
157
157
|
"@emotion/jest": "^11.11.0",
|