document-schema.js 2.1.0 → 2.2.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.
@@ -283,7 +283,19 @@ const CONTENT_DEFS = {
283
283
  },
284
284
  document: { $ref: CONTENT_DOCUMENT_URI },
285
285
  frame: { $ref: "#/$defs/Box" },
286
- sourcePath: { type: "string" }
286
+ sourcePath: { type: "string" },
287
+ anchorRow: {
288
+ type: "integer",
289
+ minimum: 0,
290
+ maximum: MAX_SAFE_INTEGER
291
+ },
292
+ anchorColumn: {
293
+ type: "integer",
294
+ minimum: 0,
295
+ maximum: MAX_SAFE_INTEGER
296
+ },
297
+ offsetXPt: { type: "number" },
298
+ offsetYPt: { type: "number" }
287
299
  },
288
300
  required: [
289
301
  "kind",
@@ -282,7 +282,19 @@ const CONTENT_DEFS = {
282
282
  },
283
283
  document: { $ref: CONTENT_DOCUMENT_URI },
284
284
  frame: { $ref: "#/$defs/Box" },
285
- sourcePath: { type: "string" }
285
+ sourcePath: { type: "string" },
286
+ anchorRow: {
287
+ type: "integer",
288
+ minimum: 0,
289
+ maximum: MAX_SAFE_INTEGER
290
+ },
291
+ anchorColumn: {
292
+ type: "integer",
293
+ minimum: 0,
294
+ maximum: MAX_SAFE_INTEGER
295
+ },
296
+ offsetXPt: { type: "number" },
297
+ offsetYPt: { type: "number" }
286
298
  },
287
299
  required: [
288
300
  "kind",
package/dist/content.cjs CHANGED
@@ -64,7 +64,7 @@ function isContentEmbeddedObjectKind(value) {
64
64
  return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing";
65
65
  }
66
66
  function isContentEmbeddedObject(value) {
67
- return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && require_geometry.BoxSchema.safeParse(value.frame).success && ContentDocumentSchema.safeParse(value.document).success;
67
+ return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && require_geometry.BoxSchema.safeParse(value.frame).success && ContentDocumentSchema.safeParse(value.document).success && (value.anchorRow === void 0 || typeof value.anchorRow === "number" && Number.isInteger(value.anchorRow) && value.anchorRow >= 0) && (value.anchorColumn === void 0 || typeof value.anchorColumn === "number" && Number.isInteger(value.anchorColumn) && value.anchorColumn >= 0) && (value.offsetXPt === void 0 || typeof value.offsetXPt === "number") && (value.offsetYPt === void 0 || typeof value.offsetYPt === "number");
68
68
  }
69
69
  function isContentEmbeddedObjectBlock(value) {
70
70
  return isRecord(value) && value.kind === "embeddedObject" && isContentEmbeddedObject(value);
@@ -103,6 +103,10 @@ interface ContentEmbeddedObject {
103
103
  objectKind: ContentEmbeddedObjectKind;
104
104
  document: ContentDocument;
105
105
  frame: Box;
106
+ anchorRow?: number;
107
+ anchorColumn?: number;
108
+ offsetXPt?: number;
109
+ offsetYPt?: number;
106
110
  }
107
111
  interface ContentEmbeddedObjectBlock extends ContentEmbeddedObject {
108
112
  kind: 'embeddedObject';
package/dist/content.d.ts CHANGED
@@ -103,6 +103,10 @@ interface ContentEmbeddedObject {
103
103
  objectKind: ContentEmbeddedObjectKind;
104
104
  document: ContentDocument;
105
105
  frame: Box;
106
+ anchorRow?: number;
107
+ anchorColumn?: number;
108
+ offsetXPt?: number;
109
+ offsetYPt?: number;
106
110
  }
107
111
  interface ContentEmbeddedObjectBlock extends ContentEmbeddedObject {
108
112
  kind: 'embeddedObject';
package/dist/content.js CHANGED
@@ -63,7 +63,7 @@ function isContentEmbeddedObjectKind(value) {
63
63
  return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing";
64
64
  }
65
65
  function isContentEmbeddedObject(value) {
66
- return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && BoxSchema.safeParse(value.frame).success && ContentDocumentSchema.safeParse(value.document).success;
66
+ return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && BoxSchema.safeParse(value.frame).success && ContentDocumentSchema.safeParse(value.document).success && (value.anchorRow === void 0 || typeof value.anchorRow === "number" && Number.isInteger(value.anchorRow) && value.anchorRow >= 0) && (value.anchorColumn === void 0 || typeof value.anchorColumn === "number" && Number.isInteger(value.anchorColumn) && value.anchorColumn >= 0) && (value.offsetXPt === void 0 || typeof value.offsetXPt === "number") && (value.offsetYPt === void 0 || typeof value.offsetYPt === "number");
67
67
  }
68
68
  function isContentEmbeddedObjectBlock(value) {
69
69
  return isRecord(value) && value.kind === "embeddedObject" && isContentEmbeddedObject(value);
package/dist/layout.d.cts CHANGED
@@ -9,12 +9,12 @@ declare const LayoutTextSchema: z.ZodObject<{
9
9
  font: z.ZodObject<{
10
10
  family: z.ZodString;
11
11
  weight: z.ZodEnum<{
12
- normal: "normal";
13
12
  bold: "bold";
13
+ normal: "normal";
14
14
  }>;
15
15
  style: z.ZodEnum<{
16
- normal: "normal";
17
16
  italic: "italic";
17
+ normal: "normal";
18
18
  }>;
19
19
  }, z.core.$strip>;
20
20
  sizePt: z.ZodNumber;
@@ -202,12 +202,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
202
202
  font: z.ZodObject<{
203
203
  family: z.ZodString;
204
204
  weight: z.ZodEnum<{
205
- normal: "normal";
206
205
  bold: "bold";
206
+ normal: "normal";
207
207
  }>;
208
208
  style: z.ZodEnum<{
209
- normal: "normal";
210
209
  italic: "italic";
210
+ normal: "normal";
211
211
  }>;
212
212
  }, z.core.$strip>;
213
213
  sizePt: z.ZodNumber;
@@ -353,12 +353,12 @@ declare const LayoutPageSchema: z.ZodObject<{
353
353
  font: z.ZodObject<{
354
354
  family: z.ZodString;
355
355
  weight: z.ZodEnum<{
356
- normal: "normal";
357
356
  bold: "bold";
357
+ normal: "normal";
358
358
  }>;
359
359
  style: z.ZodEnum<{
360
- normal: "normal";
361
360
  italic: "italic";
361
+ normal: "normal";
362
362
  }>;
363
363
  }, z.core.$strip>;
364
364
  sizePt: z.ZodNumber;
@@ -528,12 +528,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
528
528
  font: z.ZodObject<{
529
529
  family: z.ZodString;
530
530
  weight: z.ZodEnum<{
531
- normal: "normal";
532
531
  bold: "bold";
532
+ normal: "normal";
533
533
  }>;
534
534
  style: z.ZodEnum<{
535
- normal: "normal";
536
535
  italic: "italic";
536
+ normal: "normal";
537
537
  }>;
538
538
  }, z.core.$strip>;
539
539
  sizePt: z.ZodNumber;
package/dist/layout.d.ts CHANGED
@@ -9,12 +9,12 @@ declare const LayoutTextSchema: z.ZodObject<{
9
9
  font: z.ZodObject<{
10
10
  family: z.ZodString;
11
11
  weight: z.ZodEnum<{
12
- normal: "normal";
13
12
  bold: "bold";
13
+ normal: "normal";
14
14
  }>;
15
15
  style: z.ZodEnum<{
16
- normal: "normal";
17
16
  italic: "italic";
17
+ normal: "normal";
18
18
  }>;
19
19
  }, z.core.$strip>;
20
20
  sizePt: z.ZodNumber;
@@ -202,12 +202,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
202
202
  font: z.ZodObject<{
203
203
  family: z.ZodString;
204
204
  weight: z.ZodEnum<{
205
- normal: "normal";
206
205
  bold: "bold";
206
+ normal: "normal";
207
207
  }>;
208
208
  style: z.ZodEnum<{
209
- normal: "normal";
210
209
  italic: "italic";
210
+ normal: "normal";
211
211
  }>;
212
212
  }, z.core.$strip>;
213
213
  sizePt: z.ZodNumber;
@@ -353,12 +353,12 @@ declare const LayoutPageSchema: z.ZodObject<{
353
353
  font: z.ZodObject<{
354
354
  family: z.ZodString;
355
355
  weight: z.ZodEnum<{
356
- normal: "normal";
357
356
  bold: "bold";
357
+ normal: "normal";
358
358
  }>;
359
359
  style: z.ZodEnum<{
360
- normal: "normal";
361
360
  italic: "italic";
361
+ normal: "normal";
362
362
  }>;
363
363
  }, z.core.$strip>;
364
364
  sizePt: z.ZodNumber;
@@ -528,12 +528,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
528
528
  font: z.ZodObject<{
529
529
  family: z.ZodString;
530
530
  weight: z.ZodEnum<{
531
- normal: "normal";
532
531
  bold: "bold";
532
+ normal: "normal";
533
533
  }>;
534
534
  style: z.ZodEnum<{
535
- normal: "normal";
536
535
  italic: "italic";
536
+ normal: "normal";
537
537
  }>;
538
538
  }, z.core.$strip>;
539
539
  sizePt: z.ZodNumber;
@@ -515,12 +515,12 @@ declare const DocumentPackageSchema: z.ZodObject<{
515
515
  font: z.ZodObject<{
516
516
  family: z.ZodString;
517
517
  weight: z.ZodEnum<{
518
- normal: "normal";
519
518
  bold: "bold";
519
+ normal: "normal";
520
520
  }>;
521
521
  style: z.ZodEnum<{
522
- normal: "normal";
523
522
  italic: "italic";
523
+ normal: "normal";
524
524
  }>;
525
525
  }, z.core.$strip>;
526
526
  sizePt: z.ZodNumber;
package/dist/package.d.ts CHANGED
@@ -515,12 +515,12 @@ declare const DocumentPackageSchema: z.ZodObject<{
515
515
  font: z.ZodObject<{
516
516
  family: z.ZodString;
517
517
  weight: z.ZodEnum<{
518
- normal: "normal";
519
518
  bold: "bold";
519
+ normal: "normal";
520
520
  }>;
521
521
  style: z.ZodEnum<{
522
- normal: "normal";
523
522
  italic: "italic";
523
+ normal: "normal";
524
524
  }>;
525
525
  }, z.core.$strip>;
526
526
  sizePt: z.ZodNumber;
@@ -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.1.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
12
+ return `https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/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.1.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
11
+ return `https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/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/dist/style.d.cts CHANGED
@@ -10,12 +10,12 @@ type Alignment = z.infer<typeof AlignmentSchema>;
10
10
  declare const LayoutFontSchema: z.ZodObject<{
11
11
  family: z.ZodString;
12
12
  weight: z.ZodEnum<{
13
- normal: "normal";
14
13
  bold: "bold";
14
+ normal: "normal";
15
15
  }>;
16
16
  style: z.ZodEnum<{
17
- normal: "normal";
18
17
  italic: "italic";
18
+ normal: "normal";
19
19
  }>;
20
20
  }, z.core.$strip>;
21
21
  type LayoutFont = z.infer<typeof LayoutFontSchema>;
package/dist/style.d.ts CHANGED
@@ -10,12 +10,12 @@ type Alignment = z.infer<typeof AlignmentSchema>;
10
10
  declare const LayoutFontSchema: z.ZodObject<{
11
11
  family: z.ZodString;
12
12
  weight: z.ZodEnum<{
13
- normal: "normal";
14
13
  bold: "bold";
14
+ normal: "normal";
15
15
  }>;
16
16
  style: z.ZodEnum<{
17
- normal: "normal";
18
17
  italic: "italic";
18
+ normal: "normal";
19
19
  }>;
20
20
  }, z.core.$strip>;
21
21
  type LayoutFont = z.infer<typeof LayoutFontSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-schema.js",
3
- "version": "2.1.0",
3
+ "version": "2.2.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@2.1.0/schemas/content-document.schema.json",
3
+ "$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/schemas/content-document.schema.json",
4
4
  "oneOf": [
5
5
  {
6
6
  "type": "object",
@@ -1208,10 +1208,26 @@
1208
1208
  ]
1209
1209
  },
1210
1210
  "document": {
1211
- "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.1.0/schemas/content-document.schema.json"
1211
+ "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/schemas/content-document.schema.json"
1212
1212
  },
1213
1213
  "frame": {
1214
1214
  "$ref": "#/$defs/Box"
1215
+ },
1216
+ "anchorRow": {
1217
+ "type": "integer",
1218
+ "minimum": 0,
1219
+ "maximum": 9007199254740991
1220
+ },
1221
+ "anchorColumn": {
1222
+ "type": "integer",
1223
+ "minimum": 0,
1224
+ "maximum": 9007199254740991
1225
+ },
1226
+ "offsetXPt": {
1227
+ "type": "number"
1228
+ },
1229
+ "offsetYPt": {
1230
+ "type": "number"
1215
1231
  }
1216
1232
  },
1217
1233
  "required": [
@@ -2483,13 +2499,29 @@
2483
2499
  ]
2484
2500
  },
2485
2501
  "document": {
2486
- "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.1.0/schemas/content-document.schema.json"
2502
+ "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/schemas/content-document.schema.json"
2487
2503
  },
2488
2504
  "frame": {
2489
2505
  "$ref": "#/$defs/Box"
2490
2506
  },
2491
2507
  "sourcePath": {
2492
2508
  "type": "string"
2509
+ },
2510
+ "anchorRow": {
2511
+ "type": "integer",
2512
+ "minimum": 0,
2513
+ "maximum": 9007199254740991
2514
+ },
2515
+ "anchorColumn": {
2516
+ "type": "integer",
2517
+ "minimum": 0,
2518
+ "maximum": 9007199254740991
2519
+ },
2520
+ "offsetXPt": {
2521
+ "type": "number"
2522
+ },
2523
+ "offsetYPt": {
2524
+ "type": "number"
2493
2525
  }
2494
2526
  },
2495
2527
  "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.1.0/schemas/document-package.schema.json",
3
+ "$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.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@2.1.0/schemas/content-document.schema.json"
11
+ "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/schemas/content-document.schema.json"
12
12
  },
13
13
  "layout": {
14
- "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.1.0/schemas/layout-document.schema.json"
14
+ "$ref": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.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@2.1.0/schemas/layout-document.schema.json",
3
+ "$id": "https://cdn.jsdelivr.net/npm/document-schema.js@2.2.1/schemas/layout-document.schema.json",
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "formatVersion": {