document-content-model 1.0.0 → 1.1.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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # document-content-model
2
2
 
3
+ [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/document-content-model) [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/document-content-model) [![Release](https://img.shields.io/github/v/release/ExaDev/document-content-model)](https://github.com/ExaDev/document-content-model/releases/latest) [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/document-content-model/ci.yml?branch=main)](https://github.com/ExaDev/document-content-model/actions)
4
+
3
5
  > The canonical, format-agnostic content and layout schema pivot shared by [ooxml.js](https://github.com/ExaDev/ooxml.js), [odf.js](https://github.com/ExaDev/odf.js), and [documents.js](https://github.com/ExaDev/documents.js).
4
6
 
5
7
  Both `ooxml.js` and `documents.js` independently arrived at the same content vocabulary -- paragraphs, runs, tables, images, shapes, slides -- because `documents.js`'s docx/pptx-to-PDF pipeline needed a richer model than `ooxml.js`'s own readers originally produced, and that model was later ported back into `ooxml.js` itself. The result was two field-identical copies maintained in two places. This package is the fix: one schema, imported by every format package instead of redefined by each. It also sidesteps a circular dependency that would otherwise appear once `odf.js` exists, since `documents.js` depends on both `ooxml.js` and `odf.js`.
package/dist/index.cjs CHANGED
@@ -108,7 +108,8 @@ const ContentRunSchema = zod.z.object({
108
108
  fontFamily: zod.z.string().optional(),
109
109
  sizePt: zod.z.number().positive().optional(),
110
110
  color: ColorSchema.optional(),
111
- hyperlink: zod.z.string().optional()
111
+ hyperlink: zod.z.string().optional(),
112
+ sourcePath: zod.z.string().optional()
112
113
  });
113
114
  const ContentListMembershipSchema = zod.z.object({
114
115
  numId: zod.z.string(),
@@ -124,7 +125,8 @@ const ContentParagraphSchema = zod.z.object({
124
125
  spacingAfterPt: zod.z.number().optional(),
125
126
  lineSpacing: zod.z.number().positive().optional(),
126
127
  indentLeftPt: zod.z.number().optional(),
127
- indentFirstLinePt: zod.z.number().optional()
128
+ indentFirstLinePt: zod.z.number().optional(),
129
+ sourcePath: zod.z.string().optional()
128
130
  });
129
131
  const ContentImageBlockSchema = zod.z.object({
130
132
  kind: zod.z.literal("image"),
@@ -132,9 +134,13 @@ const ContentImageBlockSchema = zod.z.object({
132
134
  base64: zod.z.string(),
133
135
  widthPt: zod.z.number().positive(),
134
136
  heightPt: zod.z.number().positive(),
135
- altText: zod.z.string().optional()
137
+ altText: zod.z.string().optional(),
138
+ sourcePath: zod.z.string().optional()
139
+ });
140
+ const ContentPageBreakSchema = zod.z.object({
141
+ kind: zod.z.literal("pageBreak"),
142
+ sourcePath: zod.z.string().optional()
136
143
  });
137
- const ContentPageBreakSchema = zod.z.object({ kind: zod.z.literal("pageBreak") });
138
144
  function isRecord(value) {
139
145
  return typeof value === "object" && value !== null && !Array.isArray(value);
140
146
  }
@@ -170,7 +176,8 @@ const ContentTableRowSchema = zod.z.object({
170
176
  const ContentTableSchema = zod.z.object({
171
177
  kind: zod.z.literal("table"),
172
178
  rows: zod.z.array(ContentTableRowSchema),
173
- columnWidthsPt: zod.z.array(zod.z.number().positive())
179
+ columnWidthsPt: zod.z.array(zod.z.number().positive()),
180
+ sourcePath: zod.z.string().optional()
174
181
  });
175
182
  const ContentSectionSchema = zod.z.object({
176
183
  pageSize: PageSizeSchema,
@@ -187,6 +194,7 @@ const ContentShapeSchema = zod.z.object({
187
194
  insetBottomPt: zod.z.number().nonnegative(),
188
195
  fontScale: zod.z.number().positive().optional(),
189
196
  lineSpacingReduction: zod.z.number().nonnegative().optional(),
197
+ sourcePath: zod.z.string().optional(),
190
198
  blocks: zod.z.array(ContentBlockSchema)
191
199
  });
192
200
  const ContentSlideSchema = zod.z.object({
@@ -219,7 +227,8 @@ const LayoutTextSchema = zod.z.object({
219
227
  color: ColorSchema,
220
228
  widthPt: zod.z.number().nonnegative().optional(),
221
229
  rotationDeg: zod.z.number().optional(),
222
- underline: zod.z.boolean().optional()
230
+ underline: zod.z.boolean().optional(),
231
+ sourcePath: zod.z.string().optional()
223
232
  });
224
233
  const LayoutImageSchema = zod.z.object({
225
234
  kind: zod.z.literal("image"),
@@ -228,7 +237,8 @@ const LayoutImageSchema = zod.z.object({
228
237
  yPt: zod.z.number(),
229
238
  widthPt: zod.z.number().positive(),
230
239
  heightPt: zod.z.number().positive(),
231
- rotationDeg: zod.z.number().optional()
240
+ rotationDeg: zod.z.number().optional(),
241
+ sourcePath: zod.z.string().optional()
232
242
  });
233
243
  const LayoutRectSchema = zod.z.object({
234
244
  kind: zod.z.literal("rect"),
@@ -240,7 +250,8 @@ const LayoutRectSchema = zod.z.object({
240
250
  stroke: zod.z.object({
241
251
  color: ColorSchema,
242
252
  widthPt: zod.z.number().positive()
243
- }).optional()
253
+ }).optional(),
254
+ sourcePath: zod.z.string().optional()
244
255
  });
245
256
  const LayoutLineSchema = zod.z.object({
246
257
  kind: zod.z.literal("line"),
@@ -249,7 +260,8 @@ const LayoutLineSchema = zod.z.object({
249
260
  x2Pt: zod.z.number(),
250
261
  y2Pt: zod.z.number(),
251
262
  color: ColorSchema,
252
- widthPt: zod.z.number().positive()
263
+ widthPt: zod.z.number().positive(),
264
+ sourcePath: zod.z.string().optional()
253
265
  });
254
266
  const LayoutEllipseSchema = zod.z.object({
255
267
  kind: zod.z.literal("ellipse"),
@@ -261,7 +273,8 @@ const LayoutEllipseSchema = zod.z.object({
261
273
  stroke: zod.z.object({
262
274
  color: ColorSchema,
263
275
  widthPt: zod.z.number().positive()
264
- }).optional()
276
+ }).optional(),
277
+ sourcePath: zod.z.string().optional()
265
278
  });
266
279
  const LayoutLinkSchema = zod.z.object({
267
280
  kind: zod.z.literal("link"),
@@ -269,7 +282,8 @@ const LayoutLinkSchema = zod.z.object({
269
282
  xPt: zod.z.number(),
270
283
  yPt: zod.z.number(),
271
284
  widthPt: zod.z.number().nonnegative(),
272
- heightPt: zod.z.number().nonnegative()
285
+ heightPt: zod.z.number().nonnegative(),
286
+ sourcePath: zod.z.string().optional()
273
287
  });
274
288
  const LayoutItemSchema = zod.z.discriminatedUnion("kind", [
275
289
  LayoutTextSchema,
package/dist/index.d.cts CHANGED
@@ -85,6 +85,7 @@ declare const ContentRunSchema: z.ZodObject<{
85
85
  b: z.ZodNumber;
86
86
  }, z.core.$strip>>;
87
87
  hyperlink: z.ZodOptional<z.ZodString>;
88
+ sourcePath: z.ZodOptional<z.ZodString>;
88
89
  }, z.core.$strip>;
89
90
  type ContentRun = z.infer<typeof ContentRunSchema>;
90
91
  declare const ContentListMembershipSchema: z.ZodObject<{
@@ -108,6 +109,7 @@ declare const ContentParagraphSchema: z.ZodObject<{
108
109
  b: z.ZodNumber;
109
110
  }, z.core.$strip>>;
110
111
  hyperlink: z.ZodOptional<z.ZodString>;
112
+ sourcePath: z.ZodOptional<z.ZodString>;
111
113
  }, z.core.$strip>>;
112
114
  styleId: z.ZodOptional<z.ZodString>;
113
115
  alignment: z.ZodOptional<z.ZodEnum<{
@@ -125,6 +127,7 @@ declare const ContentParagraphSchema: z.ZodObject<{
125
127
  lineSpacing: z.ZodOptional<z.ZodNumber>;
126
128
  indentLeftPt: z.ZodOptional<z.ZodNumber>;
127
129
  indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
130
+ sourcePath: z.ZodOptional<z.ZodString>;
128
131
  }, z.core.$strip>;
129
132
  type ContentParagraph = z.infer<typeof ContentParagraphSchema>;
130
133
  declare const ContentImageBlockSchema: z.ZodObject<{
@@ -137,10 +140,12 @@ declare const ContentImageBlockSchema: z.ZodObject<{
137
140
  widthPt: z.ZodNumber;
138
141
  heightPt: z.ZodNumber;
139
142
  altText: z.ZodOptional<z.ZodString>;
143
+ sourcePath: z.ZodOptional<z.ZodString>;
140
144
  }, z.core.$strip>;
141
145
  type ContentImageBlock = z.infer<typeof ContentImageBlockSchema>;
142
146
  declare const ContentPageBreakSchema: z.ZodObject<{
143
147
  kind: z.ZodLiteral<"pageBreak">;
148
+ sourcePath: z.ZodOptional<z.ZodString>;
144
149
  }, z.core.$strip>;
145
150
  type ContentPageBreak = z.infer<typeof ContentPageBreakSchema>;
146
151
  interface ContentTableCell {
@@ -157,6 +162,7 @@ interface ContentTable {
157
162
  kind: 'table';
158
163
  rows: ContentTableRow[];
159
164
  columnWidthsPt: number[];
165
+ sourcePath?: string;
160
166
  }
161
167
  type ContentBlock = ContentParagraph | ContentTable | ContentImageBlock | ContentPageBreak;
162
168
  declare function isContentBlock(value: unknown): value is ContentBlock;
@@ -200,6 +206,7 @@ declare const ContentTableSchema: z.ZodObject<{
200
206
  heightPt: z.ZodOptional<z.ZodNumber>;
201
207
  }, z.core.$strip>>;
202
208
  columnWidthsPt: z.ZodArray<z.ZodNumber>;
209
+ sourcePath: z.ZodOptional<z.ZodString>;
203
210
  }, z.core.$strip>;
204
211
  declare const ContentSectionSchema: z.ZodObject<{
205
212
  pageSize: z.ZodObject<{
@@ -230,6 +237,7 @@ declare const ContentShapeSchema: z.ZodObject<{
230
237
  insetBottomPt: z.ZodNumber;
231
238
  fontScale: z.ZodOptional<z.ZodNumber>;
232
239
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
240
+ sourcePath: z.ZodOptional<z.ZodString>;
233
241
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
234
242
  }, z.core.$strip>;
235
243
  type ContentShape = z.infer<typeof ContentShapeSchema>;
@@ -253,6 +261,7 @@ declare const ContentSlideSchema: z.ZodObject<{
253
261
  insetBottomPt: z.ZodNumber;
254
262
  fontScale: z.ZodOptional<z.ZodNumber>;
255
263
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
264
+ sourcePath: z.ZodOptional<z.ZodString>;
256
265
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
257
266
  }, z.core.$strip>>;
258
267
  notes: z.ZodString;
@@ -318,6 +327,7 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
318
327
  insetBottomPt: z.ZodNumber;
319
328
  fontScale: z.ZodOptional<z.ZodNumber>;
320
329
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
330
+ sourcePath: z.ZodOptional<z.ZodString>;
321
331
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
322
332
  }, z.core.$strip>>;
323
333
  notes: z.ZodString;
@@ -352,6 +362,7 @@ declare const LayoutTextSchema: z.ZodObject<{
352
362
  widthPt: z.ZodOptional<z.ZodNumber>;
353
363
  rotationDeg: z.ZodOptional<z.ZodNumber>;
354
364
  underline: z.ZodOptional<z.ZodBoolean>;
365
+ sourcePath: z.ZodOptional<z.ZodString>;
355
366
  }, z.core.$strip>;
356
367
  type LayoutText = z.infer<typeof LayoutTextSchema>;
357
368
  declare const LayoutImageSchema: z.ZodObject<{
@@ -362,6 +373,7 @@ declare const LayoutImageSchema: z.ZodObject<{
362
373
  widthPt: z.ZodNumber;
363
374
  heightPt: z.ZodNumber;
364
375
  rotationDeg: z.ZodOptional<z.ZodNumber>;
376
+ sourcePath: z.ZodOptional<z.ZodString>;
365
377
  }, z.core.$strip>;
366
378
  type LayoutImage = z.infer<typeof LayoutImageSchema>;
367
379
  declare const LayoutRectSchema: z.ZodObject<{
@@ -383,6 +395,7 @@ declare const LayoutRectSchema: z.ZodObject<{
383
395
  }, z.core.$strip>;
384
396
  widthPt: z.ZodNumber;
385
397
  }, z.core.$strip>>;
398
+ sourcePath: z.ZodOptional<z.ZodString>;
386
399
  }, z.core.$strip>;
387
400
  type LayoutRect = z.infer<typeof LayoutRectSchema>;
388
401
  declare const LayoutLineSchema: z.ZodObject<{
@@ -397,6 +410,7 @@ declare const LayoutLineSchema: z.ZodObject<{
397
410
  b: z.ZodNumber;
398
411
  }, z.core.$strip>;
399
412
  widthPt: z.ZodNumber;
413
+ sourcePath: z.ZodOptional<z.ZodString>;
400
414
  }, z.core.$strip>;
401
415
  type LayoutLine = z.infer<typeof LayoutLineSchema>;
402
416
  declare const LayoutEllipseSchema: z.ZodObject<{
@@ -418,6 +432,7 @@ declare const LayoutEllipseSchema: z.ZodObject<{
418
432
  }, z.core.$strip>;
419
433
  widthPt: z.ZodNumber;
420
434
  }, z.core.$strip>>;
435
+ sourcePath: z.ZodOptional<z.ZodString>;
421
436
  }, z.core.$strip>;
422
437
  type LayoutEllipse = z.infer<typeof LayoutEllipseSchema>;
423
438
  declare const LayoutLinkSchema: z.ZodObject<{
@@ -427,6 +442,7 @@ declare const LayoutLinkSchema: z.ZodObject<{
427
442
  yPt: z.ZodNumber;
428
443
  widthPt: z.ZodNumber;
429
444
  heightPt: z.ZodNumber;
445
+ sourcePath: z.ZodOptional<z.ZodString>;
430
446
  }, z.core.$strip>;
431
447
  type LayoutLink = z.infer<typeof LayoutLinkSchema>;
432
448
  declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -454,6 +470,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
454
470
  widthPt: z.ZodOptional<z.ZodNumber>;
455
471
  rotationDeg: z.ZodOptional<z.ZodNumber>;
456
472
  underline: z.ZodOptional<z.ZodBoolean>;
473
+ sourcePath: z.ZodOptional<z.ZodString>;
457
474
  }, z.core.$strip>, z.ZodObject<{
458
475
  kind: z.ZodLiteral<"image">;
459
476
  imageId: z.ZodString;
@@ -462,6 +479,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
462
479
  widthPt: z.ZodNumber;
463
480
  heightPt: z.ZodNumber;
464
481
  rotationDeg: z.ZodOptional<z.ZodNumber>;
482
+ sourcePath: z.ZodOptional<z.ZodString>;
465
483
  }, z.core.$strip>, z.ZodObject<{
466
484
  kind: z.ZodLiteral<"rect">;
467
485
  xPt: z.ZodNumber;
@@ -481,6 +499,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
481
499
  }, z.core.$strip>;
482
500
  widthPt: z.ZodNumber;
483
501
  }, z.core.$strip>>;
502
+ sourcePath: z.ZodOptional<z.ZodString>;
484
503
  }, z.core.$strip>, z.ZodObject<{
485
504
  kind: z.ZodLiteral<"line">;
486
505
  x1Pt: z.ZodNumber;
@@ -493,6 +512,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
493
512
  b: z.ZodNumber;
494
513
  }, z.core.$strip>;
495
514
  widthPt: z.ZodNumber;
515
+ sourcePath: z.ZodOptional<z.ZodString>;
496
516
  }, z.core.$strip>, z.ZodObject<{
497
517
  kind: z.ZodLiteral<"ellipse">;
498
518
  xPt: z.ZodNumber;
@@ -512,6 +532,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
512
532
  }, z.core.$strip>;
513
533
  widthPt: z.ZodNumber;
514
534
  }, z.core.$strip>>;
535
+ sourcePath: z.ZodOptional<z.ZodString>;
515
536
  }, z.core.$strip>, z.ZodObject<{
516
537
  kind: z.ZodLiteral<"link">;
517
538
  uri: z.ZodString;
@@ -519,6 +540,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
519
540
  yPt: z.ZodNumber;
520
541
  widthPt: z.ZodNumber;
521
542
  heightPt: z.ZodNumber;
543
+ sourcePath: z.ZodOptional<z.ZodString>;
522
544
  }, z.core.$strip>], "kind">;
523
545
  type LayoutItem = z.infer<typeof LayoutItemSchema>;
524
546
  declare const LayoutPageSchema: z.ZodObject<{
@@ -549,6 +571,7 @@ declare const LayoutPageSchema: z.ZodObject<{
549
571
  widthPt: z.ZodOptional<z.ZodNumber>;
550
572
  rotationDeg: z.ZodOptional<z.ZodNumber>;
551
573
  underline: z.ZodOptional<z.ZodBoolean>;
574
+ sourcePath: z.ZodOptional<z.ZodString>;
552
575
  }, z.core.$strip>, z.ZodObject<{
553
576
  kind: z.ZodLiteral<"image">;
554
577
  imageId: z.ZodString;
@@ -557,6 +580,7 @@ declare const LayoutPageSchema: z.ZodObject<{
557
580
  widthPt: z.ZodNumber;
558
581
  heightPt: z.ZodNumber;
559
582
  rotationDeg: z.ZodOptional<z.ZodNumber>;
583
+ sourcePath: z.ZodOptional<z.ZodString>;
560
584
  }, z.core.$strip>, z.ZodObject<{
561
585
  kind: z.ZodLiteral<"rect">;
562
586
  xPt: z.ZodNumber;
@@ -576,6 +600,7 @@ declare const LayoutPageSchema: z.ZodObject<{
576
600
  }, z.core.$strip>;
577
601
  widthPt: z.ZodNumber;
578
602
  }, z.core.$strip>>;
603
+ sourcePath: z.ZodOptional<z.ZodString>;
579
604
  }, z.core.$strip>, z.ZodObject<{
580
605
  kind: z.ZodLiteral<"line">;
581
606
  x1Pt: z.ZodNumber;
@@ -588,6 +613,7 @@ declare const LayoutPageSchema: z.ZodObject<{
588
613
  b: z.ZodNumber;
589
614
  }, z.core.$strip>;
590
615
  widthPt: z.ZodNumber;
616
+ sourcePath: z.ZodOptional<z.ZodString>;
591
617
  }, z.core.$strip>, z.ZodObject<{
592
618
  kind: z.ZodLiteral<"ellipse">;
593
619
  xPt: z.ZodNumber;
@@ -607,6 +633,7 @@ declare const LayoutPageSchema: z.ZodObject<{
607
633
  }, z.core.$strip>;
608
634
  widthPt: z.ZodNumber;
609
635
  }, z.core.$strip>>;
636
+ sourcePath: z.ZodOptional<z.ZodString>;
610
637
  }, z.core.$strip>, z.ZodObject<{
611
638
  kind: z.ZodLiteral<"link">;
612
639
  uri: z.ZodString;
@@ -614,6 +641,7 @@ declare const LayoutPageSchema: z.ZodObject<{
614
641
  yPt: z.ZodNumber;
615
642
  widthPt: z.ZodNumber;
616
643
  heightPt: z.ZodNumber;
644
+ sourcePath: z.ZodOptional<z.ZodString>;
617
645
  }, z.core.$strip>], "kind">>;
618
646
  notes: z.ZodOptional<z.ZodString>;
619
647
  }, z.core.$strip>;
@@ -668,6 +696,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
668
696
  widthPt: z.ZodOptional<z.ZodNumber>;
669
697
  rotationDeg: z.ZodOptional<z.ZodNumber>;
670
698
  underline: z.ZodOptional<z.ZodBoolean>;
699
+ sourcePath: z.ZodOptional<z.ZodString>;
671
700
  }, z.core.$strip>, z.ZodObject<{
672
701
  kind: z.ZodLiteral<"image">;
673
702
  imageId: z.ZodString;
@@ -676,6 +705,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
676
705
  widthPt: z.ZodNumber;
677
706
  heightPt: z.ZodNumber;
678
707
  rotationDeg: z.ZodOptional<z.ZodNumber>;
708
+ sourcePath: z.ZodOptional<z.ZodString>;
679
709
  }, z.core.$strip>, z.ZodObject<{
680
710
  kind: z.ZodLiteral<"rect">;
681
711
  xPt: z.ZodNumber;
@@ -695,6 +725,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
695
725
  }, z.core.$strip>;
696
726
  widthPt: z.ZodNumber;
697
727
  }, z.core.$strip>>;
728
+ sourcePath: z.ZodOptional<z.ZodString>;
698
729
  }, z.core.$strip>, z.ZodObject<{
699
730
  kind: z.ZodLiteral<"line">;
700
731
  x1Pt: z.ZodNumber;
@@ -707,6 +738,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
707
738
  b: z.ZodNumber;
708
739
  }, z.core.$strip>;
709
740
  widthPt: z.ZodNumber;
741
+ sourcePath: z.ZodOptional<z.ZodString>;
710
742
  }, z.core.$strip>, z.ZodObject<{
711
743
  kind: z.ZodLiteral<"ellipse">;
712
744
  xPt: z.ZodNumber;
@@ -726,6 +758,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
726
758
  }, z.core.$strip>;
727
759
  widthPt: z.ZodNumber;
728
760
  }, z.core.$strip>>;
761
+ sourcePath: z.ZodOptional<z.ZodString>;
729
762
  }, z.core.$strip>, z.ZodObject<{
730
763
  kind: z.ZodLiteral<"link">;
731
764
  uri: z.ZodString;
@@ -733,6 +766,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
733
766
  yPt: z.ZodNumber;
734
767
  widthPt: z.ZodNumber;
735
768
  heightPt: z.ZodNumber;
769
+ sourcePath: z.ZodOptional<z.ZodString>;
736
770
  }, z.core.$strip>], "kind">>;
737
771
  notes: z.ZodOptional<z.ZodString>;
738
772
  }, z.core.$strip>>;
package/dist/index.d.ts CHANGED
@@ -85,6 +85,7 @@ declare const ContentRunSchema: z.ZodObject<{
85
85
  b: z.ZodNumber;
86
86
  }, z.core.$strip>>;
87
87
  hyperlink: z.ZodOptional<z.ZodString>;
88
+ sourcePath: z.ZodOptional<z.ZodString>;
88
89
  }, z.core.$strip>;
89
90
  type ContentRun = z.infer<typeof ContentRunSchema>;
90
91
  declare const ContentListMembershipSchema: z.ZodObject<{
@@ -108,6 +109,7 @@ declare const ContentParagraphSchema: z.ZodObject<{
108
109
  b: z.ZodNumber;
109
110
  }, z.core.$strip>>;
110
111
  hyperlink: z.ZodOptional<z.ZodString>;
112
+ sourcePath: z.ZodOptional<z.ZodString>;
111
113
  }, z.core.$strip>>;
112
114
  styleId: z.ZodOptional<z.ZodString>;
113
115
  alignment: z.ZodOptional<z.ZodEnum<{
@@ -125,6 +127,7 @@ declare const ContentParagraphSchema: z.ZodObject<{
125
127
  lineSpacing: z.ZodOptional<z.ZodNumber>;
126
128
  indentLeftPt: z.ZodOptional<z.ZodNumber>;
127
129
  indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
130
+ sourcePath: z.ZodOptional<z.ZodString>;
128
131
  }, z.core.$strip>;
129
132
  type ContentParagraph = z.infer<typeof ContentParagraphSchema>;
130
133
  declare const ContentImageBlockSchema: z.ZodObject<{
@@ -137,10 +140,12 @@ declare const ContentImageBlockSchema: z.ZodObject<{
137
140
  widthPt: z.ZodNumber;
138
141
  heightPt: z.ZodNumber;
139
142
  altText: z.ZodOptional<z.ZodString>;
143
+ sourcePath: z.ZodOptional<z.ZodString>;
140
144
  }, z.core.$strip>;
141
145
  type ContentImageBlock = z.infer<typeof ContentImageBlockSchema>;
142
146
  declare const ContentPageBreakSchema: z.ZodObject<{
143
147
  kind: z.ZodLiteral<"pageBreak">;
148
+ sourcePath: z.ZodOptional<z.ZodString>;
144
149
  }, z.core.$strip>;
145
150
  type ContentPageBreak = z.infer<typeof ContentPageBreakSchema>;
146
151
  interface ContentTableCell {
@@ -157,6 +162,7 @@ interface ContentTable {
157
162
  kind: 'table';
158
163
  rows: ContentTableRow[];
159
164
  columnWidthsPt: number[];
165
+ sourcePath?: string;
160
166
  }
161
167
  type ContentBlock = ContentParagraph | ContentTable | ContentImageBlock | ContentPageBreak;
162
168
  declare function isContentBlock(value: unknown): value is ContentBlock;
@@ -200,6 +206,7 @@ declare const ContentTableSchema: z.ZodObject<{
200
206
  heightPt: z.ZodOptional<z.ZodNumber>;
201
207
  }, z.core.$strip>>;
202
208
  columnWidthsPt: z.ZodArray<z.ZodNumber>;
209
+ sourcePath: z.ZodOptional<z.ZodString>;
203
210
  }, z.core.$strip>;
204
211
  declare const ContentSectionSchema: z.ZodObject<{
205
212
  pageSize: z.ZodObject<{
@@ -230,6 +237,7 @@ declare const ContentShapeSchema: z.ZodObject<{
230
237
  insetBottomPt: z.ZodNumber;
231
238
  fontScale: z.ZodOptional<z.ZodNumber>;
232
239
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
240
+ sourcePath: z.ZodOptional<z.ZodString>;
233
241
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
234
242
  }, z.core.$strip>;
235
243
  type ContentShape = z.infer<typeof ContentShapeSchema>;
@@ -253,6 +261,7 @@ declare const ContentSlideSchema: z.ZodObject<{
253
261
  insetBottomPt: z.ZodNumber;
254
262
  fontScale: z.ZodOptional<z.ZodNumber>;
255
263
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
264
+ sourcePath: z.ZodOptional<z.ZodString>;
256
265
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
257
266
  }, z.core.$strip>>;
258
267
  notes: z.ZodString;
@@ -318,6 +327,7 @@ declare const ContentDocumentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
318
327
  insetBottomPt: z.ZodNumber;
319
328
  fontScale: z.ZodOptional<z.ZodNumber>;
320
329
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
330
+ sourcePath: z.ZodOptional<z.ZodString>;
321
331
  blocks: z.ZodArray<z.ZodCustom<ContentBlock, ContentBlock>>;
322
332
  }, z.core.$strip>>;
323
333
  notes: z.ZodString;
@@ -352,6 +362,7 @@ declare const LayoutTextSchema: z.ZodObject<{
352
362
  widthPt: z.ZodOptional<z.ZodNumber>;
353
363
  rotationDeg: z.ZodOptional<z.ZodNumber>;
354
364
  underline: z.ZodOptional<z.ZodBoolean>;
365
+ sourcePath: z.ZodOptional<z.ZodString>;
355
366
  }, z.core.$strip>;
356
367
  type LayoutText = z.infer<typeof LayoutTextSchema>;
357
368
  declare const LayoutImageSchema: z.ZodObject<{
@@ -362,6 +373,7 @@ declare const LayoutImageSchema: z.ZodObject<{
362
373
  widthPt: z.ZodNumber;
363
374
  heightPt: z.ZodNumber;
364
375
  rotationDeg: z.ZodOptional<z.ZodNumber>;
376
+ sourcePath: z.ZodOptional<z.ZodString>;
365
377
  }, z.core.$strip>;
366
378
  type LayoutImage = z.infer<typeof LayoutImageSchema>;
367
379
  declare const LayoutRectSchema: z.ZodObject<{
@@ -383,6 +395,7 @@ declare const LayoutRectSchema: z.ZodObject<{
383
395
  }, z.core.$strip>;
384
396
  widthPt: z.ZodNumber;
385
397
  }, z.core.$strip>>;
398
+ sourcePath: z.ZodOptional<z.ZodString>;
386
399
  }, z.core.$strip>;
387
400
  type LayoutRect = z.infer<typeof LayoutRectSchema>;
388
401
  declare const LayoutLineSchema: z.ZodObject<{
@@ -397,6 +410,7 @@ declare const LayoutLineSchema: z.ZodObject<{
397
410
  b: z.ZodNumber;
398
411
  }, z.core.$strip>;
399
412
  widthPt: z.ZodNumber;
413
+ sourcePath: z.ZodOptional<z.ZodString>;
400
414
  }, z.core.$strip>;
401
415
  type LayoutLine = z.infer<typeof LayoutLineSchema>;
402
416
  declare const LayoutEllipseSchema: z.ZodObject<{
@@ -418,6 +432,7 @@ declare const LayoutEllipseSchema: z.ZodObject<{
418
432
  }, z.core.$strip>;
419
433
  widthPt: z.ZodNumber;
420
434
  }, z.core.$strip>>;
435
+ sourcePath: z.ZodOptional<z.ZodString>;
421
436
  }, z.core.$strip>;
422
437
  type LayoutEllipse = z.infer<typeof LayoutEllipseSchema>;
423
438
  declare const LayoutLinkSchema: z.ZodObject<{
@@ -427,6 +442,7 @@ declare const LayoutLinkSchema: z.ZodObject<{
427
442
  yPt: z.ZodNumber;
428
443
  widthPt: z.ZodNumber;
429
444
  heightPt: z.ZodNumber;
445
+ sourcePath: z.ZodOptional<z.ZodString>;
430
446
  }, z.core.$strip>;
431
447
  type LayoutLink = z.infer<typeof LayoutLinkSchema>;
432
448
  declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -454,6 +470,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
454
470
  widthPt: z.ZodOptional<z.ZodNumber>;
455
471
  rotationDeg: z.ZodOptional<z.ZodNumber>;
456
472
  underline: z.ZodOptional<z.ZodBoolean>;
473
+ sourcePath: z.ZodOptional<z.ZodString>;
457
474
  }, z.core.$strip>, z.ZodObject<{
458
475
  kind: z.ZodLiteral<"image">;
459
476
  imageId: z.ZodString;
@@ -462,6 +479,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
462
479
  widthPt: z.ZodNumber;
463
480
  heightPt: z.ZodNumber;
464
481
  rotationDeg: z.ZodOptional<z.ZodNumber>;
482
+ sourcePath: z.ZodOptional<z.ZodString>;
465
483
  }, z.core.$strip>, z.ZodObject<{
466
484
  kind: z.ZodLiteral<"rect">;
467
485
  xPt: z.ZodNumber;
@@ -481,6 +499,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
481
499
  }, z.core.$strip>;
482
500
  widthPt: z.ZodNumber;
483
501
  }, z.core.$strip>>;
502
+ sourcePath: z.ZodOptional<z.ZodString>;
484
503
  }, z.core.$strip>, z.ZodObject<{
485
504
  kind: z.ZodLiteral<"line">;
486
505
  x1Pt: z.ZodNumber;
@@ -493,6 +512,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
493
512
  b: z.ZodNumber;
494
513
  }, z.core.$strip>;
495
514
  widthPt: z.ZodNumber;
515
+ sourcePath: z.ZodOptional<z.ZodString>;
496
516
  }, z.core.$strip>, z.ZodObject<{
497
517
  kind: z.ZodLiteral<"ellipse">;
498
518
  xPt: z.ZodNumber;
@@ -512,6 +532,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
512
532
  }, z.core.$strip>;
513
533
  widthPt: z.ZodNumber;
514
534
  }, z.core.$strip>>;
535
+ sourcePath: z.ZodOptional<z.ZodString>;
515
536
  }, z.core.$strip>, z.ZodObject<{
516
537
  kind: z.ZodLiteral<"link">;
517
538
  uri: z.ZodString;
@@ -519,6 +540,7 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
519
540
  yPt: z.ZodNumber;
520
541
  widthPt: z.ZodNumber;
521
542
  heightPt: z.ZodNumber;
543
+ sourcePath: z.ZodOptional<z.ZodString>;
522
544
  }, z.core.$strip>], "kind">;
523
545
  type LayoutItem = z.infer<typeof LayoutItemSchema>;
524
546
  declare const LayoutPageSchema: z.ZodObject<{
@@ -549,6 +571,7 @@ declare const LayoutPageSchema: z.ZodObject<{
549
571
  widthPt: z.ZodOptional<z.ZodNumber>;
550
572
  rotationDeg: z.ZodOptional<z.ZodNumber>;
551
573
  underline: z.ZodOptional<z.ZodBoolean>;
574
+ sourcePath: z.ZodOptional<z.ZodString>;
552
575
  }, z.core.$strip>, z.ZodObject<{
553
576
  kind: z.ZodLiteral<"image">;
554
577
  imageId: z.ZodString;
@@ -557,6 +580,7 @@ declare const LayoutPageSchema: z.ZodObject<{
557
580
  widthPt: z.ZodNumber;
558
581
  heightPt: z.ZodNumber;
559
582
  rotationDeg: z.ZodOptional<z.ZodNumber>;
583
+ sourcePath: z.ZodOptional<z.ZodString>;
560
584
  }, z.core.$strip>, z.ZodObject<{
561
585
  kind: z.ZodLiteral<"rect">;
562
586
  xPt: z.ZodNumber;
@@ -576,6 +600,7 @@ declare const LayoutPageSchema: z.ZodObject<{
576
600
  }, z.core.$strip>;
577
601
  widthPt: z.ZodNumber;
578
602
  }, z.core.$strip>>;
603
+ sourcePath: z.ZodOptional<z.ZodString>;
579
604
  }, z.core.$strip>, z.ZodObject<{
580
605
  kind: z.ZodLiteral<"line">;
581
606
  x1Pt: z.ZodNumber;
@@ -588,6 +613,7 @@ declare const LayoutPageSchema: z.ZodObject<{
588
613
  b: z.ZodNumber;
589
614
  }, z.core.$strip>;
590
615
  widthPt: z.ZodNumber;
616
+ sourcePath: z.ZodOptional<z.ZodString>;
591
617
  }, z.core.$strip>, z.ZodObject<{
592
618
  kind: z.ZodLiteral<"ellipse">;
593
619
  xPt: z.ZodNumber;
@@ -607,6 +633,7 @@ declare const LayoutPageSchema: z.ZodObject<{
607
633
  }, z.core.$strip>;
608
634
  widthPt: z.ZodNumber;
609
635
  }, z.core.$strip>>;
636
+ sourcePath: z.ZodOptional<z.ZodString>;
610
637
  }, z.core.$strip>, z.ZodObject<{
611
638
  kind: z.ZodLiteral<"link">;
612
639
  uri: z.ZodString;
@@ -614,6 +641,7 @@ declare const LayoutPageSchema: z.ZodObject<{
614
641
  yPt: z.ZodNumber;
615
642
  widthPt: z.ZodNumber;
616
643
  heightPt: z.ZodNumber;
644
+ sourcePath: z.ZodOptional<z.ZodString>;
617
645
  }, z.core.$strip>], "kind">>;
618
646
  notes: z.ZodOptional<z.ZodString>;
619
647
  }, z.core.$strip>;
@@ -668,6 +696,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
668
696
  widthPt: z.ZodOptional<z.ZodNumber>;
669
697
  rotationDeg: z.ZodOptional<z.ZodNumber>;
670
698
  underline: z.ZodOptional<z.ZodBoolean>;
699
+ sourcePath: z.ZodOptional<z.ZodString>;
671
700
  }, z.core.$strip>, z.ZodObject<{
672
701
  kind: z.ZodLiteral<"image">;
673
702
  imageId: z.ZodString;
@@ -676,6 +705,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
676
705
  widthPt: z.ZodNumber;
677
706
  heightPt: z.ZodNumber;
678
707
  rotationDeg: z.ZodOptional<z.ZodNumber>;
708
+ sourcePath: z.ZodOptional<z.ZodString>;
679
709
  }, z.core.$strip>, z.ZodObject<{
680
710
  kind: z.ZodLiteral<"rect">;
681
711
  xPt: z.ZodNumber;
@@ -695,6 +725,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
695
725
  }, z.core.$strip>;
696
726
  widthPt: z.ZodNumber;
697
727
  }, z.core.$strip>>;
728
+ sourcePath: z.ZodOptional<z.ZodString>;
698
729
  }, z.core.$strip>, z.ZodObject<{
699
730
  kind: z.ZodLiteral<"line">;
700
731
  x1Pt: z.ZodNumber;
@@ -707,6 +738,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
707
738
  b: z.ZodNumber;
708
739
  }, z.core.$strip>;
709
740
  widthPt: z.ZodNumber;
741
+ sourcePath: z.ZodOptional<z.ZodString>;
710
742
  }, z.core.$strip>, z.ZodObject<{
711
743
  kind: z.ZodLiteral<"ellipse">;
712
744
  xPt: z.ZodNumber;
@@ -726,6 +758,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
726
758
  }, z.core.$strip>;
727
759
  widthPt: z.ZodNumber;
728
760
  }, z.core.$strip>>;
761
+ sourcePath: z.ZodOptional<z.ZodString>;
729
762
  }, z.core.$strip>, z.ZodObject<{
730
763
  kind: z.ZodLiteral<"link">;
731
764
  uri: z.ZodString;
@@ -733,6 +766,7 @@ declare const LayoutDocumentSchema: z.ZodObject<{
733
766
  yPt: z.ZodNumber;
734
767
  widthPt: z.ZodNumber;
735
768
  heightPt: z.ZodNumber;
769
+ sourcePath: z.ZodOptional<z.ZodString>;
736
770
  }, z.core.$strip>], "kind">>;
737
771
  notes: z.ZodOptional<z.ZodString>;
738
772
  }, z.core.$strip>>;
package/dist/index.js CHANGED
@@ -107,7 +107,8 @@ const ContentRunSchema = z.object({
107
107
  fontFamily: z.string().optional(),
108
108
  sizePt: z.number().positive().optional(),
109
109
  color: ColorSchema.optional(),
110
- hyperlink: z.string().optional()
110
+ hyperlink: z.string().optional(),
111
+ sourcePath: z.string().optional()
111
112
  });
112
113
  const ContentListMembershipSchema = z.object({
113
114
  numId: z.string(),
@@ -123,7 +124,8 @@ const ContentParagraphSchema = z.object({
123
124
  spacingAfterPt: z.number().optional(),
124
125
  lineSpacing: z.number().positive().optional(),
125
126
  indentLeftPt: z.number().optional(),
126
- indentFirstLinePt: z.number().optional()
127
+ indentFirstLinePt: z.number().optional(),
128
+ sourcePath: z.string().optional()
127
129
  });
128
130
  const ContentImageBlockSchema = z.object({
129
131
  kind: z.literal("image"),
@@ -131,9 +133,13 @@ const ContentImageBlockSchema = z.object({
131
133
  base64: z.string(),
132
134
  widthPt: z.number().positive(),
133
135
  heightPt: z.number().positive(),
134
- altText: z.string().optional()
136
+ altText: z.string().optional(),
137
+ sourcePath: z.string().optional()
138
+ });
139
+ const ContentPageBreakSchema = z.object({
140
+ kind: z.literal("pageBreak"),
141
+ sourcePath: z.string().optional()
135
142
  });
136
- const ContentPageBreakSchema = z.object({ kind: z.literal("pageBreak") });
137
143
  function isRecord(value) {
138
144
  return typeof value === "object" && value !== null && !Array.isArray(value);
139
145
  }
@@ -169,7 +175,8 @@ const ContentTableRowSchema = z.object({
169
175
  const ContentTableSchema = z.object({
170
176
  kind: z.literal("table"),
171
177
  rows: z.array(ContentTableRowSchema),
172
- columnWidthsPt: z.array(z.number().positive())
178
+ columnWidthsPt: z.array(z.number().positive()),
179
+ sourcePath: z.string().optional()
173
180
  });
174
181
  const ContentSectionSchema = z.object({
175
182
  pageSize: PageSizeSchema,
@@ -186,6 +193,7 @@ const ContentShapeSchema = z.object({
186
193
  insetBottomPt: z.number().nonnegative(),
187
194
  fontScale: z.number().positive().optional(),
188
195
  lineSpacingReduction: z.number().nonnegative().optional(),
196
+ sourcePath: z.string().optional(),
189
197
  blocks: z.array(ContentBlockSchema)
190
198
  });
191
199
  const ContentSlideSchema = z.object({
@@ -218,7 +226,8 @@ const LayoutTextSchema = z.object({
218
226
  color: ColorSchema,
219
227
  widthPt: z.number().nonnegative().optional(),
220
228
  rotationDeg: z.number().optional(),
221
- underline: z.boolean().optional()
229
+ underline: z.boolean().optional(),
230
+ sourcePath: z.string().optional()
222
231
  });
223
232
  const LayoutImageSchema = z.object({
224
233
  kind: z.literal("image"),
@@ -227,7 +236,8 @@ const LayoutImageSchema = z.object({
227
236
  yPt: z.number(),
228
237
  widthPt: z.number().positive(),
229
238
  heightPt: z.number().positive(),
230
- rotationDeg: z.number().optional()
239
+ rotationDeg: z.number().optional(),
240
+ sourcePath: z.string().optional()
231
241
  });
232
242
  const LayoutRectSchema = z.object({
233
243
  kind: z.literal("rect"),
@@ -239,7 +249,8 @@ const LayoutRectSchema = z.object({
239
249
  stroke: z.object({
240
250
  color: ColorSchema,
241
251
  widthPt: z.number().positive()
242
- }).optional()
252
+ }).optional(),
253
+ sourcePath: z.string().optional()
243
254
  });
244
255
  const LayoutLineSchema = z.object({
245
256
  kind: z.literal("line"),
@@ -248,7 +259,8 @@ const LayoutLineSchema = z.object({
248
259
  x2Pt: z.number(),
249
260
  y2Pt: z.number(),
250
261
  color: ColorSchema,
251
- widthPt: z.number().positive()
262
+ widthPt: z.number().positive(),
263
+ sourcePath: z.string().optional()
252
264
  });
253
265
  const LayoutEllipseSchema = z.object({
254
266
  kind: z.literal("ellipse"),
@@ -260,7 +272,8 @@ const LayoutEllipseSchema = z.object({
260
272
  stroke: z.object({
261
273
  color: ColorSchema,
262
274
  widthPt: z.number().positive()
263
- }).optional()
275
+ }).optional(),
276
+ sourcePath: z.string().optional()
264
277
  });
265
278
  const LayoutLinkSchema = z.object({
266
279
  kind: z.literal("link"),
@@ -268,7 +281,8 @@ const LayoutLinkSchema = z.object({
268
281
  xPt: z.number(),
269
282
  yPt: z.number(),
270
283
  widthPt: z.number().nonnegative(),
271
- heightPt: z.number().nonnegative()
284
+ heightPt: z.number().nonnegative(),
285
+ sourcePath: z.string().optional()
272
286
  });
273
287
  const LayoutItemSchema = z.discriminatedUnion("kind", [
274
288
  LayoutTextSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-content-model",
3
- "version": "1.0.0",
3
+ "version": "1.1.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": {