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
package/dist/text/index.js
CHANGED
|
@@ -4,7 +4,10 @@ import { math } from 'micromark-extension-llm-math';
|
|
|
4
4
|
import { decodeHTML } from 'entities';
|
|
5
5
|
import MarkdownIt from 'markdown-it';
|
|
6
6
|
import texmath from 'markdown-it-texmath';
|
|
7
|
-
|
|
7
|
+
import { inlineDollarEnd } from './inlineDollar.js';
|
|
8
|
+
const mathSyntax = math();
|
|
9
|
+
const dollar = mathSyntax.text[36];
|
|
10
|
+
const mdastExtensions = [mathFromMarkdown()];
|
|
8
11
|
// Preserve the existing Fika support for bare TeX environments. This parser is
|
|
9
12
|
// only used for that uncommon syntax; CommonMark code fences still take priority.
|
|
10
13
|
const environmentParser = new MarkdownIt({ html: false }).use(texmath, {
|
|
@@ -28,7 +31,19 @@ function parserInput(source) {
|
|
|
28
31
|
}
|
|
29
32
|
return out.join('');
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
function parseGeneratedMarkdown(source) {
|
|
35
|
+
const singleOrDisplay = {
|
|
36
|
+
...dollar,
|
|
37
|
+
tokenize(effects, ok, nok) {
|
|
38
|
+
const start = this.now().offset;
|
|
39
|
+
if (source[start + 1] !== '$' && inlineDollarEnd(source, start) < 0)
|
|
40
|
+
return nok;
|
|
41
|
+
return dollar.tokenize.call(this, effects, ok, nok);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const extension = { ...mathSyntax, text: { ...mathSyntax.text, 36: singleOrDisplay } };
|
|
45
|
+
return fromMarkdown(parserInput(source), { extensions: [extension], mdastExtensions });
|
|
46
|
+
}
|
|
32
47
|
function environmentSpans(source) {
|
|
33
48
|
if (!source.includes('\\begin{'))
|
|
34
49
|
return [];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The nearest unescaped dollar on the same line must be a closer. Never
|
|
3
|
+
* search past a price or the start of a second formula for a later closer.
|
|
4
|
+
* Digits can start a formula ($2+2$), but cannot follow its closing delimiter.
|
|
5
|
+
*/
|
|
6
|
+
export declare function inlineDollarEnd(source: string, start: number): number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The nearest unescaped dollar on the same line must be a closer. Never
|
|
3
|
+
* search past a price or the start of a second formula for a later closer.
|
|
4
|
+
* Digits can start a formula ($2+2$), but cannot follow its closing delimiter.
|
|
5
|
+
*/
|
|
6
|
+
export function inlineDollarEnd(source, start) {
|
|
7
|
+
const first = source[start + 1];
|
|
8
|
+
if (!first || first === '$' || /\s/.test(first))
|
|
9
|
+
return -1;
|
|
10
|
+
for (let i = start + 1; i < source.length; i++) {
|
|
11
|
+
const char = source[i];
|
|
12
|
+
if (char === '\n' || char === '\r')
|
|
13
|
+
return -1;
|
|
14
|
+
if (char === '\\' && (source[i + 1] === '$' || source[i + 1] === '\\')) {
|
|
15
|
+
i++;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (char !== '$')
|
|
19
|
+
continue;
|
|
20
|
+
const before = source[i - 1];
|
|
21
|
+
const after = source[i + 1] || '';
|
|
22
|
+
if (/\s/.test(before) || after === '$' || /\d/.test(after))
|
|
23
|
+
return -1;
|
|
24
|
+
if (after === '.' && /\d/.test(source[i + 2] || ''))
|
|
25
|
+
return -1;
|
|
26
|
+
// An opening parenthesis, backtick, etc. before $x makes it a new opener.
|
|
27
|
+
if (/[\p{P}\p{S}]/u.test(before) && /\p{L}/u.test(after))
|
|
28
|
+
return -1;
|
|
29
|
+
return i + 1;
|
|
30
|
+
}
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Slide } from '../types/slides';
|
|
2
|
+
export type FikaSlideGapPosition = 'before-first' | 'between' | 'after-last';
|
|
3
|
+
export interface FikaAiSlideInsertAnchor {
|
|
4
|
+
/** Stable unique request id generated by Fika for correlation and cancellation. */
|
|
5
|
+
requestId: string;
|
|
6
|
+
/** Semantic gap location at trigger time. */
|
|
7
|
+
position: FikaSlideGapPosition;
|
|
8
|
+
/** Slide id immediately before the gap (`null` for `before-first` or empty deck). */
|
|
9
|
+
afterSlideId: string | null;
|
|
10
|
+
/** Slide id immediately after the gap (`null` for `after-last` or empty deck). */
|
|
11
|
+
beforeSlideId: string | null;
|
|
12
|
+
/** 1-based insertion index at trigger time (matches `slides.create` / `slides.insert`). */
|
|
13
|
+
insertIndex: number;
|
|
14
|
+
/** Slide count at trigger time. */
|
|
15
|
+
slideCount: number;
|
|
16
|
+
/** Active slide id at trigger time, if any. */
|
|
17
|
+
currentSlideId: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface FikaSlideInsertAnchorInput {
|
|
20
|
+
position?: FikaSlideGapPosition;
|
|
21
|
+
afterSlideId?: string | null;
|
|
22
|
+
beforeSlideId?: string | null;
|
|
23
|
+
/** Optional 1-based fallback index if neither neighbor slide still exists. */
|
|
24
|
+
fallbackIndex?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface FikaAiSlideInsertLabels {
|
|
27
|
+
/** Primary action label, e.g. "Add slide with AI". */
|
|
28
|
+
addWithAi?: string;
|
|
29
|
+
/** Accessible label for the gap before slide 1. */
|
|
30
|
+
addWithAiBeforeFirst?: string;
|
|
31
|
+
/** Accessible label for a gap between slides (optional `{after}` / `{before}` 1-based placeholders). */
|
|
32
|
+
addWithAiBetween?: string;
|
|
33
|
+
/** Accessible label for the gap after the last slide. */
|
|
34
|
+
addWithAiAfterLast?: string;
|
|
35
|
+
/** Manual blank slide insertion button label at a gap. */
|
|
36
|
+
addBlankSlide?: string;
|
|
37
|
+
/** Cancel label shown on pending skeleton slide / active AI insertion indicator. */
|
|
38
|
+
cancel?: string;
|
|
39
|
+
/** Status text shown while a pending AI slide is generating. */
|
|
40
|
+
generating?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface FikaAiSlideInsertCancelDetail {
|
|
43
|
+
requestId: string;
|
|
44
|
+
slideId?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface FikaAiSlideInsertConfig {
|
|
47
|
+
/** Show AI insert actions at slide gaps. Defaults to `true` when config object is supplied. */
|
|
48
|
+
enabled?: boolean;
|
|
49
|
+
/** Disable AI insert triggers while keeping controls visible. */
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/** Host-localized labels; omitted entries fall back to Fika built-in i18n. */
|
|
52
|
+
labels?: FikaAiSlideInsertLabels;
|
|
53
|
+
/** Optional direct callback invoked when user triggers AI insert at a gap. */
|
|
54
|
+
onRequest?: (anchor: FikaAiSlideInsertAnchor) => void;
|
|
55
|
+
/** Optional direct callback invoked when user activates cancel on a pending AI skeleton slide. */
|
|
56
|
+
onCancel?: (detail: FikaAiSlideInsertCancelDetail) => void;
|
|
57
|
+
}
|
|
58
|
+
export type FikaAiSlideInsertInternalEvent = {
|
|
59
|
+
type: 'aiSlideInsertRequested';
|
|
60
|
+
data: FikaAiSlideInsertAnchor;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'aiSlideInsertCancelled';
|
|
63
|
+
data: FikaAiSlideInsertCancelDetail;
|
|
64
|
+
};
|
|
65
|
+
type AiSlideInsertEventListener = (event: FikaAiSlideInsertInternalEvent) => void;
|
|
66
|
+
export declare const useAiSlideInsert: import("zustand").UseBoundStore<import("zustand").StoreApi<{
|
|
67
|
+
config: FikaAiSlideInsertConfig | null;
|
|
68
|
+
}>>;
|
|
69
|
+
export declare function setFikaAiSlideInsert(config?: FikaAiSlideInsertConfig | null): void;
|
|
70
|
+
export declare function getFikaAiSlideInsert(): FikaAiSlideInsertConfig | null;
|
|
71
|
+
export declare function isFikaAiSlideInsertEnabled(config: FikaAiSlideInsertConfig | null): boolean;
|
|
72
|
+
export declare function subscribeFikaAiSlideInsertEvents(listener: AiSlideInsertEventListener): () => void;
|
|
73
|
+
export declare function createAiGapRequestId(): string;
|
|
74
|
+
/**
|
|
75
|
+
* Build a stable gap anchor for the given 0-based splice position (`0..slides.length`).
|
|
76
|
+
* `spliceIndex === 0` is `before-first`, `spliceIndex === slides.length` is `after-last`
|
|
77
|
+
* (when slides exist), and intermediate indices are `between`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildSlideGapAnchor(slides: readonly Pick<Slide, 'id'>[], spliceIndex: number, currentSlideId?: string | null, requestId?: string): FikaAiSlideInsertAnchor;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve a stable 1-based insertion index (`1..slides.length + 1`) from an anchor
|
|
82
|
+
* even after asynchronous edits, insertions, reorders, or neighbor deletions.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resolveSlideGapInsertIndex(slides: readonly Pick<Slide, 'id'>[], anchor: FikaSlideInsertAnchorInput): number;
|
|
85
|
+
export declare function emitFikaAiSlideInsertRequest(anchor: FikaAiSlideInsertAnchor): void;
|
|
86
|
+
export declare function emitFikaAiSlideInsertCancel(detail: FikaAiSlideInsertCancelDetail): void;
|
|
87
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Locales } from '../../i18n/locale';
|
|
2
2
|
import type { ShapeCategoryKey, ShapePoolItem } from '../../configs/shapes';
|
|
3
|
-
import type { Broken2LineDirection, ChartData, ChartOptions, ChartType, Gradient, LinePoint, LineStyleType, Note, NoteReply, PPTAnimation, PPTAudioElement, PPTChartElement, PPTElement, PPTElementLink, PPTElementOutline, PPTElementShadow, PPTImageElement, PPTLatexElement, PPTLineElement, PPTShapeElement, PPTTableElement, PPTTextElement, PPTVideoElement, ShapeText, Slide, SlideBackground, SlideTemplate, SlideTheme, TableCell, TableCellStyle, TextAlign, TurningMode } from '../../types/slides';
|
|
3
|
+
import type { Broken2LineDirection, ChartData, ChartOptions, ChartType, Gradient, ImageMediaFit, ImageMediaState, LinePoint, LineStyleType, Note, NoteReply, PPTAnimation, PPTAudioElement, PPTChartElement, PPTElement, PPTElementLink, PPTElementOutline, PPTElementShadow, PPTImageElement, PPTLatexElement, PPTLineElement, PPTShapeElement, PPTTableElement, PPTTextElement, PPTVideoElement, ShapeText, Slide, SlideBackground, SlideTemplate, SlideTheme, TableCell, TableCellStyle, TextAlign, TurningMode } from '../../types/slides';
|
|
4
|
+
import type { FikaAiSlideInsertAnchor, FikaAiSlideInsertCancelDetail, FikaSlideInsertAnchorInput } from '../../configs/aiSlideInsert';
|
|
4
5
|
import type { FikaDocument } from '../types';
|
|
5
6
|
import type { FikaTemplateCatalogQuery, FikaTemplateSlidesCatalogResult, FikaTemplateSummary } from './templates';
|
|
6
7
|
import type { FikaLayout, FikaLayoutBackgroundMode } from './layouts';
|
|
@@ -151,7 +152,7 @@ export interface FikaMediaAssetResolverResult {
|
|
|
151
152
|
asset: FikaMediaAsset;
|
|
152
153
|
warnings?: FikaCommandIssue[];
|
|
153
154
|
}
|
|
154
|
-
export type FikaBridgeEventType = 'documentChanged' | 'selectionChanged' | 'commandApplied' | 'commandFailed' | 'destroyed';
|
|
155
|
+
export type FikaBridgeEventType = 'documentChanged' | 'selectionChanged' | 'commandApplied' | 'commandFailed' | 'aiSlideInsertRequested' | 'aiSlideInsertCancelled' | 'destroyed';
|
|
155
156
|
export interface FikaBridgeEvent<TData = unknown> {
|
|
156
157
|
type: FikaBridgeEventType;
|
|
157
158
|
documentVersion: number;
|
|
@@ -175,10 +176,18 @@ export interface FikaCommandFailedEvent extends FikaBridgeEvent {
|
|
|
175
176
|
command: FikaAgentCommand;
|
|
176
177
|
result: FikaCommandResult;
|
|
177
178
|
}
|
|
179
|
+
export interface FikaAiSlideInsertRequestedEvent extends FikaBridgeEvent<FikaAiSlideInsertAnchor> {
|
|
180
|
+
type: 'aiSlideInsertRequested';
|
|
181
|
+
data: FikaAiSlideInsertAnchor;
|
|
182
|
+
}
|
|
183
|
+
export interface FikaAiSlideInsertCancelledEvent extends FikaBridgeEvent<FikaAiSlideInsertCancelDetail> {
|
|
184
|
+
type: 'aiSlideInsertCancelled';
|
|
185
|
+
data: FikaAiSlideInsertCancelDetail;
|
|
186
|
+
}
|
|
178
187
|
export interface FikaDestroyedEvent extends FikaBridgeEvent {
|
|
179
188
|
type: 'destroyed';
|
|
180
189
|
}
|
|
181
|
-
export type FikaTypedBridgeEvent = FikaDocumentChangedEvent | FikaSelectionChangedEvent | FikaCommandAppliedEvent | FikaCommandFailedEvent | FikaDestroyedEvent;
|
|
190
|
+
export type FikaTypedBridgeEvent = FikaDocumentChangedEvent | FikaSelectionChangedEvent | FikaCommandAppliedEvent | FikaCommandFailedEvent | FikaAiSlideInsertRequestedEvent | FikaAiSlideInsertCancelledEvent | FikaDestroyedEvent;
|
|
182
191
|
export type FikaBridgeListener = (event: FikaBridgeEvent) => void;
|
|
183
192
|
export type FikaUnsubscribe = () => void;
|
|
184
193
|
export interface FikaBridgeState {
|
|
@@ -212,6 +221,8 @@ export interface FikaCreateSlideInput {
|
|
|
212
221
|
slide?: Partial<Slide>;
|
|
213
222
|
/** 1-based insert position; omit or pass slideCount+1 to append. */
|
|
214
223
|
index?: number;
|
|
224
|
+
/** Stable neighbor anchor used to resolve the live 1-based insert position when `index` is omitted. */
|
|
225
|
+
anchor?: FikaSlideInsertAnchorInput;
|
|
215
226
|
select?: boolean;
|
|
216
227
|
}
|
|
217
228
|
export interface FikaDeleteSlidesResult {
|
|
@@ -230,6 +241,8 @@ export interface FikaIdRemap {
|
|
|
230
241
|
export interface FikaInsertSlidesInput {
|
|
231
242
|
slides: Slide | Slide[];
|
|
232
243
|
index?: number;
|
|
244
|
+
/** Stable neighbor anchor used to resolve the live 1-based insert position when `index` is omitted. */
|
|
245
|
+
anchor?: FikaSlideInsertAnchorInput;
|
|
233
246
|
select?: boolean;
|
|
234
247
|
preserveExternalSlideLinks?: boolean;
|
|
235
248
|
}
|
|
@@ -639,6 +652,8 @@ export interface FikaAgentSlidesApi {
|
|
|
639
652
|
get(slideIdOrIndex?: FikaSlideReference): Slide | null;
|
|
640
653
|
current(): Slide | null;
|
|
641
654
|
read(slideIdOrIndex?: FikaSlideReference, meta?: FikaCommandMeta): Promise<FikaCommandResult<Slide | null>>;
|
|
655
|
+
/** Resolve a stable 1-based insert index from a gap anchor against the live slide order. */
|
|
656
|
+
resolveInsertIndex(anchor: FikaSlideInsertAnchorInput): number;
|
|
642
657
|
create(input?: FikaCreateSlideInput, meta?: FikaCommandMeta): Promise<FikaCommandResult<Slide>>;
|
|
643
658
|
/** Build + insert a themed slide from a layout recipe (from `layouts.catalog`) using the active style preset. */
|
|
644
659
|
createFromLayout(input: FikaCreateFromLayoutInput, meta?: FikaCommandMeta): Promise<FikaCommandResult<FikaCreateFromLayoutResult>>;
|
|
@@ -955,10 +970,39 @@ export interface FikaAgentImagesApi {
|
|
|
955
970
|
slideId?: string;
|
|
956
971
|
}): Promise<FikaCommandResult<Slide>>;
|
|
957
972
|
}
|
|
973
|
+
export interface FikaSetImageSourceOptions {
|
|
974
|
+
slideId?: string;
|
|
975
|
+
slotId?: string;
|
|
976
|
+
fit?: ImageMediaFit;
|
|
977
|
+
natural?: {
|
|
978
|
+
width: number;
|
|
979
|
+
height: number;
|
|
980
|
+
};
|
|
981
|
+
onlyIfPending?: boolean;
|
|
982
|
+
}
|
|
983
|
+
export interface FikaSetImageSourcePayload extends FikaSetImageSourceOptions {
|
|
984
|
+
elementId?: string;
|
|
985
|
+
asset?: FikaMediaAssetInput;
|
|
986
|
+
src?: string;
|
|
987
|
+
patch?: Partial<PPTImageElement>;
|
|
988
|
+
}
|
|
989
|
+
export interface FikaSetImageStatePayload {
|
|
990
|
+
elementId?: string;
|
|
991
|
+
slotId?: string;
|
|
992
|
+
slideId?: string;
|
|
993
|
+
state: ImageMediaState | null;
|
|
994
|
+
onlyIfPending?: boolean;
|
|
995
|
+
}
|
|
958
996
|
export interface FikaAgentMediaApi {
|
|
959
997
|
resolveAsset(asset: FikaMediaAssetInput, kind?: FikaMediaAssetKind): FikaMediaAsset;
|
|
960
|
-
setImageSource(elementId: string, asset: FikaMediaAssetInput, patch?: Partial<PPTImageElement>, meta?: FikaCommandMeta &
|
|
998
|
+
setImageSource(elementId: string, asset: FikaMediaAssetInput, patch?: Partial<PPTImageElement>, meta?: FikaCommandMeta & FikaSetImageSourceOptions): Promise<FikaCommandResult<PPTImageElement>>;
|
|
999
|
+
setImageState(target: string | {
|
|
1000
|
+
elementId?: string;
|
|
1001
|
+
slotId?: string;
|
|
1002
|
+
slideId?: string;
|
|
1003
|
+
}, state: ImageMediaState | null, meta?: FikaCommandMeta & {
|
|
961
1004
|
slideId?: string;
|
|
1005
|
+
onlyIfPending?: boolean;
|
|
962
1006
|
}): Promise<FikaCommandResult<PPTImageElement>>;
|
|
963
1007
|
setVideoSource(elementId: string, asset: FikaMediaAssetInput, patch?: Partial<PPTVideoElement>, meta?: FikaCommandMeta & {
|
|
964
1008
|
slideId?: string;
|
|
@@ -1888,12 +1932,8 @@ export interface FikaCommandPayloadMap {
|
|
|
1888
1932
|
asset: FikaMediaAssetInput;
|
|
1889
1933
|
kind?: FikaMediaAssetKind;
|
|
1890
1934
|
};
|
|
1891
|
-
'media.setImageSource':
|
|
1892
|
-
|
|
1893
|
-
slideId?: string;
|
|
1894
|
-
asset: FikaMediaAssetInput;
|
|
1895
|
-
patch?: Partial<PPTImageElement>;
|
|
1896
|
-
};
|
|
1935
|
+
'media.setImageSource': FikaSetImageSourcePayload;
|
|
1936
|
+
'media.setImageState': FikaSetImageStatePayload;
|
|
1897
1937
|
'media.setVideoSource': {
|
|
1898
1938
|
elementId: string;
|
|
1899
1939
|
slideId?: string;
|
|
@@ -2201,6 +2241,7 @@ export interface FikaCommandResultDataMap {
|
|
|
2201
2241
|
'images.setAsBackground': Slide;
|
|
2202
2242
|
'media.resolveAsset': FikaMediaAsset;
|
|
2203
2243
|
'media.setImageSource': PPTImageElement;
|
|
2244
|
+
'media.setImageState': PPTImageElement;
|
|
2204
2245
|
'media.setVideoSource': PPTVideoElement;
|
|
2205
2246
|
'media.setAudioSource': PPTAudioElement;
|
|
2206
2247
|
'videos.get': PPTVideoElement;
|
|
@@ -23,6 +23,7 @@ export declare function assertColorString(value: unknown, path?: string): string
|
|
|
23
23
|
export declare function assertColorFields(value: unknown, path?: string): void;
|
|
24
24
|
export declare function assertElementType(value: unknown, path?: string): PPTElement['type'];
|
|
25
25
|
export declare function assertElementDimensions(element: Partial<PPTElement>, path?: string): void;
|
|
26
|
+
export declare function assertImageMediaState(value: unknown, path?: string): void;
|
|
26
27
|
export declare function assertElementSubtypeRequirements(element: Partial<PPTElement> & {
|
|
27
28
|
type?: unknown;
|
|
28
29
|
}, path?: string): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { exportPresentationPptx, exportPresentationPdf, type FikaExportOptions, type FikaExportProgress } from './export';
|
|
2
2
|
export { renderSlideImage, renderDeckAtlas } from "./render";
|
|
3
3
|
export { mountFika, unmountFika } from './mount';
|
|
4
|
-
export type { FikaController, FikaDocument, FikaHeaderMenuItem, FikaMountOptions, FikaMountResult, FikaDocumentLoader, FikaStarterPresentationOptions, FikaTemplateLoader, FikaTemplatePayload, FikaImportPptxOptions, FikaImportApplyMode, FikaViewMode, } from './types';
|
|
4
|
+
export type { FikaAiSlideInsertAnchor, FikaAiSlideInsertCancelDetail, FikaAiSlideInsertConfig, FikaAiSlideInsertLabels, FikaController, FikaDocument, FikaHeaderMenuItem, FikaMountOptions, FikaMountResult, FikaDocumentLoader, FikaSlideGapPosition, FikaSlideInsertAnchorInput, FikaStarterPresentationOptions, FikaTemplateLoader, FikaTemplatePayload, FikaImportPptxOptions, FikaImportApplyMode, FikaViewMode, } from './types';
|
|
5
5
|
export type { FikaDeckAtlasOptions, FikaDeckAtlasSheet, FikaDeckAtlasTile, FikaRenderSlideOptions, } from './render';
|
|
6
6
|
export type { ExportTabId, FikaExportTabsConfig } from '../configs/exportTabs';
|
|
7
7
|
export type { FikaExportMediaResolver } from '../configs/exportMediaResolver';
|
|
@@ -11,7 +11,7 @@ export { createFikaMediaUploader, } from '../configs/mediaUpload';
|
|
|
11
11
|
export type { FikaMediaConfig, FikaMediaConstraints, FikaMediaKind, FikaMediaSizeLimit, FikaMediaUploadProgress, FikaMediaUploadRequest, FikaMediaUploadResult, FikaMediaUploader, FikaXhrMediaUploaderOptions, } from '../configs/mediaUpload';
|
|
12
12
|
export type * from './agentic/types';
|
|
13
13
|
export type { Locales as FikaLocales } from '../i18n/locale';
|
|
14
|
-
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';
|
|
14
|
+
export type { ChartData, ChartOptions, ChartType, ImageMediaFit, ImageMediaState, ImageMediaStatus, ImageMediaFit as FikaImageMediaFit, ImageMediaState as FikaImageMediaState, ImageMediaStatus as FikaImageMediaStatus, 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';
|
|
15
15
|
export type { FikaDesignTheme } from '../configs/designThemes';
|
|
16
16
|
export { getFikaDefaultDesignThemes } from '../configs/designThemes';
|
|
17
17
|
export { resizeDeckSlides, type SlideCanvas } from '../utils/resizeDeck';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FikaDesignTheme } from '../configs/designThemes';
|
|
2
|
+
import type { FikaAiSlideInsertAnchor, FikaAiSlideInsertCancelDetail, FikaAiSlideInsertConfig, FikaAiSlideInsertLabels, FikaSlideGapPosition, FikaSlideInsertAnchorInput } from '../configs/aiSlideInsert';
|
|
2
3
|
import type { FikaExportTabsConfig } from '../configs/exportTabs';
|
|
3
4
|
import type { FikaExportMediaResolver } from '../configs/exportMediaResolver';
|
|
4
5
|
import type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, FikaWatermarkSurface } from '../configs/exportWatermark';
|
|
@@ -8,6 +9,7 @@ import type { Locales } from '../i18n/locale';
|
|
|
8
9
|
import type { Slide, SlideTheme, SlideTemplate } from '../types/slides';
|
|
9
10
|
import type { FikaAgentApi, FikaDeckViewport, FikaSlideReference } from './agentic/types';
|
|
10
11
|
import type { FikaRevealOptions } from './reveal';
|
|
12
|
+
export type { FikaAiSlideInsertAnchor, FikaAiSlideInsertCancelDetail, FikaAiSlideInsertConfig, FikaAiSlideInsertLabels, FikaSlideGapPosition, FikaSlideInsertAnchorInput, };
|
|
11
13
|
export type { FikaExportMediaResolver };
|
|
12
14
|
export type { FikaExportWatermark, FikaExportWatermarkPosition, FikaExportWatermarkResolver, FikaWatermarkSurface };
|
|
13
15
|
export type { FikaExportMetadata, FikaExportMetadataContext, FikaExportMetadataResolver, FikaExportMetadataXmpNamespace };
|
|
@@ -160,6 +162,12 @@ export interface FikaMountOptions {
|
|
|
160
162
|
* Exiting the slideshow re-enters it, so the page stays a pure viewer.
|
|
161
163
|
*/
|
|
162
164
|
viewMode?: FikaViewMode;
|
|
165
|
+
/**
|
|
166
|
+
* Host-driven "AI add slide here" controls rendered at the first, middle, and
|
|
167
|
+
* last gaps in the slide rail. Fika emits stable anchor payloads and never
|
|
168
|
+
* calls LLM providers directly. Update live via `controller.setAiSlideInsert`.
|
|
169
|
+
*/
|
|
170
|
+
aiSlideInsert?: FikaAiSlideInsertConfig;
|
|
163
171
|
/**
|
|
164
172
|
* Start in view-only mode: the user can browse slides but not select, edit,
|
|
165
173
|
* insert, reorder or delete anything. Host and agent commands still apply.
|
|
@@ -216,6 +224,8 @@ export interface FikaController extends FikaAgentApi {
|
|
|
216
224
|
setLocale(locale: Locales): Promise<void>;
|
|
217
225
|
/** Replace the visible design catalog without changing slide content. Undefined restores defaults. */
|
|
218
226
|
setDesignThemes(themes?: readonly FikaDesignTheme[]): void;
|
|
227
|
+
/** Update or disable host-driven gap AI slide insertion controls without remounting. */
|
|
228
|
+
setAiSlideInsert(config?: FikaAiSlideInsertConfig | null): void;
|
|
219
229
|
/**
|
|
220
230
|
* Paint one slide offscreen (thumbnail painter, no DOM capture) and return
|
|
221
231
|
* the encoded image. Defaults to the current slide.
|
|
@@ -5,7 +5,7 @@ declare function _default(): {
|
|
|
5
5
|
updateSlideIndex: (command: string) => void;
|
|
6
6
|
copySlide: () => Promise<boolean>;
|
|
7
7
|
pasteSlide: () => void;
|
|
8
|
-
createSlide: () => void;
|
|
8
|
+
createSlide: (insertAtIndex?: number) => void;
|
|
9
9
|
createSlideByTemplate: (slide: Slide) => void;
|
|
10
10
|
copyAndPasteSlide: () => void;
|
|
11
11
|
deleteSlide: (targetSlidesId?: string[]) => void;
|
|
@@ -3932,6 +3932,36 @@ export type NamespaceEditorTranslation = {
|
|
|
3932
3932
|
* Add slide
|
|
3933
3933
|
*/
|
|
3934
3934
|
addSlide: string;
|
|
3935
|
+
/**
|
|
3936
|
+
* Add slide with AI
|
|
3937
|
+
*/
|
|
3938
|
+
addWithAi: string;
|
|
3939
|
+
/**
|
|
3940
|
+
* Add slide with AI before slide 1
|
|
3941
|
+
*/
|
|
3942
|
+
addWithAiBeforeFirst: string;
|
|
3943
|
+
/**
|
|
3944
|
+
* Add slide with AI between slides {after} and {before}
|
|
3945
|
+
* @param {number} after
|
|
3946
|
+
* @param {number} before
|
|
3947
|
+
*/
|
|
3948
|
+
addWithAiBetween: RequiredParams<'after' | 'before'>;
|
|
3949
|
+
/**
|
|
3950
|
+
* Add slide with AI after the last slide
|
|
3951
|
+
*/
|
|
3952
|
+
addWithAiAfterLast: string;
|
|
3953
|
+
/**
|
|
3954
|
+
* Insert blank slide here
|
|
3955
|
+
*/
|
|
3956
|
+
addBlankSlideHere: string;
|
|
3957
|
+
/**
|
|
3958
|
+
* Generating slide…
|
|
3959
|
+
*/
|
|
3960
|
+
generatingSlide: string;
|
|
3961
|
+
/**
|
|
3962
|
+
* Cancel
|
|
3963
|
+
*/
|
|
3964
|
+
cancelAiSlide: string;
|
|
3935
3965
|
/**
|
|
3936
3966
|
* Enter section name
|
|
3937
3967
|
*/
|
|
@@ -4035,6 +4065,20 @@ export type NamespaceEditorTranslation = {
|
|
|
4035
4065
|
presentFromCurrent: string;
|
|
4036
4066
|
};
|
|
4037
4067
|
};
|
|
4068
|
+
mediaSlot: {
|
|
4069
|
+
/**
|
|
4070
|
+
* Generating image…
|
|
4071
|
+
*/
|
|
4072
|
+
pending: string;
|
|
4073
|
+
/**
|
|
4074
|
+
* Loading image…
|
|
4075
|
+
*/
|
|
4076
|
+
loading: string;
|
|
4077
|
+
/**
|
|
4078
|
+
* Image unavailable
|
|
4079
|
+
*/
|
|
4080
|
+
error: string;
|
|
4081
|
+
};
|
|
4038
4082
|
elementAnimation: {
|
|
4039
4083
|
/**
|
|
4040
4084
|
* Add animation
|
|
@@ -10018,6 +10062,37 @@ export type TranslationFunctions = {
|
|
|
10018
10062
|
* Add slide
|
|
10019
10063
|
*/
|
|
10020
10064
|
addSlide: () => LocalizedString;
|
|
10065
|
+
/**
|
|
10066
|
+
* Add slide with AI
|
|
10067
|
+
*/
|
|
10068
|
+
addWithAi: () => LocalizedString;
|
|
10069
|
+
/**
|
|
10070
|
+
* Add slide with AI before slide 1
|
|
10071
|
+
*/
|
|
10072
|
+
addWithAiBeforeFirst: () => LocalizedString;
|
|
10073
|
+
/**
|
|
10074
|
+
* Add slide with AI between slides {after} and {before}
|
|
10075
|
+
*/
|
|
10076
|
+
addWithAiBetween: (arg: {
|
|
10077
|
+
after: number;
|
|
10078
|
+
before: number;
|
|
10079
|
+
}) => LocalizedString;
|
|
10080
|
+
/**
|
|
10081
|
+
* Add slide with AI after the last slide
|
|
10082
|
+
*/
|
|
10083
|
+
addWithAiAfterLast: () => LocalizedString;
|
|
10084
|
+
/**
|
|
10085
|
+
* Insert blank slide here
|
|
10086
|
+
*/
|
|
10087
|
+
addBlankSlideHere: () => LocalizedString;
|
|
10088
|
+
/**
|
|
10089
|
+
* Generating slide…
|
|
10090
|
+
*/
|
|
10091
|
+
generatingSlide: () => LocalizedString;
|
|
10092
|
+
/**
|
|
10093
|
+
* Cancel
|
|
10094
|
+
*/
|
|
10095
|
+
cancelAiSlide: () => LocalizedString;
|
|
10021
10096
|
/**
|
|
10022
10097
|
* Enter section name
|
|
10023
10098
|
*/
|
|
@@ -10122,6 +10197,20 @@ export type TranslationFunctions = {
|
|
|
10122
10197
|
presentFromCurrent: () => LocalizedString;
|
|
10123
10198
|
};
|
|
10124
10199
|
};
|
|
10200
|
+
mediaSlot: {
|
|
10201
|
+
/**
|
|
10202
|
+
* Generating image…
|
|
10203
|
+
*/
|
|
10204
|
+
pending: () => LocalizedString;
|
|
10205
|
+
/**
|
|
10206
|
+
* Loading image…
|
|
10207
|
+
*/
|
|
10208
|
+
loading: () => LocalizedString;
|
|
10209
|
+
/**
|
|
10210
|
+
* Image unavailable
|
|
10211
|
+
*/
|
|
10212
|
+
error: () => LocalizedString;
|
|
10213
|
+
};
|
|
10125
10214
|
elementAnimation: {
|
|
10126
10215
|
/**
|
|
10127
10216
|
* Add animation
|
|
@@ -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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The nearest unescaped dollar on the same line must be a closer. Never
|
|
3
|
+
* search past a price or the start of a second formula for a later closer.
|
|
4
|
+
* Digits can start a formula ($2+2$), but cannot follow its closing delimiter.
|
|
5
|
+
*/
|
|
6
|
+
export declare function inlineDollarEnd(source: string, start: number): number;
|
|
@@ -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;
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const convertOmmlMathSpans: (doc: Document) => void;
|
|
8
8
|
/** Typeset leftover TeX source with MathLive — any control word, not a command list. */
|
|
9
|
-
export declare const convertBareLatexBlocks: (doc: Document) =>
|
|
9
|
+
export declare const convertBareLatexBlocks: (doc: Document) => boolean;
|
|
10
10
|
/** Import-time and paint-time: OMML spans + leftover TeX source → fika-math. */
|
|
11
11
|
export declare function typesetImportedTex(html: string): string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { markdownMathSegments, normalizeGeneratedMarkdown } from '../text/index';
|
|
2
2
|
/** True when a string carries math delimiters the math parser should handle. */
|
|
3
3
|
export declare function containsMath(source: string): boolean;
|
|
4
|
-
/**
|
|
4
|
+
/** Cheap prefilter for HTML. Delimiter boundaries are resolved on individual text nodes. */
|
|
5
|
+
export declare function mayContainTexSource(source: string): boolean;
|
|
5
6
|
export declare function containsTexSource(source: string): boolean;
|
|
6
7
|
/** The whole string is a TeX formula MathLive can typeset as-is. */
|
|
7
|
-
export declare function isTexFormulaSource(source: string): boolean;
|
|
8
|
+
export declare function isTexFormulaSource(source: string, segments?: import("../text/index").MarkdownMathSegment[]): boolean;
|
|
8
9
|
/**
|
|
9
10
|
* A run of either plain text or a single math span, in source order. `raw` is
|
|
10
11
|
* the exact source slice (delimiters included for math); `value` is the inner
|