deckjsx 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/index.d.mts +13 -355
- package/dist/index.mjs +10 -66
- package/dist/jsx-5H4Zgl79.mjs +66 -0
- package/dist/jsx-CrQPDEqU.d.mts +375 -0
- package/dist/jsx-dev-runtime.d.mts +3 -0
- package/dist/jsx-dev-runtime.mjs +3 -0
- package/dist/jsx-runtime.d.mts +19 -0
- package/dist/jsx-runtime.mjs +8 -0
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -80,14 +80,6 @@ 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
|
-
## Spec
|
|
84
|
-
|
|
85
|
-
The current draft specification is here:
|
|
86
|
-
|
|
87
|
-
- [docs/compiler-spec.md](docs/compiler-spec.md)
|
|
88
|
-
- [docs/css-support-matrix.md](docs/css-support-matrix.md)
|
|
89
|
-
- [docs/css-completion-plan.md](docs/css-completion-plan.md)
|
|
90
|
-
|
|
91
83
|
## Development
|
|
92
84
|
|
|
93
85
|
```bash
|
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 OutputConfig, A as CssGridLine, B as CssOverflow, C as CssAspectRatio, D as CssFlexDirection, E as CssFlexBasis, F as CssGridTemplateShorthand, G as DeckPointLength, H as CssVisibility, I as CssGridTrack, J as ImageProps, K as ImageCropAuthoring, L as CssJustifyContent, M as CssGridShorthand, N as CssGridTemplate, O as CssFlexWrap, P as CssGridTemplateAreas, Q as LayoutMode, R as CssJustifySelf, S as CssAlignSelf, T as CssDisplay, U as DeckLength, V as CssPosition, W as DeckOptions, X as ImplementedBackendName, Y as ImageStyle, Z as JsxNode, _ as BorderStyle, _t as TextTabStopAuthoring, a as Text, at as SlideStyle, b as CssAlignContent, bt as ViewProps, c as isAuthorNode, ct as StackAxis, d as AuthorNode, dt as StrokeLineJoin, et as ShapeProps, f as AuthorNodeKind, ft as TextFit, g as BackendName, gt as TextTabStopAlignment, h as AuthorNodePropsMap, ht as TextStyle, i as Slide, it as SlideProps, j as CssGridPlacement, k as CssGridAutoFlow, l as isContentNode, lt as StrokeDashType, m as AuthorNodeProps, mt as TextProps, n as Image, nt as SlideContext, o as View, ot as Spacing, p as AuthorNodeMap, pt as TextJsxChild, q as ImageCropValue, r as Shape, rt as SlideFactory, s as createElement, st as StackAlignment, t as Fragment, tt as ShapeStyle, u as isSlideNode, ut as StrokeLineCap, v as ContentAuthorNode, vt as TextTabStopLength, w as CssBoxSizing, x as CssAlignItems, xt as ViewStyle, y as ContentJsxChild, yt as VerticalAlign, z as CssObjectPosition } from "./jsx-CrQPDEqU.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,15 @@ declare function pptxgenjsBackend(): CompileBackend;
|
|
|
606
253
|
declare const EMU_PER_INCH = 914400;
|
|
607
254
|
declare const POINTS_PER_INCH = 72;
|
|
608
255
|
//#endregion
|
|
256
|
+
//#region src/index.d.ts
|
|
257
|
+
declare global {
|
|
258
|
+
namespace JSX {
|
|
259
|
+
type Element = ContentJsxChild;
|
|
260
|
+
interface ElementChildrenAttribute {
|
|
261
|
+
children: {};
|
|
262
|
+
}
|
|
263
|
+
interface IntrinsicElements {}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
609
267
|
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 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-5H4Zgl79.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,66 @@
|
|
|
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 authorNode(kind, props) {
|
|
17
|
+
const { children: rawChildren, ...nodeProps } = props;
|
|
18
|
+
return {
|
|
19
|
+
$$typeof: "deckjsx.author-node",
|
|
20
|
+
kind,
|
|
21
|
+
props: nodeProps,
|
|
22
|
+
children: rawChildren === void 0 ? [] : flattenChildren(rawChildren)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function createElement(type, props, ...children) {
|
|
26
|
+
if (typeof type === "string") throw new Error(`Intrinsic elements are not supported: <${type}>.`);
|
|
27
|
+
if (typeof type !== "function") throw new Error("JSX element type must be a function component.");
|
|
28
|
+
const propsObject = isRecord(props) ? props : {};
|
|
29
|
+
return type({
|
|
30
|
+
...propsObject,
|
|
31
|
+
children: children.length === 0 ? requireJsxNode(propsObject.children) : children.length === 1 ? requireJsxNode(children[0]) : children.map((child) => requireJsxNode(child))
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function Fragment(props) {
|
|
35
|
+
return props.children ?? null;
|
|
36
|
+
}
|
|
37
|
+
function Slide(props) {
|
|
38
|
+
return authorNode("slide", props);
|
|
39
|
+
}
|
|
40
|
+
function View(props) {
|
|
41
|
+
return authorNode("view", props);
|
|
42
|
+
}
|
|
43
|
+
function Text(props) {
|
|
44
|
+
return authorNode("text", props);
|
|
45
|
+
}
|
|
46
|
+
function Image(props) {
|
|
47
|
+
return authorNode("image", props);
|
|
48
|
+
}
|
|
49
|
+
function Shape(props) {
|
|
50
|
+
return authorNode("shape", props);
|
|
51
|
+
}
|
|
52
|
+
function isAuthorNodeKind(value) {
|
|
53
|
+
return value === "slide" || value === "view" || value === "text" || value === "image" || value === "shape";
|
|
54
|
+
}
|
|
55
|
+
function isAuthorNode(value) {
|
|
56
|
+
if (!isRecord(value)) return false;
|
|
57
|
+
return value.$$typeof === "deckjsx.author-node" && isAuthorNodeKind(value.kind) && isRecord(value.props) && Array.isArray(value.children);
|
|
58
|
+
}
|
|
59
|
+
function isSlideNode(value) {
|
|
60
|
+
return isAuthorNode(value) && value.kind === "slide";
|
|
61
|
+
}
|
|
62
|
+
function isContentNode(value) {
|
|
63
|
+
return isAuthorNode(value) && value.kind !== "slide";
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
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,375 @@
|
|
|
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 AuthorNode<K extends AuthorNodeKind = AuthorNodeKind> = { [NodeKind in K]: {
|
|
343
|
+
readonly $$typeof: "deckjsx.author-node";
|
|
344
|
+
readonly kind: NodeKind;
|
|
345
|
+
readonly props: AuthorNodeProps<NodeKind>;
|
|
346
|
+
readonly children: ReadonlyArray<JsxNode>;
|
|
347
|
+
} }[K];
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/jsx.d.ts
|
|
350
|
+
type ComponentProps = {
|
|
351
|
+
children?: JsxNode;
|
|
352
|
+
};
|
|
353
|
+
type ElementChildren<P> = P extends {
|
|
354
|
+
children?: infer Child;
|
|
355
|
+
} ? Child : never;
|
|
356
|
+
type ElementChildArgs<P> = P extends {
|
|
357
|
+
children?: never;
|
|
358
|
+
} ? [] : ElementChildren<P>[];
|
|
359
|
+
declare function createElement<P extends {
|
|
360
|
+
children?: unknown;
|
|
361
|
+
}, R extends JsxNode>(type: (props: P) => R, props: (Omit<P, "children"> & Partial<Pick<P, "children">>) | null, ...children: ElementChildArgs<P>): R;
|
|
362
|
+
declare function createElement(type: string, props: ComponentProps | null): never;
|
|
363
|
+
declare function Fragment(props: {
|
|
364
|
+
children?: ContentJsxChild;
|
|
365
|
+
}): ContentJsxChild;
|
|
366
|
+
declare function Slide(props: SlideProps): AuthorNode<"slide">;
|
|
367
|
+
declare function View(props: ViewProps): AuthorNode<"view">;
|
|
368
|
+
declare function Text(props: TextProps): AuthorNode<"text">;
|
|
369
|
+
declare function Image(props: ImageProps): AuthorNode<"image">;
|
|
370
|
+
declare function Shape(props: ShapeProps): AuthorNode<"shape">;
|
|
371
|
+
declare function isAuthorNode(value: unknown): value is AuthorNode;
|
|
372
|
+
declare function isSlideNode(value: unknown): value is AuthorNode<"slide">;
|
|
373
|
+
declare function isContentNode(value: unknown): value is ContentAuthorNode;
|
|
374
|
+
//#endregion
|
|
375
|
+
export { OutputConfig as $, CssGridLine as A, CssOverflow as B, CssAspectRatio as C, CssFlexDirection as D, CssFlexBasis as E, CssGridTemplateShorthand as F, DeckPointLength as G, CssVisibility as H, CssGridTrack as I, ImageProps as J, ImageCropAuthoring as K, CssJustifyContent as L, CssGridShorthand as M, CssGridTemplate as N, CssFlexWrap as O, CssGridTemplateAreas as P, LayoutMode as Q, CssJustifySelf as R, CssAlignSelf as S, CssDisplay as T, DeckLength as U, CssPosition as V, DeckOptions as W, ImplementedBackendName as X, ImageStyle as Y, JsxNode as Z, BorderStyle as _, TextTabStopAuthoring as _t, Text as a, SlideStyle as at, CssAlignContent as b, ViewProps as bt, isAuthorNode as c, StackAxis as ct, AuthorNode as d, StrokeLineJoin as dt, ShapeProps as et, AuthorNodeKind as f, TextFit as ft, BackendName as g, TextTabStopAlignment as gt, AuthorNodePropsMap as h, TextStyle as ht, Slide as i, SlideProps as it, CssGridPlacement as j, CssGridAutoFlow as k, isContentNode as l, StrokeDashType as lt, AuthorNodeProps as m, TextProps as mt, Image as n, SlideContext as nt, View as o, Spacing as ot, AuthorNodeMap as p, TextJsxChild as pt, ImageCropValue as q, Shape as r, SlideFactory as rt, createElement as s, StackAlignment as st, Fragment as t, ShapeStyle as tt, isSlideNode as u, StrokeLineCap as ut, ContentAuthorNode as v, TextTabStopLength as vt, CssBoxSizing as w, CssAlignItems as x, ViewStyle as xt, ContentJsxChild as y, VerticalAlign as yt, CssObjectPosition as z };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Z as JsxNode, t as Fragment, y as ContentJsxChild } from "./jsx-CrQPDEqU.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/jsx-runtime.d.ts
|
|
4
|
+
type JsxComponent<P, R extends JsxNode> = (props: P) => R;
|
|
5
|
+
type JsxProps<P> = P extends {
|
|
6
|
+
children?: unknown;
|
|
7
|
+
} ? Omit<P, "children"> & Partial<Pick<P, "children">> : P;
|
|
8
|
+
declare function jsx<P, R extends JsxNode>(type: JsxComponent<P, R>, props: JsxProps<P> | null, key?: string): R;
|
|
9
|
+
declare function jsx(type: string, props: Record<string, unknown> | null, key?: string): never;
|
|
10
|
+
declare const jsxs: typeof jsx;
|
|
11
|
+
declare namespace JSX {
|
|
12
|
+
type Element = ContentJsxChild;
|
|
13
|
+
interface ElementChildrenAttribute {
|
|
14
|
+
children: {};
|
|
15
|
+
}
|
|
16
|
+
interface IntrinsicElements {}
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Fragment, JSX, jsx, jsxs };
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deckjsx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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": {
|