pptx-ts 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +319 -0
  3. package/dist/autopage-DkjYZUFD.js +423 -0
  4. package/dist/autopage-DkjYZUFD.js.map +1 -0
  5. package/dist/browser.d.ts +31 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +110 -0
  8. package/dist/browser.js.map +1 -0
  9. package/dist/diagnostics-Du_s75MT.d.ts +829 -0
  10. package/dist/diagnostics-Du_s75MT.d.ts.map +1 -0
  11. package/dist/enums-CvRYniUA.d.ts +463 -0
  12. package/dist/enums-CvRYniUA.d.ts.map +1 -0
  13. package/dist/errors-Bvln0H-7.js +112 -0
  14. package/dist/errors-Bvln0H-7.js.map +1 -0
  15. package/dist/errors-PflMPWBn.d.ts +182 -0
  16. package/dist/errors-PflMPWBn.d.ts.map +1 -0
  17. package/dist/fit-BKs0zxMI.js +1356 -0
  18. package/dist/fit-BKs0zxMI.js.map +1 -0
  19. package/dist/html-dom-B0I0QSbU.js +679 -0
  20. package/dist/html-dom-B0I0QSbU.js.map +1 -0
  21. package/dist/html.d.ts +26 -0
  22. package/dist/html.d.ts.map +1 -0
  23. package/dist/html.js +63 -0
  24. package/dist/html.js.map +1 -0
  25. package/dist/index.d.ts +24 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +57 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/inspect.d.ts +197 -0
  30. package/dist/inspect.d.ts.map +1 -0
  31. package/dist/inspect.js +317 -0
  32. package/dist/inspect.js.map +1 -0
  33. package/dist/math.d.ts +37 -0
  34. package/dist/math.d.ts.map +1 -0
  35. package/dist/math.js +203 -0
  36. package/dist/math.js.map +1 -0
  37. package/dist/measure.d.ts +313 -0
  38. package/dist/measure.d.ts.map +1 -0
  39. package/dist/measure.js +3 -0
  40. package/dist/namespaces-BVnNu7sg.js +666 -0
  41. package/dist/namespaces-BVnNu7sg.js.map +1 -0
  42. package/dist/node.d.ts +20 -0
  43. package/dist/node.d.ts.map +1 -0
  44. package/dist/node.js +55 -0
  45. package/dist/node.js.map +1 -0
  46. package/dist/notes-RLCwdlTE.js +1703 -0
  47. package/dist/notes-RLCwdlTE.js.map +1 -0
  48. package/dist/package-CaOLXSNi.d.ts +193 -0
  49. package/dist/package-CaOLXSNi.d.ts.map +1 -0
  50. package/dist/pres-C5__xkDh.d.ts +202 -0
  51. package/dist/pres-C5__xkDh.d.ts.map +1 -0
  52. package/dist/presentation-Cp7vzlAw.js +5427 -0
  53. package/dist/presentation-Cp7vzlAw.js.map +1 -0
  54. package/dist/presentation-types-DP_8jog7.d.ts +4872 -0
  55. package/dist/presentation-types-DP_8jog7.d.ts.map +1 -0
  56. package/dist/read.d.ts +55 -0
  57. package/dist/read.d.ts.map +1 -0
  58. package/dist/read.js +4 -0
  59. package/dist/script.d.ts +581 -0
  60. package/dist/script.d.ts.map +1 -0
  61. package/dist/script.js +3741 -0
  62. package/dist/script.js.map +1 -0
  63. package/dist/shapes-BemroU-z.js +6951 -0
  64. package/dist/shapes-BemroU-z.js.map +1 -0
  65. package/dist/slide-js0QpRV-.d.ts +3873 -0
  66. package/dist/slide-js0QpRV-.d.ts.map +1 -0
  67. package/dist/text-CyetbF6p.js +11278 -0
  68. package/dist/text-CyetbF6p.js.map +1 -0
  69. package/dist/units-1kRzYShk.js +231 -0
  70. package/dist/units-1kRzYShk.js.map +1 -0
  71. package/dist/units-internal-Dg95w_YD.js +753 -0
  72. package/dist/units-internal-Dg95w_YD.js.map +1 -0
  73. package/dist/zip.d.ts +68 -0
  74. package/dist/zip.d.ts.map +1 -0
  75. package/dist/zip.js +163 -0
  76. package/dist/zip.js.map +1 -0
  77. package/package.json +152 -0
  78. package/skills/ts-pptx-upstream/SKILL.md +340 -0
@@ -0,0 +1,340 @@
1
+ ---
2
+ name: ts-pptx-upstream
3
+ description: Report a ts-pptx (@shbernal/ts-pptx) bug, gap, or wrong output to its GitHub tracker from a project that depends on it. Use when ts-pptx throws an InternalError or an error whose message points at the issue tracker, when it cannot read a .pptx that opens cleanly in PowerPoint, when it writes a deck PowerPoint repairs or renders wrong, when a construct does not survive a round trip, when its types block correct code, or whenever you are about to write a workaround for ts-pptx behaving incorrectly. Filing the bug is the fix; the workaround is the stopgap.
4
+ ---
5
+
6
+ # Reporting a ts-pptx problem upstream
7
+
8
+ You are in a project that *uses* `@shbernal/ts-pptx`, not the project that builds it.
9
+ This skill is how a defect you hit here becomes a permanent regression test there.
10
+
11
+ The library's maintainers turn reports with a minimal reproduction into fixtures and
12
+ regression cases, which is the only mechanism that guarantees a bug is never
13
+ reintroduced. A report without a reproduction is a wish; a report with one is a fix.
14
+
15
+ **The single most valuable thing you can do is reduce the failure to a script that
16
+ builds its own deck.** Everything below is in service of that.
17
+
18
+ ## 1. Decide whether it is actually ours
19
+
20
+ Every failure ts-pptx raises is a `TsPptxError` in one of five classes, and the class
21
+ already answers *whose problem is this*. Catch it and read `err.name` and `err.code`
22
+ — `code` is a stable `area/condition` string and is API; the message is not, so never
23
+ branch on its wording.
24
+
25
+ | class | whose bug | report it? |
26
+ | ------------------------- | ---------------- | ------------------------------------------------------------------- |
27
+ | `InternalError` | **ts-pptx** | Always. The library says so itself in the message. |
28
+ | `PackageReadError` | usually the file | Only if the file opens **cleanly in PowerPoint**. Then it's our gap. |
29
+ | `MediaError` | usually the asset| Only if the image/font/AV loads fine elsewhere. |
30
+ | `UnsupportedFeatureError` | nobody's, yet | If PowerPoint can express it, this is a feature request worth filing.|
31
+ | `InvalidOptionError` | usually you | Only if the deck it refused is one PowerPoint can express. |
32
+
33
+ **The supported bar is "the output opens cleanly in Microsoft PowerPoint."** That is
34
+ the project's own stated standard, and it is the test to apply in both directions: a
35
+ file PowerPoint opens but ts-pptx rejects is our gap, and a file ts-pptx writes that
36
+ PowerPoint repairs is our bug.
37
+
38
+ Not every defect throws. These are ours too, and are worth reporting:
39
+
40
+ - Output PowerPoint opens with a **repair prompt** (`0x80070570` and friends), or
41
+ renders differently than intended.
42
+ - A **round trip that loses a construct**: read a deck, write it back, something is
43
+ gone or changed. If the loss surfaced as a conversion fidelity note, the note has
44
+ already classified it for you — see below.
45
+ - The **read side cannot see what the write side authors** — a property ts-pptx emits
46
+ but has no accessor to read back. This is the strongest case a gap can make, and it
47
+ has its own form (see step 5).
48
+ - A `Diagnostic` that fires when it should not, does not fire when it should, or
49
+ carries the wrong `code`.
50
+ - Types that make correct code fail to compile, or admit code that throws at runtime.
51
+ - Documented behaviour that does not match observed behaviour.
52
+
53
+ ### If you are holding a fidelity note, it already told you
54
+
55
+ Anything that converts a deck through `@shbernal/ts-pptx/script` gets `FidelityNote`s
56
+ back, and `cause` is the library's own verdict on whose gap the loss is. Read it
57
+ before deciding whether to file — it answers the same question the error table above
58
+ answers for the throwing cases:
59
+
60
+ | `cause` | what it means | report it? |
61
+ | ------------- | ---------------------------------------------------------- | ----------------------------------------------- |
62
+ | `unread` | nothing on the read side can see it — a missing reader | **Yes**, and `api-gap.yml` is its form. |
63
+ | `unwritable` | it is read fine, but no write option can author it back | **Yes** — a missing option is a gap, not a limit.|
64
+ | `unsupported` | OOXML, or the tier you chose, cannot express it at all | **No**. No amount of converter work closes it. |
65
+
66
+ So a `dropped`/`unread` note is a report waiting to be written, and an `unsupported`
67
+ one is the format's answer rather than ours. Quote `construct` (`line.width`,
68
+ `table.rowAuto`) verbatim: it is a stable dotted key, the form asks for it, and it is
69
+ the fastest thing a maintainer can search on.
70
+
71
+ One more shape worth filing: a note that fires for a construct that **did** survive.
72
+ A declared loss that does not happen is a stale note, and it is a defect in the same
73
+ way a missing one is — it teaches every reader to discount the notes that are true.
74
+
75
+ Two things are **out of active maintenance scope** and will usually be closed — check
76
+ before spending effort on a reproduction:
77
+
78
+ - Live-DOM / browser-layout features, i.e. anything whose answer comes from a
79
+ *rendered* page (real `offsetWidth` after layout, the resolved cascade). Converting
80
+ an HTML `<table>` is *not* in this category.
81
+ - Third-party office-suite interop quirks that appear only after the file has been
82
+ round-tripped through another application, when the package ts-pptx wrote is itself
83
+ valid OOXML.
84
+
85
+ Issues and pull requests in those two areas are still welcome; just say so in the
86
+ report so nobody triages it as a regression.
87
+
88
+ Also: ts-pptx is **ESM, Node-first**. Reports about `require()`, a CJS build, or an
89
+ IIFE/global browser bundle will be closed — those are deliberately not supported.
90
+
91
+ ## 2. Collect the facts
92
+
93
+ ```bash
94
+ node -p "require('@shbernal/ts-pptx/package.json').version" # exact installed version
95
+ node -v # runtime (>=24 required)
96
+ ```
97
+
98
+ Capture, verbatim: `err.name`, `err.code`, the full message, `err.detail` if present,
99
+ and the stack. Do not paraphrase the message — the throw site is often identifiable
100
+ from its exact text, and `detail` is the structured context the site chose to attach.
101
+
102
+ If the failure is about how the file *renders* or whether PowerPoint repairs it, note
103
+ the PowerPoint version and platform too. For an API-shape report it is meaningless;
104
+ for a render report it is load-bearing.
105
+
106
+ ## 3. Build a minimal reproduction
107
+
108
+ **Never attach or paste the user's deck.** A presentation in a real project carries
109
+ client names, unreleased strategy, pricing, and internal logos. Treat every `.pptx`
110
+ in this repo as confidential unless the user tells you otherwise, and never upload one
111
+ to a public tracker — including "just a screenshot of the slide". This is the same rule
112
+ the project already applies to its own filings: describe a downstream consumer's need
113
+ anonymously, never its name, its deck or client names, or a path from its tree.
114
+
115
+ Instead, write a self-contained script that *constructs* its input and fails:
116
+
117
+ ```ts
118
+ import TsPptx from '@shbernal/ts-pptx'
119
+
120
+ // build the smallest deck that shows the problem
121
+ const pptx = new TsPptx()
122
+ const slide = pptx.addSlide()
123
+ slide.addText('x', { x: 1, y: 1, w: 8, h: 1 /* the option that triggers it */ })
124
+
125
+ const bytes = await pptx.write({ outputType: 'uint8array' })
126
+ // ...then whatever exposes the defect: read it back, inspect it, open it.
127
+ ```
128
+
129
+ For a read-side or round-trip defect, generate the input with the write side first, so
130
+ the script still owns everything it touches:
131
+
132
+ ```ts
133
+ import { Presentation } from '@shbernal/ts-pptx/read'
134
+
135
+ const pres = await Presentation.load(bytes) // bytes built above, not the user's file
136
+ // ...the accessor that returns the wrong thing, or throws
137
+ ```
138
+
139
+ Then cut it down: remove slides, shapes, options, and styling one at a time, re-running
140
+ after each cut, until removing anything more makes the failure disappear. What is left
141
+ is the report.
142
+
143
+ If the failure only reproduces with a *specific deck* you cannot share, do not ask for
144
+ permission to share it — file without the file. Say exactly that in the report and
145
+ describe the structural feature you believe is responsible (a grouped shape, a chart
146
+ part, a custom table style, a particular namespace prefix, a layout inherited from a
147
+ master). A maintainer can usually author a fixture from that description in PowerPoint;
148
+ they can never unsee an attachment.
149
+
150
+ If you need a file attached, build one: reproduce the *structure* you suspect in a deck
151
+ you generate, with invented values. A synthesized file is always safe to attach. A
152
+ redacted one is not yours to judge — redaction fails quietly, and a public tracker is
153
+ permanent.
154
+
155
+ ## 4. Check it is not already fixed, or already filed
156
+
157
+ **Fixed first.** The version in `node_modules` is whatever the project pinned, which is
158
+ not necessarily the current one:
159
+
160
+ ```bash
161
+ npm view @shbernal/ts-pptx version # latest published
162
+ ```
163
+
164
+ If that is ahead of the version you collected in step 2, bump the pin and re-run the
165
+ reproduction from step 3 before writing anything. A report against a stale version costs
166
+ a maintainer the same triage as a real one and ends in a close; the bump costs you one
167
+ command, and you were going to need it anyway once the fix shipped.
168
+
169
+ Then the tracker:
170
+
171
+ ```bash
172
+ gh issue list --repo shbernal/ts-pptx --state all --limit 20 --search "<distinctive phrase>"
173
+ ```
174
+
175
+ Search the error `code` (`table/invalid-border`, `oxml/node-has-no-document`), the
176
+ fidelity note's `construct` key, or the distinctive part of the message — not your
177
+ description of it. Codes and construct keys are stable and searchable in a way prose is
178
+ not. If an open issue matches, add your reproduction as a comment instead of opening a
179
+ duplicate; if a closed one matches, reopen the conversation there with your version and
180
+ Node version — closed and unreleased is a real state, and so is closed and regressed.
181
+
182
+ ## 5. Pick the form, then file it
183
+
184
+ **File it yourself. Do not stop to ask for permission.** A report whose reproduction
185
+ builds its own deck carries nothing of the user's into the tracker, so there is nothing
186
+ for them to weigh; interrupting them to approve a synthetic script is a question with
187
+ only one sensible answer. A duplicate or a thin report is a small cost to a maintainer.
188
+ A bug that is never filed because the moment passed costs everyone, permanently.
189
+
190
+ This rests entirely on step 3 holding: the reproduction constructs its own input, and no
191
+ file from this project is attached. When you cannot manage a self-contained reproduction,
192
+ the answer is a thinner report — the prose description from step 3 — not a question and
193
+ not an attachment.
194
+
195
+ Three forms; pick by what you are reporting:
196
+
197
+ | form | for |
198
+ | ------------------ | ------------------------------------------------------------------------- |
199
+ | `agent-report.yml` | you hit this while using the library in another project — start here |
200
+ | `bug.yml` | wrong output, a repair prompt, a regression, a fidelity limit |
201
+ | `api-gap.yml` | the OOXML carries it but no accessor reaches it |
202
+
203
+ If none fits, file a blank issue rather than bending one of them — blank issues are
204
+ enabled deliberately.
205
+
206
+ `gh` defaults to the *current* repository — which here is the consumer's, not ts-pptx's.
207
+ Always pass `--repo shbernal/ts-pptx` explicitly, or you will file the bug into the wrong
208
+ tracker.
209
+
210
+ ```bash
211
+ gh issue create --repo shbernal/ts-pptx \
212
+ --title "<InternalError|reads|writes|round-trip|types>: <one specific symptom>" \
213
+ --label agent-reported \
214
+ --body-file <a path your repo ignores>/ts-pptx-report.md
215
+ ```
216
+
217
+ Write the body somewhere the consumer's own `.gitignore` already covers — its scratch or
218
+ temp directory, whatever that repo calls it. A report file committed by accident is a
219
+ second copy of the reproduction living in someone else's history.
220
+
221
+ The web form (`agent-report.yml`) is what the error message links to; `gh` does not apply
222
+ issue forms, so mirror its sections in the body file so both routes land the same shape:
223
+
224
+ ````markdown
225
+ ### ts-pptx version
226
+ <x.y.z>
227
+
228
+ ### Node.js version
229
+ <vXX.Y.Z>
230
+
231
+ ### Operating system
232
+ <Windows 11 x64 / macOS 15 arm64 / Ubuntu 24.04 x64>
233
+
234
+ ### PowerPoint version
235
+ <only if the report depends on how PowerPoint renders or repairs the file>
236
+
237
+ ### Error class and code
238
+ <InternalError / oxml/node-has-no-document> (or: no error thrown — wrong output)
239
+
240
+ ### What happened
241
+ <observed>
242
+
243
+ ### What should have happened
244
+ <expected, and why you believe that — an ECMA-376 clause, what PowerPoint itself does
245
+ with the same input, or what the docs promise>
246
+
247
+ ### Minimal reproduction
248
+ ```js
249
+ <the script from step 3>
250
+ ```
251
+
252
+ ### Error output
253
+ ```
254
+ <verbatim message, detail, and stack>
255
+ ```
256
+
257
+ ### Attached file
258
+ <none / synthesized — describe how it was generated>
259
+ ````
260
+
261
+ Tell the user the issue number and URL once it exists — after the fact, as a result, not
262
+ as a request. They should be able to read what you filed and close it if they disagree.
263
+
264
+ ## 6. Then, and only then, write the workaround
265
+
266
+ Filing does not unblock the user. Once the issue is open, implement the workaround in
267
+ this project and mark it, so that whoever bumps the pin later can find it and decide.
268
+
269
+ An issue number alone is not enough of a mark. `remove once fixed upstream` does not say
270
+ what *fixed* looks like, so at bump time it cannot be checked — it can only be
271
+ re-investigated, which means re-reading the issue and re-deriving the reproduction
272
+ someone already wrote. Write the comment so that verifying the fix is running one line:
273
+
274
+ ```ts
275
+ // Workaround for ts-pptx#<N> — https://github.com/shbernal/ts-pptx/issues/<N>
276
+ //
277
+ // <what the library does instead, as an observable: the XML it emits, the value the
278
+ // accessor returns, the option it ignores.>
279
+ //
280
+ // Remove when <the exact check — an accessor returning the right value, a written part
281
+ // containing the right element> holds, and write <the code this becomes> instead.
282
+ ```
283
+
284
+ Keep `ts-pptx#` in that literal spelling wherever you mark one. It is the token that
285
+ makes `rg 'ts-pptx#'` list every stopgap in the project at once, and step 7 is exactly
286
+ the moment someone needs that list.
287
+
288
+ ## 7. When the fix ships, delete the workaround
289
+
290
+ The other half of the cycle, and the half that quietly does not happen: a stopgap nobody
291
+ removes becomes indistinguishable from a design decision, and the next reader inherits it
292
+ as one. Do this in one unit of work, on the release that carries the fix.
293
+
294
+ ```bash
295
+ npm view @shbernal/ts-pptx version # what is out
296
+ gh issue list --repo shbernal/ts-pptx --state closed --limit 30
297
+ rg 'ts-pptx#' # every stopgap here
298
+ ```
299
+
300
+ **A closed issue is not a released fix.** A fix can sit merged and unreleased for weeks,
301
+ so the published version is what to check, never the issue state — the repository's
302
+ [`CHANGELOG.md`](https://github.com/shbernal/ts-pptx/blob/master/CHANGELOG.md) and the
303
+ GitHub release notes name the issue numbers each version closes. Bump the pin, reinstall,
304
+ and refresh the installed skill in the same commit. Then, per stopgap:
305
+
306
+ 1. **Run the check its comment names.** If it does not hold, the release does not carry
307
+ that fix; say so on the issue rather than deleting anything.
308
+ 2. **Delete the workaround** and write what the comment told you to write.
309
+ 3. **Add the test the workaround was standing in for**, if the project has a layer that
310
+ can hold it. The stopgap was the only thing keeping the defect from being visible; a
311
+ deletion with nothing in its place means the same regression can return unnoticed.
312
+ 4. **Replace the comment rather than only deleting it** where the code still looks odd
313
+ without it. One sentence on why the shape it has is the shape it has — *this used to
314
+ be X because of Y, which release Z fixed* — is the difference between a reader
315
+ trusting the line and re-litigating it.
316
+ 5. **Close the loop upstream**: comment on the issue with the check that now passes, in
317
+ the same self-contained form as the original reproduction. A maintainer's own tests
318
+ say the fix works; a consumer's say it works *where it was found*, which is the thing
319
+ they cannot write themselves.
320
+
321
+ ## If `gh` is unavailable
322
+
323
+ Print the assembled report and this URL, and ask the user to paste it in:
324
+
325
+ <https://github.com/shbernal/ts-pptx/issues/new?template=agent-report.yml>
326
+
327
+ ## Keeping this skill current
328
+
329
+ This file ships inside the package, so the copy in `node_modules` always matches the
330
+ installed version — but the copy in an agent directory is a *copy*, and a version bump
331
+ does not move it. Refresh it in the same commit as the bump, which is step 7's commit:
332
+
333
+ ```bash
334
+ npx skills update ts-pptx-upstream
335
+ ```
336
+
337
+ If that reports nothing to do but the skill is not loading, the runtime link is missing
338
+ rather than the file — reinstall it with the command in the package README, which names
339
+ the runtimes explicitly. `skills experimental_install` and `experimental_sync` restore
340
+ the file from the lock and create no runtime links, so neither is the repair.