document-schema 4.2.0 → 4.3.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 +30 -4
- package/dist/canonicalise.cjs +20 -0
- package/dist/canonicalise.d.cts +5 -0
- package/dist/canonicalise.d.ts +5 -0
- package/dist/canonicalise.js +18 -0
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{construct-D5pdDPqM.d.cts → construct-CdQuI9f5.d.cts} +6 -6
- package/dist/{construct-D5pdDPqM.d.ts → construct-CdQuI9f5.d.ts} +6 -6
- package/dist/construct.d.cts +1 -1
- package/dist/construct.d.ts +1 -1
- package/dist/{content-oSmH1_zP.d.cts → content-BmqzegMG.d.cts} +9 -9
- package/dist/{content-D3C14yyb.d.ts → content-CIwPb_yh.d.ts} +9 -9
- package/dist/content.d.cts +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/decompose.cjs +186 -0
- package/dist/decompose.d.cts +18 -0
- package/dist/decompose.d.ts +18 -0
- package/dist/decompose.js +177 -0
- package/dist/definitions.d.cts +1 -1
- package/dist/definitions.d.ts +1 -1
- package/dist/factor-styles.cjs +435 -0
- package/dist/factor-styles.d.cts +9 -0
- package/dist/factor-styles.d.ts +9 -0
- package/dist/factor-styles.js +432 -0
- package/dist/flatten.cjs +154 -0
- package/dist/flatten.d.cts +6 -0
- package/dist/flatten.d.ts +6 -0
- package/dist/flatten.js +153 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +4 -1
- package/dist/{math-BlG8Tjk-.d.cts → math-B7gZJeND.d.cts} +3 -3
- package/dist/{math-BlG8Tjk-.d.ts → math-B7gZJeND.d.ts} +3 -3
- package/dist/math.d.cts +1 -1
- package/dist/math.d.ts +1 -1
- package/dist/{package-node-B9qLyhk5.d.ts → package-node-C7RiYhyk.d.ts} +48 -48
- package/dist/{package-node-DUKZHgAg.d.cts → package-node-a9CyRaD3.d.cts} +48 -48
- package/dist/package-node.d.cts +1 -1
- package/dist/package-node.d.ts +1 -1
- package/dist/package.d.cts +7 -7
- package/dist/package.d.ts +7 -7
- 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.d.cts +2 -2
- package/dist/style.d.ts +2 -2
- package/package.json +2 -2
- package/schemas/content-document.schema.json +3 -3
- package/schemas/document-package.schema.json +3 -3
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_content = require("./content.cjs");
|
|
3
|
+
//#region src/decompose.ts
|
|
4
|
+
function isHeadingParagraph(paragraph) {
|
|
5
|
+
return paragraph.headingLevel !== void 0;
|
|
6
|
+
}
|
|
7
|
+
function isListParagraph(paragraph) {
|
|
8
|
+
return paragraph.list !== void 0;
|
|
9
|
+
}
|
|
10
|
+
var ConstructMarkerImbalanceError = class extends Error {
|
|
11
|
+
imbalance;
|
|
12
|
+
constructor(imbalance) {
|
|
13
|
+
super(imbalance.kind === "unmatchedEnd" ? `decompose: the constructEnd marker at index ${imbalance.index} of this container's block flow closes no open construct` : `decompose: the constructStart marker at index ${imbalance.index} of this container's block flow is never closed`);
|
|
14
|
+
this.name = "ConstructMarkerImbalanceError";
|
|
15
|
+
this.imbalance = imbalance;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function decompose(content) {
|
|
19
|
+
switch (content.kind) {
|
|
20
|
+
case "wordprocessing": return content.sections.map(decomposeSection);
|
|
21
|
+
case "presentation": return content.slides.map(decomposeSlide);
|
|
22
|
+
case "spreadsheet": return content.sheets.map(decomposeSheet);
|
|
23
|
+
case "drawing": return content.pages.map(decomposeDrawPage);
|
|
24
|
+
case "formula": return [content.formula];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function decomposeSection(section) {
|
|
28
|
+
const { blocks, ...rest } = section;
|
|
29
|
+
return {
|
|
30
|
+
node: {
|
|
31
|
+
kind: "section",
|
|
32
|
+
...rest
|
|
33
|
+
},
|
|
34
|
+
children: decomposeSectionBlocks(blocks)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function assertBalancedConstructMarkers(blocks) {
|
|
38
|
+
const imbalance = require_content.findConstructMarkerImbalance(blocks);
|
|
39
|
+
if (imbalance !== void 0) throw new ConstructMarkerImbalanceError(imbalance);
|
|
40
|
+
}
|
|
41
|
+
function decomposeSectionBlocks(blocks) {
|
|
42
|
+
assertBalancedConstructMarkers(blocks);
|
|
43
|
+
return walkSectionBlocks(blocks.values());
|
|
44
|
+
}
|
|
45
|
+
function walkSectionBlocks(cursor) {
|
|
46
|
+
const root = [];
|
|
47
|
+
const headingStack = [];
|
|
48
|
+
const listStack = [];
|
|
49
|
+
const headingScope = () => headingStack.at(-1)?.children ?? root;
|
|
50
|
+
for (let step = cursor.next(); step.done !== true; step = cursor.next()) {
|
|
51
|
+
const block = step.value;
|
|
52
|
+
if (block.kind === "constructEnd") return root;
|
|
53
|
+
if (block.kind === "constructStart") {
|
|
54
|
+
openConstructGroup(block.descriptor, cursor, listStack, headingScope());
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (block.kind !== "paragraph") {
|
|
58
|
+
const parent = listStack.at(-1);
|
|
59
|
+
(parent !== void 0 ? parent.children : headingScope()).push(block);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (isHeadingParagraph(block)) {
|
|
63
|
+
listStack.length = 0;
|
|
64
|
+
const level = block.headingLevel;
|
|
65
|
+
for (let top = headingStack.at(-1); top !== void 0 && top.node.headingLevel >= level; top = headingStack.at(-1)) headingStack.pop();
|
|
66
|
+
const group = {
|
|
67
|
+
node: block,
|
|
68
|
+
children: []
|
|
69
|
+
};
|
|
70
|
+
const parent = headingStack.at(-1);
|
|
71
|
+
(parent !== void 0 ? parent.children : root).push(group);
|
|
72
|
+
headingStack.push(group);
|
|
73
|
+
} else if (isListParagraph(block)) openListGroup(listStack, headingScope(), block);
|
|
74
|
+
else {
|
|
75
|
+
listStack.length = 0;
|
|
76
|
+
headingScope().push(block);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return root;
|
|
80
|
+
}
|
|
81
|
+
function decomposeSlide(slide) {
|
|
82
|
+
const { shapes, ...rest } = slide;
|
|
83
|
+
return {
|
|
84
|
+
node: {
|
|
85
|
+
kind: "slide",
|
|
86
|
+
...rest
|
|
87
|
+
},
|
|
88
|
+
children: shapes.map(decomposeShape)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function decomposeSheet(sheet) {
|
|
92
|
+
const { images, embeddedObjects, ...rest } = sheet;
|
|
93
|
+
const children = [...images, ...embeddedObjects ?? []];
|
|
94
|
+
return {
|
|
95
|
+
node: {
|
|
96
|
+
kind: "sheet",
|
|
97
|
+
...rest
|
|
98
|
+
},
|
|
99
|
+
children
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function decomposeDrawPage(page) {
|
|
103
|
+
const { shapes, vectors, ...rest } = page;
|
|
104
|
+
const children = [...shapes.map(decomposeShape), ...vectors];
|
|
105
|
+
return {
|
|
106
|
+
node: {
|
|
107
|
+
kind: "drawPage",
|
|
108
|
+
...rest
|
|
109
|
+
},
|
|
110
|
+
children
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function decomposeShape(shape) {
|
|
114
|
+
const { blocks, ...rest } = shape;
|
|
115
|
+
return {
|
|
116
|
+
node: rest,
|
|
117
|
+
children: decomposeShapeBlocks(blocks)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function decomposeShapeBlocks(blocks) {
|
|
121
|
+
assertBalancedConstructMarkers(blocks);
|
|
122
|
+
return walkShapeBlocks(blocks.values());
|
|
123
|
+
}
|
|
124
|
+
function walkShapeBlocks(cursor) {
|
|
125
|
+
const root = [];
|
|
126
|
+
const listStack = [];
|
|
127
|
+
for (let step = cursor.next(); step.done !== true; step = cursor.next()) {
|
|
128
|
+
const block = step.value;
|
|
129
|
+
if (block.kind === "constructEnd") return root;
|
|
130
|
+
if (block.kind === "constructStart") {
|
|
131
|
+
const parent = listStack.at(-1);
|
|
132
|
+
(parent !== void 0 ? parent.children : root).push({
|
|
133
|
+
node: block.descriptor,
|
|
134
|
+
children: walkShapeBlocks(cursor)
|
|
135
|
+
});
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (block.kind !== "paragraph") {
|
|
139
|
+
const parent = listStack.at(-1);
|
|
140
|
+
(parent !== void 0 ? parent.children : root).push(block);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (isListParagraph(block)) {
|
|
144
|
+
openListGroup(listStack, root, block);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
listStack.length = 0;
|
|
148
|
+
root.push(block);
|
|
149
|
+
}
|
|
150
|
+
return root;
|
|
151
|
+
}
|
|
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
|
+
function openListGroup(listStack, scopeChildren, paragraph) {
|
|
167
|
+
const level = paragraph.list.level;
|
|
168
|
+
for (let top = listStack.at(-1); top !== void 0 && top.node.list.level >= level; top = listStack.at(-1)) listStack.pop();
|
|
169
|
+
const group = {
|
|
170
|
+
node: paragraph,
|
|
171
|
+
children: []
|
|
172
|
+
};
|
|
173
|
+
const parent = listStack.at(-1);
|
|
174
|
+
(parent !== void 0 ? parent.children : scopeChildren).push(group);
|
|
175
|
+
listStack.push(group);
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
exports.ConstructMarkerImbalanceError = ConstructMarkerImbalanceError;
|
|
179
|
+
exports.decompose = decompose;
|
|
180
|
+
exports.decomposeDrawPage = decomposeDrawPage;
|
|
181
|
+
exports.decomposeSection = decomposeSection;
|
|
182
|
+
exports.decomposeShape = decomposeShape;
|
|
183
|
+
exports.decomposeSheet = decomposeSheet;
|
|
184
|
+
exports.decomposeSlide = decomposeSlide;
|
|
185
|
+
exports.isHeadingParagraph = isHeadingParagraph;
|
|
186
|
+
exports.isListParagraph = isListParagraph;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { C as ContentFormula, U as ContentSheet, V as ContentShape, g as ContentDrawPage, j as ContentParagraph, m as ContentDocument, st as ContentSlide, t as ConstructMarkerImbalance, z as ContentSection } from "./content-BmqzegMG.cjs";
|
|
2
|
+
import { B as SheetGroupNode, F as ShapeGroupNode, O as SectionGroupNode, W as SlideGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-a9CyRaD3.cjs";
|
|
3
|
+
//#region src/decompose.d.ts
|
|
4
|
+
declare function isHeadingParagraph(paragraph: ContentParagraph): paragraph is HeadingParagraph;
|
|
5
|
+
declare function isListParagraph(paragraph: ContentParagraph): paragraph is ListParagraph;
|
|
6
|
+
declare class ConstructMarkerImbalanceError extends Error {
|
|
7
|
+
readonly imbalance: ConstructMarkerImbalance;
|
|
8
|
+
constructor(imbalance: ConstructMarkerImbalance);
|
|
9
|
+
}
|
|
10
|
+
type PackageChildren = SectionGroupNode[] | SlideGroupNode[] | SheetGroupNode[] | DrawPageGroupNode[] | ContentFormula[];
|
|
11
|
+
declare function decompose(content: ContentDocument): PackageChildren;
|
|
12
|
+
declare function decomposeSection(section: ContentSection): SectionGroupNode;
|
|
13
|
+
declare function decomposeSlide(slide: ContentSlide): SlideGroupNode;
|
|
14
|
+
declare function decomposeSheet(sheet: ContentSheet): SheetGroupNode;
|
|
15
|
+
declare function decomposeDrawPage(page: ContentDrawPage): DrawPageGroupNode;
|
|
16
|
+
declare function decomposeShape(shape: ContentShape): ShapeGroupNode;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ConstructMarkerImbalanceError, PackageChildren, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { C as ContentFormula, U as ContentSheet, V as ContentShape, g as ContentDrawPage, j as ContentParagraph, m as ContentDocument, st as ContentSlide, t as ConstructMarkerImbalance, z as ContentSection } from "./content-CIwPb_yh.js";
|
|
2
|
+
import { B as SheetGroupNode, F as ShapeGroupNode, O as SectionGroupNode, W as SlideGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-C7RiYhyk.js";
|
|
3
|
+
//#region src/decompose.d.ts
|
|
4
|
+
declare function isHeadingParagraph(paragraph: ContentParagraph): paragraph is HeadingParagraph;
|
|
5
|
+
declare function isListParagraph(paragraph: ContentParagraph): paragraph is ListParagraph;
|
|
6
|
+
declare class ConstructMarkerImbalanceError extends Error {
|
|
7
|
+
readonly imbalance: ConstructMarkerImbalance;
|
|
8
|
+
constructor(imbalance: ConstructMarkerImbalance);
|
|
9
|
+
}
|
|
10
|
+
type PackageChildren = SectionGroupNode[] | SlideGroupNode[] | SheetGroupNode[] | DrawPageGroupNode[] | ContentFormula[];
|
|
11
|
+
declare function decompose(content: ContentDocument): PackageChildren;
|
|
12
|
+
declare function decomposeSection(section: ContentSection): SectionGroupNode;
|
|
13
|
+
declare function decomposeSlide(slide: ContentSlide): SlideGroupNode;
|
|
14
|
+
declare function decomposeSheet(sheet: ContentSheet): SheetGroupNode;
|
|
15
|
+
declare function decomposeDrawPage(page: ContentDrawPage): DrawPageGroupNode;
|
|
16
|
+
declare function decomposeShape(shape: ContentShape): ShapeGroupNode;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ConstructMarkerImbalanceError, PackageChildren, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { findConstructMarkerImbalance } from "./content.js";
|
|
2
|
+
//#region src/decompose.ts
|
|
3
|
+
function isHeadingParagraph(paragraph) {
|
|
4
|
+
return paragraph.headingLevel !== void 0;
|
|
5
|
+
}
|
|
6
|
+
function isListParagraph(paragraph) {
|
|
7
|
+
return paragraph.list !== void 0;
|
|
8
|
+
}
|
|
9
|
+
var ConstructMarkerImbalanceError = class extends Error {
|
|
10
|
+
imbalance;
|
|
11
|
+
constructor(imbalance) {
|
|
12
|
+
super(imbalance.kind === "unmatchedEnd" ? `decompose: the constructEnd marker at index ${imbalance.index} of this container's block flow closes no open construct` : `decompose: the constructStart marker at index ${imbalance.index} of this container's block flow is never closed`);
|
|
13
|
+
this.name = "ConstructMarkerImbalanceError";
|
|
14
|
+
this.imbalance = imbalance;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function decompose(content) {
|
|
18
|
+
switch (content.kind) {
|
|
19
|
+
case "wordprocessing": return content.sections.map(decomposeSection);
|
|
20
|
+
case "presentation": return content.slides.map(decomposeSlide);
|
|
21
|
+
case "spreadsheet": return content.sheets.map(decomposeSheet);
|
|
22
|
+
case "drawing": return content.pages.map(decomposeDrawPage);
|
|
23
|
+
case "formula": return [content.formula];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function decomposeSection(section) {
|
|
27
|
+
const { blocks, ...rest } = section;
|
|
28
|
+
return {
|
|
29
|
+
node: {
|
|
30
|
+
kind: "section",
|
|
31
|
+
...rest
|
|
32
|
+
},
|
|
33
|
+
children: decomposeSectionBlocks(blocks)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function assertBalancedConstructMarkers(blocks) {
|
|
37
|
+
const imbalance = findConstructMarkerImbalance(blocks);
|
|
38
|
+
if (imbalance !== void 0) throw new ConstructMarkerImbalanceError(imbalance);
|
|
39
|
+
}
|
|
40
|
+
function decomposeSectionBlocks(blocks) {
|
|
41
|
+
assertBalancedConstructMarkers(blocks);
|
|
42
|
+
return walkSectionBlocks(blocks.values());
|
|
43
|
+
}
|
|
44
|
+
function walkSectionBlocks(cursor) {
|
|
45
|
+
const root = [];
|
|
46
|
+
const headingStack = [];
|
|
47
|
+
const listStack = [];
|
|
48
|
+
const headingScope = () => headingStack.at(-1)?.children ?? root;
|
|
49
|
+
for (let step = cursor.next(); step.done !== true; step = cursor.next()) {
|
|
50
|
+
const block = step.value;
|
|
51
|
+
if (block.kind === "constructEnd") return root;
|
|
52
|
+
if (block.kind === "constructStart") {
|
|
53
|
+
openConstructGroup(block.descriptor, cursor, listStack, headingScope());
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (block.kind !== "paragraph") {
|
|
57
|
+
const parent = listStack.at(-1);
|
|
58
|
+
(parent !== void 0 ? parent.children : headingScope()).push(block);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (isHeadingParagraph(block)) {
|
|
62
|
+
listStack.length = 0;
|
|
63
|
+
const level = block.headingLevel;
|
|
64
|
+
for (let top = headingStack.at(-1); top !== void 0 && top.node.headingLevel >= level; top = headingStack.at(-1)) headingStack.pop();
|
|
65
|
+
const group = {
|
|
66
|
+
node: block,
|
|
67
|
+
children: []
|
|
68
|
+
};
|
|
69
|
+
const parent = headingStack.at(-1);
|
|
70
|
+
(parent !== void 0 ? parent.children : root).push(group);
|
|
71
|
+
headingStack.push(group);
|
|
72
|
+
} else if (isListParagraph(block)) openListGroup(listStack, headingScope(), block);
|
|
73
|
+
else {
|
|
74
|
+
listStack.length = 0;
|
|
75
|
+
headingScope().push(block);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return root;
|
|
79
|
+
}
|
|
80
|
+
function decomposeSlide(slide) {
|
|
81
|
+
const { shapes, ...rest } = slide;
|
|
82
|
+
return {
|
|
83
|
+
node: {
|
|
84
|
+
kind: "slide",
|
|
85
|
+
...rest
|
|
86
|
+
},
|
|
87
|
+
children: shapes.map(decomposeShape)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function decomposeSheet(sheet) {
|
|
91
|
+
const { images, embeddedObjects, ...rest } = sheet;
|
|
92
|
+
const children = [...images, ...embeddedObjects ?? []];
|
|
93
|
+
return {
|
|
94
|
+
node: {
|
|
95
|
+
kind: "sheet",
|
|
96
|
+
...rest
|
|
97
|
+
},
|
|
98
|
+
children
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function decomposeDrawPage(page) {
|
|
102
|
+
const { shapes, vectors, ...rest } = page;
|
|
103
|
+
const children = [...shapes.map(decomposeShape), ...vectors];
|
|
104
|
+
return {
|
|
105
|
+
node: {
|
|
106
|
+
kind: "drawPage",
|
|
107
|
+
...rest
|
|
108
|
+
},
|
|
109
|
+
children
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function decomposeShape(shape) {
|
|
113
|
+
const { blocks, ...rest } = shape;
|
|
114
|
+
return {
|
|
115
|
+
node: rest,
|
|
116
|
+
children: decomposeShapeBlocks(blocks)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function decomposeShapeBlocks(blocks) {
|
|
120
|
+
assertBalancedConstructMarkers(blocks);
|
|
121
|
+
return walkShapeBlocks(blocks.values());
|
|
122
|
+
}
|
|
123
|
+
function walkShapeBlocks(cursor) {
|
|
124
|
+
const root = [];
|
|
125
|
+
const listStack = [];
|
|
126
|
+
for (let step = cursor.next(); step.done !== true; step = cursor.next()) {
|
|
127
|
+
const block = step.value;
|
|
128
|
+
if (block.kind === "constructEnd") return root;
|
|
129
|
+
if (block.kind === "constructStart") {
|
|
130
|
+
const parent = listStack.at(-1);
|
|
131
|
+
(parent !== void 0 ? parent.children : root).push({
|
|
132
|
+
node: block.descriptor,
|
|
133
|
+
children: walkShapeBlocks(cursor)
|
|
134
|
+
});
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (block.kind !== "paragraph") {
|
|
138
|
+
const parent = listStack.at(-1);
|
|
139
|
+
(parent !== void 0 ? parent.children : root).push(block);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (isListParagraph(block)) {
|
|
143
|
+
openListGroup(listStack, root, block);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
listStack.length = 0;
|
|
147
|
+
root.push(block);
|
|
148
|
+
}
|
|
149
|
+
return root;
|
|
150
|
+
}
|
|
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
|
+
function openListGroup(listStack, scopeChildren, paragraph) {
|
|
166
|
+
const level = paragraph.list.level;
|
|
167
|
+
for (let top = listStack.at(-1); top !== void 0 && top.node.list.level >= level; top = listStack.at(-1)) listStack.pop();
|
|
168
|
+
const group = {
|
|
169
|
+
node: paragraph,
|
|
170
|
+
children: []
|
|
171
|
+
};
|
|
172
|
+
const parent = listStack.at(-1);
|
|
173
|
+
(parent !== void 0 ? parent.children : scopeChildren).push(group);
|
|
174
|
+
listStack.push(group);
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
export { ConstructMarkerImbalanceError, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
|
package/dist/definitions.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as ContentRun, j as ContentParagraph } from "./content-
|
|
1
|
+
import { L as ContentRun, j as ContentParagraph } from "./content-BmqzegMG.cjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/definitions.d.ts
|
|
4
4
|
declare const StyleParagraphPropertiesSchema: z.ZodObject<{
|
package/dist/definitions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as ContentRun, j as ContentParagraph } from "./content-
|
|
1
|
+
import { L as ContentRun, j as ContentParagraph } from "./content-CIwPb_yh.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/definitions.d.ts
|
|
4
4
|
declare const StyleParagraphPropertiesSchema: z.ZodObject<{
|