@lofcz/pptist 2.0.16 → 2.0.18

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,11 @@
1
+ import type { DialogForExportTypes } from '../types/export';
2
+ /** Non-empty export dialog tab ids. */
3
+ export type ExportTabId = Exclude<DialogForExportTypes, ''>;
4
+ export type PptistExportTabsConfig = Partial<Record<ExportTabId, boolean>>;
5
+ /** Configure which export dialog tabs are available in an embedded host. Omitted keys stay enabled. */
6
+ export declare function setPptistExportTabs(config?: PptistExportTabsConfig): void;
7
+ export declare function getPptistExportTabs(): Readonly<Record<ExportTabId, boolean>>;
8
+ export declare function isExportTabEnabled(tab: ExportTabId): boolean;
9
+ export declare function getEnabledExportTabs(): ExportTabId[];
10
+ /** Resolve a requested export tab to an enabled one, or close the dialog when none are enabled. */
11
+ export declare function resolveExportDialogType(type: DialogForExportTypes): DialogForExportTypes;
@@ -20,7 +20,7 @@ export type PptistLayoutBackgroundMode = 'auto' | 'feature' | 'plain';
20
20
  export interface PptistLayoutSlotDef {
21
21
  name: string;
22
22
  /** Coarse shape of the value the agent should pass for this slot. */
23
- type: 'text' | 'bullets' | 'image' | 'chart' | 'stats' | 'rows';
23
+ type: 'text' | 'bullets' | 'image' | 'chart' | 'stats' | 'rows' | 'cards' | 'steps';
24
24
  required: boolean;
25
25
  description: string;
26
26
  }
@@ -472,6 +472,8 @@ export interface PptistCreateFromLayoutInput {
472
472
  export interface PptistCreateFromLayoutResult {
473
473
  slideId: string;
474
474
  layoutId: string;
475
+ /** True when this slide replaced the deck's lone pristine blank starter. */
476
+ replacedStarter?: boolean;
475
477
  elementIds: string[];
476
478
  textElementIds: string[];
477
479
  }
@@ -1,5 +1,6 @@
1
1
  export { mountPptist, unmountPptist } from './mount';
2
2
  export type { PptistController, PptistDocument, PptistMountOptions, PptistMountResult, PptistDocumentLoader, PptistStarterPresentationOptions, PptistTemplateLoader, PptistTemplatePayload, } from './types';
3
+ export type { ExportTabId, PptistExportTabsConfig } from '../configs/exportTabs';
3
4
  export type * from './agentic/types';
4
5
  export type { Locales as PptistLocales } from '../i18n/locale';
5
6
  export type { ChartData, ChartOptions, ChartType, Note, NoteReply, PPTAnimation, PPTAudioElement, PPTChartElement, PPTElement, PPTElementLink, PPTImageElement, PPTLatexElement, PPTLineElement, PPTShapeElement, PPTTableElement, PPTTextElement, PPTVideoElement, ShapeText, Slide, SlideBackground, SlideTemplate, SlideTheme, TableCell, TableCellStyle, TextAlign, TurningMode, } from '../types/slides';
@@ -1,3 +1,4 @@
1
+ import type { PptistExportTabsConfig } from '../configs/exportTabs';
1
2
  import type { Locales } from '../i18n/locale';
2
3
  import type { Slide, SlideTheme, SlideTemplate } from '../types/slides';
3
4
  import type { PptistAgentApi, PptistSlideReference } from './agentic/types';
@@ -58,6 +59,11 @@ export interface PptistMountOptions {
58
59
  onChangeDebounceMs?: number;
59
60
  /** Fired when PPTist enters or exits slideshow/presentation mode. */
60
61
  onPresentationModeChange?: (screening: boolean) => void;
62
+ /**
63
+ * Toggle export dialog tabs (`pptx`, `image`, `json`, `pdf`, `pptist`).
64
+ * Omitted keys stay enabled. The `pptist` tab also requires `PPTIST_EXTRAS_ENABLED=true` at build time.
65
+ */
66
+ exportTabs?: PptistExportTabsConfig;
61
67
  }
62
68
  /** Public embed controller: legacy host methods plus the generic command and domain APIs. */
63
69
  export interface PptistController extends PptistAgentApi {
@@ -5,6 +5,6 @@ declare const _default: () => {
5
5
  exportImagePPTX: (domRefs: NodeListOf<Element>) => void;
6
6
  exportJSON: () => void;
7
7
  exportSpecificFile: (_slides: Slide[]) => void;
8
- exportPPTX: (_slides: Slide[], masterOverwrite: boolean, ignoreMedia: boolean) => void;
8
+ exportPPTX: (_slides: Slide[], masterOverwrite: boolean, ignoreMedia: boolean) => Promise<void>;
9
9
  };
10
10
  export default _default;
@@ -2157,6 +2157,10 @@ export type NamespaceEditorTranslation = {
2157
2157
  * P​r​e​s​e​t​ ​s​h​a​p​e​s
2158
2158
  */
2159
2159
  presetShapes: string;
2160
+ /**
2161
+ * P​a​t​h​ ​d​r​a​w
2162
+ */
2163
+ pathDraw: string;
2160
2164
  /**
2161
2165
  * F​r​e​e​ ​d​r​a​w
2162
2166
  */
@@ -3120,6 +3124,38 @@ export type NamespaceEditorTranslation = {
3120
3124
  * C​o​l​u​m​n​s​:
3121
3125
  */
3122
3126
  columns: string;
3127
+ /**
3128
+ * A​d​d​ ​r​o​w
3129
+ */
3130
+ addRow: string;
3131
+ /**
3132
+ * A​d​d​ ​a​b​o​v​e
3133
+ */
3134
+ addAbove: string;
3135
+ /**
3136
+ * A​d​d​ ​b​e​l​o​w
3137
+ */
3138
+ addBelow: string;
3139
+ /**
3140
+ * D​e​l​e​t​e​ ​r​o​w
3141
+ */
3142
+ deleteRow: string;
3143
+ /**
3144
+ * A​d​d​ ​c​o​l​u​m​n
3145
+ */
3146
+ addColumn: string;
3147
+ /**
3148
+ * A​d​d​ ​l​e​f​t
3149
+ */
3150
+ addLeft: string;
3151
+ /**
3152
+ * A​d​d​ ​r​i​g​h​t
3153
+ */
3154
+ addRight: string;
3155
+ /**
3156
+ * D​e​l​e​t​e​ ​c​o​l​u​m​n
3157
+ */
3158
+ deleteColumn: string;
3123
3159
  /**
3124
3160
  * E​n​a​b​l​e​ ​t​h​e​m​e​d​ ​t​a​b​l​e​:
3125
3161
  */
@@ -3995,6 +4031,10 @@ export type NamespaceExportTranslation = {
3995
4031
  * E​x​p​o​r​t​ ​f​a​i​l​e​d
3996
4032
  */
3997
4033
  exportFailed: string;
4034
+ /**
4035
+ * E​x​p​o​r​t​ ​f​i​n​i​s​h​e​d​,​ ​b​u​t​ ​s​o​m​e​ ​m​e​d​i​a​ ​c​o​u​l​d​ ​n​o​t​ ​b​e​ ​e​m​b​e​d​d​e​d
4036
+ */
4037
+ exportPartial: string;
3998
4038
  /**
3999
4039
  * S​e​r​i​e​s​ ​{​i​n​d​e​x​}
4000
4040
  * @param {number} index
@@ -4098,7 +4138,7 @@ export type NamespaceExportTranslation = {
4098
4138
  */
4099
4139
  overwriteMaster: string;
4100
4140
  /**
4101
- * T​i​p​:​ ​1​.​ ​S​u​p​p​o​r​t​e​d​ ​f​o​r​m​a​t​s​:​ ​a​v​i​,​ ​m​p​4​,​ ​m​o​v​,​ ​w​m​v​,​ ​m​p​3​,​ ​w​a​v​;​ ​2​.​ ​C​r​o​ss​-​o​r​i​g​i​n​ ​re​s​our​c​e​s​ ​ca​n​n​o​t​ ​b​e​ ​e​x​p​o​r​t​e​d​.
4141
+ * T​i​p​:​ ​1​.​ ​S​u​p​p​o​r​t​e​d​ ​f​o​r​m​a​t​s​:​ ​a​v​i​,​ ​m​p​4​,​ ​m​o​v​,​ ​w​m​v​,​ ​m​p​3​,​ ​w​a​v​;​ ​2​.​ ​Me​d​i​a​ ​f​r​o​mo​t​h​e​r​ ​o​r​i​g​i​n​s​i​s​ fet​c​h​e​d​ ​i​n​ y​o​ur​ ​b​r​o​w​s​e​r​b​e​f​o​r​e​ ​e​x​p​o​r​t​ ​—​ ​i​f​ ​a​ ​s​o​u​r​c​e​ ​b​l​o​c​k​s​ ​t​h​e​ ​f​e​t​c​h​,​ ​i​t​ ​w​i​l​l​ ​b​e​ ​s​k​i​p​p​e​d​.
4102
4142
  */
4103
4143
  mediaExportTip: string;
4104
4144
  /**
@@ -6695,6 +6735,10 @@ export type TranslationFunctions = {
6695
6735
  * Preset shapes
6696
6736
  */
6697
6737
  presetShapes: () => LocalizedString;
6738
+ /**
6739
+ * Path draw
6740
+ */
6741
+ pathDraw: () => LocalizedString;
6698
6742
  /**
6699
6743
  * Free draw
6700
6744
  */
@@ -7664,6 +7708,38 @@ export type TranslationFunctions = {
7664
7708
  * Columns:
7665
7709
  */
7666
7710
  columns: () => LocalizedString;
7711
+ /**
7712
+ * Add row
7713
+ */
7714
+ addRow: () => LocalizedString;
7715
+ /**
7716
+ * Add above
7717
+ */
7718
+ addAbove: () => LocalizedString;
7719
+ /**
7720
+ * Add below
7721
+ */
7722
+ addBelow: () => LocalizedString;
7723
+ /**
7724
+ * Delete row
7725
+ */
7726
+ deleteRow: () => LocalizedString;
7727
+ /**
7728
+ * Add column
7729
+ */
7730
+ addColumn: () => LocalizedString;
7731
+ /**
7732
+ * Add left
7733
+ */
7734
+ addLeft: () => LocalizedString;
7735
+ /**
7736
+ * Add right
7737
+ */
7738
+ addRight: () => LocalizedString;
7739
+ /**
7740
+ * Delete column
7741
+ */
7742
+ deleteColumn: () => LocalizedString;
7667
7743
  /**
7668
7744
  * Enable themed table:
7669
7745
  */
@@ -8545,6 +8621,10 @@ export type TranslationFunctions = {
8545
8621
  * Export failed
8546
8622
  */
8547
8623
  exportFailed: () => LocalizedString;
8624
+ /**
8625
+ * Export finished, but some media could not be embedded
8626
+ */
8627
+ exportPartial: () => LocalizedString;
8548
8628
  /**
8549
8629
  * Series {index}
8550
8630
  */
@@ -8650,7 +8730,7 @@ export type TranslationFunctions = {
8650
8730
  */
8651
8731
  overwriteMaster: () => LocalizedString;
8652
8732
  /**
8653
- * Tip: 1. Supported formats: avi, mp4, mov, wmv, mp3, wav; 2. Cross-origin resources cannot be exported.
8733
+ * Tip: 1. Supported formats: avi, mp4, mov, wmv, mp3, wav; 2. Media from other origins is fetched in your browser before export — if a source blocks the fetch, it will be skipped.
8654
8734
  */
8655
8735
  mediaExportTip: () => LocalizedString;
8656
8736
  /**
@@ -1,6 +1,7 @@
1
1
  import { type Emitter } from 'mitt';
2
2
  export declare const enum EmitterEvents {
3
3
  RICH_TEXT_COMMAND = "RICH_TEXT_COMMAND",
4
+ TABLE_COMMAND = "TABLE_COMMAND",
4
5
  SYNC_RICH_TEXT_ATTRS_TO_STORE = "SYNC_RICH_TEXT_ATTRS_TO_STORE",
5
6
  OPEN_CHART_DATA_EDITOR = "OPEN_CHART_DATA_EDITOR",
6
7
  OPEN_LATEX_EDITOR = "OPEN_LATEX_EDITOR"
@@ -13,8 +14,14 @@ export interface RichTextCommand {
13
14
  target?: string;
14
15
  action: RichTextAction | RichTextAction[];
15
16
  }
17
+ export interface TableCommand {
18
+ targetId: string;
19
+ command: 'insert-row' | 'insert-col' | 'delete-row' | 'delete-col';
20
+ position?: 'before' | 'after';
21
+ }
16
22
  type Events = {
17
23
  [EmitterEvents.RICH_TEXT_COMMAND]: RichTextCommand;
24
+ [EmitterEvents.TABLE_COMMAND]: TableCommand;
18
25
  [EmitterEvents.SYNC_RICH_TEXT_ATTRS_TO_STORE]: void;
19
26
  [EmitterEvents.OPEN_CHART_DATA_EDITOR]: void;
20
27
  [EmitterEvents.OPEN_LATEX_EDITOR]: void;
@@ -1,5 +1,28 @@
1
1
  /** True when a string carries math delimiters the math parser should handle. */
2
2
  export declare function containsMath(source: string): boolean;
3
+ /**
4
+ * A run of either plain text or a single math span, in source order. `raw` is
5
+ * the exact source slice (delimiters included for math); `value` is the inner
6
+ * formula for math (delimiters stripped) and equals `raw` for text.
7
+ */
8
+ export interface ContentSegment {
9
+ type: 'text' | 'math';
10
+ raw: string;
11
+ value: string;
12
+ /** Math only: display (block) vs inline. */
13
+ display: boolean;
14
+ }
15
+ /**
16
+ * Split `source` into ordered text and math segments. This is the robust core
17
+ * behind both line-splitting and inline rendering: it scans once, picking the
18
+ * earliest opener at each position (longest on ties, so `$$` beats `$`), honors
19
+ * backslash escapes (`\$`, `\\`), skips inline code spans (so `` `$x` `` is not
20
+ * read as math) and keeps unterminated openers as literal text (graceful for
21
+ * partial/streamed content). Inline math may not span newlines; display math
22
+ * (`$$`, `\[`, `\begin{}`) may.
23
+ */
24
+ export declare function tokenizeMath(source: string): ContentSegment[];
25
+ export declare function splitLinesPreservingMath(value: string): string[];
3
26
  export declare function markdownToHtml(markdown: string): Promise<string>;
4
27
  /**
5
28
  * Preload the math-capable markdown parser (lazy KaTeX + texmath) so
@@ -9,8 +32,16 @@ export declare function markdownToHtml(markdown: string): Promise<string>;
9
32
  export declare function ensureInlineMathReady(): Promise<void>;
10
33
  /**
11
34
  * Render one line of markdown to inline HTML (no `<p>` wrapper) using the same
12
- * CommonMark + texmath pipeline as {@link markdownToHtml}. Inline math (`$…$`)
13
- * renders only when the math parser has been preloaded via
14
- * {@link ensureInlineMathReady}; otherwise math delimiters read as literal text.
35
+ * CommonMark + texmath pipeline as {@link markdownToHtml}.
36
+ *
37
+ * Plain (math-free) lines use markdown-it's inline renderer directly. Lines that
38
+ * carry math are rendered through the full *block* pipeline and then unwrapped
39
+ * from their single `<p>`: this is what makes display math correct. texmath
40
+ * exposes `\[…\]` and `\begin{env}…\end{env}` only as block rules, so the inline
41
+ * renderer would emit them verbatim; routing through the block parser renders
42
+ * every delimiter (`$…$`, `$$…$$`, `\(…\)`, `\[…\]`, environments), and matches
43
+ * the `text.setMarkdown` output byte-for-byte. Math renders only when the parser
44
+ * has been preloaded via {@link ensureInlineMathReady}; otherwise delimiters
45
+ * read as literal text.
15
46
  */
16
47
  export declare function renderInlineMarkdown(markdown: string): string;
@@ -0,0 +1,9 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
+ close: () => any;
3
+ insert: (path: string) => any;
4
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
5
+ onClose?: (() => any) | undefined;
6
+ onInsert?: ((path: string) => any) | undefined;
7
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  import type { PPTElementOutline, TableCell, TableTheme } from '../../../../types/slides';
2
2
  type __VLS_Props = {
3
+ elementId: string;
3
4
  data: TableCell[][];
4
5
  width: number;
5
6
  cellMinHeight: number;
package/docs/EMBED.md CHANGED
@@ -216,6 +216,24 @@ const result = await controller.execute<PptistDocument>({ type: 'export.json' })
216
216
 
217
217
  `export.json()` and the `export.json` command return the serializable `PptistDocument` model and do not require the editor DOM. PDF, PPTX, and image exports depend on rendered slide DOM, browser canvas/image loading, and the existing export dialogs/hooks, so they are intentionally outside the agentic bridge. Hosts that need those formats should drive PPTist's UI/export workflow in a browser context or add a dedicated DOM-aware integration boundary.
218
218
 
219
+ ### Export dialog tabs
220
+
221
+ Hosts can hide export formats they do not want to expose. Pass `exportTabs` to `mountPptist()`; omitted keys stay enabled. The native `.pptist` tab also requires `PPTIST_EXTRAS_ENABLED=true` at build time.
222
+
223
+ ```ts
224
+ await mountPptist(host, {
225
+ exportTabs: {
226
+ pptx: true,
227
+ image: false,
228
+ json: false,
229
+ pdf: false,
230
+ pptist: false,
231
+ },
232
+ })
233
+ ```
234
+
235
+ When only one tab is enabled, the tab bar is hidden and the export dialog opens directly to that format.
236
+
219
237
  ## sciobot-next wiring
220
238
 
221
239
  1. **package.json** — `"@lofcz/pptist": "^2.0.0"` after the package is published. During local development, sciobot's Vite config can fall back to the sibling `../PPTist/dist/embed` build.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/pptist",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
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",