pptx-ts 0.0.1
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/LICENSE +22 -0
- package/README.md +319 -0
- package/dist/autopage-DkjYZUFD.js +423 -0
- package/dist/autopage-DkjYZUFD.js.map +1 -0
- package/dist/browser.d.ts +31 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +110 -0
- package/dist/browser.js.map +1 -0
- package/dist/diagnostics-Du_s75MT.d.ts +829 -0
- package/dist/diagnostics-Du_s75MT.d.ts.map +1 -0
- package/dist/enums-CvRYniUA.d.ts +463 -0
- package/dist/enums-CvRYniUA.d.ts.map +1 -0
- package/dist/errors-Bvln0H-7.js +112 -0
- package/dist/errors-Bvln0H-7.js.map +1 -0
- package/dist/errors-PflMPWBn.d.ts +182 -0
- package/dist/errors-PflMPWBn.d.ts.map +1 -0
- package/dist/fit-BKs0zxMI.js +1356 -0
- package/dist/fit-BKs0zxMI.js.map +1 -0
- package/dist/html-dom-B0I0QSbU.js +679 -0
- package/dist/html-dom-B0I0QSbU.js.map +1 -0
- package/dist/html.d.ts +26 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +63 -0
- package/dist/html.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect.d.ts +197 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +317 -0
- package/dist/inspect.js.map +1 -0
- package/dist/math.d.ts +37 -0
- package/dist/math.d.ts.map +1 -0
- package/dist/math.js +203 -0
- package/dist/math.js.map +1 -0
- package/dist/measure.d.ts +313 -0
- package/dist/measure.d.ts.map +1 -0
- package/dist/measure.js +3 -0
- package/dist/namespaces-BVnNu7sg.js +666 -0
- package/dist/namespaces-BVnNu7sg.js.map +1 -0
- package/dist/node.d.ts +20 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +55 -0
- package/dist/node.js.map +1 -0
- package/dist/notes-RLCwdlTE.js +1703 -0
- package/dist/notes-RLCwdlTE.js.map +1 -0
- package/dist/package-CaOLXSNi.d.ts +193 -0
- package/dist/package-CaOLXSNi.d.ts.map +1 -0
- package/dist/pres-C5__xkDh.d.ts +202 -0
- package/dist/pres-C5__xkDh.d.ts.map +1 -0
- package/dist/presentation-Cp7vzlAw.js +5427 -0
- package/dist/presentation-Cp7vzlAw.js.map +1 -0
- package/dist/presentation-types-DP_8jog7.d.ts +4872 -0
- package/dist/presentation-types-DP_8jog7.d.ts.map +1 -0
- package/dist/read.d.ts +55 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +4 -0
- package/dist/script.d.ts +581 -0
- package/dist/script.d.ts.map +1 -0
- package/dist/script.js +3741 -0
- package/dist/script.js.map +1 -0
- package/dist/shapes-BemroU-z.js +6951 -0
- package/dist/shapes-BemroU-z.js.map +1 -0
- package/dist/slide-js0QpRV-.d.ts +3873 -0
- package/dist/slide-js0QpRV-.d.ts.map +1 -0
- package/dist/text-CyetbF6p.js +11278 -0
- package/dist/text-CyetbF6p.js.map +1 -0
- package/dist/units-1kRzYShk.js +231 -0
- package/dist/units-1kRzYShk.js.map +1 -0
- package/dist/units-internal-Dg95w_YD.js +753 -0
- package/dist/units-internal-Dg95w_YD.js.map +1 -0
- package/dist/zip.d.ts +68 -0
- package/dist/zip.d.ts.map +1 -0
- package/dist/zip.js +163 -0
- package/dist/zip.js.map +1 -0
- package/package.json +152 -0
- package/skills/ts-pptx-upstream/SKILL.md +340 -0
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
import { S as warnOnce, a as FIXED_PCT_PER_PERCENT, i as EMU_PER_POINT, m as inchesToEmu, r as EMU_PER_INCH, s as PERCENT_SCALE, t as ANGLE_UNITS_PER_DEGREE, u as coordToEmu, x as warn } from "./units-1kRzYShk.js";
|
|
2
|
+
import { n as InvalidOptionError } from "./errors-Bvln0H-7.js";
|
|
3
|
+
//#region src/enums.ts
|
|
4
|
+
let TextAnchor = /* @__PURE__ */ function(TextAnchor) {
|
|
5
|
+
TextAnchor["b"] = "b";
|
|
6
|
+
TextAnchor["ctr"] = "ctr";
|
|
7
|
+
TextAnchor["t"] = "t";
|
|
8
|
+
return TextAnchor;
|
|
9
|
+
}({});
|
|
10
|
+
let OutputType = /* @__PURE__ */ function(OutputType) {
|
|
11
|
+
OutputType["arraybuffer"] = "arraybuffer";
|
|
12
|
+
OutputType["base64"] = "base64";
|
|
13
|
+
OutputType["binarystring"] = "binarystring";
|
|
14
|
+
OutputType["blob"] = "blob";
|
|
15
|
+
OutputType["nodebuffer"] = "nodebuffer";
|
|
16
|
+
OutputType["uint8array"] = "uint8array";
|
|
17
|
+
return OutputType;
|
|
18
|
+
}({});
|
|
19
|
+
let ChartType = /* @__PURE__ */ function(ChartType) {
|
|
20
|
+
ChartType["area"] = "area";
|
|
21
|
+
ChartType["bar"] = "bar";
|
|
22
|
+
ChartType["bar3d"] = "bar3D";
|
|
23
|
+
ChartType["bubble"] = "bubble";
|
|
24
|
+
ChartType["bubble3d"] = "bubble3D";
|
|
25
|
+
ChartType["doughnut"] = "doughnut";
|
|
26
|
+
ChartType["line"] = "line";
|
|
27
|
+
ChartType["pie"] = "pie";
|
|
28
|
+
ChartType["radar"] = "radar";
|
|
29
|
+
ChartType["scatter"] = "scatter";
|
|
30
|
+
ChartType["stock"] = "stock";
|
|
31
|
+
ChartType["surface"] = "surface";
|
|
32
|
+
ChartType["waterfall"] = "waterfall";
|
|
33
|
+
ChartType["funnel"] = "funnel";
|
|
34
|
+
ChartType["treemap"] = "treemap";
|
|
35
|
+
ChartType["sunburst"] = "sunburst";
|
|
36
|
+
ChartType["histogram"] = "histogram";
|
|
37
|
+
ChartType["pareto"] = "pareto";
|
|
38
|
+
ChartType["boxWhisker"] = "boxWhisker";
|
|
39
|
+
ChartType["regionMap"] = "regionMap";
|
|
40
|
+
return ChartType;
|
|
41
|
+
}({});
|
|
42
|
+
let ShapeType = /* @__PURE__ */ function(ShapeType) {
|
|
43
|
+
ShapeType["accentBorderCallout1"] = "accentBorderCallout1";
|
|
44
|
+
ShapeType["accentBorderCallout2"] = "accentBorderCallout2";
|
|
45
|
+
ShapeType["accentBorderCallout3"] = "accentBorderCallout3";
|
|
46
|
+
ShapeType["accentCallout1"] = "accentCallout1";
|
|
47
|
+
ShapeType["accentCallout2"] = "accentCallout2";
|
|
48
|
+
ShapeType["accentCallout3"] = "accentCallout3";
|
|
49
|
+
ShapeType["actionButtonBackPrevious"] = "actionButtonBackPrevious";
|
|
50
|
+
ShapeType["actionButtonBeginning"] = "actionButtonBeginning";
|
|
51
|
+
ShapeType["actionButtonBlank"] = "actionButtonBlank";
|
|
52
|
+
ShapeType["actionButtonDocument"] = "actionButtonDocument";
|
|
53
|
+
ShapeType["actionButtonEnd"] = "actionButtonEnd";
|
|
54
|
+
ShapeType["actionButtonForwardNext"] = "actionButtonForwardNext";
|
|
55
|
+
ShapeType["actionButtonHelp"] = "actionButtonHelp";
|
|
56
|
+
ShapeType["actionButtonHome"] = "actionButtonHome";
|
|
57
|
+
ShapeType["actionButtonInformation"] = "actionButtonInformation";
|
|
58
|
+
ShapeType["actionButtonMovie"] = "actionButtonMovie";
|
|
59
|
+
ShapeType["actionButtonReturn"] = "actionButtonReturn";
|
|
60
|
+
ShapeType["actionButtonSound"] = "actionButtonSound";
|
|
61
|
+
ShapeType["arc"] = "arc";
|
|
62
|
+
ShapeType["bentArrow"] = "bentArrow";
|
|
63
|
+
ShapeType["bentUpArrow"] = "bentUpArrow";
|
|
64
|
+
ShapeType["bevel"] = "bevel";
|
|
65
|
+
ShapeType["blockArc"] = "blockArc";
|
|
66
|
+
ShapeType["borderCallout1"] = "borderCallout1";
|
|
67
|
+
ShapeType["borderCallout2"] = "borderCallout2";
|
|
68
|
+
ShapeType["borderCallout3"] = "borderCallout3";
|
|
69
|
+
ShapeType["bracePair"] = "bracePair";
|
|
70
|
+
ShapeType["bracketPair"] = "bracketPair";
|
|
71
|
+
ShapeType["callout1"] = "callout1";
|
|
72
|
+
ShapeType["callout2"] = "callout2";
|
|
73
|
+
ShapeType["callout3"] = "callout3";
|
|
74
|
+
ShapeType["can"] = "can";
|
|
75
|
+
ShapeType["chartPlus"] = "chartPlus";
|
|
76
|
+
ShapeType["chartStar"] = "chartStar";
|
|
77
|
+
ShapeType["chartX"] = "chartX";
|
|
78
|
+
ShapeType["chevron"] = "chevron";
|
|
79
|
+
ShapeType["chord"] = "chord";
|
|
80
|
+
ShapeType["circularArrow"] = "circularArrow";
|
|
81
|
+
ShapeType["cloud"] = "cloud";
|
|
82
|
+
ShapeType["cloudCallout"] = "cloudCallout";
|
|
83
|
+
ShapeType["corner"] = "corner";
|
|
84
|
+
ShapeType["cornerTabs"] = "cornerTabs";
|
|
85
|
+
ShapeType["cube"] = "cube";
|
|
86
|
+
ShapeType["curvedDownArrow"] = "curvedDownArrow";
|
|
87
|
+
ShapeType["curvedLeftArrow"] = "curvedLeftArrow";
|
|
88
|
+
ShapeType["curvedRightArrow"] = "curvedRightArrow";
|
|
89
|
+
ShapeType["curvedUpArrow"] = "curvedUpArrow";
|
|
90
|
+
ShapeType["custGeom"] = "custGeom";
|
|
91
|
+
ShapeType["decagon"] = "decagon";
|
|
92
|
+
ShapeType["diagStripe"] = "diagStripe";
|
|
93
|
+
ShapeType["diamond"] = "diamond";
|
|
94
|
+
ShapeType["dodecagon"] = "dodecagon";
|
|
95
|
+
ShapeType["donut"] = "donut";
|
|
96
|
+
ShapeType["doubleWave"] = "doubleWave";
|
|
97
|
+
ShapeType["downArrow"] = "downArrow";
|
|
98
|
+
ShapeType["downArrowCallout"] = "downArrowCallout";
|
|
99
|
+
ShapeType["ellipse"] = "ellipse";
|
|
100
|
+
ShapeType["ellipseRibbon"] = "ellipseRibbon";
|
|
101
|
+
ShapeType["ellipseRibbon2"] = "ellipseRibbon2";
|
|
102
|
+
ShapeType["flowChartAlternateProcess"] = "flowChartAlternateProcess";
|
|
103
|
+
ShapeType["flowChartCollate"] = "flowChartCollate";
|
|
104
|
+
ShapeType["flowChartConnector"] = "flowChartConnector";
|
|
105
|
+
ShapeType["flowChartDecision"] = "flowChartDecision";
|
|
106
|
+
ShapeType["flowChartDelay"] = "flowChartDelay";
|
|
107
|
+
ShapeType["flowChartDisplay"] = "flowChartDisplay";
|
|
108
|
+
ShapeType["flowChartDocument"] = "flowChartDocument";
|
|
109
|
+
ShapeType["flowChartExtract"] = "flowChartExtract";
|
|
110
|
+
ShapeType["flowChartInputOutput"] = "flowChartInputOutput";
|
|
111
|
+
ShapeType["flowChartInternalStorage"] = "flowChartInternalStorage";
|
|
112
|
+
ShapeType["flowChartMagneticDisk"] = "flowChartMagneticDisk";
|
|
113
|
+
ShapeType["flowChartMagneticDrum"] = "flowChartMagneticDrum";
|
|
114
|
+
ShapeType["flowChartMagneticTape"] = "flowChartMagneticTape";
|
|
115
|
+
ShapeType["flowChartManualInput"] = "flowChartManualInput";
|
|
116
|
+
ShapeType["flowChartManualOperation"] = "flowChartManualOperation";
|
|
117
|
+
ShapeType["flowChartMerge"] = "flowChartMerge";
|
|
118
|
+
ShapeType["flowChartMultidocument"] = "flowChartMultidocument";
|
|
119
|
+
ShapeType["flowChartOfflineStorage"] = "flowChartOfflineStorage";
|
|
120
|
+
ShapeType["flowChartOffpageConnector"] = "flowChartOffpageConnector";
|
|
121
|
+
ShapeType["flowChartOnlineStorage"] = "flowChartOnlineStorage";
|
|
122
|
+
ShapeType["flowChartOr"] = "flowChartOr";
|
|
123
|
+
ShapeType["flowChartPredefinedProcess"] = "flowChartPredefinedProcess";
|
|
124
|
+
ShapeType["flowChartPreparation"] = "flowChartPreparation";
|
|
125
|
+
ShapeType["flowChartProcess"] = "flowChartProcess";
|
|
126
|
+
ShapeType["flowChartPunchedCard"] = "flowChartPunchedCard";
|
|
127
|
+
ShapeType["flowChartPunchedTape"] = "flowChartPunchedTape";
|
|
128
|
+
ShapeType["flowChartSort"] = "flowChartSort";
|
|
129
|
+
ShapeType["flowChartSummingJunction"] = "flowChartSummingJunction";
|
|
130
|
+
ShapeType["flowChartTerminator"] = "flowChartTerminator";
|
|
131
|
+
ShapeType["foldedCorner"] = "foldedCorner";
|
|
132
|
+
ShapeType["frame"] = "frame";
|
|
133
|
+
ShapeType["funnel"] = "funnel";
|
|
134
|
+
ShapeType["gear6"] = "gear6";
|
|
135
|
+
ShapeType["gear9"] = "gear9";
|
|
136
|
+
ShapeType["halfFrame"] = "halfFrame";
|
|
137
|
+
ShapeType["heart"] = "heart";
|
|
138
|
+
ShapeType["heptagon"] = "heptagon";
|
|
139
|
+
ShapeType["hexagon"] = "hexagon";
|
|
140
|
+
ShapeType["homePlate"] = "homePlate";
|
|
141
|
+
ShapeType["horizontalScroll"] = "horizontalScroll";
|
|
142
|
+
ShapeType["irregularSeal1"] = "irregularSeal1";
|
|
143
|
+
ShapeType["irregularSeal2"] = "irregularSeal2";
|
|
144
|
+
ShapeType["leftArrow"] = "leftArrow";
|
|
145
|
+
ShapeType["leftArrowCallout"] = "leftArrowCallout";
|
|
146
|
+
ShapeType["leftBrace"] = "leftBrace";
|
|
147
|
+
ShapeType["leftBracket"] = "leftBracket";
|
|
148
|
+
ShapeType["leftCircularArrow"] = "leftCircularArrow";
|
|
149
|
+
ShapeType["leftRightArrow"] = "leftRightArrow";
|
|
150
|
+
ShapeType["leftRightArrowCallout"] = "leftRightArrowCallout";
|
|
151
|
+
ShapeType["leftRightCircularArrow"] = "leftRightCircularArrow";
|
|
152
|
+
ShapeType["leftRightRibbon"] = "leftRightRibbon";
|
|
153
|
+
ShapeType["leftRightUpArrow"] = "leftRightUpArrow";
|
|
154
|
+
ShapeType["leftUpArrow"] = "leftUpArrow";
|
|
155
|
+
ShapeType["lightningBolt"] = "lightningBolt";
|
|
156
|
+
ShapeType["line"] = "line";
|
|
157
|
+
ShapeType["lineInv"] = "lineInv";
|
|
158
|
+
ShapeType["mathDivide"] = "mathDivide";
|
|
159
|
+
ShapeType["mathEqual"] = "mathEqual";
|
|
160
|
+
ShapeType["mathMinus"] = "mathMinus";
|
|
161
|
+
ShapeType["mathMultiply"] = "mathMultiply";
|
|
162
|
+
ShapeType["mathNotEqual"] = "mathNotEqual";
|
|
163
|
+
ShapeType["mathPlus"] = "mathPlus";
|
|
164
|
+
ShapeType["moon"] = "moon";
|
|
165
|
+
ShapeType["noSmoking"] = "noSmoking";
|
|
166
|
+
ShapeType["nonIsoscelesTrapezoid"] = "nonIsoscelesTrapezoid";
|
|
167
|
+
ShapeType["notchedRightArrow"] = "notchedRightArrow";
|
|
168
|
+
ShapeType["octagon"] = "octagon";
|
|
169
|
+
ShapeType["parallelogram"] = "parallelogram";
|
|
170
|
+
ShapeType["pentagon"] = "pentagon";
|
|
171
|
+
ShapeType["pie"] = "pie";
|
|
172
|
+
ShapeType["pieWedge"] = "pieWedge";
|
|
173
|
+
ShapeType["plaque"] = "plaque";
|
|
174
|
+
ShapeType["plaqueTabs"] = "plaqueTabs";
|
|
175
|
+
ShapeType["plus"] = "plus";
|
|
176
|
+
ShapeType["quadArrow"] = "quadArrow";
|
|
177
|
+
ShapeType["quadArrowCallout"] = "quadArrowCallout";
|
|
178
|
+
ShapeType["rect"] = "rect";
|
|
179
|
+
ShapeType["ribbon"] = "ribbon";
|
|
180
|
+
ShapeType["ribbon2"] = "ribbon2";
|
|
181
|
+
ShapeType["rightArrow"] = "rightArrow";
|
|
182
|
+
ShapeType["rightArrowCallout"] = "rightArrowCallout";
|
|
183
|
+
ShapeType["rightBrace"] = "rightBrace";
|
|
184
|
+
ShapeType["rightBracket"] = "rightBracket";
|
|
185
|
+
ShapeType["round1Rect"] = "round1Rect";
|
|
186
|
+
ShapeType["round2DiagRect"] = "round2DiagRect";
|
|
187
|
+
ShapeType["round2SameRect"] = "round2SameRect";
|
|
188
|
+
ShapeType["roundRect"] = "roundRect";
|
|
189
|
+
ShapeType["rtTriangle"] = "rtTriangle";
|
|
190
|
+
ShapeType["smileyFace"] = "smileyFace";
|
|
191
|
+
ShapeType["snip1Rect"] = "snip1Rect";
|
|
192
|
+
ShapeType["snip2DiagRect"] = "snip2DiagRect";
|
|
193
|
+
ShapeType["snip2SameRect"] = "snip2SameRect";
|
|
194
|
+
ShapeType["snipRoundRect"] = "snipRoundRect";
|
|
195
|
+
ShapeType["squareTabs"] = "squareTabs";
|
|
196
|
+
ShapeType["star10"] = "star10";
|
|
197
|
+
ShapeType["star12"] = "star12";
|
|
198
|
+
ShapeType["star16"] = "star16";
|
|
199
|
+
ShapeType["star24"] = "star24";
|
|
200
|
+
ShapeType["star32"] = "star32";
|
|
201
|
+
ShapeType["star4"] = "star4";
|
|
202
|
+
ShapeType["star5"] = "star5";
|
|
203
|
+
ShapeType["star6"] = "star6";
|
|
204
|
+
ShapeType["star7"] = "star7";
|
|
205
|
+
ShapeType["star8"] = "star8";
|
|
206
|
+
ShapeType["stripedRightArrow"] = "stripedRightArrow";
|
|
207
|
+
ShapeType["sun"] = "sun";
|
|
208
|
+
ShapeType["swooshArrow"] = "swooshArrow";
|
|
209
|
+
ShapeType["teardrop"] = "teardrop";
|
|
210
|
+
ShapeType["trapezoid"] = "trapezoid";
|
|
211
|
+
ShapeType["triangle"] = "triangle";
|
|
212
|
+
ShapeType["upArrow"] = "upArrow";
|
|
213
|
+
ShapeType["upArrowCallout"] = "upArrowCallout";
|
|
214
|
+
ShapeType["upDownArrow"] = "upDownArrow";
|
|
215
|
+
ShapeType["upDownArrowCallout"] = "upDownArrowCallout";
|
|
216
|
+
ShapeType["uturnArrow"] = "uturnArrow";
|
|
217
|
+
ShapeType["verticalScroll"] = "verticalScroll";
|
|
218
|
+
ShapeType["wave"] = "wave";
|
|
219
|
+
ShapeType["wedgeEllipseCallout"] = "wedgeEllipseCallout";
|
|
220
|
+
ShapeType["wedgeRectCallout"] = "wedgeRectCallout";
|
|
221
|
+
ShapeType["wedgeRoundRectCallout"] = "wedgeRoundRectCallout";
|
|
222
|
+
return ShapeType;
|
|
223
|
+
}({});
|
|
224
|
+
let SchemeColor = /* @__PURE__ */ function(SchemeColor) {
|
|
225
|
+
SchemeColor["text1"] = "tx1";
|
|
226
|
+
SchemeColor["text2"] = "tx2";
|
|
227
|
+
SchemeColor["background1"] = "bg1";
|
|
228
|
+
SchemeColor["background2"] = "bg2";
|
|
229
|
+
SchemeColor["accent1"] = "accent1";
|
|
230
|
+
SchemeColor["accent2"] = "accent2";
|
|
231
|
+
SchemeColor["accent3"] = "accent3";
|
|
232
|
+
SchemeColor["accent4"] = "accent4";
|
|
233
|
+
SchemeColor["accent5"] = "accent5";
|
|
234
|
+
SchemeColor["accent6"] = "accent6";
|
|
235
|
+
return SchemeColor;
|
|
236
|
+
}({});
|
|
237
|
+
let AlignH = /* @__PURE__ */ function(AlignH) {
|
|
238
|
+
AlignH["left"] = "left";
|
|
239
|
+
AlignH["center"] = "center";
|
|
240
|
+
AlignH["right"] = "right";
|
|
241
|
+
AlignH["justify"] = "justify";
|
|
242
|
+
return AlignH;
|
|
243
|
+
}({});
|
|
244
|
+
let AlignV = /* @__PURE__ */ function(AlignV) {
|
|
245
|
+
AlignV["top"] = "top";
|
|
246
|
+
AlignV["middle"] = "middle";
|
|
247
|
+
AlignV["bottom"] = "bottom";
|
|
248
|
+
return AlignV;
|
|
249
|
+
}({});
|
|
250
|
+
/**
|
|
251
|
+
* Valid ECMA-376 `ST_ShapeType` presets that are not surfaced with a friendly
|
|
252
|
+
* `ShapeType` name. They are still legal geometries PowerPoint renders, so the
|
|
253
|
+
* preset-validation set must accept them.
|
|
254
|
+
*/
|
|
255
|
+
const EXTRA_SHAPE_PRESETS = [
|
|
256
|
+
"straightConnector1",
|
|
257
|
+
"bentConnector2",
|
|
258
|
+
"bentConnector3",
|
|
259
|
+
"bentConnector4",
|
|
260
|
+
"bentConnector5",
|
|
261
|
+
"curvedConnector2",
|
|
262
|
+
"curvedConnector3",
|
|
263
|
+
"curvedConnector4",
|
|
264
|
+
"curvedConnector5"
|
|
265
|
+
];
|
|
266
|
+
/**
|
|
267
|
+
* Every shape geometry name ts-pptx can serialize without corrupting the
|
|
268
|
+
* package: the OOXML preset geometries (`ST_ShapeType` — `ShapeType` values
|
|
269
|
+
* plus the unexposed connectors above) and `custGeom` (freeform paths, emitted
|
|
270
|
+
* as `<a:custGeom>` rather than `<a:prstGeom>`). Used to reject bogus presets
|
|
271
|
+
* before they become an invalid `<a:prstGeom prst="...">` that triggers
|
|
272
|
+
* PowerPoint's "needs repair" dialog and drops the shape.
|
|
273
|
+
*/
|
|
274
|
+
const VALID_SHAPE_PRESETS = /* @__PURE__ */ new Set([...Object.values(ShapeType), ...EXTRA_SHAPE_PRESETS]);
|
|
275
|
+
/**
|
|
276
|
+
* Narrow a public `CHART_NAME` to the internal `ChartType` enum. Because
|
|
277
|
+
* `CHART_NAME` is derived from `ChartType`, every `CHART_NAME` value is by
|
|
278
|
+
* construction a valid enum value, so this conversion is total and safe — it is
|
|
279
|
+
* the single boundary cast that lets internal code compare against the enum
|
|
280
|
+
* (enum-to-enum) instead of enum-to-string.
|
|
281
|
+
*/
|
|
282
|
+
function asChartType(name) {
|
|
283
|
+
return name;
|
|
284
|
+
}
|
|
285
|
+
/** Every {@link ChartType} value, for validating a caller-supplied `type` at the API boundary. */
|
|
286
|
+
const CHART_TYPES = new Set(Object.values(ChartType));
|
|
287
|
+
/**
|
|
288
|
+
* Is `name` a chart type this library emits?
|
|
289
|
+
*
|
|
290
|
+
* `CHART_NAME` constrains TypeScript callers, but `addChart` is reachable from plain JavaScript
|
|
291
|
+
* where nothing enforces the union — and the two emitters partition the catalog between them by
|
|
292
|
+
* `switch`, so an off-catalog string has no arm in either and cannot produce a plot. Checked once
|
|
293
|
+
* at define time (`gen/define/chart.ts`) so the caller hears about it at the call that was wrong,
|
|
294
|
+
* rather than getting a chart-shaped hole in the deck.
|
|
295
|
+
*/
|
|
296
|
+
function isChartType(name) {
|
|
297
|
+
return typeof name === "string" && CHART_TYPES.has(name);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The chartEx (`cx:` / Office 2016 chart-extension) chart types. Unlike the classic 2007 catalog
|
|
301
|
+
* these do NOT emit a `<c:chartSpace>` chart part: they emit a separate `chartEx{N}.xml` part in
|
|
302
|
+
* the `http://schemas.microsoft.com/office/drawing/2014/chartex` namespace, are referenced from
|
|
303
|
+
* the slide through `<mc:AlternateContent>`, and render only in PowerPoint 2016+/Microsoft 365
|
|
304
|
+
* (older Office, Google Slides, Keynote and LibreOffice show the `<mc:Fallback>` shape instead).
|
|
305
|
+
* See `gen/chart/chartex-xml.ts`.
|
|
306
|
+
*/
|
|
307
|
+
const CHARTEX_TYPES = /* @__PURE__ */ new Set([
|
|
308
|
+
"waterfall",
|
|
309
|
+
"funnel",
|
|
310
|
+
"treemap",
|
|
311
|
+
"sunburst",
|
|
312
|
+
"histogram",
|
|
313
|
+
"pareto",
|
|
314
|
+
"boxWhisker",
|
|
315
|
+
"regionMap"
|
|
316
|
+
]);
|
|
317
|
+
/**
|
|
318
|
+
* Is `type` a chartEx (cx:) chart? Accepts a `ChartType`/`CHART_NAME` string; anything else —
|
|
319
|
+
* including a combo-chart `ChartMulti[]` array or `undefined` — is not a chartEx type (combos are
|
|
320
|
+
* classic-only), so those return `false`.
|
|
321
|
+
*/
|
|
322
|
+
function isChartExType(type) {
|
|
323
|
+
return typeof type === "string" && CHARTEX_TYPES.has(type);
|
|
324
|
+
}
|
|
325
|
+
let SlideObjectType = /* @__PURE__ */ function(SlideObjectType) {
|
|
326
|
+
SlideObjectType["chart"] = "chart";
|
|
327
|
+
SlideObjectType["connector"] = "connector";
|
|
328
|
+
SlideObjectType["group"] = "group";
|
|
329
|
+
SlideObjectType["hyperlink"] = "hyperlink";
|
|
330
|
+
SlideObjectType["image"] = "image";
|
|
331
|
+
SlideObjectType["media"] = "media";
|
|
332
|
+
SlideObjectType["model3d"] = "model3d";
|
|
333
|
+
SlideObjectType["oleObject"] = "oleObject";
|
|
334
|
+
SlideObjectType["online"] = "online";
|
|
335
|
+
SlideObjectType["placeholder"] = "placeholder";
|
|
336
|
+
SlideObjectType["table"] = "table";
|
|
337
|
+
SlideObjectType["tablecell"] = "tablecell";
|
|
338
|
+
SlideObjectType["text"] = "text";
|
|
339
|
+
SlideObjectType["notes"] = "notes";
|
|
340
|
+
SlideObjectType["zoom"] = "zoom";
|
|
341
|
+
return SlideObjectType;
|
|
342
|
+
}({});
|
|
343
|
+
/**
|
|
344
|
+
* Maps a friendly `ConnectorType` to its OOXML connector preset *family*. `straight`
|
|
345
|
+
* has a single fixed preset; `elbow` and `curved` select a member by bend count
|
|
346
|
+
* (`bentConnector{3,4,5}` / `curvedConnector{3,4,5}`) — see `connectorPresetFor`.
|
|
347
|
+
*/
|
|
348
|
+
const CONNECTOR_PRESETS = {
|
|
349
|
+
straight: "straightConnector1",
|
|
350
|
+
elbow: "bentConnector",
|
|
351
|
+
curved: "curvedConnector"
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Resolve the concrete connector preset geometry name for a `type` + bend count.
|
|
355
|
+
* `straight` ignores `bends` (it has no adjustable jog). For `elbow` / `curved`, the
|
|
356
|
+
* preset suffix is `bends + 2`, so `bends` of 1/2/3 maps to `…Connector3/4/5`, each
|
|
357
|
+
* of which exposes exactly `bends` adjustable guides (`adj1…adjN`).
|
|
358
|
+
* @param {'straight' | 'elbow' | 'curved'} type - friendly connector routing style
|
|
359
|
+
* @param {number} bends - number of adjustable bends (1–3); ignored for `straight`
|
|
360
|
+
* @return {CONNECTOR_PRESET_NAME} OOXML preset geometry name (e.g. `bentConnector4`)
|
|
361
|
+
*/
|
|
362
|
+
function connectorPresetFor(type, bends) {
|
|
363
|
+
if (type === "straight") return CONNECTOR_PRESETS.straight;
|
|
364
|
+
return `${CONNECTOR_PRESETS[type]}${bends + 2}`;
|
|
365
|
+
}
|
|
366
|
+
let PlaceholderType = /* @__PURE__ */ function(PlaceholderType) {
|
|
367
|
+
PlaceholderType["title"] = "title";
|
|
368
|
+
PlaceholderType["body"] = "body";
|
|
369
|
+
PlaceholderType["image"] = "pic";
|
|
370
|
+
PlaceholderType["chart"] = "chart";
|
|
371
|
+
PlaceholderType["table"] = "tbl";
|
|
372
|
+
PlaceholderType["media"] = "media";
|
|
373
|
+
return PlaceholderType;
|
|
374
|
+
}({});
|
|
375
|
+
/**
|
|
376
|
+
* Bullet glyph presets. Only `DEFAULT` is currently wired through to output; the remaining entries are
|
|
377
|
+
* reserved and not yet selectable via options.
|
|
378
|
+
*/
|
|
379
|
+
let BulletType = /* @__PURE__ */ function(BulletType) {
|
|
380
|
+
BulletType["DEFAULT"] = "•";
|
|
381
|
+
BulletType["CHECK"] = "✓";
|
|
382
|
+
BulletType["STAR"] = "★";
|
|
383
|
+
BulletType["TRIANGLE"] = "▶";
|
|
384
|
+
return BulletType;
|
|
385
|
+
}({});
|
|
386
|
+
/**
|
|
387
|
+
* Built-in PowerPoint table style IDs.
|
|
388
|
+
*
|
|
389
|
+
* Each value is the GUID that goes into `<a:tableStyleId>` inside `<a:tblPr>`.
|
|
390
|
+
* These 74 GUIDs are the complete set defined in [MS-OE376] §5.1.6.10 and are
|
|
391
|
+
* resolved by PowerPoint without embedding any style definition in the file.
|
|
392
|
+
*
|
|
393
|
+
* Only these enum members are supported. Raw GUID strings are not accepted;
|
|
394
|
+
* use `TableStyle` members exclusively.
|
|
395
|
+
*/
|
|
396
|
+
let TableStyle = /* @__PURE__ */ function(TableStyle) {
|
|
397
|
+
TableStyle["NO_STYLE_NO_GRID"] = "{2D5ABB26-0587-4C30-8999-92F81FD0307C}";
|
|
398
|
+
TableStyle["NO_STYLE_TABLE_GRID"] = "{5940675A-B579-460E-94D1-54222C63F5DA}";
|
|
399
|
+
TableStyle["THEMED_STYLE_1_ACCENT_1"] = "{3C2FFA5D-87B4-456A-9821-1D502468CF0F}";
|
|
400
|
+
TableStyle["THEMED_STYLE_1_ACCENT_2"] = "{284E427A-3D55-4303-BF80-6455036E1DE7}";
|
|
401
|
+
TableStyle["THEMED_STYLE_1_ACCENT_3"] = "{69C7853C-536D-4A76-A0AE-DD22124D55A5}";
|
|
402
|
+
TableStyle["THEMED_STYLE_1_ACCENT_4"] = "{775DCB02-9BB8-47FD-8907-85C794F793BA}";
|
|
403
|
+
TableStyle["THEMED_STYLE_1_ACCENT_5"] = "{35758FB7-9AC5-4552-8A53-C91805E547FA}";
|
|
404
|
+
TableStyle["THEMED_STYLE_1_ACCENT_6"] = "{08FB837D-C827-4EFA-A057-4D05807E0F7C}";
|
|
405
|
+
TableStyle["THEMED_STYLE_2_ACCENT_1"] = "{D113A9D2-9D6B-4929-AA2D-F23B5EE8CBE7}";
|
|
406
|
+
TableStyle["THEMED_STYLE_2_ACCENT_2"] = "{18603FDC-E32A-4AB5-989C-0864C3EAD2B8}";
|
|
407
|
+
TableStyle["THEMED_STYLE_2_ACCENT_3"] = "{306799F8-075E-4A3A-A7F6-7FBC6576F1A4}";
|
|
408
|
+
TableStyle["THEMED_STYLE_2_ACCENT_4"] = "{E269D01E-BC32-4049-B463-5C60D7B0CCD2}";
|
|
409
|
+
TableStyle["THEMED_STYLE_2_ACCENT_5"] = "{327F97BB-C833-4FB7-BDE5-3F7075034690}";
|
|
410
|
+
TableStyle["THEMED_STYLE_2_ACCENT_6"] = "{638B1855-1B75-4FBE-930C-398BA8C253C6}";
|
|
411
|
+
TableStyle["LIGHT_STYLE_1"] = "{9D7B26C5-4107-4FEC-AEDC-1716B250A1EF}";
|
|
412
|
+
TableStyle["LIGHT_STYLE_1_ACCENT_1"] = "{3B4B98B0-60AC-42C2-AFA5-B58CD77FA1E5}";
|
|
413
|
+
TableStyle["LIGHT_STYLE_1_ACCENT_2"] = "{0E3FDE45-AF77-4B5C-9715-49D594BDF05E}";
|
|
414
|
+
TableStyle["LIGHT_STYLE_1_ACCENT_3"] = "{C083E6E3-FA7D-4D7B-A595-EF9225AFEA82}";
|
|
415
|
+
TableStyle["LIGHT_STYLE_1_ACCENT_4"] = "{D27102A9-8310-4765-A935-A1911B00CA55}";
|
|
416
|
+
TableStyle["LIGHT_STYLE_1_ACCENT_5"] = "{5FD0F851-EC5A-4D38-B0AD-8093EC10F338}";
|
|
417
|
+
TableStyle["LIGHT_STYLE_1_ACCENT_6"] = "{68D230F3-CF80-4859-8CE7-A43EE81993B5}";
|
|
418
|
+
TableStyle["LIGHT_STYLE_2"] = "{7E9639D4-E3E2-4D34-9284-5A2195B3D0D7}";
|
|
419
|
+
TableStyle["LIGHT_STYLE_2_ACCENT_1"] = "{69012ECD-51FC-41F1-AA8D-1B2483CD663E}";
|
|
420
|
+
TableStyle["LIGHT_STYLE_2_ACCENT_2"] = "{72833802-FEF1-4C79-8D5D-14CF1EAF98D9}";
|
|
421
|
+
TableStyle["LIGHT_STYLE_2_ACCENT_3"] = "{F2DE63D5-997A-4646-A377-4702673A728D}";
|
|
422
|
+
TableStyle["LIGHT_STYLE_2_ACCENT_4"] = "{17292A2E-F333-43FB-9621-5CBBE7FDCDCB}";
|
|
423
|
+
TableStyle["LIGHT_STYLE_2_ACCENT_5"] = "{5A111915-BE36-4E01-A7E5-04B1672EAD32}";
|
|
424
|
+
TableStyle["LIGHT_STYLE_2_ACCENT_6"] = "{912C8C85-51F0-491E-9774-3900AFEF0FD7}";
|
|
425
|
+
TableStyle["LIGHT_STYLE_3"] = "{616DA210-FB5B-4158-B5E0-FEB733F419BA}";
|
|
426
|
+
TableStyle["LIGHT_STYLE_3_ACCENT_1"] = "{BC89EF96-8CEA-46FF-86C4-4CE0E7609802}";
|
|
427
|
+
TableStyle["LIGHT_STYLE_3_ACCENT_2"] = "{5DA37D80-6434-44D0-A028-1B22A696006F}";
|
|
428
|
+
TableStyle["LIGHT_STYLE_3_ACCENT_3"] = "{8799B23B-EC83-4686-B30A-512413B5E67A}";
|
|
429
|
+
TableStyle["LIGHT_STYLE_3_ACCENT_4"] = "{ED083AE6-46FA-4A59-8FB0-9F97EB10719F}";
|
|
430
|
+
TableStyle["LIGHT_STYLE_3_ACCENT_5"] = "{BDBED569-4797-4DF1-A0F4-6AAB3CD982D8}";
|
|
431
|
+
TableStyle["LIGHT_STYLE_3_ACCENT_6"] = "{E8B1032C-EA38-4F05-BA0D-38AFFFC7BED3}";
|
|
432
|
+
TableStyle["MEDIUM_STYLE_1"] = "{793D81CF-94F2-401A-BA57-92F5A7B2D0C5}";
|
|
433
|
+
TableStyle["MEDIUM_STYLE_1_ACCENT_1"] = "{B301B821-A1FF-4177-AEE7-76D212191A09}";
|
|
434
|
+
TableStyle["MEDIUM_STYLE_1_ACCENT_2"] = "{9DCAF9ED-07DC-4A11-8D7F-57B35C25682E}";
|
|
435
|
+
TableStyle["MEDIUM_STYLE_1_ACCENT_3"] = "{1FECB4D8-DB02-4DC6-A0A2-4F2EBAE1DC90}";
|
|
436
|
+
TableStyle["MEDIUM_STYLE_1_ACCENT_4"] = "{1E171933-4619-4E11-9A3F-F7608DF75F80}";
|
|
437
|
+
TableStyle["MEDIUM_STYLE_1_ACCENT_5"] = "{FABFCF23-3B69-468F-B69F-88F6DE6A72F2}";
|
|
438
|
+
TableStyle["MEDIUM_STYLE_1_ACCENT_6"] = "{10A1B5D5-9B99-4C35-A422-299274C87663}";
|
|
439
|
+
TableStyle["MEDIUM_STYLE_2"] = "{073A0DAA-6AF3-43AB-8588-CEC1D06C72B9}";
|
|
440
|
+
TableStyle["MEDIUM_STYLE_2_ACCENT_1"] = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
|
|
441
|
+
TableStyle["MEDIUM_STYLE_2_ACCENT_2"] = "{21E4AEA4-8DFA-4A89-87EB-49C32662AFE0}";
|
|
442
|
+
TableStyle["MEDIUM_STYLE_2_ACCENT_3"] = "{F5AB1C69-6EDB-4FF4-983F-18BD219EF322}";
|
|
443
|
+
TableStyle["MEDIUM_STYLE_2_ACCENT_4"] = "{00A15C55-8517-42AA-B614-E9B94910E393}";
|
|
444
|
+
TableStyle["MEDIUM_STYLE_2_ACCENT_5"] = "{7DF18680-E054-41AD-8BC1-D1AEF772440D}";
|
|
445
|
+
TableStyle["MEDIUM_STYLE_2_ACCENT_6"] = "{93296810-A885-4BE3-A3E7-6D5BEEA58F35}";
|
|
446
|
+
TableStyle["MEDIUM_STYLE_3"] = "{8EC20E35-A176-4012-BC5E-935CFFF8708E}";
|
|
447
|
+
TableStyle["MEDIUM_STYLE_3_ACCENT_1"] = "{6E25E649-3F16-4E02-A733-19D2CDBF48F0}";
|
|
448
|
+
TableStyle["MEDIUM_STYLE_3_ACCENT_2"] = "{85BE263C-DBD7-4A20-BB59-AAB30ACAA65A}";
|
|
449
|
+
TableStyle["MEDIUM_STYLE_3_ACCENT_3"] = "{EB344D84-9AFB-497E-A393-DC336BA19D2E}";
|
|
450
|
+
TableStyle["MEDIUM_STYLE_3_ACCENT_4"] = "{EB9631B5-78F2-41C9-869B-9F39066F8104}";
|
|
451
|
+
TableStyle["MEDIUM_STYLE_3_ACCENT_5"] = "{74C1A8A3-306A-4EB7-A6B1-4F7E0EB9C5D6}";
|
|
452
|
+
TableStyle["MEDIUM_STYLE_3_ACCENT_6"] = "{2A488322-F2BA-4B5B-9748-0D474271808F}";
|
|
453
|
+
TableStyle["MEDIUM_STYLE_4"] = "{D7AC3CCA-C797-4891-BE02-D94E43425B78}";
|
|
454
|
+
TableStyle["MEDIUM_STYLE_4_ACCENT_1"] = "{69CF1AB2-1976-4502-BF36-3FF5EA218861}";
|
|
455
|
+
TableStyle["MEDIUM_STYLE_4_ACCENT_2"] = "{8A107856-5554-42FB-B03E-39F5DBC370BA}";
|
|
456
|
+
TableStyle["MEDIUM_STYLE_4_ACCENT_3"] = "{0505E3EF-67EA-436B-97B2-0124C06EBD24}";
|
|
457
|
+
TableStyle["MEDIUM_STYLE_4_ACCENT_4"] = "{C4B1156A-380E-4F78-BDF5-A606A8083BF9}";
|
|
458
|
+
TableStyle["MEDIUM_STYLE_4_ACCENT_5"] = "{22838BEF-8BB2-4498-84A7-C5851F593DF1}";
|
|
459
|
+
TableStyle["MEDIUM_STYLE_4_ACCENT_6"] = "{16D9F66E-5EB9-4882-86FB-DCBF35E3C3E4}";
|
|
460
|
+
TableStyle["DARK_STYLE_1"] = "{E8034E78-7F5D-4C2E-B375-FC64B27BC917}";
|
|
461
|
+
TableStyle["DARK_STYLE_1_ACCENT_1"] = "{125E5076-3810-47DD-B79F-674D7AD40C01}";
|
|
462
|
+
TableStyle["DARK_STYLE_1_ACCENT_2"] = "{37CE84F3-28C3-443E-9E96-99CF82512B78}";
|
|
463
|
+
TableStyle["DARK_STYLE_1_ACCENT_3"] = "{D03447BB-5D67-496B-8E87-E561075AD55C}";
|
|
464
|
+
TableStyle["DARK_STYLE_1_ACCENT_4"] = "{E929F9F4-4A8F-4326-A1B4-22849713DDAB}";
|
|
465
|
+
TableStyle["DARK_STYLE_1_ACCENT_5"] = "{8FD4443E-F989-4FC4-A0C8-D5A2AF1F390B}";
|
|
466
|
+
TableStyle["DARK_STYLE_1_ACCENT_6"] = "{AF606853-7671-496A-8E4F-DF71F8EC918B}";
|
|
467
|
+
TableStyle["DARK_STYLE_2"] = "{5202B0CA-FC54-4496-8BCA-5EF66A818D29}";
|
|
468
|
+
/** Header uses Accent 2, body rows use Accent 1 */
|
|
469
|
+
TableStyle["DARK_STYLE_2_ACCENT_1_ACCENT_2"] = "{0660B408-B3CF-4A94-85FC-2B1E0A45F4A2}";
|
|
470
|
+
/** Header uses Accent 4, body rows use Accent 3 */
|
|
471
|
+
TableStyle["DARK_STYLE_2_ACCENT_3_ACCENT_4"] = "{91EBBBCC-DAD2-459C-BE2E-F6DE35CF9A28}";
|
|
472
|
+
/** Header uses Accent 6, body rows use Accent 5 */
|
|
473
|
+
TableStyle["DARK_STYLE_2_ACCENT_5_ACCENT_6"] = "{46F890A9-2807-4EBB-B81D-B2AA78EC7F39}";
|
|
474
|
+
return TableStyle;
|
|
475
|
+
}({});
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/constants-internal.ts
|
|
478
|
+
const LAYOUT_IDX_SERIES_BASE = 2147483649;
|
|
479
|
+
const REGEX_HEX_COLOR = /^[0-9a-fA-F]{6}$/;
|
|
480
|
+
const LINEH_MODIFIER = 1.67;
|
|
481
|
+
const DEF_CELL_BORDER = {
|
|
482
|
+
type: "solid",
|
|
483
|
+
color: "666666",
|
|
484
|
+
width: 1
|
|
485
|
+
};
|
|
486
|
+
const DEF_CELL_MARGIN_IN = [
|
|
487
|
+
.05,
|
|
488
|
+
.1,
|
|
489
|
+
.05,
|
|
490
|
+
.1
|
|
491
|
+
];
|
|
492
|
+
const DEF_CHART_BORDER = {
|
|
493
|
+
type: "solid",
|
|
494
|
+
color: "363636",
|
|
495
|
+
width: 1
|
|
496
|
+
};
|
|
497
|
+
const DEF_CHART_GRIDLINE = {
|
|
498
|
+
color: "888888",
|
|
499
|
+
style: "solid",
|
|
500
|
+
size: 1,
|
|
501
|
+
cap: "flat"
|
|
502
|
+
};
|
|
503
|
+
const DEF_FONT_COLOR = "000000";
|
|
504
|
+
const DEF_PRES_LAYOUT = "LAYOUT_16x9";
|
|
505
|
+
const DEF_PRES_LAYOUT_NAME = "DEFAULT";
|
|
506
|
+
const DEF_SHAPE_LINE_COLOR = "333333";
|
|
507
|
+
const DEF_SHAPE_SHADOW = {
|
|
508
|
+
type: "outer",
|
|
509
|
+
blur: 3,
|
|
510
|
+
offset: 23e3 / 12700,
|
|
511
|
+
angle: 90,
|
|
512
|
+
color: "000000",
|
|
513
|
+
_alpha: .35,
|
|
514
|
+
rotateWithShape: true
|
|
515
|
+
};
|
|
516
|
+
const DEF_SLIDE_MARGIN_IN = [
|
|
517
|
+
.5,
|
|
518
|
+
.5,
|
|
519
|
+
.5,
|
|
520
|
+
.5
|
|
521
|
+
];
|
|
522
|
+
const DEF_TEXT_SHADOW = {
|
|
523
|
+
type: "outer",
|
|
524
|
+
blur: 8,
|
|
525
|
+
offset: 4,
|
|
526
|
+
angle: 270,
|
|
527
|
+
color: "000000",
|
|
528
|
+
_alpha: .75
|
|
529
|
+
};
|
|
530
|
+
const DEF_TEXT_GLOW = {
|
|
531
|
+
size: 8,
|
|
532
|
+
color: "FFFFFF",
|
|
533
|
+
opacity: .75
|
|
534
|
+
};
|
|
535
|
+
const AXIS_ID_VALUE_PRIMARY = "2094734552";
|
|
536
|
+
const AXIS_ID_VALUE_SECONDARY = "2094734553";
|
|
537
|
+
const AXIS_ID_CATEGORY_PRIMARY = "2094734554";
|
|
538
|
+
const AXIS_ID_CATEGORY_SECONDARY = "2094734555";
|
|
539
|
+
const AXIS_ID_SERIES_PRIMARY = "2094734556";
|
|
540
|
+
const LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
541
|
+
const BARCHART_COLORS = [
|
|
542
|
+
"C0504D",
|
|
543
|
+
"4F81BD",
|
|
544
|
+
"9BBB59",
|
|
545
|
+
"8064A2",
|
|
546
|
+
"4BACC6",
|
|
547
|
+
"F79646",
|
|
548
|
+
"628FC6",
|
|
549
|
+
"C86360"
|
|
550
|
+
];
|
|
551
|
+
const PIECHART_COLORS = [
|
|
552
|
+
"5DA5DA",
|
|
553
|
+
"FAA43A",
|
|
554
|
+
"60BD68",
|
|
555
|
+
"F17CB0",
|
|
556
|
+
"B2912F",
|
|
557
|
+
"B276B2",
|
|
558
|
+
"DECF3F",
|
|
559
|
+
"F15854",
|
|
560
|
+
"A7A7A7"
|
|
561
|
+
];
|
|
562
|
+
const SLDNUMFLDID = "{F7021451-1387-4CA6-816F-3879F97B5CBC}";
|
|
563
|
+
const SLDNUM_PLACEHOLDER_TEXT = "‹#›";
|
|
564
|
+
const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/units-internal.ts
|
|
567
|
+
/**
|
|
568
|
+
* Generator-side unit conversion — the lenient layer over `units.ts`.
|
|
569
|
+
*
|
|
570
|
+
* `units.ts` holds the strict, public primitives: one branded `Emu` type and converters that
|
|
571
|
+
* take a number and throw on anything they cannot represent. This module holds what the
|
|
572
|
+
* generators actually need on top of that: converters that accept the loose shapes the
|
|
573
|
+
* authoring API has always accepted (numeric strings, `"5in"`, `null`), that clamp to the
|
|
574
|
+
* ranges PowerPoint will load without offering to repair the file, and that warn about legacy
|
|
575
|
+
* inputs instead of failing.
|
|
576
|
+
*
|
|
577
|
+
* The split is deliberate: the leniency and the back-compat warnings are policy, not
|
|
578
|
+
* arithmetic, and policy should not be part of the published API. Nothing here is exported
|
|
579
|
+
* from an entrypoint.
|
|
580
|
+
*/
|
|
581
|
+
/**
|
|
582
|
+
* Resolve a user `Coord` (x/y/w/h) to EMU — the single user-coordinate → EMU boundary.
|
|
583
|
+
* - bare `number` → **inches** (no magnitude guessing); `"<n>%"` → percent of the slide axis;
|
|
584
|
+
* `"<n>in"`/`"<n>pt"`/`"<n>emu"` → explicit units (see {@link Coord} / {@link coordToEmu})
|
|
585
|
+
* - `null`/`undefined` → 0 (callers may omit a coordinate)
|
|
586
|
+
* - throws on a non-finite number rather than silently collapsing the object to zero size
|
|
587
|
+
* @param {Coord|null|undefined} size - user coordinate
|
|
588
|
+
* @param {'X' | 'Y'} xyDir - axis (selects slide width vs height for percentages)
|
|
589
|
+
* @param {PresLayout} layout - presentation layout (EMU dimensions)
|
|
590
|
+
* @returns {Emu} resolved EMU value
|
|
591
|
+
*/
|
|
592
|
+
function getSmartParseNumber(size, xyDir, layout) {
|
|
593
|
+
if (size === null || size === void 0) return 0;
|
|
594
|
+
if (typeof size === "number" && !isFinite(size)) throw new InvalidOptionError("coord/non-finite", `Invalid ${xyDir || "coordinate"} value: expected a finite number but received ${String(size)}. This usually means a layout dimension was read from a missing property (e.g. \`layout.width\` returning \`undefined\`). Use \`slide.width\`/\`slide.height\` or \`STANDARD_LAYOUTS.<NAME>.width\`/\`.height\` (inches).`);
|
|
595
|
+
return coordToEmu(size, xyDir === "Y" ? layout.height : layout.width);
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Convert inches into EMU.
|
|
599
|
+
* - accepts a number (inches) or a numeric/`"<n>in"` string
|
|
600
|
+
* - no magnitude guessing: values are always treated as inches (use {@link coordToEmu} for
|
|
601
|
+
* user coordinates that may carry other units)
|
|
602
|
+
* @param {number|string} inches - inches as number or string
|
|
603
|
+
* @returns {Emu} EMU value
|
|
604
|
+
*/
|
|
605
|
+
function inch2Emu(inches) {
|
|
606
|
+
if (typeof inches === "string") inches = Number(inches.replace(/in*/gi, ""));
|
|
607
|
+
return inchesToEmu(inches);
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Convert a single `margin` component (table cell/table margin, or text-box/placeholder body
|
|
611
|
+
* inset) to EMU.
|
|
612
|
+
*
|
|
613
|
+
* Margins are INCHES, consistent with the positional API (`x`/`y`/`w`/`h`) and the value
|
|
614
|
+
* PowerPoint's own dialog shows (both the table cell-margin and the text-box internal-margin
|
|
615
|
+
* fields are inches). Historically the library read these as POINTS (table cells used a magnitude
|
|
616
|
+
* heuristic — `>= 1` points, `< 1` inches; text-box margins were straight points), so a legitimate
|
|
617
|
+
* fraction-of-an-inch value entered from the PowerPoint dialog became a tiny points value. Every
|
|
618
|
+
* value is now inches. A `>= 1` value is honored as inches but warns once, because it is almost
|
|
619
|
+
* certainly a legacy points value that should be divided by 72 (e.g. `10` points → `0.139` inches).
|
|
620
|
+
*
|
|
621
|
+
* Shared by every margin site so they stay in lockstep: the cell XML emitter and text-box/slide-
|
|
622
|
+
* number insets (`gen/slide/object.ts`), the autoPage row-height pass (`gen/table/autopage.ts`), and the measured-fit pass
|
|
623
|
+
* (`measure-fit`).
|
|
624
|
+
* @param {number} inches - margin component in inches
|
|
625
|
+
* @returns {Emu} EMU value
|
|
626
|
+
*/
|
|
627
|
+
function marginToEmu(inches) {
|
|
628
|
+
if (inches >= 1) warnOnce("margin/legacy-points", "margins (table cell and text-box) are interpreted as inches (matching the rest of the API and the PowerPoint dialog); a value >= 1 is likely a legacy points value — divide by 72 to convert (e.g. 10pt => 0.139in).");
|
|
629
|
+
return inch2Emu(inches);
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Resolve a table's column widths to EMU, the single source of truth shared by the
|
|
633
|
+
* table XML emitter and the measured-fit pass (so a fitted cell sees the same grid
|
|
634
|
+
* the renderer draws).
|
|
635
|
+
* - an explicit `colW` **array** is per-column inches (`inch2Emu`); a non-finite slot
|
|
636
|
+
* falls back to the even-distribution width
|
|
637
|
+
* - otherwise the table's already-resolved width (`totalWidthEmu`, EMU) is split evenly
|
|
638
|
+
* across `colCount` columns. (A scalar `colW` never reaches here — `addTableDefinition`
|
|
639
|
+
* converts it to `w` and clears `colW`.)
|
|
640
|
+
*
|
|
641
|
+
* IMPORTANT: the even path divides an **EMU** width. Passing the raw inches `options.w`
|
|
642
|
+
* instead (the historical bug) produced ~0-EMU columns (e.g. `w=9` → `gridCol w="3"`),
|
|
643
|
+
* collapsing auto-width tables to a sliver in PowerPoint/LibreOffice.
|
|
644
|
+
* @param {Coord[]|Coord|undefined} colW - explicit per-column inches, or scalar/undefined
|
|
645
|
+
* @param {number} totalWidthEmu - the table's resolved width in EMU
|
|
646
|
+
* @param {number} colCount - number of grid columns (counting colspans)
|
|
647
|
+
* @returns {number[]} per-column widths in EMU (length `colCount`)
|
|
648
|
+
*/
|
|
649
|
+
function resolveTableColWidthsEmu(colW, totalWidthEmu, colCount) {
|
|
650
|
+
if (!(colCount > 0)) return [];
|
|
651
|
+
const even = totalWidthEmu > 0 ? Math.round(totalWidthEmu / colCount) : EMU_PER_INCH;
|
|
652
|
+
if (Array.isArray(colW)) return Array.from({ length: colCount }, (_, i) => {
|
|
653
|
+
const n = colW[i];
|
|
654
|
+
return typeof n === "number" && Number.isFinite(n) ? Math.round(inch2Emu(n)) : even;
|
|
655
|
+
});
|
|
656
|
+
return new Array(colCount).fill(even);
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Convert points to EMU, leniently: anything that does not read as a finite number — a `NaN`,
|
|
660
|
+
* an `Infinity`, a non-numeric string, `null` — becomes `0` rather than throwing.
|
|
661
|
+
*
|
|
662
|
+
* That is the whole difference from {@link pointsToEmu} in `units.ts`, which throws on the same
|
|
663
|
+
* input. Emitters use this one for the many optional size/width/offset options where a missing
|
|
664
|
+
* or malformed value should collapse the feature (a zero-width line, no shadow offset) rather
|
|
665
|
+
* than take the whole deck down.
|
|
666
|
+
*
|
|
667
|
+
* @param pt - points, as a number or a numeric string
|
|
668
|
+
* @returns the value in EMU, or `0` if it does not read as a finite number
|
|
669
|
+
*/
|
|
670
|
+
function ptsToEmuLenient(pt) {
|
|
671
|
+
const points = Number(pt);
|
|
672
|
+
return Number.isFinite(points) ? Math.round(points * EMU_PER_POINT) : 0;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Convert a transparency percentage (0-100) into a schema-valid `<a:alpha>` value
|
|
676
|
+
* (ST_PositiveFixedPercentage, 0-100000). Out-of-range transparency yields an
|
|
677
|
+
* alpha that PowerPoint rejects as needing repair, so clamp into range and warn.
|
|
678
|
+
*/
|
|
679
|
+
function transparencyToAlpha(transparency) {
|
|
680
|
+
const pct = Math.min(100, Math.max(0, transparency));
|
|
681
|
+
if (pct !== transparency) warn("transparency/out-of-range", `transparency ${transparency} is outside the valid range 0-100; using ${pct}.`);
|
|
682
|
+
return Math.round((100 - pct) * FIXED_PCT_PER_PERCENT);
|
|
683
|
+
}
|
|
684
|
+
/** Convert an opacity (0-1) into a schema-valid `<a:alpha>` value (0-100000); clamps + warns on out-of-range input. */
|
|
685
|
+
function opacityToAlpha(opacity) {
|
|
686
|
+
const o = Math.min(1, Math.max(0, opacity));
|
|
687
|
+
if (o !== opacity) warn("opacity/out-of-range", `opacity ${opacity} is outside the valid range 0-1; using ${o}.`);
|
|
688
|
+
return Math.round(o * PERCENT_SCALE);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Convert a line width (points) to EMU clamped into ST_LineWidth (0..20116800 EMU,
|
|
692
|
+
* i.e. 0-1584pt). Out-of-range widths make PowerPoint report the package as needing
|
|
693
|
+
* repair, so clamp into range and warn.
|
|
694
|
+
*/
|
|
695
|
+
function lineWidthToEmu(widthPts) {
|
|
696
|
+
const raw = ptsToEmuLenient(widthPts);
|
|
697
|
+
const clamped = Math.min(20116800, Math.max(0, raw));
|
|
698
|
+
if (clamped !== raw) warn("line/width-out-of-range", `line width ${widthPts} is outside the valid range 0-1584pt; using ${clamped / EMU_PER_POINT}.`);
|
|
699
|
+
return clamped;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Convert degrees to a DrawingML angle (60000ths of a degree), **without** wrapping.
|
|
703
|
+
*
|
|
704
|
+
* Most angles in the format are not modular: a connection site at 400 degrees, a polar adjust
|
|
705
|
+
* handle whose range runs to 540, an arc that sweeps 400 degrees — each means something a
|
|
706
|
+
* reduction into 0..360 would destroy. Use this for those, and {@link convertRotationDegrees}
|
|
707
|
+
* for the ones that genuinely are a rotation.
|
|
708
|
+
*
|
|
709
|
+
* Non-finite input throws rather than reaching the attribute: `Math.round(Infinity * 60000)` is
|
|
710
|
+
* `Infinity`, which serializes as `ang="Infinity"` and makes PowerPoint offer to repair the file.
|
|
711
|
+
*
|
|
712
|
+
* @param d - degrees
|
|
713
|
+
* @param what - what is being converted, for the error message
|
|
714
|
+
* @param code - diagnostic code to throw under, where a caller has a more specific one
|
|
715
|
+
*/
|
|
716
|
+
function convertAngleUnits(d, what, code = "coord/non-finite") {
|
|
717
|
+
assertFiniteDegrees(d, what, code);
|
|
718
|
+
return Math.round(d * ANGLE_UNITS_PER_DEGREE);
|
|
719
|
+
}
|
|
720
|
+
function assertFiniteDegrees(d, what, code) {
|
|
721
|
+
if (typeof d !== "number" || !Number.isFinite(d)) throw new InvalidOptionError(code, `${what} must be a finite number of degrees; received ${String(d)}.`);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Convert a shape or gradient rotation (degrees) to a DrawingML angle (60000ths of a degree).
|
|
725
|
+
*
|
|
726
|
+
* A rotation *is* modular — 800 degrees and 80 degrees point the same way — so the value is
|
|
727
|
+
* reduced with `% 360`. The reduction keeps the sign: `-45` stays `-45` rather than becoming
|
|
728
|
+
* `315`, because both are valid `ST_Angle`, PowerPoint writes negative rotations itself, and
|
|
729
|
+
* the read side reports back what was authored. Only an input outside -360..360 moves.
|
|
730
|
+
*
|
|
731
|
+
* @param d - degrees
|
|
732
|
+
* @returns the `rot` value in 60000ths of a degree
|
|
733
|
+
*/
|
|
734
|
+
function convertRotationDegrees(d) {
|
|
735
|
+
const degrees = d || 0;
|
|
736
|
+
assertFiniteDegrees(degrees, "rotation", "coord/non-finite");
|
|
737
|
+
return Math.round(degrees % 360 * ANGLE_UNITS_PER_DEGREE);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Convert a freeform arc angle (degrees) to an `<a:arcTo>` ST_AdjAngle value (60000ths).
|
|
741
|
+
* Unlike a shape rotation, a sweep is not modular: a 400 degree swAng draws a different
|
|
742
|
+
* arc than a 40 degree one, so the value is never wrapped into 0..360.
|
|
743
|
+
* @param {number} d degrees
|
|
744
|
+
* @param {'stAng' | 'swAng'} attr - attribute being emitted, for the error message
|
|
745
|
+
* @returns {number} ST_AdjAngle value (60000ths of a degree)
|
|
746
|
+
*/
|
|
747
|
+
function convertArcAngle(d, attr) {
|
|
748
|
+
return convertAngleUnits(d, `Arc ${attr}`, "geometry/arc-angle-non-finite");
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
export { isChartExType as $, LAYOUT_IDX_SERIES_BASE as A, BulletType as B, DEF_PRES_LAYOUT as C, DEF_SLIDE_MARGIN_IN as D, DEF_SHAPE_SHADOW as E, SLDNUMFLDID as F, SchemeColor as G, ChartType as H, SLDNUM_PLACEHOLDER_TEXT as I, TableStyle as J, ShapeType as K, XML_DECL as L, LINEH_MODIFIER as M, PIECHART_COLORS as N, DEF_TEXT_GLOW as O, REGEX_HEX_COLOR as P, connectorPresetFor as Q, AlignH as R, DEF_FONT_COLOR as S, DEF_SHAPE_LINE_COLOR as T, OutputType as U, CONNECTOR_PRESETS as V, PlaceholderType as W, VALID_SHAPE_PRESETS as X, TextAnchor as Y, asChartType as Z, BARCHART_COLORS as _, inch2Emu as a, DEF_CHART_BORDER as b, opacityToAlpha as c, transparencyToAlpha as d, isChartType as et, AXIS_ID_CATEGORY_PRIMARY as f, AXIS_ID_VALUE_SECONDARY as g, AXIS_ID_VALUE_PRIMARY as h, getSmartParseNumber as i, LETTERS as j, DEF_TEXT_SHADOW as k, ptsToEmuLenient as l, AXIS_ID_SERIES_PRIMARY as m, convertArcAngle as n, lineWidthToEmu as o, AXIS_ID_CATEGORY_SECONDARY as p, SlideObjectType as q, convertRotationDegrees as r, marginToEmu as s, convertAngleUnits as t, resolveTableColWidthsEmu as u, DEF_CELL_BORDER as v, DEF_PRES_LAYOUT_NAME as w, DEF_CHART_GRIDLINE as x, DEF_CELL_MARGIN_IN as y, AlignV as z };
|
|
752
|
+
|
|
753
|
+
//# sourceMappingURL=units-internal-Dg95w_YD.js.map
|