ooxml-core 1.40.0 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +4 -0
  2. package/dist/PptxHandler-73QIJ6SD.cjs +14 -0
  3. package/dist/{PptxHandler-2WYH66TS.mjs → PptxHandler-A2J4PCOB.mjs} +2 -2
  4. package/dist/PptxHandler-OGLVLX2T.mjs +5 -0
  5. package/dist/{PresentationBuilder-BUUVVMNI.cjs → PresentationBuilder-6S5PJXXF.cjs} +6 -6
  6. package/dist/{PresentationBuilder-VHDHLGIK.mjs → PresentationBuilder-APJKCMVS.mjs} +2 -2
  7. package/dist/{PresentationBuilder-RTHLLHLE.mjs → PresentationBuilder-F3BWDERK.mjs} +3 -3
  8. package/dist/automation/index.cjs +5322 -3452
  9. package/dist/automation/index.mjs +5322 -3452
  10. package/dist/chart/index.cjs +5 -5
  11. package/dist/chart/index.mjs +5 -5
  12. package/dist/{chunk-EXSPNK6W.cjs → chunk-3J6VIKLP.cjs} +3 -3
  13. package/dist/chunk-CODMW5KF.cjs +110 -0
  14. package/dist/{chunk-3E4GSBC7.mjs → chunk-CPSTCCRD.mjs} +4 -4
  15. package/dist/{chunk-6XAAJTA3.mjs → chunk-IPV3J3I5.mjs} +4925 -3049
  16. package/dist/{chunk-HLBIT5H4.mjs → chunk-MXA67O7R.mjs} +1 -1
  17. package/dist/{chunk-OGD5OQK2.mjs → chunk-N6X5CJZP.mjs} +6723 -4840
  18. package/dist/chunk-O3YGBYGZ.mjs +104 -0
  19. package/dist/{chunk-SEGPDD5W.cjs → chunk-QZPOPUI5.cjs} +4925 -3048
  20. package/dist/{chunk-5BVSDSJZ.mjs → chunk-VKFKEVHK.mjs} +1 -1
  21. package/dist/{chunk-AZNF3IOI.mjs → chunk-VV724DWE.mjs} +87 -11
  22. package/dist/{chunk-NHV47JOE.mjs → chunk-XVB3CBNM.mjs} +53 -9
  23. package/dist/{chunk-U6FMLGWH.cjs → chunk-YNQRXFTC.cjs} +1317 -1273
  24. package/dist/{chunk-725QJW4K.mjs → chunk-ZUEN4RQG.mjs} +1 -1
  25. package/dist/color/index.cjs +36 -0
  26. package/dist/color/index.d.ts +1 -0
  27. package/dist/color/index.d.ts.map +1 -1
  28. package/dist/color/index.mjs +35 -1
  29. package/dist/color/office-gradient-stops.d.ts +27 -0
  30. package/dist/color/office-gradient-stops.d.ts.map +1 -0
  31. package/dist/diagram/index.cjs +5223 -3170
  32. package/dist/diagram/index.d.ts +1 -0
  33. package/dist/diagram/index.d.ts.map +1 -1
  34. package/dist/diagram/index.mjs +5218 -3171
  35. package/dist/docx/embedded.cjs +4862 -3000
  36. package/dist/docx/embedded.mjs +4862 -3000
  37. package/dist/docx/index.cjs +4970 -3072
  38. package/dist/docx/index.mjs +4970 -3072
  39. package/dist/docx/layout/index.cjs +4952 -3054
  40. package/dist/docx/layout/index.mjs +4952 -3054
  41. package/dist/docx/load/index.cjs +4999 -3137
  42. package/dist/docx/load/index.mjs +4999 -3137
  43. package/dist/docx/shape-svg.d.ts.map +1 -1
  44. package/dist/docx/ui/index.cjs +4907 -3045
  45. package/dist/docx/ui/index.mjs +4907 -3045
  46. package/dist/drawingml/dash-pattern.d.ts +61 -0
  47. package/dist/drawingml/dash-pattern.d.ts.map +1 -0
  48. package/dist/drawingml/index.cjs +319 -53
  49. package/dist/drawingml/index.d.ts +3 -0
  50. package/dist/drawingml/index.d.ts.map +1 -1
  51. package/dist/drawingml/index.mjs +310 -54
  52. package/dist/drawingml/path-data.d.ts.map +1 -1
  53. package/dist/drawingml/rect-path-gradient.d.ts +17 -0
  54. package/dist/drawingml/rect-path-gradient.d.ts.map +1 -1
  55. package/dist/drawingml/shape-path-gradient.d.ts +57 -0
  56. package/dist/drawingml/shape-path-gradient.d.ts.map +1 -0
  57. package/dist/geometry/index.cjs +4117 -2254
  58. package/dist/geometry/index.mjs +4117 -2255
  59. package/dist/geometry/ooxml-arc.d.ts +10 -1
  60. package/dist/geometry/ooxml-arc.d.ts.map +1 -1
  61. package/dist/geometry/preset-shape-definitions-action-buttons.d.ts +7 -36
  62. package/dist/geometry/preset-shape-definitions-action-buttons.d.ts.map +1 -1
  63. package/dist/geometry/preset-shape-definitions-connectors-brackets.d.ts.map +1 -1
  64. package/dist/geometry/preset-shape-definitions-exact-action-buttons.d.ts +19 -0
  65. package/dist/geometry/preset-shape-definitions-exact-action-buttons.d.ts.map +1 -0
  66. package/dist/geometry/preset-shape-definitions-exact-arcs.d.ts +14 -0
  67. package/dist/geometry/preset-shape-definitions-exact-arcs.d.ts.map +1 -0
  68. package/dist/geometry/preset-shape-definitions-exact-arrows.d.ts +11 -0
  69. package/dist/geometry/preset-shape-definitions-exact-arrows.d.ts.map +1 -0
  70. package/dist/geometry/preset-shape-definitions-exact-basic.d.ts +12 -0
  71. package/dist/geometry/preset-shape-definitions-exact-basic.d.ts.map +1 -0
  72. package/dist/geometry/preset-shape-definitions-exact-circular.d.ts +18 -0
  73. package/dist/geometry/preset-shape-definitions-exact-circular.d.ts.map +1 -0
  74. package/dist/geometry/preset-shape-definitions-exact-ellipse-ribbons.d.ts +16 -0
  75. package/dist/geometry/preset-shape-definitions-exact-ellipse-ribbons.d.ts.map +1 -0
  76. package/dist/geometry/preset-shape-definitions-exact-funnel.d.ts +13 -0
  77. package/dist/geometry/preset-shape-definitions-exact-funnel.d.ts.map +1 -0
  78. package/dist/geometry/preset-shape-definitions-exact-left-right-ribbon.d.ts +13 -0
  79. package/dist/geometry/preset-shape-definitions-exact-left-right-ribbon.d.ts.map +1 -0
  80. package/dist/geometry/preset-shape-definitions-exact-math.d.ts +14 -0
  81. package/dist/geometry/preset-shape-definitions-exact-math.d.ts.map +1 -0
  82. package/dist/geometry/preset-shape-definitions-exact-misc.d.ts +11 -0
  83. package/dist/geometry/preset-shape-definitions-exact-misc.d.ts.map +1 -0
  84. package/dist/geometry/preset-shape-definitions-exact-ribbons.d.ts +12 -0
  85. package/dist/geometry/preset-shape-definitions-exact-ribbons.d.ts.map +1 -0
  86. package/dist/geometry/preset-shape-definitions-exact-scrolls.d.ts +13 -0
  87. package/dist/geometry/preset-shape-definitions-exact-scrolls.d.ts.map +1 -0
  88. package/dist/geometry/preset-shape-definitions-flowchart.d.ts.map +1 -1
  89. package/dist/geometry/preset-shape-definitions-misc.d.ts.map +1 -1
  90. package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
  91. package/dist/geometry/preset-shape-exact-dsl.d.ts +30 -0
  92. package/dist/geometry/preset-shape-exact-dsl.d.ts.map +1 -0
  93. package/dist/index.cjs +7637 -5216
  94. package/dist/index.mjs +7637 -5216
  95. package/dist/pptx/automation/index.cjs +5683 -3508
  96. package/dist/pptx/automation/index.d.ts +11 -17
  97. package/dist/pptx/automation/index.d.ts.map +1 -1
  98. package/dist/pptx/automation/index.mjs +156 -71
  99. package/dist/pptx/chunks/{elements-DheCTwi0.d.ts → elements-PBugbKtv.d.ts} +3 -848
  100. package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +1 -0
  101. package/dist/pptx/chunks/{index-Jcce8TlI.d.ts → index-BJuR8GLL.d.ts} +4 -4
  102. package/dist/pptx/chunks/{index-Jcce8TlI.d.ts.map → index-BJuR8GLL.d.ts.map} +1 -1
  103. package/dist/pptx/chunks/{index-CYukxWbl.d.ts → index-Rbvl2WaM.d.ts} +32 -13
  104. package/dist/pptx/chunks/index-Rbvl2WaM.d.ts.map +1 -0
  105. package/dist/pptx/chunks/{index-B4ofjG6_.d.ts → index-xoJGYTgQ.d.ts} +5 -3
  106. package/dist/pptx/chunks/index-xoJGYTgQ.d.ts.map +1 -0
  107. package/dist/pptx/chunks/table-C7ITXL3Y.d.ts +875 -0
  108. package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +1 -0
  109. package/dist/pptx/chunks/{text-operations-CdgEnFuK.d.ts → text-operations-BNJr7aGa.d.ts} +3 -2
  110. package/dist/pptx/chunks/text-operations-BNJr7aGa.d.ts.map +1 -0
  111. package/dist/pptx/cli/index.cjs +5419 -3335
  112. package/dist/pptx/cli/index.d.ts +1 -1
  113. package/dist/pptx/cli/index.mjs +4 -4
  114. package/dist/pptx/converter/index.cjs +4936 -2978
  115. package/dist/pptx/converter/index.d.ts +1 -1
  116. package/dist/pptx/converter/index.mjs +2 -2
  117. package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
  118. package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
  119. package/dist/pptx/editor/render/find-replace.cjs +15 -15
  120. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  121. package/dist/pptx/editor/render/find-replace.mjs +2 -2
  122. package/dist/pptx/editor/render/slide-operations.cjs +9 -9
  123. package/dist/pptx/editor/render/slide-operations.mjs +3 -3
  124. package/dist/pptx/editor/render/table-data-grid-ops.cjs +5 -5
  125. package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
  126. package/dist/pptx/editor/render/table-layout.cjs +6 -6
  127. package/dist/pptx/editor/render/table-layout.d.ts +8 -37
  128. package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
  129. package/dist/pptx/editor/render/table-layout.mjs +1 -1
  130. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  131. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  132. package/dist/pptx/index.cjs +7298 -5162
  133. package/dist/pptx/index.d.ts +7 -6
  134. package/dist/pptx/index.mjs +5 -5
  135. package/dist/pptx/node/index.d.ts +1 -1
  136. package/dist/teams/index.cjs +5332 -3307
  137. package/dist/teams/index.mjs +5332 -3307
  138. package/dist/text/font-metrics/design-advances.generated.d.ts +3 -1
  139. package/dist/text/font-metrics/design-advances.generated.d.ts.map +1 -1
  140. package/dist/text/font-metrics/office-font-metrics.generated.d.ts +23 -0
  141. package/dist/text/font-metrics/office-font-metrics.generated.d.ts.map +1 -0
  142. package/dist/text/font-metrics/vertical-metrics.d.ts +35 -0
  143. package/dist/text/font-metrics/vertical-metrics.d.ts.map +1 -0
  144. package/dist/text/index.cjs +268 -0
  145. package/dist/text/index.d.ts +1 -0
  146. package/dist/text/index.d.ts.map +1 -1
  147. package/dist/text/index.mjs +267 -1
  148. package/dist/visio/index.cjs +8 -0
  149. package/dist/visio/index.mjs +8 -0
  150. package/dist/visio/ui/index.cjs +8 -0
  151. package/dist/visio/ui/index.mjs +8 -0
  152. package/dist/xlsx/collab/index.cjs +5084 -3222
  153. package/dist/xlsx/collab/index.mjs +5084 -3222
  154. package/dist/xlsx/index.cjs +5298 -3404
  155. package/dist/xlsx/index.mjs +5298 -3404
  156. package/dist/xlsx/layout/shape-paint.d.ts.map +1 -1
  157. package/dist/xlsx/load/index.cjs +5103 -3241
  158. package/dist/xlsx/load/index.mjs +5103 -3241
  159. package/dist/xlsx/ui/index.cjs +5261 -3399
  160. package/dist/xlsx/ui/index.mjs +5261 -3399
  161. package/package.json +1 -1
  162. package/dist/PptxHandler-SD6VWF3I.mjs +0 -5
  163. package/dist/PptxHandler-ZHWWOO2X.cjs +0 -14
  164. package/dist/chunk-3IT6ZD7K.mjs +0 -213
  165. package/dist/chunk-FRUB573B.cjs +0 -219
  166. package/dist/pptx/chunks/elements-DheCTwi0.d.ts.map +0 -1
  167. package/dist/pptx/chunks/index-B4ofjG6_.d.ts.map +0 -1
  168. package/dist/pptx/chunks/index-CYukxWbl.d.ts.map +0 -1
  169. package/dist/pptx/chunks/text-operations-CdgEnFuK.d.ts.map +0 -1
@@ -282,7 +282,7 @@ function linearToSrgb255(linear) {
282
282
  function orderedColorTransforms(channels, transforms) {
283
283
  let { r, g, b } = channels;
284
284
  let alpha = 1;
285
- const wrap = (value) => (value % 360 + 360) % 360;
285
+ const wrap2 = (value) => (value % 360 + 360) % 360;
286
286
  for (const transform of transforms) {
287
287
  const { name, value } = transform;
288
288
  const fraction = parseDrawingFraction(value);
@@ -300,14 +300,14 @@ function orderedColorTransforms(channels, transforms) {
300
300
  [r, g, b] = [mix(r), mix(g), mix(b)];
301
301
  } else {
302
302
  const hsl = rgbToHsl(r, g, b);
303
- if (name === "comp") hsl.h = wrap(hsl.h + 180);
303
+ if (name === "comp") hsl.h = wrap2(hsl.h + 180);
304
304
  else if (name === "hue") {
305
305
  const hue = parseDrawingHueDegrees(value);
306
- if (hue !== void 0) hsl.h = wrap(hue);
306
+ if (hue !== void 0) hsl.h = wrap2(hue);
307
307
  } else if (name === "hueOff") {
308
308
  const hue = parseDrawingHueDegrees(value);
309
- if (hue !== void 0) hsl.h = wrap(hsl.h + hue);
310
- } else if (name === "hueMod" && fraction !== void 0) hsl.h = wrap(hsl.h * fraction);
309
+ if (hue !== void 0) hsl.h = wrap2(hsl.h + hue);
310
+ } else if (name === "hueMod" && fraction !== void 0) hsl.h = wrap2(hsl.h * fraction);
311
311
  else if (name === "sat" && fraction !== void 0) hsl.s = clampUnitInterval(fraction);
312
312
  else if (name === "satMod" && fraction !== void 0) hsl.s *= fraction;
313
313
  else if (name === "satOff" && fraction !== void 0)
@@ -465,13 +465,13 @@ function resolveDrawingColor(color, theme, options) {
465
465
  }
466
466
  if (["hue", "hueMod", "hueOff", "sat", "satMod", "satOff", "lum", "lumMod", "lumOff"].some(has)) {
467
467
  const hsl = rgbToHsl(r, g, b);
468
- const wrap = (degrees) => (degrees % 360 + 360) % 360;
468
+ const wrap2 = (degrees) => (degrees % 360 + 360) % 360;
469
469
  const hueAbs = parseDrawingHueDegrees(find("hue"));
470
- if (hueAbs !== void 0) hsl.h = wrap(hueAbs);
470
+ if (hueAbs !== void 0) hsl.h = wrap2(hueAbs);
471
471
  const hueMod = parseDrawingFraction(find("hueMod"));
472
- if (hueMod !== void 0) hsl.h = wrap(hsl.h * hueMod);
472
+ if (hueMod !== void 0) hsl.h = wrap2(hsl.h * hueMod);
473
473
  const hueOff = parseDrawingHueDegrees(find("hueOff"));
474
- if (hueOff !== void 0) hsl.h = wrap(hsl.h + hueOff);
474
+ if (hueOff !== void 0) hsl.h = wrap2(hsl.h + hueOff);
475
475
  const satAbs = parseDrawingFraction(find("sat"));
476
476
  if (satAbs !== void 0) hsl.s = clampUnitInterval(satAbs);
477
477
  const satMod = parseDrawingFraction(find("satMod"));
@@ -584,12 +584,12 @@ function parseArtisticPictureExtension(node) {
584
584
  const key = ARTISTIC_PRIMARY_ATTRIBUTE[effect.localName];
585
585
  if (!key) return void 0;
586
586
  const raw = key ? effect.getAttribute(key) : null;
587
- const n = raw === null ? 0 : Number(raw);
588
- if (!Number.isFinite(n)) return void 0;
587
+ const n2 = raw === null ? 0 : Number(raw);
588
+ if (!Number.isFinite(n2)) return void 0;
589
589
  return {
590
590
  kind: "artistic",
591
591
  name: effect.localName,
592
- radius: effect.localName === "artisticBlur" ? n : n / 1e3,
592
+ radius: effect.localName === "artisticBlur" ? n2 : n2 / 1e3,
593
593
  baked: true,
594
594
  ...unhandled.length ? { unhandled } : {}
595
595
  };
@@ -701,10 +701,10 @@ function parseStandardPictureEffect(node) {
701
701
  const raw = node.getAttribute(attribute);
702
702
  if (raw === null) continue;
703
703
  const percent = raw.endsWith("%");
704
- const n = Number(percent ? raw.slice(0, -1) : raw) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
705
- if (!Number.isFinite(n) || key === "hue" && (n < 0 || n >= 360) || key === "threshold" && (n < 0 || n > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n) || n < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n < (name === "alphaRepl" ? 0 : -1) || n > 1))
704
+ const n2 = Number(percent ? raw.slice(0, -1) : raw) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
705
+ if (!Number.isFinite(n2) || key === "hue" && (n2 < 0 || n2 >= 360) || key === "threshold" && (n2 < 0 || n2 > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n2) || n2 < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n2 < (name === "alphaRepl" ? 0 : -1) || n2 > 1))
706
706
  return void 0;
707
- values[key] = n;
707
+ values[key] = n2;
708
708
  }
709
709
  if (["biLevel", "alphaBiLevel"].includes(name) && values.threshold === void 0)
710
710
  return void 0;
@@ -714,9 +714,9 @@ function parseStandardPictureEffect(node) {
714
714
  const nested = cont ? elements(cont) : [];
715
715
  if (nested.length !== 1 || nested[0]?.localName !== "alphaModFix") return void 0;
716
716
  const raw = nested[0].getAttribute("amt") ?? "100000";
717
- const n = Number(raw.endsWith("%") ? raw.slice(0, -1) : raw) / (raw.endsWith("%") ? 100 : 1e5);
718
- if (!Number.isFinite(n) || n < 0) return void 0;
719
- values.amount = n;
717
+ const n2 = Number(raw.endsWith("%") ? raw.slice(0, -1) : raw) / (raw.endsWith("%") ? 100 : 1e5);
718
+ if (!Number.isFinite(n2) || n2 < 0) return void 0;
719
+ values.amount = n2;
720
720
  }
721
721
  let colors = [];
722
722
  if (name === "duotone") {
@@ -812,8 +812,8 @@ function picturePercentage(value) {
812
812
  const text = String(value ?? "").trim();
813
813
  if (!text) return void 0;
814
814
  const percent = text.endsWith("%");
815
- const n = Number(percent ? text.slice(0, -1) : text) / (percent ? 100 : 1e5);
816
- return Number.isFinite(n) ? n : void 0;
815
+ const n2 = Number(percent ? text.slice(0, -1) : text) / (percent ? 100 : 1e5);
816
+ return Number.isFinite(n2) ? n2 : void 0;
817
817
  }
818
818
  function readPictureEffect(name, attribute) {
819
819
  if (name === "grayscl") return { kind: "grayscale" };
@@ -973,16 +973,16 @@ function parsePictureLayout(fill) {
973
973
  ["scaleX", "sx"],
974
974
  ["scaleY", "sy"]
975
975
  ]) {
976
- const n = picturePercentage(tile.getAttribute(attr));
977
- if (n !== void 0) value[key] = n;
976
+ const n2 = picturePercentage(tile.getAttribute(attr));
977
+ if (n2 !== void 0) value[key] = n2;
978
978
  }
979
979
  for (const [key, attr] of [
980
980
  ["offsetXEmu", "tx"],
981
981
  ["offsetYEmu", "ty"]
982
982
  ]) {
983
983
  const raw = tile.getAttribute(attr);
984
- const n = raw === null ? NaN : Number(raw);
985
- if (Number.isSafeInteger(n)) value[key] = n;
984
+ const n2 = raw === null ? NaN : Number(raw);
985
+ if (Number.isSafeInteger(n2)) value[key] = n2;
986
986
  }
987
987
  const alignment = tile.getAttribute("algn");
988
988
  if (alignment) value.alignment = alignment;
@@ -1037,14 +1037,14 @@ function applyPictureLayout(fill, layout) {
1037
1037
  ["offsetXEmu", "tx"],
1038
1038
  ["offsetYEmu", "ty"]
1039
1039
  ]) {
1040
- const n = layout.tile[key];
1041
- if (n !== void 0 && (!Number.isFinite(n) || (name === "sx" || name === "sy" ? n <= 0 : !Number.isSafeInteger(n))))
1040
+ const n2 = layout.tile[key];
1041
+ if (n2 !== void 0 && (!Number.isFinite(n2) || (name === "sx" || name === "sy" ? n2 <= 0 : !Number.isSafeInteger(n2))))
1042
1042
  throw new RangeError("Invalid picture tile");
1043
- if (n !== before.tile?.[key])
1043
+ if (n2 !== before.tile?.[key])
1044
1044
  attr(
1045
1045
  tile,
1046
1046
  name,
1047
- n === void 0 ? void 0 : Math.round(n * (name === "sx" || name === "sy" ? 1e5 : 1)),
1047
+ n2 === void 0 ? void 0 : Math.round(n2 * (name === "sx" || name === "sy" ? 1e5 : 1)),
1048
1048
  void 0
1049
1049
  );
1050
1050
  }
@@ -1061,11 +1061,11 @@ function applyPictureLayout(fill, layout) {
1061
1061
  if (tile) fill.removeChild(tile);
1062
1062
  const rect = make(make(fill, "stretch"), "fillRect");
1063
1063
  for (const key of ["l", "t", "r", "b"]) {
1064
- const n = layout.fillRect?.[key];
1065
- if (n !== void 0 && !Number.isFinite(n))
1064
+ const n2 = layout.fillRect?.[key];
1065
+ if (n2 !== void 0 && !Number.isFinite(n2))
1066
1066
  throw new RangeError("Invalid picture fill rectangle");
1067
- if (n !== before.fillRect?.[key])
1068
- attr(rect, key, n === void 0 ? void 0 : Math.round(n * 1e5), void 0);
1067
+ if (n2 !== before.fillRect?.[key])
1068
+ attr(rect, key, n2 === void 0 ? void 0 : Math.round(n2 * 1e5), void 0);
1069
1069
  }
1070
1070
  }
1071
1071
  }
@@ -1618,7 +1618,7 @@ function parseCustomGeometry(custom, width, height) {
1618
1618
  }
1619
1619
  const pathWidth = path.hasAttribute("w") ? Number(path.getAttribute("w")) : contextWidth;
1620
1620
  const pathHeight = path.hasAttribute("h") ? Number(path.getAttribute("h")) : contextHeight;
1621
- if (![pathWidth, pathHeight].every((n) => Number.isFinite(n) && n > 0)) return void 0;
1621
+ if (![pathWidth, pathHeight].every((n2) => Number.isFinite(n2) && n2 > 0)) return void 0;
1622
1622
  paths.push({
1623
1623
  commands,
1624
1624
  width: pathWidth,
@@ -2793,7 +2793,7 @@ function lerpStops(a, b, t) {
2793
2793
  opacity: oa + (ob - oa) * t
2794
2794
  };
2795
2795
  }
2796
- function colorAt(stops, position) {
2796
+ function gradientColorAt(stops, position) {
2797
2797
  const first2 = stops[0];
2798
2798
  const last = stops[stops.length - 1];
2799
2799
  if (position <= first2.position) {
@@ -2855,7 +2855,7 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
2855
2855
  if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
2856
2856
  for (let i = bands; i >= 0; i -= 1) {
2857
2857
  const t = i / bands;
2858
- const { color, opacity } = colorAt(sorted, t * 100);
2858
+ const { color, opacity } = gradientColorAt(sorted, t * 100);
2859
2859
  const left = lerpEdge(inner.left, 0, t);
2860
2860
  const top = lerpEdge(inner.top, 0, t);
2861
2861
  const right = lerpEdge(inner.right, 100, t);
@@ -2874,9 +2874,194 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
2874
2874
  const paint = masked ? `<defs><mask id="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100" mask-type="luminance" color-interpolation="sRGB">${alphaRects.join("")}</mask></defs><g mask="url(#alpha)">${rects.join("")}</g>` : rects.join("");
2875
2875
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">${paint}</svg>`;
2876
2876
  }
2877
+ function buildRectPathGradientExactSvg(stops, focalPoint, fillToRect) {
2878
+ if (stops.length === 0) {
2879
+ return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
2880
+ }
2881
+ const sorted = [...stops].sort((a, b) => a.position - b.position);
2882
+ const { left, top, right, bottom } = resolveInnerRect(fillToRect, focalPoint);
2883
+ const n2 = (value) => String(Math.round(value * 1e3) / 1e3);
2884
+ const alpha = (opacity, attr) => (opacity ?? 1) < 1 ? ` ${attr}="${n2(Math.max(0, opacity ?? 1))}"` : "";
2885
+ const stopMarkup = sorted.map(
2886
+ (stop) => `<stop offset="${n2(Math.min(Math.max(stop.position, 0), 100) / 100)}" stop-color="${stop.color}"${alpha(stop.opacity, "stop-opacity")}/>`
2887
+ ).join("");
2888
+ const sides = [
2889
+ { id: "t", pts: [0, 0, 100, 0, right, top, left, top], v: [0, top, 0, 0], size: top },
2890
+ {
2891
+ id: "b",
2892
+ pts: [0, 100, 100, 100, right, bottom, left, bottom],
2893
+ v: [0, bottom, 0, 100],
2894
+ size: 100 - bottom
2895
+ },
2896
+ { id: "l", pts: [0, 0, left, top, left, bottom, 0, 100], v: [left, 0, 0, 0], size: left },
2897
+ {
2898
+ id: "r",
2899
+ pts: [100, 0, right, top, right, bottom, 100, 100],
2900
+ v: [right, 0, 100, 0],
2901
+ size: 100 - right
2902
+ }
2903
+ ].filter((side) => side.size > 1e-3);
2904
+ const defs = sides.map(
2905
+ (side) => `<linearGradient id="${side.id}" gradientUnits="userSpaceOnUse" x1="${n2(side.v[0])}" y1="${n2(side.v[1])}" x2="${n2(side.v[2])}" y2="${n2(side.v[3])}">${stopMarkup}</linearGradient>`
2906
+ ).join("");
2907
+ const polygons = sides.map((side) => {
2908
+ const points = side.pts.map(n2);
2909
+ const pairs = [0, 2, 4, 6].map((i) => `${points[i]},${points[i + 1]}`).join(" ");
2910
+ return `<polygon points="${pairs}" fill="url(#${side.id})"/>`;
2911
+ }).join("");
2912
+ const first2 = sorted[0];
2913
+ const plateau = right - left > 1e-3 && bottom - top > 1e-3 ? `<rect x="${n2(left)}" y="${n2(top)}" width="${n2(right - left)}" height="${n2(bottom - top)}" fill="${first2.color}"${alpha(first2.opacity, "fill-opacity")}/>` : "";
2914
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none" shape-rendering="crispEdges"><defs>${defs}</defs>${polygons}${plateau}</svg>`;
2915
+ }
2877
2916
  function buildRectPathGradientImage(stops, focalPoint, fillToRect) {
2878
- const markup = buildRectPathGradientSvg(stops, focalPoint, fillToRect);
2879
- return `url("data:image/svg+xml,${encodeURIComponent(markup)}")`;
2917
+ const markup = buildRectPathGradientExactSvg(stops, focalPoint, fillToRect);
2918
+ return `url("data:image/svg+xml,${encodeURIComponent(markup).replace(/[()]/gu, (c) => c === "(" ? "%28" : "%29")}")`;
2919
+ }
2920
+
2921
+ // drawingml/shape-path-gradient.ts
2922
+ var CIRCLE_FIELD_PRESETS = new Set(
2923
+ [
2924
+ "chevron",
2925
+ "rightArrow",
2926
+ "leftArrow",
2927
+ "upArrow",
2928
+ "downArrow",
2929
+ "stripedRightArrow",
2930
+ "notchedRightArrow",
2931
+ "bentUpArrow",
2932
+ "bentArrow",
2933
+ "uturnArrow",
2934
+ "leftRightArrow",
2935
+ "upDownArrow",
2936
+ "leftUpArrow",
2937
+ "leftRightUpArrow",
2938
+ "quadArrow",
2939
+ "curvedRightArrow",
2940
+ "curvedLeftArrow",
2941
+ "curvedUpArrow",
2942
+ "curvedDownArrow",
2943
+ "swooshArrow",
2944
+ "lightningBolt",
2945
+ "sun",
2946
+ "moon",
2947
+ "smileyFace",
2948
+ "ribbon",
2949
+ "ribbon2",
2950
+ "ellipseRibbon",
2951
+ "ellipseRibbon2",
2952
+ "leftRightRibbon",
2953
+ "verticalScroll",
2954
+ "horizontalScroll",
2955
+ "wave",
2956
+ "doubleWave",
2957
+ "flowChartDocument",
2958
+ "flowChartMultidocument",
2959
+ "flowChartPunchedTape",
2960
+ "flowChartMagneticDisk",
2961
+ "flowChartDisplay"
2962
+ ].map((name) => name.toLowerCase())
2963
+ );
2964
+ var LEGACY_FIELD_PRESETS = new Set(
2965
+ [
2966
+ "donut",
2967
+ "noSmoking",
2968
+ "blockArc",
2969
+ "frame",
2970
+ "chord",
2971
+ "funnel",
2972
+ "mathDivide",
2973
+ "mathNotEqual",
2974
+ "cornerTabs",
2975
+ "squareTabs",
2976
+ "plaqueTabs",
2977
+ "circularArrow",
2978
+ "leftCircularArrow",
2979
+ "leftRightCircularArrow",
2980
+ "flowChartMagneticTape",
2981
+ "flowChartMagneticDrum"
2982
+ ].map((name) => name.toLowerCase())
2983
+ );
2984
+ function shapePathGradientField(preset) {
2985
+ if (!preset || preset === "custom") return "circle";
2986
+ const key = preset.toLowerCase();
2987
+ if (CIRCLE_FIELD_PRESETS.has(key)) return "circle";
2988
+ if (LEGACY_FIELD_PRESETS.has(key)) return "legacy";
2989
+ return "outline";
2990
+ }
2991
+ var BAND_COUNT2 = 100;
2992
+ function n(value) {
2993
+ return String(Math.round(value * 1e3) / 1e3);
2994
+ }
2995
+ var ARG_COUNT = { M: 2, L: 2, Q: 4, C: 6, A: 7, Z: 0 };
2996
+ function scalePathAbout(d, s, fx, fy) {
2997
+ const tokens = d.match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gu);
2998
+ if (!tokens) return void 0;
2999
+ const out = [];
3000
+ let i = 0;
3001
+ while (i < tokens.length) {
3002
+ const command = tokens[i++];
3003
+ const count = ARG_COUNT[command];
3004
+ if (count === void 0) return void 0;
3005
+ out.push(command);
3006
+ if (command === "Z") continue;
3007
+ const args = tokens.slice(i, i + count).map(Number);
3008
+ i += count;
3009
+ if (args.length !== count || args.some((value) => !Number.isFinite(value))) return void 0;
3010
+ if (command === "A") {
3011
+ out.push(
3012
+ n(args[0] * s),
3013
+ n(args[1] * s),
3014
+ n(args[2]),
3015
+ n(args[3]),
3016
+ n(args[4]),
3017
+ n(fx + (args[5] - fx) * s),
3018
+ n(fy + (args[6] - fy) * s)
3019
+ );
3020
+ continue;
3021
+ }
3022
+ for (let k = 0; k < count; k += 2) {
3023
+ out.push(n(fx + (args[k] - fx) * s), n(fy + (args[k + 1] - fy) * s));
3024
+ }
3025
+ }
3026
+ return out.join(" ");
3027
+ }
3028
+ function closedSubpaths(d) {
3029
+ const parts = d.split(/(?=M)/u).map((part) => part.trim()).filter((part) => part.endsWith("Z"));
3030
+ return parts.length > 0 ? parts.join(" ") : void 0;
3031
+ }
3032
+ function buildOutlinePathGradientSvg(stops, d, width, height, focusX, focusY) {
3033
+ if (stops.length === 0 || !(width > 0) || !(height > 0)) return void 0;
3034
+ if (scalePathAbout(d, 1, 0, 0) === void 0) return void 0;
3035
+ const sorted = [...stops].sort((a, b) => a.position - b.position);
3036
+ const fx = focusX * width;
3037
+ const fy = focusY * height;
3038
+ const translucent = sorted.some((stop) => (stop.opacity ?? 1) < 1);
3039
+ const body = [];
3040
+ if (translucent) {
3041
+ for (let i = BAND_COUNT2; i >= 1; i -= 1) {
3042
+ const outer = scalePathAbout(d, i / BAND_COUNT2, fx, fy);
3043
+ if (outer === void 0) return void 0;
3044
+ const inner = i > 1 ? scalePathAbout(d, (i - 1) / BAND_COUNT2, fx, fy) : void 0;
3045
+ const { color, opacity } = gradientColorAt(sorted, (i - 0.5) / BAND_COUNT2 * 100);
3046
+ const alpha = opacity < 1 ? ` fill-opacity="${n(Math.max(0, opacity))}"` : "";
3047
+ body.push(
3048
+ `<path d="${outer}${inner ? ` ${inner}` : ""}" fill="${color}"${alpha} fill-rule="evenodd"/>`
3049
+ );
3050
+ }
3051
+ return wrap(width, height, body.join(""));
3052
+ }
3053
+ body.push(`<defs><path id="p" d="${d}"/></defs>`);
3054
+ for (let i = BAND_COUNT2; i >= 1; i -= 1) {
3055
+ const s = i / BAND_COUNT2;
3056
+ const { color } = gradientColorAt(sorted, (i - 0.5) / BAND_COUNT2 * 100);
3057
+ body.push(
3058
+ `<use href="#p" transform="matrix(${n(s)} 0 0 ${n(s)} ${n(fx * (1 - s))} ${n(fy * (1 - s))})" fill="${color}"/>`
3059
+ );
3060
+ }
3061
+ return wrap(width, height, body.join(""));
3062
+ }
3063
+ function wrap(width, height, body) {
3064
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${n(width)} ${n(height)}" preserveAspectRatio="none">${body}</svg>`;
2880
3065
  }
2881
3066
 
2882
3067
  // drawingml/theme.ts
@@ -3360,8 +3545,8 @@ var LIGHT_DIRECTIONS = /* @__PURE__ */ new Set(["tl", "t", "tr", "l", "r", "bl",
3360
3545
  // drawingml/read-3d-values.ts
3361
3546
  var integer = (value) => {
3362
3547
  if (value === void 0 || value === null || String(value).trim() === "") return void 0;
3363
- const n = Number(value);
3364
- return Number.isSafeInteger(n) ? n : void 0;
3548
+ const n2 = Number(value);
3549
+ return Number.isSafeInteger(n2) ? n2 : void 0;
3365
3550
  };
3366
3551
  function readScene3DValues(node, read) {
3367
3552
  const out = {};
@@ -4228,7 +4413,10 @@ function drawingRichTextBodyXml(body, qualifiedName = "a:txBody", namespace = NS
4228
4413
  }
4229
4414
 
4230
4415
  // geometry/ooxml-arc.ts
4231
- function ooxmlArcToSvg(wR, hR, stAng, swAng, penX, penY) {
4416
+ function visualToParametric(visual, wR, hR) {
4417
+ return Math.atan2(wR * Math.sin(visual), hR * Math.cos(visual));
4418
+ }
4419
+ function ooxmlArcToSvg(wR, hR, stAng, swAng, penX, penY, scaleX = 1, scaleY = 1, parametric = false) {
4232
4420
  if (![wR, hR, stAng, swAng, penX, penY].every(Number.isFinite) || wR <= 0 || hR <= 0 || swAng === 0) {
4233
4421
  return null;
4234
4422
  }
@@ -4240,7 +4428,7 @@ function ooxmlArcToSvg(wR, hR, stAng, swAng, penX, penY) {
4240
4428
  let angle = stAng;
4241
4429
  const commands = [];
4242
4430
  for (let index = 0; index < pieces; index++) {
4243
- const part = ooxmlArcToSvg(wR, hR, angle, sweep2 / pieces, x, y);
4431
+ const part = ooxmlArcToSvg(wR, hR, angle, sweep2 / pieces, x, y, scaleX, scaleY, parametric);
4244
4432
  commands.push(part.svg);
4245
4433
  x = part.endX;
4246
4434
  y = part.endY;
@@ -4248,17 +4436,32 @@ function ooxmlArcToSvg(wR, hR, stAng, swAng, penX, penY) {
4248
4436
  }
4249
4437
  return { svg: commands.join(" "), endX: x, endY: y };
4250
4438
  }
4251
- const startRad = angleToRadians(stAng);
4252
- const sweepRad = angleToRadians(swAng);
4253
- const endRad = startRad + sweepRad;
4254
- const cx = penX - wR * Math.cos(startRad);
4255
- const cy = penY - hR * Math.sin(startRad);
4256
- const endX = cx + wR * Math.cos(endRad);
4257
- const endY = cy + hR * Math.sin(endRad);
4439
+ const visualStart = angleToRadians(stAng);
4440
+ const visualSweep = angleToRadians(swAng);
4441
+ let startRad = visualStart;
4442
+ let endRad = visualStart + visualSweep;
4443
+ if (!parametric) {
4444
+ startRad = visualToParametric(visualStart, wR, hR);
4445
+ endRad = visualToParametric(visualStart + visualSweep, wR, hR);
4446
+ const direction = Math.sign(swAng);
4447
+ while ((endRad - startRad) * direction < 0) {
4448
+ endRad += direction * 2 * Math.PI;
4449
+ }
4450
+ while (Math.abs(endRad - startRad) > Math.abs(visualSweep) + Math.PI) {
4451
+ endRad -= direction * 2 * Math.PI;
4452
+ }
4453
+ }
4454
+ const sweepRad = endRad - startRad;
4455
+ const outWR = wR * scaleX;
4456
+ const outHR = hR * scaleY;
4457
+ const cx = penX - outWR * Math.cos(startRad);
4458
+ const cy = penY - outHR * Math.sin(startRad);
4459
+ const endX = cx + outWR * Math.cos(endRad);
4460
+ const endY = cy + outHR * Math.sin(endRad);
4258
4461
  const largeArc = Math.abs(sweepRad) > Math.PI ? 1 : 0;
4259
4462
  const sweep = sweepRad > 0 ? 1 : 0;
4260
- const rx = Math.round(wR * 1e3) / 1e3;
4261
- const ry = Math.round(hR * 1e3) / 1e3;
4463
+ const rx = Math.round(outWR * 1e3) / 1e3;
4464
+ const ry = Math.round(outHR * 1e3) / 1e3;
4262
4465
  const ex = Math.round(endX * 1e3) / 1e3;
4263
4466
  const ey = Math.round(endY * 1e3) / 1e3;
4264
4467
  return {
@@ -4280,12 +4483,14 @@ function drawingPathData(path, width, height) {
4280
4483
  for (const command of path.commands) {
4281
4484
  if (command.op === "A") {
4282
4485
  const arc = ooxmlArcToSvg(
4283
- command.wR * sx,
4284
- command.hR * sy,
4486
+ command.wR,
4487
+ command.hR,
4285
4488
  command.startAngle * 6e4,
4286
4489
  command.swingAngle * 6e4,
4287
4490
  px,
4288
- py
4491
+ py,
4492
+ sx,
4493
+ sy
4289
4494
  );
4290
4495
  if (arc) {
4291
4496
  out.push(arc.svg);
@@ -4564,4 +4769,55 @@ function applyPictureHslPixels(data, effect) {
4564
4769
  }
4565
4770
  }
4566
4771
 
4567
- export { ARTISTIC_PRIMARY_ATTRIBUTE, BODY_PROPERTIES_ORDER, DEFAULT_THEME_COLOR_MAP, DOM_3D_READER, OFFICE_GRADIENT_PRESETS, PARAGRAPH_PROPERTIES_ORDER, RASTER_IMAGE_LIMITS, RECT_GRADIENT_DIRECTIONS, RUN_PROPERTIES_ORDER, RasterImageError, THEME_COLOR_SLOTS, applyPictureCrop, applyPictureEffects, applyPictureHslPixels, applyPictureLayout, applyStandardPictureEffect, attributeReader, booleanAttribute, buildImageBiLevelTable, buildImageLuminanceTransfer, buildRectPathGradientImage, buildRectPathGradientSvg, descendants, drawingColorBrightness, drawingColorCss, drawingColorXml, drawingDashLength, drawingEffectXml, drawingEffectsXml, drawingFillXml, drawingLineXml, drawingParagraphPropertiesXml, drawingParagraphText, drawingPathData, drawingRichTextBodyXml, drawingRunPropertiesXml, drawingThemeFormatSchemeXml, drawingThemeXml, fillElementOf, imageContentType, inspectRasterImage, integerAttribute, isThemeColorSlot, officeGradientPresetFill, officeGradientPresetId, orderedColorTransforms, parseArtisticPictureExtension, parseCustomGeometry, parseDrawingBodyProperties, parseDrawingColor, parseDrawingColorIn, parseDrawingColorList, parseDrawingEffect, parseDrawingEffects, parseDrawingFill, parseDrawingFlatText3D, parseDrawingFont, parseDrawingGeometry, parseDrawingHyperlink, parseDrawingLine, parseDrawingListStyle, parseDrawingParagraph, parseDrawingParagraphProperties, parseDrawingPictureFill, parseDrawingRichTextBody, parseDrawingRunProperties, parseDrawingTextBody, parseDrawingTextScene3D, parseDrawingTextShape3D, parseDrawingTextSpacing, parseFrame, parsePictureCrop, parsePictureEffects, parsePictureLayout, parseStandardPictureEffect, parseTheme, parseThemeColorMap, parseThemeColorScheme, parseThemeFontScheme, parseThemeFormatScheme, parseThemeXml, parseTransform, patchDrawingColorIn, patchDrawingEffects, patchDrawingLine, patchPictureEffects, pictureLuminanceTransfer, picturePercentage, readPictureEffect, rectGradientDirection, rectGradientFocus, resolveDrawingColor, resolveDrawingOuterShadow, resolveDrawingShadow, resolveDrawingShadowXml, resolveSchemeColor, resolveThemeEffectStyle, resolveThemeFillStyle, resolveThemeLineStyle, setDrawingFillXml, stringAttribute, substituteDrawingPlaceholder, svgDropShadowElement, themeColorSlotFor, themeDrawingColorTheme, themeSlotHex, withDrawingColorBrightness, withDrawingGradientGeometry, writeDrawingBodyProperties, writeDrawingFlatText3D, writeDrawingFont, writeDrawingListStyle, writeDrawingParagraph, writeDrawingParagraphProperties, writeDrawingRichTextBody, writeDrawingRunProperties, writeDrawingTextScene3D, writeDrawingTextShape3D, writeDrawingTextSpacing };
4772
+ // drawingml/dash-pattern.ts
4773
+ var PRESET_PATTERNS = {
4774
+ dash: [4, 3],
4775
+ dot: [1, 3],
4776
+ lgDash: [8, 3],
4777
+ dashDot: [4, 3, 1, 3],
4778
+ lgDashDot: [8, 3, 1, 3],
4779
+ lgDashDotDot: [8, 3, 1, 3, 1, 3],
4780
+ sysDash: [3, 1],
4781
+ sysDot: [1, 1],
4782
+ sysDashDot: [3, 1, 1, 1],
4783
+ sysDashDotDot: [3, 1, 1, 1, 1, 1]
4784
+ };
4785
+ var CUSTOM_DASH_UNIT = 1e5;
4786
+ var FALLBACK_CUSTOM_PATTERN = [3, 2];
4787
+ function dashPenWidth(strokeWidth) {
4788
+ if (!Number.isFinite(strokeWidth) || strokeWidth <= 1) return 1;
4789
+ return Math.max(1, Math.ceil(strokeWidth - 0.5));
4790
+ }
4791
+ function dashPatternUnits(dashType, customSegments) {
4792
+ if (!dashType || dashType === "solid") return void 0;
4793
+ if (dashType === "custom") {
4794
+ const pattern = (customSegments ?? []).flatMap((seg) => [
4795
+ Math.max(0, seg.dash) / CUSTOM_DASH_UNIT,
4796
+ Math.max(0, seg.space) / CUSTOM_DASH_UNIT
4797
+ ]);
4798
+ return pattern.some((n2) => n2 > 0) ? pattern : FALLBACK_CUSTOM_PATTERN;
4799
+ }
4800
+ return PRESET_PATTERNS[dashType];
4801
+ }
4802
+ function isDashedStroke(dashType) {
4803
+ return dashType !== void 0 && dashType !== "solid" && dashType !== "";
4804
+ }
4805
+ function capCompensatedDashArray(pattern, strokeWidth, lineCap) {
4806
+ const pen = dashPenWidth(strokeWidth);
4807
+ const round = lineCap === "rnd";
4808
+ const out = [];
4809
+ for (let i = 0; i < pattern.length; i += 1) {
4810
+ const len = (pattern[i] ?? 0) * pen;
4811
+ if (!round) {
4812
+ out.push(len);
4813
+ } else if (i % 2 === 0) {
4814
+ out.push(Math.max(0, len - pen));
4815
+ } else {
4816
+ const dash = (pattern[i - 1] ?? 0) * pen;
4817
+ out.push(len + (dash - Math.max(0, dash - pen)));
4818
+ }
4819
+ }
4820
+ return out.map((n2) => Number(n2.toFixed(4))).join(" ");
4821
+ }
4822
+
4823
+ export { ARTISTIC_PRIMARY_ATTRIBUTE, BODY_PROPERTIES_ORDER, DEFAULT_THEME_COLOR_MAP, DOM_3D_READER, OFFICE_GRADIENT_PRESETS, PARAGRAPH_PROPERTIES_ORDER, RASTER_IMAGE_LIMITS, RECT_GRADIENT_DIRECTIONS, RUN_PROPERTIES_ORDER, RasterImageError, THEME_COLOR_SLOTS, applyPictureCrop, applyPictureEffects, applyPictureHslPixels, applyPictureLayout, applyStandardPictureEffect, attributeReader, booleanAttribute, buildImageBiLevelTable, buildImageLuminanceTransfer, buildOutlinePathGradientSvg, buildRectPathGradientExactSvg, buildRectPathGradientImage, buildRectPathGradientSvg, capCompensatedDashArray, closedSubpaths, dashPatternUnits, dashPenWidth, descendants, drawingColorBrightness, drawingColorCss, drawingColorXml, drawingDashLength, drawingEffectXml, drawingEffectsXml, drawingFillXml, drawingLineXml, drawingParagraphPropertiesXml, drawingParagraphText, drawingPathData, drawingRichTextBodyXml, drawingRunPropertiesXml, drawingThemeFormatSchemeXml, drawingThemeXml, fillElementOf, gradientColorAt, imageContentType, inspectRasterImage, integerAttribute, isDashedStroke, isThemeColorSlot, officeGradientPresetFill, officeGradientPresetId, orderedColorTransforms, parseArtisticPictureExtension, parseCustomGeometry, parseDrawingBodyProperties, parseDrawingColor, parseDrawingColorIn, parseDrawingColorList, parseDrawingEffect, parseDrawingEffects, parseDrawingFill, parseDrawingFlatText3D, parseDrawingFont, parseDrawingGeometry, parseDrawingHyperlink, parseDrawingLine, parseDrawingListStyle, parseDrawingParagraph, parseDrawingParagraphProperties, parseDrawingPictureFill, parseDrawingRichTextBody, parseDrawingRunProperties, parseDrawingTextBody, parseDrawingTextScene3D, parseDrawingTextShape3D, parseDrawingTextSpacing, parseFrame, parsePictureCrop, parsePictureEffects, parsePictureLayout, parseStandardPictureEffect, parseTheme, parseThemeColorMap, parseThemeColorScheme, parseThemeFontScheme, parseThemeFormatScheme, parseThemeXml, parseTransform, patchDrawingColorIn, patchDrawingEffects, patchDrawingLine, patchPictureEffects, pictureLuminanceTransfer, picturePercentage, readPictureEffect, rectGradientDirection, rectGradientFocus, resolveDrawingColor, resolveDrawingOuterShadow, resolveDrawingShadow, resolveDrawingShadowXml, resolveSchemeColor, resolveThemeEffectStyle, resolveThemeFillStyle, resolveThemeLineStyle, scalePathAbout, setDrawingFillXml, shapePathGradientField, stringAttribute, substituteDrawingPlaceholder, svgDropShadowElement, themeColorSlotFor, themeDrawingColorTheme, themeSlotHex, withDrawingColorBrightness, withDrawingGradientGeometry, writeDrawingBodyProperties, writeDrawingFlatText3D, writeDrawingFont, writeDrawingListStyle, writeDrawingParagraph, writeDrawingParagraphProperties, writeDrawingRichTextBody, writeDrawingRunProperties, writeDrawingTextScene3D, writeDrawingTextShape3D, writeDrawingTextSpacing };
@@ -1 +1 @@
1
- {"version":3,"file":"path-data.d.ts","sourceRoot":"","sources":["../../drawingml/path-data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CA4CxF"}
1
+ {"version":3,"file":"path-data.d.ts","sourceRoot":"","sources":["../../drawingml/path-data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CA8CxF"}
@@ -16,6 +16,11 @@ export interface RectPathGradientFillToRect {
16
16
  r: number;
17
17
  b: number;
18
18
  }
19
+ /** Colour + opacity at a given position (0-100) along a sorted, non-empty stop list. */
20
+ export declare function gradientColorAt(stops: RectPathGradientStop[], position: number): {
21
+ color: string;
22
+ opacity: number;
23
+ };
19
24
  /**
20
25
  * Builds the raw SVG markup for the nested-rectangle band approximation, in a
21
26
  * normalised 0-100 viewBox. Exported mainly so tests can inspect the actual
@@ -26,6 +31,18 @@ export declare function buildRectPathGradientSvg(stops: RectPathGradientStop[],
26
31
  bands: number;
27
32
  independentOpacity?: boolean;
28
33
  }): string;
34
+ /**
35
+ * The exact rectangular field, without banding: four trapezoids (top, bottom,
36
+ * left, right) split along the diagonals joining the inner target rectangle to
37
+ * the box corners, each filled with a plain `linearGradient` across its band,
38
+ * plus the flat inner rectangle. That is precisely the Chebyshev distance field
39
+ * PowerPoint paints, so it is smooth at any size where
40
+ * {@link buildRectPathGradientSvg}'s bands step by a few levels. SVG blends
41
+ * stops straight (not premultiplied), which is also how Office blends alpha.
42
+ * Edges are not anti-aliased: both sides of a diagonal carry the same colour,
43
+ * and anti-aliasing there would let the backdrop leak through the seam.
44
+ */
45
+ export declare function buildRectPathGradientExactSvg(stops: RectPathGradientStop[], focalPoint?: RectPathGradientFocalPoint, fillToRect?: RectPathGradientFillToRect): string;
29
46
  /**
30
47
  * Builds the `background-image: url(...)` CSS value for a `path="rect"`
31
48
  * gradient fill. Pair with `background-size: 100% 100%` and
@@ -1 +1 @@
1
- {"version":3,"file":"rect-path-gradient.d.ts","sourceRoot":"","sources":["../../drawingml/rect-path-gradient.ts"],"names":[],"mappings":"AA6CA,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uFAAuF;AACvF,MAAM,WAAW,0BAA0B;IAC1C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAED,0DAA0D;AAC1D,MAAM,WAAW,0BAA0B;IAC1C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AA6HD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,oBAAoB,EAAE,EAC7B,UAAU,CAAC,EAAE,0BAA0B,EACvC,UAAU,CAAC,EAAE,0BAA0B,EACvC,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GACvD,MAAM,CA6CR;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,oBAAoB,EAAE,EAC7B,UAAU,CAAC,EAAE,0BAA0B,EACvC,UAAU,CAAC,EAAE,0BAA0B,GACrC,MAAM,CAGR"}
1
+ {"version":3,"file":"rect-path-gradient.d.ts","sourceRoot":"","sources":["../../drawingml/rect-path-gradient.ts"],"names":[],"mappings":"AA6CA,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uFAAuF;AACvF,MAAM,WAAW,0BAA0B;IAC1C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAED,0DAA0D;AAC1D,MAAM,WAAW,0BAA0B;IAC1C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAyCD,wFAAwF;AACxF,wBAAgB,eAAe,CAC9B,KAAK,EAAE,oBAAoB,EAAE,EAC7B,QAAQ,EAAE,MAAM,GACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAmBpC;AA6DD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,oBAAoB,EAAE,EAC7B,UAAU,CAAC,EAAE,0BAA0B,EACvC,UAAU,CAAC,EAAE,0BAA0B,EACvC,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GACvD,MAAM,CA6CR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,oBAAoB,EAAE,EAC7B,UAAU,CAAC,EAAE,0BAA0B,EACvC,UAAU,CAAC,EAAE,0BAA0B,GACrC,MAAM,CAoDR;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,oBAAoB,EAAE,EAC7B,UAAU,CAAC,EAAE,0BAA0B,EACvC,UAAU,CAAC,EAAE,0BAA0B,GACrC,MAAM,CAGR"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * `a:gradFill/a:path@path="shape"`: what PowerPoint paints, measured on
3
+ * PowerPoint 16 (`Slide.Export`, white to black, inverted through the sigma
4
+ * curve to a position field and compared with candidate fields on 130 presets
5
+ * and two freeforms).
6
+ *
7
+ * The field is not a distance to the outline. Position 0 sits at the focus
8
+ * (the centre of `a:fillToRect`) and position 1 on the outline, along every
9
+ * ray from the focus, so the iso-lines are the outline scaled about the focus
10
+ * (`t = |p - f| / |b(p) - f|`, `b(p)` where the ray leaves the shape). The
11
+ * mean absolute position error against PowerPoint is 0.002 to 0.008 for the
12
+ * ellipse, triangles, stars, rounded rectangles, hexagon and the like, with
13
+ * the focus at the centre or off it (even outside the shape).
14
+ *
15
+ * Two families do not follow it: every block arrow, the chevron, the swoosh,
16
+ * the lightning bolt, sun, moon, ribbons, scrolls, waves, a few flow chart
17
+ * symbols and the smiley face, plus any freeform (`a:custGeom`), paint a true
18
+ * circle to the farthest corner of the box, exactly as `path="circle"` does
19
+ * (error 0.001 to 0.005). The ring-shaped presets (donut, frame, block arc, ...)
20
+ * match neither and keep their approximation.
21
+ *
22
+ * The scaled outline is drawn as nested copies of the outline, largest first,
23
+ * each filled with the colour at the middle of its band, so the markup is plain
24
+ * SVG that renders in any `background-image`, raster export or older browser.
25
+ * A stop with alpha is drawn as rings (an outer copy with the next copy cut out
26
+ * by the even-odd rule) so the layers do not stack.
27
+ *
28
+ * @module shape-path-gradient
29
+ */
30
+ import { type RectPathGradientStop } from './rect-path-gradient.js';
31
+ /** How a `path="shape"` gradient is painted on a given geometry. */
32
+ export type ShapePathField = 'outline' | 'circle' | 'legacy';
33
+ /**
34
+ * Which field a `path="shape"` gradient paints on `preset`. Pass `undefined`
35
+ * for a freeform (`a:custGeom`), which always paints the circle.
36
+ */
37
+ export declare function shapePathGradientField(preset: string | undefined): ShapePathField;
38
+ /**
39
+ * Scales an absolute SVG path (`M L Q C A Z`) about `(fx, fy)`. Returns
40
+ * `undefined` for any other command, so the caller can fall back.
41
+ */
42
+ export declare function scalePathAbout(d: string, s: number, fx: number, fy: number): string | undefined;
43
+ /**
44
+ * The closed subpaths of `d` (the evaluator appends open stroke-only lines,
45
+ * such as a flow chart's inner bars, to the same path), joined, or `undefined`
46
+ * when there is none.
47
+ */
48
+ export declare function closedSubpaths(d: string): string | undefined;
49
+ /**
50
+ * The scaled-outline field as a self-contained SVG (viewBox in the shape's own
51
+ * pixels, `preserveAspectRatio="none"`): `d` is the outline in a
52
+ * `width` x `height` box and `(focusX, focusY)` the focus as fractions of it.
53
+ * Returns `undefined` when the outline cannot be scaled (an unsupported path
54
+ * command or no stops).
55
+ */
56
+ export declare function buildOutlinePathGradientSvg(stops: readonly RectPathGradientStop[], d: string, width: number, height: number, focusX: number, focusY: number): string | undefined;
57
+ //# sourceMappingURL=shape-path-gradient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape-path-gradient.d.ts","sourceRoot":"","sources":["../../drawingml/shape-path-gradient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAElF,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAoE7D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAMjF;AAWD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiC/F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM5D;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,SAAS,oBAAoB,EAAE,EACtC,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CA8BpB"}