@prismicio/types-internal 2.4.0-alpha.2 → 2.4.0-alpha.4

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 (38) hide show
  1. package/lib/content/Document.d.ts +1035 -1
  2. package/lib/content/Document.js +4 -0
  3. package/lib/content/fields/GroupContent.d.ts +1 -0
  4. package/lib/content/fields/GroupContent.js +5 -1
  5. package/lib/content/fields/WidgetContent.d.ts +1035 -1
  6. package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +1036 -2
  7. package/lib/content/fields/slices/Slice/SharedSliceContent.js +25 -4
  8. package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +1429 -0
  9. package/lib/content/fields/slices/Slice/SlicePrimaryContent.js +28 -0
  10. package/lib/content/fields/slices/Slice/index.d.ts +717 -1
  11. package/lib/content/fields/slices/SliceItem.d.ts +717 -1
  12. package/lib/content/fields/slices/SlicesContent.d.ts +1035 -1
  13. package/lib/content/fields/withDefaultValues.d.ts +3 -1
  14. package/lib/content/fields/withDefaultValues.js +26 -1
  15. package/lib/customtypes/CustomType.d.ts +159 -318
  16. package/lib/customtypes/Section.d.ts +159 -318
  17. package/lib/customtypes/diff/SharedSlice.d.ts +190 -508
  18. package/lib/customtypes/diff/Variation.d.ts +183 -502
  19. package/lib/customtypes/diff/Variation.js +1 -3
  20. package/lib/customtypes/widgets/Widget.d.ts +159 -318
  21. package/lib/customtypes/widgets/slices/SharedSlice.d.ts +10 -324
  22. package/lib/customtypes/widgets/slices/SharedSlice.js +2 -3
  23. package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +327 -0
  24. package/lib/customtypes/widgets/slices/SlicePrimaryWidget.js +8 -0
  25. package/lib/customtypes/widgets/slices/Slices.d.ts +422 -740
  26. package/lib/customtypes/widgets/slices/index.d.ts +1 -1
  27. package/lib/customtypes/widgets/slices/index.js +1 -1
  28. package/package.json +1 -1
  29. package/src/content/Document.ts +4 -0
  30. package/src/content/fields/GroupContent.ts +5 -0
  31. package/src/content/fields/slices/Slice/SharedSliceContent.ts +38 -12
  32. package/src/content/fields/slices/Slice/SlicePrimaryContent.ts +33 -0
  33. package/src/content/fields/withDefaultValues.ts +48 -1
  34. package/src/customtypes/diff/Variation.ts +8 -11
  35. package/src/customtypes/widgets/slices/SharedSlice.ts +2 -3
  36. package/src/customtypes/widgets/slices/SlicePrimaryWidget.ts +9 -0
  37. package/src/customtypes/widgets/slices/index.ts +1 -1
  38. package/src/customtypes/widgets/slices/SliceWidget.ts +0 -9
@@ -1,5 +1,7 @@
1
- import type { NestableWidget } from "../../customtypes";
1
+ import { type NestableWidget, type SlicePrimaryWidget } from "../../customtypes";
2
2
  import type { NestableContent } from "./nestable";
3
+ import type { SlicePrimaryContent } from "./slices/Slice/SlicePrimaryContent";
4
+ export declare function withDefaultSlicePrimaryContentValues(customType: Record<string, SlicePrimaryWidget>, content: Partial<Record<string, SlicePrimaryContent>>): Record<string, SlicePrimaryContent>;
3
5
  export declare function withDefaultNestableContentValues(customType: Record<string, NestableWidget>, content: Record<string, NestableContent>): Record<string, NestableContent>;
4
6
  export declare function repeatableContentWithDefaultNestableContentValues<T extends {
5
7
  value: [string, NestableContent][];
@@ -1,7 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.repeatableContentWithDefaultNestableContentValues = exports.withDefaultNestableContentValues = void 0;
3
+ exports.repeatableContentWithDefaultNestableContentValues = exports.withDefaultNestableContentValues = exports.withDefaultSlicePrimaryContentValues = void 0;
4
+ const customtypes_1 = require("../../customtypes");
5
+ const GroupContent_1 = require("./GroupContent");
4
6
  const nestable_1 = require("./nestable");
7
+ function withDefaultSlicePrimaryContentValues(customType, content) {
8
+ const updatedContent = content;
9
+ for (const [widgetKey, widgetDef] of Object.entries(customType)) {
10
+ const widgetContent = content[widgetKey];
11
+ if (widgetContent === undefined) {
12
+ if (widgetDef.type === customtypes_1.GroupFieldType) {
13
+ updatedContent[widgetKey] = (0, GroupContent_1.groupContentWithDefaultValues)(widgetDef, GroupContent_1.GroupContentDefaultValue);
14
+ }
15
+ else {
16
+ const defaultValue = (0, nestable_1.NestableContentDefaultValue)(widgetDef);
17
+ if (defaultValue) {
18
+ updatedContent[widgetKey] = defaultValue;
19
+ }
20
+ }
21
+ continue;
22
+ }
23
+ if (widgetDef.type === customtypes_1.GroupFieldType && (0, GroupContent_1.isGroupContent)(widgetContent)) {
24
+ updatedContent[widgetKey] = (0, GroupContent_1.groupContentWithDefaultValues)(widgetDef, widgetContent);
25
+ }
26
+ }
27
+ return updatedContent;
28
+ }
29
+ exports.withDefaultSlicePrimaryContentValues = withDefaultSlicePrimaryContentValues;
5
30
  function withDefaultNestableContentValues(customType, content) {
6
31
  return Object.entries(customType).reduce((updatedContent, [widgetKey, widgetDef]) => {
7
32
  if (content[widgetKey] === undefined) {
@@ -1180,324 +1180,6 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1180
1180
  placeholder?: string;
1181
1181
  default?: string;
1182
1182
  };
1183
- });
1184
- };
1185
- items?: {
1186
- [x: string]: ({
1187
- type: "Boolean";
1188
- } & {
1189
- config?: {
1190
- label?: string | null | undefined;
1191
- default_value?: boolean;
1192
- placeholder_true?: string;
1193
- placeholder_false?: string;
1194
- };
1195
- }) | ({
1196
- type: "Color";
1197
- } & {
1198
- fieldset?: string | null | undefined;
1199
- config?: {
1200
- label?: string | null | undefined;
1201
- placeholder?: string;
1202
- };
1203
- }) | ({
1204
- type: "Date";
1205
- } & {
1206
- fieldset?: string | null | undefined;
1207
- config?: {
1208
- label?: string | null | undefined;
1209
- placeholder?: string;
1210
- default?: string;
1211
- };
1212
- }) | ({
1213
- type: "Embed";
1214
- } & {
1215
- fieldset?: string | null | undefined;
1216
- config?: {
1217
- label?: string | null | undefined;
1218
- placeholder?: string;
1219
- useAsTitle?: boolean;
1220
- };
1221
- }) | ({
1222
- type: "GeoPoint";
1223
- } & {
1224
- fieldset?: string | null | undefined;
1225
- config?: {
1226
- label?: string | null | undefined;
1227
- };
1228
- }) | ({
1229
- type: "Image";
1230
- } & {
1231
- fieldset?: string | null | undefined;
1232
- config?: {
1233
- label?: string | null | undefined;
1234
- placeholder?: string;
1235
- constraint?: {
1236
- width?: number | null;
1237
- height?: number | null;
1238
- };
1239
- thumbnails?: readonly ({
1240
- name: string;
1241
- } & {
1242
- width?: number | null;
1243
- height?: number | null;
1244
- })[];
1245
- };
1246
- }) | ({
1247
- type: "IntegrationFields";
1248
- } & {
1249
- fieldset?: string | null | undefined;
1250
- config?: {
1251
- label?: string | null | undefined;
1252
- placeholder?: string;
1253
- catalog?: string;
1254
- };
1255
- }) | ({
1256
- type: "Link";
1257
- } & {
1258
- fieldset?: string | null | undefined;
1259
- config?: {
1260
- label?: string | null | undefined;
1261
- useAsTitle?: boolean;
1262
- placeholder?: string;
1263
- select?: "media" | "document" | "web" | null;
1264
- customtypes?: readonly string[];
1265
- masks?: readonly string[];
1266
- tags?: readonly string[];
1267
- allowTargetBlank?: boolean;
1268
- };
1269
- }) | ({
1270
- type: "Number";
1271
- } & {
1272
- fieldset?: string | null | undefined;
1273
- config?: {
1274
- label?: string | null | undefined;
1275
- placeholder?: string;
1276
- min?: number;
1277
- max?: number;
1278
- step?: number;
1279
- };
1280
- }) | ({
1281
- type: "Range";
1282
- } & {
1283
- fieldset?: string | null | undefined;
1284
- config?: {
1285
- label?: string | null | undefined;
1286
- placeholder?: string;
1287
- min?: number;
1288
- max?: number;
1289
- step?: number;
1290
- };
1291
- }) | ({
1292
- type: "StructuredText";
1293
- } & {
1294
- fieldset?: string | null | undefined;
1295
- config?: {
1296
- label?: string | null | undefined;
1297
- placeholder?: string;
1298
- useAsTitle?: boolean;
1299
- single?: string;
1300
- multi?: string;
1301
- imageConstraint?: {
1302
- width?: number | null;
1303
- height?: number | null;
1304
- };
1305
- labels?: readonly string[];
1306
- allowTargetBlank?: boolean;
1307
- };
1308
- }) | ({
1309
- type: "Select";
1310
- } & {
1311
- fieldset?: string | null | undefined;
1312
- config?: {
1313
- label?: string | null | undefined;
1314
- placeholder?: string;
1315
- default_value?: string;
1316
- options?: readonly string[];
1317
- };
1318
- }) | ({
1319
- type: "Separator";
1320
- } & {
1321
- config?: {
1322
- label?: string | null | undefined;
1323
- };
1324
- }) | ({
1325
- type: "Text";
1326
- } & {
1327
- fieldset?: string | null | undefined;
1328
- config?: {
1329
- label?: string | null | undefined;
1330
- useAsTitle?: boolean;
1331
- placeholder?: string;
1332
- };
1333
- }) | ({
1334
- type: "Timestamp";
1335
- } & {
1336
- fieldset?: string | null | undefined;
1337
- config?: {
1338
- label?: string | null | undefined;
1339
- placeholder?: string;
1340
- default?: string;
1341
- };
1342
- });
1343
- };
1344
- fields?: {
1345
- [x: string]: ({
1346
- type: "Boolean";
1347
- } & {
1348
- config?: {
1349
- label?: string | null | undefined;
1350
- default_value?: boolean;
1351
- placeholder_true?: string;
1352
- placeholder_false?: string;
1353
- };
1354
- }) | ({
1355
- type: "Color";
1356
- } & {
1357
- fieldset?: string | null | undefined;
1358
- config?: {
1359
- label?: string | null | undefined;
1360
- placeholder?: string;
1361
- };
1362
- }) | ({
1363
- type: "Date";
1364
- } & {
1365
- fieldset?: string | null | undefined;
1366
- config?: {
1367
- label?: string | null | undefined;
1368
- placeholder?: string;
1369
- default?: string;
1370
- };
1371
- }) | ({
1372
- type: "Embed";
1373
- } & {
1374
- fieldset?: string | null | undefined;
1375
- config?: {
1376
- label?: string | null | undefined;
1377
- placeholder?: string;
1378
- useAsTitle?: boolean;
1379
- };
1380
- }) | ({
1381
- type: "GeoPoint";
1382
- } & {
1383
- fieldset?: string | null | undefined;
1384
- config?: {
1385
- label?: string | null | undefined;
1386
- };
1387
- }) | ({
1388
- type: "Image";
1389
- } & {
1390
- fieldset?: string | null | undefined;
1391
- config?: {
1392
- label?: string | null | undefined;
1393
- placeholder?: string;
1394
- constraint?: {
1395
- width?: number | null;
1396
- height?: number | null;
1397
- };
1398
- thumbnails?: readonly ({
1399
- name: string;
1400
- } & {
1401
- width?: number | null;
1402
- height?: number | null;
1403
- })[];
1404
- };
1405
- }) | ({
1406
- type: "IntegrationFields";
1407
- } & {
1408
- fieldset?: string | null | undefined;
1409
- config?: {
1410
- label?: string | null | undefined;
1411
- placeholder?: string;
1412
- catalog?: string;
1413
- };
1414
- }) | ({
1415
- type: "Link";
1416
- } & {
1417
- fieldset?: string | null | undefined;
1418
- config?: {
1419
- label?: string | null | undefined;
1420
- useAsTitle?: boolean;
1421
- placeholder?: string;
1422
- select?: "media" | "document" | "web" | null;
1423
- customtypes?: readonly string[];
1424
- masks?: readonly string[];
1425
- tags?: readonly string[];
1426
- allowTargetBlank?: boolean;
1427
- };
1428
- }) | ({
1429
- type: "Number";
1430
- } & {
1431
- fieldset?: string | null | undefined;
1432
- config?: {
1433
- label?: string | null | undefined;
1434
- placeholder?: string;
1435
- min?: number;
1436
- max?: number;
1437
- step?: number;
1438
- };
1439
- }) | ({
1440
- type: "Range";
1441
- } & {
1442
- fieldset?: string | null | undefined;
1443
- config?: {
1444
- label?: string | null | undefined;
1445
- placeholder?: string;
1446
- min?: number;
1447
- max?: number;
1448
- step?: number;
1449
- };
1450
- }) | ({
1451
- type: "StructuredText";
1452
- } & {
1453
- fieldset?: string | null | undefined;
1454
- config?: {
1455
- label?: string | null | undefined;
1456
- placeholder?: string;
1457
- useAsTitle?: boolean;
1458
- single?: string;
1459
- multi?: string;
1460
- imageConstraint?: {
1461
- width?: number | null;
1462
- height?: number | null;
1463
- };
1464
- labels?: readonly string[];
1465
- allowTargetBlank?: boolean;
1466
- };
1467
- }) | ({
1468
- type: "Select";
1469
- } & {
1470
- fieldset?: string | null | undefined;
1471
- config?: {
1472
- label?: string | null | undefined;
1473
- placeholder?: string;
1474
- default_value?: string;
1475
- options?: readonly string[];
1476
- };
1477
- }) | ({
1478
- type: "Separator";
1479
- } & {
1480
- config?: {
1481
- label?: string | null | undefined;
1482
- };
1483
- }) | ({
1484
- type: "Text";
1485
- } & {
1486
- fieldset?: string | null | undefined;
1487
- config?: {
1488
- label?: string | null | undefined;
1489
- useAsTitle?: boolean;
1490
- placeholder?: string;
1491
- };
1492
- }) | ({
1493
- type: "Timestamp";
1494
- } & {
1495
- fieldset?: string | null | undefined;
1496
- config?: {
1497
- label?: string | null | undefined;
1498
- placeholder?: string;
1499
- default?: string;
1500
- };
1501
1183
  }) | ({
1502
1184
  type: "Group";
1503
1185
  } & {
@@ -1669,6 +1351,165 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
1669
1351
  };
1670
1352
  });
1671
1353
  };
1354
+ items?: {
1355
+ [x: string]: ({
1356
+ type: "Boolean";
1357
+ } & {
1358
+ config?: {
1359
+ label?: string | null | undefined;
1360
+ default_value?: boolean;
1361
+ placeholder_true?: string;
1362
+ placeholder_false?: string;
1363
+ };
1364
+ }) | ({
1365
+ type: "Color";
1366
+ } & {
1367
+ fieldset?: string | null | undefined;
1368
+ config?: {
1369
+ label?: string | null | undefined;
1370
+ placeholder?: string;
1371
+ };
1372
+ }) | ({
1373
+ type: "Date";
1374
+ } & {
1375
+ fieldset?: string | null | undefined;
1376
+ config?: {
1377
+ label?: string | null | undefined;
1378
+ placeholder?: string;
1379
+ default?: string;
1380
+ };
1381
+ }) | ({
1382
+ type: "Embed";
1383
+ } & {
1384
+ fieldset?: string | null | undefined;
1385
+ config?: {
1386
+ label?: string | null | undefined;
1387
+ placeholder?: string;
1388
+ useAsTitle?: boolean;
1389
+ };
1390
+ }) | ({
1391
+ type: "GeoPoint";
1392
+ } & {
1393
+ fieldset?: string | null | undefined;
1394
+ config?: {
1395
+ label?: string | null | undefined;
1396
+ };
1397
+ }) | ({
1398
+ type: "Image";
1399
+ } & {
1400
+ fieldset?: string | null | undefined;
1401
+ config?: {
1402
+ label?: string | null | undefined;
1403
+ placeholder?: string;
1404
+ constraint?: {
1405
+ width?: number | null;
1406
+ height?: number | null;
1407
+ };
1408
+ thumbnails?: readonly ({
1409
+ name: string;
1410
+ } & {
1411
+ width?: number | null;
1412
+ height?: number | null;
1413
+ })[];
1414
+ };
1415
+ }) | ({
1416
+ type: "IntegrationFields";
1417
+ } & {
1418
+ fieldset?: string | null | undefined;
1419
+ config?: {
1420
+ label?: string | null | undefined;
1421
+ placeholder?: string;
1422
+ catalog?: string;
1423
+ };
1424
+ }) | ({
1425
+ type: "Link";
1426
+ } & {
1427
+ fieldset?: string | null | undefined;
1428
+ config?: {
1429
+ label?: string | null | undefined;
1430
+ useAsTitle?: boolean;
1431
+ placeholder?: string;
1432
+ select?: "media" | "document" | "web" | null;
1433
+ customtypes?: readonly string[];
1434
+ masks?: readonly string[];
1435
+ tags?: readonly string[];
1436
+ allowTargetBlank?: boolean;
1437
+ };
1438
+ }) | ({
1439
+ type: "Number";
1440
+ } & {
1441
+ fieldset?: string | null | undefined;
1442
+ config?: {
1443
+ label?: string | null | undefined;
1444
+ placeholder?: string;
1445
+ min?: number;
1446
+ max?: number;
1447
+ step?: number;
1448
+ };
1449
+ }) | ({
1450
+ type: "Range";
1451
+ } & {
1452
+ fieldset?: string | null | undefined;
1453
+ config?: {
1454
+ label?: string | null | undefined;
1455
+ placeholder?: string;
1456
+ min?: number;
1457
+ max?: number;
1458
+ step?: number;
1459
+ };
1460
+ }) | ({
1461
+ type: "StructuredText";
1462
+ } & {
1463
+ fieldset?: string | null | undefined;
1464
+ config?: {
1465
+ label?: string | null | undefined;
1466
+ placeholder?: string;
1467
+ useAsTitle?: boolean;
1468
+ single?: string;
1469
+ multi?: string;
1470
+ imageConstraint?: {
1471
+ width?: number | null;
1472
+ height?: number | null;
1473
+ };
1474
+ labels?: readonly string[];
1475
+ allowTargetBlank?: boolean;
1476
+ };
1477
+ }) | ({
1478
+ type: "Select";
1479
+ } & {
1480
+ fieldset?: string | null | undefined;
1481
+ config?: {
1482
+ label?: string | null | undefined;
1483
+ placeholder?: string;
1484
+ default_value?: string;
1485
+ options?: readonly string[];
1486
+ };
1487
+ }) | ({
1488
+ type: "Separator";
1489
+ } & {
1490
+ config?: {
1491
+ label?: string | null | undefined;
1492
+ };
1493
+ }) | ({
1494
+ type: "Text";
1495
+ } & {
1496
+ fieldset?: string | null | undefined;
1497
+ config?: {
1498
+ label?: string | null | undefined;
1499
+ useAsTitle?: boolean;
1500
+ placeholder?: string;
1501
+ };
1502
+ }) | ({
1503
+ type: "Timestamp";
1504
+ } & {
1505
+ fieldset?: string | null | undefined;
1506
+ config?: {
1507
+ label?: string | null | undefined;
1508
+ placeholder?: string;
1509
+ default?: string;
1510
+ };
1511
+ });
1512
+ };
1672
1513
  })[];
1673
1514
  } & {
1674
1515
  description?: string;