fika-editor 3.0.26 → 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/agentic-manifest.json +2 -2
- 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/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/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
|
@@ -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
|
+
};
|
|
@@ -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
|