deckjsx 0.5.0 → 0.7.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 +72 -54
- package/dist/adapter-NxGlM8_c.d.mts +22 -0
- package/dist/{pptxgenjs-BTMKb1WX.mjs → adapter-rS3mWdi0.mjs} +229 -128
- package/dist/adapter.d.mts +2 -0
- package/dist/adapter.mjs +2 -0
- package/dist/{index-sb451NVh.d.mts → index-C-LDA3Lj.d.mts} +260 -139
- package/dist/index.d.mts +183 -4
- package/dist/index.mjs +7517 -5319
- package/dist/inspect.d.mts +3 -3
- package/dist/{jsx-CK-x7PLd.mjs → jsx-DetoUfLm.mjs} +102 -113
- package/dist/jsx-dev-runtime.d.mts +2 -2
- package/dist/jsx-dev-runtime.mjs +1 -1
- package/dist/{jsx-runtime-Bk7Wx3AL.d.mts → jsx-runtime-Dz8WBHpq.d.mts} +2 -3
- package/dist/jsx-runtime.d.mts +2 -2
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/pptx-DaSXvESd.d.mts +448 -0
- package/package.json +2 -2
- package/dist/deck-CvTHG5ik.d.mts +0 -78
- package/dist/index-_eBM2cs3.d.mts +0 -245
- package/dist/legacy.d.mts +0 -6
- package/dist/legacy.mjs +0 -2
package/README.md
CHANGED
|
@@ -7,18 +7,19 @@ The intended architecture is:
|
|
|
7
7
|
|
|
8
8
|
```text
|
|
9
9
|
JSX
|
|
10
|
-
->
|
|
11
|
-
->
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
-> Author Tree
|
|
11
|
+
-> Semantic Author Graph
|
|
12
|
+
-> Output Projection
|
|
13
|
+
-> Output Writer
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
This project is being designed as a compiler, not as a thin `PptxGenJS` wrapper.
|
|
17
|
-
The API uses a class-based compiler with callback-based `.
|
|
18
|
-
Authoring uses typed JSX elements with
|
|
17
|
+
The API uses a class-based compiler with callback-based `.slide()`, `.compile()`, `.project()`, and
|
|
18
|
+
`.render()`. Authoring uses typed JSX elements with CSS-like style and class semantics.
|
|
19
19
|
|
|
20
20
|
The implementation preserves the compiler model with explicit module boundaries for authoring,
|
|
21
|
-
|
|
21
|
+
semantic graph construction, style resolution, output projection, writer adapters, and runtime
|
|
22
|
+
output.
|
|
22
23
|
|
|
23
24
|
## Install
|
|
24
25
|
|
|
@@ -26,64 +27,75 @@ style normalization, layout, IR, backend emission, and Node runtime output.
|
|
|
26
27
|
npm install deckjsx
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
The package currently targets
|
|
30
|
+
The package currently targets PPTX output and ships a temporary `pptxgenjs` writer adapter.
|
|
30
31
|
|
|
31
32
|
## Usage
|
|
32
33
|
|
|
33
34
|
```tsx
|
|
34
|
-
import { Deck
|
|
35
|
+
import { Deck } from "deckjsx";
|
|
35
36
|
|
|
36
37
|
const deck = new Deck({
|
|
37
38
|
layout: { width: 13.333, height: 7.5, unit: "in" },
|
|
38
39
|
meta: { title: "Quarterly Review", author: "deckjsx" },
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
deck.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
42
|
+
deck.slide(
|
|
43
|
+
{ name: "Quarterly Review", style: { backgroundColor: "#F8FAFC" } },
|
|
44
|
+
({ composition }) => (
|
|
45
|
+
<>
|
|
46
|
+
<main
|
|
47
|
+
style={{
|
|
48
|
+
x: 0.7,
|
|
49
|
+
y: 0.5,
|
|
50
|
+
width: 11.9,
|
|
51
|
+
height: 6.3,
|
|
52
|
+
display: "grid",
|
|
53
|
+
gridTemplateRows: ["0.9in", "1fr", "0.4in"],
|
|
54
|
+
rowGap: 0.25,
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<header>
|
|
58
|
+
<h1
|
|
59
|
+
style={{ width: "100%", height: 0.6, fontSize: 28, fontWeight: 700, color: "#0F172A" }}
|
|
60
|
+
>
|
|
61
|
+
Quarterly Review
|
|
62
|
+
</h1>
|
|
63
|
+
</header>
|
|
64
|
+
|
|
65
|
+
<section style={{ display: "grid", gridTemplateColumns: "1fr 1fr", columnGap: 0.35 }}>
|
|
66
|
+
<p style={{ fontSize: 18, color: "#334155", fit: "shrink" }}>
|
|
67
|
+
Author slides with typed JSX, inspect the projected document model, and render PPTX
|
|
68
|
+
files.
|
|
69
|
+
</p>
|
|
70
|
+
<figure style={{ backgroundColor: "#E0F2FE", borderRadius: 0.15, padding: 0.25 }}>
|
|
71
|
+
<img src="chart.png" style={{ width: "100%", height: "100%", fit: "contain" }} />
|
|
72
|
+
</figure>
|
|
73
|
+
</section>
|
|
74
|
+
|
|
75
|
+
<footer>
|
|
76
|
+
<p
|
|
77
|
+
style={{
|
|
78
|
+
width: "100%",
|
|
79
|
+
height: 0.3,
|
|
80
|
+
fontSize: 11,
|
|
81
|
+
color: "#64748B",
|
|
82
|
+
textAlign: "right",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{composition.slideIndex + 1} / {composition.totalSlides}
|
|
86
|
+
</p>
|
|
87
|
+
</footer>
|
|
88
|
+
</main>
|
|
89
|
+
</>
|
|
90
|
+
),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const project = deck.project();
|
|
94
|
+
await deck.render({ output: "quarterly-review.pptx" });
|
|
83
95
|
```
|
|
84
96
|
|
|
85
|
-
Use `deck.
|
|
86
|
-
`deck.
|
|
97
|
+
Use `deck.compile()` for authoring semantics, `deck.project()` for output-facing inspection, and
|
|
98
|
+
`deck.render({ output })` when writing a PowerPoint file.
|
|
87
99
|
|
|
88
100
|
## JSX elements
|
|
89
101
|
|
|
@@ -118,7 +130,13 @@ Image elements compile to images and require either `src` or `data`:
|
|
|
118
130
|
```
|
|
119
131
|
|
|
120
132
|
Primitive string and number children inside view-like elements are normalized to implicit text
|
|
121
|
-
nodes. Inline rich text
|
|
133
|
+
nodes. Inline rich text uses `span` inside text-like elements:
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
<p>
|
|
137
|
+
Revenue grew <span style={{ color: "#16A34A", fontWeight: 700 }}>12%</span>.
|
|
138
|
+
</p>
|
|
139
|
+
```
|
|
122
140
|
|
|
123
141
|
## View Layout Semantics
|
|
124
142
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { rn as Diagnostics } from "./index-C-LDA3Lj.mjs";
|
|
2
|
+
import { F as OutputFormat, L as ProjectionFormat, s as PptxPackageModel, z as RenderedArtifact } from "./pptx-DaSXvESd.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapter.d.ts
|
|
5
|
+
type RenderOptions = {
|
|
6
|
+
readonly output?: string;
|
|
7
|
+
};
|
|
8
|
+
type WriterAdapterResult<TFormat extends OutputFormat = OutputFormat> = {
|
|
9
|
+
readonly diagnostics: Diagnostics;
|
|
10
|
+
readonly artifact?: RenderedArtifact<TFormat>;
|
|
11
|
+
};
|
|
12
|
+
type WriterAdapter<TProjection = unknown, TFormat extends OutputFormat = OutputFormat> = {
|
|
13
|
+
readonly kind: "deckjsx.writerAdapter";
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly projectionFormat: ProjectionFormat;
|
|
16
|
+
readonly format: TFormat;
|
|
17
|
+
readonly options: RenderOptions;
|
|
18
|
+
render(projection: TProjection): Promise<WriterAdapterResult<TFormat>>;
|
|
19
|
+
};
|
|
20
|
+
declare function pptxgenjs(options?: RenderOptions): WriterAdapter<PptxPackageModel, "pptx">;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { pptxgenjs as i, WriterAdapter as n, WriterAdapterResult as r, RenderOptions as t };
|