@lofcz/pptist 2.0.9 → 2.0.10

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.
@@ -0,0 +1,32 @@
1
+ import { type BuiltInTemplateId, type TemplatePayload } from '../../configs/templates';
2
+ import type { Slide, SlideTheme, SlideType } from '../../types/slides';
3
+ export interface PptistTemplateSummary {
4
+ /** Built-in id, e.g. `template_1` (Crimson landscape). */
5
+ id: BuiltInTemplateId | string;
6
+ name: string;
7
+ cover: string;
8
+ origin?: string;
9
+ }
10
+ export interface PptistTemplateSlideEntry {
11
+ /** Stable slug within this template, e.g. `cover_1`, `content_2`. */
12
+ slug: string;
13
+ type: SlideType;
14
+ description: string;
15
+ elementCount: number;
16
+ }
17
+ export type PptistTemplateSlidesCatalog = Record<SlideType, PptistTemplateSlideEntry[]>;
18
+ export interface PptistTemplateSlidesCatalogResult {
19
+ templateId: string;
20
+ templateName: string;
21
+ slideCount: number;
22
+ byType: PptistTemplateSlidesCatalog;
23
+ }
24
+ export declare function listTemplateCatalog(): PptistTemplateSummary[];
25
+ export declare function loadTemplatePayload(templateId: string): Promise<TemplatePayload>;
26
+ export declare function buildTemplateSlidesCatalog(templateId: string): Promise<PptistTemplateSlidesCatalogResult>;
27
+ export declare function resolveTemplateSlide(payload: TemplatePayload, slug: string): {
28
+ slide: Slide;
29
+ type: SlideType;
30
+ };
31
+ export declare function assertBuiltInTemplateId(templateId: string): asserts templateId is BuiltInTemplateId;
32
+ export declare function templateThemePatch(payload: TemplatePayload): Partial<SlideTheme> | undefined;
@@ -2,12 +2,10 @@ import type { Locales } from '../../i18n/locale';
2
2
  import type { ShapeCategoryKey, ShapePoolItem } from '../../configs/shapes';
3
3
  import type { Broken2LineDirection, ChartData, ChartOptions, ChartType, Gradient, LinePoint, LineStyleType, Note, NoteReply, PPTAnimation, PPTAudioElement, PPTChartElement, PPTElement, PPTElementLink, PPTElementOutline, PPTElementShadow, PPTImageElement, PPTLatexElement, PPTLineElement, PPTShapeElement, PPTTableElement, PPTTextElement, PPTVideoElement, ShapeText, Slide, SlideBackground, SlideTemplate, SlideTheme, TableCell, TableCellStyle, TextAlign, TurningMode } from '../../types/slides';
4
4
  import type { PptistDocument } from '../types';
5
- import type { PptistStyleSummary } from './styles';
6
- import type { PptistLayout, PptistLayoutBackgroundMode } from './layouts';
5
+ import type { PptistTemplateSlidesCatalogResult, PptistTemplateSummary } from './templates';
7
6
  import type { PptistAgenticDocs, PptistCommandDescription, PptistDesignGuide, PptistDomainSummary } from './manifestDocs';
8
7
  export type { PptistAgenticDocs, PptistCommandDescription, PptistCommandDoc, PptistDesignGuide, PptistDesignSystem, PptistDocParam, PptistDomainDoc, PptistDomainSummary, } from './manifestDocs';
9
- export type { PptistStylePreset, PptistStylePalette, PptistStyleScale, PptistStyleFonts, PptistStyleSummary, } from './styles';
10
- export type { PptistLayout, PptistLayoutSlotDef, PptistLayoutBackgroundMode, } from './layouts';
8
+ export type { PptistTemplateSummary, PptistTemplateSlideEntry, PptistTemplateSlidesCatalog, PptistTemplateSlidesCatalogResult, } from './templates';
11
9
  export type PptistKnownCommandType = keyof PptistCommandPayloadMap;
12
10
  export type PptistCommandType = PptistKnownCommandType | (string & {});
13
11
  export interface PptistDeckViewport {
@@ -424,45 +422,31 @@ export interface PptistElementFlipInput {
424
422
  flipH?: boolean;
425
423
  flipV?: boolean;
426
424
  }
427
- export interface PptistApplyStyleOptions {
428
- /** Restyle existing slide content (fonts/colors) to match the preset too. */
429
- applyToSlides?: boolean;
430
- }
431
- export interface PptistApplyStyleResult {
432
- styleId: string;
425
+ export interface PptistApplyTemplateResult {
426
+ templateId: string;
433
427
  theme: SlideTheme;
434
428
  }
435
- export interface PptistCreateFromLayoutInput {
436
- /** Layout id from `layouts.catalog` (e.g. `bullets`, `twoColumn`, `chart`). */
437
- layout: string;
438
- /** Content slots for the layout. Shapes vary per layout (see its `slots`). */
439
- slots?: Record<string, unknown>;
440
- /** Style preset id to use; defaults to the deck's active style. */
441
- style?: string;
442
- /** Insertion index (defaults to the end). */
429
+ export interface PptistInsertFromTemplateInput {
430
+ /** Built-in template id from `templates.catalog` (e.g. `template_1` = Crimson landscape). */
431
+ templateId: string;
432
+ /** Slide slug from `templates.slidesCatalog` (e.g. `cover_1`, `content_2`). */
433
+ slug: string;
443
434
  index?: number;
444
- /** Select the new slide after creating it (default true). */
445
435
  select?: boolean;
446
- /** Background override: `auto` (layout default), `feature` (dark), `plain`. */
447
- background?: PptistLayoutBackgroundMode;
436
+ /** Apply the template theme when the deck is still empty (default true). */
437
+ applyTemplateTheme?: boolean;
448
438
  }
449
- export interface PptistCreateFromLayoutResult {
439
+ export interface PptistInsertFromTemplateResult {
450
440
  slideId: string;
441
+ templateId: string;
442
+ slug: string;
451
443
  elementIds: string[];
452
- layout: string;
453
- styleId: string;
454
444
  }
455
- export interface PptistAgentStylesApi {
456
- /** List the style presets (id, label, fonts, preview colors). */
457
- catalog(): PptistStyleSummary[];
458
- /** Apply a preset to the deck theme (and optionally restyle existing slides). */
459
- apply(style: string, options?: PptistApplyStyleOptions, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistApplyStyleResult>>;
460
- }
461
- export interface PptistAgentLayoutsApi {
462
- /** List the compositional layouts with their content slots. */
463
- catalog(): PptistLayout[];
464
- /** Create a new themed slide from a layout id + slots. */
465
- createSlide(input: PptistCreateFromLayoutInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistCreateFromLayoutResult>>;
445
+ export interface PptistAgentTemplatesApi {
446
+ /** List built-in presentation templates (styles) shown in the template picker. */
447
+ catalog(): PptistTemplateSummary[];
448
+ /** List insertable slides for a template, grouped by type (cover, contents, ). */
449
+ slidesCatalog(templateId: string, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistTemplateSlidesCatalogResult>>;
466
450
  }
467
451
  export interface PptistAgentDeckApi {
468
452
  get(): PptistDeckDocument;
@@ -473,7 +457,7 @@ export interface PptistAgentDeckApi {
473
457
  }>>;
474
458
  getTheme(): SlideTheme;
475
459
  setTheme(theme: PptistSlideThemePatch, meta?: PptistCommandMeta): Promise<PptistCommandResult<SlideTheme>>;
476
- applyStyle(style: string, options?: PptistApplyStyleOptions, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistApplyStyleResult>>;
460
+ applyTemplate(templateId: string, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistApplyTemplateResult>>;
477
461
  applyTheme(theme: PptistSlideThemePatch, options?: PptistApplyThemeOptions, meta?: PptistCommandMeta): Promise<PptistCommandResult<SlideTheme>>;
478
462
  extractTheme(options?: PptistThemeExtractionOptions): SlideTheme;
479
463
  setViewport(viewport: {
@@ -488,7 +472,7 @@ export interface PptistAgentSlidesApi {
488
472
  current(): Slide | null;
489
473
  read(slideIdOrIndex?: PptistSlideReference, meta?: PptistCommandMeta): Promise<PptistCommandResult<Slide | null>>;
490
474
  create(input?: PptistCreateSlideInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<Slide>>;
491
- createFromLayout(input: PptistCreateFromLayoutInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistCreateFromLayoutResult>>;
475
+ insertFromTemplate(input: PptistInsertFromTemplateInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistInsertFromTemplateResult>>;
492
476
  insert(input: PptistInsertSlidesInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistInsertSlidesResult>>;
493
477
  update(slideId: string, patch: Partial<Slide>, meta?: PptistCommandMeta): Promise<PptistCommandResult<Slide>>;
494
478
  delete(slideId: string | string[], meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistDeleteSlidesResult>>;
@@ -1028,8 +1012,7 @@ export interface PptistAgentApi {
1028
1012
  guides(guideId?: string): PptistDesignGuide[] | PptistDesignGuide | null;
1029
1013
  deck: PptistAgentDeckApi;
1030
1014
  slides: PptistAgentSlidesApi;
1031
- styles: PptistAgentStylesApi;
1032
- layouts: PptistAgentLayoutsApi;
1015
+ templates: PptistAgentTemplatesApi;
1033
1016
  elements: PptistAgentElementsApi;
1034
1017
  text: PptistAgentTextApi;
1035
1018
  shapes: PptistAgentShapesApi;
@@ -1067,9 +1050,8 @@ export interface PptistCommandPayloadMap {
1067
1050
  theme: PptistSlideThemePatch | Partial<SlideTheme>;
1068
1051
  options?: PptistApplyThemeOptions;
1069
1052
  };
1070
- 'deck.applyStyle': {
1071
- style: string;
1072
- applyToSlides?: boolean;
1053
+ 'deck.applyTemplate': {
1054
+ templateId: string;
1073
1055
  };
1074
1056
  'deck.extractTheme': {
1075
1057
  options?: PptistThemeExtractionOptions;
@@ -1081,8 +1063,10 @@ export interface PptistCommandPayloadMap {
1081
1063
  'deck.setTemplates': {
1082
1064
  templates: SlideTemplate[];
1083
1065
  };
1084
- 'styles.catalog': undefined;
1085
- 'layouts.catalog': undefined;
1066
+ 'templates.catalog': undefined;
1067
+ 'templates.slidesCatalog': {
1068
+ templateId: string;
1069
+ };
1086
1070
  'import.json': PptistDocumentImportPayload;
1087
1071
  'import.pptist': PptistDocumentImportPayload;
1088
1072
  'import.pptxSafe': PptistDocumentImportPayload;
@@ -1097,7 +1081,7 @@ export interface PptistCommandPayloadMap {
1097
1081
  slideIdOrIndex?: PptistSlideReference;
1098
1082
  } | undefined;
1099
1083
  'slides.create': PptistCreateSlideInput | undefined;
1100
- 'slides.createFromLayout': PptistCreateFromLayoutInput;
1084
+ 'slides.insertFromTemplate': PptistInsertFromTemplateInput;
1101
1085
  'slides.insert': PptistInsertSlidesInput;
1102
1086
  'slides.update': {
1103
1087
  slideId: string;
@@ -1698,12 +1682,12 @@ export interface PptistCommandResultDataMap {
1698
1682
  'deck.getTheme': SlideTheme;
1699
1683
  'deck.setTheme': SlideTheme;
1700
1684
  'deck.applyTheme': SlideTheme;
1701
- 'deck.applyStyle': PptistApplyStyleResult;
1685
+ 'deck.applyTemplate': PptistApplyTemplateResult;
1702
1686
  'deck.extractTheme': SlideTheme;
1703
1687
  'deck.setViewport': PptistBridgeState;
1704
1688
  'deck.setTemplates': SlideTemplate[];
1705
- 'styles.catalog': PptistStyleSummary[];
1706
- 'layouts.catalog': PptistLayout[];
1689
+ 'templates.catalog': PptistTemplateSummary[];
1690
+ 'templates.slidesCatalog': PptistTemplateSlidesCatalogResult;
1707
1691
  'import.json': PptistDeckDocument;
1708
1692
  'import.pptist': PptistDeckDocument;
1709
1693
  'import.pptxSafe': PptistDeckDocument;
@@ -1713,7 +1697,7 @@ export interface PptistCommandResultDataMap {
1713
1697
  'slides.current': Slide | null;
1714
1698
  'slides.read': Slide | null;
1715
1699
  'slides.create': Slide;
1716
- 'slides.createFromLayout': PptistCreateFromLayoutResult;
1700
+ 'slides.insertFromTemplate': PptistInsertFromTemplateResult;
1717
1701
  'slides.insert': PptistInsertSlidesResult;
1718
1702
  'slides.update': Slide;
1719
1703
  'slides.delete': PptistDeleteSlidesResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/pptist",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "PPTist presentation editor embed bundle with a typed agentic bridge.",
5
5
  "type": "module",
6
6
  "main": "dist/embed/pptist-embed.js",