fika-editor 3.2.8 → 3.2.9

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.
@@ -0,0 +1,24 @@
1
+ import { type PresetTheme } from './theme';
2
+ /** Host-localized designs displayed in the slide design picker, in supplied order. */
3
+ export type FikaDesignTheme = Omit<PresetTheme, 'id' | 'name'> & {
4
+ id: string;
5
+ name: string;
6
+ };
7
+ /** Undefined restores Fika defaults; [] intentionally hides the preset catalog. */
8
+ export declare function resolveDesignThemes(themes?: readonly FikaDesignTheme[]): readonly PresetTheme[];
9
+ export declare const useDesignThemes: import("zustand").UseBoundStore<import("zustand").StoreApi<{
10
+ themes: readonly PresetTheme[];
11
+ }>>;
12
+ /** Updates the catalog only; never restyles or replaces the host document. */
13
+ export declare function setFikaDesignThemes(themes?: readonly FikaDesignTheme[]): void;
14
+ /** Obtain independent copies of Fika's built-in designs for filtering/extending. */
15
+ export declare function getFikaDefaultDesignThemes(): FikaDesignTheme[];
16
+ /** Small JSON-safe catalog for host/agent discovery, not full document content. */
17
+ export declare function listFikaDesignThemes(): {
18
+ id: string;
19
+ name: string;
20
+ background: string;
21
+ fontColor: string;
22
+ colors: string[];
23
+ }[];
24
+ export declare function getFikaDesignTheme(id: string): PresetTheme;
@@ -36,7 +36,7 @@ export declare const themeBackgroundCycle: (theme: PresetTheme) => SlideBackgrou
36
36
  export declare const resolvePresetBackground: (theme: PresetTheme, slideType?: SlideType, index?: number) => SlideBackground;
37
37
  export declare const resolvePresetFontColor: (theme: PresetTheme, _slideType?: SlideType) => string;
38
38
  export declare const themeChartColors: (theme: Pick<PresetTheme, 'colors' | 'chartColors'>) => string[];
39
- export declare const matchPresetTheme: (themeColors: string[]) => PresetTheme | undefined;
39
+ export declare const matchPresetTheme: (themeColors: string[], presets?: readonly PresetTheme[]) => PresetTheme | undefined;
40
40
  /** Paint a layout preview/insert with the active preset's type-specific background and type. */
41
41
  export declare const applyPresetToLayoutSlide: (slide: Slide, theme: PresetTheme, index?: number) => void;
42
42
  export declare const sameSlideBackground: (a?: SlideBackground, b?: SlideBackground) => boolean;
@@ -0,0 +1,8 @@
1
+ /** Remove only explicitly replaced theme properties from HTML style attributes.
2
+ * Matching whole declarations avoids corrupting background-color / border-color
3
+ * or literal lesson text that happens to contain CSS examples.
4
+ */
5
+ export declare function stripThemeInlineStyles(content: string, patch: {
6
+ fontColor?: string;
7
+ fontName?: string;
8
+ }): string;
@@ -598,6 +598,18 @@ export interface FikaAgentDeckApi {
598
598
  setTitle(title: string, meta?: FikaCommandMeta): Promise<FikaCommandResult<{
599
599
  title: string;
600
600
  }>>;
601
+ listDesignThemes(): Array<{
602
+ id: string;
603
+ name: string;
604
+ background: string;
605
+ fontColor: string;
606
+ colors: string[];
607
+ }>;
608
+ applyDesignTheme(themeId: string, meta?: FikaCommandMeta): Promise<FikaCommandResult<{
609
+ themeId: string;
610
+ name: string;
611
+ slideCount: number;
612
+ }>>;
601
613
  getTheme(): SlideTheme;
602
614
  setTheme(theme: FikaSlideThemePatch, meta?: FikaCommandMeta): Promise<FikaCommandResult<SlideTheme>>;
603
615
  applyTemplate(templateId: string, meta?: FikaCommandMeta): Promise<FikaCommandResult<FikaApplyTemplateResult>>;
@@ -1200,6 +1212,10 @@ export interface FikaCommandPayloadMap {
1200
1212
  'deck.setTitle': {
1201
1213
  title: string;
1202
1214
  };
1215
+ 'deck.listDesignThemes': undefined;
1216
+ 'deck.applyDesignTheme': {
1217
+ themeId: string;
1218
+ };
1203
1219
  'deck.getTheme': undefined;
1204
1220
  'deck.setTheme': {
1205
1221
  theme: FikaSlideThemePatch | Partial<SlideTheme>;
@@ -1892,6 +1908,18 @@ export interface FikaCommandResultDataMap {
1892
1908
  'deck.setTitle': {
1893
1909
  title: string;
1894
1910
  };
1911
+ 'deck.listDesignThemes': Array<{
1912
+ id: string;
1913
+ name: string;
1914
+ background: string;
1915
+ fontColor: string;
1916
+ colors: string[];
1917
+ }>;
1918
+ 'deck.applyDesignTheme': {
1919
+ themeId: string;
1920
+ name: string;
1921
+ slideCount: number;
1922
+ };
1895
1923
  'deck.getTheme': SlideTheme;
1896
1924
  'deck.setTheme': SlideTheme;
1897
1925
  'deck.applyTheme': SlideTheme;
@@ -10,3 +10,5 @@ export type { FikaMediaConfig, FikaMediaConstraints, FikaMediaKind, FikaMediaSiz
10
10
  export type * from './agentic/types';
11
11
  export type { Locales as FikaLocales } from '../i18n/locale';
12
12
  export type { ChartData, ChartOptions, ChartType, Note, NoteReply, PPTAnimation, PPTAudioElement, PPTChartElement, PPTElement, PPTElementLink, PPTImageElement, PPTLatexElement, PPTLineElement, PPTShapeElement, PPTTableElement, PPTTextElement, PPTVideoElement, ShapeText, Slide, SlideBackground, SlideTemplate, SlideTheme, TableCell, TableCellStyle, TextAlign, TurningMode, } from '../types/slides';
13
+ export type { FikaDesignTheme } from '../configs/designThemes';
14
+ export { getFikaDefaultDesignThemes } from '../configs/designThemes';
@@ -1,3 +1,4 @@
1
+ import type { FikaDesignTheme } from '../configs/designThemes';
1
2
  import type { FikaExportTabsConfig } from '../configs/exportTabs';
2
3
  import type { FikaExportMediaResolver } from '../configs/exportMediaResolver';
3
4
  import type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, FikaWatermarkSurface } from '../configs/exportWatermark';
@@ -63,6 +64,8 @@ export interface FikaHeaderMenuItem {
63
64
  /** `editor` is the default full editor; `presentation` boots straight into the fullscreen slideshow with no editor chrome. */
64
65
  export type FikaViewMode = 'editor' | 'presentation';
65
66
  export interface FikaMountOptions {
67
+ /** Replacement design catalog in display order. Omit for Fika defaults; [] hides presets. Does not restyle the loaded document. */
68
+ designThemes?: readonly FikaDesignTheme[];
66
69
  /** UI locale (`cs` | `en` | `sk` | `pl`). */
67
70
  locale?: Locales;
68
71
  /** Initial deck; takes precedence over `loadDocument` and the starter slide. */
@@ -191,6 +194,8 @@ export interface FikaController extends FikaAgentApi {
191
194
  importPptx(data: File | Blob | ArrayBuffer, options?: FikaImportPptxOptions): Promise<boolean>;
192
195
  setTitle(title: string): void;
193
196
  setLocale(locale: Locales): Promise<void>;
197
+ /** Replace the visible design catalog without changing slide content. Undefined restores defaults. */
198
+ setDesignThemes(themes?: readonly FikaDesignTheme[]): void;
194
199
  /**
195
200
  * Paint one slide offscreen (thumbnail painter, no DOM capture) and return
196
201
  * the encoded image. Defaults to the current slide.
@@ -0,0 +1,8 @@
1
+ import type { Slide, SlideTheme } from '../types/slides';
2
+ import { type PresetTheme } from '../configs/theme';
3
+ export declare const setSlideTheme: (slide: Slide, theme: PresetTheme, index?: number) => void;
4
+ /** Shared by the design picker and agent command, with no store/history effects. */
5
+ export declare function applyDesignTheme(slides: readonly Slide[], currentTheme: SlideTheme, preset: PresetTheme): {
6
+ slides: Slide[];
7
+ theme: SlideTheme;
8
+ };
@@ -518,4 +518,12 @@ await savePresentationDocument(controller.getDocument())
518
518
  await controller.executeBatch(commands, { atomic: true })
519
519
  ```
520
520
 
521
- Use `controller.export.json()` for a synchronous serializable snapshot. Use `controller.import.json(document)`, `controller.execute({ type: 'import.json', payload: { document } })`, or `controller.execute({ type: 'export.json' })` when sciobot needs command results for whole-document import/export.
521
+ Use `controller.export.json()` for a synchronous serializable snapshot. Use `controller.import.json(document)`, `controller.execute({ type: 'import.json', payload: { document } })`, or `controller.execute({ type: 'export.json' })` when sciobot needs command results for whole-document import/export.
522
+ ### Partial theme application
523
+
524
+ `deck.applyTheme` with `options.applyToSlides: true` applies only the supplied
525
+ properties to existing slide content. For example, `{ theme: { fontName:
526
+ 'Calibri' }, options: { applyToSlides: true } }` replaces text/shape/table font
527
+ families without resetting backgrounds, text colors, chart palettes or sizes.
528
+ Inline property removal is restricted to style declarations; background-color,
529
+ border-color and literal CSS examples in lesson text are preserved.
package/docs/EMBED.md CHANGED
@@ -479,3 +479,43 @@ The ProseMirror schema preserves hard line breaks and Markdown strikethrough
479
479
  through storage, static rendering, and editing.
480
480
  Pass `assetBaseUrl` to `mountFika()` to resolve lazy editor CSS under the same
481
481
  asset directory as the embed stylesheet.
482
+
483
+ ### Host-configured slide designs
484
+
485
+ Pass `designThemes` to replace the built-in design cards (not editor chrome).
486
+ The supplied order and host-localized `name` appear in the picker. Custom designs
487
+ also drive layout previews, new layout slides, background looks and chart colors.
488
+ Omit the option for Fika defaults; pass `[]` to hide the preset section.
489
+ Configuring the catalog does not apply a design to the existing document.
490
+
491
+ ```ts
492
+ import { mountFika, getFikaDefaultDesignThemes, type FikaDesignTheme } from 'fika-editor/embed'
493
+
494
+ const paper: FikaDesignTheme = {
495
+ id: 'my-paper', name: 'Paper',
496
+ background: '#FAF8F4', fontColor: '#2B3445', fontname: 'Inter',
497
+ colors: ['#D25F2B', '#2A7FA3', '#5F8A2C'],
498
+ borderColor: '#E3DFD6',
499
+ }
500
+ const { controller } = await mountFika('#editor', { designThemes: [paper] })
501
+ controller.setDesignThemes([{ ...paper, name: 'Papír' }]) // reactive label/catalog update
502
+ controller.setDesignThemes(getFikaDefaultDesignThemes()) // independent copies of defaults
503
+ ```
504
+
505
+ Design IDs must be nonempty and unique; names and accent palettes are required.
506
+ Use distinct accent palettes so the active design can be recognized after a
507
+ saved document is loaded. Optional `chartColors`, `featureFontColor`,
508
+ `contentBackground`, `featureBackground`, `altBackground` and `backgrounds`
509
+ provide the same appearance controls as built-in designs. Catalogs are runtime
510
+ host configuration, not part of the persisted document. Like Fika's other embed
511
+ configuration and stores, the catalog is shared by the active editor runtime;
512
+ use separate runtimes for independently configured simultaneous editors.
513
+
514
+ Agents can use the same active catalog via `controller.deck.listDesignThemes()`
515
+ (read-only), then apply one by ID with
516
+ `controller.deck.applyDesignTheme('scio-blue')`. The command-bus equivalent is
517
+ `{ type: 'deck.applyDesignTheme', payload: { themeId: 'scio-blue' } }`.
518
+ Application uses the picker implementation and creates one undo step for the
519
+ whole deck. Unknown IDs fail without changing the presentation. Hosts should
520
+ include the small catalog in agent context so applying a named theme needs only
521
+ one call, without a preceding discovery request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fika-editor",
3
- "version": "3.2.8",
3
+ "version": "3.2.9",
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",