document-content-model 7.11.1 → 7.11.3
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/dist/a1.cjs +1 -1
- package/dist/a1.js +1 -1
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/color.cjs +3 -5
- package/dist/color.js +3 -5
- package/dist/{construct-C9cYkjnd.d.cts → construct-GVdTKrE7.d.cts} +3 -3
- package/dist/{construct-C9cYkjnd.d.ts → construct-GVdTKrE7.d.ts} +3 -3
- package/dist/construct.d.cts +1 -1
- package/dist/construct.d.ts +1 -1
- package/dist/{content-DJYlkhmk.d.ts → content-C5CsxSt1.d.ts} +13 -13
- package/dist/{content-oJmrSCr6.d.cts → content-DWSflkUJ.d.cts} +13 -13
- package/dist/content-json-schema-defs.cjs +1 -3
- package/dist/content-json-schema-defs.js +1 -3
- package/dist/content.cjs +1 -1
- package/dist/content.d.cts +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/content.js +1 -1
- package/dist/decompose.d.cts +2 -2
- package/dist/decompose.d.ts +2 -2
- package/dist/definitions.d.cts +1 -1
- package/dist/definitions.d.ts +1 -1
- package/dist/factor-styles.cjs +17 -61
- package/dist/factor-styles.d.cts +1 -1
- package/dist/factor-styles.d.ts +1 -1
- package/dist/factor-styles.js +17 -61
- package/dist/flatten.d.cts +1 -1
- package/dist/flatten.d.ts +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/{package-node-DkOfPGtb.d.ts → package-node-5OqgGCtu.d.ts} +6 -6
- package/dist/{package-node-BaeLuQNH.d.cts → package-node-DK-b0h6V.d.cts} +6 -6
- package/dist/package-node.cjs +0 -1
- package/dist/package-node.d.cts +1 -1
- package/dist/package-node.d.ts +1 -1
- package/dist/package-node.js +0 -1
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- 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/package.json +1 -1
- package/schemas/content-document.schema.json +16 -16
- package/schemas/document-tree.schema.json +3 -3
package/dist/factor-styles.cjs
CHANGED
|
@@ -22,18 +22,9 @@ const RUN_STYLE_KEYS = [
|
|
|
22
22
|
"sizePt",
|
|
23
23
|
"color"
|
|
24
24
|
];
|
|
25
|
-
function isShapeGroupWrapper(wrapper) {
|
|
26
|
-
return !("kind" in wrapper.node);
|
|
27
|
-
}
|
|
28
25
|
function isAnchorGroupWrapper(wrapper) {
|
|
29
26
|
return "kind" in wrapper.node && wrapper.node.kind === "paragraph";
|
|
30
27
|
}
|
|
31
|
-
function isSlideGroupWrapper(wrapper) {
|
|
32
|
-
return "kind" in wrapper.node && wrapper.node.kind === "slide";
|
|
33
|
-
}
|
|
34
|
-
function isDrawPageGroupWrapper(wrapper) {
|
|
35
|
-
return "kind" in wrapper.node && wrapper.node.kind === "drawPage";
|
|
36
|
-
}
|
|
37
28
|
function isHeadingGroup(group) {
|
|
38
29
|
return group.node.headingLevel !== void 0;
|
|
39
30
|
}
|
|
@@ -82,21 +73,13 @@ function factorStyles(pkg) {
|
|
|
82
73
|
...pkg.fonts !== void 0 ? { fonts: pkg.fonts } : {},
|
|
83
74
|
...pkg.source !== void 0 ? { source: pkg.source } : {}
|
|
84
75
|
};
|
|
85
|
-
if (pkg.definitions === void 0 && pkg.fonts === void 0 && pkg.source === void 0) return reassembled;
|
|
86
76
|
return {
|
|
87
77
|
...reassembled,
|
|
88
78
|
...carried
|
|
89
79
|
};
|
|
90
80
|
}
|
|
91
81
|
function extentOf(wrapper) {
|
|
92
|
-
if (isShapeGroupWrapper(wrapper)) return flowExtent(wrapper.children);
|
|
93
82
|
if (isAnchorGroupWrapper(wrapper)) return [wrapper.node, ...flowExtent(wrapper.children)];
|
|
94
|
-
if (isSlideGroupWrapper(wrapper)) return wrapper.children.flatMap(extentOf);
|
|
95
|
-
if (isDrawPageGroupWrapper(wrapper)) {
|
|
96
|
-
const paragraphs = [];
|
|
97
|
-
for (const child of wrapper.children) if ("node" in child) paragraphs.push(...extentOf(child));
|
|
98
|
-
return paragraphs;
|
|
99
|
-
}
|
|
100
83
|
return flowExtent(wrapper.children);
|
|
101
84
|
}
|
|
102
85
|
function flowExtent(children) {
|
|
@@ -107,12 +90,12 @@ function flowExtent(children) {
|
|
|
107
90
|
}
|
|
108
91
|
function paragraphTuple(paragraph, keys) {
|
|
109
92
|
const tuple = {};
|
|
110
|
-
for (const key of keys)
|
|
93
|
+
for (const key of keys) tuple[key] = paragraph[key];
|
|
111
94
|
return tuple;
|
|
112
95
|
}
|
|
113
96
|
function runTuple(run, keys) {
|
|
114
97
|
const tuple = {};
|
|
115
|
-
for (const key of keys)
|
|
98
|
+
for (const key of keys) tuple[key] = run[key];
|
|
116
99
|
return tuple;
|
|
117
100
|
}
|
|
118
101
|
function commonParagraphKeys(extent, frozen) {
|
|
@@ -120,7 +103,6 @@ function commonParagraphKeys(extent, frozen) {
|
|
|
120
103
|
}
|
|
121
104
|
function commonRunKeys(extent, frozen) {
|
|
122
105
|
const runs = extent.flatMap((paragraph) => paragraph.runs);
|
|
123
|
-
if (runs.length === 0) return [];
|
|
124
106
|
return RUN_STYLE_KEYS.filter((key) => !frozen.has(key) && runs.every((run) => run[key] !== void 0));
|
|
125
107
|
}
|
|
126
108
|
function bestParagraphCandidate(extent, keys, factored) {
|
|
@@ -165,10 +147,10 @@ function bestGroup(groups) {
|
|
|
165
147
|
}
|
|
166
148
|
return best;
|
|
167
149
|
}
|
|
168
|
-
function plan(wrapper,
|
|
150
|
+
function plan(wrapper, branch, state, entries) {
|
|
169
151
|
const extent = extentOf(wrapper);
|
|
170
|
-
const paragraphCandidate =
|
|
171
|
-
const runCandidate =
|
|
152
|
+
const paragraphCandidate = bestParagraphCandidate(extent, commonParagraphKeys(extent, branch.frozenParagraphs), branch.factoredParagraphs);
|
|
153
|
+
const runCandidate = bestRunCandidate(extent, commonRunKeys(extent, branch.frozenRuns), branch.factoredRuns);
|
|
172
154
|
const nextFrozenParagraphs = new Set(branch.frozenParagraphs);
|
|
173
155
|
const nextFrozenRuns = new Set(branch.frozenRuns);
|
|
174
156
|
const nextFactoredParagraphs = new Set(branch.factoredParagraphs);
|
|
@@ -183,8 +165,7 @@ function plan(wrapper, visit, branch, state, entries) {
|
|
|
183
165
|
if (existing === void 0) entries.set(contentKey, {
|
|
184
166
|
content,
|
|
185
167
|
wrappers: [wrapper],
|
|
186
|
-
frequency: (paragraphCandidate?.positions.length ?? 0) + (runCandidate?.positions.length ?? 0)
|
|
187
|
-
firstVisit: visit.index
|
|
168
|
+
frequency: (paragraphCandidate?.positions.length ?? 0) + (runCandidate?.positions.length ?? 0)
|
|
188
169
|
});
|
|
189
170
|
else {
|
|
190
171
|
existing.wrappers.push(wrapper);
|
|
@@ -210,27 +191,15 @@ function plan(wrapper, visit, branch, state, entries) {
|
|
|
210
191
|
}
|
|
211
192
|
state.wrapperStrips.set(wrapper, strips);
|
|
212
193
|
}
|
|
213
|
-
visit.index += 1;
|
|
214
194
|
const next = {
|
|
215
195
|
frozenParagraphs: nextFrozenParagraphs,
|
|
216
196
|
frozenRuns: nextFrozenRuns,
|
|
217
197
|
factoredParagraphs: nextFactoredParagraphs,
|
|
218
198
|
factoredRuns: nextFactoredRuns
|
|
219
199
|
};
|
|
220
|
-
for (const child of childWrappers(wrapper)) plan(child,
|
|
200
|
+
for (const child of childWrappers(wrapper)) plan(child, next, state, entries);
|
|
221
201
|
}
|
|
222
202
|
function childWrappers(wrapper) {
|
|
223
|
-
if (isShapeGroupWrapper(wrapper) || isAnchorGroupWrapper(wrapper)) {
|
|
224
|
-
const wrappers = [];
|
|
225
|
-
for (const child of wrapper.children) if ("node" in child && "children" in child) wrappers.push(child);
|
|
226
|
-
return wrappers;
|
|
227
|
-
}
|
|
228
|
-
if (isSlideGroupWrapper(wrapper)) return [...wrapper.children];
|
|
229
|
-
if (isDrawPageGroupWrapper(wrapper)) {
|
|
230
|
-
const shapes = [];
|
|
231
|
-
for (const child of wrapper.children) if ("node" in child) shapes.push(child);
|
|
232
|
-
return shapes;
|
|
233
|
-
}
|
|
234
203
|
const wrappers = [];
|
|
235
204
|
for (const child of wrapper.children) if ("node" in child && "children" in child) wrappers.push(child);
|
|
236
205
|
return wrappers;
|
|
@@ -241,7 +210,6 @@ function mint(pkg) {
|
|
|
241
210
|
wrapperStrips: /* @__PURE__ */ new Map()
|
|
242
211
|
};
|
|
243
212
|
const entries = /* @__PURE__ */ new Map();
|
|
244
|
-
const visit = { index: 0 };
|
|
245
213
|
const rootBranch = {
|
|
246
214
|
frozenParagraphs: /* @__PURE__ */ new Set(),
|
|
247
215
|
frozenRuns: /* @__PURE__ */ new Set(),
|
|
@@ -250,15 +218,11 @@ function mint(pkg) {
|
|
|
250
218
|
};
|
|
251
219
|
switch (pkg.kind) {
|
|
252
220
|
case "wordprocessing":
|
|
253
|
-
for (const root of pkg.children) plan(root, visit, rootBranch, state, entries);
|
|
254
|
-
break;
|
|
255
221
|
case "presentation":
|
|
256
|
-
|
|
257
|
-
break;
|
|
258
|
-
case "drawing": for (const root of pkg.children) plan(root, visit, rootBranch, state, entries);
|
|
222
|
+
case "drawing": for (const root of pkg.children) plan(root, rootBranch, state, entries);
|
|
259
223
|
}
|
|
260
224
|
if (entries.size === 0) return pkg;
|
|
261
|
-
const ordered = [...entries.values()].sort((a, b) => b.frequency - a.frequency
|
|
225
|
+
const ordered = [...entries.values()].sort((a, b) => b.frequency - a.frequency);
|
|
262
226
|
const styles = {};
|
|
263
227
|
ordered.forEach((entry, index) => {
|
|
264
228
|
const id = `s${index + 1}`;
|
|
@@ -312,7 +276,7 @@ function rebuildSlideGroup(group, chain, state) {
|
|
|
312
276
|
const inner = innerChain(group, chain, state);
|
|
313
277
|
const children = group.children.map((shape) => rebuildShapeGroup(shape, inner, state));
|
|
314
278
|
const ref = state.wrapperRefs.get(group);
|
|
315
|
-
return
|
|
279
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
316
280
|
node: group.node,
|
|
317
281
|
...ref !== void 0 ? { style: ref } : {},
|
|
318
282
|
children
|
|
@@ -322,7 +286,7 @@ function rebuildDrawPageGroup(group, chain, state) {
|
|
|
322
286
|
const inner = innerChain(group, chain, state);
|
|
323
287
|
const children = group.children.map((child) => "node" in child ? rebuildShapeGroup(child, inner, state) : child);
|
|
324
288
|
const ref = state.wrapperRefs.get(group);
|
|
325
|
-
return
|
|
289
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
326
290
|
node: group.node,
|
|
327
291
|
...ref !== void 0 ? { style: ref } : {},
|
|
328
292
|
children
|
|
@@ -332,7 +296,7 @@ function rebuildSectionGroup(group, chain, state) {
|
|
|
332
296
|
const inner = innerChain(group, chain, state);
|
|
333
297
|
const children = group.children.map((child) => rebuildSectionChild(child, inner, state));
|
|
334
298
|
const ref = state.wrapperRefs.get(group);
|
|
335
|
-
return
|
|
299
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
336
300
|
node: group.node,
|
|
337
301
|
...ref !== void 0 ? { style: ref } : {},
|
|
338
302
|
children
|
|
@@ -354,7 +318,7 @@ function rebuildShapeGroup(group, chain, state) {
|
|
|
354
318
|
const inner = innerChain(group, chain, state);
|
|
355
319
|
const children = group.children.map((child) => rebuildListChild(child, inner, state));
|
|
356
320
|
const ref = state.wrapperRefs.get(group);
|
|
357
|
-
return
|
|
321
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
358
322
|
node: group.node,
|
|
359
323
|
...ref !== void 0 ? { style: ref } : {},
|
|
360
324
|
children
|
|
@@ -364,7 +328,7 @@ function rebuildSectionConstructGroup(group, chain, state) {
|
|
|
364
328
|
const inner = innerChain(group, chain, state);
|
|
365
329
|
const children = group.children.map((child) => rebuildSectionChild(child, inner, state));
|
|
366
330
|
const ref = state.wrapperRefs.get(group);
|
|
367
|
-
return
|
|
331
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
368
332
|
node: group.node,
|
|
369
333
|
...ref !== void 0 ? { style: ref } : {},
|
|
370
334
|
children
|
|
@@ -374,7 +338,7 @@ function rebuildShapeConstructGroup(group, chain, state) {
|
|
|
374
338
|
const inner = innerChain(group, chain, state);
|
|
375
339
|
const children = group.children.map((child) => rebuildListChild(child, inner, state));
|
|
376
340
|
const ref = state.wrapperRefs.get(group);
|
|
377
|
-
return
|
|
341
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
378
342
|
node: group.node,
|
|
379
343
|
...ref !== void 0 ? { style: ref } : {},
|
|
380
344
|
children
|
|
@@ -383,10 +347,9 @@ function rebuildShapeConstructGroup(group, chain, state) {
|
|
|
383
347
|
function rebuildHeadingGroup(group, chain, state, rebuildChild) {
|
|
384
348
|
const inner = innerChain(group, chain, state);
|
|
385
349
|
const anchor = rebuildParagraph(group.node, inner);
|
|
386
|
-
assertHeadingAnchor(anchor);
|
|
387
350
|
const children = group.children.map((child) => rebuildChild(child, inner, state));
|
|
388
351
|
const ref = state.wrapperRefs.get(group);
|
|
389
|
-
return
|
|
352
|
+
return anchor === group.node && children.every((child, index) => child === group.children[index]) ? group : {
|
|
390
353
|
node: anchor,
|
|
391
354
|
...ref !== void 0 ? { style: ref } : {},
|
|
392
355
|
children
|
|
@@ -395,21 +358,14 @@ function rebuildHeadingGroup(group, chain, state, rebuildChild) {
|
|
|
395
358
|
function rebuildListGroup(group, chain, state, rebuildChild) {
|
|
396
359
|
const inner = innerChain(group, chain, state);
|
|
397
360
|
const anchor = rebuildParagraph(group.node, inner);
|
|
398
|
-
assertListAnchor(anchor);
|
|
399
361
|
const children = group.children.map((child) => rebuildChild(child, inner, state));
|
|
400
362
|
const ref = state.wrapperRefs.get(group);
|
|
401
|
-
return
|
|
363
|
+
return anchor === group.node && children.every((child, index) => child === group.children[index]) ? group : {
|
|
402
364
|
node: anchor,
|
|
403
365
|
...ref !== void 0 ? { style: ref } : {},
|
|
404
366
|
children
|
|
405
367
|
};
|
|
406
368
|
}
|
|
407
|
-
function assertHeadingAnchor(paragraph) {
|
|
408
|
-
if (paragraph.headingLevel === void 0) throw new Error("factorStyles: stripping dropped a heading anchor's headingLevel");
|
|
409
|
-
}
|
|
410
|
-
function assertListAnchor(paragraph) {
|
|
411
|
-
if (paragraph.list === void 0) throw new Error("factorStyles: stripping dropped a list anchor's list membership");
|
|
412
|
-
}
|
|
413
369
|
function rebuildParagraph(paragraph, chain) {
|
|
414
370
|
const strips = paragraphStripsOf(chain, paragraph);
|
|
415
371
|
const base = strips === void 0 ? paragraph : stripParagraphKeys(paragraph, strips);
|
package/dist/factor-styles.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as PageSize } from "./geometry-CvcjSwnA.cjs";
|
|
2
|
-
import { C as ContentDocument } from "./content-
|
|
2
|
+
import { C as ContentDocument } from "./content-DWSflkUJ.cjs";
|
|
3
3
|
import { DocumentTree } from "./package.cjs";
|
|
4
4
|
//#region src/factor-styles.d.ts
|
|
5
5
|
declare function assembleTree(content: ContentDocument, pages?: readonly PageSize[]): DocumentTree;
|
package/dist/factor-styles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as PageSize } from "./geometry-CvcjSwnA.js";
|
|
2
|
-
import { C as ContentDocument } from "./content-
|
|
2
|
+
import { C as ContentDocument } from "./content-C5CsxSt1.js";
|
|
3
3
|
import { DocumentTree } from "./package.js";
|
|
4
4
|
//#region src/factor-styles.d.ts
|
|
5
5
|
declare function assembleTree(content: ContentDocument, pages?: readonly PageSize[]): DocumentTree;
|
package/dist/factor-styles.js
CHANGED
|
@@ -21,18 +21,9 @@ const RUN_STYLE_KEYS = [
|
|
|
21
21
|
"sizePt",
|
|
22
22
|
"color"
|
|
23
23
|
];
|
|
24
|
-
function isShapeGroupWrapper(wrapper) {
|
|
25
|
-
return !("kind" in wrapper.node);
|
|
26
|
-
}
|
|
27
24
|
function isAnchorGroupWrapper(wrapper) {
|
|
28
25
|
return "kind" in wrapper.node && wrapper.node.kind === "paragraph";
|
|
29
26
|
}
|
|
30
|
-
function isSlideGroupWrapper(wrapper) {
|
|
31
|
-
return "kind" in wrapper.node && wrapper.node.kind === "slide";
|
|
32
|
-
}
|
|
33
|
-
function isDrawPageGroupWrapper(wrapper) {
|
|
34
|
-
return "kind" in wrapper.node && wrapper.node.kind === "drawPage";
|
|
35
|
-
}
|
|
36
27
|
function isHeadingGroup(group) {
|
|
37
28
|
return group.node.headingLevel !== void 0;
|
|
38
29
|
}
|
|
@@ -81,21 +72,13 @@ function factorStyles(pkg) {
|
|
|
81
72
|
...pkg.fonts !== void 0 ? { fonts: pkg.fonts } : {},
|
|
82
73
|
...pkg.source !== void 0 ? { source: pkg.source } : {}
|
|
83
74
|
};
|
|
84
|
-
if (pkg.definitions === void 0 && pkg.fonts === void 0 && pkg.source === void 0) return reassembled;
|
|
85
75
|
return {
|
|
86
76
|
...reassembled,
|
|
87
77
|
...carried
|
|
88
78
|
};
|
|
89
79
|
}
|
|
90
80
|
function extentOf(wrapper) {
|
|
91
|
-
if (isShapeGroupWrapper(wrapper)) return flowExtent(wrapper.children);
|
|
92
81
|
if (isAnchorGroupWrapper(wrapper)) return [wrapper.node, ...flowExtent(wrapper.children)];
|
|
93
|
-
if (isSlideGroupWrapper(wrapper)) return wrapper.children.flatMap(extentOf);
|
|
94
|
-
if (isDrawPageGroupWrapper(wrapper)) {
|
|
95
|
-
const paragraphs = [];
|
|
96
|
-
for (const child of wrapper.children) if ("node" in child) paragraphs.push(...extentOf(child));
|
|
97
|
-
return paragraphs;
|
|
98
|
-
}
|
|
99
82
|
return flowExtent(wrapper.children);
|
|
100
83
|
}
|
|
101
84
|
function flowExtent(children) {
|
|
@@ -106,12 +89,12 @@ function flowExtent(children) {
|
|
|
106
89
|
}
|
|
107
90
|
function paragraphTuple(paragraph, keys) {
|
|
108
91
|
const tuple = {};
|
|
109
|
-
for (const key of keys)
|
|
92
|
+
for (const key of keys) tuple[key] = paragraph[key];
|
|
110
93
|
return tuple;
|
|
111
94
|
}
|
|
112
95
|
function runTuple(run, keys) {
|
|
113
96
|
const tuple = {};
|
|
114
|
-
for (const key of keys)
|
|
97
|
+
for (const key of keys) tuple[key] = run[key];
|
|
115
98
|
return tuple;
|
|
116
99
|
}
|
|
117
100
|
function commonParagraphKeys(extent, frozen) {
|
|
@@ -119,7 +102,6 @@ function commonParagraphKeys(extent, frozen) {
|
|
|
119
102
|
}
|
|
120
103
|
function commonRunKeys(extent, frozen) {
|
|
121
104
|
const runs = extent.flatMap((paragraph) => paragraph.runs);
|
|
122
|
-
if (runs.length === 0) return [];
|
|
123
105
|
return RUN_STYLE_KEYS.filter((key) => !frozen.has(key) && runs.every((run) => run[key] !== void 0));
|
|
124
106
|
}
|
|
125
107
|
function bestParagraphCandidate(extent, keys, factored) {
|
|
@@ -164,10 +146,10 @@ function bestGroup(groups) {
|
|
|
164
146
|
}
|
|
165
147
|
return best;
|
|
166
148
|
}
|
|
167
|
-
function plan(wrapper,
|
|
149
|
+
function plan(wrapper, branch, state, entries) {
|
|
168
150
|
const extent = extentOf(wrapper);
|
|
169
|
-
const paragraphCandidate =
|
|
170
|
-
const runCandidate =
|
|
151
|
+
const paragraphCandidate = bestParagraphCandidate(extent, commonParagraphKeys(extent, branch.frozenParagraphs), branch.factoredParagraphs);
|
|
152
|
+
const runCandidate = bestRunCandidate(extent, commonRunKeys(extent, branch.frozenRuns), branch.factoredRuns);
|
|
171
153
|
const nextFrozenParagraphs = new Set(branch.frozenParagraphs);
|
|
172
154
|
const nextFrozenRuns = new Set(branch.frozenRuns);
|
|
173
155
|
const nextFactoredParagraphs = new Set(branch.factoredParagraphs);
|
|
@@ -182,8 +164,7 @@ function plan(wrapper, visit, branch, state, entries) {
|
|
|
182
164
|
if (existing === void 0) entries.set(contentKey, {
|
|
183
165
|
content,
|
|
184
166
|
wrappers: [wrapper],
|
|
185
|
-
frequency: (paragraphCandidate?.positions.length ?? 0) + (runCandidate?.positions.length ?? 0)
|
|
186
|
-
firstVisit: visit.index
|
|
167
|
+
frequency: (paragraphCandidate?.positions.length ?? 0) + (runCandidate?.positions.length ?? 0)
|
|
187
168
|
});
|
|
188
169
|
else {
|
|
189
170
|
existing.wrappers.push(wrapper);
|
|
@@ -209,27 +190,15 @@ function plan(wrapper, visit, branch, state, entries) {
|
|
|
209
190
|
}
|
|
210
191
|
state.wrapperStrips.set(wrapper, strips);
|
|
211
192
|
}
|
|
212
|
-
visit.index += 1;
|
|
213
193
|
const next = {
|
|
214
194
|
frozenParagraphs: nextFrozenParagraphs,
|
|
215
195
|
frozenRuns: nextFrozenRuns,
|
|
216
196
|
factoredParagraphs: nextFactoredParagraphs,
|
|
217
197
|
factoredRuns: nextFactoredRuns
|
|
218
198
|
};
|
|
219
|
-
for (const child of childWrappers(wrapper)) plan(child,
|
|
199
|
+
for (const child of childWrappers(wrapper)) plan(child, next, state, entries);
|
|
220
200
|
}
|
|
221
201
|
function childWrappers(wrapper) {
|
|
222
|
-
if (isShapeGroupWrapper(wrapper) || isAnchorGroupWrapper(wrapper)) {
|
|
223
|
-
const wrappers = [];
|
|
224
|
-
for (const child of wrapper.children) if ("node" in child && "children" in child) wrappers.push(child);
|
|
225
|
-
return wrappers;
|
|
226
|
-
}
|
|
227
|
-
if (isSlideGroupWrapper(wrapper)) return [...wrapper.children];
|
|
228
|
-
if (isDrawPageGroupWrapper(wrapper)) {
|
|
229
|
-
const shapes = [];
|
|
230
|
-
for (const child of wrapper.children) if ("node" in child) shapes.push(child);
|
|
231
|
-
return shapes;
|
|
232
|
-
}
|
|
233
202
|
const wrappers = [];
|
|
234
203
|
for (const child of wrapper.children) if ("node" in child && "children" in child) wrappers.push(child);
|
|
235
204
|
return wrappers;
|
|
@@ -240,7 +209,6 @@ function mint(pkg) {
|
|
|
240
209
|
wrapperStrips: /* @__PURE__ */ new Map()
|
|
241
210
|
};
|
|
242
211
|
const entries = /* @__PURE__ */ new Map();
|
|
243
|
-
const visit = { index: 0 };
|
|
244
212
|
const rootBranch = {
|
|
245
213
|
frozenParagraphs: /* @__PURE__ */ new Set(),
|
|
246
214
|
frozenRuns: /* @__PURE__ */ new Set(),
|
|
@@ -249,15 +217,11 @@ function mint(pkg) {
|
|
|
249
217
|
};
|
|
250
218
|
switch (pkg.kind) {
|
|
251
219
|
case "wordprocessing":
|
|
252
|
-
for (const root of pkg.children) plan(root, visit, rootBranch, state, entries);
|
|
253
|
-
break;
|
|
254
220
|
case "presentation":
|
|
255
|
-
|
|
256
|
-
break;
|
|
257
|
-
case "drawing": for (const root of pkg.children) plan(root, visit, rootBranch, state, entries);
|
|
221
|
+
case "drawing": for (const root of pkg.children) plan(root, rootBranch, state, entries);
|
|
258
222
|
}
|
|
259
223
|
if (entries.size === 0) return pkg;
|
|
260
|
-
const ordered = [...entries.values()].sort((a, b) => b.frequency - a.frequency
|
|
224
|
+
const ordered = [...entries.values()].sort((a, b) => b.frequency - a.frequency);
|
|
261
225
|
const styles = {};
|
|
262
226
|
ordered.forEach((entry, index) => {
|
|
263
227
|
const id = `s${index + 1}`;
|
|
@@ -311,7 +275,7 @@ function rebuildSlideGroup(group, chain, state) {
|
|
|
311
275
|
const inner = innerChain(group, chain, state);
|
|
312
276
|
const children = group.children.map((shape) => rebuildShapeGroup(shape, inner, state));
|
|
313
277
|
const ref = state.wrapperRefs.get(group);
|
|
314
|
-
return
|
|
278
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
315
279
|
node: group.node,
|
|
316
280
|
...ref !== void 0 ? { style: ref } : {},
|
|
317
281
|
children
|
|
@@ -321,7 +285,7 @@ function rebuildDrawPageGroup(group, chain, state) {
|
|
|
321
285
|
const inner = innerChain(group, chain, state);
|
|
322
286
|
const children = group.children.map((child) => "node" in child ? rebuildShapeGroup(child, inner, state) : child);
|
|
323
287
|
const ref = state.wrapperRefs.get(group);
|
|
324
|
-
return
|
|
288
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
325
289
|
node: group.node,
|
|
326
290
|
...ref !== void 0 ? { style: ref } : {},
|
|
327
291
|
children
|
|
@@ -331,7 +295,7 @@ function rebuildSectionGroup(group, chain, state) {
|
|
|
331
295
|
const inner = innerChain(group, chain, state);
|
|
332
296
|
const children = group.children.map((child) => rebuildSectionChild(child, inner, state));
|
|
333
297
|
const ref = state.wrapperRefs.get(group);
|
|
334
|
-
return
|
|
298
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
335
299
|
node: group.node,
|
|
336
300
|
...ref !== void 0 ? { style: ref } : {},
|
|
337
301
|
children
|
|
@@ -353,7 +317,7 @@ function rebuildShapeGroup(group, chain, state) {
|
|
|
353
317
|
const inner = innerChain(group, chain, state);
|
|
354
318
|
const children = group.children.map((child) => rebuildListChild(child, inner, state));
|
|
355
319
|
const ref = state.wrapperRefs.get(group);
|
|
356
|
-
return
|
|
320
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
357
321
|
node: group.node,
|
|
358
322
|
...ref !== void 0 ? { style: ref } : {},
|
|
359
323
|
children
|
|
@@ -363,7 +327,7 @@ function rebuildSectionConstructGroup(group, chain, state) {
|
|
|
363
327
|
const inner = innerChain(group, chain, state);
|
|
364
328
|
const children = group.children.map((child) => rebuildSectionChild(child, inner, state));
|
|
365
329
|
const ref = state.wrapperRefs.get(group);
|
|
366
|
-
return
|
|
330
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
367
331
|
node: group.node,
|
|
368
332
|
...ref !== void 0 ? { style: ref } : {},
|
|
369
333
|
children
|
|
@@ -373,7 +337,7 @@ function rebuildShapeConstructGroup(group, chain, state) {
|
|
|
373
337
|
const inner = innerChain(group, chain, state);
|
|
374
338
|
const children = group.children.map((child) => rebuildListChild(child, inner, state));
|
|
375
339
|
const ref = state.wrapperRefs.get(group);
|
|
376
|
-
return
|
|
340
|
+
return children.every((child, index) => child === group.children[index]) ? group : {
|
|
377
341
|
node: group.node,
|
|
378
342
|
...ref !== void 0 ? { style: ref } : {},
|
|
379
343
|
children
|
|
@@ -382,10 +346,9 @@ function rebuildShapeConstructGroup(group, chain, state) {
|
|
|
382
346
|
function rebuildHeadingGroup(group, chain, state, rebuildChild) {
|
|
383
347
|
const inner = innerChain(group, chain, state);
|
|
384
348
|
const anchor = rebuildParagraph(group.node, inner);
|
|
385
|
-
assertHeadingAnchor(anchor);
|
|
386
349
|
const children = group.children.map((child) => rebuildChild(child, inner, state));
|
|
387
350
|
const ref = state.wrapperRefs.get(group);
|
|
388
|
-
return
|
|
351
|
+
return anchor === group.node && children.every((child, index) => child === group.children[index]) ? group : {
|
|
389
352
|
node: anchor,
|
|
390
353
|
...ref !== void 0 ? { style: ref } : {},
|
|
391
354
|
children
|
|
@@ -394,21 +357,14 @@ function rebuildHeadingGroup(group, chain, state, rebuildChild) {
|
|
|
394
357
|
function rebuildListGroup(group, chain, state, rebuildChild) {
|
|
395
358
|
const inner = innerChain(group, chain, state);
|
|
396
359
|
const anchor = rebuildParagraph(group.node, inner);
|
|
397
|
-
assertListAnchor(anchor);
|
|
398
360
|
const children = group.children.map((child) => rebuildChild(child, inner, state));
|
|
399
361
|
const ref = state.wrapperRefs.get(group);
|
|
400
|
-
return
|
|
362
|
+
return anchor === group.node && children.every((child, index) => child === group.children[index]) ? group : {
|
|
401
363
|
node: anchor,
|
|
402
364
|
...ref !== void 0 ? { style: ref } : {},
|
|
403
365
|
children
|
|
404
366
|
};
|
|
405
367
|
}
|
|
406
|
-
function assertHeadingAnchor(paragraph) {
|
|
407
|
-
if (paragraph.headingLevel === void 0) throw new Error("factorStyles: stripping dropped a heading anchor's headingLevel");
|
|
408
|
-
}
|
|
409
|
-
function assertListAnchor(paragraph) {
|
|
410
|
-
if (paragraph.list === void 0) throw new Error("factorStyles: stripping dropped a list anchor's list membership");
|
|
411
|
-
}
|
|
412
368
|
function rebuildParagraph(paragraph, chain) {
|
|
413
369
|
const strips = paragraphStripsOf(chain, paragraph);
|
|
414
370
|
const base = strips === void 0 ? paragraph : stripParagraphKeys(paragraph, strips);
|
package/dist/flatten.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ContentDocument } from "./content-
|
|
1
|
+
import { C as ContentDocument } from "./content-DWSflkUJ.cjs";
|
|
2
2
|
import { DocumentTree } from "./package.cjs";
|
|
3
3
|
//#region src/flatten.d.ts
|
|
4
4
|
declare function flattenTree(pkg: DocumentTree): ContentDocument;
|
package/dist/flatten.d.ts
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -6,11 +6,11 @@ import { a as rgbHexToColor, i as colorToRgbHex, n as Color, r as ColorSchema, t
|
|
|
6
6
|
import { a as Margins, c as PAGE_SIZE_LETTER, d as Point, f as SLIDE_SIZE_STANDARD, i as LayoutFrameSchema, l as PageSize, n as BoxSchema, o as MarginsSchema, p as SLIDE_SIZE_WIDESCREEN, r as LayoutFrame, s as PAGE_SIZE_A4, t as Box, u as PageSizeSchema } from "./geometry-CvcjSwnA.cjs";
|
|
7
7
|
import { i as SourceResidueSchema, n as SourceFormatSchema, r as SourceResidue, t as SourceFormat } from "./source-Bas5ol6f.cjs";
|
|
8
8
|
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-D06NwxAJ.cjs";
|
|
9
|
-
import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as RunConstructExtent, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as isContentConstructEnd, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentVectorSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as IMAGE_FORMATS, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as FusedNode, Et as ContentShape, F as ContentFloatAlignSchema, Fn as clampHeadingLevel, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gt as ContentSheetImage, H as ContentFont, Hn as isRunConstructExtent, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as contentDocumentSharedFields, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as findConstructMarkerImbalance, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructFault, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as SheetRuleOperator, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as ImageFormat, Ot as ContentSheet, P as ContentFloatAlign, Pn as SheetRuleOperatorSchema, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as findRunConstructFault, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentVector, St as ContentRun, T as ContentDrawPage, Tn as DecimalStringSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as resolveCellFillColor, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentConstructStart, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as unrecognizedFillKind, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableRow, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTranscript, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RunConstructExtentSchema, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as RUN_FONT_PROPERTY_SHAPE, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableRowSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as DecimalString, wt as ContentSection, x as ContentDefinedName, xn as ContentTranscriptSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableSchema, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as isContentBlock, zt as ContentSheetConditionalFormatValue } from "./content-
|
|
9
|
+
import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as RunConstructExtent, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as isContentConstructEnd, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentVectorSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as IMAGE_FORMATS, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as FusedNode, Et as ContentShape, F as ContentFloatAlignSchema, Fn as clampHeadingLevel, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gt as ContentSheetImage, H as ContentFont, Hn as isRunConstructExtent, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as contentDocumentSharedFields, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as findConstructMarkerImbalance, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructFault, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as SheetRuleOperator, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as ImageFormat, Ot as ContentSheet, P as ContentFloatAlign, Pn as SheetRuleOperatorSchema, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as findRunConstructFault, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentVector, St as ContentRun, T as ContentDrawPage, Tn as DecimalStringSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as resolveCellFillColor, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentConstructStart, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as unrecognizedFillKind, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableRow, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTranscript, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RunConstructExtentSchema, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as RUN_FONT_PROPERTY_SHAPE, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableRowSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as DecimalString, wt as ContentSection, x as ContentDefinedName, xn as ContentTranscriptSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableSchema, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as isContentBlock, zt as ContentSheetConditionalFormatValue } from "./content-DWSflkUJ.cjs";
|
|
10
10
|
import { ContentCodec } from "./codec.cjs";
|
|
11
|
-
import { C as ProvenanceChange, E as ProvenanceDescriptorSchema, S as LinkTargetSchema, T as ProvenanceDescriptor, _ as FieldDescriptor, a as ConstructDescriptor, b as LinkDescriptorSchema, c as ContentControlDescriptorSchema, d as ContentControlType, f as ContentControlTypeSchema, g as DivisionSourceSchema, h as DivisionSource, i as AnchorTypeSchema, l as ContentControlLock, m as DivisionDescriptorSchema, n as AnchorDescriptorSchema, o as ConstructDescriptorSchema, p as DivisionDescriptor, r as AnchorType, s as ContentControlDescriptor, t as AnchorDescriptor, u as ContentControlLockSchema, v as FieldDescriptorSchema, w as ProvenanceChangeSchema, x as LinkTarget, y as LinkDescriptor } from "./construct-
|
|
11
|
+
import { C as ProvenanceChange, E as ProvenanceDescriptorSchema, S as LinkTargetSchema, T as ProvenanceDescriptor, _ as FieldDescriptor, a as ConstructDescriptor, b as LinkDescriptorSchema, c as ContentControlDescriptorSchema, d as ContentControlType, f as ContentControlTypeSchema, g as DivisionSourceSchema, h as DivisionSource, i as AnchorTypeSchema, l as ContentControlLock, m as DivisionDescriptorSchema, n as AnchorDescriptorSchema, o as ConstructDescriptorSchema, p as DivisionDescriptor, r as AnchorType, s as ContentControlDescriptor, t as AnchorDescriptor, u as ContentControlLockSchema, v as FieldDescriptorSchema, w as ProvenanceChangeSchema, x as LinkTarget, y as LinkDescriptor } from "./construct-GVdTKrE7.cjs";
|
|
12
12
|
import { CONTENT_DEFS, CONTENT_DOCUMENT_URI, EMBEDDED_OBJECT_KINDS, MAX_SAFE_INTEGER } from "./content-json-schema-defs.cjs";
|
|
13
|
-
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-
|
|
13
|
+
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-DK-b0h6V.cjs";
|
|
14
14
|
import { ConstructMarkerImbalanceError, TreeChildren, decompose } from "./decompose.cjs";
|
|
15
15
|
import { DefinitionEntry, DefinitionEntrySchema, DefinitionsTable, DefinitionsTableSchema, StyleEntry, StyleEntrySchema, StyleParagraphProperties, StyleParagraphPropertiesSchema, StyleRunProperties, StyleRunPropertiesSchema, StylesTable, StylesTableSchema, applyParagraphStyleProperties, applyRunStyleProperties, overlayStyleEntries, resolveStyleChain } from "./definitions.cjs";
|
|
16
16
|
import { DocumentTree, DocumentTreeSchema, TreeEmbeddedFont, TreeEmbeddedFontSchema } from "./package.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ import { a as rgbHexToColor, i as colorToRgbHex, n as Color, r as ColorSchema, t
|
|
|
6
6
|
import { a as Margins, c as PAGE_SIZE_LETTER, d as Point, f as SLIDE_SIZE_STANDARD, i as LayoutFrameSchema, l as PageSize, n as BoxSchema, o as MarginsSchema, p as SLIDE_SIZE_WIDESCREEN, r as LayoutFrame, s as PAGE_SIZE_A4, t as Box, u as PageSizeSchema } from "./geometry-CvcjSwnA.js";
|
|
7
7
|
import { i as SourceResidueSchema, n as SourceFormatSchema, r as SourceResidue, t as SourceFormat } from "./source-Bas5ol6f.js";
|
|
8
8
|
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-D06NwxAJ.js";
|
|
9
|
-
import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as RunConstructExtent, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as isContentConstructEnd, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentVectorSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as IMAGE_FORMATS, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as FusedNode, Et as ContentShape, F as ContentFloatAlignSchema, Fn as clampHeadingLevel, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gt as ContentSheetImage, H as ContentFont, Hn as isRunConstructExtent, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as contentDocumentSharedFields, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as findConstructMarkerImbalance, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructFault, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as SheetRuleOperator, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as ImageFormat, Ot as ContentSheet, P as ContentFloatAlign, Pn as SheetRuleOperatorSchema, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as findRunConstructFault, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentVector, St as ContentRun, T as ContentDrawPage, Tn as DecimalStringSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as resolveCellFillColor, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentConstructStart, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as unrecognizedFillKind, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableRow, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTranscript, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RunConstructExtentSchema, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as RUN_FONT_PROPERTY_SHAPE, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableRowSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as DecimalString, wt as ContentSection, x as ContentDefinedName, xn as ContentTranscriptSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableSchema, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as isContentBlock, zt as ContentSheetConditionalFormatValue } from "./content-
|
|
9
|
+
import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as RunConstructExtent, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as isContentConstructEnd, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentVectorSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as IMAGE_FORMATS, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as FusedNode, Et as ContentShape, F as ContentFloatAlignSchema, Fn as clampHeadingLevel, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gt as ContentSheetImage, H as ContentFont, Hn as isRunConstructExtent, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as contentDocumentSharedFields, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as findConstructMarkerImbalance, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructFault, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as SheetRuleOperator, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as ImageFormat, Ot as ContentSheet, P as ContentFloatAlign, Pn as SheetRuleOperatorSchema, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as findRunConstructFault, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentVector, St as ContentRun, T as ContentDrawPage, Tn as DecimalStringSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as resolveCellFillColor, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentConstructStart, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as unrecognizedFillKind, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableRow, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTranscript, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RunConstructExtentSchema, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as RUN_FONT_PROPERTY_SHAPE, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableRowSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as DecimalString, wt as ContentSection, x as ContentDefinedName, xn as ContentTranscriptSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableSchema, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as isContentBlock, zt as ContentSheetConditionalFormatValue } from "./content-C5CsxSt1.js";
|
|
10
10
|
import { ContentCodec } from "./codec.js";
|
|
11
|
-
import { C as ProvenanceChange, E as ProvenanceDescriptorSchema, S as LinkTargetSchema, T as ProvenanceDescriptor, _ as FieldDescriptor, a as ConstructDescriptor, b as LinkDescriptorSchema, c as ContentControlDescriptorSchema, d as ContentControlType, f as ContentControlTypeSchema, g as DivisionSourceSchema, h as DivisionSource, i as AnchorTypeSchema, l as ContentControlLock, m as DivisionDescriptorSchema, n as AnchorDescriptorSchema, o as ConstructDescriptorSchema, p as DivisionDescriptor, r as AnchorType, s as ContentControlDescriptor, t as AnchorDescriptor, u as ContentControlLockSchema, v as FieldDescriptorSchema, w as ProvenanceChangeSchema, x as LinkTarget, y as LinkDescriptor } from "./construct-
|
|
11
|
+
import { C as ProvenanceChange, E as ProvenanceDescriptorSchema, S as LinkTargetSchema, T as ProvenanceDescriptor, _ as FieldDescriptor, a as ConstructDescriptor, b as LinkDescriptorSchema, c as ContentControlDescriptorSchema, d as ContentControlType, f as ContentControlTypeSchema, g as DivisionSourceSchema, h as DivisionSource, i as AnchorTypeSchema, l as ContentControlLock, m as DivisionDescriptorSchema, n as AnchorDescriptorSchema, o as ConstructDescriptorSchema, p as DivisionDescriptor, r as AnchorType, s as ContentControlDescriptor, t as AnchorDescriptor, u as ContentControlLockSchema, v as FieldDescriptorSchema, w as ProvenanceChangeSchema, x as LinkTarget, y as LinkDescriptor } from "./construct-GVdTKrE7.js";
|
|
12
12
|
import { CONTENT_DEFS, CONTENT_DOCUMENT_URI, EMBEDDED_OBJECT_KINDS, MAX_SAFE_INTEGER } from "./content-json-schema-defs.js";
|
|
13
|
-
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-
|
|
13
|
+
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-5OqgGCtu.js";
|
|
14
14
|
import { ConstructMarkerImbalanceError, TreeChildren, decompose } from "./decompose.js";
|
|
15
15
|
import { DefinitionEntry, DefinitionEntrySchema, DefinitionsTable, DefinitionsTableSchema, StyleEntry, StyleEntrySchema, StyleParagraphProperties, StyleParagraphPropertiesSchema, StyleRunProperties, StyleRunPropertiesSchema, StylesTable, StylesTableSchema, applyParagraphStyleProperties, applyRunStyleProperties, overlayStyleEntries, resolveStyleChain } from "./definitions.js";
|
|
16
16
|
import { DocumentTree, DocumentTreeSchema, TreeEmbeddedFont, TreeEmbeddedFontSchema } from "./package.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as ContentEmbeddedObject, Gt as ContentSheetImage, Sn as ContentVector, W as ContentFormula, _ as ContentConstructEnd, a as ContentBlock, y as ContentConstructStart } from "./content-
|
|
2
|
-
import { a as ConstructDescriptor } from "./construct-
|
|
1
|
+
import { D as ContentEmbeddedObject, Gt as ContentSheetImage, Sn as ContentVector, W as ContentFormula, _ as ContentConstructEnd, a as ContentBlock, y as ContentConstructStart } from "./content-C5CsxSt1.js";
|
|
2
|
+
import { a as ConstructDescriptor } from "./construct-GVdTKrE7.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/package-node.d.ts
|
|
5
5
|
declare const SectionDescriptorSchema: z.ZodObject<{
|
|
@@ -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
|
-
date: "date";
|
|
621
|
-
custom: "custom";
|
|
622
620
|
decimal: "decimal";
|
|
623
621
|
list: "list";
|
|
622
|
+
date: "date";
|
|
623
|
+
custom: "custom";
|
|
624
624
|
time: "time";
|
|
625
625
|
whole: "whole";
|
|
626
626
|
textLength: "textLength";
|
|
@@ -1482,12 +1482,12 @@ declare const HeadingParagraphSchema: z.ZodObject<{
|
|
|
1482
1482
|
descriptor: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1483
1483
|
kind: z.ZodLiteral<"contentControl">;
|
|
1484
1484
|
controlType: z.ZodEnum<{
|
|
1485
|
+
date: "date";
|
|
1485
1486
|
richText: "richText";
|
|
1486
1487
|
plainText: "plainText";
|
|
1487
1488
|
checkbox: "checkbox";
|
|
1488
1489
|
dropDown: "dropDown";
|
|
1489
1490
|
comboBox: "comboBox";
|
|
1490
|
-
date: "date";
|
|
1491
1491
|
picture: "picture";
|
|
1492
1492
|
repeatingSection: "repeatingSection";
|
|
1493
1493
|
button: "button";
|
|
@@ -1907,12 +1907,12 @@ declare const ListParagraphSchema: z.ZodObject<{
|
|
|
1907
1907
|
descriptor: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1908
1908
|
kind: z.ZodLiteral<"contentControl">;
|
|
1909
1909
|
controlType: z.ZodEnum<{
|
|
1910
|
+
date: "date";
|
|
1910
1911
|
richText: "richText";
|
|
1911
1912
|
plainText: "plainText";
|
|
1912
1913
|
checkbox: "checkbox";
|
|
1913
1914
|
dropDown: "dropDown";
|
|
1914
1915
|
comboBox: "comboBox";
|
|
1915
|
-
date: "date";
|
|
1916
1916
|
picture: "picture";
|
|
1917
1917
|
repeatingSection: "repeatingSection";
|
|
1918
1918
|
button: "button";
|