@shbernal/ts-pptx 3.3.0 → 3.4.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 (60) hide show
  1. package/dist/{autopage-D1sqK6j7.js → autopage-BYlTzX-l.js} +8 -5
  2. package/dist/autopage-BYlTzX-l.js.map +1 -0
  3. package/dist/browser.d.ts +4 -4
  4. package/dist/browser.js +11 -11
  5. package/dist/browser.js.map +1 -1
  6. package/dist/{diagnostics-B2yWpcjB.d.ts → diagnostics-B0OmTOoz.d.ts} +38 -6
  7. package/dist/diagnostics-B0OmTOoz.d.ts.map +1 -0
  8. package/dist/{diagnostics-H1QzgRSw.js → diagnostics-CPVADSL1.js} +29 -3
  9. package/dist/{diagnostics-H1QzgRSw.js.map → diagnostics-CPVADSL1.js.map} +1 -1
  10. package/dist/{fit-CYJ1jkQI.js → fit-TjpNbMru.js} +3 -3
  11. package/dist/{fit-CYJ1jkQI.js.map → fit-TjpNbMru.js.map} +1 -1
  12. package/dist/{html-dom-CzewEdE1.js → html-dom-yUSdCExA.js} +5 -5
  13. package/dist/html-dom-yUSdCExA.js.map +1 -0
  14. package/dist/html.d.ts +2 -2
  15. package/dist/html.js +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +16 -33
  18. package/dist/index.js.map +1 -1
  19. package/dist/inspect.js +5 -4
  20. package/dist/inspect.js.map +1 -1
  21. package/dist/measure.d.ts +1 -1
  22. package/dist/measure.js +1 -1
  23. package/dist/{st-enums-bVnezkMJ.js → namespaces-Sy_m7Nhd.js} +288 -200
  24. package/dist/namespaces-Sy_m7Nhd.js.map +1 -0
  25. package/dist/node.d.ts +4 -4
  26. package/dist/node.js +7 -19
  27. package/dist/node.js.map +1 -1
  28. package/dist/{notes-SCvpJz0l.js → notes-bWApshah.js} +221 -140
  29. package/dist/notes-bWApshah.js.map +1 -0
  30. package/dist/{pres-Cb-1xDne.d.ts → pres-Dybf7ZUl.d.ts} +2 -2
  31. package/dist/{pres-Cb-1xDne.d.ts.map → pres-Dybf7ZUl.d.ts.map} +1 -1
  32. package/dist/{presentation-DeKTJGHf.js → presentation-3rAKKRfm.js} +154 -230
  33. package/dist/presentation-3rAKKRfm.js.map +1 -0
  34. package/dist/{presentation-types-B50aOUFI.d.ts → presentation-types-D7cgT-eG.d.ts} +191 -16
  35. package/dist/presentation-types-D7cgT-eG.d.ts.map +1 -0
  36. package/dist/read.d.ts +3 -3
  37. package/dist/read.js +3 -3
  38. package/dist/script.d.ts +1 -1
  39. package/dist/script.d.ts.map +1 -1
  40. package/dist/script.js +67 -40
  41. package/dist/script.js.map +1 -1
  42. package/dist/{shapes-BXVgsk0F.js → shapes-Dyw5bxwO.js} +371 -52
  43. package/dist/shapes-Dyw5bxwO.js.map +1 -0
  44. package/dist/{slide-DWw9UoI6.d.ts → slide-B_aInw3N.d.ts} +208 -180
  45. package/dist/slide-B_aInw3N.d.ts.map +1 -0
  46. package/dist/{text-uM-zGton.js → text-DSN3anEh.js} +3563 -3437
  47. package/dist/text-DSN3anEh.js.map +1 -0
  48. package/dist/{units-internal-CGf4VrXy.js → units-internal-DNvK2I6o.js} +54 -34
  49. package/dist/{units-internal-CGf4VrXy.js.map → units-internal-DNvK2I6o.js.map} +1 -1
  50. package/package.json +4 -4
  51. package/dist/autopage-D1sqK6j7.js.map +0 -1
  52. package/dist/diagnostics-B2yWpcjB.d.ts.map +0 -1
  53. package/dist/html-dom-CzewEdE1.js.map +0 -1
  54. package/dist/notes-SCvpJz0l.js.map +0 -1
  55. package/dist/presentation-DeKTJGHf.js.map +0 -1
  56. package/dist/presentation-types-B50aOUFI.d.ts.map +0 -1
  57. package/dist/shapes-BXVgsk0F.js.map +0 -1
  58. package/dist/slide-DWw9UoI6.d.ts.map +0 -1
  59. package/dist/st-enums-bVnezkMJ.js.map +0 -1
  60. package/dist/text-uM-zGton.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { n as warn, r as warnOnce } from "./diagnostics-H1QzgRSw.js";
1
+ import { i as warnOnce, r as warn } from "./diagnostics-CPVADSL1.js";
2
2
  import { n as InvalidOptionError } from "./errors-Bvln0H-7.js";
3
3
  //#region src/units.ts
4
4
  /**
@@ -37,6 +37,7 @@ const HUNDREDTHS_PER_POINT = 100;
37
37
  * for `sz`, `spc`, and `<a:spcPts val>`. See {@link HUNDREDTHS_PER_POINT}.
38
38
  */
39
39
  function ptToHundredths(pt) {
40
+ assertFiniteNumber(pt, "points");
40
41
  return Math.round(pt * 100);
41
42
  }
42
43
  /** A bare number larger than this (in inches) is almost certainly a mistake — likely a raw EMU
@@ -678,14 +679,6 @@ const AXIS_ID_CATEGORY_SECONDARY = "2094734555";
678
679
  const AXIS_ID_SERIES_PRIMARY = "2094734556";
679
680
  const LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
680
681
  const BARCHART_COLORS = [
681
- "C0504D",
682
- "4F81BD",
683
- "9BBB59",
684
- "8064A2",
685
- "4BACC6",
686
- "F79646",
687
- "628FC6",
688
- "C86360",
689
682
  "C0504D",
690
683
  "4F81BD",
691
684
  "9BBB59",
@@ -696,15 +689,6 @@ const BARCHART_COLORS = [
696
689
  "C86360"
697
690
  ];
698
691
  const PIECHART_COLORS = [
699
- "5DA5DA",
700
- "FAA43A",
701
- "60BD68",
702
- "F17CB0",
703
- "B2912F",
704
- "B276B2",
705
- "DECF3F",
706
- "F15854",
707
- "A7A7A7",
708
692
  "5DA5DA",
709
693
  "FAA43A",
710
694
  "60BD68",
@@ -716,6 +700,7 @@ const PIECHART_COLORS = [
716
700
  "A7A7A7"
717
701
  ];
718
702
  const SLDNUMFLDID = "{F7021451-1387-4CA6-816F-3879F97B5CBC}";
703
+ const SLDNUM_PLACEHOLDER_TEXT = "‹#›";
719
704
  const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
720
705
  const IMG_BROKEN = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOV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0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==";
721
706
  const IMG_SVG_PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
@@ -814,13 +799,20 @@ function resolveTableColWidthsEmu(colW, totalWidthEmu, colCount) {
814
799
  return new Array(colCount).fill(even);
815
800
  }
816
801
  /**
817
- * Convert `pt` into points (using `ONEPT`)
818
- * @param {number|string} pt
819
- * @returns {number} value in points (`ONEPT`)
802
+ * Convert points to EMU, leniently: anything that does not read as a finite number — a `NaN`,
803
+ * an `Infinity`, a non-numeric string, `null` — becomes `0` rather than throwing.
804
+ *
805
+ * That is the whole difference from {@link pointsToEmu} in `units.ts`, which throws on the same
806
+ * input. Emitters use this one for the many optional size/width/offset options where a missing
807
+ * or malformed value should collapse the feature (a zero-width line, no shadow offset) rather
808
+ * than take the whole deck down.
809
+ *
810
+ * @param pt - points, as a number or a numeric string
811
+ * @returns the value in EMU, or `0` if it does not read as a finite number
820
812
  */
821
- function valToPts(pt) {
822
- const points = Number(pt) || 0;
823
- return isNaN(points) ? 0 : Math.round(points * EMU_PER_POINT);
813
+ function ptsToEmuLenient(pt) {
814
+ const points = Number(pt);
815
+ return Number.isFinite(points) ? Math.round(points * EMU_PER_POINT) : 0;
824
816
  }
825
817
  /**
826
818
  * Convert a transparency percentage (0-100) into a schema-valid `<a:alpha>` value
@@ -844,19 +836,48 @@ function opacityToAlpha(opacity) {
844
836
  * repair, so clamp into range and warn.
845
837
  */
846
838
  function lineWidthToEmu(widthPts) {
847
- const raw = valToPts(widthPts);
839
+ const raw = ptsToEmuLenient(widthPts);
848
840
  const clamped = Math.min(20116800, Math.max(0, raw));
849
841
  if (clamped !== raw) warn("line/width-out-of-range", `line width ${widthPts} is outside the valid range 0-1584pt; using ${clamped / EMU_PER_POINT}.`);
850
842
  return clamped;
851
843
  }
852
844
  /**
853
- * Convert degrees (0..360) to PowerPoint `rot` value
854
- * @param {number} d degrees
855
- * @returns {number} calculated `rot` value
845
+ * Convert degrees to a DrawingML angle (60000ths of a degree), **without** wrapping.
846
+ *
847
+ * Most angles in the format are not modular: a connection site at 400 degrees, a polar adjust
848
+ * handle whose range runs to 540, an arc that sweeps 400 degrees — each means something a
849
+ * reduction into 0..360 would destroy. Use this for those, and {@link convertRotationDegrees}
850
+ * for the ones that genuinely are a rotation.
851
+ *
852
+ * Non-finite input throws rather than reaching the attribute: `Math.round(Infinity * 60000)` is
853
+ * `Infinity`, which serializes as `ang="Infinity"` and makes PowerPoint offer to repair the file.
854
+ *
855
+ * @param d - degrees
856
+ * @param what - what is being converted, for the error message
857
+ * @param code - diagnostic code to throw under, where a caller has a more specific one
858
+ */
859
+ function convertAngleUnits(d, what, code = "coord/non-finite") {
860
+ assertFiniteDegrees(d, what, code);
861
+ return Math.round(d * ANGLE_UNITS_PER_DEGREE);
862
+ }
863
+ function assertFiniteDegrees(d, what, code) {
864
+ if (typeof d !== "number" || !Number.isFinite(d)) throw new InvalidOptionError(code, `${what} must be a finite number of degrees; received ${String(d)}.`);
865
+ }
866
+ /**
867
+ * Convert a shape or gradient rotation (degrees) to a DrawingML angle (60000ths of a degree).
868
+ *
869
+ * A rotation *is* modular — 800 degrees and 80 degrees point the same way — so the value is
870
+ * reduced with `% 360`. The reduction keeps the sign: `-45` stays `-45` rather than becoming
871
+ * `315`, because both are valid `ST_Angle`, PowerPoint writes negative rotations itself, and
872
+ * the read side reports back what was authored. Only an input outside -360..360 moves.
873
+ *
874
+ * @param d - degrees
875
+ * @returns the `rot` value in 60000ths of a degree
856
876
  */
857
877
  function convertRotationDegrees(d) {
858
- d = d || 0;
859
- return Math.round((d > 360 ? d - 360 : d) * ANGLE_UNITS_PER_DEGREE);
878
+ const degrees = d || 0;
879
+ assertFiniteDegrees(degrees, "rotation", "coord/non-finite");
880
+ return Math.round(degrees % 360 * ANGLE_UNITS_PER_DEGREE);
860
881
  }
861
882
  /**
862
883
  * Convert a freeform arc angle (degrees) to an `<a:arcTo>` ST_AdjAngle value (60000ths).
@@ -867,10 +888,9 @@ function convertRotationDegrees(d) {
867
888
  * @returns {number} ST_AdjAngle value (60000ths of a degree)
868
889
  */
869
890
  function convertArcAngle(d, attr) {
870
- if (typeof d !== "number" || !Number.isFinite(d)) throw new InvalidOptionError("geometry/arc-angle-non-finite", `Arc ${attr} must be a finite number of degrees; received ${String(d)}.`);
871
- return Math.round(d * ANGLE_UNITS_PER_DEGREE);
891
+ return convertAngleUnits(d, `Arc ${attr}`, "geometry/arc-angle-non-finite");
872
892
  }
873
893
  //#endregion
874
- export { connectorPresetFor as $, IMG_PLAYBTN as A, AlignV as B, DEF_PRES_LAYOUT_NAME as C, DEF_TEXT_GLOW as D, DEF_SLIDE_MARGIN_IN as E, PIECHART_COLORS as F, PlaceholderType as G, CONNECTOR_PRESETS as H, REGEX_HEX_COLOR as I, SlideObjectType as J, SchemeColor as K, SLDNUMFLDID as L, LAYOUT_IDX_SERIES_BASE as M, LETTERS as N, DEF_TEXT_SHADOW as O, LINEH_MODIFIER as P, asChartType as Q, XML_DECL as R, DEF_PRES_LAYOUT as S, DEF_SHAPE_SHADOW as T, ChartType as U, BulletType as V, OutputType as W, TextAnchor as X, TableStyle as Y, VALID_SHAPE_PRESETS as Z, DEF_CELL_BORDER as _, pixelsToEmu as _t, lineWidthToEmu as a, EMU_PER_POINT as at, DEF_CHART_GRIDLINE as b, resolveTableColWidthsEmu as c, PERCENT_SCALE as ct, AXIS_ID_CATEGORY_PRIMARY as d, coordToEmu as dt, isChartExType as et, AXIS_ID_CATEGORY_SECONDARY as f, emuToInches as ft, BARCHART_COLORS as g, percentToEmu as gt, AXIS_ID_VALUE_SECONDARY as h, inchesToEmu as ht, inch2Emu as i, EMU_PER_INCH as it, IMG_SVG_PLACEHOLDER as j, IMG_BROKEN as k, transparencyToAlpha as l, POINTS_PER_INCH as lt, AXIS_ID_VALUE_PRIMARY as m, emuToPoints as mt, convertRotationDegrees as n, ANGLE_UNITS_PER_DEGREE as nt, marginToEmu as o, FIXED_PCT_PER_PERCENT as ot, AXIS_ID_SERIES_PRIMARY as p, emuToPixels as pt, ShapeType as q, getSmartParseNumber as r, DEFAULT_PX_PER_INCH as rt, opacityToAlpha as s, HUNDREDTHS_PER_POINT as st, convertArcAngle as t, isChartType as tt, valToPts as u, STANDARD_LAYOUTS as ut, DEF_CELL_MARGIN_IN as v, pointsToEmu as vt, DEF_SHAPE_LINE_COLOR as w, DEF_FONT_COLOR as x, DEF_CHART_BORDER as y, ptToHundredths as yt, AlignH as z };
894
+ export { VALID_SHAPE_PRESETS as $, IMG_BROKEN as A, XML_DECL as B, DEF_PRES_LAYOUT as C, DEF_SLIDE_MARGIN_IN as D, DEF_SHAPE_SHADOW as E, LINEH_MODIFIER as F, ChartType as G, AlignV as H, PIECHART_COLORS as I, SchemeColor as J, OutputType as K, REGEX_HEX_COLOR as L, IMG_SVG_PLACEHOLDER as M, LAYOUT_IDX_SERIES_BASE as N, DEF_TEXT_GLOW as O, LETTERS as P, TextAnchor as Q, SLDNUMFLDID as R, DEF_FONT_COLOR as S, DEF_SHAPE_LINE_COLOR as T, BulletType as U, AlignH as V, CONNECTOR_PRESETS as W, SlideObjectType as X, ShapeType as Y, TableStyle as Z, BARCHART_COLORS as _, inchesToEmu as _t, inch2Emu as a, DEFAULT_PX_PER_INCH as at, DEF_CHART_BORDER as b, pointsToEmu as bt, opacityToAlpha as c, FIXED_PCT_PER_PERCENT as ct, transparencyToAlpha as d, POINTS_PER_INCH as dt, asChartType as et, AXIS_ID_CATEGORY_PRIMARY as f, STANDARD_LAYOUTS as ft, AXIS_ID_VALUE_SECONDARY as g, emuToPoints as gt, AXIS_ID_VALUE_PRIMARY as h, emuToPixels as ht, getSmartParseNumber as i, ANGLE_UNITS_PER_DEGREE as it, IMG_PLAYBTN as j, DEF_TEXT_SHADOW as k, ptsToEmuLenient as l, HUNDREDTHS_PER_POINT as lt, AXIS_ID_SERIES_PRIMARY as m, emuToInches as mt, convertArcAngle as n, isChartExType as nt, lineWidthToEmu as o, EMU_PER_INCH as ot, AXIS_ID_CATEGORY_SECONDARY as p, coordToEmu as pt, PlaceholderType as q, convertRotationDegrees as r, isChartType as rt, marginToEmu as s, EMU_PER_POINT as st, convertAngleUnits as t, connectorPresetFor as tt, resolveTableColWidthsEmu as u, PERCENT_SCALE as ut, DEF_CELL_BORDER as v, percentToEmu as vt, DEF_PRES_LAYOUT_NAME as w, DEF_CHART_GRIDLINE as x, ptToHundredths as xt, DEF_CELL_MARGIN_IN as y, pixelsToEmu as yt, SLDNUM_PLACEHOLDER_TEXT as z };
875
895
 
876
- //# sourceMappingURL=units-internal-CGf4VrXy.js.map
896
+ //# sourceMappingURL=units-internal-DNvK2I6o.js.map