fika-editor 3.4.1 → 3.4.3
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/171.js +71 -0
- package/dist/embed/2355.js +1 -0
- package/dist/embed/8147.js +1 -0
- package/dist/embed/9733.js +117 -0
- package/dist/embed/agentic-manifest.json +2 -2
- package/dist/embed/chunks/2595.js +1 -1
- package/dist/embed/chunks/2596.js +1 -0
- package/dist/embed/chunks/4927.js +2 -0
- package/dist/embed/chunks/9541.js +1 -0
- package/dist/embed/fika-embed.js +5 -5
- package/dist/types/embed/export.d.ts +8 -1
- package/dist/types/embed/index.d.ts +1 -1
- package/dist/types/utils/exportFonts.d.ts +10 -2
- package/dist/types/utils/exportWorker.d.ts +9 -0
- package/dist/types/utils/pptxExportCommands.d.ts +13 -0
- package/docs/EMBED.md +24 -1
- package/package.json +1 -1
- package/dist/embed/6104.js +0 -187
- package/dist/embed/chunks/2085.js +0 -1
|
@@ -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';
|
|
@@ -12,15 +12,23 @@
|
|
|
12
12
|
* boot inside a bundled web build, hanging exports forever with no error.
|
|
13
13
|
*/
|
|
14
14
|
import type pptxgen from 'pptxgenjs-plus';
|
|
15
|
+
import type { PptxExportCommand } from './pptxExportCommands';
|
|
15
16
|
type AddFontOptions = Parameters<pptxgen['addFont']>[0];
|
|
16
17
|
/** Collect candidate font families from a CSS font-family string. */
|
|
17
18
|
export declare const parseFontFamilyList: (value?: string) => string[];
|
|
18
|
-
/**
|
|
19
|
+
/** Bundled fonts travel with the deck, even when installed on this computer. */
|
|
19
20
|
export declare const isEmbeddableFont: (family: string) => boolean;
|
|
20
21
|
/**
|
|
21
22
|
* Embed fonts used in the deck into the PPTX.
|
|
22
23
|
* `usedFamilies` should be the raw font-family strings gathered from elements/theme.
|
|
23
|
-
*
|
|
24
|
+
* Unbundled families remain available for the viewer to resolve. A bundled font
|
|
25
|
+
* failing to load rejects export instead of silently losing portability.
|
|
24
26
|
*/
|
|
25
27
|
export declare const collectEmbeddedFonts: (usedFamilies: string[]) => Promise<AddFontOptions[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Inspect the final generator commands, including rich text runs, shape text,
|
|
30
|
+
* tables, charts and theme defaults. CSS fallback lists are not OOXML typefaces;
|
|
31
|
+
* use their first family and the same canonical name as our embedded font.
|
|
32
|
+
*/
|
|
33
|
+
export declare const preparePptxFontFamilies: (commands: PptxExportCommand[]) => string[];
|
|
26
34
|
export {};
|
|
@@ -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,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
|
|
@@ -592,3 +601,17 @@ mounting a second host concurrently throws before changing any document.
|
|
|
592
601
|
Cache each deck separately in the host and pass its latest snapshot on remount.
|
|
593
602
|
`destroy()` flushes pending rich-text changes and the final `onChange` before
|
|
594
603
|
releasing the editor. Hosts should flush their own autosave queue on teardown.
|
|
604
|
+
|
|
605
|
+
### Portable PPTX fonts
|
|
606
|
+
|
|
607
|
+
PPTX exports automatically embed bundled fonts used by the exported text runs,
|
|
608
|
+
tables, shapes, charts and theme, including fonts that are installed on the
|
|
609
|
+
exporting computer. Inline-only font choices are included. CSS fallback stacks
|
|
610
|
+
are converted to a single OOXML typeface, and bundled family aliases use their
|
|
611
|
+
canonical names. No host option is required.
|
|
612
|
+
|
|
613
|
+
Serve the package's font assets alongside its workers and chunks. If a required
|
|
614
|
+
bundled font cannot be fetched or decoded, export rejects instead of silently
|
|
615
|
+
omitting it. Fonts outside the bundled catalog still depend on the receiving
|
|
616
|
+
application's font availability. Embedded fonts improve portability in viewers
|
|
617
|
+
that support them; PDF is available for a fixed visual result.
|