@shbernal/ts-pptx 4.1.0 → 5.0.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 (139) hide show
  1. package/README.md +11 -11
  2. package/dist/anim-presets-Qbgh8uut.js +55 -0
  3. package/dist/anim-presets-Qbgh8uut.js.map +1 -0
  4. package/dist/{autopage-D4kyVp11.js → autopage-DqZ37VpL.js} +11 -12
  5. package/dist/autopage-DqZ37VpL.js.map +1 -0
  6. package/dist/{binary-string-CKVAYI3M.js → binary-string-Ba8VM3b9.js} +3 -4
  7. package/dist/binary-string-Ba8VM3b9.js.map +1 -0
  8. package/dist/{body-insets-kVHmjGc6.js → body-insets-BDHymJvz.js} +7 -9
  9. package/dist/body-insets-BDHymJvz.js.map +1 -0
  10. package/dist/browser.d.ts +24 -16
  11. package/dist/browser.d.ts.map +1 -1
  12. package/dist/browser.js +19 -19
  13. package/dist/browser.js.map +1 -1
  14. package/dist/{image-size-DwDbakcl.js → chart-metadata-CwiTTcJq.js} +576 -538
  15. package/dist/chart-metadata-CwiTTcJq.js.map +1 -0
  16. package/dist/{clip-DHDlnHUq.d.ts → clip-ISfCMtWA.d.ts} +6 -10
  17. package/dist/clip-ISfCMtWA.d.ts.map +1 -0
  18. package/dist/{notes-BcT571R4.js → comments-CKIZYRbZ.js} +517 -389
  19. package/dist/comments-CKIZYRbZ.js.map +1 -0
  20. package/dist/{diagnostics-DiMmBU8P.d.ts → diagnostics-MoA4MBq5.d.ts} +52 -50
  21. package/dist/diagnostics-MoA4MBq5.d.ts.map +1 -0
  22. package/dist/{embedded-fonts-CI_YGW2d.d.ts → embedded-fonts-U7HIIhPO.d.ts} +4 -6
  23. package/dist/embedded-fonts-U7HIIhPO.d.ts.map +1 -0
  24. package/dist/{entry-compose-6hF9aTmT.d.ts → entry-compose-CiakSt-f.d.ts} +53 -74
  25. package/dist/entry-compose-CiakSt-f.d.ts.map +1 -0
  26. package/dist/{errors-Da2nXCJm.js → entry-errors-JMthgJ2g.js} +41 -25
  27. package/dist/entry-errors-JMthgJ2g.js.map +1 -0
  28. package/dist/{table-cell-margins-PDshga8T.js → enums-BP9wsb9Q.js} +42 -45
  29. package/dist/enums-BP9wsb9Q.js.map +1 -0
  30. package/dist/{enums-DQRpVOLh.d.ts → enums-PcXr3o3J.d.ts} +11 -12
  31. package/dist/{enums-DQRpVOLh.d.ts.map → enums-PcXr3o3J.d.ts.map} +1 -1
  32. package/dist/families.d.ts +24 -26
  33. package/dist/families.d.ts.map +1 -1
  34. package/dist/families.js +3 -4
  35. package/dist/{fit-CcXbg__l.js → fit-Bpmzep6O.js} +60 -52
  36. package/dist/fit-Bpmzep6O.js.map +1 -0
  37. package/dist/{font-metrics-CBGmhLo0.d.ts → font-metrics-DTppw4t3.d.ts} +61 -37
  38. package/dist/font-metrics-DTppw4t3.d.ts.map +1 -0
  39. package/dist/{grid-9B2w5EaY.js → grid-DUIMxjfl.js} +23 -26
  40. package/dist/grid-DUIMxjfl.js.map +1 -0
  41. package/dist/{html-dom-DvJmuHt2.js → html-dom-LZCgntnJ.js} +42 -43
  42. package/dist/html-dom-LZCgntnJ.js.map +1 -0
  43. package/dist/html.d.ts +53 -9
  44. package/dist/html.d.ts.map +1 -1
  45. package/dist/html.js +12 -13
  46. package/dist/html.js.map +1 -1
  47. package/dist/index.d.ts +21 -13
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +15 -15
  50. package/dist/index.js.map +1 -1
  51. package/dist/inspect.d.ts +14 -16
  52. package/dist/inspect.d.ts.map +1 -1
  53. package/dist/inspect.js +18 -19
  54. package/dist/inspect.js.map +1 -1
  55. package/dist/{text-anchor-BgLPbwbL.js → lock-attrs-CSQnFDHP.js} +62 -12
  56. package/dist/lock-attrs-CSQnFDHP.js.map +1 -0
  57. package/dist/math.d.ts +2 -4
  58. package/dist/math.d.ts.map +1 -1
  59. package/dist/math.js +12 -13
  60. package/dist/math.js.map +1 -1
  61. package/dist/measure.d.ts +23 -12
  62. package/dist/measure.d.ts.map +1 -1
  63. package/dist/measure.js +3 -3
  64. package/dist/node.d.ts +21 -13
  65. package/dist/node.d.ts.map +1 -1
  66. package/dist/node.js +12 -12
  67. package/dist/node.js.map +1 -1
  68. package/dist/{options-internal-WqgMf720.js → options-internal-BWgmLPdx.js} +4 -5
  69. package/dist/options-internal-BWgmLPdx.js.map +1 -0
  70. package/dist/{package-KoEgVwII.d.ts → package-CANBWuSm.d.ts} +4 -12
  71. package/dist/package-CANBWuSm.d.ts.map +1 -0
  72. package/dist/{playbtn-CUqQdoDf.js → playbtn-BQZFJir9.js} +4 -5
  73. package/dist/playbtn-BQZFJir9.js.map +1 -0
  74. package/dist/{pres-BA9_lJbY.d.ts → pres-BkEkUAEM.d.ts} +383 -230
  75. package/dist/pres-BkEkUAEM.d.ts.map +1 -0
  76. package/dist/{presentation-Cyl74rq2.js → presentation-4Ggq0_Xa.js} +408 -288
  77. package/dist/presentation-4Ggq0_Xa.js.map +1 -0
  78. package/dist/{presentation-types-B3VQH4Bz.d.ts → presentation-types-BgnZR-0a.d.ts} +1104 -457
  79. package/dist/presentation-types-BgnZR-0a.d.ts.map +1 -0
  80. package/dist/read.d.ts +18 -13
  81. package/dist/read.d.ts.map +1 -1
  82. package/dist/read.js +4 -4
  83. package/dist/script.d.ts +116 -65
  84. package/dist/script.d.ts.map +1 -1
  85. package/dist/script.js +2697 -777
  86. package/dist/script.js.map +1 -1
  87. package/dist/{shapes-BcyFdZpp.js → shapes-CAPOjU0Q.js} +1556 -487
  88. package/dist/shapes-CAPOjU0Q.js.map +1 -0
  89. package/dist/{slide-BqPtyKmb.d.ts → slide-BmT4kMoO.d.ts} +94 -86
  90. package/dist/slide-BmT4kMoO.d.ts.map +1 -0
  91. package/dist/{slide-size-BalTjFuv.js → slide-size-SkScz1ig.js} +2 -3
  92. package/dist/{slide-size-BalTjFuv.js.map → slide-size-SkScz1ig.js.map} +1 -1
  93. package/dist/{table-dom-CVbvUfgh.js → table-dom-BYga4FYY.js} +3 -4
  94. package/dist/{table-dom-CVbvUfgh.js.map → table-dom-BYga4FYY.js.map} +1 -1
  95. package/dist/{text-BvFFMMFQ.js → text-Dz0ArGIp.js} +365 -318
  96. package/dist/text-Dz0ArGIp.js.map +1 -0
  97. package/dist/{transition-speed-kUEWDWTx.js → transition-speed-CNJ0fSpQ.js} +2 -3
  98. package/dist/{transition-speed-kUEWDWTx.js.map → transition-speed-CNJ0fSpQ.js.map} +1 -1
  99. package/dist/{units-internal-DFcUYjh3.js → units-internal-BR3a4cIi.js} +26 -29
  100. package/dist/units-internal-BR3a4cIi.js.map +1 -0
  101. package/dist/{zip-CYZ0F6BV.js → zip-7JTh61LX.js} +8 -10
  102. package/dist/zip-7JTh61LX.js.map +1 -0
  103. package/dist/{zip-CTll_dr0.d.ts → zip-uUjs9Cqx.d.ts} +4 -6
  104. package/dist/zip-uUjs9Cqx.d.ts.map +1 -0
  105. package/dist/zip.d.ts +3 -3
  106. package/dist/zip.js +3 -3
  107. package/dist/{zoom-BoNyOlPm.js → zoom-CSSeOwM8.js} +1153 -583
  108. package/dist/zoom-CSSeOwM8.js.map +1 -0
  109. package/package.json +20 -21
  110. package/skills/{ts-pptx-upstream → pptx-ts-upstream}/SKILL.md +27 -74
  111. package/dist/autopage-D4kyVp11.js.map +0 -1
  112. package/dist/binary-string-CKVAYI3M.js.map +0 -1
  113. package/dist/body-insets-kVHmjGc6.js.map +0 -1
  114. package/dist/clip-DHDlnHUq.d.ts.map +0 -1
  115. package/dist/diagnostics-DiMmBU8P.d.ts.map +0 -1
  116. package/dist/embedded-fonts-CI_YGW2d.d.ts.map +0 -1
  117. package/dist/entry-compose-6hF9aTmT.d.ts.map +0 -1
  118. package/dist/errors-Da2nXCJm.js.map +0 -1
  119. package/dist/fit-CcXbg__l.js.map +0 -1
  120. package/dist/font-metrics-CBGmhLo0.d.ts.map +0 -1
  121. package/dist/grid-9B2w5EaY.js.map +0 -1
  122. package/dist/html-dom-DvJmuHt2.js.map +0 -1
  123. package/dist/image-size-DwDbakcl.js.map +0 -1
  124. package/dist/notes-BcT571R4.js.map +0 -1
  125. package/dist/options-internal-WqgMf720.js.map +0 -1
  126. package/dist/package-KoEgVwII.d.ts.map +0 -1
  127. package/dist/playbtn-CUqQdoDf.js.map +0 -1
  128. package/dist/pres-BA9_lJbY.d.ts.map +0 -1
  129. package/dist/presentation-Cyl74rq2.js.map +0 -1
  130. package/dist/presentation-types-B3VQH4Bz.d.ts.map +0 -1
  131. package/dist/shapes-BcyFdZpp.js.map +0 -1
  132. package/dist/slide-BqPtyKmb.d.ts.map +0 -1
  133. package/dist/table-cell-margins-PDshga8T.js.map +0 -1
  134. package/dist/text-BvFFMMFQ.js.map +0 -1
  135. package/dist/text-anchor-BgLPbwbL.js.map +0 -1
  136. package/dist/units-internal-DFcUYjh3.js.map +0 -1
  137. package/dist/zip-CTll_dr0.d.ts.map +0 -1
  138. package/dist/zip-CYZ0F6BV.js.map +0 -1
  139. package/dist/zoom-BoNyOlPm.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { hn as imageFormatForExtension, mn as imageFormatForContentType } from "./image-size-DwDbakcl.js";
2
- //#region src/media/content-type.ts
1
+ import { vn as imageFormatForContentType, yn as imageFormatForExtension } from "./chart-metadata-CwiTTcJq.js";
2
+ // src/media/content-type.ts
3
3
  /**
4
4
  * OPC content types for embedded media parts, keyed by file extension.
5
5
  *
6
6
  * Both mappings reproduce what PowerPoint itself authors rather than the IANA-preferred
7
- * spelling — a package that disagrees (e.g. `audio/mp3` for an `.mp3`) is the kind of thing
7
+ * spelling. A package that disagrees (e.g. `audio/mp3` for an `.mp3`) is the kind of thing
8
8
  * PowerPoint offers to repair.
9
9
  */
10
10
  /**
@@ -38,7 +38,7 @@ function dataUriMediaType(data) {
38
38
  * A `data:` URI states its mime type outright, so it wins over `path`: the bytes are the thing
39
39
  * being embedded, and a caller may supply them with no path at all (or with a path whose
40
40
  * extension disagrees with the payload). The extension chosen here names the media part *and*,
41
- * via {@link imageContentType}, decides the `<Default>` the package declares for it — so
41
+ * via {@link imageContentType}, decides the `<Default>` the package declares for it, so
42
42
  * getting it from a placeholder path is how a deck ends up declaring `image/png` over SVG
43
43
  * bytes, which is exactly the mismatch PowerPoint offers to "repair".
44
44
  *
@@ -62,7 +62,7 @@ function imageExtensionForSource(path, data) {
62
62
  *
63
63
  * Needed because a caller supplying sound bytes as a `data:` URI states a *content type*
64
64
  * (`data:audio/x-wav;base64,…`), while the media part needs a *filename*. Taking the subtype
65
- * verbatim produces `audio1.x-wav` — legal, since the package would then declare a matching
65
+ * verbatim produces `audio1.x-wav`. That is legal, since the package would then declare a matching
66
66
  * `<Default Extension="x-wav"/>`, but a file type that does not exist and that no other tool
67
67
  * recognises. `audio/x-wav` in particular is not an edge case: it is exactly what PowerPoint
68
68
  * authors for an embedded transition sound, so it arrives on any deck read back in.
@@ -127,13 +127,12 @@ function assetFilenameExtension(contentType) {
127
127
  const ct = (contentType || "").toLowerCase();
128
128
  return ct.startsWith("audio/") ? audioExtensionForSubtype(ct.slice(6)) : null;
129
129
  }
130
- //#endregion
131
- //#region src/ooxml/text-anchor.ts
130
+ // src/ooxml/text-anchor.ts
132
131
  /**
133
132
  * Every `valign` the write API accepts, the anchor token it means, and the other spellings the
134
133
  * definers between them have always taken.
135
134
  *
136
- * The three definers read `valign` three ways — `startsWith('b'|'m'|'t')`, a chain of
135
+ * The three definers read `valign` three ways: `startsWith('b'|'m'|'t')`, a chain of
137
136
  * `.replace('top','t')…` that let any other string through *verbatim* into `anchor=`, and a
138
137
  * longer chain that also took `btm` and `center`. This table is the union of what they named;
139
138
  * anything else is a warning and an omitted attribute rather than an invalid one.
@@ -166,11 +165,62 @@ const VALIGN_TABLE = [
166
165
  /** Every spelling of `valign` the definers accept, mapped to the one anchor token it means. */
167
166
  const TEXT_ANCHOR_BY_VALIGN = Object.fromEntries(VALIGN_TABLE.flatMap((row) => [row.valign, ...row.aliases].map((spelling) => [spelling, row.anchor])));
168
167
  /**
169
- * An anchor token back to the `valign` a generated script writes — the preferred spelling of the
168
+ * An anchor token back to the `valign` a generated script writes, in the preferred spelling of the
170
169
  * row, never one of its aliases.
171
170
  */
172
171
  const VALIGN_BY_ANCHOR = Object.fromEntries(VALIGN_TABLE.map((row) => [row.anchor, row.valign]));
173
- //#endregion
174
- export { avContentType as a, imageExtensionForSource as c, audioExtensionForSubtype as i, VALIGN_BY_ANCHOR as n, dataUriMediaType as o, assetFilenameExtension as r, imageContentType as s, TEXT_ANCHOR_BY_VALIGN as t };
172
+ // src/ooxml/lock-attrs.ts
173
+ /**
174
+ * The attributes each DrawingML locking element defines, in emit order (ECMA-376 §20.1.2.2.x /
175
+ * §20.1.2.2.34): `a:spLocks`, `a:picLocks`, `a:graphicFrameLocks` and `a:grpSpLocks`.
176
+ *
177
+ * Here rather than in `gen/drawingml/locks.ts` because the read side's `readModelToIr` needs the
178
+ * same list to tell an `objectLock` flag it can write from one it cannot. No runtime imports.
179
+ */
180
+ const SHAPE_LOCK_ATTRS = [
181
+ "noGrp",
182
+ "noSelect",
183
+ "noRot",
184
+ "noChangeAspect",
185
+ "noMove",
186
+ "noResize",
187
+ "noEditPoints",
188
+ "noAdjustHandles",
189
+ "noChangeArrowheads",
190
+ "noChangeShapeType",
191
+ "noTextEdit"
192
+ ];
193
+ const PICTURE_LOCK_ATTRS = [
194
+ "noGrp",
195
+ "noSelect",
196
+ "noRot",
197
+ "noChangeAspect",
198
+ "noMove",
199
+ "noResize",
200
+ "noEditPoints",
201
+ "noAdjustHandles",
202
+ "noChangeArrowheads",
203
+ "noChangeShapeType",
204
+ "noCrop"
205
+ ];
206
+ const GRAPHIC_FRAME_LOCK_ATTRS = [
207
+ "noGrp",
208
+ "noDrilldown",
209
+ "noSelect",
210
+ "noChangeAspect",
211
+ "noMove",
212
+ "noResize"
213
+ ];
214
+ const GROUP_SHAPE_LOCK_ATTRS = [
215
+ "noGrp",
216
+ "noUngrp",
217
+ "noSelect",
218
+ "noRot",
219
+ "noChangeAspect",
220
+ "noMove",
221
+ "noResize"
222
+ ];
223
+ /** Every attribute name the four tables between them list. */
224
+ export { TEXT_ANCHOR_BY_VALIGN as a, audioExtensionForSubtype as c, imageContentType as d, imageExtensionForSource as f, SHAPE_LOCK_ATTRS as i, avContentType as l, GROUP_SHAPE_LOCK_ATTRS as n, VALIGN_BY_ANCHOR as o, PICTURE_LOCK_ATTRS as r, assetFilenameExtension as s, GRAPHIC_FRAME_LOCK_ATTRS as t, dataUriMediaType as u };
175
225
 
176
- //# sourceMappingURL=text-anchor-BgLPbwbL.js.map
226
+ //# sourceMappingURL=lock-attrs-CSQnFDHP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock-attrs-CSQnFDHP.js","names":[],"sources":["../src/media/content-type.ts","../src/ooxml/text-anchor.ts","../src/ooxml/lock-attrs.ts"],"sourcesContent":["/**\n * OPC content types for embedded media parts, keyed by file extension.\n *\n * Both mappings reproduce what PowerPoint itself authors rather than the IANA-preferred\n * spelling. A package that disagrees (e.g. `audio/mp3` for an `.mp3`) is the kind of thing\n * PowerPoint offers to repair.\n */\n\nimport { imageFormatForContentType, imageFormatForExtension } from './image-formats.js'\n\n/**\n * Map an image file extension to its OOXML content type, through the format registry in\n * `media/image-formats.ts`. An extension the registry does not carry falls through to\n * `image/<extn>`, which is right for any format whose content type is its extension.\n * Only the content type is derived here; the file extension (used for the media Target\n * filename) is left to the caller.\n * @param {string} extn - image file extension (e.g. `png`, `jpg`, `emf`)\n * @returns {string} OOXML content type (e.g. `image/png`, `image/x-emf`)\n */\nexport function imageContentType(extn: string): string {\n\treturn imageFormatForExtension(extn)?.contentType ?? 'image/' + (extn || '').toLowerCase()\n}\n\n/**\n * The media type an inline payload states in its header, lower-cased, or `null` when it states none.\n *\n * Takes a `data:` URI or the same header without its `data:` scheme (`image/png;base64,…`), the\n * two forms the definers accept. It is the one reading of that header: the patterns it replaces\n * each stopped short somewhere, `image\\/(\\w+);` at `-`, `.` and `+`, so `data:image/x-emf;…` named\n * no type and its EMF bytes were written into a `.png` part declared `image/png`.\n * @param data - a `data:` URI, a header-first base64 payload, or anything else\n * @returns the `type/subtype`, e.g. `image/x-emf`, or `null`\n */\nexport function dataUriMediaType(data: string): string | null {\n\tconst match = /^(?:data:)?([a-z]+\\/[\\w.+-]+)[;,]/i.exec(data || '')\n\treturn match?.[1]?.toLowerCase() ?? null\n}\n\n/**\n * Resolve the file extension an embedded image part should carry, from the caller's source.\n *\n * A `data:` URI states its mime type outright, so it wins over `path`: the bytes are the thing\n * being embedded, and a caller may supply them with no path at all (or with a path whose\n * extension disagrees with the payload). The extension chosen here names the media part *and*,\n * via {@link imageContentType}, decides the `<Default>` the package declares for it, so\n * getting it from a placeholder path is how a deck ends up declaring `image/png` over SVG\n * bytes, which is exactly the mismatch PowerPoint offers to \"repair\".\n *\n * A type the format registry carries names its part by the registry's extension (`image/x-emf` is\n * `emf`, `image/svg+xml` is `svg`). Any other type names it by its subtype, so `image/jpg` keeps\n * `jpg`. The result is always lower-cased, so a `data:image/PNG;` source names its part the same\n * way a `photo.PNG` path does.\n * @param {string} path - caller-supplied path/URL (may be empty); query and fragment are stripped\n * @param {string} data - caller-supplied `data:`/base64 payload (may be empty)\n * @returns {string} file extension, no dot (e.g. `png`, `jpeg`, `svg`)\n */\nexport function imageExtensionForSource(path: string, data: string): string {\n\t// NOTE: Split to address URLs with params (eg: `path/brent.jpg?someParam=true`)\n\tconst strPath = path || ''\n\tconst pathFile = strPath.slice(strPath.lastIndexOf('/') + 1).split('?')[0] || ''\n\tconst pathExtn = ((pathFile.split('.').pop() || 'png').split('#')[0] || 'png').toLowerCase()\n\n\tconst mime = dataUriMediaType(data)\n\tif (mime?.startsWith('image/')) return imageFormatForContentType(mime)?.ext ?? mime.slice('image/'.length)\n\treturn pathExtn\n}\n\n/**\n * Map an audio content type's subtype back to the file extension a media part should use.\n *\n * Needed because a caller supplying sound bytes as a `data:` URI states a *content type*\n * (`data:audio/x-wav;base64,…`), while the media part needs a *filename*. Taking the subtype\n * verbatim produces `audio1.x-wav`. That is legal, since the package would then declare a matching\n * `<Default Extension=\"x-wav\"/>`, but a file type that does not exist and that no other tool\n * recognises. `audio/x-wav` in particular is not an edge case: it is exactly what PowerPoint\n * authors for an embedded transition sound, so it arrives on any deck read back in.\n *\n * Only the spellings that are *not* already an extension are listed; anything else (`ogg`,\n * `flac`, `aac`, …) is its own extension and falls through. Read against {@link avContentType},\n * which maps the same pairs in the other direction.\n */\nexport function audioExtensionForSubtype(subtype: string): string {\n\tswitch ((subtype || '').toLowerCase()) {\n\t\tcase 'x-wav':\n\t\tcase 'wave':\n\t\tcase 'vnd.wave':\n\t\t\treturn 'wav'\n\t\tcase 'mpeg':\n\t\t\treturn 'mp3'\n\t\tcase 'x-ms-wma':\n\t\t\treturn 'wma'\n\t\tcase 'mp4':\n\t\t\treturn 'm4a'\n\t\tdefault:\n\t\t\treturn (subtype || '').toLowerCase()\n\t}\n}\n\n/**\n * Resolve the OPC content type for an embedded audio/video part by file extension,\n * matching what PowerPoint authors (e.g. `mp3` → `audio/mpeg`, not `audio/mp3`).\n * The `mtype` disambiguates extensions Office maps differently per kind and seeds\n * the `mtype/extn` fallback for anything unlisted.\n * @param {string} extn - media file extension (no dot), case-insensitive\n * @param {'audio' | 'video'} mtype - whether the item is audio or video\n */\nexport function avContentType(extn: string, mtype: 'audio' | 'video'): string {\n\tswitch ((extn || '').toLowerCase()) {\n\t\t// video\n\t\tcase 'mp4':\n\t\t\treturn mtype === 'audio' ? 'audio/mp4' : 'video/mp4'\n\t\tcase 'm4v':\n\t\t\treturn 'video/mp4'\n\t\tcase 'mov':\n\t\t\treturn 'video/quicktime'\n\t\tcase 'avi':\n\t\t\treturn 'video/avi'\n\t\tcase 'wmv':\n\t\t\treturn 'video/x-ms-wmv'\n\t\tcase 'mpg':\n\t\tcase 'mpeg':\n\t\t\treturn mtype === 'audio' ? 'audio/mpeg' : 'video/mpeg'\n\t\tcase 'ogv':\n\t\t\treturn 'video/ogg'\n\t\tcase 'webm':\n\t\t\treturn 'video/webm'\n\t\t// audio\n\t\tcase 'mp3':\n\t\t\treturn 'audio/mpeg'\n\t\tcase 'm4a':\n\t\t\treturn 'audio/mp4'\n\t\tcase 'wav':\n\t\t\treturn 'audio/x-wav' // PowerPoint authors the x- form (e.g. embedded transition sounds)\n\t\tcase 'wma':\n\t\t\treturn 'audio/x-ms-wma'\n\t\tcase 'aac':\n\t\t\treturn 'audio/aac'\n\t\tcase 'oga':\n\t\tcase 'ogg':\n\t\t\treturn 'audio/ogg'\n\t\tcase 'flac':\n\t\t\treturn 'audio/flac'\n\t\tdefault:\n\t\t\treturn mtype + '/' + (extn || '').toLowerCase()\n\t}\n}\n\n/**\n * The extension an emitted *asset filename* should carry for a media content type, or `null`\n * when nothing here names one and the caller should fall back to the source part's own suffix.\n *\n * This is the on-disk spelling, not the media part's: `image/jpeg` is `jpg` and `image/tiff` is\n * `tif` here, because an asset directory is read by people and opened by desktop viewers. See the\n * `filenameExt` column in `media/image-formats.ts`. Audio goes through {@link audioExtensionForSubtype}, which is\n * already the one table for that direction.\n */\nexport function assetFilenameExtension(contentType: string): string | null {\n\tconst image = imageFormatForContentType(contentType)\n\tif (image) return image.filenameExt\n\tconst ct = (contentType || '').toLowerCase()\n\treturn ct.startsWith('audio/') ? audioExtensionForSubtype(ct.slice('audio/'.length)) : null\n}\n","/**\n * `a:bodyPr/@anchor` and `a:tcPr/@anchor`, and the write API's `valign` on the other side of it.\n *\n * Two tables stated the same correspondence in opposite directions and could not see each other:\n * the emitters' spelling table in `gen/drawingml/text-body.ts`, and its hand-written inverse in\n * `script/from-read/values.ts`, which maps a read deck's anchor back to the `valign` a generated\n * script writes. `script/` cannot import `gen/` (it has no such import anywhere, deliberately),\n * so the inverse could not be derived where it stood, and a token added to one table would have\n * meant a script that reads an anchor it cannot write back.\n *\n * The correspondence itself is a fact about the format, so it lives here, as one table with both\n * directions derived from it.\n *\n * This module keeps `ooxml/`'s no-runtime-imports property: {@link TEXT_ANCHORS} is the schema's\n * own list from a module with none either, and the {@link TextAnchor} reference is type-only, so\n * it is erased. That reference is still a real check: it is what ties the enum the write API\n * exposes to the tokens named here.\n */\n\nimport type { TextAnchor } from '../enums.js'\nimport { TEXT_ANCHORS } from './st-enums.js'\n\n/**\n * The `ST_TextAnchoringType` tokens this library writes, checked against both the schema's list\n * and the public {@link TextAnchor} enum.\n *\n * `Extract` is that check twice over: a token here that is not in `ST_TextAnchoringType`, or not\n * in the enum, is dropped from the type and the table below stops compiling. Compile-time on\n * purpose: every value in the table is a literal, so a runtime check could never fail, and a\n * check that cannot fail is worse than none.\n *\n * The library writes three of the schema's five: `just` and `dist` are anchoring modes no\n * option surfaces.\n */\nexport type TextAnchorToken = Extract<`${TextAnchor}`, (typeof TEXT_ANCHORS)[number]>\n\n/**\n * Every `valign` the write API accepts, the anchor token it means, and the other spellings the\n * definers between them have always taken.\n *\n * The three definers read `valign` three ways: `startsWith('b'|'m'|'t')`, a chain of\n * `.replace('top','t')…` that let any other string through *verbatim* into `anchor=`, and a\n * longer chain that also took `btm` and `center`. This table is the union of what they named;\n * anything else is a warning and an omitted attribute rather than an invalid one.\n *\n * `valign` leads each row because it is the direction with a preferred answer: several spellings\n * mean one anchor, and only one of them is what a generated script should write back.\n */\nconst VALIGN_TABLE = [\n\t{ valign: 'top', anchor: 't', aliases: ['t'] },\n\t{ valign: 'middle', anchor: 'ctr', aliases: ['c', 'ctr', 'center', 'm'] },\n\t{ valign: 'bottom', anchor: 'b', aliases: ['b', 'btm'] },\n] as const satisfies ReadonlyArray<{ valign: string; anchor: TextAnchorToken; aliases: readonly string[] }>\n\n/** Every spelling of `valign` the definers accept, mapped to the one anchor token it means. */\nexport const TEXT_ANCHOR_BY_VALIGN: Readonly<Record<string, TextAnchorToken>> = Object.fromEntries(\n\tVALIGN_TABLE.flatMap((row) => [row.valign, ...row.aliases].map((spelling) => [spelling, row.anchor]))\n)\n\n/**\n * An anchor token back to the `valign` a generated script writes, in the preferred spelling of the\n * row, never one of its aliases.\n */\nexport const VALIGN_BY_ANCHOR: Readonly<Record<string, string>> = Object.fromEntries(\n\tVALIGN_TABLE.map((row) => [row.anchor, row.valign])\n)\n","/**\n * The attributes each DrawingML locking element defines, in emit order (ECMA-376 §20.1.2.2.x /\n * §20.1.2.2.34): `a:spLocks`, `a:picLocks`, `a:graphicFrameLocks` and `a:grpSpLocks`.\n *\n * Here rather than in `gen/drawingml/locks.ts` because the read side's `readModelToIr` needs the\n * same list to tell an `objectLock` flag it can write from one it cannot. No runtime imports.\n */\nexport const SHAPE_LOCK_ATTRS = [\n\t'noGrp',\n\t'noSelect',\n\t'noRot',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n\t'noEditPoints',\n\t'noAdjustHandles',\n\t'noChangeArrowheads',\n\t'noChangeShapeType',\n\t'noTextEdit',\n] as const\nexport const PICTURE_LOCK_ATTRS = [\n\t'noGrp',\n\t'noSelect',\n\t'noRot',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n\t'noEditPoints',\n\t'noAdjustHandles',\n\t'noChangeArrowheads',\n\t'noChangeShapeType',\n\t'noCrop',\n] as const\nexport const GRAPHIC_FRAME_LOCK_ATTRS = [\n\t'noGrp',\n\t'noDrilldown',\n\t'noSelect',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n] as const\nexport const GROUP_SHAPE_LOCK_ATTRS = [\n\t'noGrp',\n\t'noUngrp',\n\t'noSelect',\n\t'noRot',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n] as const\n\n/** Every attribute name the four tables between them list. */\n"],"mappings":"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"}
package/dist/math.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { _ as PackageReadErrorCode, a as InternalError, c as PackageReadError, d as UnsupportedFeatureError, f as DiagnosticCode, g as MediaErrorCode, h as InvalidOptionErrorCode, i as setDiagnosticHandler, l as TsPptxError, m as InternalErrorCode, n as DiagnosticHandler, o as InvalidOptionError, p as ErrorCode, r as resetDiagnosticState, s as MediaError, t as Diagnostic, u as TsPptxErrorOptions, v as TsPptxCode, y as UnsupportedFeatureErrorCode } from "./diagnostics-DiMmBU8P.js";
2
- //#region src/math.d.ts
1
+ import { S as UnsupportedFeatureErrorCode, _ as InternalErrorCode, a as TsPptxCode, b as PackageReadErrorCode, c as InternalError, d as PackageReadError, f as PptxTsError, g as ErrorCode, h as DiagnosticCode, i as setDiagnosticHandler, l as InvalidOptionError, m as UnsupportedFeatureError, n as DiagnosticHandler, o as TsPptxError, p as PptxTsErrorOptions, r as resetDiagnosticState, s as TsPptxErrorOptions, t as Diagnostic, u as MediaError, v as InvalidOptionErrorCode, x as PptxTsCode, y as MediaErrorCode } from "./diagnostics-MoA4MBq5.js";
3
2
  /**
4
3
  * Convert a MathML string to OMML for the `math:` option on `addText`.
5
4
  *
@@ -34,6 +33,5 @@ export interface LatexToOmmlOptions {
34
33
  * @throws {Error} if the LaTeX cannot be parsed
35
34
  */
36
35
  export declare function latexToOmml(latex: string, opts?: LatexToOmmlOptions): string;
37
- //#endregion
38
- export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, resetDiagnosticState, setDiagnosticHandler };
36
+ export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type PptxTsCode, PptxTsError, type PptxTsErrorOptions, TsPptxCode, TsPptxError, TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, resetDiagnosticState, setDiagnosticHandler };
39
37
  //# sourceMappingURL=math.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":";;;;;;;;;;;;;wBA0MgB,aAAa;iBAkBZ;;;;;;EAMhB;;;;;;;;;;;;;;;wBAgBe,YAAY,eAAe,OAAM"}
1
+ {"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":";;;;;;;;;;;;wBA0MgB,aAAa;iBAkBZ;;;;;;EAMhB;;;;;;;;;;;;;;;wBAgBe,YAAY,eAAe,OAAM"}
package/dist/math.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as TsPptxError, c as setDiagnosticHandler, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, s as resetDiagnosticState, t as InternalError } from "./errors-Da2nXCJm.js";
1
+ import { a as PackageReadError, c as resetDiagnosticState, i as MediaError, l as setDiagnosticHandler, n as InternalError, o as PptxTsError, r as InvalidOptionError, s as UnsupportedFeatureError, t as TsPptxError } from "./entry-errors-JMthgJ2g.js";
2
2
  import { createRequire } from "node:module";
3
- //#region src/math.ts
3
+ // src/math.ts
4
4
  /**
5
5
  * Author display equations in LaTeX or MathML and get
6
6
  * OMML for the `math:` option on `addText` (see `TextProps.math`).
@@ -50,7 +50,7 @@ function loadMml2omml() {
50
50
  }
51
51
  /**
52
52
  * mathml2omml puts namespace declarations on the `<m:oMath>` opening tag: `xmlns:m`
53
- * (redundant — the `<a14:m>` envelope the `math:` option authors already declares it)
53
+ * (redundant, since the `<a14:m>` envelope the `math:` option authors already declares it)
54
54
  * and `xmlns:w` (unused in the output it produces). Strip them so the result is a bare
55
55
  * `<m:oMath>` that drops into the `math:` option cleanly.
56
56
  */
@@ -64,15 +64,15 @@ const DISPLAY_PARA_PR = "<m:oMathParaPr><m:jc m:val=\"centerGroup\"/></m:oMathPa
64
64
  * puts in the `<mo>` of an accent and valued by the combining mark OMML wants in `m:chr`.
65
65
  *
66
66
  * Two halves of one problem. **Which** `<mover>`s are accents: temml renders every accent
67
- * command as a bare `<mover>` with no `accent="true"`, which is correct for a browser —
68
- * MathML renderers derive accent positioning from the operator dictionary, so the attribute
69
- * is redundant there — but mathml2omml has no dictionary and keys strictly off the
67
+ * command as a bare `<mover>` with no `accent="true"`, which is correct for a browser
68
+ * (MathML renderers derive accent positioning from the operator dictionary, so the attribute
69
+ * is redundant there), but mathml2omml has no dictionary and keys strictly off the
70
70
  * attribute, mapping a bare `<mover>` to `<m:limUpp>` (an over-*limit*, with limit spacing)
71
71
  * instead of `<m:acc>`. Membership in this table is the dictionary lookup that is otherwise
72
72
  * missing. **Which character** to attach: mathml2omml passes the `<mo>` text straight
73
73
  * through to `m:chr`, and temml emits the *spacing* modifiers (U+02C6 MODIFIER LETTER
74
74
  * CIRCUMFLEX, U+2192 RIGHTWARDS ARROW) while ECMA-376 §22.1.2.20 says an `accPr` character
75
- * "should be within the range of (U+0300–U+036F) or (U+20D0–U+20EF)" — the combining marks,
75
+ * "should be within the range of (U+0300–U+036F) or (U+20D0–U+20EF)": the combining marks,
76
76
  * which is also what Word itself writes. Left alone, `\vec{v}` would hang a full-size arrow
77
77
  * over the base instead of an arrow accent.
78
78
  *
@@ -106,20 +106,20 @@ const TRAILING_MO = /<mo\b([^>]*)>([^<]*)<\/mo>\s*$/;
106
106
  *
107
107
  * Scoped as narrowly as the defect. Only `<mo stretchy="false">` qualifies, which is how
108
108
  * temml distinguishes a true accent from a *wide* one (`\widehat`, `\overrightarrow`) or a
109
- * group character (`\overbrace`, `\overgroup`) — those already reach `m:groupChr`, which is
109
+ * group character (`\overbrace`, `\overgroup`). Those already reach `m:groupChr`, which is
110
110
  * a reasonable rendering, so they are left alone rather than churned. `\stackrel` is an
111
111
  * over-relation whose character comes from the caller, so it stays `m:limUpp` unless the
112
112
  * caller happened to stack a diacritic. An `<mover>` that already states `accent` is the
113
113
  * author's call and is never rewritten.
114
114
  *
115
- * `<munder>` is deliberately **not** touched. The symmetric-looking fix — stamping
116
- * `accentunder="true"` — makes mathml2omml emit `<m:acc>`, which is an *over*-accent: it
115
+ * `<munder>` is deliberately **not** touched. The symmetric-looking fix, stamping
116
+ * `accentunder="true"`, makes mathml2omml emit `<m:acc>`, which is an *over*-accent: it
117
117
  * would move `\utilde`'s tilde above the base. OMML has no under-accent object, so the
118
118
  * `m:limLow` an under-accent already produces is the closest thing available.
119
119
  *
120
120
  * Implemented against the tag text rather than through a DOM. temml's output is
121
121
  * machine-generated and well-formed, so pairing `<mover>` with `</mover>` on a stack is
122
- * exact, and this subpath otherwise carries no XML parser — the read path's is a different
122
+ * exact, and this subpath otherwise carries no XML parser. The read path's is a different
123
123
  * dependency and pulling it in here would grow the module for one rewrite.
124
124
  */
125
125
  function markAccentedMovers(mathml) {
@@ -206,7 +206,6 @@ function latexToOmml(latex, opts = {}) {
206
206
  const oMath = mathmlToOmml(markAccentedMovers(mathml));
207
207
  return display ? `<m:oMathPara>${DISPLAY_PARA_PR}${oMath}</m:oMathPara>` : oMath;
208
208
  }
209
- //#endregion
210
- export { InternalError, InvalidOptionError, MediaError, PackageReadError, TsPptxError, UnsupportedFeatureError, latexToOmml, mathmlToOmml, resetDiagnosticState, setDiagnosticHandler };
209
+ export { InternalError, InvalidOptionError, MediaError, PackageReadError, PptxTsError, TsPptxError, UnsupportedFeatureError, latexToOmml, mathmlToOmml, resetDiagnosticState, setDiagnosticHandler };
211
210
 
212
211
  //# sourceMappingURL=math.js.map
package/dist/math.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"math.js","names":[],"sources":["../src/math.ts"],"sourcesContent":["/**\n * Author display equations in LaTeX or MathML and get\n * OMML for the `math:` option on `addText` (see `TextProps.math`).\n *\n * Pipeline: LaTeX --temml--> MathML --mathml2omml--> OMML.\n *\n * Both converters are **optional peer dependencies** (temml is MIT, mathml2omml is\n * LGPL-3.0-or-later); install them to use this subpath:\n *\n * ```sh\n * npm install temml mathml2omml\n * ```\n *\n * This subpath is **Node-only**: it loads the converters synchronously via\n * `node:module`'s `createRequire`, so `latexToOmml()` / `mathmlToOmml()` stay\n * synchronous. Both display and inline (in-sentence) equations are supported: a\n * default `latexToOmml()` returns a centered display `<m:oMathPara>`, while\n * `latexToOmml(tex, { display: false })` (and `mathmlToOmml()`) return the bare\n * `<m:oMath>` form you pass to a text item with `inline: true` to flow it\n * mid-paragraph (see `TextProps.inline`).\n *\n * @module\n */\nimport { createRequire } from 'node:module'\nimport { InvalidOptionError, UnsupportedFeatureError } from './errors.js'\n\nconst nodeRequire = createRequire(import.meta.url)\n\n/** Minimal shape of the temml API we depend on. */\ninterface TemmlModule {\n\trenderToString(latex: string, options?: { displayMode?: boolean; throwOnError?: boolean }): string\n}\n/** temml's `ParseError` carries a `position` (character offset into the source). */\ninterface TemmlParseError extends Error {\n\tposition?: number\n}\n\nconst MISSING_DEPS_MESSAGE =\n\t\"pptx-ts/math requires the optional peer dependencies 'temml' and \" +\n\t\"'mathml2omml'. Install them with: npm install temml mathml2omml\"\n\n/** Require an optional peer, remapping a not-found error to the install hint. */\nfunction requirePeer<T>(id: string): T {\n\ttry {\n\t\treturn nodeRequire(id) as T\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException | undefined)?.code === 'MODULE_NOT_FOUND') {\n\t\t\tthrow new UnsupportedFeatureError('math/missing-optional-peer', MISSING_DEPS_MESSAGE, { cause: err })\n\t\t}\n\t\tthrow err\n\t}\n}\n\nlet temmlModule: TemmlModule | undefined\nlet mml2ommlFn: ((mathml: string) => string) | undefined\n\nfunction loadTemml(): TemmlModule {\n\tif (!temmlModule) {\n\t\tconst mod = requirePeer<TemmlModule | { default: TemmlModule }>('temml')\n\t\ttemmlModule = 'renderToString' in mod ? mod : mod.default\n\t}\n\treturn temmlModule\n}\n\nfunction loadMml2omml(): (mathml: string) => string {\n\tif (!mml2ommlFn) {\n\t\tconst mod = requirePeer<{ mml2omml: (mathml: string) => string }>('mathml2omml')\n\t\tmml2ommlFn = mod.mml2omml\n\t}\n\treturn mml2ommlFn\n}\n\n/**\n * mathml2omml puts namespace declarations on the `<m:oMath>` opening tag: `xmlns:m`\n * (redundant — the `<a14:m>` envelope the `math:` option authors already declares it)\n * and `xmlns:w` (unused in the output it produces). Strip them so the result is a bare\n * `<m:oMath>` that drops into the `math:` option cleanly.\n */\nfunction stripOMathNamespaces(omml: string): string {\n\treturn omml.replace(/^(\\s*<m:oMath)\\b[^>]*>/, '$1>')\n}\n\n/** Centered-display paragraph props, matching what the `math:` emitter/oracle author. */\nconst DISPLAY_PARA_PR = '<m:oMathParaPr><m:jc m:val=\"centerGroup\"/></m:oMathParaPr>'\n\n/**\n * The operator-dictionary subset this module has to carry, keyed by the character temml\n * puts in the `<mo>` of an accent and valued by the combining mark OMML wants in `m:chr`.\n *\n * Two halves of one problem. **Which** `<mover>`s are accents: temml renders every accent\n * command as a bare `<mover>` with no `accent=\"true\"`, which is correct for a browser —\n * MathML renderers derive accent positioning from the operator dictionary, so the attribute\n * is redundant there — but mathml2omml has no dictionary and keys strictly off the\n * attribute, mapping a bare `<mover>` to `<m:limUpp>` (an over-*limit*, with limit spacing)\n * instead of `<m:acc>`. Membership in this table is the dictionary lookup that is otherwise\n * missing. **Which character** to attach: mathml2omml passes the `<mo>` text straight\n * through to `m:chr`, and temml emits the *spacing* modifiers (U+02C6 MODIFIER LETTER\n * CIRCUMFLEX, U+2192 RIGHTWARDS ARROW) while ECMA-376 §22.1.2.20 says an `accPr` character\n * \"should be within the range of (U+0300–U+036F) or (U+20D0–U+20EF)\" — the combining marks,\n * which is also what Word itself writes. Left alone, `\\vec{v}` would hang a full-size arrow\n * over the base instead of an arrow accent.\n *\n * Keyed by character rather than by LaTeX command because that is all that survives into\n * the MathML. Derived by rendering every accent command temml documents and reading back\n * the `<mo>` it produced; the commands each entry serves are named in the comments.\n */\nconst ACCENT_CHARS = new Map<string, string>([\n\t['ˆ', '̂'], // ˆ \\hat, \\^ → COMBINING CIRCUMFLEX ACCENT\n\t['~', '̃'], // ~ \\tilde, \\~ → COMBINING TILDE\n\t['´', '́'], // ´ \\acute → COMBINING ACUTE ACCENT\n\t['ˊ', '́'], // ˊ \\' → COMBINING ACUTE ACCENT\n\t['`', '̀'], // ` \\grave → COMBINING GRAVE ACCENT\n\t['ˋ', '̀'], // ˋ \\` → COMBINING GRAVE ACCENT\n\t['¨', '̈'], // ¨ \\ddot, \\\" → COMBINING DIAERESIS\n\t['˙', '̇'], // ˙ \\dot, \\. → COMBINING DOT ABOVE\n\t['‾', '̄'], // ‾ \\bar → COMBINING MACRON\n\t['ˉ', '̄'], // ˉ \\= → COMBINING MACRON\n\t['˘', '̆'], // ˘ \\breve, \\u → COMBINING BREVE\n\t['ˇ', '̌'], // ˇ \\check, \\v → COMBINING CARON\n\t['˚', '̊'], // ˚ \\mathring, \\r → COMBINING RING ABOVE\n\t['˝', '̋'], // ˝ \\H → COMBINING DOUBLE ACUTE ACCENT\n\t['→', '⃗'], // → \\vec → COMBINING RIGHT ARROW ABOVE\n\t['…', '⃛'], // … \\dddot → COMBINING THREE DOTS ABOVE\n])\n\n/** An `<mover>`'s last child, when that child is an `<mo>`: `[, attributes, text]`. */\nconst TRAILING_MO = /<mo\\b([^>]*)>([^<]*)<\\/mo>\\s*$/\n\n/**\n * Stamp `accent=\"true\"` on the `<mover>`s that are accents, and swap their operator for the\n * combining mark OMML wants. See {@link ACCENT_CHARS} for why both are needed.\n *\n * Scoped as narrowly as the defect. Only `<mo stretchy=\"false\">` qualifies, which is how\n * temml distinguishes a true accent from a *wide* one (`\\widehat`, `\\overrightarrow`) or a\n * group character (`\\overbrace`, `\\overgroup`) — those already reach `m:groupChr`, which is\n * a reasonable rendering, so they are left alone rather than churned. `\\stackrel` is an\n * over-relation whose character comes from the caller, so it stays `m:limUpp` unless the\n * caller happened to stack a diacritic. An `<mover>` that already states `accent` is the\n * author's call and is never rewritten.\n *\n * `<munder>` is deliberately **not** touched. The symmetric-looking fix — stamping\n * `accentunder=\"true\"` — makes mathml2omml emit `<m:acc>`, which is an *over*-accent: it\n * would move `\\utilde`'s tilde above the base. OMML has no under-accent object, so the\n * `m:limLow` an under-accent already produces is the closest thing available.\n *\n * Implemented against the tag text rather than through a DOM. temml's output is\n * machine-generated and well-formed, so pairing `<mover>` with `</mover>` on a stack is\n * exact, and this subpath otherwise carries no XML parser — the read path's is a different\n * dependency and pulling it in here would grow the module for one rewrite.\n */\nfunction markAccentedMovers(mathml: string): string {\n\tconst edits: { at: number; length: number; text: string }[] = []\n\tconst open: number[] = []\n\tconst tags = /<(\\/?)mover\\b[^>]*>/g\n\tfor (let tag = tags.exec(mathml); tag !== null; tag = tags.exec(mathml)) {\n\t\tif (tag[1] === '') {\n\t\t\t// `accent` already stated: the author has answered the question this asks.\n\t\t\topen.push(tag[0].includes('accent=') ? -1 : tag.index)\n\t\t\tcontinue\n\t\t}\n\t\tconst openAt = open.pop()\n\t\tif (openAt === undefined || openAt === -1) continue\n\n\t\tconst openEnd = mathml.indexOf('>', openAt) + 1\n\t\tconst mo = TRAILING_MO.exec(mathml.slice(openEnd, tag.index))\n\t\tif (!mo) continue\n\t\tconst [whole, attrs = '', operator = ''] = mo\n\t\t// `stretchy=\"false\"` is how temml separates a true accent from a wide one\n\t\t// (`\\widehat`) or a group character (`\\overbrace`); those already map well.\n\t\tif (!attrs.includes('stretchy=\"false\"')) continue\n\t\tconst combining = ACCENT_CHARS.get(operator)\n\t\t// A multi-character operator (`\\ddddot` renders as \"….\") has no single `m:chr`, so it\n\t\t// is not in the table and keeps the limit form rather than producing an invalid one.\n\t\tif (combining === undefined) continue\n\n\t\t// Applied right-to-left below, so earlier offsets stay valid.\n\t\tedits.push({\n\t\t\tat: openEnd + mo.index + whole.length - `${operator}</mo>`.length,\n\t\t\tlength: operator.length,\n\t\t\ttext: combining,\n\t\t})\n\t\tedits.push({ at: openAt + '<mover'.length, length: 0, text: ' accent=\"true\"' })\n\t}\n\n\tlet out = mathml\n\tfor (const edit of edits.sort((a, b) => b.at - a.at)) {\n\t\tout = out.slice(0, edit.at) + edit.text + out.slice(edit.at + edit.length)\n\t}\n\treturn out\n}\n\n/**\n * Convert a MathML string to OMML for the `math:` option on `addText`.\n *\n * Canonical output form: a bare `<m:oMath>…</m:oMath>` in the `m:` namespace, with no\n * namespace declarations (the `math:` option's envelope supplies the `m` prefix).\n *\n * @param mathml - a MathML string (e.g. `<math>…</math>`)\n * @returns OMML `<m:oMath>…</m:oMath>`\n * @throws {InvalidOptionError} `math/invalid-mathml` when the input has no `<math>` element, or\n * does not convert to an equation. The converter returns the string `'undefined'` for such input.\n */\nexport function mathmlToOmml(mathml: string): string {\n\tconst mml2omml = loadMml2omml()\n\tif (typeof mathml !== 'string' || !/<(?:[\\w-]+:)?math[\\s>]/.test(mathml)) {\n\t\tconst got = typeof mathml === 'string' ? JSON.stringify(mathml.slice(0, 40)) : typeof mathml\n\t\tthrow new InvalidOptionError(\n\t\t\t'math/invalid-mathml',\n\t\t\t`mathmlToOmml: expected MathML with a <math> element, got ${got}`\n\t\t)\n\t}\n\tconst omml = stripOMathNamespaces(String(mml2omml(mathml)).trim())\n\t// The root element's name, read rather than matched as a tag: this checks the converter's output\n\t// and builds nothing.\n\tif (/^<([\\w:]+)/.exec(omml)?.[1] !== 'm:oMath') {\n\t\tthrow new InvalidOptionError('math/invalid-mathml', 'mathmlToOmml: the MathML did not convert to an OMML equation')\n\t}\n\treturn omml\n}\n\nexport interface LatexToOmmlOptions {\n\t/**\n\t * Display (block) math: render in `displayMode` and wrap the result in\n\t * `<m:oMathPara>` (a centered display-math paragraph). Default `true`. When `false`,\n\t * temml renders in inline mode and the result is a bare `<m:oMath>`.\n\t */\n\tdisplay?: boolean\n}\n\n/**\n * Convert a LaTeX string to OMML for the `math:` option on `addText`.\n *\n * Display math (the default) is returned as a full `<m:oMathPara>` centered display\n * paragraph; with `{ display: false }` a bare `<m:oMath>` is returned (both forms are\n * accepted by the `math:` option). Throws on invalid LaTeX, surfacing temml's parse\n * position.\n *\n * @param latex - a LaTeX math expression, e.g. `x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}`\n * @param opts - see {@link LatexToOmmlOptions}\n * @returns OMML `<m:oMathPara>…</m:oMathPara>` (display) or `<m:oMath>…</m:oMath>` (inline)\n * @throws {Error} if the LaTeX cannot be parsed\n */\nexport function latexToOmml(latex: string, opts: LatexToOmmlOptions = {}): string {\n\tconst display = opts.display ?? true\n\tconst temml = loadTemml()\n\tlet mathml: string\n\ttry {\n\t\tmathml = temml.renderToString(latex, { displayMode: display, throwOnError: true })\n\t} catch (err) {\n\t\tconst pe = err as TemmlParseError\n\t\tconst pos = typeof pe.position === 'number' ? ` (position ${pe.position})` : ''\n\t\tthrow new InvalidOptionError('math/invalid-latex', `Invalid LaTeX${pos}: ${pe.message}`, { cause: err })\n\t}\n\t// Applied here rather than in `mathmlToOmml`, because it compensates for something temml\n\t// does: a caller handing in their own MathML states `accent` themselves, and rewriting it\n\t// under them would be the module second-guessing an attribute the MathML spec gives them.\n\tconst oMath = mathmlToOmml(markAccentedMovers(mathml))\n\treturn display ? `<m:oMathPara>${DISPLAY_PARA_PR}${oMath}</m:oMathPara>` : oMath\n}\n\n// Error taxonomy — see `entry-errors.ts`. Re-exported from every entry so `instanceof`\n// works whichever subpath a consumer imports.\nexport * from './entry-errors.js'\n\n// Diagnostics — see `entry-diagnostics.ts`. Re-exported from every entry so a consumer of any\n// subpath can install a handler for the warnings that subpath emits.\nexport * from './entry-diagnostics.js'\n"],"mappings":"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"}
1
+ {"version":3,"file":"math.js","names":[],"sources":["../src/math.ts"],"sourcesContent":["/**\n * Author display equations in LaTeX or MathML and get\n * OMML for the `math:` option on `addText` (see `TextProps.math`).\n *\n * Pipeline: LaTeX --temml--> MathML --mathml2omml--> OMML.\n *\n * Both converters are **optional peer dependencies** (temml is MIT, mathml2omml is\n * LGPL-3.0-or-later); install them to use this subpath:\n *\n * ```sh\n * npm install temml mathml2omml\n * ```\n *\n * This subpath is **Node-only**: it loads the converters synchronously via\n * `node:module`'s `createRequire`, so `latexToOmml()` / `mathmlToOmml()` stay\n * synchronous. Both display and inline (in-sentence) equations are supported: a\n * default `latexToOmml()` returns a centered display `<m:oMathPara>`, while\n * `latexToOmml(tex, { display: false })` (and `mathmlToOmml()`) return the bare\n * `<m:oMath>` form you pass to a text item with `inline: true` to flow it\n * mid-paragraph (see `TextProps.inline`).\n *\n * @module\n */\nimport { createRequire } from 'node:module'\nimport { InvalidOptionError, UnsupportedFeatureError } from './errors.js'\n\nconst nodeRequire = createRequire(import.meta.url)\n\n/** Minimal shape of the temml API we depend on. */\ninterface TemmlModule {\n\trenderToString(latex: string, options?: { displayMode?: boolean; throwOnError?: boolean }): string\n}\n/** temml's `ParseError` carries a `position` (character offset into the source). */\ninterface TemmlParseError extends Error {\n\tposition?: number\n}\n\nconst MISSING_DEPS_MESSAGE =\n\t\"pptx-ts/math requires the optional peer dependencies 'temml' and \" +\n\t\"'mathml2omml'. Install them with: npm install temml mathml2omml\"\n\n/** Require an optional peer, remapping a not-found error to the install hint. */\nfunction requirePeer<T>(id: string): T {\n\ttry {\n\t\treturn nodeRequire(id) as T\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException | undefined)?.code === 'MODULE_NOT_FOUND') {\n\t\t\tthrow new UnsupportedFeatureError('math/missing-optional-peer', MISSING_DEPS_MESSAGE, { cause: err })\n\t\t}\n\t\tthrow err\n\t}\n}\n\nlet temmlModule: TemmlModule | undefined\nlet mml2ommlFn: ((mathml: string) => string) | undefined\n\nfunction loadTemml(): TemmlModule {\n\tif (!temmlModule) {\n\t\tconst mod = requirePeer<TemmlModule | { default: TemmlModule }>('temml')\n\t\ttemmlModule = 'renderToString' in mod ? mod : mod.default\n\t}\n\treturn temmlModule\n}\n\nfunction loadMml2omml(): (mathml: string) => string {\n\tif (!mml2ommlFn) {\n\t\tconst mod = requirePeer<{ mml2omml: (mathml: string) => string }>('mathml2omml')\n\t\tmml2ommlFn = mod.mml2omml\n\t}\n\treturn mml2ommlFn\n}\n\n/**\n * mathml2omml puts namespace declarations on the `<m:oMath>` opening tag: `xmlns:m`\n * (redundant, since the `<a14:m>` envelope the `math:` option authors already declares it)\n * and `xmlns:w` (unused in the output it produces). Strip them so the result is a bare\n * `<m:oMath>` that drops into the `math:` option cleanly.\n */\nfunction stripOMathNamespaces(omml: string): string {\n\treturn omml.replace(/^(\\s*<m:oMath)\\b[^>]*>/, '$1>')\n}\n\n/** Centered-display paragraph props, matching what the `math:` emitter/oracle author. */\nconst DISPLAY_PARA_PR = '<m:oMathParaPr><m:jc m:val=\"centerGroup\"/></m:oMathParaPr>'\n\n/**\n * The operator-dictionary subset this module has to carry, keyed by the character temml\n * puts in the `<mo>` of an accent and valued by the combining mark OMML wants in `m:chr`.\n *\n * Two halves of one problem. **Which** `<mover>`s are accents: temml renders every accent\n * command as a bare `<mover>` with no `accent=\"true\"`, which is correct for a browser\n * (MathML renderers derive accent positioning from the operator dictionary, so the attribute\n * is redundant there), but mathml2omml has no dictionary and keys strictly off the\n * attribute, mapping a bare `<mover>` to `<m:limUpp>` (an over-*limit*, with limit spacing)\n * instead of `<m:acc>`. Membership in this table is the dictionary lookup that is otherwise\n * missing. **Which character** to attach: mathml2omml passes the `<mo>` text straight\n * through to `m:chr`, and temml emits the *spacing* modifiers (U+02C6 MODIFIER LETTER\n * CIRCUMFLEX, U+2192 RIGHTWARDS ARROW) while ECMA-376 §22.1.2.20 says an `accPr` character\n * \"should be within the range of (U+0300–U+036F) or (U+20D0–U+20EF)\": the combining marks,\n * which is also what Word itself writes. Left alone, `\\vec{v}` would hang a full-size arrow\n * over the base instead of an arrow accent.\n *\n * Keyed by character rather than by LaTeX command because that is all that survives into\n * the MathML. Derived by rendering every accent command temml documents and reading back\n * the `<mo>` it produced; the commands each entry serves are named in the comments.\n */\nconst ACCENT_CHARS = new Map<string, string>([\n\t['ˆ', '̂'], // ˆ \\hat, \\^ → COMBINING CIRCUMFLEX ACCENT\n\t['~', '̃'], // ~ \\tilde, \\~ → COMBINING TILDE\n\t['´', '́'], // ´ \\acute → COMBINING ACUTE ACCENT\n\t['ˊ', '́'], // ˊ \\' → COMBINING ACUTE ACCENT\n\t['`', '̀'], // ` \\grave → COMBINING GRAVE ACCENT\n\t['ˋ', '̀'], // ˋ \\` → COMBINING GRAVE ACCENT\n\t['¨', '̈'], // ¨ \\ddot, \\\" → COMBINING DIAERESIS\n\t['˙', '̇'], // ˙ \\dot, \\. → COMBINING DOT ABOVE\n\t['‾', '̄'], // ‾ \\bar → COMBINING MACRON\n\t['ˉ', '̄'], // ˉ \\= → COMBINING MACRON\n\t['˘', '̆'], // ˘ \\breve, \\u → COMBINING BREVE\n\t['ˇ', '̌'], // ˇ \\check, \\v → COMBINING CARON\n\t['˚', '̊'], // ˚ \\mathring, \\r → COMBINING RING ABOVE\n\t['˝', '̋'], // ˝ \\H → COMBINING DOUBLE ACUTE ACCENT\n\t['→', '⃗'], // → \\vec → COMBINING RIGHT ARROW ABOVE\n\t['…', '⃛'], // … \\dddot → COMBINING THREE DOTS ABOVE\n])\n\n/** An `<mover>`'s last child, when that child is an `<mo>`: `[, attributes, text]`. */\nconst TRAILING_MO = /<mo\\b([^>]*)>([^<]*)<\\/mo>\\s*$/\n\n/**\n * Stamp `accent=\"true\"` on the `<mover>`s that are accents, and swap their operator for the\n * combining mark OMML wants. See {@link ACCENT_CHARS} for why both are needed.\n *\n * Scoped as narrowly as the defect. Only `<mo stretchy=\"false\">` qualifies, which is how\n * temml distinguishes a true accent from a *wide* one (`\\widehat`, `\\overrightarrow`) or a\n * group character (`\\overbrace`, `\\overgroup`). Those already reach `m:groupChr`, which is\n * a reasonable rendering, so they are left alone rather than churned. `\\stackrel` is an\n * over-relation whose character comes from the caller, so it stays `m:limUpp` unless the\n * caller happened to stack a diacritic. An `<mover>` that already states `accent` is the\n * author's call and is never rewritten.\n *\n * `<munder>` is deliberately **not** touched. The symmetric-looking fix, stamping\n * `accentunder=\"true\"`, makes mathml2omml emit `<m:acc>`, which is an *over*-accent: it\n * would move `\\utilde`'s tilde above the base. OMML has no under-accent object, so the\n * `m:limLow` an under-accent already produces is the closest thing available.\n *\n * Implemented against the tag text rather than through a DOM. temml's output is\n * machine-generated and well-formed, so pairing `<mover>` with `</mover>` on a stack is\n * exact, and this subpath otherwise carries no XML parser. The read path's is a different\n * dependency and pulling it in here would grow the module for one rewrite.\n */\nfunction markAccentedMovers(mathml: string): string {\n\tconst edits: { at: number; length: number; text: string }[] = []\n\tconst open: number[] = []\n\tconst tags = /<(\\/?)mover\\b[^>]*>/g\n\tfor (let tag = tags.exec(mathml); tag !== null; tag = tags.exec(mathml)) {\n\t\tif (tag[1] === '') {\n\t\t\t// `accent` already stated: the author has answered the question this asks.\n\t\t\topen.push(tag[0].includes('accent=') ? -1 : tag.index)\n\t\t\tcontinue\n\t\t}\n\t\tconst openAt = open.pop()\n\t\tif (openAt === undefined || openAt === -1) continue\n\n\t\tconst openEnd = mathml.indexOf('>', openAt) + 1\n\t\tconst mo = TRAILING_MO.exec(mathml.slice(openEnd, tag.index))\n\t\tif (!mo) continue\n\t\tconst [whole, attrs = '', operator = ''] = mo\n\t\t// `stretchy=\"false\"` is how temml separates a true accent from a wide one\n\t\t// (`\\widehat`) or a group character (`\\overbrace`); those already map well.\n\t\tif (!attrs.includes('stretchy=\"false\"')) continue\n\t\tconst combining = ACCENT_CHARS.get(operator)\n\t\t// A multi-character operator (`\\ddddot` renders as \"….\") has no single `m:chr`, so it\n\t\t// is not in the table and keeps the limit form rather than producing an invalid one.\n\t\tif (combining === undefined) continue\n\n\t\t// Applied right-to-left below, so earlier offsets stay valid.\n\t\tedits.push({\n\t\t\tat: openEnd + mo.index + whole.length - `${operator}</mo>`.length,\n\t\t\tlength: operator.length,\n\t\t\ttext: combining,\n\t\t})\n\t\tedits.push({ at: openAt + '<mover'.length, length: 0, text: ' accent=\"true\"' })\n\t}\n\n\tlet out = mathml\n\tfor (const edit of edits.sort((a, b) => b.at - a.at)) {\n\t\tout = out.slice(0, edit.at) + edit.text + out.slice(edit.at + edit.length)\n\t}\n\treturn out\n}\n\n/**\n * Convert a MathML string to OMML for the `math:` option on `addText`.\n *\n * Canonical output form: a bare `<m:oMath>…</m:oMath>` in the `m:` namespace, with no\n * namespace declarations (the `math:` option's envelope supplies the `m` prefix).\n *\n * @param mathml - a MathML string (e.g. `<math>…</math>`)\n * @returns OMML `<m:oMath>…</m:oMath>`\n * @throws {InvalidOptionError} `math/invalid-mathml` when the input has no `<math>` element, or\n * does not convert to an equation. The converter returns the string `'undefined'` for such input.\n */\nexport function mathmlToOmml(mathml: string): string {\n\tconst mml2omml = loadMml2omml()\n\tif (typeof mathml !== 'string' || !/<(?:[\\w-]+:)?math[\\s>]/.test(mathml)) {\n\t\tconst got = typeof mathml === 'string' ? JSON.stringify(mathml.slice(0, 40)) : typeof mathml\n\t\tthrow new InvalidOptionError(\n\t\t\t'math/invalid-mathml',\n\t\t\t`mathmlToOmml: expected MathML with a <math> element, got ${got}`\n\t\t)\n\t}\n\tconst omml = stripOMathNamespaces(String(mml2omml(mathml)).trim())\n\t// The root element's name, read rather than matched as a tag: this checks the converter's output\n\t// and builds nothing.\n\tif (/^<([\\w:]+)/.exec(omml)?.[1] !== 'm:oMath') {\n\t\tthrow new InvalidOptionError('math/invalid-mathml', 'mathmlToOmml: the MathML did not convert to an OMML equation')\n\t}\n\treturn omml\n}\n\nexport interface LatexToOmmlOptions {\n\t/**\n\t * Display (block) math: render in `displayMode` and wrap the result in\n\t * `<m:oMathPara>` (a centered display-math paragraph). Default `true`. When `false`,\n\t * temml renders in inline mode and the result is a bare `<m:oMath>`.\n\t */\n\tdisplay?: boolean\n}\n\n/**\n * Convert a LaTeX string to OMML for the `math:` option on `addText`.\n *\n * Display math (the default) is returned as a full `<m:oMathPara>` centered display\n * paragraph; with `{ display: false }` a bare `<m:oMath>` is returned (both forms are\n * accepted by the `math:` option). Throws on invalid LaTeX, surfacing temml's parse\n * position.\n *\n * @param latex - a LaTeX math expression, e.g. `x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}`\n * @param opts - see {@link LatexToOmmlOptions}\n * @returns OMML `<m:oMathPara>…</m:oMathPara>` (display) or `<m:oMath>…</m:oMath>` (inline)\n * @throws {Error} if the LaTeX cannot be parsed\n */\nexport function latexToOmml(latex: string, opts: LatexToOmmlOptions = {}): string {\n\tconst display = opts.display ?? true\n\tconst temml = loadTemml()\n\tlet mathml: string\n\ttry {\n\t\tmathml = temml.renderToString(latex, { displayMode: display, throwOnError: true })\n\t} catch (err) {\n\t\tconst pe = err as TemmlParseError\n\t\tconst pos = typeof pe.position === 'number' ? ` (position ${pe.position})` : ''\n\t\tthrow new InvalidOptionError('math/invalid-latex', `Invalid LaTeX${pos}: ${pe.message}`, { cause: err })\n\t}\n\t// Applied here rather than in `mathmlToOmml`, because it compensates for something temml\n\t// does: a caller handing in their own MathML states `accent` themselves, and rewriting it\n\t// under them would be the module second-guessing an attribute the MathML spec gives them.\n\tconst oMath = mathmlToOmml(markAccentedMovers(mathml))\n\treturn display ? `<m:oMathPara>${DISPLAY_PARA_PR}${oMath}</m:oMathPara>` : oMath\n}\n\n// Error taxonomy: see `entry-errors.ts`. Re-exported from every entry so `instanceof`\n// works whichever subpath a consumer imports.\nexport * from './entry-errors.js'\n\n// Diagnostics: see `entry-diagnostics.ts`. Re-exported from every entry so a consumer of any\n// subpath can install a handler for the warnings that subpath emits.\nexport * from './entry-diagnostics.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,cAAc,cAAc,YAAY,GAAG;AAWjD,MAAM,uBACL;;AAID,SAAS,YAAe,IAAe;CACtC,IAAI;EACH,OAAO,YAAY,EAAE;CACtB,SAAS,KAAK;EACb,IAAK,KAA2C,SAAS,oBACxD,MAAM,IAAI,wBAAwB,8BAA8B,sBAAsB,EAAE,OAAO,IAAI,CAAC;EAErG,MAAM;CACP;AACD;AAEA,IAAI;AACJ,IAAI;AAEJ,SAAS,YAAyB;CACjC,IAAI,CAAC,aAAa;EACjB,MAAM,MAAM,YAAoD,OAAO;EACvE,cAAc,oBAAoB,MAAM,MAAM,IAAI;CACnD;CACA,OAAO;AACR;AAEA,SAAS,eAA2C;CACnD,IAAI,CAAC,YAEJ,aADY,YAAsD,aACnD,CAAC,CAAC;CAElB,OAAO;AACR;;;;;;;AAQA,SAAS,qBAAqB,MAAsB;CACnD,OAAO,KAAK,QAAQ,0BAA0B,KAAK;AACpD;;AAGA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;AAuBxB,MAAM,+BAAe,IAAI,IAAoB;CAC5C,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;AACV,CAAC;;AAGD,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;AAwBpB,SAAS,mBAAmB,QAAwB;CACnD,MAAM,QAAwD,CAAC;CAC/D,MAAM,OAAiB,CAAC;CACxB,MAAM,OAAO;CACb,KAAK,IAAI,MAAM,KAAK,KAAK,MAAM,GAAG,QAAQ,MAAM,MAAM,KAAK,KAAK,MAAM,GAAG;EACxE,IAAI,IAAI,OAAO,IAAI;GAElB,KAAK,KAAK,IAAI,EAAE,CAAC,SAAS,SAAS,IAAI,KAAK,IAAI,KAAK;GACrD;EACD;EACA,MAAM,SAAS,KAAK,IAAI;EACxB,IAAI,WAAW,KAAA,KAAa,WAAW,IAAI;EAE3C,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,IAAI;EAC9C,MAAM,KAAK,YAAY,KAAK,OAAO,MAAM,SAAS,IAAI,KAAK,CAAC;EAC5D,IAAI,CAAC,IAAI;EACT,MAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,MAAM;EAG3C,IAAI,CAAC,MAAM,SAAS,oBAAkB,GAAG;EACzC,MAAM,YAAY,aAAa,IAAI,QAAQ;EAG3C,IAAI,cAAc,KAAA,GAAW;EAG7B,MAAM,KAAK;GACV,IAAI,UAAU,GAAG,QAAQ,MAAM,SAAS,GAAG,SAAS,OAAO;GAC3D,QAAQ,SAAS;GACjB,MAAM;EACP,CAAC;EACD,MAAM,KAAK;GAAE,IAAI,SAAS;GAAiB,QAAQ;GAAG,MAAM;EAAiB,CAAC;CAC/E;CAEA,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAClD,MAAM,IAAI,MAAM,GAAG,KAAK,EAAE,IAAI,KAAK,OAAO,IAAI,MAAM,KAAK,KAAK,KAAK,MAAM;CAE1E,OAAO;AACR;;;;;;;;;;;;AAaA,SAAgB,aAAa,QAAwB;CACpD,MAAM,WAAW,aAAa;CAC9B,IAAI,OAAO,WAAW,YAAY,CAAC,yBAAyB,KAAK,MAAM,GAAG;EACzE,MAAM,MAAM,OAAO,WAAW,WAAW,KAAK,UAAU,OAAO,MAAM,GAAG,EAAE,CAAC,IAAI,OAAO;EACtF,MAAM,IAAI,mBACT,uBACA,4DAA4D,KAC7D;CACD;CACA,MAAM,OAAO,qBAAqB,OAAO,SAAS,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;CAGjE,IAAI,aAAa,KAAK,IAAI,CAAC,GAAG,OAAO,WACpC,MAAM,IAAI,mBAAmB,uBAAuB,8DAA8D;CAEnH,OAAO;AACR;;;;;;;;;;;;;;AAwBA,SAAgB,YAAY,OAAe,OAA2B,CAAC,GAAW;CACjF,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,QAAQ,UAAU;CACxB,IAAI;CACJ,IAAI;EACH,SAAS,MAAM,eAAe,OAAO;GAAE,aAAa;GAAS,cAAc;EAAK,CAAC;CAClF,SAAS,KAAK;EACb,MAAM,KAAK;EACX,MAAM,MAAM,OAAO,GAAG,aAAa,WAAW,cAAc,GAAG,SAAS,KAAK;EAC7E,MAAM,IAAI,mBAAmB,sBAAsB,gBAAgB,IAAI,IAAI,GAAG,WAAW,EAAE,OAAO,IAAI,CAAC;CACxG;CAIA,MAAM,QAAQ,aAAa,mBAAmB,MAAM,CAAC;CACrD,OAAO,UAAU,gBAAgB,kBAAkB,MAAM,kBAAkB;AAC5E"}
package/dist/measure.d.ts CHANGED
@@ -1,7 +1,23 @@
1
- import { Ht as TextProps, Mt as OverflowBoxOptions, Ut as TextPropsOptions, Vt as TextMeasurement, kt as MeasureTextOptions } from "./pres-BA9_lJbY.js";
2
- import { C as solveShrink, S as solveResize, _ as ShrinkOutcome, a as makeRegistryResolver, b as measureHeightPt, c as FitBox, d as HEIGHT_SAFETY_FACTOR, f as LayoutResult, g as SINGLE_LINE_PITCH, h as ResizeOutcome, i as getHeuristicFontMetrics, l as FitParagraph, m as MetricsResolver, n as FontMetricsRegistry, o as parseFontMetrics, p as MIN_FONT_SCALE_PCT, r as ParseFontMetricsOptions, s as FONT_SCALE_STEP_PCT, t as FontMetrics, u as FitRun, v as ShrinkResult, w as ObjectOptionsInternal, x as measureLayout, y as WIDTH_SAFETY_FACTOR } from "./font-metrics-CBGmhLo0.js";
3
- import { _ as PackageReadErrorCode, a as InternalError, c as PackageReadError, d as UnsupportedFeatureError, f as DiagnosticCode, g as MediaErrorCode, h as InvalidOptionErrorCode, i as setDiagnosticHandler, l as TsPptxError, m as InternalErrorCode, n as DiagnosticHandler, o as InvalidOptionError, p as ErrorCode, r as resetDiagnosticState, s as MediaError, t as Diagnostic, u as TsPptxErrorOptions, v as TsPptxCode, y as UnsupportedFeatureErrorCode } from "./diagnostics-DiMmBU8P.js";
4
- //#region src/measure/font-collection.d.ts
1
+ /**
2
+ * The calibrated text-measurement engine as a standalone,
3
+ * public surface, so a consumer can lay out its own geometry (grow a card, reflow
4
+ * a grid, detect overflow) **before export** without a `PptxTs` instance.
5
+ *
6
+ * This is the same wrap model + solvers the export-time autofit bake uses (see
7
+ * `docs/contributing/design/text-fit.md`), so a layout-time prediction never disagrees with
8
+ * the baked result. For the ergonomic, inches-based path use
9
+ * `pptx.measureText()` / `pptx.overflowsBox()` on a presentation instance; reach
10
+ * for these primitives when you need to build your own resolver/registry and
11
+ * measure standalone.
12
+ *
13
+ * `opentype.js` (used by `parseFontMetrics`) is imported lazily, so importing this
14
+ * module does not pull it into the bundle until a font is actually parsed.
15
+ *
16
+ * @module
17
+ */
18
+ import { C as solveShrink, S as solveResize, _ as ShrinkOutcome, a as makeRegistryResolver, b as measureHeightPt, c as FitBox, d as HEIGHT_SAFETY_FACTOR, f as LayoutResult, g as SINGLE_LINE_PITCH, h as ResizeOutcome, i as getHeuristicFontMetrics, l as FitParagraph, m as MetricsResolver, n as FontMetricsRegistry, o as parseFontMetrics, p as MIN_FONT_SCALE_PCT, r as ParseFontMetricsOptions, s as FONT_SCALE_STEP_PCT, t as FontMetrics, u as FitRun, v as ShrinkResult, w as ObjectOptionsInternal, x as measureLayout, y as WIDTH_SAFETY_FACTOR } from "./font-metrics-DTppw4t3.js";
19
+ import { It as MeasureTextOptions, Jt as TextMeasurement, Xt as TextPropsOptions, Yt as TextProps, zt as OverflowBoxOptions } from "./pres-BkEkUAEM.js";
20
+ import { S as UnsupportedFeatureErrorCode, _ as InternalErrorCode, a as TsPptxCode, b as PackageReadErrorCode, c as InternalError, d as PackageReadError, f as PptxTsError, g as ErrorCode, h as DiagnosticCode, i as setDiagnosticHandler, l as InvalidOptionError, m as UnsupportedFeatureError, n as DiagnosticHandler, o as TsPptxError, p as PptxTsErrorOptions, r as resetDiagnosticState, s as TsPptxErrorOptions, t as Diagnostic, u as MediaError, v as InvalidOptionErrorCode, x as PptxTsCode, y as MediaErrorCode } from "./diagnostics-MoA4MBq5.js";
5
21
  /**
6
22
  * Font **collection** (`.ttc` / `.otc`) support for the write-side metrics.
7
23
  *
@@ -62,10 +78,8 @@ export declare function isFontCollection(data: Uint8Array): boolean;
62
78
  * @example listFontFaces(readFileSync('C:/Windows/Fonts/msgothic.ttc')).map((f) => f.family)
63
79
  */
64
80
  export declare function listFontFaces(data: Uint8Array): FontFaceInfo[];
65
- //#endregion
66
- //#region src/measure/fit.d.ts
67
81
  /**
68
- * Layout-time text measurement against registered metrics — the public engine
82
+ * Layout-time text measurement against registered metrics: the public engine
69
83
  * behind `pptx.measureText()`. Uses the **same** calibrated wrap model, resolver
70
84
  * semantics, and conservative safety factors as the export-time bake
71
85
  * (`applyMeasuredFit` / {@link solveResize} / {@link solveShrink}), so a
@@ -82,11 +96,9 @@ export declare function listFontFaces(data: Uint8Array): FontFaceInfo[];
82
96
  * and is reported in `approximatedFaces`; an unnamed theme-default face returns
83
97
  * `measurable: false`. Code points a *registered* face has no glyph for are reported
84
98
  * in `uncoveredCodepoints`, and are the one case where the height may come back short
85
- * rather than tall — there is no font fallback here, only the font's `.notdef` advance.
99
+ * rather than tall: there is no font fallback here, only the font's `.notdef` advance.
86
100
  */
87
101
  export declare function measureText(registry: FontMetricsRegistry, text: string | TextProps[], opts: MeasureTextOptions): TextMeasurement;
88
- //#endregion
89
- //#region src/measure/paragraphs.d.ts
90
102
  type RunOpts = TextPropsOptions & ObjectOptionsInternal;
91
103
  /**
92
104
  * Convert a run list (+ box-level default options) into a measurable
@@ -95,6 +107,5 @@ type RunOpts = TextPropsOptions & ObjectOptionsInternal;
95
107
  * `measureText` API, so a layout-time prediction and the baked export never drift.
96
108
  */
97
109
  export declare function buildFitParagraphs(runs: TextProps[], opts: RunOpts): FitParagraph[] | null;
98
- //#endregion
99
- export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, FONT_SCALE_STEP_PCT, type FitBox, type FitParagraph, type FitRun, type FontFaceInfo, type FontMetrics, FontMetricsRegistry, HEIGHT_SAFETY_FACTOR, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LayoutResult, MIN_FONT_SCALE_PCT, type MeasureTextOptions, MediaError, type MediaErrorCode, type MetricsResolver, type OverflowBoxOptions, PackageReadError, type PackageReadErrorCode, type ParseFontMetricsOptions, type ResizeOutcome, SINGLE_LINE_PITCH, type ShrinkOutcome, type ShrinkResult, type TextMeasurement, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, WIDTH_SAFETY_FACTOR, getHeuristicFontMetrics, makeRegistryResolver, measureHeightPt, measureLayout, parseFontMetrics, resetDiagnosticState, setDiagnosticHandler, solveResize, solveShrink };
110
+ export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, FONT_SCALE_STEP_PCT, type FitBox, type FitParagraph, type FitRun, type FontFaceInfo, type FontMetrics, FontMetricsRegistry, HEIGHT_SAFETY_FACTOR, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LayoutResult, MIN_FONT_SCALE_PCT, type MeasureTextOptions, MediaError, type MediaErrorCode, type MetricsResolver, type OverflowBoxOptions, PackageReadError, type PackageReadErrorCode, type ParseFontMetricsOptions, type PptxTsCode, PptxTsError, type PptxTsErrorOptions, type ResizeOutcome, SINGLE_LINE_PITCH, type ShrinkOutcome, type ShrinkResult, type TextMeasurement, TsPptxCode, TsPptxError, TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, WIDTH_SAFETY_FACTOR, getHeuristicFontMetrics, makeRegistryResolver, measureHeightPt, measureLayout, parseFontMetrics, resetDiagnosticState, setDiagnosticHandler, solveResize, solveShrink };
100
111
  //# sourceMappingURL=measure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"measure.d.ts","names":[],"sources":["../src/measure/font-collection.ts","../src/measure/fit.ts","../src/measure/paragraphs.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmDiB;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;;wBA+BM,iBAAiB,MAAM;;;;;;;;;;;;;wBA0HvB,cAAc,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;wBC5GjC,YACf,UAAU,qBACV,eAAe,aACf,MAAM,qBACJ;;;KCzFS,UAAU,mBAAmB;;;;;;;wBAoDzB,mBAAmB,MAAM,aAAa,MAAM,UAAU"}
1
+ {"version":3,"file":"measure.d.ts","names":[],"sources":["../src/measure/font-collection.ts","../src/measure/fit.ts","../src/measure/paragraphs.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmDiB;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;;wBA+BM,iBAAiB,MAAM;;;;;;;;;;;;;wBA0HvB,cAAc,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;wBC5GjC,YACf,UAAU,qBACV,eAAe,aACf,MAAM,qBACJ;KCzFS,UAAU,mBAAmB;;;;;;;wBAkDzB,mBAAmB,MAAM,aAAa,MAAM,UAAU"}
package/dist/measure.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as TsPptxError, c as setDiagnosticHandler, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, s as resetDiagnosticState, t as InternalError } from "./errors-Da2nXCJm.js";
2
- import { _ as getHeuristicFontMetrics, b as isFontCollection, c as HEIGHT_SAFETY_FACTOR, d as WIDTH_SAFETY_FACTOR, f as measureHeightPt, g as FontMetricsRegistry, h as solveShrink, l as MIN_FONT_SCALE_PCT, m as solveResize, n as measureText, o as buildFitParagraphs, p as measureLayout, s as FONT_SCALE_STEP_PCT, u as SINGLE_LINE_PITCH, v as makeRegistryResolver, x as listFontFaces, y as parseFontMetrics } from "./fit-CcXbg__l.js";
3
- export { FONT_SCALE_STEP_PCT, FontMetricsRegistry, HEIGHT_SAFETY_FACTOR, InternalError, InvalidOptionError, MIN_FONT_SCALE_PCT, MediaError, PackageReadError, SINGLE_LINE_PITCH, TsPptxError, UnsupportedFeatureError, WIDTH_SAFETY_FACTOR, buildFitParagraphs, getHeuristicFontMetrics, isFontCollection, listFontFaces, makeRegistryResolver, measureHeightPt, measureLayout, measureText, parseFontMetrics, resetDiagnosticState, setDiagnosticHandler, solveResize, solveShrink };
1
+ import { _ as getHeuristicFontMetrics, b as isFontCollection, c as HEIGHT_SAFETY_FACTOR, d as WIDTH_SAFETY_FACTOR, f as measureHeightPt, g as FontMetricsRegistry, h as solveShrink, l as MIN_FONT_SCALE_PCT, m as solveResize, n as measureText, o as buildFitParagraphs, p as measureLayout, s as FONT_SCALE_STEP_PCT, u as SINGLE_LINE_PITCH, v as makeRegistryResolver, x as listFontFaces, y as parseFontMetrics } from "./fit-Bpmzep6O.js";
2
+ import { a as PackageReadError, c as resetDiagnosticState, i as MediaError, l as setDiagnosticHandler, n as InternalError, o as PptxTsError, r as InvalidOptionError, s as UnsupportedFeatureError, t as TsPptxError } from "./entry-errors-JMthgJ2g.js";
3
+ export { FONT_SCALE_STEP_PCT, FontMetricsRegistry, HEIGHT_SAFETY_FACTOR, InternalError, InvalidOptionError, MIN_FONT_SCALE_PCT, MediaError, PackageReadError, PptxTsError, SINGLE_LINE_PITCH, TsPptxError, UnsupportedFeatureError, WIDTH_SAFETY_FACTOR, buildFitParagraphs, getHeuristicFontMetrics, isFontCollection, listFontFaces, makeRegistryResolver, measureHeightPt, measureLayout, measureText, parseFontMetrics, resetDiagnosticState, setDiagnosticHandler, solveResize, solveShrink };
package/dist/node.d.ts CHANGED
@@ -1,25 +1,30 @@
1
- import { C as isChartType, S as isChartExType, _ as VALID_SHAPE_PRESETS, a as CONNECTOR_PRESET_NAME, b as asChartType, c as PLACEHOLDER_TYPE, d as SHAPE_NAME, f as SchemeColor, g as TextAnchor, h as TableStyle, i as CHART_NAME, l as PlaceholderType, m as SlideObjectType, n as AlignV, o as ChartType, p as ShapeType, r as BulletType, s as OutputType, t as AlignH, u as SCHEME_COLORS, v as WRITE_OUTPUT_TYPE, x as connectorPresetFor, y as ZIP_OUTPUT_TYPE } from "./enums-DQRpVOLh.js";
2
- import { $ as ChartOpts, $t as ShapeAdjustHandleXY, A as RadialGradientFillProps, At as NotesProps, B as ShadowProps, Bt as TextGlowProps, C as HexColor, Ct as OptsChartGridLine, D as PatternFillProps, Dt as PlaceholderProps, E as Margin, Et as ObjectNameProps, F as ConnectorProps, Ft as TableCellLayout, G as ChartAxisTickMark, Gt as textRuns, H as ShapeLineProps, Ht as TextProps, I as ConnectorType, It as TableLayoutResult, J as ChartExBinning, Jt as MediaProps, K as ChartDataPointStyle, Kt as ImageBaseProps, L as FillOption, Lt as TextBaseProps, M as ThemeColor, Mt as OverflowBoxOptions, N as VAlign, Nt as ResolvedCommentAuthor, O as PatternPreset, Ot as CommentProps, P as BorderProps, Pt as SlideComment, Q as ChartMulti, Qt as ShapeAdjustHandlePolar, R as HyperlinkActionJump, Rt as TextBulletProps, S as HAlign, St as OptsChartData, T as LinearGradientFillProps, Tt as ObjectLockProps, U as StrokeProps, Ut as TextPropsOptions, V as ShapeFillProps, Vt as TextMeasurement, W as ChartAreaProps, Wt as textRun, X as ChartExStatistics, Xt as OleObjectProps, Y as ChartExGeography, Yt as MediaType, Z as ChartLineDash, Zt as ShapeAdjustHandle, _ as DataOrPathProps, _n as RadarStyle, _t as ChartPropsFillLine, a as PresentationProps, an as BarDirection, at as ChartPropsChartBoxWhisker, b as GradientFillProps, bt as ChartSeriesOpts, c as WriteFileProps, ct as ChartPropsChartLine, d as ThemeColorScheme, dt as ChartPropsChartRegionMap, en as ShapeAdjustValue, et as ChartPropsAxisCat, f as ThemeProps, fn as LegendPosition, ft as ChartPropsChartStock, g as Coord, gn as PresetMaterialType, gt as ChartPropsDataTable, h as Color, hn as LineDataSymbol, ht as ChartPropsDataLabel, i as PresLayout, in as Bar3DShape, it as ChartPropsChartBar, j as TextVertType, jt as NotesTextOptions, k as PositionProps, kt as MeasureTextOptions, l as WriteOutputMap, ln as DataLabelPosition, lt as ChartPropsChartPie, m as BackgroundProps, mn as LightRigType, mt as ChartPropsChartWaterfall, n as PackagePart, nn as ShapeGuide, nt as ChartPropsAxisVal, o as SectionProps, on as BarGrouping, ot as ChartPropsChartDoughnut, p as BackgroundOption, pn as LightRigDirection, pt as ChartPropsChartSurface, q as ChartErrorBarOptions, qt as ImageProps, r as PartsProps, rn as ShapeProps, rt as ChartPropsBase, s as WriteBaseProps, sn as BevelPresetType, st as ChartPropsChartHistogram, t as CustomPropertyValue, tn as ShapeConnectionSite, tt as ChartPropsAxisSer, u as WriteProps, un as DisplayBlanksAs, ut as ChartPropsChartRadar, v as DataOrPathRequiredProps, vn as RadarStyleAlias, vt as ChartPropsLegend, w as ImageFillProps, wn as TimeUnit, wt as CommonObjectDescriptor, x as GradientStopProps, xt as LineCap, y as GeometryPoint, yt as ChartPropsTitle, z as HyperlinkProps, zt as TextFitShrinkProps } from "./pres-BA9_lJbY.js";
3
- import { A as TableCellDiagonals, C as AnimationTrigger, D as TransitionType, E as TransitionSoundProps, F as TableToSlidesDocument, I as TableToSlidesElement, L as TableToSlidesProps, M as TableProps, N as TableRow, O as TableCell, P as TableRowSlide, S as AnimationProps, T as TransitionProps, _ as MasterTextStyleProps, a as Slide, b as SlideMasterProps, c as SectionZoomProps, d as ZoomBaseProps, f as Model3dCameraProps, g as MasterTextStyleLevel, h as MasterBulletProps, i as ObjectOptions, j as TableCellProps, k as TableCell3DProps, l as SlideZoomProps, m as Model3dProps, n as GroupChildProps, o as SlideLayout, p as Model3dPoint, r as GroupProps, s as SlideObjectInfo, t as AddSlideProps, u as SummaryZoomProps, v as SlideMasterChartProps, w as PresetEffect, x as SlideNumberProps, y as SlideMasterObject } from "./slide-BqPtyKmb.js";
4
- import { _ as PackageReadErrorCode, a as InternalError, c as PackageReadError, d as UnsupportedFeatureError, f as DiagnosticCode, g as MediaErrorCode, h as InvalidOptionErrorCode, i as setDiagnosticHandler, l as TsPptxError, m as InternalErrorCode, n as DiagnosticHandler, o as InvalidOptionError, p as ErrorCode, r as resetDiagnosticState, s as MediaError, t as Diagnostic, u as TsPptxErrorOptions, v as TsPptxCode, y as UnsupportedFeatureErrorCode } from "./diagnostics-DiMmBU8P.js";
5
- import { A as pixelsToEmu, C as StandardLayoutName, D as emuToPoints, E as emuToPixels, M as ptToHundredths, O as inchesToEmu, S as StandardLayout, T as emuToInches, _ as HUNDREDTHS_PER_POINT, b as PERCENT_SCALE, c as ConstructFamily, g as FIXED_PCT_PER_PERCENT, h as Emu, i as ComposedSlide, j as pointsToEmu, k as percentToEmu, m as DEFAULT_PX_PER_INCH, n as Composed, p as ANGLE_UNITS_PER_DEGREE, r as ComposedPresentation, s as PresentationCore, t as ComposeOptions, v as MAX_COORDINATE_EMU, w as coordToEmu, x as STANDARD_LAYOUTS, y as MIN_COORDINATE_EMU } from "./entry-compose-6hF9aTmT.js";
6
- import { a as EMU_PER_INCH, i as clipPath, n as FlatSide, o as EMU_PER_POINT, r as HalfDiscPreset, s as POINTS_PER_INCH, t as ClipShape } from "./clip-DHDlnHUq.js";
7
- //#region src/node.d.ts
8
1
  /**
9
- * The Node entry, reached through the `node` export condition — a consumer importing the bare
2
+ * The Node authoring entry, which the bare `pptx-ts` specifier resolves to under the `node`
3
+ * export condition.
4
+ *
5
+ * @module
6
+ */
7
+ import { C as isChartType, S as isChartExType, _ as VALID_SHAPE_PRESETS, a as CONNECTOR_PRESET_NAME, b as asChartType, c as PLACEHOLDER_TYPE, d as SHAPE_NAME, f as SchemeColor, g as TextAnchor, h as TableStyle, i as CHART_NAME, l as PlaceholderType, m as SlideObjectType, n as AlignV, o as ChartType, p as ShapeType, r as BulletType, s as OutputType, t as AlignH, u as SCHEME_COLORS, v as WRITE_OUTPUT_TYPE, x as connectorPresetFor, y as ZIP_OUTPUT_TYPE } from "./enums-PcXr3o3J.js";
8
+ import { $ as ChartExBinning, $t as ImageBaseProps, A as PositionProps, At as ObjectLockProps, B as HyperlinkActionJump, Bt as ResolvedCommentAuthor, C as HexColor, Ct as ChartPropsLegend, D as PatternFillProps, Dt as OptsChartData, E as Margin, En as RadarStyleAlias, Et as LineCap, F as ActionHyperlinkProps, Ft as CommentProps, G as ShapeLineProps, Gt as TextBulletProps, H as HyperlinkProps, Ht as TableCellLayout, I as BorderProps, It as MeasureTextOptions, J as UrlHyperlinkProps, Jt as TextMeasurement, K as SlideHyperlinkProps, Kt as TextFitShrinkProps, L as ConnectorProps, Lt as NotesProps, M as TextVertType, Mn as TimeUnit, Mt as PlaceholderBinding, N as ThemeColor, Nt as PlaceholderOption, O as PatternPreset, Ot as OptsChartGridLine, P as VAlign, Pt as PlaceholderProps, Q as ChartErrorBarOptions, Qt as textRuns, R as ConnectorType, Rt as NotesTextOptions, S as HAlign, Sn as LineDataSymbol, St as ChartPropsFillLine, T as LinearGradientFillProps, Tn as RadarStyle, Tt as ChartSeriesOpts, U as ShadowProps, Ut as TableLayoutResult, V as HyperlinkBaseProps, Vt as SlideComment, W as ShapeFillProps, Wt as TextBaseProps, X as ChartAxisTickMark, Xt as TextPropsOptions, Y as ChartAreaProps, Yt as TextProps, Z as ChartDataPointStyle, Zt as textRun, _ as DataOrPathProps, _n as DisplayBlanksAs, _t as ChartPropsChartStock, a as PresentationProps, an as ShapeAdjustHandlePolar, at as ChartPropsAxisCat, b as GradientFillProps, bn as LightRigDirection, bt as ChartPropsDataLabel, c as WriteFileProps, cn as ShapeConnectionSite, ct as ChartPropsBase, d as ThemeColorScheme, dn as Bar3DShape, dt as ChartPropsChartDoughnut, en as ImageProps, et as ChartExGeography, f as ThemeProps, fn as BarDirection, ft as ChartPropsChartHistogram, g as Coord, gn as DataLabelPosition, gt as ChartPropsChartRegionMap, h as Color, ht as ChartPropsChartRadar, i as PresLayout, in as ShapeAdjustHandle, it as ChartOpts, j as RadialGradientFillProps, jt as ObjectNameProps, k as PlaceholderPositionProps, kt as CommonObjectDescriptor, l as WriteOutputMap, ln as ShapeGuide, lt as ChartPropsChartBar, m as BackgroundProps, mn as BevelPresetType, mt as ChartPropsChartPie, n as PackagePart, nn as MediaType, nt as ChartLineDash, o as SectionProps, on as ShapeAdjustHandleXY, ot as ChartPropsAxisSer, p as BackgroundOption, pn as BarGrouping, pt as ChartPropsChartLine, q as StrokeProps, qt as TextGlowProps, r as PartsProps, rn as OleObjectProps, rt as ChartMulti, s as WriteBaseProps, sn as ShapeAdjustValue, st as ChartPropsAxisVal, t as CustomPropertyValue, tn as MediaProps, tt as ChartExStatistics, u as WriteProps, un as ShapeProps, ut as ChartPropsChartBoxWhisker, v as DataOrPathRequiredProps, vt as ChartPropsChartSurface, w as ImageFillProps, wn as PresetMaterialType, wt as ChartPropsTitle, x as GradientStopProps, xn as LightRigType, xt as ChartPropsDataTable, y as GeometryPoint, yn as LegendPosition, yt as ChartPropsChartWaterfall, z as FillOption, zt as OverflowBoxOptions } from "./pres-BkEkUAEM.js";
9
+ import { A as TableCellDiagonals, C as AnimationTrigger, D as TransitionType, E as TransitionSoundProps, F as TableToSlidesDocument, I as TableToSlidesElement, L as TableToSlidesProps, M as TableProps, N as TableRow, O as TableCell, P as TableRowSlide, S as AnimationProps, T as TransitionProps, _ as MasterTextStyleProps, a as Slide, b as SlideMasterProps, c as SectionZoomProps, d as ZoomBaseProps, f as Model3dCameraProps, g as MasterTextStyleLevel, h as MasterBulletProps, i as ObjectOptions, j as TableCellProps, k as TableCell3DProps, l as SlideZoomProps, m as Model3dProps, n as GroupChildProps, o as SlideLayout, p as Model3dPoint, r as GroupProps, s as SlideObjectInfo, t as AddSlideProps, u as SummaryZoomProps, v as SlideMasterChartProps, w as PresetEffect, x as SlideNumberProps, y as SlideMasterObject } from "./slide-BmT4kMoO.js";
10
+ import { S as UnsupportedFeatureErrorCode, _ as InternalErrorCode, a as TsPptxCode, b as PackageReadErrorCode, c as InternalError, d as PackageReadError, f as PptxTsError, g as ErrorCode, h as DiagnosticCode, i as setDiagnosticHandler, l as InvalidOptionError, m as UnsupportedFeatureError, n as DiagnosticHandler, o as TsPptxError, p as PptxTsErrorOptions, r as resetDiagnosticState, s as TsPptxErrorOptions, t as Diagnostic, u as MediaError, v as InvalidOptionErrorCode, x as PptxTsCode, y as MediaErrorCode } from "./diagnostics-MoA4MBq5.js";
11
+ import { A as pixelsToEmu, C as StandardLayoutName, D as emuToPoints, E as emuToPixels, M as ptToHundredths, O as inchesToEmu, S as StandardLayout, T as emuToInches, _ as HUNDREDTHS_PER_POINT, b as PERCENT_SCALE, c as ConstructFamily, g as FIXED_PCT_PER_PERCENT, h as Emu, i as ComposedSlide, j as pointsToEmu, k as percentToEmu, m as DEFAULT_PX_PER_INCH, n as Composed, p as ANGLE_UNITS_PER_DEGREE, r as ComposedPresentation, s as PresentationCore, t as ComposeOptions, v as MAX_COORDINATE_EMU, w as coordToEmu, x as STANDARD_LAYOUTS, y as MIN_COORDINATE_EMU } from "./entry-compose-CiakSt-f.js";
12
+ import { a as EMU_PER_INCH, i as clipPath, n as FlatSide, o as EMU_PER_POINT, r as HalfDiscPreset, s as POINTS_PER_INCH, t as ClipShape } from "./clip-ISfCMtWA.js";
13
+ /**
14
+ * The Node entry, reached through the `node` export condition. A consumer importing the bare
10
15
  * `pptx-ts` specifier under Node lands here without naming this subpath.
11
16
  *
12
17
  * Same authoring API as every other entry (see `entry-surface.ts`); the runtime adapter is what
13
18
  * differs. This one can reach the filesystem, so `writeFile` writes a real file and media may be
14
- * loaded from a path — both of which throw on the runtime-agnostic entry.
19
+ * loaded from a path, both of which throw on the runtime-agnostic entry.
15
20
  */
16
- export declare class TsPptx extends PresentationCore {
21
+ export declare class PptxTs extends PresentationCore {
17
22
  constructor();
18
23
  }
19
24
  /**
20
25
  * Compose a presentation from the construct families it needs, on the Node adapter.
21
26
  *
22
- * The counterpart to {@link TsPptx}, which is composed with every family there is. This one costs
27
+ * The counterpart to {@link PptxTs}, which is composed with every family there is. This one costs
23
28
  * what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever
24
29
  * `use` names, and nothing else reaches the bundle.
25
30
  * @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`
@@ -29,6 +34,9 @@ export declare class TsPptx extends PresentationCore {
29
34
  * const pres = createPresentation({ use: [charts] })
30
35
  */
31
36
  export declare function createPresentation<const Fs extends readonly ConstructFamily[] = []>(opts?: ComposeOptions<Fs>): Composed<Fs>;
32
- //#endregion
33
- export { ANGLE_UNITS_PER_DEGREE, AddSlideProps, AlignH, AlignV, AnimationProps, AnimationTrigger, BackgroundOption, BackgroundProps, type Bar3DShape, type BarDirection, type BarGrouping, type BevelPresetType, BorderProps, BulletType, CHART_NAME, CONNECTOR_PRESET_NAME, ChartAreaProps, ChartAxisTickMark, ChartDataPointStyle, ChartErrorBarOptions, ChartExBinning, ChartExGeography, ChartExStatistics, ChartLineDash, ChartMulti, ChartOpts, ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartBoxWhisker, ChartPropsChartDoughnut, ChartPropsChartHistogram, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsChartWaterfall, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsFillLine, ChartPropsLegend, ChartPropsTitle, ChartSeriesOpts, ChartType, ClipShape, Color, CommentProps, CommonObjectDescriptor, type ComposeOptions, type Composed, type ComposedPresentation, type ComposedSlide, ConnectorProps, ConnectorType, type ConstructFamily, Coord, CustomPropertyValue, DEFAULT_PX_PER_INCH, type DataLabelPosition, DataOrPathProps, DataOrPathRequiredProps, type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type DisplayBlanksAs, EMU_PER_INCH, EMU_PER_POINT, Emu, type ErrorCode, FIXED_PCT_PER_PERCENT, FillOption, FlatSide, GeometryPoint, GradientFillProps, GradientStopProps, GroupChildProps, GroupProps, HAlign, HUNDREDTHS_PER_POINT, HalfDiscPreset, HexColor, HyperlinkActionJump, HyperlinkProps, ImageBaseProps, ImageFillProps, ImageProps, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LegendPosition, type LightRigDirection, type LightRigType, LineCap, type LineDataSymbol, LinearGradientFillProps, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, Margin, MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps, MeasureTextOptions, MediaError, type MediaErrorCode, MediaProps, MediaType, Model3dCameraProps, Model3dPoint, Model3dProps, NotesProps, NotesTextOptions, ObjectLockProps, ObjectNameProps, ObjectOptions, OleObjectProps, OptsChartData, OptsChartGridLine, OutputType, OverflowBoxOptions, PERCENT_SCALE, PLACEHOLDER_TYPE, POINTS_PER_INCH, PackagePart, PackageReadError, type PackageReadErrorCode, PartsProps, PatternFillProps, PatternPreset, PlaceholderProps, PlaceholderType, PositionProps, PresLayout, PresentationProps, PresetEffect, type PresetMaterialType, type RadarStyle, type RadarStyleAlias, RadialGradientFillProps, ResolvedCommentAuthor, SCHEME_COLORS, SHAPE_NAME, STANDARD_LAYOUTS, SchemeColor, SectionProps, SectionZoomProps, ShadowProps, ShapeAdjustHandle, ShapeAdjustHandlePolar, ShapeAdjustHandleXY, ShapeAdjustValue, ShapeConnectionSite, ShapeFillProps, ShapeGuide, ShapeLineProps, ShapeProps, ShapeType, Slide, SlideComment, SlideLayout, SlideMasterChartProps, SlideMasterObject, SlideMasterProps, SlideNumberProps, SlideObjectInfo, SlideObjectType, SlideZoomProps, StandardLayout, StandardLayoutName, StrokeProps, SummaryZoomProps, TableCell, TableCell3DProps, TableCellDiagonals, TableCellLayout, TableCellProps, TableLayoutResult, TableProps, TableRow, TableRowSlide, TableStyle, TableToSlidesDocument, TableToSlidesElement, TableToSlidesProps, TextAnchor, TextBaseProps, TextBulletProps, TextFitShrinkProps, TextGlowProps, TextMeasurement, TextProps, TextPropsOptions, TextVertType, ThemeColor, ThemeColorScheme, ThemeProps, type TimeUnit, TransitionProps, TransitionSoundProps, TransitionType, TsPptx as default, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, VALID_SHAPE_PRESETS, VAlign, WRITE_OUTPUT_TYPE, WriteBaseProps, WriteFileProps, WriteOutputMap, WriteProps, ZIP_OUTPUT_TYPE, ZoomBaseProps, asChartType, clipPath, connectorPresetFor, coordToEmu, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
37
+ /** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */
38
+ export declare const TsPptx: typeof PptxTs;
39
+ /** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */
40
+ export type TsPptx = PptxTs;
41
+ export { ANGLE_UNITS_PER_DEGREE, ActionHyperlinkProps, AddSlideProps, AlignH, AlignV, AnimationProps, AnimationTrigger, BackgroundOption, BackgroundProps, type Bar3DShape, type BarDirection, type BarGrouping, type BevelPresetType, BorderProps, BulletType, CHART_NAME, CONNECTOR_PRESET_NAME, ChartAreaProps, ChartAxisTickMark, ChartDataPointStyle, ChartErrorBarOptions, ChartExBinning, ChartExGeography, ChartExStatistics, ChartLineDash, ChartMulti, ChartOpts, ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartBoxWhisker, ChartPropsChartDoughnut, ChartPropsChartHistogram, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsChartWaterfall, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsFillLine, ChartPropsLegend, ChartPropsTitle, ChartSeriesOpts, ChartType, ClipShape, Color, CommentProps, CommonObjectDescriptor, type ComposeOptions, type Composed, type ComposedPresentation, type ComposedSlide, ConnectorProps, ConnectorType, type ConstructFamily, Coord, CustomPropertyValue, DEFAULT_PX_PER_INCH, type DataLabelPosition, DataOrPathProps, DataOrPathRequiredProps, type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type DisplayBlanksAs, EMU_PER_INCH, EMU_PER_POINT, Emu, type ErrorCode, FIXED_PCT_PER_PERCENT, FillOption, FlatSide, GeometryPoint, GradientFillProps, GradientStopProps, GroupChildProps, GroupProps, HAlign, HUNDREDTHS_PER_POINT, HalfDiscPreset, HexColor, HyperlinkActionJump, HyperlinkBaseProps, HyperlinkProps, ImageBaseProps, ImageFillProps, ImageProps, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LegendPosition, type LightRigDirection, type LightRigType, LineCap, type LineDataSymbol, LinearGradientFillProps, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, Margin, MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps, MeasureTextOptions, MediaError, type MediaErrorCode, MediaProps, MediaType, Model3dCameraProps, Model3dPoint, Model3dProps, NotesProps, NotesTextOptions, ObjectLockProps, ObjectNameProps, ObjectOptions, OleObjectProps, OptsChartData, OptsChartGridLine, OutputType, OverflowBoxOptions, PERCENT_SCALE, PLACEHOLDER_TYPE, POINTS_PER_INCH, PackagePart, PackageReadError, type PackageReadErrorCode, PartsProps, PatternFillProps, PatternPreset, PlaceholderBinding, PlaceholderOption, PlaceholderPositionProps, PlaceholderProps, PlaceholderType, PositionProps, PptxTs as default, type PptxTsCode, PptxTsError, type PptxTsErrorOptions, PresLayout, PresentationProps, PresetEffect, type PresetMaterialType, type RadarStyle, type RadarStyleAlias, RadialGradientFillProps, ResolvedCommentAuthor, SCHEME_COLORS, SHAPE_NAME, STANDARD_LAYOUTS, SchemeColor, SectionProps, SectionZoomProps, ShadowProps, ShapeAdjustHandle, ShapeAdjustHandlePolar, ShapeAdjustHandleXY, ShapeAdjustValue, ShapeConnectionSite, ShapeFillProps, ShapeGuide, ShapeLineProps, ShapeProps, ShapeType, Slide, SlideComment, SlideHyperlinkProps, SlideLayout, SlideMasterChartProps, SlideMasterObject, SlideMasterProps, SlideNumberProps, SlideObjectInfo, SlideObjectType, SlideZoomProps, StandardLayout, StandardLayoutName, StrokeProps, SummaryZoomProps, TableCell, TableCell3DProps, TableCellDiagonals, TableCellLayout, TableCellProps, TableLayoutResult, TableProps, TableRow, TableRowSlide, TableStyle, TableToSlidesDocument, TableToSlidesElement, TableToSlidesProps, TextAnchor, TextBaseProps, TextBulletProps, TextFitShrinkProps, TextGlowProps, TextMeasurement, TextProps, TextPropsOptions, TextVertType, ThemeColor, ThemeColorScheme, ThemeProps, type TimeUnit, TransitionProps, TransitionSoundProps, TransitionType, TsPptxCode, TsPptxError, TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, UrlHyperlinkProps, VALID_SHAPE_PRESETS, VAlign, WRITE_OUTPUT_TYPE, WriteBaseProps, WriteFileProps, WriteOutputMap, WriteProps, ZIP_OUTPUT_TYPE, ZoomBaseProps, asChartType, clipPath, connectorPresetFor, coordToEmu, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
34
42
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","names":[],"sources":["../src/node.ts"],"mappings":";;;;;;;;;;;;;;;qBAoBa,eAAe;EAC3B;;;;;;;;;;;;;;wBAiBe,yBAAyB,oBAAoB,wBAC5D,OAAO,eAAe,MACpB,SAAS"}
1
+ {"version":3,"file":"node.d.ts","names":[],"sources":["../src/node.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAoBa,eAAe;EAC3B;;;;;;;;;;;;;;wBAiBe,yBAAyB,oBAAoB,wBAC5D,OAAO,eAAe,MACpB,SAAS;;qBAOC,eAAM;;YAEP,SAAS"}
package/dist/node.js CHANGED
@@ -1,9 +1,9 @@
1
- import { a as TsPptxError, c as setDiagnosticHandler, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, s as resetDiagnosticState, t as InternalError } from "./errors-Da2nXCJm.js";
2
- import { A as inchesToEmu, C as MIN_COORDINATE_EMU, D as emuToInches, E as coordToEmu, F as EMU_PER_INCH, I as EMU_PER_POINT, L as POINTS_PER_INCH, M as pixelsToEmu, N as pointsToEmu, O as emuToPixels, P as ptToHundredths, S as MAX_COORDINATE_EMU, T as STANDARD_LAYOUTS, _ as isChartType, a as ChartType, b as FIXED_PCT_PER_PERCENT, c as SchemeColor, d as TableStyle, f as TextAnchor, g as isChartExType, h as connectorPresetFor, i as BulletType, j as percentToEmu, k as emuToPoints, l as ShapeType, m as asChartType, n as AlignH, o as OutputType, p as VALID_SHAPE_PRESETS, r as AlignV, s as PlaceholderType, u as SlideObjectType, v as ANGLE_UNITS_PER_DEGREE, w as PERCENT_SCALE, x as HUNDREDTHS_PER_POINT, y as DEFAULT_PX_PER_INCH } from "./table-cell-margins-PDshga8T.js";
3
- import { a as fetchMediaBase64, c as ALL_CONSTRUCT_FAMILIES, i as fetchFontBytes, l as composePresentation, n as textRuns, o as isRemote, r as clipPath, s as placeholderSvgPreview, t as textRun, u as PresentationCore } from "./text-BvFFMMFQ.js";
1
+ import { a as fetchMediaBase64, c as ALL_CONSTRUCT_FAMILIES, i as fetchFontBytes, l as composePresentation, n as textRuns, o as isRemote, r as clipPath, s as placeholderSvgPreview, t as textRun, u as PresentationCore } from "./text-Dz0ArGIp.js";
2
+ import { A as inchesToEmu, C as MIN_COORDINATE_EMU, D as emuToInches, E as coordToEmu, F as EMU_PER_INCH, I as EMU_PER_POINT, L as POINTS_PER_INCH, M as pixelsToEmu, N as pointsToEmu, O as emuToPixels, P as ptToHundredths, S as MAX_COORDINATE_EMU, T as STANDARD_LAYOUTS, a as OutputType, b as FIXED_PCT_PER_PERCENT, c as ShapeType, d as TextAnchor, f as VALID_SHAPE_PRESETS, g as isChartType, h as isChartExType, i as ChartType, j as percentToEmu, k as emuToPoints, l as SlideObjectType, m as connectorPresetFor, n as AlignV, o as PlaceholderType, p as asChartType, r as BulletType, s as SchemeColor, t as AlignH, u as TableStyle, v as ANGLE_UNITS_PER_DEGREE, w as PERCENT_SCALE, x as HUNDREDTHS_PER_POINT, y as DEFAULT_PX_PER_INCH } from "./enums-BP9wsb9Q.js";
3
+ import { a as PackageReadError, c as resetDiagnosticState, i as MediaError, l as setDiagnosticHandler, n as InternalError, o as PptxTsError, r as InvalidOptionError, s as UnsupportedFeatureError, t as TsPptxError } from "./entry-errors-JMthgJ2g.js";
4
4
  import { Buffer } from "node:buffer";
5
5
  import fs from "node:fs/promises";
6
- //#region src/runtime/node.ts
6
+ // src/runtime/node.ts
7
7
  function createNodeRuntime() {
8
8
  return {
9
9
  writeFileOutputType: "nodebuffer",
@@ -33,8 +33,7 @@ async function writeFile(fileName, data) {
33
33
  await fs.writeFile(fileName, data);
34
34
  return fileName;
35
35
  }
36
- //#endregion
37
- //#region src/node.ts
36
+ // src/node.ts
38
37
  /**
39
38
  * The Node authoring entry, which the bare `pptx-ts` specifier resolves to under the `node`
40
39
  * export condition.
@@ -42,14 +41,14 @@ async function writeFile(fileName, data) {
42
41
  * @module
43
42
  */
44
43
  /**
45
- * The Node entry, reached through the `node` export condition — a consumer importing the bare
44
+ * The Node entry, reached through the `node` export condition. A consumer importing the bare
46
45
  * `pptx-ts` specifier under Node lands here without naming this subpath.
47
46
  *
48
47
  * Same authoring API as every other entry (see `entry-surface.ts`); the runtime adapter is what
49
48
  * differs. This one can reach the filesystem, so `writeFile` writes a real file and media may be
50
- * loaded from a path — both of which throw on the runtime-agnostic entry.
49
+ * loaded from a path, both of which throw on the runtime-agnostic entry.
51
50
  */
52
- var TsPptx = class extends PresentationCore {
51
+ var PptxTs = class extends PresentationCore {
53
52
  constructor() {
54
53
  super(createNodeRuntime(), ALL_CONSTRUCT_FAMILIES);
55
54
  }
@@ -57,7 +56,7 @@ var TsPptx = class extends PresentationCore {
57
56
  /**
58
57
  * Compose a presentation from the construct families it needs, on the Node adapter.
59
58
  *
60
- * The counterpart to {@link TsPptx}, which is composed with every family there is. This one costs
59
+ * The counterpart to {@link PptxTs}, which is composed with every family there is. This one costs
61
60
  * what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever
62
61
  * `use` names, and nothing else reaches the bundle.
63
62
  * @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`
@@ -69,7 +68,8 @@ var TsPptx = class extends PresentationCore {
69
68
  function createPresentation(opts) {
70
69
  return composePresentation(createNodeRuntime(), opts);
71
70
  }
72
- //#endregion
73
- export { ANGLE_UNITS_PER_DEGREE, AlignH, AlignV, BulletType, ChartType, DEFAULT_PX_PER_INCH, EMU_PER_INCH, EMU_PER_POINT, FIXED_PCT_PER_PERCENT, HUNDREDTHS_PER_POINT, InternalError, InvalidOptionError, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, MediaError, OutputType, PERCENT_SCALE, POINTS_PER_INCH, PackageReadError, PlaceholderType, STANDARD_LAYOUTS, SchemeColor, ShapeType, SlideObjectType, TableStyle, TextAnchor, TsPptx, TsPptx as default, TsPptxError, UnsupportedFeatureError, VALID_SHAPE_PRESETS, asChartType, clipPath, connectorPresetFor, coordToEmu, createPresentation, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
71
+ /** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */
72
+ const TsPptx = PptxTs;
73
+ export { ANGLE_UNITS_PER_DEGREE, AlignH, AlignV, BulletType, ChartType, DEFAULT_PX_PER_INCH, EMU_PER_INCH, EMU_PER_POINT, FIXED_PCT_PER_PERCENT, HUNDREDTHS_PER_POINT, InternalError, InvalidOptionError, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, MediaError, OutputType, PERCENT_SCALE, POINTS_PER_INCH, PackageReadError, PlaceholderType, PptxTs, PptxTs as default, PptxTsError, STANDARD_LAYOUTS, SchemeColor, ShapeType, SlideObjectType, TableStyle, TextAnchor, TsPptx, TsPptxError, UnsupportedFeatureError, VALID_SHAPE_PRESETS, asChartType, clipPath, connectorPresetFor, coordToEmu, createPresentation, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
74
74
 
75
75
  //# sourceMappingURL=node.js.map