fika-editor 3.0.25 → 3.0.27
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/{482.js → 6311.js} +59 -59
- package/dist/embed/agentic-manifest.json +202 -12
- package/dist/embed/chunks/2020.js +75 -49
- package/dist/embed/fika-embed.css +2 -2
- package/dist/embed/fika-embed.js +3 -3
- package/dist/types/embed/agentic/layouts.d.ts +10 -0
- package/dist/types/embed/agentic/types.d.ts +7 -1
- package/dist/types/paint/rasterResources.d.ts +7 -0
- package/dist/types/paint/textPainter.d.ts +1 -0
- package/dist/types/utils/inlineMathBox.d.ts +10 -0
- package/dist/types/utils/markdown.d.ts +20 -0
- package/dist/types/utils/math.d.ts +15 -2
- package/dist/types/utils/portal.d.ts +7 -0
- package/dist/types/utils/textFit.d.ts +31 -0
- package/package.json +2 -2
- /package/dist/embed/{static/font/fonts → fonts}/Inter.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/JetBrainsMono.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_AMS-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Caligraphic-Bold.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Caligraphic-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Fraktur-Bold.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Fraktur-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-Bold.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-BoldItalic.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-Italic.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Math-BoldItalic.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Math-Italic.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_SansSerif-Bold.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_SansSerif-Italic.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_SansSerif-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Script-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size1-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size2-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size3-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size4-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Typewriter-Regular.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/Lato.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/Literata.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/Merriweather.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/Montserrat.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/OpenSans.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/Roboto.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/SourceSansPro.woff2 +0 -0
- /package/dist/embed/{static/font/fonts → fonts}/SourceSerif4.woff2 +0 -0
|
@@ -58,6 +58,16 @@ export interface FikaLayout {
|
|
|
58
58
|
/** Strip one or more leading bullet/number markers from a list item. */
|
|
59
59
|
export declare function stripLeadingListMarkers(raw: string): string;
|
|
60
60
|
type Slots = Record<string, unknown>;
|
|
61
|
+
/** Natural (intrinsic) pixel size of a bitmap, when the host or the probe knows it. */
|
|
62
|
+
export interface ImageNaturalSize {
|
|
63
|
+
width: number;
|
|
64
|
+
height: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Best-effort natural size of a bitmap. Browser only; resolves `undefined`
|
|
68
|
+
* on error or after `timeoutMs` so a slow CDN never blocks slide creation.
|
|
69
|
+
*/
|
|
70
|
+
export declare function probeImageNaturalSize(src: string, timeoutMs?: number): Promise<ImageNaturalSize | undefined>;
|
|
61
71
|
export declare const PPTX_LAYOUTS: FikaLayout[];
|
|
62
72
|
export declare function listLayouts(): FikaLayout[];
|
|
63
73
|
/**
|
|
@@ -7,6 +7,8 @@ import type { FikaLayout, FikaLayoutBackgroundMode } from './layouts';
|
|
|
7
7
|
import type { FikaStyleMotif, FikaStyleSummary } from './styles';
|
|
8
8
|
import type { CompositionAnchor, CompositionPlan, CompositionSlideHint } from './composition';
|
|
9
9
|
import type { FikaAgenticDocs, FikaCommandDescription, FikaDesignGuide, FikaDomainSummary } from './manifestDocs';
|
|
10
|
+
import type { TextRunStyle } from '../../utils/markdown';
|
|
11
|
+
export type { TextRunStyle } from '../../utils/markdown';
|
|
10
12
|
export type { FikaAgenticDocs, FikaCommandDescription, FikaCommandDoc, FikaDesignGuide, FikaDesignSystem, FikaDocParam, FikaDomainDoc, FikaDomainSummary } from './manifestDocs';
|
|
11
13
|
export type { FikaTemplateSummary, FikaTemplateSlideEntry, FikaTemplateSlidesCatalog, FikaTemplateSlidesCatalogResult } from './templates';
|
|
12
14
|
export type { FikaLayout, FikaLayoutSlotDef, FikaLayoutBackgroundMode, FikaLayoutVariant } from './layouts';
|
|
@@ -317,6 +319,8 @@ export interface FikaCreateTextInput {
|
|
|
317
319
|
content?: string;
|
|
318
320
|
/** Markdown content; converted to HTML by the bridge. */
|
|
319
321
|
markdown?: string;
|
|
322
|
+
/** Run style (fontSize / fontName / color / bold / align) applied to `markdown`. */
|
|
323
|
+
style?: TextRunStyle;
|
|
320
324
|
element?: Partial<PPTTextElement>;
|
|
321
325
|
select?: boolean;
|
|
322
326
|
}
|
|
@@ -742,9 +746,10 @@ export interface FikaAgentTextApi {
|
|
|
742
746
|
setContent(elementId: string, content: string, meta?: FikaCommandMeta & {
|
|
743
747
|
slideId?: string;
|
|
744
748
|
}): Promise<FikaCommandResult<PPTTextElement>>;
|
|
745
|
-
/** Replace content from a Markdown string (converted to HTML)
|
|
749
|
+
/** Replace content from a Markdown string (converted to HTML), optionally with a run `style`. */
|
|
746
750
|
setMarkdown(elementId: string, markdown: string, meta?: FikaCommandMeta & {
|
|
747
751
|
slideId?: string;
|
|
752
|
+
style?: TextRunStyle;
|
|
748
753
|
}): Promise<FikaCommandResult<PPTTextElement>>;
|
|
749
754
|
updateContent(elementId: string, update: FikaTextContentUpdateInput, meta?: FikaCommandMeta & {
|
|
750
755
|
slideId?: string;
|
|
@@ -1429,6 +1434,7 @@ export interface FikaCommandPayloadMap {
|
|
|
1429
1434
|
elementId: string;
|
|
1430
1435
|
slideId?: string;
|
|
1431
1436
|
markdown: string;
|
|
1437
|
+
style?: TextRunStyle;
|
|
1432
1438
|
};
|
|
1433
1439
|
'text.updateContent': {
|
|
1434
1440
|
elementId: string;
|
|
@@ -10,5 +10,12 @@ export declare const getCodeRaster: (element: PPTCodeElement, invalidate: () =>
|
|
|
10
10
|
* cannot load the MathLive web fonts.
|
|
11
11
|
*/
|
|
12
12
|
export declare const getLatexRaster: (element: PPTLatexElement, invalidate: () => void) => Raster | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Typeset inline/display math at the painted font size and snapshot it.
|
|
15
|
+
* The booth is `.fika-embed-root` so scoped MathLive CSS applies; a white
|
|
16
|
+
* or empty capture falls back to readable TeX-ish text instead of a gap.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getInlineMathRaster: (latex: string, fontSize: number, color: string, display: boolean, invalidate: () => void) => Raster | undefined;
|
|
19
|
+
export declare const hasPendingRasters: () => boolean;
|
|
13
20
|
export declare const clearSlideRasterResources: () => void;
|
|
14
21
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Canonical class on typeset math wrappers. Kept here so text-fit can stay MathLive-free. */
|
|
2
|
+
export declare const MATH_CLASS = "fika-math";
|
|
3
|
+
export declare function htmlHasFikaMath(html: string): boolean;
|
|
4
|
+
/** Readable stand-in when a math raster has not arrived yet. Never leave a blank chip. */
|
|
5
|
+
export declare function latexFallbackText(latex: string): string;
|
|
6
|
+
/** Fallback box when MathLive is not loaded yet — wide enough to reserve wrap space. */
|
|
7
|
+
export declare function estimateInlineMathBox(latex: string, fontSize: number, display: boolean): {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
@@ -50,3 +50,23 @@ export declare function ensureInlineMathReady(): Promise<void>;
|
|
|
50
50
|
* read as literal text.
|
|
51
51
|
*/
|
|
52
52
|
export declare function renderInlineMarkdown(markdown: string): string;
|
|
53
|
+
/** Typographic run style applied on top of Markdown-rendered HTML. */
|
|
54
|
+
export interface TextRunStyle {
|
|
55
|
+
/** Font size in px (the deck's canvas px). */
|
|
56
|
+
fontSize?: number;
|
|
57
|
+
/** CSS font-family name, e.g. "Calibri". */
|
|
58
|
+
fontName?: string;
|
|
59
|
+
/** CSS color (hex / rgb). */
|
|
60
|
+
color?: string;
|
|
61
|
+
bold?: boolean;
|
|
62
|
+
align?: 'left' | 'center' | 'right' | 'justify';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Apply one run style (size / font / color / bold / align) to Markdown output
|
|
66
|
+
* so agents get styled copy from `text.create({ markdown, style })` without
|
|
67
|
+
* hand-writing `<span style>` HTML. Parses the HTML with parse5, wraps each
|
|
68
|
+
* block's inline content in a single styled span (the shape the editor and
|
|
69
|
+
* the pptx importer produce) and mirrors size / color onto list containers so
|
|
70
|
+
* bullet markers match.
|
|
71
|
+
*/
|
|
72
|
+
export declare function applyTextRunStyle(htmlText: string, style: TextRunStyle | undefined): string;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `fonts.css`) is lazy-loaded the first time math actually appears or an editor
|
|
13
13
|
* opens, so decks without math never pull it into the bundle.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export { MATH_CLASS, estimateInlineMathBox, htmlHasFikaMath } from './inlineMathBox';
|
|
16
16
|
type ConvertLatexToMarkup = (latex: string, options?: {
|
|
17
17
|
defaultMode?: 'inline-math' | 'math' | 'text';
|
|
18
18
|
}) => string;
|
|
@@ -26,6 +26,7 @@ interface MathliveModule {
|
|
|
26
26
|
MathfieldElement: {
|
|
27
27
|
fontsDirectory: string | null;
|
|
28
28
|
soundsDirectory: string | null;
|
|
29
|
+
stylesheetScope: string | null;
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
@@ -86,6 +87,19 @@ export declare const LATEX_ELEMENT_FONT_SIZE = 36;
|
|
|
86
87
|
* inline math — not the old hfmath stroke paths.
|
|
87
88
|
*/
|
|
88
89
|
export declare function renderLatexElementHtml(latex: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Sync natural box of inline/display math at `fontSize`. Returns null until
|
|
92
|
+
* MathLive can typeset; callers should fall back to {@link estimateInlineMathBox}.
|
|
93
|
+
*/
|
|
94
|
+
export declare function measureInlineMathBox(latex: string, fontSize: number, display?: boolean): {
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
} | null;
|
|
98
|
+
/** Measured box when MathLive is ready, otherwise a conservative estimate. */
|
|
99
|
+
export declare function inlineMathBox(latex: string, fontSize: number, display?: boolean): {
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
};
|
|
89
103
|
/** Natural box of a formula at {@link LATEX_ELEMENT_FONT_SIZE}, plus padding. */
|
|
90
104
|
export declare function measureLatexElement(latex: string): Promise<{
|
|
91
105
|
width: number;
|
|
@@ -101,4 +115,3 @@ export declare function deckHasMath(slides: ReadonlyArray<{
|
|
|
101
115
|
export declare function ensureMathStylesForSlides(slides: ReadonlyArray<{
|
|
102
116
|
elements?: ReadonlyArray<unknown>;
|
|
103
117
|
}>): void;
|
|
104
|
-
export {};
|
|
@@ -5,6 +5,13 @@ export declare function setFikaPortalTarget(target: HTMLElement | null): void;
|
|
|
5
5
|
export declare function clearFikaPortalTarget(target: HTMLElement): void;
|
|
6
6
|
/** Overlay mount for the standalone app. Never document.body — that is the page, not Fika. */
|
|
7
7
|
export declare function ensureAppPortalRoot(): HTMLElement;
|
|
8
|
+
/**
|
|
9
|
+
* Parent for offscreen work nodes (MathLive probes, raster stages). The embed
|
|
10
|
+
* stylesheet is scoped under `.fika-embed-root`, so a node hung off
|
|
11
|
+
* `document.body` would paint without MathLive/ProseMirror rules (fractions
|
|
12
|
+
* collapse to a flat run). Mount inside the embed root when there is one.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveOffscreenHost(): HTMLElement;
|
|
8
15
|
export declare function getFikaPortalTarget(): HTMLElement;
|
|
9
16
|
/**
|
|
10
17
|
* Resolve the portal target for a *specific* embed instance.
|
|
@@ -31,6 +31,13 @@ export interface TextFitRun {
|
|
|
31
31
|
strikethrough?: boolean;
|
|
32
32
|
color?: string;
|
|
33
33
|
fontFamily?: string;
|
|
34
|
+
/** Authored TeX from `span.fika-math[data-latex]` — painted as a raster chip. */
|
|
35
|
+
mathLatex?: string;
|
|
36
|
+
mathDisplay?: boolean;
|
|
37
|
+
/** Chip width at authored `size` (not yet fit-scaled). */
|
|
38
|
+
extraWidth?: number;
|
|
39
|
+
/** Chip height at authored `size` (fractions are taller than the font). */
|
|
40
|
+
mathHeight?: number;
|
|
34
41
|
}
|
|
35
42
|
/** A single measurable text block (one paragraph or one list item). */
|
|
36
43
|
export interface TextFitBlock {
|
|
@@ -120,6 +127,22 @@ export declare function innerBoxFromLiveStyles(box: HTMLElement | null | undefin
|
|
|
120
127
|
};
|
|
121
128
|
export declare function contentBoxOfHost(host: HTMLElement | null | undefined): HTMLElement | null;
|
|
122
129
|
export declare function measureUnzoomedScrollHeight(host: HTMLElement, innerWidth: number): number;
|
|
130
|
+
/** Line-box size for a run: math chips use the typeset height, not the font. */
|
|
131
|
+
export declare const runVisualSize: (run: TextFitRun) => number;
|
|
132
|
+
/**
|
|
133
|
+
* Stand-in grapheme for a math chip. pretext drops items whose text is empty
|
|
134
|
+
* or whitespace-only, so a chip must carry one real `text`-kind grapheme to
|
|
135
|
+
* exist in the flow; its glyph advance is subtracted from `extraWidth` so the
|
|
136
|
+
* item occupies exactly the chip width.
|
|
137
|
+
*/
|
|
138
|
+
export declare const MATH_PLACEHOLDER = "\uFFFC";
|
|
139
|
+
export declare const richInlineFromRun: (run: TextFitRun, font: string, sizeScale: number, letterSpacing?: number) => {
|
|
140
|
+
text: string;
|
|
141
|
+
font: string;
|
|
142
|
+
letterSpacing?: number;
|
|
143
|
+
break?: 'never';
|
|
144
|
+
extraWidth?: number;
|
|
145
|
+
};
|
|
123
146
|
export declare function measureTextBlocksHeight(blocks: TextFitBlock[], options: MeasureBlocksOptions): number;
|
|
124
147
|
export interface FitFontScaleOptions {
|
|
125
148
|
innerWidth: number;
|
|
@@ -149,6 +172,7 @@ export type FitMeasureSession = {
|
|
|
149
172
|
key: string;
|
|
150
173
|
lineHeight: number;
|
|
151
174
|
maxFont: number;
|
|
175
|
+
letterSpacing?: number;
|
|
152
176
|
items: Array<{
|
|
153
177
|
block: TextFitBlock;
|
|
154
178
|
size: number;
|
|
@@ -183,6 +207,8 @@ type FitScaleOptions = {
|
|
|
183
207
|
letterSpacing?: number;
|
|
184
208
|
blockSpace?: number;
|
|
185
209
|
locale?: string;
|
|
210
|
+
/** Pre-extracted blocks (e.g. after MathLive refined math chip sizes). */
|
|
211
|
+
blocks?: TextFitBlock[];
|
|
186
212
|
};
|
|
187
213
|
/**
|
|
188
214
|
* Persist a DOM-verified correction: the editor measured the REAL rendered
|
|
@@ -195,6 +221,11 @@ export declare function rememberFitScale(html: string, options: FitScaleOptions,
|
|
|
195
221
|
* cached session; preview/export call this so they shrink with the same math.
|
|
196
222
|
*/
|
|
197
223
|
export declare function textFitScaleForHtml(html: string, options: FitScaleOptions): number;
|
|
224
|
+
/** Replace estimated math chip boxes with a real typeset measure. */
|
|
225
|
+
export declare function applyMeasuredMathBoxes(blocks: TextFitBlock[], measure: (latex: string, fontSize: number, display: boolean) => {
|
|
226
|
+
width: number;
|
|
227
|
+
height: number;
|
|
228
|
+
} | null): void;
|
|
198
229
|
export interface ExtractedContent {
|
|
199
230
|
blocks: TextFitBlock[];
|
|
200
231
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fika-editor",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.27",
|
|
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",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"lucide-react": "^1.33.0",
|
|
110
110
|
"markdown-it": "^15.0.0",
|
|
111
111
|
"markdown-it-texmath": "^1.0.0",
|
|
112
|
-
"mathlive": "npm:@lofcz/mathlive@^0.110.
|
|
112
|
+
"mathlive": "npm:@lofcz/mathlive@^0.110.8",
|
|
113
113
|
"mathml2omml-plus": "^0.6.4",
|
|
114
114
|
"mermaid": "^11.17.0",
|
|
115
115
|
"mitt": "^3.0.1",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|