deckjsx 0.2.0 → 0.3.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/README.md CHANGED
@@ -38,8 +38,8 @@ const deck = new Deck({
38
38
  meta: { title: "Quarterly Review", author: "deckjsx" },
39
39
  });
40
40
 
41
- deck.add(({ slideIndex, totalSlides }) => (
42
- <Slide name={`Slide ${slideIndex + 1}`} style={{ backgroundColor: "#F8FAFC" }}>
41
+ deck.add(({ composition }) => (
42
+ <Slide name={`Slide ${composition.slideIndex + 1}`} style={{ backgroundColor: "#F8FAFC" }}>
43
43
  <main
44
44
  style={{
45
45
  x: 0.7,
@@ -71,7 +71,7 @@ deck.add(({ slideIndex, totalSlides }) => (
71
71
  <p
72
72
  style={{ width: "100%", height: 0.3, fontSize: 11, color: "#64748B", textAlign: "right" }}
73
73
  >
74
- {slideIndex + 1} / {totalSlides}
74
+ {composition.slideIndex + 1} / {composition.totalSlides}
75
75
  </p>
76
76
  </footer>
77
77
  </main>
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
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, $t as SourceIdentity, A as CssFlexDirection, At as CompositionContext, B as CssJustifyContent, Bt as GraphNodeId, C as CssAlignContent, Ct as TextTabStopAlignment, D as CssBoxSizing, Dt as ViewProps, E as CssAspectRatio, Et as VerticalAlign, F as CssGridShorthand, Ft as SourceContextInput, G as CssVisibility, Gt as SemanticNode, H as CssObjectPosition, Ht as SemanticContainerNode, I as CssGridTemplate, It as SourceContextMapper, J as DeckOptions, Jt as SemanticRole, K as DeckJsxIntrinsicElements, Kt as SemanticNodeKind, L as CssGridTemplateAreas, Lt as AssetEntity, M as CssGridAutoFlow, Mt as CompositionSourceInternals, N as CssGridLine, Nt as SlideFactory, O as CssDisplay, Ot as ViewStyle, P as CssGridPlacement, Pt as SlideFactoryInput, Q as ImageProps, Qt as SemanticTextRunNode, R as CssGridTemplateShorthand, Rt as AssetEntityId, S as ContentJsxChild, St as TextStyle, T as CssAlignSelf, Tt as TextTabStopLength, U as CssOverflow, Ut as SemanticDocumentNode, V as CssJustifySelf, Vt as SemanticAuthorGraph, W as CssPosition, Wt as SemanticImageNode, X as ImageCropAuthoring, Xt as SemanticSlideNode, Y as DeckPointLength, Yt as SemanticShapeNode, Z as ImageCropValue, Zt as SemanticTextNode, _ as AuthorNodeProps, _t as StrokeLineCap, a as createElement, an as DiagnosticSeverity, at as IntrinsicViewTag, b as BorderStyle, bt as TextJsxChild, c as isSlideNode, cn as formatDiagnostics, ct as OutputConfig, d as Slide, dn as SemanticGraphDiagnosticError, dt as SlideProps, en as SourceOrigin, et as ImplementedBackendName, f as Text, ft as SlideStyle, g as AuthorNodeMap, gt as StrokeDashType, h as AuthorNodeKind, ht as StackAxis, i as Fragment, in as DiagnosticLabel, it as IntrinsicTextTag, j as CssFlexWrap, jt as CompositionSource, k as CssFlexBasis, kt as COMPOSITION_SOURCE, l as Image, ln as CompositionDiagnosticError, lt as ShapeProps, m as AuthorNode, mn as SourceSpan, mt as StackAlignment, nn as StyleEntityId, nt as IntrinsicImgProps, o as isAuthorNode, on as Diagnostics, ot as JsxNode, p as View, pn as JsxKey, pt as Spacing, q as DeckLength, qt as SemanticOrigin, rn as Diagnostic, rt as IntrinsicPProps, s as isContentNode, sn as formatDiagnostic, st as LayoutMode, tn as StyleEntity, tt as IntrinsicDivProps, u as Shape, un as DeckDiagnosticError, ut as ShapeStyle, v as AuthorNodePropsMap, vt as StrokeLineJoin, w as CssAlignItems, wt as TextTabStopAuthoring, x as ContentAuthorNode, xt as TextProps, y as BackendName, yt as TextFit, z as CssGridTrack, zt as BaseSemanticNode } from "./jsx-runtime-DauuRkY2.mjs";
2
2
 
3
3
  //#region src/ir/index.d.ts
4
4
  type PresentationIR = {
@@ -171,6 +171,11 @@ type EdgeStrokeIR = {
171
171
  };
172
172
  type TextContentIR = {
173
173
  text: string;
174
+ runs?: ReadonlyArray<TextRunIR>;
175
+ };
176
+ type TextRunIR = {
177
+ text: string;
178
+ style?: TextStyleIR;
174
179
  };
175
180
  type TextTabStopIR = {
176
181
  positionIn: number;
@@ -238,13 +243,45 @@ type CompileBackend = {
238
243
  };
239
244
  //#endregion
240
245
  //#region src/deck.d.ts
241
- declare class Deck {
246
+ type CompileMode = "inspect" | "strict";
247
+ type CompileInspectResult = {
248
+ readonly graph?: SemanticAuthorGraph;
249
+ readonly diagnostics: Diagnostics;
250
+ };
251
+ type WithSource<TSourceContext> = [TSourceContext] extends [void] ? never : (sourceContext: TSourceContext) => BoundSource<TSourceContext>;
252
+ declare class BoundSource<TSourceContext = void> implements CompositionSource<TSourceContext> {
242
253
  #private;
243
- constructor(options: DeckOptions);
244
- add(slide: SlideFactory): this;
254
+ constructor(source: Deck<TSourceContext>, sourceContext: TSourceContext);
255
+ [COMPOSITION_SOURCE](): CompositionSourceInternals<TSourceContext>;
256
+ compile(): SemanticAuthorGraph;
257
+ compile(config: {
258
+ mode?: "strict";
259
+ }): SemanticAuthorGraph;
260
+ compile(config: {
261
+ mode: "inspect";
262
+ }): CompileInspectResult;
245
263
  render(): PresentationIR;
246
264
  output(config: OutputConfig): Promise<void>;
247
265
  }
266
+ declare class Deck<TSourceContext = void> implements CompositionSource<TSourceContext> {
267
+ #private;
268
+ readonly withSource: WithSource<TSourceContext>;
269
+ constructor(options: DeckOptions);
270
+ get options(): DeckOptions;
271
+ [COMPOSITION_SOURCE](): CompositionSourceInternals<TSourceContext>;
272
+ add(slide: SlideFactory<TSourceContext>): this;
273
+ mount<TChildContext>(sourceKey: string, child: Deck<TChildContext>, ...context: [TChildContext] extends [void] ? [] : [sourceContext: SourceContextInput<TSourceContext, TChildContext>]): this;
274
+ mount<TChildContext>(sourceKey: string, child: BoundSource<TChildContext>): this;
275
+ render(this: Deck<void>): PresentationIR;
276
+ compile(this: Deck<void>): SemanticAuthorGraph;
277
+ compile(this: Deck<void>, config: {
278
+ mode?: "strict";
279
+ }): SemanticAuthorGraph;
280
+ compile(this: Deck<void>, config: {
281
+ mode: "inspect";
282
+ }): CompileInspectResult;
283
+ output(this: Deck<void>, config: OutputConfig): Promise<void>;
284
+ }
248
285
  //#endregion
249
286
  //#region src/backends/pptxgenjs.d.ts
250
287
  declare function pptxgenjsBackend(): CompileBackend;
@@ -267,4 +304,4 @@ declare global {
267
304
  }
268
305
  }
269
306
  //#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 };
307
+ 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 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 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 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 };