deckjsx 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -58
- package/dist/{adapter-C2AHiDGa.d.mts → adapter-B-bVXjv-.d.mts} +3 -7
- package/dist/{adapter-BamaV2yi.mjs → adapter-CNSvvD4i.mjs} +12 -37
- package/dist/adapter.d.mts +2 -2
- package/dist/adapter.mjs +1 -1
- package/dist/{index-dx2ZSBgF.d.mts → index-BlOsGMTm.d.mts} +7 -7
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +335 -266
- package/dist/inspect.d.mts +3 -3
- package/dist/jsx-dev-runtime.d.mts +2 -2
- package/dist/jsx-dev-runtime.mjs +1 -2
- package/dist/{jsx-runtime-_eIs-wi1.d.mts → jsx-runtime-Dd6G09P7.d.mts} +1 -1
- package/dist/jsx-runtime-DzJLgS1w.mjs +120 -0
- package/dist/jsx-runtime.d.mts +2 -2
- package/dist/jsx-runtime.mjs +1 -7
- package/dist/{model-BVkO8qGK.d.mts → model-oqG9gKTq.d.mts} +1 -2
- package/dist/{resolve-BD1dHxZd.d.mts → resolve-CfjiMtv5.d.mts} +1 -1
- package/dist/tree-DNsco0U3.mjs +156 -0
- package/package.json +3 -4
- package/dist/jsx-DGGM5erN.mjs +0 -403
- /package/dist/{node-output-ChRpOCV8.mjs → node-output-BXQOTLKj.mjs} +0 -0
package/README.md
CHANGED
|
@@ -13,10 +13,9 @@ JSX
|
|
|
13
13
|
-> Output Writer
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
This project is
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
semantics.
|
|
16
|
+
This project is designed as a presentation compiler. The API uses a class-based compiler with
|
|
17
|
+
callback-based `.slide()`, synchronous `.compile()`, async `.project()`, and async `.render()`.
|
|
18
|
+
Authoring uses typed JSX elements with CSS-like style and class semantics.
|
|
20
19
|
|
|
21
20
|
The implementation preserves the compiler model with explicit module boundaries for authoring,
|
|
22
21
|
semantic graph construction, style resolution, output projection, writer adapters, and runtime
|
|
@@ -28,66 +27,88 @@ output.
|
|
|
28
27
|
npm install deckjsx
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
The package currently targets PPTX output through deckjsx's direct PPTX writer.
|
|
30
|
+
The package currently targets PPTX output through deckjsx's direct PPTX writer. The public authoring
|
|
31
|
+
surface is `deckjsx`; explicit writer selection lives in `deckjsx/adapter`; inspection helpers live
|
|
32
|
+
in `deckjsx/inspect`.
|
|
32
33
|
|
|
33
34
|
## Usage
|
|
34
35
|
|
|
35
36
|
```tsx
|
|
36
|
-
import { Deck } from "deckjsx";
|
|
37
|
+
import { Deck, StyleSheet, Theme } from "deckjsx";
|
|
37
38
|
|
|
38
39
|
const deck = new Deck({
|
|
39
40
|
layout: { width: 13.333, height: 7.5, unit: "in" },
|
|
40
41
|
meta: { title: "Quarterly Review", author: "deckjsx" },
|
|
42
|
+
templates: {
|
|
43
|
+
report: {
|
|
44
|
+
areas: {
|
|
45
|
+
title: { kind: "title", frame: { x: 0.7, y: 0.5, width: 11.9, height: 0.8 } },
|
|
46
|
+
body: { frame: { x: 0.7, y: 1.5, width: 11.9, height: 4.9 } },
|
|
47
|
+
footer: { frame: { x: 0.7, y: 6.9, width: 11.9, height: 0.3 } },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
theme: new Theme({
|
|
52
|
+
defaults: {
|
|
53
|
+
h1: { fontFamily: "Aptos Display", fontSize: 28, fontWeight: 700, color: "#0F172A" },
|
|
54
|
+
p: { fontFamily: "Aptos", fontSize: 18, color: "#334155", fit: "shrink" },
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
41
57
|
});
|
|
42
58
|
|
|
59
|
+
deck.useStyles(
|
|
60
|
+
new StyleSheet({
|
|
61
|
+
classes: {
|
|
62
|
+
review: { backgroundColor: "#F8FAFC" },
|
|
63
|
+
title: { target: "h1.title", style: { width: "100%", height: 0.6 } },
|
|
64
|
+
contentGrid: {
|
|
65
|
+
target: "section.contentGrid",
|
|
66
|
+
style: { display: "grid", gridTemplateColumns: "1fr 1fr", columnGap: 0.35 },
|
|
67
|
+
},
|
|
68
|
+
lead: { target: "p.lead", style: { lineHeight: 1.2 } },
|
|
69
|
+
chartFrame: { backgroundColor: "#E0F2FE", borderRadius: 0.15, padding: 0.25 },
|
|
70
|
+
chart: { width: "100%", height: "100%", fit: "contain" },
|
|
71
|
+
footerText: {
|
|
72
|
+
target: "p.footerText",
|
|
73
|
+
style: { width: "100%", height: 0.3, fontSize: 11, color: "#64748B", textAlign: "right" },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
78
|
+
|
|
43
79
|
deck.slide(
|
|
44
|
-
{ name: "Quarterly Review",
|
|
45
|
-
({ composition }) => (
|
|
46
|
-
<main
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
gridTemplateRows: ["0.9in", "1fr", "0.4in"],
|
|
54
|
-
rowGap: 0.25,
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<header>
|
|
58
|
-
<h1 style={{ width: "100%", height: 0.6, fontSize: 28, fontWeight: 700, color: "#0F172A" }}>
|
|
59
|
-
Quarterly Review
|
|
60
|
-
</h1>
|
|
61
|
-
</header>
|
|
62
|
-
|
|
63
|
-
<section style={{ display: "grid", gridTemplateColumns: "1fr 1fr", columnGap: 0.35 }}>
|
|
64
|
-
<p style={{ fontSize: 18, color: "#334155", fit: "shrink" }}>
|
|
80
|
+
{ name: "Quarterly Review", template: "report", className: "review" },
|
|
81
|
+
({ composition, template }) => (
|
|
82
|
+
<main>
|
|
83
|
+
<h1 area={template.title} className="title">
|
|
84
|
+
Quarterly Review
|
|
85
|
+
</h1>
|
|
86
|
+
|
|
87
|
+
<section area={template.body} className="contentGrid" style={{ columnGap: 0.45 }}>
|
|
88
|
+
<p className="lead" style={{ color: "#1E293B" }}>
|
|
65
89
|
Author slides with typed JSX, inspect the projected document model, and render PPTX files.
|
|
66
90
|
</p>
|
|
67
|
-
<figure
|
|
68
|
-
<img src="chart.png"
|
|
91
|
+
<figure className="chartFrame">
|
|
92
|
+
<img src="chart.png" className="chart" />
|
|
69
93
|
</figure>
|
|
70
94
|
</section>
|
|
71
95
|
|
|
72
|
-
<footer>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
width: "100%",
|
|
76
|
-
height: 0.3,
|
|
77
|
-
fontSize: 11,
|
|
78
|
-
color: "#64748B",
|
|
79
|
-
textAlign: "right",
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{composition.slideIndex + 1} / {composition.totalSlides}
|
|
83
|
-
</p>
|
|
84
|
-
</footer>
|
|
96
|
+
<p area={template.footer} className="footerText">
|
|
97
|
+
{composition.slideIndex + 1} / {composition.totalSlides}
|
|
98
|
+
</p>
|
|
85
99
|
</main>
|
|
86
100
|
),
|
|
87
101
|
);
|
|
88
102
|
|
|
89
|
-
const
|
|
90
|
-
|
|
103
|
+
const projected = await deck.project();
|
|
104
|
+
if (!projected.ok) {
|
|
105
|
+
console.warn(projected.diagnostics.items);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const rendered = await deck.render({ output: "quarterly-review.pptx" });
|
|
109
|
+
if (!rendered.ok) {
|
|
110
|
+
throw new Error("PPTX render failed");
|
|
111
|
+
}
|
|
91
112
|
```
|
|
92
113
|
|
|
93
114
|
Use `deck.compile()` for authoring semantics, `await deck.project()` for output-facing inspection,
|
|
@@ -98,8 +119,8 @@ skipped with `await deck.project({ inspection: "none" })` or
|
|
|
98
119
|
`await deck.render({ inspection: "none" })`.
|
|
99
120
|
|
|
100
121
|
The default render path uses deckjsx's built-in direct PPTX writer. If an explicit writer adapter is
|
|
101
|
-
needed, import `pptx()` from `deckjsx/adapter
|
|
102
|
-
and sinks are intentionally not part of the public API.
|
|
122
|
+
needed, import `pptx()` from `deckjsx/adapter`. Writer internals such as XML emitters, ZIP assembly,
|
|
123
|
+
and output sinks are intentionally not part of the public API.
|
|
103
124
|
|
|
104
125
|
```tsx
|
|
105
126
|
import { pptx } from "deckjsx/adapter";
|
|
@@ -136,15 +157,89 @@ Text-like lowercase elements compile to text boxes:
|
|
|
136
157
|
Image lowercase elements compile to images and require either `src` or `data`:
|
|
137
158
|
|
|
138
159
|
```tsx
|
|
139
|
-
<img src="diagram.png"
|
|
160
|
+
<img src="diagram.png" className="diagram" />
|
|
140
161
|
```
|
|
141
162
|
|
|
142
163
|
The lowercase `shape` element compiles to PPTX shapes:
|
|
143
164
|
|
|
144
165
|
```tsx
|
|
145
|
-
<shape shape="rect"
|
|
166
|
+
<shape shape="rect" className="accentBlock" />
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Layout, Style, And Templates
|
|
170
|
+
|
|
171
|
+
`deckjsx` keeps layout, style, and templates as separate authoring ideas even when they are written
|
|
172
|
+
through JSX and CSS-like objects.
|
|
173
|
+
|
|
174
|
+
- Layout describes where things are and how children flow: deck slide size, `x`, `y`, `width`,
|
|
175
|
+
`height`, `left`, `top`, `right`, `bottom`, `display`, flex, grid, gaps, padding, and stacking
|
|
176
|
+
order. Project resolves these values into concrete frames and paint order.
|
|
177
|
+
- Style describes how resolved boxes are drawn: fills, borders, shadows, opacity, rotation, text
|
|
178
|
+
color, font, alignment, bullets, links, image fitting, and background layers.
|
|
179
|
+
- Templates describe reusable slide structure: named areas such as `title`, `body`, `media`, or
|
|
180
|
+
`footer` that authored JSX can target without exposing PowerPoint placeholder ids.
|
|
181
|
+
|
|
182
|
+
Reusable layout and appearance should usually live in `StyleSheet` classes and `Theme` defaults.
|
|
183
|
+
Use the JSX `style` prop for slide-local variations, data-dependent overrides, or one-off values
|
|
184
|
+
that should stay close to the authored element. Direct style props exist in the current v0.8 surface,
|
|
185
|
+
but they are not the preferred HTML/CSS-like authoring form and are planned to be removed in v0.8.1.
|
|
186
|
+
|
|
187
|
+
Templates should be used when the same semantic slide regions repeat across slides; layout should be
|
|
188
|
+
used for per-slide geometry and flow; visual style should be used for appearance after the geometry
|
|
189
|
+
is known.
|
|
190
|
+
|
|
191
|
+
## Style Cascade
|
|
192
|
+
|
|
193
|
+
In deckjsx, cascade means the per-element process that turns defaults, theme defaults, stylesheet
|
|
194
|
+
classes, and inline authoring styles into one resolved style snapshot for Project. It is CSS-like,
|
|
195
|
+
but it is not a full browser CSS engine and does not mean every property automatically inherits from
|
|
196
|
+
parent elements.
|
|
197
|
+
|
|
198
|
+
For each style-capable element, values are resolved in this order:
|
|
199
|
+
|
|
200
|
+
1. Element defaults, such as default text box behavior.
|
|
201
|
+
2. `Theme` defaults for the authored tag, such as `p`, `h1`, `div`, `span`, or `img`.
|
|
202
|
+
3. Matching `StyleSheet` class rules registered with `deck.useStyles()`.
|
|
203
|
+
4. Authored inline style from the JSX `style` object.
|
|
204
|
+
|
|
205
|
+
Later layers replace earlier layers property by property. The v0.8 authoring surface still accepts
|
|
206
|
+
some direct style props, but new examples should prefer `style={{ ... }}` for inline values because
|
|
207
|
+
direct style props are planned for removal in v0.8.1.
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { Deck, StyleSheet, Theme } from "deckjsx";
|
|
211
|
+
|
|
212
|
+
const deck = new Deck({
|
|
213
|
+
layout: { width: 13.333, height: 7.5, unit: "in" },
|
|
214
|
+
theme: new Theme({
|
|
215
|
+
defaults: {
|
|
216
|
+
p: { color: "#334155", fontSize: 18 },
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
deck.useStyles(
|
|
222
|
+
new StyleSheet({
|
|
223
|
+
classes: {
|
|
224
|
+
muted: { color: "#64748B" },
|
|
225
|
+
title: { target: "p.title", style: { color: "#0F172A", fontSize: 28, fontWeight: 700 } },
|
|
226
|
+
},
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
deck.slide(() => <p className="muted title">Revenue</p>);
|
|
146
231
|
```
|
|
147
232
|
|
|
233
|
+
In this example, `fontSize`, `fontWeight`, and `color` come from the matching `title` class, and the
|
|
234
|
+
theme default supplies any remaining `p` defaults. `className`
|
|
235
|
+
token order is preserved for inspection, but it is not the priority rule for conflicting class
|
|
236
|
+
styles. Class conflicts are resolved by selector specificity first, then stylesheet registration and
|
|
237
|
+
rule order. Supported selectors are intentionally small: class selectors, tag/class compounds, and
|
|
238
|
+
descendant selectors such as `.title`, `p.title`, or `.card .caption`.
|
|
239
|
+
|
|
240
|
+
Style cascade is source-local. A mounted child deck resolves its own theme and stylesheets against
|
|
241
|
+
its own slides, which keeps sandboxed and HMR-style composition predictable.
|
|
242
|
+
|
|
148
243
|
## Slide Templates
|
|
149
244
|
|
|
150
245
|
Deck templates describe reusable slide structure without asking authors to write PowerPoint
|
|
@@ -217,7 +312,7 @@ nodes. Inline rich text uses `span` inside text-like elements:
|
|
|
217
312
|
|
|
218
313
|
```tsx
|
|
219
314
|
<p>
|
|
220
|
-
Revenue grew <span
|
|
315
|
+
Revenue grew <span className="positiveDelta">12%</span>.
|
|
221
316
|
</p>
|
|
222
317
|
```
|
|
223
318
|
|
|
@@ -229,9 +324,9 @@ the slide, so authors can build panels with local coordinates. Percentage length
|
|
|
229
324
|
the parent frame as their reference.
|
|
230
325
|
|
|
231
326
|
```tsx
|
|
232
|
-
<div
|
|
233
|
-
<p
|
|
234
|
-
<p
|
|
327
|
+
<div className="panel">
|
|
328
|
+
<p className="localPercentFrame">local percent frame</p>
|
|
329
|
+
<p className="insetFrame">inset frame</p>
|
|
235
330
|
</div>
|
|
236
331
|
```
|
|
237
332
|
|
|
@@ -260,15 +355,11 @@ from custom projections fail before Render emits bytes.
|
|
|
260
355
|
```bash
|
|
261
356
|
vp install
|
|
262
357
|
vp check
|
|
263
|
-
|
|
264
|
-
npm ci --prefix sample
|
|
265
|
-
npm run --prefix sample smoke
|
|
358
|
+
vp build
|
|
266
359
|
vp test
|
|
267
360
|
bun run benchmark:pptx -- --iterations 1 --strict
|
|
268
361
|
bun run verify:render -- --skip-raster
|
|
269
|
-
npm run --prefix .github/compat/pptxgenjs compare
|
|
270
362
|
```
|
|
271
363
|
|
|
272
364
|
For output or public-surface changes, keep the direct PPTX writer as the documented built-in path.
|
|
273
|
-
|
|
274
|
-
adapter examples.
|
|
365
|
+
Use render verification and XML/package inspection to catch regressions in emitted PPTX structure.
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { $ as Diagnostics } from "./index-
|
|
2
|
-
import { bn as RenderedArtifact, hn as RenderInspectionSummary, in as OutputFormat, rn as InspectionDetailLevel, sn as ProjectionFormat, w as PptxPackageModel } from "./model-
|
|
1
|
+
import { $ as Diagnostics } from "./index-BlOsGMTm.mjs";
|
|
2
|
+
import { bn as RenderedArtifact, hn as RenderInspectionSummary, in as OutputFormat, rn as InspectionDetailLevel, sn as ProjectionFormat, w as PptxPackageModel } from "./model-oqG9gKTq.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/pptx-options.d.ts
|
|
5
|
-
type PptxCompressionMode = "balanced" | "fast" | "small" | "store";
|
|
6
|
-
//#endregion
|
|
7
4
|
//#region src/adapter.d.ts
|
|
8
5
|
type PptxRenderOptions = {
|
|
9
6
|
readonly output?: string;
|
|
10
|
-
readonly compression?: PptxCompressionMode;
|
|
11
7
|
readonly inspection?: InspectionDetailLevel;
|
|
12
8
|
};
|
|
13
9
|
type RenderOptions = PptxRenderOptions;
|
|
@@ -35,4 +31,4 @@ type WriterAdapter<TProjection = PptxPackageModel, TFormat extends OutputFormat
|
|
|
35
31
|
};
|
|
36
32
|
declare function pptx(options?: PptxRenderOptions): WriterAdapter<PptxPackageModel, "pptx">;
|
|
37
33
|
//#endregion
|
|
38
|
-
export { WriterRenderContext as a, WriterAdapterResult as i, RenderOptions as n, pptx as o, WriterAdapter as r,
|
|
34
|
+
export { WriterRenderContext as a, WriterAdapterResult as i, RenderOptions as n, pptx as o, WriterAdapter as r, PptxRenderOptions as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { a as isPptxRelationshipsPart, n as isPptxMediaPart, o as isPptxSlidePart, s as isPptxSupportPart, t as isPptxContentTypesPart } from "./model-DIuh51qh.mjs";
|
|
2
|
-
import { deflateSync, strToU8 } from "fflate";
|
|
3
2
|
//#region src/diagnostics/format.ts
|
|
4
3
|
function formatSpan(path) {
|
|
5
4
|
return ` at ${path}`;
|
|
@@ -6400,8 +6399,7 @@ function expectedAssemblyEntryForPart(part) {
|
|
|
6400
6399
|
required: requirement.required,
|
|
6401
6400
|
...requirement.requirementCondition ? { requirementCondition: requirement.requirementCondition } : {},
|
|
6402
6401
|
...requirement.requirementDependencies ? { requirementDependencies: requirement.requirementDependencies } : {},
|
|
6403
|
-
...requirement.reason ? { requirementReason: requirement.reason } : {}
|
|
6404
|
-
compression: part.kind === "media" ? "store" : "default"
|
|
6402
|
+
...requirement.reason ? { requirementReason: requirement.reason } : {}
|
|
6405
6403
|
};
|
|
6406
6404
|
}
|
|
6407
6405
|
function assemblyPlanEntry(input) {
|
|
@@ -6427,7 +6425,6 @@ function assemblyPlanEntry(input) {
|
|
|
6427
6425
|
...input.expected.requirementCondition ? { requirementCondition: input.expected.requirementCondition } : {},
|
|
6428
6426
|
...input.expected.requirementDependencies ? { requirementDependencies: input.expected.requirementDependencies } : {},
|
|
6429
6427
|
...input.expected.requirementReason ? { requirementReason: input.expected.requirementReason } : {},
|
|
6430
|
-
compression: input.expected.compression,
|
|
6431
6428
|
status: input.final.status,
|
|
6432
6429
|
...input.final.byteLength !== void 0 ? { byteLength: input.final.byteLength } : {},
|
|
6433
6430
|
...input.final.reason ? { reason: input.final.reason } : {},
|
|
@@ -6441,8 +6438,7 @@ function assemblyPlanEntry(input) {
|
|
|
6441
6438
|
required: input.expected.required,
|
|
6442
6439
|
...input.expected.requirementCondition ? { requirementCondition: input.expected.requirementCondition } : {},
|
|
6443
6440
|
...input.expected.requirementDependencies ? { requirementDependencies: input.expected.requirementDependencies } : {},
|
|
6444
|
-
...input.expected.requirementReason ? { requirementReason: input.expected.requirementReason } : {}
|
|
6445
|
-
compression: input.expected.compression
|
|
6441
|
+
...input.expected.requirementReason ? { requirementReason: input.expected.requirementReason } : {}
|
|
6446
6442
|
},
|
|
6447
6443
|
final,
|
|
6448
6444
|
...build ? { build } : {},
|
|
@@ -6463,7 +6459,6 @@ function assemblySummary(plan) {
|
|
|
6463
6459
|
...entry.requirementCondition ? { requirementCondition: entry.requirementCondition } : {},
|
|
6464
6460
|
...entry.requirementDependencies ? { requirementDependencies: entry.requirementDependencies } : {},
|
|
6465
6461
|
...entry.requirementReason ? { requirementReason: entry.requirementReason } : {},
|
|
6466
|
-
compression: entry.compression,
|
|
6467
6462
|
...entry.byteLength !== void 0 ? { byteLength: entry.byteLength } : {},
|
|
6468
6463
|
...entry.reason ? { reason: entry.reason } : {},
|
|
6469
6464
|
...entry.reasonDetails ? { reasonDetails: entry.reasonDetails } : {},
|
|
@@ -6514,8 +6509,7 @@ function zipEntriesFromAssemblyPlan(plan) {
|
|
|
6514
6509
|
if (entry.status === "missing" || entry.status === "failed" || !entry.bytes) continue;
|
|
6515
6510
|
entries.push({
|
|
6516
6511
|
path: entry.path,
|
|
6517
|
-
bytes: entry.bytes
|
|
6518
|
-
compression: entry.compression
|
|
6512
|
+
bytes: entry.bytes
|
|
6519
6513
|
});
|
|
6520
6514
|
}
|
|
6521
6515
|
return entries;
|
|
@@ -8280,18 +8274,10 @@ const FIXED_DOS_TIME = 0;
|
|
|
8280
8274
|
const FIXED_DOS_DATE = 33;
|
|
8281
8275
|
const ZIP_VERSION = 20;
|
|
8282
8276
|
const UTF8_FLAG = 2048;
|
|
8283
|
-
const DEFLATE_METHOD = 8;
|
|
8284
8277
|
const STORE_METHOD = 0;
|
|
8285
8278
|
const UINT32_MAX = 4294967295;
|
|
8286
8279
|
const CRC32_TABLE = createCrc32Table();
|
|
8287
|
-
|
|
8288
|
-
switch (compression) {
|
|
8289
|
-
case "store": return 0;
|
|
8290
|
-
case "balanced": return 6;
|
|
8291
|
-
case "small": return 9;
|
|
8292
|
-
default: return 1;
|
|
8293
|
-
}
|
|
8294
|
-
}
|
|
8280
|
+
const PATH_ENCODER = new TextEncoder();
|
|
8295
8281
|
function createCrc32Table() {
|
|
8296
8282
|
const table = new Uint32Array(256);
|
|
8297
8283
|
for (let index = 0; index < table.length; index += 1) {
|
|
@@ -8320,23 +8306,13 @@ function assertZip32Size(name, value) {
|
|
|
8320
8306
|
if (!Number.isSafeInteger(value) || value < 0 || value > UINT32_MAX) throw new Error(`PPTX ZIP ${name} exceeds ZIP32 limits.`);
|
|
8321
8307
|
}
|
|
8322
8308
|
function encodedPath(path) {
|
|
8323
|
-
const bytes =
|
|
8309
|
+
const bytes = PATH_ENCODER.encode(path);
|
|
8324
8310
|
if (bytes.byteLength > 65535) throw new Error(`PPTX ZIP entry path is too long: ${path}`);
|
|
8325
8311
|
return {
|
|
8326
8312
|
bytes,
|
|
8327
8313
|
flags: bytes.byteLength === path.length ? 0 : UTF8_FLAG
|
|
8328
8314
|
};
|
|
8329
8315
|
}
|
|
8330
|
-
function compressedBytesForEntry(entry, options) {
|
|
8331
|
-
if (entry.compression === "store" || options.compression === "store") return {
|
|
8332
|
-
bytes: entry.bytes,
|
|
8333
|
-
method: STORE_METHOD
|
|
8334
|
-
};
|
|
8335
|
-
return {
|
|
8336
|
-
bytes: deflateSync(entry.bytes, { level: zipLevel(options.compression) }),
|
|
8337
|
-
method: DEFLATE_METHOD
|
|
8338
|
-
};
|
|
8339
|
-
}
|
|
8340
8316
|
function localHeader(entry) {
|
|
8341
8317
|
const header = new Uint8Array(30 + entry.pathBytes.byteLength);
|
|
8342
8318
|
writeUint32(header, 0, 67324752);
|
|
@@ -8390,7 +8366,7 @@ function endOfCentralDirectory(entryCount, centralSize, centralOffset) {
|
|
|
8390
8366
|
writeUint16(header, 20, 0);
|
|
8391
8367
|
return header;
|
|
8392
8368
|
}
|
|
8393
|
-
function writePptxZipEntriesToSink(entries, sink
|
|
8369
|
+
function writePptxZipEntriesToSink(entries, sink) {
|
|
8394
8370
|
const centralEntries = [];
|
|
8395
8371
|
let offset = 0;
|
|
8396
8372
|
const write = (chunk) => {
|
|
@@ -8401,21 +8377,20 @@ function writePptxZipEntriesToSink(entries, sink, options = {}) {
|
|
|
8401
8377
|
try {
|
|
8402
8378
|
for (const entry of entries) {
|
|
8403
8379
|
const path = encodedPath(entry.path);
|
|
8404
|
-
|
|
8405
|
-
assertZip32Size("compressed entry size", compressed.bytes.byteLength);
|
|
8380
|
+
assertZip32Size("compressed entry size", entry.bytes.byteLength);
|
|
8406
8381
|
assertZip32Size("uncompressed entry size", entry.bytes.byteLength);
|
|
8407
8382
|
const centralEntry = {
|
|
8408
8383
|
pathBytes: path.bytes,
|
|
8409
8384
|
flags: path.flags,
|
|
8410
|
-
method:
|
|
8385
|
+
method: STORE_METHOD,
|
|
8411
8386
|
crc: crc32(entry.bytes),
|
|
8412
|
-
compressedSize:
|
|
8387
|
+
compressedSize: entry.bytes.byteLength,
|
|
8413
8388
|
uncompressedSize: entry.bytes.byteLength,
|
|
8414
8389
|
localHeaderOffset: offset
|
|
8415
8390
|
};
|
|
8416
8391
|
centralEntries.push(centralEntry);
|
|
8417
8392
|
write(localHeader(centralEntry));
|
|
8418
|
-
write(
|
|
8393
|
+
write(entry.bytes);
|
|
8419
8394
|
}
|
|
8420
8395
|
const centralOffset = offset;
|
|
8421
8396
|
for (const entry of centralEntries) write(centralDirectoryHeader(entry));
|
|
@@ -8582,7 +8557,7 @@ async function renderPptxPackage(projection, options = {}, context) {
|
|
|
8582
8557
|
const sink = sideEffectSink ?? createCollectingPptxZipSink();
|
|
8583
8558
|
let outputSideEffectError;
|
|
8584
8559
|
try {
|
|
8585
|
-
writePptxZipEntriesToSink(zipEntriesFromAssemblyPlan(plan), sink
|
|
8560
|
+
writePptxZipEntriesToSink(zipEntriesFromAssemblyPlan(plan), sink);
|
|
8586
8561
|
outputSideEffectError = sideEffectSink?.sideEffectError();
|
|
8587
8562
|
} catch (error) {
|
|
8588
8563
|
return {
|
|
@@ -8595,7 +8570,7 @@ async function renderPptxPackage(projection, options = {}, context) {
|
|
|
8595
8570
|
path: "render.assembly.zip",
|
|
8596
8571
|
message: error instanceof Error ? error.message : String(error)
|
|
8597
8572
|
}],
|
|
8598
|
-
notes: [
|
|
8573
|
+
notes: ["reason=zipSourceFailed"],
|
|
8599
8574
|
help: ["Inspect render.summary.assembly.entries to confirm every required package entry was available before ZIP emission."]
|
|
8600
8575
|
})]),
|
|
8601
8576
|
summary: assemblySummary(plan)
|
package/dist/adapter.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as WriterRenderContext, i as WriterAdapterResult, n as RenderOptions, o as pptx, r as WriterAdapter,
|
|
2
|
-
export {
|
|
1
|
+
import { a as WriterRenderContext, i as WriterAdapterResult, n as RenderOptions, o as pptx, r as WriterAdapter, t as PptxRenderOptions } from "./adapter-B-bVXjv-.mjs";
|
|
2
|
+
export { PptxRenderOptions, RenderOptions, WriterAdapter, WriterAdapterResult, WriterRenderContext, pptx };
|
package/dist/adapter.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as pptx } from "./adapter-
|
|
1
|
+
import { t as pptx } from "./adapter-CNSvvD4i.mjs";
|
|
2
2
|
export { pptx };
|
|
@@ -332,16 +332,16 @@ type TemplateAreaAuthorProps = {
|
|
|
332
332
|
};
|
|
333
333
|
type ViewNodeProps = {
|
|
334
334
|
style?: ViewStyle;
|
|
335
|
-
} & ClassNameAuthorProps & TemplateAreaAuthorProps
|
|
335
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps;
|
|
336
336
|
type TextNodeProps = {
|
|
337
337
|
style?: TextStyle;
|
|
338
|
-
} & ClassNameAuthorProps & TemplateAreaAuthorProps
|
|
338
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps;
|
|
339
339
|
type TextRunNodeProps = {
|
|
340
340
|
style?: TextRunStyle;
|
|
341
|
-
} & ClassNameAuthorProps
|
|
341
|
+
} & ClassNameAuthorProps;
|
|
342
342
|
type ImageNodeProps = {
|
|
343
343
|
style?: ImageStyle;
|
|
344
|
-
} & ClassNameAuthorProps & TemplateAreaAuthorProps &
|
|
344
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps & ({
|
|
345
345
|
src: string;
|
|
346
346
|
data?: string;
|
|
347
347
|
} | {
|
|
@@ -350,8 +350,8 @@ type ImageNodeProps = {
|
|
|
350
350
|
});
|
|
351
351
|
type ShapeNodeProps = {
|
|
352
352
|
style?: ShapeStyle;
|
|
353
|
-
shape
|
|
354
|
-
} & ClassNameAuthorProps & TemplateAreaAuthorProps
|
|
353
|
+
shape?: "rect" | "ellipse" | "line";
|
|
354
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps;
|
|
355
355
|
//#endregion
|
|
356
356
|
//#region src/authoring/tree.d.ts
|
|
357
357
|
type JsxKey = string | number | bigint;
|
|
@@ -707,7 +707,7 @@ type CompositionSource<TSourceContext extends SourceContextValue | void = void,
|
|
|
707
707
|
//#endregion
|
|
708
708
|
//#region src/authoring/index.d.ts
|
|
709
709
|
type DeckJsxElement = {
|
|
710
|
-
readonly $$typeof: "deckjsx.author-tree"
|
|
710
|
+
readonly $$typeof: "deckjsx.author-tree";
|
|
711
711
|
};
|
|
712
712
|
interface TextJsxChildArray extends ReadonlyArray<TextJsxChild> {}
|
|
713
713
|
type TextJsxChild = DeckJsxElement | string | number | boolean | null | undefined | TextJsxChildArray;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as Diagnostics, $t as StackAlignment, At as CssGridAutoFlow, Bt as CssObjectPosition, C as SourceContextValue, Ct as CssAlignSelf, D as StyleSheet, Dt as CssFlexBasis, E as ThemeDefaults, Et as CssDisplay, Ft as CssGridTemplateAreas, Gt as DeckPointLength, Ht as CssPosition, It as CssGridTemplateShorthand, Jt as ImageStyle, Kt as ImageCropAuthoring, Lt as CssGridTrack, Mt as CssGridPlacement, N as SemanticAuthorGraph, Nt as CssGridShorthand, Ot as CssFlexDirection, Pt as CssGridTemplate, Q as DiagnosticSeverity, Qt as Spacing, Rt as CssJustifyContent, S as SourceContextMapper, St as CssAlignItems, T as ThemeInput, Tt as CssBoxSizing, Ut as CssVisibility, Vt as CssOverflow, Wt as DeckLength, X as Diagnostic, Xt as ShapeStyle, Yt as LayoutMode, Z as DiagnosticLabel, Zt as SlideStyle, _ as SlideFactory, _t as TemplateFrame, a as IntrinsicDivProps, at as StyleDiagnosticError, b as SlideOptions, bt as BorderStyle, c as IntrinsicShapeProps, cn as TextStyle, ct as ClassNameObject, dn as TextTabStopLength, dt as EmptySlideTemplateSet, en as StackAxis, et as formatDiagnostic, f as TextJsxChild, fn as VerticalAlign, ft as SlideTemplate, g as CompositionSourceInternals, gt as TemplateAreaRef, h as CompositionSource, ht as TemplateAreaKind, i as DeckOptions, it as SemanticGraphDiagnosticError, jt as CssGridLine, kt as CssFlexWrap, l as IntrinsicTextTag, ln as TextTabStopAlignment, lt as ClassNameValue, m as CompositionContext, mt as TemplateArea, n as DeckJsxElement, nn as StrokeLineCap, nt as CompositionDiagnosticError, o as IntrinsicImgProps, on as TextFit, ot as JsxKey, p as COMPOSITION_SOURCE, pn as ViewStyle, pt as SlideTemplateSet, qt as ImageCropValue, r as DeckJsxIntrinsicElements, rn as StrokeLineJoin, rt as DeckDiagnosticError, s as IntrinsicPProps, sn as TextRunStyle, st as SourceSpan, t as ContentJsxChild, tn as StrokeDashType, tt as formatDiagnostics, u as IntrinsicViewTag, un as TextTabStopAuthoring, ut as ClassNameValueArray, v as SlideFactoryInput, vt as TemplateHandle, w as Theme, wt as CssAspectRatio, x as SourceContextInput, xt as CssAlignContent, y as SlideFactoryInputWithTemplate, yt as TemplateName, zt as CssJustifySelf } from "./index-
|
|
2
|
-
import { An as AssetSource, Cn as StageSummary, Dn as AssetLoaderContext, En as AssetLoader, Gt as ProjectInspectionSummary, On as AssetMediaType, Sn as StageName, T as PptxPackageModelCandidate, Tn as AssetLoadResult, _n as RenderOutputSideEffectStatus, an as ProjectOptions, bn as RenderedArtifact, cn as RenderAssemblyBuildSummary, dn as RenderAssemblyFingerprintDelta, fn as RenderAssemblyPlanEntrySummary, gn as RenderOutputSideEffectReason, hn as RenderInspectionSummary, in as OutputFormat, kn as AssetProbeResult, ln as RenderAssemblyExpectedEntrySummary, mn as RenderAssemblyReasonDetails, nn as CompileStages, on as ProjectStages, pn as RenderAssemblyPlanSummary, rn as InspectionDetailLevel, sn as ProjectionFormat, un as RenderAssemblyFinalEntrySummary, vn as RenderOutputSideEffectSummary, w as PptxPackageModel, wn as WrittenOutput, xn as StageArtifactStatus, yn as RenderStages } from "./model-
|
|
3
|
-
import { n as RenderOptions, r as WriterAdapter } from "./adapter-
|
|
4
|
-
import { r as ResolvedStyleMap } from "./resolve-
|
|
1
|
+
import { $ as Diagnostics, $t as StackAlignment, At as CssGridAutoFlow, Bt as CssObjectPosition, C as SourceContextValue, Ct as CssAlignSelf, D as StyleSheet, Dt as CssFlexBasis, E as ThemeDefaults, Et as CssDisplay, Ft as CssGridTemplateAreas, Gt as DeckPointLength, Ht as CssPosition, It as CssGridTemplateShorthand, Jt as ImageStyle, Kt as ImageCropAuthoring, Lt as CssGridTrack, Mt as CssGridPlacement, N as SemanticAuthorGraph, Nt as CssGridShorthand, Ot as CssFlexDirection, Pt as CssGridTemplate, Q as DiagnosticSeverity, Qt as Spacing, Rt as CssJustifyContent, S as SourceContextMapper, St as CssAlignItems, T as ThemeInput, Tt as CssBoxSizing, Ut as CssVisibility, Vt as CssOverflow, Wt as DeckLength, X as Diagnostic, Xt as ShapeStyle, Yt as LayoutMode, Z as DiagnosticLabel, Zt as SlideStyle, _ as SlideFactory, _t as TemplateFrame, a as IntrinsicDivProps, at as StyleDiagnosticError, b as SlideOptions, bt as BorderStyle, c as IntrinsicShapeProps, cn as TextStyle, ct as ClassNameObject, dn as TextTabStopLength, dt as EmptySlideTemplateSet, en as StackAxis, et as formatDiagnostic, f as TextJsxChild, fn as VerticalAlign, ft as SlideTemplate, g as CompositionSourceInternals, gt as TemplateAreaRef, h as CompositionSource, ht as TemplateAreaKind, i as DeckOptions, it as SemanticGraphDiagnosticError, jt as CssGridLine, kt as CssFlexWrap, l as IntrinsicTextTag, ln as TextTabStopAlignment, lt as ClassNameValue, m as CompositionContext, mt as TemplateArea, n as DeckJsxElement, nn as StrokeLineCap, nt as CompositionDiagnosticError, o as IntrinsicImgProps, on as TextFit, ot as JsxKey, p as COMPOSITION_SOURCE, pn as ViewStyle, pt as SlideTemplateSet, qt as ImageCropValue, r as DeckJsxIntrinsicElements, rn as StrokeLineJoin, rt as DeckDiagnosticError, s as IntrinsicPProps, sn as TextRunStyle, st as SourceSpan, t as ContentJsxChild, tn as StrokeDashType, tt as formatDiagnostics, u as IntrinsicViewTag, un as TextTabStopAuthoring, ut as ClassNameValueArray, v as SlideFactoryInput, vt as TemplateHandle, w as Theme, wt as CssAspectRatio, x as SourceContextInput, xt as CssAlignContent, y as SlideFactoryInputWithTemplate, yt as TemplateName, zt as CssJustifySelf } from "./index-BlOsGMTm.mjs";
|
|
2
|
+
import { An as AssetSource, Cn as StageSummary, Dn as AssetLoaderContext, En as AssetLoader, Gt as ProjectInspectionSummary, On as AssetMediaType, Sn as StageName, T as PptxPackageModelCandidate, Tn as AssetLoadResult, _n as RenderOutputSideEffectStatus, an as ProjectOptions, bn as RenderedArtifact, cn as RenderAssemblyBuildSummary, dn as RenderAssemblyFingerprintDelta, fn as RenderAssemblyPlanEntrySummary, gn as RenderOutputSideEffectReason, hn as RenderInspectionSummary, in as OutputFormat, kn as AssetProbeResult, ln as RenderAssemblyExpectedEntrySummary, mn as RenderAssemblyReasonDetails, nn as CompileStages, on as ProjectStages, pn as RenderAssemblyPlanSummary, rn as InspectionDetailLevel, sn as ProjectionFormat, un as RenderAssemblyFinalEntrySummary, vn as RenderOutputSideEffectSummary, w as PptxPackageModel, wn as WrittenOutput, xn as StageArtifactStatus, yn as RenderStages } from "./model-oqG9gKTq.mjs";
|
|
3
|
+
import { n as RenderOptions, r as WriterAdapter } from "./adapter-B-bVXjv-.mjs";
|
|
4
|
+
import { r as ResolvedStyleMap } from "./resolve-CfjiMtv5.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/pipeline-runner.d.ts
|
|
7
7
|
type PresentStageArtifactStatus = Exclude<StageArtifactStatus, "missing">;
|