fika-editor 3.6.13 → 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/text/index.js +17 -2
- package/dist/text/inlineDollar.d.ts +6 -0
- package/dist/text/inlineDollar.js +32 -0
- 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-types.d.ts +89 -0
- package/dist/types/store/slides.d.ts +36 -0
- package/dist/types/text/inlineDollar.d.ts +6 -0
- package/dist/types/types/slides.d.ts +24 -0
- package/dist/types/utils/element.d.ts +1 -0
- package/dist/types/utils/importedTex.d.ts +1 -1
- package/dist/types/utils/markdown.d.ts +3 -2
- package/dist/types/utils/prosemirror/schema/index.d.ts +9 -0
- package/dist/types/utils/prosemirror/schema/marks.d.ts +9 -0
- package/dist/types/utils/prosemirror/table.d.ts +1 -1
- 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
|
@@ -12,6 +12,15 @@ export declare const schemaNodes: {
|
|
|
12
12
|
export declare const schemaMarks: {
|
|
13
13
|
em: import("prosemirror-model").MarkSpec;
|
|
14
14
|
strong: import("prosemirror-model").MarkSpec;
|
|
15
|
+
literalDollar: {
|
|
16
|
+
inclusive: false;
|
|
17
|
+
parseDOM: {
|
|
18
|
+
tag: string;
|
|
19
|
+
}[];
|
|
20
|
+
toDOM: () => [string, {
|
|
21
|
+
'data-literal-dollar': string;
|
|
22
|
+
}, number];
|
|
23
|
+
};
|
|
15
24
|
fontsize: import("prosemirror-model").MarkSpec;
|
|
16
25
|
fontname: import("prosemirror-model").MarkSpec;
|
|
17
26
|
code: import("prosemirror-model").MarkSpec;
|
|
@@ -2,6 +2,15 @@ import type { MarkSpec } from 'prosemirror-model';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
em: MarkSpec;
|
|
4
4
|
strong: MarkSpec;
|
|
5
|
+
literalDollar: {
|
|
6
|
+
inclusive: false;
|
|
7
|
+
parseDOM: {
|
|
8
|
+
tag: string;
|
|
9
|
+
}[];
|
|
10
|
+
toDOM: () => [string, {
|
|
11
|
+
'data-literal-dollar': string;
|
|
12
|
+
}, number];
|
|
13
|
+
};
|
|
5
14
|
fontsize: MarkSpec;
|
|
6
15
|
fontname: MarkSpec;
|
|
7
16
|
code: MarkSpec;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema, type Node as PMNode } from 'prosemirror-model';
|
|
2
2
|
import { EditorState, type Transaction } from 'prosemirror-state';
|
|
3
3
|
import type { TableCell, TableCellStyle } from '../../types/slides';
|
|
4
|
-
export declare const tableSchema: Schema<"doc" | "hard_break" | "math" | "paragraph" | "text", "code" | "em" | "fontname" | "fontsize" | "forecolor" | "link" | "strikethrough" | "strong" | "subscript" | "superscript" | "underline">;
|
|
4
|
+
export declare const tableSchema: Schema<"doc" | "hard_break" | "math" | "paragraph" | "text", "code" | "em" | "fontname" | "fontsize" | "forecolor" | "link" | "literalDollar" | "strikethrough" | "strong" | "subscript" | "superscript" | "underline">;
|
|
5
5
|
export declare const plainTextToTableHTML: (text: string) => string;
|
|
6
6
|
declare const markNames: {
|
|
7
7
|
readonly bold: 'strong';
|
|
@@ -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:
|