deckjsx 0.6.0 → 0.7.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
@@ -14,7 +14,7 @@ JSX
14
14
  ```
15
15
 
16
16
  This project is being designed as a compiler, not as a thin `PptxGenJS` wrapper.
17
- The API uses a class-based compiler with callback-based `.add()`, `.compile()`, `.project()`, and
17
+ The API uses a class-based compiler with callback-based `.slide()`, `.compile()`, `.project()`, and
18
18
  `.render()`. Authoring uses typed JSX elements with CSS-like style and class semantics.
19
19
 
20
20
  The implementation preserves the compiler model with explicit module boundaries for authoring,
@@ -32,51 +32,63 @@ The package currently targets PPTX output and ships a temporary `pptxgenjs` writ
32
32
  ## Usage
33
33
 
34
34
  ```tsx
35
- import { Deck, Slide } from "deckjsx";
35
+ import { Deck } from "deckjsx";
36
36
 
37
37
  const deck = new Deck({
38
38
  layout: { width: 13.333, height: 7.5, unit: "in" },
39
39
  meta: { title: "Quarterly Review", author: "deckjsx" },
40
40
  });
41
41
 
42
- deck.add(({ composition }) => (
43
- <Slide name={`Slide ${composition.slideIndex + 1}`} style={{ backgroundColor: "#F8FAFC" }}>
44
- <main
45
- style={{
46
- x: 0.7,
47
- y: 0.5,
48
- width: 11.9,
49
- height: 6.3,
50
- display: "grid",
51
- gridTemplateRows: ["0.9in", "1fr", "0.4in"],
52
- rowGap: 0.25,
53
- }}
54
- >
55
- <header>
56
- <h1 style={{ width: "100%", height: 0.6, fontSize: 28, fontWeight: 700, color: "#0F172A" }}>
57
- Quarterly Review
58
- </h1>
59
- </header>
60
-
61
- <section style={{ display: "grid", gridTemplateColumns: "1fr 1fr", columnGap: 0.35 }}>
62
- <p style={{ fontSize: 18, color: "#334155", fit: "shrink" }}>
63
- Author slides with typed JSX, inspect the projected document model, and render PPTX files.
64
- </p>
65
- <figure style={{ backgroundColor: "#E0F2FE", borderRadius: 0.15, padding: 0.25 }}>
66
- <img src="chart.png" style={{ width: "100%", height: "100%", fit: "contain" }} />
67
- </figure>
68
- </section>
69
-
70
- <footer>
71
- <p
72
- style={{ width: "100%", height: 0.3, fontSize: 11, color: "#64748B", textAlign: "right" }}
73
- >
74
- {composition.slideIndex + 1} / {composition.totalSlides}
75
- </p>
76
- </footer>
77
- </main>
78
- </Slide>
79
- ));
42
+ deck.slide(
43
+ { name: "Quarterly Review", style: { backgroundColor: "#F8FAFC" } },
44
+ ({ composition }) => (
45
+ <>
46
+ <main
47
+ style={{
48
+ x: 0.7,
49
+ y: 0.5,
50
+ width: 11.9,
51
+ height: 6.3,
52
+ display: "grid",
53
+ gridTemplateRows: ["0.9in", "1fr", "0.4in"],
54
+ rowGap: 0.25,
55
+ }}
56
+ >
57
+ <header>
58
+ <h1
59
+ style={{ width: "100%", height: 0.6, fontSize: 28, fontWeight: 700, color: "#0F172A" }}
60
+ >
61
+ Quarterly Review
62
+ </h1>
63
+ </header>
64
+
65
+ <section style={{ display: "grid", gridTemplateColumns: "1fr 1fr", columnGap: 0.35 }}>
66
+ <p style={{ fontSize: 18, color: "#334155", fit: "shrink" }}>
67
+ Author slides with typed JSX, inspect the projected document model, and render PPTX
68
+ files.
69
+ </p>
70
+ <figure style={{ backgroundColor: "#E0F2FE", borderRadius: 0.15, padding: 0.25 }}>
71
+ <img src="chart.png" style={{ width: "100%", height: "100%", fit: "contain" }} />
72
+ </figure>
73
+ </section>
74
+
75
+ <footer>
76
+ <p
77
+ style={{
78
+ width: "100%",
79
+ height: 0.3,
80
+ fontSize: 11,
81
+ color: "#64748B",
82
+ textAlign: "right",
83
+ }}
84
+ >
85
+ {composition.slideIndex + 1} / {composition.totalSlides}
86
+ </p>
87
+ </footer>
88
+ </main>
89
+ </>
90
+ ),
91
+ );
80
92
 
81
93
  const project = deck.project();
82
94
  await deck.render({ output: "quarterly-review.pptx" });
@@ -1,5 +1,5 @@
1
- import { Yt as Diagnostics } from "./index-C5l8PX5V.mjs";
2
- import { F as OutputFormat, L as ProjectionFormat, s as PptxPackageModel, z as RenderedArtifact } from "./pptx-PzEK54aA.mjs";
1
+ import { rn as Diagnostics } from "./index-C-LDA3Lj.mjs";
2
+ import { F as OutputFormat, L as ProjectionFormat, s as PptxPackageModel, z as RenderedArtifact } from "./pptx-DaSXvESd.mjs";
3
3
 
4
4
  //#region src/adapter.d.ts
5
5
  type RenderOptions = {
@@ -1,2 +1,2 @@
1
- import { i as pptxgenjs, n as WriterAdapter, r as WriterAdapterResult, t as RenderOptions } from "./adapter-C8xw46nz.mjs";
1
+ import { i as pptxgenjs, n as WriterAdapter, r as WriterAdapterResult, t as RenderOptions } from "./adapter-NxGlM8_c.mjs";
2
2
  export { RenderOptions, WriterAdapter, WriterAdapterResult, pptxgenjs };
package/dist/adapter.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as pptxgenjs } from "./adapter-BbtteJ7s.mjs";
1
+ import { t as pptxgenjs } from "./adapter-rS3mWdi0.mjs";
2
2
  export { pptxgenjs };
@@ -86,129 +86,6 @@ type Diagnostics = {
86
86
  readonly hasWarnings: boolean;
87
87
  };
88
88
  //#endregion
89
- //#region src/graph/types.d.ts
90
- type Brand<T, B extends string> = T & {
91
- readonly __brand: B;
92
- };
93
- type GraphNodeId = Brand<string, "GraphNodeId">;
94
- type StyleEntityId = Brand<string, "StyleEntityId">;
95
- type AssetEntityId = Brand<string, "AssetEntityId">;
96
- type SourceIdentity = Brand<string, "SourceIdentity">;
97
- type SemanticNodeKind = "container" | "document" | "image" | "shape" | "slide" | "text" | "textRun";
98
- type SemanticRole = {
99
- readonly kind: "document";
100
- } | {
101
- readonly kind: "slide";
102
- } | {
103
- readonly kind: "genericContainer";
104
- } | {
105
- readonly kind: "sectioning";
106
- readonly tag: SectioningTag;
107
- } | {
108
- readonly kind: "figure";
109
- } | {
110
- readonly kind: "paragraph";
111
- } | {
112
- readonly kind: "heading";
113
- readonly level: 1 | 2 | 3 | 4 | 5 | 6;
114
- } | {
115
- readonly kind: "image";
116
- } | {
117
- readonly kind: "shape";
118
- };
119
- type SourceOrigin = {
120
- readonly kind: "root";
121
- } | {
122
- readonly kind: "mounted";
123
- readonly sourceKey: string;
124
- readonly sourceIdentity: SourceIdentity;
125
- };
126
- type SemanticOrigin = {
127
- readonly kind: "authored" | "implicit";
128
- readonly path: string;
129
- readonly source?: SourceOrigin;
130
- readonly sourceSpan?: SourceSpan;
131
- readonly reason?: "primitive-text-in-container";
132
- };
133
- type BaseSemanticNode = {
134
- readonly id: GraphNodeId;
135
- readonly kind: SemanticNodeKind;
136
- readonly origin: SemanticOrigin;
137
- readonly authoredTag?: AuthoredTag;
138
- readonly authoredComponent?: AuthoredComponent;
139
- readonly role?: SemanticRole;
140
- readonly key?: JsxKey;
141
- readonly styleRef?: StyleEntityId;
142
- };
143
- type SemanticDocumentNode = BaseSemanticNode & {
144
- readonly kind: "document";
145
- readonly children: readonly GraphNodeId[];
146
- };
147
- type SemanticSlideNode = BaseSemanticNode & {
148
- readonly kind: "slide";
149
- readonly name?: string;
150
- readonly children: readonly GraphNodeId[];
151
- };
152
- type SemanticContainerNode = BaseSemanticNode & {
153
- readonly kind: "container";
154
- readonly children: readonly GraphNodeId[];
155
- };
156
- type SemanticTextNode = BaseSemanticNode & {
157
- readonly kind: "text";
158
- readonly inlineChildren: readonly GraphNodeId[];
159
- readonly implicit?: boolean;
160
- };
161
- type SemanticTextRunNode = BaseSemanticNode & {
162
- readonly kind: "textRun";
163
- readonly text: string;
164
- };
165
- type SemanticImageNode = BaseSemanticNode & {
166
- readonly kind: "image";
167
- readonly assetRef?: AssetEntityId;
168
- };
169
- type SemanticShapeNode = BaseSemanticNode & {
170
- readonly kind: "shape";
171
- readonly shape: "rect" | "ellipse" | "line";
172
- };
173
- type SemanticNode = SemanticContainerNode | SemanticDocumentNode | SemanticImageNode | SemanticShapeNode | SemanticSlideNode | SemanticTextNode | SemanticTextRunNode;
174
- type StyleClassRef = {
175
- readonly name: string;
176
- readonly index: number;
177
- };
178
- type StyleEntity = {
179
- readonly id: StyleEntityId;
180
- readonly target: SemanticNodeKind;
181
- readonly authored: {
182
- readonly style?: unknown;
183
- readonly classRefs?: readonly StyleClassRef[];
184
- };
185
- };
186
- type AssetEntity = {
187
- readonly id: AssetEntityId;
188
- readonly kind: "image";
189
- readonly source: {
190
- readonly kind: "path";
191
- readonly path: string;
192
- } | {
193
- readonly kind: "data";
194
- readonly data: string;
195
- };
196
- readonly metadata: {
197
- readonly mediaType?: string;
198
- readonly byteLength?: number;
199
- readonly widthPx?: number;
200
- readonly heightPx?: number;
201
- readonly contentHash?: string;
202
- };
203
- readonly resolution: "failed" | "resolved" | "unresolved";
204
- };
205
- type SemanticAuthorGraph = {
206
- readonly documentId: GraphNodeId;
207
- readonly nodes: ReadonlyMap<GraphNodeId, SemanticNode>;
208
- readonly styles: ReadonlyMap<StyleEntityId, StyleEntity>;
209
- readonly assets: ReadonlyMap<AssetEntityId, AssetEntity>;
210
- };
211
- //#endregion
212
89
  //#region src/style/types.d.ts
213
90
  type DeckLength = number | `${number}${"in" | "pt" | "px" | "%" | "em" | "rem" | "vh" | "vw" | "ch"}`;
214
91
  type DeckPointLength = number | `${number}${"pt" | "in" | "px" | "em" | "rem" | "vh" | "vw" | "ch"}`;
@@ -464,6 +341,189 @@ type ShapeStyle = FrameAuthorProps & Omit<BoxStyleAuthorProps, "backgroundColor"
464
341
  type TextRunStyle = Pick<TextStyle, "fontFamily" | "fontSize" | "fontWeight" | "italic" | "fontStyle" | "underline" | "strike" | "textDecoration" | "textDecorationLine" | "textDecorationStyle" | "textDecorationColor" | "textTransform" | "direction" | "writingMode" | "color" | "verticalAlign" | "charSpacing" | "letterSpacing" | "href" | "tooltip" | "superscript" | "subscript" | "textShadow">;
465
342
  type StyleForAuthoredTag<TTag extends string> = TTag extends "span" ? TextRunStyle : TTag extends "img" ? ImageStyle : TTag extends "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" ? TextStyle : ViewStyle;
466
343
  //#endregion
344
+ //#region src/templates.d.ts
345
+ /** The concrete frame used by a Template Area before output projection. */
346
+ type TemplateFrame = {
347
+ readonly x: DeckLength;
348
+ readonly y: DeckLength;
349
+ readonly width: DeckLength;
350
+ readonly height: DeckLength;
351
+ };
352
+ /** A named placement area inside a Slide Template. */
353
+ type TemplateArea = {
354
+ readonly frame: TemplateFrame;
355
+ };
356
+ /** A reusable Deck-owned slide structure made of named Template Areas. */
357
+ type SlideTemplate = {
358
+ readonly areas: Readonly<Record<string, TemplateArea>>;
359
+ };
360
+ /** The Deck-local set of Slide Templates available to `deck.slide({ template })`. */
361
+ type SlideTemplateSet = Readonly<Record<string, SlideTemplate>>;
362
+ type EmptySlideTemplateSet = Record<never, never>;
363
+ /**
364
+ * A branded authored reference from slide content to one Template Area.
365
+ *
366
+ * Authors normally obtain this value from the slide factory's `template` handle, for example
367
+ * `area={template.title}`. deckjsx does not expose a root-level constructor for these refs.
368
+ *
369
+ * @typeParam TTemplateName - Name of the Slide Template that owns the referenced area.
370
+ * @typeParam TAreaName - Name of the referenced Template Area.
371
+ */
372
+ type TemplateAreaRef<TTemplateName extends string = string, TAreaName extends string = string> = Readonly<{
373
+ readonly type: "deckjsx.templateAreaRef";
374
+ readonly template: TTemplateName;
375
+ readonly area: TAreaName;
376
+ }> & {
377
+ readonly __deckjsxTemplateAreaRefBrand?: never;
378
+ };
379
+ type TemplateAreaNames<TTemplates extends SlideTemplateSet, TName extends keyof TTemplates> = keyof TTemplates[TName]["areas"] & string;
380
+ /**
381
+ * The typed template handle passed to a templated slide factory.
382
+ *
383
+ * `$name` is a discriminant for template-name unions. Every other key maps to a Template Area
384
+ * Reference for that area.
385
+ *
386
+ * @typeParam TTemplates - Deck-local Slide Template set.
387
+ * @typeParam TName - Selected Slide Template name.
388
+ */
389
+ type TemplateHandle<TTemplates extends SlideTemplateSet, TName extends keyof TTemplates & string> = TName extends keyof TTemplates & string ? {
390
+ readonly $name: TName;
391
+ } & { readonly [AreaName in TemplateAreaNames<TTemplates, TName>]: TemplateAreaRef<TName, AreaName> } : never;
392
+ type TemplateName<TTemplates extends SlideTemplateSet> = keyof TTemplates & string;
393
+ //#endregion
394
+ //#region src/graph/types.d.ts
395
+ type Brand<T, B extends string> = T & {
396
+ readonly __brand: B;
397
+ };
398
+ type GraphNodeId = Brand<string, "GraphNodeId">;
399
+ type StyleEntityId = Brand<string, "StyleEntityId">;
400
+ type AssetEntityId = Brand<string, "AssetEntityId">;
401
+ type SourceIdentity = Brand<string, "SourceIdentity">;
402
+ type SemanticNodeKind = "container" | "document" | "image" | "shape" | "slide" | "text" | "textRun";
403
+ type SemanticRole = {
404
+ readonly kind: "document";
405
+ } | {
406
+ readonly kind: "slide";
407
+ } | {
408
+ readonly kind: "genericContainer";
409
+ } | {
410
+ readonly kind: "sectioning";
411
+ readonly tag: SectioningTag;
412
+ } | {
413
+ readonly kind: "figure";
414
+ } | {
415
+ readonly kind: "paragraph";
416
+ } | {
417
+ readonly kind: "heading";
418
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
419
+ } | {
420
+ readonly kind: "image";
421
+ } | {
422
+ readonly kind: "shape";
423
+ };
424
+ type SourceOrigin = {
425
+ readonly kind: "root";
426
+ } | {
427
+ readonly kind: "mounted";
428
+ readonly sourceKey: string;
429
+ readonly sourceIdentity: SourceIdentity;
430
+ };
431
+ type SemanticOrigin = {
432
+ readonly kind: "authored" | "implicit";
433
+ readonly path: string;
434
+ readonly source?: SourceOrigin;
435
+ readonly sourceSpan?: SourceSpan;
436
+ readonly reason?: "primitive-text-in-container";
437
+ };
438
+ type SemanticTemplateRef = {
439
+ readonly name: string;
440
+ };
441
+ type SemanticTemplateAreaRef = {
442
+ readonly template: string;
443
+ readonly area: string;
444
+ };
445
+ type BaseSemanticNode = {
446
+ readonly id: GraphNodeId;
447
+ readonly kind: SemanticNodeKind;
448
+ readonly origin: SemanticOrigin;
449
+ readonly authoredTag?: AuthoredTag;
450
+ readonly authoredComponent?: AuthoredComponent;
451
+ readonly role?: SemanticRole;
452
+ readonly key?: JsxKey;
453
+ readonly styleRef?: StyleEntityId;
454
+ readonly templateAreaRef?: SemanticTemplateAreaRef;
455
+ };
456
+ type SemanticDocumentNode = BaseSemanticNode & {
457
+ readonly kind: "document";
458
+ readonly children: readonly GraphNodeId[];
459
+ };
460
+ type SemanticSlideNode = BaseSemanticNode & {
461
+ readonly kind: "slide";
462
+ readonly name?: string;
463
+ readonly templateRef?: SemanticTemplateRef;
464
+ readonly children: readonly GraphNodeId[];
465
+ };
466
+ type SemanticContainerNode = BaseSemanticNode & {
467
+ readonly kind: "container";
468
+ readonly children: readonly GraphNodeId[];
469
+ };
470
+ type SemanticTextNode = BaseSemanticNode & {
471
+ readonly kind: "text";
472
+ readonly inlineChildren: readonly GraphNodeId[];
473
+ readonly implicit?: boolean;
474
+ };
475
+ type SemanticTextRunNode = BaseSemanticNode & {
476
+ readonly kind: "textRun";
477
+ readonly text: string;
478
+ };
479
+ type SemanticImageNode = BaseSemanticNode & {
480
+ readonly kind: "image";
481
+ readonly assetRef?: AssetEntityId;
482
+ };
483
+ type SemanticShapeNode = BaseSemanticNode & {
484
+ readonly kind: "shape";
485
+ readonly shape: "rect" | "ellipse" | "line";
486
+ };
487
+ type SemanticNode = SemanticContainerNode | SemanticDocumentNode | SemanticImageNode | SemanticShapeNode | SemanticSlideNode | SemanticTextNode | SemanticTextRunNode;
488
+ type StyleClassRef = {
489
+ readonly name: string;
490
+ readonly index: number;
491
+ };
492
+ type StyleEntity = {
493
+ readonly id: StyleEntityId;
494
+ readonly target: SemanticNodeKind;
495
+ readonly authored: {
496
+ readonly style?: unknown;
497
+ readonly classRefs?: readonly StyleClassRef[];
498
+ };
499
+ };
500
+ type AssetEntity = {
501
+ readonly id: AssetEntityId;
502
+ readonly kind: "image";
503
+ readonly source: {
504
+ readonly kind: "path";
505
+ readonly path: string;
506
+ } | {
507
+ readonly kind: "data";
508
+ readonly data: string;
509
+ };
510
+ readonly metadata: {
511
+ readonly mediaType?: string;
512
+ readonly byteLength?: number;
513
+ readonly widthPx?: number;
514
+ readonly heightPx?: number;
515
+ readonly contentHash?: string;
516
+ };
517
+ readonly resolution: "failed" | "resolved" | "unresolved";
518
+ };
519
+ type SemanticAuthorGraph = {
520
+ readonly documentId: GraphNodeId;
521
+ readonly nodes: ReadonlyMap<GraphNodeId, SemanticNode>;
522
+ readonly styles: ReadonlyMap<StyleEntityId, StyleEntity>;
523
+ readonly assets: ReadonlyMap<AssetEntityId, AssetEntity>;
524
+ readonly templates: ReadonlyMap<string, SlideTemplateSet>;
525
+ };
526
+ //#endregion
467
527
  //#region src/style/stylesheet.d.ts
468
528
  type StyleTargetSelector = string;
469
529
  type StyleClassStyle = SlideStyle | ViewStyle | TextStyle | TextRunStyle | ImageStyle | ShapeStyle;
@@ -524,6 +584,12 @@ declare const Theme: {
524
584
  //#endregion
525
585
  //#region src/composition/types.d.ts
526
586
  declare const COMPOSITION_SOURCE: unique symbol;
587
+ /**
588
+ * Deck-generated composition values passed to every slide factory.
589
+ *
590
+ * `slideIndex` and `totalSlides` are source-local. `deckSlideIndex` and `deckTotalSlides` refer to
591
+ * the fully composed root deck after mounted sources are expanded.
592
+ */
527
593
  type CompositionContext = {
528
594
  readonly sourceKey?: string;
529
595
  readonly slideIndex: number;
@@ -531,13 +597,66 @@ type CompositionContext = {
531
597
  readonly deckSlideIndex: number;
532
598
  readonly deckTotalSlides: number;
533
599
  };
600
+ /**
601
+ * The input shape for a slide factory.
602
+ *
603
+ * Root Decks receive only `composition`; Decks with Source Context also receive `context`.
604
+ *
605
+ * @typeParam TSourceContext - Source Context type required by the declaring Deck.
606
+ */
534
607
  type SlideFactoryInput<TSourceContext = void> = [TSourceContext] extends [void] ? {
535
608
  readonly composition: CompositionContext;
536
609
  } : {
537
610
  readonly context: TSourceContext;
538
611
  readonly composition: CompositionContext;
539
612
  };
540
- type SlideFactory<TSourceContext = void> = (input: SlideFactoryInput<TSourceContext>) => JsxNode;
613
+ /**
614
+ * Slide factory input when a slide selects a Deck Template.
615
+ *
616
+ * The `template` handle exposes typed Template Area References for the selected template.
617
+ *
618
+ * @typeParam TSourceContext - Source Context type required by the declaring Deck.
619
+ * @typeParam TTemplates - Deck-local Slide Template set.
620
+ * @typeParam TTemplateName - Selected Slide Template name.
621
+ */
622
+ type SlideFactoryInputWithTemplate<TSourceContext = void, TTemplates extends SlideTemplateSet = EmptySlideTemplateSet, TTemplateName extends TemplateName<TTemplates> = TemplateName<TTemplates>> = SlideFactoryInput<TSourceContext> & {
623
+ readonly template: TemplateHandle<TTemplates, TTemplateName>;
624
+ };
625
+ /**
626
+ * A callback that returns the authored JSX content for one slide.
627
+ *
628
+ * The returned JSX is slide content, not a public `<Slide>` wrapper.
629
+ *
630
+ * @typeParam TSourceContext - Source Context type required by the declaring Deck.
631
+ * @typeParam TInput - Factory input shape, including template handle when applicable.
632
+ */
633
+ type SlideFactory<TSourceContext = void, TInput extends SlideFactoryInput<TSourceContext> = SlideFactoryInput<TSourceContext>> = (input: TInput) => JsxNode;
634
+ /**
635
+ * Slide-level options for `deck.slide(...)`.
636
+ *
637
+ * `template` is available only when the Deck has a typed template set. `name`, `className`, and
638
+ * `style` apply to the slide declaration itself.
639
+ *
640
+ * @typeParam TTemplates - Deck-local Slide Template set.
641
+ * @typeParam TTemplateName - Selected Slide Template name.
642
+ */
643
+ type SlideOptions<TTemplates extends SlideTemplateSet = EmptySlideTemplateSet, TTemplateName extends TemplateName<TTemplates> = TemplateName<TTemplates>> = {
644
+ readonly name?: string;
645
+ readonly className?: ClassNameValue;
646
+ readonly style?: SlideStyle;
647
+ } & ([TemplateName<TTemplates>] extends [never] ? {
648
+ readonly template?: never;
649
+ } : {
650
+ readonly template?: TTemplateName;
651
+ });
652
+ /**
653
+ * Maps parent Source Context into a mounted child Deck's Source Context.
654
+ *
655
+ * Source Context mappers are synchronous and do not receive Composition Context.
656
+ *
657
+ * @typeParam TParentContext - Source Context type of the parent Deck.
658
+ * @typeParam TChildContext - Source Context type required by the child Deck.
659
+ */
541
660
  type SourceContextMapper<TParentContext, TChildContext> = [TParentContext] extends [void] ? () => TChildContext : (context: TParentContext) => TChildContext;
542
661
  type SourceContextInput<TParentContext, TChildContext> = TChildContext | SourceContextMapper<TParentContext, TChildContext>;
543
662
  type SourceContextBinding<TSourceContext = unknown> = {
@@ -548,7 +667,8 @@ type SourceContextBinding<TSourceContext = unknown> = {
548
667
  };
549
668
  type CompositionEntry<TSourceContext = unknown> = {
550
669
  readonly kind: "slide";
551
- readonly factory: SlideFactory<TSourceContext>;
670
+ readonly options?: SlideOptions<SlideTemplateSet>;
671
+ readonly factory: SlideFactory<TSourceContext, SlideFactoryInput<TSourceContext> & object>;
552
672
  } | {
553
673
  readonly kind: "mount";
554
674
  readonly sourceKey: string;
@@ -560,6 +680,7 @@ type CompositionSourceInternals<TSourceContext = unknown> = {
560
680
  readonly entries: readonly CompositionEntry<TSourceContext>[];
561
681
  readonly stylesheets: readonly StyleSheet[];
562
682
  readonly theme?: Theme;
683
+ readonly templates?: SlideTemplateSet;
563
684
  readonly cycleId: object;
564
685
  readonly boundContext: SourceContextBinding<TSourceContext>;
565
686
  };
@@ -582,12 +703,16 @@ type ClassNameValue = string | false | null | undefined | ClassNameValueArray |
582
703
  type ClassNameAuthorProps = {
583
704
  className?: ClassNameValue;
584
705
  };
585
- type DeckOptions = {
706
+ type TemplateAreaAuthorProps = {
707
+ area?: TemplateAreaRef;
708
+ };
709
+ type DeckOptions<TTemplates extends SlideTemplateSet = EmptySlideTemplateSet> = {
586
710
  layout: {
587
711
  width: number;
588
712
  height: number;
589
713
  unit: "in" | "pt";
590
714
  };
715
+ templates?: TTemplates;
591
716
  meta?: {
592
717
  title?: string;
593
718
  author?: string;
@@ -598,11 +723,9 @@ type DeckOptions = {
598
723
  format?: "pptx";
599
724
  };
600
725
  };
601
- type SlideContext = {
602
- composition: CompositionContext;
603
- };
604
726
  type SlideNodeProps = {
605
727
  name?: string;
728
+ template?: string;
606
729
  className?: ClassNameValue;
607
730
  style?: SlideStyle;
608
731
  background?: string;
@@ -620,13 +743,13 @@ type SlideProps = SlideNodeProps & {
620
743
  };
621
744
  type ViewNodeProps = {
622
745
  style?: ViewStyle;
623
- } & ClassNameAuthorProps & ViewStyle;
746
+ } & ClassNameAuthorProps & TemplateAreaAuthorProps & ViewStyle;
624
747
  type ViewProps = ViewNodeProps & {
625
748
  children?: ContentJsxChild;
626
749
  };
627
750
  type TextNodeProps = {
628
751
  style?: TextStyle;
629
- } & ClassNameAuthorProps & TextStyle;
752
+ } & ClassNameAuthorProps & TemplateAreaAuthorProps & TextStyle;
630
753
  type TextProps = TextNodeProps & {
631
754
  children?: TextJsxChild;
632
755
  };
@@ -635,7 +758,7 @@ type TextRunNodeProps = {
635
758
  } & ClassNameAuthorProps & TextRunStyle;
636
759
  type ImageNodeProps = {
637
760
  style?: ImageStyle;
638
- } & ClassNameAuthorProps & ImageStyle & ({
761
+ } & ClassNameAuthorProps & TemplateAreaAuthorProps & ImageStyle & ({
639
762
  src: string;
640
763
  data?: string;
641
764
  } | {
@@ -648,7 +771,7 @@ type ImageProps = ImageNodeProps & {
648
771
  type ShapeNodeProps = {
649
772
  style?: ShapeStyle;
650
773
  shape: "rect" | "ellipse" | "line";
651
- } & ClassNameAuthorProps & ShapeStyle;
774
+ } & ClassNameAuthorProps & TemplateAreaAuthorProps & ShapeStyle;
652
775
  type ShapeProps = ShapeNodeProps & {
653
776
  children?: never;
654
777
  };
@@ -696,4 +819,4 @@ type DeckJsxIntrinsicElements = {
696
819
  span: IntrinsicSpanProps;
697
820
  } & { [Tag in IntrinsicViewTag]: IntrinsicDivProps } & { [Tag in IntrinsicTextTag]: IntrinsicPProps };
698
821
  //#endregion
699
- export { CssOverflow as $, DeckDiagnosticError as $t, ThemeDefaults as A, SemanticContainerNode as At, CssFlexDirection as B, SemanticTextRunNode as Bt, CompositionSourceInternals as C, ViewStyle as Ct, SourceContextMapper as D, Brand as Dt, SourceContextInput as E, BaseSemanticNode as Et, CssAlignSelf as F, SemanticOrigin as Ft, CssGridShorthand as G, StyleEntityId as Gt, CssGridAutoFlow as H, SourceOrigin as Ht, CssAspectRatio as I, SemanticRole as It, CssGridTemplateShorthand as J, DiagnosticSeverity as Jt, CssGridTemplate as K, Diagnostic as Kt, CssBoxSizing as L, SemanticShapeNode as Lt, BorderStyle as M, SemanticImageNode as Mt, CssAlignContent as N, SemanticNode as Nt, Theme as O, GraphNodeId as Ot, CssAlignItems as P, SemanticNodeKind as Pt, CssObjectPosition as Q, CompositionDiagnosticError as Qt, CssDisplay as R, SemanticSlideNode as Rt, CompositionSource as S, VerticalAlign as St, SlideFactoryInput as T, AssetEntityId as Tt, CssGridLine as U, StyleClassRef as Ut, CssFlexWrap as V, SourceIdentity as Vt, CssGridPlacement as W, StyleEntity as Wt, CssJustifyContent as X, formatDiagnostic as Xt, CssGridTrack as Y, Diagnostics as Yt, CssJustifySelf as Z, formatDiagnostics as Zt, TextProps as _, TextRunStyle as _t, DeckJsxIntrinsicElements as a, JsxKey as an, ImageCropValue as at, COMPOSITION_SOURCE as b, TextTabStopAuthoring as bt, IntrinsicDivProps as c, IntrinsicViewTag$1 as cn, ShapeStyle as ct, IntrinsicTextTag as d, StackAlignment as dt, SemanticGraphDiagnosticError as en, CssPosition as et, IntrinsicViewTag as f, StackAxis as ft, TextJsxChild as g, TextFit as gt, SlideProps as h, StrokeLineJoin as ht, ContentJsxChild as i, AuthorTreeNode as in, ImageCropAuthoring as it, StyleSheet as j, SemanticDocumentNode as jt, ThemeInput as k, SemanticAuthorGraph as kt, IntrinsicImgProps as l, SlideStyle as lt, SlideContext as m, StrokeLineCap as mt, ClassNameValue as n, AuthorElementNode as nn, DeckLength as nt, DeckOptions as o, SourceSpan as on, ImageStyle as ot, ShapeProps as p, StrokeDashType as pt, CssGridTemplateAreas as q, DiagnosticLabel as qt, ClassNameValueArray as r, AuthorTreeChild as rn, DeckPointLength as rt, ImageProps as s, IntrinsicTextTag$1 as sn, LayoutMode as st, ClassNameObject as t, StyleDiagnosticError as tn, CssVisibility as tt, IntrinsicPProps as u, Spacing as ut, TextRunNodeProps as v, TextStyle as vt, SlideFactory as w, AssetEntity as wt, CompositionContext as x, TextTabStopLength as xt, ViewProps as y, TextTabStopAlignment as yt, CssFlexBasis as z, SemanticTextNode as zt };
822
+ export { StyleEntityId as $, ViewStyle as $t, ThemeDefaults as A, CssPosition as At, SemanticImageNode as B, Spacing as Bt, SlideFactoryInput as C, CssGridTemplateAreas as Ct, SourceContextMapper as D, CssJustifySelf as Dt, SourceContextInput as E, CssJustifyContent as Et, Brand as F, ImageCropValue as Ft, SemanticShapeNode as G, StrokeLineJoin as Gt, SemanticNodeKind as H, StackAxis as Ht, GraphNodeId as I, ImageStyle as It, SemanticTextRunNode as J, TextStyle as Jt, SemanticSlideNode as K, TextFit as Kt, SemanticAuthorGraph as L, LayoutMode as Lt, AssetEntity as M, DeckLength as Mt, AssetEntityId as N, DeckPointLength as Nt, Theme as O, CssObjectPosition as Ot, BaseSemanticNode as P, ImageCropAuthoring as Pt, StyleEntity as Q, VerticalAlign as Qt, SemanticContainerNode as R, ShapeStyle as Rt, SlideFactory as S, CssGridTemplate as St, SlideOptions as T, CssGridTrack as Tt, SemanticOrigin as U, StrokeDashType as Ut, SemanticNode as V, StackAlignment as Vt, SemanticRole as W, StrokeLineCap as Wt, SourceOrigin as X, TextTabStopAuthoring as Xt, SourceIdentity as Y, TextTabStopAlignment as Yt, StyleClassRef as Z, TextTabStopLength as Zt, ViewProps as _, CssFlexWrap as _t, DeckJsxIntrinsicElements as a, formatDiagnostics as an, TemplateFrame as at, CompositionSource as b, CssGridPlacement as bt, IntrinsicDivProps as c, SemanticGraphDiagnosticError as cn, BorderStyle as ct, IntrinsicTextTag as d, AuthorTreeChild as dn, CssAlignSelf as dt, Diagnostic as en, EmptySlideTemplateSet as et, IntrinsicViewTag as f, AuthorTreeNode as fn, CssAspectRatio as ft, TextRunNodeProps as g, IntrinsicViewTag$1 as gn, CssFlexDirection as gt, TextProps as h, IntrinsicTextTag$1 as hn, CssFlexBasis as ht, ContentJsxChild as i, formatDiagnostic as in, TemplateAreaRef as it, StyleSheet as j, CssVisibility as jt, ThemeInput as k, CssOverflow as kt, IntrinsicImgProps as l, StyleDiagnosticError as ln, CssAlignContent as lt, TextJsxChild as m, SourceSpan as mn, CssDisplay as mt, ClassNameValue as n, DiagnosticSeverity as nn, SlideTemplateSet as nt, DeckOptions as o, CompositionDiagnosticError as on, TemplateHandle as ot, ShapeProps as p, JsxKey as pn, CssBoxSizing as pt, SemanticTextNode as q, TextRunStyle as qt, ClassNameValueArray as r, Diagnostics as rn, TemplateArea as rt, ImageProps as s, DeckDiagnosticError as sn, TemplateName as st, ClassNameObject as t, DiagnosticLabel as tn, SlideTemplate as tt, IntrinsicPProps as u, AuthorElementNode as un, CssAlignItems as ut, COMPOSITION_SOURCE as v, CssGridAutoFlow as vt, SlideFactoryInputWithTemplate as w, CssGridTemplateShorthand as wt, CompositionSourceInternals as x, CssGridShorthand as xt, CompositionContext as y, CssGridLine as yt, SemanticDocumentNode as z, SlideStyle as zt };