deckjsx 0.2.0 → 0.2.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/dist/index.d.mts CHANGED
@@ -1,5 +1,151 @@
1
- import { $ as ImageProps, A as CssFlexBasis, At as ViewProps, B as CssGridTrack, C as ContentJsxChild, Ct as TextJsxChild, D as CssAspectRatio, Dt as TextTabStopAuthoring, E as CssAlignSelf, Et as TextTabStopAlignment, F as CssGridPlacement, G as CssPosition, H as CssJustifySelf, I as CssGridShorthand, J as DeckLength, K as CssVisibility, L as CssGridTemplate, M as CssFlexWrap, N as CssGridAutoFlow, O as CssBoxSizing, Ot as TextTabStopLength, P as CssGridLine, Q as ImageCropValue, R as CssGridTemplateAreas, S as ContentAuthorNode, St as TextFit, T as CssAlignItems, Tt as TextStyle, U as CssObjectPosition, V as CssJustifyContent, W as CssOverflow, X as DeckPointLength, Y as DeckOptions, Z as ImageCropAuthoring, _ as AuthorNodeMap, _t as StackAlignment, a as Fragment, at as IntrinsicTextTag, b as BackendName, bt as StrokeLineCap, c as Slide, ct as LayoutMode, d as createElement, dt as ShapeStyle, et as ImageStyle, f as isAuthorNode, ft as SlideContext, g as AuthorNodeKind, gt as Spacing, h as AuthorNode, ht as SlideStyle, it as IntrinsicPProps, j as CssFlexDirection, jt as ViewStyle, k as CssDisplay, kt as VerticalAlign, l as Text, lt as OutputConfig, m as isSlideNode, mt as SlideProps, n as JsxKey, nt as IntrinsicDivProps, o as Image, ot as IntrinsicViewTag, p as isContentNode, pt as SlideFactory, q as DeckJsxIntrinsicElements, rt as IntrinsicImgProps, s as Shape, st as JsxNode, tt as ImplementedBackendName, u as View, ut as ShapeProps, v as AuthorNodeProps, vt as StackAxis, w as CssAlignContent, wt as TextProps, x as BorderStyle, xt as StrokeLineJoin, y as AuthorNodePropsMap, yt as StrokeDashType, z as CssGridTemplateShorthand } from "./jsx-runtime-BWV9tOov.mjs";
1
+ import { $ as ImageStyle, A as CssFlexDirection, At as ViewStyle, B as CssJustifyContent, C as CssAlignContent, Ct as TextProps, D as CssBoxSizing, Dt as TextTabStopLength, E as CssAspectRatio, Et as TextTabStopAuthoring, F as CssGridShorthand, Ft as AuthoredTag, G as CssVisibility, H as CssObjectPosition, I as CssGridTemplate, It as SectioningTag, J as DeckOptions, K as DeckJsxIntrinsicElements, L as CssGridTemplateAreas, M as CssGridAutoFlow, Mt as JsxKey, N as CssGridLine, Nt as SourceSpan, O as CssDisplay, Ot as VerticalAlign, P as CssGridPlacement, Pt as AuthoredComponent, Q as ImageProps, R as CssGridTemplateShorthand, S as ContentJsxChild, St as TextJsxChild, T as CssAlignSelf, Tt as TextTabStopAlignment, U as CssOverflow, V as CssJustifySelf, W as CssPosition, X as ImageCropAuthoring, Y as DeckPointLength, Z as ImageCropValue, _ as AuthorNodeProps, _t as StackAxis, a as createElement, at as IntrinsicViewTag, b as BorderStyle, bt as StrokeLineJoin, c as isSlideNode, ct as OutputConfig, d as Slide, dt as SlideContext, et as ImplementedBackendName, f as Text, ft as SlideFactory, g as AuthorNodeMap, gt as StackAlignment, h as AuthorNodeKind, ht as Spacing, i as Fragment, it as IntrinsicTextTag, j as CssFlexWrap, k as CssFlexBasis, kt as ViewProps, l as Image, lt as ShapeProps, m as AuthorNode, mt as SlideStyle, nt as IntrinsicImgProps, o as isAuthorNode, ot as JsxNode, p as View, pt as SlideProps, q as DeckLength, rt as IntrinsicPProps, s as isContentNode, st as LayoutMode, tt as IntrinsicDivProps, u as Shape, ut as ShapeStyle, v as AuthorNodePropsMap, vt as StrokeDashType, w as CssAlignItems, wt as TextStyle, x as ContentAuthorNode, xt as TextFit, y as BackendName, yt as StrokeLineCap, z as CssGridTrack } from "./jsx-runtime-ru5t8S3z.mjs";
2
2
 
3
+ //#region src/diagnostics/errors.d.ts
4
+ declare class DeckDiagnosticError extends Error {
5
+ readonly diagnostics: Diagnostics;
6
+ constructor(message: string, diagnostics: Diagnostics);
7
+ }
8
+ declare class SemanticGraphDiagnosticError extends DeckDiagnosticError {
9
+ constructor(diagnostics: Diagnostics);
10
+ }
11
+ //#endregion
12
+ //#region src/diagnostics/format.d.ts
13
+ declare function formatDiagnostic(diagnostic: Diagnostic): string;
14
+ declare function formatDiagnostics(diagnostics: Diagnostics): string;
15
+ //#endregion
16
+ //#region src/diagnostics/index.d.ts
17
+ type DiagnosticSeverity = "error" | "warning";
18
+ type DiagnosticLabel = {
19
+ readonly message: string;
20
+ readonly path: string;
21
+ readonly sourceSpan?: SourceSpan;
22
+ readonly severity?: "primary" | "secondary";
23
+ };
24
+ type Diagnostic = {
25
+ readonly severity: DiagnosticSeverity;
26
+ readonly code: string;
27
+ readonly title: string;
28
+ readonly message?: string;
29
+ readonly labels: readonly DiagnosticLabel[];
30
+ readonly notes?: readonly string[];
31
+ readonly help?: readonly string[];
32
+ };
33
+ type Diagnostics = {
34
+ readonly items: readonly Diagnostic[];
35
+ readonly hasErrors: boolean;
36
+ readonly hasWarnings: boolean;
37
+ };
38
+ //#endregion
39
+ //#region src/graph/types.d.ts
40
+ type Brand<T, B extends string> = T & {
41
+ readonly __brand: B;
42
+ };
43
+ type GraphNodeId = Brand<string, "GraphNodeId">;
44
+ type StyleEntityId = Brand<string, "StyleEntityId">;
45
+ type AssetEntityId = Brand<string, "AssetEntityId">;
46
+ type SemanticNodeKind = "container" | "document" | "image" | "shape" | "slide" | "text" | "textRun";
47
+ type SemanticRole = {
48
+ readonly kind: "document";
49
+ } | {
50
+ readonly kind: "slide";
51
+ } | {
52
+ readonly kind: "genericContainer";
53
+ } | {
54
+ readonly kind: "sectioning";
55
+ readonly tag: SectioningTag;
56
+ } | {
57
+ readonly kind: "figure";
58
+ } | {
59
+ readonly kind: "paragraph";
60
+ } | {
61
+ readonly kind: "heading";
62
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
63
+ } | {
64
+ readonly kind: "image";
65
+ } | {
66
+ readonly kind: "shape";
67
+ };
68
+ type SemanticOrigin = {
69
+ readonly kind: "authored" | "implicit";
70
+ readonly path: string;
71
+ readonly sourceSpan?: SourceSpan;
72
+ readonly reason?: "primitive-text-in-container";
73
+ };
74
+ type BaseSemanticNode = {
75
+ readonly id: GraphNodeId;
76
+ readonly kind: SemanticNodeKind;
77
+ readonly origin: SemanticOrigin;
78
+ readonly authoredTag?: AuthoredTag;
79
+ readonly authoredComponent?: AuthoredComponent;
80
+ readonly role?: SemanticRole;
81
+ readonly key?: JsxKey;
82
+ readonly styleRef?: StyleEntityId;
83
+ };
84
+ type SemanticDocumentNode = BaseSemanticNode & {
85
+ readonly kind: "document";
86
+ readonly children: readonly GraphNodeId[];
87
+ };
88
+ type SemanticSlideNode = BaseSemanticNode & {
89
+ readonly kind: "slide";
90
+ readonly name?: string;
91
+ readonly children: readonly GraphNodeId[];
92
+ };
93
+ type SemanticContainerNode = BaseSemanticNode & {
94
+ readonly kind: "container";
95
+ readonly children: readonly GraphNodeId[];
96
+ };
97
+ type SemanticTextNode = BaseSemanticNode & {
98
+ readonly kind: "text";
99
+ readonly inlineChildren: readonly GraphNodeId[];
100
+ readonly implicit?: boolean;
101
+ };
102
+ type SemanticTextRunNode = BaseSemanticNode & {
103
+ readonly kind: "textRun";
104
+ readonly text: string;
105
+ };
106
+ type SemanticImageNode = BaseSemanticNode & {
107
+ readonly kind: "image";
108
+ readonly assetRef?: AssetEntityId;
109
+ };
110
+ type SemanticShapeNode = BaseSemanticNode & {
111
+ readonly kind: "shape";
112
+ };
113
+ type SemanticNode = SemanticContainerNode | SemanticDocumentNode | SemanticImageNode | SemanticShapeNode | SemanticSlideNode | SemanticTextNode | SemanticTextRunNode;
114
+ type StyleEntity = {
115
+ readonly id: StyleEntityId;
116
+ readonly target: SemanticNodeKind;
117
+ readonly authored: {
118
+ readonly style?: unknown;
119
+ readonly direct?: unknown;
120
+ };
121
+ readonly resolved?: unknown;
122
+ };
123
+ type AssetEntity = {
124
+ readonly id: AssetEntityId;
125
+ readonly kind: "image";
126
+ readonly source: {
127
+ readonly kind: "path";
128
+ readonly path: string;
129
+ } | {
130
+ readonly kind: "data";
131
+ readonly data: string;
132
+ };
133
+ readonly metadata: {
134
+ readonly mediaType?: string;
135
+ readonly byteLength?: number;
136
+ readonly widthPx?: number;
137
+ readonly heightPx?: number;
138
+ readonly contentHash?: string;
139
+ };
140
+ readonly resolution: "failed" | "resolved" | "unresolved";
141
+ };
142
+ type SemanticAuthorGraph = {
143
+ readonly documentId: GraphNodeId;
144
+ readonly nodes: ReadonlyMap<GraphNodeId, SemanticNode>;
145
+ readonly styles: ReadonlyMap<StyleEntityId, StyleEntity>;
146
+ readonly assets: ReadonlyMap<AssetEntityId, AssetEntity>;
147
+ };
148
+ //#endregion
3
149
  //#region src/ir/index.d.ts
4
150
  type PresentationIR = {
5
151
  version: "0.1";
@@ -171,6 +317,11 @@ type EdgeStrokeIR = {
171
317
  };
172
318
  type TextContentIR = {
173
319
  text: string;
320
+ runs?: ReadonlyArray<TextRunIR>;
321
+ };
322
+ type TextRunIR = {
323
+ text: string;
324
+ style?: TextStyleIR;
174
325
  };
175
326
  type TextTabStopIR = {
176
327
  positionIn: number;
@@ -238,11 +389,23 @@ type CompileBackend = {
238
389
  };
239
390
  //#endregion
240
391
  //#region src/deck.d.ts
392
+ type CompileMode = "inspect" | "strict";
393
+ type CompileInspectResult = {
394
+ readonly graph?: SemanticAuthorGraph;
395
+ readonly diagnostics: Diagnostics;
396
+ };
241
397
  declare class Deck {
242
398
  #private;
243
399
  constructor(options: DeckOptions);
244
400
  add(slide: SlideFactory): this;
245
401
  render(): PresentationIR;
402
+ compile(): SemanticAuthorGraph;
403
+ compile(config: {
404
+ mode?: "strict";
405
+ }): SemanticAuthorGraph;
406
+ compile(config: {
407
+ mode: "inspect";
408
+ }): CompileInspectResult;
246
409
  output(config: OutputConfig): Promise<void>;
247
410
  }
248
411
  //#endregion
@@ -267,4 +430,4 @@ declare global {
267
430
  }
268
431
  }
269
432
  //#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 DeckJsxIntrinsicElements, 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 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 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 };
433
+ 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 CompileBackend, type CompileInspectResult, type CompileMode, 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 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 SlideContext, type SlideFactory, type SlideIR, type SlideProps, type SlideStyle, type SolidFillIR, type SourceSpan, type Spacing, type StackAlignment, type StackAxis, type StrokeDashType, type StrokeIR, type StrokeLineCap, type StrokeLineJoin, type StyleEntity, type StyleEntityId, Text, type TextBulletListIR, type TextContentIR, type TextFit, type TextIR, type TextJsxChild, type TextListIR, type TextNoListIR, type TextNumberListIR, type TextProps, type TextRunIR, type TextStyle, type TextStyleIR, type TextTabStopAlignment, type TextTabStopAuthoring, type TextTabStopIR, type TextTabStopLength, type VerticalAlign, View, type ViewProps, type ViewStyle, createElement, formatDiagnostic, formatDiagnostics, isAuthorNode, isContentNode, isSlideNode, pptxgenjsBackend };