ooxml-core 1.41.0 → 1.43.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 (166) hide show
  1. package/README.md +4 -0
  2. package/dist/{PptxHandler-3AGIITR7.mjs → PptxHandler-3VAVJDFB.mjs} +2 -2
  3. package/dist/PptxHandler-V23RDNEX.cjs +14 -0
  4. package/dist/PptxHandler-WB3KL2WH.mjs +5 -0
  5. package/dist/{PresentationBuilder-JNID4B4Z.mjs → PresentationBuilder-7LJMTRJ6.mjs} +2 -2
  6. package/dist/{PresentationBuilder-MZBKYOYD.cjs → PresentationBuilder-KHL6GONR.cjs} +6 -6
  7. package/dist/{PresentationBuilder-5DPKFUXP.mjs → PresentationBuilder-PY2GB4IG.mjs} +3 -3
  8. package/dist/automation/index.cjs +79 -91
  9. package/dist/automation/index.mjs +79 -91
  10. package/dist/chart/index.cjs +12 -9
  11. package/dist/chart/index.mjs +12 -9
  12. package/dist/{chunk-ZYCBJKAE.mjs → chunk-243ZYX2B.mjs} +1 -1
  13. package/dist/{chunk-LRBWCRQ3.cjs → chunk-3J6VIKLP.cjs} +3 -3
  14. package/dist/{chunk-DD7COXWR.mjs → chunk-4LEVL6ZW.mjs} +30 -13
  15. package/dist/chunk-CODMW5KF.cjs +110 -0
  16. package/dist/{chunk-HTELXT2N.mjs → chunk-HLYOHD2Z.mjs} +30 -12
  17. package/dist/{chunk-P3WAKBVS.mjs → chunk-IPV3J3I5.mjs} +82 -90
  18. package/dist/{chunk-6LGRRQ3K.mjs → chunk-JHYU7HGG.mjs} +1 -1
  19. package/dist/{chunk-JXR6YWBW.mjs → chunk-KCDLTVUI.mjs} +125 -126
  20. package/dist/chunk-O3YGBYGZ.mjs +104 -0
  21. package/dist/{chunk-75KBNUKS.cjs → chunk-QZPOPUI5.cjs} +82 -89
  22. package/dist/{chunk-3BIFRTU4.cjs → chunk-RNZQ2OU4.cjs} +1294 -1276
  23. package/dist/{chunk-UE23HF2N.mjs → chunk-VKFKEVHK.mjs} +1 -1
  24. package/dist/{chunk-KKVD3R6O.mjs → chunk-WEAWSXUX.mjs} +4 -4
  25. package/dist/diagram/index.cjs +499 -370
  26. package/dist/diagram/index.d.ts +1 -0
  27. package/dist/diagram/index.d.ts.map +1 -1
  28. package/dist/diagram/index.mjs +495 -371
  29. package/dist/docx/embedded.cjs +67 -89
  30. package/dist/docx/embedded.mjs +67 -89
  31. package/dist/docx/index.cjs +125 -110
  32. package/dist/docx/index.mjs +125 -110
  33. package/dist/docx/layout/index.cjs +257 -110
  34. package/dist/docx/layout/index.d.ts +1 -0
  35. package/dist/docx/layout/index.d.ts.map +1 -1
  36. package/dist/docx/layout/index.mjs +257 -111
  37. package/dist/docx/layout/webfont-runs.d.ts +5 -0
  38. package/dist/docx/layout/webfont-runs.d.ts.map +1 -0
  39. package/dist/docx/load/index.cjs +67 -89
  40. package/dist/docx/load/index.mjs +67 -89
  41. package/dist/docx/shape-svg.d.ts.map +1 -1
  42. package/dist/docx/ui/index.cjs +79 -98
  43. package/dist/docx/ui/index.mjs +79 -98
  44. package/dist/drawingml/dash-pattern.d.ts +61 -0
  45. package/dist/drawingml/dash-pattern.d.ts.map +1 -0
  46. package/dist/drawingml/index.cjs +249 -43
  47. package/dist/drawingml/index.d.ts +3 -0
  48. package/dist/drawingml/index.d.ts.map +1 -1
  49. package/dist/drawingml/index.mjs +241 -44
  50. package/dist/drawingml/rect-path-gradient.d.ts +5 -0
  51. package/dist/drawingml/rect-path-gradient.d.ts.map +1 -1
  52. package/dist/drawingml/shape-path-gradient.d.ts +57 -0
  53. package/dist/drawingml/shape-path-gradient.d.ts.map +1 -0
  54. package/dist/geometry/index.cjs +68 -90
  55. package/dist/geometry/index.mjs +68 -90
  56. package/dist/geometry/preset-shape-definitions-exact-action-buttons.d.ts +2 -2
  57. package/dist/geometry/preset-shape-definitions-exact-action-buttons.d.ts.map +1 -1
  58. package/dist/geometry/preset-shape-definitions-exact-arrows.d.ts.map +1 -1
  59. package/dist/geometry/preset-shape-definitions-exact-scrolls.d.ts.map +1 -1
  60. package/dist/index.cjs +2937 -493
  61. package/dist/index.mjs +2937 -493
  62. package/dist/pptx/automation/index.cjs +366 -197
  63. package/dist/pptx/automation/index.d.ts +11 -17
  64. package/dist/pptx/automation/index.d.ts.map +1 -1
  65. package/dist/pptx/automation/index.mjs +156 -71
  66. package/dist/pptx/chunks/{elements-6BMEOo7i.d.ts → elements-PBugbKtv.d.ts} +3 -873
  67. package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +1 -0
  68. package/dist/pptx/chunks/{index-BbXLv6As.d.ts → index-Bj-hur0D.d.ts} +4 -4
  69. package/dist/pptx/chunks/{index-BbXLv6As.d.ts.map → index-Bj-hur0D.d.ts.map} +1 -1
  70. package/dist/pptx/chunks/{index-DvN0TkJJ.d.ts → index-CCJiD-Bm.d.ts} +14 -10
  71. package/dist/pptx/chunks/index-CCJiD-Bm.d.ts.map +1 -0
  72. package/dist/pptx/chunks/{index-Dija_Wth.d.ts → index-CGNb1TV9.d.ts} +22 -4
  73. package/dist/pptx/chunks/index-CGNb1TV9.d.ts.map +1 -0
  74. package/dist/pptx/chunks/table-C7ITXL3Y.d.ts +875 -0
  75. package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +1 -0
  76. package/dist/pptx/chunks/{text-operations-DorONr3h.d.ts → text-operations-BNJr7aGa.d.ts} +3 -2
  77. package/dist/pptx/chunks/text-operations-BNJr7aGa.d.ts.map +1 -0
  78. package/dist/pptx/cli/index.cjs +180 -102
  79. package/dist/pptx/cli/index.d.ts +1 -1
  80. package/dist/pptx/cli/index.mjs +4 -4
  81. package/dist/pptx/converter/index.cjs +69 -91
  82. package/dist/pptx/converter/index.d.ts +1 -1
  83. package/dist/pptx/converter/index.mjs +2 -2
  84. package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
  85. package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
  86. package/dist/pptx/editor/render/find-replace.cjs +15 -15
  87. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  88. package/dist/pptx/editor/render/find-replace.mjs +2 -2
  89. package/dist/pptx/editor/render/slide-operations.cjs +9 -9
  90. package/dist/pptx/editor/render/slide-operations.mjs +3 -3
  91. package/dist/pptx/editor/render/table-data-grid-ops.cjs +5 -5
  92. package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
  93. package/dist/pptx/editor/render/table-layout.cjs +6 -6
  94. package/dist/pptx/editor/render/table-layout.d.ts +8 -37
  95. package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
  96. package/dist/pptx/editor/render/table-layout.mjs +1 -1
  97. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  98. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  99. package/dist/pptx/index.cjs +225 -135
  100. package/dist/pptx/index.d.ts +6 -5
  101. package/dist/pptx/index.mjs +5 -5
  102. package/dist/pptx/node/index.d.ts +1 -1
  103. package/dist/teams/index.cjs +136 -91
  104. package/dist/teams/index.mjs +136 -91
  105. package/dist/text/css-font-family.d.ts.map +1 -1
  106. package/dist/text/font-metrics/design-advances.generated.d.ts +3 -1
  107. package/dist/text/font-metrics/design-advances.generated.d.ts.map +1 -1
  108. package/dist/text/index.cjs +2252 -0
  109. package/dist/text/index.d.ts +1 -0
  110. package/dist/text/index.d.ts.map +1 -1
  111. package/dist/text/index.mjs +2231 -1
  112. package/dist/text/metric-font-family.d.ts.map +1 -1
  113. package/dist/text/webfonts/font-weight-names.d.ts +66 -0
  114. package/dist/text/webfonts/font-weight-names.d.ts.map +1 -0
  115. package/dist/text/webfonts/google-fonts-catalogue.d.ts +14 -0
  116. package/dist/text/webfonts/google-fonts-catalogue.d.ts.map +1 -0
  117. package/dist/text/webfonts/google-fonts-lookup.d.ts +7 -0
  118. package/dist/text/webfonts/google-fonts-lookup.d.ts.map +1 -0
  119. package/dist/text/webfonts/google-fonts-request.d.ts +57 -0
  120. package/dist/text/webfonts/google-fonts-request.d.ts.map +1 -0
  121. package/dist/text/webfonts/index.d.ts +12 -0
  122. package/dist/text/webfonts/index.d.ts.map +1 -0
  123. package/dist/text/webfonts/metric-clones.d.ts +17 -0
  124. package/dist/text/webfonts/metric-clones.d.ts.map +1 -0
  125. package/dist/text/webfonts/webfont-faces.d.ts +24 -0
  126. package/dist/text/webfonts/webfont-faces.d.ts.map +1 -0
  127. package/dist/visio/index.cjs +64 -0
  128. package/dist/visio/index.d.ts +1 -0
  129. package/dist/visio/index.d.ts.map +1 -1
  130. package/dist/visio/index.mjs +64 -1
  131. package/dist/visio/ui/index.cjs +8 -0
  132. package/dist/visio/ui/index.mjs +8 -0
  133. package/dist/visio/webfont-runs.d.ts +27 -0
  134. package/dist/visio/webfont-runs.d.ts.map +1 -0
  135. package/dist/xlsx/collab/index.cjs +67 -89
  136. package/dist/xlsx/collab/index.mjs +67 -89
  137. package/dist/xlsx/index.cjs +2253 -118
  138. package/dist/xlsx/index.mjs +2249 -119
  139. package/dist/xlsx/layout/font-stack.d.ts +8 -0
  140. package/dist/xlsx/layout/font-stack.d.ts.map +1 -0
  141. package/dist/xlsx/layout/index.d.ts +3 -1
  142. package/dist/xlsx/layout/index.d.ts.map +1 -1
  143. package/dist/xlsx/layout/shape-paint.d.ts.map +1 -1
  144. package/dist/xlsx/layout/shape-view.d.ts.map +1 -1
  145. package/dist/xlsx/layout/style-view.d.ts +2 -0
  146. package/dist/xlsx/layout/style-view.d.ts.map +1 -1
  147. package/dist/xlsx/layout/webfont-runs.d.ts +11 -0
  148. package/dist/xlsx/layout/webfont-runs.d.ts.map +1 -0
  149. package/dist/xlsx/load/index.cjs +67 -89
  150. package/dist/xlsx/load/index.mjs +67 -89
  151. package/dist/xlsx/ui/commands/util.d.ts.map +1 -1
  152. package/dist/xlsx/ui/context.d.ts +5 -0
  153. package/dist/xlsx/ui/context.d.ts.map +1 -1
  154. package/dist/xlsx/ui/grid/cell-paint.d.ts +3 -2
  155. package/dist/xlsx/ui/grid/cell-paint.d.ts.map +1 -1
  156. package/dist/xlsx/ui/index.cjs +2093 -102
  157. package/dist/xlsx/ui/index.mjs +2093 -103
  158. package/package.json +1 -1
  159. package/dist/PptxHandler-EL4E4SPH.mjs +0 -5
  160. package/dist/PptxHandler-OIZ3R3DJ.cjs +0 -14
  161. package/dist/chunk-3IT6ZD7K.mjs +0 -213
  162. package/dist/chunk-FRUB573B.cjs +0 -219
  163. package/dist/pptx/chunks/elements-6BMEOo7i.d.ts.map +0 -1
  164. package/dist/pptx/chunks/index-Dija_Wth.d.ts.map +0 -1
  165. package/dist/pptx/chunks/index-DvN0TkJJ.d.ts.map +0 -1
  166. package/dist/pptx/chunks/text-operations-DorONr3h.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);
@@ -2880,10 +2880,10 @@ function buildRectPathGradientExactSvg(stops, focalPoint, fillToRect) {
2880
2880
  }
2881
2881
  const sorted = [...stops].sort((a, b) => a.position - b.position);
2882
2882
  const { left, top, right, bottom } = resolveInnerRect(fillToRect, focalPoint);
2883
- const n = (value) => String(Math.round(value * 1e3) / 1e3);
2884
- const alpha = (opacity, attr) => (opacity ?? 1) < 1 ? ` ${attr}="${n(Math.max(0, opacity ?? 1))}"` : "";
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
2885
  const stopMarkup = sorted.map(
2886
- (stop) => `<stop offset="${n(Math.min(Math.max(stop.position, 0), 100) / 100)}" stop-color="${stop.color}"${alpha(stop.opacity, "stop-opacity")}/>`
2886
+ (stop) => `<stop offset="${n2(Math.min(Math.max(stop.position, 0), 100) / 100)}" stop-color="${stop.color}"${alpha(stop.opacity, "stop-opacity")}/>`
2887
2887
  ).join("");
2888
2888
  const sides = [
2889
2889
  { id: "t", pts: [0, 0, 100, 0, right, top, left, top], v: [0, top, 0, 0], size: top },
@@ -2902,15 +2902,15 @@ function buildRectPathGradientExactSvg(stops, focalPoint, fillToRect) {
2902
2902
  }
2903
2903
  ].filter((side) => side.size > 1e-3);
2904
2904
  const defs = sides.map(
2905
- (side) => `<linearGradient id="${side.id}" gradientUnits="userSpaceOnUse" x1="${n(side.v[0])}" y1="${n(side.v[1])}" x2="${n(side.v[2])}" y2="${n(side.v[3])}">${stopMarkup}</linearGradient>`
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
2906
  ).join("");
2907
2907
  const polygons = sides.map((side) => {
2908
- const points = side.pts.map(n);
2908
+ const points = side.pts.map(n2);
2909
2909
  const pairs = [0, 2, 4, 6].map((i) => `${points[i]},${points[i + 1]}`).join(" ");
2910
2910
  return `<polygon points="${pairs}" fill="url(#${side.id})"/>`;
2911
2911
  }).join("");
2912
2912
  const first2 = sorted[0];
2913
- const plateau = right - left > 1e-3 && bottom - top > 1e-3 ? `<rect x="${n(left)}" y="${n(top)}" width="${n(right - left)}" height="${n(bottom - top)}" fill="${first2.color}"${alpha(first2.opacity, "fill-opacity")}/>` : "";
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
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
2915
  }
2916
2916
  function buildRectPathGradientImage(stops, focalPoint, fillToRect) {
@@ -2918,6 +2918,152 @@ function buildRectPathGradientImage(stops, focalPoint, fillToRect) {
2918
2918
  return `url("data:image/svg+xml,${encodeURIComponent(markup).replace(/[()]/gu, (c) => c === "(" ? "%28" : "%29")}")`;
2919
2919
  }
2920
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>`;
3065
+ }
3066
+
2921
3067
  // drawingml/theme.ts
2922
3068
  var MAP_KEYS = [
2923
3069
  "bg1",
@@ -3399,8 +3545,8 @@ var LIGHT_DIRECTIONS = /* @__PURE__ */ new Set(["tl", "t", "tr", "l", "r", "bl",
3399
3545
  // drawingml/read-3d-values.ts
3400
3546
  var integer = (value) => {
3401
3547
  if (value === void 0 || value === null || String(value).trim() === "") return void 0;
3402
- const n = Number(value);
3403
- return Number.isSafeInteger(n) ? n : void 0;
3548
+ const n2 = Number(value);
3549
+ return Number.isSafeInteger(n2) ? n2 : void 0;
3404
3550
  };
3405
3551
  function readScene3DValues(node, read) {
3406
3552
  const out = {};
@@ -4623,4 +4769,55 @@ function applyPictureHslPixels(data, effect) {
4623
4769
  }
4624
4770
  }
4625
4771
 
4626
- 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, buildRectPathGradientExactSvg, 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 };
@@ -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
@@ -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;;;;;;;;;;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"}
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"}