js.documents 1.85.0 → 1.86.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/edit/docx/content.cjs +75 -2
- package/dist/edit/docx/content.js +75 -2
- package/dist/edit/docx/numbering.cjs +45 -0
- package/dist/edit/docx/numbering.d.cts +15 -0
- package/dist/edit/docx/numbering.d.ts +15 -0
- package/dist/edit/docx/numbering.js +40 -0
- package/dist/edit/odt/run.cjs +1 -0
- package/dist/edit/odt/run.js +1 -0
- package/dist/edit/pptx/content.cjs +30 -26
- package/dist/edit/pptx/content.js +30 -26
- package/dist/edit/pptx/shape.cjs +93 -1
- package/dist/edit/pptx/shape.d.cts +1 -1
- package/dist/edit/pptx/shape.d.ts +1 -1
- package/dist/edit/pptx/shape.js +93 -1
- package/dist/edit/pptx/slide.d.cts +2 -2
- package/dist/edit/pptx/slide.d.ts +2 -2
- package/dist/edit/pptx/table.cjs +78 -0
- package/dist/edit/pptx/table.d.cts +1 -1
- package/dist/edit/pptx/table.d.ts +1 -1
- package/dist/edit/pptx/table.js +79 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/markdown/read.cjs +4 -1
- package/dist/markdown/read.js +4 -1
- package/dist/{shape-BwBiRGha.d.cts → shape-CIIpuHNp.d.cts} +19 -0
- package/dist/{shape-D5IoGzf9.d.ts → shape-DU4GMETm.d.ts} +19 -0
- package/dist/{table-SczxeRF0.d.cts → table-C2dxbmvn.d.cts} +11 -3
- package/dist/{table-CCdAhdcG.d.ts → table-DOce3xA6.d.ts} +11 -3
- package/package.json +3 -3
|
@@ -2,18 +2,55 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_model_metadata = require("../../model/metadata.cjs");
|
|
3
3
|
const require_ports_clock = require("../../ports/clock.cjs");
|
|
4
4
|
const require_model_units = require("../../model/units.cjs");
|
|
5
|
+
const require_opc_rels = require("../../opc/rels.cjs");
|
|
6
|
+
const require_opc_content_types = require("../../opc/content-types.cjs");
|
|
5
7
|
const require_edit_docx_scaffold = require("./scaffold.cjs");
|
|
6
8
|
const require_edit_docx_editor = require("./editor.cjs");
|
|
7
9
|
const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs");
|
|
8
10
|
const require_model_formula = require("../../model/formula.cjs");
|
|
11
|
+
const require_edit_docx_numbering = require("./numbering.cjs");
|
|
9
12
|
let ooxml_js = require("ooxml.js");
|
|
10
13
|
//#region src/edit/docx/content.ts
|
|
11
14
|
function buildDocxPackage(content, options) {
|
|
12
15
|
if (content.kind !== "wordprocessing") throw new Error("buildDocxPackage requires a wordprocessing ContentDocument");
|
|
13
16
|
const clock = options?.clock ?? require_ports_clock.systemClock;
|
|
14
17
|
const metadata = require_model_metadata.resolveMetadataTimestamps(content.metadata, clock);
|
|
15
|
-
const
|
|
16
|
-
|
|
18
|
+
const pkg = require_edit_docx_scaffold.createEmptyDocxPackage({ metadata });
|
|
19
|
+
const numIdLevels = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const section of content.sections) collectListNumIds(section.blocks, numIdLevels);
|
|
21
|
+
const remap = /* @__PURE__ */ new Map();
|
|
22
|
+
if (numIdLevels.size > 0) {
|
|
23
|
+
const entries = [];
|
|
24
|
+
let abstractNumId = 0;
|
|
25
|
+
let numId = 1;
|
|
26
|
+
for (const [sourceNumId, levels] of numIdLevels) {
|
|
27
|
+
const remapped = String(numId);
|
|
28
|
+
remap.set(sourceNumId, remapped);
|
|
29
|
+
entries.push({
|
|
30
|
+
sourceNumId,
|
|
31
|
+
remappedNumId: remapped,
|
|
32
|
+
abstractNumId: String(abstractNumId),
|
|
33
|
+
levels: [...levels].sort((a, b) => a - b)
|
|
34
|
+
});
|
|
35
|
+
abstractNumId += 1;
|
|
36
|
+
numId += 1;
|
|
37
|
+
}
|
|
38
|
+
const numberingRoot = require_edit_docx_numbering.buildNumberingRoot(entries);
|
|
39
|
+
pkg.parts[require_edit_docx_numbering.NUMBERING_PART_PATH] = {
|
|
40
|
+
kind: "xml",
|
|
41
|
+
nodes: [require_edit_docx_numbering.declaration(), numberingRoot]
|
|
42
|
+
};
|
|
43
|
+
require_opc_content_types.ensureContentTypeOverride(pkg, require_edit_docx_numbering.NUMBERING_PART_PATH, require_edit_docx_numbering.NUMBERING_CONTENT_TYPE);
|
|
44
|
+
require_opc_rels.addRelationship(pkg, "word/document.xml", {
|
|
45
|
+
type: require_edit_docx_numbering.NUMBERING_REL_TYPE,
|
|
46
|
+
target: "numbering.xml"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const editor = new require_edit_docx_editor.DocxEditor(pkg);
|
|
50
|
+
(numIdLevels.size > 0 ? content.sections.map((section) => ({
|
|
51
|
+
...section,
|
|
52
|
+
blocks: remapListNumIds(section.blocks, remap)
|
|
53
|
+
})) : content.sections).forEach((section, sectionIndex) => {
|
|
17
54
|
if (sectionIndex > 0) editor.body.appendPageBreak();
|
|
18
55
|
appendBlocks(editor.body, section.blocks, options);
|
|
19
56
|
});
|
|
@@ -22,6 +59,42 @@ function buildDocxPackage(content, options) {
|
|
|
22
59
|
function isMergeableImageParagraph(block) {
|
|
23
60
|
return block.kind === "paragraph" && block.runs.every((run) => run.text === "");
|
|
24
61
|
}
|
|
62
|
+
function collectListNumIds(blocks, out) {
|
|
63
|
+
for (const block of blocks) if (block.kind === "paragraph" && block.list !== void 0) {
|
|
64
|
+
let levels = out.get(block.list.numId);
|
|
65
|
+
if (levels === void 0) {
|
|
66
|
+
levels = /* @__PURE__ */ new Set();
|
|
67
|
+
out.set(block.list.numId, levels);
|
|
68
|
+
}
|
|
69
|
+
levels.add(block.list.level);
|
|
70
|
+
} else if (block.kind === "table") for (const row of block.rows) for (const cell of row.cells) collectListNumIds(cell.blocks, out);
|
|
71
|
+
}
|
|
72
|
+
function remapListNumIds(blocks, numIdMap) {
|
|
73
|
+
if (numIdMap.size === 0) return [...blocks];
|
|
74
|
+
return blocks.map((block) => {
|
|
75
|
+
if (block.kind === "paragraph" && block.list !== void 0) {
|
|
76
|
+
const remapped = numIdMap.get(block.list.numId);
|
|
77
|
+
return remapped === void 0 ? block : {
|
|
78
|
+
...block,
|
|
79
|
+
list: {
|
|
80
|
+
numId: remapped,
|
|
81
|
+
level: block.list.level
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (block.kind === "table") return {
|
|
86
|
+
...block,
|
|
87
|
+
rows: block.rows.map((row) => ({
|
|
88
|
+
...row,
|
|
89
|
+
cells: row.cells.map((cell) => ({
|
|
90
|
+
...cell,
|
|
91
|
+
blocks: remapListNumIds(cell.blocks, numIdMap)
|
|
92
|
+
}))
|
|
93
|
+
}))
|
|
94
|
+
};
|
|
95
|
+
return block;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
25
98
|
function appendBlocks(body, blocks, options) {
|
|
26
99
|
let index = 0;
|
|
27
100
|
while (index < blocks.length) {
|
|
@@ -1,18 +1,55 @@
|
|
|
1
1
|
import { resolveMetadataTimestamps } from "../../model/metadata.js";
|
|
2
2
|
import { systemClock } from "../../ports/clock.js";
|
|
3
3
|
import { ptToTwips } from "../../model/units.js";
|
|
4
|
+
import { addRelationship } from "../../opc/rels.js";
|
|
5
|
+
import { ensureContentTypeOverride } from "../../opc/content-types.js";
|
|
4
6
|
import { createEmptyDocxPackage } from "./scaffold.js";
|
|
5
7
|
import { DocxEditor } from "./editor.js";
|
|
6
8
|
import { FLOW_CONTAINER_ORIGIN, drawingOfBlock, embeddedDrawingVectors } from "../../model/embedded-drawing.js";
|
|
7
9
|
import { formulaOfBlock, formulaPlaceholderText } from "../../model/formula.js";
|
|
10
|
+
import { NUMBERING_CONTENT_TYPE, NUMBERING_PART_PATH, NUMBERING_REL_TYPE, buildNumberingRoot, declaration } from "./numbering.js";
|
|
8
11
|
import { base64ToBytes } from "ooxml.js";
|
|
9
12
|
//#region src/edit/docx/content.ts
|
|
10
13
|
function buildDocxPackage(content, options) {
|
|
11
14
|
if (content.kind !== "wordprocessing") throw new Error("buildDocxPackage requires a wordprocessing ContentDocument");
|
|
12
15
|
const clock = options?.clock ?? systemClock;
|
|
13
16
|
const metadata = resolveMetadataTimestamps(content.metadata, clock);
|
|
14
|
-
const
|
|
15
|
-
|
|
17
|
+
const pkg = createEmptyDocxPackage({ metadata });
|
|
18
|
+
const numIdLevels = /* @__PURE__ */ new Map();
|
|
19
|
+
for (const section of content.sections) collectListNumIds(section.blocks, numIdLevels);
|
|
20
|
+
const remap = /* @__PURE__ */ new Map();
|
|
21
|
+
if (numIdLevels.size > 0) {
|
|
22
|
+
const entries = [];
|
|
23
|
+
let abstractNumId = 0;
|
|
24
|
+
let numId = 1;
|
|
25
|
+
for (const [sourceNumId, levels] of numIdLevels) {
|
|
26
|
+
const remapped = String(numId);
|
|
27
|
+
remap.set(sourceNumId, remapped);
|
|
28
|
+
entries.push({
|
|
29
|
+
sourceNumId,
|
|
30
|
+
remappedNumId: remapped,
|
|
31
|
+
abstractNumId: String(abstractNumId),
|
|
32
|
+
levels: [...levels].sort((a, b) => a - b)
|
|
33
|
+
});
|
|
34
|
+
abstractNumId += 1;
|
|
35
|
+
numId += 1;
|
|
36
|
+
}
|
|
37
|
+
const numberingRoot = buildNumberingRoot(entries);
|
|
38
|
+
pkg.parts[NUMBERING_PART_PATH] = {
|
|
39
|
+
kind: "xml",
|
|
40
|
+
nodes: [declaration(), numberingRoot]
|
|
41
|
+
};
|
|
42
|
+
ensureContentTypeOverride(pkg, NUMBERING_PART_PATH, NUMBERING_CONTENT_TYPE);
|
|
43
|
+
addRelationship(pkg, "word/document.xml", {
|
|
44
|
+
type: NUMBERING_REL_TYPE,
|
|
45
|
+
target: "numbering.xml"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const editor = new DocxEditor(pkg);
|
|
49
|
+
(numIdLevels.size > 0 ? content.sections.map((section) => ({
|
|
50
|
+
...section,
|
|
51
|
+
blocks: remapListNumIds(section.blocks, remap)
|
|
52
|
+
})) : content.sections).forEach((section, sectionIndex) => {
|
|
16
53
|
if (sectionIndex > 0) editor.body.appendPageBreak();
|
|
17
54
|
appendBlocks(editor.body, section.blocks, options);
|
|
18
55
|
});
|
|
@@ -21,6 +58,42 @@ function buildDocxPackage(content, options) {
|
|
|
21
58
|
function isMergeableImageParagraph(block) {
|
|
22
59
|
return block.kind === "paragraph" && block.runs.every((run) => run.text === "");
|
|
23
60
|
}
|
|
61
|
+
function collectListNumIds(blocks, out) {
|
|
62
|
+
for (const block of blocks) if (block.kind === "paragraph" && block.list !== void 0) {
|
|
63
|
+
let levels = out.get(block.list.numId);
|
|
64
|
+
if (levels === void 0) {
|
|
65
|
+
levels = /* @__PURE__ */ new Set();
|
|
66
|
+
out.set(block.list.numId, levels);
|
|
67
|
+
}
|
|
68
|
+
levels.add(block.list.level);
|
|
69
|
+
} else if (block.kind === "table") for (const row of block.rows) for (const cell of row.cells) collectListNumIds(cell.blocks, out);
|
|
70
|
+
}
|
|
71
|
+
function remapListNumIds(blocks, numIdMap) {
|
|
72
|
+
if (numIdMap.size === 0) return [...blocks];
|
|
73
|
+
return blocks.map((block) => {
|
|
74
|
+
if (block.kind === "paragraph" && block.list !== void 0) {
|
|
75
|
+
const remapped = numIdMap.get(block.list.numId);
|
|
76
|
+
return remapped === void 0 ? block : {
|
|
77
|
+
...block,
|
|
78
|
+
list: {
|
|
79
|
+
numId: remapped,
|
|
80
|
+
level: block.list.level
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (block.kind === "table") return {
|
|
85
|
+
...block,
|
|
86
|
+
rows: block.rows.map((row) => ({
|
|
87
|
+
...row,
|
|
88
|
+
cells: row.cells.map((cell) => ({
|
|
89
|
+
...cell,
|
|
90
|
+
blocks: remapListNumIds(cell.blocks, numIdMap)
|
|
91
|
+
}))
|
|
92
|
+
}))
|
|
93
|
+
};
|
|
94
|
+
return block;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
24
97
|
function appendBlocks(body, blocks, options) {
|
|
25
98
|
let index = 0;
|
|
26
99
|
while (index < blocks.length) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
|
+
//#region src/edit/docx/numbering.ts
|
|
4
|
+
const NUMBERING_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";
|
|
5
|
+
const NUMBERING_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
|
|
6
|
+
const NUMBERING_PART_PATH = "word/numbering.xml";
|
|
7
|
+
function declaration() {
|
|
8
|
+
return {
|
|
9
|
+
type: "declaration",
|
|
10
|
+
attributes: [
|
|
11
|
+
{
|
|
12
|
+
name: "version",
|
|
13
|
+
value: "1.0"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "encoding",
|
|
17
|
+
value: "UTF-8"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "standalone",
|
|
21
|
+
value: "yes"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function buildNumberingRoot(entries) {
|
|
27
|
+
const W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
28
|
+
const abstractNums = entries.map((entry) => require_xml_fragment.el("w:abstractNum", { "w:abstractNumId": entry.abstractNumId }, entry.levels.map((level) => require_xml_fragment.el("w:lvl", {
|
|
29
|
+
"w:ilvl": String(level),
|
|
30
|
+
"w:tentative": "1"
|
|
31
|
+
}, [
|
|
32
|
+
require_xml_fragment.el("w:start", { "w:val": "1" }),
|
|
33
|
+
require_xml_fragment.el("w:numFmt", { "w:val": "bullet" }),
|
|
34
|
+
require_xml_fragment.el("w:lvlText", { "w:val": "•" }),
|
|
35
|
+
require_xml_fragment.el("w:lvlJc", { "w:val": "left" })
|
|
36
|
+
]))));
|
|
37
|
+
const nums = entries.map((entry) => require_xml_fragment.el("w:num", { "w:numId": entry.remappedNumId }, [require_xml_fragment.el("w:abstractNumId", { "w:val": entry.abstractNumId })]));
|
|
38
|
+
return require_xml_fragment.el("w:numbering", { "xmlns:w": W }, [...abstractNums, ...nums]);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.NUMBERING_CONTENT_TYPE = NUMBERING_CONTENT_TYPE;
|
|
42
|
+
exports.NUMBERING_PART_PATH = NUMBERING_PART_PATH;
|
|
43
|
+
exports.NUMBERING_REL_TYPE = NUMBERING_REL_TYPE;
|
|
44
|
+
exports.buildNumberingRoot = buildNumberingRoot;
|
|
45
|
+
exports.declaration = declaration;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { XmlElement, XmlNode } from "ooxml.js";
|
|
2
|
+
//#region src/edit/docx/numbering.d.ts
|
|
3
|
+
declare const NUMBERING_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";
|
|
4
|
+
declare const NUMBERING_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
|
|
5
|
+
declare const NUMBERING_PART_PATH = "word/numbering.xml";
|
|
6
|
+
declare function declaration(): XmlNode;
|
|
7
|
+
interface NumberingEntry {
|
|
8
|
+
readonly sourceNumId: string;
|
|
9
|
+
readonly remappedNumId: string;
|
|
10
|
+
readonly abstractNumId: string;
|
|
11
|
+
readonly levels: readonly number[];
|
|
12
|
+
}
|
|
13
|
+
declare function buildNumberingRoot(entries: readonly NumberingEntry[]): XmlElement;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { NUMBERING_CONTENT_TYPE, NUMBERING_PART_PATH, NUMBERING_REL_TYPE, NumberingEntry, buildNumberingRoot, declaration };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { XmlElement, XmlNode } from "ooxml.js";
|
|
2
|
+
//#region src/edit/docx/numbering.d.ts
|
|
3
|
+
declare const NUMBERING_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";
|
|
4
|
+
declare const NUMBERING_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
|
|
5
|
+
declare const NUMBERING_PART_PATH = "word/numbering.xml";
|
|
6
|
+
declare function declaration(): XmlNode;
|
|
7
|
+
interface NumberingEntry {
|
|
8
|
+
readonly sourceNumId: string;
|
|
9
|
+
readonly remappedNumId: string;
|
|
10
|
+
readonly abstractNumId: string;
|
|
11
|
+
readonly levels: readonly number[];
|
|
12
|
+
}
|
|
13
|
+
declare function buildNumberingRoot(entries: readonly NumberingEntry[]): XmlElement;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { NUMBERING_CONTENT_TYPE, NUMBERING_PART_PATH, NUMBERING_REL_TYPE, NumberingEntry, buildNumberingRoot, declaration };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { el } from "../../xml/fragment.js";
|
|
2
|
+
//#region src/edit/docx/numbering.ts
|
|
3
|
+
const NUMBERING_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";
|
|
4
|
+
const NUMBERING_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
|
|
5
|
+
const NUMBERING_PART_PATH = "word/numbering.xml";
|
|
6
|
+
function declaration() {
|
|
7
|
+
return {
|
|
8
|
+
type: "declaration",
|
|
9
|
+
attributes: [
|
|
10
|
+
{
|
|
11
|
+
name: "version",
|
|
12
|
+
value: "1.0"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "encoding",
|
|
16
|
+
value: "UTF-8"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "standalone",
|
|
20
|
+
value: "yes"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function buildNumberingRoot(entries) {
|
|
26
|
+
const W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
27
|
+
const abstractNums = entries.map((entry) => el("w:abstractNum", { "w:abstractNumId": entry.abstractNumId }, entry.levels.map((level) => el("w:lvl", {
|
|
28
|
+
"w:ilvl": String(level),
|
|
29
|
+
"w:tentative": "1"
|
|
30
|
+
}, [
|
|
31
|
+
el("w:start", { "w:val": "1" }),
|
|
32
|
+
el("w:numFmt", { "w:val": "bullet" }),
|
|
33
|
+
el("w:lvlText", { "w:val": "•" }),
|
|
34
|
+
el("w:lvlJc", { "w:val": "left" })
|
|
35
|
+
]))));
|
|
36
|
+
const nums = entries.map((entry) => el("w:num", { "w:numId": entry.remappedNumId }, [el("w:abstractNumId", { "w:val": entry.abstractNumId })]));
|
|
37
|
+
return el("w:numbering", { "xmlns:w": W }, [...abstractNums, ...nums]);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { NUMBERING_CONTENT_TYPE, NUMBERING_PART_PATH, NUMBERING_REL_TYPE, buildNumberingRoot, declaration };
|
package/dist/edit/odt/run.cjs
CHANGED
|
@@ -78,6 +78,7 @@ function buildRun(pkg, init = {}) {
|
|
|
78
78
|
if (init.bold !== void 0) run.bold = init.bold;
|
|
79
79
|
if (init.italic !== void 0) run.italic = init.italic;
|
|
80
80
|
if (init.underline !== void 0) run.underline = init.underline;
|
|
81
|
+
if (init.strike !== void 0) run.strike = init.strike;
|
|
81
82
|
if (init.fontFamily !== void 0) run.fontFamily = init.fontFamily;
|
|
82
83
|
if (init.sizePt !== void 0) run.sizePt = init.sizePt;
|
|
83
84
|
if (init.color !== void 0) run.color = init.color;
|
package/dist/edit/odt/run.js
CHANGED
|
@@ -77,6 +77,7 @@ function buildRun(pkg, init = {}) {
|
|
|
77
77
|
if (init.bold !== void 0) run.bold = init.bold;
|
|
78
78
|
if (init.italic !== void 0) run.italic = init.italic;
|
|
79
79
|
if (init.underline !== void 0) run.underline = init.underline;
|
|
80
|
+
if (init.strike !== void 0) run.strike = init.strike;
|
|
80
81
|
if (init.fontFamily !== void 0) run.fontFamily = init.fontFamily;
|
|
81
82
|
if (init.sizePt !== void 0) run.sizePt = init.sizePt;
|
|
82
83
|
if (init.color !== void 0) run.color = init.color;
|
|
@@ -34,6 +34,7 @@ function appendShape(slide, shape) {
|
|
|
34
34
|
altText: onlyBlock.altText
|
|
35
35
|
});
|
|
36
36
|
if (shape.rotationDeg !== void 0) imageShape.rotationDeg = shape.rotationDeg;
|
|
37
|
+
if (shape.name !== void 0) imageShape.name = shape.name;
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "table") {
|
|
@@ -51,44 +52,45 @@ function appendShape(slide, shape) {
|
|
|
51
52
|
const paragraphs = [];
|
|
52
53
|
for (const block of shape.blocks) {
|
|
53
54
|
if (block.kind !== "paragraph") continue;
|
|
54
|
-
paragraphs.push(
|
|
55
|
-
alignment: block.alignment,
|
|
56
|
-
runs: block.runs.map((run) => ({
|
|
57
|
-
text: run.text,
|
|
58
|
-
bold: run.bold,
|
|
59
|
-
italic: run.italic,
|
|
60
|
-
underline: run.underline,
|
|
61
|
-
strike: run.strike,
|
|
62
|
-
fontFamily: run.fontFamily,
|
|
63
|
-
sizePt: run.sizePt,
|
|
64
|
-
color: run.color
|
|
65
|
-
}))
|
|
66
|
-
});
|
|
55
|
+
paragraphs.push(paragraphInitFromBlock(block));
|
|
67
56
|
}
|
|
68
57
|
const textBox = slide.addTextBox({
|
|
69
58
|
frame: shape.frame,
|
|
70
59
|
text: ""
|
|
71
60
|
});
|
|
72
61
|
if (shape.rotationDeg !== void 0) textBox.rotationDeg = shape.rotationDeg;
|
|
62
|
+
if (shape.name !== void 0) textBox.name = shape.name;
|
|
63
|
+
textBox.insetLeftPt = shape.insetLeftPt;
|
|
64
|
+
textBox.insetTopPt = shape.insetTopPt;
|
|
65
|
+
textBox.insetRightPt = shape.insetRightPt;
|
|
66
|
+
textBox.insetBottomPt = shape.insetBottomPt;
|
|
73
67
|
textBox.setParagraphs(paragraphs);
|
|
74
68
|
}
|
|
69
|
+
function paragraphInitFromBlock(block) {
|
|
70
|
+
return {
|
|
71
|
+
alignment: block.alignment,
|
|
72
|
+
spacingBeforePt: block.spacingBeforePt,
|
|
73
|
+
spacingAfterPt: block.spacingAfterPt,
|
|
74
|
+
lineSpacing: block.lineSpacing,
|
|
75
|
+
indentLeftPt: block.indentLeftPt,
|
|
76
|
+
indentFirstLinePt: block.indentFirstLinePt,
|
|
77
|
+
runs: block.runs.map((run) => ({
|
|
78
|
+
text: run.text,
|
|
79
|
+
bold: run.bold,
|
|
80
|
+
italic: run.italic,
|
|
81
|
+
underline: run.underline,
|
|
82
|
+
strike: run.strike,
|
|
83
|
+
fontFamily: run.fontFamily,
|
|
84
|
+
sizePt: run.sizePt,
|
|
85
|
+
color: run.color
|
|
86
|
+
}))
|
|
87
|
+
};
|
|
88
|
+
}
|
|
75
89
|
function populateCellParagraphs(cell, blocks) {
|
|
76
90
|
const paragraphs = [];
|
|
77
91
|
for (const block of blocks) {
|
|
78
92
|
if (block.kind !== "paragraph") continue;
|
|
79
|
-
paragraphs.push(
|
|
80
|
-
alignment: block.alignment,
|
|
81
|
-
runs: block.runs.map((run) => ({
|
|
82
|
-
text: run.text,
|
|
83
|
-
bold: run.bold,
|
|
84
|
-
italic: run.italic,
|
|
85
|
-
underline: run.underline,
|
|
86
|
-
strike: run.strike,
|
|
87
|
-
fontFamily: run.fontFamily,
|
|
88
|
-
sizePt: run.sizePt,
|
|
89
|
-
color: run.color
|
|
90
|
-
}))
|
|
91
|
-
});
|
|
93
|
+
paragraphs.push(paragraphInitFromBlock(block));
|
|
92
94
|
}
|
|
93
95
|
cell.setParagraphs(paragraphs);
|
|
94
96
|
}
|
|
@@ -121,6 +123,8 @@ function populatePptxTable(table, block) {
|
|
|
121
123
|
tableCell.rowSpan = cell.rowSpan;
|
|
122
124
|
for (let c = 0; c < span; c++) verticalMerges.set(colIndex + c, cell.rowSpan - 1);
|
|
123
125
|
}
|
|
126
|
+
if (cell.background !== void 0) tableCell.background = cell.background;
|
|
127
|
+
if (cell.borders !== void 0) tableCell.borders = cell.borders;
|
|
124
128
|
populateCellParagraphs(tableCell, cell.blocks);
|
|
125
129
|
});
|
|
126
130
|
});
|
|
@@ -33,6 +33,7 @@ function appendShape(slide, shape) {
|
|
|
33
33
|
altText: onlyBlock.altText
|
|
34
34
|
});
|
|
35
35
|
if (shape.rotationDeg !== void 0) imageShape.rotationDeg = shape.rotationDeg;
|
|
36
|
+
if (shape.name !== void 0) imageShape.name = shape.name;
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "table") {
|
|
@@ -50,44 +51,45 @@ function appendShape(slide, shape) {
|
|
|
50
51
|
const paragraphs = [];
|
|
51
52
|
for (const block of shape.blocks) {
|
|
52
53
|
if (block.kind !== "paragraph") continue;
|
|
53
|
-
paragraphs.push(
|
|
54
|
-
alignment: block.alignment,
|
|
55
|
-
runs: block.runs.map((run) => ({
|
|
56
|
-
text: run.text,
|
|
57
|
-
bold: run.bold,
|
|
58
|
-
italic: run.italic,
|
|
59
|
-
underline: run.underline,
|
|
60
|
-
strike: run.strike,
|
|
61
|
-
fontFamily: run.fontFamily,
|
|
62
|
-
sizePt: run.sizePt,
|
|
63
|
-
color: run.color
|
|
64
|
-
}))
|
|
65
|
-
});
|
|
54
|
+
paragraphs.push(paragraphInitFromBlock(block));
|
|
66
55
|
}
|
|
67
56
|
const textBox = slide.addTextBox({
|
|
68
57
|
frame: shape.frame,
|
|
69
58
|
text: ""
|
|
70
59
|
});
|
|
71
60
|
if (shape.rotationDeg !== void 0) textBox.rotationDeg = shape.rotationDeg;
|
|
61
|
+
if (shape.name !== void 0) textBox.name = shape.name;
|
|
62
|
+
textBox.insetLeftPt = shape.insetLeftPt;
|
|
63
|
+
textBox.insetTopPt = shape.insetTopPt;
|
|
64
|
+
textBox.insetRightPt = shape.insetRightPt;
|
|
65
|
+
textBox.insetBottomPt = shape.insetBottomPt;
|
|
72
66
|
textBox.setParagraphs(paragraphs);
|
|
73
67
|
}
|
|
68
|
+
function paragraphInitFromBlock(block) {
|
|
69
|
+
return {
|
|
70
|
+
alignment: block.alignment,
|
|
71
|
+
spacingBeforePt: block.spacingBeforePt,
|
|
72
|
+
spacingAfterPt: block.spacingAfterPt,
|
|
73
|
+
lineSpacing: block.lineSpacing,
|
|
74
|
+
indentLeftPt: block.indentLeftPt,
|
|
75
|
+
indentFirstLinePt: block.indentFirstLinePt,
|
|
76
|
+
runs: block.runs.map((run) => ({
|
|
77
|
+
text: run.text,
|
|
78
|
+
bold: run.bold,
|
|
79
|
+
italic: run.italic,
|
|
80
|
+
underline: run.underline,
|
|
81
|
+
strike: run.strike,
|
|
82
|
+
fontFamily: run.fontFamily,
|
|
83
|
+
sizePt: run.sizePt,
|
|
84
|
+
color: run.color
|
|
85
|
+
}))
|
|
86
|
+
};
|
|
87
|
+
}
|
|
74
88
|
function populateCellParagraphs(cell, blocks) {
|
|
75
89
|
const paragraphs = [];
|
|
76
90
|
for (const block of blocks) {
|
|
77
91
|
if (block.kind !== "paragraph") continue;
|
|
78
|
-
paragraphs.push(
|
|
79
|
-
alignment: block.alignment,
|
|
80
|
-
runs: block.runs.map((run) => ({
|
|
81
|
-
text: run.text,
|
|
82
|
-
bold: run.bold,
|
|
83
|
-
italic: run.italic,
|
|
84
|
-
underline: run.underline,
|
|
85
|
-
strike: run.strike,
|
|
86
|
-
fontFamily: run.fontFamily,
|
|
87
|
-
sizePt: run.sizePt,
|
|
88
|
-
color: run.color
|
|
89
|
-
}))
|
|
90
|
-
});
|
|
92
|
+
paragraphs.push(paragraphInitFromBlock(block));
|
|
91
93
|
}
|
|
92
94
|
cell.setParagraphs(paragraphs);
|
|
93
95
|
}
|
|
@@ -120,6 +122,8 @@ function populatePptxTable(table, block) {
|
|
|
120
122
|
tableCell.rowSpan = cell.rowSpan;
|
|
121
123
|
for (let c = 0; c < span; c++) verticalMerges.set(colIndex + c, cell.rowSpan - 1);
|
|
122
124
|
}
|
|
125
|
+
if (cell.background !== void 0) tableCell.background = cell.background;
|
|
126
|
+
if (cell.borders !== void 0) tableCell.borders = cell.borders;
|
|
123
127
|
populateCellParagraphs(tableCell, cell.blocks);
|
|
124
128
|
});
|
|
125
129
|
});
|
package/dist/edit/pptx/shape.cjs
CHANGED
|
@@ -34,6 +34,88 @@ var PptxShape = class {
|
|
|
34
34
|
node.children.push(created);
|
|
35
35
|
return created;
|
|
36
36
|
}
|
|
37
|
+
cNvPrElement(create) {
|
|
38
|
+
const node = this.live();
|
|
39
|
+
let container;
|
|
40
|
+
for (const tag of ["p:nvSpPr", "p:nvPicPr"]) {
|
|
41
|
+
container = directChild(node, tag);
|
|
42
|
+
if (container !== void 0) break;
|
|
43
|
+
}
|
|
44
|
+
if (container === void 0) {
|
|
45
|
+
if (!create) return;
|
|
46
|
+
container = require_xml_fragment.el("p:nvSpPr");
|
|
47
|
+
node.children.unshift(container);
|
|
48
|
+
}
|
|
49
|
+
const existing = directChild(container, "p:cNvPr");
|
|
50
|
+
if (existing !== void 0 || !create) return existing;
|
|
51
|
+
const created = require_xml_fragment.el("p:cNvPr", { id: "0" });
|
|
52
|
+
container.children.unshift(created);
|
|
53
|
+
return created;
|
|
54
|
+
}
|
|
55
|
+
bodyPrElement(create) {
|
|
56
|
+
const node = this.live();
|
|
57
|
+
let txBody = directChild(node, "p:txBody");
|
|
58
|
+
if (txBody === void 0) {
|
|
59
|
+
if (!create) return;
|
|
60
|
+
txBody = require_xml_fragment.el("p:txBody", {}, [require_xml_fragment.el("a:bodyPr"), require_xml_fragment.el("a:lstStyle")]);
|
|
61
|
+
node.children.push(txBody);
|
|
62
|
+
}
|
|
63
|
+
const existing = directChild(txBody, "a:bodyPr");
|
|
64
|
+
if (existing !== void 0 || !create) return existing;
|
|
65
|
+
const created = require_xml_fragment.el("a:bodyPr");
|
|
66
|
+
txBody.children.unshift(created);
|
|
67
|
+
return created;
|
|
68
|
+
}
|
|
69
|
+
get name() {
|
|
70
|
+
const cNvPr = this.cNvPrElement(false);
|
|
71
|
+
return cNvPr === void 0 ? void 0 : (0, ooxml_js.attr)(cNvPr, "name");
|
|
72
|
+
}
|
|
73
|
+
set name(value) {
|
|
74
|
+
const cNvPr = this.cNvPrElement(true);
|
|
75
|
+
if (value === void 0) {
|
|
76
|
+
require_xml_edit.removeAttr(cNvPr, "name");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
require_xml_edit.setAttr(cNvPr, "name", value);
|
|
80
|
+
}
|
|
81
|
+
get insetLeftPt() {
|
|
82
|
+
return this.readInsetPt("lIns");
|
|
83
|
+
}
|
|
84
|
+
set insetLeftPt(value) {
|
|
85
|
+
this.writeInsetPt("lIns", value);
|
|
86
|
+
}
|
|
87
|
+
get insetTopPt() {
|
|
88
|
+
return this.readInsetPt("tIns");
|
|
89
|
+
}
|
|
90
|
+
set insetTopPt(value) {
|
|
91
|
+
this.writeInsetPt("tIns", value);
|
|
92
|
+
}
|
|
93
|
+
get insetRightPt() {
|
|
94
|
+
return this.readInsetPt("rIns");
|
|
95
|
+
}
|
|
96
|
+
set insetRightPt(value) {
|
|
97
|
+
this.writeInsetPt("rIns", value);
|
|
98
|
+
}
|
|
99
|
+
get insetBottomPt() {
|
|
100
|
+
return this.readInsetPt("bIns");
|
|
101
|
+
}
|
|
102
|
+
set insetBottomPt(value) {
|
|
103
|
+
this.writeInsetPt("bIns", value);
|
|
104
|
+
}
|
|
105
|
+
readInsetPt(name) {
|
|
106
|
+
const bodyPr = this.bodyPrElement(false);
|
|
107
|
+
if (bodyPr === void 0) return;
|
|
108
|
+
const value = (0, ooxml_js.attr)(bodyPr, name);
|
|
109
|
+
return value === void 0 ? void 0 : require_model_units.emuToPt(Number.parseInt(value, 10));
|
|
110
|
+
}
|
|
111
|
+
writeInsetPt(name, value) {
|
|
112
|
+
const bodyPr = this.bodyPrElement(true);
|
|
113
|
+
if (value === void 0) {
|
|
114
|
+
require_xml_edit.removeAttr(bodyPr, name);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
require_xml_edit.setAttr(bodyPr, name, String(require_model_units.ptToEmu(value)));
|
|
118
|
+
}
|
|
37
119
|
get frame() {
|
|
38
120
|
const spPr = this.spPrElement(false);
|
|
39
121
|
const xfrm = spPr === void 0 ? void 0 : directChild(spPr, "a:xfrm");
|
|
@@ -124,6 +206,8 @@ const ALIGNMENT_TO_ALGN = {
|
|
|
124
206
|
justify: "just"
|
|
125
207
|
};
|
|
126
208
|
const HUNDREDTHS_POINT_PER_POINT = 100;
|
|
209
|
+
const SPACING_POINTS_PER_POINT = 100;
|
|
210
|
+
const LINE_SPACING_PERCENT_PER_MULTIPLIER = 1e5;
|
|
127
211
|
function buildDrawingRun(init) {
|
|
128
212
|
const rPrAttrs = {};
|
|
129
213
|
if (init.bold === true) rPrAttrs.b = "1";
|
|
@@ -139,8 +223,16 @@ function buildDrawingRun(init) {
|
|
|
139
223
|
return require_xml_fragment.el("a:r", {}, [...rPr, require_xml_fragment.el("a:t", tAttrs, [require_xml_fragment.txt(require_xml_entities.encodeXmlText(init.text))])]);
|
|
140
224
|
}
|
|
141
225
|
function buildDrawingParagraph(init) {
|
|
226
|
+
const pPrAttrs = {};
|
|
227
|
+
if (init.alignment !== void 0) pPrAttrs.algn = ALIGNMENT_TO_ALGN[init.alignment];
|
|
228
|
+
if (init.indentLeftPt !== void 0) pPrAttrs.marL = String(require_model_units.ptToEmu(init.indentLeftPt));
|
|
229
|
+
if (init.indentFirstLinePt !== void 0) pPrAttrs.indent = String(require_model_units.ptToEmu(init.indentFirstLinePt));
|
|
230
|
+
const pPrChildren = [];
|
|
231
|
+
if (init.lineSpacing !== void 0) pPrChildren.push(require_xml_fragment.el("a:lnSpc", {}, [require_xml_fragment.el("a:spcPct", { val: String(Math.round(init.lineSpacing * LINE_SPACING_PERCENT_PER_MULTIPLIER)) })]));
|
|
232
|
+
if (init.spacingBeforePt !== void 0) pPrChildren.push(require_xml_fragment.el("a:spcBef", {}, [require_xml_fragment.el("a:spcPts", { val: String(Math.round(init.spacingBeforePt * SPACING_POINTS_PER_POINT)) })]));
|
|
233
|
+
if (init.spacingAfterPt !== void 0) pPrChildren.push(require_xml_fragment.el("a:spcAft", {}, [require_xml_fragment.el("a:spcPts", { val: String(Math.round(init.spacingAfterPt * SPACING_POINTS_PER_POINT)) })]));
|
|
142
234
|
const children = [];
|
|
143
|
-
if (
|
|
235
|
+
if (Object.keys(pPrAttrs).length > 0 || pPrChildren.length > 0) children.push(require_xml_fragment.el("a:pPr", pPrAttrs, pPrChildren));
|
|
144
236
|
if (init.runs.length === 0) children.push(require_xml_fragment.el("a:endParaRPr"));
|
|
145
237
|
else children.push(...init.runs.map(buildDrawingRun));
|
|
146
238
|
return require_xml_fragment.el("a:p", {}, children);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-
|
|
1
|
+
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-CIIpuHNp.cjs";
|
|
2
2
|
export { DrawingParagraphInit, DrawingRunInit, PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-
|
|
1
|
+
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-DU4GMETm.js";
|
|
2
2
|
export { DrawingParagraphInit, DrawingRunInit, PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|
package/dist/edit/pptx/shape.js
CHANGED
|
@@ -33,6 +33,88 @@ var PptxShape = class {
|
|
|
33
33
|
node.children.push(created);
|
|
34
34
|
return created;
|
|
35
35
|
}
|
|
36
|
+
cNvPrElement(create) {
|
|
37
|
+
const node = this.live();
|
|
38
|
+
let container;
|
|
39
|
+
for (const tag of ["p:nvSpPr", "p:nvPicPr"]) {
|
|
40
|
+
container = directChild(node, tag);
|
|
41
|
+
if (container !== void 0) break;
|
|
42
|
+
}
|
|
43
|
+
if (container === void 0) {
|
|
44
|
+
if (!create) return;
|
|
45
|
+
container = el("p:nvSpPr");
|
|
46
|
+
node.children.unshift(container);
|
|
47
|
+
}
|
|
48
|
+
const existing = directChild(container, "p:cNvPr");
|
|
49
|
+
if (existing !== void 0 || !create) return existing;
|
|
50
|
+
const created = el("p:cNvPr", { id: "0" });
|
|
51
|
+
container.children.unshift(created);
|
|
52
|
+
return created;
|
|
53
|
+
}
|
|
54
|
+
bodyPrElement(create) {
|
|
55
|
+
const node = this.live();
|
|
56
|
+
let txBody = directChild(node, "p:txBody");
|
|
57
|
+
if (txBody === void 0) {
|
|
58
|
+
if (!create) return;
|
|
59
|
+
txBody = el("p:txBody", {}, [el("a:bodyPr"), el("a:lstStyle")]);
|
|
60
|
+
node.children.push(txBody);
|
|
61
|
+
}
|
|
62
|
+
const existing = directChild(txBody, "a:bodyPr");
|
|
63
|
+
if (existing !== void 0 || !create) return existing;
|
|
64
|
+
const created = el("a:bodyPr");
|
|
65
|
+
txBody.children.unshift(created);
|
|
66
|
+
return created;
|
|
67
|
+
}
|
|
68
|
+
get name() {
|
|
69
|
+
const cNvPr = this.cNvPrElement(false);
|
|
70
|
+
return cNvPr === void 0 ? void 0 : attr(cNvPr, "name");
|
|
71
|
+
}
|
|
72
|
+
set name(value) {
|
|
73
|
+
const cNvPr = this.cNvPrElement(true);
|
|
74
|
+
if (value === void 0) {
|
|
75
|
+
removeAttr(cNvPr, "name");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setAttr(cNvPr, "name", value);
|
|
79
|
+
}
|
|
80
|
+
get insetLeftPt() {
|
|
81
|
+
return this.readInsetPt("lIns");
|
|
82
|
+
}
|
|
83
|
+
set insetLeftPt(value) {
|
|
84
|
+
this.writeInsetPt("lIns", value);
|
|
85
|
+
}
|
|
86
|
+
get insetTopPt() {
|
|
87
|
+
return this.readInsetPt("tIns");
|
|
88
|
+
}
|
|
89
|
+
set insetTopPt(value) {
|
|
90
|
+
this.writeInsetPt("tIns", value);
|
|
91
|
+
}
|
|
92
|
+
get insetRightPt() {
|
|
93
|
+
return this.readInsetPt("rIns");
|
|
94
|
+
}
|
|
95
|
+
set insetRightPt(value) {
|
|
96
|
+
this.writeInsetPt("rIns", value);
|
|
97
|
+
}
|
|
98
|
+
get insetBottomPt() {
|
|
99
|
+
return this.readInsetPt("bIns");
|
|
100
|
+
}
|
|
101
|
+
set insetBottomPt(value) {
|
|
102
|
+
this.writeInsetPt("bIns", value);
|
|
103
|
+
}
|
|
104
|
+
readInsetPt(name) {
|
|
105
|
+
const bodyPr = this.bodyPrElement(false);
|
|
106
|
+
if (bodyPr === void 0) return;
|
|
107
|
+
const value = attr(bodyPr, name);
|
|
108
|
+
return value === void 0 ? void 0 : emuToPt(Number.parseInt(value, 10));
|
|
109
|
+
}
|
|
110
|
+
writeInsetPt(name, value) {
|
|
111
|
+
const bodyPr = this.bodyPrElement(true);
|
|
112
|
+
if (value === void 0) {
|
|
113
|
+
removeAttr(bodyPr, name);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
setAttr(bodyPr, name, String(ptToEmu(value)));
|
|
117
|
+
}
|
|
36
118
|
get frame() {
|
|
37
119
|
const spPr = this.spPrElement(false);
|
|
38
120
|
const xfrm = spPr === void 0 ? void 0 : directChild(spPr, "a:xfrm");
|
|
@@ -123,6 +205,8 @@ const ALIGNMENT_TO_ALGN = {
|
|
|
123
205
|
justify: "just"
|
|
124
206
|
};
|
|
125
207
|
const HUNDREDTHS_POINT_PER_POINT = 100;
|
|
208
|
+
const SPACING_POINTS_PER_POINT = 100;
|
|
209
|
+
const LINE_SPACING_PERCENT_PER_MULTIPLIER = 1e5;
|
|
126
210
|
function buildDrawingRun(init) {
|
|
127
211
|
const rPrAttrs = {};
|
|
128
212
|
if (init.bold === true) rPrAttrs.b = "1";
|
|
@@ -138,8 +222,16 @@ function buildDrawingRun(init) {
|
|
|
138
222
|
return el("a:r", {}, [...rPr, el("a:t", tAttrs, [txt(encodeXmlText(init.text))])]);
|
|
139
223
|
}
|
|
140
224
|
function buildDrawingParagraph(init) {
|
|
225
|
+
const pPrAttrs = {};
|
|
226
|
+
if (init.alignment !== void 0) pPrAttrs.algn = ALIGNMENT_TO_ALGN[init.alignment];
|
|
227
|
+
if (init.indentLeftPt !== void 0) pPrAttrs.marL = String(ptToEmu(init.indentLeftPt));
|
|
228
|
+
if (init.indentFirstLinePt !== void 0) pPrAttrs.indent = String(ptToEmu(init.indentFirstLinePt));
|
|
229
|
+
const pPrChildren = [];
|
|
230
|
+
if (init.lineSpacing !== void 0) pPrChildren.push(el("a:lnSpc", {}, [el("a:spcPct", { val: String(Math.round(init.lineSpacing * LINE_SPACING_PERCENT_PER_MULTIPLIER)) })]));
|
|
231
|
+
if (init.spacingBeforePt !== void 0) pPrChildren.push(el("a:spcBef", {}, [el("a:spcPts", { val: String(Math.round(init.spacingBeforePt * SPACING_POINTS_PER_POINT)) })]));
|
|
232
|
+
if (init.spacingAfterPt !== void 0) pPrChildren.push(el("a:spcAft", {}, [el("a:spcPts", { val: String(Math.round(init.spacingAfterPt * SPACING_POINTS_PER_POINT)) })]));
|
|
141
233
|
const children = [];
|
|
142
|
-
if (
|
|
234
|
+
if (Object.keys(pPrAttrs).length > 0 || pPrChildren.length > 0) children.push(el("a:pPr", pPrAttrs, pPrChildren));
|
|
143
235
|
if (init.runs.length === 0) children.push(el("a:endParaRPr"));
|
|
144
236
|
else children.push(...init.runs.map(buildDrawingRun));
|
|
145
237
|
return el("a:p", {}, children);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Box$1 } from "../../geometry-DaJr8yQW.cjs";
|
|
2
2
|
import { t as ImageInit } from "../../image-7snmKIxn.cjs";
|
|
3
|
-
import { r as PptxShape } from "../../shape-
|
|
4
|
-
import { r as PptxTableInit, t as PptxTable } from "../../table-
|
|
3
|
+
import { r as PptxShape } from "../../shape-CIIpuHNp.cjs";
|
|
4
|
+
import { r as PptxTableInit, t as PptxTable } from "../../table-C2dxbmvn.cjs";
|
|
5
5
|
import { ContentVector } from "document-schema.js";
|
|
6
6
|
import { Package, XmlElement, XmlNode } from "ooxml.js";
|
|
7
7
|
//#region src/edit/pptx/slide.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Box$1 } from "../../geometry-DaJr8yQW.js";
|
|
2
2
|
import { t as ImageInit } from "../../image-Cs8xF753.js";
|
|
3
|
-
import { r as PptxShape } from "../../shape-
|
|
4
|
-
import { r as PptxTableInit, t as PptxTable } from "../../table-
|
|
3
|
+
import { r as PptxShape } from "../../shape-DU4GMETm.js";
|
|
4
|
+
import { r as PptxTableInit, t as PptxTable } from "../../table-DOce3xA6.js";
|
|
5
5
|
import { Package, XmlElement, XmlNode } from "ooxml.js";
|
|
6
6
|
import { ContentVector } from "document-schema.js";
|
|
7
7
|
//#region src/edit/pptx/slide.d.ts
|
package/dist/edit/pptx/table.cjs
CHANGED
|
@@ -2,8 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
3
|
const require_model_units = require("../../model/units.cjs");
|
|
4
4
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
5
|
+
const require_edit_drawingml_vector = require("../drawingml/vector.cjs");
|
|
5
6
|
const require_edit_pptx_shape = require("./shape.cjs");
|
|
6
7
|
let ooxml_js = require("ooxml.js");
|
|
8
|
+
let document_schema_js = require("document-schema.js");
|
|
7
9
|
//#region src/edit/pptx/table.ts
|
|
8
10
|
const DEFAULT_TABLE_WIDTH_PT = 468;
|
|
9
11
|
const DEFAULT_ROW_HEIGHT_PT = 20;
|
|
@@ -13,6 +15,9 @@ var PptxTableCell = class {
|
|
|
13
15
|
constructor(node) {
|
|
14
16
|
this.node = node;
|
|
15
17
|
}
|
|
18
|
+
get element() {
|
|
19
|
+
return this.node;
|
|
20
|
+
}
|
|
16
21
|
get colSpan() {
|
|
17
22
|
const value = (0, ooxml_js.attr)(this.node, "gridSpan");
|
|
18
23
|
return value === void 0 ? void 0 : Number(value);
|
|
@@ -43,6 +48,79 @@ var PptxTableCell = class {
|
|
|
43
48
|
if (value) require_xml_edit.setAttr(this.node, "vMerge", "1");
|
|
44
49
|
else require_xml_edit.removeAttr(this.node, "vMerge");
|
|
45
50
|
}
|
|
51
|
+
tcPrElement(create) {
|
|
52
|
+
const existing = require_xml_edit.directChildElement(this.node, "a:tcPr");
|
|
53
|
+
if (existing !== void 0 || !create) return existing;
|
|
54
|
+
const created = require_xml_fragment.el("a:tcPr");
|
|
55
|
+
this.node.children.push(created);
|
|
56
|
+
return created;
|
|
57
|
+
}
|
|
58
|
+
get background() {
|
|
59
|
+
const tcPr = this.tcPrElement(false);
|
|
60
|
+
if (tcPr === void 0) return;
|
|
61
|
+
const solidFill = require_xml_edit.directChildElement(tcPr, "a:solidFill");
|
|
62
|
+
const srgbClr = solidFill === void 0 ? void 0 : require_xml_edit.directChildElement(solidFill, "a:srgbClr");
|
|
63
|
+
const hex = srgbClr === void 0 ? void 0 : (0, ooxml_js.attr)(srgbClr, "val");
|
|
64
|
+
return hex === void 0 ? void 0 : (0, document_schema_js.rgbHexToColor)(hex);
|
|
65
|
+
}
|
|
66
|
+
set background(value) {
|
|
67
|
+
const tcPr = this.tcPrElement(true);
|
|
68
|
+
const existing = require_xml_edit.directChildElement(tcPr, "a:solidFill");
|
|
69
|
+
if (existing !== void 0) tcPr.children.splice(tcPr.children.indexOf(existing), 1);
|
|
70
|
+
if (value === void 0) return;
|
|
71
|
+
tcPr.children.push(require_xml_fragment.el("a:solidFill", {}, [require_xml_fragment.el("a:srgbClr", { val: require_edit_drawingml_vector.drawingMlColorHex(value) })]));
|
|
72
|
+
}
|
|
73
|
+
get borders() {
|
|
74
|
+
const tcPr = this.tcPrElement(false);
|
|
75
|
+
if (tcPr === void 0) return;
|
|
76
|
+
const left = this.readBorder(require_xml_edit.directChildElement(tcPr, "a:lnL"));
|
|
77
|
+
const right = this.readBorder(require_xml_edit.directChildElement(tcPr, "a:lnR"));
|
|
78
|
+
const top = this.readBorder(require_xml_edit.directChildElement(tcPr, "a:lnT"));
|
|
79
|
+
const bottom = this.readBorder(require_xml_edit.directChildElement(tcPr, "a:lnB"));
|
|
80
|
+
if (left === void 0 && right === void 0 && top === void 0 && bottom === void 0) return;
|
|
81
|
+
const borders = {};
|
|
82
|
+
if (left !== void 0) borders.left = left;
|
|
83
|
+
if (right !== void 0) borders.right = right;
|
|
84
|
+
if (top !== void 0) borders.top = top;
|
|
85
|
+
if (bottom !== void 0) borders.bottom = bottom;
|
|
86
|
+
return borders;
|
|
87
|
+
}
|
|
88
|
+
set borders(value) {
|
|
89
|
+
const tcPr = this.tcPrElement(true);
|
|
90
|
+
for (const tag of [
|
|
91
|
+
"a:lnL",
|
|
92
|
+
"a:lnR",
|
|
93
|
+
"a:lnT",
|
|
94
|
+
"a:lnB"
|
|
95
|
+
]) {
|
|
96
|
+
const existing = require_xml_edit.directChildElement(tcPr, tag);
|
|
97
|
+
if (existing !== void 0) tcPr.children.splice(tcPr.children.indexOf(existing), 1);
|
|
98
|
+
}
|
|
99
|
+
if (value === void 0) return;
|
|
100
|
+
for (const [key, tag] of [
|
|
101
|
+
["left", "a:lnL"],
|
|
102
|
+
["right", "a:lnR"],
|
|
103
|
+
["top", "a:lnT"],
|
|
104
|
+
["bottom", "a:lnB"]
|
|
105
|
+
]) {
|
|
106
|
+
const border = value[key];
|
|
107
|
+
if (border === void 0) continue;
|
|
108
|
+
tcPr.children.push(require_xml_fragment.el(tag, { w: String(require_model_units.ptToEmu(border.widthPt)) }, [require_xml_fragment.el("a:solidFill", {}, [require_xml_fragment.el("a:srgbClr", { val: require_edit_drawingml_vector.drawingMlColorHex(border.color) })])]));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
readBorder(lnElement) {
|
|
112
|
+
if (lnElement === void 0) return;
|
|
113
|
+
const w = (0, ooxml_js.attr)(lnElement, "w");
|
|
114
|
+
if (w === void 0) return;
|
|
115
|
+
const solidFill = require_xml_edit.directChildElement(lnElement, "a:solidFill");
|
|
116
|
+
const srgbClr = solidFill === void 0 ? void 0 : require_xml_edit.directChildElement(solidFill, "a:srgbClr");
|
|
117
|
+
const hex = srgbClr === void 0 ? void 0 : (0, ooxml_js.attr)(srgbClr, "val");
|
|
118
|
+
if (hex === void 0) return;
|
|
119
|
+
return {
|
|
120
|
+
color: (0, document_schema_js.rgbHexToColor)(hex),
|
|
121
|
+
widthPt: require_model_units.emuToPt(Number.parseInt(w, 10))
|
|
122
|
+
};
|
|
123
|
+
}
|
|
46
124
|
setParagraphs(paragraphs) {
|
|
47
125
|
const txBody = require_xml_edit.directChildElement(this.node, "a:txBody");
|
|
48
126
|
if (txBody === void 0) return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-
|
|
1
|
+
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-C2dxbmvn.cjs";
|
|
2
2
|
export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-
|
|
1
|
+
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-DOce3xA6.js";
|
|
2
2
|
export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
|
package/dist/edit/pptx/table.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
|
-
import { ptToEmu } from "../../model/units.js";
|
|
2
|
+
import { emuToPt, ptToEmu } from "../../model/units.js";
|
|
3
3
|
import { directChildElement, removeAttr, setAttr } from "../../xml/edit.js";
|
|
4
|
+
import { drawingMlColorHex } from "../drawingml/vector.js";
|
|
4
5
|
import { ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph } from "./shape.js";
|
|
5
6
|
import { attr } from "ooxml.js";
|
|
7
|
+
import { rgbHexToColor } from "document-schema.js";
|
|
6
8
|
//#region src/edit/pptx/table.ts
|
|
7
9
|
const DEFAULT_TABLE_WIDTH_PT = 468;
|
|
8
10
|
const DEFAULT_ROW_HEIGHT_PT = 20;
|
|
@@ -12,6 +14,9 @@ var PptxTableCell = class {
|
|
|
12
14
|
constructor(node) {
|
|
13
15
|
this.node = node;
|
|
14
16
|
}
|
|
17
|
+
get element() {
|
|
18
|
+
return this.node;
|
|
19
|
+
}
|
|
15
20
|
get colSpan() {
|
|
16
21
|
const value = attr(this.node, "gridSpan");
|
|
17
22
|
return value === void 0 ? void 0 : Number(value);
|
|
@@ -42,6 +47,79 @@ var PptxTableCell = class {
|
|
|
42
47
|
if (value) setAttr(this.node, "vMerge", "1");
|
|
43
48
|
else removeAttr(this.node, "vMerge");
|
|
44
49
|
}
|
|
50
|
+
tcPrElement(create) {
|
|
51
|
+
const existing = directChildElement(this.node, "a:tcPr");
|
|
52
|
+
if (existing !== void 0 || !create) return existing;
|
|
53
|
+
const created = el("a:tcPr");
|
|
54
|
+
this.node.children.push(created);
|
|
55
|
+
return created;
|
|
56
|
+
}
|
|
57
|
+
get background() {
|
|
58
|
+
const tcPr = this.tcPrElement(false);
|
|
59
|
+
if (tcPr === void 0) return;
|
|
60
|
+
const solidFill = directChildElement(tcPr, "a:solidFill");
|
|
61
|
+
const srgbClr = solidFill === void 0 ? void 0 : directChildElement(solidFill, "a:srgbClr");
|
|
62
|
+
const hex = srgbClr === void 0 ? void 0 : attr(srgbClr, "val");
|
|
63
|
+
return hex === void 0 ? void 0 : rgbHexToColor(hex);
|
|
64
|
+
}
|
|
65
|
+
set background(value) {
|
|
66
|
+
const tcPr = this.tcPrElement(true);
|
|
67
|
+
const existing = directChildElement(tcPr, "a:solidFill");
|
|
68
|
+
if (existing !== void 0) tcPr.children.splice(tcPr.children.indexOf(existing), 1);
|
|
69
|
+
if (value === void 0) return;
|
|
70
|
+
tcPr.children.push(el("a:solidFill", {}, [el("a:srgbClr", { val: drawingMlColorHex(value) })]));
|
|
71
|
+
}
|
|
72
|
+
get borders() {
|
|
73
|
+
const tcPr = this.tcPrElement(false);
|
|
74
|
+
if (tcPr === void 0) return;
|
|
75
|
+
const left = this.readBorder(directChildElement(tcPr, "a:lnL"));
|
|
76
|
+
const right = this.readBorder(directChildElement(tcPr, "a:lnR"));
|
|
77
|
+
const top = this.readBorder(directChildElement(tcPr, "a:lnT"));
|
|
78
|
+
const bottom = this.readBorder(directChildElement(tcPr, "a:lnB"));
|
|
79
|
+
if (left === void 0 && right === void 0 && top === void 0 && bottom === void 0) return;
|
|
80
|
+
const borders = {};
|
|
81
|
+
if (left !== void 0) borders.left = left;
|
|
82
|
+
if (right !== void 0) borders.right = right;
|
|
83
|
+
if (top !== void 0) borders.top = top;
|
|
84
|
+
if (bottom !== void 0) borders.bottom = bottom;
|
|
85
|
+
return borders;
|
|
86
|
+
}
|
|
87
|
+
set borders(value) {
|
|
88
|
+
const tcPr = this.tcPrElement(true);
|
|
89
|
+
for (const tag of [
|
|
90
|
+
"a:lnL",
|
|
91
|
+
"a:lnR",
|
|
92
|
+
"a:lnT",
|
|
93
|
+
"a:lnB"
|
|
94
|
+
]) {
|
|
95
|
+
const existing = directChildElement(tcPr, tag);
|
|
96
|
+
if (existing !== void 0) tcPr.children.splice(tcPr.children.indexOf(existing), 1);
|
|
97
|
+
}
|
|
98
|
+
if (value === void 0) return;
|
|
99
|
+
for (const [key, tag] of [
|
|
100
|
+
["left", "a:lnL"],
|
|
101
|
+
["right", "a:lnR"],
|
|
102
|
+
["top", "a:lnT"],
|
|
103
|
+
["bottom", "a:lnB"]
|
|
104
|
+
]) {
|
|
105
|
+
const border = value[key];
|
|
106
|
+
if (border === void 0) continue;
|
|
107
|
+
tcPr.children.push(el(tag, { w: String(ptToEmu(border.widthPt)) }, [el("a:solidFill", {}, [el("a:srgbClr", { val: drawingMlColorHex(border.color) })])]));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
readBorder(lnElement) {
|
|
111
|
+
if (lnElement === void 0) return;
|
|
112
|
+
const w = attr(lnElement, "w");
|
|
113
|
+
if (w === void 0) return;
|
|
114
|
+
const solidFill = directChildElement(lnElement, "a:solidFill");
|
|
115
|
+
const srgbClr = solidFill === void 0 ? void 0 : directChildElement(solidFill, "a:srgbClr");
|
|
116
|
+
const hex = srgbClr === void 0 ? void 0 : attr(srgbClr, "val");
|
|
117
|
+
if (hex === void 0) return;
|
|
118
|
+
return {
|
|
119
|
+
color: rgbHexToColor(hex),
|
|
120
|
+
widthPt: emuToPt(Number.parseInt(w, 10))
|
|
121
|
+
};
|
|
122
|
+
}
|
|
45
123
|
setParagraphs(paragraphs) {
|
|
46
124
|
const txBody = directChildElement(this.node, "a:txBody");
|
|
47
125
|
if (txBody === void 0) return;
|
package/dist/index.d.cts
CHANGED
|
@@ -51,8 +51,8 @@ import { a as PdfItem, c as PdfLinkInit, d as PdfPathItem, f as PdfRectInit, h a
|
|
|
51
51
|
import { PageInit, PdfPage } from "./edit/pdf/page.cjs";
|
|
52
52
|
import { CreatePdfOptions, PdfEditor, createPdf, openPdf } from "./edit/pdf/editor.cjs";
|
|
53
53
|
import { BuildPptxPackageOptions, buildPptxPackage } from "./edit/pptx/content.cjs";
|
|
54
|
-
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-
|
|
55
|
-
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-
|
|
54
|
+
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-CIIpuHNp.cjs";
|
|
55
|
+
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-C2dxbmvn.cjs";
|
|
56
56
|
import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.cjs";
|
|
57
57
|
import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.cjs";
|
|
58
58
|
import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -51,8 +51,8 @@ import { a as PdfItem, c as PdfLinkInit, d as PdfPathItem, f as PdfRectInit, h a
|
|
|
51
51
|
import { PageInit, PdfPage } from "./edit/pdf/page.js";
|
|
52
52
|
import { CreatePdfOptions, PdfEditor, createPdf, openPdf } from "./edit/pdf/editor.js";
|
|
53
53
|
import { BuildPptxPackageOptions, buildPptxPackage } from "./edit/pptx/content.js";
|
|
54
|
-
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-
|
|
55
|
-
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-
|
|
54
|
+
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-DU4GMETm.js";
|
|
55
|
+
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-DOce3xA6.js";
|
|
56
56
|
import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.js";
|
|
57
57
|
import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.js";
|
|
58
58
|
import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.js";
|
package/dist/markdown/read.cjs
CHANGED
|
@@ -2,7 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let markdown_codec = require("markdown-codec");
|
|
3
3
|
//#region src/markdown/read.ts
|
|
4
4
|
function readMarkdownContent(text, options) {
|
|
5
|
-
const { document } = (0, markdown_codec.readMarkdown)(text,
|
|
5
|
+
const { document } = (0, markdown_codec.readMarkdown)(text, {
|
|
6
|
+
frontMatter: true,
|
|
7
|
+
...options
|
|
8
|
+
});
|
|
6
9
|
if (document.kind !== "wordprocessing") throw new Error("readMarkdown returned a non-wordprocessing ContentDocument");
|
|
7
10
|
return document;
|
|
8
11
|
}
|
package/dist/markdown/read.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { readMarkdown } from "markdown-codec";
|
|
2
2
|
//#region src/markdown/read.ts
|
|
3
3
|
function readMarkdownContent(text, options) {
|
|
4
|
-
const { document } = readMarkdown(text,
|
|
4
|
+
const { document } = readMarkdown(text, {
|
|
5
|
+
frontMatter: true,
|
|
6
|
+
...options
|
|
7
|
+
});
|
|
5
8
|
if (document.kind !== "wordprocessing") throw new Error("readMarkdown returned a non-wordprocessing ContentDocument");
|
|
6
9
|
return document;
|
|
7
10
|
}
|
|
@@ -11,6 +11,20 @@ declare class PptxShape {
|
|
|
11
11
|
constructor(container: XmlNode[], node: XmlElement);
|
|
12
12
|
private live;
|
|
13
13
|
private spPrElement;
|
|
14
|
+
private cNvPrElement;
|
|
15
|
+
private bodyPrElement;
|
|
16
|
+
get name(): string | undefined;
|
|
17
|
+
set name(value: string | undefined);
|
|
18
|
+
get insetLeftPt(): number | undefined;
|
|
19
|
+
set insetLeftPt(value: number | undefined);
|
|
20
|
+
get insetTopPt(): number | undefined;
|
|
21
|
+
set insetTopPt(value: number | undefined);
|
|
22
|
+
get insetRightPt(): number | undefined;
|
|
23
|
+
set insetRightPt(value: number | undefined);
|
|
24
|
+
get insetBottomPt(): number | undefined;
|
|
25
|
+
set insetBottomPt(value: number | undefined);
|
|
26
|
+
private readInsetPt;
|
|
27
|
+
private writeInsetPt;
|
|
14
28
|
get frame(): Box | undefined;
|
|
15
29
|
set frame(value: Box);
|
|
16
30
|
get rotationDeg(): number | undefined;
|
|
@@ -33,6 +47,11 @@ interface DrawingRunInit {
|
|
|
33
47
|
interface DrawingParagraphInit {
|
|
34
48
|
readonly runs: readonly DrawingRunInit[];
|
|
35
49
|
readonly alignment?: Alignment;
|
|
50
|
+
readonly spacingBeforePt?: number;
|
|
51
|
+
readonly spacingAfterPt?: number;
|
|
52
|
+
readonly lineSpacing?: number;
|
|
53
|
+
readonly indentLeftPt?: number;
|
|
54
|
+
readonly indentFirstLinePt?: number;
|
|
36
55
|
}
|
|
37
56
|
declare function buildDrawingParagraph(init: DrawingParagraphInit): XmlElement;
|
|
38
57
|
declare function buildTextBoxShape(frame: Box, text: string, shapeId: number): XmlElement;
|
|
@@ -11,6 +11,20 @@ declare class PptxShape {
|
|
|
11
11
|
constructor(container: XmlNode[], node: XmlElement);
|
|
12
12
|
private live;
|
|
13
13
|
private spPrElement;
|
|
14
|
+
private cNvPrElement;
|
|
15
|
+
private bodyPrElement;
|
|
16
|
+
get name(): string | undefined;
|
|
17
|
+
set name(value: string | undefined);
|
|
18
|
+
get insetLeftPt(): number | undefined;
|
|
19
|
+
set insetLeftPt(value: number | undefined);
|
|
20
|
+
get insetTopPt(): number | undefined;
|
|
21
|
+
set insetTopPt(value: number | undefined);
|
|
22
|
+
get insetRightPt(): number | undefined;
|
|
23
|
+
set insetRightPt(value: number | undefined);
|
|
24
|
+
get insetBottomPt(): number | undefined;
|
|
25
|
+
set insetBottomPt(value: number | undefined);
|
|
26
|
+
private readInsetPt;
|
|
27
|
+
private writeInsetPt;
|
|
14
28
|
get frame(): Box | undefined;
|
|
15
29
|
set frame(value: Box);
|
|
16
30
|
get rotationDeg(): number | undefined;
|
|
@@ -33,6 +47,11 @@ interface DrawingRunInit {
|
|
|
33
47
|
interface DrawingParagraphInit {
|
|
34
48
|
readonly runs: readonly DrawingRunInit[];
|
|
35
49
|
readonly alignment?: Alignment;
|
|
50
|
+
readonly spacingBeforePt?: number;
|
|
51
|
+
readonly spacingAfterPt?: number;
|
|
52
|
+
readonly lineSpacing?: number;
|
|
53
|
+
readonly indentLeftPt?: number;
|
|
54
|
+
readonly indentFirstLinePt?: number;
|
|
36
55
|
}
|
|
37
56
|
declare function buildDrawingParagraph(init: DrawingParagraphInit): XmlElement;
|
|
38
57
|
declare function buildTextBoxShape(frame: Box, text: string, shapeId: number): XmlElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as Box } from "./geometry-DaJr8yQW.cjs";
|
|
2
|
-
import { t as DrawingParagraphInit } from "./shape-
|
|
1
|
+
import { t as Box$1 } from "./geometry-DaJr8yQW.cjs";
|
|
2
|
+
import { t as DrawingParagraphInit } from "./shape-CIIpuHNp.cjs";
|
|
3
|
+
import { Color, ContentCellBorders } from "document-schema.js";
|
|
3
4
|
import { XmlElement } from "ooxml.js";
|
|
4
5
|
//#region src/edit/pptx/table.d.ts
|
|
5
6
|
interface PptxTableInit {
|
|
@@ -10,12 +11,19 @@ interface PptxTableInit {
|
|
|
10
11
|
declare class PptxTableCell {
|
|
11
12
|
private readonly node;
|
|
12
13
|
constructor(node: XmlElement);
|
|
14
|
+
get element(): XmlElement;
|
|
13
15
|
get colSpan(): number | undefined;
|
|
14
16
|
set colSpan(value: number | undefined);
|
|
15
17
|
get rowSpan(): number | undefined;
|
|
16
18
|
set rowSpan(value: number | undefined);
|
|
17
19
|
set horizontalMerge(value: boolean);
|
|
18
20
|
set verticalMerge(value: boolean);
|
|
21
|
+
private tcPrElement;
|
|
22
|
+
get background(): Color | undefined;
|
|
23
|
+
set background(value: Color | undefined);
|
|
24
|
+
get borders(): ContentCellBorders | undefined;
|
|
25
|
+
set borders(value: ContentCellBorders | undefined);
|
|
26
|
+
private readBorder;
|
|
19
27
|
setParagraphs(paragraphs: readonly DrawingParagraphInit[]): void;
|
|
20
28
|
}
|
|
21
29
|
declare class PptxTableRow {
|
|
@@ -30,7 +38,7 @@ declare class PptxTable {
|
|
|
30
38
|
cell(rowIndex: number, columnIndex: number): PptxTableCell;
|
|
31
39
|
}
|
|
32
40
|
declare function buildDrawingTable(init: PptxTableInit): XmlElement;
|
|
33
|
-
declare function buildTableGraphicFrame(frame: Box, tableElement: XmlElement, shapeId: number, rotationDeg: number | undefined): XmlElement;
|
|
41
|
+
declare function buildTableGraphicFrame(frame: Box$1, tableElement: XmlElement, shapeId: number, rotationDeg: number | undefined): XmlElement;
|
|
34
42
|
declare function findGraphicFrameTable(graphicFrame: XmlElement): XmlElement | undefined;
|
|
35
43
|
//#endregion
|
|
36
44
|
export { buildDrawingTable as a, PptxTableRow as i, PptxTableCell as n, buildTableGraphicFrame as o, PptxTableInit as r, findGraphicFrameTable as s, PptxTable as t };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as Box } from "./geometry-DaJr8yQW.js";
|
|
2
|
-
import { t as DrawingParagraphInit } from "./shape-
|
|
1
|
+
import { t as Box$1 } from "./geometry-DaJr8yQW.js";
|
|
2
|
+
import { t as DrawingParagraphInit } from "./shape-DU4GMETm.js";
|
|
3
3
|
import { XmlElement } from "ooxml.js";
|
|
4
|
+
import { Color, ContentCellBorders } from "document-schema.js";
|
|
4
5
|
//#region src/edit/pptx/table.d.ts
|
|
5
6
|
interface PptxTableInit {
|
|
6
7
|
readonly rows: number;
|
|
@@ -10,12 +11,19 @@ interface PptxTableInit {
|
|
|
10
11
|
declare class PptxTableCell {
|
|
11
12
|
private readonly node;
|
|
12
13
|
constructor(node: XmlElement);
|
|
14
|
+
get element(): XmlElement;
|
|
13
15
|
get colSpan(): number | undefined;
|
|
14
16
|
set colSpan(value: number | undefined);
|
|
15
17
|
get rowSpan(): number | undefined;
|
|
16
18
|
set rowSpan(value: number | undefined);
|
|
17
19
|
set horizontalMerge(value: boolean);
|
|
18
20
|
set verticalMerge(value: boolean);
|
|
21
|
+
private tcPrElement;
|
|
22
|
+
get background(): Color | undefined;
|
|
23
|
+
set background(value: Color | undefined);
|
|
24
|
+
get borders(): ContentCellBorders | undefined;
|
|
25
|
+
set borders(value: ContentCellBorders | undefined);
|
|
26
|
+
private readBorder;
|
|
19
27
|
setParagraphs(paragraphs: readonly DrawingParagraphInit[]): void;
|
|
20
28
|
}
|
|
21
29
|
declare class PptxTableRow {
|
|
@@ -30,7 +38,7 @@ declare class PptxTable {
|
|
|
30
38
|
cell(rowIndex: number, columnIndex: number): PptxTableCell;
|
|
31
39
|
}
|
|
32
40
|
declare function buildDrawingTable(init: PptxTableInit): XmlElement;
|
|
33
|
-
declare function buildTableGraphicFrame(frame: Box, tableElement: XmlElement, shapeId: number, rotationDeg: number | undefined): XmlElement;
|
|
41
|
+
declare function buildTableGraphicFrame(frame: Box$1, tableElement: XmlElement, shapeId: number, rotationDeg: number | undefined): XmlElement;
|
|
34
42
|
declare function findGraphicFrameTable(graphicFrame: XmlElement): XmlElement | undefined;
|
|
35
43
|
//#endregion
|
|
36
44
|
export { buildDrawingTable as a, PptxTableRow as i, PptxTableCell as n, buildTableGraphicFrame as o, PptxTableInit as r, findGraphicFrameTable as s, PptxTable as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.documents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.86.0",
|
|
4
4
|
"description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"document-schema.js": "^2.3.4",
|
|
62
62
|
"fflate": "^0.8.3",
|
|
63
63
|
"markdown-codec": "^1.1.7",
|
|
64
|
-
"odf.js": "^2.
|
|
65
|
-
"ooxml.js": "^2.
|
|
64
|
+
"odf.js": "^2.4.0",
|
|
65
|
+
"ooxml.js": "^2.8.0",
|
|
66
66
|
"pdf-codec": "^1.11.8",
|
|
67
67
|
"zod": "^4.4.3"
|
|
68
68
|
},
|