pptx-viewer-core 1.1.34 → 1.1.36
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/{SvgExporter-CGO8Tx9z.d.mts → SvgExporter-CYyO9c5A.d.mts} +1 -1
- package/dist/{SvgExporter-DpupBlmk.d.ts → SvgExporter-DdjrIx33.d.ts} +1 -1
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.mjs +0 -0
- package/dist/converter/index.d.mts +3 -3
- package/dist/converter/index.d.ts +3 -3
- package/dist/index.d.mts +82 -6
- package/dist/index.d.ts +82 -6
- package/dist/index.js +424 -129
- package/dist/index.mjs +423 -130
- package/dist/{presentation-CyttD6sq.d.mts → presentation-BRAUjTRt.d.mts} +98 -45
- package/dist/{presentation-CyttD6sq.d.ts → presentation-BRAUjTRt.d.ts} +98 -45
- package/dist/{text-operations-DXebUVQp.d.ts → text-operations-BJUOhA1w.d.ts} +1 -1
- package/dist/{text-operations-D5GfkYT5.d.mts → text-operations-CkW4BO91.d.mts} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6209,16 +6209,16 @@ var PptxShapeStyleExtractor = class {
|
|
|
6209
6209
|
extractShapeStyle(spPr, styleNode) {
|
|
6210
6210
|
const style = {};
|
|
6211
6211
|
const shapeProps = spPr || {};
|
|
6212
|
-
const
|
|
6212
|
+
const solidFill2 = shapeProps["a:solidFill"];
|
|
6213
6213
|
const gradFill = shapeProps["a:gradFill"];
|
|
6214
6214
|
const pattFill = shapeProps["a:pattFill"];
|
|
6215
6215
|
const noFill = shapeProps["a:noFill"];
|
|
6216
6216
|
const blipFill = shapeProps["a:blipFill"];
|
|
6217
|
-
if (
|
|
6217
|
+
if (solidFill2) {
|
|
6218
6218
|
style.fillMode = "solid";
|
|
6219
|
-
style.fillColor = this.context.parseColor(
|
|
6220
|
-
style.fillOpacity = this.context.extractColorOpacity(
|
|
6221
|
-
const solidFillColorXml = extractColorChoiceXml(
|
|
6219
|
+
style.fillColor = this.context.parseColor(solidFill2);
|
|
6220
|
+
style.fillOpacity = this.context.extractColorOpacity(solidFill2);
|
|
6221
|
+
const solidFillColorXml = extractColorChoiceXml(solidFill2);
|
|
6222
6222
|
if (solidFillColorXml) {
|
|
6223
6223
|
style.fillColorXml = solidFillColorXml;
|
|
6224
6224
|
}
|
|
@@ -8949,15 +8949,15 @@ var PptxSlideLoaderService = class {
|
|
|
8949
8949
|
|
|
8950
8950
|
// src/core/services/PptxXmlLookupService.ts
|
|
8951
8951
|
var PptxXmlLookupService = class {
|
|
8952
|
-
getChildByLocalName(parent,
|
|
8952
|
+
getChildByLocalName(parent, localName2) {
|
|
8953
8953
|
if (!parent) {
|
|
8954
8954
|
return void 0;
|
|
8955
8955
|
}
|
|
8956
|
-
const direct = parent[
|
|
8956
|
+
const direct = parent[localName2];
|
|
8957
8957
|
if (direct && typeof direct === "object" && !Array.isArray(direct)) {
|
|
8958
8958
|
return direct;
|
|
8959
8959
|
}
|
|
8960
|
-
const suffix = `:${
|
|
8960
|
+
const suffix = `:${localName2}`;
|
|
8961
8961
|
const matchingKey = Object.keys(parent).find((key) => key.endsWith(suffix));
|
|
8962
8962
|
if (!matchingKey) {
|
|
8963
8963
|
return void 0;
|
|
@@ -8968,32 +8968,32 @@ var PptxXmlLookupService = class {
|
|
|
8968
8968
|
}
|
|
8969
8969
|
return value;
|
|
8970
8970
|
}
|
|
8971
|
-
getChildrenArrayByLocalName(parent,
|
|
8971
|
+
getChildrenArrayByLocalName(parent, localName2) {
|
|
8972
8972
|
if (!parent) {
|
|
8973
8973
|
return [];
|
|
8974
8974
|
}
|
|
8975
|
-
const direct = parent[
|
|
8975
|
+
const direct = parent[localName2];
|
|
8976
8976
|
if (direct !== void 0) {
|
|
8977
8977
|
return this.toXmlArray(direct);
|
|
8978
8978
|
}
|
|
8979
|
-
const suffix = `:${
|
|
8979
|
+
const suffix = `:${localName2}`;
|
|
8980
8980
|
const matchingKey = Object.keys(parent).find((key) => key.endsWith(suffix));
|
|
8981
8981
|
if (!matchingKey) {
|
|
8982
8982
|
return [];
|
|
8983
8983
|
}
|
|
8984
8984
|
return this.toXmlArray(parent[matchingKey]);
|
|
8985
8985
|
}
|
|
8986
|
-
getScalarChildByLocalName(parent,
|
|
8986
|
+
getScalarChildByLocalName(parent, localName2) {
|
|
8987
8987
|
if (!parent) {
|
|
8988
8988
|
return void 0;
|
|
8989
8989
|
}
|
|
8990
|
-
const direct = parent[
|
|
8990
|
+
const direct = parent[localName2];
|
|
8991
8991
|
if (typeof direct === "string" || typeof direct === "number") {
|
|
8992
8992
|
return String(direct);
|
|
8993
8993
|
}
|
|
8994
|
-
const suffix = `:${
|
|
8994
|
+
const suffix = `:${localName2}`;
|
|
8995
8995
|
for (const [key, value] of Object.entries(parent)) {
|
|
8996
|
-
if (key !==
|
|
8996
|
+
if (key !== localName2 && !key.endsWith(suffix)) {
|
|
8997
8997
|
continue;
|
|
8998
8998
|
}
|
|
8999
8999
|
if (typeof value === "string" || typeof value === "number") {
|
|
@@ -10438,11 +10438,11 @@ function parseP14FromExtLst(extLstNode, xmlLookupService, getXmlLocalName) {
|
|
|
10438
10438
|
if (key.startsWith("@_")) {
|
|
10439
10439
|
continue;
|
|
10440
10440
|
}
|
|
10441
|
-
const
|
|
10442
|
-
if (!P14_TRANSITION_TYPES.has(
|
|
10441
|
+
const localName2 = getXmlLocalName(key);
|
|
10442
|
+
if (!P14_TRANSITION_TYPES.has(localName2)) {
|
|
10443
10443
|
continue;
|
|
10444
10444
|
}
|
|
10445
|
-
const type =
|
|
10445
|
+
const type = localName2;
|
|
10446
10446
|
let direction;
|
|
10447
10447
|
let orient;
|
|
10448
10448
|
let pattern;
|
|
@@ -10492,8 +10492,8 @@ function buildP14ExtLst(transitionType, direction, orient, pattern, rawExtLst, x
|
|
|
10492
10492
|
if (key.startsWith("@_")) {
|
|
10493
10493
|
continue;
|
|
10494
10494
|
}
|
|
10495
|
-
const
|
|
10496
|
-
if (P14_TRANSITION_TYPES.has(
|
|
10495
|
+
const localName2 = getXmlLocalName(key);
|
|
10496
|
+
if (P14_TRANSITION_TYPES.has(localName2)) {
|
|
10497
10497
|
return false;
|
|
10498
10498
|
}
|
|
10499
10499
|
}
|
|
@@ -10556,17 +10556,17 @@ var PptxSlideTransitionService = class {
|
|
|
10556
10556
|
if (key.startsWith("@_")) {
|
|
10557
10557
|
continue;
|
|
10558
10558
|
}
|
|
10559
|
-
const
|
|
10560
|
-
if (
|
|
10559
|
+
const localName2 = this.getXmlLocalName(key);
|
|
10560
|
+
if (localName2 === "sndAc") {
|
|
10561
10561
|
rawSoundAction = value;
|
|
10562
10562
|
continue;
|
|
10563
10563
|
}
|
|
10564
|
-
if (
|
|
10564
|
+
if (localName2 === "extLst") {
|
|
10565
10565
|
rawExtLst = value;
|
|
10566
10566
|
continue;
|
|
10567
10567
|
}
|
|
10568
|
-
if (TRANSITION_TYPES.has(
|
|
10569
|
-
transitionType =
|
|
10568
|
+
if (TRANSITION_TYPES.has(localName2)) {
|
|
10569
|
+
transitionType = localName2;
|
|
10570
10570
|
}
|
|
10571
10571
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
10572
10572
|
const detail = value;
|
|
@@ -11957,6 +11957,26 @@ var PptxAnimationWriteService = class {
|
|
|
11957
11957
|
}
|
|
11958
11958
|
};
|
|
11959
11959
|
|
|
11960
|
+
// src/core/utils/xml-entities.ts
|
|
11961
|
+
var NUMERIC_HEX = /&#x(?<hex>[0-9a-fA-F]+);/gu;
|
|
11962
|
+
var NUMERIC_DEC = /&#(?<dec>\d+);/gu;
|
|
11963
|
+
function decodeXmlEntities(value) {
|
|
11964
|
+
if (typeof value !== "string" || !value.includes("&")) {
|
|
11965
|
+
return value;
|
|
11966
|
+
}
|
|
11967
|
+
return value.replace(NUMERIC_HEX, (_match, hex8) => codePointToString(parseInt(hex8, 16))).replace(NUMERIC_DEC, (_match, dec) => codePointToString(parseInt(dec, 10))).replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, '"').replace(/'/gu, "'").replace(/&/gu, "&");
|
|
11968
|
+
}
|
|
11969
|
+
function codePointToString(codePoint) {
|
|
11970
|
+
if (!Number.isFinite(codePoint) || codePoint < 0 || codePoint > 1114111) {
|
|
11971
|
+
return "";
|
|
11972
|
+
}
|
|
11973
|
+
try {
|
|
11974
|
+
return String.fromCodePoint(codePoint);
|
|
11975
|
+
} catch {
|
|
11976
|
+
return "";
|
|
11977
|
+
}
|
|
11978
|
+
}
|
|
11979
|
+
|
|
11960
11980
|
// src/core/core/factories/PptxRuntimeDependencyFactory.ts
|
|
11961
11981
|
var PptxRuntimeDependencyFactory = class {
|
|
11962
11982
|
createParser() {
|
|
@@ -11968,7 +11988,7 @@ var PptxRuntimeDependencyFactory = class {
|
|
|
11968
11988
|
// default), `<AppVersion>16.0000</AppVersion>` is coerced to the
|
|
11969
11989
|
// JS number 16, losing the trailing zeros. On save we write back
|
|
11970
11990
|
// "16", which fails PowerPoint's strict `[0-9]+\.[0-9]{4}` match
|
|
11971
|
-
// on AppVersion
|
|
11991
|
+
// on AppVersion: the loader rejects the package with HRESULT
|
|
11972
11992
|
// 0x80070570 (ERROR_FILE_CORRUPT) and shows the repair dialog.
|
|
11973
11993
|
// More generally, OOXML element text is always an untyped string;
|
|
11974
11994
|
// downstream callers coerce where needed.
|
|
@@ -11979,7 +11999,15 @@ var PptxRuntimeDependencyFactory = class {
|
|
|
11979
11999
|
// (billion-laughs / external-entity / future fast-xml-parser
|
|
11980
12000
|
// regressions). v5.5.5 currently defaults to safe behaviour but
|
|
11981
12001
|
// pinning this makes the guarantee explicit and forward-stable.
|
|
11982
|
-
processEntities: false
|
|
12002
|
+
processEntities: false,
|
|
12003
|
+
// With entity processing disabled, the five predefined XML entities
|
|
12004
|
+
// and numeric character references would survive ENCODED in element
|
|
12005
|
+
// text (e.g. `Tom & Jerry` renders the literal `&` and
|
|
12006
|
+
// double-encodes to `&amp;` on save). Decode just those here -
|
|
12007
|
+
// they cannot trigger entity expansion, so the security guarantee
|
|
12008
|
+
// above is preserved - so text nodes hold their real characters and
|
|
12009
|
+
// the builder re-encodes them symmetrically on save.
|
|
12010
|
+
tagValueProcessor: (_tagName, tagValue) => decodeXmlEntities(tagValue)
|
|
11983
12011
|
});
|
|
11984
12012
|
}
|
|
11985
12013
|
createBuilder() {
|
|
@@ -12743,27 +12771,27 @@ function detectDigitalSignatures(zipEntryPaths) {
|
|
|
12743
12771
|
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
12744
12772
|
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
12745
12773
|
}
|
|
12746
|
-
function findByLocalName(parent,
|
|
12774
|
+
function findByLocalName(parent, localName2) {
|
|
12747
12775
|
if (!parent) {
|
|
12748
12776
|
return void 0;
|
|
12749
12777
|
}
|
|
12750
|
-
if (parent[
|
|
12751
|
-
return parent[
|
|
12778
|
+
if (parent[localName2] !== void 0 && typeof parent[localName2] === "object") {
|
|
12779
|
+
return parent[localName2];
|
|
12752
12780
|
}
|
|
12753
12781
|
for (const key of Object.keys(parent)) {
|
|
12754
12782
|
const parts = key.split(":");
|
|
12755
|
-
if (parts[parts.length - 1] ===
|
|
12783
|
+
if (parts[parts.length - 1] === localName2 && typeof parent[key] === "object") {
|
|
12756
12784
|
return parent[key];
|
|
12757
12785
|
}
|
|
12758
12786
|
}
|
|
12759
12787
|
return void 0;
|
|
12760
12788
|
}
|
|
12761
|
-
function findScalarByLocalName(parent,
|
|
12789
|
+
function findScalarByLocalName(parent, localName2) {
|
|
12762
12790
|
if (!parent) {
|
|
12763
12791
|
return void 0;
|
|
12764
12792
|
}
|
|
12765
|
-
if (parent[
|
|
12766
|
-
const v = parent[
|
|
12793
|
+
if (parent[localName2] !== void 0) {
|
|
12794
|
+
const v = parent[localName2];
|
|
12767
12795
|
if (typeof v === "string") {
|
|
12768
12796
|
return v;
|
|
12769
12797
|
}
|
|
@@ -12776,7 +12804,7 @@ function findScalarByLocalName(parent, localName) {
|
|
|
12776
12804
|
}
|
|
12777
12805
|
for (const key of Object.keys(parent)) {
|
|
12778
12806
|
const parts = key.split(":");
|
|
12779
|
-
if (parts[parts.length - 1] ===
|
|
12807
|
+
if (parts[parts.length - 1] === localName2) {
|
|
12780
12808
|
const v = parent[key];
|
|
12781
12809
|
if (typeof v === "string") {
|
|
12782
12810
|
return v;
|
|
@@ -12791,13 +12819,13 @@ function findScalarByLocalName(parent, localName) {
|
|
|
12791
12819
|
}
|
|
12792
12820
|
return void 0;
|
|
12793
12821
|
}
|
|
12794
|
-
function findAllByLocalName(parent,
|
|
12822
|
+
function findAllByLocalName(parent, localName2) {
|
|
12795
12823
|
if (!parent) {
|
|
12796
12824
|
return [];
|
|
12797
12825
|
}
|
|
12798
12826
|
for (const key of Object.keys(parent)) {
|
|
12799
12827
|
const parts = key.split(":");
|
|
12800
|
-
if (parts[parts.length - 1] ===
|
|
12828
|
+
if (parts[parts.length - 1] === localName2) {
|
|
12801
12829
|
const v = parent[key];
|
|
12802
12830
|
if (Array.isArray(v)) {
|
|
12803
12831
|
return v;
|
|
@@ -13274,8 +13302,8 @@ function parseLineStyle(container, elementName, xmlLookup, colorParser) {
|
|
|
13274
13302
|
if (spPr) {
|
|
13275
13303
|
const lnNode = xmlLookup.getChildByLocalName(spPr, "ln");
|
|
13276
13304
|
if (lnNode) {
|
|
13277
|
-
const
|
|
13278
|
-
const lineColor = colorParser.parseColor(
|
|
13305
|
+
const solidFill2 = xmlLookup.getChildByLocalName(lnNode, "solidFill");
|
|
13306
|
+
const lineColor = colorParser.parseColor(solidFill2);
|
|
13279
13307
|
if (lineColor) {
|
|
13280
13308
|
result.color = lineColor;
|
|
13281
13309
|
}
|
|
@@ -13317,8 +13345,8 @@ function parseShapeProps(spPrNode, xmlLookup, colorParser) {
|
|
|
13317
13345
|
}
|
|
13318
13346
|
const result = {};
|
|
13319
13347
|
let hasProps = false;
|
|
13320
|
-
const
|
|
13321
|
-
const fillColor = colorParser.parseColor(
|
|
13348
|
+
const solidFill2 = xmlLookup.getChildByLocalName(spPrNode, "solidFill");
|
|
13349
|
+
const fillColor = colorParser.parseColor(solidFill2);
|
|
13322
13350
|
if (fillColor) {
|
|
13323
13351
|
result.fillColor = fillColor;
|
|
13324
13352
|
hasProps = true;
|
|
@@ -13498,8 +13526,8 @@ var AXIS_TYPE_MAP = {
|
|
|
13498
13526
|
dateAx: "dateAx",
|
|
13499
13527
|
serAx: "serAx"
|
|
13500
13528
|
};
|
|
13501
|
-
function upsertChartAxisChild(parent,
|
|
13502
|
-
const existingKey = Object.keys(parent).find((k) => getLocalName(k) ===
|
|
13529
|
+
function upsertChartAxisChild(parent, localName2, value, getLocalName) {
|
|
13530
|
+
const existingKey = Object.keys(parent).find((k) => getLocalName(k) === localName2);
|
|
13503
13531
|
if (value === void 0) {
|
|
13504
13532
|
if (existingKey) {
|
|
13505
13533
|
delete parent[existingKey];
|
|
@@ -13509,18 +13537,18 @@ function upsertChartAxisChild(parent, localName, value, getLocalName) {
|
|
|
13509
13537
|
if (existingKey) {
|
|
13510
13538
|
parent[existingKey]["@_val"] = value;
|
|
13511
13539
|
} else {
|
|
13512
|
-
parent[`c:${
|
|
13540
|
+
parent[`c:${localName2}`] = { "@_val": value };
|
|
13513
13541
|
}
|
|
13514
13542
|
}
|
|
13515
13543
|
function parseChartAxes(plotArea, xmlLookup, colorParser, getLocalName) {
|
|
13516
13544
|
const result = [];
|
|
13517
13545
|
for (const key of Object.keys(plotArea)) {
|
|
13518
|
-
const
|
|
13519
|
-
const axisType = AXIS_TYPE_MAP[
|
|
13546
|
+
const localName2 = getLocalName(key);
|
|
13547
|
+
const axisType = AXIS_TYPE_MAP[localName2];
|
|
13520
13548
|
if (!axisType) {
|
|
13521
13549
|
continue;
|
|
13522
13550
|
}
|
|
13523
|
-
const axisNodes = xmlLookup.getChildrenArrayByLocalName(plotArea,
|
|
13551
|
+
const axisNodes = xmlLookup.getChildrenArrayByLocalName(plotArea, localName2);
|
|
13524
13552
|
for (const axisNode of axisNodes) {
|
|
13525
13553
|
const axis = parseSingleAxis(axisNode, axisType, xmlLookup, colorParser);
|
|
13526
13554
|
if (axis) {
|
|
@@ -13717,8 +13745,8 @@ function parseTxPr(txPrNode, xmlLookup, colorParser, target) {
|
|
|
13717
13745
|
if (latin?.["@_typeface"]) {
|
|
13718
13746
|
target.fontFamily = String(latin["@_typeface"]);
|
|
13719
13747
|
}
|
|
13720
|
-
const
|
|
13721
|
-
const fontColor = colorParser.parseColor(
|
|
13748
|
+
const solidFill2 = xmlLookup.getChildByLocalName(defRPr, "solidFill");
|
|
13749
|
+
const fontColor = colorParser.parseColor(solidFill2);
|
|
13722
13750
|
if (fontColor) {
|
|
13723
13751
|
target.fontColor = fontColor;
|
|
13724
13752
|
}
|
|
@@ -13793,8 +13821,8 @@ var CONTAINER_LOCAL_NAME_TO_TYPE = {
|
|
|
13793
13821
|
surfaceChart: "surface",
|
|
13794
13822
|
surface3DChart: "surface"
|
|
13795
13823
|
};
|
|
13796
|
-
function chartContainerLocalNameToType(
|
|
13797
|
-
return CONTAINER_LOCAL_NAME_TO_TYPE[
|
|
13824
|
+
function chartContainerLocalNameToType(localName2) {
|
|
13825
|
+
return CONTAINER_LOCAL_NAME_TO_TYPE[localName2];
|
|
13798
13826
|
}
|
|
13799
13827
|
|
|
13800
13828
|
// src/core/utils/chart-cx-parser.ts
|
|
@@ -13803,11 +13831,11 @@ function extractCxSeriesColor(ser, xmlLookup) {
|
|
|
13803
13831
|
if (!spPr) {
|
|
13804
13832
|
return void 0;
|
|
13805
13833
|
}
|
|
13806
|
-
const
|
|
13807
|
-
if (!
|
|
13834
|
+
const solidFill2 = xmlLookup.getChildByLocalName(spPr, "solidFill");
|
|
13835
|
+
if (!solidFill2) {
|
|
13808
13836
|
return void 0;
|
|
13809
13837
|
}
|
|
13810
|
-
const srgb = xmlLookup.getChildByLocalName(
|
|
13838
|
+
const srgb = xmlLookup.getChildByLocalName(solidFill2, "srgbClr");
|
|
13811
13839
|
if (srgb) {
|
|
13812
13840
|
const val = String(srgb["@_val"] || "").trim();
|
|
13813
13841
|
if (val.length === 6) {
|
|
@@ -14015,18 +14043,18 @@ function parseWorksheetCells(xml) {
|
|
|
14015
14043
|
}
|
|
14016
14044
|
return cells;
|
|
14017
14045
|
}
|
|
14018
|
-
function findByLocalName2(obj,
|
|
14046
|
+
function findByLocalName2(obj, localName2) {
|
|
14019
14047
|
for (const key of Object.keys(obj)) {
|
|
14020
14048
|
const parts = key.split(":");
|
|
14021
14049
|
const local = parts[parts.length - 1];
|
|
14022
|
-
if (local ===
|
|
14050
|
+
if (local === localName2) {
|
|
14023
14051
|
return obj[key];
|
|
14024
14052
|
}
|
|
14025
14053
|
}
|
|
14026
14054
|
return void 0;
|
|
14027
14055
|
}
|
|
14028
|
-
function getChildArray(parent,
|
|
14029
|
-
const child = findByLocalName2(parent,
|
|
14056
|
+
function getChildArray(parent, localName2) {
|
|
14057
|
+
const child = findByLocalName2(parent, localName2);
|
|
14030
14058
|
if (!child) {
|
|
14031
14059
|
return [];
|
|
14032
14060
|
}
|
|
@@ -14038,8 +14066,8 @@ function getChildArray(parent, localName) {
|
|
|
14038
14066
|
}
|
|
14039
14067
|
return [];
|
|
14040
14068
|
}
|
|
14041
|
-
function getTextValue(parent,
|
|
14042
|
-
const child = findByLocalName2(parent,
|
|
14069
|
+
function getTextValue(parent, localName2) {
|
|
14070
|
+
const child = findByLocalName2(parent, localName2);
|
|
14043
14071
|
if (child === void 0 || child === null) {
|
|
14044
14072
|
return void 0;
|
|
14045
14073
|
}
|
|
@@ -16505,8 +16533,8 @@ function createSimpleLookup() {
|
|
|
16505
16533
|
return void 0;
|
|
16506
16534
|
}
|
|
16507
16535
|
for (const [key, value] of Object.entries(obj)) {
|
|
16508
|
-
const
|
|
16509
|
-
if (
|
|
16536
|
+
const localName2 = key.includes(":") ? key.split(":").pop() : key;
|
|
16537
|
+
if (localName2 === name && value && typeof value === "object" && !Array.isArray(value)) {
|
|
16510
16538
|
return value;
|
|
16511
16539
|
}
|
|
16512
16540
|
}
|
|
@@ -16517,8 +16545,8 @@ function createSimpleLookup() {
|
|
|
16517
16545
|
return [];
|
|
16518
16546
|
}
|
|
16519
16547
|
for (const [key, value] of Object.entries(obj)) {
|
|
16520
|
-
const
|
|
16521
|
-
if (
|
|
16548
|
+
const localName2 = key.includes(":") ? key.split(":").pop() : key;
|
|
16549
|
+
if (localName2 === name) {
|
|
16522
16550
|
if (Array.isArray(value)) {
|
|
16523
16551
|
return value.filter(
|
|
16524
16552
|
(v) => v !== null && typeof v === "object"
|
|
@@ -17645,6 +17673,62 @@ function layoutRelationship(nodes, bounds, themeColorMap) {
|
|
|
17645
17673
|
return elements;
|
|
17646
17674
|
}
|
|
17647
17675
|
|
|
17676
|
+
// src/core/utils/smartart-node-style-apply.ts
|
|
17677
|
+
function styledContentNodes(nodes) {
|
|
17678
|
+
return getContentNodes(nodes);
|
|
17679
|
+
}
|
|
17680
|
+
function applyNodeStylesToElements(elements, nodes) {
|
|
17681
|
+
const contentNodes = styledContentNodes(nodes);
|
|
17682
|
+
if (contentNodes.length === 0) {
|
|
17683
|
+
return elements;
|
|
17684
|
+
}
|
|
17685
|
+
let shapeIndex = 0;
|
|
17686
|
+
return elements.map((element) => {
|
|
17687
|
+
if (element.type !== "shape") {
|
|
17688
|
+
return element;
|
|
17689
|
+
}
|
|
17690
|
+
const node = contentNodes[shapeIndex++];
|
|
17691
|
+
const style = node?.style;
|
|
17692
|
+
if (!style || Object.keys(style).length === 0) {
|
|
17693
|
+
return element;
|
|
17694
|
+
}
|
|
17695
|
+
const shapeStyle = { ...element.shapeStyle };
|
|
17696
|
+
if (style.fillColor !== void 0) {
|
|
17697
|
+
shapeStyle.fillColor = style.fillColor;
|
|
17698
|
+
shapeStyle.fillMode = "solid";
|
|
17699
|
+
}
|
|
17700
|
+
if (style.lineColor !== void 0) {
|
|
17701
|
+
shapeStyle.strokeColor = style.lineColor;
|
|
17702
|
+
}
|
|
17703
|
+
const baseTextStyle = element.textStyle ?? {};
|
|
17704
|
+
const textStyle = { ...baseTextStyle };
|
|
17705
|
+
if (style.fontColor !== void 0) {
|
|
17706
|
+
textStyle.color = style.fontColor;
|
|
17707
|
+
}
|
|
17708
|
+
if (style.bold !== void 0) {
|
|
17709
|
+
textStyle.bold = style.bold;
|
|
17710
|
+
}
|
|
17711
|
+
if (style.italic !== void 0) {
|
|
17712
|
+
textStyle.italic = style.italic;
|
|
17713
|
+
}
|
|
17714
|
+
const segments = element.textSegments?.map((seg) => ({
|
|
17715
|
+
...seg,
|
|
17716
|
+
style: {
|
|
17717
|
+
...seg.style,
|
|
17718
|
+
...style.fontColor !== void 0 ? { color: style.fontColor } : {},
|
|
17719
|
+
...style.bold !== void 0 ? { bold: style.bold } : {},
|
|
17720
|
+
...style.italic !== void 0 ? { italic: style.italic } : {}
|
|
17721
|
+
}
|
|
17722
|
+
}));
|
|
17723
|
+
return {
|
|
17724
|
+
...element,
|
|
17725
|
+
shapeStyle,
|
|
17726
|
+
textStyle,
|
|
17727
|
+
...segments ? { textSegments: segments } : {}
|
|
17728
|
+
};
|
|
17729
|
+
});
|
|
17730
|
+
}
|
|
17731
|
+
|
|
17648
17732
|
// src/core/utils/smartart-decompose.ts
|
|
17649
17733
|
function quickStyleStrokeScale(quickStyle) {
|
|
17650
17734
|
if (!quickStyle?.effectIntensity) {
|
|
@@ -17741,9 +17825,13 @@ function decomposeSmartArt(smartArtData, containerBounds, themeColorMap, layoutD
|
|
|
17741
17825
|
if (namedLayout) {
|
|
17742
17826
|
const namedResult = dispatchNamedLayout(namedLayout, nodes, containerBounds, effectiveThemeMap);
|
|
17743
17827
|
if (namedResult) {
|
|
17744
|
-
return namedResult;
|
|
17828
|
+
return applyNodeStylesToElements(namedResult, nodes);
|
|
17745
17829
|
}
|
|
17746
17830
|
}
|
|
17831
|
+
const algorithmic = dispatchLayoutByType(layoutType, nodes, containerBounds, effectiveThemeMap);
|
|
17832
|
+
return algorithmic ? applyNodeStylesToElements(algorithmic, nodes) : algorithmic;
|
|
17833
|
+
}
|
|
17834
|
+
function dispatchLayoutByType(layoutType, nodes, containerBounds, effectiveThemeMap) {
|
|
17747
17835
|
switch (layoutType) {
|
|
17748
17836
|
case "list":
|
|
17749
17837
|
return layoutList(nodes, containerBounds, effectiveThemeMap);
|
|
@@ -18090,6 +18178,46 @@ function reorderSmartArtNodeToIndex(data, nodeId, newIndex) {
|
|
|
18090
18178
|
};
|
|
18091
18179
|
}
|
|
18092
18180
|
|
|
18181
|
+
// src/core/utils/smartart-editing-node-style.ts
|
|
18182
|
+
function mergeNodeStyle(current, patch) {
|
|
18183
|
+
const merged = { ...current };
|
|
18184
|
+
for (const key of Object.keys(patch)) {
|
|
18185
|
+
const value = patch[key];
|
|
18186
|
+
if (value === void 0) {
|
|
18187
|
+
delete merged[key];
|
|
18188
|
+
} else {
|
|
18189
|
+
merged[key] = value;
|
|
18190
|
+
}
|
|
18191
|
+
}
|
|
18192
|
+
return merged;
|
|
18193
|
+
}
|
|
18194
|
+
function setSmartArtNodeStyle(data, nodeId, style) {
|
|
18195
|
+
let matched = false;
|
|
18196
|
+
const nodes = data.nodes.map((node) => {
|
|
18197
|
+
if (node.id !== nodeId) {
|
|
18198
|
+
return node;
|
|
18199
|
+
}
|
|
18200
|
+
matched = true;
|
|
18201
|
+
const nextStyle = mergeNodeStyle(node.style, style);
|
|
18202
|
+
const hasStyle = Object.keys(nextStyle).length > 0;
|
|
18203
|
+
const updated = { ...node };
|
|
18204
|
+
if (hasStyle) {
|
|
18205
|
+
updated.style = nextStyle;
|
|
18206
|
+
} else {
|
|
18207
|
+
delete updated.style;
|
|
18208
|
+
}
|
|
18209
|
+
return updated;
|
|
18210
|
+
});
|
|
18211
|
+
if (!matched) {
|
|
18212
|
+
return data;
|
|
18213
|
+
}
|
|
18214
|
+
return {
|
|
18215
|
+
...data,
|
|
18216
|
+
nodes,
|
|
18217
|
+
drawingShapes: void 0
|
|
18218
|
+
};
|
|
18219
|
+
}
|
|
18220
|
+
|
|
18093
18221
|
// src/core/utils/smartart-editing-reflow-layouts-geometric.ts
|
|
18094
18222
|
function reflowCycle(nodes, bounds) {
|
|
18095
18223
|
const size = Math.min(bounds.width, bounds.height);
|
|
@@ -19902,18 +20030,18 @@ function extractTagAttribute(xml, tagName, attributeName) {
|
|
|
19902
20030
|
const match = xml.match(pattern);
|
|
19903
20031
|
return match?.groups?.["attributeValue"]?.trim();
|
|
19904
20032
|
}
|
|
19905
|
-
function extractFirstTagText(xml,
|
|
20033
|
+
function extractFirstTagText(xml, localName2) {
|
|
19906
20034
|
const pattern = new RegExp(
|
|
19907
|
-
`<([\\w.-]+:)?${
|
|
20035
|
+
`<([\\w.-]+:)?${localName2}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName2}>`,
|
|
19908
20036
|
"i"
|
|
19909
20037
|
);
|
|
19910
20038
|
const match = xml.match(pattern);
|
|
19911
20039
|
return match?.[2]?.replace(/\s+/g, "").trim() || void 0;
|
|
19912
20040
|
}
|
|
19913
|
-
function extractAllTagText(xml,
|
|
20041
|
+
function extractAllTagText(xml, localName2) {
|
|
19914
20042
|
const result = [];
|
|
19915
20043
|
const regex = new RegExp(
|
|
19916
|
-
`<([\\w.-]+:)?${
|
|
20044
|
+
`<([\\w.-]+:)?${localName2}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName2}>`,
|
|
19917
20045
|
"gi"
|
|
19918
20046
|
);
|
|
19919
20047
|
let match = regex.exec(xml);
|
|
@@ -26546,8 +26674,8 @@ var PptxHandlerRuntime2 = class extends PptxHandlerRuntime {
|
|
|
26546
26674
|
return void 0;
|
|
26547
26675
|
}
|
|
26548
26676
|
const fillNode = tblBg["a:fill"];
|
|
26549
|
-
const
|
|
26550
|
-
const schemeClr =
|
|
26677
|
+
const solidFill2 = fillNode?.["a:solidFill"] ?? tblBg["a:solidFill"];
|
|
26678
|
+
const schemeClr = solidFill2?.["a:schemeClr"];
|
|
26551
26679
|
const schemeColor = schemeClr ? String(schemeClr["@_val"] || "").trim() || void 0 : void 0;
|
|
26552
26680
|
const fill = schemeColor ? { schemeColor } : void 0;
|
|
26553
26681
|
const hasEffectLst = Boolean(tblBg["a:effectLst"]);
|
|
@@ -26575,11 +26703,11 @@ var PptxHandlerRuntime2 = class extends PptxHandlerRuntime {
|
|
|
26575
26703
|
if (!fill) {
|
|
26576
26704
|
return void 0;
|
|
26577
26705
|
}
|
|
26578
|
-
const
|
|
26579
|
-
if (!
|
|
26706
|
+
const solidFill2 = fill["a:solidFill"];
|
|
26707
|
+
if (!solidFill2) {
|
|
26580
26708
|
return void 0;
|
|
26581
26709
|
}
|
|
26582
|
-
const schemeClr =
|
|
26710
|
+
const schemeClr = solidFill2["a:schemeClr"];
|
|
26583
26711
|
if (!schemeClr) {
|
|
26584
26712
|
return void 0;
|
|
26585
26713
|
}
|
|
@@ -30858,10 +30986,10 @@ var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
30858
30986
|
if (csTypeface) {
|
|
30859
30987
|
style.complexScriptFont = csTypeface;
|
|
30860
30988
|
}
|
|
30861
|
-
const
|
|
30862
|
-
if (
|
|
30863
|
-
style.color = this.parseColor(
|
|
30864
|
-
const colorXml = extractColorChoiceXml(
|
|
30989
|
+
const solidFill2 = xmlChild(runProperties, "a:solidFill");
|
|
30990
|
+
if (solidFill2) {
|
|
30991
|
+
style.color = this.parseColor(solidFill2);
|
|
30992
|
+
const colorXml = extractColorChoiceXml(solidFill2);
|
|
30865
30993
|
if (colorXml) {
|
|
30866
30994
|
style.colorXml = colorXml;
|
|
30867
30995
|
}
|
|
@@ -31826,13 +31954,13 @@ function serializeTablePropertyFlags(tbl, tableData) {
|
|
|
31826
31954
|
}
|
|
31827
31955
|
tbl["a:tblPr"] = tblPr;
|
|
31828
31956
|
}
|
|
31829
|
-
function replaceFirstTextValueInTree(node,
|
|
31957
|
+
function replaceFirstTextValueInTree(node, localName2, newValue, getXmlLocalName) {
|
|
31830
31958
|
if (node === null || node === void 0) {
|
|
31831
31959
|
return false;
|
|
31832
31960
|
}
|
|
31833
31961
|
if (Array.isArray(node)) {
|
|
31834
31962
|
for (const entry of node) {
|
|
31835
|
-
if (replaceFirstTextValueInTree(entry,
|
|
31963
|
+
if (replaceFirstTextValueInTree(entry, localName2, newValue, getXmlLocalName)) {
|
|
31836
31964
|
return true;
|
|
31837
31965
|
}
|
|
31838
31966
|
}
|
|
@@ -31843,13 +31971,13 @@ function replaceFirstTextValueInTree(node, localName, newValue, getXmlLocalName)
|
|
|
31843
31971
|
}
|
|
31844
31972
|
const objectNode = node;
|
|
31845
31973
|
for (const [key, value] of Object.entries(objectNode)) {
|
|
31846
|
-
if (getXmlLocalName(key) ===
|
|
31974
|
+
if (getXmlLocalName(key) === localName2) {
|
|
31847
31975
|
if (typeof value === "string" || typeof value === "number") {
|
|
31848
31976
|
objectNode[key] = newValue;
|
|
31849
31977
|
return true;
|
|
31850
31978
|
}
|
|
31851
31979
|
}
|
|
31852
|
-
if (replaceFirstTextValueInTree(value,
|
|
31980
|
+
if (replaceFirstTextValueInTree(value, localName2, newValue, getXmlLocalName)) {
|
|
31853
31981
|
return true;
|
|
31854
31982
|
}
|
|
31855
31983
|
}
|
|
@@ -32937,10 +33065,10 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
32937
33065
|
* Upsert a `c:<localName>` child with `@_val` on an axis or scaling node.
|
|
32938
33066
|
* When `value` is undefined, removes any existing child of that local name.
|
|
32939
33067
|
*/
|
|
32940
|
-
upsertChartAxisChild(parent,
|
|
33068
|
+
upsertChartAxisChild(parent, localName2, value) {
|
|
32941
33069
|
upsertChartAxisChild(
|
|
32942
33070
|
parent,
|
|
32943
|
-
|
|
33071
|
+
localName2,
|
|
32944
33072
|
value,
|
|
32945
33073
|
(key) => this.compatibilityService.getXmlLocalName(key)
|
|
32946
33074
|
);
|
|
@@ -32974,10 +33102,10 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
32974
33102
|
cacheNode[ptKey] = buildChartPoints(values);
|
|
32975
33103
|
}
|
|
32976
33104
|
/** Replace the first text value found deep in the node tree. */
|
|
32977
|
-
replaceFirstTextValue(node,
|
|
33105
|
+
replaceFirstTextValue(node, localName2, newValue) {
|
|
32978
33106
|
return replaceFirstTextValueInTree(
|
|
32979
33107
|
node,
|
|
32980
|
-
|
|
33108
|
+
localName2,
|
|
32981
33109
|
newValue,
|
|
32982
33110
|
(key) => this.compatibilityService.getXmlLocalName(key)
|
|
32983
33111
|
);
|
|
@@ -32989,10 +33117,10 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
32989
33117
|
* Upsert a `c:<localName>` child carrying only an `@_val` attribute on
|
|
32990
33118
|
* `parent`. When `value` is `undefined` the existing child is removed.
|
|
32991
33119
|
*/
|
|
32992
|
-
upsertValChild(parent,
|
|
32993
|
-
const existing = this.xmlLookupService.getChildByLocalName(parent,
|
|
33120
|
+
upsertValChild(parent, localName2, value) {
|
|
33121
|
+
const existing = this.xmlLookupService.getChildByLocalName(parent, localName2);
|
|
32994
33122
|
const existingKey = Object.keys(parent).find(
|
|
32995
|
-
(k) => this.compatibilityService.getXmlLocalName(k) ===
|
|
33123
|
+
(k) => this.compatibilityService.getXmlLocalName(k) === localName2
|
|
32996
33124
|
);
|
|
32997
33125
|
if (value === void 0) {
|
|
32998
33126
|
if (existingKey) {
|
|
@@ -33003,7 +33131,7 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
33003
33131
|
if (existing && existingKey) {
|
|
33004
33132
|
parent[existingKey] = { ...existing, "@_val": value };
|
|
33005
33133
|
} else {
|
|
33006
|
-
parent[`c:${
|
|
33134
|
+
parent[`c:${localName2}`] = { "@_val": value };
|
|
33007
33135
|
}
|
|
33008
33136
|
}
|
|
33009
33137
|
/**
|
|
@@ -33323,27 +33451,27 @@ function applySmartArtChrome(dataModel, chrome, getLocalName) {
|
|
|
33323
33451
|
if (!chrome || !chrome.backgroundColor && !chrome.outlineColor && (chrome.outlineWidth === null || chrome.outlineWidth === void 0)) {
|
|
33324
33452
|
return;
|
|
33325
33453
|
}
|
|
33326
|
-
const
|
|
33454
|
+
const findKey13 = (obj, name) => Object.keys(obj).find((k) => getLocalName(k) === name);
|
|
33327
33455
|
if (chrome.backgroundColor) {
|
|
33328
33456
|
const hex8 = chrome.backgroundColor.replace("#", "");
|
|
33329
|
-
const bgKey =
|
|
33457
|
+
const bgKey = findKey13(dataModel, "bg") ?? "dgm:bg";
|
|
33330
33458
|
const bg = asObject2(dataModel[bgKey]);
|
|
33331
|
-
const fillKey =
|
|
33459
|
+
const fillKey = findKey13(bg, "solidFill") ?? "a:solidFill";
|
|
33332
33460
|
bg[fillKey] = { "a:srgbClr": { "@_val": hex8 } };
|
|
33333
33461
|
dataModel[bgKey] = bg;
|
|
33334
33462
|
}
|
|
33335
33463
|
const hasOutlineWidth = chrome.outlineWidth !== null && chrome.outlineWidth !== void 0;
|
|
33336
33464
|
if (chrome.outlineColor || hasOutlineWidth) {
|
|
33337
|
-
const wholeKey =
|
|
33465
|
+
const wholeKey = findKey13(dataModel, "whole") ?? "dgm:whole";
|
|
33338
33466
|
const whole = asObject2(dataModel[wholeKey]);
|
|
33339
|
-
const lnKey =
|
|
33467
|
+
const lnKey = findKey13(whole, "ln") ?? "a:ln";
|
|
33340
33468
|
const ln = asObject2(whole[lnKey]);
|
|
33341
33469
|
if (hasOutlineWidth) {
|
|
33342
33470
|
ln["@_w"] = String(Math.round(chrome.outlineWidth * 12700));
|
|
33343
33471
|
}
|
|
33344
33472
|
if (chrome.outlineColor) {
|
|
33345
33473
|
const hex8 = chrome.outlineColor.replace("#", "");
|
|
33346
|
-
const fillKey =
|
|
33474
|
+
const fillKey = findKey13(ln, "solidFill") ?? "a:solidFill";
|
|
33347
33475
|
ln[fillKey] = { "a:srgbClr": { "@_val": hex8 } };
|
|
33348
33476
|
}
|
|
33349
33477
|
whole[lnKey] = ln;
|
|
@@ -33351,6 +33479,102 @@ function applySmartArtChrome(dataModel, chrome, getLocalName) {
|
|
|
33351
33479
|
}
|
|
33352
33480
|
}
|
|
33353
33481
|
|
|
33482
|
+
// src/core/core/runtime/smartart-style-xml.ts
|
|
33483
|
+
function localName(key) {
|
|
33484
|
+
const idx = key.indexOf(":");
|
|
33485
|
+
return idx >= 0 ? key.slice(idx + 1) : key;
|
|
33486
|
+
}
|
|
33487
|
+
function findKey12(obj, local) {
|
|
33488
|
+
return Object.keys(obj).find((k) => localName(k) === local);
|
|
33489
|
+
}
|
|
33490
|
+
function ensureChild(obj, local, prefixedFallback) {
|
|
33491
|
+
const key = findKey12(obj, local) ?? prefixedFallback;
|
|
33492
|
+
const existing = obj[key];
|
|
33493
|
+
if (existing && typeof existing === "object" && !Array.isArray(existing)) {
|
|
33494
|
+
return existing;
|
|
33495
|
+
}
|
|
33496
|
+
const created = {};
|
|
33497
|
+
obj[key] = created;
|
|
33498
|
+
return created;
|
|
33499
|
+
}
|
|
33500
|
+
function hexValue(color) {
|
|
33501
|
+
return color.replace(/^#/u, "").toUpperCase();
|
|
33502
|
+
}
|
|
33503
|
+
function solidFill(color) {
|
|
33504
|
+
return { "a:srgbClr": { "@_val": hexValue(color) } };
|
|
33505
|
+
}
|
|
33506
|
+
function setSolidFill(parent, color) {
|
|
33507
|
+
const key = findKey12(parent, "solidFill") ?? "a:solidFill";
|
|
33508
|
+
parent[key] = solidFill(color);
|
|
33509
|
+
}
|
|
33510
|
+
function applyShapeStyle(pt2, style) {
|
|
33511
|
+
if (style.fillColor === void 0 && style.lineColor === void 0) {
|
|
33512
|
+
return;
|
|
33513
|
+
}
|
|
33514
|
+
const spPr = ensureChild(pt2, "spPr", "dgm:spPr");
|
|
33515
|
+
if (style.fillColor !== void 0) {
|
|
33516
|
+
setSolidFill(spPr, style.fillColor);
|
|
33517
|
+
}
|
|
33518
|
+
if (style.lineColor !== void 0) {
|
|
33519
|
+
const ln = ensureChild(spPr, "ln", "a:ln");
|
|
33520
|
+
setSolidFill(ln, style.lineColor);
|
|
33521
|
+
}
|
|
33522
|
+
}
|
|
33523
|
+
function ensureFirstRunRPr(pt2) {
|
|
33524
|
+
const tKey = findKey12(pt2, "t");
|
|
33525
|
+
if (!tKey) {
|
|
33526
|
+
return void 0;
|
|
33527
|
+
}
|
|
33528
|
+
const body = pt2[tKey];
|
|
33529
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
33530
|
+
return void 0;
|
|
33531
|
+
}
|
|
33532
|
+
const pKey = findKey12(body, "p");
|
|
33533
|
+
if (!pKey) {
|
|
33534
|
+
return void 0;
|
|
33535
|
+
}
|
|
33536
|
+
const paragraph = body[pKey];
|
|
33537
|
+
const firstP = Array.isArray(paragraph) ? paragraph[0] : paragraph;
|
|
33538
|
+
if (!firstP || typeof firstP !== "object") {
|
|
33539
|
+
return void 0;
|
|
33540
|
+
}
|
|
33541
|
+
const rKey = findKey12(firstP, "r");
|
|
33542
|
+
if (!rKey) {
|
|
33543
|
+
return void 0;
|
|
33544
|
+
}
|
|
33545
|
+
const run = firstP[rKey];
|
|
33546
|
+
const firstR = Array.isArray(run) ? run[0] : run;
|
|
33547
|
+
if (!firstR || typeof firstR !== "object") {
|
|
33548
|
+
return void 0;
|
|
33549
|
+
}
|
|
33550
|
+
return ensureChild(firstR, "rPr", "a:rPr");
|
|
33551
|
+
}
|
|
33552
|
+
function applyRunStyle(pt2, style) {
|
|
33553
|
+
if (style.bold === void 0 && style.italic === void 0 && style.fontColor === void 0) {
|
|
33554
|
+
return;
|
|
33555
|
+
}
|
|
33556
|
+
const rPr = ensureFirstRunRPr(pt2);
|
|
33557
|
+
if (!rPr) {
|
|
33558
|
+
return;
|
|
33559
|
+
}
|
|
33560
|
+
if (style.bold !== void 0) {
|
|
33561
|
+
rPr["@_b"] = style.bold ? "1" : "0";
|
|
33562
|
+
}
|
|
33563
|
+
if (style.italic !== void 0) {
|
|
33564
|
+
rPr["@_i"] = style.italic ? "1" : "0";
|
|
33565
|
+
}
|
|
33566
|
+
if (style.fontColor !== void 0) {
|
|
33567
|
+
setSolidFill(rPr, style.fontColor);
|
|
33568
|
+
}
|
|
33569
|
+
}
|
|
33570
|
+
function applySmartArtNodeStyleToPoint(pt2, style) {
|
|
33571
|
+
if (!style || Object.keys(style).length === 0) {
|
|
33572
|
+
return;
|
|
33573
|
+
}
|
|
33574
|
+
applyShapeStyle(pt2, style);
|
|
33575
|
+
applyRunStyle(pt2, style);
|
|
33576
|
+
}
|
|
33577
|
+
|
|
33354
33578
|
// src/core/core/runtime/smartart-xml-builders.ts
|
|
33355
33579
|
var NON_CONTENT_POINT_TYPES = /* @__PURE__ */ new Set([
|
|
33356
33580
|
"doc",
|
|
@@ -33490,6 +33714,7 @@ function mergeSmartArtPointXml(existingPts, nodes) {
|
|
|
33490
33714
|
continue;
|
|
33491
33715
|
}
|
|
33492
33716
|
applyTextToExistingPoint(pt2, desired);
|
|
33717
|
+
applySmartArtNodeStyleToPoint(pt2, desired.style);
|
|
33493
33718
|
seenContentIds.add(modelId);
|
|
33494
33719
|
merged.push(pt2);
|
|
33495
33720
|
}
|
|
@@ -33503,6 +33728,7 @@ function mergeSmartArtPointXml(existingPts, nodes) {
|
|
|
33503
33728
|
ptNode["@_type"] = node.nodeType;
|
|
33504
33729
|
}
|
|
33505
33730
|
ptNode["dgm:t"] = shouldRebuildFromRuns(node) ? buildPointFromRuns(node.runs) : buildPointText(node.text);
|
|
33731
|
+
applySmartArtNodeStyleToPoint(ptNode, node.style);
|
|
33506
33732
|
merged.push(ptNode);
|
|
33507
33733
|
}
|
|
33508
33734
|
return merged;
|
|
@@ -34476,8 +34702,8 @@ var PptxHandlerRuntime27 = class extends PptxHandlerRuntime26 {
|
|
|
34476
34702
|
}
|
|
34477
34703
|
const obj = node;
|
|
34478
34704
|
for (const [key, value] of Object.entries(obj)) {
|
|
34479
|
-
const
|
|
34480
|
-
if (
|
|
34705
|
+
const localName2 = this.compatibilityService.getXmlLocalName(key);
|
|
34706
|
+
if (localName2 === "extLst" && value && typeof value === "object") {
|
|
34481
34707
|
const extLst = value;
|
|
34482
34708
|
for (const extKey of Object.keys(extLst)) {
|
|
34483
34709
|
const extLocalName = this.compatibilityService.getXmlLocalName(extKey);
|
|
@@ -36693,9 +36919,9 @@ function applyTableStyleEntryToNode(styleNode, entry) {
|
|
|
36693
36919
|
}
|
|
36694
36920
|
function applyFillToSection(styleNode, sectionKey, fill) {
|
|
36695
36921
|
const section = ensureSection(styleNode, sectionKey);
|
|
36696
|
-
const tcStyle =
|
|
36697
|
-
const fillNode =
|
|
36698
|
-
const
|
|
36922
|
+
const tcStyle = ensureChild2(section, "a:tcStyle");
|
|
36923
|
+
const fillNode = ensureChild2(tcStyle, "a:fill");
|
|
36924
|
+
const solidFill2 = ensureChild2(fillNode, "a:solidFill");
|
|
36699
36925
|
const schemeClr = { "@_val": fill.schemeColor };
|
|
36700
36926
|
if (fill.tint !== void 0) {
|
|
36701
36927
|
schemeClr["a:tint"] = { "@_val": String(fill.tint) };
|
|
@@ -36703,14 +36929,14 @@ function applyFillToSection(styleNode, sectionKey, fill) {
|
|
|
36703
36929
|
if (fill.shade !== void 0) {
|
|
36704
36930
|
schemeClr["a:shade"] = { "@_val": String(fill.shade) };
|
|
36705
36931
|
}
|
|
36706
|
-
for (const key of Object.keys(
|
|
36707
|
-
delete
|
|
36932
|
+
for (const key of Object.keys(solidFill2)) {
|
|
36933
|
+
delete solidFill2[key];
|
|
36708
36934
|
}
|
|
36709
|
-
|
|
36935
|
+
solidFill2["a:schemeClr"] = schemeClr;
|
|
36710
36936
|
}
|
|
36711
36937
|
function applyTextToSection(styleNode, sectionKey, text) {
|
|
36712
36938
|
const section = ensureSection(styleNode, sectionKey);
|
|
36713
|
-
const tcTxStyle =
|
|
36939
|
+
const tcTxStyle = ensureChild2(section, "a:tcTxStyle");
|
|
36714
36940
|
if (text.bold !== void 0) {
|
|
36715
36941
|
if (text.bold) {
|
|
36716
36942
|
tcTxStyle["@_b"] = "on";
|
|
@@ -36750,7 +36976,7 @@ function ensureSection(styleNode, sectionKey) {
|
|
|
36750
36976
|
styleNode[sectionKey] = created;
|
|
36751
36977
|
return created;
|
|
36752
36978
|
}
|
|
36753
|
-
function
|
|
36979
|
+
function ensureChild2(parent, key) {
|
|
36754
36980
|
const existing = parent[key];
|
|
36755
36981
|
if (Array.isArray(existing) && existing.length > 0) {
|
|
36756
36982
|
return existing[0];
|
|
@@ -40508,9 +40734,9 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
|
|
|
40508
40734
|
}
|
|
40509
40735
|
const bgPr = xmlChild(bg, "p:bgPr");
|
|
40510
40736
|
if (bgPr) {
|
|
40511
|
-
const
|
|
40512
|
-
if (
|
|
40513
|
-
return this.parseColor(
|
|
40737
|
+
const solidFill2 = xmlChild(bgPr, "a:solidFill");
|
|
40738
|
+
if (solidFill2) {
|
|
40739
|
+
return this.parseColor(solidFill2);
|
|
40514
40740
|
}
|
|
40515
40741
|
const pattFill = xmlChild(bgPr, "a:pattFill");
|
|
40516
40742
|
if (pattFill) {
|
|
@@ -40553,9 +40779,9 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
|
|
|
40553
40779
|
if (idx === 0) {
|
|
40554
40780
|
return void 0;
|
|
40555
40781
|
}
|
|
40556
|
-
const
|
|
40557
|
-
if (
|
|
40558
|
-
return this.parseColor(
|
|
40782
|
+
const solidFill2 = xmlChild(bgRef, "a:solidFill");
|
|
40783
|
+
if (solidFill2) {
|
|
40784
|
+
return this.parseColor(solidFill2);
|
|
40559
40785
|
}
|
|
40560
40786
|
const overrideColor = this.parseColor(bgRef);
|
|
40561
40787
|
if (this.themeFormatScheme) {
|
|
@@ -43374,7 +43600,7 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
|
|
|
43374
43600
|
partPath
|
|
43375
43601
|
};
|
|
43376
43602
|
}
|
|
43377
|
-
collectLocalTextValues(node,
|
|
43603
|
+
collectLocalTextValues(node, localName2, output) {
|
|
43378
43604
|
const MAX_NODES = 1e6;
|
|
43379
43605
|
const stack = [node];
|
|
43380
43606
|
let visited = 0;
|
|
@@ -43397,7 +43623,7 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
|
|
|
43397
43623
|
}
|
|
43398
43624
|
const objectNode = current;
|
|
43399
43625
|
for (const [key, value] of Object.entries(objectNode)) {
|
|
43400
|
-
if (this.compatibilityService.getXmlLocalName(key) ===
|
|
43626
|
+
if (this.compatibilityService.getXmlLocalName(key) === localName2) {
|
|
43401
43627
|
if (typeof value === "string" || typeof value === "number") {
|
|
43402
43628
|
const textValue = String(value).trim();
|
|
43403
43629
|
if (textValue.length > 0) {
|
|
@@ -43451,6 +43677,71 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
|
|
|
43451
43677
|
}
|
|
43452
43678
|
return runs.length > 0 ? runs : void 0;
|
|
43453
43679
|
}
|
|
43680
|
+
/**
|
|
43681
|
+
* Extract a content point's per-node visual override.
|
|
43682
|
+
*
|
|
43683
|
+
* Reads the point's presentation `spPr` solid fill and line colour, and the
|
|
43684
|
+
* first run's `rPr` bold / italic / solid fill, into a
|
|
43685
|
+
* {@link PptxSmartArtNodeStyle}. Every field is optional and only set when
|
|
43686
|
+
* present, so an unstyled point yields `undefined` (never throws on missing
|
|
43687
|
+
* structure). This lets the editing UI display the node's current colours.
|
|
43688
|
+
*/
|
|
43689
|
+
extractSmartArtNodeStyle(point) {
|
|
43690
|
+
const style = {};
|
|
43691
|
+
const spPr = this.xmlLookupService.getChildByLocalName(point, "spPr");
|
|
43692
|
+
if (spPr) {
|
|
43693
|
+
const fill = this.parseColor(this.xmlLookupService.getChildByLocalName(spPr, "solidFill"));
|
|
43694
|
+
if (fill) {
|
|
43695
|
+
style.fillColor = fill;
|
|
43696
|
+
}
|
|
43697
|
+
const ln = this.xmlLookupService.getChildByLocalName(spPr, "ln");
|
|
43698
|
+
if (ln) {
|
|
43699
|
+
const lineColor = this.parseColor(
|
|
43700
|
+
this.xmlLookupService.getChildByLocalName(ln, "solidFill")
|
|
43701
|
+
);
|
|
43702
|
+
if (lineColor) {
|
|
43703
|
+
style.lineColor = lineColor;
|
|
43704
|
+
}
|
|
43705
|
+
}
|
|
43706
|
+
}
|
|
43707
|
+
const rPr = this.firstRunProperties(point);
|
|
43708
|
+
if (rPr) {
|
|
43709
|
+
if (this.xmlBoolean(rPr["@_b"])) {
|
|
43710
|
+
style.bold = true;
|
|
43711
|
+
}
|
|
43712
|
+
if (this.xmlBoolean(rPr["@_i"])) {
|
|
43713
|
+
style.italic = true;
|
|
43714
|
+
}
|
|
43715
|
+
const fontColor = this.parseColor(
|
|
43716
|
+
this.xmlLookupService.getChildByLocalName(rPr, "solidFill")
|
|
43717
|
+
);
|
|
43718
|
+
if (fontColor) {
|
|
43719
|
+
style.fontColor = fontColor;
|
|
43720
|
+
}
|
|
43721
|
+
}
|
|
43722
|
+
return Object.keys(style).length > 0 ? style : void 0;
|
|
43723
|
+
}
|
|
43724
|
+
/** Read the first run's `rPr` of a content point's first paragraph. */
|
|
43725
|
+
firstRunProperties(point) {
|
|
43726
|
+
const tBody = this.xmlLookupService.getChildByLocalName(point, "t");
|
|
43727
|
+
if (!tBody) {
|
|
43728
|
+
return void 0;
|
|
43729
|
+
}
|
|
43730
|
+
const paragraph = this.xmlLookupService.getChildrenArrayByLocalName(tBody, "p")[0];
|
|
43731
|
+
if (!paragraph) {
|
|
43732
|
+
return void 0;
|
|
43733
|
+
}
|
|
43734
|
+
const run = this.xmlLookupService.getChildrenArrayByLocalName(paragraph, "r")[0];
|
|
43735
|
+
if (!run) {
|
|
43736
|
+
return void 0;
|
|
43737
|
+
}
|
|
43738
|
+
return this.xmlLookupService.getChildByLocalName(run, "rPr");
|
|
43739
|
+
}
|
|
43740
|
+
/** Interpret an OOXML boolean attribute ("1"/"true"/"on" => true). */
|
|
43741
|
+
xmlBoolean(value) {
|
|
43742
|
+
const v = String(value ?? "").trim().toLowerCase();
|
|
43743
|
+
return v === "1" || v === "true" || v === "on";
|
|
43744
|
+
}
|
|
43454
43745
|
/**
|
|
43455
43746
|
* Parse background and outline chrome from `dgm:bg` and `dgm:whole`.
|
|
43456
43747
|
*/
|
|
@@ -43465,8 +43756,8 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
|
|
|
43465
43756
|
}
|
|
43466
43757
|
const chrome = {};
|
|
43467
43758
|
if (bg) {
|
|
43468
|
-
const
|
|
43469
|
-
const bgColor = this.parseColor(
|
|
43759
|
+
const solidFill2 = this.xmlLookupService.getChildByLocalName(bg, "solidFill");
|
|
43760
|
+
const bgColor = this.parseColor(solidFill2);
|
|
43470
43761
|
if (bgColor) {
|
|
43471
43762
|
chrome.backgroundColor = bgColor;
|
|
43472
43763
|
}
|
|
@@ -43474,8 +43765,8 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
|
|
|
43474
43765
|
if (whole) {
|
|
43475
43766
|
const lnNode = this.xmlLookupService.getChildByLocalName(whole, "ln");
|
|
43476
43767
|
if (lnNode) {
|
|
43477
|
-
const
|
|
43478
|
-
const outlineColor = this.parseColor(
|
|
43768
|
+
const solidFill2 = this.xmlLookupService.getChildByLocalName(lnNode, "solidFill");
|
|
43769
|
+
const outlineColor = this.parseColor(solidFill2);
|
|
43479
43770
|
if (outlineColor) {
|
|
43480
43771
|
chrome.outlineColor = outlineColor;
|
|
43481
43772
|
}
|
|
@@ -43650,8 +43941,8 @@ var PptxHandlerRuntime69 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
|
|
|
43650
43941
|
const skewY = xfrm?.["@_skewY"] ? parseInt(String(xfrm["@_skewY"]), 10) / 6e4 : void 0;
|
|
43651
43942
|
const prstGeom = this.xmlLookupService.getChildByLocalName(spPr, "prstGeom");
|
|
43652
43943
|
const shapeType = prstGeom ? String(prstGeom["@_prst"] || "rect") : "rect";
|
|
43653
|
-
const
|
|
43654
|
-
const fillColor = this.parseColor(
|
|
43944
|
+
const solidFill2 = this.xmlLookupService.getChildByLocalName(spPr, "solidFill");
|
|
43945
|
+
const fillColor = this.parseColor(solidFill2);
|
|
43655
43946
|
const lnNode = this.xmlLookupService.getChildByLocalName(spPr, "ln");
|
|
43656
43947
|
const lnFill = lnNode ? this.xmlLookupService.getChildByLocalName(lnNode, "solidFill") : void 0;
|
|
43657
43948
|
const strokeColor = this.parseColor(lnFill);
|
|
@@ -43755,12 +44046,14 @@ var PptxHandlerRuntime70 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
|
|
|
43755
44046
|
return null;
|
|
43756
44047
|
}
|
|
43757
44048
|
const runs = this.extractSmartArtNodeRuns(point);
|
|
44049
|
+
const style = this.extractSmartArtNodeStyle(point);
|
|
43758
44050
|
return {
|
|
43759
44051
|
id: pointId,
|
|
43760
44052
|
text: resolvedText.trim(),
|
|
43761
44053
|
parentId: parentByNodeId.get(pointId),
|
|
43762
44054
|
nodeType,
|
|
43763
|
-
runs
|
|
44055
|
+
runs,
|
|
44056
|
+
style
|
|
43764
44057
|
};
|
|
43765
44058
|
}).filter((entry) => Boolean(entry)).slice(0, MAX_SMARTART_NODES);
|
|
43766
44059
|
if (nodes.length === 0) {
|
|
@@ -43925,10 +44218,10 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
43925
44218
|
};
|
|
43926
44219
|
const matchedKeys = [];
|
|
43927
44220
|
for (const key of Object.keys(plotArea)) {
|
|
43928
|
-
const
|
|
43929
|
-
const mapped = chartElementMap[
|
|
44221
|
+
const localName2 = this.compatibilityService.getXmlLocalName(key);
|
|
44222
|
+
const mapped = chartElementMap[localName2];
|
|
43930
44223
|
if (mapped) {
|
|
43931
|
-
matchedKeys.push(
|
|
44224
|
+
matchedKeys.push(localName2);
|
|
43932
44225
|
}
|
|
43933
44226
|
}
|
|
43934
44227
|
if (matchedKeys.length >= 2) {
|
|
@@ -43938,8 +44231,8 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
43938
44231
|
return chartElementMap[matchedKeys[0]];
|
|
43939
44232
|
}
|
|
43940
44233
|
for (const key of Object.keys(plotArea)) {
|
|
43941
|
-
const
|
|
43942
|
-
if (
|
|
44234
|
+
const localName2 = this.compatibilityService.getXmlLocalName(key);
|
|
44235
|
+
if (localName2 === "plotAreaRegion" || localName2 === "plotSurface") {
|
|
43943
44236
|
const seriesArr = this.xmlLookupService.getChildrenArrayByLocalName(
|
|
43944
44237
|
plotArea[key],
|
|
43945
44238
|
"series"
|
|
@@ -44466,8 +44759,8 @@ var PptxHandlerRuntime74 = class extends PptxHandlerRuntime73 {
|
|
|
44466
44759
|
if (key.startsWith("@_")) {
|
|
44467
44760
|
continue;
|
|
44468
44761
|
}
|
|
44469
|
-
const
|
|
44470
|
-
if (
|
|
44762
|
+
const localName2 = this.compatibilityService.getXmlLocalName(key);
|
|
44763
|
+
if (localName2 === "schemeClr") {
|
|
44471
44764
|
const items = Array.isArray(value) ? value : [value];
|
|
44472
44765
|
for (const item of items) {
|
|
44473
44766
|
const resolved = this.resolveChartSchemeColor(item);
|
|
@@ -44475,7 +44768,7 @@ var PptxHandlerRuntime74 = class extends PptxHandlerRuntime73 {
|
|
|
44475
44768
|
output.push(resolved);
|
|
44476
44769
|
}
|
|
44477
44770
|
}
|
|
44478
|
-
} else if (
|
|
44771
|
+
} else if (localName2 === "srgbClr") {
|
|
44479
44772
|
const items = Array.isArray(value) ? value : [value];
|
|
44480
44773
|
for (const item of items) {
|
|
44481
44774
|
const hex8 = String(
|
|
@@ -63910,6 +64203,7 @@ exports.createTextElement = createTextElement;
|
|
|
63910
64203
|
exports.createUniformTextSegments = createUniformTextSegments;
|
|
63911
64204
|
exports.dataUrlToMediaBytes = dataUrlToMediaBytes;
|
|
63912
64205
|
exports.decodeOle10Native = decodeOle10Native;
|
|
64206
|
+
exports.decodeXmlEntities = decodeXmlEntities;
|
|
63913
64207
|
exports.decomposeSmartArt = decomposeSmartArt;
|
|
63914
64208
|
exports.decryptPptx = decryptPptx;
|
|
63915
64209
|
exports.demoteSmartArtNode = demoteSmartArtNode;
|
|
@@ -64147,6 +64441,7 @@ exports.setChartSeriesMarker = setChartSeriesMarker;
|
|
|
64147
64441
|
exports.setChartSeriesTrendline = setChartSeriesTrendline;
|
|
64148
64442
|
exports.setChartTitle = setChartTitle;
|
|
64149
64443
|
exports.setChartType = setChartType;
|
|
64444
|
+
exports.setSmartArtNodeStyle = setSmartArtNodeStyle;
|
|
64150
64445
|
exports.shouldRenderFallbackLabel = shouldRenderFallbackLabel;
|
|
64151
64446
|
exports.shouldReturnToZoomSlide = shouldReturnToZoomSlide;
|
|
64152
64447
|
exports.subtractPolygons = subtractPolygons;
|