@lofcz/pptist 2.0.3 → 2.0.4

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,15 @@
1
+ /**
2
+ * Compile-time feature flags.
3
+ *
4
+ * `EXTRAS_ENABLED` gates demo / upstream-only chrome that has no place in an
5
+ * embedded product build: the AI / AIPPT entry points, the GitHub link, the
6
+ * feedback & FAQ links, and the "for testing only" demo disclaimer.
7
+ *
8
+ * The value comes from the `__PPTIST_EXTRAS_ENABLED__` constant that Vite
9
+ * replaces at build time (see `vite.config.ts` / `vite.config.embed.ts`). Because
10
+ * it resolves to a literal `true`/`false`, any `if (EXTRAS_ENABLED)` branch and
11
+ * any `v-if="EXTRAS_ENABLED"` subtree is eliminated by the bundler when the flag
12
+ * is off — the default for consumer builds. Enable it with
13
+ * `PPTIST_EXTRAS_ENABLED=true` at build time.
14
+ */
15
+ export declare const EXTRAS_ENABLED: boolean;
@@ -1,4 +1,5 @@
1
1
  import type { Directive } from 'vue';
2
+ import 'tippy.js/dist/tippy.css';
2
3
  import './tooltip.scss';
3
4
  declare const TooltipDirective: Directive;
4
5
  export default TooltipDirective;
@@ -0,0 +1,73 @@
1
+ export interface PptistDocParam {
2
+ name: string;
3
+ type?: string;
4
+ required?: boolean;
5
+ description?: string;
6
+ }
7
+ export interface PptistCommandDoc {
8
+ summary?: string;
9
+ details?: string;
10
+ params?: PptistDocParam[];
11
+ examples?: string[];
12
+ tips?: string[];
13
+ related?: string[];
14
+ }
15
+ export interface PptistDomainDoc {
16
+ title: string;
17
+ summary: string;
18
+ whenToUse?: string;
19
+ }
20
+ export interface PptistDesignGuide {
21
+ id: string;
22
+ title: string;
23
+ summary: string;
24
+ /** Body lines (join with "\n" to render). */
25
+ body: string[];
26
+ }
27
+ export interface PptistDesignSystem {
28
+ summary: string;
29
+ coordinateSystem: {
30
+ summary: string;
31
+ notes: string[];
32
+ };
33
+ tokens: {
34
+ summary?: string;
35
+ colors?: Record<string, string>;
36
+ fontFamily?: string;
37
+ fontSizePx?: Record<string, number>;
38
+ spacingPx?: Record<string, number>;
39
+ };
40
+ }
41
+ export interface PptistAgenticDocs {
42
+ version: number;
43
+ summary: string;
44
+ designSystem: PptistDesignSystem;
45
+ domains: Record<string, PptistDomainDoc>;
46
+ commands: Record<string, PptistCommandDoc>;
47
+ guides: PptistDesignGuide[];
48
+ }
49
+ /** A command description merged with live registry facts (registered? mutates?). */
50
+ export interface PptistCommandDescription extends PptistCommandDoc {
51
+ name: string;
52
+ domain: string;
53
+ registered: boolean;
54
+ mutates: boolean;
55
+ }
56
+ /** A domain summary merged with the live registry command list. */
57
+ export interface PptistDomainSummary {
58
+ id: string;
59
+ title: string;
60
+ summary: string;
61
+ whenToUse?: string;
62
+ commandCount: number;
63
+ commands: string[];
64
+ }
65
+ /** Minimal structural view of the command registry needed for introspection. */
66
+ export type PptistCommandRegistryView = ReadonlyMap<string, {
67
+ mutates: boolean;
68
+ }>;
69
+ export declare const AGENTIC_DOCS: PptistAgenticDocs;
70
+ /** Describe a single command: its doc annotation plus live registry facts. */
71
+ export declare function describeAgenticCommand(registry: PptistCommandRegistryView, commandType: string): PptistCommandDescription | null;
72
+ /** List domains (from the live registry + docs) with their command names. */
73
+ export declare function listAgenticDomains(registry: PptistCommandRegistryView): PptistDomainSummary[];
@@ -2,6 +2,8 @@ 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 { PptistAgenticDocs, PptistCommandDescription, PptistDesignGuide, PptistDomainSummary } from './manifestDocs';
6
+ export type { PptistAgenticDocs, PptistCommandDescription, PptistCommandDoc, PptistDesignGuide, PptistDesignSystem, PptistDocParam, PptistDomainDoc, PptistDomainSummary, } from './manifestDocs';
5
7
  export type PptistKnownCommandType = keyof PptistCommandPayloadMap;
6
8
  export type PptistCommandType = PptistKnownCommandType | (string & {});
7
9
  export interface PptistDeckViewport {
@@ -276,7 +278,10 @@ export interface PptistLineStyleInput {
276
278
  export interface PptistCreateTextInput {
277
279
  slideId?: string;
278
280
  index?: number;
281
+ /** HTML content (wins over `markdown` when both are supplied). */
279
282
  content?: string;
283
+ /** Markdown content; converted to HTML by the bridge. */
284
+ markdown?: string;
280
285
  element?: Partial<PPTTextElement>;
281
286
  select?: boolean;
282
287
  }
@@ -557,6 +562,10 @@ export interface PptistAgentTextApi {
557
562
  setContent(elementId: string, content: string, meta?: PptistCommandMeta & {
558
563
  slideId?: string;
559
564
  }): Promise<PptistCommandResult<PPTTextElement>>;
565
+ /** Replace content from a Markdown string (converted to HTML). */
566
+ setMarkdown(elementId: string, markdown: string, meta?: PptistCommandMeta & {
567
+ slideId?: string;
568
+ }): Promise<PptistCommandResult<PPTTextElement>>;
560
569
  updateContent(elementId: string, update: PptistTextContentUpdateInput, meta?: PptistCommandMeta & {
561
570
  slideId?: string;
562
571
  }): Promise<PptistCommandResult<PPTTextElement>>;
@@ -961,6 +970,16 @@ export interface PptistAgentApi {
961
970
  executeBatch(commands: PptistAgentCommand[], options?: PptistBatchOptions): Promise<PptistCommandResult[]>;
962
971
  canExecute(command: PptistAgentCommand): PptistAgentCapability;
963
972
  subscribe(listener: PptistBridgeListener): PptistUnsubscribe;
973
+ /** Convert a Markdown string to the HTML PPTist stores. Math support is loaded on demand. */
974
+ markdownToHtml(markdown: string): Promise<string>;
975
+ /** Full authoring docs: design system, domain/command notes, and guides. */
976
+ docs(): PptistAgenticDocs;
977
+ /** Domains with their live command lists, for hierarchical discovery. */
978
+ domains(): PptistDomainSummary[];
979
+ /** Drill into one command: its doc annotation merged with live registry facts. */
980
+ describe(commandType: string): PptistCommandDescription | null;
981
+ /** Slide composition recipes; pass a guide id to fetch a single guide. */
982
+ guides(guideId?: string): PptistDesignGuide[] | PptistDesignGuide | null;
964
983
  deck: PptistAgentDeckApi;
965
984
  slides: PptistAgentSlidesApi;
966
985
  elements: PptistAgentElementsApi;
@@ -1203,6 +1222,11 @@ export interface PptistCommandPayloadMap {
1203
1222
  slideId?: string;
1204
1223
  content: string;
1205
1224
  };
1225
+ 'text.setMarkdown': {
1226
+ elementId: string;
1227
+ slideId?: string;
1228
+ markdown: string;
1229
+ };
1206
1230
  'text.updateContent': {
1207
1231
  elementId: string;
1208
1232
  slideId?: string;
@@ -1683,6 +1707,7 @@ export interface PptistCommandResultDataMap {
1683
1707
  };
1684
1708
  'text.getContent': string | null;
1685
1709
  'text.setContent': PPTTextElement;
1710
+ 'text.setMarkdown': PPTTextElement;
1686
1711
  'text.updateContent': PPTTextElement;
1687
1712
  'text.clearContent': PPTTextElement;
1688
1713
  'text.setStyle': PPTTextElement;
@@ -1,5 +1,5 @@
1
1
  import type { Locales } from '../i18n/locale';
2
- import type { Slide, SlideTheme } from '../types/slides';
2
+ import type { Slide, SlideTheme, SlideTemplate } from '../types/slides';
3
3
  import type { PptistAgentApi, PptistSlideReference } from './agentic/types';
4
4
  /** Serializable deck passed between sciobot-next and PPTist. */
5
5
  export interface PptistDocument {
@@ -19,6 +19,12 @@ export interface PptistMountOptions {
19
19
  * Dev: `http://127.0.0.1:5173` while PPTist dev server runs, or sciobot proxy path.
20
20
  */
21
21
  assetBaseUrl?: string;
22
+ /**
23
+ * Style/template catalog shown in the design picker. Each entry's `id` maps to
24
+ * a `mocks/<id>.json` payload resolved against `assetBaseUrl`. Omit to use the
25
+ * bundled defaults (which fall back to the demo deck when a file is missing).
26
+ */
27
+ templates?: SlideTemplate[];
22
28
  /** Fired when title, slides, or theme change (debounced). */
23
29
  onChange?: (document: PptistDocument) => void;
24
30
  onChangeDebounceMs?: number;
@@ -0,0 +1,4 @@
1
+ export declare function setPptistAssetBase(base: string | undefined | null): void;
2
+ export declare function getPptistAssetBase(): string;
3
+ /** Resolve a packaged-asset path against the configured asset base. */
4
+ export declare function resolvePptistAsset(path: string): string;
@@ -0,0 +1 @@
1
+ export declare function markdownToHtml(markdown: string): Promise<string>;
@@ -26,6 +26,11 @@ controller.execute({ id: 'cmd_1', type: 'slides.create', payload: { slide } })
26
26
  controller.executeBatch(commands, { atomic: true })
27
27
  controller.canExecute(command)
28
28
  controller.subscribe(event => {})
29
+ await controller.markdownToHtml(markdown)
30
+ controller.docs()
31
+ controller.domains()
32
+ controller.describe(commandType)
33
+ controller.guides(guideId?)
29
34
 
30
35
  controller.deck.*
31
36
  controller.slides.*
@@ -168,6 +173,8 @@ Content rules:
168
173
  - Element create payloads must include `element.type`.
169
174
  - Whole-document writes (`deck.set`, `deck.patch`, `import.json`, `import.pptist`, and `import.pptxSafe`) require a JSON-serializable payload with a string `title` and a `slides` array before store state is touched.
170
175
  - Text-like content is stored as HTML where the model already expects HTML, for example text element `content`, shape `text.content`, slide `remark`, and note `content`.
176
+ - Markdown flavor: `markdown-it` + `markdown-it-texmath` (KaTeX).
177
+ - Use `content` / `text.setContent` for trusted HTML; use `markdown` / `text.setMarkdown` for Markdown.
171
178
  - Slide links should be validated against `slides.list()` before use.
172
179
  - DOM-dependent import/export paths remain outside the JSON bridge until they have been converted to a serializable document payload.
173
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/pptist",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
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",
@@ -74,7 +74,10 @@
74
74
  "hfmath": "^0.0.2",
75
75
  "html-to-image": "^1.11.13",
76
76
  "jsonrepair": "^3.13.2",
77
+ "katex": "^0.17.0",
77
78
  "lodash": "^4.17.21",
79
+ "markdown-it": "^14.2.0",
80
+ "markdown-it-texmath": "^1.0.0",
78
81
  "mitt": "^3.0.1",
79
82
  "nanoid": "^5.0.7",
80
83
  "number-precision": "^1.6.0",
@@ -108,6 +111,7 @@
108
111
  "@types/crypto-js": "^4.2.1",
109
112
  "@types/file-saver": "^2.0.7",
110
113
  "@types/lodash": "^4.14.202",
114
+ "@types/markdown-it": "^14.1.2",
111
115
  "@types/node": "^25.9.1",
112
116
  "@types/tinycolor2": "^1.4.6",
113
117
  "@vitejs/plugin-vue": "^6.0.7",