pretext-pdf 1.9.0 → 2.0.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 (78) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/dist/allowed-props.d.ts +23 -8
  3. package/dist/allowed-props.d.ts.map +1 -1
  4. package/dist/allowed-props.js +38 -6
  5. package/dist/allowed-props.js.map +1 -1
  6. package/dist/assets/index.d.ts +1 -1
  7. package/dist/assets/index.d.ts.map +1 -1
  8. package/dist/assets/index.js +1 -1
  9. package/dist/assets/index.js.map +1 -1
  10. package/dist/assets/svg/sanitize.d.ts +2 -0
  11. package/dist/assets/svg/sanitize.d.ts.map +1 -1
  12. package/dist/assets/svg/sanitize.js +41 -10
  13. package/dist/assets/svg/sanitize.js.map +1 -1
  14. package/dist/builder.js +1 -1
  15. package/dist/builder.js.map +1 -1
  16. package/dist/fonts.d.ts.map +1 -1
  17. package/dist/fonts.js +7 -5
  18. package/dist/fonts.js.map +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/measure-blocks/simple-blocks.js +3 -3
  24. package/dist/measure-blocks/simple-blocks.js.map +1 -1
  25. package/dist/measure-text.d.ts.map +1 -1
  26. package/dist/measure-text.js +7 -0
  27. package/dist/measure-text.js.map +1 -1
  28. package/dist/pipeline.d.ts.map +1 -1
  29. package/dist/pipeline.js +42 -13
  30. package/dist/pipeline.js.map +1 -1
  31. package/dist/plugin-types.d.ts +3 -3
  32. package/dist/plugin-types.d.ts.map +1 -1
  33. package/dist/render-blocks/hr.d.ts.map +1 -1
  34. package/dist/render-blocks/hr.js +2 -3
  35. package/dist/render-blocks/hr.js.map +1 -1
  36. package/dist/render-extras.d.ts +0 -2
  37. package/dist/render-extras.d.ts.map +1 -1
  38. package/dist/render-extras.js +15 -78
  39. package/dist/render-extras.js.map +1 -1
  40. package/dist/render-utils.d.ts.map +1 -1
  41. package/dist/render-utils.js +10 -6
  42. package/dist/render-utils.js.map +1 -1
  43. package/dist/render.js +2 -1
  44. package/dist/render.js.map +1 -1
  45. package/dist/schema.d.ts +335 -88
  46. package/dist/schema.d.ts.map +1 -1
  47. package/dist/schema.js +94 -35
  48. package/dist/schema.js.map +1 -1
  49. package/dist/signing/index.d.ts +3 -0
  50. package/dist/signing/index.d.ts.map +1 -0
  51. package/dist/signing/index.js +3 -0
  52. package/dist/signing/index.js.map +1 -0
  53. package/dist/signing/placeholder.d.ts +5 -0
  54. package/dist/signing/placeholder.d.ts.map +1 -0
  55. package/dist/signing/placeholder.js +75 -0
  56. package/dist/signing/placeholder.js.map +1 -0
  57. package/dist/signing/post-process.d.ts +16 -0
  58. package/dist/signing/post-process.d.ts.map +1 -0
  59. package/dist/signing/post-process.js +125 -0
  60. package/dist/signing/post-process.js.map +1 -0
  61. package/dist/types-public/document.d.ts +7 -9
  62. package/dist/types-public/document.d.ts.map +1 -1
  63. package/dist/types-public/elements-block.d.ts +54 -35
  64. package/dist/types-public/elements-block.d.ts.map +1 -1
  65. package/dist/types-public/validation.d.ts +9 -15
  66. package/dist/types-public/validation.d.ts.map +1 -1
  67. package/dist/types.d.ts +1 -1
  68. package/dist/types.d.ts.map +1 -1
  69. package/dist/validate/elements/forms-floats.d.ts +1 -1
  70. package/dist/validate/elements/forms-floats.d.ts.map +1 -1
  71. package/dist/validate/elements/forms-floats.js +44 -6
  72. package/dist/validate/elements/forms-floats.js.map +1 -1
  73. package/dist/validate/elements/structural-simple.js +4 -4
  74. package/dist/validate/elements/structural-simple.js.map +1 -1
  75. package/dist/validate/index.d.ts.map +1 -1
  76. package/dist/validate/index.js +4 -6
  77. package/dist/validate/index.js.map +1 -1
  78. package/package.json +7 -3
package/dist/schema.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare const pdfDocumentSchema: {
19
19
  readonly type: "array";
20
20
  readonly description: "Document content elements rendered top-to-bottom.";
21
21
  readonly items: {
22
- readonly anyOf: readonly [{
22
+ readonly oneOf: readonly [{
23
23
  readonly type: "object";
24
24
  readonly required: readonly ["type", "text"];
25
25
  readonly properties: {
@@ -265,21 +265,13 @@ export declare const pdfDocumentSchema: {
265
265
  readonly pattern: "^#[0-9A-Fa-f]{6}$";
266
266
  readonly description: "6-digit hex color e.g. #FF0000";
267
267
  };
268
- readonly spaceAbove: {
269
- readonly type: "number";
270
- readonly description: "Space above line in pt. Default: 12. Primary field.";
271
- };
272
- readonly spaceBelow: {
273
- readonly type: "number";
274
- readonly description: "Space below line in pt. Default: 12. Primary field.";
275
- };
276
268
  readonly spaceBefore: {
277
269
  readonly type: "number";
278
- readonly description: "Alias for spaceAbove (primary).";
270
+ readonly description: "Space above line in pt. Default: 12.";
279
271
  };
280
272
  readonly spaceAfter: {
281
273
  readonly type: "number";
282
- readonly description: "Alias for spaceBelow (primary).";
274
+ readonly description: "Space below line in pt. Default: 12.";
283
275
  };
284
276
  };
285
277
  }, {
@@ -1249,91 +1241,345 @@ export declare const pdfDocumentSchema: {
1249
1241
  }, {
1250
1242
  readonly type: "object";
1251
1243
  readonly required: readonly ["type", "fieldType", "name"];
1252
- readonly properties: {
1253
- readonly type: {
1254
- readonly type: "string";
1255
- readonly const: "form-field";
1256
- };
1257
- readonly fieldType: {
1258
- readonly type: "string";
1259
- readonly enum: readonly ["text", "checkbox", "radio", "dropdown", "button"];
1260
- };
1261
- readonly name: {
1262
- readonly type: "string";
1263
- };
1264
- readonly label: {
1265
- readonly type: "string";
1266
- };
1267
- readonly placeholder: {
1268
- readonly type: "string";
1269
- };
1270
- readonly defaultValue: {
1271
- readonly type: "string";
1272
- };
1273
- readonly multiline: {
1274
- readonly type: "boolean";
1275
- };
1276
- readonly maxLength: {
1277
- readonly type: "number";
1244
+ readonly oneOf: readonly [{
1245
+ readonly description: "Single-line or multi-line text input.";
1246
+ readonly properties: {
1247
+ readonly fieldType: {
1248
+ readonly type: "string";
1249
+ readonly const: "text";
1250
+ };
1251
+ readonly placeholder: {
1252
+ readonly type: "string";
1253
+ };
1254
+ readonly defaultValue: {
1255
+ readonly type: "string";
1256
+ };
1257
+ readonly multiline: {
1258
+ readonly type: "boolean";
1259
+ };
1260
+ readonly maxLength: {
1261
+ readonly type: "number";
1262
+ readonly minimum: 1;
1263
+ };
1264
+ readonly type: {
1265
+ readonly type: "string";
1266
+ readonly const: "form-field";
1267
+ };
1268
+ readonly name: {
1269
+ readonly type: "string";
1270
+ readonly description: "Unique field name used in PDF AcroForm dictionary.";
1271
+ };
1272
+ readonly label: {
1273
+ readonly type: "string";
1274
+ };
1275
+ readonly width: {
1276
+ readonly type: "number";
1277
+ };
1278
+ readonly height: {
1279
+ readonly type: "number";
1280
+ };
1281
+ readonly fontSize: {
1282
+ readonly type: "number";
1283
+ };
1284
+ readonly borderColor: {
1285
+ readonly type: "string";
1286
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1287
+ readonly description: "6-digit hex color e.g. #FF0000";
1288
+ };
1289
+ readonly backgroundColor: {
1290
+ readonly type: "string";
1291
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1292
+ readonly description: "6-digit hex color e.g. #FF0000";
1293
+ };
1294
+ readonly keepTogether: {
1295
+ readonly type: "boolean";
1296
+ readonly description: "If true, never break this element across pages. Default: true";
1297
+ };
1298
+ readonly spaceAfter: {
1299
+ readonly type: "number";
1300
+ readonly description: "Space in points (pt)";
1301
+ };
1302
+ readonly spaceBefore: {
1303
+ readonly type: "number";
1304
+ readonly description: "Space in points (pt)";
1305
+ };
1306
+ readonly accessibilityLabel: {
1307
+ readonly type: "string";
1308
+ readonly description: "Written to the PDF /TU AcroForm annotation entry for screen-reader announcements.";
1309
+ };
1278
1310
  };
1279
- readonly checked: {
1280
- readonly type: "boolean";
1311
+ readonly required: readonly ["type", "fieldType", "name"];
1312
+ }, {
1313
+ readonly description: "Boolean on/off checkbox.";
1314
+ readonly properties: {
1315
+ readonly fieldType: {
1316
+ readonly type: "string";
1317
+ readonly const: "checkbox";
1318
+ };
1319
+ readonly checked: {
1320
+ readonly type: "boolean";
1321
+ readonly description: "Initial checked state. Default: false.";
1322
+ };
1323
+ readonly type: {
1324
+ readonly type: "string";
1325
+ readonly const: "form-field";
1326
+ };
1327
+ readonly name: {
1328
+ readonly type: "string";
1329
+ readonly description: "Unique field name used in PDF AcroForm dictionary.";
1330
+ };
1331
+ readonly label: {
1332
+ readonly type: "string";
1333
+ };
1334
+ readonly width: {
1335
+ readonly type: "number";
1336
+ };
1337
+ readonly height: {
1338
+ readonly type: "number";
1339
+ };
1340
+ readonly fontSize: {
1341
+ readonly type: "number";
1342
+ };
1343
+ readonly borderColor: {
1344
+ readonly type: "string";
1345
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1346
+ readonly description: "6-digit hex color e.g. #FF0000";
1347
+ };
1348
+ readonly backgroundColor: {
1349
+ readonly type: "string";
1350
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1351
+ readonly description: "6-digit hex color e.g. #FF0000";
1352
+ };
1353
+ readonly keepTogether: {
1354
+ readonly type: "boolean";
1355
+ readonly description: "If true, never break this element across pages. Default: true";
1356
+ };
1357
+ readonly spaceAfter: {
1358
+ readonly type: "number";
1359
+ readonly description: "Space in points (pt)";
1360
+ };
1361
+ readonly spaceBefore: {
1362
+ readonly type: "number";
1363
+ readonly description: "Space in points (pt)";
1364
+ };
1365
+ readonly accessibilityLabel: {
1366
+ readonly type: "string";
1367
+ readonly description: "Written to the PDF /TU AcroForm annotation entry for screen-reader announcements.";
1368
+ };
1281
1369
  };
1282
- readonly options: {
1283
- readonly type: "array";
1284
- readonly items: {
1285
- readonly type: "object";
1286
- readonly required: readonly ["value", "label"];
1287
- readonly properties: {
1288
- readonly value: {
1289
- readonly type: "string";
1290
- };
1291
- readonly label: {
1292
- readonly type: "string";
1370
+ readonly required: readonly ["type", "fieldType", "name"];
1371
+ }, {
1372
+ readonly description: "Radio button group — exactly one option is selectable.";
1373
+ readonly properties: {
1374
+ readonly fieldType: {
1375
+ readonly type: "string";
1376
+ readonly const: "radio";
1377
+ };
1378
+ readonly options: {
1379
+ readonly type: "array";
1380
+ readonly minItems: 1;
1381
+ readonly items: {
1382
+ readonly type: "object";
1383
+ readonly required: readonly ["value", "label"];
1384
+ readonly properties: {
1385
+ readonly value: {
1386
+ readonly type: "string";
1387
+ readonly minLength: 1;
1388
+ };
1389
+ readonly label: {
1390
+ readonly type: "string";
1391
+ readonly minLength: 1;
1392
+ };
1293
1393
  };
1394
+ readonly additionalProperties: false;
1294
1395
  };
1295
1396
  };
1397
+ readonly defaultSelected: {
1398
+ readonly type: "string";
1399
+ readonly description: "value of the pre-selected option.";
1400
+ };
1401
+ readonly type: {
1402
+ readonly type: "string";
1403
+ readonly const: "form-field";
1404
+ };
1405
+ readonly name: {
1406
+ readonly type: "string";
1407
+ readonly description: "Unique field name used in PDF AcroForm dictionary.";
1408
+ };
1409
+ readonly label: {
1410
+ readonly type: "string";
1411
+ };
1412
+ readonly width: {
1413
+ readonly type: "number";
1414
+ };
1415
+ readonly height: {
1416
+ readonly type: "number";
1417
+ };
1418
+ readonly fontSize: {
1419
+ readonly type: "number";
1420
+ };
1421
+ readonly borderColor: {
1422
+ readonly type: "string";
1423
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1424
+ readonly description: "6-digit hex color e.g. #FF0000";
1425
+ };
1426
+ readonly backgroundColor: {
1427
+ readonly type: "string";
1428
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1429
+ readonly description: "6-digit hex color e.g. #FF0000";
1430
+ };
1431
+ readonly keepTogether: {
1432
+ readonly type: "boolean";
1433
+ readonly description: "If true, never break this element across pages. Default: true";
1434
+ };
1435
+ readonly spaceAfter: {
1436
+ readonly type: "number";
1437
+ readonly description: "Space in points (pt)";
1438
+ };
1439
+ readonly spaceBefore: {
1440
+ readonly type: "number";
1441
+ readonly description: "Space in points (pt)";
1442
+ };
1443
+ readonly accessibilityLabel: {
1444
+ readonly type: "string";
1445
+ readonly description: "Written to the PDF /TU AcroForm annotation entry for screen-reader announcements.";
1446
+ };
1296
1447
  };
1297
- readonly width: {
1298
- readonly type: "number";
1299
- };
1300
- readonly height: {
1301
- readonly type: "number";
1302
- };
1303
- readonly fontSize: {
1304
- readonly type: "number";
1305
- };
1306
- readonly borderColor: {
1307
- readonly type: "string";
1308
- readonly pattern: "^#[0-9A-Fa-f]{6}$";
1309
- readonly description: "6-digit hex color e.g. #FF0000";
1310
- };
1311
- readonly backgroundColor: {
1312
- readonly type: "string";
1313
- readonly pattern: "^#[0-9A-Fa-f]{6}$";
1314
- readonly description: "6-digit hex color e.g. #FF0000";
1315
- };
1316
- readonly defaultSelected: {
1317
- readonly type: "string";
1318
- readonly description: "Pre-selected value for radio groups and dropdowns.";
1319
- };
1320
- readonly keepTogether: {
1321
- readonly type: "boolean";
1322
- readonly description: "If true, never break this element across pages. Default: true";
1323
- };
1324
- readonly spaceAfter: {
1325
- readonly type: "number";
1326
- readonly description: "Space in points (pt)";
1327
- };
1328
- readonly spaceBefore: {
1329
- readonly type: "number";
1330
- readonly description: "Space in points (pt)";
1448
+ readonly required: readonly ["type", "fieldType", "name", "options"];
1449
+ }, {
1450
+ readonly description: "Dropdown / select list — exactly one option is selectable.";
1451
+ readonly properties: {
1452
+ readonly fieldType: {
1453
+ readonly type: "string";
1454
+ readonly const: "dropdown";
1455
+ };
1456
+ readonly options: {
1457
+ readonly type: "array";
1458
+ readonly minItems: 1;
1459
+ readonly items: {
1460
+ readonly type: "object";
1461
+ readonly required: readonly ["value", "label"];
1462
+ readonly properties: {
1463
+ readonly value: {
1464
+ readonly type: "string";
1465
+ readonly minLength: 1;
1466
+ };
1467
+ readonly label: {
1468
+ readonly type: "string";
1469
+ readonly minLength: 1;
1470
+ };
1471
+ };
1472
+ readonly additionalProperties: false;
1473
+ };
1474
+ };
1475
+ readonly defaultSelected: {
1476
+ readonly type: "string";
1477
+ readonly description: "value of the pre-selected option.";
1478
+ };
1479
+ readonly type: {
1480
+ readonly type: "string";
1481
+ readonly const: "form-field";
1482
+ };
1483
+ readonly name: {
1484
+ readonly type: "string";
1485
+ readonly description: "Unique field name used in PDF AcroForm dictionary.";
1486
+ };
1487
+ readonly label: {
1488
+ readonly type: "string";
1489
+ };
1490
+ readonly width: {
1491
+ readonly type: "number";
1492
+ };
1493
+ readonly height: {
1494
+ readonly type: "number";
1495
+ };
1496
+ readonly fontSize: {
1497
+ readonly type: "number";
1498
+ };
1499
+ readonly borderColor: {
1500
+ readonly type: "string";
1501
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1502
+ readonly description: "6-digit hex color e.g. #FF0000";
1503
+ };
1504
+ readonly backgroundColor: {
1505
+ readonly type: "string";
1506
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1507
+ readonly description: "6-digit hex color e.g. #FF0000";
1508
+ };
1509
+ readonly keepTogether: {
1510
+ readonly type: "boolean";
1511
+ readonly description: "If true, never break this element across pages. Default: true";
1512
+ };
1513
+ readonly spaceAfter: {
1514
+ readonly type: "number";
1515
+ readonly description: "Space in points (pt)";
1516
+ };
1517
+ readonly spaceBefore: {
1518
+ readonly type: "number";
1519
+ readonly description: "Space in points (pt)";
1520
+ };
1521
+ readonly accessibilityLabel: {
1522
+ readonly type: "string";
1523
+ readonly description: "Written to the PDF /TU AcroForm annotation entry for screen-reader announcements.";
1524
+ };
1331
1525
  };
1332
- readonly accessibilityLabel: {
1333
- readonly type: "string";
1334
- readonly description: "Accessible label for screen-reader announcements (v1.8+). Stored but has no render-time effect in v1.x.";
1526
+ readonly required: readonly ["type", "fieldType", "name", "options"];
1527
+ }, {
1528
+ readonly description: "Clickable push-button (no value submitted).";
1529
+ readonly properties: {
1530
+ readonly fieldType: {
1531
+ readonly type: "string";
1532
+ readonly const: "button";
1533
+ };
1534
+ readonly type: {
1535
+ readonly type: "string";
1536
+ readonly const: "form-field";
1537
+ };
1538
+ readonly name: {
1539
+ readonly type: "string";
1540
+ readonly description: "Unique field name used in PDF AcroForm dictionary.";
1541
+ };
1542
+ readonly label: {
1543
+ readonly type: "string";
1544
+ };
1545
+ readonly width: {
1546
+ readonly type: "number";
1547
+ };
1548
+ readonly height: {
1549
+ readonly type: "number";
1550
+ };
1551
+ readonly fontSize: {
1552
+ readonly type: "number";
1553
+ };
1554
+ readonly borderColor: {
1555
+ readonly type: "string";
1556
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1557
+ readonly description: "6-digit hex color e.g. #FF0000";
1558
+ };
1559
+ readonly backgroundColor: {
1560
+ readonly type: "string";
1561
+ readonly pattern: "^#[0-9A-Fa-f]{6}$";
1562
+ readonly description: "6-digit hex color e.g. #FF0000";
1563
+ };
1564
+ readonly keepTogether: {
1565
+ readonly type: "boolean";
1566
+ readonly description: "If true, never break this element across pages. Default: true";
1567
+ };
1568
+ readonly spaceAfter: {
1569
+ readonly type: "number";
1570
+ readonly description: "Space in points (pt)";
1571
+ };
1572
+ readonly spaceBefore: {
1573
+ readonly type: "number";
1574
+ readonly description: "Space in points (pt)";
1575
+ };
1576
+ readonly accessibilityLabel: {
1577
+ readonly type: "string";
1578
+ readonly description: "Written to the PDF /TU AcroForm annotation entry for screen-reader announcements.";
1579
+ };
1335
1580
  };
1336
- };
1581
+ readonly required: readonly ["type", "fieldType", "name"];
1582
+ }];
1337
1583
  }, {
1338
1584
  readonly type: "object";
1339
1585
  readonly required: readonly ["type", "image", "float", "content"];
@@ -1874,5 +2120,6 @@ export declare const pdfDocumentSchema: {
1874
2120
  readonly description: "Restrict filesystem access to these absolute directory paths.";
1875
2121
  };
1876
2122
  };
2123
+ readonly additionalProperties: false;
1877
2124
  };
1878
2125
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA6iBH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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: 'hr' },
130
130
  thickness: { type: 'number' },
131
131
  color: colorSchema,
132
- spaceAbove: { type: 'number', description: 'Space above line in pt. Default: 12. Primary field.' },
133
- spaceBelow: { type: 'number', description: 'Space below line in pt. Default: 12. Primary field.' },
134
- spaceBefore: { type: 'number', description: 'Alias for spaceAbove (primary).' },
135
- spaceAfter: { type: 'number', description: 'Alias for spaceBelow (primary).' },
132
+ spaceBefore: { type: 'number', description: 'Space above line in pt. Default: 12.' },
133
+ spaceAfter: { type: 'number', description: 'Space below line in pt. Default: 12.' },
136
134
  },
137
135
  };
138
136
  const pageBreakSchema = {
@@ -460,41 +458,95 @@ const commentSchema = {
460
458
  spaceAfter: spaceSchema,
461
459
  },
462
460
  };
461
+ /** Shared base properties present on every FormFieldElement variant. */
462
+ const formFieldBaseProperties = {
463
+ type: { type: 'string', const: 'form-field' },
464
+ name: { type: 'string', description: 'Unique field name used in PDF AcroForm dictionary.' },
465
+ label: { type: 'string' },
466
+ width: { type: 'number' },
467
+ height: { type: 'number' },
468
+ fontSize: { type: 'number' },
469
+ borderColor: colorSchema,
470
+ backgroundColor: colorSchema,
471
+ keepTogether: { type: 'boolean', description: 'If true, never break this element across pages. Default: true' },
472
+ spaceAfter: spaceSchema,
473
+ spaceBefore: spaceSchema,
474
+ accessibilityLabel: { type: 'string', description: 'Written to the PDF /TU AcroForm annotation entry for screen-reader announcements.' },
475
+ };
476
+ /** Shared options array used by radio and dropdown variants. */
477
+ const formFieldOptionsSchema = {
478
+ type: 'array',
479
+ minItems: 1,
480
+ items: {
481
+ type: 'object',
482
+ required: ['value', 'label'],
483
+ properties: {
484
+ value: { type: 'string', minLength: 1 },
485
+ label: { type: 'string', minLength: 1 },
486
+ },
487
+ additionalProperties: false,
488
+ },
489
+ };
490
+ /**
491
+ * Discriminated-union schema for form-field elements.
492
+ * The `fieldType` property is the discriminant; each oneOf branch constrains
493
+ * the allowed properties to the specific variant so AI agents and schema
494
+ * validators get accurate narrowed feedback.
495
+ */
463
496
  const formFieldSchema = {
464
497
  type: 'object',
465
498
  required: ['type', 'fieldType', 'name'],
466
- properties: {
467
- type: { type: 'string', const: 'form-field' },
468
- fieldType: { type: 'string', enum: ['text', 'checkbox', 'radio', 'dropdown', 'button'] },
469
- name: { type: 'string' },
470
- label: { type: 'string' },
471
- placeholder: { type: 'string' },
472
- defaultValue: { type: 'string' },
473
- multiline: { type: 'boolean' },
474
- maxLength: { type: 'number' },
475
- checked: { type: 'boolean' },
476
- options: {
477
- type: 'array',
478
- items: {
479
- type: 'object',
480
- required: ['value', 'label'],
481
- properties: {
482
- value: { type: 'string' },
483
- label: { type: 'string' },
484
- },
499
+ oneOf: [
500
+ {
501
+ description: 'Single-line or multi-line text input.',
502
+ properties: {
503
+ ...formFieldBaseProperties,
504
+ fieldType: { type: 'string', const: 'text' },
505
+ placeholder: { type: 'string' },
506
+ defaultValue: { type: 'string' },
507
+ multiline: { type: 'boolean' },
508
+ maxLength: { type: 'number', minimum: 1 },
485
509
  },
510
+ required: ['type', 'fieldType', 'name'],
486
511
  },
487
- width: { type: 'number' },
488
- height: { type: 'number' },
489
- fontSize: { type: 'number' },
490
- borderColor: colorSchema,
491
- backgroundColor: colorSchema,
492
- defaultSelected: { type: 'string', description: 'Pre-selected value for radio groups and dropdowns.' },
493
- keepTogether: { type: 'boolean', description: 'If true, never break this element across pages. Default: true' },
494
- spaceAfter: spaceSchema,
495
- spaceBefore: spaceSchema,
496
- accessibilityLabel: { type: 'string', description: 'Accessible label for screen-reader announcements (v1.8+). Stored but has no render-time effect in v1.x.' },
497
- },
512
+ {
513
+ description: 'Boolean on/off checkbox.',
514
+ properties: {
515
+ ...formFieldBaseProperties,
516
+ fieldType: { type: 'string', const: 'checkbox' },
517
+ checked: { type: 'boolean', description: 'Initial checked state. Default: false.' },
518
+ },
519
+ required: ['type', 'fieldType', 'name'],
520
+ },
521
+ {
522
+ description: 'Radio button group — exactly one option is selectable.',
523
+ properties: {
524
+ ...formFieldBaseProperties,
525
+ fieldType: { type: 'string', const: 'radio' },
526
+ options: formFieldOptionsSchema,
527
+ defaultSelected: { type: 'string', description: 'value of the pre-selected option.' },
528
+ },
529
+ required: ['type', 'fieldType', 'name', 'options'],
530
+ },
531
+ {
532
+ description: 'Dropdown / select list — exactly one option is selectable.',
533
+ properties: {
534
+ ...formFieldBaseProperties,
535
+ fieldType: { type: 'string', const: 'dropdown' },
536
+ options: formFieldOptionsSchema,
537
+ defaultSelected: { type: 'string', description: 'value of the pre-selected option.' },
538
+ },
539
+ required: ['type', 'fieldType', 'name', 'options'],
540
+ },
541
+ {
542
+ description: 'Clickable push-button (no value submitted).',
543
+ properties: {
544
+ ...formFieldBaseProperties,
545
+ fieldType: { type: 'string', const: 'button' },
546
+ },
547
+ required: ['type', 'fieldType', 'name'],
548
+ },
549
+ ],
498
550
  };
499
551
  const floatGroupSchema = {
500
552
  type: 'object',
@@ -548,7 +600,7 @@ export const pdfDocumentSchema = {
548
600
  type: 'array',
549
601
  description: 'Document content elements rendered top-to-bottom.',
550
602
  items: {
551
- anyOf: [
603
+ oneOf: [
552
604
  paragraphSchema,
553
605
  headingSchema,
554
606
  spacerSchema,
@@ -798,5 +850,12 @@ export const pdfDocumentSchema = {
798
850
  description: 'Restrict filesystem access to these absolute directory paths.',
799
851
  },
800
852
  },
853
+ // additionalProperties: false on the root object catches unknown top-level keys
854
+ // in AI-agent and MCP code-generation contexts, where an LLM might hallucinate
855
+ // a property that doesn't exist. Element schemas (content items) are intentionally
856
+ // not locked down here — they use runtime validation in validate/index.ts which
857
+ // produces precise per-property VALIDATION_ERROR messages for better DX than
858
+ // JSON Schema's generic "additional property" error.
859
+ additionalProperties: false,
801
860
  };
802
861
  //# sourceMappingURL=schema.js.map