pptx-ts 0.0.1 → 4.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.
- package/README.md +116 -269
- package/dist/autopage-odPz7zZO.js +536 -0
- package/dist/autopage-odPz7zZO.js.map +1 -0
- package/dist/binary-string-CKVAYI3M.js +24 -0
- package/dist/binary-string-CKVAYI3M.js.map +1 -0
- package/dist/body-insets-Dw_BeWD_.js +54 -0
- package/dist/body-insets-Dw_BeWD_.js.map +1 -0
- package/dist/browser.d.ts +29 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +41 -14
- package/dist/browser.js.map +1 -1
- package/dist/clip-Bl01BPcN.d.ts +67 -0
- package/dist/clip-Bl01BPcN.d.ts.map +1 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
- package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
- package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
- package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
- package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
- package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
- package/dist/errors-C4oENPcu.js.map +1 -0
- package/dist/families.d.ts +260 -0
- package/dist/families.d.ts.map +1 -0
- package/dist/families.js +57 -0
- package/dist/families.js.map +1 -0
- package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
- package/dist/fit-Cb7naFj6.js.map +1 -0
- package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
- package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
- package/dist/grid-DikTjFey.js +187 -0
- package/dist/grid-DikTjFey.js.map +1 -0
- package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
- package/dist/html-dom-Iuog2wdK.js.map +1 -0
- package/dist/html.d.ts +6 -6
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +7 -6
- package/dist/html.js.map +1 -1
- package/dist/image-size-CvN2iCA4.js +1611 -0
- package/dist/image-size-CvN2iCA4.js.map +1 -0
- package/dist/index.d.ts +24 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +40 -31
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +40 -48
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +7 -5
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +16 -7
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +12 -225
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +3 -3
- package/dist/node.d.ts +22 -8
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +27 -7
- package/dist/node.js.map +1 -1
- package/dist/notes-Dh12JAbn.js +3264 -0
- package/dist/notes-Dh12JAbn.js.map +1 -0
- package/dist/options-internal-WqgMf720.js +43 -0
- package/dist/options-internal-WqgMf720.js.map +1 -0
- package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
- package/dist/package-J49Ck6S2.d.ts.map +1 -0
- package/dist/playbtn-CUqQdoDf.js +22 -0
- package/dist/playbtn-CUqQdoDf.js.map +1 -0
- package/dist/{slide-js0QpRV-.d.ts → pres-C6qgOFAa.d.ts} +1021 -1370
- package/dist/pres-C6qgOFAa.d.ts.map +1 -0
- package/dist/{presentation-Cp7vzlAw.js → presentation-DGYlAWhl.js} +3208 -2727
- package/dist/presentation-DGYlAWhl.js.map +1 -0
- package/dist/{presentation-types-DP_8jog7.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
- package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
- package/dist/read.d.ts +9 -9
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +4 -4
- package/dist/script.d.ts +80 -66
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +2399 -1139
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
- package/dist/shapes-re0KyQk_.js.map +1 -0
- package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
- package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
- package/dist/slide-size-BalTjFuv.js +88 -0
- package/dist/slide-size-BalTjFuv.js.map +1 -0
- package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
- package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
- package/dist/table-dom-BTDP3lEP.js +21 -0
- package/dist/table-dom-BTDP3lEP.js.map +1 -0
- package/dist/text-KnLOtEEu.js +3980 -0
- package/dist/text-KnLOtEEu.js.map +1 -0
- package/dist/text-anchor-CrYXAfUu.js +176 -0
- package/dist/text-anchor-CrYXAfUu.js.map +1 -0
- package/dist/transition-speed-kUEWDWTx.js +14 -0
- package/dist/transition-speed-kUEWDWTx.js.map +1 -0
- package/dist/units-internal-XJlf-hOl.js +649 -0
- package/dist/units-internal-XJlf-hOl.js.map +1 -0
- package/dist/zip-C0leZZMj.d.ts +67 -0
- package/dist/zip-C0leZZMj.d.ts.map +1 -0
- package/dist/zip-CKd8ihcf.js +177 -0
- package/dist/zip-CKd8ihcf.js.map +1 -0
- package/dist/zip.d.ts +3 -68
- package/dist/zip.js +3 -163
- package/dist/zoom-cX9sllpH.js +8865 -0
- package/dist/zoom-cX9sllpH.js.map +1 -0
- package/package.json +106 -19
- package/skills/ts-pptx-upstream/SKILL.md +58 -57
- package/dist/autopage-DkjYZUFD.js +0 -423
- package/dist/autopage-DkjYZUFD.js.map +0 -1
- package/dist/diagnostics-Du_s75MT.d.ts +0 -829
- package/dist/diagnostics-Du_s75MT.d.ts.map +0 -1
- package/dist/errors-Bvln0H-7.js.map +0 -1
- package/dist/errors-PflMPWBn.d.ts +0 -182
- package/dist/errors-PflMPWBn.d.ts.map +0 -1
- package/dist/fit-BKs0zxMI.js.map +0 -1
- package/dist/html-dom-B0I0QSbU.js.map +0 -1
- package/dist/namespaces-BVnNu7sg.js +0 -666
- package/dist/namespaces-BVnNu7sg.js.map +0 -1
- package/dist/notes-RLCwdlTE.js +0 -1703
- package/dist/notes-RLCwdlTE.js.map +0 -1
- package/dist/package-CaOLXSNi.d.ts.map +0 -1
- package/dist/pres-C5__xkDh.d.ts +0 -202
- package/dist/pres-C5__xkDh.d.ts.map +0 -1
- package/dist/presentation-Cp7vzlAw.js.map +0 -1
- package/dist/presentation-types-DP_8jog7.d.ts.map +0 -1
- package/dist/shapes-BemroU-z.js.map +0 -1
- package/dist/slide-js0QpRV-.d.ts.map +0 -1
- package/dist/text-CyetbF6p.js +0 -11278
- package/dist/text-CyetbF6p.js.map +0 -1
- package/dist/units-1kRzYShk.js +0 -231
- package/dist/units-1kRzYShk.js.map +0 -1
- package/dist/units-internal-Dg95w_YD.js.map +0 -1
- package/dist/zip.d.ts.map +0 -1
- package/dist/zip.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,87 +1,37 @@
|
|
|
1
1
|
# ts-pptx
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> never both: two copies of this library in one dependency tree are two module
|
|
7
|
-
> registries, and state such as the diagnostic handler is per-copy. The scoped name is
|
|
8
|
-
> canonical, and the issue tracker, the changelog and every example below use it.
|
|
9
|
-
|
|
10
|
-
[](https://www.npmjs.com/package/@shbernal/ts-pptx)
|
|
11
|
-
[](https://www.npmjs.com/package/@shbernal/ts-pptx)
|
|
12
|
-
[](https://www.npmjs.com/package/@shbernal/ts-pptx)
|
|
3
|
+
[](https://www.npmjs.com/package/pptx-ts)
|
|
4
|
+
[](https://www.npmjs.com/package/pptx-ts)
|
|
5
|
+
[](https://www.npmjs.com/package/pptx-ts)
|
|
13
6
|
[](https://github.com/shbernal/ts-pptx/actions/workflows/ci.yml)
|
|
14
7
|
[](LICENSE)
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
JavaScript. This project targets ESM package consumers, typed application code,
|
|
18
|
-
reproducible package verification, and agent-assisted OOXML development.
|
|
9
|
+
**Write a program, get a PowerPoint file.**
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
A `.pptx` is a zip full of XML. ts-pptx writes that zip for you, so you describe
|
|
12
|
+
slides in TypeScript and a `.pptx` comes out the other end. PowerPoint never runs, no
|
|
13
|
+
Office licence is involved, and nothing has to be installed on the machine doing the
|
|
14
|
+
writing. The file opens cleanly in desktop PowerPoint, and Keynote, LibreOffice Impress
|
|
15
|
+
and Google Slides import it on a best-effort basis.
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
PowerPoint at runtime.
|
|
30
|
-
- Support TypeScript-first workflows with checked declarations and modern
|
|
31
|
-
bundler resolution.
|
|
32
|
-
- Ship a small, explicit ESM package boundary for Node.js, Vite, React,
|
|
33
|
-
Angular, Electron, and similar modern toolchains.
|
|
34
|
-
- Keep OOXML changes grounded in fixtures, schema validation, and PowerPoint
|
|
35
|
-
compatibility evidence.
|
|
36
|
-
- Make the repository practical for human and agent-driven maintenance.
|
|
17
|
+
Reach for it when a deck has to be built from data that changes: a monthly report,
|
|
18
|
+
one deck per customer, a hundred decks per night, or a download button on a page that
|
|
19
|
+
hands the user a deck built from what they are looking at.
|
|
37
20
|
|
|
38
21
|
## Install
|
|
39
22
|
|
|
40
23
|
```bash
|
|
41
|
-
pnpm add
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npm install @shbernal/ts-pptx
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
yarn add @shbernal/ts-pptx
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The unscoped name [`pptx-ts`](https://www.npmjs.com/package/pptx-ts) is an alias
|
|
53
|
-
for the same package: same contents, same version, published from the same
|
|
54
|
-
commit by the same workflow. Take it if a scoped name is awkward somewhere in
|
|
55
|
-
your toolchain. Install one or the other and never both, because two copies of
|
|
56
|
-
this library in one dependency tree are two module registries and state such as
|
|
57
|
-
the diagnostic handler is per-copy. The scoped name is canonical: the issue
|
|
58
|
-
tracker, the changelog and every example in these docs use it.
|
|
59
|
-
|
|
60
|
-
### Installing an unreleased commit
|
|
61
|
-
|
|
62
|
-
Any commit is installable directly from GitHub, without waiting for a release:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm install github:shbernal/ts-pptx#<commit-sha>
|
|
24
|
+
pnpm add pptx-ts
|
|
66
25
|
```
|
|
67
26
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
`dist/` is not committed, so this builds the package on install: your package
|
|
72
|
-
manager clones the repo, installs this package's `devDependencies`, and runs its
|
|
73
|
-
`prepare` script. That makes the install slow (a couple of minutes) and heavier
|
|
74
|
-
than a registry install, and it needs a working Node toolchain. It is meant for
|
|
75
|
-
trying a fix before it ships, not for production dependencies.
|
|
76
|
-
|
|
77
|
-
Note that `pres.version` reports the version in `package.json` at that commit, so
|
|
78
|
-
several different commits report the same number. The sha in your `package.json`
|
|
79
|
-
is what identifies the build.
|
|
27
|
+
`@shbernal/ts-pptx` is the same package under its first name, so install one or the other.
|
|
28
|
+
[Installation](docs/getting-started/installation.md) covers npm, CommonJS and the optional
|
|
29
|
+
math dependencies.
|
|
80
30
|
|
|
81
|
-
## Quick
|
|
31
|
+
## Quick start
|
|
82
32
|
|
|
83
33
|
```ts
|
|
84
|
-
import TsPptx from "
|
|
34
|
+
import TsPptx from "pptx-ts"
|
|
85
35
|
|
|
86
36
|
const pptx = new TsPptx()
|
|
87
37
|
const slide = pptx.addSlide()
|
|
@@ -98,218 +48,115 @@ slide.addText("Hello from ts-pptx", {
|
|
|
98
48
|
await pptx.writeFile({ fileName: "example.pptx" })
|
|
99
49
|
```
|
|
100
50
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- **
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
[
|
|
131
|
-
and
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
layout helpers ship from the main entry)
|
|
180
|
-
- `import { inspectPptx } from "@shbernal/ts-pptx/inspect"`
|
|
181
|
-
- `import { measureText } from "@shbernal/ts-pptx/measure"`
|
|
182
|
-
- `import { Presentation } from "@shbernal/ts-pptx/read"`
|
|
183
|
-
- `import { latexToOmml } from "@shbernal/ts-pptx/math"`
|
|
184
|
-
- `import { tableToSlides } from "@shbernal/ts-pptx/html"`
|
|
185
|
-
- `import TsPptx from "@shbernal/ts-pptx/node"`
|
|
186
|
-
- `import TsPptx from "@shbernal/ts-pptx/browser"`:
|
|
187
|
-
the bare specifier resolves to one of these two by export condition, so Node
|
|
188
|
-
and bundled browser apps get the right build without naming it. A runtime that
|
|
189
|
-
sets neither (Deno, Bun, edge workers) gets a runtime-agnostic build that
|
|
190
|
-
authors and exports bytes normally but has no `writeFile` destination; see
|
|
191
|
-
[Runtime And Package Support](docs/runtime-and-package-support.md#which-build-the-bare-import-gives-you).
|
|
192
|
-
- generated runtime and declaration artifacts under `dist/`
|
|
193
|
-
- Node.js `>=24`
|
|
194
|
-
- modern bundlers and module-aware app frameworks
|
|
195
|
-
|
|
196
|
-
Deliberately not supported:
|
|
197
|
-
|
|
198
|
-
- No CommonJS: no `require("@shbernal/ts-pptx")`, no CJS export condition, and no
|
|
199
|
-
`.cjs` artifact. Modern Node.js may provide `require()` interop for ESM, but it
|
|
200
|
-
is not a maintained API.
|
|
201
|
-
- No IIFE/global browser bundle: no classic-script global, no `dist/*.bundle.js`,
|
|
202
|
-
and no `dist/*.min.js`.
|
|
203
|
-
|
|
204
|
-
Use the package exports rather than direct `dist/` artifact paths.
|
|
205
|
-
|
|
206
|
-
See [runtime and package support](docs/runtime-and-package-support.md) for the
|
|
207
|
-
complete support contract.
|
|
208
|
-
|
|
209
|
-
## HTML Tables → Slides
|
|
210
|
-
|
|
211
|
-
`@shbernal/ts-pptx/html` reproduces an existing HTML `<table>` as a PowerPoint
|
|
212
|
-
table, auto-paging across as many slides as its rows need. It works in the
|
|
213
|
-
browser and under Node with any DOM implementation, from one artifact.
|
|
214
|
-
|
|
215
|
-
```ts
|
|
216
|
-
import { TsPptx } from '@shbernal/ts-pptx'
|
|
217
|
-
import { tableToSlides } from '@shbernal/ts-pptx/html'
|
|
218
|
-
import { Window } from 'happy-dom'
|
|
219
|
-
|
|
220
|
-
const win = new Window()
|
|
221
|
-
win.document.body.innerHTML = '<table id="report">…</table>'
|
|
222
|
-
|
|
223
|
-
const pptx = new TsPptx()
|
|
224
|
-
tableToSlides(pptx, win.document.getElementById('report'))
|
|
225
|
-
await pptx.writeFile({ fileName: 'report.pptx' })
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Pass the element itself and no global DOM is consulted at all. To pass a string
|
|
229
|
-
id instead, say which document it belongs to:
|
|
230
|
-
|
|
231
|
-
```ts
|
|
232
|
-
tableToSlides(pptx, 'report', { document: win.document })
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
In a browser, `options.document` defaults to the global `document`, so
|
|
236
|
-
`tableToSlides(pptx, 'report')` is enough. The equivalent method form,
|
|
237
|
-
`pptx.tableToSlides('report', options)`, remains on the browser build and
|
|
238
|
-
delegates to the same implementation.
|
|
239
|
-
|
|
240
|
-
**Column widths need a layout engine.** In a browser the columns are sized from
|
|
241
|
-
each cell's rendered `offsetWidth`, reproducing the table's real proportions.
|
|
242
|
-
Nothing outside a browser lays a table out, so `offsetWidth` is `0` there and
|
|
243
|
-
the conversion falls back in two steps: it uses the computed CSS `width`s when the
|
|
244
|
-
stylesheet states them for every column in one unit (all `px` or all `%`), and
|
|
245
|
-
an equal split when it does not.
|
|
246
|
-
|
|
247
|
-
The first step is a *fallback*, not a graceful loss of precision: `offsetWidth` is
|
|
248
|
-
the border box and computed `width` the content box, so padding alone can put the
|
|
249
|
-
two bases in different proportions. The same table can therefore come out with
|
|
250
|
-
different column widths in a browser and outside one.
|
|
251
|
-
|
|
252
|
-
To pin widths regardless of runtime, annotate the `<thead>` header cells, which
|
|
253
|
-
win outright on every path:
|
|
254
|
-
|
|
255
|
-
```html
|
|
256
|
-
<thead>
|
|
257
|
-
<tr>
|
|
258
|
-
<th data-pptx-width="2.5">Name</th>
|
|
259
|
-
<th data-pptx-min-width="1">Qty</th>
|
|
260
|
-
</tr>
|
|
261
|
-
</thead>
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
Everything else behaves the same wherever it runs: cell text (with `<br>` kept
|
|
265
|
-
as a line break), `colspan`/`rowspan`, computed colors, weight, alignment,
|
|
266
|
-
padding and borders, and auto-paging.
|
|
51
|
+
That is the whole shape of it. Make a presentation, add a slide, put things on the
|
|
52
|
+
slide, write the file. Positions are in inches by default, so `x: 1, y: 1` is an inch
|
|
53
|
+
in from the top-left corner of a 10 by 5.625 inch slide.
|
|
54
|
+
[Your first deck](docs/getting-started/first-deck.md) builds a bigger one from data, with a
|
|
55
|
+
table, a chart and speaker notes.
|
|
56
|
+
|
|
57
|
+
## What you can put on a slide
|
|
58
|
+
|
|
59
|
+
Text and rich paragraphs. Tables, including ones that spill onto as many slides as
|
|
60
|
+
they need. Shapes and connectors between them. Pictures, SVGs, video and audio.
|
|
61
|
+
Charts, with a real embedded workbook behind them, so double-clicking a chart in
|
|
62
|
+
PowerPoint opens its data the way it does for a chart a human made. Speaker notes,
|
|
63
|
+
sections, slide masters and layouts, gradients, an image clipped to a shape, a
|
|
64
|
+
spreadsheet embedded as an object, a 3D model, and LaTeX maths.
|
|
65
|
+
|
|
66
|
+
Two features worth knowing about by name:
|
|
67
|
+
|
|
68
|
+
- **[An HTML table becomes slides](docs/html-tables.md).** Point `tableToSlides` at a
|
|
69
|
+
`<table>` you already have and it comes out as a PowerPoint table, paged across
|
|
70
|
+
slides. Works in a browser and under Node.
|
|
71
|
+
- **[Text that has to fit](docs/text-fit.md).** ts-pptx can measure the text
|
|
72
|
+
against the real font and shrink or grow the box before it writes the file, instead
|
|
73
|
+
of leaving you to guess at font sizes.
|
|
74
|
+
|
|
75
|
+
## Reading decks, not only writing them
|
|
76
|
+
|
|
77
|
+
Writing is half of it. ts-pptx also opens a `.pptx` you already have, which is
|
|
78
|
+
unusual: the library it descends from generates decks and does not read them.
|
|
79
|
+
|
|
80
|
+
- **[Look inside one](docs/reference/pptx-inspection.md)** and get slide count, size,
|
|
81
|
+
parts, media and fonts, without loading the whole thing into a model.
|
|
82
|
+
- **[Edit one](docs/reading/read-and-edit.md)**. Open a deck, change the text on slide
|
|
83
|
+
four, save it back. Parts you did not touch come out byte for byte as they went in.
|
|
84
|
+
- **[Turn one into code](docs/reference/pptx-to-script.md)**. Point it at a deck and
|
|
85
|
+
get TypeScript that rebuilds it. Anything it could not express is reported to you
|
|
86
|
+
rather than dropped in silence. It is the fastest way to learn the API: build a
|
|
87
|
+
slide by hand in PowerPoint, then read the script for it.
|
|
88
|
+
|
|
89
|
+
## Where it runs
|
|
90
|
+
|
|
91
|
+
| Runtime | Load it with | `writeFile` |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| Node.js 24 or later | `import`, or `require()` with the class on `.default` | writes to disk |
|
|
94
|
+
| A browser app built with a bundler | `import` | downloads the file |
|
|
95
|
+
| A browser page with no build step | `import TsPptx from "https://esm.sh/pptx-ts/browser"` in a module script | downloads the file |
|
|
96
|
+
| Deno, Bun, edge workers | `import` | throws; use `toBytes()` |
|
|
97
|
+
|
|
98
|
+
[Where it runs](docs/getting-started/runtime.md) lists every entry point and how each runtime
|
|
99
|
+
loads the one ESM build.
|
|
100
|
+
|
|
101
|
+
<!-- comparison:start -->
|
|
102
|
+
<!-- GENERATED REGION. Do not edit by hand.
|
|
103
|
+
Regenerate with `pnpm run comparison:render`.
|
|
104
|
+
Source: `scripts/comparison/snapshot.json`, written by `scripts/comparison/measure.mjs`. -->
|
|
105
|
+
|
|
106
|
+
## How this compares with PptxGenJS
|
|
107
|
+
|
|
108
|
+
ts-pptx is an independent derivative of
|
|
109
|
+
[PptxGenJS](https://github.com/gitbrent/PptxGenJS), detached at its v4.0.1. Both were
|
|
110
|
+
measured on 2026-09-21 by building the same 22 deck intents with each library and reading
|
|
111
|
+
the bytes that came out.
|
|
112
|
+
|
|
113
|
+
- **Construct coverage:** ts-pptx emitted 21 of 22, pptxgenjs 10 of 22. Nothing in the
|
|
114
|
+
corpus is emitted by pptxgenjs and not by ts-pptx.
|
|
115
|
+
- **Schema validity:** of the decks each library built, 21 of 21 ts-pptx decks and 0 of 10
|
|
116
|
+
pptxgenjs decks validate with no error against the Open XML SDK.
|
|
117
|
+
- **Adoption:** pptxgenjs is downloaded 10,539,687 times a month, against 1,780 for
|
|
118
|
+
ts-pptx. If a large installed base matters to you more than the differences above, use
|
|
119
|
+
pptxgenjs.
|
|
120
|
+
- **Activity:** last commit on the default branch, 2026-09-15 for ts-pptx and 2025-06-26
|
|
121
|
+
for pptxgenjs. Last npm publish, 2026-08-29 and 2025-06-26.
|
|
122
|
+
|
|
123
|
+
Where the two libraries part company is on the [comparison page](docs/comparison.md), and
|
|
124
|
+
[how it was measured](docs/comparison-method.md) has every full table. Every intent as
|
|
125
|
+
each library expresses it, including the calls that differ, is on [porting from
|
|
126
|
+
PptxGenJS](docs/comparison-syntax.md).
|
|
127
|
+
|
|
128
|
+
<!-- comparison:end -->
|
|
267
129
|
|
|
268
130
|
## Documentation
|
|
269
131
|
|
|
270
|
-
The
|
|
271
|
-
**<https://shbernal.github.io/ts-pptx
|
|
272
|
-
|
|
273
|
-
- [Documentation index](docs/README.md)
|
|
274
|
-
- [Project target](docs/project-target.md)
|
|
275
|
-
- [Runtime and package support](docs/runtime-and-package-support.md)
|
|
276
|
-
- [Development guide](docs/development.md)
|
|
277
|
-
- [Testing guide](docs/testing.md)
|
|
278
|
-
- [Agent development guide](docs/agent-development.md)
|
|
279
|
-
- [OOXML agent context](docs/ooxml-agent-context.md)
|
|
280
|
-
- [Evidence and fixtures](docs/evidence-and-fixtures.md)
|
|
281
|
-
|
|
282
|
-
## Repository Development
|
|
132
|
+
The documentation site, with the generated API reference, is at
|
|
133
|
+
**<https://shbernal.github.io/ts-pptx/>**. The [demos page](https://shbernal.github.io/ts-pptx/demos)
|
|
134
|
+
builds a quarterly review deck in your browser and previews the slides.
|
|
283
135
|
|
|
284
|
-
|
|
136
|
+
- Start with the [Introduction](docs/getting-started/introduction.md),
|
|
137
|
+
[Your first deck](docs/getting-started/first-deck.md) and
|
|
138
|
+
[Core concepts](docs/getting-started/concepts.md)
|
|
139
|
+
- [Tables](docs/tables.md), [connectors](docs/connectors.md), [groups](docs/groups.md) and
|
|
140
|
+
[HTML tables to slides](docs/html-tables.md)
|
|
141
|
+
- [Smaller bundles](docs/bundle-size.md) for a browser program that composes only what it uses
|
|
142
|
+
- [Errors and warnings](docs/errors-and-warnings.md) and
|
|
143
|
+
[troubleshooting](docs/troubleshooting.md)
|
|
285
144
|
|
|
286
|
-
|
|
287
|
-
pnpm install
|
|
288
|
-
pnpm run verify
|
|
289
|
-
```
|
|
145
|
+
## Something wrong, or missing?
|
|
290
146
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
fetches and caches its oracle binary on first use, so there is nothing to install.
|
|
147
|
+
Open an issue: <https://github.com/shbernal/ts-pptx/issues>. Errors the library knows
|
|
148
|
+
are its own fault print that link themselves.
|
|
294
149
|
|
|
295
|
-
|
|
150
|
+
If an agent writes most of your code, install the `ts-pptx-upstream` skill that ships inside
|
|
151
|
+
the package. It turns a library defect the agent hits into a filed issue with a small
|
|
152
|
+
reproduction, instead of a silent workaround:
|
|
296
153
|
|
|
297
154
|
```bash
|
|
298
|
-
|
|
155
|
+
npx skills add ./node_modules/pptx-ts -s '*' -a claude-code -a codex -a universal -y
|
|
299
156
|
```
|
|
300
157
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
- `demos/showcases` builds the two flagship decks from one command.
|
|
304
|
-
- `demos/node` exercises Node.js ESM generation and stream output.
|
|
305
|
-
- The [demos page](https://shbernal.github.io/ts-pptx/demos) builds the quarterly review in
|
|
306
|
-
your browser and previews the slides: nothing to clone.
|
|
307
|
-
|
|
308
|
-
## Relationship To Upstream
|
|
309
|
-
|
|
310
|
-
ts-pptx builds on the original work of Brent Ely and the gitbrent/PptxGenJS
|
|
311
|
-
contributors. The modernized package target is intentionally narrower than the
|
|
312
|
-
original in order to simplify the runtime contract and keep maintenance focused.
|
|
158
|
+
Name the runtimes you use. [CONTRIBUTING.md](CONTRIBUTING.md) covers what the skill does
|
|
159
|
+
with a report and how to refresh it after a version bump.
|
|
313
160
|
|
|
314
161
|
## License
|
|
315
162
|
|