@prismicio/types-internal 2.5.0-alpha.0 → 2.5.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/lib/content/Document.d.ts +3972 -7926
  2. package/lib/content/fields/GroupContent.d.ts +17 -1754
  3. package/lib/content/fields/GroupContent.js +62 -22
  4. package/lib/content/fields/WidgetContent.d.ts +3371 -7324
  5. package/lib/content/fields/nestable/NestableContent.d.ts +3 -145
  6. package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +4 -212
  7. package/lib/content/fields/nestable/RichTextContent/Blocks.js +2 -0
  8. package/lib/content/fields/nestable/RichTextContent/index.d.ts +4 -184
  9. package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +6 -290
  10. package/lib/content/fields/slices/Slice/CompositeSliceContent.js +3 -0
  11. package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +2 -383
  12. package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +15 -1333
  13. package/lib/content/fields/slices/Slice/SharedSliceContent.js +2 -0
  14. package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +7 -1182
  15. package/lib/content/fields/slices/Slice/SimpleSliceContent.js +1 -0
  16. package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +7 -1182
  17. package/lib/content/fields/slices/Slice/index.d.ts +983 -2935
  18. package/lib/content/fields/slices/SliceItem.d.ts +148 -2100
  19. package/lib/content/fields/slices/SlicesContent.d.ts +866 -3644
  20. package/lib/content/fields/withDefaultValues.d.ts +4 -3
  21. package/lib/content/fields/withDefaultValues.js +17 -1
  22. package/lib/customtypes/CustomType.d.ts +70 -915
  23. package/lib/customtypes/Section.d.ts +70 -915
  24. package/lib/customtypes/diff/SharedSlice.d.ts +2 -340
  25. package/lib/customtypes/diff/Variation.d.ts +4 -351
  26. package/lib/customtypes/diff/Variation.js +4 -3
  27. package/lib/customtypes/diff/Widgets.d.ts +11 -0
  28. package/lib/customtypes/diff/Widgets.js +2 -0
  29. package/lib/customtypes/diff/index.d.ts +1 -0
  30. package/lib/customtypes/diff/index.js +1 -0
  31. package/lib/customtypes/widgets/Group.d.ts +15 -331
  32. package/lib/customtypes/widgets/Group.js +25 -5
  33. package/lib/customtypes/widgets/Widget.d.ts +7 -1014
  34. package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -168
  35. package/lib/customtypes/widgets/slices/SharedSlice.d.ts +2 -336
  36. package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +3 -338
  37. package/lib/customtypes/widgets/slices/Slices.d.ts +7 -1184
  38. package/lib/validators/function.js +8 -1
  39. package/package.json +5 -5
  40. package/src/content/fields/GroupContent.ts +107 -32
  41. package/src/content/fields/nestable/RichTextContent/Blocks.ts +3 -1
  42. package/src/content/fields/slices/Slice/CompositeSliceContent.ts +7 -4
  43. package/src/content/fields/slices/Slice/SharedSliceContent.ts +5 -3
  44. package/src/content/fields/slices/Slice/SimpleSliceContent.ts +3 -1
  45. package/src/content/fields/withDefaultValues.ts +27 -3
  46. package/src/customtypes/diff/Variation.ts +9 -20
  47. package/src/customtypes/diff/Widgets.ts +17 -0
  48. package/src/customtypes/diff/index.ts +1 -0
  49. package/src/customtypes/widgets/Group.ts +66 -20
  50. package/src/validators/function.ts +11 -1
@@ -1,15 +1,7 @@
1
- import type { Group } from "../widgets";
2
- import type { NestableWidget } from "../widgets/nestable";
1
+ import { Group } from "../widgets/Group";
3
2
  import type { Variation } from "../widgets/slices";
4
3
  import { type DiffChange } from "./Changes";
5
- declare type NestableWidgetDiff = DiffChange<NestableWidget, NestableWidget>;
6
- declare type GroupWidgetWithFieldsDiff = Omit<Group, "config"> & {
7
- config: Omit<Group["config"], "fields"> & {
8
- fields?: Record<string, NestableWidgetDiff>;
9
- };
10
- };
11
- declare type GroupWidgetDiff = DiffChange<GroupWidgetWithFieldsDiff, GroupWidgetWithFieldsDiff>;
12
- declare type SlicePrimaryWidgetDiff = NestableWidgetDiff | GroupWidgetDiff;
4
+ import type { NestableWidgetDiff, SlicePrimaryWidgetDiff } from "./Widgets";
13
5
  export declare type VariationMetadata = Omit<Variation, "primary" | "items">;
14
6
  export declare type VariationDiff = DiffChange<Variation, Partial<VariationMetadata> & {
15
7
  primary?: Record<string, SlicePrimaryWidgetDiff>;
@@ -182,176 +174,7 @@ export declare const VariationComparator: {
182
174
  placeholder?: string;
183
175
  default?: string;
184
176
  };
185
- }) | ({
186
- type: "Group";
187
- } & {
188
- fieldset?: string | null | undefined;
189
- icon?: string;
190
- description?: string;
191
- config?: {
192
- label?: string | null | undefined;
193
- repeat?: boolean;
194
- fields?: {
195
- [x: string]: ({
196
- type: "Boolean";
197
- } & {
198
- config?: {
199
- label?: string | null | undefined;
200
- default_value?: boolean;
201
- placeholder_true?: string;
202
- placeholder_false?: string;
203
- };
204
- }) | ({
205
- type: "Color";
206
- } & {
207
- fieldset?: string | null | undefined;
208
- config?: {
209
- label?: string | null | undefined;
210
- placeholder?: string;
211
- };
212
- }) | ({
213
- type: "Date";
214
- } & {
215
- fieldset?: string | null | undefined;
216
- config?: {
217
- label?: string | null | undefined;
218
- placeholder?: string;
219
- default?: string;
220
- };
221
- }) | ({
222
- type: "Embed";
223
- } & {
224
- fieldset?: string | null | undefined;
225
- config?: {
226
- label?: string | null | undefined;
227
- placeholder?: string;
228
- useAsTitle?: boolean;
229
- };
230
- }) | ({
231
- type: "GeoPoint";
232
- } & {
233
- fieldset?: string | null | undefined;
234
- config?: {
235
- label?: string | null | undefined;
236
- };
237
- }) | ({
238
- type: "Image";
239
- } & {
240
- fieldset?: string | null | undefined;
241
- config?: {
242
- label?: string | null | undefined;
243
- placeholder?: string;
244
- constraint?: {
245
- width?: number | null;
246
- height?: number | null;
247
- };
248
- thumbnails?: readonly ({
249
- name: string;
250
- } & {
251
- width?: number | null;
252
- height?: number | null;
253
- })[];
254
- };
255
- }) | ({
256
- type: "IntegrationFields";
257
- } & {
258
- fieldset?: string | null | undefined;
259
- config?: {
260
- label?: string | null | undefined;
261
- placeholder?: string;
262
- catalog?: string;
263
- };
264
- }) | ({
265
- type: "Link";
266
- } & {
267
- fieldset?: string | null | undefined;
268
- config?: {
269
- label?: string | null | undefined;
270
- useAsTitle?: boolean;
271
- placeholder?: string;
272
- select?: "media" | "document" | "web" | null;
273
- customtypes?: readonly string[];
274
- masks?: readonly string[];
275
- tags?: readonly string[];
276
- allowTargetBlank?: boolean;
277
- };
278
- }) | ({
279
- type: "Number";
280
- } & {
281
- fieldset?: string | null | undefined;
282
- config?: {
283
- label?: string | null | undefined;
284
- placeholder?: string;
285
- min?: number;
286
- max?: number;
287
- step?: number;
288
- };
289
- }) | ({
290
- type: "Range";
291
- } & {
292
- fieldset?: string | null | undefined;
293
- config?: {
294
- label?: string | null | undefined;
295
- placeholder?: string;
296
- min?: number;
297
- max?: number;
298
- step?: number;
299
- };
300
- }) | ({
301
- type: "StructuredText";
302
- } & {
303
- fieldset?: string | null | undefined;
304
- config?: {
305
- label?: string | null | undefined;
306
- placeholder?: string;
307
- useAsTitle?: boolean;
308
- single?: string;
309
- multi?: string;
310
- imageConstraint?: {
311
- width?: number | null;
312
- height?: number | null;
313
- };
314
- labels?: readonly string[];
315
- allowTargetBlank?: boolean;
316
- };
317
- }) | ({
318
- type: "Select";
319
- } & {
320
- fieldset?: string | null | undefined;
321
- config?: {
322
- label?: string | null | undefined;
323
- placeholder?: string;
324
- default_value?: string;
325
- options?: readonly string[];
326
- };
327
- }) | ({
328
- type: "Separator";
329
- } & {
330
- config?: {
331
- label?: string | null | undefined;
332
- };
333
- }) | ({
334
- type: "Text";
335
- } & {
336
- fieldset?: string | null | undefined;
337
- config?: {
338
- label?: string | null | undefined;
339
- useAsTitle?: boolean;
340
- placeholder?: string;
341
- };
342
- }) | ({
343
- type: "Timestamp";
344
- } & {
345
- fieldset?: string | null | undefined;
346
- config?: {
347
- label?: string | null | undefined;
348
- placeholder?: string;
349
- default?: string;
350
- };
351
- });
352
- };
353
- };
354
- });
177
+ }) | Group;
355
178
  };
356
179
  items?: {
357
180
  [x: string]: ({
@@ -678,176 +501,7 @@ export declare const VariationComparator: {
678
501
  placeholder?: string;
679
502
  default?: string;
680
503
  };
681
- }) | ({
682
- type: "Group";
683
- } & {
684
- fieldset?: string | null | undefined;
685
- icon?: string;
686
- description?: string;
687
- config?: {
688
- label?: string | null | undefined;
689
- repeat?: boolean;
690
- fields?: {
691
- [x: string]: ({
692
- type: "Boolean";
693
- } & {
694
- config?: {
695
- label?: string | null | undefined;
696
- default_value?: boolean;
697
- placeholder_true?: string;
698
- placeholder_false?: string;
699
- };
700
- }) | ({
701
- type: "Color";
702
- } & {
703
- fieldset?: string | null | undefined;
704
- config?: {
705
- label?: string | null | undefined;
706
- placeholder?: string;
707
- };
708
- }) | ({
709
- type: "Date";
710
- } & {
711
- fieldset?: string | null | undefined;
712
- config?: {
713
- label?: string | null | undefined;
714
- placeholder?: string;
715
- default?: string;
716
- };
717
- }) | ({
718
- type: "Embed";
719
- } & {
720
- fieldset?: string | null | undefined;
721
- config?: {
722
- label?: string | null | undefined;
723
- placeholder?: string;
724
- useAsTitle?: boolean;
725
- };
726
- }) | ({
727
- type: "GeoPoint";
728
- } & {
729
- fieldset?: string | null | undefined;
730
- config?: {
731
- label?: string | null | undefined;
732
- };
733
- }) | ({
734
- type: "Image";
735
- } & {
736
- fieldset?: string | null | undefined;
737
- config?: {
738
- label?: string | null | undefined;
739
- placeholder?: string;
740
- constraint?: {
741
- width?: number | null;
742
- height?: number | null;
743
- };
744
- thumbnails?: readonly ({
745
- name: string;
746
- } & {
747
- width?: number | null;
748
- height?: number | null;
749
- })[];
750
- };
751
- }) | ({
752
- type: "IntegrationFields";
753
- } & {
754
- fieldset?: string | null | undefined;
755
- config?: {
756
- label?: string | null | undefined;
757
- placeholder?: string;
758
- catalog?: string;
759
- };
760
- }) | ({
761
- type: "Link";
762
- } & {
763
- fieldset?: string | null | undefined;
764
- config?: {
765
- label?: string | null | undefined;
766
- useAsTitle?: boolean;
767
- placeholder?: string;
768
- select?: "media" | "document" | "web" | null;
769
- customtypes?: readonly string[];
770
- masks?: readonly string[];
771
- tags?: readonly string[];
772
- allowTargetBlank?: boolean;
773
- };
774
- }) | ({
775
- type: "Number";
776
- } & {
777
- fieldset?: string | null | undefined;
778
- config?: {
779
- label?: string | null | undefined;
780
- placeholder?: string;
781
- min?: number;
782
- max?: number;
783
- step?: number;
784
- };
785
- }) | ({
786
- type: "Range";
787
- } & {
788
- fieldset?: string | null | undefined;
789
- config?: {
790
- label?: string | null | undefined;
791
- placeholder?: string;
792
- min?: number;
793
- max?: number;
794
- step?: number;
795
- };
796
- }) | ({
797
- type: "StructuredText";
798
- } & {
799
- fieldset?: string | null | undefined;
800
- config?: {
801
- label?: string | null | undefined;
802
- placeholder?: string;
803
- useAsTitle?: boolean;
804
- single?: string;
805
- multi?: string;
806
- imageConstraint?: {
807
- width?: number | null;
808
- height?: number | null;
809
- };
810
- labels?: readonly string[];
811
- allowTargetBlank?: boolean;
812
- };
813
- }) | ({
814
- type: "Select";
815
- } & {
816
- fieldset?: string | null | undefined;
817
- config?: {
818
- label?: string | null | undefined;
819
- placeholder?: string;
820
- default_value?: string;
821
- options?: readonly string[];
822
- };
823
- }) | ({
824
- type: "Separator";
825
- } & {
826
- config?: {
827
- label?: string | null | undefined;
828
- };
829
- }) | ({
830
- type: "Text";
831
- } & {
832
- fieldset?: string | null | undefined;
833
- config?: {
834
- label?: string | null | undefined;
835
- useAsTitle?: boolean;
836
- placeholder?: string;
837
- };
838
- }) | ({
839
- type: "Timestamp";
840
- } & {
841
- fieldset?: string | null | undefined;
842
- config?: {
843
- label?: string | null | undefined;
844
- placeholder?: string;
845
- default?: string;
846
- };
847
- });
848
- };
849
- };
850
- });
504
+ }) | Group;
851
505
  };
852
506
  items?: {
853
507
  [x: string]: ({
@@ -1010,4 +664,3 @@ export declare const VariationComparator: {
1010
664
  };
1011
665
  }) | undefined): VariationDiff | undefined;
1012
666
  };
1013
- export {};
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VariationComparator = void 0;
4
4
  const utils_1 = require("../../utils");
5
+ const Group_1 = require("../widgets/Group");
5
6
  const Changes_1 = require("./Changes");
6
7
  function compareVariationMeta(variationA, variationB) {
7
8
  const zippedVariations = utils_1.Objects.zipObjects(variationA, variationB);
@@ -28,7 +29,7 @@ function compareWidgets(widgetsA, widgetsB) {
28
29
  };
29
30
  }
30
31
  if (!(widgetValue === null || widgetValue === void 0 ? void 0 : widgetValue.left) && (widgetValue === null || widgetValue === void 0 ? void 0 : widgetValue.right)) {
31
- if (((_a = widgetValue.right) === null || _a === void 0 ? void 0 : _a.type) === "Group") {
32
+ if (((_a = widgetValue.right) === null || _a === void 0 ? void 0 : _a.type) === Group_1.GroupFieldType) {
32
33
  const group = {
33
34
  ...widgetValue.right,
34
35
  config: {
@@ -49,7 +50,7 @@ function compareWidgets(widgetsA, widgetsB) {
49
50
  value: widgetValue.right,
50
51
  };
51
52
  }
52
- if (((_c = widgetValue.right) === null || _c === void 0 ? void 0 : _c.type) === "Group") {
53
+ if (((_c = widgetValue.right) === null || _c === void 0 ? void 0 : _c.type) === Group_1.GroupFieldType) {
53
54
  const group = {
54
55
  ...widgetValue.right,
55
56
  config: {
@@ -59,7 +60,7 @@ function compareWidgets(widgetsA, widgetsB) {
59
60
  };
60
61
  // On updated groups, this also compares the fields inside the group
61
62
  group.config.fields =
62
- compareWidgets(((_d = widgetValue.left) === null || _d === void 0 ? void 0 : _d.type) === "Group"
63
+ compareWidgets(((_d = widgetValue.left) === null || _d === void 0 ? void 0 : _d.type) === Group_1.GroupFieldType
63
64
  ? (_f = (_e = widgetValue.left) === null || _e === void 0 ? void 0 : _e.config) === null || _f === void 0 ? void 0 : _f.fields
64
65
  : undefined, (_g = widgetValue.right.config) === null || _g === void 0 ? void 0 : _g.fields) || {};
65
66
  return {
@@ -0,0 +1,11 @@
1
+ import type { Group } from "../widgets";
2
+ import type { NestableWidget } from "../widgets/nestable";
3
+ import type { DiffChange } from "./Changes";
4
+ export declare type NestableWidgetDiff = DiffChange<NestableWidget, NestableWidget>;
5
+ export declare type GroupWidgetWithFieldsDiff = Omit<Group, "config"> & {
6
+ config: Omit<Group["config"], "fields"> & {
7
+ fields?: Record<string, GroupWidgetDiff | NestableWidgetDiff>;
8
+ };
9
+ };
10
+ export declare type GroupWidgetDiff = DiffChange<GroupWidgetWithFieldsDiff, GroupWidgetWithFieldsDiff>;
11
+ export declare type SlicePrimaryWidgetDiff = NestableWidgetDiff | GroupWidgetDiff;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
1
  export * from "./Changes";
2
2
  export * from "./SharedSlice";
3
3
  export * from "./Variation";
4
+ export * from "./Widgets";
@@ -4,3 +4,4 @@ const tslib_1 = require("tslib");
4
4
  (0, tslib_1.__exportStar)(require("./Changes"), exports);
5
5
  (0, tslib_1.__exportStar)(require("./SharedSlice"), exports);
6
6
  (0, tslib_1.__exportStar)(require("./Variation"), exports);
7
+ (0, tslib_1.__exportStar)(require("./Widgets"), exports);