pptxgenjs-plus-jsx 4.1.17
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/LICENSE +23 -0
- package/README.md +713 -0
- package/dist/components.d.ts +565 -0
- package/dist/components.js +228 -0
- package/dist/components.js.map +1 -0
- package/dist/context.d.ts +147 -0
- package/dist/context.js +167 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +1 -0
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +63 -0
- package/dist/jsx-runtime.js +85 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/node.d.ts +129 -0
- package/dist/node.js +188 -0
- package/dist/node.js.map +1 -0
- package/dist/render.d.ts +61 -0
- package/dist/render.js +1125 -0
- package/dist/render.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component factory definitions for pptxgenjsx.
|
|
3
|
+
*
|
|
4
|
+
* Each component factory creates a tagged PptxNode that the renderer later
|
|
5
|
+
* maps to the corresponding PptxGenJS method.
|
|
6
|
+
*
|
|
7
|
+
* All positioning / sizing values are in inches.
|
|
8
|
+
* Default canvas: 13.333 x 7.5 (WIDE).
|
|
9
|
+
*
|
|
10
|
+
* @module components
|
|
11
|
+
*/
|
|
12
|
+
import { createNode, } from "./node.js";
|
|
13
|
+
// ════════════════════════════════════════════════════════════════════
|
|
14
|
+
// COMPONENT FACTORIES
|
|
15
|
+
// ════════════════════════════════════════════════════════════════════
|
|
16
|
+
// ── Generic factory helpers ───────────────────────────────────────
|
|
17
|
+
/** Create a generic component factory for the given node type tag. */
|
|
18
|
+
function component(type) {
|
|
19
|
+
return (props) => createNode(type, props);
|
|
20
|
+
}
|
|
21
|
+
/** Create a component factory for a specific PptxGenJS shape (e.g. `"rect"`, `"ellipse"`). */
|
|
22
|
+
function shapeComponent(type, shape) {
|
|
23
|
+
return (props) => createNode(type, { ...props, shape });
|
|
24
|
+
}
|
|
25
|
+
/** Create a component factory for a specific chart type (e.g. `"bar"`, `"line"`). */
|
|
26
|
+
function chartComponent(type, chartType) {
|
|
27
|
+
return (props) => createNode(type, { ...props, type: chartType });
|
|
28
|
+
}
|
|
29
|
+
// ── Deck / Presentation ──────────────────────────────────────────
|
|
30
|
+
/** Root presentation wrapper. Maps to `new PptxGenJS()`.
|
|
31
|
+
*
|
|
32
|
+
* Usage:
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Deck title="My Deck">
|
|
35
|
+
* <Slide>...</Slide>
|
|
36
|
+
* </Deck>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const Deck = component("Deck");
|
|
40
|
+
/** Alias for `<Deck />`. */
|
|
41
|
+
export const Presentation = Deck;
|
|
42
|
+
// ── Slide ─────────────────────────────────────────────────────────
|
|
43
|
+
/** A single slide in the presentation. Maps to `pptx.addSlide()`.
|
|
44
|
+
*
|
|
45
|
+
* Usage:
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <Slide layout="TITLE_ONLY">
|
|
48
|
+
* <Text>Hello</Text>
|
|
49
|
+
* </Slide>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export const Slide = component("Slide");
|
|
53
|
+
// ── Layout / Section / Master / Placeholder ───────────────────────
|
|
54
|
+
/** Define an additional custom slide layout. Maps to `pptx.defineLayout()`.
|
|
55
|
+
* Provide the layout object via props (name, width, height).
|
|
56
|
+
*/
|
|
57
|
+
export const Layout = component("Layout");
|
|
58
|
+
/** Group one or more slides into a named PowerPoint section.
|
|
59
|
+
* Maps to `pptx.addSection()`.
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <Section name="Overview">
|
|
64
|
+
* <Slide>...</Slide>
|
|
65
|
+
* </Section>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export const Section = component("Section");
|
|
69
|
+
/** Define a reusable slide master. Maps to `pptx.defineSlideMaster()`.
|
|
70
|
+
* Supports placeholders via nested `<Placeholder />` nodes.
|
|
71
|
+
*/
|
|
72
|
+
export const Master = component("Master");
|
|
73
|
+
/** Declare a placeholder inside a slide master.
|
|
74
|
+
* Maps to `SlideMasterProps.objects[].placeholder` entries.
|
|
75
|
+
*/
|
|
76
|
+
export const Placeholder = component("Placeholder");
|
|
77
|
+
// ── Text ──────────────────────────────────────────────────────────
|
|
78
|
+
/** Text box or rich text block. Maps to `slide.addText(text, options)`.
|
|
79
|
+
*
|
|
80
|
+
* Usage:
|
|
81
|
+
* ```tsx
|
|
82
|
+
* <Text x={1} y={1} w={4} fontSize={24}>Hello World</Text>
|
|
83
|
+
* <Text x={1} y={2} w={4}>
|
|
84
|
+
* <TextRun bold fontSize={24}>Bold</TextRun>
|
|
85
|
+
* <TextRun color="888">Regular</TextRun>
|
|
86
|
+
* </Text>
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* Text content can come from the `text` prop, child `<TextRun />` nodes,
|
|
90
|
+
* plain-string children, or the `runs` prop. */
|
|
91
|
+
export const Text = component("Text");
|
|
92
|
+
/** A single formatted text run inside `<Text />`. Maps to `PptxGenJS.TextProps`.
|
|
93
|
+
* Supports per-run font, color, bold, italic, etc.
|
|
94
|
+
*/
|
|
95
|
+
export const TextRun = component("TextRun");
|
|
96
|
+
/** Speaker notes for a slide. Maps to `slide.addNotes()`.
|
|
97
|
+
*
|
|
98
|
+
* Usage:
|
|
99
|
+
* ```tsx
|
|
100
|
+
* <Slide>
|
|
101
|
+
* <Notes>Remember to mention the quarterly results.</Notes>
|
|
102
|
+
* </Slide>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export const Notes = component("Notes");
|
|
106
|
+
// ── Shapes ────────────────────────────────────────────────────────
|
|
107
|
+
/** Generic shape — for any PptxGenJS shape without a dedicated component.
|
|
108
|
+
* Maps to `slide.addShape(shape, options)`. */
|
|
109
|
+
export const Shape = component("Shape");
|
|
110
|
+
/** Rectangle. Maps to `slide.addShape("rect", options)`. */
|
|
111
|
+
export const Rect = shapeComponent("Rect", "rect");
|
|
112
|
+
/** Rounded rectangle; supports `rectRadius` for corner rounding.
|
|
113
|
+
* Maps to `slide.addShape("roundRect", options)`. */
|
|
114
|
+
export const RoundRect = shapeComponent("RoundRect", "roundRect");
|
|
115
|
+
/** Ellipse / oval. Maps to `slide.addShape("ellipse", options)`. */
|
|
116
|
+
export const Ellipse = shapeComponent("Ellipse", "ellipse");
|
|
117
|
+
/** Alias for `<Ellipse />`. */
|
|
118
|
+
export const Oval = Ellipse;
|
|
119
|
+
/** Triangle. Maps to `slide.addShape("triangle", options)`. */
|
|
120
|
+
export const Triangle = shapeComponent("Triangle", "triangle");
|
|
121
|
+
/** Right-angle triangle. Maps to `slide.addShape("rtTriangle", options)`. */
|
|
122
|
+
export const RightTriangle = shapeComponent("RightTriangle", "rtTriangle");
|
|
123
|
+
/** Diamond. Maps to `slide.addShape("diamond", options)`. */
|
|
124
|
+
export const Diamond = shapeComponent("Diamond", "diamond");
|
|
125
|
+
/** Pentagon. Maps to `slide.addShape("pentagon", options)`. */
|
|
126
|
+
export const Pentagon = shapeComponent("Pentagon", "pentagon");
|
|
127
|
+
/** Hexagon. Maps to `slide.addShape("hexagon", options)`. */
|
|
128
|
+
export const Hexagon = shapeComponent("Hexagon", "hexagon");
|
|
129
|
+
/** Five-point star. Maps to `slide.addShape("star5", options)`. */
|
|
130
|
+
export const Star = shapeComponent("Star", "star5");
|
|
131
|
+
/** Four-point star. Maps to `slide.addShape("star4", options)`. */
|
|
132
|
+
export const Star4 = shapeComponent("Star4", "star4");
|
|
133
|
+
/** Alias for `<Star />` (five-point). */
|
|
134
|
+
export const Star5 = Star;
|
|
135
|
+
/** Six-point star. Maps to `slide.addShape("star6", options)`. */
|
|
136
|
+
export const Star6 = shapeComponent("Star6", "star6");
|
|
137
|
+
/** Eight-point star. Maps to `slide.addShape("star8", options)`. */
|
|
138
|
+
export const Star8 = shapeComponent("Star8", "star8");
|
|
139
|
+
/** Ten-point star. Maps to `slide.addShape("star10", options)`. */
|
|
140
|
+
export const Star10 = shapeComponent("Star10", "star10");
|
|
141
|
+
/** Simple line. Maps to `slide.addShape("line", options)`.
|
|
142
|
+
* For lines defined by start/end points, use `<LineBetween />` instead. */
|
|
143
|
+
export const Line = component("Line");
|
|
144
|
+
/** Line connecting two absolute coordinates.
|
|
145
|
+
* Pass start/end points via `x1`/`y1`/`x2`/`y2`. */
|
|
146
|
+
export const LineBetween = component("LineBetween");
|
|
147
|
+
/** Arc shape; supports `angleRange`. Maps to `slide.addShape("arc", options)`. */
|
|
148
|
+
export const Arc = shapeComponent("Arc", "arc");
|
|
149
|
+
/** Thick arc; supports `angleRange` and `arcThicknessRatio`.
|
|
150
|
+
* Maps to `slide.addShape("blockArc", options)`. */
|
|
151
|
+
export const BlockArc = shapeComponent("BlockArc", "blockArc");
|
|
152
|
+
/** Pie-slice shape (visual only — not a data chart).
|
|
153
|
+
* Maps to `slide.addShape("pie", options)`. */
|
|
154
|
+
export const PieShape = shapeComponent("PieShape", "pie");
|
|
155
|
+
/** Editable custom path geometry. Maps to `slide.addShape("custGeom", options)`. */
|
|
156
|
+
export const CustomGeometry = shapeComponent("CustomGeometry", "custGeom");
|
|
157
|
+
/** Left-pointing arrow. Maps to `slide.addShape("leftArrow", options)`. */
|
|
158
|
+
export const LeftArrow = shapeComponent("LeftArrow", "leftArrow");
|
|
159
|
+
/** Right-pointing arrow. Maps to `slide.addShape("rightArrow", options)`. */
|
|
160
|
+
export const RightArrow = shapeComponent("RightArrow", "rightArrow");
|
|
161
|
+
/** Up-pointing arrow. Maps to `slide.addShape("upArrow", options)`. */
|
|
162
|
+
export const UpArrow = shapeComponent("UpArrow", "upArrow");
|
|
163
|
+
/** Down-pointing arrow. Maps to `slide.addShape("downArrow", options)`. */
|
|
164
|
+
export const DownArrow = shapeComponent("DownArrow", "downArrow");
|
|
165
|
+
/** Left-right bidirectional arrow. Maps to `slide.addShape("leftRightArrow", options)`. */
|
|
166
|
+
export const LeftRightArrow = shapeComponent("LeftRightArrow", "leftRightArrow");
|
|
167
|
+
/** Up-down bidirectional arrow. Maps to `slide.addShape("upDownArrow", options)`. */
|
|
168
|
+
export const UpDownArrow = shapeComponent("UpDownArrow", "upDownArrow");
|
|
169
|
+
/** Chevron / angle bracket. Maps to `slide.addShape("chevron", options)`. */
|
|
170
|
+
export const Chevron = shapeComponent("Chevron", "chevron");
|
|
171
|
+
/** Cloud shape. Maps to `slide.addShape("cloud", options)`. */
|
|
172
|
+
export const Cloud = shapeComponent("Cloud", "cloud");
|
|
173
|
+
/** Heart shape. Maps to `slide.addShape("heart", options)`. */
|
|
174
|
+
export const Heart = shapeComponent("Heart", "heart");
|
|
175
|
+
/** Donut / ring shape. Maps to `slide.addShape("donut", options)`. */
|
|
176
|
+
export const Donut = shapeComponent("Donut", "donut");
|
|
177
|
+
/** Plus / cross shape. Maps to `slide.addShape("plus", options)`. */
|
|
178
|
+
export const Plus = shapeComponent("Plus", "plus");
|
|
179
|
+
// ── Media ─────────────────────────────────────────────────────────
|
|
180
|
+
/** Image (path, data URI, or base64). Maps to `slide.addImage(options)`. */
|
|
181
|
+
export const Image = component("Image");
|
|
182
|
+
/** Audio, video, or online media. Maps to `slide.addMedia(options)`. */
|
|
183
|
+
export const Media = component("Media");
|
|
184
|
+
// ── Charts ────────────────────────────────────────────────────────
|
|
185
|
+
/** Generic chart with explicit type + data. Maps to `slide.addChart(type, data, options)`.
|
|
186
|
+
* For common chart types, prefer typed components (`<BarChart />`, `<LineChart />`, etc.). */
|
|
187
|
+
export const Chart = component("Chart");
|
|
188
|
+
/** Area chart. Maps to `slide.addChart("area", data, options)`. */
|
|
189
|
+
export const AreaChart = chartComponent("AreaChart", "area");
|
|
190
|
+
/** Bar chart. Maps to `slide.addChart("bar", data, options)`. */
|
|
191
|
+
export const BarChart = chartComponent("BarChart", "bar");
|
|
192
|
+
/** 3D bar chart. Maps to `slide.addChart("bar3D", data, options)`. */
|
|
193
|
+
export const Bar3DChart = chartComponent("Bar3DChart", "bar3D");
|
|
194
|
+
/** Bubble chart. Maps to `slide.addChart("bubble", data, options)`. */
|
|
195
|
+
export const BubbleChart = chartComponent("BubbleChart", "bubble");
|
|
196
|
+
/** Doughnut chart. Maps to `slide.addChart("doughnut", data, options)`. */
|
|
197
|
+
export const DoughnutChart = chartComponent("DoughnutChart", "doughnut");
|
|
198
|
+
/** Line chart. Maps to `slide.addChart("line", data, options)`. */
|
|
199
|
+
export const LineChart = chartComponent("LineChart", "line");
|
|
200
|
+
/** Pie chart. Maps to `slide.addChart("pie", data, options)`. */
|
|
201
|
+
export const PieChart = chartComponent("PieChart", "pie");
|
|
202
|
+
/** Radar chart. Maps to `slide.addChart("radar", data, options)`. */
|
|
203
|
+
export const RadarChart = chartComponent("RadarChart", "radar");
|
|
204
|
+
/** Scatter chart. Maps to `slide.addChart("scatter", data, options)`. */
|
|
205
|
+
export const ScatterChart = chartComponent("ScatterChart", "scatter");
|
|
206
|
+
// ── Table ─────────────────────────────────────────────────────────
|
|
207
|
+
/** Table of rows and cells. Maps to `slide.addTable(rows, options)`. */
|
|
208
|
+
export const Table = component("Table");
|
|
209
|
+
/** A row inside `<Table />`. Maps to `PptxGenJS.TableRow`. */
|
|
210
|
+
export const TableRow = component("TableRow");
|
|
211
|
+
/** A cell inside `<TableRow />`. Maps to `PptxGenJS.TableCell`. */
|
|
212
|
+
export const TableCell = component("TableCell");
|
|
213
|
+
/** Split an HTML table across multiple slides (browser runtime only).
|
|
214
|
+
* Maps to `pptx.tableToSlides(eleId, options)`. */
|
|
215
|
+
export const TableToSlides = component("TableToSlides");
|
|
216
|
+
// ── Escape hatch ──────────────────────────────────────────────────
|
|
217
|
+
/** Escape hatch for unsupported or new PptxGenJS APIs.
|
|
218
|
+
* Provides direct access via a custom render callback.
|
|
219
|
+
* Maps to the `<Raw>` custom render protocol. */
|
|
220
|
+
export const Raw = component("Raw");
|
|
221
|
+
// ── Group ─────────────────────────────────────────────────────────
|
|
222
|
+
/** PresentationML group (`p:grpSp`). Child coordinates are relative to
|
|
223
|
+
* the group's origin. Maps to `slide.addGroup()`. Nested groups use
|
|
224
|
+
* `group.addGroup()`. Tables, charts, and media are not valid children. */
|
|
225
|
+
export const Group = component("Group");
|
|
226
|
+
/** WordArt text with a warp (`a:prstTxWarp`). Maps to `slide.addWordArt()`. */
|
|
227
|
+
export const WordArt = component("WordArt");
|
|
228
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAML,UAAU,GACX,MAAM,WAAW,CAAC;AAmanB,uEAAuE;AACvE,sBAAsB;AACtB,uEAAuE;AAEvE,qEAAqE;AAErE,sEAAsE;AACtE,SAAS,SAAS,CAAmB,IAAO;IAC1C,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAY,CAAC,CAAC;AACnD,CAAC;AAED,8FAA8F;AAC9F,SAAS,cAAc,CAAmB,IAAO,EAAE,KAAa;IAC9D,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAS,CAAC,CAAC;AACjE,CAAC;AAED,qFAAqF;AACrF,SAAS,cAAc,CAAmB,IAAO,EAAE,SAAiB;IAClE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,EAAS,CAAC,CAAC;AAC3E,CAAC;AAED,oEAAoE;AAEpE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,C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AAC,MAAM,YAAY,GAAG,cAAc,CACxC,cAAc,EACd,SAAS,CAC6B,CAAC;AAEzC,qEAAqE;AAErE,wEAAwE;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAiC,CAAC;AACxE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAoC,CAAC;AACjF,mEAAmE;AACnE,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAqC,CAAC;AACpF;mDACmD;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,eAAe,CAAyC,CAAC;AAEhG,qEAAqE;AAErE;;iDAEiD;AACjD,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAA+B,CAAC;AAElE,qEAAqE;AAErE;;2EAE2E;AAC3E,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAiC,CAAC;AAExE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAmC,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering context for pptxgenjsx.
|
|
3
|
+
*
|
|
4
|
+
* Uses `AsyncLocalStorage` stored via `globalThis[Symbol.for()]` to
|
|
5
|
+
* share context across module instances **and** preserve concurrency
|
|
6
|
+
* safety.
|
|
7
|
+
*
|
|
8
|
+
* ### Why not module-level `AsyncLocalStorage`?
|
|
9
|
+
*
|
|
10
|
+
* When the package is symlinked (e.g. `npm link` during local
|
|
11
|
+
* development), the consumer and the library can resolve to **different
|
|
12
|
+
* copies** of this module. A module-level `AsyncLocalStorage` would be
|
|
13
|
+
* duplicated — context written by one copy would be invisible to the
|
|
14
|
+
* other.
|
|
15
|
+
*
|
|
16
|
+
* By storing the `AsyncLocalStorage` instance on `globalThis` via a
|
|
17
|
+
* `Symbol.for()` key, all copies share the same underlying store,
|
|
18
|
+
* solving the dual-instance problem.
|
|
19
|
+
*
|
|
20
|
+
* ### Why not plain `globalThis` variables?
|
|
21
|
+
*
|
|
22
|
+
* Plain global variables (`globalThis[key] = value`) are not
|
|
23
|
+
* concurrency-safe — two async rendering processes would overwrite each
|
|
24
|
+
* other's context. `AsyncLocalStorage` uses Node.js's `AsyncHook` to
|
|
25
|
+
* isolate context per async call chain, making it safe for concurrent
|
|
26
|
+
* usage (e.g. in an HTTP server).
|
|
27
|
+
*
|
|
28
|
+
* @module context
|
|
29
|
+
*/
|
|
30
|
+
/** Deck-level metadata accessible via {@link useDeckContext}. */
|
|
31
|
+
export interface DeckContextInfo {
|
|
32
|
+
/** Slide width in inches (set by the presentation layout). */
|
|
33
|
+
readonly width: number;
|
|
34
|
+
/** Slide height in inches (set by the presentation layout). */
|
|
35
|
+
readonly height: number;
|
|
36
|
+
}
|
|
37
|
+
/** Group-level metadata accessible via {@link useGroupContext}.
|
|
38
|
+
*
|
|
39
|
+
* `x` and `y` are the group's origin on the slide (accumulated from nested
|
|
40
|
+
* parents). Child element coordinates passed to pptxgenjs are group-relative
|
|
41
|
+
* (`relative: true`) because `<Group>` emits a PresentationML `p:grpSp`.
|
|
42
|
+
* When called outside a `<Group>`, falls back to the deck's dimensions
|
|
43
|
+
* with `x = 0, y = 0` and `relative: false`. */
|
|
44
|
+
export interface GroupContextInfo {
|
|
45
|
+
/** Absolute x offset of the group origin on the slide. */
|
|
46
|
+
readonly x: number;
|
|
47
|
+
/** Absolute y offset of the group origin on the slide. */
|
|
48
|
+
readonly y: number;
|
|
49
|
+
/** Virtual canvas width of the current group (or deck width when outside a group). */
|
|
50
|
+
readonly width: number;
|
|
51
|
+
/** Virtual canvas height of the current group (or deck height when outside a group). */
|
|
52
|
+
readonly height: number;
|
|
53
|
+
/** True while rendering inside `<Group>` — child x/y are group-relative. */
|
|
54
|
+
readonly relative: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** Slide-level metadata accessible via {@link useSlideContext}. */
|
|
57
|
+
export interface SlideContextInfo {
|
|
58
|
+
/** 1-based slide index within the entire presentation. */
|
|
59
|
+
readonly index: number;
|
|
60
|
+
/** Total number of slides in the presentation. */
|
|
61
|
+
readonly total: number;
|
|
62
|
+
/** Title of the section this slide belongs to, if any. */
|
|
63
|
+
readonly sectionTitle?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retrieve the current deck's context information (width, height).
|
|
67
|
+
*
|
|
68
|
+
* Must be called **during rendering** — i.e., inside a component factory
|
|
69
|
+
* mounted via `<Slide component={...} />` or within any synchronous
|
|
70
|
+
* function called by such a factory.
|
|
71
|
+
*
|
|
72
|
+
* @returns The {@link DeckContextInfo} for the current presentation.
|
|
73
|
+
* @throws if called outside a rendering context.
|
|
74
|
+
*/
|
|
75
|
+
export declare function useDeckContext(): DeckContextInfo;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieve the current slide's context information (index, total, sectionTitle).
|
|
78
|
+
*
|
|
79
|
+
* Must be called **during rendering** — i.e., inside a component factory
|
|
80
|
+
* mounted via `<Slide component={...} />` or within any synchronous
|
|
81
|
+
* function called by such a factory.
|
|
82
|
+
*
|
|
83
|
+
* @returns The {@link SlideContextInfo} for the currently rendering slide.
|
|
84
|
+
* @throws if called outside a rendering context.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* // slides/title-slide.tsx
|
|
89
|
+
* export default function TitleSlide() {
|
|
90
|
+
* const { index, total } = useSlideContext();
|
|
91
|
+
* return (
|
|
92
|
+
* <Text x={1} y={1} w={10}>
|
|
93
|
+
* Slide {index} of {total}
|
|
94
|
+
* </Text>
|
|
95
|
+
* );
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function useSlideContext(): SlideContextInfo;
|
|
100
|
+
/**
|
|
101
|
+
* Retrieve the current group's context information (absolute x, y and group width, height).
|
|
102
|
+
*
|
|
103
|
+
* When called **outside** a `<Group>` (i.e., directly inside a `<Slide>`),
|
|
104
|
+
* returns the deck's dimensions with `x = 0, y = 0` — so offset behaviour
|
|
105
|
+
* is a no-op and `width` / `height` still reflect the slide canvas.
|
|
106
|
+
*
|
|
107
|
+
* Must be called during rendering — i.e., inside a component factory
|
|
108
|
+
* mounted via `<Slide component={...} />` or within any synchronous
|
|
109
|
+
* function called by such a factory.
|
|
110
|
+
*
|
|
111
|
+
* @returns The {@link GroupContextInfo} for the current group (or deck fallback).
|
|
112
|
+
* @throws if called outside any rendering context.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```tsx
|
|
116
|
+
* export default function ProgressBar() {
|
|
117
|
+
* const { width } = useGroupContext();
|
|
118
|
+
* return <Rect x={0} y={0} w={width * 0.7} h={0.5} fill="blue" />;
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function useGroupContext(): GroupContextInfo;
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
* Run a function within a deck-level rendering context.
|
|
126
|
+
* Uses `AsyncLocalStorage.run()` to preserve context across async
|
|
127
|
+
* boundaries while maintaining concurrency safety.
|
|
128
|
+
*
|
|
129
|
+
* The return type uses `Awaited<T>` to flatten nested Promises that
|
|
130
|
+
* arise when the callback is async (which is always the case in our
|
|
131
|
+
* rendering pipeline).
|
|
132
|
+
*/
|
|
133
|
+
export declare function withDeckContext<T>(info: DeckContextInfo, fn: () => T): Promise<Awaited<T>>;
|
|
134
|
+
/**
|
|
135
|
+
* @internal
|
|
136
|
+
* Run a function within a slide-level rendering context.
|
|
137
|
+
* Uses `AsyncLocalStorage.run()` to preserve context across async
|
|
138
|
+
* boundaries while maintaining concurrency safety.
|
|
139
|
+
*/
|
|
140
|
+
export declare function withSlideContext<T>(info: SlideContextInfo, fn: () => T): Promise<Awaited<T>>;
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
* Run a function within a group-level rendering context.
|
|
144
|
+
* Uses `AsyncLocalStorage.run()` to preserve context across async
|
|
145
|
+
* boundaries while maintaining concurrency safety.
|
|
146
|
+
*/
|
|
147
|
+
export declare function withGroupContext<T>(info: GroupContextInfo, fn: () => T): Promise<Awaited<T>>;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering context for pptxgenjsx.
|
|
3
|
+
*
|
|
4
|
+
* Uses `AsyncLocalStorage` stored via `globalThis[Symbol.for()]` to
|
|
5
|
+
* share context across module instances **and** preserve concurrency
|
|
6
|
+
* safety.
|
|
7
|
+
*
|
|
8
|
+
* ### Why not module-level `AsyncLocalStorage`?
|
|
9
|
+
*
|
|
10
|
+
* When the package is symlinked (e.g. `npm link` during local
|
|
11
|
+
* development), the consumer and the library can resolve to **different
|
|
12
|
+
* copies** of this module. A module-level `AsyncLocalStorage` would be
|
|
13
|
+
* duplicated — context written by one copy would be invisible to the
|
|
14
|
+
* other.
|
|
15
|
+
*
|
|
16
|
+
* By storing the `AsyncLocalStorage` instance on `globalThis` via a
|
|
17
|
+
* `Symbol.for()` key, all copies share the same underlying store,
|
|
18
|
+
* solving the dual-instance problem.
|
|
19
|
+
*
|
|
20
|
+
* ### Why not plain `globalThis` variables?
|
|
21
|
+
*
|
|
22
|
+
* Plain global variables (`globalThis[key] = value`) are not
|
|
23
|
+
* concurrency-safe — two async rendering processes would overwrite each
|
|
24
|
+
* other's context. `AsyncLocalStorage` uses Node.js's `AsyncHook` to
|
|
25
|
+
* isolate context per async call chain, making it safe for concurrent
|
|
26
|
+
* usage (e.g. in an HTTP server).
|
|
27
|
+
*
|
|
28
|
+
* @module context
|
|
29
|
+
*/
|
|
30
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
31
|
+
// ════════════════════════════════════════════════════════════════════
|
|
32
|
+
// INTERNAL GLOBAL KEY
|
|
33
|
+
// ════════════════════════════════════════════════════════════════════
|
|
34
|
+
function getGlobalAls(key) {
|
|
35
|
+
let als = globalThis[key];
|
|
36
|
+
if (!als) {
|
|
37
|
+
als = new AsyncLocalStorage();
|
|
38
|
+
globalThis[key] = als;
|
|
39
|
+
}
|
|
40
|
+
return als;
|
|
41
|
+
}
|
|
42
|
+
function getDeckAls() {
|
|
43
|
+
return getGlobalAls(Symbol.for("pptxgenjsx:deckAls"));
|
|
44
|
+
}
|
|
45
|
+
function getSlideAls() {
|
|
46
|
+
return getGlobalAls(Symbol.for("pptxgenjsx:slideAls"));
|
|
47
|
+
}
|
|
48
|
+
function getGroupAls() {
|
|
49
|
+
return getGlobalAls(Symbol.for("pptxgenjsx:groupAls"));
|
|
50
|
+
}
|
|
51
|
+
// ════════════════════════════════════════════════════════════════════
|
|
52
|
+
// PUBLIC API
|
|
53
|
+
// ════════════════════════════════════════════════════════════════════
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve the current deck's context information (width, height).
|
|
56
|
+
*
|
|
57
|
+
* Must be called **during rendering** — i.e., inside a component factory
|
|
58
|
+
* mounted via `<Slide component={...} />` or within any synchronous
|
|
59
|
+
* function called by such a factory.
|
|
60
|
+
*
|
|
61
|
+
* @returns The {@link DeckContextInfo} for the current presentation.
|
|
62
|
+
* @throws if called outside a rendering context.
|
|
63
|
+
*/
|
|
64
|
+
export function useDeckContext() {
|
|
65
|
+
const ctx = getDeckAls().getStore();
|
|
66
|
+
if (!ctx) {
|
|
67
|
+
throw new Error("useDeckContext() can only be called during slide rendering.\n" +
|
|
68
|
+
"Ensure you are inside a component factory invoked via <Slide component={...} />.");
|
|
69
|
+
}
|
|
70
|
+
return ctx;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve the current slide's context information (index, total, sectionTitle).
|
|
74
|
+
*
|
|
75
|
+
* Must be called **during rendering** — i.e., inside a component factory
|
|
76
|
+
* mounted via `<Slide component={...} />` or within any synchronous
|
|
77
|
+
* function called by such a factory.
|
|
78
|
+
*
|
|
79
|
+
* @returns The {@link SlideContextInfo} for the currently rendering slide.
|
|
80
|
+
* @throws if called outside a rendering context.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* // slides/title-slide.tsx
|
|
85
|
+
* export default function TitleSlide() {
|
|
86
|
+
* const { index, total } = useSlideContext();
|
|
87
|
+
* return (
|
|
88
|
+
* <Text x={1} y={1} w={10}>
|
|
89
|
+
* Slide {index} of {total}
|
|
90
|
+
* </Text>
|
|
91
|
+
* );
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export function useSlideContext() {
|
|
96
|
+
const ctx = getSlideAls().getStore();
|
|
97
|
+
if (!ctx) {
|
|
98
|
+
throw new Error("useSlideContext() can only be called during slide rendering.\n" +
|
|
99
|
+
"Ensure you are inside a component factory invoked via <Slide component={...} />.");
|
|
100
|
+
}
|
|
101
|
+
return ctx;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Retrieve the current group's context information (absolute x, y and group width, height).
|
|
105
|
+
*
|
|
106
|
+
* When called **outside** a `<Group>` (i.e., directly inside a `<Slide>`),
|
|
107
|
+
* returns the deck's dimensions with `x = 0, y = 0` — so offset behaviour
|
|
108
|
+
* is a no-op and `width` / `height` still reflect the slide canvas.
|
|
109
|
+
*
|
|
110
|
+
* Must be called during rendering — i.e., inside a component factory
|
|
111
|
+
* mounted via `<Slide component={...} />` or within any synchronous
|
|
112
|
+
* function called by such a factory.
|
|
113
|
+
*
|
|
114
|
+
* @returns The {@link GroupContextInfo} for the current group (or deck fallback).
|
|
115
|
+
* @throws if called outside any rendering context.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* export default function ProgressBar() {
|
|
120
|
+
* const { width } = useGroupContext();
|
|
121
|
+
* return <Rect x={0} y={0} w={width * 0.7} h={0.5} fill="blue" />;
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export function useGroupContext() {
|
|
126
|
+
const ctx = getGroupAls().getStore();
|
|
127
|
+
if (ctx)
|
|
128
|
+
return ctx;
|
|
129
|
+
// Outside any group — use deck dimensions as the virtual canvas
|
|
130
|
+
const deck = useDeckContext();
|
|
131
|
+
return { x: 0, y: 0, width: deck.width, height: deck.height, relative: false };
|
|
132
|
+
}
|
|
133
|
+
// ════════════════════════════════════════════════════════════════════
|
|
134
|
+
// INTERNAL — used by render.ts only
|
|
135
|
+
// ════════════════════════════════════════════════════════════════════
|
|
136
|
+
/**
|
|
137
|
+
* @internal
|
|
138
|
+
* Run a function within a deck-level rendering context.
|
|
139
|
+
* Uses `AsyncLocalStorage.run()` to preserve context across async
|
|
140
|
+
* boundaries while maintaining concurrency safety.
|
|
141
|
+
*
|
|
142
|
+
* The return type uses `Awaited<T>` to flatten nested Promises that
|
|
143
|
+
* arise when the callback is async (which is always the case in our
|
|
144
|
+
* rendering pipeline).
|
|
145
|
+
*/
|
|
146
|
+
export function withDeckContext(info, fn) {
|
|
147
|
+
return getDeckAls().run(info, fn);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
* Run a function within a slide-level rendering context.
|
|
152
|
+
* Uses `AsyncLocalStorage.run()` to preserve context across async
|
|
153
|
+
* boundaries while maintaining concurrency safety.
|
|
154
|
+
*/
|
|
155
|
+
export function withSlideContext(info, fn) {
|
|
156
|
+
return getSlideAls().run(info, fn);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @internal
|
|
160
|
+
* Run a function within a group-level rendering context.
|
|
161
|
+
* Uses `AsyncLocalStorage.run()` to preserve context across async
|
|
162
|
+
* boundaries while maintaining concurrency safety.
|
|
163
|
+
*/
|
|
164
|
+
export function withGroupContext(info, fn) {
|
|
165
|
+
return getGroupAls().run(info, fn);
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mapp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C;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IACpB,gEAAgE;IAChE,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACjF,CAAC;AAED,uEAAuE;AACvE,oCAAoC;AACpC,uEAAuE;AAEvE;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAI,IAAqB,EAAE,EAAW;IACnE,OAAO,UAAU,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAwB,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAI,IAAsB,EAAE,EAAW;IACrE,OAAO,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAwB,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAI,IAAsB,EAAE,EAAW;IACrE,OAAO,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAwB,CAAC;AAC5D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pptxgenjsx — JSX runtime for building PowerPoint presentations with pptxgenjs.
|
|
3
|
+
*
|
|
4
|
+
* Entry point that re-exports all public API (components + context).
|
|
5
|
+
*
|
|
6
|
+
* @module pptxgenjsx
|
|
7
|
+
*/
|
|
8
|
+
export { Fragment } from "./node.js";
|
|
9
|
+
export type { ComponentFactory, ComponentProps, ContainerProps, LeafProps, PptxNode, PptxChild, PptxChildren, PptxNodePromise, PrimitiveChild, } from "./node.js";
|
|
10
|
+
export { useSlideContext, useDeckContext, useGroupContext } from "./context.js";
|
|
11
|
+
export type { SlideContextInfo, DeckContextInfo, GroupContextInfo } from "./context.js";
|
|
12
|
+
export * from "./components.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pptxgenjsx — JSX runtime for building PowerPoint presentations with pptxgenjs.
|
|
3
|
+
*
|
|
4
|
+
* Entry point that re-exports all public API (components + context).
|
|
5
|
+
*
|
|
6
|
+
* @module pptxgenjsx
|
|
7
|
+
*/
|
|
8
|
+
export { Fragment } from "./node.js";
|
|
9
|
+
export { useSlideContext, useDeckContext, useGroupContext } from "./context.js";
|
|
10
|
+
export * from "./components.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAYrC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhF,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./jsx-runtime.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|