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 CHANGED
@@ -7,18 +7,19 @@ The intended architecture is:
7
7
 
8
8
  ```text
9
9
  JSX
10
- -> Presentation IR
11
- -> Backend
12
- |- PptxGenJS backend
13
- `- OOXML direct backend (future)
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 `.add()`, `.render()`, and `.output()`.
18
- Authoring uses typed JSX elements with a `style` object prop.
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
- style normalization, layout, IR, backend emission, and Node runtime output.
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 Node.js output and ships a `pptxgenjs` backend.
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, Slide } from "deckjsx";
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.add(({ composition }) => (
42
- <Slide name={`Slide ${composition.slideIndex + 1}`} style={{ backgroundColor: "#F8FAFC" }}>
43
- <main
44
- style={{
45
- x: 0.7,
46
- y: 0.5,
47
- width: 11.9,
48
- height: 6.3,
49
- display: "grid",
50
- gridTemplateRows: ["0.9in", "1fr", "0.4in"],
51
- rowGap: 0.25,
52
- }}
53
- >
54
- <header>
55
- <h1 style={{ width: "100%", height: 0.6, fontSize: 28, fontWeight: 700, color: "#0F172A" }}>
56
- Quarterly Review
57
- </h1>
58
- </header>
59
-
60
- <section style={{ display: "grid", gridTemplateColumns: "1fr 1fr", columnGap: 0.35 }}>
61
- <p style={{ fontSize: 18, color: "#334155", fit: "shrink" }}>
62
- Author slides with typed JSX, inspect the generated IR, and emit PPTX files through the
63
- backend boundary.
64
- </p>
65
- <figure style={{ backgroundColor: "#E0F2FE", borderRadius: 0.15, padding: 0.25 }}>
66
- <img src="chart.png" style={{ width: "100%", height: "100%", fit: "contain" }} />
67
- </figure>
68
- </section>
69
-
70
- <footer>
71
- <p
72
- style={{ width: "100%", height: 0.3, fontSize: 11, color: "#64748B", textAlign: "right" }}
73
- >
74
- {composition.slideIndex + 1} / {composition.totalSlides}
75
- </p>
76
- </footer>
77
- </main>
78
- </Slide>
79
- ));
80
-
81
- const ir = deck.render();
82
- await deck.output({ backend: "pptxgenjs", output: "quarterly-review.pptx" });
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.render()` for tests, snapshots, and backend-independent inspection. Use
86
- `deck.output({ backend: "pptxgenjs", output })` when writing a PowerPoint file.
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 with `span` is intentionally reserved for a later release.
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 };