fika-editor 3.6.14 → 3.7.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 +127 -11
- package/dist/embed/chunks/1131.js +1 -1
- package/dist/embed/fika-embed.css +1 -1
- package/dist/embed/fika-embed.js +5 -5
- package/dist/types/configs/aiSlideInsert.d.ts +87 -0
- package/dist/types/embed/agentic/types.d.ts +51 -10
- package/dist/types/embed/agentic/validators.d.ts +1 -0
- package/dist/types/embed/index.d.ts +2 -2
- package/dist/types/embed/types.d.ts +10 -0
- package/dist/types/hooks/useSlideHandler.d.ts +1 -1
- package/dist/types/i18n/i18n-react.d.ts +10 -10
- package/dist/types/i18n/i18n-types.d.ts +10556 -10467
- package/dist/types/i18n/i18n-util.async.d.ts +5 -5
- package/dist/types/i18n/i18n-util.d.ts +5 -5
- package/dist/types/store/slides.d.ts +36 -0
- package/dist/types/types/slides.d.ts +24 -0
- package/dist/types/utils/element.d.ts +1 -0
- package/dist/types/views/Editor/Thumbnails/useThumbnailVirtualizer.d.ts +1 -1
- package/dist/types/views/components/SlideSkeleton/index.d.ts +6 -1
- package/dist/types/views/components/element/ImageElement/ImageBitmapSurface.d.ts +3 -0
- package/dist/types/views/components/element/ImageElement/ImageMediaSlot.d.ts +10 -0
- package/dist/types/views/components/element/ImageElement/useImageBitmap.d.ts +6 -0
- package/docs/EMBED.md +39 -0
- package/package.json +1 -1
|
@@ -4,14 +4,14 @@ export declare const loadLocaleAsync: (locale: Locales) => Promise<void>;
|
|
|
4
4
|
export declare const loadAllLocalesAsync: () => Promise<void[]>;
|
|
5
5
|
export declare const loadFormatters: (locale: Locales) => void;
|
|
6
6
|
export declare const importNamespaceAsync: <Namespace extends Namespaces>(locale: Locales, namespace: Namespace) => Promise<{
|
|
7
|
-
|
|
7
|
+
canvas: import("./i18n-types").NamespaceCanvasTranslation;
|
|
8
|
+
configs: import("./i18n-types").NamespaceConfigsTranslation;
|
|
8
9
|
editor: import("./i18n-types").NamespaceEditorTranslation;
|
|
9
10
|
myna: import("./i18n-types").NamespaceMynaTranslation;
|
|
10
|
-
|
|
11
|
+
common: import("./i18n-types").NamespaceCommonTranslation;
|
|
11
12
|
mobile: import("./i18n-types").NamespaceMobileTranslation;
|
|
12
|
-
screen: import("./i18n-types").NamespaceScreenTranslation;
|
|
13
13
|
components: import("./i18n-types").NamespaceComponentsTranslation;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
screen: import("./i18n-types").NamespaceScreenTranslation;
|
|
15
|
+
export: import("./i18n-types").NamespaceExportTranslation;
|
|
16
16
|
}[Namespace]>;
|
|
17
17
|
export declare const loadNamespaceAsync: <Namespace extends Namespaces>(locale: Locales, namespace: Namespace) => Promise<void>;
|
|
@@ -9,15 +9,15 @@ export declare const isNamespace: (namespace: string) => namespace is Namespaces
|
|
|
9
9
|
export declare const loadedLocales: Record<Locales, Translations>;
|
|
10
10
|
export declare const loadedFormatters: Record<Locales, Formatters>;
|
|
11
11
|
export declare const extendDictionary: <Base extends import("typesafe-i18n").BaseTranslation | {
|
|
12
|
-
|
|
12
|
+
canvas: import("./i18n-types").NamespaceCanvasTranslation;
|
|
13
|
+
configs: import("./i18n-types").NamespaceConfigsTranslation;
|
|
13
14
|
editor: import("./i18n-types").NamespaceEditorTranslation;
|
|
14
15
|
myna: import("./i18n-types").NamespaceMynaTranslation;
|
|
15
|
-
|
|
16
|
+
common: import("./i18n-types").NamespaceCommonTranslation;
|
|
16
17
|
mobile: import("./i18n-types").NamespaceMobileTranslation;
|
|
17
|
-
screen: import("./i18n-types").NamespaceScreenTranslation;
|
|
18
18
|
components: import("./i18n-types").NamespaceComponentsTranslation;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
screen: import("./i18n-types").NamespaceScreenTranslation;
|
|
20
|
+
export: import("./i18n-types").NamespaceExportTranslation;
|
|
21
21
|
}, Translation extends Base>(base: Base, part: (Translation extends string ? string : Translation extends import("typesafe-i18n").BaseTranslation ? { [P in keyof Translation]?: Translation[P] extends infer T ? T extends Translation[P] ? T extends string ? string : T extends import("typesafe-i18n").BaseTranslation ? { [P_1 in keyof T]?: T[P_1] extends infer T_1 ? T_1 extends T[P_1] ? T_1 extends string ? string : T_1 extends import("typesafe-i18n").BaseTranslation ? { [P_2 in keyof T_1]?: T_1[P_2] extends infer T_2 ? T_2 extends T_1[P_2] ? T_2 extends string ? string : T_2 extends import("typesafe-i18n").BaseTranslation ? { [P_3 in keyof T_2]?: T_2[P_3] extends infer T_3 ? T_3 extends T_2[P_3] ? T_3 extends string ? string : T_3 extends import("typesafe-i18n").BaseTranslation ? { [P_4 in keyof T_3]?: T_3[P_4] extends infer T_4 ? T_4 extends T_3[P_4] ? T_4 extends string ? string : T_4 extends import("typesafe-i18n").BaseTranslation ? { [P_5 in keyof T_4]?: T_4[P_5] extends infer T_5 ? T_5 extends T_4[P_5] ? T_5 extends string ? string : T_5 extends import("typesafe-i18n").BaseTranslation ? { [P_6 in keyof T_5]?: T_5[P_6] extends infer T_6 ? T_6 extends T_5[P_6] ? T_6 extends string ? string : T_6 extends import("typesafe-i18n").BaseTranslation ? { [P_7 in keyof T_6]?: T_6[P_7] extends infer T_7 ? T_7 extends T_6[P_7] ? T_7 extends string ? string : T_7 extends import("typesafe-i18n").BaseTranslation ? { [P_8 in keyof T_7]?: T_7[P_8] extends infer T_8 ? T_8 extends T_7[P_8] ? T_8 extends string ? string : T_8 extends import("typesafe-i18n").BaseTranslation ? { [P_9 in keyof T_8]?: T_8[P_9] extends infer T_9 ? T_9 extends T_8[P_9] ? T_9 extends string ? string : T_9 extends import("typesafe-i18n").BaseTranslation ? { [P_10 in keyof T_9]?: /*elided*/ any; } : T_9 : never : never; } : T_8 : never : never; } : T_7 : never : never; } : T_6 : never : never; } : T_5 : never : never; } : T_4 : never : never; } : T_3 : never : never; } : T_2 : never : never; } : T_1 : never : never; } : T : never : never; } : Translation) extends infer T ? T extends (Translation extends string ? string : Translation extends import("typesafe-i18n").BaseTranslation ? { [P in keyof Translation]?: Translation[P] extends infer T ? T extends Translation[P] ? T extends string ? string : T extends import("typesafe-i18n").BaseTranslation ? { [P_1 in keyof T]?: T[P_1] extends infer T_1 ? T_1 extends T[P_1] ? T_1 extends string ? string : T_1 extends import("typesafe-i18n").BaseTranslation ? { [P_2 in keyof T_1]?: T_1[P_2] extends infer T_2 ? T_2 extends T_1[P_2] ? T_2 extends string ? string : T_2 extends import("typesafe-i18n").BaseTranslation ? { [P_3 in keyof T_2]?: T_2[P_3] extends infer T_3 ? T_3 extends T_2[P_3] ? T_3 extends string ? string : T_3 extends import("typesafe-i18n").BaseTranslation ? { [P_4 in keyof T_3]?: T_3[P_4] extends infer T_4 ? T_4 extends T_3[P_4] ? T_4 extends string ? string : T_4 extends import("typesafe-i18n").BaseTranslation ? { [P_5 in keyof T_4]?: T_4[P_5] extends infer T_5 ? T_5 extends T_4[P_5] ? T_5 extends string ? string : T_5 extends import("typesafe-i18n").BaseTranslation ? { [P_6 in keyof T_5]?: T_5[P_6] extends infer T_6 ? T_6 extends T_5[P_6] ? T_6 extends string ? string : T_6 extends import("typesafe-i18n").BaseTranslation ? { [P_7 in keyof T_6]?: T_6[P_7] extends infer T_7 ? T_7 extends T_6[P_7] ? T_7 extends string ? string : T_7 extends import("typesafe-i18n").BaseTranslation ? { [P_8 in keyof T_7]?: T_7[P_8] extends infer T_8 ? T_8 extends T_7[P_8] ? T_8 extends string ? string : T_8 extends import("typesafe-i18n").BaseTranslation ? { [P_9 in keyof T_8]?: T_8[P_9] extends infer T_9 ? T_9 extends T_8[P_9] ? T_9 extends string ? string : T_9 extends import("typesafe-i18n").BaseTranslation ? { [P_10 in keyof T_9]?: any; } : T_9 : never : never; } : T_8 : never : never; } : T_7 : never : never; } : T_6 : never : never; } : T_5 : never : never; } : T_4 : never : never; } : T_3 : never : never; } : T_2 : never : never; } : T_1 : never : never; } : T : never : never; } : Translation) ? T extends import("typesafe-i18n").BaseTranslation ? { [P in keyof T]?: T[P] extends infer T_1 ? T_1 extends T[P] ? T_1 extends import("typesafe-i18n").BaseTranslation ? { [P_1 in keyof T_1]?: T_1[P_1] extends infer T_2 ? T_2 extends T_1[P_1] ? T_2 extends import("typesafe-i18n").BaseTranslation ? { [P_2 in keyof T_2]?: T_2[P_2] extends infer T_3 ? T_3 extends T_2[P_2] ? T_3 extends import("typesafe-i18n").BaseTranslation ? { [P_3 in keyof T_3]?: T_3[P_3] extends infer T_4 ? T_4 extends T_3[P_3] ? T_4 extends import("typesafe-i18n").BaseTranslation ? { [P_4 in keyof T_4]?: T_4[P_4] extends infer T_5 ? T_5 extends T_4[P_4] ? T_5 extends import("typesafe-i18n").BaseTranslation ? { [P_5 in keyof T_5]?: T_5[P_5] extends infer T_6 ? T_6 extends T_5[P_5] ? T_6 extends import("typesafe-i18n").BaseTranslation ? { [P_6 in keyof T_6]?: T_6[P_6] extends infer T_7 ? T_7 extends T_6[P_6] ? T_7 extends import("typesafe-i18n").BaseTranslation ? { [P_7 in keyof T_7]?: T_7[P_7] extends infer T_8 ? T_8 extends T_7[P_7] ? T_8 extends import("typesafe-i18n").BaseTranslation ? { [P_8 in keyof T_8]?: T_8[P_8] extends infer T_9 ? T_9 extends T_8[P_8] ? T_9 extends import("typesafe-i18n").BaseTranslation ? { [P_9 in keyof T_9]?: T_9[P_9] extends infer T_10 ? T_10 extends T_9[P_9] ? T_10 extends import("typesafe-i18n").BaseTranslation ? { [P_10 in keyof T_10]?: /*elided*/ any; } : T_10 : never : never; } : T_9 : never : never; } : T_8 : never : never; } : T_7 : never : never; } : T_6 : never : never; } : T_5 : never : never; } : T_4 : never : never; } : T_3 : never : never; } : T_2 : never : never; } : T_1 : never : never; } : T : never : never) => Translation;
|
|
22
22
|
export declare const i18nString: (locale: Locales) => TranslateByString;
|
|
23
23
|
export declare const i18nObject: (locale: Locales) => TranslationFunctions;
|
|
@@ -400,6 +400,14 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
400
400
|
sourceWidth?: number;
|
|
401
401
|
sourceHeight?: number;
|
|
402
402
|
};
|
|
403
|
+
mediaState?: {
|
|
404
|
+
slotId?: string;
|
|
405
|
+
status: import("../types/slides").ImageMediaStatus;
|
|
406
|
+
aspectRatio?: number;
|
|
407
|
+
fit?: import("../types/slides").ImageMediaFit;
|
|
408
|
+
label?: string;
|
|
409
|
+
error?: string;
|
|
410
|
+
};
|
|
403
411
|
} | {
|
|
404
412
|
parentFrameId?: string;
|
|
405
413
|
id: string;
|
|
@@ -940,6 +948,7 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
940
948
|
type?: import("../types/slides").SlideType;
|
|
941
949
|
sourcePackageId?: string;
|
|
942
950
|
skeleton?: boolean;
|
|
951
|
+
aiRequestId?: string;
|
|
943
952
|
}[];
|
|
944
953
|
slideIndex: number;
|
|
945
954
|
viewportSize: number;
|
|
@@ -1249,6 +1258,14 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
1249
1258
|
sourceWidth?: number;
|
|
1250
1259
|
sourceHeight?: number;
|
|
1251
1260
|
};
|
|
1261
|
+
mediaState?: {
|
|
1262
|
+
slotId?: string;
|
|
1263
|
+
status: import("../types/slides").ImageMediaStatus;
|
|
1264
|
+
aspectRatio?: number;
|
|
1265
|
+
fit?: import("../types/slides").ImageMediaFit;
|
|
1266
|
+
label?: string;
|
|
1267
|
+
error?: string;
|
|
1268
|
+
};
|
|
1252
1269
|
} | {
|
|
1253
1270
|
parentFrameId?: string;
|
|
1254
1271
|
id: string;
|
|
@@ -1789,6 +1806,7 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
1789
1806
|
type?: import("../types/slides").SlideType;
|
|
1790
1807
|
sourcePackageId?: string;
|
|
1791
1808
|
skeleton?: boolean;
|
|
1809
|
+
aiRequestId?: string;
|
|
1792
1810
|
}[];
|
|
1793
1811
|
theme: {
|
|
1794
1812
|
headingFontName?: string;
|
|
@@ -2166,6 +2184,14 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
2166
2184
|
sourceWidth?: number;
|
|
2167
2185
|
sourceHeight?: number;
|
|
2168
2186
|
};
|
|
2187
|
+
mediaState?: {
|
|
2188
|
+
slotId?: string;
|
|
2189
|
+
status: import("../types/slides").ImageMediaStatus;
|
|
2190
|
+
aspectRatio?: number;
|
|
2191
|
+
fit?: import("../types/slides").ImageMediaFit;
|
|
2192
|
+
label?: string;
|
|
2193
|
+
error?: string;
|
|
2194
|
+
};
|
|
2169
2195
|
} | {
|
|
2170
2196
|
parentFrameId?: string;
|
|
2171
2197
|
id: string;
|
|
@@ -2706,6 +2732,7 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
2706
2732
|
type?: import("../types/slides").SlideType;
|
|
2707
2733
|
sourcePackageId?: string;
|
|
2708
2734
|
skeleton?: boolean;
|
|
2735
|
+
aiRequestId?: string;
|
|
2709
2736
|
}[];
|
|
2710
2737
|
slideIndex: number;
|
|
2711
2738
|
viewportSize: number;
|
|
@@ -3015,6 +3042,14 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
3015
3042
|
sourceWidth?: number;
|
|
3016
3043
|
sourceHeight?: number;
|
|
3017
3044
|
};
|
|
3045
|
+
mediaState?: {
|
|
3046
|
+
slotId?: string;
|
|
3047
|
+
status: import("../types/slides").ImageMediaStatus;
|
|
3048
|
+
aspectRatio?: number;
|
|
3049
|
+
fit?: import("../types/slides").ImageMediaFit;
|
|
3050
|
+
label?: string;
|
|
3051
|
+
error?: string;
|
|
3052
|
+
};
|
|
3018
3053
|
} | {
|
|
3019
3054
|
parentFrameId?: string;
|
|
3020
3055
|
id: string;
|
|
@@ -3555,6 +3590,7 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
3555
3590
|
type?: import("../types/slides").SlideType;
|
|
3556
3591
|
sourcePackageId?: string;
|
|
3557
3592
|
skeleton?: boolean;
|
|
3593
|
+
aiRequestId?: string;
|
|
3558
3594
|
}[];
|
|
3559
3595
|
theme: {
|
|
3560
3596
|
headingFontName?: string;
|
|
@@ -252,6 +252,26 @@ export interface ImageElementClip {
|
|
|
252
252
|
shape: string;
|
|
253
253
|
}
|
|
254
254
|
export type ImageType = 'pageFigure' | 'itemFigure' | 'background';
|
|
255
|
+
export type ImageMediaStatus = 'pending' | 'ready' | 'error';
|
|
256
|
+
export type ImageMediaFit = 'cover' | 'contain';
|
|
257
|
+
/**
|
|
258
|
+
* Async/pending image slot metadata persisted on a native `PPTImageElement`.
|
|
259
|
+
* Omitted or `status: 'ready'` behaves as a normal resolved image.
|
|
260
|
+
*/
|
|
261
|
+
export interface ImageMediaState {
|
|
262
|
+
/** Stable slot/job identifier persisted across reload, reorder, and async media completion. */
|
|
263
|
+
slotId?: string;
|
|
264
|
+
/** Lifecycle status of async/pending media. */
|
|
265
|
+
status: ImageMediaStatus;
|
|
266
|
+
/** Optional target aspect ratio (`width / height`) preserved while pending and on resolution. */
|
|
267
|
+
aspectRatio?: number;
|
|
268
|
+
/** Fit policy used when resolving media (`'cover'` default, or `'contain'`). */
|
|
269
|
+
fit?: ImageMediaFit;
|
|
270
|
+
/** Optional host-localized accessible status label (e.g. "Generating image…"). */
|
|
271
|
+
label?: string;
|
|
272
|
+
/** Optional human-readable error message when `status === 'error'`. */
|
|
273
|
+
error?: string;
|
|
274
|
+
}
|
|
255
275
|
/**
|
|
256
276
|
* Image element.
|
|
257
277
|
*/
|
|
@@ -286,6 +306,8 @@ export interface PPTImageElement extends PPTBaseElement {
|
|
|
286
306
|
sourceWidth?: number;
|
|
287
307
|
sourceHeight?: number;
|
|
288
308
|
};
|
|
309
|
+
/** Async/pending image slot state; cleared automatically when resolved via `media.setImageSource`. */
|
|
310
|
+
mediaState?: ImageMediaState;
|
|
289
311
|
}
|
|
290
312
|
/**
|
|
291
313
|
* Text inside a shape.
|
|
@@ -631,6 +653,8 @@ export interface Slide {
|
|
|
631
653
|
type?: SlideType;
|
|
632
654
|
sourcePackageId?: string;
|
|
633
655
|
skeleton?: boolean;
|
|
656
|
+
/** Optional host correlation id for a pending AI-generated skeleton slide (enables native cancel action). */
|
|
657
|
+
aiRequestId?: string;
|
|
634
658
|
}
|
|
635
659
|
/**
|
|
636
660
|
* Slide theme (background, accent colors, default font).
|
|
@@ -204,6 +204,7 @@ export declare const rotateRectLikeElement: (element: Exclude<PPTElement, PPTLin
|
|
|
204
204
|
sourceWidth?: number;
|
|
205
205
|
sourceHeight?: number;
|
|
206
206
|
};
|
|
207
|
+
mediaState?: import("../types/slides").ImageMediaState;
|
|
207
208
|
left: number;
|
|
208
209
|
top: number;
|
|
209
210
|
rotate: number;
|
|
@@ -11,4 +11,4 @@ export type ThumbnailVirtualizerApi = {
|
|
|
11
11
|
thumbHeight: number;
|
|
12
12
|
dest: PreviewDestSize;
|
|
13
13
|
};
|
|
14
|
-
export declare const useThumbnailVirtualizer: (items: RailSlideMeta[], hasSection: boolean) => ThumbnailVirtualizerApi;
|
|
14
|
+
export declare const useThumbnailVirtualizer: (items: RailSlideMeta[], hasSection: boolean, showGapControls?: boolean) => ThumbnailVirtualizerApi;
|
|
@@ -2,11 +2,16 @@ export type ISlideSkeletonProps = {
|
|
|
2
2
|
className?: string;
|
|
3
3
|
/** Swallow pointer gestures so the placeholder cannot be drawn on (live canvas). */
|
|
4
4
|
shield?: boolean;
|
|
5
|
+
/** Optional host AI insertion request id to expose an accessible cancel control. */
|
|
6
|
+
requestId?: string;
|
|
7
|
+
generatingLabel?: string;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
onCancel?: () => void;
|
|
5
10
|
};
|
|
6
11
|
/**
|
|
7
12
|
* Shimmering placeholder painted over a `Slide.skeleton` slide. Absolutely
|
|
8
13
|
* fills its positioned parent; block geometry is shared with the canvas
|
|
9
14
|
* painter so a thumbnail and a `renderSlide` capture agree.
|
|
10
15
|
*/
|
|
11
|
-
declare const SlideSkeleton: import("react").MemoExoticComponent<({ className, shield }: ISlideSkeletonProps) => import("react").JSX.Element>;
|
|
16
|
+
declare const SlideSkeleton: import("react").MemoExoticComponent<({ className, shield, requestId, generatingLabel, cancelLabel, onCancel, }: ISlideSkeletonProps) => import("react").JSX.Element>;
|
|
12
17
|
export default SlideSkeleton;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type CSSProperties, type DragEventHandler } from 'react';
|
|
2
|
+
import type { ImageMediaState } from '../../../../types/slides';
|
|
2
3
|
export type IImageBitmapSurfaceProps = {
|
|
3
4
|
src: string;
|
|
5
|
+
mediaState?: ImageMediaState;
|
|
6
|
+
altText?: string;
|
|
4
7
|
className?: string;
|
|
5
8
|
style?: CSSProperties;
|
|
6
9
|
draggable?: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ImageMediaSlotKind = 'pending' | 'loading' | 'error';
|
|
2
|
+
export interface ImageMediaSlotProps {
|
|
3
|
+
status: ImageMediaSlotKind;
|
|
4
|
+
label: string;
|
|
5
|
+
slotId?: string;
|
|
6
|
+
/** Hide the shimmer sweep (used for neutral static empty placeholders). */
|
|
7
|
+
staticSurface?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const ImageMediaSlot: import("react").MemoExoticComponent<({ status, label, slotId, staticSurface }: ImageMediaSlotProps) => import("react").JSX.Element>;
|
|
10
|
+
export default ImageMediaSlot;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
export type ImageBitmapLoadStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
2
|
+
export interface ImageBitmapLoadState {
|
|
3
|
+
bitmap: ImageBitmap | null;
|
|
4
|
+
status: ImageBitmapLoadStatus;
|
|
5
|
+
}
|
|
6
|
+
export declare const useImageBitmapState: (src: string) => ImageBitmapLoadState;
|
|
1
7
|
export declare const useImageBitmap: (src: string) => ImageBitmap | null;
|
|
2
8
|
export declare const useSyncImageBitmapCache: () => void;
|
package/docs/EMBED.md
CHANGED
|
@@ -167,6 +167,45 @@ await controller.slides.update(item.id, { elements, background, remark })
|
|
|
167
167
|
controller.goToSlide(item.id)
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
+
### Generating a slide at a chosen position
|
|
171
|
+
|
|
172
|
+
Set `aiSlideInsert` on mount or call `controller.setAiSlideInsert(config)` to expose an AI action in the gaps before, between, and after slide thumbnails. Each action supports keyboard focus and activation. Use `labels` for host-specific wording.
|
|
173
|
+
|
|
174
|
+
`onRequest(anchor)` supplies a request ID and the slide IDs on either side of the gap. The host collects the prompt, runs generation, and inserts the resulting slide. Keep the anchor until the request finishes so edits and reordering during generation carry through to placement. For example, a host receiving a completed slide can apply it in one undoable edit.
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const result = await controller.slides.insert({
|
|
178
|
+
slides: generatedSlide,
|
|
179
|
+
anchor: {
|
|
180
|
+
position: request.position,
|
|
181
|
+
afterSlideId: request.afterSlideId,
|
|
182
|
+
beforeSlideId: request.beforeSlideId,
|
|
183
|
+
fallbackIndex: request.insertIndex,
|
|
184
|
+
},
|
|
185
|
+
select: true,
|
|
186
|
+
})
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The controller also emits `aiSlideInsertRequested` with the same request ID. Use one request handler per editor. A host that exposes a cancellable skeleton slide can correlate cancellation with `onCancel` and discard an outstanding result.
|
|
190
|
+
|
|
191
|
+
### Images that finish after slide text
|
|
192
|
+
|
|
193
|
+
Give each pending image its final position and dimensions, an empty `src`, and a `mediaState` containing `{ status: 'pending', slotId, fit: 'cover' }`. Use a fresh slot ID for each replacement request. The editor can display and edit subsequent slides while the host obtains the image. Settle the specific slot with its slide ID and slot ID.
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
const result = await controller.execute({
|
|
197
|
+
type: 'media.setImageSource',
|
|
198
|
+
payload: {
|
|
199
|
+
slideId,
|
|
200
|
+
slotId,
|
|
201
|
+
asset: { src: imageUrl, width: imageWidth, height: imageHeight },
|
|
202
|
+
onlyIfPending: true,
|
|
203
|
+
},
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Inspect `result.ok` before persisting. A deleted slot returns a recoverable lookup error. For a failed request, use `media.setImageState` with the same target and an error state. Keep the current editor document as the source of truth when saving late media.
|
|
208
|
+
|
|
170
209
|
### Bridge subscriptions
|
|
171
210
|
|
|
172
211
|
Subscribe once when the controller is mounted, then unsubscribe before replacing or destroying it. `documentChanged` is the best signal for persistence, while `commandFailed` is the best signal for agent telemetry:
|