document-model.js 3.0.0 → 3.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.
package/dist/package.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { d as MathMlNode } from "./mathml-B1oTCtzc.js";
2
+ import { s as MathExpression } from "./math-B7gZJeND.js";
2
3
  import { ContentBlock, ContentEmbeddedObject } from "./content.js";
3
4
  import { z } from "zod";
4
5
  //#region src/package.d.ts
@@ -6,18 +7,6 @@ declare const DOCUMENT_PACKAGE_FORMAT_VERSION = 2;
6
7
  declare const DocumentPackageSchema: z.ZodObject<{
7
8
  formatVersion: z.ZodLiteral<2>;
8
9
  content: z.ZodDiscriminatedUnion<[z.ZodObject<{
9
- kind: z.ZodLiteral<"wordprocessing">;
10
- formatVersion: z.ZodLiteral<3>;
11
- metadata: z.ZodObject<{
12
- title: z.ZodOptional<z.ZodString>;
13
- author: z.ZodOptional<z.ZodString>;
14
- subject: z.ZodOptional<z.ZodString>;
15
- keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
- creator: z.ZodOptional<z.ZodString>;
17
- producer: z.ZodOptional<z.ZodString>;
18
- createdIso: z.ZodOptional<z.ZodString>;
19
- modifiedIso: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strip>;
21
10
  sections: z.ZodArray<z.ZodObject<{
22
11
  pageSize: z.ZodObject<{
23
12
  widthPt: z.ZodNumber;
@@ -31,8 +20,50 @@ declare const DocumentPackageSchema: z.ZodObject<{
31
20
  }, z.core.$strip>;
32
21
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
33
22
  }, z.core.$strip>>;
34
- }, z.core.$strip>, z.ZodObject<{
35
- kind: z.ZodLiteral<"presentation">;
23
+ symbolTable: z.ZodOptional<z.ZodObject<{
24
+ symbols: z.ZodArray<z.ZodObject<{
25
+ glyph: z.ZodString;
26
+ scope: z.ZodString;
27
+ id: z.ZodString;
28
+ quantityKind: z.ZodOptional<z.ZodString>;
29
+ preferredUnit: z.ZodOptional<z.ZodString>;
30
+ definitionSource: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>;
32
+ units: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodString;
34
+ symbol: z.ZodString;
35
+ name: z.ZodOptional<z.ZodString>;
36
+ dimension: z.ZodRecord<z.ZodEnum<{
37
+ time: "time";
38
+ length: "length";
39
+ mass: "mass";
40
+ electricCurrent: "electricCurrent";
41
+ thermodynamicTemperature: "thermodynamicTemperature";
42
+ amountOfSubstance: "amountOfSubstance";
43
+ luminousIntensity: "luminousIntensity";
44
+ }> & z.core.$partial, z.ZodNumber>;
45
+ factorToSi: z.ZodObject<{
46
+ numerator: z.ZodString;
47
+ denominator: z.ZodString;
48
+ }, z.core.$strip>;
49
+ offsetToSi: z.ZodOptional<z.ZodObject<{
50
+ numerator: z.ZodString;
51
+ denominator: z.ZodString;
52
+ }, z.core.$strip>>;
53
+ context: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>>;
55
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ bases: z.ZodArray<z.ZodObject<{
58
+ unit: z.ZodString;
59
+ value: z.ZodObject<{
60
+ numerator: z.ZodString;
61
+ denominator: z.ZodString;
62
+ }, z.core.$strip>;
63
+ }, z.core.$strip>>;
64
+ }, z.core.$strip>>>;
65
+ }, z.core.$strip>>;
66
+ kind: z.ZodLiteral<"wordprocessing">;
36
67
  formatVersion: z.ZodLiteral<3>;
37
68
  metadata: z.ZodObject<{
38
69
  title: z.ZodOptional<z.ZodString>;
@@ -44,6 +75,7 @@ declare const DocumentPackageSchema: z.ZodObject<{
44
75
  createdIso: z.ZodOptional<z.ZodString>;
45
76
  modifiedIso: z.ZodOptional<z.ZodString>;
46
77
  }, z.core.$strip>;
78
+ }, z.core.$strip>, z.ZodObject<{
47
79
  slides: z.ZodArray<z.ZodObject<{
48
80
  size: z.ZodObject<{
49
81
  widthPt: z.ZodNumber;
@@ -77,8 +109,50 @@ declare const DocumentPackageSchema: z.ZodObject<{
77
109
  }, z.core.$strip>>;
78
110
  notes: z.ZodString;
79
111
  }, z.core.$strip>>;
80
- }, z.core.$strip>, z.ZodObject<{
81
- kind: z.ZodLiteral<"spreadsheet">;
112
+ symbolTable: z.ZodOptional<z.ZodObject<{
113
+ symbols: z.ZodArray<z.ZodObject<{
114
+ glyph: z.ZodString;
115
+ scope: z.ZodString;
116
+ id: z.ZodString;
117
+ quantityKind: z.ZodOptional<z.ZodString>;
118
+ preferredUnit: z.ZodOptional<z.ZodString>;
119
+ definitionSource: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>>;
121
+ units: z.ZodArray<z.ZodObject<{
122
+ id: z.ZodString;
123
+ symbol: z.ZodString;
124
+ name: z.ZodOptional<z.ZodString>;
125
+ dimension: z.ZodRecord<z.ZodEnum<{
126
+ time: "time";
127
+ length: "length";
128
+ mass: "mass";
129
+ electricCurrent: "electricCurrent";
130
+ thermodynamicTemperature: "thermodynamicTemperature";
131
+ amountOfSubstance: "amountOfSubstance";
132
+ luminousIntensity: "luminousIntensity";
133
+ }> & z.core.$partial, z.ZodNumber>;
134
+ factorToSi: z.ZodObject<{
135
+ numerator: z.ZodString;
136
+ denominator: z.ZodString;
137
+ }, z.core.$strip>;
138
+ offsetToSi: z.ZodOptional<z.ZodObject<{
139
+ numerator: z.ZodString;
140
+ denominator: z.ZodString;
141
+ }, z.core.$strip>>;
142
+ context: z.ZodOptional<z.ZodString>;
143
+ }, z.core.$strip>>;
144
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
145
+ id: z.ZodString;
146
+ bases: z.ZodArray<z.ZodObject<{
147
+ unit: z.ZodString;
148
+ value: z.ZodObject<{
149
+ numerator: z.ZodString;
150
+ denominator: z.ZodString;
151
+ }, z.core.$strip>;
152
+ }, z.core.$strip>>;
153
+ }, z.core.$strip>>>;
154
+ }, z.core.$strip>>;
155
+ kind: z.ZodLiteral<"presentation">;
82
156
  formatVersion: z.ZodLiteral<3>;
83
157
  metadata: z.ZodObject<{
84
158
  title: z.ZodOptional<z.ZodString>;
@@ -90,6 +164,7 @@ declare const DocumentPackageSchema: z.ZodObject<{
90
164
  createdIso: z.ZodOptional<z.ZodString>;
91
165
  modifiedIso: z.ZodOptional<z.ZodString>;
92
166
  }, z.core.$strip>;
167
+ }, z.core.$strip>, z.ZodObject<{
93
168
  sheets: z.ZodArray<z.ZodObject<{
94
169
  name: z.ZodString;
95
170
  cells: z.ZodArray<z.ZodObject<{
@@ -230,6 +305,15 @@ declare const DocumentPackageSchema: z.ZodObject<{
230
305
  bottom: "bottom";
231
306
  middle: "middle";
232
307
  }>>;
308
+ comment: z.ZodOptional<z.ZodObject<{
309
+ text: z.ZodString;
310
+ author: z.ZodOptional<z.ZodString>;
311
+ createdAt: z.ZodOptional<z.ZodString>;
312
+ replies: z.ZodOptional<z.ZodArray<z.ZodObject<{
313
+ text: z.ZodString;
314
+ author: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strip>>>;
316
+ }, z.core.$strip>>;
233
317
  sourcePath: z.ZodOptional<z.ZodString>;
234
318
  frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
235
319
  pageIndex: z.ZodNumber;
@@ -315,8 +399,50 @@ declare const DocumentPackageSchema: z.ZodObject<{
315
399
  }, z.core.$strip>;
316
400
  embeddedObjects: z.ZodOptional<z.ZodArray<z.ZodCustom<ContentEmbeddedObject, ContentEmbeddedObject>>>;
317
401
  }, z.core.$strip>>;
318
- }, z.core.$strip>, z.ZodObject<{
319
- kind: z.ZodLiteral<"drawing">;
402
+ symbolTable: z.ZodOptional<z.ZodObject<{
403
+ symbols: z.ZodArray<z.ZodObject<{
404
+ glyph: z.ZodString;
405
+ scope: z.ZodString;
406
+ id: z.ZodString;
407
+ quantityKind: z.ZodOptional<z.ZodString>;
408
+ preferredUnit: z.ZodOptional<z.ZodString>;
409
+ definitionSource: z.ZodOptional<z.ZodString>;
410
+ }, z.core.$strip>>;
411
+ units: z.ZodArray<z.ZodObject<{
412
+ id: z.ZodString;
413
+ symbol: z.ZodString;
414
+ name: z.ZodOptional<z.ZodString>;
415
+ dimension: z.ZodRecord<z.ZodEnum<{
416
+ time: "time";
417
+ length: "length";
418
+ mass: "mass";
419
+ electricCurrent: "electricCurrent";
420
+ thermodynamicTemperature: "thermodynamicTemperature";
421
+ amountOfSubstance: "amountOfSubstance";
422
+ luminousIntensity: "luminousIntensity";
423
+ }> & z.core.$partial, z.ZodNumber>;
424
+ factorToSi: z.ZodObject<{
425
+ numerator: z.ZodString;
426
+ denominator: z.ZodString;
427
+ }, z.core.$strip>;
428
+ offsetToSi: z.ZodOptional<z.ZodObject<{
429
+ numerator: z.ZodString;
430
+ denominator: z.ZodString;
431
+ }, z.core.$strip>>;
432
+ context: z.ZodOptional<z.ZodString>;
433
+ }, z.core.$strip>>;
434
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
435
+ id: z.ZodString;
436
+ bases: z.ZodArray<z.ZodObject<{
437
+ unit: z.ZodString;
438
+ value: z.ZodObject<{
439
+ numerator: z.ZodString;
440
+ denominator: z.ZodString;
441
+ }, z.core.$strip>;
442
+ }, z.core.$strip>>;
443
+ }, z.core.$strip>>>;
444
+ }, z.core.$strip>>;
445
+ kind: z.ZodLiteral<"spreadsheet">;
320
446
  formatVersion: z.ZodLiteral<3>;
321
447
  metadata: z.ZodObject<{
322
448
  title: z.ZodOptional<z.ZodString>;
@@ -328,6 +454,7 @@ declare const DocumentPackageSchema: z.ZodObject<{
328
454
  createdIso: z.ZodOptional<z.ZodString>;
329
455
  modifiedIso: z.ZodOptional<z.ZodString>;
330
456
  }, z.core.$strip>;
457
+ }, z.core.$strip>, z.ZodObject<{
331
458
  pages: z.ZodArray<z.ZodObject<{
332
459
  size: z.ZodObject<{
333
460
  widthPt: z.ZodNumber;
@@ -537,8 +664,50 @@ declare const DocumentPackageSchema: z.ZodObject<{
537
664
  }, z.core.$strip>>>;
538
665
  }, z.core.$strip>], "kind">>;
539
666
  }, z.core.$strip>>;
540
- }, z.core.$strip>, z.ZodObject<{
541
- kind: z.ZodLiteral<"formula">;
667
+ symbolTable: z.ZodOptional<z.ZodObject<{
668
+ symbols: z.ZodArray<z.ZodObject<{
669
+ glyph: z.ZodString;
670
+ scope: z.ZodString;
671
+ id: z.ZodString;
672
+ quantityKind: z.ZodOptional<z.ZodString>;
673
+ preferredUnit: z.ZodOptional<z.ZodString>;
674
+ definitionSource: z.ZodOptional<z.ZodString>;
675
+ }, z.core.$strip>>;
676
+ units: z.ZodArray<z.ZodObject<{
677
+ id: z.ZodString;
678
+ symbol: z.ZodString;
679
+ name: z.ZodOptional<z.ZodString>;
680
+ dimension: z.ZodRecord<z.ZodEnum<{
681
+ time: "time";
682
+ length: "length";
683
+ mass: "mass";
684
+ electricCurrent: "electricCurrent";
685
+ thermodynamicTemperature: "thermodynamicTemperature";
686
+ amountOfSubstance: "amountOfSubstance";
687
+ luminousIntensity: "luminousIntensity";
688
+ }> & z.core.$partial, z.ZodNumber>;
689
+ factorToSi: z.ZodObject<{
690
+ numerator: z.ZodString;
691
+ denominator: z.ZodString;
692
+ }, z.core.$strip>;
693
+ offsetToSi: z.ZodOptional<z.ZodObject<{
694
+ numerator: z.ZodString;
695
+ denominator: z.ZodString;
696
+ }, z.core.$strip>>;
697
+ context: z.ZodOptional<z.ZodString>;
698
+ }, z.core.$strip>>;
699
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
700
+ id: z.ZodString;
701
+ bases: z.ZodArray<z.ZodObject<{
702
+ unit: z.ZodString;
703
+ value: z.ZodObject<{
704
+ numerator: z.ZodString;
705
+ denominator: z.ZodString;
706
+ }, z.core.$strip>;
707
+ }, z.core.$strip>>;
708
+ }, z.core.$strip>>>;
709
+ }, z.core.$strip>>;
710
+ kind: z.ZodLiteral<"drawing">;
542
711
  formatVersion: z.ZodLiteral<3>;
543
712
  metadata: z.ZodObject<{
544
713
  title: z.ZodOptional<z.ZodString>;
@@ -550,9 +719,74 @@ declare const DocumentPackageSchema: z.ZodObject<{
550
719
  createdIso: z.ZodOptional<z.ZodString>;
551
720
  modifiedIso: z.ZodOptional<z.ZodString>;
552
721
  }, z.core.$strip>;
722
+ }, z.core.$strip>, z.ZodObject<{
553
723
  formula: z.ZodObject<{
554
724
  mathml: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
555
725
  starMath: z.ZodOptional<z.ZodString>;
726
+ presentation: z.ZodOptional<z.ZodObject<{
727
+ latex: z.ZodString;
728
+ }, z.core.$strip>>;
729
+ content: z.ZodOptional<z.ZodCustom<MathExpression, MathExpression>>;
730
+ provenance: z.ZodOptional<z.ZodObject<{
731
+ source: z.ZodString;
732
+ pageRef: z.ZodOptional<z.ZodString>;
733
+ editTrail: z.ZodArray<z.ZodString>;
734
+ }, z.core.$strip>>;
735
+ }, z.core.$strip>;
736
+ symbolTable: z.ZodOptional<z.ZodObject<{
737
+ symbols: z.ZodArray<z.ZodObject<{
738
+ glyph: z.ZodString;
739
+ scope: z.ZodString;
740
+ id: z.ZodString;
741
+ quantityKind: z.ZodOptional<z.ZodString>;
742
+ preferredUnit: z.ZodOptional<z.ZodString>;
743
+ definitionSource: z.ZodOptional<z.ZodString>;
744
+ }, z.core.$strip>>;
745
+ units: z.ZodArray<z.ZodObject<{
746
+ id: z.ZodString;
747
+ symbol: z.ZodString;
748
+ name: z.ZodOptional<z.ZodString>;
749
+ dimension: z.ZodRecord<z.ZodEnum<{
750
+ time: "time";
751
+ length: "length";
752
+ mass: "mass";
753
+ electricCurrent: "electricCurrent";
754
+ thermodynamicTemperature: "thermodynamicTemperature";
755
+ amountOfSubstance: "amountOfSubstance";
756
+ luminousIntensity: "luminousIntensity";
757
+ }> & z.core.$partial, z.ZodNumber>;
758
+ factorToSi: z.ZodObject<{
759
+ numerator: z.ZodString;
760
+ denominator: z.ZodString;
761
+ }, z.core.$strip>;
762
+ offsetToSi: z.ZodOptional<z.ZodObject<{
763
+ numerator: z.ZodString;
764
+ denominator: z.ZodString;
765
+ }, z.core.$strip>>;
766
+ context: z.ZodOptional<z.ZodString>;
767
+ }, z.core.$strip>>;
768
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
769
+ id: z.ZodString;
770
+ bases: z.ZodArray<z.ZodObject<{
771
+ unit: z.ZodString;
772
+ value: z.ZodObject<{
773
+ numerator: z.ZodString;
774
+ denominator: z.ZodString;
775
+ }, z.core.$strip>;
776
+ }, z.core.$strip>>;
777
+ }, z.core.$strip>>>;
778
+ }, z.core.$strip>>;
779
+ kind: z.ZodLiteral<"formula">;
780
+ formatVersion: z.ZodLiteral<3>;
781
+ metadata: z.ZodObject<{
782
+ title: z.ZodOptional<z.ZodString>;
783
+ author: z.ZodOptional<z.ZodString>;
784
+ subject: z.ZodOptional<z.ZodString>;
785
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
786
+ creator: z.ZodOptional<z.ZodString>;
787
+ producer: z.ZodOptional<z.ZodString>;
788
+ createdIso: z.ZodOptional<z.ZodString>;
789
+ modifiedIso: z.ZodOptional<z.ZodString>;
556
790
  }, z.core.$strip>;
557
791
  }, z.core.$strip>], "kind">;
558
792
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -9,7 +9,7 @@ const SCHEMA_FILE_NAMES = {
9
9
  LayoutDocument: "layout-document.schema.json"
10
10
  };
11
11
  function schemaUriFor(kind) {
12
- return `https://cdn.jsdelivr.net/npm/document-schema.js@3.0.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
12
+ return `https://cdn.jsdelivr.net/npm/document-schema.js@3.2.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
13
13
  }
14
14
  const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@[^/]+\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
15
15
  function kindForFileStem(stem) {
package/dist/schema-io.js CHANGED
@@ -8,7 +8,7 @@ const SCHEMA_FILE_NAMES = {
8
8
  LayoutDocument: "layout-document.schema.json"
9
9
  };
10
10
  function schemaUriFor(kind) {
11
- return `https://cdn.jsdelivr.net/npm/document-schema.js@3.0.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
11
+ return `https://cdn.jsdelivr.net/npm/document-schema.js@3.2.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
12
12
  }
13
13
  const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@[^/]+\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
14
14
  function kindForFileStem(stem) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-model.js",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "The canonical, format-agnostic content and layout schemas shared by ooxml.js, odf.js, and documents.js -- pure Zod schemas, no behaviour.",
5
5
  "type": "module",
6
6
  "repository": {