@lofcz/pptist 2.0.12 → 2.0.14

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.
@@ -1,20 +1,3 @@
1
- /**
2
- * Compositional slide layouts for the agentic bridge.
3
- *
4
- * A "layout" is a named, pre-composed slide recipe (title, bullets, two-column,
5
- * image+text, big stat, quote, chart, comparison, …). The agent picks a layout
6
- * by id and fills a few content *slots*; the builder here lays out themed,
7
- * contrast-safe elements using the active style preset's role tokens and a
8
- * fixed margin grid. This is the preferred way to add slides — it removes the
9
- * need to hand-place boxes or hand-pick colors/sizes, and it never emits raw
10
- * authoring HTML the agent has to reason about.
11
- *
12
- * Builders are deterministic and pure (no async, no store access): given a
13
- * viewport, a style preset, and slots, they return a `Partial<Slide>` that the
14
- * bridge normalizes and inserts. Text content is rendered to the small, safe
15
- * HTML subset PPTist stores (`<p>/<ul>/<li>/<span style>` with inline size and
16
- * color), with light inline markdown (`**bold**`, `_italic_`, `` `code` ``).
17
- */
18
1
  import type { PPTChartElement, PPTImageElement, PPTShapeElement, PPTTableElement, PPTTextElement, Slide } from '../../types/slides';
19
2
  import type { PptistStylePreset } from './styles';
20
3
  /**
@@ -62,8 +45,9 @@ export interface PptistLayoutBuildResult {
62
45
  /**
63
46
  * Build a themed slide from a layout id + content slots. Pure and deterministic:
64
47
  * returns a `Partial<Slide>` (background + un-normalized elements) plus any
65
- * non-fatal warnings (e.g. a missing optional image). Throws on missing
66
- * required slots or an unknown layout.
48
+ * non-fatal warnings (e.g. a missing optional image). Text is auto-fit to each
49
+ * box via pretext, so content never overflows. Throws on missing required slots
50
+ * or an unknown layout.
67
51
  */
68
52
  export declare function buildLayoutSlide(layoutId: string, slots: Slots, preset: PptistStylePreset, viewport: {
69
53
  width: number;
@@ -3,9 +3,13 @@ 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
5
  import type { PptistTemplateSlidesCatalogResult, PptistTemplateSummary } from './templates';
6
+ import type { PptistLayout, PptistLayoutBackgroundMode } from './layouts';
7
+ import type { PptistStyleSummary } from './styles';
6
8
  import type { PptistAgenticDocs, PptistCommandDescription, PptistDesignGuide, PptistDomainSummary } from './manifestDocs';
7
9
  export type { PptistAgenticDocs, PptistCommandDescription, PptistCommandDoc, PptistDesignGuide, PptistDesignSystem, PptistDocParam, PptistDomainDoc, PptistDomainSummary, } from './manifestDocs';
8
10
  export type { PptistTemplateSummary, PptistTemplateSlideEntry, PptistTemplateSlidesCatalog, PptistTemplateSlidesCatalogResult, } from './templates';
11
+ export type { PptistLayout, PptistLayoutSlotDef, PptistLayoutBackgroundMode, } from './layouts';
12
+ export type { PptistStyleSummary, PptistStylePreset, PptistStylePalette, PptistStyleScale, PptistStyleFonts, } from './styles';
9
13
  export type PptistKnownCommandType = keyof PptistCommandPayloadMap;
10
14
  export type PptistCommandType = PptistKnownCommandType | (string & {});
11
15
  export interface PptistDeckViewport {
@@ -450,6 +454,35 @@ export interface PptistAgentTemplatesApi {
450
454
  /** List insertable slides for a template, grouped by type (cover, contents, …). */
451
455
  slidesCatalog(templateId: string, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistTemplateSlidesCatalogResult>>;
452
456
  }
457
+ export interface PptistApplyStyleResult {
458
+ /** The preset id actually applied (the requested one, or the default fallback). */
459
+ styleId: string;
460
+ theme: SlideTheme;
461
+ }
462
+ export interface PptistCreateFromLayoutInput {
463
+ /** Layout id from `layouts.catalog` (e.g. `title`, `bullets`, `twoColumn`). */
464
+ layoutId: string;
465
+ /** Content slots for the layout. Keys + shapes are described per layout in the catalog. */
466
+ slots?: Record<string, unknown>;
467
+ index?: number;
468
+ select?: boolean;
469
+ /** Force a feature (dark) or plain background; defaults to the layout's own preference. */
470
+ backgroundMode?: PptistLayoutBackgroundMode;
471
+ }
472
+ export interface PptistCreateFromLayoutResult {
473
+ slideId: string;
474
+ layoutId: string;
475
+ elementIds: string[];
476
+ textElementIds: string[];
477
+ }
478
+ export interface PptistAgentStylesApi {
479
+ /** List the contrast-safe visual identity presets (academic/minimal/bold/playful). */
480
+ catalog(): PptistStyleSummary[];
481
+ }
482
+ export interface PptistAgentLayoutsApi {
483
+ /** List the compositional slide recipes and their content slots. */
484
+ catalog(): PptistLayout[];
485
+ }
453
486
  export interface PptistAgentDeckApi {
454
487
  get(): PptistDeckDocument;
455
488
  set(document: PptistDeckInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistDeckDocument>>;
@@ -460,6 +493,8 @@ export interface PptistAgentDeckApi {
460
493
  getTheme(): SlideTheme;
461
494
  setTheme(theme: PptistSlideThemePatch, meta?: PptistCommandMeta): Promise<PptistCommandResult<SlideTheme>>;
462
495
  applyTemplate(templateId: string, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistApplyTemplateResult>>;
496
+ /** Apply a style preset (from `styles.catalog`) as the deck's visual identity; records `theme.styleId`. */
497
+ applyStyle(styleId: string, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistApplyStyleResult>>;
463
498
  applyTheme(theme: PptistSlideThemePatch, options?: PptistApplyThemeOptions, meta?: PptistCommandMeta): Promise<PptistCommandResult<SlideTheme>>;
464
499
  extractTheme(options?: PptistThemeExtractionOptions): SlideTheme;
465
500
  setViewport(viewport: {
@@ -474,6 +509,8 @@ export interface PptistAgentSlidesApi {
474
509
  current(): Slide | null;
475
510
  read(slideIdOrIndex?: PptistSlideReference, meta?: PptistCommandMeta): Promise<PptistCommandResult<Slide | null>>;
476
511
  create(input?: PptistCreateSlideInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<Slide>>;
512
+ /** Build + insert a themed slide from a layout recipe (from `layouts.catalog`) using the active style preset. */
513
+ createFromLayout(input: PptistCreateFromLayoutInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistCreateFromLayoutResult>>;
477
514
  insertFromTemplate(input: PptistInsertFromTemplateInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistInsertFromTemplateResult>>;
478
515
  insert(input: PptistInsertSlidesInput, meta?: PptistCommandMeta): Promise<PptistCommandResult<PptistInsertSlidesResult>>;
479
516
  update(slideId: string, patch: Partial<Slide>, meta?: PptistCommandMeta): Promise<PptistCommandResult<Slide>>;
@@ -1015,6 +1052,8 @@ export interface PptistAgentApi {
1015
1052
  deck: PptistAgentDeckApi;
1016
1053
  slides: PptistAgentSlidesApi;
1017
1054
  templates: PptistAgentTemplatesApi;
1055
+ styles: PptistAgentStylesApi;
1056
+ layouts: PptistAgentLayoutsApi;
1018
1057
  elements: PptistAgentElementsApi;
1019
1058
  text: PptistAgentTextApi;
1020
1059
  shapes: PptistAgentShapesApi;
@@ -1055,6 +1094,9 @@ export interface PptistCommandPayloadMap {
1055
1094
  'deck.applyTemplate': {
1056
1095
  templateId: string;
1057
1096
  };
1097
+ 'deck.applyStyle': {
1098
+ styleId: string;
1099
+ };
1058
1100
  'deck.extractTheme': {
1059
1101
  options?: PptistThemeExtractionOptions;
1060
1102
  } | undefined;
@@ -1069,6 +1111,8 @@ export interface PptistCommandPayloadMap {
1069
1111
  'templates.slidesCatalog': {
1070
1112
  templateId: string;
1071
1113
  };
1114
+ 'styles.catalog': undefined;
1115
+ 'layouts.catalog': undefined;
1072
1116
  'import.json': PptistDocumentImportPayload;
1073
1117
  'import.pptist': PptistDocumentImportPayload;
1074
1118
  'import.pptxSafe': PptistDocumentImportPayload;
@@ -1083,6 +1127,7 @@ export interface PptistCommandPayloadMap {
1083
1127
  slideIdOrIndex?: PptistSlideReference;
1084
1128
  } | undefined;
1085
1129
  'slides.create': PptistCreateSlideInput | undefined;
1130
+ 'slides.createFromLayout': PptistCreateFromLayoutInput;
1086
1131
  'slides.insertFromTemplate': PptistInsertFromTemplateInput;
1087
1132
  'slides.insert': PptistInsertSlidesInput;
1088
1133
  'slides.update': {
@@ -1685,11 +1730,14 @@ export interface PptistCommandResultDataMap {
1685
1730
  'deck.setTheme': SlideTheme;
1686
1731
  'deck.applyTheme': SlideTheme;
1687
1732
  'deck.applyTemplate': PptistApplyTemplateResult;
1733
+ 'deck.applyStyle': PptistApplyStyleResult;
1688
1734
  'deck.extractTheme': SlideTheme;
1689
1735
  'deck.setViewport': PptistBridgeState;
1690
1736
  'deck.setTemplates': SlideTemplate[];
1691
1737
  'templates.catalog': PptistTemplateSummary[];
1692
1738
  'templates.slidesCatalog': PptistTemplateSlidesCatalogResult;
1739
+ 'styles.catalog': PptistStyleSummary[];
1740
+ 'layouts.catalog': PptistLayout[];
1693
1741
  'import.json': PptistDeckDocument;
1694
1742
  'import.pptist': PptistDeckDocument;
1695
1743
  'import.pptxSafe': PptistDeckDocument;
@@ -1699,6 +1747,7 @@ export interface PptistCommandResultDataMap {
1699
1747
  'slides.current': Slide | null;
1700
1748
  'slides.read': Slide | null;
1701
1749
  'slides.create': Slide;
1750
+ 'slides.createFromLayout': PptistCreateFromLayoutResult;
1702
1751
  'slides.insertFromTemplate': PptistInsertFromTemplateResult;
1703
1752
  'slides.insert': PptistInsertSlidesResult;
1704
1753
  'slides.update': Slide;
@@ -39,6 +39,8 @@ export interface PptistMountOptions {
39
39
  loadDocument?: PptistDocumentLoader;
40
40
  /** Legacy demo behavior: when explicitly true, load `mocks/slides.json` instead of the starter slide. */
41
41
  loadMockOnEmpty?: boolean;
42
+ /** Set false when the embed host renders its own empty/loading state. */
43
+ showLoadingData?: boolean;
42
44
  /** Customize the default one-slide starter deck used when no existing document is loaded. */
43
45
  starterPresentation?: PptistStarterPresentationOptions;
44
46
  /** Base URL for runtime image/font assets and fallback mock decks. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/pptist",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
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",