fika-editor 3.3.2 → 3.4.1
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.
- package/dist/embed/6104.js +41 -41
- package/dist/embed/agentic-manifest.json +2 -2
- package/dist/embed/chunks/1131.js +1 -1
- package/dist/embed/chunks/2085.js +1 -0
- package/dist/embed/chunks/655.js +1 -1
- package/dist/embed/fika-embed.js +5 -5
- package/dist/types/embed/export.d.ts +15 -0
- package/dist/types/embed/index.d.ts +1 -0
- package/dist/types/embed/render.d.ts +5 -0
- package/dist/types/embed/types.d.ts +1 -1
- package/dist/types/hooks/useExport.d.ts +32 -4
- package/dist/types/i18n/i18n-types.d.ts +28 -0
- package/dist/types/types/export.d.ts +1 -1
- package/dist/types/utils/imageTransfer.d.ts +2 -0
- package/docs/EMBED.md +40 -0
- package/package.json +4 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FikaDocument } from './types';
|
|
2
|
+
import type { PresentationExportOptions } from '../hooks/useExport';
|
|
3
|
+
export interface FikaExportOptions extends Pick<PresentationExportOptions, 'mediaResolver' | 'watermark'> {
|
|
4
|
+
/** Runtime assets/chunks when exporting before mounting an editor. */
|
|
5
|
+
assetBaseUrl?: string;
|
|
6
|
+
/** PDF raster width in pixels. Default 2560, maximum 8192. */
|
|
7
|
+
width?: number;
|
|
8
|
+
/** Resource timeout per slide in milliseconds. Default 30000. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
onProgress?: (completed: number, total: number) => void;
|
|
11
|
+
}
|
|
12
|
+
/** Editable PPTX bytes. No mount, dialog, browser download, or editor mutations. */
|
|
13
|
+
export declare function exportPresentationPptx(document: FikaDocument, options?: FikaExportOptions): Promise<Blob>;
|
|
14
|
+
/** High-resolution image PDF, one slide per page, using Fika's existing painter. */
|
|
15
|
+
export declare function exportPresentationPdf(document: FikaDocument, options?: FikaExportOptions): Promise<Blob>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { exportPresentationPptx, exportPresentationPdf, type FikaExportOptions } from './export';
|
|
1
2
|
export { renderSlideImage, renderDeckAtlas } from "./render";
|
|
2
3
|
export { mountFika, unmountFika } from './mount';
|
|
3
4
|
export type { FikaController, FikaDocument, FikaHeaderMenuItem, FikaMountOptions, FikaMountResult, FikaDocumentLoader, FikaStarterPresentationOptions, FikaTemplateLoader, FikaTemplatePayload, FikaImportPptxOptions, FikaImportApplyMode, FikaViewMode, } from './types';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Slide, SlideTheme } from '../types/slides';
|
|
2
|
+
import { type FikaExportMediaResolver } from '../configs/exportMediaResolver';
|
|
2
3
|
/**
|
|
3
4
|
* Offscreen slide rendering for hosts and agents.
|
|
4
5
|
*
|
|
@@ -25,6 +26,10 @@ export interface FikaRenderSlideOptions {
|
|
|
25
26
|
transparentBackground?: boolean;
|
|
26
27
|
/** Load original image pixels, using the host media resolver if needed. Fail if an image cannot load. */
|
|
27
28
|
fullResolutionImages?: boolean;
|
|
29
|
+
/** Per-export resolver; does not replace the mounted editor's configuration. */
|
|
30
|
+
mediaResolver?: FikaExportMediaResolver | null;
|
|
31
|
+
/** Reject instead of encoding incomplete asynchronous resources. */
|
|
32
|
+
strictResources?: boolean;
|
|
28
33
|
}
|
|
29
34
|
export interface FikaDeckAtlasOptions extends Omit<FikaRenderSlideOptions, 'width'> {
|
|
30
35
|
/** Width of one slide tile in CSS px. Default 640. */
|
|
@@ -93,7 +93,7 @@ export interface FikaMountOptions {
|
|
|
93
93
|
/** Fired when Fika enters or exits slideshow/presentation mode. */
|
|
94
94
|
onPresentationModeChange?: (screening: boolean) => void;
|
|
95
95
|
/**
|
|
96
|
-
* Toggle export dialog formats (`pptx`, `json`). Omitted keys stay enabled.
|
|
96
|
+
* Toggle export dialog formats (`pptx`, `pdf`, `json`). Omitted keys stay enabled.
|
|
97
97
|
*/
|
|
98
98
|
exportTabs?: FikaExportTabsConfig;
|
|
99
99
|
/**
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import type { Slide } from '../types/slides';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Slide, SlideTheme } from '../types/slides';
|
|
2
|
+
import { type FikaExportMediaResolver } from '../configs/exportMediaResolver';
|
|
3
|
+
import { type FikaExportWatermarkResolver } from '../configs/exportWatermark';
|
|
4
|
+
/** A per-call deck snapshot: exporting never mounts or mutates an editor. */
|
|
5
|
+
export interface PresentationExportState {
|
|
6
|
+
slides: Slide[];
|
|
7
|
+
theme: SlideTheme;
|
|
8
|
+
viewportRatio: number;
|
|
9
|
+
viewportSize: number;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PresentationExportOptions {
|
|
13
|
+
/** Only the live editor can certify the retained source package is unchanged. */
|
|
14
|
+
preserveSourcePackage?: boolean;
|
|
15
|
+
hiddenElementIds?: string[];
|
|
16
|
+
mediaResolver?: FikaExportMediaResolver | null;
|
|
17
|
+
watermark?: FikaExportWatermarkResolver | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function createPresentationExporter({ slides, theme, viewportRatio, title, viewportSize }: PresentationExportState, options?: PresentationExportOptions, job?: import("../utils/jobProgress").JobProgress): {
|
|
4
20
|
exporting: boolean;
|
|
5
21
|
exportProgress: number;
|
|
6
22
|
exportSlide: number;
|
|
@@ -9,5 +25,17 @@ declare function _default(): {
|
|
|
9
25
|
exportImagePPTX: (domRefs: NodeListOf<Element>) => void;
|
|
10
26
|
exportJSON: () => void;
|
|
11
27
|
exportSpecificFile: (_slides: Slide[]) => void;
|
|
12
|
-
exportPPTX: (_slides: Slide[], masterOverwrite?: boolean, ignoreMedia?: boolean) => Promise<
|
|
28
|
+
exportPPTX: (_slides: Slide[], masterOverwrite?: boolean, ignoreMedia?: boolean) => Promise<Blob>;
|
|
29
|
+
};
|
|
30
|
+
export default function useExport(): {
|
|
31
|
+
exporting: boolean;
|
|
32
|
+
exportProgress: number;
|
|
33
|
+
exportSlide: number;
|
|
34
|
+
exportSlideTotal: number;
|
|
35
|
+
exportImage: (domRef: HTMLElement, format: string, quality: number, ignoreWebfont?: boolean) => void;
|
|
36
|
+
exportImagePPTX: (domRefs: NodeListOf<Element>) => void;
|
|
37
|
+
exportJSON: () => void;
|
|
38
|
+
exportSpecificFile: (_slides: Slide[]) => void;
|
|
39
|
+
exportPDF: () => Promise<void>;
|
|
40
|
+
exportPPTX: (slides: Slide[], masterOverwrite?: boolean, ignoreMedia?: boolean) => Promise<void>;
|
|
13
41
|
};
|
|
@@ -80,6 +80,20 @@ export type NamespaceExportTranslation = {
|
|
|
80
80
|
*/
|
|
81
81
|
exportButton: string;
|
|
82
82
|
};
|
|
83
|
+
pdf: {
|
|
84
|
+
/**
|
|
85
|
+
* PDF
|
|
86
|
+
*/
|
|
87
|
+
title: string;
|
|
88
|
+
/**
|
|
89
|
+
* High-resolution slides, one per page.
|
|
90
|
+
*/
|
|
91
|
+
description: string;
|
|
92
|
+
/**
|
|
93
|
+
* Download PDF
|
|
94
|
+
*/
|
|
95
|
+
exportButton: string;
|
|
96
|
+
};
|
|
83
97
|
json: {
|
|
84
98
|
/**
|
|
85
99
|
* JSON
|
|
@@ -6076,6 +6090,20 @@ export type TranslationFunctions = {
|
|
|
6076
6090
|
*/
|
|
6077
6091
|
exportButton: () => LocalizedString;
|
|
6078
6092
|
};
|
|
6093
|
+
pdf: {
|
|
6094
|
+
/**
|
|
6095
|
+
* PDF
|
|
6096
|
+
*/
|
|
6097
|
+
title: () => LocalizedString;
|
|
6098
|
+
/**
|
|
6099
|
+
* High-resolution slides, one per page.
|
|
6100
|
+
*/
|
|
6101
|
+
description: () => LocalizedString;
|
|
6102
|
+
/**
|
|
6103
|
+
* Download PDF
|
|
6104
|
+
*/
|
|
6105
|
+
exportButton: () => LocalizedString;
|
|
6106
|
+
};
|
|
6079
6107
|
json: {
|
|
6080
6108
|
/**
|
|
6081
6109
|
* JSON
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type DialogForExportTypes = 'json' | 'pptx' | '';
|
|
1
|
+
export type DialogForExportTypes = 'json' | 'pptx' | 'pdf' | '';
|
package/docs/EMBED.md
CHANGED
|
@@ -552,3 +552,43 @@ ordinary Fika document and viewport. `createMynaDocument()` and `MYNA_FORMATS`
|
|
|
552
552
|
are exported for hosts that need the starter or format catalog. The same
|
|
553
553
|
controller, history, media uploader, read-only options, and change callbacks
|
|
554
554
|
apply. See [Myna integration and capabilities](./MYNA.md).
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
### Export without a mounted editor
|
|
558
|
+
|
|
559
|
+
`exportPresentationPptx(document, options)` and `exportPresentationPdf(document, options)`
|
|
560
|
+
return `Promise<Blob>`. They snapshot the supplied `FikaDocument`, do not open
|
|
561
|
+
an export dialog, and do not trigger a browser download. A saved deck can be
|
|
562
|
+
exported while another deck remains open and editable.
|
|
563
|
+
|
|
564
|
+
```ts
|
|
565
|
+
import { exportPresentationPptx, exportPresentationPdf } from 'fika-editor/embed'
|
|
566
|
+
|
|
567
|
+
const options = { assetBaseUrl: '/fika-assets' }
|
|
568
|
+
const pptx = await exportPresentationPptx(document, options)
|
|
569
|
+
const pdf = await exportPresentationPdf(document, options)
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
PPTX retains editable elements. PDF uses the existing slide painter with one
|
|
573
|
+
high-resolution PNG per page (2560 pixels wide by default), preserving slide
|
|
574
|
+
order and aspect ratio. PDF text is rasterized. No additional document IR is
|
|
575
|
+
required. Load `fika-embed.css` before PDF export so bundled fonts are available.
|
|
576
|
+
|
|
577
|
+
Options include `mediaResolver`, `watermark`, and `onProgress(completed, total)`.
|
|
578
|
+
Omitted resolvers use the current embed configuration. Pass `null` explicitly
|
|
579
|
+
to disable a resolver. PDF also accepts `width` (64 to 8192 pixels) and
|
|
580
|
+
`timeoutMs` (default 30000 per slide). Required watermark and PDF image failures
|
|
581
|
+
reject the promise. PPTX retains its existing partial-media warning behavior.
|
|
582
|
+
|
|
583
|
+
The native export dialog now offers `pptx`, `pdf`, and `json`; control their
|
|
584
|
+
visibility with `exportTabs`. Host exports should call these APIs directly,
|
|
585
|
+
without simulating export button clicks or mounting an offscreen editor.
|
|
586
|
+
|
|
587
|
+
### Multiple presentation tabs
|
|
588
|
+
|
|
589
|
+
The embed uses shared module-level stores and permits one active editor per
|
|
590
|
+
module. Destroy the previous controller before mounting a different deck;
|
|
591
|
+
mounting a second host concurrently throws before changing any document.
|
|
592
|
+
Cache each deck separately in the host and pass its latest snapshot on remount.
|
|
593
|
+
`destroy()` flushes pending rich-text changes and the final `onChange` before
|
|
594
|
+
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.
|
|
3
|
+
"version": "3.4.1",
|
|
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",
|
|
@@ -96,11 +96,11 @@
|
|
|
96
96
|
"@codemirror/language": "^6.12.4",
|
|
97
97
|
"@codemirror/state": "^6.7.1",
|
|
98
98
|
"@codemirror/view": "^6.43.9",
|
|
99
|
-
"@rgrove/parse-xml": "^4.2.3",
|
|
100
99
|
"@dnd-kit/core": "^6.3.1",
|
|
101
100
|
"@dnd-kit/sortable": "^10.0.0",
|
|
102
101
|
"@dnd-kit/utilities": "^3.2.2",
|
|
103
102
|
"@karibash/pixel-units": "^2.3.0",
|
|
103
|
+
"@rgrove/parse-xml": "^4.2.3",
|
|
104
104
|
"@tanstack/react-virtual": "^3.14.10",
|
|
105
105
|
"@use-gesture/react": "^10.3.1",
|
|
106
106
|
"@use-gesture/vanilla": "^10.3.1",
|
|
@@ -136,8 +136,9 @@
|
|
|
136
136
|
"number-precision": "^1.6.0",
|
|
137
137
|
"overlayscrollbars": "^2.16.0",
|
|
138
138
|
"parse5": "^8.0.1",
|
|
139
|
+
"pdf-lib": "^1.17.1",
|
|
139
140
|
"perfect-freehand": "^1.2.3",
|
|
140
|
-
"pptxgenjs-plus": "^4.3.
|
|
141
|
+
"pptxgenjs-plus": "^4.3.4",
|
|
141
142
|
"pptxtojson": "npm:@lofcz/pptxtojson@^2.2.9",
|
|
142
143
|
"prosemirror-commands": "^1.7.2",
|
|
143
144
|
"prosemirror-dropcursor": "^1.8.3",
|