document-schema 3.1.0 → 3.3.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/content.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_color = require("./color.cjs");
3
+ const require_math = require("./math.cjs");
3
4
  const require_geometry = require("./geometry.cjs");
4
5
  const require_mathml = require("./mathml.cjs");
5
6
  const require_metadata = require("./metadata.cjs");
@@ -20,7 +21,7 @@ const ContentRunSchema = zod.z.object({
20
21
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
21
22
  });
22
23
  const ContentListMembershipSchema = zod.z.object({
23
- numId: zod.z.string(),
24
+ numId: zod.z.string().optional(),
24
25
  level: zod.z.number().int().nonnegative()
25
26
  });
26
27
  const ContentParagraphSchema = zod.z.object({
@@ -353,38 +354,47 @@ const ContentDrawPageSchema = zod.z.object({
353
354
  });
354
355
  const ContentFormulaSchema = zod.z.object({
355
356
  mathml: zod.z.array(require_mathml.MathMlNodeSchema),
356
- starMath: zod.z.string().optional()
357
+ starMath: zod.z.string().optional(),
358
+ presentation: require_math.MathPresentationSchema.optional(),
359
+ content: require_math.MathExpressionSchema.optional(),
360
+ provenance: require_math.MathProvenanceSchema.optional()
357
361
  });
358
362
  const CONTENT_FORMAT_VERSION = 3;
363
+ const contentDocumentSharedFields = { symbolTable: require_math.SymbolTableSchema.optional() };
359
364
  const ContentDocumentSchema = zod.z.discriminatedUnion("kind", [
360
365
  zod.z.object({
361
366
  kind: zod.z.literal("wordprocessing"),
362
367
  formatVersion: zod.z.literal(3),
363
368
  metadata: require_metadata.LayoutMetadataSchema,
369
+ ...contentDocumentSharedFields,
364
370
  sections: zod.z.array(ContentSectionSchema)
365
371
  }),
366
372
  zod.z.object({
367
373
  kind: zod.z.literal("presentation"),
368
374
  formatVersion: zod.z.literal(3),
369
375
  metadata: require_metadata.LayoutMetadataSchema,
376
+ ...contentDocumentSharedFields,
370
377
  slides: zod.z.array(ContentSlideSchema)
371
378
  }),
372
379
  zod.z.object({
373
380
  kind: zod.z.literal("spreadsheet"),
374
381
  formatVersion: zod.z.literal(3),
375
382
  metadata: require_metadata.LayoutMetadataSchema,
383
+ ...contentDocumentSharedFields,
376
384
  sheets: zod.z.array(ContentSheetSchema)
377
385
  }),
378
386
  zod.z.object({
379
387
  kind: zod.z.literal("drawing"),
380
388
  formatVersion: zod.z.literal(3),
381
389
  metadata: require_metadata.LayoutMetadataSchema,
390
+ ...contentDocumentSharedFields,
382
391
  pages: zod.z.array(ContentDrawPageSchema)
383
392
  }),
384
393
  zod.z.object({
385
394
  kind: zod.z.literal("formula"),
386
395
  formatVersion: zod.z.literal(3),
387
396
  metadata: require_metadata.LayoutMetadataSchema,
397
+ ...contentDocumentSharedFields,
388
398
  formula: ContentFormulaSchema
389
399
  })
390
400
  ]);
@@ -1,4 +1,5 @@
1
1
  import { d as MathMlNode } from "./mathml-B1oTCtzc.cjs";
2
+ import { s as MathExpression } from "./math-B7gZJeND.cjs";
2
3
  import { n as Color } from "./color-AELCDH_b.cjs";
3
4
  import { r as LayoutFrame, t as Box } from "./geometry-CvcjSwnA.cjs";
4
5
  import { z } from "zod";
@@ -31,7 +32,7 @@ declare const ContentRunSchema: z.ZodObject<{
31
32
  }, z.core.$strip>;
32
33
  type ContentRun = z.infer<typeof ContentRunSchema>;
33
34
  declare const ContentListMembershipSchema: z.ZodObject<{
34
- numId: z.ZodString;
35
+ numId: z.ZodOptional<z.ZodString>;
35
36
  level: z.ZodNumber;
36
37
  }, z.core.$strip>;
37
38
  type ContentListMembership = z.infer<typeof ContentListMembershipSchema>;
@@ -69,7 +70,7 @@ declare const ContentParagraphSchema: z.ZodObject<{
69
70
  justify: "justify";
70
71
  }>>;
71
72
  list: z.ZodOptional<z.ZodObject<{
72
- numId: z.ZodString;
73
+ numId: z.ZodOptional<z.ZodString>;
73
74
  level: z.ZodNumber;
74
75
  }, z.core.$strip>>;
75
76
  spacingBeforePt: z.ZodOptional<z.ZodNumber>;
@@ -1553,22 +1554,19 @@ type ContentDrawPage = z.infer<typeof ContentDrawPageSchema>;
1553
1554
  declare const ContentFormulaSchema: z.ZodObject<{
1554
1555
  mathml: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
1555
1556
  starMath: z.ZodOptional<z.ZodString>;
1557
+ presentation: z.ZodOptional<z.ZodObject<{
1558
+ latex: z.ZodString;
1559
+ }, z.core.$strip>>;
1560
+ content: z.ZodOptional<z.ZodCustom<MathExpression, MathExpression>>;
1561
+ provenance: z.ZodOptional<z.ZodObject<{
1562
+ source: z.ZodString;
1563
+ pageRef: z.ZodOptional<z.ZodString>;
1564
+ editTrail: z.ZodArray<z.ZodString>;
1565
+ }, z.core.$strip>>;
1556
1566
  }, z.core.$strip>;
1557
1567
  type ContentFormula = z.infer<typeof ContentFormulaSchema>;
1558
1568
  declare const CONTENT_FORMAT_VERSION = 3;
1559
1569
  declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1560
- kind: z.ZodLiteral<"wordprocessing">;
1561
- formatVersion: z.ZodLiteral<3>;
1562
- metadata: z.ZodObject<{
1563
- title: z.ZodOptional<z.ZodString>;
1564
- author: z.ZodOptional<z.ZodString>;
1565
- subject: z.ZodOptional<z.ZodString>;
1566
- keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
1567
- creator: z.ZodOptional<z.ZodString>;
1568
- producer: z.ZodOptional<z.ZodString>;
1569
- createdIso: z.ZodOptional<z.ZodString>;
1570
- modifiedIso: z.ZodOptional<z.ZodString>;
1571
- }, z.core.$strip>;
1572
1570
  sections: z.ZodArray<z.ZodObject<{
1573
1571
  pageSize: z.ZodObject<{
1574
1572
  widthPt: z.ZodNumber;
@@ -1582,8 +1580,50 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1582
1580
  }, z.core.$strip>;
1583
1581
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
1584
1582
  }, z.core.$strip>>;
1585
- }, z.core.$strip>, z.ZodObject<{
1586
- kind: z.ZodLiteral<"presentation">;
1583
+ symbolTable: z.ZodOptional<z.ZodObject<{
1584
+ symbols: z.ZodArray<z.ZodObject<{
1585
+ glyph: z.ZodString;
1586
+ scope: z.ZodString;
1587
+ id: z.ZodString;
1588
+ quantityKind: z.ZodOptional<z.ZodString>;
1589
+ preferredUnit: z.ZodOptional<z.ZodString>;
1590
+ definitionSource: z.ZodOptional<z.ZodString>;
1591
+ }, z.core.$strip>>;
1592
+ units: z.ZodArray<z.ZodObject<{
1593
+ id: z.ZodString;
1594
+ symbol: z.ZodString;
1595
+ name: z.ZodOptional<z.ZodString>;
1596
+ dimension: z.ZodRecord<z.ZodEnum<{
1597
+ time: "time";
1598
+ length: "length";
1599
+ mass: "mass";
1600
+ electricCurrent: "electricCurrent";
1601
+ thermodynamicTemperature: "thermodynamicTemperature";
1602
+ amountOfSubstance: "amountOfSubstance";
1603
+ luminousIntensity: "luminousIntensity";
1604
+ }> & z.core.$partial, z.ZodNumber>;
1605
+ factorToSi: z.ZodObject<{
1606
+ numerator: z.ZodString;
1607
+ denominator: z.ZodString;
1608
+ }, z.core.$strip>;
1609
+ offsetToSi: z.ZodOptional<z.ZodObject<{
1610
+ numerator: z.ZodString;
1611
+ denominator: z.ZodString;
1612
+ }, z.core.$strip>>;
1613
+ context: z.ZodOptional<z.ZodString>;
1614
+ }, z.core.$strip>>;
1615
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1616
+ id: z.ZodString;
1617
+ bases: z.ZodArray<z.ZodObject<{
1618
+ unit: z.ZodString;
1619
+ value: z.ZodObject<{
1620
+ numerator: z.ZodString;
1621
+ denominator: z.ZodString;
1622
+ }, z.core.$strip>;
1623
+ }, z.core.$strip>>;
1624
+ }, z.core.$strip>>>;
1625
+ }, z.core.$strip>>;
1626
+ kind: z.ZodLiteral<"wordprocessing">;
1587
1627
  formatVersion: z.ZodLiteral<3>;
1588
1628
  metadata: z.ZodObject<{
1589
1629
  title: z.ZodOptional<z.ZodString>;
@@ -1595,6 +1635,7 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1595
1635
  createdIso: z.ZodOptional<z.ZodString>;
1596
1636
  modifiedIso: z.ZodOptional<z.ZodString>;
1597
1637
  }, z.core.$strip>;
1638
+ }, z.core.$strip>, z.ZodObject<{
1598
1639
  slides: z.ZodArray<z.ZodObject<{
1599
1640
  size: z.ZodObject<{
1600
1641
  widthPt: z.ZodNumber;
@@ -1628,8 +1669,50 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1628
1669
  }, z.core.$strip>>;
1629
1670
  notes: z.ZodString;
1630
1671
  }, z.core.$strip>>;
1631
- }, z.core.$strip>, z.ZodObject<{
1632
- kind: z.ZodLiteral<"spreadsheet">;
1672
+ symbolTable: z.ZodOptional<z.ZodObject<{
1673
+ symbols: z.ZodArray<z.ZodObject<{
1674
+ glyph: z.ZodString;
1675
+ scope: z.ZodString;
1676
+ id: z.ZodString;
1677
+ quantityKind: z.ZodOptional<z.ZodString>;
1678
+ preferredUnit: z.ZodOptional<z.ZodString>;
1679
+ definitionSource: z.ZodOptional<z.ZodString>;
1680
+ }, z.core.$strip>>;
1681
+ units: z.ZodArray<z.ZodObject<{
1682
+ id: z.ZodString;
1683
+ symbol: z.ZodString;
1684
+ name: z.ZodOptional<z.ZodString>;
1685
+ dimension: z.ZodRecord<z.ZodEnum<{
1686
+ time: "time";
1687
+ length: "length";
1688
+ mass: "mass";
1689
+ electricCurrent: "electricCurrent";
1690
+ thermodynamicTemperature: "thermodynamicTemperature";
1691
+ amountOfSubstance: "amountOfSubstance";
1692
+ luminousIntensity: "luminousIntensity";
1693
+ }> & z.core.$partial, z.ZodNumber>;
1694
+ factorToSi: z.ZodObject<{
1695
+ numerator: z.ZodString;
1696
+ denominator: z.ZodString;
1697
+ }, z.core.$strip>;
1698
+ offsetToSi: z.ZodOptional<z.ZodObject<{
1699
+ numerator: z.ZodString;
1700
+ denominator: z.ZodString;
1701
+ }, z.core.$strip>>;
1702
+ context: z.ZodOptional<z.ZodString>;
1703
+ }, z.core.$strip>>;
1704
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1705
+ id: z.ZodString;
1706
+ bases: z.ZodArray<z.ZodObject<{
1707
+ unit: z.ZodString;
1708
+ value: z.ZodObject<{
1709
+ numerator: z.ZodString;
1710
+ denominator: z.ZodString;
1711
+ }, z.core.$strip>;
1712
+ }, z.core.$strip>>;
1713
+ }, z.core.$strip>>>;
1714
+ }, z.core.$strip>>;
1715
+ kind: z.ZodLiteral<"presentation">;
1633
1716
  formatVersion: z.ZodLiteral<3>;
1634
1717
  metadata: z.ZodObject<{
1635
1718
  title: z.ZodOptional<z.ZodString>;
@@ -1641,6 +1724,7 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1641
1724
  createdIso: z.ZodOptional<z.ZodString>;
1642
1725
  modifiedIso: z.ZodOptional<z.ZodString>;
1643
1726
  }, z.core.$strip>;
1727
+ }, z.core.$strip>, z.ZodObject<{
1644
1728
  sheets: z.ZodArray<z.ZodObject<{
1645
1729
  name: z.ZodString;
1646
1730
  cells: z.ZodArray<z.ZodObject<{
@@ -1875,8 +1959,50 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1875
1959
  }, z.core.$strip>;
1876
1960
  embeddedObjects: z.ZodOptional<z.ZodArray<z.ZodCustom<ContentEmbeddedObject, ContentEmbeddedObject>>>;
1877
1961
  }, z.core.$strip>>;
1878
- }, z.core.$strip>, z.ZodObject<{
1879
- kind: z.ZodLiteral<"drawing">;
1962
+ symbolTable: z.ZodOptional<z.ZodObject<{
1963
+ symbols: z.ZodArray<z.ZodObject<{
1964
+ glyph: z.ZodString;
1965
+ scope: z.ZodString;
1966
+ id: z.ZodString;
1967
+ quantityKind: z.ZodOptional<z.ZodString>;
1968
+ preferredUnit: z.ZodOptional<z.ZodString>;
1969
+ definitionSource: z.ZodOptional<z.ZodString>;
1970
+ }, z.core.$strip>>;
1971
+ units: z.ZodArray<z.ZodObject<{
1972
+ id: z.ZodString;
1973
+ symbol: z.ZodString;
1974
+ name: z.ZodOptional<z.ZodString>;
1975
+ dimension: z.ZodRecord<z.ZodEnum<{
1976
+ time: "time";
1977
+ length: "length";
1978
+ mass: "mass";
1979
+ electricCurrent: "electricCurrent";
1980
+ thermodynamicTemperature: "thermodynamicTemperature";
1981
+ amountOfSubstance: "amountOfSubstance";
1982
+ luminousIntensity: "luminousIntensity";
1983
+ }> & z.core.$partial, z.ZodNumber>;
1984
+ factorToSi: z.ZodObject<{
1985
+ numerator: z.ZodString;
1986
+ denominator: z.ZodString;
1987
+ }, z.core.$strip>;
1988
+ offsetToSi: z.ZodOptional<z.ZodObject<{
1989
+ numerator: z.ZodString;
1990
+ denominator: z.ZodString;
1991
+ }, z.core.$strip>>;
1992
+ context: z.ZodOptional<z.ZodString>;
1993
+ }, z.core.$strip>>;
1994
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1995
+ id: z.ZodString;
1996
+ bases: z.ZodArray<z.ZodObject<{
1997
+ unit: z.ZodString;
1998
+ value: z.ZodObject<{
1999
+ numerator: z.ZodString;
2000
+ denominator: z.ZodString;
2001
+ }, z.core.$strip>;
2002
+ }, z.core.$strip>>;
2003
+ }, z.core.$strip>>>;
2004
+ }, z.core.$strip>>;
2005
+ kind: z.ZodLiteral<"spreadsheet">;
1880
2006
  formatVersion: z.ZodLiteral<3>;
1881
2007
  metadata: z.ZodObject<{
1882
2008
  title: z.ZodOptional<z.ZodString>;
@@ -1888,6 +2014,7 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1888
2014
  createdIso: z.ZodOptional<z.ZodString>;
1889
2015
  modifiedIso: z.ZodOptional<z.ZodString>;
1890
2016
  }, z.core.$strip>;
2017
+ }, z.core.$strip>, z.ZodObject<{
1891
2018
  pages: z.ZodArray<z.ZodObject<{
1892
2019
  size: z.ZodObject<{
1893
2020
  widthPt: z.ZodNumber;
@@ -2097,8 +2224,50 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2097
2224
  }, z.core.$strip>>>;
2098
2225
  }, z.core.$strip>], "kind">>;
2099
2226
  }, z.core.$strip>>;
2100
- }, z.core.$strip>, z.ZodObject<{
2101
- kind: z.ZodLiteral<"formula">;
2227
+ symbolTable: z.ZodOptional<z.ZodObject<{
2228
+ symbols: z.ZodArray<z.ZodObject<{
2229
+ glyph: z.ZodString;
2230
+ scope: z.ZodString;
2231
+ id: z.ZodString;
2232
+ quantityKind: z.ZodOptional<z.ZodString>;
2233
+ preferredUnit: z.ZodOptional<z.ZodString>;
2234
+ definitionSource: z.ZodOptional<z.ZodString>;
2235
+ }, z.core.$strip>>;
2236
+ units: z.ZodArray<z.ZodObject<{
2237
+ id: z.ZodString;
2238
+ symbol: z.ZodString;
2239
+ name: z.ZodOptional<z.ZodString>;
2240
+ dimension: z.ZodRecord<z.ZodEnum<{
2241
+ time: "time";
2242
+ length: "length";
2243
+ mass: "mass";
2244
+ electricCurrent: "electricCurrent";
2245
+ thermodynamicTemperature: "thermodynamicTemperature";
2246
+ amountOfSubstance: "amountOfSubstance";
2247
+ luminousIntensity: "luminousIntensity";
2248
+ }> & z.core.$partial, z.ZodNumber>;
2249
+ factorToSi: z.ZodObject<{
2250
+ numerator: z.ZodString;
2251
+ denominator: z.ZodString;
2252
+ }, z.core.$strip>;
2253
+ offsetToSi: z.ZodOptional<z.ZodObject<{
2254
+ numerator: z.ZodString;
2255
+ denominator: z.ZodString;
2256
+ }, z.core.$strip>>;
2257
+ context: z.ZodOptional<z.ZodString>;
2258
+ }, z.core.$strip>>;
2259
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2260
+ id: z.ZodString;
2261
+ bases: z.ZodArray<z.ZodObject<{
2262
+ unit: z.ZodString;
2263
+ value: z.ZodObject<{
2264
+ numerator: z.ZodString;
2265
+ denominator: z.ZodString;
2266
+ }, z.core.$strip>;
2267
+ }, z.core.$strip>>;
2268
+ }, z.core.$strip>>>;
2269
+ }, z.core.$strip>>;
2270
+ kind: z.ZodLiteral<"drawing">;
2102
2271
  formatVersion: z.ZodLiteral<3>;
2103
2272
  metadata: z.ZodObject<{
2104
2273
  title: z.ZodOptional<z.ZodString>;
@@ -2110,9 +2279,74 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2110
2279
  createdIso: z.ZodOptional<z.ZodString>;
2111
2280
  modifiedIso: z.ZodOptional<z.ZodString>;
2112
2281
  }, z.core.$strip>;
2282
+ }, z.core.$strip>, z.ZodObject<{
2113
2283
  formula: z.ZodObject<{
2114
2284
  mathml: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
2115
2285
  starMath: z.ZodOptional<z.ZodString>;
2286
+ presentation: z.ZodOptional<z.ZodObject<{
2287
+ latex: z.ZodString;
2288
+ }, z.core.$strip>>;
2289
+ content: z.ZodOptional<z.ZodCustom<MathExpression, MathExpression>>;
2290
+ provenance: z.ZodOptional<z.ZodObject<{
2291
+ source: z.ZodString;
2292
+ pageRef: z.ZodOptional<z.ZodString>;
2293
+ editTrail: z.ZodArray<z.ZodString>;
2294
+ }, z.core.$strip>>;
2295
+ }, z.core.$strip>;
2296
+ symbolTable: z.ZodOptional<z.ZodObject<{
2297
+ symbols: z.ZodArray<z.ZodObject<{
2298
+ glyph: z.ZodString;
2299
+ scope: z.ZodString;
2300
+ id: z.ZodString;
2301
+ quantityKind: z.ZodOptional<z.ZodString>;
2302
+ preferredUnit: z.ZodOptional<z.ZodString>;
2303
+ definitionSource: z.ZodOptional<z.ZodString>;
2304
+ }, z.core.$strip>>;
2305
+ units: z.ZodArray<z.ZodObject<{
2306
+ id: z.ZodString;
2307
+ symbol: z.ZodString;
2308
+ name: z.ZodOptional<z.ZodString>;
2309
+ dimension: z.ZodRecord<z.ZodEnum<{
2310
+ time: "time";
2311
+ length: "length";
2312
+ mass: "mass";
2313
+ electricCurrent: "electricCurrent";
2314
+ thermodynamicTemperature: "thermodynamicTemperature";
2315
+ amountOfSubstance: "amountOfSubstance";
2316
+ luminousIntensity: "luminousIntensity";
2317
+ }> & z.core.$partial, z.ZodNumber>;
2318
+ factorToSi: z.ZodObject<{
2319
+ numerator: z.ZodString;
2320
+ denominator: z.ZodString;
2321
+ }, z.core.$strip>;
2322
+ offsetToSi: z.ZodOptional<z.ZodObject<{
2323
+ numerator: z.ZodString;
2324
+ denominator: z.ZodString;
2325
+ }, z.core.$strip>>;
2326
+ context: z.ZodOptional<z.ZodString>;
2327
+ }, z.core.$strip>>;
2328
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2329
+ id: z.ZodString;
2330
+ bases: z.ZodArray<z.ZodObject<{
2331
+ unit: z.ZodString;
2332
+ value: z.ZodObject<{
2333
+ numerator: z.ZodString;
2334
+ denominator: z.ZodString;
2335
+ }, z.core.$strip>;
2336
+ }, z.core.$strip>>;
2337
+ }, z.core.$strip>>>;
2338
+ }, z.core.$strip>>;
2339
+ kind: z.ZodLiteral<"formula">;
2340
+ formatVersion: z.ZodLiteral<3>;
2341
+ metadata: z.ZodObject<{
2342
+ title: z.ZodOptional<z.ZodString>;
2343
+ author: z.ZodOptional<z.ZodString>;
2344
+ subject: z.ZodOptional<z.ZodString>;
2345
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
2346
+ creator: z.ZodOptional<z.ZodString>;
2347
+ producer: z.ZodOptional<z.ZodString>;
2348
+ createdIso: z.ZodOptional<z.ZodString>;
2349
+ modifiedIso: z.ZodOptional<z.ZodString>;
2116
2350
  }, z.core.$strip>;
2117
2351
  }, z.core.$strip>], "kind">;
2118
2352
  type ContentDocument = z.infer<typeof ContentDocumentSchema>;