fika-editor 3.1.1 → 3.2.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.
@@ -8,9 +8,19 @@
8
8
  * — the engine never silently drops a mark the host asked for.
9
9
  */
10
10
  export type FikaExportWatermarkPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
11
+ export type FikaWatermarkSurface = 'light' | 'dark';
11
12
  export interface FikaExportWatermark {
12
- /** PNG or JPEG as a `data:` URL or a URL the browser can fetch. */
13
+ /**
14
+ * Mark for light slide fills (dark artwork). PNG or JPEG as a `data:` URL
15
+ * or a URL the browser can fetch.
16
+ */
13
17
  image: string;
18
+ /**
19
+ * Mark for dark / photo slides (light artwork). When omitted every slide
20
+ * uses `image`. Polarities come from the same `preferredInk` query as editor
21
+ * chrome and text contrast.
22
+ */
23
+ imageOnDark?: string;
14
24
  /** Corner of the slide. @default 'bottom-right' */
15
25
  position?: FikaExportWatermarkPosition;
16
26
  /** Mark width as a fraction of the slide width (0–1]. @default 0.12 */
@@ -3,7 +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
+ export type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, FikaWatermarkSurface, } from '../configs/exportWatermark';
7
7
  export { createFikaMediaUploader, } from '../configs/mediaUpload';
8
8
  export type { FikaMediaConfig, FikaMediaConstraints, FikaMediaKind, FikaMediaSizeLimit, FikaMediaUploadProgress, FikaMediaUploadRequest, FikaMediaUploadResult, FikaMediaUploader, FikaXhrMediaUploaderOptions, } from '../configs/mediaUpload';
9
9
  export type * from './agentic/types';
@@ -1,13 +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
+ import type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, FikaWatermarkSurface } from '../configs/exportWatermark';
4
4
  import type { FikaMediaConfig } from '../configs/mediaUpload';
5
5
  import type { Locales } from '../i18n/locale';
6
6
  import type { Slide, SlideTheme, SlideTemplate } from '../types/slides';
7
7
  import type { FikaAgentApi, FikaDeckViewport, FikaSlideReference } from './agentic/types';
8
8
  import type { FikaRevealOptions } from './reveal';
9
9
  export type { FikaExportMediaResolver };
10
- export type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver };
10
+ export type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, FikaWatermarkSurface };
11
11
  export type { FikaRevealOptions };
12
12
  export type { FikaMediaConfig, FikaMediaConstraints, FikaMediaKind, FikaMediaSizeLimit, FikaMediaUploadProgress, FikaMediaUploadRequest, FikaMediaUploadResult, FikaMediaUploader, FikaXhrMediaUploaderOptions } from '../configs/mediaUpload';
13
13
  export interface FikaTemplatePayload {
@@ -1,4 +1,4 @@
1
- import type { FikaExportWatermark } from '../configs/exportWatermark';
1
+ import type { FikaExportWatermark, FikaWatermarkSurface } from '../configs/exportWatermark';
2
2
  export declare const EXPORT_WATERMARK_MARKER = "fika:export-watermark";
3
3
  export interface WatermarkImage {
4
4
  bytes: Uint8Array;
@@ -6,17 +6,32 @@ export interface WatermarkImage {
6
6
  width: number;
7
7
  height: number;
8
8
  }
9
+ export interface ApplyPptxExportWatermarkImages {
10
+ onLight: WatermarkImage;
11
+ onDark?: WatermarkImage;
12
+ /** Per-slide polarity from `preferredInk`. Gaps are inferred from the slide XML. */
13
+ slideSurfaces?: Array<FikaWatermarkSurface | undefined>;
14
+ masterSurface?: FikaWatermarkSurface;
15
+ }
9
16
  /** Reads dimensions from the PNG/JPEG header — no decoder or DOM needed. */
10
17
  export declare function readWatermarkImage(bytes: Uint8Array): WatermarkImage;
11
18
  /** Resolves `image` (data: URL or fetchable URL) to raw bytes plus dimensions. */
12
19
  export declare function loadWatermarkImage(image: string): Promise<WatermarkImage>;
20
+ /**
21
+ * Same cliff as `perceivedDark` in textContrast: AERT brightness 140 or WCAG
22
+ * luminance 0.25. Dark surface → light mark.
23
+ */
24
+ export declare function watermarkSurfaceFromRgb(r: number, g: number, b: number): FikaWatermarkSurface;
25
+ export declare function watermarkSurfaceFromHex(hex: string): FikaWatermarkSurface;
26
+ /** Photo fills use the invert mark; solids/gradients follow the sampled color. */
27
+ export declare function inferWatermarkSurfaceFromSlideXml(xml: string): FikaWatermarkSurface;
13
28
  /** True when the package already carries the export watermark on any slide. */
14
29
  export declare function hasPptxExportWatermark(bytes: ArrayBuffer | Uint8Array): Promise<boolean>;
15
30
  /**
16
31
  * Returns a new package with the watermark on every slide and slide master.
17
32
  * Throws when the input is not a presentation package.
18
33
  */
19
- export declare function applyPptxExportWatermark(bytes: ArrayBuffer | Uint8Array, watermark: FikaExportWatermark, image: WatermarkImage): Promise<Uint8Array>;
34
+ export declare function applyPptxExportWatermark(bytes: ArrayBuffer | Uint8Array, watermark: FikaExportWatermark, images: WatermarkImage | ApplyPptxExportWatermarkImages): Promise<Uint8Array>;
20
35
  /**
21
36
  * Browser download through a real `HTMLAnchorElement.click()` — the same seam
22
37
  * pptxgenjs uses, which embedding hosts rely on to capture export bytes.
@@ -0,0 +1,8 @@
1
+ import type { NodeType } from 'prosemirror-model';
2
+ import type { Command } from 'prosemirror-state';
3
+ /**
4
+ * Enter must continue the current paragraph — align, indent, and marks.
5
+ * Default `splitBlock` / `splitListItem` drop attrs at the end of a block.
6
+ */
7
+ export declare const splitBlockKeepStyle: Command;
8
+ export declare const splitListItemKeepStyle: (itemType: NodeType) => Command;
package/docs/EMBED.md CHANGED
@@ -292,7 +292,8 @@ await mountFika(host, {
292
292
  exportWatermark: () =>
293
293
  isFreeTier()
294
294
  ? {
295
- image: `${location.origin}/images/logo.png`, // PNG or JPEG; data: URLs work too
295
+ image: `${location.origin}/images/logo.png`, // light slides (dark artwork)
296
+ imageOnDark: `${location.origin}/images/logo-on-dark.png`, // optional; dark / photo slides
296
297
  position: 'bottom-right', // default
297
298
  widthRatio: 0.12, // fraction of slide width, default
298
299
  marginRatio: 0.02, // fraction of slide width, default
@@ -304,7 +305,7 @@ await mountFika(host, {
304
305
 
305
306
  The mark is written into the OOXML after generation, so it is identical for regenerated decks and retained source packages:
306
307
 
307
- - one shared media part, referenced from **every slide and every slide master**;
308
+ - one media part per polarity (`image` on light fills, `imageOnDark` on dark / photo fills). The engine picks the variant with the same `preferredInk` query as editor chrome; image backgrounds follow the invert mark;
308
309
  - 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
310
  - 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
311
  - parts already carrying the mark are skipped, so a re-imported export does not stack marks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fika-editor",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
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",