fika-editor 3.0.19 → 3.0.21

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,14 @@
1
+ import type { Slide, SlideTheme } from '../../types/slides';
2
+ import { type FikaStylePreset } from './styles';
3
+ export declare const INHERITED_STYLE_ID = "inherited";
4
+ /** True when the deck has authored content worth inheriting from. */
5
+ export declare function deckHasAuthoredStyle(slides: Slide[]): boolean;
6
+ /**
7
+ * Derive a preset from the slides that already exist. Returns `undefined`
8
+ * when there is too little authored content to read a style from.
9
+ *
10
+ * `canvasWidth` is the deck's viewport width; the returned scale is expressed
11
+ * in the layout engine's 1000px reference so `buildLayoutSlide` can rescale it
12
+ * for the actual canvas together with the built-in presets.
13
+ */
14
+ export declare function inferStylePresetFromDeck(slides: Slide[], theme: Partial<SlideTheme> | undefined, canvasWidth: number): FikaStylePreset | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { PPTChartElement, PPTImageElement, PPTShapeElement, PPTTableElement, PPTTextElement, Slide } from '../../types/slides';
2
- import type { FikaStylePreset } from './styles';
2
+ import { type FikaStylePreset } from './styles';
3
3
  import type { CompositionAnchor } from './composition';
4
4
  /**
5
5
  * Un-normalized element inputs the builder emits. Typed as a discriminated
@@ -123,6 +123,15 @@ export declare function getStylePreset(id?: string | null): FikaStylePreset | un
123
123
  /** Resolve a usable preset, falling back to the default when id is missing/unknown. */
124
124
  export declare function resolveStylePreset(id?: string | null): FikaStylePreset;
125
125
  export declare function listStylePresets(): FikaStyleSummary[];
126
+ /** Canvas width the preset type scales and motif sizes are authored for. */
127
+ export declare const STYLE_REFERENCE_WIDTH = 1000;
128
+ /**
129
+ * Rescale a preset's px-based type scale and motif for a canvas of `width`
130
+ * px. Presets are authored for the 1000px default viewport; an imported
131
+ * 1280px deck would otherwise get 22px body copy that reads 22% smaller than
132
+ * designed. Returns the same object when no scaling is needed.
133
+ */
134
+ export declare function scaleStylePreset(preset: FikaStylePreset, width: number): FikaStylePreset;
126
135
  /**
127
136
  * Build the deck-theme patch for a preset. Sets the inheritable defaults that
128
137
  * manually-created elements pick up (`fontColor`, `fontName`, `backgroundColor`,
@@ -534,9 +534,14 @@ export interface FikaCreateFromLayoutInput {
534
534
  slots?: Record<string, unknown>;
535
535
  /**
536
536
  * 1-based slide number. Omit to append (or replace the blank starter / a duplicate title).
537
- * 1…slideCount replaces that slide in place. slideCount+1 appends.
537
+ * 1…slideCount replaces that slide in place (or inserts before it with `mode: 'insert'`). slideCount+1 appends.
538
538
  */
539
539
  index?: number;
540
+ /**
541
+ * How an `index` inside 1…slideCount is applied: `replace` (default) rebuilds
542
+ * that slide; `insert` puts the new slide BEFORE it and shifts the rest right.
543
+ */
544
+ mode?: 'replace' | 'insert';
540
545
  select?: boolean;
541
546
  /** Force a feature (dark) or plain background; defaults to the layout's own preference. */
542
547
  backgroundMode?: FikaLayoutBackgroundMode;
@@ -554,6 +559,8 @@ export interface FikaCreateFromLayoutResult {
554
559
  replacedStarter?: boolean;
555
560
  /** True when an existing slide was overwritten in place. */
556
561
  replaced?: boolean;
562
+ /** True when the slide was inserted before `index` (`mode: 'insert'`), shifting later slides right. */
563
+ inserted?: boolean;
557
564
  elementIds: string[];
558
565
  textElementIds: string[];
559
566
  }
@@ -1,5 +1,6 @@
1
1
  export { mountFika, unmountFika } from './mount';
2
2
  export type { FikaController, FikaDocument, FikaHeaderMenuItem, FikaMountOptions, FikaMountResult, FikaDocumentLoader, FikaStarterPresentationOptions, FikaTemplateLoader, FikaTemplatePayload, FikaImportPptxOptions, FikaImportApplyMode, FikaViewMode, } from './types';
3
+ export type { FikaDeckAtlasOptions, FikaDeckAtlasSheet, FikaDeckAtlasTile, FikaRenderSlideOptions, } from './render';
3
4
  export type { ExportTabId, FikaExportTabsConfig } from '../configs/exportTabs';
4
5
  export type { FikaExportMediaResolver } from '../configs/exportMediaResolver';
5
6
  export { createFikaMediaUploader, } from '../configs/mediaUpload';
@@ -0,0 +1,82 @@
1
+ import type { Slide, SlideTheme } from '../types/slides';
2
+ /**
3
+ * Offscreen slide rendering for hosts and agents.
4
+ *
5
+ * Both entry points paint Slide JSON straight to a canvas with the same
6
+ * painter the thumbnail rail uses, so the pixels match what the user sees
7
+ * (list markers, text-fit sizes, shapes) without cloning the live DOM.
8
+ */
9
+ export interface FikaRenderSlideOptions {
10
+ /** Output width in CSS px. Height follows the deck ratio. Default 1280. */
11
+ width?: number;
12
+ /** Device pixel ratio multiplier for the backing store. Default 1. */
13
+ dpr?: number;
14
+ /**
15
+ * Upper bound on waiting for async resources (images, charts, LaTeX).
16
+ * Whatever has resolved by then is painted; the rest stays blank.
17
+ * Default 4000.
18
+ */
19
+ timeoutMs?: number;
20
+ /** Encoded image type. Default `image/png`. */
21
+ format?: 'image/png' | 'image/jpeg' | 'image/webp';
22
+ /** Encoder quality for lossy formats (0–1). Default 0.9. */
23
+ quality?: number;
24
+ }
25
+ export interface FikaDeckAtlasOptions extends Omit<FikaRenderSlideOptions, 'width'> {
26
+ /** Width of one slide tile in CSS px. Default 640. */
27
+ tileWidth?: number;
28
+ /** Tiles per row. Default 3. */
29
+ columns?: number;
30
+ /** Slides per sheet; long decks split into several sheets. Default 12. */
31
+ maxPerSheet?: number;
32
+ /** Only these slides (ids or 1-based indexes). Default: every slide. */
33
+ slides?: Array<string | number>;
34
+ /** Paint "1", "2", … in each tile's corner so the viewer can address slides. Default true. */
35
+ numbered?: boolean;
36
+ /** Sheet background. Default `#1F2937`. */
37
+ gutterColor?: string;
38
+ }
39
+ export interface FikaDeckAtlasTile {
40
+ slideId: string;
41
+ /** 1-based deck position. */
42
+ index: number;
43
+ row: number;
44
+ column: number;
45
+ /** Tile rectangle in sheet CSS px. */
46
+ left: number;
47
+ top: number;
48
+ width: number;
49
+ height: number;
50
+ }
51
+ export interface FikaDeckAtlasSheet {
52
+ blob: Blob;
53
+ width: number;
54
+ height: number;
55
+ columns: number;
56
+ rows: number;
57
+ tiles: FikaDeckAtlasTile[];
58
+ }
59
+ interface RenderTarget {
60
+ slide: Slide;
61
+ theme: SlideTheme;
62
+ viewportSize: number;
63
+ viewportRatio: number;
64
+ }
65
+ /** Render one slide to an encoded image. */
66
+ export declare function renderSlideImage(target: RenderTarget, options?: FikaRenderSlideOptions): Promise<{
67
+ blob: Blob;
68
+ width: number;
69
+ height: number;
70
+ }>;
71
+ /**
72
+ * Render the deck as one or more contact sheets: numbered slide tiles on a
73
+ * neutral gutter, in reading order. One sheet holds up to `maxPerSheet`
74
+ * slides so a 30-slide deck yields three images rather than one unreadable one.
75
+ */
76
+ export declare function renderDeckAtlas(deck: {
77
+ slides: Slide[];
78
+ theme: SlideTheme;
79
+ viewportSize: number;
80
+ viewportRatio: number;
81
+ }, options?: FikaDeckAtlasOptions): Promise<FikaDeckAtlasSheet[]>;
82
+ export {};
@@ -174,6 +174,21 @@ export interface FikaController extends FikaAgentApi {
174
174
  importPptx(data: File | Blob | ArrayBuffer, options?: FikaImportPptxOptions): Promise<boolean>;
175
175
  setTitle(title: string): void;
176
176
  setLocale(locale: Locales): Promise<void>;
177
+ /**
178
+ * Paint one slide offscreen (thumbnail painter, no DOM capture) and return
179
+ * the encoded image. Defaults to the current slide.
180
+ */
181
+ renderSlide(slideIdOrIndex?: FikaSlideReference, options?: import('./render').FikaRenderSlideOptions): Promise<{
182
+ blob: Blob;
183
+ width: number;
184
+ height: number;
185
+ } | null>;
186
+ /**
187
+ * Paint the whole deck as numbered contact sheets — what an agent should
188
+ * look at before editing an existing deck, or after its context was
189
+ * compacted. Long decks split across several sheets.
190
+ */
191
+ renderAtlas(options?: import('./render').FikaDeckAtlasOptions): Promise<import('./render').FikaDeckAtlasSheet[]>;
177
192
  goToSlide(slideIdOrIndex: FikaSlideReference): void;
178
193
  nextSlide(): void;
179
194
  previousSlide(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fika-editor",
3
- "version": "3.0.19",
3
+ "version": "3.0.21",
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",