@prismicio/types-internal 4.0.0-pr.6.eb53f11 → 4.0.0-pr.9.e09af2c
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/README.md +5 -5
- package/dist/content/boolean.d.ts.map +1 -1
- package/dist/content/boolean.js.map +1 -1
- package/dist/content/document.d.ts +2 -3019
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/field.d.ts +1 -30
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/group.d.ts +2 -1
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/legacy/boolean.d.ts +1 -0
- package/dist/content/legacy/embed.d.ts +1 -0
- package/dist/content/legacy/empty.d.ts +1 -0
- package/dist/content/legacy/field.d.ts +1 -0
- package/dist/content/legacy/geopoint.d.ts +1 -0
- package/dist/content/legacy/group.d.ts +9 -0
- package/dist/content/legacy/group.d.ts.map +1 -0
- package/dist/content/legacy/group.js.map +1 -1
- package/dist/content/legacy/integrationField.d.ts +1 -0
- package/dist/content/legacy/link.d.ts +41 -0
- package/dist/content/legacy/link.d.ts.map +1 -0
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/nestable.d.ts +1 -0
- package/dist/content/legacy/nestable.js.map +1 -1
- package/dist/content/legacy/repeatable.d.ts +1 -0
- package/dist/content/legacy/repeatable.js +2 -8
- package/dist/content/legacy/repeatable.js.map +1 -1
- package/dist/content/legacy/richText.d.ts +109 -0
- package/dist/content/legacy/richText.d.ts.map +1 -0
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/legacy/separator.d.ts +1 -0
- package/dist/content/legacy/slice.js +2 -3
- package/dist/content/legacy/slice.js.map +1 -1
- package/dist/content/legacy/table.d.ts +1 -0
- package/dist/content/link.d.ts +74 -99
- package/dist/content/link.d.ts.map +1 -1
- package/dist/content/link.js +2 -2
- package/dist/content/link.js.map +1 -1
- package/dist/content/nestable.d.ts +13 -749
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js +1 -0
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/repeatable.d.ts +3 -98
- package/dist/content/repeatable.d.ts.map +1 -1
- package/dist/content/richText.d.ts +20 -248
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js.map +1 -1
- package/dist/content/slice.d.ts +6 -4509
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +8 -6765
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/table.d.ts +2 -134
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/widget.d.ts +5 -3020
- package/dist/content/widget.d.ts.map +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/contentPath.js +1 -1
- package/dist/helpers/customTypeModel.d.ts +3 -2
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js +31 -1
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/helpers/documentContent.d.ts +3 -2
- package/dist/helpers/documentContent.d.ts.map +1 -1
- package/dist/helpers/documentContent.js +14 -1
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/helpers/sliceContent.d.ts +12 -0
- package/dist/helpers/sliceContent.d.ts.map +1 -0
- package/dist/helpers/sliceContent.js +60 -0
- package/dist/helpers/sliceContent.js.map +1 -0
- package/dist/helpers/traverseContent.d.ts +15 -16
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js +53 -19
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +14 -15
- package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
- package/dist/helpers/traverseContentWithModel.js +61 -35
- package/dist/helpers/traverseContentWithModel.js.map +1 -1
- package/dist/helpers/withDefaultContent.d.ts +17 -0
- package/dist/helpers/withDefaultContent.d.ts.map +1 -0
- package/dist/helpers/withDefaultContent.js +113 -0
- package/dist/helpers/withDefaultContent.js.map +1 -0
- package/dist/index.d.ts +16 -14
- package/dist/index.js +4 -1
- package/dist/io-ts.d.ts +3629 -70848
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +126 -124
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +3 -3329
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/group.d.ts +375 -376
- package/dist/model/group.d.ts.map +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/image.d.ts +4 -4
- package/dist/model/image.js.map +1 -1
- package/dist/model/link.d.ts +2 -2
- package/dist/model/link.js.map +1 -1
- package/dist/model/nestable.d.ts +17 -178
- package/dist/model/nestable.d.ts.map +1 -1
- package/dist/model/nestable.js +3 -3
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/richText.d.ts +3 -7
- package/dist/model/richText.d.ts.map +1 -1
- package/dist/model/richText.js +4 -3
- package/dist/model/richText.js.map +1 -1
- package/dist/model/section.d.ts +3 -3329
- package/dist/model/section.d.ts.map +1 -1
- package/dist/model/select.d.ts +1 -1
- package/dist/model/select.js +1 -1
- package/dist/model/select.js.map +1 -1
- package/dist/model/slice.d.ts +1360 -3691
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +10 -5
- package/dist/model/slice.js.map +1 -1
- package/dist/model/slices.d.ts +3 -2195
- package/dist/model/slices.d.ts.map +1 -1
- package/dist/model/table.d.ts +2 -1
- package/dist/model/table.d.ts.map +1 -1
- package/dist/model/table.js +9 -7
- package/dist/model/table.js.map +1 -1
- package/dist/model/widget.d.ts +7 -3334
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +5 -2
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +1796 -34837
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +126 -124
- package/dist/zod4.js.map +1 -1
- package/package.json +3 -2
- package/src/content/boolean.ts +0 -13
- package/src/content/field.ts +9 -16
- package/src/content/group.ts +6 -56
- package/src/content/legacy/group.ts +12 -4
- package/src/content/legacy/link.ts +32 -9
- package/src/content/legacy/nestable.ts +26 -2
- package/src/content/legacy/repeatable.ts +3 -16
- package/src/content/legacy/richText.ts +37 -5
- package/src/content/legacy/slice.ts +8 -7
- package/src/content/legacy/widget.ts +6 -2
- package/src/content/link.ts +32 -9
- package/src/content/nestable.ts +43 -22
- package/src/content/richText.ts +19 -7
- package/src/content/slice.ts +2 -2
- package/src/content/widget.ts +6 -2
- package/src/helpers/customTypeModel.ts +44 -0
- package/src/helpers/documentContent.ts +32 -1
- package/src/helpers/sliceContent.ts +86 -0
- package/src/helpers/traverseContent.ts +96 -32
- package/src/helpers/traverseContentWithModel.ts +73 -48
- package/src/helpers/withDefaultContent.ts +173 -0
- package/src/index.ts +6 -1
- package/src/io-ts.ts +166 -144
- package/src/model/diff/sharedSlice.ts +2 -2
- package/src/model/diff/variation.ts +7 -7
- package/src/model/group.ts +4 -1
- package/src/model/image.ts +1 -1
- package/src/model/link.ts +1 -1
- package/src/model/nestable.ts +33 -1
- package/src/model/richText.ts +2 -2
- package/src/model/select.ts +2 -2
- package/src/model/slice.ts +38 -13
- package/src/model/table.ts +11 -2
- package/src/model/widget.ts +14 -6
- package/src/zod4.ts +166 -144
- package/src/content/withDefaultValues.ts +0 -114
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/model/group.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/model/group.ts"],"mappings":";;;;cA2Ba,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,cAGjC,gBAAA,EAAgB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMjB,UAAA,GAAa,CAAA,CAAE,KAAA,QAAa,gBAAA"}
|
package/dist/model/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","names":[],"sources":["../../src/model/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { NestableModelSchema } from \"./nestable\"\n\nexport const GroupFieldType = \"Group\"\n\n// Factory to create group config schema with configurable widget types\nconst createGroupConfigSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\tlabel: z.nullish(z.string()),\n\t\trepeat: z.optional(z.boolean()),\n\t\tfields: z.optional(z.record(WidgetKeySchema, widgets)),\n\t})\n\n// Factory to create group schema with configurable widget types\nconst createGroupSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\ttype: z.literal(GroupFieldType),\n\t\tfieldset: z.nullish(z.string()),\n\t\ticon: z.optional(z.string()),\n\t\tdescription: z.optional(z.string()),\n\t\tconfig: z.optional(createGroupConfigSchema(widgets)),\n\t})\n\n// NestedGroup - only allows Nestable in fields (no further nesting)\nexport const NestedGroupModelSchema = createGroupSchema(NestableModelSchema)\n\nexport type NestedGroupModel = z.infer<typeof NestedGroupModelSchema>\n\n// Group - allows Nestable | NestedGroup in fields (max 2 levels of nesting)\nexport const GroupModelSchema = createGroupSchema(\n\tz.union([NestableModelSchema, NestedGroupModelSchema])
|
|
1
|
+
{"version":3,"file":"group.js","names":[],"sources":["../../src/model/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport type { NestableModel } from \"./nestable\"\nimport { NestableModelSchema } from \"./nestable\"\n\nexport const GroupFieldType = \"Group\"\n\n// Factory to create group config schema with configurable widget types\nconst createGroupConfigSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\tlabel: z.nullish(z.string()),\n\t\trepeat: z.optional(z.boolean()),\n\t\tfields: z.optional(z.record(WidgetKeySchema, widgets)),\n\t})\n\n// Factory to create group schema with configurable widget types\nconst createGroupSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\ttype: z.literal(GroupFieldType),\n\t\tfieldset: z.nullish(z.string()),\n\t\ticon: z.optional(z.string()),\n\t\tdescription: z.optional(z.string()),\n\t\tconfig: z.optional(createGroupConfigSchema(widgets)),\n\t})\n\n// NestedGroup - only allows Nestable in fields (no further nesting)\nexport const NestedGroupModelSchema = createGroupSchema(NestableModelSchema)\n\nexport type NestedGroupModel = z.infer<typeof NestedGroupModelSchema>\n\n// Group - allows Nestable | NestedGroup in fields (max 2 levels of nesting)\nexport const GroupModelSchema = createGroupSchema(\n\tz.union([NestableModelSchema, NestedGroupModelSchema]) as z.ZodMiniType<\n\t\tNestableModel | NestedGroupModel\n\t>,\n)\n\nexport type GroupModel = z.infer<typeof GroupModelSchema>\n"],"mappings":";;;;AAMA,MAAa,iBAAiB;AAG9B,MAAM,2BAA2D,YAChE,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;CAC/B,QAAQ,EAAE,SAAS,EAAE,OAAO,iBAAiB,QAAQ,CAAC;CACtD,CAAC;AAGH,MAAM,qBAAqD,YAC1D,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,eAAe;CAC/B,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,QAAQ,EAAE,SAAS,wBAAwB,QAAQ,CAAC;CACpD,CAAC;AAGH,MAAa,yBAAyB,kBAAkB,oBAAoB;AAK5E,MAAa,mBAAmB,kBAC/B,EAAE,MAAM,CAAC,qBAAqB,uBAAuB,CAAC,CAGtD"}
|
package/dist/model/image.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ declare const ImageModelSchema: z.ZodMiniObject<{
|
|
|
8
8
|
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
9
9
|
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
10
|
constraint: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
11
|
-
width: z.ZodMiniOptional<z.
|
|
12
|
-
height: z.ZodMiniOptional<z.
|
|
11
|
+
width: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
|
|
12
|
+
height: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
|
|
13
13
|
}, z.core.$strip>>;
|
|
14
14
|
thumbnails: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
15
15
|
name: z.ZodMiniString<string>;
|
|
16
|
-
width: z.ZodMiniOptional<z.
|
|
17
|
-
height: z.ZodMiniOptional<z.
|
|
16
|
+
width: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
|
|
17
|
+
height: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
|
|
18
18
|
}, z.core.$strip>>>;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
20
|
}, z.core.$strip>;
|
package/dist/model/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","names":[],"sources":["../../src/model/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n/**\n * SideConstraint accepts multiple input formats and normalizes to number | null:\n * - Integer values\n * - String integers (e.g., \"100\")\n * - Pixel strings (e.g., \"100px\")\n * - \"auto\" or \"\" → null\n * - null\n */\nexport const SideConstraintSchema = z.union([\n\tz.pipe(\n\t\tz.literal(\"auto\"),\n\t\tz.transform(() => null),\n\t),\n\tz.pipe(\n\t\tz.literal(\"\"),\n\t\tz.transform(() => null),\n\t),\n\tz.null(),\n\tz.number().check(z.int()),\n\tz.pipe(\n\t\tz.string(),\n\t\tz.transform((s: string) => parseInt(s.replace(\"px\", \"\"), 10)),\n\t),\n])\n\nexport const ImageConstraintSchema = z.object({\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nexport type ImageConstraint = z.infer<typeof ImageConstraintSchema>\n\nconst ThumbnailSchema = z.object({\n\tname: z.string(),\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nconst ImageConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tconstraint: z.optional(ImageConstraintSchema),\n\tthumbnails: z.optional(z.array(ThumbnailSchema)),\n})\n\nexport const ImageModelSchema = z.object({\n\ttype: z.literal(\"Image\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(ImageConfigSchema),\n})\n\nexport type ImageModel = z.infer<typeof ImageModelSchema>\n"],"mappings":";;;;;;;;;;AAUA,MAAa,
|
|
1
|
+
{"version":3,"file":"image.js","names":[],"sources":["../../src/model/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n/**\n * SideConstraint accepts multiple input formats and normalizes to number | null:\n * - Integer values\n * - String integers (e.g., \"100\")\n * - Pixel strings (e.g., \"100px\")\n * - \"auto\" or \"\" → null\n * - null\n */\nexport const SideConstraintSchema: z.ZodMiniType<number | null> = z.union([\n\tz.pipe(\n\t\tz.literal(\"auto\"),\n\t\tz.transform(() => null),\n\t),\n\tz.pipe(\n\t\tz.literal(\"\"),\n\t\tz.transform(() => null),\n\t),\n\tz.null(),\n\tz.number().check(z.int()),\n\tz.pipe(\n\t\tz.string(),\n\t\tz.transform((s: string) => parseInt(s.replace(\"px\", \"\"), 10)),\n\t),\n])\n\nexport const ImageConstraintSchema = z.object({\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nexport type ImageConstraint = z.infer<typeof ImageConstraintSchema>\n\nconst ThumbnailSchema = z.object({\n\tname: z.string(),\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nconst ImageConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tconstraint: z.optional(ImageConstraintSchema),\n\tthumbnails: z.optional(z.array(ThumbnailSchema)),\n})\n\nexport const ImageModelSchema = z.object({\n\ttype: z.literal(\"Image\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(ImageConfigSchema),\n})\n\nexport type ImageModel = z.infer<typeof ImageModelSchema>\n"],"mappings":";;;;;;;;;;AAUA,MAAa,uBAAqD,EAAE,MAAM;CACzE,EAAE,KACD,EAAE,QAAQ,OAAO,EACjB,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,KACD,EAAE,QAAQ,GAAG,EACb,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,MAAM;CACR,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;CACzB,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,SAAS,EAAE,QAAQ,MAAM,GAAG,EAAE,GAAG,CAAC,CAC7D;CACD,CAAC;AAEF,MAAa,wBAAwB,EAAE,OAAO;CAC7C,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAIF,MAAM,kBAAkB,EAAE,OAAO;CAChC,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAEF,MAAM,oBAAoB,EAAE,OAAO;CAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,sBAAsB;CAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;CAChD,CAAC;AAEF,MAAa,mBAAmB,EAAE,OAAO;CACxC,MAAM,EAAE,QAAQ,QAAQ;CACxB,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,kBAAkB;CACrC,CAAC"}
|
package/dist/model/link.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ declare const LinkModelSchema: z.ZodMiniObject<{
|
|
|
34
34
|
}, z.core.$strip>]>>;
|
|
35
35
|
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
36
36
|
}, z.core.$strip>]>>>;
|
|
37
|
-
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<
|
|
38
|
-
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<
|
|
37
|
+
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<string[], string | string[]>>>;
|
|
38
|
+
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<string[], string | string[]>>>;
|
|
39
39
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
40
40
|
allowText: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
41
41
|
repeat: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
package/dist/model/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","names":[],"sources":["../../src/model/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Accepts string | string[], normalizes string to [string]\nconst MasksArrayStringSchema = z.pipe(\n\tz.union([z.array(z.string()), z.string()]),\n\tz.transform((val):
|
|
1
|
+
{"version":3,"file":"link.js","names":[],"sources":["../../src/model/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Accepts string | string[], normalizes string to [string]\nconst MasksArrayStringSchema = z.pipe(\n\tz.union([z.array(z.string()), z.string()]),\n\tz.transform((val): string[] => (typeof val === \"string\" ? [val] : val)),\n)\n\n// --- CustomTypes hierarchy (field selection in content relationship fields) ---\n\n// Level 2\n\nconst noDuplicateStrings = z.refine(\n\t(arr) => new Set(arr as string[]).size === (arr as string[]).length,\n\t\"Fields have duplicates.\",\n)\n\nconst CustomTypeLevel2FieldGroupFieldsSchema = z.array(z.string()).check(noDuplicateStrings)\n\nconst CustomTypeLevel2FieldSchema = z.union([\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldGroupFieldsSchema }),\n\tz.string(),\n])\n\nconst noDuplicateIds = (items: unknown) => {\n\tconst arr = items as { id: string }[] | string[]\n\tconst ids = new Set(arr.map((item) => (typeof item === \"string\" ? item : item.id)))\n\treturn ids.size === arr.length\n}\n\nconst CustomTypeLevel2FieldsSchema = z\n\t.array(CustomTypeLevel2FieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel2Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldsSchema }),\n])\n\nconst CustomTypesLevel2Schema = z\n\t.array(CustomTypeLevel2Schema)\n\t.check(z.refine(noDuplicateIds, \"Custom types have duplicates.\"))\n\n// Level 1\n\nconst CustomTypeLevel1FieldCustomTypesSchema = z.object({\n\tid: z.string(),\n\tcustomtypes: CustomTypesLevel2Schema,\n})\n\nconst CustomTypeLevel1FieldGroupFieldSchema = z.union([\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldGroupFieldsSchema = z\n\t.array(CustomTypeLevel1FieldGroupFieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel1FieldSchema = z.union([\n\tz.object({\n\t\tid: z.string(),\n\t\tfields: CustomTypeLevel1FieldGroupFieldsSchema,\n\t}),\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldsSchema = z\n\t.array(CustomTypeLevel1FieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel1Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel1FieldsSchema }),\n])\n\nconst CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {\n\tconst cts = value as ({ id: string } | string)[]\n\tconst push = (message: string) => issues.push({ code: \"custom\", input: value, message })\n\tconst strings = new Set<string>()\n\tconst objects = new Set<string>()\n\tfor (const ct of cts) {\n\t\tlet failed = false\n\t\tif (typeof ct === \"string\") {\n\t\t\tfailed = objects.has(ct)\n\t\t\tstrings.add(ct)\n\t\t} else {\n\t\t\tconst { id } = ct\n\t\t\tfailed = strings.has(id) || objects.has(id)\n\t\t\tobjects.add(id)\n\t\t}\n\t\tif (failed) {\n\t\t\tpush(\"Custom types have duplicates.\")\n\t\t\treturn\n\t\t}\n\t}\n\tif (objects.size > 1) {\n\t\tpush(\"Cannot have multiple custom types with fields selection.\")\n\t\treturn\n\t}\n\tif (strings.size > 0 && objects.size > 0) {\n\t\tpush(\"Cannot mix custom types as strings and objects with fields.\")\n\t}\n})\n\n// --- Select with fallback to null ---\n\nconst SelectWithFallbackSchema = z.pipe(\n\tz.unknown(),\n\tz.transform((val): \"media\" | \"document\" | \"web\" | null => {\n\t\tif (val === \"media\" || val === \"document\" || val === \"web\" || val === null) {\n\t\t\treturn val\n\t\t}\n\t\treturn null\n\t}),\n)\n\n// --- LinkConfig and Link ---\n\nconst LinkConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tplaceholder: z.optional(z.string()),\n\tselect: z.optional(SelectWithFallbackSchema),\n\tcustomtypes: z.optional(CustomTypesSchema),\n\tmasks: z.optional(MasksArrayStringSchema),\n\ttags: z.optional(MasksArrayStringSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n\tallowText: z.optional(z.boolean()),\n\trepeat: z.optional(z.boolean()),\n\tvariants: z.optional(z.array(z.string())),\n})\n\nexport const LinkModelSchema = z.object({\n\ttype: z.literal(\"Link\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(LinkConfigSchema),\n})\n\nexport type LinkModel = z.infer<typeof LinkModelSchema>\n"],"mappings":"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"}
|
package/dist/model/nestable.d.ts
CHANGED
|
@@ -1,184 +1,23 @@
|
|
|
1
|
+
import { BooleanModel } from "./boolean.js";
|
|
2
|
+
import { ColorModel } from "./color.js";
|
|
3
|
+
import { DateModel } from "./date.js";
|
|
4
|
+
import { EmbedModel } from "./embed.js";
|
|
5
|
+
import { GeoPointModel } from "./geopoint.js";
|
|
6
|
+
import { ImageModel } from "./image.js";
|
|
7
|
+
import { IntegrationFieldModel } from "./integrationField.js";
|
|
8
|
+
import { LinkModel } from "./link.js";
|
|
9
|
+
import { NumberModel } from "./number.js";
|
|
10
|
+
import { RangeModel } from "./range.js";
|
|
11
|
+
import { RichTextModel } from "./richText.js";
|
|
12
|
+
import { SelectModel } from "./select.js";
|
|
13
|
+
import { SeparatorModel } from "./separator.js";
|
|
14
|
+
import { TableModel } from "./table.js";
|
|
15
|
+
import { TextModel } from "./text.js";
|
|
16
|
+
import { TimestampModel } from "./timestamp.js";
|
|
1
17
|
import { z } from "zod/mini";
|
|
2
18
|
|
|
3
19
|
//#region src/model/nestable.d.ts
|
|
4
|
-
|
|
5
|
-
type: z.ZodMiniLiteral<"Boolean">;
|
|
6
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
7
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
8
|
-
default_value: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
9
|
-
placeholder_true: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
|
-
placeholder_false: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
13
|
-
type: z.ZodMiniLiteral<"Color">;
|
|
14
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
15
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
16
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
17
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
18
|
-
}, z.core.$strip>>;
|
|
19
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
20
|
-
type: z.ZodMiniLiteral<"Date">;
|
|
21
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
22
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
23
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
24
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
-
default: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
26
|
-
}, z.core.$strip>>;
|
|
27
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
28
|
-
type: z.ZodMiniLiteral<"Embed">;
|
|
29
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
30
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
31
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
32
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
33
|
-
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
34
|
-
}, z.core.$strip>>;
|
|
35
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
36
|
-
type: z.ZodMiniLiteral<"GeoPoint">;
|
|
37
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
38
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
39
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
40
|
-
}, z.core.$strip>>;
|
|
41
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
42
|
-
type: z.ZodMiniLiteral<"Image">;
|
|
43
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
44
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
45
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
46
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
|
-
constraint: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
48
|
-
width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
49
|
-
height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
50
|
-
}, z.core.$strip>>;
|
|
51
|
-
thumbnails: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
52
|
-
name: z.ZodMiniString<string>;
|
|
53
|
-
width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
54
|
-
height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
55
|
-
}, z.core.$strip>>>;
|
|
56
|
-
}, z.core.$strip>>;
|
|
57
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
58
|
-
type: z.ZodMiniLiteral<"IntegrationFields">;
|
|
59
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
60
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
61
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
62
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
63
|
-
catalog: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
64
|
-
}, z.core.$strip>>;
|
|
65
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
66
|
-
type: z.ZodMiniLiteral<"Link">;
|
|
67
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
68
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
69
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
70
|
-
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
71
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
72
|
-
select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
|
|
73
|
-
customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
74
|
-
id: z.ZodMiniString<string>;
|
|
75
|
-
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
76
|
-
id: z.ZodMiniString<string>;
|
|
77
|
-
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
78
|
-
id: z.ZodMiniString<string>;
|
|
79
|
-
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
80
|
-
id: z.ZodMiniString<string>;
|
|
81
|
-
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
82
|
-
id: z.ZodMiniString<string>;
|
|
83
|
-
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
84
|
-
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
85
|
-
}, z.core.$strip>]>>;
|
|
86
|
-
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
87
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
88
|
-
id: z.ZodMiniString<string>;
|
|
89
|
-
customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
90
|
-
id: z.ZodMiniString<string>;
|
|
91
|
-
fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
92
|
-
id: z.ZodMiniString<string>;
|
|
93
|
-
fields: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
94
|
-
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
95
|
-
}, z.core.$strip>]>>;
|
|
96
|
-
}, z.core.$strip>, z.ZodMiniString<string>]>>;
|
|
97
|
-
}, z.core.$strip>]>>>;
|
|
98
|
-
masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
99
|
-
tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
|
|
100
|
-
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
101
|
-
allowText: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
102
|
-
repeat: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
103
|
-
variants: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
104
|
-
}, z.core.$strip>>;
|
|
105
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
106
|
-
type: z.ZodMiniLiteral<"Number">;
|
|
107
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
108
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
109
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
110
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
111
|
-
min: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
112
|
-
max: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
113
|
-
step: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
114
|
-
}, z.core.$strip>>;
|
|
115
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
116
|
-
type: z.ZodMiniLiteral<"Range">;
|
|
117
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
118
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
119
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
120
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
121
|
-
min: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
122
|
-
max: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
123
|
-
step: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
124
|
-
}, z.core.$strip>>;
|
|
125
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
126
|
-
type: z.ZodMiniLiteral<"StructuredText">;
|
|
127
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
128
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
129
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
130
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
131
|
-
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
132
|
-
single: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
|
|
133
|
-
multi: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
|
|
134
|
-
imageConstraint: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
135
|
-
width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
136
|
-
height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
|
|
137
|
-
}, z.core.$strip>>;
|
|
138
|
-
labels: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniNull, z.ZodMiniTransform<string[], null>>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string[], string>>, z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
139
|
-
name: z.ZodMiniString<string>;
|
|
140
|
-
}, z.core.$strip>>>, z.ZodMiniTransform<string[], Record<string, {
|
|
141
|
-
name: string;
|
|
142
|
-
}[]>>>]>, z.ZodMiniTransform<readonly string[], string[]>>>;
|
|
143
|
-
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
144
|
-
}, z.core.$strip>>;
|
|
145
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
146
|
-
type: z.ZodMiniLiteral<"Select">;
|
|
147
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
148
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
149
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
150
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
151
|
-
default_value: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
152
|
-
options: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniPipe<z.ZodMiniNumber<number>, z.ZodMiniTransform<string, number>>, z.ZodMiniPipe<z.ZodMiniBoolean<boolean>, z.ZodMiniTransform<string, boolean>>]>>>>;
|
|
153
|
-
}, z.core.$strip>>;
|
|
154
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
155
|
-
type: z.ZodMiniLiteral<"Separator">;
|
|
156
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
157
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
158
|
-
}, z.core.$strip>>;
|
|
159
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
160
|
-
type: z.ZodMiniLiteral<"Table">;
|
|
161
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
162
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
163
|
-
}, z.core.$strip>>;
|
|
164
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
165
|
-
type: z.ZodMiniLiteral<"Text">;
|
|
166
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
167
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
168
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
169
|
-
useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
170
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
171
|
-
}, z.core.$strip>>;
|
|
172
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
173
|
-
type: z.ZodMiniLiteral<"Timestamp">;
|
|
174
|
-
fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
175
|
-
config: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
176
|
-
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
177
|
-
placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
178
|
-
default: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
179
|
-
}, z.core.$strip>>;
|
|
180
|
-
}, z.core.$strip>]>;
|
|
181
|
-
type NestableModel = z.infer<typeof NestableModelSchema>;
|
|
20
|
+
type NestableModel = BooleanModel | ColorModel | DateModel | EmbedModel | GeoPointModel | ImageModel | IntegrationFieldModel | LinkModel | NumberModel | RangeModel | RichTextModel | SelectModel | SeparatorModel | TableModel | TextModel | TimestampModel;
|
|
182
21
|
//#endregion
|
|
183
22
|
export { NestableModel };
|
|
184
23
|
//# sourceMappingURL=nestable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/model/nestable.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/model/nestable.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAsDY,aAAA,GACT,YAAA,GACA,UAAA,GACA,SAAA,GACA,UAAA,GACA,aAAA,GACA,UAAA,GACA,qBAAA,GACA,SAAA,GACA,WAAA,GACA,UAAA,GACA,aAAA,GACA,WAAA,GACA,cAAA,GACA,UAAA,GACA,SAAA,GACA,cAAA"}
|
package/dist/model/nestable.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { ImageModelSchema } from "./image.js";
|
|
2
|
+
import { RichTextModelSchema } from "./richText.js";
|
|
3
|
+
import { TableModelSchema } from "./table.js";
|
|
1
4
|
import { BooleanModelSchema } from "./boolean.js";
|
|
2
5
|
import { ColorModelSchema } from "./color.js";
|
|
3
6
|
import { DateModelSchema } from "./date.js";
|
|
4
7
|
import { EmbedModelSchema } from "./embed.js";
|
|
5
8
|
import { GeoPointModelSchema } from "./geopoint.js";
|
|
6
|
-
import { ImageModelSchema } from "./image.js";
|
|
7
9
|
import { IntegrationFieldModelSchema } from "./integrationField.js";
|
|
8
10
|
import { LinkModelSchema } from "./link.js";
|
|
9
11
|
import { NumberModelSchema } from "./number.js";
|
|
10
12
|
import { RangeModelSchema } from "./range.js";
|
|
11
|
-
import { RichTextModelSchema } from "./richText.js";
|
|
12
13
|
import { SelectModelSchema } from "./select.js";
|
|
13
14
|
import { SeparatorModelSchema } from "./separator.js";
|
|
14
|
-
import { TableModelSchema } from "./table.js";
|
|
15
15
|
import { TextModelSchema } from "./text.js";
|
|
16
16
|
import { TimestampModelSchema } from "./timestamp.js";
|
|
17
17
|
import { z } from "zod/mini";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestable.js","names":[],"sources":["../../src/model/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { BooleanModelSchema } from \"./boolean\"\nimport { ColorModelSchema } from \"./color\"\nimport { DateModelSchema } from \"./date\"\nimport { EmbedModelSchema } from \"./embed\"\nimport { GeoPointModelSchema } from \"./geopoint\"\nimport { ImageModelSchema } from \"./image\"\nimport { IntegrationFieldModelSchema } from \"./integrationField\"\nimport { LinkModelSchema } from \"./link\"\nimport { NumberModelSchema } from \"./number\"\nimport { RangeModelSchema } from \"./range\"\nimport { RichTextModelSchema } from \"./richText\"\nimport { SelectModelSchema } from \"./select\"\nimport { SeparatorModelSchema } from \"./separator\"\nimport { TableModelSchema } from \"./table\"\nimport { TextModelSchema } from \"./text\"\nimport { TimestampModelSchema } from \"./timestamp\"\n\nexport const NestableModelSchema = z.union([\n\tBooleanModelSchema,\n\tColorModelSchema,\n\tDateModelSchema,\n\tEmbedModelSchema,\n\tGeoPointModelSchema,\n\tImageModelSchema,\n\tIntegrationFieldModelSchema,\n\tLinkModelSchema,\n\tNumberModelSchema,\n\tRangeModelSchema,\n\tRichTextModelSchema,\n\tSelectModelSchema,\n\tSeparatorModelSchema,\n\tTableModelSchema,\n\tTextModelSchema,\n\tTimestampModelSchema,\n])\n\nexport type NestableModel
|
|
1
|
+
{"version":3,"file":"nestable.js","names":[],"sources":["../../src/model/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { BooleanModel } from \"./boolean\"\nimport { BooleanModelSchema } from \"./boolean\"\nimport type { ColorModel } from \"./color\"\nimport { ColorModelSchema } from \"./color\"\nimport type { DateModel } from \"./date\"\nimport { DateModelSchema } from \"./date\"\nimport type { EmbedModel } from \"./embed\"\nimport { EmbedModelSchema } from \"./embed\"\nimport type { GeoPointModel } from \"./geopoint\"\nimport { GeoPointModelSchema } from \"./geopoint\"\nimport type { ImageModel } from \"./image\"\nimport { ImageModelSchema } from \"./image\"\nimport type { IntegrationFieldModel } from \"./integrationField\"\nimport { IntegrationFieldModelSchema } from \"./integrationField\"\nimport type { LinkModel } from \"./link\"\nimport { LinkModelSchema } from \"./link\"\nimport type { NumberModel } from \"./number\"\nimport { NumberModelSchema } from \"./number\"\nimport type { RangeModel } from \"./range\"\nimport { RangeModelSchema } from \"./range\"\nimport type { RichTextModel } from \"./richText\"\nimport { RichTextModelSchema } from \"./richText\"\nimport type { SelectModel } from \"./select\"\nimport { SelectModelSchema } from \"./select\"\nimport type { SeparatorModel } from \"./separator\"\nimport { SeparatorModelSchema } from \"./separator\"\nimport type { TableModel } from \"./table\"\nimport { TableModelSchema } from \"./table\"\nimport type { TextModel } from \"./text\"\nimport { TextModelSchema } from \"./text\"\nimport type { TimestampModel } from \"./timestamp\"\nimport { TimestampModelSchema } from \"./timestamp\"\n\nexport const NestableModelSchema = z.union([\n\tBooleanModelSchema,\n\tColorModelSchema,\n\tDateModelSchema,\n\tEmbedModelSchema,\n\tGeoPointModelSchema,\n\tImageModelSchema,\n\tIntegrationFieldModelSchema,\n\tLinkModelSchema,\n\tNumberModelSchema,\n\tRangeModelSchema,\n\tRichTextModelSchema,\n\tSelectModelSchema,\n\tSeparatorModelSchema,\n\tTableModelSchema,\n\tTextModelSchema,\n\tTimestampModelSchema,\n])\n\nexport type NestableModel =\n\t| BooleanModel\n\t| ColorModel\n\t| DateModel\n\t| EmbedModel\n\t| GeoPointModel\n\t| ImageModel\n\t| IntegrationFieldModel\n\t| LinkModel\n\t| NumberModel\n\t| RangeModel\n\t| RichTextModel\n\t| SelectModel\n\t| SeparatorModel\n\t| TableModel\n\t| TextModel\n\t| TimestampModel\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAa,sBAAsB,EAAE,MAAM;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
|
package/dist/model/richText.d.ts
CHANGED
|
@@ -11,14 +11,10 @@ declare const RichTextModelSchema: z.ZodMiniObject<{
|
|
|
11
11
|
single: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
|
|
12
12
|
multi: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
|
|
13
13
|
imageConstraint: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
14
|
-
width: z.ZodMiniOptional<z.
|
|
15
|
-
height: z.ZodMiniOptional<z.
|
|
14
|
+
width: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
|
|
15
|
+
height: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
|
|
16
16
|
}, z.core.$strip>>;
|
|
17
|
-
labels: z.ZodMiniOptional<z.
|
|
18
|
-
name: z.ZodMiniString<string>;
|
|
19
|
-
}, z.core.$strip>>>, z.ZodMiniTransform<string[], Record<string, {
|
|
20
|
-
name: string;
|
|
21
|
-
}[]>>>]>, z.ZodMiniTransform<readonly string[], string[]>>>;
|
|
17
|
+
labels: z.ZodMiniOptional<z.ZodMiniType<string[], unknown, z.core.$ZodTypeInternals<string[], unknown>>>;
|
|
22
18
|
allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
23
19
|
}, z.core.$strip>>;
|
|
24
20
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/model/richText.ts"],"mappings":";;;cAmGa,mBAAA,EAAmB,CAAA,CAAA,aAAA
|
|
1
|
+
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/model/richText.ts"],"mappings":";;;cAmGa,mBAAA,EAAmB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;KAMpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA"}
|
package/dist/model/richText.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod/mini";
|
|
|
3
3
|
//#region src/model/richText.ts
|
|
4
4
|
const RichTextFieldType = "StructuredText";
|
|
5
5
|
const DEFAULT_OPTION = "paragraph";
|
|
6
|
-
const
|
|
6
|
+
const RichTextNodeType = {
|
|
7
7
|
heading1: "heading1",
|
|
8
8
|
heading2: "heading2",
|
|
9
9
|
heading3: "heading3",
|
|
@@ -20,7 +20,8 @@ const VALID_NODE_TYPES = Object.values({
|
|
|
20
20
|
strong: "strong",
|
|
21
21
|
em: "em",
|
|
22
22
|
rtl: "rtl"
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
|
+
const VALID_NODE_TYPES = Object.values(RichTextNodeType);
|
|
24
25
|
/**
|
|
25
26
|
* RichTextOptions parses comma-separated node types, filters invalid ones,
|
|
26
27
|
* and defaults to "paragraph" if empty or null.
|
|
@@ -67,6 +68,6 @@ const RichTextModelSchema = z.object({
|
|
|
67
68
|
config: z.optional(RichTextConfigSchema)
|
|
68
69
|
});
|
|
69
70
|
//#endregion
|
|
70
|
-
export { RichTextModelSchema };
|
|
71
|
+
export { RichTextModelSchema, RichTextNodeType };
|
|
71
72
|
|
|
72
73
|
//# sourceMappingURL=richText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.js","names":[],"sources":["../../src/model/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { ImageConstraintSchema } from \"./image\"\n\nexport const RichTextFieldType = \"StructuredText\"\n\nexport const DEFAULT_OPTION = \"paragraph\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\torderedList: \"o-list-item\",\n\tlist: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\trtl: \"rtl\",\n} as const\n\nconst VALID_NODE_TYPES = Object.values(RichTextNodeType)\n\n/**\n * RichTextOptions parses comma-separated node types, filters invalid ones,\n * and defaults to \"paragraph\" if empty or null.\n */\nconst RichTextOptionsSchema = z.pipe(\n\tz.union([z.string(), z.null()]),\n\tz.transform((s: string | null) => {\n\t\tif (!s) return DEFAULT_OPTION\n\t\tconst entries = s.split(\",\").map((e: string) => e.trim())\n\t\tconst filtered = entries.filter((e: string) =>\n\t\t\tVALID_NODE_TYPES.includes(e as (typeof VALID_NODE_TYPES)[number]),\n\t\t)\n\t\treturn filtered.length ? filtered.join(\",\") : DEFAULT_OPTION\n\t}),\n)\n\n/**\n * RichTextLabels accepts multiple formats and normalizes to string[]:\n * - null → []\n * - \"label\" → [\"label\"]\n * - [\"a\", \"b\"] → [\"a\", \"b\"]\n * - { \"\": [{name: \"a\"}], \"key\": [{name: \"b\"}] } → [\"a\", \"b\"] (legacy format)\n */\nconst LegacyLabelsFormat = z.record(z.string(), z.array(z.object({ name: z.string() })))\n\nconst RichTextLabelsSchema = z.pipe(\n\tz.union([\n\t\tz.pipe(\n\t\t\tz.null(),\n\t\t\tz.transform(() => [] as string[]),\n\t\t),\n\t\tz.pipe(\n\t\t\tz.string(),\n\t\t\tz.transform((s: string) => [s]),\n\t\t),\n\t\tz.array(z.string()),\n\t\tz.pipe(\n\t\t\tLegacyLabelsFormat,\n\t\t\tz.transform((obj: Record<string, Array<{ name: string }>>) => {\n\t\t\t\tconst entries = Object.entries(obj)\n\t\t\t\tif (!entries.length) return [] as string[]\n\n\t\t\t\t// Handle legacy format with empty key\n\t\t\t\tif (obj[\"\"]) {\n\t\t\t\t\treturn obj[\"\"].map((l: { name: string }) => l.name)\n\t\t\t\t}\n\n\t\t\t\t// Convert all entries to flat array of names\n\t\t\t\treturn entries\n\t\t\t\t\t.reduce<string[]>((acc, [, labelsEntries]) => {\n\t\t\t\t\t\treturn acc.concat(labelsEntries.map((l: { name: string }) => l.name))\n\t\t\t\t\t}, [])\n\t\t\t\t\t.filter(Boolean)\n\t\t\t}),\n\t\t),\n\t]),\n\tz.transform((result: string[]) => result as
|
|
1
|
+
{"version":3,"file":"richText.js","names":[],"sources":["../../src/model/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { ImageConstraintSchema } from \"./image\"\n\nexport const RichTextFieldType = \"StructuredText\"\n\nexport const DEFAULT_OPTION = \"paragraph\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\torderedList: \"o-list-item\",\n\tlist: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\trtl: \"rtl\",\n} as const\n\nconst VALID_NODE_TYPES = Object.values(RichTextNodeType)\n\n/**\n * RichTextOptions parses comma-separated node types, filters invalid ones,\n * and defaults to \"paragraph\" if empty or null.\n */\nconst RichTextOptionsSchema = z.pipe(\n\tz.union([z.string(), z.null()]),\n\tz.transform((s: string | null) => {\n\t\tif (!s) return DEFAULT_OPTION\n\t\tconst entries = s.split(\",\").map((e: string) => e.trim())\n\t\tconst filtered = entries.filter((e: string) =>\n\t\t\tVALID_NODE_TYPES.includes(e as (typeof VALID_NODE_TYPES)[number]),\n\t\t)\n\t\treturn filtered.length ? filtered.join(\",\") : DEFAULT_OPTION\n\t}),\n)\n\n/**\n * RichTextLabels accepts multiple formats and normalizes to string[]:\n * - null → []\n * - \"label\" → [\"label\"]\n * - [\"a\", \"b\"] → [\"a\", \"b\"]\n * - { \"\": [{name: \"a\"}], \"key\": [{name: \"b\"}] } → [\"a\", \"b\"] (legacy format)\n */\nconst LegacyLabelsFormat = z.record(z.string(), z.array(z.object({ name: z.string() })))\n\nconst RichTextLabelsSchema: z.ZodMiniType<string[]> = z.pipe(\n\tz.union([\n\t\tz.pipe(\n\t\t\tz.null(),\n\t\t\tz.transform(() => [] as string[]),\n\t\t),\n\t\tz.pipe(\n\t\t\tz.string(),\n\t\t\tz.transform((s: string) => [s]),\n\t\t),\n\t\tz.array(z.string()),\n\t\tz.pipe(\n\t\t\tLegacyLabelsFormat,\n\t\t\tz.transform((obj: Record<string, Array<{ name: string }>>) => {\n\t\t\t\tconst entries = Object.entries(obj)\n\t\t\t\tif (!entries.length) return [] as string[]\n\n\t\t\t\t// Handle legacy format with empty key\n\t\t\t\tif (obj[\"\"]) {\n\t\t\t\t\treturn obj[\"\"].map((l: { name: string }) => l.name)\n\t\t\t\t}\n\n\t\t\t\t// Convert all entries to flat array of names\n\t\t\t\treturn entries\n\t\t\t\t\t.reduce<string[]>((acc, [, labelsEntries]) => {\n\t\t\t\t\t\treturn acc.concat(labelsEntries.map((l: { name: string }) => l.name))\n\t\t\t\t\t}, [])\n\t\t\t\t\t.filter(Boolean)\n\t\t\t}),\n\t\t),\n\t]),\n\tz.transform((result: string[]) => result as string[]),\n)\n\nconst RichTextConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tsingle: z.optional(RichTextOptionsSchema),\n\tmulti: z.optional(RichTextOptionsSchema),\n\timageConstraint: z.optional(ImageConstraintSchema),\n\tlabels: z.optional(RichTextLabelsSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n})\n\nexport const RichTextModelSchema = z.object({\n\ttype: z.literal(RichTextFieldType),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(RichTextConfigSchema),\n})\n\nexport type RichTextModel = z.infer<typeof RichTextModelSchema>\n"],"mappings":";;;AAIA,MAAa,oBAAoB;AAEjC,MAAa,iBAAiB;AAE9B,MAAa,mBAAmB;CAC/B,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,WAAW;CACX,cAAc;CACd,aAAa;CACb,MAAM;CACN,OAAO;CACP,OAAO;CACP,WAAW;CACX,QAAQ;CACR,IAAI;CACJ,KAAK;CACL;AAED,MAAM,mBAAmB,OAAO,OAAO,iBAAiB;;;;;AAMxD,MAAM,wBAAwB,EAAE,KAC/B,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC,EAC/B,EAAE,WAAW,MAAqB;AACjC,KAAI,CAAC,EAAG,QAAO;CAEf,MAAM,WADU,EAAE,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC,CAChC,QAAQ,MAChC,iBAAiB,SAAS,EAAuC,CACjE;AACD,QAAO,SAAS,SAAS,SAAS,KAAK,IAAI,GAAG;EAC7C,CACF;;;;;;;;AASD,MAAM,qBAAqB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAExF,MAAM,uBAAgD,EAAE,KACvD,EAAE,MAAM;CACP,EAAE,KACD,EAAE,MAAM,EACR,EAAE,gBAAgB,EAAE,CAAa,CACjC;CACD,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,CAAC,EAAE,CAAC,CAC/B;CACD,EAAE,MAAM,EAAE,QAAQ,CAAC;CACnB,EAAE,KACD,oBACA,EAAE,WAAW,QAAiD;EAC7D,MAAM,UAAU,OAAO,QAAQ,IAAI;AACnC,MAAI,CAAC,QAAQ,OAAQ,QAAO,EAAE;AAG9B,MAAI,IAAI,IACP,QAAO,IAAI,IAAI,KAAK,MAAwB,EAAE,KAAK;AAIpD,SAAO,QACL,QAAkB,KAAK,GAAG,mBAAmB;AAC7C,UAAO,IAAI,OAAO,cAAc,KAAK,MAAwB,EAAE,KAAK,CAAC;KACnE,EAAE,CAAC,CACL,OAAO,QAAQ;GAChB,CACF;CACD,CAAC,EACF,EAAE,WAAW,WAAqB,OAAmB,CACrD;AAED,MAAM,uBAAuB,EAAE,OAAO;CACrC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC;CACnC,QAAQ,EAAE,SAAS,sBAAsB;CACzC,OAAO,EAAE,SAAS,sBAAsB;CACxC,iBAAiB,EAAE,SAAS,sBAAsB;CAClD,QAAQ,EAAE,SAAS,qBAAqB;CACxC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC;CACzC,CAAC;AAEF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,kBAAkB;CAClC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC"}
|