fika-editor 3.5.5 → 3.5.6

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.
Files changed (35) hide show
  1. package/dist/embed/{4395.js → 7605.js} +7 -7
  2. package/dist/embed/agentic-manifest.json +2 -2
  3. package/dist/embed/fika-embed.css +1 -1
  4. package/dist/embed/fika-embed.js +5 -5
  5. package/dist/types/components/MoveablePanel.d.ts +2 -1
  6. package/dist/types/components/Slider.d.ts +2 -0
  7. package/dist/types/hooks/useCopyAndPasteElement.d.ts +3 -3
  8. package/dist/types/hooks/useImageHandler.d.ts +1 -1
  9. package/dist/types/hooks/useLink.d.ts +1 -0
  10. package/dist/types/hooks/useSearch.d.ts +3 -0
  11. package/dist/types/hooks/useSlideHandler.d.ts +2 -2
  12. package/dist/types/store/slides.d.ts +9 -3
  13. package/dist/types/utils/clipboard.d.ts +2 -2
  14. package/dist/types/utils/elementOutline.d.ts +7 -1
  15. package/dist/types/utils/hotkeyTarget.d.ts +2 -0
  16. package/dist/types/utils/imageCrop.d.ts +8 -0
  17. package/dist/types/utils/liveElementSize.d.ts +2 -0
  18. package/dist/types/utils/nestedFrames.d.ts +1 -0
  19. package/dist/types/utils/prosemirror/commitEditor.d.ts +5 -0
  20. package/dist/types/utils/prosemirror/index.d.ts +1 -1
  21. package/dist/types/utils/richTextFontSize.d.ts +1 -0
  22. package/dist/types/utils/searchText.d.ts +10 -0
  23. package/dist/types/utils/selection.d.ts +3 -0
  24. package/dist/types/utils/tableHiddenCells.d.ts +2 -0
  25. package/dist/types/utils/textContrast.d.ts +1 -0
  26. package/dist/types/utils/textFit.d.ts +7 -9
  27. package/dist/types/utils/textParser.d.ts +2 -0
  28. package/dist/types/views/Editor/Toolbar/common/useOutlineDrag.d.ts +8 -0
  29. package/dist/types/views/Myna/photoFrameUpload.d.ts +5 -0
  30. package/dist/types/views/components/element/ImageElement/ImageClipHandler.d.ts +2 -0
  31. package/dist/types/views/components/element/ProsemirrorEditor.d.ts +2 -0
  32. package/dist/types/views/components/element/TableElement/cellEdit.d.ts +8 -0
  33. package/dist/types/views/components/element/TableElement/useHideCells.d.ts +3 -2
  34. package/dist/types/views/components/element/hooks/useTextFit.d.ts +3 -4
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode, type KeyboardEventHandler } from 'react';
2
2
  export type IMoveablePanelProps = {
3
3
  width: number;
4
4
  height: number;
@@ -14,6 +14,7 @@ export type IMoveablePanelProps = {
14
14
  contentStyle?: CSSProperties;
15
15
  className?: string;
16
16
  onClose?: () => void;
17
+ onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
17
18
  children?: ReactNode;
18
19
  };
19
20
  declare const MoveablePanel: import("react").MemoExoticComponent<(vrProps: IMoveablePanelProps) => import("react").JSX.Element>;
@@ -1,5 +1,7 @@
1
1
  import { type CSSProperties } from 'react';
2
2
  type SliderBaseProps = {
3
+ onStart?: () => void;
4
+ onCancel?: () => void;
3
5
  disabled?: boolean;
4
6
  min?: number;
5
7
  max?: number;
@@ -1,7 +1,7 @@
1
1
  export default _default;
2
2
  declare function _default(): {
3
- copyElement: () => void;
4
- cutElement: () => void;
3
+ copyElement: () => Promise<boolean>;
4
+ cutElement: () => Promise<void>;
5
5
  pasteElement: () => void;
6
- quickCopyElement: () => void;
6
+ quickCopyElement: () => Promise<void>;
7
7
  };
@@ -1,4 +1,4 @@
1
1
  export default _default;
2
2
  declare function _default(): {
3
- replaceImage: (files: FileList) => void;
3
+ replaceImage: (files: FileList) => Promise<void>;
4
4
  };
@@ -1,4 +1,5 @@
1
1
  import type { PPTElement, PPTElementLink } from '../types/slides';
2
+ export declare const canEditElementLink: (element: PPTElement) => boolean;
2
3
  export default _default;
3
4
  declare function _default(): {
4
5
  setLink: (handleElement: PPTElement, link: PPTElementLink) => boolean;
@@ -1,10 +1,12 @@
1
1
  interface SearchTextResult {
2
2
  elType: 'text' | 'shape';
3
+ offset: number;
3
4
  slideId: string;
4
5
  elId: string;
5
6
  }
6
7
  interface SearchTableResult {
7
8
  elType: 'table';
9
+ offset: number;
8
10
  slideId: string;
9
11
  elId: string;
10
12
  cellIndex: [number, number];
@@ -13,6 +15,7 @@ type SearchResult = SearchTextResult | SearchTableResult;
13
15
  type Modifiers = 'g' | 'gi';
14
16
  export default _default;
15
17
  declare function _default(): {
18
+ canReplace: boolean;
16
19
  searchWord: string;
17
20
  setSearchWord: import("react").Dispatch<import("react").SetStateAction<string>>;
18
21
  replaceWord: string;
@@ -3,13 +3,13 @@ export default _default;
3
3
  declare function _default(): {
4
4
  resetSlides: () => void;
5
5
  updateSlideIndex: (command: string) => void;
6
- copySlide: () => void;
6
+ copySlide: () => Promise<boolean>;
7
7
  pasteSlide: () => void;
8
8
  createSlide: () => void;
9
9
  createSlideByTemplate: (slide: Slide) => void;
10
10
  copyAndPasteSlide: () => void;
11
11
  deleteSlide: (targetSlidesId?: string[]) => void;
12
- cutSlide: () => void;
12
+ cutSlide: () => Promise<void>;
13
13
  selectAllSlide: () => void;
14
14
  sortSlides: (newIndex: number, oldIndex: number) => void;
15
15
  isEmptySlide: boolean;
@@ -64,7 +64,9 @@ export interface SlidesActions {
64
64
  addElement: (element: PPTElement | PPTElement[]) => void;
65
65
  deleteElement: (elementId: string | string[]) => void;
66
66
  updateElement: (data: UpdateElementData) => void;
67
- removeElementProps: (data: RemovePropData) => void;
67
+ removeElementProps: (data: RemovePropData & {
68
+ slideId?: string;
69
+ }) => void;
68
70
  }
69
71
  export type SlidesStore = SlidesState & SlidesActions;
70
72
  export declare const selectCurrentSlide: (state: SlidesState) => Slide;
@@ -1826,7 +1828,9 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
1826
1828
  addElement: (element: PPTElement | PPTElement[]) => void;
1827
1829
  deleteElement: (elementId: string | string[]) => void;
1828
1830
  updateElement: (data: UpdateElementData) => void;
1829
- removeElementProps: (data: RemovePropData) => void;
1831
+ removeElementProps: (data: RemovePropData & {
1832
+ slideId?: string;
1833
+ }) => void;
1830
1834
  }) => void) | SlidesStore, shouldReplace?: false): void;
1831
1835
  setState(nextStateOrUpdater: ((state: {
1832
1836
  title: string;
@@ -3571,7 +3575,9 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
3571
3575
  addElement: (element: PPTElement | PPTElement[]) => void;
3572
3576
  deleteElement: (elementId: string | string[]) => void;
3573
3577
  updateElement: (data: UpdateElementData) => void;
3574
- removeElementProps: (data: RemovePropData) => void;
3578
+ removeElementProps: (data: RemovePropData & {
3579
+ slideId?: string;
3580
+ }) => void;
3575
3581
  }) => void) | SlidesStore, shouldReplace: true): void;
3576
3582
  }>;
3577
3583
  export {};
@@ -2,8 +2,8 @@
2
2
  * Copy text to the clipboard.
3
3
  * @param text Text to copy
4
4
  */
5
- export declare const copyText: (text: string) => Promise<unknown>;
5
+ export declare const copyText: (text: string) => Promise<void>;
6
6
  export declare const readClipboard: () => Promise<string>;
7
7
  export declare const pasteCustomClipboardString: (text: string) => any;
8
- export declare const pasteExcelClipboardString: (text: string) => string[][] | null;
8
+ export declare const pasteExcelClipboardString: (text: string, allowSingleColumn?: boolean) => string[][] | null;
9
9
  export declare const pasteHTMLTableClipboardString: (text: string) => string[][] | null;
@@ -1,4 +1,4 @@
1
- import { type LineStyleType, type PPTElementOutline, type PPTShapeElement } from '../types/slides';
1
+ import { type LineStyleType, type PPTElement, type PPTElementOutline, type PPTShapeElement } from '../types/slides';
2
2
  /** Clamp a resolved pixel corner radius to half the shorter box side. */
3
3
  export declare const clampOutlineRadius: (radius: number, width: number, height: number) => number;
4
4
  /** Pixel radius for paint/CSS. `radius` is 0–1 of max rounding, or legacy px when `> 1`. */
@@ -68,4 +68,10 @@ interface PptxOutlineSource {
68
68
  export declare const importOutlineFromPptx: (el: PptxOutlineSource, ratio: number, options?: {
69
69
  includeCornerRadius?: boolean;
70
70
  }) => PPTElementOutline;
71
+ /** Capture only fields a border preview can change, including absent properties. */
72
+ export declare const captureOutlineRestore: (el: PPTElement) => {
73
+ id: string;
74
+ props: Partial<PPTElement>;
75
+ absent: string[];
76
+ };
71
77
  export {};
@@ -1,2 +1,4 @@
1
1
  /** True when canvas/element hotkeys must yield to a focused text field. */
2
2
  export declare const isTypingTarget: (target: EventTarget | null) => boolean;
3
+ /** Controls own navigation and activation keys, even while the canvas retains selection. */
4
+ export declare const isInteractiveControlTarget: (target: EventTarget | null) => boolean;
@@ -0,0 +1,8 @@
1
+ import type { ImageClipDataRange, PPTImageElement } from '../types/slides';
2
+ /** Change the crop box while keeping the full bitmap fixed in slide coordinates. */
3
+ export declare const imageCropGeometry: (element: PPTImageElement, range: ImageClipDataRange) => {
4
+ width: number;
5
+ height: number;
6
+ left: number;
7
+ top: number;
8
+ };
@@ -40,6 +40,8 @@ export declare const autoHeightInsetSum: (el: {
40
40
  inset?: readonly number[];
41
41
  } | null;
42
42
  }) => number | null;
43
+ /** Uniform table rows must remain tall enough for the content at live widths. */
44
+ export declare const measureLiveTableHeight: (id: string) => number | null;
43
45
  /**
44
46
  * Height the auto-height element's text actually needs at its CURRENT live
45
47
  * width (call after the width has been painted). scrollHeight reports the
@@ -7,6 +7,7 @@ export declare const isFrame: (element: PPTElement) => element is PPTShapeElemen
7
7
  export declare function frameAncestors(element: PPTElement, elements: readonly PPTElement[]): PPTShapeElement[];
8
8
  export declare function frameDescendantIds(elements: readonly PPTElement[], ids: readonly string[]): string[];
9
9
  export declare function frameCorners(element: PPTElement): FramePoint[];
10
+ export declare function intersectFramePolygons(subject: FramePoint[], clip: FramePoint[]): FramePoint[];
10
11
  export declare function frameClipPolygon(element: PPTElement, elements: readonly PPTElement[]): FramePoint[] | null;
11
12
  export declare function createFrameFromSelection(elements: readonly PPTElement[], ids: readonly string[], frameId: string, name: string): {
12
13
  elements: PPTElement[];
@@ -1,7 +1,12 @@
1
+ import type { EditorView } from 'prosemirror-view';
1
2
  import { editorHtmlLooksEmpty } from './commitPolicy';
2
3
  export { editorHtmlLooksEmpty, shouldWriteEditorHtml } from './commitPolicy';
4
+ /** Exclude transient node-selection decorations from persisted rich text. */
5
+ export declare function cleanEditorHtml(dom: HTMLElement): string;
3
6
  export declare const richTextHtmlLooksEmpty: typeof editorHtmlLooksEmpty;
4
7
  export declare const storeHtmlForElement: (elementId: string) => string;
8
+ /** Remember which store content this view has actually synchronized. */
9
+ export declare function rememberEditorSource(view: EditorView, elementId: string): void;
5
10
  /** Activity remounts must not rebuild an empty view over store-owned text. */
6
11
  export declare const resolveEditorMountHtml: (elementId: string, value: string) => string;
7
12
  /** Persist the live ProseMirror HTML. History is for explicit flushes, not every key. */
@@ -1,6 +1,6 @@
1
1
  import { type DirectEditorProps, EditorView } from 'prosemirror-view';
2
2
  import { type PluginOptions } from './plugins/index';
3
- export declare const normalizeFittedFontSizes: (html: string) => string;
3
+ export { normalizeFittedFontSizes } from '../richTextFontSize';
4
4
  export declare const createDocument: (content: string) => import("prosemirror-model").Node;
5
5
  /** Same HTML the live editor paints, so static → edit cannot shift glyphs. */
6
6
  export declare const serializeRichTextHtml: (content: string) => string;
@@ -0,0 +1 @@
1
+ export declare const normalizeFittedFontSizes: (html: string) => string;
@@ -0,0 +1,10 @@
1
+ export declare const getSearchText: (root: Node) => {
2
+ content: string;
3
+ textNodes: Text[];
4
+ textList: {
5
+ text: string;
6
+ startIdx: number;
7
+ endIdx: number;
8
+ }[];
9
+ };
10
+ export declare const getSearchHtmlText: (html: string) => string;
@@ -1 +1,4 @@
1
+ import type { PPTElement } from '../types/slides';
1
2
  export declare const removeAllRanges: () => void;
3
+ /** Hidden or locked frames make their entire subtree unavailable for selection. */
4
+ export declare const isElementSelectable: (element: PPTElement, elements: readonly PPTElement[], hiddenIds: readonly string[]) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { TableCell } from '../types/slides';
2
+ export declare const getHiddenTableCells: (cells: TableCell[][]) => string[];
@@ -145,6 +145,7 @@ export declare const resolveTextPaintSurfaces: (el: PPTTextElement | PPTShapeEle
145
145
  export declare const resolveLiveTextPaint: (preferred: string | undefined, html: string, options?: LiveTextPaintOptions) => {
146
146
  ink: string;
147
147
  html: string;
148
+ defaultInk?: string;
148
149
  };
149
150
  /**
150
151
  * Chart axis / legend / label ink. Same rules as text: default greys / black /
@@ -11,6 +11,8 @@
11
11
  * callers wrap usage so a non-DOM context falls back gracefully.
12
12
  */
13
13
  import { prepare as pretextPrepare } from '@chenglou/pretext';
14
+ import { type PreparedRichInline, type RichInlineLineRange } from '@chenglou/pretext/rich-inline';
15
+ import { normalizeFittedFontSizes } from './richTextFontSize';
14
16
  /** ProseMirror's default text size (assets/styles/prosemirror.scss). */
15
17
  export declare const DEFAULT_TEXT_FONT_SIZE = 16;
16
18
  /**
@@ -163,6 +165,8 @@ export declare const MATH_PLACEHOLDER = "\uFFFC";
163
165
  export declare const measureSpaceWidth: (font: string) => number;
164
166
  export declare const breakSpacesWrapWidth: (width: number, spaceWidth: number) => number;
165
167
  export declare const editorWrapWidth: (width: number, font: string) => number;
168
+ /** Match break-spaces without reserving a nonexistent space after the final line. */
169
+ export declare function walkEditorTextLines(prepared: PreparedRichInline, width: number, font: string, onLine: (line: RichInlineLineRange) => void): void;
166
170
  export declare const richInlineFromRun: (run: TextFitRun, font: string, sizeScale: number, letterSpacing?: number) => {
167
171
  text: string;
168
172
  font: string;
@@ -222,9 +226,7 @@ export declare function createFitMeasureSession(html: string, options: {
222
226
  /** Resize hot path: pure `layout()` over cached prepare handles. */
223
227
  export declare function measureSessionHeight(session: FitMeasureSession, innerWidth: number, blockSpace?: number, bulletIndent?: number): number;
224
228
  export declare function fitZoomScaleFromSession(session: FitMeasureSession, innerWidth: number, innerHeight: number, blockSpace?: number): number;
225
- /** Rendered spans may carry calc(var(--text-fit-scale,...)); measurement wants authored px. */
226
- declare const stripFitScale: (html: string) => string;
227
- export declare const stripFitScaleForProbe: typeof stripFitScale;
229
+ export declare const stripFitScaleForProbe: typeof normalizeFittedFontSizes;
228
230
  type FitScaleOptions = {
229
231
  innerWidth: number;
230
232
  innerHeight: number;
@@ -237,12 +239,8 @@ type FitScaleOptions = {
237
239
  /** Pre-extracted blocks (e.g. after MathLive refined math chip sizes). */
238
240
  blocks?: TextFitBlock[];
239
241
  };
240
- /**
241
- * Persist a DOM-verified correction: the editor measured the REAL rendered
242
- * height and found the searched scale overflowing. Remembered so the rail,
243
- * later applies, and export reuse the corrected value instead of re-overflow.
244
- */
245
- export declare function rememberFitScale(html: string, options: FitScaleOptions, scale: number): void;
242
+ export declare function subscribeFitScaleChanges(listener: (elementId: string) => void): () => void;
243
+ export declare function rememberFitScale(html: string, options: FitScaleOptions, scale: number, elementId?: string): void;
246
244
  /**
247
245
  * One-shot locked-box scale for a rich-text HTML string. Editor resize keeps a
248
246
  * cached session; preview/export call this so they shrink with the same math.
@@ -1,3 +1,5 @@
1
+ /** Clipboard text is literal: only actual line endings become HTML breaks. */
2
+ export declare const plainTextToParagraphs: (text: string) => string;
1
3
  /**
2
4
  * Convert plain text to HTML string with paragraph information
3
5
  * @param text Text
@@ -0,0 +1,8 @@
1
+ import type { PPTElement } from '../../../../types/slides';
2
+ /** Roll back live border previews only while they still own the stored objects. */
3
+ export default function useOutlineDrag(): {
4
+ begin: (elements: PPTElement[], restoreUI?: () => void) => void;
5
+ track: () => void;
6
+ cancel: () => void;
7
+ finish: () => void;
8
+ };
@@ -1,3 +1,8 @@
1
+ export declare function cancelPhotoFrameReplacement(pageId: string, elementId: string): void;
2
+ export declare function beginPhotoFrameReplacement(pageId: string, elementId: string): {
3
+ isCurrent: () => boolean;
4
+ finish: () => void;
5
+ };
1
6
  export declare function loadPhotoFrameImage(input: string | File): Promise<{
2
7
  width: number;
3
8
  height: number;
@@ -8,6 +8,8 @@ export type IImageClipHandlerProps = {
8
8
  top: number;
9
9
  left: number;
10
10
  rotate: number;
11
+ flipH?: boolean;
12
+ flipV?: boolean;
11
13
  clipData?: ImageElementClip;
12
14
  onClip?: (payload: ImageClipedEmitData | null) => void;
13
15
  };
@@ -5,6 +5,7 @@ type HostFallthrough = Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'onFoc
5
5
  export type IProsemirrorEditorProps = {
6
6
  elementId: string;
7
7
  defaultColor: string;
8
+ paintDefaultInk?: string;
8
9
  defaultFontName: string;
9
10
  defaultFontSize?: string;
10
11
  defaultAlign?: TextAlign;
@@ -35,6 +36,7 @@ export type ProsemirrorEditorHandle = {
35
36
  declare const ProsemirrorEditor: import("react").ForwardRefExoticComponent<{
36
37
  elementId: string;
37
38
  defaultColor: string;
39
+ paintDefaultInk?: string;
38
40
  defaultFontName: string;
39
41
  defaultFontSize?: string;
40
42
  defaultAlign?: TextAlign;
@@ -12,4 +12,12 @@ export declare const locateTableCell: (grid: TableCell[][], draft: Pick<TableCel
12
12
  export declare const replaceTableCellText: (grid: TableCell[][], draft: TableCellDraft) => TableCell[][] | null;
13
13
  export declare const growTable: (grid: TableCell[][], extraRows: number, extraCols: number, createCell: () => TableCell) => TableCell[][];
14
14
  export declare const applyExcelPaste: (grid: TableCell[][], startRow: number, startCol: number, excel: string[][], createCell: () => TableCell) => TableCell[][];
15
+ export declare const insertRowIntoGrid: (grid: TableCell[][], rowIndex: number, createCell: () => TableCell) => TableCell[][];
15
16
  export declare const insertColIntoGrid: (grid: TableCell[][], colIndex: number, createCell: () => TableCell) => TableCell[][];
17
+ export declare const deleteTableGridLine: (grid: TableCell[][], index: number, axis: 'row' | 'col') => TableCell[][];
18
+ export declare const tableSelectionBounds: (grid: TableCell[][], start: number[], end: number[]) => {
19
+ top: number;
20
+ left: number;
21
+ bottom: number;
22
+ right: number;
23
+ };
@@ -1,4 +1,5 @@
1
+ import type { TableCell } from '../../../../types/slides';
1
2
  export default _default;
2
- declare function _default(cells: any): {
3
- hideCells: any[];
3
+ declare function _default(cells: TableCell[][]): {
4
+ hideCells: string[];
4
5
  };
@@ -7,10 +7,9 @@ export default _default;
7
7
  * Auto-fit a locked text box (fixed height or placeholder/title slot) so
8
8
  * its content never overflows.
9
9
  *
10
- * Resize is a pretext hot path: `prepare()` once per content/font, then only
11
- * `layout(prepared, width, lineHeight)` when the box size changes. No DOM
12
- * layout reads, no binary search. CSS `zoom` is written on the host so Canvas
13
- * / siblings do not re-render.
10
+ * Pretext supplies a cached estimate during resize. Settled geometry is
11
+ * refined against browser layout before paint, and the verified font scale
12
+ * is shared with the thumbnail painter. Authored font sizes stay unchanged.
14
13
  */
15
14
  declare function _default(elementInfo: FitSource, liveContent?: LiveContentInput, hostEl?: {
16
15
  readonly current: HTMLElement | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fika-editor",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
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",