@office-open/core 0.9.6 → 0.9.8
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/chart/index.d.mts +1 -1
- package/dist/descriptor/index.d.mts +2 -2
- package/dist/descriptor/index.mjs +2 -2
- package/dist/descriptor-TtMXoZgS.mjs +443 -0
- package/dist/drawingml/index.d.mts +2 -2
- package/dist/drawingml/index.mjs +2 -2
- package/dist/{index-DMw7eid7.d.mts → index-BEQ12eyX.d.mts} +42 -42
- package/dist/{index-FByLiyYM.d.mts → index-CeVhA1an.d.mts} +878 -249
- package/dist/{index-eu1aFQCm.d.mts → index-CsQP7Cl4.d.mts} +36 -36
- package/dist/{index-DmPBJwSk.d.mts → index-DYy8l709.d.mts} +34 -34
- package/dist/index-L82O3q6V.d.mts +170 -0
- package/dist/{index-4hjRdzMU.d.mts → index-vEeWkbm5.d.mts} +20 -20
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +3 -3
- package/dist/patch/index.d.mts +1 -1
- package/dist/smartart/index.d.mts +1 -1
- package/dist/{src-CZMc9C8f.mjs → src-CSka9ln4.mjs} +1061 -195
- package/dist/theme/index.d.mts +1 -1
- package/package.json +2 -2
- package/dist/descriptor-DcQm32dg.mjs +0 -71
- package/dist/index-C4r2WLEy.d.mts +0 -73
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./smartart-DCY-Vdv7.mjs";
|
|
2
2
|
import "./chart-DwE8FCFk.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { d as parse$1, f as stringify$1 } from "./descriptor-TtMXoZgS.mjs";
|
|
4
4
|
import "./patch-ilNZTQmG.mjs";
|
|
5
5
|
import "./theme-CiNzdl-9.mjs";
|
|
6
6
|
import { attr, attrNum, element, escapeXml, findChild, js2xml, stringify, textOf, xml2js } from "@office-open/xml";
|
|
@@ -1616,11 +1616,33 @@ async function nativeZipAsync(files, level = 6) {
|
|
|
1616
1616
|
*
|
|
1617
1617
|
* @module
|
|
1618
1618
|
*/
|
|
1619
|
-
|
|
1619
|
+
const DATA_URL_RE = /^data:([\w.+-]+\/[\w.+-]+)?;base64,/;
|
|
1620
|
+
/** Test whether a string is a base64 data URL (`data:[mime];base64,...`). */
|
|
1621
|
+
function isBase64DataURL(input) {
|
|
1622
|
+
return DATA_URL_RE.test(input);
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Decode a base64 string into a Uint8Array using the most efficient path
|
|
1626
|
+
* available: Node `Buffer` (zero-copy) > `Uint8Array.fromBase64()` (2025
|
|
1627
|
+
* baseline, no intermediate binary string) > `atob` fallback. Prefer this over
|
|
1628
|
+
* raw `atob` for large payloads — `atob` materializes a UCS-2 binary string
|
|
1629
|
+
* (~2x memory) before the byte array.
|
|
1630
|
+
*/
|
|
1631
|
+
function decodeBase64(input) {
|
|
1632
|
+
if (typeof Buffer !== "undefined") return Buffer.from(input, "base64");
|
|
1633
|
+
const fromBase64 = Uint8Array.fromBase64;
|
|
1634
|
+
if (typeof fromBase64 === "function") return fromBase64.call(Uint8Array, input);
|
|
1635
|
+
return Uint8Array.from(atob(input), (c) => c.codePointAt(0));
|
|
1636
|
+
}
|
|
1637
|
+
function toUint8Array(data) {
|
|
1620
1638
|
if (data instanceof Uint8Array) return data;
|
|
1621
|
-
if (data instanceof ArrayBuffer
|
|
1639
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
1622
1640
|
if (data instanceof DataView) return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
1623
|
-
if (typeof data === "string")
|
|
1641
|
+
if (typeof data === "string") {
|
|
1642
|
+
const match = data.match(DATA_URL_RE);
|
|
1643
|
+
if (match) return decodeBase64(data.slice(match[0].length));
|
|
1644
|
+
return new TextEncoder().encode(data);
|
|
1645
|
+
}
|
|
1624
1646
|
if (Array.isArray(data)) return new Uint8Array(data);
|
|
1625
1647
|
if (data instanceof Blob) throw new TypeError("Blob input requires async processing");
|
|
1626
1648
|
if (data instanceof ReadableStream) throw new TypeError("ReadableStream input requires async processing");
|
|
@@ -1631,11 +1653,37 @@ const ZIP_DEFLATE_LEVEL = 1;
|
|
|
1631
1653
|
/** Default level for media entries (STORE — no compression). */
|
|
1632
1654
|
const ZIP_STORED_LEVEL = 0;
|
|
1633
1655
|
/**
|
|
1656
|
+
* Media formats already compressed internally (DEFLATE for PNG, DCT for JPEG,
|
|
1657
|
+
* LZW for GIF). Re-compressing via zip DEFLATE wastes CPU and often inflates
|
|
1658
|
+
* the data, so MS Office STORE-s these (CompressionOption.NotCompressed → zip
|
|
1659
|
+
* method 0). Everything else (EMF/WMF/BMP/TIFF/SVG/…) is compressible → DEFLATE.
|
|
1660
|
+
*/
|
|
1661
|
+
const PRECOMPRESSED_MEDIA_EXT = new Set([
|
|
1662
|
+
"jpg",
|
|
1663
|
+
"jpeg",
|
|
1664
|
+
"png",
|
|
1665
|
+
"gif"
|
|
1666
|
+
]);
|
|
1667
|
+
/**
|
|
1668
|
+
* Resolve the ZIP level for a media entry by file-name extension, matching MS
|
|
1669
|
+
* Office: already-compressed raster formats → STORE (0), everything else →
|
|
1670
|
+
* DEFLATE (`mediaLevel`, default SuperFast). A `compression.media` override
|
|
1671
|
+
* therefore applies only to compressible formats, never forcing DEFLATE onto
|
|
1672
|
+
* pre-compressed assets.
|
|
1673
|
+
*/
|
|
1674
|
+
const levelForMediaName = (fileName, mediaLevel) => {
|
|
1675
|
+
const dot = fileName.lastIndexOf(".");
|
|
1676
|
+
const ext = dot < 0 ? "" : fileName.slice(dot + 1).toLowerCase();
|
|
1677
|
+
return PRECOMPRESSED_MEDIA_EXT.has(ext) ? 0 : mediaLevel;
|
|
1678
|
+
};
|
|
1679
|
+
/**
|
|
1634
1680
|
* Asynchronously compress files and convert to the requested output format.
|
|
1635
1681
|
*
|
|
1636
1682
|
* Uses fflate Web Workers for non-blocking DEFLATE compression.
|
|
1637
|
-
* XML entries use DEFLATE by default
|
|
1638
|
-
*
|
|
1683
|
+
* XML entries use DEFLATE level 1 (SuperFast) by default. Media entries are
|
|
1684
|
+
* split by type, matching MS Office: already-compressed formats (PNG/JPEG/GIF)
|
|
1685
|
+
* are STOREd, everything else uses the `media` level (default SuperFast).
|
|
1686
|
+
* Set `{ media: ZIP_STORED_LEVEL }` to STORE all compressible media too.
|
|
1639
1687
|
*/
|
|
1640
1688
|
const zipAndConvert = async (files, type, mimeType, level = 1) => {
|
|
1641
1689
|
return convertOutput(hasNativeDeflate() ? await nativeZipAsync(files, level) : await new Promise((resolve, reject) => {
|
|
@@ -1699,7 +1747,7 @@ const createPacker = (options) => {
|
|
|
1699
1747
|
const { compile, mimeType } = options;
|
|
1700
1748
|
const pack = async (file, opts) => {
|
|
1701
1749
|
const type = opts?.type ?? "nodebuffer";
|
|
1702
|
-
return zipAndConvert(compile(file, opts?.overrides ?? [], opts?.compression?.media ??
|
|
1750
|
+
return zipAndConvert(compile(file, opts?.overrides ?? [], opts?.compression?.media ?? 1), type, mimeType, opts?.compression?.xml ?? 1);
|
|
1703
1751
|
};
|
|
1704
1752
|
const toBytes = (file, opts) => pack(file, {
|
|
1705
1753
|
...opts,
|
|
@@ -1727,7 +1775,7 @@ const createPacker = (options) => {
|
|
|
1727
1775
|
});
|
|
1728
1776
|
const packSync = (file, opts) => {
|
|
1729
1777
|
const type = opts?.type ?? "nodebuffer";
|
|
1730
|
-
return zipSyncAndConvert(compile(file, opts?.overrides ?? [], opts?.compression?.media ??
|
|
1778
|
+
return zipSyncAndConvert(compile(file, opts?.overrides ?? [], opts?.compression?.media ?? 1), type, mimeType, opts?.compression?.xml ?? 1);
|
|
1731
1779
|
};
|
|
1732
1780
|
const toBytesSync = (file, opts) => packSync(file, {
|
|
1733
1781
|
...opts,
|
|
@@ -1754,7 +1802,7 @@ const createPacker = (options) => {
|
|
|
1754
1802
|
type: "arraybuffer"
|
|
1755
1803
|
});
|
|
1756
1804
|
const toStream = (file, opts) => {
|
|
1757
|
-
const mediaLevel = opts?.compression?.media ??
|
|
1805
|
+
const mediaLevel = opts?.compression?.media ?? 1;
|
|
1758
1806
|
let files;
|
|
1759
1807
|
try {
|
|
1760
1808
|
files = compile(file, opts?.overrides ?? [], mediaLevel);
|
|
@@ -1895,6 +1943,824 @@ function parseArchive(data) {
|
|
|
1895
1943
|
return new ParsedArchive(data);
|
|
1896
1944
|
}
|
|
1897
1945
|
//#endregion
|
|
1946
|
+
//#region src/opc/opc-consistency.ts
|
|
1947
|
+
/**
|
|
1948
|
+
* OPC (Open Packaging Convention) consistency validator.
|
|
1949
|
+
*
|
|
1950
|
+
* Pure function operating on an already-unzipped part map. Detects the three
|
|
1951
|
+
* classes of cross-part breakage that single-part XSD validation cannot see:
|
|
1952
|
+
*
|
|
1953
|
+
* - relationship integrity — dangling targets, duplicate rIds (O3/O7)
|
|
1954
|
+
* - content-type integrity — parts with no Override/Default, stale
|
|
1955
|
+
* Overrides pointing at absent parts (O5/O6)
|
|
1956
|
+
* - structural integrity — missing `always` parts, undeclared orphans
|
|
1957
|
+
* (O1/O2)
|
|
1958
|
+
*
|
|
1959
|
+
* O3/O5/O6/O7 are derived directly from the ZIP + `.rels` + `[Content_Types].xml`
|
|
1960
|
+
* and need no registry. O1/O2 consult {@link PackagePartRegistry}.
|
|
1961
|
+
*
|
|
1962
|
+
* Reference: ECMA-376 Part 2 (OPC).
|
|
1963
|
+
*
|
|
1964
|
+
* @module
|
|
1965
|
+
*/
|
|
1966
|
+
function rootElement(xml) {
|
|
1967
|
+
try {
|
|
1968
|
+
return xml2js(xml).elements?.find((e) => e.type === "element");
|
|
1969
|
+
} catch {
|
|
1970
|
+
return;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
function parseContentTypes(entries) {
|
|
1974
|
+
const defaults = /* @__PURE__ */ new Map();
|
|
1975
|
+
const overrides = /* @__PURE__ */ new Map();
|
|
1976
|
+
const xml = entries.get("[Content_Types].xml");
|
|
1977
|
+
const root = xml ? rootElement(xml) : void 0;
|
|
1978
|
+
if (!root) return {
|
|
1979
|
+
defaults,
|
|
1980
|
+
overrides
|
|
1981
|
+
};
|
|
1982
|
+
for (const child of root.elements ?? []) {
|
|
1983
|
+
if (child.type !== "element") continue;
|
|
1984
|
+
if (child.name === "Default") {
|
|
1985
|
+
const ext = String(child.attributes?.Extension ?? "").toLowerCase();
|
|
1986
|
+
const ct = String(child.attributes?.ContentType ?? "");
|
|
1987
|
+
if (ext && ct) defaults.set(ext, ct);
|
|
1988
|
+
} else if (child.name === "Override") {
|
|
1989
|
+
const partName = normalizePartName(String(child.attributes?.PartName ?? ""));
|
|
1990
|
+
const ct = String(child.attributes?.ContentType ?? "");
|
|
1991
|
+
if (partName && ct) overrides.set(partName, ct);
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
return {
|
|
1995
|
+
defaults,
|
|
1996
|
+
overrides
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
function parseAllRels(entries) {
|
|
2000
|
+
const out = [];
|
|
2001
|
+
for (const [relsPath, xml] of entries) {
|
|
2002
|
+
if (!relsPath.endsWith(".rels")) continue;
|
|
2003
|
+
const root = rootElement(xml);
|
|
2004
|
+
if (!root) continue;
|
|
2005
|
+
const list = [];
|
|
2006
|
+
for (const child of root.elements ?? []) {
|
|
2007
|
+
if (child.type !== "element" || child.name !== "Relationship") continue;
|
|
2008
|
+
list.push({
|
|
2009
|
+
id: String(child.attributes?.Id ?? ""),
|
|
2010
|
+
type: String(child.attributes?.Type ?? ""),
|
|
2011
|
+
target: String(child.attributes?.Target ?? ""),
|
|
2012
|
+
targetMode: child.attributes?.TargetMode ? String(child.attributes?.TargetMode) : void 0
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
out.push({
|
|
2016
|
+
relsPath,
|
|
2017
|
+
entries: list
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
return out;
|
|
2021
|
+
}
|
|
2022
|
+
/** Strip the leading slash OPC uses on `PartName` to align with ZIP paths. */
|
|
2023
|
+
function normalizePartName(partName) {
|
|
2024
|
+
return partName.startsWith("/") ? partName.slice(1) : partName;
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Resolve a relationship `Target` (relative to its owning `.rels`) against the
|
|
2028
|
+
* ZIP root. Handles the `..` segments slides/masters use to reference siblings.
|
|
2029
|
+
*/
|
|
2030
|
+
function resolveRelTarget(relsPath, target) {
|
|
2031
|
+
const slash = relsPath.lastIndexOf("/");
|
|
2032
|
+
const relsDir = slash === -1 ? "" : relsPath.slice(0, slash);
|
|
2033
|
+
const base = relsDir === "_rels" ? "" : relsDir.endsWith("/_rels") ? relsDir.slice(0, -6) : relsDir;
|
|
2034
|
+
const segments = (base ? base.split("/") : []).concat(target.split("/"));
|
|
2035
|
+
const resolved = [];
|
|
2036
|
+
for (const seg of segments) {
|
|
2037
|
+
if (seg === "" || seg === ".") continue;
|
|
2038
|
+
if (seg === "..") resolved.pop();
|
|
2039
|
+
else resolved.push(seg);
|
|
2040
|
+
}
|
|
2041
|
+
return resolved.join("/");
|
|
2042
|
+
}
|
|
2043
|
+
/** Compile a registry path template (with `${i}`) into an anchored matcher. */
|
|
2044
|
+
function pathMatcher(template) {
|
|
2045
|
+
const pattern = template.replace(/\$\{i\}/g, "\0").replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(//g, "(\\d+)");
|
|
2046
|
+
return new RegExp(`^${pattern}$`);
|
|
2047
|
+
}
|
|
2048
|
+
function extensionOf(path) {
|
|
2049
|
+
const dot = path.lastIndexOf(".");
|
|
2050
|
+
return dot === -1 ? "" : path.slice(dot + 1).toLowerCase();
|
|
2051
|
+
}
|
|
2052
|
+
/**
|
|
2053
|
+
* Validate OPC consistency of an unzipped package.
|
|
2054
|
+
*
|
|
2055
|
+
* @param entries ZIP path → decoded XML/binary text. Binary parts (media,
|
|
2056
|
+
* fonts) are never parsed here — only their presence matters.
|
|
2057
|
+
* @param registry Declarative part expectations for the package format.
|
|
2058
|
+
* @returns Issues sorted by code then part. Empty array = consistent.
|
|
2059
|
+
*/
|
|
2060
|
+
function validateOpcConsistency(entries, registry) {
|
|
2061
|
+
const issues = [];
|
|
2062
|
+
const contentTypes = parseContentTypes(entries);
|
|
2063
|
+
const relsFiles = parseAllRels(entries);
|
|
2064
|
+
for (const def of registry.parts) {
|
|
2065
|
+
if (def.presence.kind !== "always" || def.path.includes("${i}")) continue;
|
|
2066
|
+
if (!entries.has(def.path)) issues.push({
|
|
2067
|
+
code: "O2",
|
|
2068
|
+
severity: "error",
|
|
2069
|
+
part: def.path,
|
|
2070
|
+
message: `required ${registry.format} part is absent from the package`
|
|
2071
|
+
});
|
|
2072
|
+
}
|
|
2073
|
+
const matchers = registry.parts.map((def) => pathMatcher(def.path));
|
|
2074
|
+
for (const path of entries.keys()) {
|
|
2075
|
+
if (path === "[Content_Types].xml") continue;
|
|
2076
|
+
if (path.endsWith(".rels")) continue;
|
|
2077
|
+
if (registry.orphanWhitelist.some((prefix) => path.startsWith(prefix))) continue;
|
|
2078
|
+
if (matchers.some((re) => re.test(path))) continue;
|
|
2079
|
+
issues.push({
|
|
2080
|
+
code: "O1",
|
|
2081
|
+
severity: "warn",
|
|
2082
|
+
part: path,
|
|
2083
|
+
message: `part not declared in the ${registry.format} registry (possible orphan)`
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
for (const rf of relsFiles) for (const rel of rf.entries) {
|
|
2087
|
+
if (rel.targetMode === "External") continue;
|
|
2088
|
+
if (/^https?:\/\//i.test(rel.target)) continue;
|
|
2089
|
+
const resolved = resolveRelTarget(rf.relsPath, rel.target);
|
|
2090
|
+
if (!resolved || entries.has(resolved)) continue;
|
|
2091
|
+
issues.push({
|
|
2092
|
+
code: "O3",
|
|
2093
|
+
severity: "error",
|
|
2094
|
+
part: rf.relsPath,
|
|
2095
|
+
message: `relationship ${rel.id || "(no Id)"} (${rel.type}) Target "${rel.target}" resolves to absent part "${resolved}"`
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
for (const path of entries.keys()) {
|
|
2099
|
+
if (path === "[Content_Types].xml" || path.endsWith(".rels")) continue;
|
|
2100
|
+
if (contentTypes.overrides.has(path)) continue;
|
|
2101
|
+
const ext = extensionOf(path);
|
|
2102
|
+
if (ext && contentTypes.defaults.has(ext)) continue;
|
|
2103
|
+
issues.push({
|
|
2104
|
+
code: "O5",
|
|
2105
|
+
severity: "error",
|
|
2106
|
+
part: path,
|
|
2107
|
+
message: `part has no [Content_Types] Override and no Default covers extension "${ext || "(none)"}"`
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
for (const partName of contentTypes.overrides.keys()) {
|
|
2111
|
+
if (entries.has(partName)) continue;
|
|
2112
|
+
issues.push({
|
|
2113
|
+
code: "O6",
|
|
2114
|
+
severity: "error",
|
|
2115
|
+
part: `/${partName}`,
|
|
2116
|
+
message: `[Content_Types] Override references absent part "${partName}"`
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
for (const rf of relsFiles) {
|
|
2120
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2121
|
+
for (const rel of rf.entries) {
|
|
2122
|
+
if (!rel.id) continue;
|
|
2123
|
+
counts.set(rel.id, (counts.get(rel.id) ?? 0) + 1);
|
|
2124
|
+
}
|
|
2125
|
+
for (const [id, count] of counts) {
|
|
2126
|
+
if (count <= 1) continue;
|
|
2127
|
+
issues.push({
|
|
2128
|
+
code: "O7",
|
|
2129
|
+
severity: "warn",
|
|
2130
|
+
part: rf.relsPath,
|
|
2131
|
+
message: `duplicate relationship Id "${id}" appears ${count} times`
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
return issues.sort((a, b) => a.code === b.code ? a.part.localeCompare(b.part) : a.code.localeCompare(b.code));
|
|
2136
|
+
}
|
|
2137
|
+
function summarizeOpcIssues(issues) {
|
|
2138
|
+
let errors = 0;
|
|
2139
|
+
let warnings = 0;
|
|
2140
|
+
for (const i of issues) if (i.severity === "error") errors++;
|
|
2141
|
+
else warnings++;
|
|
2142
|
+
return {
|
|
2143
|
+
errors,
|
|
2144
|
+
warnings
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region src/opc/part-registry.ts
|
|
2149
|
+
const DOCX_PARTS = {
|
|
2150
|
+
format: "docx",
|
|
2151
|
+
orphanWhitelist: [
|
|
2152
|
+
"word/media/",
|
|
2153
|
+
"word/fonts/",
|
|
2154
|
+
"word/embeddings/",
|
|
2155
|
+
"word/afchunks/",
|
|
2156
|
+
"customXml/",
|
|
2157
|
+
"_rels/",
|
|
2158
|
+
"word/_rels/",
|
|
2159
|
+
"docProps/",
|
|
2160
|
+
"[Content_Types].xml"
|
|
2161
|
+
],
|
|
2162
|
+
parts: [
|
|
2163
|
+
{
|
|
2164
|
+
path: "[Content_Types].xml",
|
|
2165
|
+
presence: { kind: "always" }
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
path: "_rels/.rels",
|
|
2169
|
+
presence: { kind: "always" }
|
|
2170
|
+
},
|
|
2171
|
+
{
|
|
2172
|
+
path: "word/document.xml",
|
|
2173
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
|
|
2174
|
+
presence: { kind: "always" }
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
path: "word/styles.xml",
|
|
2178
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",
|
|
2179
|
+
presence: {
|
|
2180
|
+
kind: "conditional",
|
|
2181
|
+
flag: "freshCompile"
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
path: "word/numbering.xml",
|
|
2186
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
|
|
2187
|
+
presence: {
|
|
2188
|
+
kind: "conditional",
|
|
2189
|
+
flag: "freshCompile"
|
|
2190
|
+
}
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
path: "word/footnotes.xml",
|
|
2194
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",
|
|
2195
|
+
presence: {
|
|
2196
|
+
kind: "conditional",
|
|
2197
|
+
flag: "freshCompile"
|
|
2198
|
+
}
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
path: "word/endnotes.xml",
|
|
2202
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",
|
|
2203
|
+
presence: {
|
|
2204
|
+
kind: "conditional",
|
|
2205
|
+
flag: "freshCompile"
|
|
2206
|
+
}
|
|
2207
|
+
},
|
|
2208
|
+
{
|
|
2209
|
+
path: "word/settings.xml",
|
|
2210
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",
|
|
2211
|
+
presence: {
|
|
2212
|
+
kind: "conditional",
|
|
2213
|
+
flag: "freshCompile"
|
|
2214
|
+
}
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
path: "word/fontTable.xml",
|
|
2218
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml",
|
|
2219
|
+
presence: {
|
|
2220
|
+
kind: "conditional",
|
|
2221
|
+
flag: "freshCompile"
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
{
|
|
2225
|
+
path: "docProps/core.xml",
|
|
2226
|
+
contentType: "application/vnd.openxmlformats-package.core-properties+xml",
|
|
2227
|
+
presence: {
|
|
2228
|
+
kind: "conditional",
|
|
2229
|
+
flag: "freshCompile"
|
|
2230
|
+
}
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
path: "docProps/app.xml",
|
|
2234
|
+
contentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
|
|
2235
|
+
presence: {
|
|
2236
|
+
kind: "conditional",
|
|
2237
|
+
flag: "freshCompile"
|
|
2238
|
+
}
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
path: "docProps/custom.xml",
|
|
2242
|
+
contentType: "application/vnd.openxmlformats-officedocument.custom-properties+xml",
|
|
2243
|
+
presence: {
|
|
2244
|
+
kind: "conditional",
|
|
2245
|
+
flag: "freshCompile"
|
|
2246
|
+
}
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
path: "word/comments.xml",
|
|
2250
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
|
2251
|
+
presence: {
|
|
2252
|
+
kind: "conditional",
|
|
2253
|
+
flag: "hasComments"
|
|
2254
|
+
}
|
|
2255
|
+
},
|
|
2256
|
+
{
|
|
2257
|
+
path: "word/header${i}.xml",
|
|
2258
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
|
|
2259
|
+
presence: {
|
|
2260
|
+
kind: "repeated",
|
|
2261
|
+
countFrom: "headerCount"
|
|
2262
|
+
}
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
path: "word/footer${i}.xml",
|
|
2266
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",
|
|
2267
|
+
presence: {
|
|
2268
|
+
kind: "repeated",
|
|
2269
|
+
countFrom: "footerCount"
|
|
2270
|
+
}
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
path: "word/charts/chart${i}.xml",
|
|
2274
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
2275
|
+
presence: {
|
|
2276
|
+
kind: "repeated",
|
|
2277
|
+
countFrom: "chartCount"
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
path: "word/diagrams/data${i}.xml",
|
|
2282
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml",
|
|
2283
|
+
presence: {
|
|
2284
|
+
kind: "repeated",
|
|
2285
|
+
countFrom: "smartArtCount"
|
|
2286
|
+
}
|
|
2287
|
+
},
|
|
2288
|
+
{
|
|
2289
|
+
path: "word/diagrams/layout${i}.xml",
|
|
2290
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml",
|
|
2291
|
+
presence: {
|
|
2292
|
+
kind: "repeated",
|
|
2293
|
+
countFrom: "smartArtCount"
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
path: "word/diagrams/quickStyle${i}.xml",
|
|
2298
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml",
|
|
2299
|
+
presence: {
|
|
2300
|
+
kind: "repeated",
|
|
2301
|
+
countFrom: "smartArtCount"
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
2304
|
+
{
|
|
2305
|
+
path: "word/diagrams/colors${i}.xml",
|
|
2306
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml",
|
|
2307
|
+
presence: {
|
|
2308
|
+
kind: "repeated",
|
|
2309
|
+
countFrom: "smartArtCount"
|
|
2310
|
+
}
|
|
2311
|
+
},
|
|
2312
|
+
{
|
|
2313
|
+
path: "word/diagrams/drawing${i}.xml",
|
|
2314
|
+
contentType: "application/vnd.ms-office.drawingml.diagramDrawing+xml",
|
|
2315
|
+
presence: {
|
|
2316
|
+
kind: "repeated",
|
|
2317
|
+
countFrom: "smartArtCount"
|
|
2318
|
+
}
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
path: "word/bibliography.xml",
|
|
2322
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.bibliography+xml",
|
|
2323
|
+
presence: {
|
|
2324
|
+
kind: "conditional",
|
|
2325
|
+
flag: "hasBibliography"
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2328
|
+
{
|
|
2329
|
+
path: "word/glossary/document.xml",
|
|
2330
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.glossary+xml",
|
|
2331
|
+
presence: {
|
|
2332
|
+
kind: "conditional",
|
|
2333
|
+
flag: "hasGlossary"
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
path: "word/webSettings.xml",
|
|
2338
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml",
|
|
2339
|
+
presence: {
|
|
2340
|
+
kind: "conditional",
|
|
2341
|
+
flag: "hasWebSettings"
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
path: "word/theme/theme1.xml",
|
|
2346
|
+
presence: {
|
|
2347
|
+
kind: "conditional",
|
|
2348
|
+
flag: "rawParts theme"
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
]
|
|
2352
|
+
};
|
|
2353
|
+
const PPTX_PARTS = {
|
|
2354
|
+
format: "pptx",
|
|
2355
|
+
orphanWhitelist: [
|
|
2356
|
+
"ppt/media/",
|
|
2357
|
+
"ppt/embeddings/",
|
|
2358
|
+
"_rels/",
|
|
2359
|
+
"ppt/_rels/",
|
|
2360
|
+
"ppt/slideMasters/_rels/",
|
|
2361
|
+
"ppt/slideLayouts/_rels/",
|
|
2362
|
+
"ppt/slides/_rels/",
|
|
2363
|
+
"ppt/notesMasters/_rels/",
|
|
2364
|
+
"ppt/notesSlides/_rels/",
|
|
2365
|
+
"ppt/charts/_rels/",
|
|
2366
|
+
"ppt/diagrams/_rels/",
|
|
2367
|
+
"docProps/",
|
|
2368
|
+
"[Content_Types].xml"
|
|
2369
|
+
],
|
|
2370
|
+
parts: [
|
|
2371
|
+
{
|
|
2372
|
+
path: "[Content_Types].xml",
|
|
2373
|
+
presence: { kind: "always" }
|
|
2374
|
+
},
|
|
2375
|
+
{
|
|
2376
|
+
path: "_rels/.rels",
|
|
2377
|
+
presence: { kind: "always" }
|
|
2378
|
+
},
|
|
2379
|
+
{
|
|
2380
|
+
path: "ppt/presentation.xml",
|
|
2381
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",
|
|
2382
|
+
presence: { kind: "always" }
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
path: "docProps/core.xml",
|
|
2386
|
+
contentType: "application/vnd.openxmlformats-package.core-properties+xml",
|
|
2387
|
+
presence: {
|
|
2388
|
+
kind: "conditional",
|
|
2389
|
+
flag: "freshCompile"
|
|
2390
|
+
}
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
path: "docProps/app.xml",
|
|
2394
|
+
contentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
|
|
2395
|
+
presence: {
|
|
2396
|
+
kind: "conditional",
|
|
2397
|
+
flag: "freshCompile"
|
|
2398
|
+
}
|
|
2399
|
+
},
|
|
2400
|
+
{
|
|
2401
|
+
path: "ppt/theme/theme${i}.xml",
|
|
2402
|
+
contentType: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
2403
|
+
presence: {
|
|
2404
|
+
kind: "repeated",
|
|
2405
|
+
countFrom: "masters + notes/handout masters"
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
path: "ppt/presProps.xml",
|
|
2410
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml",
|
|
2411
|
+
presence: {
|
|
2412
|
+
kind: "conditional",
|
|
2413
|
+
flag: "freshCompile"
|
|
2414
|
+
}
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
path: "ppt/viewProps.xml",
|
|
2418
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml",
|
|
2419
|
+
presence: {
|
|
2420
|
+
kind: "conditional",
|
|
2421
|
+
flag: "freshCompile"
|
|
2422
|
+
}
|
|
2423
|
+
},
|
|
2424
|
+
{
|
|
2425
|
+
path: "ppt/tableStyles.xml",
|
|
2426
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",
|
|
2427
|
+
presence: {
|
|
2428
|
+
kind: "conditional",
|
|
2429
|
+
flag: "freshCompile"
|
|
2430
|
+
}
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
path: "ppt/slideMasters/slideMaster${i}.xml",
|
|
2434
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml",
|
|
2435
|
+
presence: {
|
|
2436
|
+
kind: "repeated",
|
|
2437
|
+
countFrom: "masters.length"
|
|
2438
|
+
}
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
path: "ppt/slideLayouts/slideLayout${i}.xml",
|
|
2442
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml",
|
|
2443
|
+
presence: {
|
|
2444
|
+
kind: "repeated",
|
|
2445
|
+
countFrom: "layouts.length"
|
|
2446
|
+
}
|
|
2447
|
+
},
|
|
2448
|
+
{
|
|
2449
|
+
path: "ppt/slides/slide${i}.xml",
|
|
2450
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.slide+xml",
|
|
2451
|
+
presence: {
|
|
2452
|
+
kind: "repeated",
|
|
2453
|
+
countFrom: "slides.length"
|
|
2454
|
+
}
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
path: "ppt/notesMasters/notesMaster1.xml",
|
|
2458
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml",
|
|
2459
|
+
presence: {
|
|
2460
|
+
kind: "conditional",
|
|
2461
|
+
flag: "any slide has notes"
|
|
2462
|
+
}
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
path: "ppt/handoutMasters/handoutMaster1.xml",
|
|
2466
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml",
|
|
2467
|
+
presence: {
|
|
2468
|
+
kind: "conditional",
|
|
2469
|
+
flag: "includeHandoutMaster"
|
|
2470
|
+
}
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
path: "ppt/notesSlides/notesSlide${i}.xml",
|
|
2474
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",
|
|
2475
|
+
presence: {
|
|
2476
|
+
kind: "repeated",
|
|
2477
|
+
countFrom: "slides with notes"
|
|
2478
|
+
}
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
path: "ppt/commentAuthors.xml",
|
|
2482
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml",
|
|
2483
|
+
presence: {
|
|
2484
|
+
kind: "conditional",
|
|
2485
|
+
flag: "any slide has comments"
|
|
2486
|
+
}
|
|
2487
|
+
},
|
|
2488
|
+
{
|
|
2489
|
+
path: "ppt/comments/comment${i}.xml",
|
|
2490
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.comments+xml",
|
|
2491
|
+
presence: {
|
|
2492
|
+
kind: "repeated",
|
|
2493
|
+
countFrom: "slides with comments"
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2496
|
+
{
|
|
2497
|
+
path: "ppt/charts/chart${i}.xml",
|
|
2498
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
2499
|
+
presence: {
|
|
2500
|
+
kind: "repeated",
|
|
2501
|
+
countFrom: "charts"
|
|
2502
|
+
}
|
|
2503
|
+
},
|
|
2504
|
+
{
|
|
2505
|
+
path: "ppt/diagrams/data${i}.xml",
|
|
2506
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml",
|
|
2507
|
+
presence: {
|
|
2508
|
+
kind: "repeated",
|
|
2509
|
+
countFrom: "smartArts"
|
|
2510
|
+
}
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
path: "ppt/diagrams/layout${i}.xml",
|
|
2514
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml",
|
|
2515
|
+
presence: {
|
|
2516
|
+
kind: "repeated",
|
|
2517
|
+
countFrom: "smartArts"
|
|
2518
|
+
}
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
path: "ppt/diagrams/quickStyle${i}.xml",
|
|
2522
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml",
|
|
2523
|
+
presence: {
|
|
2524
|
+
kind: "repeated",
|
|
2525
|
+
countFrom: "smartArts"
|
|
2526
|
+
}
|
|
2527
|
+
},
|
|
2528
|
+
{
|
|
2529
|
+
path: "ppt/diagrams/colors${i}.xml",
|
|
2530
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml",
|
|
2531
|
+
presence: {
|
|
2532
|
+
kind: "repeated",
|
|
2533
|
+
countFrom: "smartArts"
|
|
2534
|
+
}
|
|
2535
|
+
},
|
|
2536
|
+
{
|
|
2537
|
+
path: "ppt/diagrams/drawing${i}.xml",
|
|
2538
|
+
contentType: "application/vnd.ms-office.drawingml.diagramDrawing+xml",
|
|
2539
|
+
presence: {
|
|
2540
|
+
kind: "repeated",
|
|
2541
|
+
countFrom: "smartArts"
|
|
2542
|
+
}
|
|
2543
|
+
},
|
|
2544
|
+
{
|
|
2545
|
+
path: "ppt/slideSyncPr/slideSyncPr${i}.xml",
|
|
2546
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.slideSyncProperties+xml",
|
|
2547
|
+
presence: {
|
|
2548
|
+
kind: "repeated",
|
|
2549
|
+
countFrom: "slides with slideSync"
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
]
|
|
2553
|
+
};
|
|
2554
|
+
const XLSX_PARTS = {
|
|
2555
|
+
format: "xlsx",
|
|
2556
|
+
orphanWhitelist: [
|
|
2557
|
+
"xl/media/",
|
|
2558
|
+
"xl/embeddings/",
|
|
2559
|
+
"_rels/",
|
|
2560
|
+
"xl/_rels/",
|
|
2561
|
+
"xl/worksheets/_rels/",
|
|
2562
|
+
"xl/chartsheets/_rels/",
|
|
2563
|
+
"xl/drawings/_rels/",
|
|
2564
|
+
"xl/pivotTables/_rels/",
|
|
2565
|
+
"xl/pivotCache/_rels/",
|
|
2566
|
+
"xl/externalLinks/_rels/",
|
|
2567
|
+
"docProps/",
|
|
2568
|
+
"[Content_Types].xml"
|
|
2569
|
+
],
|
|
2570
|
+
parts: [
|
|
2571
|
+
{
|
|
2572
|
+
path: "[Content_Types].xml",
|
|
2573
|
+
presence: { kind: "always" }
|
|
2574
|
+
},
|
|
2575
|
+
{
|
|
2576
|
+
path: "_rels/.rels",
|
|
2577
|
+
presence: { kind: "always" }
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
path: "xl/workbook.xml",
|
|
2581
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
|
2582
|
+
presence: { kind: "always" }
|
|
2583
|
+
},
|
|
2584
|
+
{
|
|
2585
|
+
path: "docProps/core.xml",
|
|
2586
|
+
contentType: "application/vnd.openxmlformats-package.core-properties+xml",
|
|
2587
|
+
presence: {
|
|
2588
|
+
kind: "conditional",
|
|
2589
|
+
flag: "freshCompile"
|
|
2590
|
+
}
|
|
2591
|
+
},
|
|
2592
|
+
{
|
|
2593
|
+
path: "docProps/app.xml",
|
|
2594
|
+
contentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
|
|
2595
|
+
presence: {
|
|
2596
|
+
kind: "conditional",
|
|
2597
|
+
flag: "freshCompile"
|
|
2598
|
+
}
|
|
2599
|
+
},
|
|
2600
|
+
{
|
|
2601
|
+
path: "xl/styles.xml",
|
|
2602
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
|
2603
|
+
presence: {
|
|
2604
|
+
kind: "conditional",
|
|
2605
|
+
flag: "freshCompile"
|
|
2606
|
+
}
|
|
2607
|
+
},
|
|
2608
|
+
{
|
|
2609
|
+
path: "xl/theme/theme1.xml",
|
|
2610
|
+
contentType: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
2611
|
+
presence: {
|
|
2612
|
+
kind: "conditional",
|
|
2613
|
+
flag: "freshCompile"
|
|
2614
|
+
}
|
|
2615
|
+
},
|
|
2616
|
+
{
|
|
2617
|
+
path: "xl/sharedStrings.xml",
|
|
2618
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
|
2619
|
+
presence: {
|
|
2620
|
+
kind: "conditional",
|
|
2621
|
+
flag: "sharedStrings.count > 0"
|
|
2622
|
+
}
|
|
2623
|
+
},
|
|
2624
|
+
{
|
|
2625
|
+
path: "xl/worksheets/sheet${i}.xml",
|
|
2626
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
|
2627
|
+
presence: {
|
|
2628
|
+
kind: "repeated",
|
|
2629
|
+
countFrom: "worksheets.length"
|
|
2630
|
+
}
|
|
2631
|
+
},
|
|
2632
|
+
{
|
|
2633
|
+
path: "xl/chartsheets/sheet${i}.xml",
|
|
2634
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
|
|
2635
|
+
presence: {
|
|
2636
|
+
kind: "repeated",
|
|
2637
|
+
countFrom: "chartsheets.length"
|
|
2638
|
+
}
|
|
2639
|
+
},
|
|
2640
|
+
{
|
|
2641
|
+
path: "xl/drawings/drawing${i}.xml",
|
|
2642
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawing+xml",
|
|
2643
|
+
presence: {
|
|
2644
|
+
kind: "conditional",
|
|
2645
|
+
flag: "worksheet has drawing"
|
|
2646
|
+
}
|
|
2647
|
+
},
|
|
2648
|
+
{
|
|
2649
|
+
path: "xl/comments${i}.xml",
|
|
2650
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
|
2651
|
+
presence: {
|
|
2652
|
+
kind: "conditional",
|
|
2653
|
+
flag: "worksheet.comments.length > 0"
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
{
|
|
2657
|
+
path: "xl/drawings/vmlDrawing${i}.vml",
|
|
2658
|
+
presence: {
|
|
2659
|
+
kind: "conditional",
|
|
2660
|
+
flag: "worksheet.comments (legacy VML)"
|
|
2661
|
+
}
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
path: "xl/charts/chart${i}.xml",
|
|
2665
|
+
contentType: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
2666
|
+
presence: {
|
|
2667
|
+
kind: "repeated",
|
|
2668
|
+
countFrom: "charts"
|
|
2669
|
+
}
|
|
2670
|
+
},
|
|
2671
|
+
{
|
|
2672
|
+
path: "xl/pivotTables/pivotTable${i}.xml",
|
|
2673
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
|
|
2674
|
+
presence: {
|
|
2675
|
+
kind: "repeated",
|
|
2676
|
+
countFrom: "pivotTables"
|
|
2677
|
+
}
|
|
2678
|
+
},
|
|
2679
|
+
{
|
|
2680
|
+
path: "xl/pivotCache/pivotCacheDefinition${i}.xml",
|
|
2681
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml",
|
|
2682
|
+
presence: {
|
|
2683
|
+
kind: "repeated",
|
|
2684
|
+
countFrom: "pivotCaches"
|
|
2685
|
+
}
|
|
2686
|
+
},
|
|
2687
|
+
{
|
|
2688
|
+
path: "xl/pivotCache/pivotCacheRecords${i}.xml",
|
|
2689
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml",
|
|
2690
|
+
presence: {
|
|
2691
|
+
kind: "repeated",
|
|
2692
|
+
countFrom: "pivotCaches"
|
|
2693
|
+
}
|
|
2694
|
+
},
|
|
2695
|
+
{
|
|
2696
|
+
path: "xl/tables/table${i}.xml",
|
|
2697
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
|
|
2698
|
+
presence: {
|
|
2699
|
+
kind: "repeated",
|
|
2700
|
+
countFrom: "tables"
|
|
2701
|
+
}
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
path: "xl/externalLinks/externalLink${i}.xml",
|
|
2705
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml",
|
|
2706
|
+
presence: {
|
|
2707
|
+
kind: "repeated",
|
|
2708
|
+
countFrom: "externalLinks.length"
|
|
2709
|
+
}
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
path: "xl/calcChain.xml",
|
|
2713
|
+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml",
|
|
2714
|
+
presence: {
|
|
2715
|
+
kind: "conditional",
|
|
2716
|
+
flag: "any formula cell"
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
]
|
|
2720
|
+
};
|
|
2721
|
+
const PART_REGISTRIES = {
|
|
2722
|
+
docx: DOCX_PARTS,
|
|
2723
|
+
pptx: PPTX_PARTS,
|
|
2724
|
+
xlsx: XLSX_PARTS
|
|
2725
|
+
};
|
|
2726
|
+
//#endregion
|
|
2727
|
+
//#region src/opc/content-type-overrides.ts
|
|
2728
|
+
/** Ensure a part path carries the leading slash an Override PartName requires. */
|
|
2729
|
+
function withLeadingSlash(partPath) {
|
|
2730
|
+
return partPath.startsWith("/") ? partPath : `/${partPath}`;
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* Derive [Content_Types].xml Override entries for every registry part present
|
|
2734
|
+
* under `facts`. The `facts` keys mirror the registry's `flag` / `countFrom`
|
|
2735
|
+
* tokens: a boolean for `conditional` parts, a count for `repeated` parts.
|
|
2736
|
+
* Order follows `registry.parts`; OPC does not mandate Override order.
|
|
2737
|
+
*/
|
|
2738
|
+
function buildContentTypeOverrides(registry, facts) {
|
|
2739
|
+
const overrides = [];
|
|
2740
|
+
for (const part of registry.parts) {
|
|
2741
|
+
if (!part.contentType) continue;
|
|
2742
|
+
const presence = part.presence;
|
|
2743
|
+
if (presence.kind === "always") {
|
|
2744
|
+
if (!part.path.includes("${i}")) overrides.push({
|
|
2745
|
+
partName: withLeadingSlash(part.path),
|
|
2746
|
+
contentType: part.contentType
|
|
2747
|
+
});
|
|
2748
|
+
} else if (presence.kind === "conditional") {
|
|
2749
|
+
if (facts.get(presence.flag)) overrides.push({
|
|
2750
|
+
partName: withLeadingSlash(part.path),
|
|
2751
|
+
contentType: part.contentType
|
|
2752
|
+
});
|
|
2753
|
+
} else {
|
|
2754
|
+
const count = Number(facts.get(presence.countFrom) ?? 0);
|
|
2755
|
+
for (let i = 1; i <= count; i++) overrides.push({
|
|
2756
|
+
partName: withLeadingSlash(part.path.replace("${i}", String(i))),
|
|
2757
|
+
contentType: part.contentType
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
return overrides;
|
|
2762
|
+
}
|
|
2763
|
+
//#endregion
|
|
1898
2764
|
//#region src/drawingml/color/color-transform.ts
|
|
1899
2765
|
/**
|
|
1900
2766
|
* Creates color transform child elements as XML strings.
|
|
@@ -2527,35 +3393,35 @@ const createBlipEffects = (options) => {
|
|
|
2527
3393
|
if (options.grayscale) children.push(`<a:grayscl/>`);
|
|
2528
3394
|
if (options.luminance) {
|
|
2529
3395
|
const attrs = {};
|
|
2530
|
-
if (options.luminance.bright !== void 0) attrs.bright = `${options.luminance.bright}
|
|
2531
|
-
if (options.luminance.contrast !== void 0) attrs.contrast = `${options.luminance.contrast}
|
|
3396
|
+
if (options.luminance.bright !== void 0) attrs.bright = `${options.luminance.bright}`;
|
|
3397
|
+
if (options.luminance.contrast !== void 0) attrs.contrast = `${options.luminance.contrast}`;
|
|
2532
3398
|
children.push(element("a:lum", attrs));
|
|
2533
3399
|
}
|
|
2534
3400
|
if (options.hsl) {
|
|
2535
3401
|
const attrs = {};
|
|
2536
3402
|
if (options.hsl.hue !== void 0) attrs.hue = String(options.hsl.hue);
|
|
2537
|
-
if (options.hsl.saturation !== void 0) attrs.sat = `${options.hsl.saturation}
|
|
2538
|
-
if (options.hsl.luminance !== void 0) attrs.lum = `${options.hsl.luminance}
|
|
3403
|
+
if (options.hsl.saturation !== void 0) attrs.sat = `${options.hsl.saturation}`;
|
|
3404
|
+
if (options.hsl.luminance !== void 0) attrs.lum = `${options.hsl.luminance}`;
|
|
2539
3405
|
children.push(element("a:hsl", attrs));
|
|
2540
3406
|
}
|
|
2541
3407
|
if (options.tint) {
|
|
2542
3408
|
const attrs = {};
|
|
2543
3409
|
if (options.tint.hue !== void 0) attrs.hue = String(options.tint.hue);
|
|
2544
|
-
if (options.tint.amount !== void 0) attrs.amt = `${options.tint.amount}
|
|
3410
|
+
if (options.tint.amount !== void 0) attrs.amt = `${options.tint.amount}`;
|
|
2545
3411
|
children.push(element("a:tint", attrs));
|
|
2546
3412
|
}
|
|
2547
3413
|
if (options.duotone) children.push(element("a:duotone", void 0, [createColorElement(options.duotone.color1), createColorElement(options.duotone.color2)]));
|
|
2548
|
-
if (options.biLevel) children.push(`<a:biLevel thresh="${options.biLevel.threshold}
|
|
3414
|
+
if (options.biLevel) children.push(`<a:biLevel thresh="${options.biLevel.threshold}"/>`);
|
|
2549
3415
|
if (options.alphaCeiling) children.push(`<a:alphaCeiling/>`);
|
|
2550
3416
|
if (options.alphaFloor) children.push(`<a:alphaFloor/>`);
|
|
2551
3417
|
if (options.alphaInverse !== void 0) if (typeof options.alphaInverse === "boolean") children.push(`<a:alphaInv/>`);
|
|
2552
3418
|
else children.push(element("a:alphaInv", void 0, [createColorElement(options.alphaInverse)]));
|
|
2553
3419
|
if (options.alphaModFix) {
|
|
2554
3420
|
const amt = options.alphaModFix.amount ?? 100;
|
|
2555
|
-
children.push(`<a:alphaModFix amt="${amt}
|
|
3421
|
+
children.push(`<a:alphaModFix amt="${amt}"/>`);
|
|
2556
3422
|
}
|
|
2557
|
-
if (options.alphaRepl) children.push(`<a:alphaRepl a="${options.alphaRepl.amount}
|
|
2558
|
-
if (options.alphaBiLevel) children.push(`<a:alphaBiLevel thresh="${options.alphaBiLevel.threshold}
|
|
3423
|
+
if (options.alphaRepl) children.push(`<a:alphaRepl a="${options.alphaRepl.amount}"/>`);
|
|
3424
|
+
if (options.alphaBiLevel) children.push(`<a:alphaBiLevel thresh="${options.alphaBiLevel.threshold}"/>`);
|
|
2559
3425
|
if (options.colorChange) {
|
|
2560
3426
|
const attrs = {};
|
|
2561
3427
|
if (options.colorChange.useAlpha === false) attrs.useA = "0";
|
|
@@ -2975,7 +3841,7 @@ const createShadeElement = (shade) => {
|
|
|
2975
3841
|
});
|
|
2976
3842
|
const pathShade = shade;
|
|
2977
3843
|
const children = [];
|
|
2978
|
-
if (pathShade.
|
|
3844
|
+
if (pathShade.fillToRectangle) children.push(createRelativeRect("a:fillToRect", pathShade.fillToRectangle));
|
|
2979
3845
|
return element("a:path", { path: pathShade.path }, children);
|
|
2980
3846
|
};
|
|
2981
3847
|
/**
|
|
@@ -3009,7 +3875,7 @@ const createGradientFill = (options) => {
|
|
|
3009
3875
|
const stopElements = options.stops.map(createGradientStop);
|
|
3010
3876
|
children.push(element("a:gsLst", void 0, stopElements));
|
|
3011
3877
|
if (options.shade) children.push(createShadeElement(options.shade));
|
|
3012
|
-
if (options.
|
|
3878
|
+
if (options.tileRectangle) children.push(createRelativeRect("a:tileRect", options.tileRectangle));
|
|
3013
3879
|
return element("a:gradFill", {
|
|
3014
3880
|
flip: options.flip,
|
|
3015
3881
|
rotWithShape: options.rotateWithShape
|
|
@@ -3196,21 +4062,23 @@ const createPatternFill = (options) => {
|
|
|
3196
4062
|
function normalizeColor(color) {
|
|
3197
4063
|
return typeof color === "string" ? { value: color.replace("#", "") } : color;
|
|
3198
4064
|
}
|
|
3199
|
-
function toUint8Array(data) {
|
|
3200
|
-
return data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
3201
|
-
}
|
|
3202
4065
|
/**
|
|
3203
4066
|
* Extracts media data from a blip fill option, if present.
|
|
3204
4067
|
* Returns undefined for non-blip fills.
|
|
3205
4068
|
*
|
|
3206
4069
|
* The returned data should be registered with the document's media store
|
|
3207
4070
|
* during serialization so the packer can resolve the `{fileName}` placeholder.
|
|
4071
|
+
*
|
|
4072
|
+
* @param fill - Fill options to inspect
|
|
4073
|
+
* @param nameAllocator - Optional sequential name provider (e.g. a format
|
|
4074
|
+
* package's media counter). When omitted, falls back to a random id so the
|
|
4075
|
+
* function stays usable from contexts without a shared counter.
|
|
3208
4076
|
*/
|
|
3209
|
-
const extractBlipFillMedia = (fill) => {
|
|
4077
|
+
const extractBlipFillMedia = (fill, nameAllocator) => {
|
|
3210
4078
|
if (typeof fill === "string" || fill.type !== "blip") return void 0;
|
|
3211
4079
|
return {
|
|
3212
4080
|
data: toUint8Array(fill.data),
|
|
3213
|
-
fileName: `${uniqueId()}.${fill.imageType}`,
|
|
4081
|
+
fileName: nameAllocator ? nameAllocator(fill.imageType) : `${uniqueId()}.${fill.imageType}`,
|
|
3214
4082
|
type: fill.imageType
|
|
3215
4083
|
};
|
|
3216
4084
|
};
|
|
@@ -3242,7 +4110,7 @@ const buildFill = (options) => {
|
|
|
3242
4110
|
const children = [element("a:blip", {
|
|
3243
4111
|
cstate: "none",
|
|
3244
4112
|
"r:embed": `{${fileName}}`
|
|
3245
|
-
}, blipChildren.length > 0 ? blipChildren : void 0), createSourceRectangle(options.
|
|
4113
|
+
}, blipChildren.length > 0 ? blipChildren : void 0), createSourceRectangle(options.sourceRectangle)];
|
|
3246
4114
|
if (options.tile) children.push(createTileInfo(options.tile));
|
|
3247
4115
|
else children.push("<a:stretch><a:fillRect/></a:stretch>");
|
|
3248
4116
|
const attrs = {};
|
|
@@ -3999,10 +4867,10 @@ const calculateEffectExtent = (options) => {
|
|
|
3999
4867
|
b = Math.max(b, options.softEdge);
|
|
4000
4868
|
}
|
|
4001
4869
|
return {
|
|
4002
|
-
l,
|
|
4003
|
-
t,
|
|
4004
|
-
r,
|
|
4005
|
-
b
|
|
4870
|
+
l: Math.round(l),
|
|
4871
|
+
t: Math.round(t),
|
|
4872
|
+
r: Math.round(r),
|
|
4873
|
+
b: Math.round(b)
|
|
4006
4874
|
};
|
|
4007
4875
|
};
|
|
4008
4876
|
/**
|
|
@@ -4451,11 +5319,11 @@ function stringifyPresetGeometry(options) {
|
|
|
4451
5319
|
const createGuideList = (name, guides) => {
|
|
4452
5320
|
return element(name, void 0, guides.map((guide) => `<a:gd name="${guide.name}" fmla="${guide.formula}"/>`));
|
|
4453
5321
|
};
|
|
4454
|
-
const
|
|
5322
|
+
const createAdjustPoint = (name, point) => element(name, void 0, [`<a:pt x="${point.x}" y="${point.y}"/>`]);
|
|
4455
5323
|
const createPathCommand = (cmd) => {
|
|
4456
5324
|
switch (cmd.command) {
|
|
4457
|
-
case "moveTo": return
|
|
4458
|
-
case "lineTo": return
|
|
5325
|
+
case "moveTo": return createAdjustPoint("a:moveTo", cmd.point);
|
|
5326
|
+
case "lineTo": return createAdjustPoint("a:lnTo", cmd.point);
|
|
4459
5327
|
case "arcTo": return `<a:arcTo wR="${cmd.widthRadius}" hR="${cmd.heightRadius}" stAng="${cmd.startAngle}" swAng="${cmd.sweepAngle}"/>`;
|
|
4460
5328
|
case "quadBezTo": return element("a:quadBezTo", void 0, cmd.points.map((pt) => `<a:pt x="${pt.x}" y="${pt.y}"/>`));
|
|
4461
5329
|
case "cubicBezTo": return element("a:cubicBezTo", void 0, cmd.points.map((pt) => `<a:pt x="${pt.x}" y="${pt.y}"/>`));
|
|
@@ -4510,7 +5378,7 @@ const createGeomRect = (rect) => `<a:rect l="${rect.left}" t="${rect.top}" r="${
|
|
|
4510
5378
|
* { command: "close" },
|
|
4511
5379
|
* ],
|
|
4512
5380
|
* }],
|
|
4513
|
-
*
|
|
5381
|
+
* textRectangle: { left: "2000000", top: "2000000", right: "8000000", bottom: "8000000" },
|
|
4514
5382
|
* });
|
|
4515
5383
|
* ```
|
|
4516
5384
|
*/
|
|
@@ -4520,7 +5388,7 @@ const createCustomGeometry = (options) => {
|
|
|
4520
5388
|
if (options.guides) children.push(createGuideList("a:gdLst", options.guides));
|
|
4521
5389
|
if (options.adjustHandles && options.adjustHandles.length > 0) children.push(element("a:ahLst", void 0, options.adjustHandles.map((h) => h.type === "xy" ? createXYAdjustHandle(h) : createPolarAdjustHandle(h))));
|
|
4522
5390
|
if (options.connectionSites && options.connectionSites.length > 0) children.push(element("a:cxnLst", void 0, options.connectionSites.map(createConnectionSite)));
|
|
4523
|
-
if (options.
|
|
5391
|
+
if (options.textRectangle) children.push(createGeomRect(options.textRectangle));
|
|
4524
5392
|
children.push(element("a:pathLst", void 0, options.pathList.map(createPath)));
|
|
4525
5393
|
return element("a:custGeom", void 0, children);
|
|
4526
5394
|
};
|
|
@@ -4682,7 +5550,7 @@ const createBlip = (options, blipEffects) => {
|
|
|
4682
5550
|
const createBlipFill = (blipOptions, fillOptions) => {
|
|
4683
5551
|
const children = [];
|
|
4684
5552
|
children.push(createBlip(blipOptions, fillOptions?.blipEffects));
|
|
4685
|
-
children.push(createSourceRectangle(fillOptions?.
|
|
5553
|
+
children.push(createSourceRectangle(fillOptions?.sourceRectangle));
|
|
4686
5554
|
if (fillOptions?.tile) children.push(createTileInfo(fillOptions.tile));
|
|
4687
5555
|
else children.push("<a:stretch><a:fillRect/></a:stretch>");
|
|
4688
5556
|
const attrs = {};
|
|
@@ -4776,8 +5644,14 @@ const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
|
|
|
4776
5644
|
const convertPixelsToEmu = (pixels) => Math.round(pixels * 9525);
|
|
4777
5645
|
/**
|
|
4778
5646
|
* Converts EMU to pixels (96 DPI).
|
|
5647
|
+
*
|
|
5648
|
+
* Returns a possibly fractional (sub-pixel) value. The integer rounding that
|
|
5649
|
+
* lived here before permanently discarded sub-pixel precision, which made an
|
|
5650
|
+
* EMU → pixel → EMU round-trip lossy (e.g. 5521960 EMU → 580 px → 5524500 EMU).
|
|
5651
|
+
* Keeping the fraction lets convertPixelsToEmu restore the exact original EMU.
|
|
5652
|
+
* Callers needing an integer pixel for display should Math.round the result.
|
|
4779
5653
|
*/
|
|
4780
|
-
const convertEmuToPixels = (emus) =>
|
|
5654
|
+
const convertEmuToPixels = (emus) => emus / 9525;
|
|
4781
5655
|
/**
|
|
4782
5656
|
* Converts inches to EMU.
|
|
4783
5657
|
*/
|
|
@@ -4983,10 +5857,10 @@ function createStyleMatrixRef(elementName, opts) {
|
|
|
4983
5857
|
}
|
|
4984
5858
|
/** Create border line element (a:ln with color) or a:lnRef */
|
|
4985
5859
|
function createThemeableLine(opts) {
|
|
4986
|
-
if (opts.
|
|
5860
|
+
if (opts.lineReference !== void 0) {
|
|
4987
5861
|
const children = [];
|
|
4988
5862
|
if (opts.color) children.push(toStr(opts.color));
|
|
4989
|
-
return element("a:lnRef", { idx: String(opts.
|
|
5863
|
+
return element("a:lnRef", { idx: String(opts.lineReference.idx) }, children.length > 0 ? children : void 0);
|
|
4990
5864
|
}
|
|
4991
5865
|
const children = [];
|
|
4992
5866
|
if (opts.color) children.push(toStr(opts.color));
|
|
@@ -5014,7 +5888,7 @@ function buildCellBorders(opts) {
|
|
|
5014
5888
|
}
|
|
5015
5889
|
function buildTextStyle(opts) {
|
|
5016
5890
|
const children = [];
|
|
5017
|
-
if (opts.
|
|
5891
|
+
if (opts.fontReference) children.push(createStyleMatrixRef("fontRef", opts.fontReference));
|
|
5018
5892
|
if (opts.color) children.push(toStr(opts.color));
|
|
5019
5893
|
const attrs = {};
|
|
5020
5894
|
if (opts.bold && opts.bold !== "def") attrs.b = onOffAttr(opts.bold);
|
|
@@ -5024,7 +5898,7 @@ function buildTextStyle(opts) {
|
|
|
5024
5898
|
function buildCellStyle(opts) {
|
|
5025
5899
|
const children = [];
|
|
5026
5900
|
if (opts.borders) children.push(buildCellBorders(opts.borders));
|
|
5027
|
-
if (opts.
|
|
5901
|
+
if (opts.fillReference) children.push(createStyleMatrixRef("fillRef", opts.fillReference));
|
|
5028
5902
|
else if (opts.fill) children.push(toStr(opts.fill));
|
|
5029
5903
|
return element("a:tcStyle", void 0, children);
|
|
5030
5904
|
}
|
|
@@ -5153,7 +6027,7 @@ function parseTableTextStyle(el) {
|
|
|
5153
6027
|
const i = attr(el, "i");
|
|
5154
6028
|
if (i === "on" || i === "off") opts.italic = i;
|
|
5155
6029
|
const fontRefEl = findChild(el, "a:fontRef");
|
|
5156
|
-
if (fontRefEl) opts.
|
|
6030
|
+
if (fontRefEl) opts.fontReference = parseStyleMatrixRef(fontRefEl);
|
|
5157
6031
|
for (const child of el.elements ?? []) {
|
|
5158
6032
|
if (child.name === "a:fontRef") continue;
|
|
5159
6033
|
opts.color = serializeChild(child);
|
|
@@ -5169,7 +6043,7 @@ function parseTableCellStyle(el) {
|
|
|
5169
6043
|
if (borders) opts.borders = borders;
|
|
5170
6044
|
}
|
|
5171
6045
|
const fillRefEl = findChild(el, "a:fillRef");
|
|
5172
|
-
if (fillRefEl) opts.
|
|
6046
|
+
if (fillRefEl) opts.fillReference = parseStyleMatrixRef(fillRefEl);
|
|
5173
6047
|
else for (const child of el.elements ?? []) {
|
|
5174
6048
|
if (child.name === "a:tcBdr") continue;
|
|
5175
6049
|
opts.fill = serializeChild(child);
|
|
@@ -5193,7 +6067,7 @@ function parseThemeableLine(el) {
|
|
|
5193
6067
|
const opts = {};
|
|
5194
6068
|
if (el.name === "a:lnRef") {
|
|
5195
6069
|
const idx = attrNum(el, "idx");
|
|
5196
|
-
if (idx !== void 0) opts.
|
|
6070
|
+
if (idx !== void 0) opts.lineReference = { idx };
|
|
5197
6071
|
} else {
|
|
5198
6072
|
const w = attrNum(el, "w");
|
|
5199
6073
|
if (w !== void 0) opts.width = w;
|
|
@@ -5251,25 +6125,25 @@ function createGraphicFrameLocking(opts) {
|
|
|
5251
6125
|
* @module
|
|
5252
6126
|
*/
|
|
5253
6127
|
/** Creates a dgm:adj element. */
|
|
5254
|
-
const
|
|
5255
|
-
const
|
|
6128
|
+
const createAdjust = (options) => `<dgm:adj idx="${options.idx}" val="${options.val}"/>`;
|
|
6129
|
+
const AnimationLevelValue = {
|
|
5256
6130
|
NONE: "none",
|
|
5257
6131
|
LEVEL: "lvl",
|
|
5258
6132
|
CENTER: "ctr"
|
|
5259
6133
|
};
|
|
5260
6134
|
/** Creates a dgm:animLvl element. */
|
|
5261
|
-
const
|
|
5262
|
-
const
|
|
6135
|
+
const createAnimationLevel = (options) => options?.val !== void 0 ? `<dgm:animLvl val="${options.val}"/>` : "<dgm:animLvl/>";
|
|
6136
|
+
const AnimateOneByOneValue = {
|
|
5263
6137
|
NONE: "none",
|
|
5264
6138
|
ONE: "one",
|
|
5265
6139
|
BRANCH: "branch"
|
|
5266
6140
|
};
|
|
5267
6141
|
/** Creates a dgm:animOne element. */
|
|
5268
|
-
const
|
|
6142
|
+
const createAnimateOneByOne = (options) => options?.val !== void 0 ? `<dgm:animOne val="${options.val}"/>` : "<dgm:animOne/>";
|
|
5269
6143
|
/** Creates a dgm:chMax element. */
|
|
5270
|
-
const
|
|
6144
|
+
const createMaxChildren = (options) => options?.val !== void 0 ? `<dgm:chMax val="${options.val}"/>` : "<dgm:chMax/>";
|
|
5271
6145
|
/** Creates a dgm:chPref element. */
|
|
5272
|
-
const
|
|
6146
|
+
const createPreferredChildren = (options) => options?.val !== void 0 ? `<dgm:chPref val="${options.val}"/>` : "<dgm:chPref/>";
|
|
5273
6147
|
/** Creates a dgm:orgChart element. */
|
|
5274
6148
|
const createOrgChart = (options) => options?.val !== void 0 ? `<dgm:orgChart val="${options.val}"/>` : "<dgm:orgChart/>";
|
|
5275
6149
|
const HierBranchStyle = {
|
|
@@ -5301,20 +6175,20 @@ const createHierBranch = (options) => options?.val !== void 0 ? `<dgm:hierBranch
|
|
|
5301
6175
|
* </xsd:complexType>
|
|
5302
6176
|
* ```
|
|
5303
6177
|
*/
|
|
5304
|
-
const
|
|
6178
|
+
const createPresentationLayoutVariables = (options) => {
|
|
5305
6179
|
const children = [];
|
|
5306
6180
|
if (options?.orgChart) children.push(createOrgChart(options.orgChart));
|
|
5307
|
-
if (options?.
|
|
5308
|
-
if (options?.
|
|
5309
|
-
if (options?.
|
|
5310
|
-
if (options?.
|
|
6181
|
+
if (options?.maxChildren) children.push(createMaxChildren(options.maxChildren));
|
|
6182
|
+
if (options?.preferredChildren) children.push(createPreferredChildren(options.preferredChildren));
|
|
6183
|
+
if (options?.animateOneByOne) children.push(createAnimateOneByOne(options.animateOneByOne));
|
|
6184
|
+
if (options?.animationLevel) children.push(createAnimationLevel(options.animationLevel));
|
|
5311
6185
|
if (options?.hierBranch) children.push(createHierBranch(options.hierBranch));
|
|
5312
6186
|
return element("dgm:presLayoutVars", void 0, children);
|
|
5313
6187
|
};
|
|
5314
6188
|
/** Creates a dgm:adjLst element containing dgm:adj children. */
|
|
5315
|
-
const
|
|
6189
|
+
const createAdjustList = (options) => {
|
|
5316
6190
|
const children = [];
|
|
5317
|
-
if (options?.
|
|
6191
|
+
if (options?.adjustments) for (const a of options.adjustments) children.push(createAdjust(a));
|
|
5318
6192
|
return element("dgm:adjLst", void 0, children);
|
|
5319
6193
|
};
|
|
5320
6194
|
//#endregion
|
|
@@ -5362,7 +6236,7 @@ const createCatLst = (categories) => {
|
|
|
5362
6236
|
* </xsd:complexType>
|
|
5363
6237
|
* ```
|
|
5364
6238
|
*/
|
|
5365
|
-
const
|
|
6239
|
+
const createColorsDefinitionHeader = (options) => {
|
|
5366
6240
|
const children = [];
|
|
5367
6241
|
for (const t of options.title) children.push(createNameEl("dgm:title", t));
|
|
5368
6242
|
for (const d of options.desc) children.push(createDescEl("dgm:desc", d));
|
|
@@ -5373,9 +6247,9 @@ const createColorsDefHdr = (options) => {
|
|
|
5373
6247
|
return element("dgm:colorsDefHdr", attrs, children);
|
|
5374
6248
|
};
|
|
5375
6249
|
/** Creates a dgm:colorsDefHdrLst element. */
|
|
5376
|
-
const
|
|
6250
|
+
const createColorsDefinitionHeaderList = (options) => {
|
|
5377
6251
|
const children = [];
|
|
5378
|
-
if (options?.headers) for (const hdr of options.headers) children.push(
|
|
6252
|
+
if (options?.headers) for (const hdr of options.headers) children.push(createColorsDefinitionHeader(hdr));
|
|
5379
6253
|
return element("dgm:colorsDefHdrLst", void 0, children);
|
|
5380
6254
|
};
|
|
5381
6255
|
/**
|
|
@@ -5397,7 +6271,7 @@ const createColorsDefHdrLst = (options) => {
|
|
|
5397
6271
|
* </xsd:complexType>
|
|
5398
6272
|
* ```
|
|
5399
6273
|
*/
|
|
5400
|
-
const
|
|
6274
|
+
const createLayoutDefinitionHeader = (options) => {
|
|
5401
6275
|
const children = [];
|
|
5402
6276
|
for (const t of options.title) children.push(createNameEl("dgm:title", t));
|
|
5403
6277
|
for (const d of options.desc) children.push(createDescEl("dgm:desc", d));
|
|
@@ -5409,9 +6283,9 @@ const createLayoutDefHdr = (options) => {
|
|
|
5409
6283
|
return element("dgm:layoutDefHdr", attrs, children);
|
|
5410
6284
|
};
|
|
5411
6285
|
/** Creates a dgm:layoutDefHdrLst element. */
|
|
5412
|
-
const
|
|
6286
|
+
const createLayoutDefinitionHeaderList = (options) => {
|
|
5413
6287
|
const children = [];
|
|
5414
|
-
if (options?.headers) for (const hdr of options.headers) children.push(
|
|
6288
|
+
if (options?.headers) for (const hdr of options.headers) children.push(createLayoutDefinitionHeader(hdr));
|
|
5415
6289
|
return element("dgm:layoutDefHdrLst", void 0, children);
|
|
5416
6290
|
};
|
|
5417
6291
|
/**
|
|
@@ -5432,7 +6306,7 @@ const createLayoutDefHdrLst = (options) => {
|
|
|
5432
6306
|
* </xsd:complexType>
|
|
5433
6307
|
* ```
|
|
5434
6308
|
*/
|
|
5435
|
-
const
|
|
6309
|
+
const createStyleDefinitionHeader = (options) => {
|
|
5436
6310
|
const children = [];
|
|
5437
6311
|
for (const t of options.title) children.push(createNameEl("dgm:title", t));
|
|
5438
6312
|
for (const d of options.desc) children.push(createDescEl("dgm:desc", d));
|
|
@@ -5443,9 +6317,9 @@ const createStyleDefHdr = (options) => {
|
|
|
5443
6317
|
return element("dgm:styleDefHdr", attrs, children);
|
|
5444
6318
|
};
|
|
5445
6319
|
/** Creates a dgm:styleDefHdrLst element. */
|
|
5446
|
-
const
|
|
6320
|
+
const createStyleDefinitionHeaderList = (options) => {
|
|
5447
6321
|
const children = [];
|
|
5448
|
-
if (options?.headers) for (const hdr of options.headers) children.push(
|
|
6322
|
+
if (options?.headers) for (const hdr of options.headers) children.push(createStyleDefinitionHeader(hdr));
|
|
5449
6323
|
return element("dgm:styleDefHdrLst", void 0, children);
|
|
5450
6324
|
};
|
|
5451
6325
|
//#endregion
|
|
@@ -5485,10 +6359,10 @@ const FontCollectionIndex = {
|
|
|
5485
6359
|
*/
|
|
5486
6360
|
const createDiagramStyle = (options) => {
|
|
5487
6361
|
const children = [];
|
|
5488
|
-
children.push(element("a:lnRef", { idx: options?.
|
|
5489
|
-
children.push(element("a:fillRef", { idx: options?.
|
|
5490
|
-
children.push(element("a:effectRef", { idx: options?.
|
|
5491
|
-
children.push(element("a:fontRef", { idx: options?.
|
|
6362
|
+
children.push(element("a:lnRef", { idx: options?.lineReference?.idx ?? 1 }, [createColorElement({ value: SchemeColor.ACCENT1 })]));
|
|
6363
|
+
children.push(element("a:fillRef", { idx: options?.fillReference?.idx ?? 1 }, [createColorElement({ value: SchemeColor.ACCENT1 })]));
|
|
6364
|
+
children.push(element("a:effectRef", { idx: options?.effectReference?.idx ?? 0 }, [createColorElement({ value: SchemeColor.ACCENT1 })]));
|
|
6365
|
+
children.push(element("a:fontRef", { idx: options?.fontReference?.idx ?? "minor" }, [createColorElement({ value: SchemeColor.TX1 })]));
|
|
5492
6366
|
return element("dgm:style", void 0, children);
|
|
5493
6367
|
};
|
|
5494
6368
|
const ColorMethod = {
|
|
@@ -5510,12 +6384,12 @@ const createColorList = (tag, options) => {
|
|
|
5510
6384
|
if (options?.hueDir) attrs.hueDir = options.hueDir;
|
|
5511
6385
|
return element(tag, hasAttrs ? attrs : void 0, children.length > 0 ? children : void 0);
|
|
5512
6386
|
};
|
|
5513
|
-
const
|
|
5514
|
-
const
|
|
5515
|
-
const
|
|
5516
|
-
const
|
|
5517
|
-
const
|
|
5518
|
-
const
|
|
6387
|
+
const createFillColorList = (options) => createColorList("dgm:fillClrLst", options);
|
|
6388
|
+
const createLineColorList = (options) => createColorList("dgm:linClrLst", options);
|
|
6389
|
+
const createEffectColorList = (options) => createColorList("dgm:effectClrLst", options);
|
|
6390
|
+
const createTextFillColorList = (options) => createColorList("dgm:txFillClrLst", options);
|
|
6391
|
+
const createTextLineColorList = (options) => createColorList("dgm:txLinClrLst", options);
|
|
6392
|
+
const createTextEffectColorList = (options) => createColorList("dgm:txEffectClrLst", options);
|
|
5519
6393
|
/**
|
|
5520
6394
|
* Creates a dgm:styleLbl element (CT_StyleLabel or CT_CTStyleLabel).
|
|
5521
6395
|
*
|
|
@@ -5549,14 +6423,14 @@ const createTxEffectClrLst = (options) => createColorList("dgm:txEffectClrLst",
|
|
|
5549
6423
|
* </xsd:complexType>
|
|
5550
6424
|
* ```
|
|
5551
6425
|
*/
|
|
5552
|
-
const
|
|
6426
|
+
const createStyleLabel = (options) => {
|
|
5553
6427
|
const children = [];
|
|
5554
|
-
if (options.
|
|
5555
|
-
if (options.
|
|
5556
|
-
if (options.
|
|
5557
|
-
if (options.
|
|
5558
|
-
if (options.
|
|
5559
|
-
if (options.
|
|
6428
|
+
if (options.fillColorList) children.push(createFillColorList(options.fillColorList));
|
|
6429
|
+
if (options.lineColorList) children.push(createLineColorList(options.lineColorList));
|
|
6430
|
+
if (options.effectColorList) children.push(createEffectColorList(options.effectColorList));
|
|
6431
|
+
if (options.textFillColorList) children.push(createTextFillColorList(options.textFillColorList));
|
|
6432
|
+
if (options.textLineColorList) children.push(createTextLineColorList(options.textLineColorList));
|
|
6433
|
+
if (options.textEffectColorList) children.push(createTextEffectColorList(options.textEffectColorList));
|
|
5560
6434
|
return element("dgm:styleLbl", { name: options.name }, children);
|
|
5561
6435
|
};
|
|
5562
6436
|
//#endregion
|
|
@@ -5574,7 +6448,7 @@ const createStyleLbl = (options) => {
|
|
|
5574
6448
|
* </xsd:complexType>
|
|
5575
6449
|
* ```
|
|
5576
6450
|
*/
|
|
5577
|
-
const
|
|
6451
|
+
const createDiagramRelationshipIds = (options) => `<dgm:relIds r:dm="${options.dm}" r:lo="${options.lo}" r:qs="${options.qs}" r:cs="${options.cs}"/>`;
|
|
5578
6452
|
//#endregion
|
|
5579
6453
|
//#region src/drawingml/diagram/diagram-props.ts
|
|
5580
6454
|
/**
|
|
@@ -5589,7 +6463,7 @@ const createDiagramRelIds = (options) => `<dgm:relIds r:dm="${options.dm}" r:lo=
|
|
|
5589
6463
|
*
|
|
5590
6464
|
* Generic extension list pattern used across OOXML.
|
|
5591
6465
|
*/
|
|
5592
|
-
const
|
|
6466
|
+
const createDiagramExtensionList = (options) => {
|
|
5593
6467
|
const children = [];
|
|
5594
6468
|
if (options?.extensions) for (const ext of options.extensions) children.push(`<a:ext uri="${ext.uri}"/>`);
|
|
5595
6469
|
return element("dgm:extLst", void 0, children);
|
|
@@ -5599,7 +6473,7 @@ const createDiagramExtLst = (options) => {
|
|
|
5599
6473
|
*
|
|
5600
6474
|
* Delegates to the shared createShape3D factory but wraps in dgm: namespace context.
|
|
5601
6475
|
*/
|
|
5602
|
-
const
|
|
6476
|
+
const createDiagramShape3D = (options) => createShape3D(options);
|
|
5603
6477
|
/**
|
|
5604
6478
|
* Creates a dgm:txPr element (CT_TextProps).
|
|
5605
6479
|
*
|
|
@@ -5612,7 +6486,7 @@ const createDiagramSp3d = (options) => createShape3D(options);
|
|
|
5612
6486
|
* </xsd:complexType>
|
|
5613
6487
|
* ```
|
|
5614
6488
|
*/
|
|
5615
|
-
const
|
|
6489
|
+
const createDiagramTextProperties = (_options) => "<dgm:txPr/>";
|
|
5616
6490
|
//#endregion
|
|
5617
6491
|
//#region src/drawingml/color/color-descriptors.ts
|
|
5618
6492
|
/**
|
|
@@ -5681,8 +6555,7 @@ const rgbColorDesc = {
|
|
|
5681
6555
|
return `<a:srgbClr val="${escapeXml(opts.value)}"/>`;
|
|
5682
6556
|
},
|
|
5683
6557
|
parse(el, _ctx) {
|
|
5684
|
-
const result = {};
|
|
5685
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6558
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5686
6559
|
const transforms = readTransforms(el);
|
|
5687
6560
|
if (transforms) result.transforms = transforms;
|
|
5688
6561
|
return result;
|
|
@@ -5696,8 +6569,7 @@ const schemeColorDesc = {
|
|
|
5696
6569
|
return `<a:schemeClr val="${escapeXml(opts.value)}"/>`;
|
|
5697
6570
|
},
|
|
5698
6571
|
parse(el, _ctx) {
|
|
5699
|
-
const result = {};
|
|
5700
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6572
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5701
6573
|
const transforms = readTransforms(el);
|
|
5702
6574
|
if (transforms) result.transforms = transforms;
|
|
5703
6575
|
return result;
|
|
@@ -5711,10 +6583,11 @@ const hslColorDesc = {
|
|
|
5711
6583
|
return `<a:hslClr hue="${opts.hue}" sat="${opts.saturation}" lum="${opts.luminance}"/>`;
|
|
5712
6584
|
},
|
|
5713
6585
|
parse(el, _ctx) {
|
|
5714
|
-
const result = {
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
6586
|
+
const result = {
|
|
6587
|
+
hue: Number(el.attributes?.["hue"] ?? 0),
|
|
6588
|
+
saturation: Number(el.attributes?.["sat"] ?? 0),
|
|
6589
|
+
luminance: Number(el.attributes?.["lum"] ?? 0)
|
|
6590
|
+
};
|
|
5718
6591
|
const transforms = readTransforms(el);
|
|
5719
6592
|
if (transforms) result.transforms = transforms;
|
|
5720
6593
|
return result;
|
|
@@ -5731,8 +6604,7 @@ const systemColorDesc = {
|
|
|
5731
6604
|
return `<a:sysClr ${attrStr}/>`;
|
|
5732
6605
|
},
|
|
5733
6606
|
parse(el, _ctx) {
|
|
5734
|
-
const result = {};
|
|
5735
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6607
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5736
6608
|
const lastClr = el.attributes?.["lastClr"];
|
|
5737
6609
|
if (lastClr) result.lastClr = String(lastClr);
|
|
5738
6610
|
const transforms = readTransforms(el);
|
|
@@ -5748,8 +6620,7 @@ const presetColorDesc = {
|
|
|
5748
6620
|
return `<a:prstClr val="${escapeXml(opts.value)}"/>`;
|
|
5749
6621
|
},
|
|
5750
6622
|
parse(el, _ctx) {
|
|
5751
|
-
const result = {};
|
|
5752
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6623
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5753
6624
|
const transforms = readTransforms(el);
|
|
5754
6625
|
if (transforms) result.transforms = transforms;
|
|
5755
6626
|
return result;
|
|
@@ -5763,10 +6634,11 @@ const scRgbColorDesc = {
|
|
|
5763
6634
|
return `<a:scrgbClr r="${escapeXml(opts.r)}" g="${escapeXml(opts.g)}" b="${escapeXml(opts.b)}"/>`;
|
|
5764
6635
|
},
|
|
5765
6636
|
parse(el, _ctx) {
|
|
5766
|
-
const result = {
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
6637
|
+
const result = {
|
|
6638
|
+
r: String(el.attributes?.["r"] ?? ""),
|
|
6639
|
+
g: String(el.attributes?.["g"] ?? ""),
|
|
6640
|
+
b: String(el.attributes?.["b"] ?? "")
|
|
6641
|
+
};
|
|
5770
6642
|
const transforms = readTransforms(el);
|
|
5771
6643
|
if (transforms) result.transforms = transforms;
|
|
5772
6644
|
return result;
|
|
@@ -5847,7 +6719,7 @@ function stringifyShade(shade) {
|
|
|
5847
6719
|
const parts = [];
|
|
5848
6720
|
if (pathShade.path) parts.push(`path="${escapeXml(pathShade.path)}"`);
|
|
5849
6721
|
const attrStr = parts.length ? " " + parts.join(" ") : "";
|
|
5850
|
-
if (pathShade.
|
|
6722
|
+
if (pathShade.fillToRectangle) return `<a:path${attrStr}>${stringifyRelativeRect("a:fillToRect", pathShade.fillToRectangle)}</a:path>`;
|
|
5851
6723
|
return `<a:path${attrStr}/>`;
|
|
5852
6724
|
}
|
|
5853
6725
|
const gradientFillDesc = {
|
|
@@ -5861,7 +6733,7 @@ const gradientFillDesc = {
|
|
|
5861
6733
|
}).join("");
|
|
5862
6734
|
parts.push(`<a:gsLst>${stopsXml}</a:gsLst>`);
|
|
5863
6735
|
if (opts.shade) parts.push(stringifyShade(opts.shade));
|
|
5864
|
-
if (opts.
|
|
6736
|
+
if (opts.tileRectangle) parts.push(stringifyRelativeRect("a:tileRect", opts.tileRectangle));
|
|
5865
6737
|
const attrParts = [];
|
|
5866
6738
|
if (opts.flip) attrParts.push(`flip="${escapeXml(opts.flip)}"`);
|
|
5867
6739
|
if (opts.rotateWithShape !== void 0) attrParts.push(`rotWithShape="${opts.rotateWithShape ? 1 : 0}"`);
|
|
@@ -5887,15 +6759,15 @@ const gradientFillDesc = {
|
|
|
5887
6759
|
if (path) {
|
|
5888
6760
|
const shade = {};
|
|
5889
6761
|
if (path.attributes?.["path"] !== void 0) shade.path = String(path.attributes["path"]);
|
|
5890
|
-
const
|
|
5891
|
-
if (
|
|
6762
|
+
const fillToRectangle = findChild(path, "a:fillToRect");
|
|
6763
|
+
if (fillToRectangle) shade.fillToRectangle = readRelativeRect(fillToRectangle);
|
|
5892
6764
|
result.shade = shade;
|
|
5893
6765
|
}
|
|
5894
6766
|
}
|
|
5895
6767
|
if (el.attributes?.["flip"] !== void 0) result.flip = String(el.attributes["flip"]);
|
|
5896
6768
|
if (el.attributes?.["rotWithShape"] !== void 0) result.rotateWithShape = el.attributes["rotWithShape"] !== "0";
|
|
5897
|
-
const
|
|
5898
|
-
if (
|
|
6769
|
+
const tileRectangle = findChild(el, "a:tileRect");
|
|
6770
|
+
if (tileRectangle) result.tileRectangle = readRelativeRect(tileRectangle);
|
|
5899
6771
|
return result;
|
|
5900
6772
|
}
|
|
5901
6773
|
};
|
|
@@ -5961,17 +6833,17 @@ const fillDesc = {
|
|
|
5961
6833
|
const solidFill = resolve("a:solidFill");
|
|
5962
6834
|
if (solidFill) return {
|
|
5963
6835
|
type: "solid",
|
|
5964
|
-
color: parse(solidFillDesc, solidFill, ctx)
|
|
6836
|
+
color: parse$1(solidFillDesc, solidFill, ctx)
|
|
5965
6837
|
};
|
|
5966
6838
|
const gradFill = resolve("a:gradFill");
|
|
5967
6839
|
if (gradFill) return {
|
|
5968
6840
|
type: "gradient",
|
|
5969
|
-
options: parse(gradientFillDesc, gradFill, ctx)
|
|
6841
|
+
options: parse$1(gradientFillDesc, gradFill, ctx)
|
|
5970
6842
|
};
|
|
5971
6843
|
const pattFill = resolve("a:pattFill");
|
|
5972
6844
|
if (pattFill) return {
|
|
5973
6845
|
type: "pattern",
|
|
5974
|
-
...parse(patternFillDesc, pattFill, ctx)
|
|
6846
|
+
...parse$1(patternFillDesc, pattFill, ctx)
|
|
5975
6847
|
};
|
|
5976
6848
|
if (resolve("a:grpFill")) return { type: "group" };
|
|
5977
6849
|
return { type: "none" };
|
|
@@ -5981,7 +6853,7 @@ function readDirectColor(el, ctx) {
|
|
|
5981
6853
|
const color = parseColorChoice(el, ctx);
|
|
5982
6854
|
if (Object.keys(color).length > 0) return color;
|
|
5983
6855
|
const solidFill = findChild(el, "a:solidFill");
|
|
5984
|
-
if (solidFill) return parse(solidFillDesc, solidFill, ctx);
|
|
6856
|
+
if (solidFill) return parse$1(solidFillDesc, solidFill, ctx);
|
|
5985
6857
|
return { value: "" };
|
|
5986
6858
|
}
|
|
5987
6859
|
//#endregion
|
|
@@ -6013,7 +6885,7 @@ const outlineDesc = {
|
|
|
6013
6885
|
stringify(opts, ctx) {
|
|
6014
6886
|
const parts = [];
|
|
6015
6887
|
const attrParts = [];
|
|
6016
|
-
if (opts.width !== void 0) attrParts.push(`w="${opts.width}"`);
|
|
6888
|
+
if (opts.width !== void 0) attrParts.push(`w="${convertToEmu(opts.width)}"`);
|
|
6017
6889
|
if (opts.cap !== void 0) attrParts.push(`cap="${escapeXml(opts.cap)}"`);
|
|
6018
6890
|
if (opts.compoundLine !== void 0) attrParts.push(`cmpd="${escapeXml(opts.compoundLine)}"`);
|
|
6019
6891
|
if (opts.align !== void 0) attrParts.push(`algn="${escapeXml(opts.align)}"`);
|
|
@@ -6047,12 +6919,12 @@ const outlineDesc = {
|
|
|
6047
6919
|
const solidFill = findChild(el, "a:solidFill");
|
|
6048
6920
|
if (solidFill) {
|
|
6049
6921
|
result.type = "solidFill";
|
|
6050
|
-
result.color = parse(solidFillDesc, solidFill, _ctx);
|
|
6922
|
+
result.color = parse$1(solidFillDesc, solidFill, _ctx);
|
|
6051
6923
|
}
|
|
6052
6924
|
if (findChild(el, "a:noFill")) result.type = "noFill";
|
|
6053
6925
|
if (findChild(el, "a:gradFill")) {
|
|
6054
6926
|
result.type = "gradFill";
|
|
6055
|
-
result.gradientFill = parse(gradientFillDesc, findChild(el, "a:gradFill"), _ctx);
|
|
6927
|
+
result.gradientFill = parse$1(gradientFillDesc, findChild(el, "a:gradFill"), _ctx);
|
|
6056
6928
|
}
|
|
6057
6929
|
const prstDash = findChild(el, "a:prstDash");
|
|
6058
6930
|
if (prstDash?.attributes?.["val"]) result.dash = String(prstDash.attributes["val"]);
|
|
@@ -6086,14 +6958,7 @@ const outlineDesc = {
|
|
|
6086
6958
|
*/
|
|
6087
6959
|
function stringifyEffectColor(color, ctx) {
|
|
6088
6960
|
if (!color) return void 0;
|
|
6089
|
-
return stringify$1(
|
|
6090
|
-
}
|
|
6091
|
-
function getColorDesc(color) {
|
|
6092
|
-
if ("hue" in color && "saturation" in color && "luminance" in color) {}
|
|
6093
|
-
if ("r" in color && "g" in color && "b" in color) {}
|
|
6094
|
-
const val = color.value;
|
|
6095
|
-
if (val && !/^[0-9a-fA-F]{6}$/.test(val)) return schemeColorDesc;
|
|
6096
|
-
return rgbColorDesc;
|
|
6961
|
+
return stringify$1(getColorDescriptor(color), color, ctx);
|
|
6097
6962
|
}
|
|
6098
6963
|
function stringifyColorEffect(tag, attrs, color, ctx) {
|
|
6099
6964
|
const attrParts = [];
|
|
@@ -6105,10 +6970,9 @@ function stringifyColorEffect(tag, attrs, color, ctx) {
|
|
|
6105
6970
|
return `<${tag}${attrStr}>${colorXml}</${tag}>`;
|
|
6106
6971
|
}
|
|
6107
6972
|
function readColorFromElement(el, ctx) {
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
}
|
|
6973
|
+
const color = parseColorChoice(el, ctx);
|
|
6974
|
+
if (!color || Object.keys(color).length === 0) return void 0;
|
|
6975
|
+
return color;
|
|
6112
6976
|
}
|
|
6113
6977
|
const effectListDesc = {
|
|
6114
6978
|
kind: "custom",
|
|
@@ -6370,22 +7234,22 @@ const presetGeometryDesc = {
|
|
|
6370
7234
|
if (el.attributes?.["prst"] !== void 0) result.preset = String(el.attributes["prst"]);
|
|
6371
7235
|
const avLst = findChild(el, "a:avLst");
|
|
6372
7236
|
if (avLst) {
|
|
6373
|
-
const guides = parse(adjustmentValuesDesc, avLst, ctx);
|
|
7237
|
+
const guides = parse$1(adjustmentValuesDesc, avLst, ctx);
|
|
6374
7238
|
if (guides.length > 0) result.adjustmentValues = guides;
|
|
6375
7239
|
}
|
|
6376
7240
|
return result;
|
|
6377
7241
|
}
|
|
6378
7242
|
};
|
|
6379
|
-
function
|
|
7243
|
+
function stringifyAdjustPoint(pt) {
|
|
6380
7244
|
return `<a:pt x="${escapeXml(pt.x)}" y="${escapeXml(pt.y)}"/>`;
|
|
6381
7245
|
}
|
|
6382
7246
|
function stringifyPathCommand(cmd) {
|
|
6383
7247
|
switch (cmd.command) {
|
|
6384
|
-
case "moveTo": return `<a:moveTo>${
|
|
6385
|
-
case "lineTo": return `<a:lnTo>${
|
|
7248
|
+
case "moveTo": return `<a:moveTo>${stringifyAdjustPoint(cmd.point)}</a:moveTo>`;
|
|
7249
|
+
case "lineTo": return `<a:lnTo>${stringifyAdjustPoint(cmd.point)}</a:lnTo>`;
|
|
6386
7250
|
case "arcTo": return `<a:arcTo wR="${escapeXml(cmd.widthRadius)}" hR="${escapeXml(cmd.heightRadius)}" stAng="${escapeXml(cmd.startAngle)}" swAng="${escapeXml(cmd.sweepAngle)}"/>`;
|
|
6387
|
-
case "quadBezTo": return `<a:quadBezTo>${cmd.points.map(
|
|
6388
|
-
case "cubicBezTo": return `<a:cubicBezTo>${cmd.points.map(
|
|
7251
|
+
case "quadBezTo": return `<a:quadBezTo>${cmd.points.map(stringifyAdjustPoint).join("")}</a:quadBezTo>`;
|
|
7252
|
+
case "cubicBezTo": return `<a:cubicBezTo>${cmd.points.map(stringifyAdjustPoint).join("")}</a:cubicBezTo>`;
|
|
6389
7253
|
case "close": return "<a:close/>";
|
|
6390
7254
|
}
|
|
6391
7255
|
}
|
|
@@ -6401,7 +7265,7 @@ function stringifyPath(path) {
|
|
|
6401
7265
|
if (!cmds && !attrStr) return "<a:path/>";
|
|
6402
7266
|
return `<a:path${attrStr}>${cmds}</a:path>`;
|
|
6403
7267
|
}
|
|
6404
|
-
function
|
|
7268
|
+
function readAdjustPoint(el) {
|
|
6405
7269
|
if (!el.attributes) return void 0;
|
|
6406
7270
|
const x = el.attributes["x"];
|
|
6407
7271
|
const y = el.attributes["y"];
|
|
@@ -6416,7 +7280,7 @@ function readPathCommand(tag, el) {
|
|
|
6416
7280
|
case "a:moveTo": {
|
|
6417
7281
|
const pt = el.elements?.find((c) => c.name === "a:pt");
|
|
6418
7282
|
if (!pt) return void 0;
|
|
6419
|
-
const point =
|
|
7283
|
+
const point = readAdjustPoint(pt);
|
|
6420
7284
|
if (!point) return void 0;
|
|
6421
7285
|
return {
|
|
6422
7286
|
command: "moveTo",
|
|
@@ -6426,7 +7290,7 @@ function readPathCommand(tag, el) {
|
|
|
6426
7290
|
case "a:lnTo": {
|
|
6427
7291
|
const pt = el.elements?.find((c) => c.name === "a:pt");
|
|
6428
7292
|
if (!pt) return void 0;
|
|
6429
|
-
const point =
|
|
7293
|
+
const point = readAdjustPoint(pt);
|
|
6430
7294
|
if (!point) return void 0;
|
|
6431
7295
|
return {
|
|
6432
7296
|
command: "lineTo",
|
|
@@ -6445,7 +7309,7 @@ function readPathCommand(tag, el) {
|
|
|
6445
7309
|
};
|
|
6446
7310
|
}
|
|
6447
7311
|
case "a:quadBezTo": {
|
|
6448
|
-
const points = (el.elements ?? []).filter((c) => c.name === "a:pt").map(
|
|
7312
|
+
const points = (el.elements ?? []).filter((c) => c.name === "a:pt").map(readAdjustPoint).filter((p) => p !== void 0);
|
|
6449
7313
|
if (points.length < 2) return void 0;
|
|
6450
7314
|
return {
|
|
6451
7315
|
command: "quadBezTo",
|
|
@@ -6453,7 +7317,7 @@ function readPathCommand(tag, el) {
|
|
|
6453
7317
|
};
|
|
6454
7318
|
}
|
|
6455
7319
|
case "a:cubicBezTo": {
|
|
6456
|
-
const points = (el.elements ?? []).filter((c) => c.name === "a:pt").map(
|
|
7320
|
+
const points = (el.elements ?? []).filter((c) => c.name === "a:pt").map(readAdjustPoint).filter((p) => p !== void 0);
|
|
6457
7321
|
if (points.length < 3) return void 0;
|
|
6458
7322
|
return {
|
|
6459
7323
|
command: "cubicBezTo",
|
|
@@ -6618,7 +7482,7 @@ const customGeometryDesc = {
|
|
|
6618
7482
|
const inner = opts.connectionSites.map(stringifyConnectionSite).join("");
|
|
6619
7483
|
parts.push(`<a:cxnLst>${inner}</a:cxnLst>`);
|
|
6620
7484
|
}
|
|
6621
|
-
if (opts.
|
|
7485
|
+
if (opts.textRectangle) parts.push(stringifyGeomRect(opts.textRectangle));
|
|
6622
7486
|
const pathsXml = opts.pathList.map(stringifyPath).join("");
|
|
6623
7487
|
parts.push(`<a:pathLst>${pathsXml}</a:pathLst>`);
|
|
6624
7488
|
return `<a:custGeom>${parts.join("")}</a:custGeom>`;
|
|
@@ -6658,8 +7522,8 @@ const customGeometryDesc = {
|
|
|
6658
7522
|
}
|
|
6659
7523
|
const rect = findChild(el, "a:rect");
|
|
6660
7524
|
if (rect) {
|
|
6661
|
-
const
|
|
6662
|
-
if (
|
|
7525
|
+
const textRectangle = readGeomRect(rect);
|
|
7526
|
+
if (textRectangle) result.textRectangle = textRectangle;
|
|
6663
7527
|
}
|
|
6664
7528
|
const pathLst = findChild(el, "a:pathLst");
|
|
6665
7529
|
if (pathLst?.elements) {
|
|
@@ -6823,18 +7687,18 @@ const shape3DDesc = {
|
|
|
6823
7687
|
if (el.attributes?.["contourW"] !== void 0) result.contourW = Number(el.attributes["contourW"]);
|
|
6824
7688
|
if (el.attributes?.["prstMaterial"] !== void 0) result.prstMaterial = xsdMaterialType.from(String(el.attributes["prstMaterial"]));
|
|
6825
7689
|
const bevelT = findChild(el, "a:bevelT");
|
|
6826
|
-
if (bevelT) result.bevelT = parse(bevelDesc, bevelT, ctx);
|
|
7690
|
+
if (bevelT) result.bevelT = parse$1(bevelDesc, bevelT, ctx);
|
|
6827
7691
|
const bevelB = findChild(el, "a:bevelB");
|
|
6828
|
-
if (bevelB) result.bevelB = parse(bevelDesc, bevelB, ctx);
|
|
7692
|
+
if (bevelB) result.bevelB = parse$1(bevelDesc, bevelB, ctx);
|
|
6829
7693
|
const extrusionClr = findChild(el, "a:extrusionClr");
|
|
6830
7694
|
if (extrusionClr) {
|
|
6831
7695
|
const solidFill = findChild(extrusionClr, "a:solidFill");
|
|
6832
|
-
if (solidFill) result.extrusionColor = parse(solidFillDesc, solidFill, ctx);
|
|
7696
|
+
if (solidFill) result.extrusionColor = parse$1(solidFillDesc, solidFill, ctx);
|
|
6833
7697
|
}
|
|
6834
7698
|
const contourClr = findChild(el, "a:contourClr");
|
|
6835
7699
|
if (contourClr) {
|
|
6836
7700
|
const solidFill = findChild(contourClr, "a:solidFill");
|
|
6837
|
-
if (solidFill) result.contourColor = parse(solidFillDesc, solidFill, ctx);
|
|
7701
|
+
if (solidFill) result.contourColor = parse$1(solidFillDesc, solidFill, ctx);
|
|
6838
7702
|
}
|
|
6839
7703
|
return result;
|
|
6840
7704
|
}
|
|
@@ -6901,9 +7765,9 @@ const scene3DDesc = {
|
|
|
6901
7765
|
parse(el, ctx) {
|
|
6902
7766
|
const result = {};
|
|
6903
7767
|
const camera = findChild(el, "a:camera");
|
|
6904
|
-
if (camera) result.camera = parse(cameraDesc, camera, ctx);
|
|
7768
|
+
if (camera) result.camera = parse$1(cameraDesc, camera, ctx);
|
|
6905
7769
|
const lightRig = findChild(el, "a:lightRig");
|
|
6906
|
-
if (lightRig) result.lightRig = parse(lightRigDesc, lightRig, ctx);
|
|
7770
|
+
if (lightRig) result.lightRig = parse$1(lightRigDesc, lightRig, ctx);
|
|
6907
7771
|
const backdrop = findChild(el, "a:backdrop");
|
|
6908
7772
|
if (backdrop) result.backdrop = readBackdrop(backdrop);
|
|
6909
7773
|
return result;
|
|
@@ -7030,23 +7894,23 @@ function stringifyBlipEffects(opts, ctx) {
|
|
|
7030
7894
|
if (opts.grayscale) parts.push("<a:grayscl/>");
|
|
7031
7895
|
if (opts.luminance) {
|
|
7032
7896
|
const attrParts = [];
|
|
7033
|
-
if (opts.luminance.bright !== void 0) attrParts.push(`bright="${opts.luminance.bright}
|
|
7034
|
-
if (opts.luminance.contrast !== void 0) attrParts.push(`contrast="${opts.luminance.contrast}
|
|
7897
|
+
if (opts.luminance.bright !== void 0) attrParts.push(`bright="${opts.luminance.bright}"`);
|
|
7898
|
+
if (opts.luminance.contrast !== void 0) attrParts.push(`contrast="${opts.luminance.contrast}"`);
|
|
7035
7899
|
const attrStr = attrParts.length ? " " + attrParts.join(" ") : "";
|
|
7036
7900
|
parts.push(`<a:lum${attrStr}/>`);
|
|
7037
7901
|
}
|
|
7038
7902
|
if (opts.hsl) {
|
|
7039
7903
|
const attrParts = [];
|
|
7040
7904
|
if (opts.hsl.hue !== void 0) attrParts.push(`hue="${opts.hsl.hue}"`);
|
|
7041
|
-
if (opts.hsl.saturation !== void 0) attrParts.push(`sat="${opts.hsl.saturation}
|
|
7042
|
-
if (opts.hsl.luminance !== void 0) attrParts.push(`lum="${opts.hsl.luminance}
|
|
7905
|
+
if (opts.hsl.saturation !== void 0) attrParts.push(`sat="${opts.hsl.saturation}"`);
|
|
7906
|
+
if (opts.hsl.luminance !== void 0) attrParts.push(`lum="${opts.hsl.luminance}"`);
|
|
7043
7907
|
const attrStr = attrParts.length ? " " + attrParts.join(" ") : "";
|
|
7044
7908
|
parts.push(`<a:hsl${attrStr}/>`);
|
|
7045
7909
|
}
|
|
7046
7910
|
if (opts.tint) {
|
|
7047
7911
|
const attrParts = [];
|
|
7048
7912
|
if (opts.tint.hue !== void 0) attrParts.push(`hue="${opts.tint.hue}"`);
|
|
7049
|
-
if (opts.tint.amount !== void 0) attrParts.push(`amt="${opts.tint.amount}
|
|
7913
|
+
if (opts.tint.amount !== void 0) attrParts.push(`amt="${opts.tint.amount}"`);
|
|
7050
7914
|
const attrStr = attrParts.length ? " " + attrParts.join(" ") : "";
|
|
7051
7915
|
parts.push(`<a:tint${attrStr}/>`);
|
|
7052
7916
|
}
|
|
@@ -7055,7 +7919,7 @@ function stringifyBlipEffects(opts, ctx) {
|
|
|
7055
7919
|
const c2 = stringify$1(solidFillDesc, opts.duotone.color2, ctx);
|
|
7056
7920
|
parts.push(`<a:duotone>${c1 ?? ""}${c2 ?? ""}</a:duotone>`);
|
|
7057
7921
|
}
|
|
7058
|
-
if (opts.biLevel) parts.push(`<a:biLevel thresh="${opts.biLevel.threshold}
|
|
7922
|
+
if (opts.biLevel) parts.push(`<a:biLevel thresh="${opts.biLevel.threshold}"/>`);
|
|
7059
7923
|
if (opts.alphaCeiling) parts.push("<a:alphaCeiling/>");
|
|
7060
7924
|
if (opts.alphaFloor) parts.push("<a:alphaFloor/>");
|
|
7061
7925
|
if (opts.alphaInverse !== void 0) if (typeof opts.alphaInverse === "boolean") parts.push("<a:alphaInv/>");
|
|
@@ -7065,10 +7929,10 @@ function stringifyBlipEffects(opts, ctx) {
|
|
|
7065
7929
|
}
|
|
7066
7930
|
if (opts.alphaModFix) {
|
|
7067
7931
|
const amt = opts.alphaModFix.amount ?? 100;
|
|
7068
|
-
parts.push(`<a:alphaModFix amt="${amt}
|
|
7932
|
+
parts.push(`<a:alphaModFix amt="${amt}"/>`);
|
|
7069
7933
|
}
|
|
7070
|
-
if (opts.alphaRepl) parts.push(`<a:alphaRepl a="${opts.alphaRepl.amount}
|
|
7071
|
-
if (opts.alphaBiLevel) parts.push(`<a:alphaBiLevel thresh="${opts.alphaBiLevel.threshold}
|
|
7934
|
+
if (opts.alphaRepl) parts.push(`<a:alphaRepl a="${opts.alphaRepl.amount}"/>`);
|
|
7935
|
+
if (opts.alphaBiLevel) parts.push(`<a:alphaBiLevel thresh="${opts.alphaBiLevel.threshold}"/>`);
|
|
7072
7936
|
if (opts.colorChange) {
|
|
7073
7937
|
const fromXml = stringify$1(solidFillDesc, opts.colorChange.from, ctx);
|
|
7074
7938
|
const toXml = stringify$1(solidFillDesc, opts.colorChange.to, ctx);
|
|
@@ -7122,7 +7986,7 @@ function readBlipEffects(el, ctx) {
|
|
|
7122
7986
|
const alphaInv = findChild(el, "a:alphaInv");
|
|
7123
7987
|
if (alphaInv) {
|
|
7124
7988
|
const solidFill = findChild(alphaInv, "a:solidFill");
|
|
7125
|
-
if (solidFill) result.alphaInverse = parse(solidFillDesc, solidFill, ctx);
|
|
7989
|
+
if (solidFill) result.alphaInverse = parse$1(solidFillDesc, solidFill, ctx);
|
|
7126
7990
|
else result.alphaInverse = {};
|
|
7127
7991
|
}
|
|
7128
7992
|
const alphaModFix = findChild(el, "a:alphaModFix");
|
|
@@ -7142,19 +8006,19 @@ function readBlipEffects(el, ctx) {
|
|
|
7142
8006
|
const clrFrom = findChild(clrChange, "a:clrFrom");
|
|
7143
8007
|
if (clrFrom) {
|
|
7144
8008
|
const fromFill = findChild(clrFrom, "a:solidFill");
|
|
7145
|
-
if (fromFill) opts.from = parse(solidFillDesc, fromFill, ctx);
|
|
8009
|
+
if (fromFill) opts.from = parse$1(solidFillDesc, fromFill, ctx);
|
|
7146
8010
|
}
|
|
7147
8011
|
const clrTo = findChild(clrChange, "a:clrTo");
|
|
7148
8012
|
if (clrTo) {
|
|
7149
8013
|
const toFill = findChild(clrTo, "a:solidFill");
|
|
7150
|
-
if (toFill) opts.to = parse(solidFillDesc, toFill, ctx);
|
|
8014
|
+
if (toFill) opts.to = parse$1(solidFillDesc, toFill, ctx);
|
|
7151
8015
|
}
|
|
7152
8016
|
result.colorChange = opts;
|
|
7153
8017
|
}
|
|
7154
8018
|
const clrRepl = findChild(el, "a:clrRepl");
|
|
7155
8019
|
if (clrRepl) {
|
|
7156
8020
|
const solidFill = findChild(clrRepl, "a:solidFill");
|
|
7157
|
-
if (solidFill) result.colorRepl = { color: parse(solidFillDesc, solidFill, ctx) };
|
|
8021
|
+
if (solidFill) result.colorRepl = { color: parse$1(solidFillDesc, solidFill, ctx) };
|
|
7158
8022
|
}
|
|
7159
8023
|
const blur = findChild(el, "a:blur");
|
|
7160
8024
|
if (blur) {
|
|
@@ -7168,7 +8032,7 @@ function readBlipEffects(el, ctx) {
|
|
|
7168
8032
|
const fills = [];
|
|
7169
8033
|
for (const child of duotone.elements) {
|
|
7170
8034
|
const sf = findChild(child, "a:solidFill");
|
|
7171
|
-
if (sf) fills.push(parse(solidFillDesc, sf, ctx));
|
|
8035
|
+
if (sf) fills.push(parse$1(solidFillDesc, sf, ctx));
|
|
7172
8036
|
}
|
|
7173
8037
|
if (fills.length >= 2) result.duotone = {
|
|
7174
8038
|
color1: fills[0],
|
|
@@ -7217,8 +8081,8 @@ const blipFillDesc = {
|
|
|
7217
8081
|
}, ctx);
|
|
7218
8082
|
if (blipXml) parts.push(blipXml);
|
|
7219
8083
|
}
|
|
7220
|
-
if (opts.
|
|
7221
|
-
const srcRectXml = stringify$1(sourceRectangleDesc, opts.
|
|
8084
|
+
if (opts.sourceRectangle) {
|
|
8085
|
+
const srcRectXml = stringify$1(sourceRectangleDesc, opts.sourceRectangle, ctx);
|
|
7222
8086
|
if (srcRectXml) parts.push(srcRectXml);
|
|
7223
8087
|
}
|
|
7224
8088
|
if (opts.tile) {
|
|
@@ -7236,14 +8100,14 @@ const blipFillDesc = {
|
|
|
7236
8100
|
if (el.attributes?.["rotWithShape"] !== void 0) result.rotWithShape = el.attributes["rotWithShape"] !== "0";
|
|
7237
8101
|
const blip = findChild(el, "a:blip");
|
|
7238
8102
|
if (blip) {
|
|
7239
|
-
const blipResult = parse(blipDesc, blip, ctx);
|
|
8103
|
+
const blipResult = parse$1(blipDesc, blip, ctx);
|
|
7240
8104
|
if (blipResult.referenceId) result.referenceId = blipResult.referenceId;
|
|
7241
8105
|
if (blipResult.blipEffects) result.blipEffects = blipResult.blipEffects;
|
|
7242
8106
|
}
|
|
7243
8107
|
const srcRect = findChild(el, "a:srcRect");
|
|
7244
|
-
if (srcRect) result.
|
|
8108
|
+
if (srcRect) result.sourceRectangle = parse$1(sourceRectangleDesc, srcRect, ctx);
|
|
7245
8109
|
const tile = findChild(el, "a:tile");
|
|
7246
|
-
if (tile) result.tile = parse(tileDesc, tile, ctx);
|
|
8110
|
+
if (tile) result.tile = parse$1(tileDesc, tile, ctx);
|
|
7247
8111
|
return result;
|
|
7248
8112
|
}
|
|
7249
8113
|
};
|
|
@@ -7254,7 +8118,7 @@ const blipFillDesc = {
|
|
|
7254
8118
|
*
|
|
7255
8119
|
* @module
|
|
7256
8120
|
*/
|
|
7257
|
-
const
|
|
8121
|
+
const diagramRelationshipIdsDesc = {
|
|
7258
8122
|
kind: "custom",
|
|
7259
8123
|
stringify(opts, _ctx) {
|
|
7260
8124
|
return `<dgm:relIds r:dm="${escapeXml(opts.dm)}" r:lo="${escapeXml(opts.lo)}" r:qs="${escapeXml(opts.qs)}" r:cs="${escapeXml(opts.cs)}"/>`;
|
|
@@ -7273,30 +8137,30 @@ const diagramRelIdsDesc = {
|
|
|
7273
8137
|
const diagramStyleDesc = {
|
|
7274
8138
|
kind: "custom",
|
|
7275
8139
|
stringify(opts, _ctx) {
|
|
7276
|
-
return `<dgm:style><a:lnRef idx="${opts.
|
|
8140
|
+
return `<dgm:style><a:lnRef idx="${opts.lineReference?.idx ?? 1}"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="${opts.fillReference?.idx ?? 1}"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="${opts.effectReference?.idx ?? 0}"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="${escapeXml(opts.fontReference?.idx ?? "minor")}"><a:schemeClr val="tx1"/></a:fontRef></dgm:style>`;
|
|
7277
8141
|
},
|
|
7278
8142
|
parse(el, _ctx) {
|
|
7279
8143
|
const result = {};
|
|
7280
8144
|
const lnRef = findChild(el, "a:lnRef");
|
|
7281
|
-
if (lnRef?.attributes?.["idx"] !== void 0) result.
|
|
8145
|
+
if (lnRef?.attributes?.["idx"] !== void 0) result.lineReference = { idx: Number(lnRef.attributes["idx"]) };
|
|
7282
8146
|
const fillRef = findChild(el, "a:fillRef");
|
|
7283
|
-
if (fillRef?.attributes?.["idx"] !== void 0) result.
|
|
8147
|
+
if (fillRef?.attributes?.["idx"] !== void 0) result.fillReference = { idx: Number(fillRef.attributes["idx"]) };
|
|
7284
8148
|
const effectRef = findChild(el, "a:effectRef");
|
|
7285
|
-
if (effectRef?.attributes?.["idx"] !== void 0) result.
|
|
8149
|
+
if (effectRef?.attributes?.["idx"] !== void 0) result.effectReference = { idx: Number(effectRef.attributes["idx"]) };
|
|
7286
8150
|
const fontRef = findChild(el, "a:fontRef");
|
|
7287
|
-
if (fontRef?.attributes?.["idx"] !== void 0) result.
|
|
8151
|
+
if (fontRef?.attributes?.["idx"] !== void 0) result.fontReference = { idx: String(fontRef.attributes["idx"]) };
|
|
7288
8152
|
return result;
|
|
7289
8153
|
}
|
|
7290
8154
|
};
|
|
7291
|
-
const
|
|
8155
|
+
const presentationLayoutVariablesDesc = {
|
|
7292
8156
|
kind: "custom",
|
|
7293
8157
|
stringify(opts, _ctx) {
|
|
7294
8158
|
const parts = [];
|
|
7295
8159
|
if (opts.orgChart?.val !== void 0) parts.push(`<dgm:orgChart val="${opts.orgChart.val ? 1 : 0}"/>`);
|
|
7296
|
-
if (opts.
|
|
7297
|
-
if (opts.
|
|
7298
|
-
if (opts.
|
|
7299
|
-
if (opts.
|
|
8160
|
+
if (opts.maxChildren?.val !== void 0) parts.push(`<dgm:chMax val="${opts.maxChildren.val}"/>`);
|
|
8161
|
+
if (opts.preferredChildren?.val !== void 0) parts.push(`<dgm:chPref val="${opts.preferredChildren.val}"/>`);
|
|
8162
|
+
if (opts.animateOneByOne?.val !== void 0) parts.push(`<dgm:animOne val="${escapeXml(opts.animateOneByOne.val)}"/>`);
|
|
8163
|
+
if (opts.animationLevel?.val !== void 0) parts.push(`<dgm:animLvl val="${escapeXml(opts.animationLevel.val)}"/>`);
|
|
7300
8164
|
if (opts.hierBranch?.val !== void 0) parts.push(`<dgm:hierBranch val="${escapeXml(opts.hierBranch.val)}"/>`);
|
|
7301
8165
|
if (parts.length === 0) return `<dgm:presLayoutVars/>`;
|
|
7302
8166
|
return `<dgm:presLayoutVars>${parts.join("")}</dgm:presLayoutVars>`;
|
|
@@ -7306,19 +8170,19 @@ const presLayoutVarsDesc = {
|
|
|
7306
8170
|
const orgChart = findChild(el, "dgm:orgChart");
|
|
7307
8171
|
if (orgChart?.attributes?.["val"] !== void 0) result.orgChart = { val: orgChart.attributes["val"] === 1 || orgChart.attributes["val"] === "1" };
|
|
7308
8172
|
const chMax = findChild(el, "dgm:chMax");
|
|
7309
|
-
if (chMax?.attributes?.["val"] !== void 0) result.
|
|
8173
|
+
if (chMax?.attributes?.["val"] !== void 0) result.maxChildren = { val: Number(chMax.attributes["val"]) };
|
|
7310
8174
|
const chPref = findChild(el, "dgm:chPref");
|
|
7311
|
-
if (chPref?.attributes?.["val"] !== void 0) result.
|
|
8175
|
+
if (chPref?.attributes?.["val"] !== void 0) result.preferredChildren = { val: Number(chPref.attributes["val"]) };
|
|
7312
8176
|
const animOne = findChild(el, "dgm:animOne");
|
|
7313
|
-
if (animOne?.attributes?.["val"] !== void 0) result.
|
|
8177
|
+
if (animOne?.attributes?.["val"] !== void 0) result.animateOneByOne = { val: String(animOne.attributes["val"]) };
|
|
7314
8178
|
const animLvl = findChild(el, "dgm:animLvl");
|
|
7315
|
-
if (animLvl?.attributes?.["val"] !== void 0) result.
|
|
8179
|
+
if (animLvl?.attributes?.["val"] !== void 0) result.animationLevel = { val: String(animLvl.attributes["val"]) };
|
|
7316
8180
|
const hierBranch = findChild(el, "dgm:hierBranch");
|
|
7317
8181
|
if (hierBranch?.attributes?.["val"] !== void 0) result.hierBranch = { val: String(hierBranch.attributes["val"]) };
|
|
7318
8182
|
return result;
|
|
7319
8183
|
}
|
|
7320
8184
|
};
|
|
7321
|
-
const
|
|
8185
|
+
const diagramExtensionListDesc = {
|
|
7322
8186
|
kind: "custom",
|
|
7323
8187
|
stringify(opts, _ctx) {
|
|
7324
8188
|
if (!opts.extensions?.length) return void 0;
|
|
@@ -7335,6 +8199,11 @@ const diagramExtLstDesc = {
|
|
|
7335
8199
|
};
|
|
7336
8200
|
//#endregion
|
|
7337
8201
|
//#region src/util/compile.ts
|
|
8202
|
+
/**
|
|
8203
|
+
* Shared compiler utilities for OOXML document generation.
|
|
8204
|
+
*
|
|
8205
|
+
* @module
|
|
8206
|
+
*/
|
|
7338
8207
|
/** Reusable TextEncoder instance (stateless, safe to share). */
|
|
7339
8208
|
const encoder = new TextEncoder();
|
|
7340
8209
|
/**
|
|
@@ -7346,7 +8215,7 @@ function compileMapping(mapping, overrides, media, mediaLevel = 0) {
|
|
|
7346
8215
|
const files = {};
|
|
7347
8216
|
for (const entry of Object.values(mapping)) files[entry.path] = encoder.encode(entry.data);
|
|
7348
8217
|
if (overrides) for (const o of overrides) files[o.path] = typeof o.data === "string" ? encoder.encode(o.data) : o.data;
|
|
7349
|
-
if (media) for (const m of media) files[m.path] = [m.data, { level: mediaLevel }];
|
|
8218
|
+
if (media) for (const m of media) files[m.path] = [m.data, { level: levelForMediaName(m.path, mediaLevel) }];
|
|
7350
8219
|
return files;
|
|
7351
8220
|
}
|
|
7352
8221
|
//#endregion
|
|
@@ -7483,22 +8352,19 @@ function findAndReplaceImagePlaceholders(xml, mediaArray, offset, idFormat = "rI
|
|
|
7483
8352
|
xml,
|
|
7484
8353
|
referenced: []
|
|
7485
8354
|
};
|
|
7486
|
-
const
|
|
7487
|
-
for (let i = 0; i < mediaArray.length; i++)
|
|
7488
|
-
idx: i,
|
|
7489
|
-
item: mediaArray[i]
|
|
7490
|
-
});
|
|
8355
|
+
const itemMap = /* @__PURE__ */ new Map();
|
|
8356
|
+
for (let i = 0; i < mediaArray.length; i++) itemMap.set(mediaArray[i].fileName, mediaArray[i]);
|
|
7491
8357
|
const referenced = [];
|
|
7492
8358
|
const replaceMap = /* @__PURE__ */ new Map();
|
|
7493
8359
|
const parts = [];
|
|
7494
8360
|
let last = 0;
|
|
7495
8361
|
for (const m of xml.matchAll(PLACEHOLDER_RE)) {
|
|
7496
8362
|
const key = m[1];
|
|
7497
|
-
const
|
|
7498
|
-
if (
|
|
8363
|
+
const item = itemMap.get(key);
|
|
8364
|
+
if (item !== void 0) {
|
|
7499
8365
|
if (!replaceMap.has(key)) {
|
|
7500
|
-
replaceMap.set(key, formatId(offset,
|
|
7501
|
-
referenced.push(
|
|
8366
|
+
replaceMap.set(key, formatId(offset, referenced.length, idFormat));
|
|
8367
|
+
referenced.push(item);
|
|
7502
8368
|
}
|
|
7503
8369
|
parts.push(xml.substring(last, m.index), replaceMap.get(key));
|
|
7504
8370
|
last = m.index + m[0].length;
|
|
@@ -7613,4 +8479,4 @@ function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
|
|
|
7613
8479
|
return replacePlaceholders(xml, map);
|
|
7614
8480
|
}
|
|
7615
8481
|
//#endregion
|
|
7616
|
-
export { solidFillDesc as $, createTileInfo as $n,
|
|
8482
|
+
export { solidFillDesc as $, createTileInfo as $n, toUint8Array as $r, convertToTwip as $t, bevelDesc as A, createFillOverlayEffect as An, createScRgbColor as Ar, createHierBranch as At, shapeLockingDesc as B, createLineEnd as Bn, XLSX_PARTS as Br, createTableStyleList as Bt, diagramStyleDesc as C, PresetShadowVal as Cn, uniqueUuid as Cr, AnimateOneByOneValue as Ct, sourceRectangleDesc as D, createInnerShadowEffect as Dn, createSystemColor as Dr, createAdjustList as Dt, blipFillDesc as E, createOuterShadowEffect as En, SystemColor as Er, createAdjust as Et, customGeometryDesc as F, PresetDash as Fn, createColorTransforms as Fr, createGraphicFrameLocking as Ft, patternFillDesc as G, extractBlipFillMedia as Gn, ZIP_DEFLATE_LEVEL as Gr, convertEmuToPoints as Gt, outlineDesc as H, createGroupFill as Hn, validateOpcConsistency as Hr, createTransformation as Ht, presetGeometryDesc as I, createOutline as In, buildContentTypeOverrides as Ir, createGroupLocking as It, parseColorChoice as J, PathShadeType as Jn, createZipStream as Jr, convertMillimetersToTwip as Jt, getColorDescriptor as K, PresetPattern as Kn, ZIP_STORED_LEVEL as Kr, convertInchesToEmu as Kt, graphicFrameLockingDesc as L, LineEndLength as Ln, DOCX_PARTS as Lr, createPictureLocking as Lt, shape3DDesc as M, LineCap as Mn, PresetColor as Mr, createOrgChart as Mt, groupTransform2DDesc as N, LineJoin as Nn, createPresetColor as Nr, createPreferredChildren as Nt, stretchDesc as O, createGlowEffect as On, SchemeColor as Or, createAnimateOneByOne as Ot, transform2DDesc as P, PenAlignment as Pn, createHslColor as Pr, createPresentationLayoutVariables as Pt, schemeColorDesc as Q, TileAlignment as Qn, strFromU8$1 as Qr, convertToEmu as Qt, groupLockingDesc as R, LineEndType as Rn, PART_REGISTRIES as Rr, createShapeLocking as Rt, diagramRelationshipIdsDesc as S, createReflectionEffect as Sn, uniqueNumericIdCreator as Sr, createStyleDefinitionHeaderList as St, blipDesc as T, RectAlignment as Tn, createSolidFill as Tr, HierBranchStyle as Tt, fillDesc as U, createNoFill as Un, ParsedArchive as Ur, convertEmuToInches as Ut, effectListDesc as V, createCustomDash as Vn, summarizeOpcIssues as Vr, parseTableStyleList as Vt, gradientFillDesc as W, buildFill as Wn, parseArchive as Wr, convertEmuToPixels as Wt, rgbColorDesc as X, createGradientFill as Xn, isBase64DataURL as Xr, convertPointsToEmu as Xt, presetColorDesc as Y, TileFlipMode as Yn, decodeBase64 as Yr, convertPixelsToEmu as Yt, scRgbColorDesc as Z, createGradientStop as Zn, levelForMediaName as Zr, convertPositionToEmu as Zt, derivePasswordHash as _, createScene3D as _n, xsdVerticalMergeRev as _r, createColorsDefinitionHeader as _t, getMediaRefs as a, buildCorePropertiesXml as ai, stringifyStretch as an, xsdLineEndSize as ar, ColorMethod as at, compileMapping as b, createEffectList as bn, hashedId as br, createLayoutDefinitionHeaderList as bt, hasPlaceholders as c, createDefault as ci, createExtentionList as cn, xsdPattern as cr, StyleMatrixIndex as ct, replaceHyperlinkPlaceholders as d, TargetModeType as di, stringifyAdjustmentValues as dn, xsdRectAlignment as dr, createFillColorList as dt, unzipSync$1 as ei, convertUniversalMeasureToEmu as en, invertMap as er, systemColorDesc as et, replaceImagePlaceholders as f, APP_PROPS_XML as fi, PresetMaterialType as fn, xsdStrikeStyle as fr, createLineColorList as ft, replaceVideoPlaceholders as g, createBottomBevel as gn, xsdUnderlineStyle as gr, createTextLineColorList as gt, replaceSmartArtPlaceholders as h, createBevel as hn, xsdTextCaps as hr, createTextFillColorList as ht, formatId as i, convertOutput as ii, createTransform2D as in, xsdLineCap as ir, createDiagramRelationshipIds as it, scene3DDesc as j, CompoundLine as jn, createRgbColor as jr, createMaxChildren as jt, tileDesc as k, BlendMode as kn, createSchemeColor as kr, createAnimationLevel as kt, replaceAllPlaceholders as l, createOverride as li, createCustomGeometry as ln, xsdPenAlignment as lr, createDiagramStyle as lt, replaceNumberingPlaceholders as m, BevelPresetType as mn, xsdTextAnchor as mr, createTextEffectColorList as mt, collectPlaceholderKeys as n, zipSyncAndConvert as ni, parseUniversalMeasure as nn, xsdCompoundLine as nr, createDiagramShape3D as nt, getReferencedMedia as o, buildCorePropertiesXmlString as oi, createBlipFill as on, xsdMaterialType as or, FontCollectionIndex as ot, replaceMediaPlaceholders as p, createShape3D as pn, xsdTextAlign as pr, createStyleLabel as pt, hslColorDesc as q, createPatternFill as qn, createPacker as qr, convertInchesToTwip as qt, findAndReplaceImagePlaceholders as r, OoxmlMimeType as ri, createGroupTransform2D as rn, xsdEffectContainer as rr, createDiagramTextProperties as rt, getVideoRefs as s, parseCorePropsElement as si, createBlip as sn, xsdPathFillMode as sr, HueDirection as st, addSmartArtRelationships as t, zipAndConvert as ti, convertUniversalMeasureToTwip as tn, xsdBlendMode as tr, createDiagramExtensionList as tt, replaceChartPlaceholders as u, Relationships as ui, stringifyPresetGeometry as un, xsdPresetShadow as ur, createEffectColorList as ut, hashPasswordAgile as v, createEffectDag as vn, createSourceRectangle as vr, createColorsDefinitionHeaderList as vt, presentationLayoutVariablesDesc as w, createPresetShadowEffect as wn, createColorElement as wr, AnimationLevelValue as wt, diagramExtensionListDesc as x, createSoftEdgeEffect as xn, uniqueId as xr, createStyleDefinitionHeader as xt, randomBytes as y, calculateEffectExtent as yn, createBlipEffects as yr, createLayoutDefinitionHeader as yt, pictureLockingDesc as z, LineEndWidth as zn, PPTX_PARTS as zr, createTableStyle as zt };
|