fika-editor 3.4.0 → 3.4.2

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,5 +1,12 @@
1
1
  import type { FikaDocument } from './types';
2
2
  import type { PresentationExportOptions } from '../hooks/useExport';
3
+ export interface FikaExportProgress {
4
+ phase: 'preparing' | 'rendering' | 'packaging' | 'complete';
5
+ completed: number;
6
+ total: number;
7
+ /** Normalized 0..1; reaches 1 only when downloadable bytes are ready. */
8
+ progress: number;
9
+ }
3
10
  export interface FikaExportOptions extends Pick<PresentationExportOptions, 'mediaResolver' | 'watermark'> {
4
11
  /** Runtime assets/chunks when exporting before mounting an editor. */
5
12
  assetBaseUrl?: string;
@@ -7,7 +14,7 @@ export interface FikaExportOptions extends Pick<PresentationExportOptions, 'medi
7
14
  width?: number;
8
15
  /** Resource timeout per slide in milliseconds. Default 30000. */
9
16
  timeoutMs?: number;
10
- onProgress?: (completed: number, total: number) => void;
17
+ onProgress?: (completed: number, total: number, detail?: FikaExportProgress) => void;
11
18
  }
12
19
  /** Editable PPTX bytes. No mount, dialog, browser download, or editor mutations. */
13
20
  export declare function exportPresentationPptx(document: FikaDocument, options?: FikaExportOptions): Promise<Blob>;
@@ -1,4 +1,4 @@
1
- export { exportPresentationPptx, exportPresentationPdf, type FikaExportOptions } from './export';
1
+ export { exportPresentationPptx, exportPresentationPdf, type FikaExportOptions, type FikaExportProgress } from './export';
2
2
  export { renderSlideImage, renderDeckAtlas } from "./render";
3
3
  export { mountFika, unmountFika } from './mount';
4
4
  export type { FikaController, FikaDocument, FikaHeaderMenuItem, FikaMountOptions, FikaMountResult, FikaDocumentLoader, FikaStarterPresentationOptions, FikaTemplateLoader, FikaTemplatePayload, FikaImportPptxOptions, FikaImportApplyMode, FikaViewMode, } from './types';
@@ -0,0 +1,9 @@
1
+ /** Per-export worker: bounded lifetime, no editor state or host callbacks cross the boundary. */
2
+ export declare function createExportWorker(): {
3
+ request<T>(task: string, data: unknown, transfer?: Transferable[]): Promise<T>;
4
+ close(): void;
5
+ };
6
+ /** Yield to another browser task, rather than resuming work inside a rAF callback. */
7
+ export declare const yieldExportTask: () => Promise<void>;
8
+ /** DOM conversion remains on the main thread; bound work between input opportunities. */
9
+ export declare function exportTimeSlice(budgetMs?: number): () => Promise<void>;
@@ -0,0 +1,2 @@
1
+ /** Browser image drags supply HTML/URI data, not a File. Never insert active URLs. */
2
+ export declare function imageSourceFromTransfer(transfer: Pick<DataTransfer, 'getData'>): string | null;
@@ -0,0 +1,13 @@
1
+ import pptxgen from 'pptxgenjs-plus';
2
+ export interface PptxExportCommand {
3
+ target: number;
4
+ property: string;
5
+ args?: unknown[];
6
+ value?: unknown;
7
+ slide?: number;
8
+ }
9
+ /** Record the public generator API, avoiding private class serialization across workers. */
10
+ export declare function recordPptxExport(): {
11
+ pptx: pptxgen;
12
+ commands: PptxExportCommand[];
13
+ };
package/docs/EMBED.md CHANGED
@@ -574,7 +574,16 @@ high-resolution PNG per page (2560 pixels wide by default), preserving slide
574
574
  order and aspect ratio. PDF text is rasterized. No additional document IR is
575
575
  required. Load `fika-embed.css` before PDF export so bundled fonts are available.
576
576
 
577
- Options include `mediaResolver`, `watermark`, and `onProgress(completed, total)`.
577
+ Options include `mediaResolver`, `watermark`, and `onProgress(completed, total, detail)`.
578
+ The optional `detail` (`FikaExportProgress`) includes `phase` (`preparing`, `rendering`,
579
+ `packaging`, or `complete`) and normalized `progress` (0–1). Counted slides are
580
+ completed slides; packaging continues after all slides render, and `progress: 1`
581
+ is emitted only when the returned Blob is ready. Errors reject without a completion event.
582
+
583
+ PPTX generation, PDF image compression/packaging, and font decoding run in module
584
+ workers. Serve the complete `dist/embed` directory, including worker and chunk
585
+ files, under `assetBaseUrl`; the host's CSP must permit same-origin workers.
586
+ DOM-dependent preparation still runs on the main thread with cooperative yields.
578
587
  Omitted resolvers use the current embed configuration. Pass `null` explicitly
579
588
  to disable a resolver. PDF also accepts `width` (64 to 8192 pixels) and
580
589
  `timeoutMs` (default 30000 per slide). Required watermark and PDF image failures
@@ -583,3 +592,12 @@ reject the promise. PPTX retains its existing partial-media warning behavior.
583
592
  The native export dialog now offers `pptx`, `pdf`, and `json`; control their
584
593
  visibility with `exportTabs`. Host exports should call these APIs directly,
585
594
  without simulating export button clicks or mounting an offscreen editor.
595
+
596
+ ### Multiple presentation tabs
597
+
598
+ The embed uses shared module-level stores and permits one active editor per
599
+ module. Destroy the previous controller before mounting a different deck;
600
+ mounting a second host concurrently throws before changing any document.
601
+ Cache each deck separately in the host and pass its latest snapshot on remount.
602
+ `destroy()` flushes pending rich-text changes and the final `onChange` before
603
+ releasing the editor. Hosts should flush their own autosave queue on teardown.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fika-editor",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
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",