document-schema.js 1.9.0 → 1.9.1
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
|
@@ -6,6 +6,35 @@
|
|
|
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
|
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TD
|
|
11
|
+
schema("document-schema.js")
|
|
12
|
+
ooxml("ooxml.js")
|
|
13
|
+
odf("odf.js")
|
|
14
|
+
pdfcodec("pdf-codec")
|
|
15
|
+
documents("documents.js")
|
|
16
|
+
cli("document-cli")
|
|
17
|
+
|
|
18
|
+
schema --> ooxml
|
|
19
|
+
schema --> odf
|
|
20
|
+
schema --> pdfcodec
|
|
21
|
+
schema --> documents
|
|
22
|
+
ooxml --> documents
|
|
23
|
+
odf --> documents
|
|
24
|
+
pdfcodec --> documents
|
|
25
|
+
documents --> cli
|
|
26
|
+
odf --> cli
|
|
27
|
+
|
|
28
|
+
click schema "https://github.com/ExaDev/document-schema.js" "document-schema.js"
|
|
29
|
+
click ooxml "https://github.com/ExaDev/ooxml.js" "ooxml.js"
|
|
30
|
+
click odf "https://github.com/ExaDev/odf.js" "odf.js"
|
|
31
|
+
click pdfcodec "https://github.com/ExaDev/pdf-codec" "pdf-codec"
|
|
32
|
+
click documents "https://github.com/ExaDev/documents.js" "documents.js"
|
|
33
|
+
click cli "https://github.com/ExaDev/document-cli" "document-cli"
|
|
34
|
+
|
|
35
|
+
style schema fill:#f9a825,stroke:#333,stroke-width:3px
|
|
36
|
+
```
|
|
37
|
+
|
|
9
38
|
`ContentDocument` (the semantic pivot) is a discriminated union of four kinds: `wordprocessing` (docx/odt-style sections of paragraphs/runs/tables/images), `presentation` (pptx/odp-style slides of shapes), `spreadsheet` (xlsx/ods-style sheets of cells, columns, rows, and print settings), and `drawing` (odg-style pages of shapes plus vector primitives -- rect/ellipse/line/path). `ContentEmbeddedObjectSchema` lets any of the four embed another whole `ContentDocument`. `LayoutDocument` (the PDF-rendering pivot) is pages of positioned `LayoutItem`s -- `text`/`image`/`rect`/`line`/`ellipse`/`path`/`link` -- in PDF user-space coordinates, with `LayoutPathSchema` modelling a general vector path rather than only axis-aligned rectangles. `DocumentPackageSchema` is a small envelope pairing the two: `content` required, `layout` optional (it's a derived artifact, absent until something lays the content out), correlated via each item's own `sourcePath` when both are present -- a pairing this schema does not itself keep in sync or detect as stale.
|
|
10
39
|
|
|
11
40
|
It contains only [Zod](https://zod.dev) schemas, their inferred types, and a handful of trivial schema-attached helpers (hex-colour conversion, a recursive structural type guard for the mutually-recursive table/block/embedded-object types). There is no XML, ZIP, PDF, or other binary handling here, and no `zod` dependency other than `zod` itself.
|
package/dist/index.cjs
CHANGED
|
@@ -544,7 +544,7 @@ const SCHEMA_FILE_NAMES = {
|
|
|
544
544
|
LayoutDocument: "layout-document.schema.json"
|
|
545
545
|
};
|
|
546
546
|
function schemaUriFor(kind) {
|
|
547
|
-
return `https://cdn.jsdelivr.net/npm/document-schema.js@1.9.
|
|
547
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/${SCHEMA_FILE_NAMES[kind]}`;
|
|
548
548
|
}
|
|
549
549
|
const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@[^/]+\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
|
|
550
550
|
function kindForFileStem(stem) {
|
package/dist/index.js
CHANGED
|
@@ -543,7 +543,7 @@ const SCHEMA_FILE_NAMES = {
|
|
|
543
543
|
LayoutDocument: "layout-document.schema.json"
|
|
544
544
|
};
|
|
545
545
|
function schemaUriFor(kind) {
|
|
546
|
-
return `https://cdn.jsdelivr.net/npm/document-schema.js@1.9.
|
|
546
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/${SCHEMA_FILE_NAMES[kind]}`;
|
|
547
547
|
}
|
|
548
548
|
const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@[^/]+\/schemas\/(document-package|content-document|layout-document)\.schema\.json$/;
|
|
549
549
|
function kindForFileStem(stem) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-schema.js",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
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": {
|
|
@@ -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@1.9.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/content-document.schema.json",
|
|
4
4
|
"oneOf": [
|
|
5
5
|
{
|
|
6
6
|
"type": "object",
|
|
@@ -930,7 +930,7 @@
|
|
|
930
930
|
]
|
|
931
931
|
},
|
|
932
932
|
"document": {
|
|
933
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.
|
|
933
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/content-document.schema.json"
|
|
934
934
|
},
|
|
935
935
|
"frame": {
|
|
936
936
|
"$ref": "#/$defs/Box"
|
|
@@ -2021,7 +2021,7 @@
|
|
|
2021
2021
|
]
|
|
2022
2022
|
},
|
|
2023
2023
|
"document": {
|
|
2024
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.
|
|
2024
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/content-document.schema.json"
|
|
2025
2025
|
},
|
|
2026
2026
|
"frame": {
|
|
2027
2027
|
"$ref": "#/$defs/Box"
|
|
@@ -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@1.9.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/document-package.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"formatVersion": {
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"const": 1
|
|
9
9
|
},
|
|
10
10
|
"content": {
|
|
11
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.
|
|
11
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/content-document.schema.json"
|
|
12
12
|
},
|
|
13
13
|
"layout": {
|
|
14
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.
|
|
14
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/layout-document.schema.json"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"required": [
|
|
@@ -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@1.9.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@1.9.1/schemas/layout-document.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"formatVersion": {
|