deckjsx 0.5.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 +72 -54
- package/dist/adapter-NxGlM8_c.d.mts +22 -0
- package/dist/{pptxgenjs-BTMKb1WX.mjs → adapter-rS3mWdi0.mjs} +229 -128
- package/dist/adapter.d.mts +2 -0
- package/dist/adapter.mjs +2 -0
- package/dist/{index-sb451NVh.d.mts → index-C-LDA3Lj.d.mts} +260 -139
- package/dist/index.d.mts +183 -4
- package/dist/index.mjs +7517 -5319
- package/dist/inspect.d.mts +3 -3
- package/dist/{jsx-CK-x7PLd.mjs → jsx-DetoUfLm.mjs} +102 -113
- package/dist/jsx-dev-runtime.d.mts +2 -2
- package/dist/jsx-dev-runtime.mjs +1 -1
- package/dist/{jsx-runtime-Bk7Wx3AL.d.mts → jsx-runtime-Dz8WBHpq.d.mts} +2 -3
- package/dist/jsx-runtime.d.mts +2 -2
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/pptx-DaSXvESd.d.mts +448 -0
- package/package.json +2 -2
- package/dist/deck-CvTHG5ik.d.mts +0 -78
- package/dist/index-_eBM2cs3.d.mts +0 -245
- package/dist/legacy.d.mts +0 -6
- package/dist/legacy.mjs +0 -2
|
@@ -86,128 +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
|
-
};
|
|
172
|
-
type SemanticNode = SemanticContainerNode | SemanticDocumentNode | SemanticImageNode | SemanticShapeNode | SemanticSlideNode | SemanticTextNode | SemanticTextRunNode;
|
|
173
|
-
type StyleClassRef = {
|
|
174
|
-
readonly name: string;
|
|
175
|
-
readonly index: number;
|
|
176
|
-
};
|
|
177
|
-
type StyleEntity = {
|
|
178
|
-
readonly id: StyleEntityId;
|
|
179
|
-
readonly target: SemanticNodeKind;
|
|
180
|
-
readonly authored: {
|
|
181
|
-
readonly style?: unknown;
|
|
182
|
-
readonly classRefs?: readonly StyleClassRef[];
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
type AssetEntity = {
|
|
186
|
-
readonly id: AssetEntityId;
|
|
187
|
-
readonly kind: "image";
|
|
188
|
-
readonly source: {
|
|
189
|
-
readonly kind: "path";
|
|
190
|
-
readonly path: string;
|
|
191
|
-
} | {
|
|
192
|
-
readonly kind: "data";
|
|
193
|
-
readonly data: string;
|
|
194
|
-
};
|
|
195
|
-
readonly metadata: {
|
|
196
|
-
readonly mediaType?: string;
|
|
197
|
-
readonly byteLength?: number;
|
|
198
|
-
readonly widthPx?: number;
|
|
199
|
-
readonly heightPx?: number;
|
|
200
|
-
readonly contentHash?: string;
|
|
201
|
-
};
|
|
202
|
-
readonly resolution: "failed" | "resolved" | "unresolved";
|
|
203
|
-
};
|
|
204
|
-
type SemanticAuthorGraph = {
|
|
205
|
-
readonly documentId: GraphNodeId;
|
|
206
|
-
readonly nodes: ReadonlyMap<GraphNodeId, SemanticNode>;
|
|
207
|
-
readonly styles: ReadonlyMap<StyleEntityId, StyleEntity>;
|
|
208
|
-
readonly assets: ReadonlyMap<AssetEntityId, AssetEntity>;
|
|
209
|
-
};
|
|
210
|
-
//#endregion
|
|
211
89
|
//#region src/style/types.d.ts
|
|
212
90
|
type DeckLength = number | `${number}${"in" | "pt" | "px" | "%" | "em" | "rem" | "vh" | "vw" | "ch"}`;
|
|
213
91
|
type DeckPointLength = number | `${number}${"pt" | "in" | "px" | "em" | "rem" | "vh" | "vw" | "ch"}`;
|
|
@@ -463,6 +341,189 @@ type ShapeStyle = FrameAuthorProps & Omit<BoxStyleAuthorProps, "backgroundColor"
|
|
|
463
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">;
|
|
464
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;
|
|
465
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
|
|
466
527
|
//#region src/style/stylesheet.d.ts
|
|
467
528
|
type StyleTargetSelector = string;
|
|
468
529
|
type StyleClassStyle = SlideStyle | ViewStyle | TextStyle | TextRunStyle | ImageStyle | ShapeStyle;
|
|
@@ -523,6 +584,12 @@ declare const Theme: {
|
|
|
523
584
|
//#endregion
|
|
524
585
|
//#region src/composition/types.d.ts
|
|
525
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
|
+
*/
|
|
526
593
|
type CompositionContext = {
|
|
527
594
|
readonly sourceKey?: string;
|
|
528
595
|
readonly slideIndex: number;
|
|
@@ -530,13 +597,66 @@ type CompositionContext = {
|
|
|
530
597
|
readonly deckSlideIndex: number;
|
|
531
598
|
readonly deckTotalSlides: number;
|
|
532
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
|
+
*/
|
|
533
607
|
type SlideFactoryInput<TSourceContext = void> = [TSourceContext] extends [void] ? {
|
|
534
608
|
readonly composition: CompositionContext;
|
|
535
609
|
} : {
|
|
536
610
|
readonly context: TSourceContext;
|
|
537
611
|
readonly composition: CompositionContext;
|
|
538
612
|
};
|
|
539
|
-
|
|
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
|
+
*/
|
|
540
660
|
type SourceContextMapper<TParentContext, TChildContext> = [TParentContext] extends [void] ? () => TChildContext : (context: TParentContext) => TChildContext;
|
|
541
661
|
type SourceContextInput<TParentContext, TChildContext> = TChildContext | SourceContextMapper<TParentContext, TChildContext>;
|
|
542
662
|
type SourceContextBinding<TSourceContext = unknown> = {
|
|
@@ -547,7 +667,8 @@ type SourceContextBinding<TSourceContext = unknown> = {
|
|
|
547
667
|
};
|
|
548
668
|
type CompositionEntry<TSourceContext = unknown> = {
|
|
549
669
|
readonly kind: "slide";
|
|
550
|
-
readonly
|
|
670
|
+
readonly options?: SlideOptions<SlideTemplateSet>;
|
|
671
|
+
readonly factory: SlideFactory<TSourceContext, SlideFactoryInput<TSourceContext> & object>;
|
|
551
672
|
} | {
|
|
552
673
|
readonly kind: "mount";
|
|
553
674
|
readonly sourceKey: string;
|
|
@@ -559,6 +680,7 @@ type CompositionSourceInternals<TSourceContext = unknown> = {
|
|
|
559
680
|
readonly entries: readonly CompositionEntry<TSourceContext>[];
|
|
560
681
|
readonly stylesheets: readonly StyleSheet[];
|
|
561
682
|
readonly theme?: Theme;
|
|
683
|
+
readonly templates?: SlideTemplateSet;
|
|
562
684
|
readonly cycleId: object;
|
|
563
685
|
readonly boundContext: SourceContextBinding<TSourceContext>;
|
|
564
686
|
};
|
|
@@ -567,8 +689,6 @@ type CompositionSource<TSourceContext = unknown> = {
|
|
|
567
689
|
};
|
|
568
690
|
//#endregion
|
|
569
691
|
//#region src/authoring/index.d.ts
|
|
570
|
-
type BackendName = "pptxgenjs" | "ooxml";
|
|
571
|
-
type ImplementedBackendName = "pptxgenjs";
|
|
572
692
|
interface TextJsxChildArray extends ReadonlyArray<TextJsxChild> {}
|
|
573
693
|
type TextJsxChild = AuthorTreeNode | string | number | boolean | null | undefined | TextJsxChildArray;
|
|
574
694
|
interface ContentJsxChildArray extends ReadonlyArray<ContentJsxChild> {}
|
|
@@ -583,28 +703,29 @@ type ClassNameValue = string | false | null | undefined | ClassNameValueArray |
|
|
|
583
703
|
type ClassNameAuthorProps = {
|
|
584
704
|
className?: ClassNameValue;
|
|
585
705
|
};
|
|
586
|
-
type
|
|
706
|
+
type TemplateAreaAuthorProps = {
|
|
707
|
+
area?: TemplateAreaRef;
|
|
708
|
+
};
|
|
709
|
+
type DeckOptions<TTemplates extends SlideTemplateSet = EmptySlideTemplateSet> = {
|
|
587
710
|
layout: {
|
|
588
711
|
width: number;
|
|
589
712
|
height: number;
|
|
590
713
|
unit: "in" | "pt";
|
|
591
714
|
};
|
|
715
|
+
templates?: TTemplates;
|
|
592
716
|
meta?: {
|
|
593
717
|
title?: string;
|
|
594
718
|
author?: string;
|
|
595
719
|
subject?: string;
|
|
596
720
|
};
|
|
597
721
|
theme?: Theme;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
};
|
|
602
|
-
type OutputConfig = {
|
|
603
|
-
backend: ImplementedBackendName;
|
|
604
|
-
output: string;
|
|
722
|
+
output?: {
|
|
723
|
+
format?: "pptx";
|
|
724
|
+
};
|
|
605
725
|
};
|
|
606
726
|
type SlideNodeProps = {
|
|
607
727
|
name?: string;
|
|
728
|
+
template?: string;
|
|
608
729
|
className?: ClassNameValue;
|
|
609
730
|
style?: SlideStyle;
|
|
610
731
|
background?: string;
|
|
@@ -622,13 +743,13 @@ type SlideProps = SlideNodeProps & {
|
|
|
622
743
|
};
|
|
623
744
|
type ViewNodeProps = {
|
|
624
745
|
style?: ViewStyle;
|
|
625
|
-
} & ClassNameAuthorProps & ViewStyle;
|
|
746
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps & ViewStyle;
|
|
626
747
|
type ViewProps = ViewNodeProps & {
|
|
627
748
|
children?: ContentJsxChild;
|
|
628
749
|
};
|
|
629
750
|
type TextNodeProps = {
|
|
630
751
|
style?: TextStyle;
|
|
631
|
-
} & ClassNameAuthorProps & TextStyle;
|
|
752
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps & TextStyle;
|
|
632
753
|
type TextProps = TextNodeProps & {
|
|
633
754
|
children?: TextJsxChild;
|
|
634
755
|
};
|
|
@@ -637,7 +758,7 @@ type TextRunNodeProps = {
|
|
|
637
758
|
} & ClassNameAuthorProps & TextRunStyle;
|
|
638
759
|
type ImageNodeProps = {
|
|
639
760
|
style?: ImageStyle;
|
|
640
|
-
} & ClassNameAuthorProps & ImageStyle & ({
|
|
761
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps & ImageStyle & ({
|
|
641
762
|
src: string;
|
|
642
763
|
data?: string;
|
|
643
764
|
} | {
|
|
@@ -650,7 +771,7 @@ type ImageProps = ImageNodeProps & {
|
|
|
650
771
|
type ShapeNodeProps = {
|
|
651
772
|
style?: ShapeStyle;
|
|
652
773
|
shape: "rect" | "ellipse" | "line";
|
|
653
|
-
} & ClassNameAuthorProps & ShapeStyle;
|
|
774
|
+
} & ClassNameAuthorProps & TemplateAreaAuthorProps & ShapeStyle;
|
|
654
775
|
type ShapeProps = ShapeNodeProps & {
|
|
655
776
|
children?: never;
|
|
656
777
|
};
|
|
@@ -698,4 +819,4 @@ type DeckJsxIntrinsicElements = {
|
|
|
698
819
|
span: IntrinsicSpanProps;
|
|
699
820
|
} & { [Tag in IntrinsicViewTag]: IntrinsicDivProps } & { [Tag in IntrinsicTextTag]: IntrinsicPProps };
|
|
700
821
|
//#endregion
|
|
701
|
-
export {
|
|
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 };
|