js.documents 1.67.16 → 1.68.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/dist/color-BHhGSqAh.d.ts +2 -0
- package/dist/edit/docx/paragraph.d.ts +1 -1
- package/dist/edit/docx/props.d.ts +1 -1
- package/dist/edit/docx/run.d.ts +1 -1
- package/dist/edit/drawingml/vector.cjs +145 -0
- package/dist/edit/drawingml/vector.d.cts +3 -2
- package/dist/edit/drawingml/vector.d.ts +3 -2
- package/dist/edit/drawingml/vector.js +147 -3
- package/dist/edit/odg/page.d.ts +1 -1
- package/dist/edit/odp/shape.d.ts +1 -1
- package/dist/edit/odp/slide.d.ts +2 -2
- package/dist/edit/odt/content.d.ts +2 -2
- package/dist/edit/odt/editor.d.ts +3 -3
- package/dist/edit/odt/list.d.ts +1 -1
- package/dist/edit/odt/paragraph.d.ts +1 -1
- package/dist/edit/odt/run.d.ts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/pptx/shape.d.ts +1 -1
- package/dist/edit/pptx/slide.d.ts +2 -2
- package/dist/edit/pptx/table.d.ts +1 -1
- package/dist/formula-B_4mdCuK.d.ts +12 -0
- package/dist/formula-DFc2Ofsk.d.cts +12 -0
- package/dist/index.d.ts +9 -9
- package/dist/layout/sheets.js +3 -3
- package/dist/{list-nlhN5bat.d.ts → list-BJVehfU8.d.ts} +1 -1
- package/dist/model/block-splice.cjs +18 -0
- package/dist/model/block-splice.d.cts +9 -0
- package/dist/model/block-splice.d.ts +9 -0
- package/dist/model/block-splice.js +17 -0
- package/dist/model/color.d.ts +1 -1
- package/dist/odf/odp/read.cjs +38 -0
- package/dist/odf/odp/read.js +38 -0
- package/dist/odf/odt/read.cjs +100 -35
- package/dist/odf/odt/read.js +100 -35
- package/dist/odf/vector/detect.cjs +52 -0
- package/dist/odf/vector/detect.d.cts +12 -0
- package/dist/odf/vector/detect.d.ts +12 -0
- package/dist/odf/vector/detect.js +49 -0
- package/dist/ooxml/docx/embedded-objects.cjs +92 -0
- package/dist/ooxml/docx/embedded-objects.d.cts +7 -0
- package/dist/ooxml/docx/embedded-objects.d.ts +7 -0
- package/dist/ooxml/docx/embedded-objects.js +91 -0
- package/dist/ooxml/docx/formula.cjs +3 -58
- package/dist/ooxml/docx/formula.d.cts +2 -2
- package/dist/ooxml/docx/formula.d.ts +2 -2
- package/dist/ooxml/docx/formula.js +1 -58
- package/dist/ooxml/docx/read.cjs +2 -2
- package/dist/ooxml/docx/read.d.cts +1 -1
- package/dist/ooxml/docx/read.d.ts +1 -1
- package/dist/ooxml/docx/read.js +2 -2
- package/dist/ooxml/docx/vector.cjs +63 -0
- package/dist/ooxml/docx/vector.d.cts +10 -0
- package/dist/ooxml/docx/vector.d.ts +10 -0
- package/dist/ooxml/docx/vector.js +62 -0
- package/dist/ooxml/pptx/read.cjs +25 -1
- package/dist/ooxml/pptx/read.js +26 -2
- package/dist/ooxml/pptx/vector.cjs +96 -0
- package/dist/ooxml/pptx/vector.d.cts +6 -0
- package/dist/ooxml/pptx/vector.d.ts +6 -0
- package/dist/ooxml/pptx/vector.js +95 -0
- package/dist/{paragraph-DndYbWuT.d.ts → paragraph-CjtZP77X.d.ts} +1 -1
- package/dist/{run-BhYv2wJf.d.ts → run-DDe7miD5.d.ts} +1 -1
- package/dist/{run-DtrwZwN6.d.ts → run-wB22_F5w.d.ts} +1 -1
- package/dist/{shape-B-TjU_Ej.d.ts → shape-BjX3wlig.d.ts} +1 -1
- package/dist/{shape-XGp__l-J.d.ts → shape-GV8i37zL.d.ts} +2 -2
- package/dist/{table-DQpKafyl.d.ts → table-Db91eorq.d.ts} +1 -1
- package/dist/{table-BHeUmLzZ.d.ts → table-Vf6nCixr.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/color-C98dn-pT.d.ts +0 -2
- package/dist/formula-CgydMiTt.d.ts +0 -10
- package/dist/formula-CiwPw8nY.d.cts +0 -10
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_edit_drawingml_vector = require("../../edit/drawingml/vector.cjs");
|
|
3
|
+
const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs");
|
|
4
|
+
let ooxml_js = require("ooxml.js");
|
|
5
|
+
//#region src/ooxml/pptx/vector.ts
|
|
6
|
+
function isBlankParagraphBlocks(blocks) {
|
|
7
|
+
return blocks.length === 0 || blocks.every((block) => block.kind === "paragraph" && block.runs.every((run) => run.text.trim().length === 0));
|
|
8
|
+
}
|
|
9
|
+
function collectVectorOnlyShapes(children, shapes, state, out) {
|
|
10
|
+
for (const node of children) {
|
|
11
|
+
if (node.type !== "element") continue;
|
|
12
|
+
if (node.tag === "p:sp") {
|
|
13
|
+
const shapeIndex = state.shapeIndex;
|
|
14
|
+
state.shapeIndex += 1;
|
|
15
|
+
const shape = shapes[shapeIndex];
|
|
16
|
+
if (shape !== void 0 && isBlankParagraphBlocks(shape.blocks)) {
|
|
17
|
+
const spPr = (0, ooxml_js.childrenWithTag)(node, "p:spPr")[0];
|
|
18
|
+
const vector = spPr === void 0 ? void 0 : require_edit_drawingml_vector.readDrawingMlVector(spPr);
|
|
19
|
+
if (vector !== void 0) out.push({
|
|
20
|
+
shapeIndex,
|
|
21
|
+
vector
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
} else if (node.tag === "p:pic" || node.tag === "p:graphicFrame") state.shapeIndex += 1;
|
|
25
|
+
else if (node.tag === "p:grpSp") collectVectorOnlyShapes(node.children, shapes, state, out);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function collectSlideVectorGroups(spTreeChildren, shapes) {
|
|
29
|
+
const state = { shapeIndex: 0 };
|
|
30
|
+
const found = [];
|
|
31
|
+
collectVectorOnlyShapes(spTreeChildren, shapes, state, found);
|
|
32
|
+
const groups = [];
|
|
33
|
+
for (const item of found) {
|
|
34
|
+
const last = groups[groups.length - 1];
|
|
35
|
+
if (last !== void 0 && last.insertAt + last.length === item.shapeIndex) {
|
|
36
|
+
last.vectors.push(item.vector);
|
|
37
|
+
last.length += 1;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
groups.push({
|
|
41
|
+
insertAt: item.shapeIndex,
|
|
42
|
+
length: 1,
|
|
43
|
+
vectors: [item.vector]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return groups.map((group) => ({
|
|
47
|
+
insertAt: group.insertAt,
|
|
48
|
+
length: group.length,
|
|
49
|
+
vectors: group.vectors.map((vector, index) => ({
|
|
50
|
+
...vector,
|
|
51
|
+
paintOrder: index
|
|
52
|
+
}))
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
function collapseVectorShapeRuns(slide, slideIndex, spTreeChildren) {
|
|
56
|
+
const groups = collectSlideVectorGroups(spTreeChildren, slide.shapes);
|
|
57
|
+
if (groups.length === 0) return slide;
|
|
58
|
+
const shapes = [];
|
|
59
|
+
let index = 0;
|
|
60
|
+
let groupIndex = 0;
|
|
61
|
+
while (index < slide.shapes.length) {
|
|
62
|
+
const group = groups[groupIndex];
|
|
63
|
+
if (group?.insertAt === index && group !== void 0) {
|
|
64
|
+
const sourcePath = `slides[${slideIndex}].shapes[${shapes.length}]`;
|
|
65
|
+
shapes.push({
|
|
66
|
+
frame: {
|
|
67
|
+
xPt: 0,
|
|
68
|
+
yPt: 0,
|
|
69
|
+
widthPt: slide.size.widthPt,
|
|
70
|
+
heightPt: slide.size.heightPt
|
|
71
|
+
},
|
|
72
|
+
insetLeftPt: 0,
|
|
73
|
+
insetTopPt: 0,
|
|
74
|
+
insetRightPt: 0,
|
|
75
|
+
insetBottomPt: 0,
|
|
76
|
+
blocks: [{
|
|
77
|
+
...require_model_embedded_drawing.buildDrawingBlock(slide.size, group.vectors),
|
|
78
|
+
sourcePath
|
|
79
|
+
}],
|
|
80
|
+
sourcePath
|
|
81
|
+
});
|
|
82
|
+
index += group.length;
|
|
83
|
+
groupIndex += 1;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const shape = slide.shapes[index];
|
|
87
|
+
if (shape !== void 0) shapes.push(shape);
|
|
88
|
+
index += 1;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...slide,
|
|
92
|
+
shapes
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.collapseVectorShapeRuns = collapseVectorShapeRuns;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContentSlide } from "document-schema.js";
|
|
2
|
+
import { XmlNode } from "ooxml.js";
|
|
3
|
+
//#region src/ooxml/pptx/vector.d.ts
|
|
4
|
+
declare function collapseVectorShapeRuns(slide: ContentSlide, slideIndex: number, spTreeChildren: readonly XmlNode[]): ContentSlide;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { collapseVectorShapeRuns };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { XmlNode } from "ooxml.js";
|
|
2
|
+
import { ContentSlide } from "document-schema.js";
|
|
3
|
+
//#region src/ooxml/pptx/vector.d.ts
|
|
4
|
+
declare function collapseVectorShapeRuns(slide: ContentSlide, slideIndex: number, spTreeChildren: readonly XmlNode[]): ContentSlide;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { collapseVectorShapeRuns };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { readDrawingMlVector } from "../../edit/drawingml/vector.js";
|
|
2
|
+
import { buildDrawingBlock } from "../../model/embedded-drawing.js";
|
|
3
|
+
import { childrenWithTag } from "ooxml.js";
|
|
4
|
+
//#region src/ooxml/pptx/vector.ts
|
|
5
|
+
function isBlankParagraphBlocks(blocks) {
|
|
6
|
+
return blocks.length === 0 || blocks.every((block) => block.kind === "paragraph" && block.runs.every((run) => run.text.trim().length === 0));
|
|
7
|
+
}
|
|
8
|
+
function collectVectorOnlyShapes(children, shapes, state, out) {
|
|
9
|
+
for (const node of children) {
|
|
10
|
+
if (node.type !== "element") continue;
|
|
11
|
+
if (node.tag === "p:sp") {
|
|
12
|
+
const shapeIndex = state.shapeIndex;
|
|
13
|
+
state.shapeIndex += 1;
|
|
14
|
+
const shape = shapes[shapeIndex];
|
|
15
|
+
if (shape !== void 0 && isBlankParagraphBlocks(shape.blocks)) {
|
|
16
|
+
const spPr = childrenWithTag(node, "p:spPr")[0];
|
|
17
|
+
const vector = spPr === void 0 ? void 0 : readDrawingMlVector(spPr);
|
|
18
|
+
if (vector !== void 0) out.push({
|
|
19
|
+
shapeIndex,
|
|
20
|
+
vector
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
} else if (node.tag === "p:pic" || node.tag === "p:graphicFrame") state.shapeIndex += 1;
|
|
24
|
+
else if (node.tag === "p:grpSp") collectVectorOnlyShapes(node.children, shapes, state, out);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function collectSlideVectorGroups(spTreeChildren, shapes) {
|
|
28
|
+
const state = { shapeIndex: 0 };
|
|
29
|
+
const found = [];
|
|
30
|
+
collectVectorOnlyShapes(spTreeChildren, shapes, state, found);
|
|
31
|
+
const groups = [];
|
|
32
|
+
for (const item of found) {
|
|
33
|
+
const last = groups[groups.length - 1];
|
|
34
|
+
if (last !== void 0 && last.insertAt + last.length === item.shapeIndex) {
|
|
35
|
+
last.vectors.push(item.vector);
|
|
36
|
+
last.length += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
groups.push({
|
|
40
|
+
insertAt: item.shapeIndex,
|
|
41
|
+
length: 1,
|
|
42
|
+
vectors: [item.vector]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return groups.map((group) => ({
|
|
46
|
+
insertAt: group.insertAt,
|
|
47
|
+
length: group.length,
|
|
48
|
+
vectors: group.vectors.map((vector, index) => ({
|
|
49
|
+
...vector,
|
|
50
|
+
paintOrder: index
|
|
51
|
+
}))
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
function collapseVectorShapeRuns(slide, slideIndex, spTreeChildren) {
|
|
55
|
+
const groups = collectSlideVectorGroups(spTreeChildren, slide.shapes);
|
|
56
|
+
if (groups.length === 0) return slide;
|
|
57
|
+
const shapes = [];
|
|
58
|
+
let index = 0;
|
|
59
|
+
let groupIndex = 0;
|
|
60
|
+
while (index < slide.shapes.length) {
|
|
61
|
+
const group = groups[groupIndex];
|
|
62
|
+
if (group?.insertAt === index && group !== void 0) {
|
|
63
|
+
const sourcePath = `slides[${slideIndex}].shapes[${shapes.length}]`;
|
|
64
|
+
shapes.push({
|
|
65
|
+
frame: {
|
|
66
|
+
xPt: 0,
|
|
67
|
+
yPt: 0,
|
|
68
|
+
widthPt: slide.size.widthPt,
|
|
69
|
+
heightPt: slide.size.heightPt
|
|
70
|
+
},
|
|
71
|
+
insetLeftPt: 0,
|
|
72
|
+
insetTopPt: 0,
|
|
73
|
+
insetRightPt: 0,
|
|
74
|
+
insetBottomPt: 0,
|
|
75
|
+
blocks: [{
|
|
76
|
+
...buildDrawingBlock(slide.size, group.vectors),
|
|
77
|
+
sourcePath
|
|
78
|
+
}],
|
|
79
|
+
sourcePath
|
|
80
|
+
});
|
|
81
|
+
index += group.length;
|
|
82
|
+
groupIndex += 1;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const shape = slide.shapes[index];
|
|
86
|
+
if (shape !== void 0) shapes.push(shape);
|
|
87
|
+
index += 1;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
...slide,
|
|
91
|
+
shapes
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { collapseVectorShapeRuns };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Alignment } from "./style-DkamR3aY.js";
|
|
2
|
-
import { n as RunInit, t as OdtRun } from "./run-
|
|
2
|
+
import { n as RunInit, t as OdtRun } from "./run-wB22_F5w.js";
|
|
3
3
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
4
4
|
//#region src/edit/odt/paragraph.d.ts
|
|
5
5
|
interface ParagraphInit {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as LayoutColor } from "./color-
|
|
1
|
+
import { n as LayoutColor } from "./color-BHhGSqAh.js";
|
|
2
2
|
import { t as Box } from "./geometry-DaJr8yQW.js";
|
|
3
3
|
import { t as Alignment } from "./style-DkamR3aY.js";
|
|
4
4
|
import { XmlElement, XmlNode } from "ooxml.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Box } from "./geometry-DaJr8yQW.js";
|
|
2
|
-
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-
|
|
3
|
-
import { t as OdtList } from "./list-
|
|
2
|
+
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CjtZP77X.js";
|
|
3
|
+
import { t as OdtList } from "./list-BJVehfU8.js";
|
|
4
4
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
5
5
|
//#region src/edit/odp/shape.d.ts
|
|
6
6
|
declare class OdpShape {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Box } from "./geometry-DaJr8yQW.js";
|
|
2
|
-
import { t as DrawingParagraphInit } from "./shape-
|
|
2
|
+
import { t as DrawingParagraphInit } from "./shape-BjX3wlig.js";
|
|
3
3
|
import { XmlElement } from "ooxml.js";
|
|
4
4
|
//#region src/edit/pptx/table.d.ts
|
|
5
5
|
interface PptxTableInit {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-
|
|
1
|
+
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-CjtZP77X.js";
|
|
2
2
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
3
3
|
//#region src/edit/odt/table.d.ts
|
|
4
4
|
interface TableInit {
|
package/package.json
CHANGED
package/dist/color-C98dn-pT.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { COLOR_BLACK as COLOR_BLACK$1, Color as LayoutColor, ColorSchema as LayoutColorSchema, colorToRgbHex as colorToRgbHex$1, rgbHexToColor } from "document-schema.js";
|
|
2
|
-
export { rgbHexToColor as a, colorToRgbHex$1 as i, LayoutColor as n, LayoutColorSchema as r, COLOR_BLACK$1 as t };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as OmmlDiagnostic } from "./shared-DUOzjwcL.js";
|
|
2
|
-
import { XmlNode } from "ooxml.js";
|
|
3
|
-
import { ContentSection } from "document-schema.js";
|
|
4
|
-
//#region src/ooxml/docx/formula.d.ts
|
|
5
|
-
type OmmlDiagnosticSink = (diagnostic: OmmlDiagnostic, context: {
|
|
6
|
-
readonly sourcePath?: string;
|
|
7
|
-
}) => void;
|
|
8
|
-
declare function spliceDocxFormulas(sections: readonly ContentSection[], bodyChildren: readonly XmlNode[], onMathDiagnostic?: OmmlDiagnosticSink): ContentSection[];
|
|
9
|
-
//#endregion
|
|
10
|
-
export { spliceDocxFormulas as n, OmmlDiagnosticSink as t };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as OmmlDiagnostic } from "./shared-DLZ3IQUl.cjs";
|
|
2
|
-
import { ContentSection } from "document-schema.js";
|
|
3
|
-
import { XmlNode } from "ooxml.js";
|
|
4
|
-
//#region src/ooxml/docx/formula.d.ts
|
|
5
|
-
type OmmlDiagnosticSink = (diagnostic: OmmlDiagnostic, context: {
|
|
6
|
-
readonly sourcePath?: string;
|
|
7
|
-
}) => void;
|
|
8
|
-
declare function spliceDocxFormulas(sections: readonly ContentSection[], bodyChildren: readonly XmlNode[], onMathDiagnostic?: OmmlDiagnosticSink): ContentSection[];
|
|
9
|
-
//#endregion
|
|
10
|
-
export { spliceDocxFormulas as n, OmmlDiagnosticSink as t };
|