fika-editor 3.0.44 → 3.1.0
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/agentic-manifest.json +2 -2
- package/dist/embed/fika-embed.js +4 -3
- package/dist/types/configs/exportWatermark.d.ts +27 -0
- package/dist/types/embed/index.d.ts +1 -0
- package/dist/types/embed/types.d.ts +9 -0
- package/dist/types/utils/pptxExportWatermark.d.ts +24 -0
- package/docs/EMBED.md +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-mandated watermark for PPTX exports.
|
|
3
|
+
*
|
|
4
|
+
* The resolver runs at the start of every PPTX export, so entitlement changes
|
|
5
|
+
* on the host side (a user upgrading mid-session) take effect on the next
|
|
6
|
+
* download without remounting. Returning null/undefined exports a clean deck.
|
|
7
|
+
* A resolver that throws, or an image that cannot be loaded, fails the export
|
|
8
|
+
* — the engine never silently drops a mark the host asked for.
|
|
9
|
+
*/
|
|
10
|
+
export type FikaExportWatermarkPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
11
|
+
export interface FikaExportWatermark {
|
|
12
|
+
/** PNG or JPEG as a `data:` URL or a URL the browser can fetch. */
|
|
13
|
+
image: string;
|
|
14
|
+
/** Corner of the slide. @default 'bottom-right' */
|
|
15
|
+
position?: FikaExportWatermarkPosition;
|
|
16
|
+
/** Mark width as a fraction of the slide width (0–1]. @default 0.12 */
|
|
17
|
+
widthRatio?: number;
|
|
18
|
+
/** Gap to the slide edges as a fraction of the slide width (0–1]. @default 0.02 */
|
|
19
|
+
marginRatio?: number;
|
|
20
|
+
/** Extra opacity applied on top of the image's own alpha (0–1]. @default 1 */
|
|
21
|
+
opacity?: number;
|
|
22
|
+
/** Shape name shown by presentation apps. @default 'Watermark' */
|
|
23
|
+
name?: string;
|
|
24
|
+
}
|
|
25
|
+
export type FikaExportWatermarkResolver = () => FikaExportWatermark | null | undefined | Promise<FikaExportWatermark | null | undefined>;
|
|
26
|
+
export declare function setFikaExportWatermark(resolver?: FikaExportWatermarkResolver | null): void;
|
|
27
|
+
export declare function getFikaExportWatermark(): FikaExportWatermarkResolver | null;
|
|
@@ -3,6 +3,7 @@ export type { FikaController, FikaDocument, FikaHeaderMenuItem, FikaMountOptions
|
|
|
3
3
|
export type { FikaDeckAtlasOptions, FikaDeckAtlasSheet, FikaDeckAtlasTile, FikaRenderSlideOptions, } from './render';
|
|
4
4
|
export type { ExportTabId, FikaExportTabsConfig } from '../configs/exportTabs';
|
|
5
5
|
export type { FikaExportMediaResolver } from '../configs/exportMediaResolver';
|
|
6
|
+
export type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, } from '../configs/exportWatermark';
|
|
6
7
|
export { createFikaMediaUploader, } from '../configs/mediaUpload';
|
|
7
8
|
export type { FikaMediaConfig, FikaMediaConstraints, FikaMediaKind, FikaMediaSizeLimit, FikaMediaUploadProgress, FikaMediaUploadRequest, FikaMediaUploadResult, FikaMediaUploader, FikaXhrMediaUploaderOptions, } from '../configs/mediaUpload';
|
|
8
9
|
export type * from './agentic/types';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { FikaExportTabsConfig } from '../configs/exportTabs';
|
|
2
2
|
import type { FikaExportMediaResolver } from '../configs/exportMediaResolver';
|
|
3
|
+
import type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver } from '../configs/exportWatermark';
|
|
3
4
|
import type { FikaMediaConfig } from '../configs/mediaUpload';
|
|
4
5
|
import type { Locales } from '../i18n/locale';
|
|
5
6
|
import type { Slide, SlideTheme, SlideTemplate } from '../types/slides';
|
|
6
7
|
import type { FikaAgentApi, FikaDeckViewport, FikaSlideReference } from './agentic/types';
|
|
7
8
|
import type { FikaRevealOptions } from './reveal';
|
|
8
9
|
export type { FikaExportMediaResolver };
|
|
10
|
+
export type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver };
|
|
9
11
|
export type { FikaRevealOptions };
|
|
10
12
|
export type { FikaMediaConfig, FikaMediaConstraints, FikaMediaKind, FikaMediaSizeLimit, FikaMediaUploadProgress, FikaMediaUploadRequest, FikaMediaUploadResult, FikaMediaUploader, FikaXhrMediaUploaderOptions } from '../configs/mediaUpload';
|
|
11
13
|
export interface FikaTemplatePayload {
|
|
@@ -97,6 +99,13 @@ export interface FikaMountOptions {
|
|
|
97
99
|
* or null/undefined to give up on that source.
|
|
98
100
|
*/
|
|
99
101
|
exportMediaResolver?: FikaExportMediaResolver;
|
|
102
|
+
/**
|
|
103
|
+
* Watermark baked into every PPTX download (each slide and slide master, as
|
|
104
|
+
* a locked, unselectable picture). Evaluated at the start of each export so
|
|
105
|
+
* the host can gate it on current entitlement; return null for a clean deck.
|
|
106
|
+
* Applies to regenerated decks and retained source packages alike.
|
|
107
|
+
*/
|
|
108
|
+
exportWatermark?: FikaExportWatermarkResolver;
|
|
100
109
|
/**
|
|
101
110
|
* Local media picker used by the unified Insert → Media action (images,
|
|
102
111
|
* video, and audio). Pass `upload` to send files to your backend instead of
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FikaExportWatermark } from '../configs/exportWatermark';
|
|
2
|
+
export declare const EXPORT_WATERMARK_MARKER = "fika:export-watermark";
|
|
3
|
+
export interface WatermarkImage {
|
|
4
|
+
bytes: Uint8Array;
|
|
5
|
+
mime: 'image/png' | 'image/jpeg';
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/** Reads dimensions from the PNG/JPEG header — no decoder or DOM needed. */
|
|
10
|
+
export declare function readWatermarkImage(bytes: Uint8Array): WatermarkImage;
|
|
11
|
+
/** Resolves `image` (data: URL or fetchable URL) to raw bytes plus dimensions. */
|
|
12
|
+
export declare function loadWatermarkImage(image: string): Promise<WatermarkImage>;
|
|
13
|
+
/** True when the package already carries the export watermark on any slide. */
|
|
14
|
+
export declare function hasPptxExportWatermark(bytes: ArrayBuffer | Uint8Array): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a new package with the watermark on every slide and slide master.
|
|
17
|
+
* Throws when the input is not a presentation package.
|
|
18
|
+
*/
|
|
19
|
+
export declare function applyPptxExportWatermark(bytes: ArrayBuffer | Uint8Array, watermark: FikaExportWatermark, image: WatermarkImage): Promise<Uint8Array>;
|
|
20
|
+
/**
|
|
21
|
+
* Browser download through a real `HTMLAnchorElement.click()` — the same seam
|
|
22
|
+
* pptxgenjs uses, which embedding hosts rely on to capture export bytes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function downloadPptxBytes(bytes: Uint8Array, fileName: string): void;
|
package/docs/EMBED.md
CHANGED
|
@@ -283,6 +283,34 @@ await mountFika(host, {
|
|
|
283
283
|
|
|
284
284
|
Direct fetch is tried first; the resolver runs only on failure.
|
|
285
285
|
|
|
286
|
+
### Export watermark
|
|
287
|
+
|
|
288
|
+
Hosts that gate clean downloads behind a plan can have every PPTX export carry a watermark. Pass `exportWatermark`, a resolver evaluated at the start of each export — return the mark for accounts that need it, `null` for a clean deck. Because it runs per export, an entitlement change takes effect on the next download without remounting.
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
await mountFika(host, {
|
|
292
|
+
exportWatermark: () =>
|
|
293
|
+
isFreeTier()
|
|
294
|
+
? {
|
|
295
|
+
image: `${location.origin}/images/logo.png`, // PNG or JPEG; data: URLs work too
|
|
296
|
+
position: 'bottom-right', // default
|
|
297
|
+
widthRatio: 0.12, // fraction of slide width, default
|
|
298
|
+
marginRatio: 0.02, // fraction of slide width, default
|
|
299
|
+
name: 'Acme', // shape name, default 'Watermark'
|
|
300
|
+
}
|
|
301
|
+
: null,
|
|
302
|
+
})
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
The mark is written into the OOXML after generation, so it is identical for regenerated decks and retained source packages:
|
|
306
|
+
|
|
307
|
+
- one shared media part, referenced from **every slide and every slide master**;
|
|
308
|
+
- the slide copy sits last in the shape tree (visible over full-bleed content) and is fully locked — `noSelect` keeps PowerPoint from selecting it by click, marquee, Ctrl+A or the selection pane, so there is no in-app way to delete it;
|
|
309
|
+
- the master copy is `userDrawn` and locked too; it survives slide-level deletions in editors that ignore locks and only goes away through the slide master view (or by hiding background graphics on a slide);
|
|
310
|
+
- parts already carrying the mark are skipped, so a re-imported export does not stack marks.
|
|
311
|
+
|
|
312
|
+
OOXML is plain XML in a ZIP — a determined user can still strip the picture with a text editor. The mark is designed to defeat casual removal, not to be cryptographically enforced. If the resolver throws or the image cannot be loaded, the export fails with the standard export error instead of silently downloading a clean deck.
|
|
313
|
+
|
|
286
314
|
### Media uploads
|
|
287
315
|
|
|
288
316
|
The toolbar **Media** action (images, video, and audio) opens a local-file picker. Pexels / remote galleries are not used. Without a host `upload` callback, images become data URLs and audio/video become blob URLs — fine for demos, not for persistence.
|