document-schema 7.11.5 → 7.13.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 +6 -0
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{content-DWSflkUJ.d.cts → content-CvvaHPSp.d.cts} +34 -34
- package/dist/{content-C5CsxSt1.d.ts → content-DbjeTN2j.d.ts} +34 -34
- package/dist/content.d.cts +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/decompose.d.cts +2 -2
- package/dist/decompose.d.ts +2 -2
- package/dist/definitions.d.cts +4 -4
- package/dist/definitions.d.ts +4 -4
- package/dist/factor-styles.d.cts +1 -1
- package/dist/factor-styles.d.ts +1 -1
- package/dist/flatten.d.cts +1 -1
- package/dist/flatten.d.ts +1 -1
- package/dist/index.cjs +9 -0
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -1
- package/dist/{package-node-5OqgGCtu.d.ts → package-node--fbVCVcl.d.ts} +10 -10
- package/dist/{package-node-DK-b0h6V.d.cts → package-node-D7WUiIDz.d.cts} +10 -10
- package/dist/package-node.d.cts +1 -1
- package/dist/package-node.d.ts +1 -1
- package/dist/package.d.cts +6 -6
- package/dist/package.d.ts +6 -6
- package/dist/schema-io.cjs +2 -2
- package/dist/schema-io.d.cts +1 -1
- package/dist/schema-io.d.ts +1 -1
- package/dist/schema-io.js +2 -2
- package/dist/{style-D06NwxAJ.d.cts → style-BGMcYrD2.d.cts} +1 -1
- package/dist/{style-D06NwxAJ.d.ts → style-BGMcYrD2.d.ts} +1 -1
- package/dist/style.d.cts +1 -1
- package/dist/style.d.ts +1 -1
- package/dist/table-grid.cjs +204 -0
- package/dist/table-grid.d.cts +112 -0
- package/dist/table-grid.d.ts +112 -0
- package/dist/table-grid.js +196 -0
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/content-document.schema.json +16 -16
- package/schemas/document-tree.schema.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as ContentEmbeddedObject, Gt as ContentSheetImage, Sn as ContentVector, W as ContentFormula, _ as ContentConstructEnd, a as ContentBlock, y as ContentConstructStart } from "./content-
|
|
1
|
+
import { D as ContentEmbeddedObject, Gt as ContentSheetImage, Sn as ContentVector, W as ContentFormula, _ as ContentConstructEnd, a as ContentBlock, y as ContentConstructStart } from "./content-CvvaHPSp.cjs";
|
|
2
2
|
import { a as ConstructDescriptor } from "./construct-GVdTKrE7.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/package-node.d.ts
|
|
@@ -85,6 +85,7 @@ declare const SectionDescriptorSchema: z.ZodObject<{
|
|
|
85
85
|
}, z.core.$strict>;
|
|
86
86
|
type SectionDescriptor = z.infer<typeof SectionDescriptorSchema>;
|
|
87
87
|
declare const SlideDescriptorSchema: z.ZodObject<{
|
|
88
|
+
notes: z.ZodString;
|
|
88
89
|
source: z.ZodOptional<z.ZodObject<{
|
|
89
90
|
format: z.ZodEnum<{
|
|
90
91
|
docx: "docx";
|
|
@@ -105,7 +106,6 @@ declare const SlideDescriptorSchema: z.ZodObject<{
|
|
|
105
106
|
}>;
|
|
106
107
|
xml: z.ZodString;
|
|
107
108
|
}, z.core.$strict>>;
|
|
108
|
-
notes: z.ZodString;
|
|
109
109
|
origin: z.ZodOptional<z.ZodEnum<{
|
|
110
110
|
chart: "chart";
|
|
111
111
|
diagram: "diagram";
|
|
@@ -161,7 +161,6 @@ declare const SheetDescriptorSchema: z.ZodObject<{
|
|
|
161
161
|
}>;
|
|
162
162
|
xml: z.ZodString;
|
|
163
163
|
}, z.core.$strict>>;
|
|
164
|
-
name: z.ZodString;
|
|
165
164
|
origin: z.ZodOptional<z.ZodEnum<{
|
|
166
165
|
chart: "chart";
|
|
167
166
|
diagram: "diagram";
|
|
@@ -189,6 +188,7 @@ declare const SheetDescriptorSchema: z.ZodObject<{
|
|
|
189
188
|
at: z.ZodString;
|
|
190
189
|
}, z.core.$strip>>;
|
|
191
190
|
}, z.core.$strip>>;
|
|
191
|
+
name: z.ZodString;
|
|
192
192
|
printSettings: z.ZodObject<{
|
|
193
193
|
pageSize: z.ZodObject<{
|
|
194
194
|
widthPt: z.ZodNumber;
|
|
@@ -552,8 +552,8 @@ declare const SheetDescriptorSchema: z.ZodObject<{
|
|
|
552
552
|
}, z.core.$strip>>;
|
|
553
553
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
554
554
|
left: "left";
|
|
555
|
-
center: "center";
|
|
556
555
|
right: "right";
|
|
556
|
+
center: "center";
|
|
557
557
|
justify: "justify";
|
|
558
558
|
}>>;
|
|
559
559
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -617,10 +617,10 @@ declare const SheetDescriptorSchema: z.ZodObject<{
|
|
|
617
617
|
endColumn: z.ZodNumber;
|
|
618
618
|
}, z.core.$strip>>;
|
|
619
619
|
type: z.ZodEnum<{
|
|
620
|
-
decimal: "decimal";
|
|
621
|
-
list: "list";
|
|
622
620
|
date: "date";
|
|
623
621
|
custom: "custom";
|
|
622
|
+
decimal: "decimal";
|
|
623
|
+
list: "list";
|
|
624
624
|
time: "time";
|
|
625
625
|
whole: "whole";
|
|
626
626
|
textLength: "textLength";
|
|
@@ -1298,6 +1298,7 @@ declare const DrawPageDescriptorSchema: z.ZodObject<{
|
|
|
1298
1298
|
}, z.core.$strict>;
|
|
1299
1299
|
type DrawPageDescriptor = z.infer<typeof DrawPageDescriptorSchema>;
|
|
1300
1300
|
declare const ShapeDescriptorSchema: z.ZodObject<{
|
|
1301
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
1301
1302
|
source: z.ZodOptional<z.ZodObject<{
|
|
1302
1303
|
format: z.ZodEnum<{
|
|
1303
1304
|
docx: "docx";
|
|
@@ -1318,8 +1319,6 @@ declare const ShapeDescriptorSchema: z.ZodObject<{
|
|
|
1318
1319
|
}>;
|
|
1319
1320
|
xml: z.ZodString;
|
|
1320
1321
|
}, z.core.$strict>>;
|
|
1321
|
-
name: z.ZodOptional<z.ZodString>;
|
|
1322
|
-
sourcePath: z.ZodOptional<z.ZodString>;
|
|
1323
1322
|
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1324
1323
|
pageIndex: z.ZodNumber;
|
|
1325
1324
|
xPt: z.ZodNumber;
|
|
@@ -1354,6 +1353,7 @@ declare const ShapeDescriptorSchema: z.ZodObject<{
|
|
|
1354
1353
|
at: z.ZodString;
|
|
1355
1354
|
}, z.core.$strip>>;
|
|
1356
1355
|
}, z.core.$strip>>;
|
|
1356
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1357
1357
|
frame: z.ZodObject<{
|
|
1358
1358
|
xPt: z.ZodNumber;
|
|
1359
1359
|
yPt: z.ZodNumber;
|
|
@@ -1677,8 +1677,8 @@ declare const HeadingParagraphSchema: z.ZodObject<{
|
|
|
1677
1677
|
preformatted: z.ZodOptional<z.ZodBoolean>;
|
|
1678
1678
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1679
1679
|
left: "left";
|
|
1680
|
-
center: "center";
|
|
1681
1680
|
right: "right";
|
|
1681
|
+
center: "center";
|
|
1682
1682
|
justify: "justify";
|
|
1683
1683
|
}>>;
|
|
1684
1684
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -2103,8 +2103,8 @@ declare const ListParagraphSchema: z.ZodObject<{
|
|
|
2103
2103
|
headingLevel: z.ZodOptional<z.ZodNumber>;
|
|
2104
2104
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
2105
2105
|
left: "left";
|
|
2106
|
-
center: "center";
|
|
2107
2106
|
right: "right";
|
|
2107
|
+
center: "center";
|
|
2108
2108
|
justify: "justify";
|
|
2109
2109
|
}>>;
|
|
2110
2110
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
package/dist/package-node.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as isSheetGroupNode, A as SheetDescriptor, B as TreeGroup, C as ShapeConstructGroupNode, D as ShapeGroupNode, E as ShapeDescriptorSchema, F as SlideDescriptorSchema, G as TreeNodeSchema, H as TreeLeaf, I as SlideGroupNode, J as isListGroupNode, K as isDrawPageGroupNode, L as SlideGroupSchema, M as SheetGroupNode, N as SheetGroupSchema, O as ShapeGroupSchema, P as SlideDescriptor, Q as isShapeGroupNode, R as TreeBlockLeaf, S as ShapeChild, T as ShapeDescriptor, U as TreeLeafSchema, V as TreeGroupSchema, W as TreeNode, X as isSectionGroupNode, Y as isSectionConstructGroupNode, Z as isShapeConstructGroupNode, _ as SectionConstructGroupSchema, a as DrawPageGroupSchema, b as SectionGroupNode, c as HeadingParagraph, d as ListGroupNode, et as isSlideGroupNode, f as ListGroupSchema, g as SectionConstructGroupNode, h as SectionChild, i as DrawPageGroupNode, it as isTreeNode, j as SheetDescriptorSchema, k as SheetChild, l as HeadingParagraphSchema, m as ListParagraphSchema, n as DrawPageDescriptor, nt as isTreeGroup, o as HeadingGroupNode, p as ListParagraph, q as isHeadingGroupNode, r as DrawPageDescriptorSchema, rt as isTreeLeaf, s as HeadingGroupSchema, t as DrawPageChild, tt as isTreeBlockLeaf, u as ListChild, v as SectionDescriptor, w as ShapeConstructGroupSchema, x as SectionGroupSchema, y as SectionDescriptorSchema, z as TreeBlockLeafSchema } from "./package-node-
|
|
1
|
+
import { $ as isSheetGroupNode, A as SheetDescriptor, B as TreeGroup, C as ShapeConstructGroupNode, D as ShapeGroupNode, E as ShapeDescriptorSchema, F as SlideDescriptorSchema, G as TreeNodeSchema, H as TreeLeaf, I as SlideGroupNode, J as isListGroupNode, K as isDrawPageGroupNode, L as SlideGroupSchema, M as SheetGroupNode, N as SheetGroupSchema, O as ShapeGroupSchema, P as SlideDescriptor, Q as isShapeGroupNode, R as TreeBlockLeaf, S as ShapeChild, T as ShapeDescriptor, U as TreeLeafSchema, V as TreeGroupSchema, W as TreeNode, X as isSectionGroupNode, Y as isSectionConstructGroupNode, Z as isShapeConstructGroupNode, _ as SectionConstructGroupSchema, a as DrawPageGroupSchema, b as SectionGroupNode, c as HeadingParagraph, d as ListGroupNode, et as isSlideGroupNode, f as ListGroupSchema, g as SectionConstructGroupNode, h as SectionChild, i as DrawPageGroupNode, it as isTreeNode, j as SheetDescriptorSchema, k as SheetChild, l as HeadingParagraphSchema, m as ListParagraphSchema, n as DrawPageDescriptor, nt as isTreeGroup, o as HeadingGroupNode, p as ListParagraph, q as isHeadingGroupNode, r as DrawPageDescriptorSchema, rt as isTreeLeaf, s as HeadingGroupSchema, t as DrawPageChild, tt as isTreeBlockLeaf, u as ListChild, v as SectionDescriptor, w as ShapeConstructGroupSchema, x as SectionGroupSchema, y as SectionDescriptorSchema, z as TreeBlockLeafSchema } from "./package-node-D7WUiIDz.cjs";
|
|
2
2
|
export { DrawPageChild, DrawPageDescriptor, DrawPageDescriptorSchema, DrawPageGroupNode, DrawPageGroupSchema, HeadingGroupNode, HeadingGroupSchema, HeadingParagraph, HeadingParagraphSchema, ListChild, ListGroupNode, ListGroupSchema, ListParagraph, ListParagraphSchema, SectionChild, SectionConstructGroupNode, SectionConstructGroupSchema, SectionDescriptor, SectionDescriptorSchema, SectionGroupNode, SectionGroupSchema, ShapeChild, ShapeConstructGroupNode, ShapeConstructGroupSchema, ShapeDescriptor, ShapeDescriptorSchema, ShapeGroupNode, ShapeGroupSchema, SheetChild, SheetDescriptor, SheetDescriptorSchema, SheetGroupNode, SheetGroupSchema, SlideDescriptor, SlideDescriptorSchema, SlideGroupNode, SlideGroupSchema, TreeBlockLeaf, TreeBlockLeafSchema, TreeGroup, TreeGroupSchema, TreeLeaf, TreeLeafSchema, TreeNode, TreeNodeSchema, isDrawPageGroupNode, isHeadingGroupNode, isListGroupNode, isSectionConstructGroupNode, isSectionGroupNode, isShapeConstructGroupNode, isShapeGroupNode, isSheetGroupNode, isSlideGroupNode, isTreeBlockLeaf, isTreeGroup, isTreeLeaf, isTreeNode };
|
package/dist/package-node.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as isSheetGroupNode, A as SheetDescriptor, B as TreeGroup, C as ShapeConstructGroupNode, D as ShapeGroupNode, E as ShapeDescriptorSchema, F as SlideDescriptorSchema, G as TreeNodeSchema, H as TreeLeaf, I as SlideGroupNode, J as isListGroupNode, K as isDrawPageGroupNode, L as SlideGroupSchema, M as SheetGroupNode, N as SheetGroupSchema, O as ShapeGroupSchema, P as SlideDescriptor, Q as isShapeGroupNode, R as TreeBlockLeaf, S as ShapeChild, T as ShapeDescriptor, U as TreeLeafSchema, V as TreeGroupSchema, W as TreeNode, X as isSectionGroupNode, Y as isSectionConstructGroupNode, Z as isShapeConstructGroupNode, _ as SectionConstructGroupSchema, a as DrawPageGroupSchema, b as SectionGroupNode, c as HeadingParagraph, d as ListGroupNode, et as isSlideGroupNode, f as ListGroupSchema, g as SectionConstructGroupNode, h as SectionChild, i as DrawPageGroupNode, it as isTreeNode, j as SheetDescriptorSchema, k as SheetChild, l as HeadingParagraphSchema, m as ListParagraphSchema, n as DrawPageDescriptor, nt as isTreeGroup, o as HeadingGroupNode, p as ListParagraph, q as isHeadingGroupNode, r as DrawPageDescriptorSchema, rt as isTreeLeaf, s as HeadingGroupSchema, t as DrawPageChild, tt as isTreeBlockLeaf, u as ListChild, v as SectionDescriptor, w as ShapeConstructGroupSchema, x as SectionGroupSchema, y as SectionDescriptorSchema, z as TreeBlockLeafSchema } from "./package-node
|
|
1
|
+
import { $ as isSheetGroupNode, A as SheetDescriptor, B as TreeGroup, C as ShapeConstructGroupNode, D as ShapeGroupNode, E as ShapeDescriptorSchema, F as SlideDescriptorSchema, G as TreeNodeSchema, H as TreeLeaf, I as SlideGroupNode, J as isListGroupNode, K as isDrawPageGroupNode, L as SlideGroupSchema, M as SheetGroupNode, N as SheetGroupSchema, O as ShapeGroupSchema, P as SlideDescriptor, Q as isShapeGroupNode, R as TreeBlockLeaf, S as ShapeChild, T as ShapeDescriptor, U as TreeLeafSchema, V as TreeGroupSchema, W as TreeNode, X as isSectionGroupNode, Y as isSectionConstructGroupNode, Z as isShapeConstructGroupNode, _ as SectionConstructGroupSchema, a as DrawPageGroupSchema, b as SectionGroupNode, c as HeadingParagraph, d as ListGroupNode, et as isSlideGroupNode, f as ListGroupSchema, g as SectionConstructGroupNode, h as SectionChild, i as DrawPageGroupNode, it as isTreeNode, j as SheetDescriptorSchema, k as SheetChild, l as HeadingParagraphSchema, m as ListParagraphSchema, n as DrawPageDescriptor, nt as isTreeGroup, o as HeadingGroupNode, p as ListParagraph, q as isHeadingGroupNode, r as DrawPageDescriptorSchema, rt as isTreeLeaf, s as HeadingGroupSchema, t as DrawPageChild, tt as isTreeBlockLeaf, u as ListChild, v as SectionDescriptor, w as ShapeConstructGroupSchema, x as SectionGroupSchema, y as SectionDescriptorSchema, z as TreeBlockLeafSchema } from "./package-node--fbVCVcl.js";
|
|
2
2
|
export { DrawPageChild, DrawPageDescriptor, DrawPageDescriptorSchema, DrawPageGroupNode, DrawPageGroupSchema, HeadingGroupNode, HeadingGroupSchema, HeadingParagraph, HeadingParagraphSchema, ListChild, ListGroupNode, ListGroupSchema, ListParagraph, ListParagraphSchema, SectionChild, SectionConstructGroupNode, SectionConstructGroupSchema, SectionDescriptor, SectionDescriptorSchema, SectionGroupNode, SectionGroupSchema, ShapeChild, ShapeConstructGroupNode, ShapeConstructGroupSchema, ShapeDescriptor, ShapeDescriptorSchema, ShapeGroupNode, ShapeGroupSchema, SheetChild, SheetDescriptor, SheetDescriptorSchema, SheetGroupNode, SheetGroupSchema, SlideDescriptor, SlideDescriptorSchema, SlideGroupNode, SlideGroupSchema, TreeBlockLeaf, TreeBlockLeafSchema, TreeGroup, TreeGroupSchema, TreeLeaf, TreeLeafSchema, TreeNode, TreeNodeSchema, isDrawPageGroupNode, isHeadingGroupNode, isListGroupNode, isSectionConstructGroupNode, isSectionGroupNode, isShapeConstructGroupNode, isShapeGroupNode, isSheetGroupNode, isSlideGroupNode, isTreeBlockLeaf, isTreeGroup, isTreeLeaf, isTreeNode };
|
package/dist/package.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as MathMlNode } from "./mathml-Czqc1mdZ.cjs";
|
|
2
2
|
import { p as MathExpression } from "./math-BScHxedi.cjs";
|
|
3
|
-
import { I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, i as DrawPageGroupNode } from "./package-node-
|
|
3
|
+
import { I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, i as DrawPageGroupNode } from "./package-node-D7WUiIDz.cjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/package.d.ts
|
|
6
6
|
declare const TreeEmbeddedFontSchema: z.ZodObject<{
|
|
@@ -26,8 +26,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
26
26
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
27
27
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
28
28
|
left: "left";
|
|
29
|
-
center: "center";
|
|
30
29
|
right: "right";
|
|
30
|
+
center: "center";
|
|
31
31
|
justify: "justify";
|
|
32
32
|
}>>;
|
|
33
33
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -181,8 +181,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
181
181
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
182
182
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
183
183
|
left: "left";
|
|
184
|
-
center: "center";
|
|
185
184
|
right: "right";
|
|
185
|
+
center: "center";
|
|
186
186
|
justify: "justify";
|
|
187
187
|
}>>;
|
|
188
188
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -341,8 +341,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
341
341
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
342
342
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
343
343
|
left: "left";
|
|
344
|
-
center: "center";
|
|
345
344
|
right: "right";
|
|
345
|
+
center: "center";
|
|
346
346
|
justify: "justify";
|
|
347
347
|
}>>;
|
|
348
348
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -496,8 +496,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
496
496
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
497
497
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
498
498
|
left: "left";
|
|
499
|
-
center: "center";
|
|
500
499
|
right: "right";
|
|
500
|
+
center: "center";
|
|
501
501
|
justify: "justify";
|
|
502
502
|
}>>;
|
|
503
503
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -710,8 +710,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
710
710
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
711
711
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
712
712
|
left: "left";
|
|
713
|
-
center: "center";
|
|
714
713
|
right: "right";
|
|
714
|
+
center: "center";
|
|
715
715
|
justify: "justify";
|
|
716
716
|
}>>;
|
|
717
717
|
list: z.ZodOptional<z.ZodObject<{
|
package/dist/package.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as MathMlNode } from "./mathml-Czqc1mdZ.js";
|
|
2
2
|
import { p as MathExpression } from "./math-BScHxedi.js";
|
|
3
|
-
import { I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, i as DrawPageGroupNode } from "./package-node
|
|
3
|
+
import { I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, i as DrawPageGroupNode } from "./package-node--fbVCVcl.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/package.d.ts
|
|
6
6
|
declare const TreeEmbeddedFontSchema: z.ZodObject<{
|
|
@@ -26,8 +26,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
26
26
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
27
27
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
28
28
|
left: "left";
|
|
29
|
-
center: "center";
|
|
30
29
|
right: "right";
|
|
30
|
+
center: "center";
|
|
31
31
|
justify: "justify";
|
|
32
32
|
}>>;
|
|
33
33
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -181,8 +181,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
181
181
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
182
182
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
183
183
|
left: "left";
|
|
184
|
-
center: "center";
|
|
185
184
|
right: "right";
|
|
185
|
+
center: "center";
|
|
186
186
|
justify: "justify";
|
|
187
187
|
}>>;
|
|
188
188
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -341,8 +341,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
341
341
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
342
342
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
343
343
|
left: "left";
|
|
344
|
-
center: "center";
|
|
345
344
|
right: "right";
|
|
345
|
+
center: "center";
|
|
346
346
|
justify: "justify";
|
|
347
347
|
}>>;
|
|
348
348
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -496,8 +496,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
496
496
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
497
497
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
498
498
|
left: "left";
|
|
499
|
-
center: "center";
|
|
500
499
|
right: "right";
|
|
500
|
+
center: "center";
|
|
501
501
|
justify: "justify";
|
|
502
502
|
}>>;
|
|
503
503
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -710,8 +710,8 @@ declare const DocumentTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
710
710
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
711
711
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
712
712
|
left: "left";
|
|
713
|
-
center: "center";
|
|
714
713
|
right: "right";
|
|
714
|
+
center: "center";
|
|
715
715
|
justify: "justify";
|
|
716
716
|
}>>;
|
|
717
717
|
list: z.ZodOptional<z.ZodObject<{
|
package/dist/schema-io.cjs
CHANGED
|
@@ -7,7 +7,7 @@ const SCHEMA_FILE_NAMES = {
|
|
|
7
7
|
ContentDocument: "content-document.schema.json"
|
|
8
8
|
};
|
|
9
9
|
function schemaUriFor(kind) {
|
|
10
|
-
return `https://cdn.jsdelivr.net/npm/document-schema.js@7.
|
|
10
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@7.13.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
|
|
11
11
|
}
|
|
12
12
|
const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@([^/]+)\/schemas\/(document-tree|document-package|content-document|layout-document)\.schema\.json$/;
|
|
13
13
|
function parseSchemaUri(uri) {
|
|
@@ -102,7 +102,7 @@ function documentFromJson(value) {
|
|
|
102
102
|
if (parts.stem === "document-package") throw new DocumentPackageRenamedError(value.$schema);
|
|
103
103
|
const kind = kindForFileStem(parts.stem);
|
|
104
104
|
if (kind === void 0) throw new UnrecognizedDocumentSchemaError(value.$schema);
|
|
105
|
-
if (majorVersionOf(parts.version) !== majorVersionOf("7.
|
|
105
|
+
if (majorVersionOf(parts.version) !== majorVersionOf("7.13.0")) throw new SchemaVersionMismatchError(value.$schema, parts.version, "7.13.0");
|
|
106
106
|
switch (kind) {
|
|
107
107
|
case "DocumentTree": return {
|
|
108
108
|
kind,
|
package/dist/schema-io.d.cts
CHANGED
package/dist/schema-io.d.ts
CHANGED
package/dist/schema-io.js
CHANGED
|
@@ -6,7 +6,7 @@ const SCHEMA_FILE_NAMES = {
|
|
|
6
6
|
ContentDocument: "content-document.schema.json"
|
|
7
7
|
};
|
|
8
8
|
function schemaUriFor(kind) {
|
|
9
|
-
return `https://cdn.jsdelivr.net/npm/document-schema.js@7.
|
|
9
|
+
return `https://cdn.jsdelivr.net/npm/document-schema.js@7.13.0/schemas/${SCHEMA_FILE_NAMES[kind]}`;
|
|
10
10
|
}
|
|
11
11
|
const SCHEMA_URI_PATTERN = /^https:\/\/cdn\.jsdelivr\.net\/npm\/document-schema\.js@([^/]+)\/schemas\/(document-tree|document-package|content-document|layout-document)\.schema\.json$/;
|
|
12
12
|
function parseSchemaUri(uri) {
|
|
@@ -101,7 +101,7 @@ function documentFromJson(value) {
|
|
|
101
101
|
if (parts.stem === "document-package") throw new DocumentPackageRenamedError(value.$schema);
|
|
102
102
|
const kind = kindForFileStem(parts.stem);
|
|
103
103
|
if (kind === void 0) throw new UnrecognizedDocumentSchemaError(value.$schema);
|
|
104
|
-
if (majorVersionOf(parts.version) !== majorVersionOf("7.
|
|
104
|
+
if (majorVersionOf(parts.version) !== majorVersionOf("7.13.0")) throw new SchemaVersionMismatchError(value.$schema, parts.version, "7.13.0");
|
|
105
105
|
switch (kind) {
|
|
106
106
|
case "DocumentTree": return {
|
|
107
107
|
kind,
|
package/dist/style.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LayoutFontSchema, i as LayoutFont, n as AlignmentSchema, o as TextDirection, r as DEFAULT_LAYOUT_FONT, s as TextDirectionSchema, t as Alignment } from "./style-
|
|
1
|
+
import { a as LayoutFontSchema, i as LayoutFont, n as AlignmentSchema, o as TextDirection, r as DEFAULT_LAYOUT_FONT, s as TextDirectionSchema, t as Alignment } from "./style-BGMcYrD2.cjs";
|
|
2
2
|
export { Alignment, AlignmentSchema, DEFAULT_LAYOUT_FONT, LayoutFont, LayoutFontSchema, TextDirection, TextDirectionSchema };
|
package/dist/style.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LayoutFontSchema, i as LayoutFont, n as AlignmentSchema, o as TextDirection, r as DEFAULT_LAYOUT_FONT, s as TextDirectionSchema, t as Alignment } from "./style-
|
|
1
|
+
import { a as LayoutFontSchema, i as LayoutFont, n as AlignmentSchema, o as TextDirection, r as DEFAULT_LAYOUT_FONT, s as TextDirectionSchema, t as Alignment } from "./style-BGMcYrD2.js";
|
|
2
2
|
export { Alignment, AlignmentSchema, DEFAULT_LAYOUT_FONT, LayoutFont, LayoutFontSchema, TextDirection, TextDirectionSchema };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/table-grid.ts
|
|
3
|
+
/** The number of grid columns a cell occupies; an absent `colSpan` means the cell occupies its own column only. */
|
|
4
|
+
function tableCellColumnSpan(cell) {
|
|
5
|
+
return cell.colSpan ?? 1;
|
|
6
|
+
}
|
|
7
|
+
/** The number of grid rows a cell occupies; an absent `rowSpan` means the cell occupies its own row only. */
|
|
8
|
+
function tableCellRowSpan(cell) {
|
|
9
|
+
return cell.rowSpan ?? 1;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The table's grid width. For a table obeying the dense rule this is `columnWidthsPt.length` and every row's `cells.length` alike; taking the largest of them is what lets a reader mid-construction, or a table whose source declared a grid narrower than a row actually uses, still be walked without the walk inventing a narrower grid than the rows occupy.
|
|
13
|
+
*/
|
|
14
|
+
function tableGridColumnCount(table) {
|
|
15
|
+
let count = table.columnWidthsPt.length;
|
|
16
|
+
for (const row of table.rows) count = Math.max(count, row.cells.length);
|
|
17
|
+
return count;
|
|
18
|
+
}
|
|
19
|
+
function coveringAnchor(anchors, rowIndex, columnIndex) {
|
|
20
|
+
for (const anchor of anchors) if (rowIndex < anchor.rowEnd && anchor.column <= columnIndex && columnIndex < anchor.columnEnd) return anchor;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Classify every entry of every row as an anchor or as covered, in row-major order, one inner array per table row.
|
|
24
|
+
*
|
|
25
|
+
* This is the walk a consumer runs instead of accumulating spans itself. A writer targeting a format that stores only anchors (HTML's `<td colspan>`, a docx `w:tc` with `w:gridSpan`) keeps the anchors and drops the covered positions; a writer targeting a format that stores covered positions explicitly (ODF, pptx) writes both; a reader checks its own output against it.
|
|
26
|
+
*/
|
|
27
|
+
function walkTableGrid(table) {
|
|
28
|
+
const anchors = [];
|
|
29
|
+
return table.rows.map((row, rowIndex) => row.cells.map((cell, columnIndex) => {
|
|
30
|
+
const anchor = coveringAnchor(anchors, rowIndex, columnIndex);
|
|
31
|
+
if (anchor !== void 0) return {
|
|
32
|
+
rowIndex,
|
|
33
|
+
columnIndex,
|
|
34
|
+
cell,
|
|
35
|
+
anchorRowIndex: anchor.row,
|
|
36
|
+
anchorColumnIndex: anchor.column
|
|
37
|
+
};
|
|
38
|
+
anchors.push({
|
|
39
|
+
row: rowIndex,
|
|
40
|
+
column: columnIndex,
|
|
41
|
+
rowEnd: rowIndex + tableCellRowSpan(cell),
|
|
42
|
+
columnEnd: columnIndex + tableCellColumnSpan(cell)
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
rowIndex,
|
|
46
|
+
columnIndex,
|
|
47
|
+
cell
|
|
48
|
+
};
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
/** The span of a cell that occupies its own grid position only, which is what an absent `colSpan` or `rowSpan` means. */
|
|
52
|
+
const UNMERGED_SPAN = 1;
|
|
53
|
+
function widestRowLength(table) {
|
|
54
|
+
let width = 0;
|
|
55
|
+
for (const row of table.rows) width = Math.max(width, row.cells.length);
|
|
56
|
+
return width;
|
|
57
|
+
}
|
|
58
|
+
function coveredFault(position) {
|
|
59
|
+
const { rowIndex, columnIndex, anchorRowIndex, anchorColumnIndex, cell } = position;
|
|
60
|
+
if (cell.blocks.length > 0) return {
|
|
61
|
+
kind: "coveredContent",
|
|
62
|
+
rowIndex,
|
|
63
|
+
columnIndex,
|
|
64
|
+
anchorRowIndex,
|
|
65
|
+
anchorColumnIndex
|
|
66
|
+
};
|
|
67
|
+
if (tableCellColumnSpan(cell) > UNMERGED_SPAN || tableCellRowSpan(cell) > UNMERGED_SPAN) return {
|
|
68
|
+
kind: "coveredSpan",
|
|
69
|
+
rowIndex,
|
|
70
|
+
columnIndex,
|
|
71
|
+
anchorRowIndex,
|
|
72
|
+
anchorColumnIndex
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function overlappedRegion(anchor, row) {
|
|
76
|
+
const footprintEnd = anchor.columnIndex + tableCellColumnSpan(anchor.cell);
|
|
77
|
+
for (const position of row.slice(anchor.columnIndex + 1, footprintEnd)) if (position.anchorRowIndex !== void 0 && position.anchorRowIndex < anchor.rowIndex) return position;
|
|
78
|
+
}
|
|
79
|
+
function anchorFault(anchor, row, rowCount) {
|
|
80
|
+
const { rowIndex, columnIndex, cell } = anchor;
|
|
81
|
+
if (columnIndex + tableCellColumnSpan(cell) > row.length) return {
|
|
82
|
+
kind: "anchorOverrunsColumns",
|
|
83
|
+
rowIndex,
|
|
84
|
+
columnIndex
|
|
85
|
+
};
|
|
86
|
+
if (rowIndex + tableCellRowSpan(cell) > rowCount) return {
|
|
87
|
+
kind: "anchorOverrunsRows",
|
|
88
|
+
rowIndex,
|
|
89
|
+
columnIndex
|
|
90
|
+
};
|
|
91
|
+
const overlapped = overlappedRegion(anchor, row);
|
|
92
|
+
if (overlapped !== void 0) return {
|
|
93
|
+
kind: "overlappingAnchors",
|
|
94
|
+
rowIndex,
|
|
95
|
+
columnIndex,
|
|
96
|
+
earlierAnchorRowIndex: overlapped.anchorRowIndex,
|
|
97
|
+
earlierAnchorColumnIndex: overlapped.anchorColumnIndex
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The first place `table` contradicts the grid rule, or `undefined` when it obeys it. It never throws: a caller decides what a fault means for it, the way findConstructMarkerImbalance leaves that decision to each consumer of a block list.
|
|
102
|
+
*
|
|
103
|
+
* Rows are compared with each other before any position is classified, since an anchor's footprint can only be measured against a grid every row shares; the positions are then checked in row-major order, so the fault returned is the earliest one in reading order.
|
|
104
|
+
*
|
|
105
|
+
* The check states the whole of the rule and nothing beyond it: a table with no rows, or whose rows are all empty, has no fault, and neither `columnWidthsPt` nor a cell's own properties other than its blocks and spans are consulted.
|
|
106
|
+
*/
|
|
107
|
+
function findTableGridFault(table) {
|
|
108
|
+
const gridColumnCount = widestRowLength(table);
|
|
109
|
+
for (const [rowIndex, row] of table.rows.entries()) if (row.cells.length !== gridColumnCount) return {
|
|
110
|
+
kind: "raggedRow",
|
|
111
|
+
rowIndex,
|
|
112
|
+
cellCount: row.cells.length,
|
|
113
|
+
gridColumnCount
|
|
114
|
+
};
|
|
115
|
+
const grid = walkTableGrid(table);
|
|
116
|
+
for (const row of grid) for (const position of row) {
|
|
117
|
+
const fault = position.anchorRowIndex === void 0 ? anchorFault(position, row, grid.length) : coveredFault(position);
|
|
118
|
+
if (fault !== void 0) return fault;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* One sentence stating a fault in words, for a writer that refuses or reports a table the grid rule does not admit: it names the fault by its position and, where the fault involves a second region, by that region's anchor. Indices are 0-based, matching every index in the descriptor. The sentence carries no entry point or format of its own, so each caller prefixes whatever names its own operation.
|
|
123
|
+
*/
|
|
124
|
+
function describeTableGridFault(fault) {
|
|
125
|
+
switch (fault.kind) {
|
|
126
|
+
case "raggedRow": return `row ${String(fault.rowIndex)} holds ${String(fault.cellCount)} cells where the widest row holds ${String(fault.gridColumnCount)}, but every row of a table covers the same grid`;
|
|
127
|
+
case "coveredContent": return `the cell at row ${String(fault.rowIndex)}, column ${String(fault.columnIndex)} lies inside the merged region anchored at row ${String(fault.anchorRowIndex)}, column ${String(fault.anchorColumnIndex)} but carries content of its own, and a merged region's content belongs to its anchor`;
|
|
128
|
+
case "coveredSpan": return `the cell at row ${String(fault.rowIndex)}, column ${String(fault.columnIndex)} lies inside the merged region anchored at row ${String(fault.anchorRowIndex)}, column ${String(fault.anchorColumnIndex)} but states a span of its own, and only a region's anchor carries a span`;
|
|
129
|
+
case "anchorOverrunsColumns": return `the merged region anchored at row ${String(fault.rowIndex)}, column ${String(fault.columnIndex)} spans past the last column of the grid`;
|
|
130
|
+
case "anchorOverrunsRows": return `the merged region anchored at row ${String(fault.rowIndex)}, column ${String(fault.columnIndex)} spans past the last row of the table`;
|
|
131
|
+
case "overlappingAnchors": return `the merged region anchored at row ${String(fault.rowIndex)}, column ${String(fault.columnIndex)} overlaps the region anchored at row ${String(fault.earlierAnchorRowIndex)}, column ${String(fault.earlierAnchorColumnIndex)}, but a grid position belongs to one region only`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function placedGridWidth(rows, columnCount) {
|
|
135
|
+
let width = columnCount;
|
|
136
|
+
for (const row of rows) for (const { columnIndex, cell } of row.cells) width = Math.max(width, columnIndex + tableCellColumnSpan(cell));
|
|
137
|
+
return width;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Build dense rows from cells a reader has already positioned, filling every position no cell was placed at with an empty covered cell.
|
|
141
|
+
*
|
|
142
|
+
* `columnCount` is the grid width the source declared (a docx `w:tblGrid`, an ODF `table:table-column` run). The result is that wide, or wider if some row places a cell past it, so that every returned row has the same length whatever the source's own grid declaration said.
|
|
143
|
+
*/
|
|
144
|
+
function denseTableRows(rows, columnCount) {
|
|
145
|
+
const width = placedGridWidth(rows, columnCount);
|
|
146
|
+
return rows.map((row) => {
|
|
147
|
+
const cells = Array.from({ length: width }, () => ({ blocks: [] }));
|
|
148
|
+
for (const { columnIndex, cell } of row.cells) cells[columnIndex] = cell;
|
|
149
|
+
return {
|
|
150
|
+
...row,
|
|
151
|
+
cells
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function occupiedColumns(occupied, rowIndex) {
|
|
156
|
+
const existing = occupied.get(rowIndex);
|
|
157
|
+
if (existing !== void 0) return existing;
|
|
158
|
+
const created = /* @__PURE__ */ new Set();
|
|
159
|
+
occupied.set(rowIndex, created);
|
|
160
|
+
return created;
|
|
161
|
+
}
|
|
162
|
+
function positionAnchorRows(rows) {
|
|
163
|
+
const occupied = /* @__PURE__ */ new Map();
|
|
164
|
+
return rows.map((row, rowIndex) => {
|
|
165
|
+
const taken = occupiedColumns(occupied, rowIndex);
|
|
166
|
+
let column = 0;
|
|
167
|
+
const cells = row.cells.map((cell) => {
|
|
168
|
+
while (taken.has(column)) column++;
|
|
169
|
+
const lastRow = rowIndex + tableCellRowSpan(cell);
|
|
170
|
+
const lastColumn = column + tableCellColumnSpan(cell);
|
|
171
|
+
for (let r = rowIndex; r < lastRow; r++) {
|
|
172
|
+
const rowTaken = occupiedColumns(occupied, r);
|
|
173
|
+
for (let c = column; c < lastColumn; c++) rowTaken.add(c);
|
|
174
|
+
}
|
|
175
|
+
const positioned = {
|
|
176
|
+
columnIndex: column,
|
|
177
|
+
cell
|
|
178
|
+
};
|
|
179
|
+
column = lastColumn;
|
|
180
|
+
return positioned;
|
|
181
|
+
});
|
|
182
|
+
return {
|
|
183
|
+
...row,
|
|
184
|
+
cells
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Build dense rows from anchor cells alone, placing each at the first grid column no earlier cell already reaches -- the placement HTML's own table model needs, where a `rowspan` in one row silently consumes a column in the rows below it and nothing marks the consumed position.
|
|
190
|
+
*
|
|
191
|
+
* `columnCount` is the grid width the source declared, where it declares one at all; pass 0 when it does not and the width follows from the placement.
|
|
192
|
+
*/
|
|
193
|
+
function placeAnchorTableRows(rows, columnCount) {
|
|
194
|
+
return denseTableRows(positionAnchorRows(rows), columnCount);
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
exports.denseTableRows = denseTableRows;
|
|
198
|
+
exports.describeTableGridFault = describeTableGridFault;
|
|
199
|
+
exports.findTableGridFault = findTableGridFault;
|
|
200
|
+
exports.placeAnchorTableRows = placeAnchorTableRows;
|
|
201
|
+
exports.tableCellColumnSpan = tableCellColumnSpan;
|
|
202
|
+
exports.tableCellRowSpan = tableCellRowSpan;
|
|
203
|
+
exports.tableGridColumnCount = tableGridColumnCount;
|
|
204
|
+
exports.walkTableGrid = walkTableGrid;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { o as TextDirection } from "./style-BGMcYrD2.cjs";
|
|
2
|
+
import { _n as ContentTableRow, hn as ContentTableCell, mn as ContentTable } from "./content-CvvaHPSp.cjs";
|
|
3
|
+
//#region src/table-grid.d.ts
|
|
4
|
+
/** The number of grid columns a cell occupies; an absent `colSpan` means the cell occupies its own column only. */
|
|
5
|
+
declare function tableCellColumnSpan(cell: ContentTableCell): number;
|
|
6
|
+
/** The number of grid rows a cell occupies; an absent `rowSpan` means the cell occupies its own row only. */
|
|
7
|
+
declare function tableCellRowSpan(cell: ContentTableCell): number;
|
|
8
|
+
/**
|
|
9
|
+
* The table's grid width. For a table obeying the dense rule this is `columnWidthsPt.length` and every row's `cells.length` alike; taking the largest of them is what lets a reader mid-construction, or a table whose source declared a grid narrower than a row actually uses, still be walked without the walk inventing a narrower grid than the rows occupy.
|
|
10
|
+
*/
|
|
11
|
+
declare function tableGridColumnCount(table: ContentTable): number;
|
|
12
|
+
/** A grid position holding a merged region's anchor, or an unmerged cell (which is its own one-position region's anchor). */
|
|
13
|
+
interface TableGridAnchor {
|
|
14
|
+
readonly rowIndex: number;
|
|
15
|
+
readonly columnIndex: number;
|
|
16
|
+
readonly cell: ContentTableCell;
|
|
17
|
+
readonly anchorRowIndex?: never;
|
|
18
|
+
readonly anchorColumnIndex?: never;
|
|
19
|
+
}
|
|
20
|
+
/** A grid position covered by a merged region anchored elsewhere. `anchorRowIndex < rowIndex` means the region reaches this position vertically; `anchorRowIndex === rowIndex` means it reaches it horizontally along this same row. */
|
|
21
|
+
interface TableGridCovered {
|
|
22
|
+
readonly rowIndex: number;
|
|
23
|
+
readonly columnIndex: number;
|
|
24
|
+
readonly cell: ContentTableCell;
|
|
25
|
+
readonly anchorRowIndex: number;
|
|
26
|
+
readonly anchorColumnIndex: number;
|
|
27
|
+
}
|
|
28
|
+
/** Discriminated by the presence of the anchor coordinates rather than by a tag field, since the two shapes' required fields are already mutually exclusive: `"anchorRowIndex" in position` narrows to the covered branch. */
|
|
29
|
+
type TableGridPosition = TableGridAnchor | TableGridCovered;
|
|
30
|
+
/**
|
|
31
|
+
* Classify every entry of every row as an anchor or as covered, in row-major order, one inner array per table row.
|
|
32
|
+
*
|
|
33
|
+
* This is the walk a consumer runs instead of accumulating spans itself. A writer targeting a format that stores only anchors (HTML's `<td colspan>`, a docx `w:tc` with `w:gridSpan`) keeps the anchors and drops the covered positions; a writer targeting a format that stores covered positions explicitly (ODF, pptx) writes both; a reader checks its own output against it.
|
|
34
|
+
*/
|
|
35
|
+
declare function walkTableGrid(table: ContentTable): TableGridPosition[][];
|
|
36
|
+
/**
|
|
37
|
+
* Where a table stops obeying the grid rule (ContentTableCell in src/content.ts states the rule; walkTableGrid derives the classification every check here is made against). Every variant names a position in the table's own row and column indices.
|
|
38
|
+
*
|
|
39
|
+
* - `raggedRow`: the row holds `cellCount` entries where the table's widest row holds `gridColumnCount`, so the rows do not all cover the same grid.
|
|
40
|
+
* - `coveredContent`: the position is covered by the region anchored at `anchorRowIndex`, `anchorColumnIndex` yet carries blocks of its own; the region's content belongs to its anchor, so a second copy has nowhere to go.
|
|
41
|
+
* - `coveredSpan`: the position is covered by the region anchored at `anchorRowIndex`, `anchorColumnIndex` yet carries a `colSpan` or `rowSpan` of its own. Spans are set on the anchor only and walkTableGrid never consults a covered entry's, so this is how a second anchor starting inside another's footprint shows up: the walk assigns each position to the first anchor covering it, which leaves the second entry classified as covered and its span ignored.
|
|
42
|
+
* - `anchorOverrunsColumns`: the anchor at this position has a `colSpan` reaching past the last grid column.
|
|
43
|
+
* - `anchorOverrunsRows`: the anchor at this position has a `rowSpan` reaching past the last row of the table.
|
|
44
|
+
* - `overlappingAnchors`: the anchor at this position starts outside every other region but its footprint reaches a position already covered by the region anchored at `earlierAnchorRowIndex`, `earlierAnchorColumnIndex`, so two regions claim one position.
|
|
45
|
+
*
|
|
46
|
+
* A `kind` tag discriminates rather than property presence, because the variants' required fields are not mutually exclusive: several variants' fields include another's.
|
|
47
|
+
*/
|
|
48
|
+
type TableGridFault = {
|
|
49
|
+
readonly kind: "raggedRow";
|
|
50
|
+
readonly rowIndex: number;
|
|
51
|
+
readonly cellCount: number;
|
|
52
|
+
readonly gridColumnCount: number;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: "coveredContent" | "coveredSpan";
|
|
55
|
+
readonly rowIndex: number;
|
|
56
|
+
readonly columnIndex: number;
|
|
57
|
+
readonly anchorRowIndex: number;
|
|
58
|
+
readonly anchorColumnIndex: number;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: "anchorOverrunsColumns" | "anchorOverrunsRows";
|
|
61
|
+
readonly rowIndex: number;
|
|
62
|
+
readonly columnIndex: number;
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: "overlappingAnchors";
|
|
65
|
+
readonly rowIndex: number;
|
|
66
|
+
readonly columnIndex: number;
|
|
67
|
+
readonly earlierAnchorRowIndex: number;
|
|
68
|
+
readonly earlierAnchorColumnIndex: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The first place `table` contradicts the grid rule, or `undefined` when it obeys it. It never throws: a caller decides what a fault means for it, the way findConstructMarkerImbalance leaves that decision to each consumer of a block list.
|
|
72
|
+
*
|
|
73
|
+
* Rows are compared with each other before any position is classified, since an anchor's footprint can only be measured against a grid every row shares; the positions are then checked in row-major order, so the fault returned is the earliest one in reading order.
|
|
74
|
+
*
|
|
75
|
+
* The check states the whole of the rule and nothing beyond it: a table with no rows, or whose rows are all empty, has no fault, and neither `columnWidthsPt` nor a cell's own properties other than its blocks and spans are consulted.
|
|
76
|
+
*/
|
|
77
|
+
declare function findTableGridFault(table: ContentTable): TableGridFault | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* One sentence stating a fault in words, for a writer that refuses or reports a table the grid rule does not admit: it names the fault by its position and, where the fault involves a second region, by that region's anchor. Indices are 0-based, matching every index in the descriptor. The sentence carries no entry point or format of its own, so each caller prefixes whatever names its own operation.
|
|
80
|
+
*/
|
|
81
|
+
declare function describeTableGridFault(fault: TableGridFault): string;
|
|
82
|
+
/** A cell together with the grid column it starts at, for a reader whose source format states that column directly. */
|
|
83
|
+
interface PositionedTableCell {
|
|
84
|
+
readonly columnIndex: number;
|
|
85
|
+
readonly cell: ContentTableCell;
|
|
86
|
+
}
|
|
87
|
+
/** One row's worth of positioned cells, carrying the row-level properties denseTableRows copies through unchanged. */
|
|
88
|
+
interface PositionedTableRow {
|
|
89
|
+
readonly cells: readonly PositionedTableCell[];
|
|
90
|
+
readonly heightPt?: number;
|
|
91
|
+
readonly direction?: TextDirection;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Build dense rows from cells a reader has already positioned, filling every position no cell was placed at with an empty covered cell.
|
|
95
|
+
*
|
|
96
|
+
* `columnCount` is the grid width the source declared (a docx `w:tblGrid`, an ODF `table:table-column` run). The result is that wide, or wider if some row places a cell past it, so that every returned row has the same length whatever the source's own grid declaration said.
|
|
97
|
+
*/
|
|
98
|
+
declare function denseTableRows(rows: readonly PositionedTableRow[], columnCount: number): ContentTableRow[];
|
|
99
|
+
/** One row's worth of anchor cells only, for a reader whose source format omits covered positions entirely and leaves their grid columns to be worked out from the spans around them. */
|
|
100
|
+
interface AnchorTableRow {
|
|
101
|
+
readonly cells: readonly ContentTableCell[];
|
|
102
|
+
readonly heightPt?: number;
|
|
103
|
+
readonly direction?: TextDirection;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Build dense rows from anchor cells alone, placing each at the first grid column no earlier cell already reaches -- the placement HTML's own table model needs, where a `rowspan` in one row silently consumes a column in the rows below it and nothing marks the consumed position.
|
|
107
|
+
*
|
|
108
|
+
* `columnCount` is the grid width the source declared, where it declares one at all; pass 0 when it does not and the width follows from the placement.
|
|
109
|
+
*/
|
|
110
|
+
declare function placeAnchorTableRows(rows: readonly AnchorTableRow[], columnCount: number): ContentTableRow[];
|
|
111
|
+
//#endregion
|
|
112
|
+
export { AnchorTableRow, PositionedTableCell, PositionedTableRow, TableGridAnchor, TableGridCovered, TableGridFault, TableGridPosition, denseTableRows, describeTableGridFault, findTableGridFault, placeAnchorTableRows, tableCellColumnSpan, tableCellRowSpan, tableGridColumnCount, walkTableGrid };
|