fika-editor 3.0.24 → 3.0.26

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.
@@ -58,6 +58,16 @@ export interface FikaLayout {
58
58
  /** Strip one or more leading bullet/number markers from a list item. */
59
59
  export declare function stripLeadingListMarkers(raw: string): string;
60
60
  type Slots = Record<string, unknown>;
61
+ /** Natural (intrinsic) pixel size of a bitmap, when the host or the probe knows it. */
62
+ export interface ImageNaturalSize {
63
+ width: number;
64
+ height: number;
65
+ }
66
+ /**
67
+ * Best-effort natural size of a bitmap. Browser only; resolves `undefined`
68
+ * on error or after `timeoutMs` so a slow CDN never blocks slide creation.
69
+ */
70
+ export declare function probeImageNaturalSize(src: string, timeoutMs?: number): Promise<ImageNaturalSize | undefined>;
61
71
  export declare const PPTX_LAYOUTS: FikaLayout[];
62
72
  export declare function listLayouts(): FikaLayout[];
63
73
  /**
@@ -7,6 +7,8 @@ import type { FikaLayout, FikaLayoutBackgroundMode } from './layouts';
7
7
  import type { FikaStyleMotif, FikaStyleSummary } from './styles';
8
8
  import type { CompositionAnchor, CompositionPlan, CompositionSlideHint } from './composition';
9
9
  import type { FikaAgenticDocs, FikaCommandDescription, FikaDesignGuide, FikaDomainSummary } from './manifestDocs';
10
+ import type { TextRunStyle } from '../../utils/markdown';
11
+ export type { TextRunStyle } from '../../utils/markdown';
10
12
  export type { FikaAgenticDocs, FikaCommandDescription, FikaCommandDoc, FikaDesignGuide, FikaDesignSystem, FikaDocParam, FikaDomainDoc, FikaDomainSummary } from './manifestDocs';
11
13
  export type { FikaTemplateSummary, FikaTemplateSlideEntry, FikaTemplateSlidesCatalog, FikaTemplateSlidesCatalogResult } from './templates';
12
14
  export type { FikaLayout, FikaLayoutSlotDef, FikaLayoutBackgroundMode, FikaLayoutVariant } from './layouts';
@@ -317,6 +319,8 @@ export interface FikaCreateTextInput {
317
319
  content?: string;
318
320
  /** Markdown content; converted to HTML by the bridge. */
319
321
  markdown?: string;
322
+ /** Run style (fontSize / fontName / color / bold / align) applied to `markdown`. */
323
+ style?: TextRunStyle;
320
324
  element?: Partial<PPTTextElement>;
321
325
  select?: boolean;
322
326
  }
@@ -742,9 +746,10 @@ export interface FikaAgentTextApi {
742
746
  setContent(elementId: string, content: string, meta?: FikaCommandMeta & {
743
747
  slideId?: string;
744
748
  }): Promise<FikaCommandResult<PPTTextElement>>;
745
- /** Replace content from a Markdown string (converted to HTML). */
749
+ /** Replace content from a Markdown string (converted to HTML), optionally with a run `style`. */
746
750
  setMarkdown(elementId: string, markdown: string, meta?: FikaCommandMeta & {
747
751
  slideId?: string;
752
+ style?: TextRunStyle;
748
753
  }): Promise<FikaCommandResult<PPTTextElement>>;
749
754
  updateContent(elementId: string, update: FikaTextContentUpdateInput, meta?: FikaCommandMeta & {
750
755
  slideId?: string;
@@ -1429,6 +1434,7 @@ export interface FikaCommandPayloadMap {
1429
1434
  elementId: string;
1430
1435
  slideId?: string;
1431
1436
  markdown: string;
1437
+ style?: TextRunStyle;
1432
1438
  };
1433
1439
  'text.updateContent': {
1434
1440
  elementId: string;
@@ -0,0 +1,33 @@
1
+ import type { PPTCodeElement } from '../types/slides';
2
+ /**
3
+ * A .pptx has no code-block primitive, so a native code element travels as a
4
+ * text box whose shape name (`p:cNvPr@name`) carries this tag:
5
+ *
6
+ * fika:code:<language>[:<theme>[:<lineNumbers 0|1>]]
7
+ *
8
+ * Fika writes it on export and python-pptx2's `add_code` writes it when a deck
9
+ * is authored server-side; the importer turns any shape carrying it back into a
10
+ * syntax-highlighted code element instead of a plain text box.
11
+ */
12
+ export declare const CODE_SHAPE_NAME_PREFIX = "fika:code";
13
+ export interface CodeShapeTag {
14
+ language: string;
15
+ theme: string;
16
+ showLineNumbers: boolean;
17
+ }
18
+ export declare function formatCodeShapeName(el: Pick<PPTCodeElement, 'language' | 'theme' | 'showLineNumbers'>): string;
19
+ export declare function parseCodeShapeName(name: string | undefined | null): CodeShapeTag | null;
20
+ /**
21
+ * Source lines from imported paragraph HTML: one `<p>` per line, `<br>` as a
22
+ * hard break inside a paragraph, entities decoded, whitespace kept verbatim.
23
+ */
24
+ export declare function htmlToCodeLines(html: string): string[];
25
+ /**
26
+ * Export paints line numbers as literal text (`" 1 code"`); when the tag says
27
+ * the gutter is on, peel it off so the numbers are not doubled on re-import.
28
+ */
29
+ export declare function stripCodeLineNumberGutter(lines: string[]): string[];
30
+ /** Imported paragraph HTML → code element source, honouring the tag's gutter flag. */
31
+ export declare function importedCodeSource(html: string, tag: CodeShapeTag): string;
32
+ /** The first run font size (pt) declared in imported paragraph HTML, scaled to px. */
33
+ export declare function importedCodeFontSize(html: string, ratio: number): number;
@@ -50,3 +50,23 @@ export declare function ensureInlineMathReady(): Promise<void>;
50
50
  * read as literal text.
51
51
  */
52
52
  export declare function renderInlineMarkdown(markdown: string): string;
53
+ /** Typographic run style applied on top of Markdown-rendered HTML. */
54
+ export interface TextRunStyle {
55
+ /** Font size in px (the deck's canvas px). */
56
+ fontSize?: number;
57
+ /** CSS font-family name, e.g. "Calibri". */
58
+ fontName?: string;
59
+ /** CSS color (hex / rgb). */
60
+ color?: string;
61
+ bold?: boolean;
62
+ align?: 'left' | 'center' | 'right' | 'justify';
63
+ }
64
+ /**
65
+ * Apply one run style (size / font / color / bold / align) to Markdown output
66
+ * so agents get styled copy from `text.create({ markdown, style })` without
67
+ * hand-writing `<span style>` HTML. Parses the HTML with parse5, wraps each
68
+ * block's inline content in a single styled span (the shape the editor and
69
+ * the pptx importer produce) and mirrors size / color onto list containers so
70
+ * bullet markers match.
71
+ */
72
+ export declare function applyTextRunStyle(htmlText: string, style: TextRunStyle | undefined): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fika-editor",
3
- "version": "3.0.24",
3
+ "version": "3.0.26",
4
4
  "description": "Fika presentation editor embed bundle with a typed agentic bridge.",
5
5
  "type": "module",
6
6
  "main": "dist/embed/fika-embed.js",