doc-model.js 2.5.0 → 2.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
CHANGED
|
@@ -52,6 +52,8 @@ graph TD
|
|
|
52
52
|
|
|
53
53
|
It contains only [Zod](https://zod.dev) schemas, their inferred types, a handful of trivial schema-attached helpers (hex-colour conversion, recursive structural type guards for the mutually-recursive table/block/embedded-object types and for the MathML node tree), and two small structural interfaces (`ContentCodec`/`LayoutCodec`, see [Codecs](#codecs) below) that a sibling package's own format codec can implement -- no runtime code of their own either. There is no XML, ZIP, PDF, or other binary handling here, and no `zod` dependency other than `zod` itself.
|
|
54
54
|
|
|
55
|
+
Beyond the schemas, the package ships two small format-agnostic helpers that live here rather than in any one format package because they operate on the content model itself: cell-addressing utilities in `src/a1.ts` (`columnIndexToLetters`/`columnLettersToIndex`, `cellReference(row, column)`/`parseCellReference`, `parseRangeReference`/`rangeReference`), shared by odf.js, ooxml.js, documents.js, document-cli, and document-mcp — the canonical A1-notation module, 0-based row/column indices with a row-first argument order matching `ContentSheetCell`'s own `{row, column}` field order; and the `FontFace` interface in `src/font-port.ts` (`{family, bold, italic}`, `ProvidedFont` minus `bytes`), the structured result of inspecting a standalone font file — a concept the content model already carries through its layout-side font fields.
|
|
56
|
+
|
|
55
57
|
The GitHub repository is [`ExaDev/document-schema.js`](https://github.com/ExaDev/document-schema.js), matching the published npm package name.
|
|
56
58
|
|
|
57
59
|
## Usage
|
package/dist/schema-io.cjs
CHANGED
|
@@ -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@2.5.
|
|
12
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/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@2.5.
|
|
11
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/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
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/schemas/content-document.schema.json",
|
|
4
4
|
"oneOf": [
|
|
5
5
|
{
|
|
6
6
|
"type": "object",
|
|
@@ -1208,7 +1208,7 @@
|
|
|
1208
1208
|
]
|
|
1209
1209
|
},
|
|
1210
1210
|
"document": {
|
|
1211
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
1211
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/schemas/content-document.schema.json"
|
|
1212
1212
|
},
|
|
1213
1213
|
"frame": {
|
|
1214
1214
|
"$ref": "#/$defs/Box"
|
|
@@ -2499,7 +2499,7 @@
|
|
|
2499
2499
|
]
|
|
2500
2500
|
},
|
|
2501
2501
|
"document": {
|
|
2502
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
2502
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/schemas/content-document.schema.json"
|
|
2503
2503
|
},
|
|
2504
2504
|
"frame": {
|
|
2505
2505
|
"$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@2.5.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/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@2.5.
|
|
11
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/schemas/content-document.schema.json"
|
|
12
12
|
},
|
|
13
13
|
"layout": {
|
|
14
|
-
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.
|
|
14
|
+
"$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/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@2.5.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.5.2/schemas/layout-document.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"formatVersion": {
|