document-content-model 1.5.1 → 1.5.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.
- package/README.md +4 -3
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/ExaDev/document-schema.js) [](https://www.npmjs.com/package/document-schema.js) [](https://github.com/ExaDev/document-schema.js/releases/latest) [](https://github.com/ExaDev/document-schema.js/actions)
|
|
4
4
|
|
|
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),
|
|
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), [documents.js](https://github.com/ExaDev/documents.js), and [pdf-codec](https://github.com/ExaDev/pdf-codec).
|
|
6
6
|
|
|
7
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`.
|
|
8
8
|
|
|
@@ -26,9 +26,10 @@ const pkg = DocumentPackageSchema.parse({ formatVersion: 1, content, layout });
|
|
|
26
26
|
|
|
27
27
|
- [ooxml.js](https://github.com/ExaDev/ooxml.js) — its `readDocx`/`readPptx`/`readXlsxContent` return `ContentSection[]`/`ContentSlide[]`/spreadsheet `ContentSheet[]` typed against this package's own schemas, not a locally-defined lookalike.
|
|
28
28
|
- [odf.js](https://github.com/ExaDev/odf.js) — its ODF typed readers (`readOdt`, `readOdp`, `readOds`, `readOdg`, …) return the same shared types, so an ODF document and an OOXML document speak the identical pivot.
|
|
29
|
-
- [documents.js](https://github.com/ExaDev/documents.js) — the primary consumer of both `ContentDocument` and `LayoutDocument`, which it converts between via its layout engines and
|
|
29
|
+
- [documents.js](https://github.com/ExaDev/documents.js) — the primary consumer of both `ContentDocument` and `LayoutDocument`, which it converts between via its layout engines and its `pdf-codec` dependency, and of `DocumentPackage` as the `onDocument` side-channel value its conversion functions hand back.
|
|
30
|
+
- [pdf-codec](https://github.com/ExaDev/pdf-codec) — the hand-written PDF codec extracted from `documents.js`: `readPdf`/`writePdf` and its own `pdfCodec` z.codec() pair operate entirely in terms of this package's `LayoutDocument` (plus the item kinds it's built from -- `LayoutItem`/`LayoutText`/`LayoutImage`/`LayoutRect`/`LayoutEllipse`/`LayoutLink`/`LayoutPath`/`LayoutSubpath`/`LayoutPathSegment`/`LayoutPage`/`LayoutImageAsset`/`LayoutMetadata`), `Color`/`LayoutFont` (aliased `LayoutColor`/`LayoutFont` at its own call sites), and `LAYOUT_FORMAT_VERSION`/`COLOR_BLACK`/`LayoutDocumentSchema` -- it never redeclares any of these itself, unlike its own `MathBox`/`PositionedFormula` mirror of `documents.js`'s MathML types (a deliberate, narrower exception -- see pdf-codec's own README).
|
|
30
31
|
|
|
31
|
-
None of these
|
|
32
|
+
None of these four packages depend on each other for this vocabulary — each depends on `document-schema.js` (or one of its aliases above) directly, which is the whole point: one schema, not four independently-maintained, drift-prone copies.
|
|
32
33
|
|
|
33
34
|
## License
|
|
34
35
|
|
package/dist/index.d.cts
CHANGED
|
@@ -46,12 +46,12 @@ type Alignment = z.infer<typeof AlignmentSchema>;
|
|
|
46
46
|
declare const LayoutFontSchema: z.ZodObject<{
|
|
47
47
|
family: z.ZodString;
|
|
48
48
|
weight: z.ZodEnum<{
|
|
49
|
-
normal: "normal";
|
|
50
49
|
bold: "bold";
|
|
50
|
+
normal: "normal";
|
|
51
51
|
}>;
|
|
52
52
|
style: z.ZodEnum<{
|
|
53
|
-
normal: "normal";
|
|
54
53
|
italic: "italic";
|
|
54
|
+
normal: "normal";
|
|
55
55
|
}>;
|
|
56
56
|
}, z.core.$strip>;
|
|
57
57
|
type LayoutFont = z.infer<typeof LayoutFontSchema>;
|
|
@@ -1264,12 +1264,12 @@ declare const LayoutTextSchema: z.ZodObject<{
|
|
|
1264
1264
|
font: z.ZodObject<{
|
|
1265
1265
|
family: z.ZodString;
|
|
1266
1266
|
weight: z.ZodEnum<{
|
|
1267
|
-
normal: "normal";
|
|
1268
1267
|
bold: "bold";
|
|
1268
|
+
normal: "normal";
|
|
1269
1269
|
}>;
|
|
1270
1270
|
style: z.ZodEnum<{
|
|
1271
|
-
normal: "normal";
|
|
1272
1271
|
italic: "italic";
|
|
1272
|
+
normal: "normal";
|
|
1273
1273
|
}>;
|
|
1274
1274
|
}, z.core.$strip>;
|
|
1275
1275
|
sizePt: z.ZodNumber;
|
|
@@ -1445,12 +1445,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1445
1445
|
font: z.ZodObject<{
|
|
1446
1446
|
family: z.ZodString;
|
|
1447
1447
|
weight: z.ZodEnum<{
|
|
1448
|
-
normal: "normal";
|
|
1449
1448
|
bold: "bold";
|
|
1449
|
+
normal: "normal";
|
|
1450
1450
|
}>;
|
|
1451
1451
|
style: z.ZodEnum<{
|
|
1452
|
-
normal: "normal";
|
|
1453
1452
|
italic: "italic";
|
|
1453
|
+
normal: "normal";
|
|
1454
1454
|
}>;
|
|
1455
1455
|
}, z.core.$strip>;
|
|
1456
1456
|
sizePt: z.ZodNumber;
|
|
@@ -1584,12 +1584,12 @@ declare const LayoutPageSchema: z.ZodObject<{
|
|
|
1584
1584
|
font: z.ZodObject<{
|
|
1585
1585
|
family: z.ZodString;
|
|
1586
1586
|
weight: z.ZodEnum<{
|
|
1587
|
-
normal: "normal";
|
|
1588
1587
|
bold: "bold";
|
|
1588
|
+
normal: "normal";
|
|
1589
1589
|
}>;
|
|
1590
1590
|
style: z.ZodEnum<{
|
|
1591
|
-
normal: "normal";
|
|
1592
1591
|
italic: "italic";
|
|
1592
|
+
normal: "normal";
|
|
1593
1593
|
}>;
|
|
1594
1594
|
}, z.core.$strip>;
|
|
1595
1595
|
sizePt: z.ZodNumber;
|
|
@@ -1747,12 +1747,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
|
|
|
1747
1747
|
font: z.ZodObject<{
|
|
1748
1748
|
family: z.ZodString;
|
|
1749
1749
|
weight: z.ZodEnum<{
|
|
1750
|
-
normal: "normal";
|
|
1751
1750
|
bold: "bold";
|
|
1751
|
+
normal: "normal";
|
|
1752
1752
|
}>;
|
|
1753
1753
|
style: z.ZodEnum<{
|
|
1754
|
-
normal: "normal";
|
|
1755
1754
|
italic: "italic";
|
|
1755
|
+
normal: "normal";
|
|
1756
1756
|
}>;
|
|
1757
1757
|
}, z.core.$strip>;
|
|
1758
1758
|
sizePt: z.ZodNumber;
|
|
@@ -2271,12 +2271,12 @@ declare const DocumentPackageSchema: z.ZodObject<{
|
|
|
2271
2271
|
font: z.ZodObject<{
|
|
2272
2272
|
family: z.ZodString;
|
|
2273
2273
|
weight: z.ZodEnum<{
|
|
2274
|
-
normal: "normal";
|
|
2275
2274
|
bold: "bold";
|
|
2275
|
+
normal: "normal";
|
|
2276
2276
|
}>;
|
|
2277
2277
|
style: z.ZodEnum<{
|
|
2278
|
-
normal: "normal";
|
|
2279
2278
|
italic: "italic";
|
|
2279
|
+
normal: "normal";
|
|
2280
2280
|
}>;
|
|
2281
2281
|
}, z.core.$strip>;
|
|
2282
2282
|
sizePt: z.ZodNumber;
|
package/dist/index.d.ts
CHANGED
|
@@ -46,12 +46,12 @@ type Alignment = z.infer<typeof AlignmentSchema>;
|
|
|
46
46
|
declare const LayoutFontSchema: z.ZodObject<{
|
|
47
47
|
family: z.ZodString;
|
|
48
48
|
weight: z.ZodEnum<{
|
|
49
|
-
normal: "normal";
|
|
50
49
|
bold: "bold";
|
|
50
|
+
normal: "normal";
|
|
51
51
|
}>;
|
|
52
52
|
style: z.ZodEnum<{
|
|
53
|
-
normal: "normal";
|
|
54
53
|
italic: "italic";
|
|
54
|
+
normal: "normal";
|
|
55
55
|
}>;
|
|
56
56
|
}, z.core.$strip>;
|
|
57
57
|
type LayoutFont = z.infer<typeof LayoutFontSchema>;
|
|
@@ -1264,12 +1264,12 @@ declare const LayoutTextSchema: z.ZodObject<{
|
|
|
1264
1264
|
font: z.ZodObject<{
|
|
1265
1265
|
family: z.ZodString;
|
|
1266
1266
|
weight: z.ZodEnum<{
|
|
1267
|
-
normal: "normal";
|
|
1268
1267
|
bold: "bold";
|
|
1268
|
+
normal: "normal";
|
|
1269
1269
|
}>;
|
|
1270
1270
|
style: z.ZodEnum<{
|
|
1271
|
-
normal: "normal";
|
|
1272
1271
|
italic: "italic";
|
|
1272
|
+
normal: "normal";
|
|
1273
1273
|
}>;
|
|
1274
1274
|
}, z.core.$strip>;
|
|
1275
1275
|
sizePt: z.ZodNumber;
|
|
@@ -1445,12 +1445,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1445
1445
|
font: z.ZodObject<{
|
|
1446
1446
|
family: z.ZodString;
|
|
1447
1447
|
weight: z.ZodEnum<{
|
|
1448
|
-
normal: "normal";
|
|
1449
1448
|
bold: "bold";
|
|
1449
|
+
normal: "normal";
|
|
1450
1450
|
}>;
|
|
1451
1451
|
style: z.ZodEnum<{
|
|
1452
|
-
normal: "normal";
|
|
1453
1452
|
italic: "italic";
|
|
1453
|
+
normal: "normal";
|
|
1454
1454
|
}>;
|
|
1455
1455
|
}, z.core.$strip>;
|
|
1456
1456
|
sizePt: z.ZodNumber;
|
|
@@ -1584,12 +1584,12 @@ declare const LayoutPageSchema: z.ZodObject<{
|
|
|
1584
1584
|
font: z.ZodObject<{
|
|
1585
1585
|
family: z.ZodString;
|
|
1586
1586
|
weight: z.ZodEnum<{
|
|
1587
|
-
normal: "normal";
|
|
1588
1587
|
bold: "bold";
|
|
1588
|
+
normal: "normal";
|
|
1589
1589
|
}>;
|
|
1590
1590
|
style: z.ZodEnum<{
|
|
1591
|
-
normal: "normal";
|
|
1592
1591
|
italic: "italic";
|
|
1592
|
+
normal: "normal";
|
|
1593
1593
|
}>;
|
|
1594
1594
|
}, z.core.$strip>;
|
|
1595
1595
|
sizePt: z.ZodNumber;
|
|
@@ -1747,12 +1747,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
|
|
|
1747
1747
|
font: z.ZodObject<{
|
|
1748
1748
|
family: z.ZodString;
|
|
1749
1749
|
weight: z.ZodEnum<{
|
|
1750
|
-
normal: "normal";
|
|
1751
1750
|
bold: "bold";
|
|
1751
|
+
normal: "normal";
|
|
1752
1752
|
}>;
|
|
1753
1753
|
style: z.ZodEnum<{
|
|
1754
|
-
normal: "normal";
|
|
1755
1754
|
italic: "italic";
|
|
1755
|
+
normal: "normal";
|
|
1756
1756
|
}>;
|
|
1757
1757
|
}, z.core.$strip>;
|
|
1758
1758
|
sizePt: z.ZodNumber;
|
|
@@ -2271,12 +2271,12 @@ declare const DocumentPackageSchema: z.ZodObject<{
|
|
|
2271
2271
|
font: z.ZodObject<{
|
|
2272
2272
|
family: z.ZodString;
|
|
2273
2273
|
weight: z.ZodEnum<{
|
|
2274
|
-
normal: "normal";
|
|
2275
2274
|
bold: "bold";
|
|
2275
|
+
normal: "normal";
|
|
2276
2276
|
}>;
|
|
2277
2277
|
style: z.ZodEnum<{
|
|
2278
|
-
normal: "normal";
|
|
2279
2278
|
italic: "italic";
|
|
2279
|
+
normal: "normal";
|
|
2280
2280
|
}>;
|
|
2281
2281
|
}, z.core.$strip>;
|
|
2282
2282
|
sizePt: z.ZodNumber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-content-model",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
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": {
|