doc-schema.js 4.0.0 → 4.2.0

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 (44) hide show
  1. package/README.md +95 -6
  2. package/dist/codec.d.cts +1 -1
  3. package/dist/codec.d.ts +1 -1
  4. package/dist/construct-D5pdDPqM.d.cts +204 -0
  5. package/dist/construct-D5pdDPqM.d.ts +204 -0
  6. package/dist/construct.cjs +106 -0
  7. package/dist/construct.d.cts +2 -0
  8. package/dist/construct.d.ts +2 -0
  9. package/dist/construct.js +93 -0
  10. package/dist/{content-eCPtLgjC.d.cts → content-B5VNueO_.d.cts} +97 -9
  11. package/dist/{content-D4gWnk94.d.ts → content-DPtA7fC1.d.ts} +97 -9
  12. package/dist/content-json-schema-defs.cjs +256 -4
  13. package/dist/content-json-schema-defs.js +256 -4
  14. package/dist/content.cjs +32 -0
  15. package/dist/content.d.cts +2 -2
  16. package/dist/content.d.ts +2 -2
  17. package/dist/content.js +28 -1
  18. package/dist/definitions.d.cts +1 -1
  19. package/dist/definitions.d.ts +1 -1
  20. package/dist/index.cjs +25 -0
  21. package/dist/index.d.cts +5 -4
  22. package/dist/index.d.ts +5 -4
  23. package/dist/index.js +4 -3
  24. package/dist/{math-BlG8Tjk-.d.cts → math-B7gZJeND.d.cts} +3 -3
  25. package/dist/{math-BlG8Tjk-.d.ts → math-B7gZJeND.d.ts} +3 -3
  26. package/dist/math.d.cts +1 -1
  27. package/dist/math.d.ts +1 -1
  28. package/dist/{package-node-DuEoTvZ9.d.ts → package-node-BGOvE4E_.d.ts} +25 -7
  29. package/dist/{package-node-j6AUkspU.d.cts → package-node-Cz-iiwsx.d.cts} +25 -7
  30. package/dist/package-node.cjs +32 -12
  31. package/dist/package-node.d.cts +2 -2
  32. package/dist/package-node.d.ts +2 -2
  33. package/dist/package-node.js +28 -14
  34. package/dist/package.cjs +4 -1
  35. package/dist/package.d.cts +52 -7
  36. package/dist/package.d.ts +52 -7
  37. package/dist/package.js +4 -1
  38. package/dist/schema-io.cjs +2 -2
  39. package/dist/schema-io.d.cts +1 -1
  40. package/dist/schema-io.d.ts +1 -1
  41. package/dist/schema-io.js +2 -2
  42. package/package.json +1 -1
  43. package/schemas/content-document.schema.json +399 -7
  44. package/schemas/document-package.schema.json +534 -7
@@ -1,4 +1,4 @@
1
- import { l as ContentDocument } from "./content-eCPtLgjC.cjs";
1
+ import { m as ContentDocument } from "./content-B5VNueO_.cjs";
2
2
  import { DocumentPackage } from "./package.cjs";
3
3
  //#region src/schema-io.d.ts
4
4
  type DocumentSchemaKind = 'DocumentPackage' | 'ContentDocument';
@@ -1,4 +1,4 @@
1
- import { l as ContentDocument } from "./content-D4gWnk94.js";
1
+ import { m as ContentDocument } from "./content-DPtA7fC1.js";
2
2
  import { DocumentPackage } from "./package.js";
3
3
  //#region src/schema-io.d.ts
4
4
  type DocumentSchemaKind = 'DocumentPackage' | 'ContentDocument';
package/dist/schema-io.js CHANGED
@@ -6,7 +6,7 @@ const SCHEMA_FILE_NAMES = {
6
6
  ContentDocument: "content-document.schema.json"
7
7
  };
8
8
  function schemaUriFor(kind) {
9
- return `https://cdn.jsdelivr.net/npm/document-schema.js@4.0.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
9
+ return `https://cdn.jsdelivr.net/npm/document-schema.js@4.2.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
10
10
  }
11
11
  const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@([^/]+)\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
12
12
  function parseSchemaUri(uri) {
@@ -92,7 +92,7 @@ function documentFromJson(value) {
92
92
  if (parts.stem === "layout-document") throw new LayoutSchemaDemotedError(value.$schema);
93
93
  const kind = kindForFileStem(parts.stem);
94
94
  if (kind === void 0) throw new UnrecognizedDocumentSchemaError(value.$schema);
95
- if (majorVersionOf(parts.version) !== majorVersionOf("4.0.0")) throw new SchemaVersionMismatchError(value.$schema, parts.version, "4.0.0");
95
+ if (majorVersionOf(parts.version) !== majorVersionOf("4.2.0")) throw new SchemaVersionMismatchError(value.$schema, parts.version, "4.2.0");
96
96
  switch (kind) {
97
97
  case "DocumentPackage": return {
98
98
  kind,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doc-schema.js",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "description": "The canonical, format-agnostic content and document-package schemas shared by ooxml.js, odf.js, documents.js, pdf-codec, and markdown-codec -- pure Zod schemas, no behaviour.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://cdn.jsdelivr.net/npm/document-schema.js@4.0.0/schemas/content-document.schema.json",
3
+ "$id": "https://cdn.jsdelivr.net/npm/document-schema.js@4.2.0/schemas/content-document.schema.json",
4
4
  "oneOf": [
5
5
  {
6
6
  "type": "object",
@@ -2857,7 +2857,7 @@
2857
2857
  ]
2858
2858
  },
2859
2859
  "document": {
2860
- "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@4.0.0/schemas/content-document.schema.json"
2860
+ "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@4.2.0/schemas/content-document.schema.json"
2861
2861
  },
2862
2862
  "frame": {
2863
2863
  "$ref": "#/$defs/Box"
@@ -2896,7 +2896,62 @@
2896
2896
  ],
2897
2897
  "additionalProperties": false
2898
2898
  },
2899
+ "ContentConstructStart": {
2900
+ "type": "object",
2901
+ "properties": {
2902
+ "kind": {
2903
+ "type": "string",
2904
+ "const": "constructStart"
2905
+ },
2906
+ "descriptor": {
2907
+ "$ref": "#/$defs/ConstructDescriptor"
2908
+ }
2909
+ },
2910
+ "required": [
2911
+ "kind",
2912
+ "descriptor"
2913
+ ],
2914
+ "additionalProperties": false
2915
+ },
2916
+ "ContentConstructEnd": {
2917
+ "type": "object",
2918
+ "properties": {
2919
+ "kind": {
2920
+ "type": "string",
2921
+ "const": "constructEnd"
2922
+ }
2923
+ },
2924
+ "required": [
2925
+ "kind"
2926
+ ],
2927
+ "additionalProperties": false
2928
+ },
2899
2929
  "ContentBlock": {
2930
+ "oneOf": [
2931
+ {
2932
+ "$ref": "#/$defs/ContentParagraph"
2933
+ },
2934
+ {
2935
+ "$ref": "#/$defs/ContentTable"
2936
+ },
2937
+ {
2938
+ "$ref": "#/$defs/ContentImageBlock"
2939
+ },
2940
+ {
2941
+ "$ref": "#/$defs/ContentPageBreak"
2942
+ },
2943
+ {
2944
+ "$ref": "#/$defs/ContentEmbeddedObjectBlock"
2945
+ },
2946
+ {
2947
+ "$ref": "#/$defs/ContentConstructStart"
2948
+ },
2949
+ {
2950
+ "$ref": "#/$defs/ContentConstructEnd"
2951
+ }
2952
+ ]
2953
+ },
2954
+ "PackageBlockLeaf": {
2900
2955
  "oneOf": [
2901
2956
  {
2902
2957
  "$ref": "#/$defs/ContentParagraph"
@@ -4077,7 +4132,7 @@
4077
4132
  ]
4078
4133
  },
4079
4134
  "document": {
4080
- "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@4.0.0/schemas/content-document.schema.json"
4135
+ "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@4.2.0/schemas/content-document.schema.json"
4081
4136
  },
4082
4137
  "frame": {
4083
4138
  "$ref": "#/$defs/Box"
@@ -4126,7 +4181,10 @@
4126
4181
  "$ref": "#/$defs/ListGroup"
4127
4182
  },
4128
4183
  {
4129
- "$ref": "#/$defs/ContentBlock"
4184
+ "$ref": "#/$defs/SectionConstructGroup"
4185
+ },
4186
+ {
4187
+ "$ref": "#/$defs/PackageBlockLeaf"
4130
4188
  }
4131
4189
  ]
4132
4190
  }
@@ -4158,7 +4216,10 @@
4158
4216
  "$ref": "#/$defs/ListGroup"
4159
4217
  },
4160
4218
  {
4161
- "$ref": "#/$defs/ContentBlock"
4219
+ "$ref": "#/$defs/SectionConstructGroup"
4220
+ },
4221
+ {
4222
+ "$ref": "#/$defs/PackageBlockLeaf"
4162
4223
  }
4163
4224
  ]
4164
4225
  }
@@ -4187,7 +4248,10 @@
4187
4248
  "$ref": "#/$defs/ListGroup"
4188
4249
  },
4189
4250
  {
4190
- "$ref": "#/$defs/ContentBlock"
4251
+ "$ref": "#/$defs/ShapeConstructGroup"
4252
+ },
4253
+ {
4254
+ "$ref": "#/$defs/PackageBlockLeaf"
4191
4255
  }
4192
4256
  ]
4193
4257
  }
@@ -4238,7 +4302,10 @@
4238
4302
  "$ref": "#/$defs/ListGroup"
4239
4303
  },
4240
4304
  {
4241
- "$ref": "#/$defs/ContentBlock"
4305
+ "$ref": "#/$defs/ShapeConstructGroup"
4306
+ },
4307
+ {
4308
+ "$ref": "#/$defs/PackageBlockLeaf"
4242
4309
  }
4243
4310
  ]
4244
4311
  }
@@ -4308,6 +4375,331 @@
4308
4375
  ],
4309
4376
  "additionalProperties": false
4310
4377
  },
4378
+ "SectionConstructGroup": {
4379
+ "type": "object",
4380
+ "properties": {
4381
+ "node": {
4382
+ "$ref": "#/$defs/ConstructDescriptor"
4383
+ },
4384
+ "style": {
4385
+ "type": "string"
4386
+ },
4387
+ "children": {
4388
+ "type": "array",
4389
+ "items": {
4390
+ "oneOf": [
4391
+ {
4392
+ "$ref": "#/$defs/HeadingGroup"
4393
+ },
4394
+ {
4395
+ "$ref": "#/$defs/ListGroup"
4396
+ },
4397
+ {
4398
+ "$ref": "#/$defs/SectionConstructGroup"
4399
+ },
4400
+ {
4401
+ "$ref": "#/$defs/PackageBlockLeaf"
4402
+ }
4403
+ ]
4404
+ }
4405
+ }
4406
+ },
4407
+ "required": [
4408
+ "node",
4409
+ "children"
4410
+ ],
4411
+ "additionalProperties": false
4412
+ },
4413
+ "ShapeConstructGroup": {
4414
+ "type": "object",
4415
+ "properties": {
4416
+ "node": {
4417
+ "$ref": "#/$defs/ConstructDescriptor"
4418
+ },
4419
+ "style": {
4420
+ "type": "string"
4421
+ },
4422
+ "children": {
4423
+ "type": "array",
4424
+ "items": {
4425
+ "oneOf": [
4426
+ {
4427
+ "$ref": "#/$defs/ListGroup"
4428
+ },
4429
+ {
4430
+ "$ref": "#/$defs/ShapeConstructGroup"
4431
+ },
4432
+ {
4433
+ "$ref": "#/$defs/PackageBlockLeaf"
4434
+ }
4435
+ ]
4436
+ }
4437
+ }
4438
+ },
4439
+ "required": [
4440
+ "node",
4441
+ "children"
4442
+ ],
4443
+ "additionalProperties": false
4444
+ },
4445
+ "ContentControlDescriptor": {
4446
+ "type": "object",
4447
+ "properties": {
4448
+ "kind": {
4449
+ "type": "string",
4450
+ "const": "contentControl"
4451
+ },
4452
+ "controlType": {
4453
+ "type": "string",
4454
+ "enum": [
4455
+ "richText",
4456
+ "plainText",
4457
+ "checkbox",
4458
+ "dropDown",
4459
+ "comboBox",
4460
+ "date",
4461
+ "picture",
4462
+ "repeatingSection",
4463
+ "button",
4464
+ "index",
4465
+ "group"
4466
+ ]
4467
+ },
4468
+ "tag": {
4469
+ "type": "string"
4470
+ },
4471
+ "alias": {
4472
+ "type": "string"
4473
+ },
4474
+ "lock": {
4475
+ "type": "string",
4476
+ "enum": [
4477
+ "content",
4478
+ "container",
4479
+ "both"
4480
+ ]
4481
+ },
4482
+ "value": {
4483
+ "type": "string"
4484
+ },
4485
+ "checked": {
4486
+ "type": "boolean"
4487
+ },
4488
+ "options": {
4489
+ "type": "array",
4490
+ "items": {
4491
+ "type": "string"
4492
+ }
4493
+ }
4494
+ },
4495
+ "required": [
4496
+ "kind",
4497
+ "controlType"
4498
+ ],
4499
+ "additionalProperties": false
4500
+ },
4501
+ "FieldDescriptor": {
4502
+ "type": "object",
4503
+ "properties": {
4504
+ "kind": {
4505
+ "type": "string",
4506
+ "const": "field"
4507
+ },
4508
+ "instruction": {
4509
+ "type": "string"
4510
+ },
4511
+ "cachedResult": {
4512
+ "type": "string"
4513
+ }
4514
+ },
4515
+ "required": [
4516
+ "kind",
4517
+ "instruction"
4518
+ ],
4519
+ "additionalProperties": false
4520
+ },
4521
+ "AnchorDescriptor": {
4522
+ "type": "object",
4523
+ "properties": {
4524
+ "kind": {
4525
+ "type": "string",
4526
+ "const": "anchor"
4527
+ },
4528
+ "anchorType": {
4529
+ "type": "string",
4530
+ "enum": [
4531
+ "bookmark",
4532
+ "footnote",
4533
+ "endnote",
4534
+ "comment"
4535
+ ]
4536
+ },
4537
+ "name": {
4538
+ "type": "string"
4539
+ },
4540
+ "definition": {
4541
+ "type": "string"
4542
+ }
4543
+ },
4544
+ "required": [
4545
+ "kind",
4546
+ "anchorType",
4547
+ "name"
4548
+ ],
4549
+ "additionalProperties": false
4550
+ },
4551
+ "LinkTarget": {
4552
+ "oneOf": [
4553
+ {
4554
+ "type": "object",
4555
+ "properties": {
4556
+ "kind": {
4557
+ "type": "string",
4558
+ "const": "external"
4559
+ },
4560
+ "uri": {
4561
+ "type": "string"
4562
+ }
4563
+ },
4564
+ "required": [
4565
+ "kind",
4566
+ "uri"
4567
+ ],
4568
+ "additionalProperties": false
4569
+ },
4570
+ {
4571
+ "type": "object",
4572
+ "properties": {
4573
+ "kind": {
4574
+ "type": "string",
4575
+ "const": "internal"
4576
+ },
4577
+ "anchor": {
4578
+ "type": "string"
4579
+ }
4580
+ },
4581
+ "required": [
4582
+ "kind",
4583
+ "anchor"
4584
+ ],
4585
+ "additionalProperties": false
4586
+ }
4587
+ ]
4588
+ },
4589
+ "LinkDescriptor": {
4590
+ "type": "object",
4591
+ "properties": {
4592
+ "kind": {
4593
+ "type": "string",
4594
+ "const": "link"
4595
+ },
4596
+ "target": {
4597
+ "$ref": "#/$defs/LinkTarget"
4598
+ },
4599
+ "title": {
4600
+ "type": "string"
4601
+ }
4602
+ },
4603
+ "required": [
4604
+ "kind",
4605
+ "target"
4606
+ ],
4607
+ "additionalProperties": false
4608
+ },
4609
+ "ProvenanceDescriptor": {
4610
+ "type": "object",
4611
+ "properties": {
4612
+ "kind": {
4613
+ "type": "string",
4614
+ "const": "provenance"
4615
+ },
4616
+ "change": {
4617
+ "type": "string",
4618
+ "enum": [
4619
+ "insertion",
4620
+ "deletion",
4621
+ "moveFrom",
4622
+ "moveTo",
4623
+ "formatChange"
4624
+ ]
4625
+ },
4626
+ "author": {
4627
+ "type": "string"
4628
+ },
4629
+ "dateIso": {
4630
+ "type": "string"
4631
+ }
4632
+ },
4633
+ "required": [
4634
+ "kind",
4635
+ "change"
4636
+ ],
4637
+ "additionalProperties": false
4638
+ },
4639
+ "DivisionSource": {
4640
+ "type": "object",
4641
+ "properties": {
4642
+ "href": {
4643
+ "type": "string"
4644
+ },
4645
+ "sectionName": {
4646
+ "type": "string"
4647
+ }
4648
+ },
4649
+ "required": [
4650
+ "href"
4651
+ ],
4652
+ "additionalProperties": false
4653
+ },
4654
+ "DivisionDescriptor": {
4655
+ "type": "object",
4656
+ "properties": {
4657
+ "kind": {
4658
+ "type": "string",
4659
+ "const": "division"
4660
+ },
4661
+ "name": {
4662
+ "type": "string"
4663
+ },
4664
+ "columnCount": {
4665
+ "type": "integer",
4666
+ "exclusiveMinimum": 0,
4667
+ "maximum": 9007199254740991
4668
+ },
4669
+ "protected": {
4670
+ "type": "boolean"
4671
+ },
4672
+ "source": {
4673
+ "$ref": "#/$defs/DivisionSource"
4674
+ }
4675
+ },
4676
+ "required": [
4677
+ "kind"
4678
+ ],
4679
+ "additionalProperties": false
4680
+ },
4681
+ "ConstructDescriptor": {
4682
+ "oneOf": [
4683
+ {
4684
+ "$ref": "#/$defs/ContentControlDescriptor"
4685
+ },
4686
+ {
4687
+ "$ref": "#/$defs/FieldDescriptor"
4688
+ },
4689
+ {
4690
+ "$ref": "#/$defs/AnchorDescriptor"
4691
+ },
4692
+ {
4693
+ "$ref": "#/$defs/LinkDescriptor"
4694
+ },
4695
+ {
4696
+ "$ref": "#/$defs/ProvenanceDescriptor"
4697
+ },
4698
+ {
4699
+ "$ref": "#/$defs/DivisionDescriptor"
4700
+ }
4701
+ ]
4702
+ },
4311
4703
  "StyleParagraphProperties": {
4312
4704
  "type": "object",
4313
4705
  "properties": {