@makeswift/prop-controllers 0.4.1 → 0.4.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/backgrounds/backgrounds.js +43 -25
- package/dist/cjs/backgrounds/backgrounds.js.map +1 -1
- package/dist/cjs/border/border.js +8 -1
- package/dist/cjs/border/border.js.map +1 -1
- package/dist/cjs/grid/grid.js +8 -1
- package/dist/cjs/grid/grid.js.map +1 -1
- package/dist/cjs/image/image.js +11 -3
- package/dist/cjs/image/image.js.map +1 -1
- package/dist/cjs/images/images.js +20 -8
- package/dist/cjs/images/images.js.map +1 -1
- package/dist/cjs/link/link.js +9 -6
- package/dist/cjs/link/link.js.map +1 -1
- package/dist/cjs/responsive-color/index.js +23 -0
- package/dist/cjs/responsive-color/index.js.map +1 -0
- package/dist/cjs/{responsive-color.js → responsive-color/responsive-color.js} +15 -4
- package/dist/cjs/responsive-color/responsive-color.js.map +1 -0
- package/dist/cjs/shadows/index.js +23 -0
- package/dist/cjs/shadows/index.js.map +1 -0
- package/dist/cjs/{shadows.js → shadows/shadows.js} +11 -3
- package/dist/cjs/shadows/shadows.js.map +1 -0
- package/dist/cjs/table/table.js +9 -4
- package/dist/cjs/table/table.js.map +1 -1
- package/dist/cjs/table-form-fields/table-form-fields.js +13 -2
- package/dist/cjs/table-form-fields/table-form-fields.js.map +1 -1
- package/dist/esm/backgrounds/backgrounds.js +52 -26
- package/dist/esm/backgrounds/backgrounds.js.map +1 -1
- package/dist/esm/border/border.js +14 -2
- package/dist/esm/border/border.js.map +1 -1
- package/dist/esm/grid/grid.js +12 -1
- package/dist/esm/grid/grid.js.map +1 -1
- package/dist/esm/image/image.js +15 -3
- package/dist/esm/image/image.js.map +1 -1
- package/dist/esm/images/images.js +24 -8
- package/dist/esm/images/images.js.map +1 -1
- package/dist/esm/link/link.js +15 -7
- package/dist/esm/link/link.js.map +1 -1
- package/dist/esm/responsive-color/index.js +2 -0
- package/dist/esm/responsive-color/index.js.map +1 -0
- package/dist/esm/{responsive-color.js → responsive-color/responsive-color.js} +19 -4
- package/dist/esm/responsive-color/responsive-color.js.map +1 -0
- package/dist/esm/shadows/index.js +2 -0
- package/dist/esm/shadows/index.js.map +1 -0
- package/dist/esm/{shadows.js → shadows/shadows.js} +15 -3
- package/dist/esm/shadows/shadows.js.map +1 -0
- package/dist/esm/table/table.js +13 -4
- package/dist/esm/table/table.js.map +1 -1
- package/dist/esm/table-form-fields/table-form-fields.js +17 -2
- package/dist/esm/table-form-fields/table-form-fields.js.map +1 -1
- package/dist/types/backgrounds/backgrounds.d.ts.map +1 -1
- package/dist/types/border/border.d.ts.map +1 -1
- package/dist/types/grid/grid.d.ts.map +1 -1
- package/dist/types/image/image.d.ts.map +1 -1
- package/dist/types/images/images.d.ts.map +1 -1
- package/dist/types/link/link.d.ts +1 -1
- package/dist/types/link/link.d.ts.map +1 -1
- package/dist/types/responsive-color/index.d.ts +2 -0
- package/dist/types/responsive-color/index.d.ts.map +1 -0
- package/dist/types/{responsive-color.d.ts → responsive-color/responsive-color.d.ts} +1 -1
- package/dist/types/responsive-color/responsive-color.d.ts.map +1 -0
- package/dist/types/responsive-color/responsive-color.test.d.ts +2 -0
- package/dist/types/responsive-color/responsive-color.test.d.ts.map +1 -0
- package/dist/types/shadows/index.d.ts +2 -0
- package/dist/types/shadows/index.d.ts.map +1 -0
- package/dist/types/{shadows.d.ts → shadows/shadows.d.ts} +1 -1
- package/dist/types/shadows/shadows.d.ts.map +1 -0
- package/dist/types/shadows/shadows.test.d.ts.map +1 -0
- package/dist/types/table/table.d.ts +1 -1
- package/dist/types/table/table.d.ts.map +1 -1
- package/dist/types/table-form-fields/table-form-fields.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/responsive-color.js.map +0 -1
- package/dist/cjs/shadows.js.map +0 -1
- package/dist/cjs/utils/utils.js +0 -42
- package/dist/cjs/utils/utils.js.map +0 -1
- package/dist/esm/responsive-color.js.map +0 -1
- package/dist/esm/shadows.js.map +0 -1
- package/dist/esm/utils/utils.js +0 -18
- package/dist/esm/utils/utils.js.map +0 -1
- package/dist/types/responsive-color.d.ts.map +0 -1
- package/dist/types/shadows.d.ts.map +0 -1
- package/dist/types/shadows.test.d.ts.map +0 -1
- package/dist/types/utils/utils.d.ts +0 -14
- package/dist/types/utils/utils.d.ts.map +0 -1
- /package/dist/types/{shadows.test.d.ts → shadows/shadows.test.d.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/grid/grid.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Element,\n MergeTranslatableDataContext,\n Options,\n Types,\n Schema,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\n\nconst gridColumnSchema = z.object({\n count: z.number(),\n spans: z.array(z.array(z.number())),\n})\n\nconst gridDataSchema = z.object({\n elements: z.array(Schema.element),\n columns: Schema.responsiveValue(gridColumnSchema),\n})\n\nexport type GridData = z.infer<typeof gridDataSchema>\n\nconst gridPropControllerDataV0Schema = gridDataSchema\n\nexport type GridPropControllerDataV0 = z.infer<\n typeof gridPropControllerDataV0Schema\n>\n\nexport const GridPropControllerDataV1Type = 'prop-controllers::grid::v1'\n\nconst gridPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(GridPropControllerDataV1Type),\n value: gridDataSchema,\n})\n\nexport type GridPropControllerDataV1 = z.infer<\n typeof gridPropControllerDataV1Schema\n>\n\nexport const gridPropControllerDataSchema = z.union([\n gridPropControllerDataV0Schema,\n gridPropControllerDataV1Schema,\n])\n\nexport type GridPropControllerData = z.infer<\n typeof gridPropControllerDataSchema\n>\n\nexport type GridOptions = Options<Record<string, never>>\n\ntype GridDescriptorV0<_T = GridPropControllerDataV0> = {\n type: typeof Types.Grid\n options: GridOptions\n}\n\ntype GridDescriptorV1<\n _T = GridPropControllerData,\n U extends GridOptions = GridOptions,\n> = {\n type: typeof Types.Grid\n version: 1\n options: U\n}\n\nexport type GridDescriptor<_T = GridPropControllerData> =\n | GridDescriptorV0\n | GridDescriptorV1\n\nexport type ResolveGridPropControllerValue<T extends GridDescriptor> =\n T extends GridDescriptor ? GridData | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Grid(options: GridOptions = {}): GridDescriptorV1 {\n return { type: Types.Grid, version: 1, options }\n}\n\nexport function getGridPropControllerDataGridData(\n data: GridPropControllerData | undefined,\n): GridData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: GridPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createGridPropControllerDataFromGridData(\n value: GridData,\n definition: GridDescriptor,\n): GridPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n P.nullish,\n () =>\n ({\n [ControlDataTypeKey]: GridPropControllerDataV1Type,\n value,\n }) as const,\n )\n .otherwise(() => value)\n}\n\nfunction mergeGridDataTranslatedData(\n data: GridData,\n context: MergeTranslatableDataContext,\n): GridData {\n return {\n ...data,\n elements: data.elements.map((element) =>\n context.mergeTranslatedData(element),\n ),\n }\n}\n\nexport function mergeGridPropControllerTranslatedData(\n data: GridPropControllerData,\n context: MergeTranslatableDataContext,\n): GridPropControllerData {\n return match(data)\n .with(\n { [ControlDataTypeKey]: GridPropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: GridPropControllerDataV1Type,\n value: mergeGridDataTranslatedData(v1.value, context),\n }) as const,\n )\n .otherwise((v0) => mergeGridDataTranslatedData(v0, context))\n}\n\nexport function getGridPropControllerElementChildren(\n data: GridPropControllerData | undefined,\n): Element[] {\n return getGridPropControllerDataGridData(data)?.elements ?? []\n}\n\nfunction copyGridData(data: GridData, context: CopyContext): GridData {\n return {\n ...data,\n elements: data.elements.map((
|
1
|
+
{"version":3,"sources":["../../../src/grid/grid.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Element,\n MergeTranslatableDataContext,\n Options,\n Types,\n Schema,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\nimport {\n isElementReference,\n ContextResource,\n shouldRemoveResource,\n} from '@makeswift/controls'\n\nconst gridColumnSchema = z.object({\n count: z.number(),\n spans: z.array(z.array(z.number())),\n})\n\nconst gridDataSchema = z.object({\n elements: z.array(Schema.element),\n columns: Schema.responsiveValue(gridColumnSchema),\n})\n\nexport type GridData = z.infer<typeof gridDataSchema>\n\nconst gridPropControllerDataV0Schema = gridDataSchema\n\nexport type GridPropControllerDataV0 = z.infer<\n typeof gridPropControllerDataV0Schema\n>\n\nexport const GridPropControllerDataV1Type = 'prop-controllers::grid::v1'\n\nconst gridPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(GridPropControllerDataV1Type),\n value: gridDataSchema,\n})\n\nexport type GridPropControllerDataV1 = z.infer<\n typeof gridPropControllerDataV1Schema\n>\n\nexport const gridPropControllerDataSchema = z.union([\n gridPropControllerDataV0Schema,\n gridPropControllerDataV1Schema,\n])\n\nexport type GridPropControllerData = z.infer<\n typeof gridPropControllerDataSchema\n>\n\nexport type GridOptions = Options<Record<string, never>>\n\ntype GridDescriptorV0<_T = GridPropControllerDataV0> = {\n type: typeof Types.Grid\n options: GridOptions\n}\n\ntype GridDescriptorV1<\n _T = GridPropControllerData,\n U extends GridOptions = GridOptions,\n> = {\n type: typeof Types.Grid\n version: 1\n options: U\n}\n\nexport type GridDescriptor<_T = GridPropControllerData> =\n | GridDescriptorV0\n | GridDescriptorV1\n\nexport type ResolveGridPropControllerValue<T extends GridDescriptor> =\n T extends GridDescriptor ? GridData | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Grid(options: GridOptions = {}): GridDescriptorV1 {\n return { type: Types.Grid, version: 1, options }\n}\n\nexport function getGridPropControllerDataGridData(\n data: GridPropControllerData | undefined,\n): GridData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: GridPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createGridPropControllerDataFromGridData(\n value: GridData,\n definition: GridDescriptor,\n): GridPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n P.nullish,\n () =>\n ({\n [ControlDataTypeKey]: GridPropControllerDataV1Type,\n value,\n }) as const,\n )\n .otherwise(() => value)\n}\n\nfunction mergeGridDataTranslatedData(\n data: GridData,\n context: MergeTranslatableDataContext,\n): GridData {\n return {\n ...data,\n elements: data.elements.map((element) =>\n context.mergeTranslatedData(element),\n ),\n }\n}\n\nexport function mergeGridPropControllerTranslatedData(\n data: GridPropControllerData,\n context: MergeTranslatableDataContext,\n): GridPropControllerData {\n return match(data)\n .with(\n { [ControlDataTypeKey]: GridPropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: GridPropControllerDataV1Type,\n value: mergeGridDataTranslatedData(v1.value, context),\n }) as const,\n )\n .otherwise((v0) => mergeGridDataTranslatedData(v0, context))\n}\n\nexport function getGridPropControllerElementChildren(\n data: GridPropControllerData | undefined,\n): Element[] {\n return getGridPropControllerDataGridData(data)?.elements ?? []\n}\n\nfunction copyGridData(data: GridData, context: CopyContext): GridData {\n return {\n ...data,\n elements: data.elements\n .filter(\n (el) =>\n !(\n isElementReference(el) &&\n shouldRemoveResource(\n ContextResource.GlobalElement,\n el.value,\n context,\n )\n ),\n )\n .map((el) => context.copyElement(el)),\n }\n}\n\nexport function copyGridPropControllerData(\n data: GridPropControllerData | undefined,\n context: CopyContext,\n): GridPropControllerData | undefined {\n return match(data)\n .with(undefined, () => undefined)\n .with(\n { [ControlDataTypeKey]: GridPropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: GridPropControllerDataV1Type,\n value: copyGridData(v1.value, context),\n }) as const,\n )\n .otherwise((v0) => copyGridData(v0, context))\n}\n\ntype Path = ReadonlyArray<string | number>\n\nexport function getGridPropControllerGetElementPath(\n data: GridPropControllerData | undefined,\n elementKey: string,\n): Path | null {\n const value = getGridPropControllerDataGridData(data)\n\n const idx =\n value?.elements.findIndex((element) => element.key === elementKey) ?? -1\n\n if (idx === -1) return null\n\n return match(data)\n .with({ [ControlDataTypeKey]: GridPropControllerDataV1Type }, (_v1) => [\n 'value',\n 'elements',\n idx,\n ])\n .otherwise((_v0) => ['elements', idx])\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAKA;AAAA,EACA;AAAA,OACK;AACP,SAAS,GAAG,aAAa;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,OAAO,EAAE,OAAO;AAAA,EAChB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,UAAU,EAAE,MAAM,OAAO,OAAO;AAAA,EAChC,SAAS,OAAO,gBAAgB,gBAAgB;AAClD,CAAC;AAID,MAAM,iCAAiC;AAMhC,MAAM,+BAA+B;AAE5C,MAAM,iCAAiC,EAAE,OAAO;AAAA,EAC9C,CAAC,kBAAkB,GAAG,EAAE,QAAQ,4BAA4B;AAAA,EAC5D,OAAO;AACT,CAAC;AAMM,MAAM,+BAA+B,EAAE,MAAM;AAAA,EAClD;AAAA,EACA;AACF,CAAC;AAiCM,SAAS,KAAK,UAAuB,CAAC,GAAqB;AAChE,SAAO,EAAE,MAAM,MAAM,MAAM,SAAS,GAAG,QAAQ;AACjD;AAEO,SAAS,kCACd,MACsB;AACtB,SAAO,MAAM,IAAI,EACd;AAAA,IACC,EAAE,CAAC,kBAAkB,GAAG,6BAA6B;AAAA,IACrD,CAAC,OAAO,GAAG;AAAA,EACb,EACC,UAAU,CAAC,OAAO,EAAE;AACzB;AAEO,SAAS,yCACd,OACA,YACwB;AACxB,SAAO,MAAM,UAAU,E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a,IAAI,OAAO,CAAC;AAChD;AAIO,SAAS,oCACd,MACA,YACa;AACb,QAAM,QAAQ,kCAAkC,IAAI;AAEpD,QAAM,MACJ,OAAO,SAAS,UAAU,CAAC,YAAY,QAAQ,QAAQ,UAAU,KAAK;AAExE,MAAI,QAAQ;AAAI,WAAO;AAEvB,SAAO,MAAM,IAAI,EACd,KAAK,EAAE,CAAC,kBAAkB,GAAG,6BAA6B,GAAG,CAAC,QAAQ;AAAA,IACrE;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACA,UAAU,CAAC,QAAQ,CAAC,YAAY,GAAG,CAAC;AACzC;","names":[]}
|
package/dist/esm/image/image.js
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
import { z } from "zod";
|
2
|
+
import {
|
3
|
+
ContextResource,
|
4
|
+
replaceResourceIfNeeded,
|
5
|
+
shouldRemoveResource
|
6
|
+
} from "@makeswift/controls";
|
2
7
|
import {
|
3
8
|
ControlDataTypeKey,
|
4
9
|
Types
|
@@ -42,10 +47,17 @@ function getImagePropControllerFileIds(data) {
|
|
42
47
|
const value = getImagePropControllerDataImageData(data);
|
43
48
|
return match(value).with(void 0, () => []).with(P.string, (v) => [v]).with({ type: "makeswift-file", version: 1 }, (v) => [v.id]).with({ type: "external-file", version: 1 }, () => []).exhaustive();
|
44
49
|
}
|
45
|
-
function copyImageData(data,
|
46
|
-
|
50
|
+
function copyImageData(data, ctx) {
|
51
|
+
const existingFileId = match(data).with(P.string, (v) => v).with({ type: "makeswift-file", version: 1 }, (v) => v.id).otherwise(() => void 0);
|
52
|
+
if (existingFileId != null && shouldRemoveResource(ContextResource.File, existingFileId, ctx)) {
|
53
|
+
return void 0;
|
54
|
+
}
|
55
|
+
return match(data).with(
|
56
|
+
P.string,
|
57
|
+
(v) => replaceResourceIfNeeded(ContextResource.File, v, ctx)
|
58
|
+
).with({ type: "makeswift-file", version: 1 }, (v) => ({
|
47
59
|
...v,
|
48
|
-
id:
|
60
|
+
id: replaceResourceIfNeeded(ContextResource.File, v.id, ctx)
|
49
61
|
})).otherwise((v) => v);
|
50
62
|
}
|
51
63
|
function copyImagePropControllerData(data, context) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/image/image.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\nimport {\n ImageData,\n ImageDataV0,\n imageDataSchema,\n imageDataV0Schema,\n} from '../data'\n\nconst imagePropControllerDataV0Schema = imageDataV0Schema\n\nconst imagePropControllerDataV1Schema = imageDataSchema\n\nexport const ImagePropControllerDataV2Type = 'prop-controllers::image::v2'\n\nconst imagePropControllerDataV2Schema = z.object({\n [ControlDataTypeKey]: z.literal(ImagePropControllerDataV2Type),\n value: imagePropControllerDataV1Schema,\n})\n\nexport type ImagePropControllerDataV2 = z.infer<\n typeof imagePropControllerDataV2Schema\n>\n\nexport const imagePropControllerDataSchema = z.union([\n imagePropControllerDataV0Schema,\n imagePropControllerDataV1Schema,\n imagePropControllerDataV2Schema,\n])\n\nexport type ImagePropControllerData = z.infer<\n typeof imagePropControllerDataSchema\n>\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\ntype ImageDescriptorV0<_T = ImageDataV0> = {\n type: typeof Types.Image\n options: ImageOptions\n}\n\ntype ImageDescriptorV1<_T = ImageData> = {\n type: typeof Types.Image\n version: 1\n options: ImageOptions\n}\n\ntype ImageDescriptorV2<_T = ImagePropControllerData> = {\n type: typeof Types.Image\n version: 2\n options: ImageOptions\n}\n\nexport type ImageDescriptor<_T = ImagePropControllerData> =\n | ImageDescriptorV0\n | ImageDescriptorV1\n | ImageDescriptorV2\n\nexport type ResolveImagePropControllerValue<T extends ImageDescriptor> =\n T extends ImageDescriptor ? ImageData | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Image(options: ImageOptions = {}): ImageDescriptorV2 {\n return { type: Types.Image, version: 2, options }\n}\n\nexport function getImagePropControllerDataImageData(\n data: ImagePropControllerData | undefined,\n): ImageData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: ImagePropControllerDataV2Type },\n (v2) => v2.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createImagePropControllerDataFromImageData(\n data: ImageData,\n definition: ImageDescriptor,\n): ImagePropControllerData {\n return match(definition)\n .with(\n { version: 2 },\n () =>\n ({\n [ControlDataTypeKey]: ImagePropControllerDataV2Type,\n value: data,\n } as const
|
1
|
+
{"version":3,"sources":["../../../src/image/image.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\nimport {\n ImageData,\n ImageDataV0,\n imageDataSchema,\n imageDataV0Schema,\n} from '../data'\n\nconst imagePropControllerDataV0Schema = imageDataV0Schema\n\nconst imagePropControllerDataV1Schema = imageDataSchema\n\nexport const ImagePropControllerDataV2Type = 'prop-controllers::image::v2'\n\nconst imagePropControllerDataV2Schema = z.object({\n [ControlDataTypeKey]: z.literal(ImagePropControllerDataV2Type),\n value: imagePropControllerDataV1Schema,\n})\n\nexport type ImagePropControllerDataV2 = z.infer<\n typeof imagePropControllerDataV2Schema\n>\n\nexport const imagePropControllerDataSchema = z.union([\n imagePropControllerDataV0Schema,\n imagePropControllerDataV1Schema,\n imagePropControllerDataV2Schema,\n])\n\nexport type ImagePropControllerData = z.infer<\n typeof imagePropControllerDataSchema\n>\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\ntype ImageDescriptorV0<_T = ImageDataV0> = {\n type: typeof Types.Image\n options: ImageOptions\n}\n\ntype ImageDescriptorV1<_T = ImageData> = {\n type: typeof Types.Image\n version: 1\n options: ImageOptions\n}\n\ntype ImageDescriptorV2<_T = ImagePropControllerData> = {\n type: typeof Types.Image\n version: 2\n options: ImageOptions\n}\n\nexport type ImageDescriptor<_T = ImagePropControllerData> =\n | ImageDescriptorV0\n | ImageDescriptorV1\n | ImageDescriptorV2\n\nexport type ResolveImagePropControllerValue<T extends ImageDescriptor> =\n T extends ImageDescriptor ? ImageData | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Image(options: ImageOptions = {}): ImageDescriptorV2 {\n return { type: Types.Image, version: 2, options }\n}\n\nexport function getImagePropControllerDataImageData(\n data: ImagePropControllerData | undefined,\n): ImageData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: ImagePropControllerDataV2Type },\n (v2) => v2.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createImagePropControllerDataFromImageData(\n data: ImageData,\n definition: ImageDescriptor,\n): ImagePropControllerData {\n return match(definition)\n .with(\n { version: 2 },\n () =>\n ({\n [ControlDataTypeKey]: ImagePropControllerDataV2Type,\n value: data,\n }) as const,\n )\n .otherwise(() => data)\n}\n\nexport function getImagePropControllerFileIds(\n data: ImagePropControllerData | undefined,\n): string[] {\n const value = getImagePropControllerDataImageData(data)\n\n return match(value)\n .with(undefined, () => [])\n .with(P.string, (v) => [v])\n .with({ type: 'makeswift-file', version: 1 }, (v) => [v.id])\n .with({ type: 'external-file', version: 1 }, () => [])\n .exhaustive()\n}\n\nfunction copyImageData(\n data: ImageData | undefined,\n ctx: CopyContext,\n): ImageData | undefined {\n const existingFileId = match(data)\n .with(P.string, (v) => v)\n .with({ type: 'makeswift-file', version: 1 }, (v) => v.id)\n .otherwise(() => undefined)\n\n if (\n existingFileId != null &&\n shouldRemoveResource(ContextResource.File, existingFileId, ctx)\n ) {\n return undefined\n }\n\n return match(data)\n .with(P.string, (v) =>\n replaceResourceIfNeeded(ContextResource.File, v, ctx),\n )\n .with({ type: 'makeswift-file', version: 1 }, (v) => ({\n ...v,\n id: replaceResourceIfNeeded(ContextResource.File, v.id, ctx),\n }))\n .otherwise((v) => v)\n}\n\nexport function copyImagePropControllerData(\n data: ImagePropControllerData | undefined,\n context: CopyContext,\n): ImagePropControllerData | undefined {\n return match(data)\n .with(undefined, () => undefined)\n .with({ [ControlDataTypeKey]: ImagePropControllerDataV2Type }, (v1) => {\n const value = copyImageData(v1.value, context)\n\n if (value == null) return undefined\n\n return {\n [ControlDataTypeKey]: ImagePropControllerDataV2Type,\n value,\n } as const\n })\n .otherwise((v0) => copyImageData(v0, context))\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP,SAAS,GAAG,aAAa;AACzB;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kCAAkC;AAExC,MAAM,kCAAkC;AAEjC,MAAM,gCAAgC;AAE7C,MAAM,kCAAkC,EAAE,OAAO;AAAA,EAC/C,CAAC,kBAAkB,GAAG,EAAE,QAAQ,6BAA6B;AAAA,EAC7D,OAAO;AACT,CAAC;AAMM,MAAM,gCAAgC,EAAE,MAAM;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAqCM,SAAS,MAAM,UAAwB,CAAC,GAAsB;AACnE,SAAO,EAAE,MAAM,MAAM,OAAO,SAAS,GAAG,QAAQ;AAClD;AAEO,SAAS,oCACd,MACuB;AACvB,SAAO,MAAM,IAAI,EACd;AAAA,IACC,EAAE,CAAC,kBAAkB,GAAG,8BAA8B;AAAA,IACtD,CAAC,OAAO,GAAG;AAAA,EACb,EACC,UAAU,CAAC,OAAO,EAAE;AACzB;AAEO,SAAS,2CACd,MACA,YACyB;AACzB,SAAO,MAAM,UAAU,EACpB;AAAA,IACC,EAAE,SAAS,EAAE;AAAA,IACb,OACG;AAAA,MACC,CAAC,kBAAkB,GAAG;AAAA,MACtB,OAAO;AAAA,IACT;AAAA,EACJ,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kBAAkB,GAAG;AAAA,MACtB;AAAA,IACF;AAAA,EACF,CAAC,EACA,UAAU,CAAC,OAAO,cAAc,IAAI,OAAO,CAAC;AACjD;","names":[]}
|
@@ -3,6 +3,11 @@ import {
|
|
3
3
|
ControlDataTypeKey,
|
4
4
|
Types
|
5
5
|
} from "../prop-controllers";
|
6
|
+
import {
|
7
|
+
ContextResource,
|
8
|
+
replaceResourceIfNeeded,
|
9
|
+
shouldRemoveResource
|
10
|
+
} from "@makeswift/controls";
|
6
11
|
import { P, match } from "ts-pattern";
|
7
12
|
import { imageDataV0Schema, imageDataV1Schema } from "../data";
|
8
13
|
import { linkDataSchema } from "../link";
|
@@ -75,10 +80,19 @@ function copyImagesData(data, context) {
|
|
75
80
|
...imagesPanelItem,
|
76
81
|
props: {
|
77
82
|
...imagesPanelItem.props,
|
78
|
-
file: match(imagesPanelItem.props.file).with({ type: "makeswift-file", version: 1 }, (f) =>
|
79
|
-
|
80
|
-
|
81
|
-
|
83
|
+
file: match(imagesPanelItem.props.file).with({ type: "makeswift-file", version: 1 }, (f) => {
|
84
|
+
if (shouldRemoveResource(ContextResource.File, f.id, context)) {
|
85
|
+
return void 0;
|
86
|
+
}
|
87
|
+
return {
|
88
|
+
...f,
|
89
|
+
id: replaceResourceIfNeeded(
|
90
|
+
ContextResource.File,
|
91
|
+
f.id,
|
92
|
+
context
|
93
|
+
)
|
94
|
+
};
|
95
|
+
}).otherwise((f) => f)
|
82
96
|
}
|
83
97
|
};
|
84
98
|
} else {
|
@@ -86,10 +100,12 @@ function copyImagesData(data, context) {
|
|
86
100
|
...imagesPanelItem,
|
87
101
|
props: {
|
88
102
|
...imagesPanelItem.props,
|
89
|
-
file: match(imagesPanelItem.props.file).with(
|
90
|
-
|
91
|
-
|
92
|
-
|
103
|
+
file: match(imagesPanelItem.props.file).with(P.string, (f) => {
|
104
|
+
if (shouldRemoveResource(ContextResource.File, f, context)) {
|
105
|
+
return void 0;
|
106
|
+
}
|
107
|
+
return replaceResourceIfNeeded(ContextResource.File, f, context);
|
108
|
+
}).otherwise((f) => f)
|
93
109
|
}
|
94
110
|
};
|
95
111
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/images/images.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\nimport { imageDataV0Schema, imageDataV1Schema } from '../data'\nimport { linkDataSchema } from '../link'\n\nconst imagesDataV0ItemSchema = z.object({\n key: z.string(),\n props: z.object({\n link: linkDataSchema.optional(),\n file: imageDataV0Schema.optional(),\n altText: z.string().optional(),\n }),\n})\n\nexport type ImagesDataV0Item = z.infer<typeof imagesDataV0ItemSchema>\n\nconst imagesDataV0Schema = z.array(imagesDataV0ItemSchema)\n\nexport type ImagesDataV0 = z.infer<typeof imagesDataV0Schema>\n\nconst imagesDataV1ItemSchema = z.object({\n key: z.string(),\n version: z.literal(1),\n props: z.object({\n link: linkDataSchema.optional(),\n file: imageDataV1Schema.optional(),\n altText: z.string().optional(),\n }),\n})\n\nexport type ImagesDataV1Item = z.infer<typeof imagesDataV1ItemSchema>\n\nconst imagesDataItemSchema = z.union([\n imagesDataV0ItemSchema,\n imagesDataV1ItemSchema,\n])\n\nexport type ImagesDataItem = z.infer<typeof imagesDataItemSchema>\n\nexport const imagesDataSchema = z.array(imagesDataItemSchema)\n\nexport type ImagesData = z.infer<typeof imagesDataSchema>\n\nconst imagesPropControllerDataV0Schema = z.array(imagesDataV0ItemSchema)\n\nconst imagesPropControllerDataV1Schema = imagesDataSchema\n\nexport const ImagesPropControllerDataV2Type = 'prop-controllers::images::v2'\n\nconst imagesPropControllerDataV2Schema = z.object({\n [ControlDataTypeKey]: z.literal(ImagesPropControllerDataV2Type),\n value: imagesPropControllerDataV1Schema,\n})\n\nexport type ImagesPropControllerDataV2 = z.infer<\n typeof imagesPropControllerDataV2Schema\n>\n\nexport const imagesPropControllerDataSchema = z.union([\n imagesPropControllerDataV0Schema,\n imagesPropControllerDataV1Schema,\n imagesPropControllerDataV2Schema,\n])\n\nexport type ImagesPropControllerData = z.infer<\n typeof imagesPropControllerDataSchema\n>\n\nexport type ImagesOptions = Options<{ preset?: ImagesPropControllerData }>\n\ntype ImagesDescriptorV0<_T = ImagesDataV0> = {\n type: typeof Types.Images\n options: ImagesOptions\n}\n\ntype ImagesDescriptorV1<_T = ImagesData> = {\n type: typeof Types.Images\n version: 1\n options: ImagesOptions\n}\n\ntype ImagesDescriptorV2<_T = ImagesPropControllerData> = {\n type: typeof Types.Images\n version: 2\n options: ImagesOptions\n}\n\nexport type ImagesDescriptor<_T = ImagesPropControllerData> =\n | ImagesDescriptorV0\n | ImagesDescriptorV1\n | ImagesDescriptorV2\n\nexport type ResolveImagesPropControllerValue<T extends ImagesDescriptor> =\n T extends ImagesDescriptor ? ImagesData | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Images(options: ImagesOptions = {}): ImagesDescriptorV2 {\n return { type: Types.Images, version: 2, options }\n}\n\nexport function getImagesPropControllerDataImagesData(\n data: ImagesPropControllerData | undefined,\n): ImagesData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: ImagesPropControllerDataV2Type },\n (v2) => v2.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createImagesPropControllerDataFromImagesData(\n data: ImagesData,\n definition: ImagesDescriptor,\n): ImagesPropControllerData {\n return match(definition)\n .with(\n { version: 2 },\n () =>\n ({\n [ControlDataTypeKey]: ImagesPropControllerDataV2Type,\n value: data,\n } as const
|
1
|
+
{"version":3,"sources":["../../../src/images/images.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\nimport {\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\nimport { P, match } from 'ts-pattern'\nimport { imageDataV0Schema, imageDataV1Schema } from '../data'\nimport { linkDataSchema } from '../link'\n\nconst imagesDataV0ItemSchema = z.object({\n key: z.string(),\n props: z.object({\n link: linkDataSchema.optional(),\n file: imageDataV0Schema.optional(),\n altText: z.string().optional(),\n }),\n})\n\nexport type ImagesDataV0Item = z.infer<typeof imagesDataV0ItemSchema>\n\nconst imagesDataV0Schema = z.array(imagesDataV0ItemSchema)\n\nexport type ImagesDataV0 = z.infer<typeof imagesDataV0Schema>\n\nconst imagesDataV1ItemSchema = z.object({\n key: z.string(),\n version: z.literal(1),\n props: z.object({\n link: linkDataSchema.optional(),\n file: imageDataV1Schema.optional(),\n altText: z.string().optional(),\n }),\n})\n\nexport type ImagesDataV1Item = z.infer<typeof imagesDataV1ItemSchema>\n\nconst imagesDataItemSchema = z.union([\n imagesDataV0ItemSchema,\n imagesDataV1ItemSchema,\n])\n\nexport type ImagesDataItem = z.infer<typeof imagesDataItemSchema>\n\nexport const imagesDataSchema = z.array(imagesDataItemSchema)\n\nexport type ImagesData = z.infer<typeof imagesDataSchema>\n\nconst imagesPropControllerDataV0Schema = z.array(imagesDataV0ItemSchema)\n\nconst imagesPropControllerDataV1Schema = imagesDataSchema\n\nexport const ImagesPropControllerDataV2Type = 'prop-controllers::images::v2'\n\nconst imagesPropControllerDataV2Schema = z.object({\n [ControlDataTypeKey]: z.literal(ImagesPropControllerDataV2Type),\n value: imagesPropControllerDataV1Schema,\n})\n\nexport type ImagesPropControllerDataV2 = z.infer<\n typeof imagesPropControllerDataV2Schema\n>\n\nexport const imagesPropControllerDataSchema = z.union([\n imagesPropControllerDataV0Schema,\n imagesPropControllerDataV1Schema,\n imagesPropControllerDataV2Schema,\n])\n\nexport type ImagesPropControllerData = z.infer<\n typeof imagesPropControllerDataSchema\n>\n\nexport type ImagesOptions = Options<{ preset?: ImagesPropControllerData }>\n\ntype ImagesDescriptorV0<_T = ImagesDataV0> = {\n type: typeof Types.Images\n options: ImagesOptions\n}\n\ntype ImagesDescriptorV1<_T = ImagesData> = {\n type: typeof Types.Images\n version: 1\n options: ImagesOptions\n}\n\ntype ImagesDescriptorV2<_T = ImagesPropControllerData> = {\n type: typeof Types.Images\n version: 2\n options: ImagesOptions\n}\n\nexport type ImagesDescriptor<_T = ImagesPropControllerData> =\n | ImagesDescriptorV0\n | ImagesDescriptorV1\n | ImagesDescriptorV2\n\nexport type ResolveImagesPropControllerValue<T extends ImagesDescriptor> =\n T extends ImagesDescriptor ? ImagesData | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Images(options: ImagesOptions = {}): ImagesDescriptorV2 {\n return { type: Types.Images, version: 2, options }\n}\n\nexport function getImagesPropControllerDataImagesData(\n data: ImagesPropControllerData | undefined,\n): ImagesData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: ImagesPropControllerDataV2Type },\n (v2) => v2.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createImagesPropControllerDataFromImagesData(\n data: ImagesData,\n definition: ImagesDescriptor,\n): ImagesPropControllerData {\n return match(definition)\n .with(\n { version: 2 },\n () =>\n ({\n [ControlDataTypeKey]: ImagesPropControllerDataV2Type,\n value: data,\n }) as const,\n )\n .otherwise(() => data)\n}\n\nexport function getImagesPropControllerFileIds(\n data: ImagesPropControllerData | undefined,\n): string[] {\n const value = getImagesPropControllerDataImagesData(data)\n\n return (\n value?.flatMap((item) =>\n match(item.props.file)\n .with(P.string, (f) => [f])\n .with({ type: 'makeswift-file', version: 1 }, (f) => [f.id])\n .with({ type: 'external-file', version: 1 }, () => [])\n .with(P.nullish, () => [])\n .otherwise(() => []),\n ) ?? []\n )\n}\n\nfunction copyImagesData(\n data: ImagesData | undefined,\n context: CopyContext,\n): ImagesData | undefined {\n if (data == null) return data\n\n return data.map(copyImagesPanelItem)\n\n function copyImagesPanelItem(\n imagesPanelItem: ImagesDataItem,\n ): ImagesDataItem {\n if ('version' in imagesPanelItem) {\n return {\n ...imagesPanelItem,\n props: {\n ...imagesPanelItem.props,\n file: match(imagesPanelItem.props.file)\n .with({ type: 'makeswift-file', version: 1 }, (f) => {\n if (shouldRemoveResource(ContextResource.File, f.id, context)) {\n return undefined\n }\n return {\n ...f,\n id: replaceResourceIfNeeded(\n ContextResource.File,\n f.id,\n context,\n ),\n }\n })\n .otherwise((f) => f),\n },\n }\n } else {\n return {\n ...imagesPanelItem,\n props: {\n ...imagesPanelItem.props,\n file: match(imagesPanelItem.props.file)\n .with(P.string, (f) => {\n if (shouldRemoveResource(ContextResource.File, f, context)) {\n return undefined\n }\n return replaceResourceIfNeeded(ContextResource.File, f, context)\n })\n .otherwise((f) => f),\n },\n }\n }\n }\n}\n\nexport function copyImagesPropControllerData(\n data: ImagesPropControllerData | undefined,\n context: CopyContext,\n): ImagesPropControllerData | undefined {\n return match(data)\n .with(undefined, () => undefined)\n .with({ [ControlDataTypeKey]: ImagesPropControllerDataV2Type }, (v1) => {\n const value = copyImagesData(v1.value, context)\n\n if (value == null) return undefined\n\n return {\n [ControlDataTypeKey]: ImagesPropControllerDataV2Type,\n value,\n } as const\n })\n .otherwise((v0) => copyImagesData(v0, context))\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,GAAG,aAAa;AACzB,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,sBAAsB;AAE/B,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,KAAK,EAAE,OAAO;AAAA,EACd,OAAO,EAAE,OAAO;AAAA,IACd,MAAM,eAAe,SAAS;AAAA,IAC9B,MAAM,kBAAkB,SAAS;AAAA,IACjC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,CAAC;AACH,CAAC;AAID,MAAM,qBAAqB,EAAE,MAAM,sBAAsB;AAIzD,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,KAAK,E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;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,6BACd,MACA,SACsC;AACtC,SAAO,MAAM,IAAI,EACd,KAAK,QAAW,MAAM,MAAS,EAC/B,KAAK,EAAE,CAAC,kBAAkB,GAAG,+BAA+B,GAAG,CAAC,OAAO;AACtE,UAAM,QAAQ,eAAe,GAAG,OAAO,OAAO;AAE9C,QAAI,SAAS;AAAM,aAAO;AAE1B,WAAO;AAAA,MACL,CAAC,kBAAkB,GAAG;AAAA,MACtB;AAAA,IACF;AAAA,EACF,CAAC,EACA,UAAU,CAAC,OAAO,eAAe,IAAI,OAAO,CAAC;AAClD;","names":[]}
|
package/dist/esm/link/link.js
CHANGED
@@ -3,7 +3,12 @@ import {
|
|
3
3
|
ControlDataTypeKey,
|
4
4
|
Types
|
5
5
|
} from "../prop-controllers";
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
LinkDefinition,
|
8
|
+
ContextResource,
|
9
|
+
replaceResourceIfNeeded,
|
10
|
+
shouldRemoveResource
|
11
|
+
} from "@makeswift/controls";
|
7
12
|
import { z } from "zod";
|
8
13
|
const linkDataSchema = LinkDefinition.schema.link;
|
9
14
|
const linkPropControllerDataV0Schema = linkDataSchema;
|
@@ -45,8 +50,14 @@ function getLinkPropControllerPageIds(linkData) {
|
|
45
50
|
return [];
|
46
51
|
}
|
47
52
|
}
|
48
|
-
function copyLinkData(data,
|
53
|
+
function copyLinkData(data, ctx) {
|
49
54
|
let value = data;
|
55
|
+
function replacePageId(pageId) {
|
56
|
+
if (shouldRemoveResource(ContextResource.Page, pageId, ctx)) {
|
57
|
+
return void 0;
|
58
|
+
}
|
59
|
+
return replaceResourceIfNeeded(ContextResource.Page, pageId, ctx);
|
60
|
+
}
|
50
61
|
switch (value?.type) {
|
51
62
|
case "OPEN_PAGE":
|
52
63
|
{
|
@@ -55,10 +66,7 @@ function copyLinkData(data, context) {
|
|
55
66
|
return value;
|
56
67
|
value = {
|
57
68
|
...value,
|
58
|
-
payload: {
|
59
|
-
...value.payload,
|
60
|
-
pageId: context.replacementContext.pageIds.get(pageId) ?? pageId
|
61
|
-
}
|
69
|
+
payload: { ...value.payload, pageId: replacePageId(pageId) }
|
62
70
|
};
|
63
71
|
}
|
64
72
|
break;
|
@@ -72,7 +80,7 @@ function copyLinkData(data, context) {
|
|
72
80
|
...value.payload,
|
73
81
|
elementIdConfig: {
|
74
82
|
...elementIdConfig,
|
75
|
-
elementKey:
|
83
|
+
elementKey: ctx.replacementContext.elementKeys.get(
|
76
84
|
elementIdConfig.elementKey
|
77
85
|
) ?? elementIdConfig.elementKey
|
78
86
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/link/link.ts"],"sourcesContent":["import { match } from 'ts-pattern'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\n\nimport {
|
1
|
+
{"version":3,"sources":["../../../src/link/link.ts"],"sourcesContent":["import { match } from 'ts-pattern'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\n\nimport {\n LinkDefinition,\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\n\nimport { z } from 'zod'\n\nexport const linkDataSchema = LinkDefinition.schema.link\n\nexport type LinkData = z.infer<typeof linkDataSchema>\n\nconst linkPropControllerDataV0Schema = linkDataSchema\n\nexport type LinkPropControllerDataV0 = z.infer<\n typeof linkPropControllerDataV0Schema\n>\n\nexport const LinkPropControllerDataV1Type = 'prop-controllers::link::v1'\nconst linkPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(LinkPropControllerDataV1Type),\n value: linkDataSchema,\n})\n\nexport type LinkPropControllerDataV1 = z.infer<\n typeof linkPropControllerDataV1Schema\n>\n\nexport const linkPropControllerDataSchema = z.union([\n linkPropControllerDataV0Schema,\n linkPropControllerDataV1Schema,\n])\n\nexport type LinkPropControllerData = z.infer<\n typeof linkPropControllerDataSchema\n>\n\ntype LinkOptions = Options<{\n preset?: LinkPropControllerData\n label?: string\n defaultValue?: LinkData\n options?: { value: LinkData['type']; label: string }[]\n hidden?: boolean\n}>\n\ntype LinkDescriptorV0<\n _T = LinkPropControllerDataV0,\n U extends LinkOptions = LinkOptions,\n> = {\n type: typeof Types.Link\n options: U\n}\n\ntype LinkDescriptorV1<\n _T = LinkPropControllerData,\n U extends LinkOptions = LinkOptions,\n> = {\n type: typeof Types.Link\n version: 1\n options: U\n}\n\nexport type LinkDescriptor<\n _T = LinkPropControllerData,\n U extends LinkOptions = LinkOptions,\n> = LinkDescriptorV0<_T, U> | LinkDescriptorV1<_T, U>\n\nexport type ResolveLinkPropControllerValue<T extends LinkDescriptor> =\n T extends LinkDescriptor ? LinkData | undefined : never\n\n/**\n * @deprecated Imports from `@makeswift/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Link(options: LinkOptions = {}): LinkDescriptor {\n return { type: Types.Link, version: 1, options }\n}\n\nexport function getLinkPropControllerDataLinkData(\n data: LinkPropControllerData,\n): LinkData {\n return match(data)\n .with(\n { [ControlDataTypeKey]: LinkPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createLinkPropControllerDataFromLinkData(\n value: LinkData,\n definition: LinkDescriptor,\n): LinkPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n () =>\n ({\n [ControlDataTypeKey]: LinkPropControllerDataV1Type,\n value,\n }) as const,\n )\n .otherwise(() => value)\n}\n\nexport function getLinkPropControllerPageIds(\n linkData: LinkPropControllerData | null | undefined,\n): string[] {\n if (linkData == null) return []\n\n const link = getLinkPropControllerDataLinkData(linkData)\n\n switch (link.type) {\n case 'OPEN_PAGE':\n return link.payload.pageId == null ? [] : [link.payload.pageId]\n\n default:\n return []\n }\n}\n\nexport function copyLinkData(\n data: LinkData | undefined,\n ctx: CopyContext,\n): LinkData | undefined {\n let value = data\n\n function replacePageId(pageId: string): string | undefined {\n if (shouldRemoveResource(ContextResource.Page, pageId, ctx)) {\n return undefined\n }\n return replaceResourceIfNeeded(ContextResource.Page, pageId, ctx)\n }\n\n switch (value?.type) {\n case 'OPEN_PAGE':\n {\n const pageId = value.payload.pageId\n\n if (pageId == null) return value\n\n value = {\n ...value,\n payload: { ...value.payload, pageId: replacePageId(pageId) },\n }\n }\n break\n\n case 'SCROLL_TO_ELEMENT': {\n const elementIdConfig = value.payload.elementIdConfig\n\n if (elementIdConfig == null) return value\n\n value = {\n ...value,\n payload: {\n ...value.payload,\n elementIdConfig: {\n ...elementIdConfig,\n elementKey:\n ctx.replacementContext.elementKeys.get(\n elementIdConfig.elementKey,\n ) ?? elementIdConfig.elementKey,\n },\n },\n }\n break\n }\n }\n\n return value\n}\n\nexport function copyLinkPropControllerData(\n data: LinkPropControllerData | undefined,\n context: CopyContext,\n): LinkPropControllerData | undefined {\n if (data == null) return data\n\n const value = copyLinkData(getLinkPropControllerDataLinkData(data), context)\n\n if (value == null) return value\n\n return match(data)\n .with({ [ControlDataTypeKey]: LinkPropControllerDataV1Type }, (v1) => ({\n ...v1,\n value,\n }))\n .otherwise((_) => value)\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS;AAEX,MAAM,iBAAiB,eAAe,OAAO;AAIpD,MAAM,iCAAiC;AAMhC,MAAM,+BAA+B;AAC5C,MAAM,iCAAiC,EAAE,OAAO;AAAA,EAC9C,CAAC,kBAAkB,GAAG,EAAE,QAAQ,4BAA4B;AAAA,EAC5D,OAAO;AACT,CAAC;AAMM,MAAM,+BAA+B,EAAE,MAAM;AAAA,EAClD;AAAA,EACA;AACF,CAAC;AA2CM,SAAS,KAAK,UAAuB,CAAC,GAAmB;AAC9D,SAAO,EAAE,MAAM,MAAM,MAAM,SAAS,GAAG,QAAQ;AACjD;AAEO,SAAS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AAAA,UACT,iBAAiB;AAAA,YACf,GAAG;AAAA,YACH,YACE,IAAI,mBAAmB,YAAY;AAAA,cACjC,gBAAgB;AAAA,YAClB,KAAK,gBAAgB;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,2BACd,MACA,SACoC;AACpC,MAAI,QAAQ;AAAM,WAAO;AAEzB,QAAM,QAAQ,aAAa,kCAAkC,IAAI,GAAG,OAAO;AAE3E,MAAI,SAAS;AAAM,WAAO;AAE1B,SAAO,MAAM,IAAI,EACd,KAAK,EAAE,CAAC,kBAAkB,GAAG,6BAA6B,GAAG,CAAC,QAAQ;AAAA,IACrE,GAAG;AAAA,IACH;AAAA,EACF,EAAE,EACD,UAAU,CAAC,MAAM,KAAK;AAC3B;","names":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/responsive-color/index.ts"],"sourcesContent":["export * from './responsive-color'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import { z } from "zod";
|
2
|
-
import { colorDataSchema } from "
|
2
|
+
import { colorDataSchema } from "../data";
|
3
3
|
import {
|
4
4
|
ControlDataTypeKey,
|
5
5
|
Types,
|
6
6
|
Schema
|
7
|
-
} from "
|
7
|
+
} from "../prop-controllers";
|
8
8
|
import { match } from "ts-pattern";
|
9
|
+
import {
|
10
|
+
ContextResource,
|
11
|
+
replaceResourceIfNeeded,
|
12
|
+
shouldRemoveResource
|
13
|
+
} from "@makeswift/controls";
|
9
14
|
const responsiveColorDataSchema = Schema.responsiveValue(colorDataSchema);
|
10
15
|
const responsiveColorPropControllerDataV0Schema = responsiveColorDataSchema;
|
11
16
|
const ResponsiveColorPropControllerDataV1Type = "prop-controllers::responsive-color::v1";
|
@@ -46,14 +51,24 @@ function getResponsiveColorPropControllerDataSwatchIds(data) {
|
|
46
51
|
);
|
47
52
|
}
|
48
53
|
function copyResponsiveColorData(data, context) {
|
49
|
-
return data.
|
54
|
+
return data.filter(
|
55
|
+
(override) => !shouldRemoveResource(
|
56
|
+
ContextResource.Swatch,
|
57
|
+
override.value.swatchId,
|
58
|
+
context
|
59
|
+
)
|
60
|
+
).map((override) => ({
|
50
61
|
...override,
|
51
62
|
value: copyColorValue(override.value)
|
52
63
|
}));
|
53
64
|
function copyColorValue(colorValue) {
|
54
65
|
return {
|
55
66
|
...colorValue,
|
56
|
-
swatchId:
|
67
|
+
swatchId: replaceResourceIfNeeded(
|
68
|
+
ContextResource.Swatch,
|
69
|
+
colorValue.swatchId,
|
70
|
+
context
|
71
|
+
)
|
57
72
|
};
|
58
73
|
}
|
59
74
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/responsive-color/responsive-color.ts"],"sourcesContent":["import { z } from 'zod'\nimport { colorDataSchema } from '../data'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n Schema,\n} from '../prop-controllers'\nimport { match } from 'ts-pattern'\nimport {\n ColorData,\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\n\nconst responsiveColorDataSchema = Schema.responsiveValue(colorDataSchema)\n\nexport type ResponsiveColorData = z.infer<typeof responsiveColorDataSchema>\n\nconst responsiveColorPropControllerDataV0Schema = responsiveColorDataSchema\n\ntype ResponsiveColorPropControllerDataV0 = z.infer<\n typeof responsiveColorPropControllerDataV0Schema\n>\n\nconst ResponsiveColorPropControllerDataV1Type =\n 'prop-controllers::responsive-color::v1'\n\nconst responsiveColorPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(ResponsiveColorPropControllerDataV1Type),\n value: responsiveColorDataSchema,\n})\n\ntype ResponsiveColorPropControllerDataV1 = z.infer<\n typeof responsiveColorPropControllerDataV1Schema\n>\n\nexport const responsiveColorPropControllerDataSchema = z.union([\n responsiveColorPropControllerDataV0Schema,\n responsiveColorPropControllerDataV1Schema,\n])\n\nexport type ResponsiveColorPropControllerData = z.infer<\n typeof responsiveColorPropControllerDataSchema\n>\n\nexport type ResponsiveColorOptions = Options<{\n label?: string\n placeholder?: string\n hidden?: boolean\n}>\n\ntype ResponsiveColorDescriptorV0<_T = ResponsiveColorPropControllerDataV0> = {\n type: typeof Types.ResponsiveColor\n options: ResponsiveColorOptions\n}\n\ntype ResponsiveColorDescriptorV1<_T = ResponsiveColorPropControllerDataV1> = {\n type: typeof Types.ResponsiveColor\n version: 1\n options: ResponsiveColorOptions\n}\n\nexport type ResponsiveColorDescriptor<_T = ResponsiveColorPropControllerData> =\n | ResponsiveColorDescriptorV0\n | ResponsiveColorDescriptorV1\n\n/**\n * @deprecated Imports from `@makeswift/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveColor(\n options: ResponsiveColorOptions = {},\n): ResponsiveColorDescriptorV1 {\n return { type: Types.ResponsiveColor, version: 1, options }\n}\n\nexport function getResponsiveColorPropControllerDataResponsiveColorData(\n data: ResponsiveColorPropControllerData,\n): ResponsiveColorData {\n return match(data)\n .with(\n { [ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createResponsiveColorPropControllerDataFromResponsiveColorData(\n definition: ResponsiveColorDescriptor,\n responsiveColorData: ResponsiveColorData,\n): ResponsiveColorPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n () =>\n ({\n [ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type,\n value: responsiveColorData,\n }) as const,\n )\n .otherwise(() => responsiveColorData)\n}\n\nexport function getResponsiveColorDataSwatchIds(\n data: ResponsiveColorData,\n): string[] {\n return data.map((override) => override.value.swatchId)\n}\n\nexport function getResponsiveColorPropControllerDataSwatchIds(\n data: ResponsiveColorPropControllerData | undefined | null,\n): string[] {\n if (data == null) return []\n\n return getResponsiveColorDataSwatchIds(\n getResponsiveColorPropControllerDataResponsiveColorData(data),\n )\n}\n\nexport function copyResponsiveColorData(\n data: ResponsiveColorData,\n context: CopyContext,\n): ResponsiveColorData {\n return data\n .filter(\n (override) =>\n !shouldRemoveResource(\n ContextResource.Swatch,\n override.value.swatchId,\n context,\n ),\n )\n .map((override) => ({\n ...override,\n value: copyColorValue(override.value),\n }))\n\n function copyColorValue(colorValue: ColorData): ColorData {\n return {\n ...colorValue,\n swatchId: replaceResourceIfNeeded(\n ContextResource.Swatch,\n colorValue.swatchId,\n context,\n ),\n }\n }\n}\n\nexport function copyResponsiveColorPropControllerData(\n data: ResponsiveColorPropControllerData | undefined,\n context: CopyContext,\n): ResponsiveColorPropControllerData | undefined {\n return match(data)\n .with(undefined, () => undefined)\n .with(\n { [ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type,\n value: copyResponsiveColorData(v1.value, context),\n }) as const,\n )\n .otherwise((v0) => copyResponsiveColorData(v0, context))\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,4BAA4B,OAAO,gBAAgB,eAAe;AAIxE,MAAM,4CAA4C;AAMlD,MAAM,0CACJ;AAEF,MAAM,4CAA4C,EAAE,OAAO;AAAA,EACzD,CAAC,kBAAkB,GAAG,EAAE,QAAQ,uCAAuC;AAAA,EACvE,OAAO;AACT,CAAC;AAMM,MAAM,0CAA0C,EAAE,MAAM;AAAA,EAC7D;AAAA,EACA;AACF,CAAC;AA+BM,SAAS,gBACd,UAAkC,CAAC,GACN;AAC7B,SAAO,EAAE,MAAM,MAAM,iBAAiB,SAAS,GAAG,QAAQ;AAC5D;AAEO,SAAS,wDACd,MACqB;AACrB,SAAO,MAAM,IAAI,EACd;AAAA,IACC,EAAE,CAAC,kBAAkB,GAA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 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/shadows/index.ts"],"sourcesContent":["export * from './shadows'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import { match } from "ts-pattern";
|
2
|
-
import { colorDataSchema } from "
|
2
|
+
import { colorDataSchema } from "../data";
|
3
3
|
import {
|
4
4
|
ControlDataTypeKey,
|
5
5
|
Types,
|
6
6
|
Schema
|
7
|
-
} from "
|
7
|
+
} from "../prop-controllers";
|
8
8
|
import { z } from "zod";
|
9
|
+
import {
|
10
|
+
ContextResource,
|
11
|
+
replaceResourceIfNeeded,
|
12
|
+
shouldRemoveResource
|
13
|
+
} from "@makeswift/controls";
|
9
14
|
const shadowDataSchema = z.object({
|
10
15
|
color: colorDataSchema.nullable().optional(),
|
11
16
|
blurRadius: z.number().optional(),
|
@@ -66,13 +71,20 @@ function copyResponsiveShadowsData(data, context) {
|
|
66
71
|
const { color } = item.payload;
|
67
72
|
if (color == null)
|
68
73
|
return item;
|
74
|
+
if (shouldRemoveResource(ContextResource.Swatch, color.swatchId, context)) {
|
75
|
+
return { ...item, payload: { ...item.payload, color: void 0 } };
|
76
|
+
}
|
69
77
|
return {
|
70
78
|
...item,
|
71
79
|
payload: {
|
72
80
|
...item.payload,
|
73
81
|
color: {
|
74
82
|
...color,
|
75
|
-
swatchId:
|
83
|
+
swatchId: replaceResourceIfNeeded(
|
84
|
+
ContextResource.Swatch,
|
85
|
+
color.swatchId,
|
86
|
+
context
|
87
|
+
)
|
76
88
|
}
|
77
89
|
}
|
78
90
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/shadows/shadows.ts"],"sourcesContent":["import { match } from 'ts-pattern'\nimport { colorDataSchema } from '../data'\nimport {\n ControlDataTypeKey,\n CopyContext,\n ResolveOptions,\n Types,\n Schema,\n} from '../prop-controllers'\nimport { z } from 'zod'\nimport {\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\n\nconst shadowDataSchema = z.object({\n color: colorDataSchema.nullable().optional(),\n blurRadius: z.number().optional(),\n spreadRadius: z.number().optional(),\n offsetX: z.number().optional(),\n offsetY: z.number().optional(),\n inset: z.boolean().optional(),\n})\n\nexport type ShadowData = z.infer<typeof shadowDataSchema>\n\nconst shadowsDataSchema = z.array(\n z.object({\n id: z.string(),\n payload: shadowDataSchema,\n }),\n)\n\nexport type ShadowsData = z.infer<typeof shadowsDataSchema>\n\nconst responsiveShadowsDataSchema = Schema.responsiveValue(shadowsDataSchema)\n\ntype ResponsiveShadowsData = z.infer<typeof responsiveShadowsDataSchema>\n\nconst shadowsPropControllerDataV0Schema = responsiveShadowsDataSchema\n\ntype ShadowsPropControllerDataV0 = z.infer<\n typeof shadowsPropControllerDataV0Schema\n>\n\nconst ShadowsPropControllerDataV1Type = 'prop-controllers::shadows::v1'\n\nconst shadowsPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(ShadowsPropControllerDataV1Type),\n value: responsiveShadowsDataSchema,\n})\n\nexport const shadowsPropControllerDataSchema = z.union([\n shadowsPropControllerDataV0Schema,\n shadowsPropControllerDataV1Schema,\n])\n\nexport type ShadowsPropControllerData = z.infer<\n typeof shadowsPropControllerDataSchema\n>\n\nexport const ShadowsPropControllerFormat = {\n ClassName: 'makeswift::prop-controllers::shadows::format::class-name',\n ResponsiveValue:\n 'makeswift::prop-controllers::shadows::format::responsive-value',\n} as const\n\nexport type ShadowsPropControllerFormat =\n (typeof ShadowsPropControllerFormat)[keyof typeof ShadowsPropControllerFormat]\n\ntype ShadowsOptions = { format?: ShadowsPropControllerFormat }\n\ntype ShadowsDescriptorV0<\n _T = ShadowsPropControllerDataV0,\n U extends ShadowsOptions = ShadowsOptions,\n> = {\n type: typeof Types.Shadows\n options: U\n}\n\ntype ShadowsDescriptorV1<\n _T = ShadowsPropControllerData,\n U extends ShadowsOptions = ShadowsOptions,\n> = {\n type: typeof Types.Shadows\n version: 1\n options: U\n}\n\nexport type ShadowsDescriptor<\n _T = ShadowsPropControllerData,\n U extends ShadowsOptions = ShadowsOptions,\n> = ShadowsDescriptorV0<_T, U> | ShadowsDescriptorV1<_T, U>\n\nexport type ResolveShadowsPropControllerValue<T extends ShadowsDescriptor> =\n T extends ShadowsDescriptor\n ? undefined extends ResolveOptions<T['options']>['format']\n ? ResponsiveShadowsData | undefined\n : ResolveOptions<\n T['options']\n >['format'] extends typeof ShadowsPropControllerFormat.ClassName\n ? string\n : ResolveOptions<\n T['options']\n >['format'] extends typeof ShadowsPropControllerFormat.ResponsiveValue\n ? ResponsiveShadowsData | undefined\n : never\n : never\n\n/**\n * @deprecated Imports from `@makeswift/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Shadows<T extends ShadowsOptions>(\n options: T & ShadowsOptions = {} as T,\n): ShadowsDescriptor<ShadowsPropControllerData, T> {\n return { type: Types.Shadows, version: 1, options }\n}\n\nShadows.Format = ShadowsPropControllerFormat\n\nexport function getShadowsPropControllerDataResponsiveShadowsData(\n data: ShadowsPropControllerData | null | undefined,\n): ResponsiveShadowsData | null | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: ShadowsPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createShadowsPropControllerDataFromResponsiveShadowsData(\n definition: ShadowsDescriptor,\n responsiveShadowsData: ResponsiveShadowsData,\n): ShadowsPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n () =>\n ({\n [ControlDataTypeKey]: ShadowsPropControllerDataV1Type,\n value: responsiveShadowsData,\n }) as const,\n )\n .otherwise(() => responsiveShadowsData)\n}\n\nexport function getShadowsPropControllerDataSwatchIds(\n data: ShadowsPropControllerData | null | undefined,\n): string[] {\n return (\n getShadowsPropControllerDataResponsiveShadowsData(data)\n ?.flatMap((override) => override.value)\n .map((item) => item.payload.color?.swatchId)\n .filter(\n (swatchId): swatchId is NonNullable<typeof swatchId> =>\n swatchId != null,\n ) ?? []\n )\n}\n\nfunction copyResponsiveShadowsData(\n data: ResponsiveShadowsData,\n context: CopyContext,\n): ResponsiveShadowsData {\n return data.map((override) => ({\n ...override,\n value: override.value.map((item) => {\n const { color } = item.payload\n\n if (color == null) return item\n\n if (\n shouldRemoveResource(ContextResource.Swatch, color.swatchId, context)\n ) {\n return { ...item, payload: { ...item.payload, color: undefined } }\n }\n\n return {\n ...item,\n payload: {\n ...item.payload,\n color: {\n ...color,\n swatchId: replaceResourceIfNeeded(\n ContextResource.Swatch,\n color.swatchId,\n context,\n ),\n },\n },\n }\n }),\n }))\n}\n\nexport function copyShadowsPropControllerData(\n data: ShadowsPropControllerData | undefined,\n context: CopyContext,\n): ShadowsPropControllerData | undefined {\n return match(data)\n .with(undefined, () => undefined)\n .with(\n { [ControlDataTypeKey]: ShadowsPropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: ShadowsPropControllerDataV1Type,\n value: copyResponsiveShadowsData(v1.value, context),\n }) as const,\n )\n .otherwise((v0) => copyResponsiveShadowsData(v0, context))\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,OAAO,gBAAgB,SAAS,EAAE,SAAS;AAAA,EAC3C,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA,EAClC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,OAAO,EAAE,QAAQ,EAAE,SAAS;AAC9B,CAAC;AAID,MAAM,oBAAoB,EAAE;AAAA,EAC1B,EAAE,OAAO;AAAA,IACP,IAAI,EAAE,OAAO;AAAA,IACb,S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AAEvB,UAAI,SAAS;AAAM,eAAO;AAE1B,UACE,qBAAqB,gBAAgB,QAAQ,MAAM,UAAU,OAAO,GACpE;AACA,eAAO,EAAE,GAAG,MAAM,SAAS,EAAE,GAAG,KAAK,SAAS,OAAO,OAAU,EAAE;AAAA,MACnE;AAEA,aAAO;AAAA,QACL,GAAG;AAAA,QACH,SAAS;AAAA,UACP,GAAG,KAAK;AAAA,UACR,OAAO;AAAA,YACL,GAAG;AAAA,YACH,UAAU;AAAA,cACR,gBAAgB;AAAA,cAChB,MAAM;AAAA,cACN;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,EAAE;AACJ;AAEO,SAAS,8BACd,MACA,SACuC;AACvC,SAAO,MAAM,IAAI,EACd,KAAK,QAAW,MAAM,MAAS,EAC/B;AAAA,IACC,EAAE,CAAC,kBAAkB,GAAG,gCAAgC;AAAA,IACxD,CAAC,QACE;AAAA,MACC,CAAC,kBAAkB,GAAG;AAAA,MACtB,OAAO,0BAA0B,GAAG,OAAO,OAAO;AAAA,IACpD;AAAA,EACJ,EACC,UAAU,CAAC,OAAO,0BAA0B,IAAI,OAAO,CAAC;AAC7D;","names":[]}
|
package/dist/esm/table/table.js
CHANGED
@@ -3,6 +3,11 @@ import {
|
|
3
3
|
ControlDataTypeKey,
|
4
4
|
Types
|
5
5
|
} from "../prop-controllers";
|
6
|
+
import {
|
7
|
+
ContextResource,
|
8
|
+
replaceResourceIfNeeded,
|
9
|
+
shouldRemoveResource
|
10
|
+
} from "@makeswift/controls";
|
6
11
|
import { P, match } from "ts-pattern";
|
7
12
|
const tableIdSchema = z.string();
|
8
13
|
const tablePropControllerDataV0Schema = tableIdSchema;
|
@@ -37,16 +42,20 @@ function createTablePropControllerDataFromTableId(value, definition) {
|
|
37
42
|
function copyTableId(data, context) {
|
38
43
|
if (data == null)
|
39
44
|
return data;
|
40
|
-
return
|
45
|
+
return replaceResourceIfNeeded(ContextResource.Table, data, context);
|
41
46
|
}
|
42
|
-
function copyTablePropControllerData(data,
|
47
|
+
function copyTablePropControllerData(data, ctx) {
|
48
|
+
const currentTableId = getTablePropControllerDataTableId(data);
|
49
|
+
if (currentTableId != null && shouldRemoveResource(ContextResource.Table, currentTableId, ctx)) {
|
50
|
+
return void 0;
|
51
|
+
}
|
43
52
|
return match(data).with(void 0, () => void 0).with(
|
44
53
|
{ [ControlDataTypeKey]: TablePropControllerDataV1Type },
|
45
54
|
(v1) => ({
|
46
55
|
[ControlDataTypeKey]: TablePropControllerDataV1Type,
|
47
|
-
value: copyTableId(v1.value,
|
56
|
+
value: copyTableId(v1.value, ctx)
|
48
57
|
})
|
49
|
-
).otherwise((v0) => copyTableId(v0,
|
58
|
+
).otherwise((v0) => copyTableId(v0, ctx));
|
50
59
|
}
|
51
60
|
function getTablePropControllerDataTableIds(data) {
|
52
61
|
const value = getTablePropControllerDataTableId(data);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/table/table.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\n\nconst tableIdSchema = z.string()\n\ntype TableId = z.infer<typeof tableIdSchema>\n\nconst tablePropControllerDataV0Schema = tableIdSchema\n\nexport type TablePropControllerDataV0 = z.infer<\n typeof tablePropControllerDataV0Schema\n>\n\nexport const TablePropControllerDataV1Type = 'prop-controllers::table::v1'\n\nconst tablePropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(TablePropControllerDataV1Type),\n value: tableIdSchema,\n})\n\nexport type TablePropControllerDataV1 = z.infer<\n typeof tablePropControllerDataV1Schema\n>\n\nexport const tablePropControllerDataSchema = z.union([\n tablePropControllerDataV0Schema,\n tablePropControllerDataV1Schema,\n])\n\nexport type TablePropControllerData = z.infer<\n typeof tablePropControllerDataSchema\n>\n\nexport type TableOptions = Options<{\n preset?: TablePropControllerData\n}>\n\ntype TableDescriptorV0<_T = TablePropControllerDataV0> = {\n type: typeof Types.Table\n options: TableOptions\n}\n\ntype TableDescriptorV1<\n _T = TablePropControllerData,\n U extends TableOptions = TableOptions,\n> = {\n type: typeof Types.Table\n version: 1\n options: U\n}\n\nexport type TableDescriptor<_T = TablePropControllerData> =\n | TableDescriptorV0\n | TableDescriptorV1\n\nexport type ResolveTablePropControllerValue<T extends TableDescriptor> =\n T extends TableDescriptor ? TableId | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Table(options: TableOptions = {}): TableDescriptorV1 {\n return { type: Types.Table, version: 1, options }\n}\n\nexport function getTablePropControllerDataTableId(\n data: TablePropControllerData | undefined,\n): TableId | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: TablePropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createTablePropControllerDataFromTableId(\n value: TableId,\n definition?: TableDescriptor,\n): TablePropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n P.nullish,\n () =>\n ({\n [ControlDataTypeKey]: TablePropControllerDataV1Type,\n value,\n } as const
|
1
|
+
{"version":3,"sources":["../../../src/table/table.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n} from '../prop-controllers'\nimport {\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\nimport { P, match } from 'ts-pattern'\n\nconst tableIdSchema = z.string()\n\ntype TableId = z.infer<typeof tableIdSchema>\n\nconst tablePropControllerDataV0Schema = tableIdSchema\n\nexport type TablePropControllerDataV0 = z.infer<\n typeof tablePropControllerDataV0Schema\n>\n\nexport const TablePropControllerDataV1Type = 'prop-controllers::table::v1'\n\nconst tablePropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(TablePropControllerDataV1Type),\n value: tableIdSchema,\n})\n\nexport type TablePropControllerDataV1 = z.infer<\n typeof tablePropControllerDataV1Schema\n>\n\nexport const tablePropControllerDataSchema = z.union([\n tablePropControllerDataV0Schema,\n tablePropControllerDataV1Schema,\n])\n\nexport type TablePropControllerData = z.infer<\n typeof tablePropControllerDataSchema\n>\n\nexport type TableOptions = Options<{\n preset?: TablePropControllerData\n}>\n\ntype TableDescriptorV0<_T = TablePropControllerDataV0> = {\n type: typeof Types.Table\n options: TableOptions\n}\n\ntype TableDescriptorV1<\n _T = TablePropControllerData,\n U extends TableOptions = TableOptions,\n> = {\n type: typeof Types.Table\n version: 1\n options: U\n}\n\nexport type TableDescriptor<_T = TablePropControllerData> =\n | TableDescriptorV0\n | TableDescriptorV1\n\nexport type ResolveTablePropControllerValue<T extends TableDescriptor> =\n T extends TableDescriptor ? TableId | undefined : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function Table(options: TableOptions = {}): TableDescriptorV1 {\n return { type: Types.Table, version: 1, options }\n}\n\nexport function getTablePropControllerDataTableId(\n data: TablePropControllerData | undefined,\n): TableId | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: TablePropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createTablePropControllerDataFromTableId(\n value: TableId,\n definition?: TableDescriptor,\n): TablePropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n P.nullish,\n () =>\n ({\n [ControlDataTypeKey]: TablePropControllerDataV1Type,\n value,\n }) as const,\n )\n .otherwise(() => value)\n}\n\nfunction copyTableId(data: TableId, context: CopyContext): TableId {\n if (data == null) return data\n\n return replaceResourceIfNeeded(ContextResource.Table, data, context)\n}\n\nexport function copyTablePropControllerData(\n data: TablePropControllerData | undefined,\n ctx: CopyContext,\n): TablePropControllerData | undefined {\n const currentTableId = getTablePropControllerDataTableId(data)\n if (\n currentTableId != null &&\n shouldRemoveResource(ContextResource.Table, currentTableId, ctx)\n ) {\n return undefined\n }\n\n return match(data)\n .with(undefined, () => undefined)\n .with(\n { [ControlDataTypeKey]: TablePropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: TablePropControllerDataV1Type,\n value: copyTableId(v1.value, ctx),\n }) as const,\n )\n .otherwise((v0) => copyTableId(v0, ctx))\n}\n\nexport function getTablePropControllerDataTableIds(\n data: TablePropControllerData | undefined,\n): string[] {\n const value = getTablePropControllerDataTableId(data)\n\n return value ? [value] : []\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,GAAG,aAAa;AAEzB,MAAM,gBAAgB,EAAE,OAAO;AAI/B,MAAM,kCAAkC;AAMjC,MAAM,gCAAgC;AAE7C,MAAM,kCAAkC,EAAE,OAAO;AAAA,EAC/C,CAAC,kBAAkB,GAAG,EAAE,QAAQ,6BAA6B;AAAA,EAC7D,OAAO;AACT,CAAC;AAMM,MAAM,gCAAgC,EAAE,MAAM;AAAA,EACnD;AAAA,EACA;AACF,CAAC;AAmCM,SAAS,MAAM,UAAwB,CAAC,GAAsB;AACnE,SAAO,EAAE,MAAM,MAAM,OAAO,SAAS,GAAG,QAAQ;AAClD;AAEO,SAAS,kCACd,MACqB;AACrB,SAAO,MAAM,IAAI,EACd;AAAA,IACC,EAAE,CAAC,kBAAkB,GAAG,8BAA8B;AAAA,IACtD,CAAC,OAAO,GAAG;AAAA,EACb,EACC,UAAU,CAAC,OAAO,EAAE;AACzB;AAEO,SAAS,yCACd,OACA,YACyB;AACzB,SAAO,MAAM,UAAU,EACpB;AAAA,IACC,EAAE,SAAS,EAAE;AAAA,IACb,EAAE;AAAA,IACF,OACG;AAAA,MACC,CAAC,kBAAkB,GAAG;AAAA,MACtB;AAAA,IACF;AAAA,EACJ,EACC,UAAU,MAAM,KAAK;AAC1B;AAEA,SAAS,YAAY,MAAe,SAA+B;AACjE,MAAI,QAAQ;AAAM,WAAO;AAEzB,SAAO,wBAAwB,gBAAgB,OAAO,MAAM,OAAO;AACrE;AAEO,SAAS,4BACd,MACA,KACqC;AACrC,QAAM,iBAAiB,kCAAkC,IAAI;AAC7D,MACE,kBAAkB,QAClB,qBAAqB,gBAAgB,OAAO,gBAAgB,GAAG,GAC/D;AACA,WAAO;AAAA,EACT;AAEA,SAAO,MAAM,IAAI,EACd,KAAK,QAAW,MAAM,MAAS,EAC/B;AAAA,IACC,EAAE,CAAC,kBAAkB,GAAG,8BAA8B;AAAA,IACtD,CAAC,QACE;AAAA,MACC,CAAC,kBAAkB,GAAG;AAAA,MACtB,OAAO,YAAY,GAAG,OAAO,GAAG;AAAA,IAClC;AAAA,EACJ,EACC,UAAU,CAAC,OAAO,YAAY,IAAI,GAAG,CAAC;AAC3C;AAEO,SAAS,mCACd,MACU;AACV,QAAM,QAAQ,kCAAkC,IAAI;AAEpD,SAAO,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC5B;","names":[]}
|
@@ -5,6 +5,11 @@ import {
|
|
5
5
|
Schema
|
6
6
|
} from "../prop-controllers";
|
7
7
|
import { P, match } from "ts-pattern";
|
8
|
+
import {
|
9
|
+
ContextResource,
|
10
|
+
replaceResourceIfNeeded,
|
11
|
+
shouldRemoveResource
|
12
|
+
} from "@makeswift/controls";
|
8
13
|
const tableFormFieldSchema = z.object({
|
9
14
|
id: z.string(),
|
10
15
|
tableColumnId: z.string(),
|
@@ -60,9 +65,19 @@ function copyTableFormFieldsData(data, context) {
|
|
60
65
|
return data;
|
61
66
|
return {
|
62
67
|
...data,
|
63
|
-
fields: data.fields.
|
68
|
+
fields: data.fields.filter(
|
69
|
+
(field) => !shouldRemoveResource(
|
70
|
+
ContextResource.TableColumn,
|
71
|
+
field.tableColumnId,
|
72
|
+
context
|
73
|
+
)
|
74
|
+
).map((field) => ({
|
64
75
|
...field,
|
65
|
-
tableColumnId:
|
76
|
+
tableColumnId: replaceResourceIfNeeded(
|
77
|
+
ContextResource.TableColumn,
|
78
|
+
field.tableColumnId,
|
79
|
+
context
|
80
|
+
)
|
66
81
|
}))
|
67
82
|
};
|
68
83
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/table-form-fields/table-form-fields.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n Schema,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\n\nconst tableFormFieldSchema = z.object({\n id: z.string(),\n tableColumnId: z.string(),\n label: z.string().optional(),\n placeholder: z.string().optional(),\n defaultValue: z\n .union([z.string(), z.boolean(), z.array(z.string())])\n .optional(),\n required: z.boolean().optional(),\n hidden: z.boolean().optional(),\n type: z.union([z.literal('select'), z.literal('radio')]).optional(),\n hideLabel: z.boolean().optional(),\n autofill: z.boolean().optional(),\n})\n\nexport const tableFormFieldsDataSchema = z.object({\n fields: z.array(tableFormFieldSchema),\n grid: Schema.responsiveValue(\n z.object({\n count: z.number(),\n spans: z.array(z.array(z.number())),\n }),\n ),\n})\n\nexport type TableFormFieldsData = z.infer<typeof tableFormFieldsDataSchema>\n\nconst tableFormFieldsPropControllerDataV0Schema = tableFormFieldsDataSchema\n\nexport type TableFormFieldsPropControllerDataV0 = z.infer<\n typeof tableFormFieldsPropControllerDataV0Schema\n>\n\nexport const TableFormFieldsPropControllerDataV1Type =\n 'prop-controllers::table-form-fields::v1'\n\nconst tableFormFieldsPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(TableFormFieldsPropControllerDataV1Type),\n value: tableFormFieldsDataSchema,\n})\n\nexport type TableFormFieldsPropControllerDataV1 = z.infer<\n typeof tableFormFieldsPropControllerDataV1Schema\n>\n\nexport const tableFormFieldsPropControllerDataSchema = z.union([\n tableFormFieldsPropControllerDataV0Schema,\n tableFormFieldsPropControllerDataV1Schema,\n])\n\nexport type TableFormFieldsPropControllerData = z.infer<\n typeof tableFormFieldsPropControllerDataSchema\n>\n\nexport type TableFormFieldsOptions = Options<{\n preset?: TableFormFieldsPropControllerData\n}>\n\ntype TableFormFieldsDescriptorV0<_T = TableFormFieldsPropControllerDataV0> = {\n type: typeof Types.TableFormFields\n options: TableFormFieldsOptions\n}\n\ntype TableFormFieldsDescriptorV1<\n _T = TableFormFieldsPropControllerData,\n U extends TableFormFieldsOptions = TableFormFieldsOptions,\n> = {\n type: typeof Types.TableFormFields\n version: 1\n options: U\n}\n\nexport type TableFormFieldsDescriptor<_T = TableFormFieldsPropControllerData> =\n | TableFormFieldsDescriptorV0\n | TableFormFieldsDescriptorV1\n\nexport type ResolveTableFormFieldsPropControllerValue<\n T extends TableFormFieldsDescriptor,\n> = T extends TableFormFieldsDescriptor\n ? TableFormFieldsData | undefined\n : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function TableFormFields(\n options: TableFormFieldsOptions = {},\n): TableFormFieldsDescriptorV1 {\n return { type: Types.TableFormFields, version: 1, options }\n}\n\nexport function getTableFormFieldsPropControllerDataTableFormFieldsData(\n data: TableFormFieldsPropControllerData | undefined,\n): TableFormFieldsData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: TableFormFieldsPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createTableFormFieldsPropControllerDataFromTableFormFieldsData(\n value: TableFormFieldsData,\n definition: TableFormFieldsDescriptor,\n): TableFormFieldsPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n P.nullish,\n () =>\n ({\n [ControlDataTypeKey]: TableFormFieldsPropControllerDataV1Type,\n value,\n }) as const,\n )\n .otherwise(() => value)\n}\n\nfunction copyTableFormFieldsData(\n data: TableFormFieldsData,\n context: CopyContext,\n): TableFormFieldsData {\n if (data == null) return data\n\n return {\n ...data,\n fields: data.fields.map((field) => ({\n
|
1
|
+
{"version":3,"sources":["../../../src/table-form-fields/table-form-fields.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n ControlDataTypeKey,\n CopyContext,\n Options,\n Types,\n Schema,\n} from '../prop-controllers'\nimport { P, match } from 'ts-pattern'\nimport {\n ContextResource,\n replaceResourceIfNeeded,\n shouldRemoveResource,\n} from '@makeswift/controls'\n\nconst tableFormFieldSchema = z.object({\n id: z.string(),\n tableColumnId: z.string(),\n label: z.string().optional(),\n placeholder: z.string().optional(),\n defaultValue: z\n .union([z.string(), z.boolean(), z.array(z.string())])\n .optional(),\n required: z.boolean().optional(),\n hidden: z.boolean().optional(),\n type: z.union([z.literal('select'), z.literal('radio')]).optional(),\n hideLabel: z.boolean().optional(),\n autofill: z.boolean().optional(),\n})\n\nexport const tableFormFieldsDataSchema = z.object({\n fields: z.array(tableFormFieldSchema),\n grid: Schema.responsiveValue(\n z.object({\n count: z.number(),\n spans: z.array(z.array(z.number())),\n }),\n ),\n})\n\nexport type TableFormFieldsData = z.infer<typeof tableFormFieldsDataSchema>\n\nconst tableFormFieldsPropControllerDataV0Schema = tableFormFieldsDataSchema\n\nexport type TableFormFieldsPropControllerDataV0 = z.infer<\n typeof tableFormFieldsPropControllerDataV0Schema\n>\n\nexport const TableFormFieldsPropControllerDataV1Type =\n 'prop-controllers::table-form-fields::v1'\n\nconst tableFormFieldsPropControllerDataV1Schema = z.object({\n [ControlDataTypeKey]: z.literal(TableFormFieldsPropControllerDataV1Type),\n value: tableFormFieldsDataSchema,\n})\n\nexport type TableFormFieldsPropControllerDataV1 = z.infer<\n typeof tableFormFieldsPropControllerDataV1Schema\n>\n\nexport const tableFormFieldsPropControllerDataSchema = z.union([\n tableFormFieldsPropControllerDataV0Schema,\n tableFormFieldsPropControllerDataV1Schema,\n])\n\nexport type TableFormFieldsPropControllerData = z.infer<\n typeof tableFormFieldsPropControllerDataSchema\n>\n\nexport type TableFormFieldsOptions = Options<{\n preset?: TableFormFieldsPropControllerData\n}>\n\ntype TableFormFieldsDescriptorV0<_T = TableFormFieldsPropControllerDataV0> = {\n type: typeof Types.TableFormFields\n options: TableFormFieldsOptions\n}\n\ntype TableFormFieldsDescriptorV1<\n _T = TableFormFieldsPropControllerData,\n U extends TableFormFieldsOptions = TableFormFieldsOptions,\n> = {\n type: typeof Types.TableFormFields\n version: 1\n options: U\n}\n\nexport type TableFormFieldsDescriptor<_T = TableFormFieldsPropControllerData> =\n | TableFormFieldsDescriptorV0\n | TableFormFieldsDescriptorV1\n\nexport type ResolveTableFormFieldsPropControllerValue<\n T extends TableFormFieldsDescriptor,\n> = T extends TableFormFieldsDescriptor\n ? TableFormFieldsData | undefined\n : never\n\n/**\n * @deprecated Imports from @makeswift/prop-controllers are deprecated. Use\n * @makeswift/runtime/controls instead.\n */\nexport function TableFormFields(\n options: TableFormFieldsOptions = {},\n): TableFormFieldsDescriptorV1 {\n return { type: Types.TableFormFields, version: 1, options }\n}\n\nexport function getTableFormFieldsPropControllerDataTableFormFieldsData(\n data: TableFormFieldsPropControllerData | undefined,\n): TableFormFieldsData | undefined {\n return match(data)\n .with(\n { [ControlDataTypeKey]: TableFormFieldsPropControllerDataV1Type },\n (v1) => v1.value,\n )\n .otherwise((v0) => v0)\n}\n\nexport function createTableFormFieldsPropControllerDataFromTableFormFieldsData(\n value: TableFormFieldsData,\n definition: TableFormFieldsDescriptor,\n): TableFormFieldsPropControllerData {\n return match(definition)\n .with(\n { version: 1 },\n P.nullish,\n () =>\n ({\n [ControlDataTypeKey]: TableFormFieldsPropControllerDataV1Type,\n value,\n }) as const,\n )\n .otherwise(() => value)\n}\n\nfunction copyTableFormFieldsData(\n data: TableFormFieldsData,\n context: CopyContext,\n): TableFormFieldsData {\n if (data == null) return data\n\n return {\n ...data,\n fields: data.fields\n .filter(\n (field) =>\n !shouldRemoveResource(\n ContextResource.TableColumn,\n field.tableColumnId,\n context,\n ),\n )\n .map((field) => ({\n ...field,\n tableColumnId: replaceResourceIfNeeded(\n ContextResource.TableColumn,\n field.tableColumnId,\n context,\n ),\n })),\n }\n}\n\nexport function copyTableFormFieldsPropControllerData(\n data: TableFormFieldsPropControllerData | undefined,\n context: CopyContext,\n): TableFormFieldsPropControllerData | undefined {\n return match(data)\n .with(undefined, () => undefined)\n .with(\n { [ControlDataTypeKey]: TableFormFieldsPropControllerDataV1Type },\n (v1) =>\n ({\n [ControlDataTypeKey]: TableFormFieldsPropControllerDataV1Type,\n value: copyTableFormFieldsData(v1.value, context),\n }) as const,\n )\n .otherwise((v0) => copyTableFormFieldsData(v0, context))\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,SAAS,GAAG,aAAa;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,uBAAuB,EAAE,OAAO;AAAA,EACpC,IAAI,EAAE,OAAO;AAAA,EACb,eAAe,EAAE,OAAO;AAAA,EACxB,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,cAAc,EACX,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EACpD,SAAS;AAAA,EACZ,UAAU,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC/B,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,SAAS;AAAA,EAClE,WAAW,EAAE,QAAQ,EAAE,SAAS;AAAA,EAChC,UAAU,EAAE,QAAQ,EAAE,SAAS;AACjC,CAAC;AAEM,MAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,QAAQ,EAAE,MAAM,oBAAoB;AAAA,EACpC,MAAM,OAAO;AAAA,IACX,EAAE,OAAO;AAAA,MACP,OAAO,EAAE,OAAO;AAAA,MAChB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAAA,IAC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kB,GAAG,wCAAwC;AAAA,IAChE,CAAC,QACE;AAAA,MACC,CAAC,kBAAkB,GAAG;AAAA,MACtB,OAAO,wBAAwB,GAAG,OAAO,OAAO;AAAA,IAClD;AAAA,EACJ,EACC,UAAU,CAAC,OAAO,wBAAwB,IAAI,OAAO,CAAC;AAC3D;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"backgrounds.d.ts","sourceRoot":"","sources":["../../../src/backgrounds/backgrounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
1
|
+
{"version":3,"file":"backgrounds.d.ts","sourceRoot":"","sources":["../../../src/backgrounds/backgrounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,OAAO,EAEL,WAAW,EACX,OAAO,EACP,KAAK,EAEN,MAAM,qBAAqB,CAAA;AA0F5B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAc3E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,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