document-content-model 4.3.3 → 7.6.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 +274 -95
- package/dist/border-weight.cjs +26 -0
- package/dist/border-weight.d.cts +12 -0
- package/dist/border-weight.d.ts +12 -0
- package/dist/border-weight.js +23 -0
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{construct-CdQuI9f5.d.cts → construct-GVdTKrE7.d.cts} +245 -5
- package/dist/{construct-CdQuI9f5.d.ts → construct-GVdTKrE7.d.ts} +245 -5
- package/dist/construct.cjs +13 -6
- package/dist/construct.d.cts +1 -1
- package/dist/construct.d.ts +1 -1
- package/dist/construct.js +13 -6
- package/dist/content-BCOxY0Eb.d.ts +10273 -0
- package/dist/content-BzkhrS6P.d.cts +10273 -0
- package/dist/content-json-schema-defs.cjs +1056 -189
- package/dist/content-json-schema-defs.js +1056 -189
- package/dist/content.cjs +514 -36
- package/dist/content.d.cts +2 -2
- package/dist/content.d.ts +2 -2
- package/dist/content.js +488 -37
- package/dist/decompose.cjs +7 -17
- package/dist/decompose.d.cts +5 -5
- package/dist/decompose.d.ts +5 -5
- package/dist/decompose.js +7 -17
- package/dist/definitions.cjs +5 -1
- package/dist/definitions.d.cts +37 -1
- package/dist/definitions.d.ts +37 -1
- package/dist/definitions.js +5 -1
- package/dist/factor-styles.cjs +14 -8
- package/dist/factor-styles.d.cts +6 -6
- package/dist/factor-styles.d.ts +6 -6
- package/dist/factor-styles.js +15 -9
- package/dist/flatten.cjs +5 -5
- package/dist/flatten.d.cts +4 -4
- package/dist/flatten.d.ts +4 -4
- package/dist/flatten.js +5 -5
- package/dist/font-port.d.cts +2 -2
- package/dist/font-port.d.ts +2 -2
- package/dist/index.cjs +54 -14
- package/dist/index.d.cts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/index.js +12 -10
- package/dist/{math-BlG8Tjk-.d.cts → math-BScHxedi.d.cts} +97 -14
- package/dist/{math-BlG8Tjk-.d.ts → math-BScHxedi.d.ts} +97 -14
- package/dist/math-layout.d.cts +6 -6
- package/dist/math-layout.d.ts +6 -6
- package/dist/math.cjs +32 -6
- package/dist/math.d.cts +2 -2
- package/dist/math.d.ts +2 -2
- package/dist/math.js +29 -7
- package/dist/{mathml-B1oTCtzc.d.cts → mathml-Czqc1mdZ.d.cts} +3 -3
- package/dist/{mathml-B1oTCtzc.d.ts → mathml-Czqc1mdZ.d.ts} +3 -3
- package/dist/mathml.cjs +9 -2
- package/dist/mathml.d.cts +1 -1
- package/dist/mathml.d.ts +1 -1
- package/dist/mathml.js +9 -2
- package/dist/metadata.cjs +12 -1
- package/dist/metadata.d.cts +13 -0
- package/dist/metadata.d.ts +13 -0
- package/dist/metadata.js +12 -1
- package/dist/package-node-C4mh1hLY.d.ts +1989 -0
- package/dist/package-node-RQMDBzwd.d.cts +1989 -0
- package/dist/package-node.cjs +21 -21
- package/dist/package-node.d.cts +2 -2
- package/dist/package-node.d.ts +2 -2
- package/dist/package-node.js +14 -14
- package/dist/package.cjs +5 -3
- package/dist/package.d.cts +253 -8
- package/dist/package.d.ts +253 -8
- package/dist/package.js +5 -3
- package/dist/schema-io.cjs +21 -11
- package/dist/schema-io.d.cts +13 -9
- package/dist/schema-io.d.ts +13 -9
- package/dist/schema-io.js +21 -12
- package/dist/source-Bas5ol6f.d.cts +43 -0
- package/dist/source-Bas5ol6f.d.ts +43 -0
- package/dist/source.cjs +27 -0
- package/dist/source.d.cts +2 -0
- package/dist/source.d.ts +2 -0
- package/dist/source.js +25 -0
- package/dist/style-D06NwxAJ.d.cts +29 -0
- package/dist/style-D06NwxAJ.d.ts +29 -0
- package/dist/style.cjs +2 -0
- package/dist/style.d.cts +2 -24
- package/dist/style.d.ts +2 -24
- package/dist/style.js +2 -1
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/package.json +28 -29
- package/schemas/content-document.schema.json +6623 -1694
- package/schemas/{document-package.schema.json → document-tree.schema.json} +1826 -143
- package/dist/content-B7b_P3FC.d.cts +0 -2481
- package/dist/content-Dn7uoJFG.d.ts +0 -2481
- package/dist/package-node-CC-FE2zS.d.cts +0 -459
- package/dist/package-node-DxdparRh.d.ts +0 -459
package/dist/decompose.cjs
CHANGED
|
@@ -51,7 +51,11 @@ function walkSectionBlocks(cursor) {
|
|
|
51
51
|
const block = step.value;
|
|
52
52
|
if (block.kind === "constructEnd") return root;
|
|
53
53
|
if (block.kind === "constructStart") {
|
|
54
|
-
|
|
54
|
+
listStack.length = 0;
|
|
55
|
+
headingScope().push({
|
|
56
|
+
node: block.descriptor,
|
|
57
|
+
children: walkSectionBlocks(cursor)
|
|
58
|
+
});
|
|
55
59
|
continue;
|
|
56
60
|
}
|
|
57
61
|
if (block.kind !== "paragraph") {
|
|
@@ -128,8 +132,8 @@ function walkShapeBlocks(cursor) {
|
|
|
128
132
|
const block = step.value;
|
|
129
133
|
if (block.kind === "constructEnd") return root;
|
|
130
134
|
if (block.kind === "constructStart") {
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
listStack.length = 0;
|
|
136
|
+
root.push({
|
|
133
137
|
node: block.descriptor,
|
|
134
138
|
children: walkShapeBlocks(cursor)
|
|
135
139
|
});
|
|
@@ -149,20 +153,6 @@ function walkShapeBlocks(cursor) {
|
|
|
149
153
|
}
|
|
150
154
|
return root;
|
|
151
155
|
}
|
|
152
|
-
function openConstructGroup(descriptor, cursor, listStack, headingScope) {
|
|
153
|
-
const parent = listStack.at(-1);
|
|
154
|
-
if (parent === void 0) {
|
|
155
|
-
headingScope.push({
|
|
156
|
-
node: descriptor,
|
|
157
|
-
children: walkSectionBlocks(cursor)
|
|
158
|
-
});
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
parent.children.push({
|
|
162
|
-
node: descriptor,
|
|
163
|
-
children: walkShapeBlocks(cursor)
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
156
|
function openListGroup(listStack, scopeChildren, paragraph) {
|
|
167
157
|
const level = paragraph.list.level;
|
|
168
158
|
for (let top = listStack.at(-1); top !== void 0 && top.node.list.level >= level; top = listStack.at(-1)) listStack.pop();
|
package/dist/decompose.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as ContentDrawPage, _t as ContentSheet, b as ContentDocument, ht as ContentShape, pt as ContentSection, qt as ContentSlide, rt as ContentParagraph, t as ConstructMarkerImbalance, z as ContentFormula } from "./content-BzkhrS6P.cjs";
|
|
2
|
+
import { D as ShapeGroupNode, I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-RQMDBzwd.cjs";
|
|
3
3
|
//#region src/decompose.d.ts
|
|
4
4
|
declare function isHeadingParagraph(paragraph: ContentParagraph): paragraph is HeadingParagraph;
|
|
5
5
|
declare function isListParagraph(paragraph: ContentParagraph): paragraph is ListParagraph;
|
|
@@ -7,12 +7,12 @@ declare class ConstructMarkerImbalanceError extends Error {
|
|
|
7
7
|
readonly imbalance: ConstructMarkerImbalance;
|
|
8
8
|
constructor(imbalance: ConstructMarkerImbalance);
|
|
9
9
|
}
|
|
10
|
-
type
|
|
11
|
-
declare function decompose(content: ContentDocument):
|
|
10
|
+
type TreeChildren = SectionGroupNode[] | SlideGroupNode[] | SheetGroupNode[] | DrawPageGroupNode[] | ContentFormula[];
|
|
11
|
+
declare function decompose(content: ContentDocument): TreeChildren;
|
|
12
12
|
declare function decomposeSection(section: ContentSection): SectionGroupNode;
|
|
13
13
|
declare function decomposeSlide(slide: ContentSlide): SlideGroupNode;
|
|
14
14
|
declare function decomposeSheet(sheet: ContentSheet): SheetGroupNode;
|
|
15
15
|
declare function decomposeDrawPage(page: ContentDrawPage): DrawPageGroupNode;
|
|
16
16
|
declare function decomposeShape(shape: ContentShape): ShapeGroupNode;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { ConstructMarkerImbalanceError,
|
|
18
|
+
export { ConstructMarkerImbalanceError, TreeChildren, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
|
package/dist/decompose.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as ContentDrawPage, _t as ContentSheet, b as ContentDocument, ht as ContentShape, pt as ContentSection, qt as ContentSlide, rt as ContentParagraph, t as ConstructMarkerImbalance, z as ContentFormula } from "./content-BCOxY0Eb.js";
|
|
2
|
+
import { D as ShapeGroupNode, I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-C4mh1hLY.js";
|
|
3
3
|
//#region src/decompose.d.ts
|
|
4
4
|
declare function isHeadingParagraph(paragraph: ContentParagraph): paragraph is HeadingParagraph;
|
|
5
5
|
declare function isListParagraph(paragraph: ContentParagraph): paragraph is ListParagraph;
|
|
@@ -7,12 +7,12 @@ declare class ConstructMarkerImbalanceError extends Error {
|
|
|
7
7
|
readonly imbalance: ConstructMarkerImbalance;
|
|
8
8
|
constructor(imbalance: ConstructMarkerImbalance);
|
|
9
9
|
}
|
|
10
|
-
type
|
|
11
|
-
declare function decompose(content: ContentDocument):
|
|
10
|
+
type TreeChildren = SectionGroupNode[] | SlideGroupNode[] | SheetGroupNode[] | DrawPageGroupNode[] | ContentFormula[];
|
|
11
|
+
declare function decompose(content: ContentDocument): TreeChildren;
|
|
12
12
|
declare function decomposeSection(section: ContentSection): SectionGroupNode;
|
|
13
13
|
declare function decomposeSlide(slide: ContentSlide): SlideGroupNode;
|
|
14
14
|
declare function decomposeSheet(sheet: ContentSheet): SheetGroupNode;
|
|
15
15
|
declare function decomposeDrawPage(page: ContentDrawPage): DrawPageGroupNode;
|
|
16
16
|
declare function decomposeShape(shape: ContentShape): ShapeGroupNode;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { ConstructMarkerImbalanceError,
|
|
18
|
+
export { ConstructMarkerImbalanceError, TreeChildren, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
|
package/dist/decompose.js
CHANGED
|
@@ -50,7 +50,11 @@ function walkSectionBlocks(cursor) {
|
|
|
50
50
|
const block = step.value;
|
|
51
51
|
if (block.kind === "constructEnd") return root;
|
|
52
52
|
if (block.kind === "constructStart") {
|
|
53
|
-
|
|
53
|
+
listStack.length = 0;
|
|
54
|
+
headingScope().push({
|
|
55
|
+
node: block.descriptor,
|
|
56
|
+
children: walkSectionBlocks(cursor)
|
|
57
|
+
});
|
|
54
58
|
continue;
|
|
55
59
|
}
|
|
56
60
|
if (block.kind !== "paragraph") {
|
|
@@ -127,8 +131,8 @@ function walkShapeBlocks(cursor) {
|
|
|
127
131
|
const block = step.value;
|
|
128
132
|
if (block.kind === "constructEnd") return root;
|
|
129
133
|
if (block.kind === "constructStart") {
|
|
130
|
-
|
|
131
|
-
|
|
134
|
+
listStack.length = 0;
|
|
135
|
+
root.push({
|
|
132
136
|
node: block.descriptor,
|
|
133
137
|
children: walkShapeBlocks(cursor)
|
|
134
138
|
});
|
|
@@ -148,20 +152,6 @@ function walkShapeBlocks(cursor) {
|
|
|
148
152
|
}
|
|
149
153
|
return root;
|
|
150
154
|
}
|
|
151
|
-
function openConstructGroup(descriptor, cursor, listStack, headingScope) {
|
|
152
|
-
const parent = listStack.at(-1);
|
|
153
|
-
if (parent === void 0) {
|
|
154
|
-
headingScope.push({
|
|
155
|
-
node: descriptor,
|
|
156
|
-
children: walkSectionBlocks(cursor)
|
|
157
|
-
});
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
parent.children.push({
|
|
161
|
-
node: descriptor,
|
|
162
|
-
children: walkShapeBlocks(cursor)
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
155
|
function openListGroup(listStack, scopeChildren, paragraph) {
|
|
166
156
|
const level = paragraph.list.level;
|
|
167
157
|
for (let top = listStack.at(-1); top !== void 0 && top.node.list.level >= level; top = listStack.at(-1)) listStack.pop();
|
package/dist/definitions.cjs
CHANGED
|
@@ -11,7 +11,9 @@ const StyleParagraphPropertiesSchema = zod.z.strictObject({
|
|
|
11
11
|
spacingAfterPt: zod.z.number().optional(),
|
|
12
12
|
lineSpacing: zod.z.number().positive().optional(),
|
|
13
13
|
indentLeftPt: zod.z.number().optional(),
|
|
14
|
-
indentFirstLinePt: zod.z.number().optional()
|
|
14
|
+
indentFirstLinePt: zod.z.number().optional(),
|
|
15
|
+
pageBreakBefore: zod.z.boolean().optional(),
|
|
16
|
+
pageBreakAfter: zod.z.boolean().optional()
|
|
15
17
|
});
|
|
16
18
|
const StyleRunPropertiesSchema = zod.z.strictObject({
|
|
17
19
|
bold: zod.z.boolean().optional(),
|
|
@@ -82,6 +84,8 @@ function applyParagraphStyleProperties(properties, paragraph) {
|
|
|
82
84
|
if (effective.lineSpacing === void 0 && properties.lineSpacing !== void 0) effective.lineSpacing = properties.lineSpacing;
|
|
83
85
|
if (effective.indentLeftPt === void 0 && properties.indentLeftPt !== void 0) effective.indentLeftPt = properties.indentLeftPt;
|
|
84
86
|
if (effective.indentFirstLinePt === void 0 && properties.indentFirstLinePt !== void 0) effective.indentFirstLinePt = properties.indentFirstLinePt;
|
|
87
|
+
if (effective.pageBreakBefore === void 0 && properties.pageBreakBefore !== void 0) effective.pageBreakBefore = properties.pageBreakBefore;
|
|
88
|
+
if (effective.pageBreakAfter === void 0 && properties.pageBreakAfter !== void 0) effective.pageBreakAfter = properties.pageBreakAfter;
|
|
85
89
|
return effective;
|
|
86
90
|
}
|
|
87
91
|
function applyRunStyleProperties(properties, run) {
|
package/dist/definitions.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dt as ContentRun, rt as ContentParagraph } from "./content-BzkhrS6P.cjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/definitions.d.ts
|
|
4
4
|
declare const StyleParagraphPropertiesSchema: z.ZodObject<{
|
|
@@ -11,12 +11,24 @@ declare const StyleParagraphPropertiesSchema: z.ZodObject<{
|
|
|
11
11
|
list: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
numId: z.ZodOptional<z.ZodString>;
|
|
13
13
|
level: z.ZodNumber;
|
|
14
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
bullet: "bullet";
|
|
18
|
+
decimal: "decimal";
|
|
19
|
+
lowerLetter: "lowerLetter";
|
|
20
|
+
upperLetter: "upperLetter";
|
|
21
|
+
lowerRoman: "lowerRoman";
|
|
22
|
+
upperRoman: "upperRoman";
|
|
23
|
+
}>>;
|
|
14
24
|
}, z.core.$strip>>;
|
|
15
25
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
|
16
26
|
spacingAfterPt: z.ZodOptional<z.ZodNumber>;
|
|
17
27
|
lineSpacing: z.ZodOptional<z.ZodNumber>;
|
|
18
28
|
indentLeftPt: z.ZodOptional<z.ZodNumber>;
|
|
19
29
|
indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
pageBreakBefore: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
pageBreakAfter: z.ZodOptional<z.ZodBoolean>;
|
|
20
32
|
}, z.core.$strict>;
|
|
21
33
|
type StyleParagraphProperties = z.infer<typeof StyleParagraphPropertiesSchema>;
|
|
22
34
|
declare const StyleRunPropertiesSchema: z.ZodObject<{
|
|
@@ -44,12 +56,24 @@ declare const StyleEntrySchema: z.ZodObject<{
|
|
|
44
56
|
list: z.ZodOptional<z.ZodObject<{
|
|
45
57
|
numId: z.ZodOptional<z.ZodString>;
|
|
46
58
|
level: z.ZodNumber;
|
|
59
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
61
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
bullet: "bullet";
|
|
63
|
+
decimal: "decimal";
|
|
64
|
+
lowerLetter: "lowerLetter";
|
|
65
|
+
upperLetter: "upperLetter";
|
|
66
|
+
lowerRoman: "lowerRoman";
|
|
67
|
+
upperRoman: "upperRoman";
|
|
68
|
+
}>>;
|
|
47
69
|
}, z.core.$strip>>;
|
|
48
70
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
|
49
71
|
spacingAfterPt: z.ZodOptional<z.ZodNumber>;
|
|
50
72
|
lineSpacing: z.ZodOptional<z.ZodNumber>;
|
|
51
73
|
indentLeftPt: z.ZodOptional<z.ZodNumber>;
|
|
52
74
|
indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
pageBreakBefore: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
pageBreakAfter: z.ZodOptional<z.ZodBoolean>;
|
|
53
77
|
}, z.core.$strict>>;
|
|
54
78
|
run: z.ZodOptional<z.ZodObject<{
|
|
55
79
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -77,12 +101,24 @@ declare const StylesTableSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
77
101
|
list: z.ZodOptional<z.ZodObject<{
|
|
78
102
|
numId: z.ZodOptional<z.ZodString>;
|
|
79
103
|
level: z.ZodNumber;
|
|
104
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
106
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
107
|
+
bullet: "bullet";
|
|
108
|
+
decimal: "decimal";
|
|
109
|
+
lowerLetter: "lowerLetter";
|
|
110
|
+
upperLetter: "upperLetter";
|
|
111
|
+
lowerRoman: "lowerRoman";
|
|
112
|
+
upperRoman: "upperRoman";
|
|
113
|
+
}>>;
|
|
80
114
|
}, z.core.$strip>>;
|
|
81
115
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
|
82
116
|
spacingAfterPt: z.ZodOptional<z.ZodNumber>;
|
|
83
117
|
lineSpacing: z.ZodOptional<z.ZodNumber>;
|
|
84
118
|
indentLeftPt: z.ZodOptional<z.ZodNumber>;
|
|
85
119
|
indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
pageBreakBefore: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
pageBreakAfter: z.ZodOptional<z.ZodBoolean>;
|
|
86
122
|
}, z.core.$strict>>;
|
|
87
123
|
run: z.ZodOptional<z.ZodObject<{
|
|
88
124
|
bold: z.ZodOptional<z.ZodBoolean>;
|
package/dist/definitions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dt as ContentRun, rt as ContentParagraph } from "./content-BCOxY0Eb.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/definitions.d.ts
|
|
4
4
|
declare const StyleParagraphPropertiesSchema: z.ZodObject<{
|
|
@@ -11,12 +11,24 @@ declare const StyleParagraphPropertiesSchema: z.ZodObject<{
|
|
|
11
11
|
list: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
numId: z.ZodOptional<z.ZodString>;
|
|
13
13
|
level: z.ZodNumber;
|
|
14
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
bullet: "bullet";
|
|
18
|
+
decimal: "decimal";
|
|
19
|
+
lowerLetter: "lowerLetter";
|
|
20
|
+
upperLetter: "upperLetter";
|
|
21
|
+
lowerRoman: "lowerRoman";
|
|
22
|
+
upperRoman: "upperRoman";
|
|
23
|
+
}>>;
|
|
14
24
|
}, z.core.$strip>>;
|
|
15
25
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
|
16
26
|
spacingAfterPt: z.ZodOptional<z.ZodNumber>;
|
|
17
27
|
lineSpacing: z.ZodOptional<z.ZodNumber>;
|
|
18
28
|
indentLeftPt: z.ZodOptional<z.ZodNumber>;
|
|
19
29
|
indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
pageBreakBefore: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
pageBreakAfter: z.ZodOptional<z.ZodBoolean>;
|
|
20
32
|
}, z.core.$strict>;
|
|
21
33
|
type StyleParagraphProperties = z.infer<typeof StyleParagraphPropertiesSchema>;
|
|
22
34
|
declare const StyleRunPropertiesSchema: z.ZodObject<{
|
|
@@ -44,12 +56,24 @@ declare const StyleEntrySchema: z.ZodObject<{
|
|
|
44
56
|
list: z.ZodOptional<z.ZodObject<{
|
|
45
57
|
numId: z.ZodOptional<z.ZodString>;
|
|
46
58
|
level: z.ZodNumber;
|
|
59
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
61
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
bullet: "bullet";
|
|
63
|
+
decimal: "decimal";
|
|
64
|
+
lowerLetter: "lowerLetter";
|
|
65
|
+
upperLetter: "upperLetter";
|
|
66
|
+
lowerRoman: "lowerRoman";
|
|
67
|
+
upperRoman: "upperRoman";
|
|
68
|
+
}>>;
|
|
47
69
|
}, z.core.$strip>>;
|
|
48
70
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
|
49
71
|
spacingAfterPt: z.ZodOptional<z.ZodNumber>;
|
|
50
72
|
lineSpacing: z.ZodOptional<z.ZodNumber>;
|
|
51
73
|
indentLeftPt: z.ZodOptional<z.ZodNumber>;
|
|
52
74
|
indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
pageBreakBefore: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
pageBreakAfter: z.ZodOptional<z.ZodBoolean>;
|
|
53
77
|
}, z.core.$strict>>;
|
|
54
78
|
run: z.ZodOptional<z.ZodObject<{
|
|
55
79
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -77,12 +101,24 @@ declare const StylesTableSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
77
101
|
list: z.ZodOptional<z.ZodObject<{
|
|
78
102
|
numId: z.ZodOptional<z.ZodString>;
|
|
79
103
|
level: z.ZodNumber;
|
|
104
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
106
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
107
|
+
bullet: "bullet";
|
|
108
|
+
decimal: "decimal";
|
|
109
|
+
lowerLetter: "lowerLetter";
|
|
110
|
+
upperLetter: "upperLetter";
|
|
111
|
+
lowerRoman: "lowerRoman";
|
|
112
|
+
upperRoman: "upperRoman";
|
|
113
|
+
}>>;
|
|
80
114
|
}, z.core.$strip>>;
|
|
81
115
|
spacingBeforePt: z.ZodOptional<z.ZodNumber>;
|
|
82
116
|
spacingAfterPt: z.ZodOptional<z.ZodNumber>;
|
|
83
117
|
lineSpacing: z.ZodOptional<z.ZodNumber>;
|
|
84
118
|
indentLeftPt: z.ZodOptional<z.ZodNumber>;
|
|
85
119
|
indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
pageBreakBefore: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
pageBreakAfter: z.ZodOptional<z.ZodBoolean>;
|
|
86
122
|
}, z.core.$strict>>;
|
|
87
123
|
run: z.ZodOptional<z.ZodObject<{
|
|
88
124
|
bold: z.ZodOptional<z.ZodBoolean>;
|
package/dist/definitions.js
CHANGED
|
@@ -10,7 +10,9 @@ const StyleParagraphPropertiesSchema = z.strictObject({
|
|
|
10
10
|
spacingAfterPt: z.number().optional(),
|
|
11
11
|
lineSpacing: z.number().positive().optional(),
|
|
12
12
|
indentLeftPt: z.number().optional(),
|
|
13
|
-
indentFirstLinePt: z.number().optional()
|
|
13
|
+
indentFirstLinePt: z.number().optional(),
|
|
14
|
+
pageBreakBefore: z.boolean().optional(),
|
|
15
|
+
pageBreakAfter: z.boolean().optional()
|
|
14
16
|
});
|
|
15
17
|
const StyleRunPropertiesSchema = z.strictObject({
|
|
16
18
|
bold: z.boolean().optional(),
|
|
@@ -81,6 +83,8 @@ function applyParagraphStyleProperties(properties, paragraph) {
|
|
|
81
83
|
if (effective.lineSpacing === void 0 && properties.lineSpacing !== void 0) effective.lineSpacing = properties.lineSpacing;
|
|
82
84
|
if (effective.indentLeftPt === void 0 && properties.indentLeftPt !== void 0) effective.indentLeftPt = properties.indentLeftPt;
|
|
83
85
|
if (effective.indentFirstLinePt === void 0 && properties.indentFirstLinePt !== void 0) effective.indentFirstLinePt = properties.indentFirstLinePt;
|
|
86
|
+
if (effective.pageBreakBefore === void 0 && properties.pageBreakBefore !== void 0) effective.pageBreakBefore = properties.pageBreakBefore;
|
|
87
|
+
if (effective.pageBreakAfter === void 0 && properties.pageBreakAfter !== void 0) effective.pageBreakAfter = properties.pageBreakAfter;
|
|
84
88
|
return effective;
|
|
85
89
|
}
|
|
86
90
|
function applyRunStyleProperties(properties, run) {
|
package/dist/factor-styles.cjs
CHANGED
|
@@ -9,7 +9,9 @@ const PARAGRAPH_STYLE_KEYS = [
|
|
|
9
9
|
"spacingAfterPt",
|
|
10
10
|
"lineSpacing",
|
|
11
11
|
"indentLeftPt",
|
|
12
|
-
"indentFirstLinePt"
|
|
12
|
+
"indentFirstLinePt",
|
|
13
|
+
"pageBreakBefore",
|
|
14
|
+
"pageBreakAfter"
|
|
13
15
|
];
|
|
14
16
|
const RUN_STYLE_KEYS = [
|
|
15
17
|
"bold",
|
|
@@ -38,7 +40,7 @@ function isHeadingGroup(group) {
|
|
|
38
40
|
function isConstructGroup(child) {
|
|
39
41
|
return "node" in child && "children" in child && child.node.kind !== "paragraph";
|
|
40
42
|
}
|
|
41
|
-
function
|
|
43
|
+
function assembleTree(content, pages) {
|
|
42
44
|
const envelope = {
|
|
43
45
|
metadata: content.metadata,
|
|
44
46
|
...content.symbolTable !== void 0 ? { symbolTable: content.symbolTable } : {},
|
|
@@ -73,11 +75,15 @@ function assemblePackage(content, pages) {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
function factorStyles(pkg) {
|
|
76
|
-
const reassembled =
|
|
77
|
-
|
|
78
|
+
const reassembled = assembleTree(require_flatten.flattenTree(pkg), pkg.pages);
|
|
79
|
+
const carried = {
|
|
80
|
+
...pkg.definitions !== void 0 ? { definitions: pkg.definitions } : {},
|
|
81
|
+
...pkg.source !== void 0 ? { source: pkg.source } : {}
|
|
82
|
+
};
|
|
83
|
+
if (pkg.definitions === void 0 && pkg.source === void 0) return reassembled;
|
|
78
84
|
return {
|
|
79
85
|
...reassembled,
|
|
80
|
-
|
|
86
|
+
...carried
|
|
81
87
|
};
|
|
82
88
|
}
|
|
83
89
|
function extentOf(wrapper) {
|
|
@@ -421,15 +427,15 @@ function rebuildParagraph(paragraph, chain) {
|
|
|
421
427
|
}
|
|
422
428
|
function stripParagraphKeys(paragraph, keys) {
|
|
423
429
|
const copy = { ...paragraph };
|
|
424
|
-
for (const key of keys)
|
|
430
|
+
for (const key of keys) Reflect.deleteProperty(copy, key);
|
|
425
431
|
return copy;
|
|
426
432
|
}
|
|
427
433
|
function stripRunKeys(run, keys) {
|
|
428
434
|
const copy = { ...run };
|
|
429
|
-
for (const key of keys)
|
|
435
|
+
for (const key of keys) Reflect.deleteProperty(copy, key);
|
|
430
436
|
return copy;
|
|
431
437
|
}
|
|
432
438
|
//#endregion
|
|
433
|
-
exports.
|
|
439
|
+
exports.assembleTree = assembleTree;
|
|
434
440
|
exports.factorStyles = factorStyles;
|
|
435
441
|
exports.mint = mint;
|
package/dist/factor-styles.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { l as PageSize } from "./geometry-CvcjSwnA.cjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { b as ContentDocument } from "./content-BzkhrS6P.cjs";
|
|
3
|
+
import { DocumentTree } from "./package.cjs";
|
|
4
4
|
//#region src/factor-styles.d.ts
|
|
5
|
-
declare function
|
|
6
|
-
declare function factorStyles(pkg:
|
|
7
|
-
declare function mint(pkg:
|
|
5
|
+
declare function assembleTree(content: ContentDocument, pages?: readonly PageSize[]): DocumentTree;
|
|
6
|
+
declare function factorStyles(pkg: DocumentTree): DocumentTree;
|
|
7
|
+
declare function mint(pkg: DocumentTree): DocumentTree;
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { assembleTree, factorStyles, mint };
|
package/dist/factor-styles.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { l as PageSize } from "./geometry-CvcjSwnA.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { b as ContentDocument } from "./content-BCOxY0Eb.js";
|
|
3
|
+
import { DocumentTree } from "./package.js";
|
|
4
4
|
//#region src/factor-styles.d.ts
|
|
5
|
-
declare function
|
|
6
|
-
declare function factorStyles(pkg:
|
|
7
|
-
declare function mint(pkg:
|
|
5
|
+
declare function assembleTree(content: ContentDocument, pages?: readonly PageSize[]): DocumentTree;
|
|
6
|
+
declare function factorStyles(pkg: DocumentTree): DocumentTree;
|
|
7
|
+
declare function mint(pkg: DocumentTree): DocumentTree;
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { assembleTree, factorStyles, mint };
|
package/dist/factor-styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { canonicalKey } from "./canonicalise.js";
|
|
2
2
|
import { decomposeDrawPage, decomposeSection, decomposeSheet, decomposeSlide } from "./decompose.js";
|
|
3
|
-
import {
|
|
3
|
+
import { flattenTree } from "./flatten.js";
|
|
4
4
|
//#region src/factor-styles.ts
|
|
5
5
|
const PARAGRAPH_STYLE_KEYS = [
|
|
6
6
|
"alignment",
|
|
@@ -8,7 +8,9 @@ const PARAGRAPH_STYLE_KEYS = [
|
|
|
8
8
|
"spacingAfterPt",
|
|
9
9
|
"lineSpacing",
|
|
10
10
|
"indentLeftPt",
|
|
11
|
-
"indentFirstLinePt"
|
|
11
|
+
"indentFirstLinePt",
|
|
12
|
+
"pageBreakBefore",
|
|
13
|
+
"pageBreakAfter"
|
|
12
14
|
];
|
|
13
15
|
const RUN_STYLE_KEYS = [
|
|
14
16
|
"bold",
|
|
@@ -37,7 +39,7 @@ function isHeadingGroup(group) {
|
|
|
37
39
|
function isConstructGroup(child) {
|
|
38
40
|
return "node" in child && "children" in child && child.node.kind !== "paragraph";
|
|
39
41
|
}
|
|
40
|
-
function
|
|
42
|
+
function assembleTree(content, pages) {
|
|
41
43
|
const envelope = {
|
|
42
44
|
metadata: content.metadata,
|
|
43
45
|
...content.symbolTable !== void 0 ? { symbolTable: content.symbolTable } : {},
|
|
@@ -72,11 +74,15 @@ function assemblePackage(content, pages) {
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
function factorStyles(pkg) {
|
|
75
|
-
const reassembled =
|
|
76
|
-
|
|
77
|
+
const reassembled = assembleTree(flattenTree(pkg), pkg.pages);
|
|
78
|
+
const carried = {
|
|
79
|
+
...pkg.definitions !== void 0 ? { definitions: pkg.definitions } : {},
|
|
80
|
+
...pkg.source !== void 0 ? { source: pkg.source } : {}
|
|
81
|
+
};
|
|
82
|
+
if (pkg.definitions === void 0 && pkg.source === void 0) return reassembled;
|
|
77
83
|
return {
|
|
78
84
|
...reassembled,
|
|
79
|
-
|
|
85
|
+
...carried
|
|
80
86
|
};
|
|
81
87
|
}
|
|
82
88
|
function extentOf(wrapper) {
|
|
@@ -420,13 +426,13 @@ function rebuildParagraph(paragraph, chain) {
|
|
|
420
426
|
}
|
|
421
427
|
function stripParagraphKeys(paragraph, keys) {
|
|
422
428
|
const copy = { ...paragraph };
|
|
423
|
-
for (const key of keys)
|
|
429
|
+
for (const key of keys) Reflect.deleteProperty(copy, key);
|
|
424
430
|
return copy;
|
|
425
431
|
}
|
|
426
432
|
function stripRunKeys(run, keys) {
|
|
427
433
|
const copy = { ...run };
|
|
428
|
-
for (const key of keys)
|
|
434
|
+
for (const key of keys) Reflect.deleteProperty(copy, key);
|
|
429
435
|
return copy;
|
|
430
436
|
}
|
|
431
437
|
//#endregion
|
|
432
|
-
export {
|
|
438
|
+
export { assembleTree, factorStyles, mint };
|
package/dist/flatten.cjs
CHANGED
|
@@ -7,7 +7,7 @@ function chainWithRef(chain, group) {
|
|
|
7
7
|
}
|
|
8
8
|
function entryOf(styles, chain) {
|
|
9
9
|
if (chain.length === 0) return void 0;
|
|
10
|
-
if (styles === void 0) throw new Error("
|
|
10
|
+
if (styles === void 0) throw new Error("flattenTree: a group carries a style ref but the package has no styles table");
|
|
11
11
|
return require_definitions.resolveStyleChain(styles, chain);
|
|
12
12
|
}
|
|
13
13
|
function applyEntry(entry, paragraph) {
|
|
@@ -19,7 +19,7 @@ function applyEntry(entry, paragraph) {
|
|
|
19
19
|
runs: withParagraph.runs.map((run) => require_definitions.applyRunStyleProperties(runProperties, run))
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function flattenTree(pkg) {
|
|
23
23
|
const styles = pkg.styles;
|
|
24
24
|
const envelope = {
|
|
25
25
|
metadata: pkg.metadata,
|
|
@@ -49,7 +49,7 @@ function flattenPackage(pkg) {
|
|
|
49
49
|
kind: "spreadsheet",
|
|
50
50
|
...envelope,
|
|
51
51
|
sheets: pkg.children.map((group) => {
|
|
52
|
-
if (group.style !== void 0) throw new Error("
|
|
52
|
+
if (group.style !== void 0) throw new Error("flattenTree: a sheet group carries a style ref but a sheet holds no block flow to resolve it onto");
|
|
53
53
|
const images = [];
|
|
54
54
|
const embedded = [];
|
|
55
55
|
for (const child of group.children) if ("kind" in child) images.push(child);
|
|
@@ -79,7 +79,7 @@ function flattenPackage(pkg) {
|
|
|
79
79
|
};
|
|
80
80
|
case "formula": {
|
|
81
81
|
const first = pkg.children[0];
|
|
82
|
-
if (pkg.children.length !== 1 || first === void 0 || !require_content.ContentFormulaSchema.safeParse(first).success) throw new Error("
|
|
82
|
+
if (pkg.children.length !== 1 || first === void 0 || !require_content.ContentFormulaSchema.safeParse(first).success) throw new Error("flattenTree: a formula package takes exactly one ContentFormula node");
|
|
83
83
|
return {
|
|
84
84
|
kind: "formula",
|
|
85
85
|
...envelope,
|
|
@@ -151,4 +151,4 @@ function resolveAnchor(styles, chain, anchor) {
|
|
|
151
151
|
return applyEntry(entry, anchor);
|
|
152
152
|
}
|
|
153
153
|
//#endregion
|
|
154
|
-
exports.
|
|
154
|
+
exports.flattenTree = flattenTree;
|
package/dist/flatten.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { b as ContentDocument } from "./content-BzkhrS6P.cjs";
|
|
2
|
+
import { DocumentTree } from "./package.cjs";
|
|
3
3
|
//#region src/flatten.d.ts
|
|
4
|
-
declare function
|
|
4
|
+
declare function flattenTree(pkg: DocumentTree): ContentDocument;
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { flattenTree };
|
package/dist/flatten.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { b as ContentDocument } from "./content-BCOxY0Eb.js";
|
|
2
|
+
import { DocumentTree } from "./package.js";
|
|
3
3
|
//#region src/flatten.d.ts
|
|
4
|
-
declare function
|
|
4
|
+
declare function flattenTree(pkg: DocumentTree): ContentDocument;
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { flattenTree };
|
package/dist/flatten.js
CHANGED
|
@@ -6,7 +6,7 @@ function chainWithRef(chain, group) {
|
|
|
6
6
|
}
|
|
7
7
|
function entryOf(styles, chain) {
|
|
8
8
|
if (chain.length === 0) return void 0;
|
|
9
|
-
if (styles === void 0) throw new Error("
|
|
9
|
+
if (styles === void 0) throw new Error("flattenTree: a group carries a style ref but the package has no styles table");
|
|
10
10
|
return resolveStyleChain(styles, chain);
|
|
11
11
|
}
|
|
12
12
|
function applyEntry(entry, paragraph) {
|
|
@@ -18,7 +18,7 @@ function applyEntry(entry, paragraph) {
|
|
|
18
18
|
runs: withParagraph.runs.map((run) => applyRunStyleProperties(runProperties, run))
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function flattenTree(pkg) {
|
|
22
22
|
const styles = pkg.styles;
|
|
23
23
|
const envelope = {
|
|
24
24
|
metadata: pkg.metadata,
|
|
@@ -48,7 +48,7 @@ function flattenPackage(pkg) {
|
|
|
48
48
|
kind: "spreadsheet",
|
|
49
49
|
...envelope,
|
|
50
50
|
sheets: pkg.children.map((group) => {
|
|
51
|
-
if (group.style !== void 0) throw new Error("
|
|
51
|
+
if (group.style !== void 0) throw new Error("flattenTree: a sheet group carries a style ref but a sheet holds no block flow to resolve it onto");
|
|
52
52
|
const images = [];
|
|
53
53
|
const embedded = [];
|
|
54
54
|
for (const child of group.children) if ("kind" in child) images.push(child);
|
|
@@ -78,7 +78,7 @@ function flattenPackage(pkg) {
|
|
|
78
78
|
};
|
|
79
79
|
case "formula": {
|
|
80
80
|
const first = pkg.children[0];
|
|
81
|
-
if (pkg.children.length !== 1 || first === void 0 || !ContentFormulaSchema.safeParse(first).success) throw new Error("
|
|
81
|
+
if (pkg.children.length !== 1 || first === void 0 || !ContentFormulaSchema.safeParse(first).success) throw new Error("flattenTree: a formula package takes exactly one ContentFormula node");
|
|
82
82
|
return {
|
|
83
83
|
kind: "formula",
|
|
84
84
|
...envelope,
|
|
@@ -150,4 +150,4 @@ function resolveAnchor(styles, chain, anchor) {
|
|
|
150
150
|
return applyEntry(entry, anchor);
|
|
151
151
|
}
|
|
152
152
|
//#endregion
|
|
153
|
-
export {
|
|
153
|
+
export { flattenTree };
|
package/dist/font-port.d.cts
CHANGED
|
@@ -14,13 +14,13 @@ interface FontSubstitution {
|
|
|
14
14
|
readonly requestedFamily: string;
|
|
15
15
|
readonly requestedBold: boolean;
|
|
16
16
|
readonly requestedItalic: boolean;
|
|
17
|
-
readonly reason:
|
|
17
|
+
readonly reason: "missing-face" | "vendored-substitute";
|
|
18
18
|
readonly resolvedFamily: string;
|
|
19
19
|
}
|
|
20
20
|
interface FontRegistryOptions {
|
|
21
21
|
readonly sourceFonts?: readonly ProvidedFont[];
|
|
22
22
|
readonly fonts?: readonly ProvidedFont[];
|
|
23
|
-
readonly substitutes?:
|
|
23
|
+
readonly substitutes?: "vendored" | "none";
|
|
24
24
|
readonly onSubstitution?: (substitution: FontSubstitution) => void;
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
package/dist/font-port.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ interface FontSubstitution {
|
|
|
14
14
|
readonly requestedFamily: string;
|
|
15
15
|
readonly requestedBold: boolean;
|
|
16
16
|
readonly requestedItalic: boolean;
|
|
17
|
-
readonly reason:
|
|
17
|
+
readonly reason: "missing-face" | "vendored-substitute";
|
|
18
18
|
readonly resolvedFamily: string;
|
|
19
19
|
}
|
|
20
20
|
interface FontRegistryOptions {
|
|
21
21
|
readonly sourceFonts?: readonly ProvidedFont[];
|
|
22
22
|
readonly fonts?: readonly ProvidedFont[];
|
|
23
|
-
readonly substitutes?:
|
|
23
|
+
readonly substitutes?: "vendored" | "none";
|
|
24
24
|
readonly onSubstitution?: (substitution: FontSubstitution) => void;
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|