@prismicio/types-internal 4.6.0-pr.25.41a8b18 → 4.6.0-pr.26.ebb6cbc
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/common/asset.d.ts +1 -2
- package/dist/common/asset.d.ts.map +1 -1
- package/dist/common/asset.js.map +1 -1
- package/dist/common/embed.d.ts +1 -2
- package/dist/common/embed.d.ts.map +1 -1
- package/dist/common/embed.js.map +1 -1
- package/dist/common/hexaColorCode.d.ts +1 -2
- package/dist/common/hexaColorCode.d.ts.map +1 -1
- package/dist/common/hexaColorCode.js.map +1 -1
- package/dist/common/nonEmptyString.d.ts +1 -2
- package/dist/common/nonEmptyString.d.ts.map +1 -1
- package/dist/common/nonEmptyString.js.map +1 -1
- package/dist/common/widgetKey.d.ts +1 -2
- package/dist/common/widgetKey.d.ts.map +1 -1
- package/dist/common/widgetKey.js.map +1 -1
- package/dist/content/boolean.d.ts +1 -2
- package/dist/content/boolean.d.ts.map +1 -1
- package/dist/content/boolean.js.map +1 -1
- package/dist/content/codec/boolean.js.map +1 -1
- package/dist/content/codec/document.js.map +1 -1
- package/dist/content/codec/embed.js.map +1 -1
- package/dist/content/codec/empty.js.map +1 -1
- package/dist/content/codec/field.js.map +1 -1
- package/dist/content/codec/geopoint.js.map +1 -1
- package/dist/content/codec/group.js +6 -4
- package/dist/content/codec/group.js.map +1 -1
- package/dist/content/codec/image.js.map +1 -1
- package/dist/content/codec/integrationField.js.map +1 -1
- package/dist/content/codec/legacyContentCtx.d.ts +2 -15
- package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
- package/dist/content/codec/legacyContentCtx.js.map +1 -1
- package/dist/content/codec/link.js.map +1 -1
- package/dist/content/codec/nestable.js.map +1 -1
- package/dist/content/codec/repeatable.js.map +1 -1
- package/dist/content/codec/richText.js.map +1 -1
- package/dist/content/codec/separator.js.map +1 -1
- package/dist/content/codec/slice.js.map +1 -1
- package/dist/content/codec/slices.js.map +1 -1
- package/dist/content/codec/table.js.map +1 -1
- package/dist/content/codec/uid.js.map +1 -1
- package/dist/content/codec/widget.js.map +1 -1
- package/dist/content/document.d.ts +1 -2
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/document.js.map +1 -1
- package/dist/content/embed.d.ts +1 -2
- package/dist/content/embed.d.ts.map +1 -1
- package/dist/content/embed.js.map +1 -1
- package/dist/content/empty.d.ts +1 -2
- package/dist/content/empty.d.ts.map +1 -1
- package/dist/content/empty.js.map +1 -1
- package/dist/content/field.d.ts +1 -2
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/geopoint.d.ts +1 -2
- package/dist/content/geopoint.d.ts.map +1 -1
- package/dist/content/geopoint.js.map +1 -1
- package/dist/content/group.d.ts +3 -2
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/image.d.ts +1 -2
- package/dist/content/image.d.ts.map +1 -1
- package/dist/content/image.js.map +1 -1
- package/dist/content/integrationField.d.ts +1 -2
- package/dist/content/integrationField.d.ts.map +1 -1
- package/dist/content/integrationField.js.map +1 -1
- package/dist/content/legacy/boolean.js.map +1 -1
- package/dist/content/legacy/document.d.ts +1 -2
- package/dist/content/legacy/document.d.ts.map +1 -1
- package/dist/content/legacy/document.js.map +1 -1
- package/dist/content/legacy/embed.js.map +1 -1
- package/dist/content/legacy/empty.js.map +1 -1
- package/dist/content/legacy/field.js.map +1 -1
- package/dist/content/legacy/geopoint.js.map +1 -1
- package/dist/content/legacy/group.d.ts +2 -2
- package/dist/content/legacy/group.d.ts.map +1 -1
- package/dist/content/legacy/group.js.map +1 -1
- package/dist/content/legacy/image.d.ts +0 -1
- package/dist/content/legacy/image.d.ts.map +1 -1
- package/dist/content/legacy/image.js.map +1 -1
- package/dist/content/legacy/integrationField.js.map +1 -1
- package/dist/content/legacy/link.d.ts +1 -2
- package/dist/content/legacy/link.d.ts.map +1 -1
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/nestable.d.ts +12 -0
- package/dist/content/legacy/nestable.js.map +1 -1
- package/dist/content/legacy/repeatable.js.map +1 -1
- package/dist/content/legacy/richText.d.ts +5 -2
- package/dist/content/legacy/richText.d.ts.map +1 -1
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/legacy/separator.js.map +1 -1
- package/dist/content/legacy/slice.js +1 -1
- package/dist/content/legacy/slice.js.map +1 -1
- package/dist/content/legacy/slices.js.map +1 -1
- package/dist/content/legacy/table.d.ts +2 -0
- package/dist/content/legacy/table.js.map +1 -1
- package/dist/content/legacy/uid.js.map +1 -1
- package/dist/content/link.d.ts +7 -8
- package/dist/content/link.d.ts.map +1 -1
- package/dist/content/link.js.map +1 -1
- package/dist/content/nestable.d.ts +0 -1
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/repeatable.d.ts +3 -4
- package/dist/content/repeatable.d.ts.map +1 -1
- package/dist/content/repeatable.js.map +1 -1
- package/dist/content/richText.d.ts +2 -3
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +2 -2
- package/dist/content/richText.js.map +1 -1
- package/dist/content/separator.d.ts +1 -2
- package/dist/content/separator.d.ts.map +1 -1
- package/dist/content/separator.js.map +1 -1
- package/dist/content/slice.d.ts +13 -14
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +13 -14
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/slices.js.map +1 -1
- package/dist/content/table.d.ts +1 -2
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/table.js.map +1 -1
- package/dist/content/uid.d.ts +1 -2
- package/dist/content/uid.d.ts.map +1 -1
- package/dist/content/uid.js.map +1 -1
- package/dist/content/widget.d.ts +0 -1
- package/dist/content/widget.d.ts.map +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/contentPath.d.ts +1 -1
- package/dist/helpers/contentPath.d.ts.map +1 -1
- package/dist/helpers/contentPath.js +1 -1
- package/dist/helpers/contentPath.js.map +1 -1
- package/dist/helpers/customTypeModel.d.ts +1 -3
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js +1 -1
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/helpers/documentContent.d.ts +1 -3
- package/dist/helpers/documentContent.d.ts.map +1 -1
- package/dist/helpers/documentContent.js +1 -1
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/helpers/fieldModel.d.ts +1 -1
- package/dist/helpers/fieldModel.d.ts.map +1 -1
- package/dist/helpers/fieldModel.js +1 -1
- package/dist/helpers/fieldModel.js.map +1 -1
- package/dist/helpers/imageContent.d.ts +2 -6
- package/dist/helpers/imageContent.d.ts.map +1 -1
- package/dist/helpers/imageContent.js +1 -1
- package/dist/helpers/imageContent.js.map +1 -1
- package/dist/helpers/repository.d.ts +1 -1
- package/dist/helpers/repository.d.ts.map +1 -1
- package/dist/helpers/repository.js +1 -1
- package/dist/helpers/repository.js.map +1 -1
- package/dist/helpers/sliceContent.d.ts +1 -3
- package/dist/helpers/sliceContent.d.ts.map +1 -1
- package/dist/helpers/sliceContent.js.map +1 -1
- package/dist/helpers/sliceModel.d.ts +1 -1
- package/dist/helpers/sliceModel.d.ts.map +1 -1
- package/dist/helpers/sliceModel.js +1 -1
- package/dist/helpers/sliceModel.js.map +1 -1
- package/dist/helpers/traverseContent.d.ts +0 -1
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +0 -1
- package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
- package/dist/helpers/traverseContentWithModel.js.map +1 -1
- package/dist/helpers/withDefaultContent.d.ts +1 -3
- package/dist/helpers/withDefaultContent.d.ts.map +1 -1
- package/dist/helpers/withDefaultContent.js +1 -1
- package/dist/helpers/withDefaultContent.js.map +1 -1
- package/dist/io-ts.d.ts +1153 -1159
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js.map +1 -1
- package/dist/model/boolean.d.ts +1 -2
- package/dist/model/boolean.d.ts.map +1 -1
- package/dist/model/boolean.js.map +1 -1
- package/dist/model/color.d.ts +1 -2
- package/dist/model/color.d.ts.map +1 -1
- package/dist/model/color.js.map +1 -1
- package/dist/model/customType.d.ts +3 -4
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/customType.js +1 -1
- package/dist/model/customType.js.map +1 -1
- package/dist/model/date.d.ts +1 -2
- package/dist/model/date.d.ts.map +1 -1
- package/dist/model/date.js.map +1 -1
- package/dist/model/embed.d.ts +1 -2
- package/dist/model/embed.d.ts.map +1 -1
- package/dist/model/embed.js.map +1 -1
- package/dist/model/geopoint.d.ts +1 -2
- package/dist/model/geopoint.d.ts.map +1 -1
- package/dist/model/geopoint.js.map +1 -1
- package/dist/model/group.d.ts +39 -40
- package/dist/model/group.d.ts.map +1 -1
- package/dist/model/group.js +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/image.d.ts +1 -2
- package/dist/model/image.d.ts.map +1 -1
- package/dist/model/image.js +1 -1
- package/dist/model/image.js.map +1 -1
- package/dist/model/integrationField.d.ts +1 -2
- package/dist/model/integrationField.d.ts.map +1 -1
- package/dist/model/integrationField.js.map +1 -1
- package/dist/model/link.d.ts +2 -3
- package/dist/model/link.d.ts.map +1 -1
- package/dist/model/link.js.map +1 -1
- package/dist/model/nestable.d.ts +0 -1
- package/dist/model/nestable.d.ts.map +1 -1
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/number.d.ts +1 -2
- package/dist/model/number.d.ts.map +1 -1
- package/dist/model/number.js.map +1 -1
- package/dist/model/range.d.ts +1 -2
- package/dist/model/range.d.ts.map +1 -1
- package/dist/model/range.js.map +1 -1
- package/dist/model/richText.d.ts +1 -2
- package/dist/model/richText.d.ts.map +1 -1
- package/dist/model/richText.js +1 -1
- package/dist/model/richText.js.map +1 -1
- package/dist/model/select.d.ts +1 -2
- package/dist/model/select.d.ts.map +1 -1
- package/dist/model/select.js.map +1 -1
- package/dist/model/separator.d.ts +1 -2
- package/dist/model/separator.d.ts.map +1 -1
- package/dist/model/separator.js.map +1 -1
- package/dist/model/slice.d.ts +44 -45
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +1 -1
- package/dist/model/slice.js.map +1 -1
- package/dist/model/slices.d.ts +1 -2
- package/dist/model/slices.d.ts.map +1 -1
- package/dist/model/slices.js +1 -1
- package/dist/model/slices.js.map +1 -1
- package/dist/model/table.d.ts +3 -3
- package/dist/model/table.d.ts.map +1 -1
- package/dist/model/table.js.map +1 -1
- package/dist/model/text.d.ts +1 -2
- package/dist/model/text.d.ts.map +1 -1
- package/dist/model/text.js.map +1 -1
- package/dist/model/timestamp.d.ts +1 -2
- package/dist/model/timestamp.d.ts.map +1 -1
- package/dist/model/timestamp.js.map +1 -1
- package/dist/model/uid.d.ts +1 -2
- package/dist/model/uid.d.ts.map +1 -1
- package/dist/model/uid.js.map +1 -1
- package/dist/model/widget.d.ts +25 -26
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +1 -1
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +3351 -3353
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js.map +1 -1
- package/package.json +11 -12
- package/src/helpers/customTypeModel.ts +3 -1
- package/src/model/image.ts +4 -1
package/dist/content/slices.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { RichTextContentBlock } from "./richText.js";
|
|
|
3
3
|
import { GroupItemContent } from "./group.js";
|
|
4
4
|
import { SliceContent } from "./slice.js";
|
|
5
5
|
import { z } from "zod/mini";
|
|
6
|
-
|
|
7
6
|
//#region src/content/slices.d.ts
|
|
8
7
|
declare const LegacySliceItemContentSchema: z.ZodMiniObject<{
|
|
9
8
|
key: z.ZodMiniString<string>;
|
|
@@ -96,12 +95,12 @@ declare const LegacySliceItemContentSchema: z.ZodMiniObject<{
|
|
|
96
95
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
97
96
|
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
98
97
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
99
|
-
variant?: string | undefined;
|
|
100
98
|
text?: string | undefined;
|
|
99
|
+
variant?: string | undefined;
|
|
101
100
|
} & LinkContentValue, {
|
|
102
|
-
value: LinkContentValue;
|
|
103
101
|
text?: string | undefined;
|
|
104
102
|
variant?: string | undefined;
|
|
103
|
+
value: LinkContentValue;
|
|
105
104
|
}>>;
|
|
106
105
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
107
106
|
__TYPE__: z.ZodMiniLiteral<"RepeatableContent">;
|
|
@@ -118,12 +117,12 @@ declare const LegacySliceItemContentSchema: z.ZodMiniObject<{
|
|
|
118
117
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
119
118
|
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
120
119
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
121
|
-
variant?: string | undefined;
|
|
122
120
|
text?: string | undefined;
|
|
121
|
+
variant?: string | undefined;
|
|
123
122
|
} & LinkContentValue, {
|
|
124
|
-
value: LinkContentValue;
|
|
125
123
|
text?: string | undefined;
|
|
126
124
|
variant?: string | undefined;
|
|
125
|
+
value: LinkContentValue;
|
|
127
126
|
}>>;
|
|
128
127
|
}, z.core.$strip>>;
|
|
129
128
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
@@ -273,12 +272,12 @@ declare const CompositeSliceItemContentSchema: z.ZodMiniObject<{
|
|
|
273
272
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
274
273
|
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
275
274
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
276
|
-
variant?: string | undefined;
|
|
277
275
|
text?: string | undefined;
|
|
276
|
+
variant?: string | undefined;
|
|
278
277
|
} & LinkContentValue, {
|
|
279
|
-
value: LinkContentValue;
|
|
280
278
|
text?: string | undefined;
|
|
281
279
|
variant?: string | undefined;
|
|
280
|
+
value: LinkContentValue;
|
|
282
281
|
}>>;
|
|
283
282
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
284
283
|
__TYPE__: z.ZodMiniLiteral<"RepeatableContent">;
|
|
@@ -295,12 +294,12 @@ declare const CompositeSliceItemContentSchema: z.ZodMiniObject<{
|
|
|
295
294
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
296
295
|
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
297
296
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
298
|
-
variant?: string | undefined;
|
|
299
297
|
text?: string | undefined;
|
|
298
|
+
variant?: string | undefined;
|
|
300
299
|
} & LinkContentValue, {
|
|
301
|
-
value: LinkContentValue;
|
|
302
300
|
text?: string | undefined;
|
|
303
301
|
variant?: string | undefined;
|
|
302
|
+
value: LinkContentValue;
|
|
304
303
|
}>>;
|
|
305
304
|
}, z.core.$strip>>;
|
|
306
305
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
@@ -450,12 +449,12 @@ declare const SharedSliceItemContentSchema: z.ZodMiniObject<{
|
|
|
450
449
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
451
450
|
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
452
451
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
453
|
-
variant?: string | undefined;
|
|
454
452
|
text?: string | undefined;
|
|
453
|
+
variant?: string | undefined;
|
|
455
454
|
} & LinkContentValue, {
|
|
456
|
-
value: LinkContentValue;
|
|
457
455
|
text?: string | undefined;
|
|
458
456
|
variant?: string | undefined;
|
|
457
|
+
value: LinkContentValue;
|
|
459
458
|
}>>;
|
|
460
459
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
461
460
|
__TYPE__: z.ZodMiniLiteral<"RepeatableContent">;
|
|
@@ -472,12 +471,12 @@ declare const SharedSliceItemContentSchema: z.ZodMiniObject<{
|
|
|
472
471
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
473
472
|
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
474
473
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
475
|
-
variant?: string | undefined;
|
|
476
474
|
text?: string | undefined;
|
|
475
|
+
variant?: string | undefined;
|
|
477
476
|
} & LinkContentValue, {
|
|
478
|
-
value: LinkContentValue;
|
|
479
477
|
text?: string | undefined;
|
|
480
478
|
variant?: string | undefined;
|
|
479
|
+
value: LinkContentValue;
|
|
481
480
|
}>>;
|
|
482
481
|
}, z.core.$strip>>;
|
|
483
482
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
@@ -554,5 +553,5 @@ declare const SlicesContentSchema: z.ZodMiniObject<{
|
|
|
554
553
|
}, z.core.$strip>;
|
|
555
554
|
type SlicesContent = z.infer<typeof SlicesContentSchema>;
|
|
556
555
|
//#endregion
|
|
557
|
-
export { CompositeSliceItemContent, LegacySliceItemContent, SharedSliceItemContent, SliceItemContent, SlicesContent };
|
|
556
|
+
export { CompositeSliceItemContent, CompositeSliceItemContentSchema, LegacySliceItemContent, LegacySliceItemContentSchema, SharedSliceItemContent, SharedSliceItemContentSchema, SliceItemContent, SliceItemContentSchema, SlicesContent, SlicesContentSchema };
|
|
558
557
|
//# sourceMappingURL=slices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slices.d.ts","names":[],"sources":["../../src/content/slices.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slices.d.ts","names":[],"sources":["../../src/content/slices.ts"],"mappings":";;;;;;cA2Ba,8BAA4B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAE7B,yBAAyB,EAAE,aAAa;cAEvC,iCAA+B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIhC,4BAA4B,EAAE,aAAa;cAE1C,8BAA4B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAE7B,yBAAyB,EAAE,aAAa;cAGvC,wBAAsB,EAAA;;;;;;KAEvB,mBAAmB,EAAE,aAAa;cAOjC,qBAAmB,EAAA;;;;;;;;;KAKpB,gBAAgB,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slices.js","names":[],"sources":["../../src/content/slices.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport {\n\tCompositeSliceContentSchema,\n\tSharedSliceContentSchema,\n\tLegacySliceContentSchema,\n\tSliceContentSchema,\n} from \"./slice\"\n\n// Item\nconst getSliceItemContentSchema = <\n\tTWidgetSchema extends\n\t\t| typeof LegacySliceContentSchema\n\t\t| typeof CompositeSliceContentSchema\n\t\t| typeof SharedSliceContentSchema\n\t\t| typeof SliceContentSchema,\n>(\n\twidgetSchema: TWidgetSchema,\n) => {\n\treturn z.object({\n\t\tkey: z.string(),\n\t\tname: z.string(),\n\t\tmaybeLabel: z.optional(z.string()),\n\t\twidget: widgetSchema,\n\t})\n}\n\nexport const LegacySliceItemContentSchema = getSliceItemContentSchema(LegacySliceContentSchema)\n\nexport type LegacySliceItemContent = z.infer<typeof LegacySliceItemContentSchema>\n\nexport const CompositeSliceItemContentSchema = getSliceItemContentSchema(\n\tCompositeSliceContentSchema,\n)\n\nexport type CompositeSliceItemContent = z.infer<typeof CompositeSliceItemContentSchema>\n\nexport const SharedSliceItemContentSchema = getSliceItemContentSchema(SharedSliceContentSchema)\n\nexport type SharedSliceItemContent = z.infer<typeof SharedSliceItemContentSchema>\n\n// All\nexport const SliceItemContentSchema = getSliceItemContentSchema(SliceContentSchema)\n\nexport type SliceItemContent = z.infer<typeof SliceItemContentSchema>\n\n// Slices\n\n// Typo (missing `s`) is legacy...\nexport const SlicesContentType = \"SliceContentType\" as const\n\nexport const SlicesContentSchema = z.object({\n\t__TYPE__: z.literal(SlicesContentType),\n\tvalue: z.array(SliceItemContentSchema),\n})\n\nexport type SlicesContent = z.infer<typeof SlicesContentSchema>\n"],"mappings":";;;AAUA,MAAM,6BAOL,iBACI;
|
|
1
|
+
{"version":3,"file":"slices.js","names":[],"sources":["../../src/content/slices.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport {\n\tCompositeSliceContentSchema,\n\tSharedSliceContentSchema,\n\tLegacySliceContentSchema,\n\tSliceContentSchema,\n} from \"./slice\"\n\n// Item\nconst getSliceItemContentSchema = <\n\tTWidgetSchema extends\n\t\t| typeof LegacySliceContentSchema\n\t\t| typeof CompositeSliceContentSchema\n\t\t| typeof SharedSliceContentSchema\n\t\t| typeof SliceContentSchema,\n>(\n\twidgetSchema: TWidgetSchema,\n) => {\n\treturn z.object({\n\t\tkey: z.string(),\n\t\tname: z.string(),\n\t\tmaybeLabel: z.optional(z.string()),\n\t\twidget: widgetSchema,\n\t})\n}\n\nexport const LegacySliceItemContentSchema = getSliceItemContentSchema(LegacySliceContentSchema)\n\nexport type LegacySliceItemContent = z.infer<typeof LegacySliceItemContentSchema>\n\nexport const CompositeSliceItemContentSchema = getSliceItemContentSchema(\n\tCompositeSliceContentSchema,\n)\n\nexport type CompositeSliceItemContent = z.infer<typeof CompositeSliceItemContentSchema>\n\nexport const SharedSliceItemContentSchema = getSliceItemContentSchema(SharedSliceContentSchema)\n\nexport type SharedSliceItemContent = z.infer<typeof SharedSliceItemContentSchema>\n\n// All\nexport const SliceItemContentSchema = getSliceItemContentSchema(SliceContentSchema)\n\nexport type SliceItemContent = z.infer<typeof SliceItemContentSchema>\n\n// Slices\n\n// Typo (missing `s`) is legacy...\nexport const SlicesContentType = \"SliceContentType\" as const\n\nexport const SlicesContentSchema = z.object({\n\t__TYPE__: z.literal(SlicesContentType),\n\tvalue: z.array(SliceItemContentSchema),\n})\n\nexport type SlicesContent = z.infer<typeof SlicesContentSchema>\n"],"mappings":";;;AAUA,MAAM,6BAOL,iBACI;CACJ,OAAO,EAAE,OAAO;EACf,KAAK,EAAE,OAAO;EACd,MAAM,EAAE,OAAO;EACf,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC;EACjC,QAAQ;CACT,CAAC;AACF;AAEA,MAAa,+BAA+B,0BAA0B,wBAAwB;AAI9F,MAAa,kCAAkC,0BAC9C,2BACD;AAIA,MAAa,+BAA+B,0BAA0B,wBAAwB;AAK9F,MAAa,yBAAyB,0BAA0B,kBAAkB;AAOlF,MAAa,oBAAoB;AAEjC,MAAa,sBAAsB,EAAE,OAAO;CAC3C,UAAU,EAAE,QAAQ,iBAAiB;CACrC,OAAO,EAAE,MAAM,sBAAsB;AACtC,CAAC"}
|
package/dist/content/table.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RichTextContentBlock } from "./richText.js";
|
|
2
2
|
import { z } from "zod/mini";
|
|
3
|
-
|
|
4
3
|
//#region src/content/table.d.ts
|
|
5
4
|
declare const TableContentSchema: z.ZodMiniObject<{
|
|
6
5
|
__TYPE__: z.ZodMiniLiteral<"TableContent">;
|
|
@@ -20,5 +19,5 @@ declare const TableContentSchema: z.ZodMiniObject<{
|
|
|
20
19
|
}, z.core.$strip>;
|
|
21
20
|
type TableContent = z.infer<typeof TableContentSchema>;
|
|
22
21
|
//#endregion
|
|
23
|
-
export { TableContent };
|
|
22
|
+
export { TableContent, TableContentSchema };
|
|
24
23
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","names":[],"sources":["../../src/content/table.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.d.ts","names":[],"sources":["../../src/content/table.ts"],"mappings":";;;cAQa,oBAAkB,EAAA;;;;;;;;;;;;;;;;KAKnB,eAAe,EAAE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":[],"sources":["../../src/content/table.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { getTableRowSchema } from \"./legacy/table\"\nimport { RichTextContentSchema } from \"./richText\"\n\nexport const TableContentType = \"TableContent\" as const\n\n// Table\nexport const TableContentSchema = z.object({\n\t__TYPE__: z.literal(TableContentType),\n\tcontent: z.array(getTableRowSchema(RichTextContentSchema)),\n})\n\nexport type TableContent = z.infer<typeof TableContentSchema>\n"],"mappings":";;;;AAKA,MAAa,mBAAmB;AAGhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,UAAU,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../../src/content/table.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { getTableRowSchema } from \"./legacy/table\"\nimport { RichTextContentSchema } from \"./richText\"\n\nexport const TableContentType = \"TableContent\" as const\n\n// Table\nexport const TableContentSchema = z.object({\n\t__TYPE__: z.literal(TableContentType),\n\tcontent: z.array(getTableRowSchema(RichTextContentSchema)),\n})\n\nexport type TableContent = z.infer<typeof TableContentSchema>\n"],"mappings":";;;;AAKA,MAAa,mBAAmB;AAGhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,UAAU,EAAE,QAAQ,gBAAgB;CACpC,SAAS,EAAE,MAAM,kBAAkB,qBAAqB,CAAC;AAC1D,CAAC"}
|
package/dist/content/uid.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
|
-
|
|
3
2
|
//#region src/content/uid.d.ts
|
|
4
3
|
declare const UIDContentSchema: z.ZodMiniObject<{
|
|
5
4
|
__TYPE__: z.ZodMiniLiteral<"UIDContent">;
|
|
@@ -7,5 +6,5 @@ declare const UIDContentSchema: z.ZodMiniObject<{
|
|
|
7
6
|
}, z.core.$strip>;
|
|
8
7
|
type UIDContent = z.infer<typeof UIDContentSchema>;
|
|
9
8
|
//#endregion
|
|
10
|
-
export { UIDContent };
|
|
9
|
+
export { UIDContent, UIDContentSchema };
|
|
11
10
|
//# sourceMappingURL=uid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uid.d.ts","names":[],"sources":["../../src/content/uid.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uid.d.ts","names":[],"sources":["../../src/content/uid.ts"],"mappings":";;cAIa,kBAAgB,EAAA;;;;KAKjB,aAAa,EAAE,aAAa"}
|
package/dist/content/uid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uid.js","names":[],"sources":["../../src/content/uid.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const UIDContentType = \"UIDContent\" as const\n\nexport const UIDContentSchema = z.object({\n\t__TYPE__: z.literal(UIDContentType),\n\tvalue: z.string(),\n})\n\nexport type UIDContent = z.infer<typeof UIDContentSchema>\n"],"mappings":";;AAEA,MAAa,iBAAiB;AAE9B,MAAa,mBAAmB,EAAE,OAAO;CACxC,UAAU,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"uid.js","names":[],"sources":["../../src/content/uid.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const UIDContentType = \"UIDContent\" as const\n\nexport const UIDContentSchema = z.object({\n\t__TYPE__: z.literal(UIDContentType),\n\tvalue: z.string(),\n})\n\nexport type UIDContent = z.infer<typeof UIDContentSchema>\n"],"mappings":";;AAEA,MAAa,iBAAiB;AAE9B,MAAa,mBAAmB,EAAE,OAAO;CACxC,UAAU,EAAE,QAAQ,cAAc;CAClC,OAAO,EAAE,OAAO;AACjB,CAAC"}
|
package/dist/content/widget.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { GroupContent } from "./group.js";
|
|
|
3
3
|
import { SlicesContent } from "./slices.js";
|
|
4
4
|
import { UIDContent } from "./uid.js";
|
|
5
5
|
import { z } from "zod/mini";
|
|
6
|
-
|
|
7
6
|
//#region src/content/widget.d.ts
|
|
8
7
|
type WidgetContent = GroupContent | NestableContent | UIDContent | SlicesContent;
|
|
9
8
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","names":[],"sources":["../../src/content/widget.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"widget.d.ts","names":[],"sources":["../../src/content/widget.ts"],"mappings":";;;;;;KAkBY,gBAAgB,eAAe,kBAAkB,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","names":[],"sources":["../../src/content/widget.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { GroupContent } from \"./group\"\nimport { GroupContentSchema } from \"./group\"\nimport type { NestableContent } from \"./nestable\"\nimport { NestableContentSchema } from \"./nestable\"\nimport type { SlicesContent } from \"./slices\"\nimport { SlicesContentSchema } from \"./slices\"\nimport type { UIDContent } from \"./uid\"\nimport { UIDContentSchema } from \"./uid\"\n\nexport const WidgetContentSchema: z.ZodMiniType<WidgetContent> = z.discriminatedUnion(\"__TYPE__\", [\n\tGroupContentSchema,\n\tNestableContentSchema,\n\tUIDContentSchema,\n\tSlicesContentSchema,\n])\n\nexport type WidgetContent = GroupContent | NestableContent | UIDContent | SlicesContent\n\nexport type ContentType = WidgetContent[\"__TYPE__\"]\n"],"mappings":";;;;;;AAWA,MAAa,sBAAoD,EAAE,mBAAmB,YAAY;CACjG;CACA;CACA;CACA;
|
|
1
|
+
{"version":3,"file":"widget.js","names":[],"sources":["../../src/content/widget.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { GroupContent } from \"./group\"\nimport { GroupContentSchema } from \"./group\"\nimport type { NestableContent } from \"./nestable\"\nimport { NestableContentSchema } from \"./nestable\"\nimport type { SlicesContent } from \"./slices\"\nimport { SlicesContentSchema } from \"./slices\"\nimport type { UIDContent } from \"./uid\"\nimport { UIDContentSchema } from \"./uid\"\n\nexport const WidgetContentSchema: z.ZodMiniType<WidgetContent> = z.discriminatedUnion(\"__TYPE__\", [\n\tGroupContentSchema,\n\tNestableContentSchema,\n\tUIDContentSchema,\n\tSlicesContentSchema,\n])\n\nexport type WidgetContent = GroupContent | NestableContent | UIDContent | SlicesContent\n\nexport type ContentType = WidgetContent[\"__TYPE__\"]\n"],"mappings":";;;;;;AAWA,MAAa,sBAAoD,EAAE,mBAAmB,YAAY;CACjG;CACA;CACA;CACA;AACD,CAAC"}
|
|
@@ -11,5 +11,5 @@ declare function current(path: Path): Part | undefined;
|
|
|
11
11
|
declare function append(path: string, strElement: string): string;
|
|
12
12
|
declare function make(...entries: (Pick<Part, "type"> & Partial<Pick<Part, "key">>)[]): Path;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { Path, contentPath_d_exports };
|
|
14
|
+
export { Part, Path, append, contentPath_d_exports, current, make, serialize };
|
|
15
15
|
//# sourceMappingURL=contentPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentPath.d.ts","names":[],"sources":["../../src/helpers/contentPath.ts"],"mappings":";;;KAAY
|
|
1
|
+
{"version":3,"file":"contentPath.d.ts","names":[],"sources":["../../src/helpers/contentPath.ts"],"mappings":";;;KAAY;EACX;EAUA;;KAGW,OAAO,cAAc;iBAIjB,UAAU,MAAM;iBAIhB,QAAQ,MAAM,OAAO;iBAIrB,OAAO,cAAc;iBAIrB,QAAQ,UAAU,KAAK,gBAAgB,QAAQ,KAAK,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentPath.js","names":[],"sources":["../../src/helpers/contentPath.ts"],"sourcesContent":["export type Part = {\n\ttype:\n\t\t| \"CustomType\"\n\t\t| \"Widget\"\n\t\t| \"SharedSlice\"\n\t\t| \"Slice\"\n\t\t| \"LegacySlice\"\n\t\t| \"GroupItem\"\n\t\t| \"primary\"\n\t\t| \"items\"\n\t\t| \"RepeatableItem\"\n\tkey: string\n}\n\nexport type Path = ReadonlyArray<Part>\n\nconst PATH_SEPARATOR = \"::\"\n\nexport function serialize(path: Path): string {\n\treturn path.map((part) => part.key).join(PATH_SEPARATOR)\n}\n\nexport function current(path: Path): Part | undefined {\n\treturn path[path.length - 1]\n}\n\nexport function append(path: string, strElement: string): string {\n\treturn path + PATH_SEPARATOR + strElement\n}\n\nexport function make(...entries: (Pick<Part, \"type\"> & Partial<Pick<Part, \"key\">>)[]): Path {\n\treturn entries.reduce<Path>((acc, { key, type }) => {\n\t\treturn key ? acc.concat({ key, type }) : acc\n\t}, [])\n}\n"],"mappings":";;;;;;;;AAgBA,MAAM,iBAAiB;AAEvB,SAAgB,UAAU,MAAoB;
|
|
1
|
+
{"version":3,"file":"contentPath.js","names":[],"sources":["../../src/helpers/contentPath.ts"],"sourcesContent":["export type Part = {\n\ttype:\n\t\t| \"CustomType\"\n\t\t| \"Widget\"\n\t\t| \"SharedSlice\"\n\t\t| \"Slice\"\n\t\t| \"LegacySlice\"\n\t\t| \"GroupItem\"\n\t\t| \"primary\"\n\t\t| \"items\"\n\t\t| \"RepeatableItem\"\n\tkey: string\n}\n\nexport type Path = ReadonlyArray<Part>\n\nconst PATH_SEPARATOR = \"::\"\n\nexport function serialize(path: Path): string {\n\treturn path.map((part) => part.key).join(PATH_SEPARATOR)\n}\n\nexport function current(path: Path): Part | undefined {\n\treturn path[path.length - 1]\n}\n\nexport function append(path: string, strElement: string): string {\n\treturn path + PATH_SEPARATOR + strElement\n}\n\nexport function make(...entries: (Pick<Part, \"type\"> & Partial<Pick<Part, \"key\">>)[]): Path {\n\treturn entries.reduce<Path>((acc, { key, type }) => {\n\t\treturn key ? acc.concat({ key, type }) : acc\n\t}, [])\n}\n"],"mappings":";;;;;;;;AAgBA,MAAM,iBAAiB;AAEvB,SAAgB,UAAU,MAAoB;CAC7C,OAAO,KAAK,KAAK,SAAS,KAAK,GAAG,CAAC,CAAC,KAAK,cAAc;AACxD;AAEA,SAAgB,QAAQ,MAA8B;CACrD,OAAO,KAAK,KAAK,SAAS;AAC3B;AAEA,SAAgB,OAAO,MAAc,YAA4B;CAChE,OAAO,OAAO,iBAAiB;AAChC;AAEA,SAAgB,KAAK,GAAG,SAAoE;CAC3F,OAAO,QAAQ,QAAc,KAAK,EAAE,KAAK,WAAW;EACnD,OAAO,MAAM,IAAI,OAAO;GAAE;GAAK;EAAK,CAAC,IAAI;CAC1C,GAAG,CAAC,CAAC;AACN"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { SharedSliceModel } from "../model/slice.js";
|
|
2
2
|
import { DynamicCustomTypeModel, DynamicCustomTypeModelTab, StaticCustomTypeModel, StaticCustomTypeModelTab } from "../model/customType.js";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/customTypeModel.d.ts
|
|
5
3
|
declare namespace customTypeModel_d_exports {
|
|
6
4
|
export { collectSharedSlices, filterMissingSharedSlices, flatten, serializeID, toDynamic, toStatic };
|
|
7
5
|
}
|
|
@@ -13,5 +11,5 @@ declare function collectSharedSlices(customType: StaticCustomTypeModel): Record<
|
|
|
13
11
|
declare function filterMissingSharedSlices<TCustomType extends StaticCustomTypeModel | DynamicCustomTypeModel>(customType: TCustomType, sharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>): TCustomType;
|
|
14
12
|
declare function serializeID(input: string): string;
|
|
15
13
|
//#endregion
|
|
16
|
-
export { customTypeModel_d_exports };
|
|
14
|
+
export { collectSharedSlices, customTypeModel_d_exports, filterMissingSharedSlices, flatten, serializeID, toDynamic, toStatic };
|
|
17
15
|
//# sourceMappingURL=customTypeModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypeModel.d.ts","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"customTypeModel.d.ts","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"mappings":";;;;;iBAQgB,SACf,YAAY,wBACZ,cAAc,YAAY,oBAAoB,eAAe,oBAC3D;iBAwCa,UAAU,YAAY,wBAAwB;iBAkC9C,QAAQ,YAAY,wBAAwB;iBAC5C,QAAQ,YAAY,yBAAyB;iBAO7C,oBACf,YAAY,wBACV,eAAe;iBAiBF,0BACf,oBAAoB,wBAAwB,wBAE5C,YAAY,aACZ,cAAc,YAAY,oBAAoB,eAAe,oBAC3D;iBAuCa,YAAY"}
|
|
@@ -114,6 +114,6 @@ function serializeID(input) {
|
|
|
114
114
|
return normalized;
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
|
-
export { collectSharedSlices, customTypeModel_exports, flatten };
|
|
117
|
+
export { collectSharedSlices, customTypeModel_exports, filterMissingSharedSlices, flatten, serializeID, toDynamic, toStatic };
|
|
118
118
|
|
|
119
119
|
//# sourceMappingURL=customTypeModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypeModel.js","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"sourcesContent":["import type {\n\tDynamicCustomTypeModel,\n\tDynamicCustomTypeModelTab,\n\tStaticCustomTypeModel,\n\tStaticCustomTypeModelTab,\n} from \"../model/customType\"\nimport type { DynamicSliceModel, SharedSliceModel, StaticSliceModel } from \"../model/slice\"\n\nexport function toStatic(\n\tcustomType: DynamicCustomTypeModel,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): StaticCustomTypeModel {\n\tconst json: StaticCustomTypeModel[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: StaticCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, StaticSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tconst sharedSlice = sharedSlicesMap.get(id)\n\t\t\t\t\t\t\tif (sharedSlice) {\n\t\t\t\t\t\t\t\tchoices[id] = sharedSlice\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function toDynamic(customType: StaticCustomTypeModel): DynamicCustomTypeModel {\n\tconst json: DynamicCustomTypeModel[\"json\"] = {}\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: DynamicCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, DynamicSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tchoices[id] = { type: \"SharedSlice\" }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function flatten(customType: StaticCustomTypeModel): StaticCustomTypeModelTab\nexport function flatten(customType: DynamicCustomTypeModel): DynamicCustomTypeModelTab\nexport function flatten(
|
|
1
|
+
{"version":3,"file":"customTypeModel.js","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"sourcesContent":["import type {\n\tDynamicCustomTypeModel,\n\tDynamicCustomTypeModelTab,\n\tStaticCustomTypeModel,\n\tStaticCustomTypeModelTab,\n} from \"../model/customType\"\nimport type { DynamicSliceModel, SharedSliceModel, StaticSliceModel } from \"../model/slice\"\n\nexport function toStatic(\n\tcustomType: DynamicCustomTypeModel,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): StaticCustomTypeModel {\n\tconst json: StaticCustomTypeModel[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: StaticCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, StaticSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tconst sharedSlice = sharedSlicesMap.get(id)\n\t\t\t\t\t\t\tif (sharedSlice) {\n\t\t\t\t\t\t\t\tchoices[id] = sharedSlice\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function toDynamic(customType: StaticCustomTypeModel): DynamicCustomTypeModel {\n\tconst json: DynamicCustomTypeModel[\"json\"] = {}\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: DynamicCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, DynamicSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tchoices[id] = { type: \"SharedSlice\" }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function flatten(customType: StaticCustomTypeModel): StaticCustomTypeModelTab\nexport function flatten(customType: DynamicCustomTypeModel): DynamicCustomTypeModelTab\nexport function flatten(\n\tcustomType: StaticCustomTypeModel | DynamicCustomTypeModel,\n): StaticCustomTypeModelTab | DynamicCustomTypeModelTab {\n\treturn Object.values(customType.json).reduce((acc, fields) => ({ ...acc, ...fields }), {})\n}\n\nexport function collectSharedSlices(\n\tcustomType: StaticCustomTypeModel,\n): Record<string, SharedSliceModel> {\n\tconst sharedSlices: Record<string, SharedSliceModel> = {}\n\n\tconst flattened = flatten(customType)\n\tfor (const widget of Object.values(flattened)) {\n\t\tif (widget.type === \"Slices\" || widget.type === \"Choice\") {\n\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\tsharedSlices[id] = model\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sharedSlices\n}\n\nexport function filterMissingSharedSlices<\n\tTCustomType extends StaticCustomTypeModel | DynamicCustomTypeModel,\n>(\n\tcustomType: TCustomType,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): TCustomType {\n\tconst json: TCustomType[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: typeof tab = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Required<typeof widget>[\"config\"][\"choices\"] = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tif (sharedSlicesMap.get(id)) {\n\t\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function serializeID(input: string): string {\n\tconst normalized = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"_\")\n\t\t.replace(/^_+|_+$/g, \"\")\n\n\tif (normalized.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)\n\t}\n\n\treturn normalized\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,SACf,YACA,cACwB;CACxB,MAAM,OAAsC,CAAC;CAE7C,MAAM,kBACL,wBAAwB,MAAM,eAAe,IAAI,IAAI,OAAO,QAAQ,YAAY,CAAC;CAElF,KAAK,MAAM,CAAC,QAAQ,QAAQ,OAAO,QAAQ,WAAW,IAAI,GAAG;EAC5D,MAAM,UAAiD,CAAC;EACxD,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,GAAG,GAC7C,QAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;IACJ,MAAM,UAA4C,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC,GACpE,IAAI,MAAM,SAAS,eAAe;KACjC,MAAM,cAAc,gBAAgB,IAAI,EAAE;KAC1C,IAAI,aACH,QAAQ,MAAM;IAEhB,OACC,QAAQ,MAAM;IAIhB,QAAQ,OAAO;KACd,GAAG;KACH,QAAQ;MAAE,GAAG,OAAO;MAAQ;KAAQ;IACrC;IACA;GACD,SACC,QAAQ,OAAO;EACjB;EAGD,KAAK,UAAU;CAChB;CAEA,OAAO;EAAE,GAAG;EAAY;CAAK;AAC9B;AAEA,SAAgB,UAAU,YAA2D;CACpF,MAAM,OAAuC,CAAC;CAE9C,KAAK,MAAM,CAAC,QAAQ,QAAQ,OAAO,QAAQ,WAAW,IAAI,GAAG;EAC5D,MAAM,UAAkD,CAAC;EACzD,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,GAAG,GAC7C,QAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;IACJ,MAAM,UAA6C,CAAC;IACpD,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC,GACpE,IAAI,MAAM,SAAS,eAClB,QAAQ,MAAM,EAAE,MAAM,cAAc;SAEpC,QAAQ,MAAM;IAIhB,QAAQ,OAAO;KACd,GAAG;KACH,QAAQ;MAAE,GAAG,OAAO;MAAQ;KAAQ;IACrC;IACA;GACD,SACC,QAAQ,OAAO;EACjB;EAGD,KAAK,UAAU;CAChB;CAEA,OAAO;EAAE,GAAG;EAAY;CAAK;AAC9B;AAIA,SAAgB,QACf,YACuD;CACvD,OAAO,OAAO,OAAO,WAAW,IAAI,CAAC,CAAC,QAAQ,KAAK,YAAY;EAAE,GAAG;EAAK,GAAG;CAAO,IAAI,CAAC,CAAC;AAC1F;AAEA,SAAgB,oBACf,YACmC;CACnC,MAAM,eAAiD,CAAC;CAExD,MAAM,YAAY,QAAQ,UAAU;CACpC,KAAK,MAAM,UAAU,OAAO,OAAO,SAAS,GAC3C,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS;OAC1C,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC,GACpE,IAAI,MAAM,SAAS,eAClB,aAAa,MAAM;CAAA;CAMvB,OAAO;AACR;AAEA,SAAgB,0BAGf,YACA,cACc;CACd,MAAM,OAA4B,CAAC;CAEnC,MAAM,kBACL,wBAAwB,MAAM,eAAe,IAAI,IAAI,OAAO,QAAQ,YAAY,CAAC;CAElF,KAAK,MAAM,CAAC,QAAQ,QAAQ,OAAO,QAAQ,WAAW,IAAI,GAAG;EAC5D,MAAM,UAAsB,CAAC;EAC7B,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,GAAG,GAC7C,QAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;IACJ,MAAM,UAAwD,CAAC;IAC/D,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC,GACpE,IAAI,MAAM,SAAS;SACd,gBAAgB,IAAI,EAAE,GACzB,QAAQ,MAAM;IAAA,OAGf,QAAQ,MAAM;IAIhB,QAAQ,OAAO;KACd,GAAG;KACH,QAAQ;MAAE,GAAG,OAAO;MAAQ;KAAQ;IACrC;IACA;GACD,SACC,QAAQ,OAAO;EACjB;EAGD,KAAK,UAAU;CAChB;CAEA,OAAO;EAAE,GAAG;EAAY;CAAK;AAC9B;AAEA,SAAgB,YAAY,OAAuB;CAClD,MAAM,aAAa,MACjB,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,QAAQ,YAAY,EAAE;CAExB,IAAI,WAAW,WAAW,GACzB,MAAM,IAAI,MAAM,qBAAqB,MAAM,oBAAoB;CAGhE,OAAO;AACR"}
|
|
@@ -3,8 +3,6 @@ import { DocumentContent } from "../content/document.js";
|
|
|
3
3
|
import { StaticCustomTypeModel } from "../model/customType.js";
|
|
4
4
|
import { Path } from "./contentPath.js";
|
|
5
5
|
import { DocumentLegacy } from "../content/legacy/document.js";
|
|
6
|
-
|
|
7
|
-
//#region src/helpers/documentContent.d.ts
|
|
8
6
|
declare namespace documentContent_d_exports {
|
|
9
7
|
export { collectWidgets, fromLegacy, serializeUID, toLegacy };
|
|
10
8
|
}
|
|
@@ -17,5 +15,5 @@ declare function fromLegacy(legacy: DocumentLegacy, model: StaticCustomTypeModel
|
|
|
17
15
|
declare function toLegacy(document: DocumentContent): DocumentLegacy;
|
|
18
16
|
declare function serializeUID(input: string): string;
|
|
19
17
|
//#endregion
|
|
20
|
-
export { documentContent_d_exports };
|
|
18
|
+
export { collectWidgets, documentContent_d_exports, fromLegacy, serializeUID, toLegacy };
|
|
21
19
|
//# sourceMappingURL=documentContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentContent.d.ts","names":[],"sources":["../../src/helpers/documentContent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"documentContent.d.ts","names":[],"sources":["../../src/helpers/documentContent.ts"],"mappings":";;;;;;;;iBAkBgB,eAAe,uBAAuB,eACrD,UAAU,iBACV,OACC,SAAS,eACT;EACC,MAAM;EACN;EACA;MAEG,WAAW,iBACd,eAAe;iBAgBF,WACf,QAAQ,gBACR,OAAO,wBACL;iBAwDa,SAAS,UAAU,kBAAkB;iBAMrC,aAAa"}
|
|
@@ -63,6 +63,6 @@ function serializeUID(input) {
|
|
|
63
63
|
return input.replace(/ /g, "-").normalize("NFD").replace(/\p{M}/gu, "").replace(/[^\p{L}\d_.-]/gu, "").toLowerCase();
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
-
export { documentContent_exports };
|
|
66
|
+
export { collectWidgets, documentContent_exports, fromLegacy, serializeUID, toLegacy };
|
|
67
67
|
|
|
68
68
|
//# sourceMappingURL=documentContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentContent.js","names":["contentPath.serialize","customTypeModel.collectSharedSlices","sliceContent.compositeToShared","sliceContent.legacyToShared"],"sources":["../../src/helpers/documentContent.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { DocumentLegacyCodec } from \"../content/codec/document\"\nimport { defaultCtx } from \"../content/codec/legacyContentCtx\"\nimport type { DocumentContent } from \"../content/document\"\nimport type { DocumentLegacy } from \"../content/legacy/document\"\nimport { DocumentLegacySchema } from \"../content/legacy/document\"\nimport { isNestableContent } from \"../content/nestable\"\nimport type { CompositeSliceItemContent, LegacySliceItemContent } from \"../content/slices\"\nimport type { WidgetContent } from \"../content/widget\"\nimport type { StaticCustomTypeModel } from \"../model/customType\"\nimport type { FieldOrSliceType } from \"../model/widget\"\nimport { FieldOrSliceTypeSchema } from \"../model/widget\"\nimport * as contentPath from \"./contentPath\"\nimport * as customTypeModel from \"./customTypeModel\"\nimport * as sliceContent from \"./sliceContent\"\nimport { traverseDocumentContent } from \"./traverseContent\"\n\nexport function collectWidgets<TWidgetContent extends WidgetContent>(\n\tdocument: DocumentContent,\n\ttest: (\n\t\tcontent: WidgetContent,\n\t\targs: {\n\t\t\tpath: contentPath.Path\n\t\t\tkey: string\n\t\t\tapiID: string\n\t\t},\n\t) => content is TWidgetContent,\n): Record<string, TWidgetContent> {\n\tconst collected: Record<string, TWidgetContent> = {}\n\n\ttraverseDocumentContent(document, {\n\t\ttransformWidget: ({ content, ...args }) => {\n\t\t\tif (test(content, args)) {\n\t\t\t\tcollected[contentPath.serialize(args.path)] = content\n\t\t\t}\n\n\t\t\treturn content\n\t\t},\n\t})\n\n\treturn collected\n}\n\nexport function fromLegacy(\n\tlegacy: DocumentLegacy,\n\tmodel: StaticCustomTypeModel,\n): DocumentContent | undefined {\n\tconst parsed = DocumentLegacySchema.safeParse(legacy)\n\tif (!parsed.success) {\n\t\treturn\n\t}\n\n\tconst types = new Map<string, FieldOrSliceType>()\n\tconst keys = new Map<string, string>()\n\tconst widgets: DocumentLegacy = {}\n\tfor (const [key, value] of Object.entries(parsed.data)) {\n\t\tif (key.endsWith(\"_TYPE\")) {\n\t\t\tconst parsed = FieldOrSliceTypeSchema.safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\ttypes.set(key.substring(0, key.length - 5), parsed.data)\n\t\t\t}\n\t\t} else if (key.endsWith(\"_KEY\")) {\n\t\t\tconst parsed = z.uuidv4().safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\tkeys.set(key.substring(0, key.length - 4), parsed.data)\n\t\t\t}\n\t\t} else if (!key.endsWith(\"_POSITION\")) {\n\t\t\twidgets[key] = value\n\t\t}\n\t}\n\n\tconst result = DocumentLegacyCodec(defaultCtx(\"\", types, keys)).toContent(widgets)\n\tif (!result.success) {\n\t\treturn\n\t}\n\n\tconst needsMigration = Object.values(customTypeModel.collectSharedSlices(model)).some((slice) =>\n\t\tBoolean(slice.legacyPaths),\n\t)\n\n\tif (needsMigration) {\n\t\treturn traverseDocumentContent(result.data, {\n\t\t\tmodel,\n\t\t\ttransformSlice: ({ content, model }) => {\n\t\t\t\tif (model?.type === \"SharedSlice\") {\n\t\t\t\t\tif (content.widget.__TYPE__ === \"CompositeSliceContent\") {\n\t\t\t\t\t\treturn sliceContent.compositeToShared(content as CompositeSliceItemContent, model)\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tcontent.widget.__TYPE__ === \"GroupContentType\" ||\n\t\t\t\t\t\tisNestableContent(content.widget)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn sliceContent.legacyToShared(content as LegacySliceItemContent, model)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn content\n\t\t\t},\n\t\t})\n\t}\n\n\treturn result.data\n}\n\nexport function toLegacy(document: DocumentContent): DocumentLegacy {\n\tconst { content, types, keys } = DocumentLegacyCodec(defaultCtx(\"\")).fromContent(document)\n\n\treturn { ...content, ...types, ...keys }\n}\n\nexport function serializeUID(input: string): string {\n\tconst nowhitespace = input.replace(/ /g, \"-\")\n\n\tconst normalized = nowhitespace.normalize(\"NFD\").replace(/\\p{M}/gu, \"\")\n\n\tconst slug = normalized.replace(/[^\\p{L}\\d_.-]/gu, \"\")\n\n\treturn slug.toLowerCase()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eACf,UACA,MAQiC;CACjC,MAAM,YAA4C,
|
|
1
|
+
{"version":3,"file":"documentContent.js","names":["contentPath.serialize","customTypeModel.collectSharedSlices","sliceContent.compositeToShared","sliceContent.legacyToShared"],"sources":["../../src/helpers/documentContent.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { DocumentLegacyCodec } from \"../content/codec/document\"\nimport { defaultCtx } from \"../content/codec/legacyContentCtx\"\nimport type { DocumentContent } from \"../content/document\"\nimport type { DocumentLegacy } from \"../content/legacy/document\"\nimport { DocumentLegacySchema } from \"../content/legacy/document\"\nimport { isNestableContent } from \"../content/nestable\"\nimport type { CompositeSliceItemContent, LegacySliceItemContent } from \"../content/slices\"\nimport type { WidgetContent } from \"../content/widget\"\nimport type { StaticCustomTypeModel } from \"../model/customType\"\nimport type { FieldOrSliceType } from \"../model/widget\"\nimport { FieldOrSliceTypeSchema } from \"../model/widget\"\nimport * as contentPath from \"./contentPath\"\nimport * as customTypeModel from \"./customTypeModel\"\nimport * as sliceContent from \"./sliceContent\"\nimport { traverseDocumentContent } from \"./traverseContent\"\n\nexport function collectWidgets<TWidgetContent extends WidgetContent>(\n\tdocument: DocumentContent,\n\ttest: (\n\t\tcontent: WidgetContent,\n\t\targs: {\n\t\t\tpath: contentPath.Path\n\t\t\tkey: string\n\t\t\tapiID: string\n\t\t},\n\t) => content is TWidgetContent,\n): Record<string, TWidgetContent> {\n\tconst collected: Record<string, TWidgetContent> = {}\n\n\ttraverseDocumentContent(document, {\n\t\ttransformWidget: ({ content, ...args }) => {\n\t\t\tif (test(content, args)) {\n\t\t\t\tcollected[contentPath.serialize(args.path)] = content\n\t\t\t}\n\n\t\t\treturn content\n\t\t},\n\t})\n\n\treturn collected\n}\n\nexport function fromLegacy(\n\tlegacy: DocumentLegacy,\n\tmodel: StaticCustomTypeModel,\n): DocumentContent | undefined {\n\tconst parsed = DocumentLegacySchema.safeParse(legacy)\n\tif (!parsed.success) {\n\t\treturn\n\t}\n\n\tconst types = new Map<string, FieldOrSliceType>()\n\tconst keys = new Map<string, string>()\n\tconst widgets: DocumentLegacy = {}\n\tfor (const [key, value] of Object.entries(parsed.data)) {\n\t\tif (key.endsWith(\"_TYPE\")) {\n\t\t\tconst parsed = FieldOrSliceTypeSchema.safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\ttypes.set(key.substring(0, key.length - 5), parsed.data)\n\t\t\t}\n\t\t} else if (key.endsWith(\"_KEY\")) {\n\t\t\tconst parsed = z.uuidv4().safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\tkeys.set(key.substring(0, key.length - 4), parsed.data)\n\t\t\t}\n\t\t} else if (!key.endsWith(\"_POSITION\")) {\n\t\t\twidgets[key] = value\n\t\t}\n\t}\n\n\tconst result = DocumentLegacyCodec(defaultCtx(\"\", types, keys)).toContent(widgets)\n\tif (!result.success) {\n\t\treturn\n\t}\n\n\tconst needsMigration = Object.values(customTypeModel.collectSharedSlices(model)).some((slice) =>\n\t\tBoolean(slice.legacyPaths),\n\t)\n\n\tif (needsMigration) {\n\t\treturn traverseDocumentContent(result.data, {\n\t\t\tmodel,\n\t\t\ttransformSlice: ({ content, model }) => {\n\t\t\t\tif (model?.type === \"SharedSlice\") {\n\t\t\t\t\tif (content.widget.__TYPE__ === \"CompositeSliceContent\") {\n\t\t\t\t\t\treturn sliceContent.compositeToShared(content as CompositeSliceItemContent, model)\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tcontent.widget.__TYPE__ === \"GroupContentType\" ||\n\t\t\t\t\t\tisNestableContent(content.widget)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn sliceContent.legacyToShared(content as LegacySliceItemContent, model)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn content\n\t\t\t},\n\t\t})\n\t}\n\n\treturn result.data\n}\n\nexport function toLegacy(document: DocumentContent): DocumentLegacy {\n\tconst { content, types, keys } = DocumentLegacyCodec(defaultCtx(\"\")).fromContent(document)\n\n\treturn { ...content, ...types, ...keys }\n}\n\nexport function serializeUID(input: string): string {\n\tconst nowhitespace = input.replace(/ /g, \"-\")\n\n\tconst normalized = nowhitespace.normalize(\"NFD\").replace(/\\p{M}/gu, \"\")\n\n\tconst slug = normalized.replace(/[^\\p{L}\\d_.-]/gu, \"\")\n\n\treturn slug.toLowerCase()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eACf,UACA,MAQiC;CACjC,MAAM,YAA4C,CAAC;CAEnD,wBAAwB,UAAU,EACjC,kBAAkB,EAAE,SAAS,GAAG,WAAW;EAC1C,IAAI,KAAK,SAAS,IAAI,GACrB,UAAUA,UAAsB,KAAK,IAAI,KAAK;EAG/C,OAAO;CACR,EACD,CAAC;CAED,OAAO;AACR;AAEA,SAAgB,WACf,QACA,OAC8B;CAC9B,MAAM,SAAS,qBAAqB,UAAU,MAAM;CACpD,IAAI,CAAC,OAAO,SACX;CAGD,MAAM,wBAAQ,IAAI,IAA8B;CAChD,MAAM,uBAAO,IAAI,IAAoB;CACrC,MAAM,UAA0B,CAAC;CACjC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,IAAI,GACpD,IAAI,IAAI,SAAS,OAAO,GAAG;EAC1B,MAAM,SAAS,uBAAuB,UAAU,KAAK;EACrD,IAAI,OAAO,SACV,MAAM,IAAI,IAAI,UAAU,GAAG,IAAI,SAAS,CAAC,GAAG,OAAO,IAAI;CAEzD,OAAO,IAAI,IAAI,SAAS,MAAM,GAAG;EAChC,MAAM,SAAS,EAAE,OAAO,CAAC,CAAC,UAAU,KAAK;EACzC,IAAI,OAAO,SACV,KAAK,IAAI,IAAI,UAAU,GAAG,IAAI,SAAS,CAAC,GAAG,OAAO,IAAI;CAExD,OAAO,IAAI,CAAC,IAAI,SAAS,WAAW,GACnC,QAAQ,OAAO;CAIjB,MAAM,SAAS,oBAAoB,WAAW,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,UAAU,OAAO;CACjF,IAAI,CAAC,OAAO,SACX;CAOD,IAJuB,OAAO,OAAOC,oBAAoC,KAAK,CAAC,CAAC,CAAC,MAAM,UACtF,QAAQ,MAAM,WAAW,CAGT,GAChB,OAAO,wBAAwB,OAAO,MAAM;EAC3C;EACA,iBAAiB,EAAE,SAAS,YAAY;GACvC,IAAI,OAAO,SAAS;QACf,QAAQ,OAAO,aAAa,yBAC/B,OAAOC,kBAA+B,SAAsC,KAAK;SAC3E,IACN,QAAQ,OAAO,aAAa,sBAC5B,kBAAkB,QAAQ,MAAM,GAEhC,OAAOC,eAA4B,SAAmC,KAAK;GAAA;GAG7E,OAAO;EACR;CACD,CAAC;CAGF,OAAO,OAAO;AACf;AAEA,SAAgB,SAAS,UAA2C;CACnE,MAAM,EAAE,SAAS,OAAO,SAAS,oBAAoB,WAAW,EAAE,CAAC,CAAC,CAAC,YAAY,QAAQ;CAEzF,OAAO;EAAE,GAAG;EAAS,GAAG;EAAO,GAAG;CAAK;AACxC;AAEA,SAAgB,aAAa,OAAuB;CAOnD,OANqB,MAAM,QAAQ,MAAM,GAEX,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,QAAQ,WAAW,EAE9C,CAAC,CAAC,QAAQ,mBAAmB,EAEzC,CAAC,CAAC,YAAY;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldModel.d.ts","names":[],"sources":["../../src/helpers/fieldModel.ts"],"mappings":";;;iBAAgB,
|
|
1
|
+
{"version":3,"file":"fieldModel.d.ts","names":[],"sources":["../../src/helpers/fieldModel.ts"],"mappings":";;;iBAAgB,YAAY"}
|
|
@@ -8,6 +8,6 @@ function serializeID(input) {
|
|
|
8
8
|
return first.toLowerCase() + rest.map((token) => token.charAt(0).toUpperCase() + token.slice(1).toLowerCase()).join("");
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
11
|
-
export { fieldModel_exports };
|
|
11
|
+
export { fieldModel_exports, serializeID };
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=fieldModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldModel.js","names":[],"sources":["../../src/helpers/fieldModel.ts"],"sourcesContent":["export function serializeID(input: string): string {\n\tconst tokens = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.split(/[^A-Za-z0-9]+/)\n\t\t.filter(Boolean)\n\n\tif (tokens.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)\n\t}\n\n\tconst [first, ...rest] = tokens\n\treturn (\n\t\tfirst.toLowerCase() +\n\t\trest.map((token) => token.charAt(0).toUpperCase() + token.slice(1).toLowerCase()).join(\"\")\n\t)\n}\n"],"mappings":";;;AAAA,SAAgB,YAAY,OAAuB;CAClD,MAAM,SAAS,MACb,
|
|
1
|
+
{"version":3,"file":"fieldModel.js","names":[],"sources":["../../src/helpers/fieldModel.ts"],"sourcesContent":["export function serializeID(input: string): string {\n\tconst tokens = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.split(/[^A-Za-z0-9]+/)\n\t\t.filter(Boolean)\n\n\tif (tokens.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)\n\t}\n\n\tconst [first, ...rest] = tokens\n\treturn (\n\t\tfirst.toLowerCase() +\n\t\trest.map((token) => token.charAt(0).toUpperCase() + token.slice(1).toLowerCase()).join(\"\")\n\t)\n}\n"],"mappings":";;;AAAA,SAAgB,YAAY,OAAuB;CAClD,MAAM,SAAS,MACb,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO;CAEhB,IAAI,OAAO,WAAW,GACrB,MAAM,IAAI,MAAM,qBAAqB,MAAM,oBAAoB;CAGhE,MAAM,CAAC,OAAO,GAAG,QAAQ;CACzB,OACC,MAAM,YAAY,IAClB,KAAK,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,EAAE;AAE3F"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ImageContent, ImageContentView } from "../content/image.js";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/imageContent.d.ts
|
|
4
2
|
declare namespace imageContent_d_exports {
|
|
5
3
|
export { CroppedImage, buildCropURL, getCroppedImage };
|
|
6
4
|
}
|
|
@@ -23,11 +21,9 @@ declare function buildCropURL(args: {
|
|
|
23
21
|
origin: ImageContent["origin"];
|
|
24
22
|
croppedImage: CroppedImage;
|
|
25
23
|
}): string;
|
|
26
|
-
declare function getCroppedImage({
|
|
27
|
-
contentView
|
|
28
|
-
}: {
|
|
24
|
+
declare function getCroppedImage({ contentView }: {
|
|
29
25
|
contentView: ImageContentView;
|
|
30
26
|
}): CroppedImage;
|
|
31
27
|
//#endregion
|
|
32
|
-
export { imageContent_d_exports };
|
|
28
|
+
export { CroppedImage, buildCropURL, getCroppedImage, imageContent_d_exports };
|
|
33
29
|
//# sourceMappingURL=imageContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageContent.d.ts","names":[],"sources":["../../src/helpers/imageContent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"imageContent.d.ts","names":[],"sources":["../../src/helpers/imageContent.ts"],"mappings":";;;;UAEiB;EAChB;;EAEA;;EAEA;;EAGA;;EAEA;;EAGA;;EAEA;;iBAGe,aAAa;EAC5B,QAAQ;EACR,cAAc;;iBA2BC,kBAAkB;EAAiB,aAAa;IAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageContent.js","names":[],"sources":["../../src/helpers/imageContent.ts"],"sourcesContent":["import type { ImageContent, ImageContentView } from \"../content/image\"\n\nexport interface CroppedImage {\n\tzoom: number\n\t/** X coordinate of the crop rect on the original image */\n\tx: number\n\t/** Y coordinate of the crop rect on the original image */\n\ty: number\n\n\t/** The width of the crop rect over the original image */\n\tcropWidth: number\n\t/** The height of the crop rect over the original image */\n\tcropHeight: number\n\n\t/** Final (user defined via W input) width of the image */\n\twidth: number\n\t/** Final (user defined via H input) height of the image */\n\theight: number\n}\n\nexport function buildCropURL(args: {\n\torigin: ImageContent[\"origin\"]\n\tcroppedImage: CroppedImage\n}): string {\n\tconst { origin, croppedImage } = args\n\tconst { x, y, width, height, cropHeight, cropWidth } = croppedImage\n\n\tconst url = new URL(origin.url)\n\n\tconst hasResize = origin.height !== height || origin.width !== width\n\n\tconst hasCrop = x !== 0 || y !== 0 || cropHeight !== origin.height || cropWidth !== origin.width\n\n\tif (hasCrop) {\n\t\tconst crop = [x, y, cropWidth, cropHeight].map(Math.round).join(\",\")\n\n\t\turl.searchParams.set(\"rect\", crop)\n\t\turl.searchParams.set(\"w\", width.toString())\n\t\turl.searchParams.set(\"h\", height.toString())\n\t}\n\n\tif (hasResize) {\n\t\turl.searchParams.set(\"w\", width.toString())\n\t\turl.searchParams.set(\"h\", height.toString())\n\t}\n\n\treturn url.toString()\n}\n\nexport function getCroppedImage({ contentView }: { contentView: ImageContentView }): CroppedImage {\n\tconst {\n\t\tedit: {\n\t\t\tcrop: { x, y },\n\t\t\tzoom,\n\t\t},\n\t\twidth,\n\t\theight,\n\t\torigin: { width: originWidth, height: originHeight },\n\t} = contentView\n\n\tlet cropWidth\n\tlet cropHeight\n\tconst originAspect = originWidth / originHeight\n\tconst cropAspect = width / height\n\tif (cropAspect >= originAspect) {\n\t\t// crop and origin image would be the same width if zoom was equal to 1\n\t\tcropWidth = originWidth / zoom\n\t\tcropHeight = cropWidth / cropAspect\n\t} else {\n\t\t// crop and origin image would be the same height if zoom was equal to 1\n\t\tcropHeight = originHeight / zoom\n\t\tcropWidth = cropHeight * cropAspect\n\t}\n\n\treturn {\n\t\tx,\n\t\ty,\n\t\twidth,\n\t\theight,\n\t\tzoom,\n\t\tcropWidth,\n\t\tcropHeight,\n\t}\n}\n"],"mappings":";;;;;;AAoBA,SAAgB,aAAa,MAGlB;CACV,MAAM,EAAE,QAAQ,iBAAiB;CACjC,MAAM,EAAE,GAAG,GAAG,OAAO,QAAQ,YAAY,cAAc;CAEvD,MAAM,MAAM,IAAI,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"imageContent.js","names":[],"sources":["../../src/helpers/imageContent.ts"],"sourcesContent":["import type { ImageContent, ImageContentView } from \"../content/image\"\n\nexport interface CroppedImage {\n\tzoom: number\n\t/** X coordinate of the crop rect on the original image */\n\tx: number\n\t/** Y coordinate of the crop rect on the original image */\n\ty: number\n\n\t/** The width of the crop rect over the original image */\n\tcropWidth: number\n\t/** The height of the crop rect over the original image */\n\tcropHeight: number\n\n\t/** Final (user defined via W input) width of the image */\n\twidth: number\n\t/** Final (user defined via H input) height of the image */\n\theight: number\n}\n\nexport function buildCropURL(args: {\n\torigin: ImageContent[\"origin\"]\n\tcroppedImage: CroppedImage\n}): string {\n\tconst { origin, croppedImage } = args\n\tconst { x, y, width, height, cropHeight, cropWidth } = croppedImage\n\n\tconst url = new URL(origin.url)\n\n\tconst hasResize = origin.height !== height || origin.width !== width\n\n\tconst hasCrop = x !== 0 || y !== 0 || cropHeight !== origin.height || cropWidth !== origin.width\n\n\tif (hasCrop) {\n\t\tconst crop = [x, y, cropWidth, cropHeight].map(Math.round).join(\",\")\n\n\t\turl.searchParams.set(\"rect\", crop)\n\t\turl.searchParams.set(\"w\", width.toString())\n\t\turl.searchParams.set(\"h\", height.toString())\n\t}\n\n\tif (hasResize) {\n\t\turl.searchParams.set(\"w\", width.toString())\n\t\turl.searchParams.set(\"h\", height.toString())\n\t}\n\n\treturn url.toString()\n}\n\nexport function getCroppedImage({ contentView }: { contentView: ImageContentView }): CroppedImage {\n\tconst {\n\t\tedit: {\n\t\t\tcrop: { x, y },\n\t\t\tzoom,\n\t\t},\n\t\twidth,\n\t\theight,\n\t\torigin: { width: originWidth, height: originHeight },\n\t} = contentView\n\n\tlet cropWidth\n\tlet cropHeight\n\tconst originAspect = originWidth / originHeight\n\tconst cropAspect = width / height\n\tif (cropAspect >= originAspect) {\n\t\t// crop and origin image would be the same width if zoom was equal to 1\n\t\tcropWidth = originWidth / zoom\n\t\tcropHeight = cropWidth / cropAspect\n\t} else {\n\t\t// crop and origin image would be the same height if zoom was equal to 1\n\t\tcropHeight = originHeight / zoom\n\t\tcropWidth = cropHeight * cropAspect\n\t}\n\n\treturn {\n\t\tx,\n\t\ty,\n\t\twidth,\n\t\theight,\n\t\tzoom,\n\t\tcropWidth,\n\t\tcropHeight,\n\t}\n}\n"],"mappings":";;;;;;AAoBA,SAAgB,aAAa,MAGlB;CACV,MAAM,EAAE,QAAQ,iBAAiB;CACjC,MAAM,EAAE,GAAG,GAAG,OAAO,QAAQ,YAAY,cAAc;CAEvD,MAAM,MAAM,IAAI,IAAI,OAAO,GAAG;CAE9B,MAAM,YAAY,OAAO,WAAW,UAAU,OAAO,UAAU;CAI/D,IAFgB,MAAM,KAAK,MAAM,KAAK,eAAe,OAAO,UAAU,cAAc,OAAO,OAE9E;EACZ,MAAM,OAAO;GAAC;GAAG;GAAG;GAAW;EAAU,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,KAAK,GAAG;EAEnE,IAAI,aAAa,IAAI,QAAQ,IAAI;EACjC,IAAI,aAAa,IAAI,KAAK,MAAM,SAAS,CAAC;EAC1C,IAAI,aAAa,IAAI,KAAK,OAAO,SAAS,CAAC;CAC5C;CAEA,IAAI,WAAW;EACd,IAAI,aAAa,IAAI,KAAK,MAAM,SAAS,CAAC;EAC1C,IAAI,aAAa,IAAI,KAAK,OAAO,SAAS,CAAC;CAC5C;CAEA,OAAO,IAAI,SAAS;AACrB;AAEA,SAAgB,gBAAgB,EAAE,eAAgE;CACjG,MAAM,EACL,MAAM,EACL,MAAM,EAAE,GAAG,KACX,QAED,OACA,QACA,QAAQ,EAAE,OAAO,aAAa,QAAQ,mBACnC;CAEJ,IAAI;CACJ,IAAI;CACJ,MAAM,eAAe,cAAc;CACnC,MAAM,aAAa,QAAQ;CAC3B,IAAI,cAAc,cAAc;EAE/B,YAAY,cAAc;EAC1B,aAAa,YAAY;CAC1B,OAAO;EAEN,aAAa,eAAe;EAC5B,YAAY,aAAa;CAC1B;CAEA,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","names":[],"sources":["../../src/helpers/repository.ts"],"mappings":";;;iBAGgB,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","names":[],"sources":["../../src/helpers/repository.ts"],"mappings":";;;iBAGgB,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","names":[],"sources":["../../src/helpers/repository.ts"],"sourcesContent":["const MIN_LENGTH = 4\nconst MAX_LENGTH = 63\n\nexport function serializeID(input: string): string {\n\tconst normalized = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"-\")\n\t\t.replace(/^-+|-+$/g, \"\")\n\n\tconst truncated =\n\t\tnormalized.length > MAX_LENGTH ? normalized.slice(0, MAX_LENGTH).replace(/-+$/, \"\") : normalized\n\n\tif (truncated.length < MIN_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Cannot serialize \"${input}\" to a repository ID: result must be between ${MIN_LENGTH} and ${MAX_LENGTH} characters.`,\n\t\t)\n\t}\n\n\treturn truncated\n}\n"],"mappings":";;;AAAA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,SAAgB,YAAY,OAAuB;CAClD,MAAM,aAAa,MACjB,
|
|
1
|
+
{"version":3,"file":"repository.js","names":[],"sources":["../../src/helpers/repository.ts"],"sourcesContent":["const MIN_LENGTH = 4\nconst MAX_LENGTH = 63\n\nexport function serializeID(input: string): string {\n\tconst normalized = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"-\")\n\t\t.replace(/^-+|-+$/g, \"\")\n\n\tconst truncated =\n\t\tnormalized.length > MAX_LENGTH ? normalized.slice(0, MAX_LENGTH).replace(/-+$/, \"\") : normalized\n\n\tif (truncated.length < MIN_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Cannot serialize \"${input}\" to a repository ID: result must be between ${MIN_LENGTH} and ${MAX_LENGTH} characters.`,\n\t\t)\n\t}\n\n\treturn truncated\n}\n"],"mappings":";;;AAAA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,SAAgB,YAAY,OAAuB;CAClD,MAAM,aAAa,MACjB,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,QAAQ,YAAY,EAAE;CAExB,MAAM,YACL,WAAW,SAAS,aAAa,WAAW,MAAM,GAAG,UAAU,CAAC,CAAC,QAAQ,OAAO,EAAE,IAAI;CAEvF,IAAI,UAAU,SAAS,YACtB,MAAM,IAAI,MACT,qBAAqB,MAAM,+CAA+C,WAAW,OAAO,WAAW,aACxG;CAGD,OAAO;AACR"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { CompositeSliceItemContent, LegacySliceItemContent, SharedSliceItemContent } from "../content/slices.js";
|
|
2
2
|
import { SharedSliceVariationContentModel } from "../model/slice.js";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/sliceContent.d.ts
|
|
5
3
|
declare namespace sliceContent_d_exports {
|
|
6
4
|
export { compositeToShared, legacyToShared };
|
|
7
5
|
}
|
|
8
6
|
declare const legacyToShared: (content: LegacySliceItemContent, model: SharedSliceVariationContentModel) => SharedSliceItemContent;
|
|
9
7
|
declare const compositeToShared: (content: CompositeSliceItemContent, model: SharedSliceVariationContentModel) => SharedSliceItemContent;
|
|
10
8
|
//#endregion
|
|
11
|
-
export { sliceContent_d_exports };
|
|
9
|
+
export { compositeToShared, legacyToShared, sliceContent_d_exports };
|
|
12
10
|
//# sourceMappingURL=sliceContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliceContent.d.ts","names":[],"sources":["../../src/helpers/sliceContent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sliceContent.d.ts","names":[],"sources":["../../src/helpers/sliceContent.ts"],"mappings":";;;;;cASa,iBAAc,SACjB,wBAAsB,OACxB,qCACL;cAoCU,oBAAiB,SACpB,2BAAyB,OAC3B,qCACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliceContent.js","names":[],"sources":["../../src/helpers/sliceContent.ts"],"sourcesContent":["import type { GroupItemContent } from \"../content/group\"\nimport type { SharedSliceContent } from \"../content/slice\"\nimport type {\n\tCompositeSliceItemContent,\n\tLegacySliceItemContent,\n\tSharedSliceItemContent,\n} from \"../content/slices\"\nimport type { SharedSliceVariationContentModel } from \"../model/slice\"\n\nexport const legacyToShared = (\n\tcontent: LegacySliceItemContent,\n\tmodel: SharedSliceVariationContentModel,\n): SharedSliceItemContent => {\n\tconst sliceUUID = content.key.split(\"$\")[1]\n\n\tconst primary: SharedSliceContent[\"primary\"] = {}\n\tconst items: SharedSliceContent[\"items\"] = []\n\tif (content.widget.__TYPE__ === \"GroupContentType\") {\n\t\t// Group content\n\t\tfor (const item of content.widget.value) {\n\t\t\tconst value: GroupItemContent[\"value\"] = []\n\n\t\t\tfor (const [key, nestable] of item.value) {\n\t\t\t\tif (model.fields.items?.[key]) {\n\t\t\t\t\tvalue.push([key, nestable])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\titems.push({ ...item, value })\n\t\t}\n\t} else if (model.fields.primary?.[content.name]) {\n\t\t// Nestable content\n\t\tprimary[content.name] = content.widget\n\t}\n\n\treturn {\n\t\tkey: `${model.sliceName}$${sliceUUID}`,\n\t\tname: model.sliceName,\n\t\tmaybeLabel: content.maybeLabel,\n\t\twidget: {\n\t\t\t__TYPE__: \"SharedSliceContent\",\n\t\t\tvariation: model.variationID,\n\t\t\tprimary,\n\t\t\titems,\n\t\t},\n\t}\n}\n\nexport const compositeToShared = (\n\tcontent: CompositeSliceItemContent,\n\tmodel: SharedSliceVariationContentModel,\n): SharedSliceItemContent => {\n\tconst sliceUUID = content.key.split(\"$\")[1]\n\n\tconst primary: SharedSliceContent[\"primary\"] = {}\n\tfor (const [key, value] of Object.entries(content.widget.nonRepeat)) {\n\t\tif (model.fields.primary?.[key]) {\n\t\t\tprimary[key] = value\n\t\t}\n\t}\n\n\tconst items: SharedSliceContent[\"items\"] = []\n\tfor (const item of content.widget.repeat) {\n\t\tconst value: GroupItemContent[\"value\"] = []\n\n\t\tfor (const [key, nestable] of item.value) {\n\t\t\tif (model.fields.items?.[key]) {\n\t\t\t\tvalue.push([key, nestable])\n\t\t\t}\n\t\t}\n\n\t\titems.push({ ...item, value })\n\t}\n\n\treturn {\n\t\tkey: `${model.sliceName}$${sliceUUID}`,\n\t\tname: model.sliceName,\n\t\tmaybeLabel: content.maybeLabel,\n\t\twidget: {\n\t\t\t__TYPE__: \"SharedSliceContent\",\n\t\t\tvariation: model.variationID,\n\t\t\tprimary,\n\t\t\titems,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;AASA,MAAa,kBACZ,SACA,UAC4B;CAC5B,MAAM,YAAY,QAAQ,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"sliceContent.js","names":[],"sources":["../../src/helpers/sliceContent.ts"],"sourcesContent":["import type { GroupItemContent } from \"../content/group\"\nimport type { SharedSliceContent } from \"../content/slice\"\nimport type {\n\tCompositeSliceItemContent,\n\tLegacySliceItemContent,\n\tSharedSliceItemContent,\n} from \"../content/slices\"\nimport type { SharedSliceVariationContentModel } from \"../model/slice\"\n\nexport const legacyToShared = (\n\tcontent: LegacySliceItemContent,\n\tmodel: SharedSliceVariationContentModel,\n): SharedSliceItemContent => {\n\tconst sliceUUID = content.key.split(\"$\")[1]\n\n\tconst primary: SharedSliceContent[\"primary\"] = {}\n\tconst items: SharedSliceContent[\"items\"] = []\n\tif (content.widget.__TYPE__ === \"GroupContentType\") {\n\t\t// Group content\n\t\tfor (const item of content.widget.value) {\n\t\t\tconst value: GroupItemContent[\"value\"] = []\n\n\t\t\tfor (const [key, nestable] of item.value) {\n\t\t\t\tif (model.fields.items?.[key]) {\n\t\t\t\t\tvalue.push([key, nestable])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\titems.push({ ...item, value })\n\t\t}\n\t} else if (model.fields.primary?.[content.name]) {\n\t\t// Nestable content\n\t\tprimary[content.name] = content.widget\n\t}\n\n\treturn {\n\t\tkey: `${model.sliceName}$${sliceUUID}`,\n\t\tname: model.sliceName,\n\t\tmaybeLabel: content.maybeLabel,\n\t\twidget: {\n\t\t\t__TYPE__: \"SharedSliceContent\",\n\t\t\tvariation: model.variationID,\n\t\t\tprimary,\n\t\t\titems,\n\t\t},\n\t}\n}\n\nexport const compositeToShared = (\n\tcontent: CompositeSliceItemContent,\n\tmodel: SharedSliceVariationContentModel,\n): SharedSliceItemContent => {\n\tconst sliceUUID = content.key.split(\"$\")[1]\n\n\tconst primary: SharedSliceContent[\"primary\"] = {}\n\tfor (const [key, value] of Object.entries(content.widget.nonRepeat)) {\n\t\tif (model.fields.primary?.[key]) {\n\t\t\tprimary[key] = value\n\t\t}\n\t}\n\n\tconst items: SharedSliceContent[\"items\"] = []\n\tfor (const item of content.widget.repeat) {\n\t\tconst value: GroupItemContent[\"value\"] = []\n\n\t\tfor (const [key, nestable] of item.value) {\n\t\t\tif (model.fields.items?.[key]) {\n\t\t\t\tvalue.push([key, nestable])\n\t\t\t}\n\t\t}\n\n\t\titems.push({ ...item, value })\n\t}\n\n\treturn {\n\t\tkey: `${model.sliceName}$${sliceUUID}`,\n\t\tname: model.sliceName,\n\t\tmaybeLabel: content.maybeLabel,\n\t\twidget: {\n\t\t\t__TYPE__: \"SharedSliceContent\",\n\t\t\tvariation: model.variationID,\n\t\t\tprimary,\n\t\t\titems,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;AASA,MAAa,kBACZ,SACA,UAC4B;CAC5B,MAAM,YAAY,QAAQ,IAAI,MAAM,GAAG,CAAC,CAAC;CAEzC,MAAM,UAAyC,CAAC;CAChD,MAAM,QAAqC,CAAC;CAC5C,IAAI,QAAQ,OAAO,aAAa,oBAE/B,KAAK,MAAM,QAAQ,QAAQ,OAAO,OAAO;EACxC,MAAM,QAAmC,CAAC;EAE1C,KAAK,MAAM,CAAC,KAAK,aAAa,KAAK,OAClC,IAAI,MAAM,OAAO,QAAQ,MACxB,MAAM,KAAK,CAAC,KAAK,QAAQ,CAAC;EAI5B,MAAM,KAAK;GAAE,GAAG;GAAM;EAAM,CAAC;CAC9B;MACM,IAAI,MAAM,OAAO,UAAU,QAAQ,OAEzC,QAAQ,QAAQ,QAAQ,QAAQ;CAGjC,OAAO;EACN,KAAK,GAAG,MAAM,UAAU,GAAG;EAC3B,MAAM,MAAM;EACZ,YAAY,QAAQ;EACpB,QAAQ;GACP,UAAU;GACV,WAAW,MAAM;GACjB;GACA;EACD;CACD;AACD;AAEA,MAAa,qBACZ,SACA,UAC4B;CAC5B,MAAM,YAAY,QAAQ,IAAI,MAAM,GAAG,CAAC,CAAC;CAEzC,MAAM,UAAyC,CAAC;CAChD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,SAAS,GACjE,IAAI,MAAM,OAAO,UAAU,MAC1B,QAAQ,OAAO;CAIjB,MAAM,QAAqC,CAAC;CAC5C,KAAK,MAAM,QAAQ,QAAQ,OAAO,QAAQ;EACzC,MAAM,QAAmC,CAAC;EAE1C,KAAK,MAAM,CAAC,KAAK,aAAa,KAAK,OAClC,IAAI,MAAM,OAAO,QAAQ,MACxB,MAAM,KAAK,CAAC,KAAK,QAAQ,CAAC;EAI5B,MAAM,KAAK;GAAE,GAAG;GAAM;EAAM,CAAC;CAC9B;CAEA,OAAO;EACN,KAAK,GAAG,MAAM,UAAU,GAAG;EAC3B,MAAM,MAAM;EACZ,YAAY,QAAQ;EACpB,QAAQ;GACP,UAAU;GACV,WAAW,MAAM;GACjB;GACA;EACD;CACD;AACD"}
|
|
@@ -4,5 +4,5 @@ declare namespace sliceModel_d_exports {
|
|
|
4
4
|
declare function serializeID(input: string): string;
|
|
5
5
|
declare const serializeVariationID: typeof serializeID;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { sliceModel_d_exports };
|
|
7
|
+
export { serializeID, serializeVariationID, sliceModel_d_exports };
|
|
8
8
|
//# sourceMappingURL=sliceModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliceModel.d.ts","names":[],"sources":["../../src/helpers/sliceModel.ts"],"mappings":";;;iBAAgB,
|
|
1
|
+
{"version":3,"file":"sliceModel.d.ts","names":[],"sources":["../../src/helpers/sliceModel.ts"],"mappings":";;;iBAAgB,YAAY;cAiBf,6BAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliceModel.js","names":[],"sources":["../../src/helpers/sliceModel.ts"],"sourcesContent":["export function serializeID(input: string): string {\n\tconst tokens = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.split(/[^A-Za-z0-9]+/)\n\t\t.filter(Boolean)\n\n\tif (tokens.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)\n\t}\n\n\treturn tokens\n\t\t.map((token) => token.charAt(0).toUpperCase() + token.slice(1).toLowerCase())\n\t\t.join(\"\")\n}\n\nexport const serializeVariationID = serializeID\n"],"mappings":";;;;;;AAAA,SAAgB,YAAY,OAAuB;CAClD,MAAM,SAAS,MACb,
|
|
1
|
+
{"version":3,"file":"sliceModel.js","names":[],"sources":["../../src/helpers/sliceModel.ts"],"sourcesContent":["export function serializeID(input: string): string {\n\tconst tokens = input\n\t\t.trim()\n\t\t.normalize(\"NFD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.split(/[^A-Za-z0-9]+/)\n\t\t.filter(Boolean)\n\n\tif (tokens.length === 0) {\n\t\tthrow new Error(`Cannot serialize \"${input}\": result is empty.`)\n\t}\n\n\treturn tokens\n\t\t.map((token) => token.charAt(0).toUpperCase() + token.slice(1).toLowerCase())\n\t\t.join(\"\")\n}\n\nexport const serializeVariationID = serializeID\n"],"mappings":";;;;;;AAAA,SAAgB,YAAY,OAAuB;CAClD,MAAM,SAAS,MACb,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO;CAEhB,IAAI,OAAO,WAAW,GACrB,MAAM,IAAI,MAAM,qBAAqB,MAAM,oBAAoB;CAGhE,OAAO,OACL,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAC5E,KAAK,EAAE;AACV;AAEA,MAAa,uBAAuB"}
|
|
@@ -13,7 +13,6 @@ import { StaticSlicesModel } from "../model/slices.js";
|
|
|
13
13
|
import { StaticWidgetModel } from "../model/widget.js";
|
|
14
14
|
import { StaticCustomTypeModel } from "../model/customType.js";
|
|
15
15
|
import { Path } from "./contentPath.js";
|
|
16
|
-
|
|
17
16
|
//#region src/helpers/traverseContent.d.ts
|
|
18
17
|
type TraverseDocumentContentConfig = {
|
|
19
18
|
model?: StaticCustomTypeModel;
|