deckjsx 0.1.0 → 0.1.2
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 +20 -5
- package/dist/index.d.mts +17 -356
- package/dist/index.mjs +10 -66
- package/dist/jsx-Cj45FgcC.mjs +103 -0
- package/dist/jsx-dev-runtime.d.mts +2 -0
- package/dist/jsx-dev-runtime.mjs +3 -0
- package/dist/jsx-runtime-BfZK5259.d.mts +408 -0
- package/dist/jsx-runtime.d.mts +2 -0
- package/dist/jsx-runtime.mjs +8 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -80,13 +80,28 @@ await deck.output({ backend: "pptxgenjs", output: "quarterly-review.pptx" });
|
|
|
80
80
|
Use `deck.render()` for tests, snapshots, and backend-independent inspection. Use
|
|
81
81
|
`deck.output({ backend: "pptxgenjs", output })` when writing a PowerPoint file.
|
|
82
82
|
|
|
83
|
-
##
|
|
83
|
+
## View Layout Semantics
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
`View` is a containing block for its children. Child `x`, `y`, `left`, `top`, `right`,
|
|
86
|
+
`bottom`, `width`, and `height` values are resolved relative to the parent `View`, not
|
|
87
|
+
the slide, so authors can build panels with local coordinates. Percentage lengths use
|
|
88
|
+
the parent frame as their reference.
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
```tsx
|
|
91
|
+
<View style={{ x: 1, y: 1, width: 6, height: 3 }}>
|
|
92
|
+
<Text style={{ x: "10%", y: "20%", width: "50%", height: "25%" }}>local percent frame</Text>
|
|
93
|
+
<Text style={{ left: "55%", top: "10%", right: "10%", bottom: "60%" }}>inset frame</Text>
|
|
94
|
+
</View>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For `display: "flex"` and `display: "grid"`, normal-flow children are laid out inside
|
|
98
|
+
the content frame after padding. `gap`, `flexGrow`, percentage widths, `fr` grid tracks,
|
|
99
|
+
and simple `gridColumn` / `gridRow` spans resolve to concrete slide coordinates during
|
|
100
|
+
rendering. Absolutely positioned children inside flex or grid containers also use the
|
|
101
|
+
container content frame, including padding, as their containing block.
|
|
102
|
+
|
|
103
|
+
Use direct slide children when you want slide-global absolute placement. Use children
|
|
104
|
+
inside a `View` when you want a local, web-like layout region.
|
|
90
105
|
|
|
91
106
|
## Development
|
|
92
107
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,332 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type DeckPointLength = number | `${number}${"pt" | "in" | "px" | "em" | "rem" | "vh" | "vw" | "ch"}`;
|
|
4
|
-
type CssAspectRatio = number | `${number}/${number}` | `${number} / ${number}`;
|
|
5
|
-
type CssBoxSizing = "border-box" | "content-box";
|
|
6
|
-
type Spacing = DeckLength | readonly [DeckLength, DeckLength, DeckLength, DeckLength];
|
|
7
|
-
type StackAxis = "horizontal" | "vertical";
|
|
8
|
-
type StackAlignment = "start" | "center" | "end";
|
|
9
|
-
type LayoutMode = "absolute" | "stack" | "grid";
|
|
10
|
-
type BackendName = "pptxgenjs" | "ooxml";
|
|
11
|
-
type ImplementedBackendName = "pptxgenjs";
|
|
12
|
-
type BorderStyle = "none" | "solid" | "dash";
|
|
13
|
-
type StrokeDashType = "solid" | "dash" | "dashDot" | "lgDash" | "lgDashDot" | "lgDashDotDot" | "sysDash" | "sysDot";
|
|
14
|
-
type StrokeLineCap = "butt" | "round" | "square";
|
|
15
|
-
type StrokeLineJoin = "miter" | "round" | "bevel";
|
|
16
|
-
type VerticalAlign = "top" | "middle" | "bottom";
|
|
17
|
-
type TextFit = "none" | "shrink" | "resize";
|
|
18
|
-
type CssDisplay = "flex" | "block" | "grid" | "none";
|
|
19
|
-
type CssPosition = "absolute" | "relative";
|
|
20
|
-
type CssVisibility = "visible" | "hidden";
|
|
21
|
-
type CssOverflow = "visible" | "hidden";
|
|
22
|
-
type CssFlexDirection = "row" | "column";
|
|
23
|
-
type CssGridTrack = DeckLength | `${number}fr` | `minmax(${string})`;
|
|
24
|
-
type CssGridTemplate = readonly CssGridTrack[] | string;
|
|
25
|
-
type CssGridLine = number | "auto" | `span ${number}`;
|
|
26
|
-
type CssGridPlacement = number | `span ${number}` | `${number} / ${number}` | `${number}/${number}` | `${number} / span ${number}` | `${number}/span${number}`;
|
|
27
|
-
type CssAlignItems = "start" | "flex-start" | "center" | "end" | "flex-end" | "stretch";
|
|
28
|
-
type CssAlignSelf = CssAlignItems | "auto";
|
|
29
|
-
type CssJustifySelf = CssAlignItems | "auto";
|
|
30
|
-
type CssJustifyContent = "start" | "flex-start" | "center" | "end" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
31
|
-
type CssAlignContent = "start" | "flex-start" | "center" | "end" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
32
|
-
type CssFlexWrap = "nowrap" | "wrap";
|
|
33
|
-
type CssFlexBasis = DeckLength | "auto";
|
|
34
|
-
type CssGridAutoFlow = "row" | "column" | "row dense" | "column dense";
|
|
35
|
-
type CssGridTemplateAreas = string | readonly string[];
|
|
36
|
-
type CssGridTemplateShorthand = string;
|
|
37
|
-
type CssGridShorthand = string;
|
|
38
|
-
type CssObjectPosition = string;
|
|
39
|
-
type ImageCropValue = number | `${number}%`;
|
|
40
|
-
type TextTabStopLength = DeckPointLength;
|
|
41
|
-
type TextTabStopAlignment = "left" | "right" | "center" | "decimal";
|
|
42
|
-
type TextTabStopAuthoring = {
|
|
43
|
-
position: TextTabStopLength;
|
|
44
|
-
alignment?: TextTabStopAlignment;
|
|
45
|
-
};
|
|
46
|
-
type ImageCropAuthoring = {
|
|
47
|
-
top?: ImageCropValue;
|
|
48
|
-
right?: ImageCropValue;
|
|
49
|
-
bottom?: ImageCropValue;
|
|
50
|
-
left?: ImageCropValue;
|
|
51
|
-
};
|
|
52
|
-
type TextJsxChild = string | number | boolean | null | undefined | readonly TextJsxChild[];
|
|
53
|
-
type ContentAuthorNode = AuthorNode<"view" | "text" | "image" | "shape">;
|
|
54
|
-
type ContentJsxChild = AuthorNode | boolean | null | undefined | readonly ContentJsxChild[];
|
|
55
|
-
type JsxNode = AuthorNode | string | number | boolean | null | undefined | readonly JsxNode[];
|
|
56
|
-
type BaseAuthorProps = {
|
|
57
|
-
opacity?: number;
|
|
58
|
-
rotation?: number;
|
|
59
|
-
transform?: string;
|
|
60
|
-
transformOrigin?: string;
|
|
61
|
-
zIndex?: number;
|
|
62
|
-
flipH?: boolean;
|
|
63
|
-
flipV?: boolean;
|
|
64
|
-
overflow?: CssOverflow;
|
|
65
|
-
alignSelf?: CssAlignSelf;
|
|
66
|
-
justifySelf?: CssJustifySelf;
|
|
67
|
-
placeSelf?: string;
|
|
68
|
-
position?: CssPosition;
|
|
69
|
-
order?: number;
|
|
70
|
-
flexGrow?: number;
|
|
71
|
-
flexShrink?: number;
|
|
72
|
-
flexBasis?: CssFlexBasis;
|
|
73
|
-
gridArea?: string;
|
|
74
|
-
gridColumnStart?: CssGridLine;
|
|
75
|
-
gridColumnEnd?: CssGridLine;
|
|
76
|
-
gridRowStart?: CssGridLine;
|
|
77
|
-
gridRowEnd?: CssGridLine;
|
|
78
|
-
gridColumn?: CssGridPlacement;
|
|
79
|
-
gridRow?: CssGridPlacement;
|
|
80
|
-
};
|
|
81
|
-
type FrameAuthorProps = BaseAuthorProps & {
|
|
82
|
-
display?: CssDisplay;
|
|
83
|
-
visibility?: CssVisibility;
|
|
84
|
-
x?: DeckLength;
|
|
85
|
-
y?: DeckLength;
|
|
86
|
-
inset?: Spacing;
|
|
87
|
-
left?: DeckLength;
|
|
88
|
-
top?: DeckLength;
|
|
89
|
-
right?: DeckLength;
|
|
90
|
-
bottom?: DeckLength;
|
|
91
|
-
width?: DeckLength;
|
|
92
|
-
height?: DeckLength;
|
|
93
|
-
aspectRatio?: CssAspectRatio;
|
|
94
|
-
minWidth?: DeckLength;
|
|
95
|
-
minHeight?: DeckLength;
|
|
96
|
-
maxWidth?: DeckLength;
|
|
97
|
-
maxHeight?: DeckLength;
|
|
98
|
-
};
|
|
99
|
-
type BoxStyleAuthorProps = {
|
|
100
|
-
boxSizing?: CssBoxSizing;
|
|
101
|
-
background?: string;
|
|
102
|
-
backgroundImage?: string;
|
|
103
|
-
backgroundColor?: string;
|
|
104
|
-
backgroundTransparency?: number;
|
|
105
|
-
backgroundPosition?: string;
|
|
106
|
-
backgroundSize?: string;
|
|
107
|
-
backgroundRepeat?: string;
|
|
108
|
-
backgroundClip?: string;
|
|
109
|
-
backgroundOrigin?: string;
|
|
110
|
-
boxShadow?: string;
|
|
111
|
-
strokeLinecap?: StrokeLineCap;
|
|
112
|
-
strokeLinejoin?: StrokeLineJoin;
|
|
113
|
-
border?: string;
|
|
114
|
-
borderColor?: string;
|
|
115
|
-
borderWidth?: DeckLength;
|
|
116
|
-
borderStyle?: BorderStyle;
|
|
117
|
-
borderTransparency?: number;
|
|
118
|
-
borderTop?: string;
|
|
119
|
-
borderRight?: string;
|
|
120
|
-
borderBottom?: string;
|
|
121
|
-
borderLeft?: string;
|
|
122
|
-
borderTopColor?: string;
|
|
123
|
-
borderRightColor?: string;
|
|
124
|
-
borderBottomColor?: string;
|
|
125
|
-
borderLeftColor?: string;
|
|
126
|
-
borderTopWidth?: DeckLength;
|
|
127
|
-
borderRightWidth?: DeckLength;
|
|
128
|
-
borderBottomWidth?: DeckLength;
|
|
129
|
-
borderLeftWidth?: DeckLength;
|
|
130
|
-
borderTopStyle?: BorderStyle;
|
|
131
|
-
borderRightStyle?: BorderStyle;
|
|
132
|
-
borderBottomStyle?: BorderStyle;
|
|
133
|
-
borderLeftStyle?: BorderStyle;
|
|
134
|
-
borderRadius?: DeckLength;
|
|
135
|
-
outline?: string;
|
|
136
|
-
outlineColor?: string;
|
|
137
|
-
outlineWidth?: DeckLength;
|
|
138
|
-
outlineStyle?: BorderStyle;
|
|
139
|
-
margin?: Spacing;
|
|
140
|
-
marginTop?: DeckLength;
|
|
141
|
-
marginRight?: DeckLength;
|
|
142
|
-
marginBottom?: DeckLength;
|
|
143
|
-
marginLeft?: DeckLength;
|
|
144
|
-
paddingTop?: DeckLength;
|
|
145
|
-
paddingRight?: DeckLength;
|
|
146
|
-
paddingBottom?: DeckLength;
|
|
147
|
-
paddingLeft?: DeckLength;
|
|
148
|
-
};
|
|
149
|
-
type SlideStyle = {
|
|
150
|
-
background?: string;
|
|
151
|
-
backgroundImage?: string;
|
|
152
|
-
backgroundColor?: string;
|
|
153
|
-
backgroundTransparency?: number;
|
|
154
|
-
backgroundPosition?: string;
|
|
155
|
-
backgroundSize?: string;
|
|
156
|
-
backgroundRepeat?: string;
|
|
157
|
-
backgroundClip?: string;
|
|
158
|
-
backgroundOrigin?: string;
|
|
159
|
-
};
|
|
160
|
-
type ViewStyle = FrameAuthorProps & BoxStyleAuthorProps & {
|
|
161
|
-
layout?: LayoutMode;
|
|
162
|
-
display?: CssDisplay;
|
|
163
|
-
direction?: StackAxis;
|
|
164
|
-
flexDirection?: CssFlexDirection;
|
|
165
|
-
gap?: DeckLength;
|
|
166
|
-
rowGap?: DeckLength;
|
|
167
|
-
columnGap?: DeckLength;
|
|
168
|
-
padding?: Spacing;
|
|
169
|
-
alignItems?: StackAlignment | CssAlignItems;
|
|
170
|
-
justifyContent?: StackAlignment | CssJustifyContent;
|
|
171
|
-
justifyItems?: CssJustifySelf;
|
|
172
|
-
placeItems?: string;
|
|
173
|
-
alignContent?: StackAlignment | CssAlignContent;
|
|
174
|
-
placeContent?: string;
|
|
175
|
-
flexWrap?: CssFlexWrap;
|
|
176
|
-
grid?: CssGridShorthand;
|
|
177
|
-
gridTemplate?: CssGridTemplateShorthand;
|
|
178
|
-
gridTemplateAreas?: CssGridTemplateAreas;
|
|
179
|
-
gridTemplateColumns?: CssGridTemplate;
|
|
180
|
-
gridTemplateRows?: CssGridTemplate;
|
|
181
|
-
gridAutoColumns?: CssGridTrack;
|
|
182
|
-
gridAutoRows?: CssGridTrack;
|
|
183
|
-
gridAutoFlow?: CssGridAutoFlow;
|
|
184
|
-
};
|
|
185
|
-
type TextStyle = FrameAuthorProps & BoxStyleAuthorProps & {
|
|
186
|
-
fontFamily?: string;
|
|
187
|
-
fontSize?: DeckPointLength;
|
|
188
|
-
fontWeight?: number | "normal" | "bold";
|
|
189
|
-
italic?: boolean;
|
|
190
|
-
fontStyle?: "normal" | "italic";
|
|
191
|
-
underline?: boolean;
|
|
192
|
-
strike?: boolean;
|
|
193
|
-
textDecoration?: string;
|
|
194
|
-
textDecorationLine?: string;
|
|
195
|
-
textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | "wavy";
|
|
196
|
-
textDecorationColor?: string;
|
|
197
|
-
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
198
|
-
direction?: "ltr" | "rtl";
|
|
199
|
-
writingMode?: "horizontal-tb" | "vertical-rl" | "vertical-lr";
|
|
200
|
-
color?: string;
|
|
201
|
-
textAlign?: "left" | "center" | "right" | "justify";
|
|
202
|
-
verticalAlign?: VerticalAlign;
|
|
203
|
-
padding?: Spacing;
|
|
204
|
-
lineSpacing?: number;
|
|
205
|
-
lineSpacingMultiple?: number;
|
|
206
|
-
lineHeight?: DeckPointLength | "normal";
|
|
207
|
-
paragraphSpacingBefore?: number;
|
|
208
|
-
paragraphSpacingAfter?: number;
|
|
209
|
-
textIndent?: DeckPointLength;
|
|
210
|
-
tabStops?: readonly TextTabStopAuthoring[];
|
|
211
|
-
charSpacing?: number;
|
|
212
|
-
letterSpacing?: number;
|
|
213
|
-
whiteSpace?: "normal" | "nowrap" | "pre" | "pre-wrap" | "pre-line";
|
|
214
|
-
wordBreak?: "normal" | "break-all" | "keep-all" | "break-word";
|
|
215
|
-
overflowWrap?: "normal" | "break-word" | "anywhere";
|
|
216
|
-
href?: string;
|
|
217
|
-
tooltip?: string;
|
|
218
|
-
listStyleType?: "none" | "disc" | "circle" | "square" | "decimal" | "lower-alpha" | "upper-alpha" | "lower-roman" | "upper-roman";
|
|
219
|
-
listStart?: number;
|
|
220
|
-
listIndent?: DeckPointLength;
|
|
221
|
-
superscript?: boolean;
|
|
222
|
-
subscript?: boolean;
|
|
223
|
-
textShadow?: string;
|
|
224
|
-
fit?: TextFit;
|
|
225
|
-
wrap?: boolean;
|
|
226
|
-
};
|
|
227
|
-
type ImageStyle = FrameAuthorProps & {
|
|
228
|
-
fit?: "contain" | "cover" | "stretch";
|
|
229
|
-
objectFit?: "contain" | "cover" | "stretch";
|
|
230
|
-
objectPosition?: CssObjectPosition;
|
|
231
|
-
crop?: ImageCropAuthoring;
|
|
232
|
-
href?: string;
|
|
233
|
-
tooltip?: string;
|
|
234
|
-
transparency?: number;
|
|
235
|
-
rounding?: boolean;
|
|
236
|
-
borderRadius?: DeckLength;
|
|
237
|
-
boxShadow?: string;
|
|
238
|
-
margin?: Spacing;
|
|
239
|
-
marginTop?: DeckLength;
|
|
240
|
-
marginRight?: DeckLength;
|
|
241
|
-
marginBottom?: DeckLength;
|
|
242
|
-
marginLeft?: DeckLength;
|
|
243
|
-
};
|
|
244
|
-
type ShapeStyle = FrameAuthorProps & Omit<BoxStyleAuthorProps, "backgroundColor" | "backgroundTransparency" | "borderRadius"> & {
|
|
245
|
-
background?: string;
|
|
246
|
-
backgroundColor?: string;
|
|
247
|
-
backgroundTransparency?: number;
|
|
248
|
-
href?: string;
|
|
249
|
-
tooltip?: string;
|
|
250
|
-
fill?: string;
|
|
251
|
-
fillTransparency?: number;
|
|
252
|
-
stroke?: string;
|
|
253
|
-
strokeWidth?: DeckLength;
|
|
254
|
-
strokeOpacity?: number;
|
|
255
|
-
strokeDasharray?: string;
|
|
256
|
-
borderRadius?: DeckLength;
|
|
257
|
-
radius?: DeckLength;
|
|
258
|
-
};
|
|
259
|
-
type DeckOptions = {
|
|
260
|
-
layout: {
|
|
261
|
-
width: number;
|
|
262
|
-
height: number;
|
|
263
|
-
unit: "in" | "pt";
|
|
264
|
-
};
|
|
265
|
-
meta?: {
|
|
266
|
-
title?: string;
|
|
267
|
-
author?: string;
|
|
268
|
-
subject?: string;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
type SlideContext = {
|
|
272
|
-
slideIndex: number;
|
|
273
|
-
totalSlides: number;
|
|
274
|
-
};
|
|
275
|
-
type SlideFactory = (context: SlideContext) => JsxNode;
|
|
276
|
-
type OutputConfig = {
|
|
277
|
-
backend: ImplementedBackendName;
|
|
278
|
-
output: string;
|
|
279
|
-
};
|
|
280
|
-
type SlideProps = {
|
|
281
|
-
name?: string;
|
|
282
|
-
style?: SlideStyle;
|
|
283
|
-
background?: string;
|
|
284
|
-
backgroundImage?: string;
|
|
285
|
-
backgroundColor?: string;
|
|
286
|
-
backgroundTransparency?: number;
|
|
287
|
-
backgroundPosition?: string;
|
|
288
|
-
backgroundSize?: string;
|
|
289
|
-
backgroundRepeat?: string;
|
|
290
|
-
backgroundClip?: string;
|
|
291
|
-
backgroundOrigin?: string;
|
|
292
|
-
children?: ContentJsxChild;
|
|
293
|
-
};
|
|
294
|
-
type ViewProps = {
|
|
295
|
-
style?: ViewStyle;
|
|
296
|
-
children?: ContentJsxChild;
|
|
297
|
-
} & ViewStyle;
|
|
298
|
-
type TextProps = {
|
|
299
|
-
style?: TextStyle;
|
|
300
|
-
children?: TextJsxChild;
|
|
301
|
-
} & TextStyle;
|
|
302
|
-
type ImageProps = {
|
|
303
|
-
style?: ImageStyle;
|
|
304
|
-
src?: string;
|
|
305
|
-
data?: string;
|
|
306
|
-
children?: never;
|
|
307
|
-
} & ImageStyle;
|
|
308
|
-
type ShapeProps = {
|
|
309
|
-
style?: ShapeStyle;
|
|
310
|
-
shape: "rect" | "ellipse" | "line";
|
|
311
|
-
children?: never;
|
|
312
|
-
} & ShapeStyle;
|
|
313
|
-
type AuthorNodeMap = {
|
|
314
|
-
slide: SlideProps;
|
|
315
|
-
view: ViewProps;
|
|
316
|
-
text: TextProps;
|
|
317
|
-
image: ImageProps;
|
|
318
|
-
shape: ShapeProps;
|
|
319
|
-
};
|
|
320
|
-
type AuthorNodeKind = keyof AuthorNodeMap;
|
|
321
|
-
type AuthorNodeProps<K extends AuthorNodeKind> = Omit<AuthorNodeMap[K], "children">;
|
|
322
|
-
type AuthorNodePropsMap = { [NodeKind in AuthorNodeKind]: AuthorNodeProps<NodeKind> };
|
|
323
|
-
type AuthorNode<K extends AuthorNodeKind = AuthorNodeKind> = { [NodeKind in K]: {
|
|
324
|
-
readonly $$typeof: "deckjsx.author-node";
|
|
325
|
-
readonly kind: NodeKind;
|
|
326
|
-
readonly props: AuthorNodeProps<NodeKind>;
|
|
327
|
-
readonly children: ReadonlyArray<JsxNode>;
|
|
328
|
-
} }[K];
|
|
329
|
-
//#endregion
|
|
1
|
+
import { $ as ImageStyle, A as CssFlexBasis, B as CssGridTrack, C as ContentJsxChild, Ct as VerticalAlign, D as CssAspectRatio, E as CssAlignSelf, F as CssGridPlacement, G as CssPosition, H as CssJustifySelf, I as CssGridShorthand, J as DeckOptions, K as CssVisibility, L as CssGridTemplate, M as CssFlexWrap, N as CssGridAutoFlow, O as CssBoxSizing, P as CssGridLine, Q as ImageProps, R as CssGridTemplateAreas, S as ContentAuthorNode, St as TextTabStopLength, T as CssAlignItems, Tt as ViewStyle, U as CssObjectPosition, V as CssJustifyContent, W as CssOverflow, X as ImageCropAuthoring, Y as DeckPointLength, Z as ImageCropValue, _ as AuthorNodeMap, _t as TextJsxChild, a as Fragment, at as ShapeStyle, b as BackendName, bt as TextTabStopAlignment, c as Slide, ct as SlideProps, d as createElement, dt as StackAlignment, et as ImplementedBackendName, f as isAuthorNode, ft as StackAxis, g as AuthorNodeKind, gt as TextFit, h as AuthorNode, ht as StrokeLineJoin, it as ShapeProps, j as CssFlexDirection, k as CssDisplay, l as Text, lt as SlideStyle, m as isSlideNode, mt as StrokeLineCap, n as JsxKey, nt as LayoutMode, o as Image, ot as SlideContext, p as isContentNode, pt as StrokeDashType, q as DeckLength, rt as OutputConfig, s as Shape, st as SlideFactory, tt as JsxNode, u as View, ut as Spacing, v as AuthorNodeProps, vt as TextProps, w as CssAlignContent, wt as ViewProps, x as BorderStyle, xt as TextTabStopAuthoring, y as AuthorNodePropsMap, yt as TextStyle, z as CssGridTemplateShorthand } from "./jsx-runtime-BfZK5259.mjs";
|
|
2
|
+
|
|
330
3
|
//#region src/ir/index.d.ts
|
|
331
4
|
type PresentationIR = {
|
|
332
5
|
version: "0.1";
|
|
@@ -573,32 +246,6 @@ declare class Deck {
|
|
|
573
246
|
output(config: OutputConfig): Promise<void>;
|
|
574
247
|
}
|
|
575
248
|
//#endregion
|
|
576
|
-
//#region src/jsx.d.ts
|
|
577
|
-
type ComponentProps = {
|
|
578
|
-
children?: JsxNode;
|
|
579
|
-
};
|
|
580
|
-
type ElementChildren<P> = P extends {
|
|
581
|
-
children?: infer Child;
|
|
582
|
-
} ? Child : never;
|
|
583
|
-
type ElementChildArgs<P> = P extends {
|
|
584
|
-
children?: never;
|
|
585
|
-
} ? [] : ElementChildren<P>[];
|
|
586
|
-
declare function createElement<P extends {
|
|
587
|
-
children?: unknown;
|
|
588
|
-
}, R extends JsxNode>(type: (props: P) => R, props: (Omit<P, "children"> & Partial<Pick<P, "children">>) | null, ...children: ElementChildArgs<P>): R;
|
|
589
|
-
declare function createElement(type: string, props: ComponentProps | null): never;
|
|
590
|
-
declare function Fragment(props: {
|
|
591
|
-
children?: ContentJsxChild;
|
|
592
|
-
}): ContentJsxChild;
|
|
593
|
-
declare function Slide(props: SlideProps): AuthorNode<"slide">;
|
|
594
|
-
declare function View(props: ViewProps): AuthorNode<"view">;
|
|
595
|
-
declare function Text(props: TextProps): AuthorNode<"text">;
|
|
596
|
-
declare function Image(props: ImageProps): AuthorNode<"image">;
|
|
597
|
-
declare function Shape(props: ShapeProps): AuthorNode<"shape">;
|
|
598
|
-
declare function isAuthorNode(value: unknown): value is AuthorNode;
|
|
599
|
-
declare function isSlideNode(value: unknown): value is AuthorNode<"slide">;
|
|
600
|
-
declare function isContentNode(value: unknown): value is ContentAuthorNode;
|
|
601
|
-
//#endregion
|
|
602
249
|
//#region src/backends/pptxgenjs.d.ts
|
|
603
250
|
declare function pptxgenjsBackend(): CompileBackend;
|
|
604
251
|
//#endregion
|
|
@@ -606,4 +253,18 @@ declare function pptxgenjsBackend(): CompileBackend;
|
|
|
606
253
|
declare const EMU_PER_INCH = 914400;
|
|
607
254
|
declare const POINTS_PER_INCH = 72;
|
|
608
255
|
//#endregion
|
|
609
|
-
|
|
256
|
+
//#region src/index.d.ts
|
|
257
|
+
declare global {
|
|
258
|
+
namespace JSX {
|
|
259
|
+
type Element = ContentJsxChild;
|
|
260
|
+
interface ElementChildrenAttribute {
|
|
261
|
+
children: {};
|
|
262
|
+
}
|
|
263
|
+
interface IntrinsicAttributes {
|
|
264
|
+
key?: JsxKey;
|
|
265
|
+
}
|
|
266
|
+
interface IntrinsicElements {}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
270
|
+
export { type AuthorNode, type AuthorNodeKind, type AuthorNodeMap, type AuthorNodeProps, type AuthorNodePropsMap, type BackendArtifact, type BackendName, type BackgroundImageLayerIR, type BackgroundLayerIR, type BaseNodeIR, type BorderStyle, type CompileBackend, type ContentAuthorNode, type ContentJsxChild, type CssAlignContent, type CssAlignItems, type CssAlignSelf, type CssAspectRatio, type CssBoxSizing, type CssDisplay, type CssFlexBasis, type CssFlexDirection, type CssFlexWrap, type CssGridAutoFlow, type CssGridLine, type CssGridPlacement, type CssGridShorthand, type CssGridTemplate, type CssGridTemplateAreas, type CssGridTemplateShorthand, type CssGridTrack, type CssJustifyContent, type CssJustifySelf, type CssObjectPosition, type CssOverflow, type CssPosition, type CssVisibility, Deck, type DeckLength, type DeckOptions, type DeckPointLength, EMU_PER_INCH, type EdgeStrokeIR, type FillIR, Fragment, type FrameIR, type GroupIR, type HyperlinkIR, Image, type ImageCropAuthoring, type ImageCropIR, type ImageCropValue, type ImageIR, type ImageProps, type ImageSourceIR, type ImageStyle, type ImplementedBackendName, type JsxKey, type JsxNode, type LayoutMode, type LinearGradientFillIR, type LinearGradientStopIR, type NodeIR, type ObjectPositionIR, type OutputConfig, POINTS_PER_INCH, type PresentationIR, type RadialGradientFillIR, type ShadowIR, Shape, type ShapeIR, type ShapeProps, type ShapeStyle, type SizeIR, Slide, type SlideContext, type SlideFactory, type SlideIR, type SlideProps, type SlideStyle, type SolidFillIR, type Spacing, type StackAlignment, type StackAxis, type StrokeDashType, type StrokeIR, type StrokeLineCap, type StrokeLineJoin, Text, type TextBulletListIR, type TextContentIR, type TextFit, type TextIR, type TextJsxChild, type TextListIR, type TextNoListIR, type TextNumberListIR, type TextProps, type TextStyle, type TextStyleIR, type TextTabStopAlignment, type TextTabStopAuthoring, type TextTabStopIR, type TextTabStopLength, type VerticalAlign, View, type ViewProps, type ViewStyle, createElement, isAuthorNode, isContentNode, isSlideNode, pptxgenjsBackend };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as Text, c as isAuthorNode, i as Slide, l as isContentNode, n as Image, o as View, r as Shape, s as createElement, t as Fragment, u as isSlideNode } from "./jsx-Cj45FgcC.mjs";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
4
|
import { dirname } from "node:path";
|
|
@@ -27,71 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
28
|
}) : target, mod));
|
|
28
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
29
30
|
//#endregion
|
|
30
|
-
//#region src/jsx.ts
|
|
31
|
-
function isRecord(value) {
|
|
32
|
-
return typeof value === "object" && value !== null;
|
|
33
|
-
}
|
|
34
|
-
function isJsxNode(value) {
|
|
35
|
-
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || isAuthorNode(value) || Array.isArray(value) && value.every((item) => isJsxNode(item));
|
|
36
|
-
}
|
|
37
|
-
function requireJsxNode(value) {
|
|
38
|
-
if (isJsxNode(value)) return value;
|
|
39
|
-
throw new Error("JSX children must be deckjsx nodes or primitive text values.");
|
|
40
|
-
}
|
|
41
|
-
function flattenChildren(input) {
|
|
42
|
-
if (Array.isArray(input)) return input.flatMap((item) => flattenChildren(item));
|
|
43
|
-
return [input];
|
|
44
|
-
}
|
|
45
|
-
function authorNode(kind, props) {
|
|
46
|
-
const { children: rawChildren, ...nodeProps } = props;
|
|
47
|
-
return {
|
|
48
|
-
$$typeof: "deckjsx.author-node",
|
|
49
|
-
kind,
|
|
50
|
-
props: nodeProps,
|
|
51
|
-
children: rawChildren === void 0 ? [] : flattenChildren(rawChildren)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function createElement(type, props, ...children) {
|
|
55
|
-
if (typeof type === "string") throw new Error(`Intrinsic elements are not supported: <${type}>.`);
|
|
56
|
-
if (typeof type !== "function") throw new Error("JSX element type must be a function component.");
|
|
57
|
-
const propsObject = isRecord(props) ? props : {};
|
|
58
|
-
return type({
|
|
59
|
-
...propsObject,
|
|
60
|
-
children: children.length === 0 ? requireJsxNode(propsObject.children) : children.length === 1 ? requireJsxNode(children[0]) : children.map((child) => requireJsxNode(child))
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function Fragment(props) {
|
|
64
|
-
return props.children ?? null;
|
|
65
|
-
}
|
|
66
|
-
function Slide(props) {
|
|
67
|
-
return authorNode("slide", props);
|
|
68
|
-
}
|
|
69
|
-
function View(props) {
|
|
70
|
-
return authorNode("view", props);
|
|
71
|
-
}
|
|
72
|
-
function Text(props) {
|
|
73
|
-
return authorNode("text", props);
|
|
74
|
-
}
|
|
75
|
-
function Image(props) {
|
|
76
|
-
return authorNode("image", props);
|
|
77
|
-
}
|
|
78
|
-
function Shape(props) {
|
|
79
|
-
return authorNode("shape", props);
|
|
80
|
-
}
|
|
81
|
-
function isAuthorNodeKind(value) {
|
|
82
|
-
return value === "slide" || value === "view" || value === "text" || value === "image" || value === "shape";
|
|
83
|
-
}
|
|
84
|
-
function isAuthorNode(value) {
|
|
85
|
-
if (!isRecord(value)) return false;
|
|
86
|
-
return value.$$typeof === "deckjsx.author-node" && isAuthorNodeKind(value.kind) && isRecord(value.props) && Array.isArray(value.children);
|
|
87
|
-
}
|
|
88
|
-
function isSlideNode(value) {
|
|
89
|
-
return isAuthorNode(value) && value.kind === "slide";
|
|
90
|
-
}
|
|
91
|
-
function isContentNode(value) {
|
|
92
|
-
return isAuthorNode(value) && value.kind !== "slide";
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
31
|
//#region src/types.ts
|
|
96
32
|
const EMU_PER_INCH = 914400;
|
|
97
33
|
const POINTS_PER_INCH = 72;
|
|
@@ -14937,7 +14873,15 @@ const TRANSPARENT_LINE = {
|
|
|
14937
14873
|
width: 0
|
|
14938
14874
|
};
|
|
14939
14875
|
const PPTX_MIME_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
14940
|
-
|
|
14876
|
+
function resolvePptxGenJSConstructor(moduleValue) {
|
|
14877
|
+
if (typeof moduleValue === "function") return moduleValue;
|
|
14878
|
+
if (typeof moduleValue === "object" && moduleValue !== null && "default" in moduleValue) {
|
|
14879
|
+
const defaultExport = moduleValue.default;
|
|
14880
|
+
if (typeof defaultExport === "function") return defaultExport;
|
|
14881
|
+
}
|
|
14882
|
+
throw new Error("Unable to resolve PptxGenJS constructor.");
|
|
14883
|
+
}
|
|
14884
|
+
const PptxGenJS = resolvePptxGenJSConstructor(PptxGenJSModule);
|
|
14941
14885
|
function emuToInches(value) {
|
|
14942
14886
|
return value / EMU_PER_INCH;
|
|
14943
14887
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/jsx.ts
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null;
|
|
4
|
+
}
|
|
5
|
+
function isJsxNode(value) {
|
|
6
|
+
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || isAuthorNode(value) || Array.isArray(value) && value.every((item) => isJsxNode(item));
|
|
7
|
+
}
|
|
8
|
+
function requireJsxNode(value) {
|
|
9
|
+
if (isJsxNode(value)) return value;
|
|
10
|
+
throw new Error("JSX children must be deckjsx nodes or primitive text values.");
|
|
11
|
+
}
|
|
12
|
+
function flattenChildren(input) {
|
|
13
|
+
if (Array.isArray(input)) return input.flatMap((item) => flattenChildren(item));
|
|
14
|
+
return [input];
|
|
15
|
+
}
|
|
16
|
+
function splitContentProps(props) {
|
|
17
|
+
const { children: rawChildren, ...nodeProps } = props;
|
|
18
|
+
return {
|
|
19
|
+
props: nodeProps,
|
|
20
|
+
children: rawChildren === void 0 ? [] : flattenChildren(rawChildren)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function splitTextProps(props) {
|
|
24
|
+
const { children: rawChildren, ...nodeProps } = props;
|
|
25
|
+
return {
|
|
26
|
+
props: nodeProps,
|
|
27
|
+
children: rawChildren === void 0 ? [] : flattenChildren(rawChildren)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function splitLeafProps(props) {
|
|
31
|
+
const { children: _rawChildren, ...nodeProps } = props;
|
|
32
|
+
return nodeProps;
|
|
33
|
+
}
|
|
34
|
+
function createElement(type, props, ...children) {
|
|
35
|
+
if (typeof type === "string") throw new Error(`Intrinsic elements are not supported: <${type}>.`);
|
|
36
|
+
if (typeof type !== "function") throw new Error("JSX element type must be a function component.");
|
|
37
|
+
const propsObject = isRecord(props) ? props : {};
|
|
38
|
+
return type({
|
|
39
|
+
...propsObject,
|
|
40
|
+
children: children.length === 0 ? requireJsxNode(propsObject.children) : children.length === 1 ? requireJsxNode(children[0]) : children.map((child) => requireJsxNode(child))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function Fragment(props) {
|
|
44
|
+
return props.children ?? null;
|
|
45
|
+
}
|
|
46
|
+
function Slide(props) {
|
|
47
|
+
const authored = splitContentProps(props);
|
|
48
|
+
return {
|
|
49
|
+
$$typeof: "deckjsx.author-node",
|
|
50
|
+
kind: "slide",
|
|
51
|
+
props: authored.props,
|
|
52
|
+
children: authored.children
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function View(props) {
|
|
56
|
+
const authored = splitContentProps(props);
|
|
57
|
+
return {
|
|
58
|
+
$$typeof: "deckjsx.author-node",
|
|
59
|
+
kind: "view",
|
|
60
|
+
props: authored.props,
|
|
61
|
+
children: authored.children
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function Text(props) {
|
|
65
|
+
const authored = splitTextProps(props);
|
|
66
|
+
return {
|
|
67
|
+
$$typeof: "deckjsx.author-node",
|
|
68
|
+
kind: "text",
|
|
69
|
+
props: authored.props,
|
|
70
|
+
children: authored.children
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function Image(props) {
|
|
74
|
+
return {
|
|
75
|
+
$$typeof: "deckjsx.author-node",
|
|
76
|
+
kind: "image",
|
|
77
|
+
props: splitLeafProps(props),
|
|
78
|
+
children: []
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function Shape(props) {
|
|
82
|
+
return {
|
|
83
|
+
$$typeof: "deckjsx.author-node",
|
|
84
|
+
kind: "shape",
|
|
85
|
+
props: splitLeafProps(props),
|
|
86
|
+
children: []
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function isAuthorNodeKind(value) {
|
|
90
|
+
return value === "slide" || value === "view" || value === "text" || value === "image" || value === "shape";
|
|
91
|
+
}
|
|
92
|
+
function isAuthorNode(value) {
|
|
93
|
+
if (!isRecord(value)) return false;
|
|
94
|
+
return value.$$typeof === "deckjsx.author-node" && isAuthorNodeKind(value.kind) && isRecord(value.props) && Array.isArray(value.children);
|
|
95
|
+
}
|
|
96
|
+
function isSlideNode(value) {
|
|
97
|
+
return isAuthorNode(value) && value.kind === "slide";
|
|
98
|
+
}
|
|
99
|
+
function isContentNode(value) {
|
|
100
|
+
return isAuthorNode(value) && value.kind !== "slide";
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { Text as a, isAuthorNode as c, Slide as i, isContentNode as l, Image as n, View as o, Shape as r, createElement as s, Fragment as t, isSlideNode as u };
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
//#region src/authoring/index.d.ts
|
|
2
|
+
type DeckLength = number | `${number}${"in" | "pt" | "px" | "%" | "em" | "rem" | "vh" | "vw" | "ch"}`;
|
|
3
|
+
type DeckPointLength = number | `${number}${"pt" | "in" | "px" | "em" | "rem" | "vh" | "vw" | "ch"}`;
|
|
4
|
+
type CssAspectRatio = number | `${number}/${number}` | `${number} / ${number}`;
|
|
5
|
+
type CssBoxSizing = "border-box" | "content-box";
|
|
6
|
+
type Spacing = DeckLength | readonly [DeckLength, DeckLength, DeckLength, DeckLength];
|
|
7
|
+
type StackAxis = "horizontal" | "vertical";
|
|
8
|
+
type StackAlignment = "start" | "center" | "end";
|
|
9
|
+
type LayoutMode = "absolute" | "stack" | "grid";
|
|
10
|
+
type BackendName = "pptxgenjs" | "ooxml";
|
|
11
|
+
type ImplementedBackendName = "pptxgenjs";
|
|
12
|
+
type BorderStyle = "none" | "solid" | "dash";
|
|
13
|
+
type StrokeDashType = "solid" | "dash" | "dashDot" | "lgDash" | "lgDashDot" | "lgDashDotDot" | "sysDash" | "sysDot";
|
|
14
|
+
type StrokeLineCap = "butt" | "round" | "square";
|
|
15
|
+
type StrokeLineJoin = "miter" | "round" | "bevel";
|
|
16
|
+
type VerticalAlign = "top" | "middle" | "bottom";
|
|
17
|
+
type TextFit = "none" | "shrink" | "resize";
|
|
18
|
+
type CssDisplay = "flex" | "block" | "grid" | "none";
|
|
19
|
+
type CssPosition = "absolute" | "relative";
|
|
20
|
+
type CssVisibility = "visible" | "hidden";
|
|
21
|
+
type CssOverflow = "visible" | "hidden";
|
|
22
|
+
type CssFlexDirection = "row" | "column";
|
|
23
|
+
type CssGridTrack = DeckLength | `${number}fr` | `minmax(${string})`;
|
|
24
|
+
type CssGridTemplate = readonly CssGridTrack[] | string;
|
|
25
|
+
type CssGridLine = number | "auto" | `span ${number}`;
|
|
26
|
+
type CssGridPlacement = number | `span ${number}` | `${number} / ${number}` | `${number}/${number}` | `${number} / span ${number}` | `${number}/span${number}`;
|
|
27
|
+
type CssAlignItems = "start" | "flex-start" | "center" | "end" | "flex-end" | "stretch";
|
|
28
|
+
type CssAlignSelf = CssAlignItems | "auto";
|
|
29
|
+
type CssJustifySelf = CssAlignItems | "auto";
|
|
30
|
+
type CssJustifyContent = "start" | "flex-start" | "center" | "end" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
31
|
+
type CssAlignContent = "start" | "flex-start" | "center" | "end" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
32
|
+
type CssFlexWrap = "nowrap" | "wrap";
|
|
33
|
+
type CssFlexBasis = DeckLength | "auto";
|
|
34
|
+
type CssGridAutoFlow = "row" | "column" | "row dense" | "column dense";
|
|
35
|
+
type CssGridTemplateAreas = string | readonly string[];
|
|
36
|
+
type CssGridTemplateShorthand = string;
|
|
37
|
+
type CssGridShorthand = string;
|
|
38
|
+
type CssObjectPosition = string;
|
|
39
|
+
type ImageCropValue = number | `${number}%`;
|
|
40
|
+
type TextTabStopLength = DeckPointLength;
|
|
41
|
+
type TextTabStopAlignment = "left" | "right" | "center" | "decimal";
|
|
42
|
+
type TextTabStopAuthoring = {
|
|
43
|
+
position: TextTabStopLength;
|
|
44
|
+
alignment?: TextTabStopAlignment;
|
|
45
|
+
};
|
|
46
|
+
type ImageCropAuthoring = {
|
|
47
|
+
top?: ImageCropValue;
|
|
48
|
+
right?: ImageCropValue;
|
|
49
|
+
bottom?: ImageCropValue;
|
|
50
|
+
left?: ImageCropValue;
|
|
51
|
+
};
|
|
52
|
+
interface TextJsxChildArray extends ReadonlyArray<TextJsxChild> {}
|
|
53
|
+
type TextJsxChild = string | number | boolean | null | undefined | TextJsxChildArray;
|
|
54
|
+
type ContentAuthorNode = AuthorNode<"view" | "text" | "image" | "shape">;
|
|
55
|
+
interface ContentJsxChildArray extends ReadonlyArray<ContentJsxChild> {}
|
|
56
|
+
type ContentJsxChild = AuthorNode | boolean | null | undefined | ContentJsxChildArray;
|
|
57
|
+
interface JsxNodeArray extends ReadonlyArray<JsxNode> {}
|
|
58
|
+
type JsxNode = AuthorNode | string | number | boolean | null | undefined | JsxNodeArray;
|
|
59
|
+
type BaseAuthorProps = {
|
|
60
|
+
opacity?: number;
|
|
61
|
+
rotation?: number;
|
|
62
|
+
transform?: string;
|
|
63
|
+
transformOrigin?: string;
|
|
64
|
+
zIndex?: number;
|
|
65
|
+
flipH?: boolean;
|
|
66
|
+
flipV?: boolean;
|
|
67
|
+
overflow?: CssOverflow;
|
|
68
|
+
alignSelf?: CssAlignSelf;
|
|
69
|
+
justifySelf?: CssJustifySelf;
|
|
70
|
+
placeSelf?: string;
|
|
71
|
+
position?: CssPosition;
|
|
72
|
+
order?: number;
|
|
73
|
+
flexGrow?: number;
|
|
74
|
+
flexShrink?: number;
|
|
75
|
+
flexBasis?: CssFlexBasis;
|
|
76
|
+
gridArea?: string;
|
|
77
|
+
gridColumnStart?: CssGridLine;
|
|
78
|
+
gridColumnEnd?: CssGridLine;
|
|
79
|
+
gridRowStart?: CssGridLine;
|
|
80
|
+
gridRowEnd?: CssGridLine;
|
|
81
|
+
gridColumn?: CssGridPlacement;
|
|
82
|
+
gridRow?: CssGridPlacement;
|
|
83
|
+
};
|
|
84
|
+
type FrameAuthorProps = BaseAuthorProps & {
|
|
85
|
+
display?: CssDisplay;
|
|
86
|
+
visibility?: CssVisibility;
|
|
87
|
+
x?: DeckLength;
|
|
88
|
+
y?: DeckLength;
|
|
89
|
+
inset?: Spacing;
|
|
90
|
+
left?: DeckLength;
|
|
91
|
+
top?: DeckLength;
|
|
92
|
+
right?: DeckLength;
|
|
93
|
+
bottom?: DeckLength;
|
|
94
|
+
width?: DeckLength;
|
|
95
|
+
height?: DeckLength;
|
|
96
|
+
aspectRatio?: CssAspectRatio;
|
|
97
|
+
minWidth?: DeckLength;
|
|
98
|
+
minHeight?: DeckLength;
|
|
99
|
+
maxWidth?: DeckLength;
|
|
100
|
+
maxHeight?: DeckLength;
|
|
101
|
+
};
|
|
102
|
+
type BoxStyleAuthorProps = {
|
|
103
|
+
boxSizing?: CssBoxSizing;
|
|
104
|
+
background?: string;
|
|
105
|
+
backgroundImage?: string;
|
|
106
|
+
backgroundColor?: string;
|
|
107
|
+
backgroundTransparency?: number;
|
|
108
|
+
backgroundPosition?: string;
|
|
109
|
+
backgroundSize?: string;
|
|
110
|
+
backgroundRepeat?: string;
|
|
111
|
+
backgroundClip?: string;
|
|
112
|
+
backgroundOrigin?: string;
|
|
113
|
+
boxShadow?: string;
|
|
114
|
+
strokeLinecap?: StrokeLineCap;
|
|
115
|
+
strokeLinejoin?: StrokeLineJoin;
|
|
116
|
+
border?: string;
|
|
117
|
+
borderColor?: string;
|
|
118
|
+
borderWidth?: DeckLength;
|
|
119
|
+
borderStyle?: BorderStyle;
|
|
120
|
+
borderTransparency?: number;
|
|
121
|
+
borderTop?: string;
|
|
122
|
+
borderRight?: string;
|
|
123
|
+
borderBottom?: string;
|
|
124
|
+
borderLeft?: string;
|
|
125
|
+
borderTopColor?: string;
|
|
126
|
+
borderRightColor?: string;
|
|
127
|
+
borderBottomColor?: string;
|
|
128
|
+
borderLeftColor?: string;
|
|
129
|
+
borderTopWidth?: DeckLength;
|
|
130
|
+
borderRightWidth?: DeckLength;
|
|
131
|
+
borderBottomWidth?: DeckLength;
|
|
132
|
+
borderLeftWidth?: DeckLength;
|
|
133
|
+
borderTopStyle?: BorderStyle;
|
|
134
|
+
borderRightStyle?: BorderStyle;
|
|
135
|
+
borderBottomStyle?: BorderStyle;
|
|
136
|
+
borderLeftStyle?: BorderStyle;
|
|
137
|
+
borderRadius?: DeckLength;
|
|
138
|
+
outline?: string;
|
|
139
|
+
outlineColor?: string;
|
|
140
|
+
outlineWidth?: DeckLength;
|
|
141
|
+
outlineStyle?: BorderStyle;
|
|
142
|
+
margin?: Spacing;
|
|
143
|
+
marginTop?: DeckLength;
|
|
144
|
+
marginRight?: DeckLength;
|
|
145
|
+
marginBottom?: DeckLength;
|
|
146
|
+
marginLeft?: DeckLength;
|
|
147
|
+
paddingTop?: DeckLength;
|
|
148
|
+
paddingRight?: DeckLength;
|
|
149
|
+
paddingBottom?: DeckLength;
|
|
150
|
+
paddingLeft?: DeckLength;
|
|
151
|
+
};
|
|
152
|
+
type SlideStyle = {
|
|
153
|
+
background?: string;
|
|
154
|
+
backgroundImage?: string;
|
|
155
|
+
backgroundColor?: string;
|
|
156
|
+
backgroundTransparency?: number;
|
|
157
|
+
backgroundPosition?: string;
|
|
158
|
+
backgroundSize?: string;
|
|
159
|
+
backgroundRepeat?: string;
|
|
160
|
+
backgroundClip?: string;
|
|
161
|
+
backgroundOrigin?: string;
|
|
162
|
+
};
|
|
163
|
+
type ViewStyle = FrameAuthorProps & BoxStyleAuthorProps & {
|
|
164
|
+
layout?: LayoutMode;
|
|
165
|
+
display?: CssDisplay;
|
|
166
|
+
direction?: StackAxis;
|
|
167
|
+
flexDirection?: CssFlexDirection;
|
|
168
|
+
gap?: DeckLength;
|
|
169
|
+
rowGap?: DeckLength;
|
|
170
|
+
columnGap?: DeckLength;
|
|
171
|
+
padding?: Spacing;
|
|
172
|
+
alignItems?: StackAlignment | CssAlignItems;
|
|
173
|
+
justifyContent?: StackAlignment | CssJustifyContent;
|
|
174
|
+
justifyItems?: CssJustifySelf;
|
|
175
|
+
placeItems?: string;
|
|
176
|
+
alignContent?: StackAlignment | CssAlignContent;
|
|
177
|
+
placeContent?: string;
|
|
178
|
+
flexWrap?: CssFlexWrap;
|
|
179
|
+
grid?: CssGridShorthand;
|
|
180
|
+
gridTemplate?: CssGridTemplateShorthand;
|
|
181
|
+
gridTemplateAreas?: CssGridTemplateAreas;
|
|
182
|
+
gridTemplateColumns?: CssGridTemplate;
|
|
183
|
+
gridTemplateRows?: CssGridTemplate;
|
|
184
|
+
gridAutoColumns?: CssGridTrack;
|
|
185
|
+
gridAutoRows?: CssGridTrack;
|
|
186
|
+
gridAutoFlow?: CssGridAutoFlow;
|
|
187
|
+
};
|
|
188
|
+
type TextStyle = FrameAuthorProps & BoxStyleAuthorProps & {
|
|
189
|
+
fontFamily?: string;
|
|
190
|
+
fontSize?: DeckPointLength;
|
|
191
|
+
fontWeight?: number | "normal" | "bold";
|
|
192
|
+
italic?: boolean;
|
|
193
|
+
fontStyle?: "normal" | "italic";
|
|
194
|
+
underline?: boolean;
|
|
195
|
+
strike?: boolean;
|
|
196
|
+
textDecoration?: string;
|
|
197
|
+
textDecorationLine?: string;
|
|
198
|
+
textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | "wavy";
|
|
199
|
+
textDecorationColor?: string;
|
|
200
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
201
|
+
direction?: "ltr" | "rtl";
|
|
202
|
+
writingMode?: "horizontal-tb" | "vertical-rl" | "vertical-lr";
|
|
203
|
+
color?: string;
|
|
204
|
+
textAlign?: "left" | "center" | "right" | "justify";
|
|
205
|
+
verticalAlign?: VerticalAlign;
|
|
206
|
+
padding?: Spacing;
|
|
207
|
+
lineSpacing?: number;
|
|
208
|
+
lineSpacingMultiple?: number;
|
|
209
|
+
lineHeight?: DeckPointLength | "normal";
|
|
210
|
+
paragraphSpacingBefore?: number;
|
|
211
|
+
paragraphSpacingAfter?: number;
|
|
212
|
+
textIndent?: DeckPointLength;
|
|
213
|
+
tabStops?: readonly TextTabStopAuthoring[];
|
|
214
|
+
charSpacing?: number;
|
|
215
|
+
letterSpacing?: number;
|
|
216
|
+
whiteSpace?: "normal" | "nowrap" | "pre" | "pre-wrap" | "pre-line";
|
|
217
|
+
wordBreak?: "normal" | "break-all" | "keep-all" | "break-word";
|
|
218
|
+
overflowWrap?: "normal" | "break-word" | "anywhere";
|
|
219
|
+
href?: string;
|
|
220
|
+
tooltip?: string;
|
|
221
|
+
listStyleType?: "none" | "disc" | "circle" | "square" | "decimal" | "lower-alpha" | "upper-alpha" | "lower-roman" | "upper-roman";
|
|
222
|
+
listStart?: number;
|
|
223
|
+
listIndent?: DeckPointLength;
|
|
224
|
+
superscript?: boolean;
|
|
225
|
+
subscript?: boolean;
|
|
226
|
+
textShadow?: string;
|
|
227
|
+
fit?: TextFit;
|
|
228
|
+
wrap?: boolean;
|
|
229
|
+
};
|
|
230
|
+
type ImageStyle = FrameAuthorProps & {
|
|
231
|
+
fit?: "contain" | "cover" | "stretch";
|
|
232
|
+
objectFit?: "contain" | "cover" | "stretch";
|
|
233
|
+
objectPosition?: CssObjectPosition;
|
|
234
|
+
crop?: ImageCropAuthoring;
|
|
235
|
+
href?: string;
|
|
236
|
+
tooltip?: string;
|
|
237
|
+
transparency?: number;
|
|
238
|
+
rounding?: boolean;
|
|
239
|
+
borderRadius?: DeckLength;
|
|
240
|
+
boxShadow?: string;
|
|
241
|
+
margin?: Spacing;
|
|
242
|
+
marginTop?: DeckLength;
|
|
243
|
+
marginRight?: DeckLength;
|
|
244
|
+
marginBottom?: DeckLength;
|
|
245
|
+
marginLeft?: DeckLength;
|
|
246
|
+
};
|
|
247
|
+
type ShapeStyle = FrameAuthorProps & Omit<BoxStyleAuthorProps, "backgroundColor" | "backgroundTransparency" | "borderRadius"> & {
|
|
248
|
+
background?: string;
|
|
249
|
+
backgroundColor?: string;
|
|
250
|
+
backgroundTransparency?: number;
|
|
251
|
+
href?: string;
|
|
252
|
+
tooltip?: string;
|
|
253
|
+
fill?: string;
|
|
254
|
+
fillTransparency?: number;
|
|
255
|
+
stroke?: string;
|
|
256
|
+
strokeWidth?: DeckLength;
|
|
257
|
+
strokeOpacity?: number;
|
|
258
|
+
strokeDasharray?: string;
|
|
259
|
+
borderRadius?: DeckLength;
|
|
260
|
+
radius?: DeckLength;
|
|
261
|
+
};
|
|
262
|
+
type DeckOptions = {
|
|
263
|
+
layout: {
|
|
264
|
+
width: number;
|
|
265
|
+
height: number;
|
|
266
|
+
unit: "in" | "pt";
|
|
267
|
+
};
|
|
268
|
+
meta?: {
|
|
269
|
+
title?: string;
|
|
270
|
+
author?: string;
|
|
271
|
+
subject?: string;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
type SlideContext = {
|
|
275
|
+
slideIndex: number;
|
|
276
|
+
totalSlides: number;
|
|
277
|
+
};
|
|
278
|
+
type SlideFactory = (context: SlideContext) => JsxNode;
|
|
279
|
+
type OutputConfig = {
|
|
280
|
+
backend: ImplementedBackendName;
|
|
281
|
+
output: string;
|
|
282
|
+
};
|
|
283
|
+
type SlideNodeProps = {
|
|
284
|
+
name?: string;
|
|
285
|
+
style?: SlideStyle;
|
|
286
|
+
background?: string;
|
|
287
|
+
backgroundImage?: string;
|
|
288
|
+
backgroundColor?: string;
|
|
289
|
+
backgroundTransparency?: number;
|
|
290
|
+
backgroundPosition?: string;
|
|
291
|
+
backgroundSize?: string;
|
|
292
|
+
backgroundRepeat?: string;
|
|
293
|
+
backgroundClip?: string;
|
|
294
|
+
backgroundOrigin?: string;
|
|
295
|
+
};
|
|
296
|
+
type SlideProps = SlideNodeProps & {
|
|
297
|
+
children?: ContentJsxChild;
|
|
298
|
+
};
|
|
299
|
+
type ViewNodeProps = {
|
|
300
|
+
style?: ViewStyle;
|
|
301
|
+
} & ViewStyle;
|
|
302
|
+
type ViewProps = ViewNodeProps & {
|
|
303
|
+
children?: ContentJsxChild;
|
|
304
|
+
};
|
|
305
|
+
type TextNodeProps = {
|
|
306
|
+
style?: TextStyle;
|
|
307
|
+
} & TextStyle;
|
|
308
|
+
type TextProps = TextNodeProps & {
|
|
309
|
+
children?: TextJsxChild;
|
|
310
|
+
};
|
|
311
|
+
type ImageNodeProps = {
|
|
312
|
+
style?: ImageStyle;
|
|
313
|
+
src?: string;
|
|
314
|
+
data?: string;
|
|
315
|
+
} & ImageStyle;
|
|
316
|
+
type ImageProps = ImageNodeProps & {
|
|
317
|
+
children?: never;
|
|
318
|
+
};
|
|
319
|
+
type ShapeNodeProps = {
|
|
320
|
+
style?: ShapeStyle;
|
|
321
|
+
shape: "rect" | "ellipse" | "line";
|
|
322
|
+
} & ShapeStyle;
|
|
323
|
+
type ShapeProps = ShapeNodeProps & {
|
|
324
|
+
children?: never;
|
|
325
|
+
};
|
|
326
|
+
type AuthorNodeMap = {
|
|
327
|
+
slide: SlideProps;
|
|
328
|
+
view: ViewProps;
|
|
329
|
+
text: TextProps;
|
|
330
|
+
image: ImageProps;
|
|
331
|
+
shape: ShapeProps;
|
|
332
|
+
};
|
|
333
|
+
type AuthorNodeKind = keyof AuthorNodeMap;
|
|
334
|
+
type AuthorNodePropsMap = {
|
|
335
|
+
slide: SlideNodeProps;
|
|
336
|
+
view: ViewNodeProps;
|
|
337
|
+
text: TextNodeProps;
|
|
338
|
+
image: ImageNodeProps;
|
|
339
|
+
shape: ShapeNodeProps;
|
|
340
|
+
};
|
|
341
|
+
type AuthorNodeProps<K extends AuthorNodeKind> = AuthorNodePropsMap[K];
|
|
342
|
+
type BaseAuthorNode<K extends AuthorNodeKind, P, C> = {
|
|
343
|
+
readonly $$typeof: "deckjsx.author-node";
|
|
344
|
+
readonly kind: K;
|
|
345
|
+
readonly props: P;
|
|
346
|
+
readonly children: ReadonlyArray<C>;
|
|
347
|
+
};
|
|
348
|
+
interface SlideAuthorNode extends BaseAuthorNode<"slide", SlideNodeProps, ContentJsxChild> {}
|
|
349
|
+
interface ViewAuthorNode extends BaseAuthorNode<"view", ViewNodeProps, ContentJsxChild> {}
|
|
350
|
+
interface TextAuthorNode extends BaseAuthorNode<"text", TextNodeProps, TextJsxChild> {}
|
|
351
|
+
interface ImageAuthorNode extends BaseAuthorNode<"image", ImageNodeProps, never> {}
|
|
352
|
+
interface ShapeAuthorNode extends BaseAuthorNode<"shape", ShapeNodeProps, never> {}
|
|
353
|
+
type AuthorNodeByKind = {
|
|
354
|
+
slide: SlideAuthorNode;
|
|
355
|
+
view: ViewAuthorNode;
|
|
356
|
+
text: TextAuthorNode;
|
|
357
|
+
image: ImageAuthorNode;
|
|
358
|
+
shape: ShapeAuthorNode;
|
|
359
|
+
};
|
|
360
|
+
type AuthorNode<K extends AuthorNodeKind = AuthorNodeKind> = AuthorNodeByKind[K];
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/jsx.d.ts
|
|
363
|
+
type ComponentProps = {
|
|
364
|
+
children?: JsxNode;
|
|
365
|
+
};
|
|
366
|
+
type ElementChildren<P> = P extends {
|
|
367
|
+
children?: infer Child;
|
|
368
|
+
} ? Child : never;
|
|
369
|
+
type ElementChildArgs<P> = P extends {
|
|
370
|
+
children?: never;
|
|
371
|
+
} ? [] : ElementChildren<P>[];
|
|
372
|
+
declare function createElement<P extends {
|
|
373
|
+
children?: unknown;
|
|
374
|
+
}, R extends JsxNode>(type: (props: P) => R, props: (Omit<P, "children"> & Partial<Pick<P, "children">>) | null, ...children: ElementChildArgs<P>): R;
|
|
375
|
+
declare function createElement(type: string, props: ComponentProps | null): never;
|
|
376
|
+
declare function Fragment(props: {
|
|
377
|
+
children?: ContentJsxChild;
|
|
378
|
+
}): ContentJsxChild;
|
|
379
|
+
declare function Slide(props: SlideProps): AuthorNode<"slide">;
|
|
380
|
+
declare function View(props: ViewProps): AuthorNode<"view">;
|
|
381
|
+
declare function Text(props: TextProps): AuthorNode<"text">;
|
|
382
|
+
declare function Image(props: ImageProps): AuthorNode<"image">;
|
|
383
|
+
declare function Shape(props: ShapeProps): AuthorNode<"shape">;
|
|
384
|
+
declare function isAuthorNode(value: unknown): value is AuthorNode;
|
|
385
|
+
declare function isSlideNode(value: unknown): value is AuthorNode<"slide">;
|
|
386
|
+
declare function isContentNode(value: unknown): value is ContentAuthorNode;
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/jsx-runtime.d.ts
|
|
389
|
+
type JsxKey = string | number | bigint;
|
|
390
|
+
type JsxComponent<P, R extends JsxNode> = (props: P) => R;
|
|
391
|
+
type JsxProps<P> = P extends {
|
|
392
|
+
children?: unknown;
|
|
393
|
+
} ? Omit<P, "children"> & Partial<Pick<P, "children">> : P;
|
|
394
|
+
declare function jsx<P, R extends JsxNode>(type: JsxComponent<P, R>, props: JsxProps<P> | null, key?: JsxKey): R;
|
|
395
|
+
declare function jsx(type: string, props: Record<string, unknown> | null, key?: JsxKey): never;
|
|
396
|
+
declare const jsxs: typeof jsx;
|
|
397
|
+
declare namespace JSX {
|
|
398
|
+
type Element = ContentJsxChild;
|
|
399
|
+
interface ElementChildrenAttribute {
|
|
400
|
+
children: {};
|
|
401
|
+
}
|
|
402
|
+
interface IntrinsicAttributes {
|
|
403
|
+
key?: JsxKey;
|
|
404
|
+
}
|
|
405
|
+
interface IntrinsicElements {}
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
408
|
+
export { ImageStyle as $, CssFlexBasis as A, CssGridTrack as B, ContentJsxChild as C, VerticalAlign as Ct, CssAspectRatio as D, CssAlignSelf as E, CssGridPlacement as F, CssPosition as G, CssJustifySelf as H, CssGridShorthand as I, DeckOptions as J, CssVisibility as K, CssGridTemplate as L, CssFlexWrap as M, CssGridAutoFlow as N, CssBoxSizing as O, CssGridLine as P, ImageProps as Q, CssGridTemplateAreas as R, ContentAuthorNode as S, TextTabStopLength as St, CssAlignItems as T, ViewStyle as Tt, CssObjectPosition as U, CssJustifyContent as V, CssOverflow as W, ImageCropAuthoring as X, DeckPointLength as Y, ImageCropValue as Z, AuthorNodeMap as _, TextJsxChild as _t, Fragment as a, ShapeStyle as at, BackendName as b, TextTabStopAlignment as bt, Slide as c, SlideProps as ct, createElement as d, StackAlignment as dt, ImplementedBackendName as et, isAuthorNode as f, StackAxis as ft, AuthorNodeKind as g, TextFit as gt, AuthorNode as h, StrokeLineJoin as ht, jsxs as i, ShapeProps as it, CssFlexDirection as j, CssDisplay as k, Text as l, SlideStyle as lt, isSlideNode as m, StrokeLineCap as mt, JsxKey as n, LayoutMode as nt, Image as o, SlideContext as ot, isContentNode as p, StrokeDashType as pt, DeckLength as q, jsx as r, OutputConfig as rt, Shape as s, SlideFactory as st, JSX as t, JsxNode as tt, View as u, Spacing as ut, AuthorNodeProps as v, TextProps as vt, CssAlignContent as w, ViewProps as wt, BorderStyle as x, TextTabStopAuthoring as xt, AuthorNodePropsMap as y, TextStyle as yt, CssGridTemplateShorthand as z };
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deckjsx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Generate PowerPoint presentations from TSX/JSX through a compiler pipeline.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "deckjsx contributors",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/chikina-dev/deckjsx"
|
|
10
|
+
},
|
|
7
11
|
"files": [
|
|
8
12
|
"dist"
|
|
9
13
|
],
|
|
@@ -11,6 +15,8 @@
|
|
|
11
15
|
"types": "./dist/index.d.mts",
|
|
12
16
|
"exports": {
|
|
13
17
|
".": "./dist/index.mjs",
|
|
18
|
+
"./jsx-dev-runtime": "./dist/jsx-dev-runtime.mjs",
|
|
19
|
+
"./jsx-runtime": "./dist/jsx-runtime.mjs",
|
|
14
20
|
"./package.json": "./package.json"
|
|
15
21
|
},
|
|
16
22
|
"publishConfig": {
|
|
@@ -21,6 +27,7 @@
|
|
|
21
27
|
"dev": "vp pack --watch",
|
|
22
28
|
"test": "vp test",
|
|
23
29
|
"check": "vp check",
|
|
30
|
+
"verify:render": "bun run scripts/verify-render.ts",
|
|
24
31
|
"prepublishOnly": "vp run build"
|
|
25
32
|
},
|
|
26
33
|
"dependencies": {
|