@aixa-transformation/pptx-viewer 2.0.29 → 2.0.31

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.
@@ -9512,11 +9512,12 @@ function colorWithOpacity(color2, opacity2) {
9512
9512
  return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${clampUnitInterval(opacity2)})`;
9513
9513
  }
9514
9514
  function parseDrawingPercent(value) {
9515
- const parsed = Number.parseFloat(String(value ?? "").trim());
9515
+ const raw = String(value ?? "").trim();
9516
+ const parsed = Number.parseFloat(raw);
9516
9517
  if (!Number.isFinite(parsed)) {
9517
9518
  return void 0;
9518
9519
  }
9519
- return clampUnitInterval(parsed / 1e5);
9520
+ return clampUnitInterval(raw.endsWith("%") ? parsed / 100 : parsed / 1e5);
9520
9521
  }
9521
9522
  function scrgbLinearToSrgb8(linear) {
9522
9523
  const l = Math.min(1, Math.max(0, linear));
@@ -9595,11 +9596,12 @@ function hslToRgb(h, s, l) {
9595
9596
  };
9596
9597
  }
9597
9598
  function parseDrawingFraction(value) {
9598
- const parsed = Number.parseFloat(String(value ?? "").trim());
9599
+ const raw = String(value ?? "").trim();
9600
+ const parsed = Number.parseFloat(raw);
9599
9601
  if (!Number.isFinite(parsed)) {
9600
9602
  return void 0;
9601
9603
  }
9602
- return parsed / 1e5;
9604
+ return raw.endsWith("%") ? parsed / 100 : parsed / 1e5;
9603
9605
  }
9604
9606
  function parseDrawingHueDegrees(value) {
9605
9607
  const parsed = Number.parseFloat(String(value ?? "").trim());
@@ -9656,9 +9658,9 @@ function applyDrawingColorTransforms(baseColor, colorNode) {
9656
9658
  }
9657
9659
  const tint = parseDrawingPercent(getVal("a:tint"));
9658
9660
  if (tint !== void 0) {
9659
- r += (255 - r) * tint;
9660
- g += (255 - g) * tint;
9661
- b += (255 - b) * tint;
9661
+ r = 255 - (255 - r) * tint;
9662
+ g = 255 - (255 - g) * tint;
9663
+ b = 255 - (255 - b) * tint;
9662
9664
  }
9663
9665
  const hslKeys = [
9664
9666
  "a:hue",
@@ -52472,6 +52474,12 @@ function applyImageColorEffects(blip, effects, parseColor, extractOpacity) {
52472
52474
  }
52473
52475
  }
52474
52476
  var EMU_PER_PX7 = 9525;
52477
+ function isSyntheticBulletMarkerSegment(segment) {
52478
+ const markerText = String(segment.text ?? "").trim();
52479
+ return Boolean(
52480
+ segment.bulletInfo && (segment.bulletInfo.char && markerText === segment.bulletInfo.char || segment.bulletInfo.autoNumType && /^\S+[.)]$/u.test(markerText) || (segment.bulletInfo.imageDataUrl || segment.bulletInfo.imageRelId) && markerText === "\u{1F4CE}")
52481
+ );
52482
+ }
52475
52483
  function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spacing, level) {
52476
52484
  const paragraphProps = {};
52477
52485
  if (typeof level === "number" && Number.isFinite(level) && level > 0) {
@@ -53426,6 +53434,14 @@ var PptxHandlerRuntime = class {
53426
53434
  }
53427
53435
  }
53428
53436
  };
53437
+ function parseOoxmlFixedPercentage(value) {
53438
+ const raw = String(value ?? "").trim();
53439
+ if (!raw) {
53440
+ return void 0;
53441
+ }
53442
+ const parsed = raw.endsWith("%") ? Number.parseFloat(raw.slice(0, -1)) * 1e3 : Number.parseInt(raw, 10);
53443
+ return Number.isFinite(parsed) && parsed !== 0 ? Math.round(parsed) : void 0;
53444
+ }
53429
53445
  var EMU_PER_PIXEL = 9525;
53430
53446
  var BORDER_SIDES = [
53431
53447
  "left",
@@ -53450,9 +53466,9 @@ function parseSolidFillStyle(solidFill2) {
53450
53466
  return void 0;
53451
53467
  }
53452
53468
  const tintRaw = schemeClr["a:tint"];
53453
- const tint = tintRaw ? parseInt(String(tintRaw["@_val"] || "0"), 10) || void 0 : void 0;
53469
+ const tint = tintRaw ? parseOoxmlFixedPercentage(tintRaw["@_val"]) : void 0;
53454
53470
  const shadeRaw = schemeClr["a:shade"];
53455
- const shade = shadeRaw ? parseInt(String(shadeRaw["@_val"] || "0"), 10) || void 0 : void 0;
53471
+ const shade = shadeRaw ? parseOoxmlFixedPercentage(shadeRaw["@_val"]) : void 0;
53456
53472
  return { schemeColor, tint, shade };
53457
53473
  }
53458
53474
  function parseBorderSide(side) {
@@ -53533,12 +53549,12 @@ function parseColorChoiceFill(node) {
53533
53549
  }
53534
53550
  const fill = { schemeColor: "", color: color2 };
53535
53551
  const tintRaw = srgb?.["a:tint"];
53536
- const tint = tintRaw ? parseInt(String(tintRaw["@_val"] || "0"), 10) || void 0 : void 0;
53552
+ const tint = tintRaw ? parseOoxmlFixedPercentage(tintRaw["@_val"]) : void 0;
53537
53553
  if (tint !== void 0) {
53538
53554
  fill.tint = tint;
53539
53555
  }
53540
53556
  const shadeRaw = srgb?.["a:shade"];
53541
- const shade = shadeRaw ? parseInt(String(shadeRaw["@_val"] || "0"), 10) || void 0 : void 0;
53557
+ const shade = shadeRaw ? parseOoxmlFixedPercentage(shadeRaw["@_val"]) : void 0;
53542
53558
  if (shade !== void 0) {
53543
53559
  fill.shade = shade;
53544
53560
  }
@@ -53659,11 +53675,11 @@ function parseTableStyleSectionText(section) {
53659
53675
  hasProps = true;
53660
53676
  const tintNode = schemeClr["a:tint"];
53661
53677
  if (tintNode) {
53662
- result.fontTint = parseInt(String(tintNode["@_val"] || "0"), 10) || void 0;
53678
+ result.fontTint = parseOoxmlFixedPercentage(tintNode["@_val"]);
53663
53679
  }
53664
53680
  const shadeNode = schemeClr["a:shade"];
53665
53681
  if (shadeNode) {
53666
- result.fontShade = parseInt(String(shadeNode["@_val"] || "0"), 10) || void 0;
53682
+ result.fontShade = parseOoxmlFixedPercentage(shadeNode["@_val"]);
53667
53683
  }
53668
53684
  }
53669
53685
  } else {
@@ -56391,6 +56407,9 @@ var PptxHandlerRuntime13 = class extends PptxHandlerRuntime12 {
56391
56407
  }
56392
56408
  capturedParagraphMeta = true;
56393
56409
  }
56410
+ if (isSyntheticBulletMarkerSegment(segment)) {
56411
+ return;
56412
+ }
56394
56413
  if (segment.isLineBreak) {
56395
56414
  const brNode = {};
56396
56415
  if (segment.breakRunProperties && typeof segment.breakRunProperties === "object") {
@@ -62440,12 +62459,16 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime7 extends PptxHandlerRuntime
62440
62459
  if (!xmlText2.trim()) {
62441
62460
  continue;
62442
62461
  }
62462
+ const isPresentationXml = path === "ppt/presentation.xml";
62463
+ const containsConvertibleUri = xmlText2.match(/https?:\/\/[^"'<>\s]+/gu)?.some((uri) => isTransitionalNamespaceUri(uri)) ?? false;
62464
+ if (!isPresentationXml && !containsConvertibleUri) {
62465
+ continue;
62466
+ }
62443
62467
  try {
62444
62468
  const parsed = parse(xmlText2);
62445
62469
  if (typeof parsed !== "object" || parsed === null) {
62446
62470
  continue;
62447
62471
  }
62448
- const isPresentationXml = path === "ppt/presentation.xml";
62449
62472
  convertXmlToStrict(parsed, isPresentationXml);
62450
62473
  this.zip.file(path, this.builder.build(parsed));
62451
62474
  } catch {
@@ -63592,7 +63615,10 @@ var PptxHandlerRuntime30 = class _PptxHandlerRuntime9 extends PptxHandlerRuntime
63592
63615
  }
63593
63616
  const textValueForSave = this.getTextValueForSave(el.text, el.textSegments);
63594
63617
  let textSegmentsForSave = el.textSegments;
63595
- if (typeof el.text === "string" && this.areTextSegmentsUniform(el.textSegments)) {
63618
+ const hasStructuredListMarkers = Boolean(
63619
+ el.textSegments?.some((segment) => segment.bulletInfo && !segment.bulletInfo.none)
63620
+ );
63621
+ if (typeof el.text === "string" && this.areTextSegmentsUniform(el.textSegments) && !hasStructuredListMarkers) {
63596
63622
  textSegmentsForSave = void 0;
63597
63623
  const existingTextSegments = this.extractTextSegmentsFromTxBodyForRewrite(
63598
63624
  txBody,
@@ -65252,7 +65278,14 @@ var PptxHandlerRuntime40 = class _PptxHandlerRuntime16 extends PptxHandlerRuntim
65252
65278
  if (el.type === "group") {
65253
65279
  const grpXml = this.buildGroupShapeXml(el);
65254
65280
  if (grpXml) {
65255
- collectors.groups.push(grpXml);
65281
+ if (this.isTemplateElementId(el.id)) {
65282
+ const templateSpTree = this.getTemplateSpTree(ctx.slide.id, el.id);
65283
+ if (templateSpTree) {
65284
+ el.rawXml = this.ensureTemplateShapeAttached(templateSpTree, el.type, grpXml);
65285
+ }
65286
+ } else {
65287
+ collectors.groups.push(grpXml);
65288
+ }
65256
65289
  }
65257
65290
  return;
65258
65291
  }
@@ -67081,11 +67114,17 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime18 extends PptxHandlerRuntim
67081
67114
  this.modernCommentAuthorsRelationshipId = modernPackage.authorRelationshipId;
67082
67115
  this.applySlideMasterChanges(options?.slideMasters);
67083
67116
  this.applySlideLayoutChanges(options?.slideLayouts);
67117
+ const dirtyLayoutPaths = new Set(options?.slideLayouts?.map((layout) => layout.path) ?? []);
67084
67118
  for (const [layoutPath, layoutXmlObj] of this.layoutXmlMap.entries()) {
67085
- this.zip.file(layoutPath, this.builder.build(layoutXmlObj));
67119
+ if (dirtyLayoutPaths.has(layoutPath)) {
67120
+ this.zip.file(layoutPath, this.builder.build(layoutXmlObj));
67121
+ }
67086
67122
  }
67123
+ const dirtyMasterPaths = new Set(options?.slideMasters?.map((master) => master.path) ?? []);
67087
67124
  for (const [masterPath, masterXmlObj] of this.masterXmlMap.entries()) {
67088
- this.zip.file(masterPath, this.builder.build(masterXmlObj));
67125
+ if (dirtyMasterPaths.has(masterPath)) {
67126
+ this.zip.file(masterPath, this.builder.build(masterXmlObj));
67127
+ }
67089
67128
  }
67090
67129
  await this.persistThemeParts();
67091
67130
  await this.applyEmbeddedFontPreservation(options?.embeddedFonts, options?.embeddedFontList);
@@ -67125,7 +67164,7 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime18 extends PptxHandlerRuntim
67125
67164
  }
67126
67165
  } : options?.presentationProperties;
67127
67166
  await this.applyPresentationPropertiesPart(presentationProperties);
67128
- await this.applyViewPropertiesPart(options?.viewProperties ?? this.loadedViewProperties);
67167
+ await this.applyViewPropertiesPart(options?.viewProperties);
67129
67168
  await this.applyTableStylesPart(options?.tableStyles);
67130
67169
  await this.documentPropertiesUpdater.updateOnSave(slides, {
67131
67170
  coreProperties: options?.coreProperties,
@@ -74571,7 +74610,9 @@ var PptxHandlerRuntime84 = class _PptxHandlerRuntime35 extends PptxHandlerRuntim
74571
74610
  const y = Math.round(parseInt(String(off["@_y"] || "0"), 10) / emuPerPx);
74572
74611
  const width = Math.round(parseInt(String(ext["@_cx"] || "0"), 10) / emuPerPx);
74573
74612
  const height = Math.round(parseInt(String(ext["@_cy"] || "0"), 10) / emuPerPx);
74574
- if (width <= 0 || height <= 0) {
74613
+ const preliminaryPrstGeom = this.xmlLookupService.getChildByLocalName(spPr, "prstGeom");
74614
+ const preliminaryShapeType = preliminaryPrstGeom ? String(preliminaryPrstGeom["@_prst"] || "rect") : "rect";
74615
+ if ((width <= 0 || height <= 0) && preliminaryShapeType !== "line") {
74575
74616
  return null;
74576
74617
  }
74577
74618
  const rotation = xfrm?.["@_rot"] ? parseInt(String(xfrm["@_rot"]), 10) / 6e4 : void 0;
@@ -74607,6 +74648,14 @@ var PptxHandlerRuntime84 = class _PptxHandlerRuntime35 extends PptxHandlerRuntim
74607
74648
  const strokeColor = this.parseColor(lnFill);
74608
74649
  const strokeWidthRaw = lnNode ? parseInt(String(lnNode["@_w"] || ""), 10) : NaN;
74609
74650
  const strokeWidth = Number.isFinite(strokeWidthRaw) && strokeWidthRaw > 0 ? strokeWidthRaw / 12700 : void 0;
74651
+ const prstDash = lnNode ? this.xmlLookupService.getChildByLocalName(lnNode, "prstDash") : void 0;
74652
+ const headEnd = lnNode ? this.xmlLookupService.getChildByLocalName(lnNode, "headEnd") : void 0;
74653
+ const tailEnd = lnNode ? this.xmlLookupService.getChildByLocalName(lnNode, "tailEnd") : void 0;
74654
+ const arrowType = (node) => {
74655
+ const value = node?.["@_type"];
74656
+ return value === "none" || value === "triangle" || value === "stealth" || value === "diamond" || value === "oval" || value === "arrow" ? value : void 0;
74657
+ };
74658
+ const arrowSize = (value) => value === "sm" || value === "med" || value === "lg" ? value : void 0;
74610
74659
  const txBody = this.xmlLookupService.getChildByLocalName(sp, "txBody");
74611
74660
  const textValues2 = [];
74612
74661
  if (txBody) {
@@ -74646,6 +74695,13 @@ var PptxHandlerRuntime84 = class _PptxHandlerRuntime35 extends PptxHandlerRuntim
74646
74695
  fillColor: fill.fillColor ?? void 0,
74647
74696
  strokeColor: strokeColor ?? void 0,
74648
74697
  strokeWidth,
74698
+ strokeDash: prstDash ? String(prstDash["@_val"] || "") || void 0 : void 0,
74699
+ startArrow: arrowType(headEnd),
74700
+ endArrow: arrowType(tailEnd),
74701
+ startArrowWidth: arrowSize(headEnd?.["@_w"]),
74702
+ startArrowLength: arrowSize(headEnd?.["@_len"]),
74703
+ endArrowWidth: arrowSize(tailEnd?.["@_w"]),
74704
+ endArrowLength: arrowSize(tailEnd?.["@_len"]),
74649
74705
  text: structuredText,
74650
74706
  textSegments,
74651
74707
  fontSize,