deckjsx 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,323 +1,7 @@
1
- import { $ as ImageCropAuthoring, $t as SemanticDocumentNode, A as CssBoxSizing, At as TextRunStyle, B as CssGridTemplateAreas, Bt as CompositionContext, C as ClassNameValueArray, Cn as StyleDiagnosticError, Ct as StyleClassStyle, D as CssAlignItems, Dt as TextJsxChild, E as CssAlignContent, En as SourceSpan, Et as TextFit, F as CssGridAutoFlow, Ft as VerticalAlign, G as CssObjectPosition, Gt as SourceContextInput, H as CssGridTrack, Ht as CompositionSourceInternals, I as CssGridLine, It as ViewProps, J as CssVisibility, Jt as AssetEntityId, K as CssOverflow, Kt as SourceContextMapper, L as CssGridPlacement, Lt as ViewStyle, M as CssFlexBasis, Mt as TextTabStopAlignment, N as CssFlexDirection, Nt as TextTabStopAuthoring, O as CssAlignSelf, Ot as TextProps, P as CssFlexWrap, Pt as TextTabStopLength, Q as DeckPointLength, Qt as SemanticContainerNode, R as CssGridShorthand, Rt as defineStyles, S as ClassNameValue, Sn as SemanticGraphDiagnosticError, St as StyleClassDefinition, T as ContentJsxChild, Tn as JsxKey, Tt as StyleTargetSelector, U as CssJustifyContent, Ut as SlideFactory, V as CssGridTemplateShorthand, Vt as CompositionSource, W as CssJustifySelf, Wt as SlideFactoryInput, X as DeckLength, Xt as GraphNodeId, Y as DeckJsxIntrinsicElements, Yt as BaseSemanticNode, Z as DeckOptions, Zt as SemanticAuthorGraph, _ as AuthorNodeProps, _n as Diagnostics, _t as StackAlignment, a as createElement, an as SemanticShapeNode, at as IntrinsicImgProps, b as BorderStyle, bn as CompositionDiagnosticError, bt as StrokeLineCap, c as isSlideNode, cn as SemanticTextRunNode, ct as IntrinsicViewTag, d as Slide, dn as StyleClassRef, dt as OutputConfig, en as SemanticImageNode, et as ImageCropValue, f as Text, fn as StyleEntity, ft as ShapeProps, g as AuthorNodeMap, gn as DiagnosticSeverity, gt as Spacing, h as AuthorNodeKind, hn as DiagnosticLabel, ht as SlideStyle, i as Fragment, in as SemanticRole, it as IntrinsicDivProps, j as CssDisplay, jt as TextStyle, k as CssAspectRatio, kt as TextRunNodeProps, l as Image, ln as SourceIdentity, lt as JsxNode, m as AuthorNode, mn as Diagnostic, mt as SlideProps, nn as SemanticNodeKind, nt as ImageStyle, o as isAuthorNode, on as SemanticSlideNode, ot as IntrinsicPProps, p as View, pn as StyleEntityId, pt as ShapeStyle, q as CssPosition, qt as AssetEntity, rn as SemanticOrigin, rt as ImplementedBackendName, s as isContentNode, sn as SemanticTextNode, st as IntrinsicTextTag, tn as SemanticNode, tt as ImageProps, u as Shape, un as SourceOrigin, ut as LayoutMode, v as AuthorNodePropsMap, vn as formatDiagnostic, vt as StackAxis, w as ContentAuthorNode, wt as StyleSheet, x as ClassNameObject, xn as DeckDiagnosticError, xt as StrokeLineJoin, y as BackendName, yn as formatDiagnostics, yt as StrokeDashType, z as CssGridTemplate, zt as COMPOSITION_SOURCE } from "./jsx-runtime-BMKEs7aG.mjs";
1
+ import { $ as CssJustifyContent, $t as formatDiagnostics, A as SourceContextMapper, B as CssBoxSizing, Ct as TextTabStopAuthoring, D as SlideFactory, Et as ViewStyle, F as BorderStyle, G as CssGridAutoFlow, H as CssFlexBasis, I as CssAlignContent, J as CssGridShorthand, Jt as Diagnostic, K as CssGridLine, L as CssAlignItems, M as ThemeInput, N as ThemeDefaults, O as SlideFactoryInput, P as StyleSheet, Q as CssGridTrack, Qt as formatDiagnostic, R as CssAlignSelf, S as ViewProps, St as TextTabStopAlignment, Tt as VerticalAlign, U as CssFlexDirection, V as CssDisplay, W as CssFlexWrap, X as CssGridTemplateAreas, Xt as DiagnosticSeverity, Y as CssGridTemplate, Yt as DiagnosticLabel, Z as CssGridTemplateShorthand, Zt as Diagnostics, _ as SlideContext, _t as StrokeLineCap, a as ContentJsxChild, at as DeckLength, b as TextProps, bt as TextRunStyle, c as ImageProps, cn as SourceSpan, ct as ImageCropValue, d as IntrinsicImgProps, dt as ShapeStyle, en as CompositionDiagnosticError, et as CssJustifySelf, f as IntrinsicPProps, ft as SlideStyle, g as ShapeProps, gt as StrokeDashType, h as OutputConfig, ht as StackAxis, i as ClassNameValueArray, it as CssVisibility, j as Theme, l as ImplementedBackendName, lt as ImageStyle, m as IntrinsicViewTag, mt as StackAlignment, n as ClassNameObject, nn as SemanticGraphDiagnosticError, nt as CssOverflow, o as DeckJsxIntrinsicElements, ot as DeckPointLength, p as IntrinsicTextTag, pt as Spacing, q as CssGridPlacement, r as ClassNameValue, rn as StyleDiagnosticError, rt as CssPosition, s as DeckOptions, sn as JsxKey, st as ImageCropAuthoring, t as BackendName, tn as DeckDiagnosticError, tt as CssObjectPosition, u as IntrinsicDivProps, ut as LayoutMode, v as SlideProps, vt as StrokeLineJoin, w as CompositionContext, wt as TextTabStopLength, x as TextRunNodeProps, xt as TextStyle, y as TextJsxChild, yt as TextFit, z as CssAspectRatio } from "./index-sb451NVh.mjs";
2
+ import { a as createElement, c as Slide, i as Fragment, l as Text, o as Image, s as Shape, u as View } from "./jsx-runtime-Bk7Wx3AL.mjs";
3
+ import { i as Deck, n as CompileInspectResult, r as CompileMode, t as BoundSource } from "./deck-CvTHG5ik.mjs";
2
4
 
3
- //#region src/style/resolve.d.ts
4
- type ResolvedStyleLayer = "default" | "theme" | "class" | "style";
5
- type ResolvedStyleSource = {
6
- readonly layer: "default";
7
- } | {
8
- readonly layer: "theme";
9
- } | {
10
- readonly layer: "class";
11
- readonly className: string;
12
- readonly stylesheetIndex: number;
13
- readonly ruleIndex: number;
14
- readonly selector: string;
15
- } | {
16
- readonly layer: "style";
17
- };
18
- type ResolvedStyleProperty = {
19
- readonly value: unknown;
20
- readonly source: ResolvedStyleSource;
21
- };
22
- type ResolvedStyle = {
23
- readonly style: Readonly<Record<string, unknown>>;
24
- readonly properties: Readonly<Record<string, ResolvedStyleProperty>>;
25
- readonly appliedClasses: readonly ResolvedStyleSource[];
26
- };
27
- type ResolvedStyleMap = ReadonlyMap<StyleEntityId, ResolvedStyle>;
28
- type StyleResolutionResult = {
29
- readonly resolvedStyles: ResolvedStyleMap;
30
- readonly diagnostics: Diagnostics;
31
- };
32
- //#endregion
33
- //#region src/ir/index.d.ts
34
- type PresentationIR = {
35
- version: "0.1";
36
- meta?: {
37
- title?: string;
38
- author?: string;
39
- subject?: string;
40
- };
41
- size: SizeIR;
42
- slides: ReadonlyArray<SlideIR>;
43
- };
44
- type SizeIR = {
45
- widthEmu: number;
46
- heightEmu: number;
47
- };
48
- type FrameIR = SizeIR & {
49
- xEmu: number;
50
- yEmu: number;
51
- };
52
- type SlideIR = {
53
- id: string;
54
- name?: string;
55
- background?: FillIR;
56
- backgroundLayers?: ReadonlyArray<BackgroundLayerIR>;
57
- nodes: ReadonlyArray<NodeIR>;
58
- };
59
- type NodeIR = GroupIR | TextIR | ImageIR | ShapeIR;
60
- type BaseNodeIR = {
61
- id: string;
62
- frame: FrameIR;
63
- opacity?: number;
64
- rotation?: number;
65
- zIndex?: number;
66
- visibility?: CssVisibility;
67
- flipH?: boolean;
68
- flipV?: boolean;
69
- };
70
- type ShadowIR = {
71
- type: "outer" | "inner";
72
- color: string;
73
- opacity?: number;
74
- blurPt?: number;
75
- offsetPt?: number;
76
- angle?: number;
77
- };
78
- type HyperlinkIR = {
79
- url: string;
80
- tooltip?: string;
81
- };
82
- type ObjectPositionIR = {
83
- x: number;
84
- y: number;
85
- };
86
- type ImageCropIR = {
87
- top: number;
88
- right: number;
89
- bottom: number;
90
- left: number;
91
- };
92
- type GroupIR = BaseNodeIR & {
93
- kind: "group";
94
- children: ReadonlyArray<NodeIR>;
95
- fill?: FillIR;
96
- backgroundLayers?: ReadonlyArray<BackgroundLayerIR>;
97
- stroke?: StrokeIR;
98
- edgeStrokes?: EdgeStrokeIR;
99
- outline?: StrokeIR;
100
- shadow?: ShadowIR;
101
- radiusEmu?: number;
102
- };
103
- type TextIR = BaseNodeIR & {
104
- kind: "text";
105
- content: TextContentIR;
106
- style: TextStyleIR;
107
- fill?: FillIR;
108
- backgroundLayers?: ReadonlyArray<BackgroundLayerIR>;
109
- stroke?: StrokeIR;
110
- edgeStrokes?: EdgeStrokeIR;
111
- outline?: StrokeIR;
112
- shadow?: ShadowIR;
113
- hyperlink?: HyperlinkIR;
114
- radiusEmu?: number;
115
- };
116
- type ImageIR = BaseNodeIR & {
117
- kind: "image";
118
- sourceFrame: FrameIR;
119
- source: ImageSourceIR;
120
- fit: "contain" | "cover" | "stretch";
121
- objectPosition?: ObjectPositionIR;
122
- crop?: ImageCropIR;
123
- transparency?: number;
124
- rounding?: boolean;
125
- shadow?: ShadowIR;
126
- hyperlink?: HyperlinkIR;
127
- };
128
- type ShapeIR = BaseNodeIR & {
129
- kind: "shape";
130
- shape: "rect" | "ellipse" | "line";
131
- fill?: FillIR;
132
- backgroundLayers?: ReadonlyArray<BackgroundLayerIR>;
133
- stroke?: StrokeIR;
134
- edgeStrokes?: EdgeStrokeIR;
135
- outline?: StrokeIR;
136
- shadow?: ShadowIR;
137
- hyperlink?: HyperlinkIR;
138
- radiusEmu?: number;
139
- };
140
- type SolidFillIR = {
141
- kind: "solid";
142
- color: string;
143
- transparency?: number;
144
- frame?: FrameIR;
145
- };
146
- type LinearGradientStopIR = {
147
- color: string;
148
- transparency?: number;
149
- position: number;
150
- };
151
- type LinearGradientFillIR = {
152
- kind: "linear-gradient";
153
- angle: number;
154
- stops: ReadonlyArray<LinearGradientStopIR>;
155
- frame?: FrameIR;
156
- };
157
- type RadialGradientFillIR = {
158
- kind: "radial-gradient";
159
- shape: "circle" | "ellipse";
160
- center: {
161
- x: number;
162
- y: number;
163
- };
164
- radius: {
165
- x: number;
166
- y: number;
167
- };
168
- stops: ReadonlyArray<LinearGradientStopIR>;
169
- frame?: FrameIR;
170
- };
171
- type BackgroundImageLayerIR = {
172
- kind: "background-image";
173
- frame: FrameIR;
174
- sourceFrame: FrameIR;
175
- source: ImageSourceIR;
176
- fit: "contain" | "cover" | "stretch" | "size";
177
- size?: {
178
- widthEmu?: number;
179
- heightEmu?: number;
180
- };
181
- repeat: "no-repeat" | "repeat-x" | "repeat-y" | "repeat";
182
- objectPosition?: ObjectPositionIR;
183
- transparency?: number;
184
- };
185
- type FillIR = SolidFillIR | LinearGradientFillIR | RadialGradientFillIR;
186
- type BackgroundLayerIR = FillIR | BackgroundImageLayerIR;
187
- type StrokeIR = {
188
- color: string;
189
- widthPt: number;
190
- style?: BorderStyle;
191
- dashType?: StrokeDashType;
192
- lineCap?: StrokeLineCap;
193
- lineJoin?: StrokeLineJoin;
194
- transparency?: number;
195
- };
196
- type EdgeStrokeIR = {
197
- top?: StrokeIR;
198
- right?: StrokeIR;
199
- bottom?: StrokeIR;
200
- left?: StrokeIR;
201
- };
202
- type TextContentIR = {
203
- text: string;
204
- runs?: ReadonlyArray<TextRunIR>;
205
- };
206
- type TextRunIR = {
207
- text: string;
208
- style?: TextStyleIR;
209
- };
210
- type TextTabStopIR = {
211
- positionIn: number;
212
- alignment?: "l" | "r" | "ctr" | "dec";
213
- };
214
- type TextBulletListIR = {
215
- type: "bullet";
216
- characterCode?: string;
217
- indentPt?: number;
218
- };
219
- type TextNumberListIR = {
220
- type: "number";
221
- style: "arabicPeriod" | "alphaLcPeriod" | "alphaUcPeriod" | "romanLcPeriod" | "romanUcPeriod";
222
- startAt?: number;
223
- indentPt?: number;
224
- };
225
- type TextNoListIR = {
226
- type: "none";
227
- };
228
- type TextListIR = TextBulletListIR | TextNumberListIR | TextNoListIR;
229
- type TextStyleIR = {
230
- fontFamily?: string;
231
- fontSizePt?: number;
232
- fontWeight?: number | "normal" | "bold";
233
- italic?: boolean;
234
- underline?: boolean;
235
- underlineStyle?: "dash" | "dbl" | "dotted" | "none" | "sng" | "wavy";
236
- underlineColor?: string;
237
- strike?: boolean;
238
- rtlMode?: boolean;
239
- textDirection?: "horz" | "vert" | "vert270";
240
- superscript?: boolean;
241
- subscript?: boolean;
242
- color?: string;
243
- textAlign?: "left" | "center" | "right" | "justify";
244
- verticalAlign?: VerticalAlign;
245
- paddingPt?: [number, number, number, number];
246
- lineSpacing?: number;
247
- lineSpacingMultiple?: number;
248
- paragraphSpacingBefore?: number;
249
- paragraphSpacingAfter?: number;
250
- textIndentPt?: number;
251
- tabStops?: ReadonlyArray<TextTabStopIR>;
252
- charSpacing?: number;
253
- list?: TextListIR;
254
- fit?: TextFit;
255
- wrap?: boolean;
256
- };
257
- type ImageSourceIR = {
258
- kind: "path";
259
- path: string;
260
- } | {
261
- kind: "data";
262
- data: string;
263
- };
264
- type BackendArtifact = {
265
- kind: "buffer";
266
- mimeType: string;
267
- data: Uint8Array;
268
- extension: string;
269
- };
270
- type CompileBackend = {
271
- name: BackendName;
272
- emit(ir: PresentationIR): Promise<BackendArtifact>;
273
- };
274
- //#endregion
275
- //#region src/deck.d.ts
276
- type CompileMode = "inspect" | "strict";
277
- type CompileInspectResult = {
278
- readonly graph?: SemanticAuthorGraph;
279
- readonly diagnostics: Diagnostics;
280
- readonly resolvedStyles?: ResolvedStyleMap;
281
- };
282
- type WithSource<TSourceContext> = [TSourceContext] extends [void] ? never : (sourceContext: TSourceContext) => BoundSource<TSourceContext>;
283
- declare class BoundSource<TSourceContext = void> implements CompositionSource<TSourceContext> {
284
- #private;
285
- constructor(source: Deck<TSourceContext>, sourceContext: TSourceContext);
286
- [COMPOSITION_SOURCE](): CompositionSourceInternals<TSourceContext>;
287
- compile(): SemanticAuthorGraph;
288
- compile(config: {
289
- mode?: "strict";
290
- }): SemanticAuthorGraph;
291
- compile(config: {
292
- mode: "inspect";
293
- }): CompileInspectResult;
294
- render(): PresentationIR;
295
- output(config: OutputConfig): Promise<void>;
296
- }
297
- declare class Deck<TSourceContext = void> implements CompositionSource<TSourceContext> {
298
- #private;
299
- readonly withSource: WithSource<TSourceContext>;
300
- constructor(options: DeckOptions);
301
- get options(): DeckOptions;
302
- [COMPOSITION_SOURCE](): CompositionSourceInternals<TSourceContext>;
303
- useStyles(stylesheet: StyleSheet): this;
304
- add(slide: SlideFactory<TSourceContext>): this;
305
- mount<TChildContext>(sourceKey: string, child: Deck<TChildContext>, ...context: [TChildContext] extends [void] ? [] : [sourceContext: SourceContextInput<TSourceContext, TChildContext>]): this;
306
- mount<TChildContext>(sourceKey: string, child: BoundSource<TChildContext>): this;
307
- render(this: Deck<void>): PresentationIR;
308
- compile(this: Deck<void>): SemanticAuthorGraph;
309
- compile(this: Deck<void>, config: {
310
- mode?: "strict";
311
- }): SemanticAuthorGraph;
312
- compile(this: Deck<void>, config: {
313
- mode: "inspect";
314
- }): CompileInspectResult;
315
- output(this: Deck<void>, config: OutputConfig): Promise<void>;
316
- }
317
- //#endregion
318
- //#region src/backends/pptxgenjs.d.ts
319
- declare function pptxgenjsBackend(): CompileBackend;
320
- //#endregion
321
5
  //#region src/types.d.ts
322
6
  declare const EMU_PER_INCH = 914400;
323
7
  declare const POINTS_PER_INCH = 72;
@@ -336,4 +20,4 @@ declare global {
336
20
  }
337
21
  }
338
22
  //#endregion
339
- export { type AssetEntity, type AssetEntityId, type AuthorNode, type AuthorNodeKind, type AuthorNodeMap, type AuthorNodeProps, type AuthorNodePropsMap, type BackendArtifact, type BackendName, type BackgroundImageLayerIR, type BackgroundLayerIR, type BaseNodeIR, type BaseSemanticNode, type BorderStyle, type BoundSource, type ClassNameObject, type ClassNameValue, type ClassNameValueArray, type CompileBackend, type CompileInspectResult, type CompileMode, type CompositionContext, CompositionDiagnosticError, 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, DeckDiagnosticError, type DeckJsxIntrinsicElements, type DeckLength, type DeckOptions, type DeckPointLength, type Diagnostic, type DiagnosticLabel, type DiagnosticSeverity, type Diagnostics, EMU_PER_INCH, type EdgeStrokeIR, type FillIR, Fragment, type FrameIR, type GraphNodeId, type GroupIR, type HyperlinkIR, Image, type ImageCropAuthoring, type ImageCropIR, type ImageCropValue, type ImageIR, type ImageProps, type ImageSourceIR, type ImageStyle, type ImplementedBackendName, type IntrinsicDivProps, type IntrinsicImgProps, type IntrinsicPProps, type IntrinsicTextTag, type IntrinsicViewTag, type JsxKey, type JsxNode, type LayoutMode, type LinearGradientFillIR, type LinearGradientStopIR, type NodeIR, type ObjectPositionIR, type OutputConfig, POINTS_PER_INCH, type PresentationIR, type RadialGradientFillIR, type ResolvedStyle, type ResolvedStyleLayer, type ResolvedStyleMap, type ResolvedStyleProperty, type ResolvedStyleSource, type SemanticAuthorGraph, type SemanticContainerNode, type SemanticDocumentNode, SemanticGraphDiagnosticError, type SemanticImageNode, type SemanticNode, type SemanticNodeKind, type SemanticOrigin, type SemanticRole, type SemanticShapeNode, type SemanticSlideNode, type SemanticTextNode, type SemanticTextRunNode, type ShadowIR, Shape, type ShapeIR, type ShapeProps, type ShapeStyle, type SizeIR, Slide, type SlideFactory, type SlideFactoryInput, type SlideIR, type SlideProps, type SlideStyle, type SolidFillIR, type SourceContextMapper, type SourceIdentity, type SourceOrigin, type SourceSpan, type Spacing, type StackAlignment, type StackAxis, type StrokeDashType, type StrokeIR, type StrokeLineCap, type StrokeLineJoin, type StyleClassDefinition, type StyleClassRef, type StyleClassStyle, StyleDiagnosticError, type StyleEntity, type StyleEntityId, type StyleResolutionResult, type StyleSheet, type StyleTargetSelector, Text, type TextBulletListIR, type TextContentIR, type TextFit, type TextIR, type TextJsxChild, type TextListIR, type TextNoListIR, type TextNumberListIR, type TextProps, type TextRunIR, type TextRunNodeProps, type TextRunStyle, type TextStyle, type TextStyleIR, type TextTabStopAlignment, type TextTabStopAuthoring, type TextTabStopIR, type TextTabStopLength, type VerticalAlign, View, type ViewProps, type ViewStyle, createElement, defineStyles, formatDiagnostic, formatDiagnostics, isAuthorNode, isContentNode, isSlideNode, pptxgenjsBackend };
23
+ export { type BackendName, type BorderStyle, type BoundSource, type ClassNameObject, type ClassNameValue, type ClassNameValueArray, type CompileInspectResult, type CompileMode, type CompositionContext, CompositionDiagnosticError, 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, DeckDiagnosticError, type DeckJsxIntrinsicElements, type DeckLength, type DeckOptions, type DeckPointLength, type Diagnostic, type DiagnosticLabel, type DiagnosticSeverity, type Diagnostics, EMU_PER_INCH, Fragment, Image, type ImageCropAuthoring, type ImageCropValue, type ImageProps, type ImageStyle, type ImplementedBackendName, type IntrinsicDivProps, type IntrinsicImgProps, type IntrinsicPProps, type IntrinsicTextTag, type IntrinsicViewTag, type JsxKey, type LayoutMode, type OutputConfig, POINTS_PER_INCH, SemanticGraphDiagnosticError, Shape, type ShapeProps, type ShapeStyle, Slide, type SlideContext, type SlideFactory, type SlideFactoryInput, type SlideProps, type SlideStyle, type SourceContextMapper, type SourceSpan, type Spacing, type StackAlignment, type StackAxis, type StrokeDashType, type StrokeLineCap, type StrokeLineJoin, StyleDiagnosticError, StyleSheet, Text, type TextFit, type TextJsxChild, type TextProps, type TextRunNodeProps, type TextRunStyle, type TextStyle, type TextTabStopAlignment, type TextTabStopAuthoring, type TextTabStopLength, Theme, type ThemeDefaults, type ThemeInput, type VerticalAlign, View, type ViewProps, type ViewStyle, createElement, formatDiagnostic, formatDiagnostics };