@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.
- package/dist/{autopage-D1sqK6j7.js → autopage-BYlTzX-l.js} +8 -5
- package/dist/autopage-BYlTzX-l.js.map +1 -0
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +11 -11
- package/dist/browser.js.map +1 -1
- package/dist/{diagnostics-B2yWpcjB.d.ts → diagnostics-B0OmTOoz.d.ts} +38 -6
- package/dist/diagnostics-B0OmTOoz.d.ts.map +1 -0
- package/dist/{diagnostics-H1QzgRSw.js → diagnostics-CPVADSL1.js} +29 -3
- package/dist/{diagnostics-H1QzgRSw.js.map → diagnostics-CPVADSL1.js.map} +1 -1
- package/dist/{fit-CYJ1jkQI.js → fit-TjpNbMru.js} +3 -3
- package/dist/{fit-CYJ1jkQI.js.map → fit-TjpNbMru.js.map} +1 -1
- package/dist/{html-dom-CzewEdE1.js → html-dom-yUSdCExA.js} +5 -5
- package/dist/html-dom-yUSdCExA.js.map +1 -0
- package/dist/html.d.ts +2 -2
- package/dist/html.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +16 -33
- package/dist/index.js.map +1 -1
- package/dist/inspect.js +5 -4
- package/dist/inspect.js.map +1 -1
- package/dist/measure.d.ts +1 -1
- package/dist/measure.js +1 -1
- package/dist/{st-enums-bVnezkMJ.js → namespaces-Sy_m7Nhd.js} +288 -200
- package/dist/namespaces-Sy_m7Nhd.js.map +1 -0
- package/dist/node.d.ts +4 -4
- package/dist/node.js +7 -19
- package/dist/node.js.map +1 -1
- package/dist/{notes-SCvpJz0l.js → notes-bWApshah.js} +221 -140
- package/dist/notes-bWApshah.js.map +1 -0
- package/dist/{pres-Cb-1xDne.d.ts → pres-Dybf7ZUl.d.ts} +2 -2
- package/dist/{pres-Cb-1xDne.d.ts.map → pres-Dybf7ZUl.d.ts.map} +1 -1
- package/dist/{presentation-DeKTJGHf.js → presentation-3rAKKRfm.js} +154 -230
- package/dist/presentation-3rAKKRfm.js.map +1 -0
- package/dist/{presentation-types-B50aOUFI.d.ts → presentation-types-D7cgT-eG.d.ts} +191 -16
- package/dist/presentation-types-D7cgT-eG.d.ts.map +1 -0
- package/dist/read.d.ts +3 -3
- package/dist/read.js +3 -3
- package/dist/script.d.ts +1 -1
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +67 -40
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BXVgsk0F.js → shapes-Dyw5bxwO.js} +371 -52
- package/dist/shapes-Dyw5bxwO.js.map +1 -0
- package/dist/{slide-DWw9UoI6.d.ts → slide-B_aInw3N.d.ts} +208 -180
- package/dist/slide-B_aInw3N.d.ts.map +1 -0
- package/dist/{text-uM-zGton.js → text-DSN3anEh.js} +3563 -3437
- package/dist/text-DSN3anEh.js.map +1 -0
- package/dist/{units-internal-CGf4VrXy.js → units-internal-DNvK2I6o.js} +54 -34
- package/dist/{units-internal-CGf4VrXy.js.map → units-internal-DNvK2I6o.js.map} +1 -1
- package/package.json +4 -4
- package/dist/autopage-D1sqK6j7.js.map +0 -1
- package/dist/diagnostics-B2yWpcjB.d.ts.map +0 -1
- package/dist/html-dom-CzewEdE1.js.map +0 -1
- package/dist/notes-SCvpJz0l.js.map +0 -1
- package/dist/presentation-DeKTJGHf.js.map +0 -1
- package/dist/presentation-types-B50aOUFI.d.ts.map +0 -1
- package/dist/shapes-BXVgsk0F.js.map +0 -1
- package/dist/slide-DWw9UoI6.d.ts.map +0 -1
- package/dist/st-enums-bVnezkMJ.js.map +0 -1
- package/dist/text-uM-zGton.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8U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MCEMPg/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
|
|
818
|
-
*
|
|
819
|
-
*
|
|
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
|
|
822
|
-
const points = Number(pt)
|
|
823
|
-
return
|
|
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 =
|
|
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 (
|
|
854
|
-
*
|
|
855
|
-
*
|
|
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
|
-
|
|
859
|
-
|
|
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
|
-
|
|
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 {
|
|
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-
|
|
896
|
+
//# sourceMappingURL=units-internal-DNvK2I6o.js.map
|