@office-open/core 0.9.7 → 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-CDYC3mxJ.d.mts → index-CeVhA1an.d.mts} +871 -262
- 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-DlZssiRY.mjs → src-CSka9ln4.mjs} +985 -145
- 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");
|
|
@@ -1921,6 +1943,824 @@ function parseArchive(data) {
|
|
|
1921
1943
|
return new ParsedArchive(data);
|
|
1922
1944
|
}
|
|
1923
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
|
|
1924
2764
|
//#region src/drawingml/color/color-transform.ts
|
|
1925
2765
|
/**
|
|
1926
2766
|
* Creates color transform child elements as XML strings.
|
|
@@ -3001,7 +3841,7 @@ const createShadeElement = (shade) => {
|
|
|
3001
3841
|
});
|
|
3002
3842
|
const pathShade = shade;
|
|
3003
3843
|
const children = [];
|
|
3004
|
-
if (pathShade.
|
|
3844
|
+
if (pathShade.fillToRectangle) children.push(createRelativeRect("a:fillToRect", pathShade.fillToRectangle));
|
|
3005
3845
|
return element("a:path", { path: pathShade.path }, children);
|
|
3006
3846
|
};
|
|
3007
3847
|
/**
|
|
@@ -3035,7 +3875,7 @@ const createGradientFill = (options) => {
|
|
|
3035
3875
|
const stopElements = options.stops.map(createGradientStop);
|
|
3036
3876
|
children.push(element("a:gsLst", void 0, stopElements));
|
|
3037
3877
|
if (options.shade) children.push(createShadeElement(options.shade));
|
|
3038
|
-
if (options.
|
|
3878
|
+
if (options.tileRectangle) children.push(createRelativeRect("a:tileRect", options.tileRectangle));
|
|
3039
3879
|
return element("a:gradFill", {
|
|
3040
3880
|
flip: options.flip,
|
|
3041
3881
|
rotWithShape: options.rotateWithShape
|
|
@@ -3222,21 +4062,23 @@ const createPatternFill = (options) => {
|
|
|
3222
4062
|
function normalizeColor(color) {
|
|
3223
4063
|
return typeof color === "string" ? { value: color.replace("#", "") } : color;
|
|
3224
4064
|
}
|
|
3225
|
-
function toUint8Array(data) {
|
|
3226
|
-
return data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
3227
|
-
}
|
|
3228
4065
|
/**
|
|
3229
4066
|
* Extracts media data from a blip fill option, if present.
|
|
3230
4067
|
* Returns undefined for non-blip fills.
|
|
3231
4068
|
*
|
|
3232
4069
|
* The returned data should be registered with the document's media store
|
|
3233
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.
|
|
3234
4076
|
*/
|
|
3235
|
-
const extractBlipFillMedia = (fill) => {
|
|
4077
|
+
const extractBlipFillMedia = (fill, nameAllocator) => {
|
|
3236
4078
|
if (typeof fill === "string" || fill.type !== "blip") return void 0;
|
|
3237
4079
|
return {
|
|
3238
4080
|
data: toUint8Array(fill.data),
|
|
3239
|
-
fileName: `${uniqueId()}.${fill.imageType}`,
|
|
4081
|
+
fileName: nameAllocator ? nameAllocator(fill.imageType) : `${uniqueId()}.${fill.imageType}`,
|
|
3240
4082
|
type: fill.imageType
|
|
3241
4083
|
};
|
|
3242
4084
|
};
|
|
@@ -3268,7 +4110,7 @@ const buildFill = (options) => {
|
|
|
3268
4110
|
const children = [element("a:blip", {
|
|
3269
4111
|
cstate: "none",
|
|
3270
4112
|
"r:embed": `{${fileName}}`
|
|
3271
|
-
}, blipChildren.length > 0 ? blipChildren : void 0), createSourceRectangle(options.
|
|
4113
|
+
}, blipChildren.length > 0 ? blipChildren : void 0), createSourceRectangle(options.sourceRectangle)];
|
|
3272
4114
|
if (options.tile) children.push(createTileInfo(options.tile));
|
|
3273
4115
|
else children.push("<a:stretch><a:fillRect/></a:stretch>");
|
|
3274
4116
|
const attrs = {};
|
|
@@ -4477,11 +5319,11 @@ function stringifyPresetGeometry(options) {
|
|
|
4477
5319
|
const createGuideList = (name, guides) => {
|
|
4478
5320
|
return element(name, void 0, guides.map((guide) => `<a:gd name="${guide.name}" fmla="${guide.formula}"/>`));
|
|
4479
5321
|
};
|
|
4480
|
-
const
|
|
5322
|
+
const createAdjustPoint = (name, point) => element(name, void 0, [`<a:pt x="${point.x}" y="${point.y}"/>`]);
|
|
4481
5323
|
const createPathCommand = (cmd) => {
|
|
4482
5324
|
switch (cmd.command) {
|
|
4483
|
-
case "moveTo": return
|
|
4484
|
-
case "lineTo": return
|
|
5325
|
+
case "moveTo": return createAdjustPoint("a:moveTo", cmd.point);
|
|
5326
|
+
case "lineTo": return createAdjustPoint("a:lnTo", cmd.point);
|
|
4485
5327
|
case "arcTo": return `<a:arcTo wR="${cmd.widthRadius}" hR="${cmd.heightRadius}" stAng="${cmd.startAngle}" swAng="${cmd.sweepAngle}"/>`;
|
|
4486
5328
|
case "quadBezTo": return element("a:quadBezTo", void 0, cmd.points.map((pt) => `<a:pt x="${pt.x}" y="${pt.y}"/>`));
|
|
4487
5329
|
case "cubicBezTo": return element("a:cubicBezTo", void 0, cmd.points.map((pt) => `<a:pt x="${pt.x}" y="${pt.y}"/>`));
|
|
@@ -4536,7 +5378,7 @@ const createGeomRect = (rect) => `<a:rect l="${rect.left}" t="${rect.top}" r="${
|
|
|
4536
5378
|
* { command: "close" },
|
|
4537
5379
|
* ],
|
|
4538
5380
|
* }],
|
|
4539
|
-
*
|
|
5381
|
+
* textRectangle: { left: "2000000", top: "2000000", right: "8000000", bottom: "8000000" },
|
|
4540
5382
|
* });
|
|
4541
5383
|
* ```
|
|
4542
5384
|
*/
|
|
@@ -4546,7 +5388,7 @@ const createCustomGeometry = (options) => {
|
|
|
4546
5388
|
if (options.guides) children.push(createGuideList("a:gdLst", options.guides));
|
|
4547
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))));
|
|
4548
5390
|
if (options.connectionSites && options.connectionSites.length > 0) children.push(element("a:cxnLst", void 0, options.connectionSites.map(createConnectionSite)));
|
|
4549
|
-
if (options.
|
|
5391
|
+
if (options.textRectangle) children.push(createGeomRect(options.textRectangle));
|
|
4550
5392
|
children.push(element("a:pathLst", void 0, options.pathList.map(createPath)));
|
|
4551
5393
|
return element("a:custGeom", void 0, children);
|
|
4552
5394
|
};
|
|
@@ -4708,7 +5550,7 @@ const createBlip = (options, blipEffects) => {
|
|
|
4708
5550
|
const createBlipFill = (blipOptions, fillOptions) => {
|
|
4709
5551
|
const children = [];
|
|
4710
5552
|
children.push(createBlip(blipOptions, fillOptions?.blipEffects));
|
|
4711
|
-
children.push(createSourceRectangle(fillOptions?.
|
|
5553
|
+
children.push(createSourceRectangle(fillOptions?.sourceRectangle));
|
|
4712
5554
|
if (fillOptions?.tile) children.push(createTileInfo(fillOptions.tile));
|
|
4713
5555
|
else children.push("<a:stretch><a:fillRect/></a:stretch>");
|
|
4714
5556
|
const attrs = {};
|
|
@@ -5015,10 +5857,10 @@ function createStyleMatrixRef(elementName, opts) {
|
|
|
5015
5857
|
}
|
|
5016
5858
|
/** Create border line element (a:ln with color) or a:lnRef */
|
|
5017
5859
|
function createThemeableLine(opts) {
|
|
5018
|
-
if (opts.
|
|
5860
|
+
if (opts.lineReference !== void 0) {
|
|
5019
5861
|
const children = [];
|
|
5020
5862
|
if (opts.color) children.push(toStr(opts.color));
|
|
5021
|
-
return element("a:lnRef", { idx: String(opts.
|
|
5863
|
+
return element("a:lnRef", { idx: String(opts.lineReference.idx) }, children.length > 0 ? children : void 0);
|
|
5022
5864
|
}
|
|
5023
5865
|
const children = [];
|
|
5024
5866
|
if (opts.color) children.push(toStr(opts.color));
|
|
@@ -5046,7 +5888,7 @@ function buildCellBorders(opts) {
|
|
|
5046
5888
|
}
|
|
5047
5889
|
function buildTextStyle(opts) {
|
|
5048
5890
|
const children = [];
|
|
5049
|
-
if (opts.
|
|
5891
|
+
if (opts.fontReference) children.push(createStyleMatrixRef("fontRef", opts.fontReference));
|
|
5050
5892
|
if (opts.color) children.push(toStr(opts.color));
|
|
5051
5893
|
const attrs = {};
|
|
5052
5894
|
if (opts.bold && opts.bold !== "def") attrs.b = onOffAttr(opts.bold);
|
|
@@ -5056,7 +5898,7 @@ function buildTextStyle(opts) {
|
|
|
5056
5898
|
function buildCellStyle(opts) {
|
|
5057
5899
|
const children = [];
|
|
5058
5900
|
if (opts.borders) children.push(buildCellBorders(opts.borders));
|
|
5059
|
-
if (opts.
|
|
5901
|
+
if (opts.fillReference) children.push(createStyleMatrixRef("fillRef", opts.fillReference));
|
|
5060
5902
|
else if (opts.fill) children.push(toStr(opts.fill));
|
|
5061
5903
|
return element("a:tcStyle", void 0, children);
|
|
5062
5904
|
}
|
|
@@ -5185,7 +6027,7 @@ function parseTableTextStyle(el) {
|
|
|
5185
6027
|
const i = attr(el, "i");
|
|
5186
6028
|
if (i === "on" || i === "off") opts.italic = i;
|
|
5187
6029
|
const fontRefEl = findChild(el, "a:fontRef");
|
|
5188
|
-
if (fontRefEl) opts.
|
|
6030
|
+
if (fontRefEl) opts.fontReference = parseStyleMatrixRef(fontRefEl);
|
|
5189
6031
|
for (const child of el.elements ?? []) {
|
|
5190
6032
|
if (child.name === "a:fontRef") continue;
|
|
5191
6033
|
opts.color = serializeChild(child);
|
|
@@ -5201,7 +6043,7 @@ function parseTableCellStyle(el) {
|
|
|
5201
6043
|
if (borders) opts.borders = borders;
|
|
5202
6044
|
}
|
|
5203
6045
|
const fillRefEl = findChild(el, "a:fillRef");
|
|
5204
|
-
if (fillRefEl) opts.
|
|
6046
|
+
if (fillRefEl) opts.fillReference = parseStyleMatrixRef(fillRefEl);
|
|
5205
6047
|
else for (const child of el.elements ?? []) {
|
|
5206
6048
|
if (child.name === "a:tcBdr") continue;
|
|
5207
6049
|
opts.fill = serializeChild(child);
|
|
@@ -5225,7 +6067,7 @@ function parseThemeableLine(el) {
|
|
|
5225
6067
|
const opts = {};
|
|
5226
6068
|
if (el.name === "a:lnRef") {
|
|
5227
6069
|
const idx = attrNum(el, "idx");
|
|
5228
|
-
if (idx !== void 0) opts.
|
|
6070
|
+
if (idx !== void 0) opts.lineReference = { idx };
|
|
5229
6071
|
} else {
|
|
5230
6072
|
const w = attrNum(el, "w");
|
|
5231
6073
|
if (w !== void 0) opts.width = w;
|
|
@@ -5283,25 +6125,25 @@ function createGraphicFrameLocking(opts) {
|
|
|
5283
6125
|
* @module
|
|
5284
6126
|
*/
|
|
5285
6127
|
/** Creates a dgm:adj element. */
|
|
5286
|
-
const
|
|
5287
|
-
const
|
|
6128
|
+
const createAdjust = (options) => `<dgm:adj idx="${options.idx}" val="${options.val}"/>`;
|
|
6129
|
+
const AnimationLevelValue = {
|
|
5288
6130
|
NONE: "none",
|
|
5289
6131
|
LEVEL: "lvl",
|
|
5290
6132
|
CENTER: "ctr"
|
|
5291
6133
|
};
|
|
5292
6134
|
/** Creates a dgm:animLvl element. */
|
|
5293
|
-
const
|
|
5294
|
-
const
|
|
6135
|
+
const createAnimationLevel = (options) => options?.val !== void 0 ? `<dgm:animLvl val="${options.val}"/>` : "<dgm:animLvl/>";
|
|
6136
|
+
const AnimateOneByOneValue = {
|
|
5295
6137
|
NONE: "none",
|
|
5296
6138
|
ONE: "one",
|
|
5297
6139
|
BRANCH: "branch"
|
|
5298
6140
|
};
|
|
5299
6141
|
/** Creates a dgm:animOne element. */
|
|
5300
|
-
const
|
|
6142
|
+
const createAnimateOneByOne = (options) => options?.val !== void 0 ? `<dgm:animOne val="${options.val}"/>` : "<dgm:animOne/>";
|
|
5301
6143
|
/** Creates a dgm:chMax element. */
|
|
5302
|
-
const
|
|
6144
|
+
const createMaxChildren = (options) => options?.val !== void 0 ? `<dgm:chMax val="${options.val}"/>` : "<dgm:chMax/>";
|
|
5303
6145
|
/** Creates a dgm:chPref element. */
|
|
5304
|
-
const
|
|
6146
|
+
const createPreferredChildren = (options) => options?.val !== void 0 ? `<dgm:chPref val="${options.val}"/>` : "<dgm:chPref/>";
|
|
5305
6147
|
/** Creates a dgm:orgChart element. */
|
|
5306
6148
|
const createOrgChart = (options) => options?.val !== void 0 ? `<dgm:orgChart val="${options.val}"/>` : "<dgm:orgChart/>";
|
|
5307
6149
|
const HierBranchStyle = {
|
|
@@ -5333,20 +6175,20 @@ const createHierBranch = (options) => options?.val !== void 0 ? `<dgm:hierBranch
|
|
|
5333
6175
|
* </xsd:complexType>
|
|
5334
6176
|
* ```
|
|
5335
6177
|
*/
|
|
5336
|
-
const
|
|
6178
|
+
const createPresentationLayoutVariables = (options) => {
|
|
5337
6179
|
const children = [];
|
|
5338
6180
|
if (options?.orgChart) children.push(createOrgChart(options.orgChart));
|
|
5339
|
-
if (options?.
|
|
5340
|
-
if (options?.
|
|
5341
|
-
if (options?.
|
|
5342
|
-
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));
|
|
5343
6185
|
if (options?.hierBranch) children.push(createHierBranch(options.hierBranch));
|
|
5344
6186
|
return element("dgm:presLayoutVars", void 0, children);
|
|
5345
6187
|
};
|
|
5346
6188
|
/** Creates a dgm:adjLst element containing dgm:adj children. */
|
|
5347
|
-
const
|
|
6189
|
+
const createAdjustList = (options) => {
|
|
5348
6190
|
const children = [];
|
|
5349
|
-
if (options?.
|
|
6191
|
+
if (options?.adjustments) for (const a of options.adjustments) children.push(createAdjust(a));
|
|
5350
6192
|
return element("dgm:adjLst", void 0, children);
|
|
5351
6193
|
};
|
|
5352
6194
|
//#endregion
|
|
@@ -5394,7 +6236,7 @@ const createCatLst = (categories) => {
|
|
|
5394
6236
|
* </xsd:complexType>
|
|
5395
6237
|
* ```
|
|
5396
6238
|
*/
|
|
5397
|
-
const
|
|
6239
|
+
const createColorsDefinitionHeader = (options) => {
|
|
5398
6240
|
const children = [];
|
|
5399
6241
|
for (const t of options.title) children.push(createNameEl("dgm:title", t));
|
|
5400
6242
|
for (const d of options.desc) children.push(createDescEl("dgm:desc", d));
|
|
@@ -5405,9 +6247,9 @@ const createColorsDefHdr = (options) => {
|
|
|
5405
6247
|
return element("dgm:colorsDefHdr", attrs, children);
|
|
5406
6248
|
};
|
|
5407
6249
|
/** Creates a dgm:colorsDefHdrLst element. */
|
|
5408
|
-
const
|
|
6250
|
+
const createColorsDefinitionHeaderList = (options) => {
|
|
5409
6251
|
const children = [];
|
|
5410
|
-
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));
|
|
5411
6253
|
return element("dgm:colorsDefHdrLst", void 0, children);
|
|
5412
6254
|
};
|
|
5413
6255
|
/**
|
|
@@ -5429,7 +6271,7 @@ const createColorsDefHdrLst = (options) => {
|
|
|
5429
6271
|
* </xsd:complexType>
|
|
5430
6272
|
* ```
|
|
5431
6273
|
*/
|
|
5432
|
-
const
|
|
6274
|
+
const createLayoutDefinitionHeader = (options) => {
|
|
5433
6275
|
const children = [];
|
|
5434
6276
|
for (const t of options.title) children.push(createNameEl("dgm:title", t));
|
|
5435
6277
|
for (const d of options.desc) children.push(createDescEl("dgm:desc", d));
|
|
@@ -5441,9 +6283,9 @@ const createLayoutDefHdr = (options) => {
|
|
|
5441
6283
|
return element("dgm:layoutDefHdr", attrs, children);
|
|
5442
6284
|
};
|
|
5443
6285
|
/** Creates a dgm:layoutDefHdrLst element. */
|
|
5444
|
-
const
|
|
6286
|
+
const createLayoutDefinitionHeaderList = (options) => {
|
|
5445
6287
|
const children = [];
|
|
5446
|
-
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));
|
|
5447
6289
|
return element("dgm:layoutDefHdrLst", void 0, children);
|
|
5448
6290
|
};
|
|
5449
6291
|
/**
|
|
@@ -5464,7 +6306,7 @@ const createLayoutDefHdrLst = (options) => {
|
|
|
5464
6306
|
* </xsd:complexType>
|
|
5465
6307
|
* ```
|
|
5466
6308
|
*/
|
|
5467
|
-
const
|
|
6309
|
+
const createStyleDefinitionHeader = (options) => {
|
|
5468
6310
|
const children = [];
|
|
5469
6311
|
for (const t of options.title) children.push(createNameEl("dgm:title", t));
|
|
5470
6312
|
for (const d of options.desc) children.push(createDescEl("dgm:desc", d));
|
|
@@ -5475,9 +6317,9 @@ const createStyleDefHdr = (options) => {
|
|
|
5475
6317
|
return element("dgm:styleDefHdr", attrs, children);
|
|
5476
6318
|
};
|
|
5477
6319
|
/** Creates a dgm:styleDefHdrLst element. */
|
|
5478
|
-
const
|
|
6320
|
+
const createStyleDefinitionHeaderList = (options) => {
|
|
5479
6321
|
const children = [];
|
|
5480
|
-
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));
|
|
5481
6323
|
return element("dgm:styleDefHdrLst", void 0, children);
|
|
5482
6324
|
};
|
|
5483
6325
|
//#endregion
|
|
@@ -5517,10 +6359,10 @@ const FontCollectionIndex = {
|
|
|
5517
6359
|
*/
|
|
5518
6360
|
const createDiagramStyle = (options) => {
|
|
5519
6361
|
const children = [];
|
|
5520
|
-
children.push(element("a:lnRef", { idx: options?.
|
|
5521
|
-
children.push(element("a:fillRef", { idx: options?.
|
|
5522
|
-
children.push(element("a:effectRef", { idx: options?.
|
|
5523
|
-
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 })]));
|
|
5524
6366
|
return element("dgm:style", void 0, children);
|
|
5525
6367
|
};
|
|
5526
6368
|
const ColorMethod = {
|
|
@@ -5542,12 +6384,12 @@ const createColorList = (tag, options) => {
|
|
|
5542
6384
|
if (options?.hueDir) attrs.hueDir = options.hueDir;
|
|
5543
6385
|
return element(tag, hasAttrs ? attrs : void 0, children.length > 0 ? children : void 0);
|
|
5544
6386
|
};
|
|
5545
|
-
const
|
|
5546
|
-
const
|
|
5547
|
-
const
|
|
5548
|
-
const
|
|
5549
|
-
const
|
|
5550
|
-
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);
|
|
5551
6393
|
/**
|
|
5552
6394
|
* Creates a dgm:styleLbl element (CT_StyleLabel or CT_CTStyleLabel).
|
|
5553
6395
|
*
|
|
@@ -5581,14 +6423,14 @@ const createTxEffectClrLst = (options) => createColorList("dgm:txEffectClrLst",
|
|
|
5581
6423
|
* </xsd:complexType>
|
|
5582
6424
|
* ```
|
|
5583
6425
|
*/
|
|
5584
|
-
const
|
|
6426
|
+
const createStyleLabel = (options) => {
|
|
5585
6427
|
const children = [];
|
|
5586
|
-
if (options.
|
|
5587
|
-
if (options.
|
|
5588
|
-
if (options.
|
|
5589
|
-
if (options.
|
|
5590
|
-
if (options.
|
|
5591
|
-
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));
|
|
5592
6434
|
return element("dgm:styleLbl", { name: options.name }, children);
|
|
5593
6435
|
};
|
|
5594
6436
|
//#endregion
|
|
@@ -5606,7 +6448,7 @@ const createStyleLbl = (options) => {
|
|
|
5606
6448
|
* </xsd:complexType>
|
|
5607
6449
|
* ```
|
|
5608
6450
|
*/
|
|
5609
|
-
const
|
|
6451
|
+
const createDiagramRelationshipIds = (options) => `<dgm:relIds r:dm="${options.dm}" r:lo="${options.lo}" r:qs="${options.qs}" r:cs="${options.cs}"/>`;
|
|
5610
6452
|
//#endregion
|
|
5611
6453
|
//#region src/drawingml/diagram/diagram-props.ts
|
|
5612
6454
|
/**
|
|
@@ -5621,7 +6463,7 @@ const createDiagramRelIds = (options) => `<dgm:relIds r:dm="${options.dm}" r:lo=
|
|
|
5621
6463
|
*
|
|
5622
6464
|
* Generic extension list pattern used across OOXML.
|
|
5623
6465
|
*/
|
|
5624
|
-
const
|
|
6466
|
+
const createDiagramExtensionList = (options) => {
|
|
5625
6467
|
const children = [];
|
|
5626
6468
|
if (options?.extensions) for (const ext of options.extensions) children.push(`<a:ext uri="${ext.uri}"/>`);
|
|
5627
6469
|
return element("dgm:extLst", void 0, children);
|
|
@@ -5631,7 +6473,7 @@ const createDiagramExtLst = (options) => {
|
|
|
5631
6473
|
*
|
|
5632
6474
|
* Delegates to the shared createShape3D factory but wraps in dgm: namespace context.
|
|
5633
6475
|
*/
|
|
5634
|
-
const
|
|
6476
|
+
const createDiagramShape3D = (options) => createShape3D(options);
|
|
5635
6477
|
/**
|
|
5636
6478
|
* Creates a dgm:txPr element (CT_TextProps).
|
|
5637
6479
|
*
|
|
@@ -5644,7 +6486,7 @@ const createDiagramSp3d = (options) => createShape3D(options);
|
|
|
5644
6486
|
* </xsd:complexType>
|
|
5645
6487
|
* ```
|
|
5646
6488
|
*/
|
|
5647
|
-
const
|
|
6489
|
+
const createDiagramTextProperties = (_options) => "<dgm:txPr/>";
|
|
5648
6490
|
//#endregion
|
|
5649
6491
|
//#region src/drawingml/color/color-descriptors.ts
|
|
5650
6492
|
/**
|
|
@@ -5713,8 +6555,7 @@ const rgbColorDesc = {
|
|
|
5713
6555
|
return `<a:srgbClr val="${escapeXml(opts.value)}"/>`;
|
|
5714
6556
|
},
|
|
5715
6557
|
parse(el, _ctx) {
|
|
5716
|
-
const result = {};
|
|
5717
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6558
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5718
6559
|
const transforms = readTransforms(el);
|
|
5719
6560
|
if (transforms) result.transforms = transforms;
|
|
5720
6561
|
return result;
|
|
@@ -5728,8 +6569,7 @@ const schemeColorDesc = {
|
|
|
5728
6569
|
return `<a:schemeClr val="${escapeXml(opts.value)}"/>`;
|
|
5729
6570
|
},
|
|
5730
6571
|
parse(el, _ctx) {
|
|
5731
|
-
const result = {};
|
|
5732
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6572
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5733
6573
|
const transforms = readTransforms(el);
|
|
5734
6574
|
if (transforms) result.transforms = transforms;
|
|
5735
6575
|
return result;
|
|
@@ -5743,10 +6583,11 @@ const hslColorDesc = {
|
|
|
5743
6583
|
return `<a:hslClr hue="${opts.hue}" sat="${opts.saturation}" lum="${opts.luminance}"/>`;
|
|
5744
6584
|
},
|
|
5745
6585
|
parse(el, _ctx) {
|
|
5746
|
-
const result = {
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
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
|
+
};
|
|
5750
6591
|
const transforms = readTransforms(el);
|
|
5751
6592
|
if (transforms) result.transforms = transforms;
|
|
5752
6593
|
return result;
|
|
@@ -5763,8 +6604,7 @@ const systemColorDesc = {
|
|
|
5763
6604
|
return `<a:sysClr ${attrStr}/>`;
|
|
5764
6605
|
},
|
|
5765
6606
|
parse(el, _ctx) {
|
|
5766
|
-
const result = {};
|
|
5767
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6607
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5768
6608
|
const lastClr = el.attributes?.["lastClr"];
|
|
5769
6609
|
if (lastClr) result.lastClr = String(lastClr);
|
|
5770
6610
|
const transforms = readTransforms(el);
|
|
@@ -5780,8 +6620,7 @@ const presetColorDesc = {
|
|
|
5780
6620
|
return `<a:prstClr val="${escapeXml(opts.value)}"/>`;
|
|
5781
6621
|
},
|
|
5782
6622
|
parse(el, _ctx) {
|
|
5783
|
-
const result = {};
|
|
5784
|
-
result.value = String(el.attributes?.["val"] ?? "");
|
|
6623
|
+
const result = { value: String(el.attributes?.["val"] ?? "") };
|
|
5785
6624
|
const transforms = readTransforms(el);
|
|
5786
6625
|
if (transforms) result.transforms = transforms;
|
|
5787
6626
|
return result;
|
|
@@ -5795,10 +6634,11 @@ const scRgbColorDesc = {
|
|
|
5795
6634
|
return `<a:scrgbClr r="${escapeXml(opts.r)}" g="${escapeXml(opts.g)}" b="${escapeXml(opts.b)}"/>`;
|
|
5796
6635
|
},
|
|
5797
6636
|
parse(el, _ctx) {
|
|
5798
|
-
const result = {
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
6637
|
+
const result = {
|
|
6638
|
+
r: String(el.attributes?.["r"] ?? ""),
|
|
6639
|
+
g: String(el.attributes?.["g"] ?? ""),
|
|
6640
|
+
b: String(el.attributes?.["b"] ?? "")
|
|
6641
|
+
};
|
|
5802
6642
|
const transforms = readTransforms(el);
|
|
5803
6643
|
if (transforms) result.transforms = transforms;
|
|
5804
6644
|
return result;
|
|
@@ -5879,7 +6719,7 @@ function stringifyShade(shade) {
|
|
|
5879
6719
|
const parts = [];
|
|
5880
6720
|
if (pathShade.path) parts.push(`path="${escapeXml(pathShade.path)}"`);
|
|
5881
6721
|
const attrStr = parts.length ? " " + parts.join(" ") : "";
|
|
5882
|
-
if (pathShade.
|
|
6722
|
+
if (pathShade.fillToRectangle) return `<a:path${attrStr}>${stringifyRelativeRect("a:fillToRect", pathShade.fillToRectangle)}</a:path>`;
|
|
5883
6723
|
return `<a:path${attrStr}/>`;
|
|
5884
6724
|
}
|
|
5885
6725
|
const gradientFillDesc = {
|
|
@@ -5893,7 +6733,7 @@ const gradientFillDesc = {
|
|
|
5893
6733
|
}).join("");
|
|
5894
6734
|
parts.push(`<a:gsLst>${stopsXml}</a:gsLst>`);
|
|
5895
6735
|
if (opts.shade) parts.push(stringifyShade(opts.shade));
|
|
5896
|
-
if (opts.
|
|
6736
|
+
if (opts.tileRectangle) parts.push(stringifyRelativeRect("a:tileRect", opts.tileRectangle));
|
|
5897
6737
|
const attrParts = [];
|
|
5898
6738
|
if (opts.flip) attrParts.push(`flip="${escapeXml(opts.flip)}"`);
|
|
5899
6739
|
if (opts.rotateWithShape !== void 0) attrParts.push(`rotWithShape="${opts.rotateWithShape ? 1 : 0}"`);
|
|
@@ -5919,15 +6759,15 @@ const gradientFillDesc = {
|
|
|
5919
6759
|
if (path) {
|
|
5920
6760
|
const shade = {};
|
|
5921
6761
|
if (path.attributes?.["path"] !== void 0) shade.path = String(path.attributes["path"]);
|
|
5922
|
-
const
|
|
5923
|
-
if (
|
|
6762
|
+
const fillToRectangle = findChild(path, "a:fillToRect");
|
|
6763
|
+
if (fillToRectangle) shade.fillToRectangle = readRelativeRect(fillToRectangle);
|
|
5924
6764
|
result.shade = shade;
|
|
5925
6765
|
}
|
|
5926
6766
|
}
|
|
5927
6767
|
if (el.attributes?.["flip"] !== void 0) result.flip = String(el.attributes["flip"]);
|
|
5928
6768
|
if (el.attributes?.["rotWithShape"] !== void 0) result.rotateWithShape = el.attributes["rotWithShape"] !== "0";
|
|
5929
|
-
const
|
|
5930
|
-
if (
|
|
6769
|
+
const tileRectangle = findChild(el, "a:tileRect");
|
|
6770
|
+
if (tileRectangle) result.tileRectangle = readRelativeRect(tileRectangle);
|
|
5931
6771
|
return result;
|
|
5932
6772
|
}
|
|
5933
6773
|
};
|
|
@@ -5993,17 +6833,17 @@ const fillDesc = {
|
|
|
5993
6833
|
const solidFill = resolve("a:solidFill");
|
|
5994
6834
|
if (solidFill) return {
|
|
5995
6835
|
type: "solid",
|
|
5996
|
-
color: parse(solidFillDesc, solidFill, ctx)
|
|
6836
|
+
color: parse$1(solidFillDesc, solidFill, ctx)
|
|
5997
6837
|
};
|
|
5998
6838
|
const gradFill = resolve("a:gradFill");
|
|
5999
6839
|
if (gradFill) return {
|
|
6000
6840
|
type: "gradient",
|
|
6001
|
-
options: parse(gradientFillDesc, gradFill, ctx)
|
|
6841
|
+
options: parse$1(gradientFillDesc, gradFill, ctx)
|
|
6002
6842
|
};
|
|
6003
6843
|
const pattFill = resolve("a:pattFill");
|
|
6004
6844
|
if (pattFill) return {
|
|
6005
6845
|
type: "pattern",
|
|
6006
|
-
...parse(patternFillDesc, pattFill, ctx)
|
|
6846
|
+
...parse$1(patternFillDesc, pattFill, ctx)
|
|
6007
6847
|
};
|
|
6008
6848
|
if (resolve("a:grpFill")) return { type: "group" };
|
|
6009
6849
|
return { type: "none" };
|
|
@@ -6013,7 +6853,7 @@ function readDirectColor(el, ctx) {
|
|
|
6013
6853
|
const color = parseColorChoice(el, ctx);
|
|
6014
6854
|
if (Object.keys(color).length > 0) return color;
|
|
6015
6855
|
const solidFill = findChild(el, "a:solidFill");
|
|
6016
|
-
if (solidFill) return parse(solidFillDesc, solidFill, ctx);
|
|
6856
|
+
if (solidFill) return parse$1(solidFillDesc, solidFill, ctx);
|
|
6017
6857
|
return { value: "" };
|
|
6018
6858
|
}
|
|
6019
6859
|
//#endregion
|
|
@@ -6045,7 +6885,7 @@ const outlineDesc = {
|
|
|
6045
6885
|
stringify(opts, ctx) {
|
|
6046
6886
|
const parts = [];
|
|
6047
6887
|
const attrParts = [];
|
|
6048
|
-
if (opts.width !== void 0) attrParts.push(`w="${opts.width}"`);
|
|
6888
|
+
if (opts.width !== void 0) attrParts.push(`w="${convertToEmu(opts.width)}"`);
|
|
6049
6889
|
if (opts.cap !== void 0) attrParts.push(`cap="${escapeXml(opts.cap)}"`);
|
|
6050
6890
|
if (opts.compoundLine !== void 0) attrParts.push(`cmpd="${escapeXml(opts.compoundLine)}"`);
|
|
6051
6891
|
if (opts.align !== void 0) attrParts.push(`algn="${escapeXml(opts.align)}"`);
|
|
@@ -6079,12 +6919,12 @@ const outlineDesc = {
|
|
|
6079
6919
|
const solidFill = findChild(el, "a:solidFill");
|
|
6080
6920
|
if (solidFill) {
|
|
6081
6921
|
result.type = "solidFill";
|
|
6082
|
-
result.color = parse(solidFillDesc, solidFill, _ctx);
|
|
6922
|
+
result.color = parse$1(solidFillDesc, solidFill, _ctx);
|
|
6083
6923
|
}
|
|
6084
6924
|
if (findChild(el, "a:noFill")) result.type = "noFill";
|
|
6085
6925
|
if (findChild(el, "a:gradFill")) {
|
|
6086
6926
|
result.type = "gradFill";
|
|
6087
|
-
result.gradientFill = parse(gradientFillDesc, findChild(el, "a:gradFill"), _ctx);
|
|
6927
|
+
result.gradientFill = parse$1(gradientFillDesc, findChild(el, "a:gradFill"), _ctx);
|
|
6088
6928
|
}
|
|
6089
6929
|
const prstDash = findChild(el, "a:prstDash");
|
|
6090
6930
|
if (prstDash?.attributes?.["val"]) result.dash = String(prstDash.attributes["val"]);
|
|
@@ -6394,22 +7234,22 @@ const presetGeometryDesc = {
|
|
|
6394
7234
|
if (el.attributes?.["prst"] !== void 0) result.preset = String(el.attributes["prst"]);
|
|
6395
7235
|
const avLst = findChild(el, "a:avLst");
|
|
6396
7236
|
if (avLst) {
|
|
6397
|
-
const guides = parse(adjustmentValuesDesc, avLst, ctx);
|
|
7237
|
+
const guides = parse$1(adjustmentValuesDesc, avLst, ctx);
|
|
6398
7238
|
if (guides.length > 0) result.adjustmentValues = guides;
|
|
6399
7239
|
}
|
|
6400
7240
|
return result;
|
|
6401
7241
|
}
|
|
6402
7242
|
};
|
|
6403
|
-
function
|
|
7243
|
+
function stringifyAdjustPoint(pt) {
|
|
6404
7244
|
return `<a:pt x="${escapeXml(pt.x)}" y="${escapeXml(pt.y)}"/>`;
|
|
6405
7245
|
}
|
|
6406
7246
|
function stringifyPathCommand(cmd) {
|
|
6407
7247
|
switch (cmd.command) {
|
|
6408
|
-
case "moveTo": return `<a:moveTo>${
|
|
6409
|
-
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>`;
|
|
6410
7250
|
case "arcTo": return `<a:arcTo wR="${escapeXml(cmd.widthRadius)}" hR="${escapeXml(cmd.heightRadius)}" stAng="${escapeXml(cmd.startAngle)}" swAng="${escapeXml(cmd.sweepAngle)}"/>`;
|
|
6411
|
-
case "quadBezTo": return `<a:quadBezTo>${cmd.points.map(
|
|
6412
|
-
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>`;
|
|
6413
7253
|
case "close": return "<a:close/>";
|
|
6414
7254
|
}
|
|
6415
7255
|
}
|
|
@@ -6425,7 +7265,7 @@ function stringifyPath(path) {
|
|
|
6425
7265
|
if (!cmds && !attrStr) return "<a:path/>";
|
|
6426
7266
|
return `<a:path${attrStr}>${cmds}</a:path>`;
|
|
6427
7267
|
}
|
|
6428
|
-
function
|
|
7268
|
+
function readAdjustPoint(el) {
|
|
6429
7269
|
if (!el.attributes) return void 0;
|
|
6430
7270
|
const x = el.attributes["x"];
|
|
6431
7271
|
const y = el.attributes["y"];
|
|
@@ -6440,7 +7280,7 @@ function readPathCommand(tag, el) {
|
|
|
6440
7280
|
case "a:moveTo": {
|
|
6441
7281
|
const pt = el.elements?.find((c) => c.name === "a:pt");
|
|
6442
7282
|
if (!pt) return void 0;
|
|
6443
|
-
const point =
|
|
7283
|
+
const point = readAdjustPoint(pt);
|
|
6444
7284
|
if (!point) return void 0;
|
|
6445
7285
|
return {
|
|
6446
7286
|
command: "moveTo",
|
|
@@ -6450,7 +7290,7 @@ function readPathCommand(tag, el) {
|
|
|
6450
7290
|
case "a:lnTo": {
|
|
6451
7291
|
const pt = el.elements?.find((c) => c.name === "a:pt");
|
|
6452
7292
|
if (!pt) return void 0;
|
|
6453
|
-
const point =
|
|
7293
|
+
const point = readAdjustPoint(pt);
|
|
6454
7294
|
if (!point) return void 0;
|
|
6455
7295
|
return {
|
|
6456
7296
|
command: "lineTo",
|
|
@@ -6469,7 +7309,7 @@ function readPathCommand(tag, el) {
|
|
|
6469
7309
|
};
|
|
6470
7310
|
}
|
|
6471
7311
|
case "a:quadBezTo": {
|
|
6472
|
-
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);
|
|
6473
7313
|
if (points.length < 2) return void 0;
|
|
6474
7314
|
return {
|
|
6475
7315
|
command: "quadBezTo",
|
|
@@ -6477,7 +7317,7 @@ function readPathCommand(tag, el) {
|
|
|
6477
7317
|
};
|
|
6478
7318
|
}
|
|
6479
7319
|
case "a:cubicBezTo": {
|
|
6480
|
-
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);
|
|
6481
7321
|
if (points.length < 3) return void 0;
|
|
6482
7322
|
return {
|
|
6483
7323
|
command: "cubicBezTo",
|
|
@@ -6642,7 +7482,7 @@ const customGeometryDesc = {
|
|
|
6642
7482
|
const inner = opts.connectionSites.map(stringifyConnectionSite).join("");
|
|
6643
7483
|
parts.push(`<a:cxnLst>${inner}</a:cxnLst>`);
|
|
6644
7484
|
}
|
|
6645
|
-
if (opts.
|
|
7485
|
+
if (opts.textRectangle) parts.push(stringifyGeomRect(opts.textRectangle));
|
|
6646
7486
|
const pathsXml = opts.pathList.map(stringifyPath).join("");
|
|
6647
7487
|
parts.push(`<a:pathLst>${pathsXml}</a:pathLst>`);
|
|
6648
7488
|
return `<a:custGeom>${parts.join("")}</a:custGeom>`;
|
|
@@ -6682,8 +7522,8 @@ const customGeometryDesc = {
|
|
|
6682
7522
|
}
|
|
6683
7523
|
const rect = findChild(el, "a:rect");
|
|
6684
7524
|
if (rect) {
|
|
6685
|
-
const
|
|
6686
|
-
if (
|
|
7525
|
+
const textRectangle = readGeomRect(rect);
|
|
7526
|
+
if (textRectangle) result.textRectangle = textRectangle;
|
|
6687
7527
|
}
|
|
6688
7528
|
const pathLst = findChild(el, "a:pathLst");
|
|
6689
7529
|
if (pathLst?.elements) {
|
|
@@ -6847,18 +7687,18 @@ const shape3DDesc = {
|
|
|
6847
7687
|
if (el.attributes?.["contourW"] !== void 0) result.contourW = Number(el.attributes["contourW"]);
|
|
6848
7688
|
if (el.attributes?.["prstMaterial"] !== void 0) result.prstMaterial = xsdMaterialType.from(String(el.attributes["prstMaterial"]));
|
|
6849
7689
|
const bevelT = findChild(el, "a:bevelT");
|
|
6850
|
-
if (bevelT) result.bevelT = parse(bevelDesc, bevelT, ctx);
|
|
7690
|
+
if (bevelT) result.bevelT = parse$1(bevelDesc, bevelT, ctx);
|
|
6851
7691
|
const bevelB = findChild(el, "a:bevelB");
|
|
6852
|
-
if (bevelB) result.bevelB = parse(bevelDesc, bevelB, ctx);
|
|
7692
|
+
if (bevelB) result.bevelB = parse$1(bevelDesc, bevelB, ctx);
|
|
6853
7693
|
const extrusionClr = findChild(el, "a:extrusionClr");
|
|
6854
7694
|
if (extrusionClr) {
|
|
6855
7695
|
const solidFill = findChild(extrusionClr, "a:solidFill");
|
|
6856
|
-
if (solidFill) result.extrusionColor = parse(solidFillDesc, solidFill, ctx);
|
|
7696
|
+
if (solidFill) result.extrusionColor = parse$1(solidFillDesc, solidFill, ctx);
|
|
6857
7697
|
}
|
|
6858
7698
|
const contourClr = findChild(el, "a:contourClr");
|
|
6859
7699
|
if (contourClr) {
|
|
6860
7700
|
const solidFill = findChild(contourClr, "a:solidFill");
|
|
6861
|
-
if (solidFill) result.contourColor = parse(solidFillDesc, solidFill, ctx);
|
|
7701
|
+
if (solidFill) result.contourColor = parse$1(solidFillDesc, solidFill, ctx);
|
|
6862
7702
|
}
|
|
6863
7703
|
return result;
|
|
6864
7704
|
}
|
|
@@ -6925,9 +7765,9 @@ const scene3DDesc = {
|
|
|
6925
7765
|
parse(el, ctx) {
|
|
6926
7766
|
const result = {};
|
|
6927
7767
|
const camera = findChild(el, "a:camera");
|
|
6928
|
-
if (camera) result.camera = parse(cameraDesc, camera, ctx);
|
|
7768
|
+
if (camera) result.camera = parse$1(cameraDesc, camera, ctx);
|
|
6929
7769
|
const lightRig = findChild(el, "a:lightRig");
|
|
6930
|
-
if (lightRig) result.lightRig = parse(lightRigDesc, lightRig, ctx);
|
|
7770
|
+
if (lightRig) result.lightRig = parse$1(lightRigDesc, lightRig, ctx);
|
|
6931
7771
|
const backdrop = findChild(el, "a:backdrop");
|
|
6932
7772
|
if (backdrop) result.backdrop = readBackdrop(backdrop);
|
|
6933
7773
|
return result;
|
|
@@ -7146,7 +7986,7 @@ function readBlipEffects(el, ctx) {
|
|
|
7146
7986
|
const alphaInv = findChild(el, "a:alphaInv");
|
|
7147
7987
|
if (alphaInv) {
|
|
7148
7988
|
const solidFill = findChild(alphaInv, "a:solidFill");
|
|
7149
|
-
if (solidFill) result.alphaInverse = parse(solidFillDesc, solidFill, ctx);
|
|
7989
|
+
if (solidFill) result.alphaInverse = parse$1(solidFillDesc, solidFill, ctx);
|
|
7150
7990
|
else result.alphaInverse = {};
|
|
7151
7991
|
}
|
|
7152
7992
|
const alphaModFix = findChild(el, "a:alphaModFix");
|
|
@@ -7166,19 +8006,19 @@ function readBlipEffects(el, ctx) {
|
|
|
7166
8006
|
const clrFrom = findChild(clrChange, "a:clrFrom");
|
|
7167
8007
|
if (clrFrom) {
|
|
7168
8008
|
const fromFill = findChild(clrFrom, "a:solidFill");
|
|
7169
|
-
if (fromFill) opts.from = parse(solidFillDesc, fromFill, ctx);
|
|
8009
|
+
if (fromFill) opts.from = parse$1(solidFillDesc, fromFill, ctx);
|
|
7170
8010
|
}
|
|
7171
8011
|
const clrTo = findChild(clrChange, "a:clrTo");
|
|
7172
8012
|
if (clrTo) {
|
|
7173
8013
|
const toFill = findChild(clrTo, "a:solidFill");
|
|
7174
|
-
if (toFill) opts.to = parse(solidFillDesc, toFill, ctx);
|
|
8014
|
+
if (toFill) opts.to = parse$1(solidFillDesc, toFill, ctx);
|
|
7175
8015
|
}
|
|
7176
8016
|
result.colorChange = opts;
|
|
7177
8017
|
}
|
|
7178
8018
|
const clrRepl = findChild(el, "a:clrRepl");
|
|
7179
8019
|
if (clrRepl) {
|
|
7180
8020
|
const solidFill = findChild(clrRepl, "a:solidFill");
|
|
7181
|
-
if (solidFill) result.colorRepl = { color: parse(solidFillDesc, solidFill, ctx) };
|
|
8021
|
+
if (solidFill) result.colorRepl = { color: parse$1(solidFillDesc, solidFill, ctx) };
|
|
7182
8022
|
}
|
|
7183
8023
|
const blur = findChild(el, "a:blur");
|
|
7184
8024
|
if (blur) {
|
|
@@ -7192,7 +8032,7 @@ function readBlipEffects(el, ctx) {
|
|
|
7192
8032
|
const fills = [];
|
|
7193
8033
|
for (const child of duotone.elements) {
|
|
7194
8034
|
const sf = findChild(child, "a:solidFill");
|
|
7195
|
-
if (sf) fills.push(parse(solidFillDesc, sf, ctx));
|
|
8035
|
+
if (sf) fills.push(parse$1(solidFillDesc, sf, ctx));
|
|
7196
8036
|
}
|
|
7197
8037
|
if (fills.length >= 2) result.duotone = {
|
|
7198
8038
|
color1: fills[0],
|
|
@@ -7241,8 +8081,8 @@ const blipFillDesc = {
|
|
|
7241
8081
|
}, ctx);
|
|
7242
8082
|
if (blipXml) parts.push(blipXml);
|
|
7243
8083
|
}
|
|
7244
|
-
if (opts.
|
|
7245
|
-
const srcRectXml = stringify$1(sourceRectangleDesc, opts.
|
|
8084
|
+
if (opts.sourceRectangle) {
|
|
8085
|
+
const srcRectXml = stringify$1(sourceRectangleDesc, opts.sourceRectangle, ctx);
|
|
7246
8086
|
if (srcRectXml) parts.push(srcRectXml);
|
|
7247
8087
|
}
|
|
7248
8088
|
if (opts.tile) {
|
|
@@ -7260,14 +8100,14 @@ const blipFillDesc = {
|
|
|
7260
8100
|
if (el.attributes?.["rotWithShape"] !== void 0) result.rotWithShape = el.attributes["rotWithShape"] !== "0";
|
|
7261
8101
|
const blip = findChild(el, "a:blip");
|
|
7262
8102
|
if (blip) {
|
|
7263
|
-
const blipResult = parse(blipDesc, blip, ctx);
|
|
8103
|
+
const blipResult = parse$1(blipDesc, blip, ctx);
|
|
7264
8104
|
if (blipResult.referenceId) result.referenceId = blipResult.referenceId;
|
|
7265
8105
|
if (blipResult.blipEffects) result.blipEffects = blipResult.blipEffects;
|
|
7266
8106
|
}
|
|
7267
8107
|
const srcRect = findChild(el, "a:srcRect");
|
|
7268
|
-
if (srcRect) result.
|
|
8108
|
+
if (srcRect) result.sourceRectangle = parse$1(sourceRectangleDesc, srcRect, ctx);
|
|
7269
8109
|
const tile = findChild(el, "a:tile");
|
|
7270
|
-
if (tile) result.tile = parse(tileDesc, tile, ctx);
|
|
8110
|
+
if (tile) result.tile = parse$1(tileDesc, tile, ctx);
|
|
7271
8111
|
return result;
|
|
7272
8112
|
}
|
|
7273
8113
|
};
|
|
@@ -7278,7 +8118,7 @@ const blipFillDesc = {
|
|
|
7278
8118
|
*
|
|
7279
8119
|
* @module
|
|
7280
8120
|
*/
|
|
7281
|
-
const
|
|
8121
|
+
const diagramRelationshipIdsDesc = {
|
|
7282
8122
|
kind: "custom",
|
|
7283
8123
|
stringify(opts, _ctx) {
|
|
7284
8124
|
return `<dgm:relIds r:dm="${escapeXml(opts.dm)}" r:lo="${escapeXml(opts.lo)}" r:qs="${escapeXml(opts.qs)}" r:cs="${escapeXml(opts.cs)}"/>`;
|
|
@@ -7297,30 +8137,30 @@ const diagramRelIdsDesc = {
|
|
|
7297
8137
|
const diagramStyleDesc = {
|
|
7298
8138
|
kind: "custom",
|
|
7299
8139
|
stringify(opts, _ctx) {
|
|
7300
|
-
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>`;
|
|
7301
8141
|
},
|
|
7302
8142
|
parse(el, _ctx) {
|
|
7303
8143
|
const result = {};
|
|
7304
8144
|
const lnRef = findChild(el, "a:lnRef");
|
|
7305
|
-
if (lnRef?.attributes?.["idx"] !== void 0) result.
|
|
8145
|
+
if (lnRef?.attributes?.["idx"] !== void 0) result.lineReference = { idx: Number(lnRef.attributes["idx"]) };
|
|
7306
8146
|
const fillRef = findChild(el, "a:fillRef");
|
|
7307
|
-
if (fillRef?.attributes?.["idx"] !== void 0) result.
|
|
8147
|
+
if (fillRef?.attributes?.["idx"] !== void 0) result.fillReference = { idx: Number(fillRef.attributes["idx"]) };
|
|
7308
8148
|
const effectRef = findChild(el, "a:effectRef");
|
|
7309
|
-
if (effectRef?.attributes?.["idx"] !== void 0) result.
|
|
8149
|
+
if (effectRef?.attributes?.["idx"] !== void 0) result.effectReference = { idx: Number(effectRef.attributes["idx"]) };
|
|
7310
8150
|
const fontRef = findChild(el, "a:fontRef");
|
|
7311
|
-
if (fontRef?.attributes?.["idx"] !== void 0) result.
|
|
8151
|
+
if (fontRef?.attributes?.["idx"] !== void 0) result.fontReference = { idx: String(fontRef.attributes["idx"]) };
|
|
7312
8152
|
return result;
|
|
7313
8153
|
}
|
|
7314
8154
|
};
|
|
7315
|
-
const
|
|
8155
|
+
const presentationLayoutVariablesDesc = {
|
|
7316
8156
|
kind: "custom",
|
|
7317
8157
|
stringify(opts, _ctx) {
|
|
7318
8158
|
const parts = [];
|
|
7319
8159
|
if (opts.orgChart?.val !== void 0) parts.push(`<dgm:orgChart val="${opts.orgChart.val ? 1 : 0}"/>`);
|
|
7320
|
-
if (opts.
|
|
7321
|
-
if (opts.
|
|
7322
|
-
if (opts.
|
|
7323
|
-
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)}"/>`);
|
|
7324
8164
|
if (opts.hierBranch?.val !== void 0) parts.push(`<dgm:hierBranch val="${escapeXml(opts.hierBranch.val)}"/>`);
|
|
7325
8165
|
if (parts.length === 0) return `<dgm:presLayoutVars/>`;
|
|
7326
8166
|
return `<dgm:presLayoutVars>${parts.join("")}</dgm:presLayoutVars>`;
|
|
@@ -7330,19 +8170,19 @@ const presLayoutVarsDesc = {
|
|
|
7330
8170
|
const orgChart = findChild(el, "dgm:orgChart");
|
|
7331
8171
|
if (orgChart?.attributes?.["val"] !== void 0) result.orgChart = { val: orgChart.attributes["val"] === 1 || orgChart.attributes["val"] === "1" };
|
|
7332
8172
|
const chMax = findChild(el, "dgm:chMax");
|
|
7333
|
-
if (chMax?.attributes?.["val"] !== void 0) result.
|
|
8173
|
+
if (chMax?.attributes?.["val"] !== void 0) result.maxChildren = { val: Number(chMax.attributes["val"]) };
|
|
7334
8174
|
const chPref = findChild(el, "dgm:chPref");
|
|
7335
|
-
if (chPref?.attributes?.["val"] !== void 0) result.
|
|
8175
|
+
if (chPref?.attributes?.["val"] !== void 0) result.preferredChildren = { val: Number(chPref.attributes["val"]) };
|
|
7336
8176
|
const animOne = findChild(el, "dgm:animOne");
|
|
7337
|
-
if (animOne?.attributes?.["val"] !== void 0) result.
|
|
8177
|
+
if (animOne?.attributes?.["val"] !== void 0) result.animateOneByOne = { val: String(animOne.attributes["val"]) };
|
|
7338
8178
|
const animLvl = findChild(el, "dgm:animLvl");
|
|
7339
|
-
if (animLvl?.attributes?.["val"] !== void 0) result.
|
|
8179
|
+
if (animLvl?.attributes?.["val"] !== void 0) result.animationLevel = { val: String(animLvl.attributes["val"]) };
|
|
7340
8180
|
const hierBranch = findChild(el, "dgm:hierBranch");
|
|
7341
8181
|
if (hierBranch?.attributes?.["val"] !== void 0) result.hierBranch = { val: String(hierBranch.attributes["val"]) };
|
|
7342
8182
|
return result;
|
|
7343
8183
|
}
|
|
7344
8184
|
};
|
|
7345
|
-
const
|
|
8185
|
+
const diagramExtensionListDesc = {
|
|
7346
8186
|
kind: "custom",
|
|
7347
8187
|
stringify(opts, _ctx) {
|
|
7348
8188
|
if (!opts.extensions?.length) return void 0;
|
|
@@ -7639,4 +8479,4 @@ function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
|
|
|
7639
8479
|
return replacePlaceholders(xml, map);
|
|
7640
8480
|
}
|
|
7641
8481
|
//#endregion
|
|
7642
|
-
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 };
|