@formulaxjs/editor 0.3.1 → 0.4.1
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/README.md +16 -13
- package/README.zh-CN.md +69 -0
- package/dist/index.cjs +31 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.global.js +153 -149
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
- /package/dist/{KF_AMS_BB-5QF7FUSO.woff → KF_AMS_BB.woff} +0 -0
- /package/dist/{KF_AMS_CAL-NXRNLAZN.woff → KF_AMS_CAL.woff} +0 -0
- /package/dist/{KF_AMS_FRAK-CO33WWN4.woff → KF_AMS_FRAK.woff} +0 -0
- /package/dist/{KF_AMS_MAIN-25QJVAWY.woff → KF_AMS_MAIN.woff} +0 -0
- /package/dist/{KF_AMS_ROMAN-243BR7HH.woff → KF_AMS_ROMAN.woff} +0 -0
- /package/dist/{btn-5DANP6JY.png → btn.png} +0 -0
- /package/dist/{editor-JT5KLVXX.css → editor.css} +0 -0
- /package/dist/{other-OMWJFGL5.png → other.png} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// src/formula-modal.ts
|
|
2
2
|
import { createEmptyState, parseLatex } from "@formulaxjs/core";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
mountKityEditor
|
|
5
|
+
} from "@formulaxjs/kity-runtime";
|
|
4
6
|
import { escapeHtml, ensureFormulaXBaseStyles } from "@formulaxjs/renderer";
|
|
5
7
|
import {
|
|
6
8
|
serializeKityFormulaFromRoot,
|
|
@@ -174,8 +176,11 @@ var formulaXModalStyles = `
|
|
|
174
176
|
inset: 0;
|
|
175
177
|
z-index: 2147483000;
|
|
176
178
|
display: flex;
|
|
177
|
-
align-items:
|
|
179
|
+
align-items: flex-start;
|
|
178
180
|
justify-content: center;
|
|
181
|
+
padding: 16px;
|
|
182
|
+
overflow-x: hidden;
|
|
183
|
+
overflow-y: auto;
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
.fx-formula-modal-backdrop {
|
|
@@ -188,9 +193,10 @@ var formulaXModalStyles = `
|
|
|
188
193
|
--fx-formula-editor-body-height: 264px;
|
|
189
194
|
--fx-formula-workspace-height: 168px;
|
|
190
195
|
position: relative;
|
|
191
|
-
width: min(
|
|
196
|
+
width: min(920px, calc(100vw - 32px));
|
|
192
197
|
height: auto;
|
|
193
|
-
max-height:
|
|
198
|
+
max-height: none;
|
|
199
|
+
margin: 0 auto;
|
|
194
200
|
background: #fff;
|
|
195
201
|
border-radius: 14px;
|
|
196
202
|
box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
|
|
@@ -408,6 +414,7 @@ function mountFormulaXEditor(root, options = {}) {
|
|
|
408
414
|
initialLatex,
|
|
409
415
|
height: options.height ?? "100%",
|
|
410
416
|
autofocus: options.autofocus ?? true,
|
|
417
|
+
locale: options.locale,
|
|
411
418
|
assets: options.assets,
|
|
412
419
|
render: {
|
|
413
420
|
fontsize: options.render?.fontsize ?? 40
|
|
@@ -511,10 +518,35 @@ async function tryReadLatexFromKityHandle(handle) {
|
|
|
511
518
|
}
|
|
512
519
|
return null;
|
|
513
520
|
}
|
|
521
|
+
|
|
522
|
+
// src/i18n.ts
|
|
523
|
+
import {
|
|
524
|
+
DEFAULT_FORMULAX_LOCALE,
|
|
525
|
+
normalizeFormulaXLocale
|
|
526
|
+
} from "@formulaxjs/kity-runtime";
|
|
527
|
+
var FORMULAX_EDITOR_MESSAGES = {
|
|
528
|
+
en_US: {
|
|
529
|
+
"modal.title": "FormulaX Editor",
|
|
530
|
+
"modal.insert": "Insert",
|
|
531
|
+
"modal.update": "Update",
|
|
532
|
+
"modal.cancel": "Cancel"
|
|
533
|
+
},
|
|
534
|
+
zh_CN: {
|
|
535
|
+
"modal.title": "FormulaX \u7F16\u8F91\u5668",
|
|
536
|
+
"modal.insert": "\u63D2\u5165",
|
|
537
|
+
"modal.update": "\u66F4\u65B0",
|
|
538
|
+
"modal.cancel": "\u53D6\u6D88"
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
function getFormulaXEditorMessage(key, locale = DEFAULT_FORMULAX_LOCALE) {
|
|
542
|
+
const normalizedLocale = normalizeFormulaXLocale(locale);
|
|
543
|
+
return FORMULAX_EDITOR_MESSAGES[normalizedLocale][key] ?? FORMULAX_EDITOR_MESSAGES[DEFAULT_FORMULAX_LOCALE][key];
|
|
544
|
+
}
|
|
514
545
|
export {
|
|
515
546
|
clearFormulaXPerfMarks,
|
|
516
547
|
ensureFormulaXModalStyles,
|
|
517
548
|
formulaXModalStyles,
|
|
549
|
+
getFormulaXEditorMessage,
|
|
518
550
|
markFormulaXPerf,
|
|
519
551
|
measureFormulaXPerf,
|
|
520
552
|
mountFormulaXEditor,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/formula-modal.ts","../src/perf.ts"],"sourcesContent":["import { createEmptyState, parseLatex, type FormulaState } from '@formulaxjs/core';\nimport { mountKityEditor, type KityEditorAssets, type KityEditorHandle } from '@formulaxjs/kity-runtime';\nimport { escapeHtml, ensureFormulaXBaseStyles } from '@formulaxjs/renderer';\nimport {\n serializeKityFormulaFromRoot,\n waitForKityFormulaSvgLayout,\n} from '@formulaxjs/renderer-kity';\nimport {\n clearFormulaXPerfMarks,\n markFormulaXPerf,\n measureFormulaXPerf,\n recordFormulaXPerfPoint,\n} from './perf';\n\nconst EMPTY_FORMULA_PLACEHOLDER = '\\\\placeholder ';\nconst STYLE_ID = 'fx-formula-modal-styles';\n\nexport interface FormulaXEditorOptions {\n initialLatex?: string;\n height?: number | string;\n autofocus?: boolean;\n assets?: Partial<KityEditorAssets>;\n render?: {\n fontsize?: number;\n };\n}\n\nexport interface MountedFormulaXEditor {\n root: HTMLElement;\n getLatex: () => Promise<string>;\n getState: () => Promise<FormulaState>;\n getRenderHtml: () => Promise<string>;\n destroy: () => void;\n}\n\nexport const formulaXModalStyles = `\n.fx-formula-modal-open {\n overflow: hidden;\n}\n\n.fx-formula-modal-root {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.fx-formula-modal-backdrop {\n position: absolute;\n inset: 0;\n background: rgba(15, 23, 42, 0.48);\n}\n\n.fx-formula-modal {\n --fx-formula-editor-body-height: 264px;\n --fx-formula-workspace-height: 168px;\n position: relative;\n width: min(860px, calc(100vw - 32px));\n height: auto;\n max-height: calc(100vh - 32px);\n background: #fff;\n border-radius: 14px;\n box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);\n display: flex;\n flex-direction: column;\n overflow: visible;\n isolation: isolate;\n}\n\n.fx-formula-modal__header,\n.fx-formula-modal__footer,\n.fx-formula-modal__title,\n.fx-formula-modal__close,\n.fx-formula-modal__button,\n.fx-formula-editor-loading,\n.fx-formula-editor-error {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n}\n\n.fx-formula-modal__header {\n min-height: 56px;\n padding: 0 20px;\n border-bottom: 1px solid #e5e7eb;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n position: relative;\n z-index: 3;\n background: #fff;\n border-radius: 14px 14px 0 0;\n}\n\n.fx-formula-modal__title {\n font-size: 16px;\n font-weight: 650;\n margin: 0;\n color: #111827;\n}\n\n.fx-formula-modal__close {\n border: 0;\n background: transparent;\n font-size: 24px;\n line-height: 1;\n cursor: pointer;\n color: #6b7280;\n}\n\n.fx-formula-modal__body {\n flex: 0 0 auto;\n height: var(--fx-formula-editor-body-height);\n padding: 0;\n overflow: visible;\n min-height: var(--fx-formula-editor-body-height);\n position: relative;\n z-index: 2;\n}\n\n.fx-formula-editor-host {\n width: 100%;\n height: var(--fx-formula-editor-body-height);\n min-height: var(--fx-formula-editor-body-height);\n overflow: visible;\n position: relative;\n}\n\n.fx-formula-kity-host {\n width: 100%;\n height: var(--fx-formula-editor-body-height);\n min-height: var(--fx-formula-editor-body-height);\n overflow: visible;\n position: relative;\n}\n\n.fx-formula-kity-host .kf-editor {\n box-sizing: border-box;\n width: 100%;\n height: var(--fx-formula-editor-body-height) !important;\n overflow: visible !important;\n}\n\n.fx-formula-kity-host .kf-editor-toolbar {\n overflow: visible;\n position: relative;\n z-index: 20;\n}\n\n.fx-formula-kity-host .kf-editor-ui-button-mount-point,\n.fx-formula-kity-host .kf-editor-ui-area-mount,\n.fx-formula-kity-host .kf-editor-ui-box,\n.fx-formula-kity-host .kf-editor-ui-list {\n z-index: 1000;\n}\n\n.fx-formula-kity-host .kf-editor-edit-area,\n.fx-formula-kity-host .kf-editor-canvas-container {\n min-height: var(--fx-formula-workspace-height);\n height: var(--fx-formula-workspace-height);\n}\n\n.fx-formula-kity-host .kf-editor-edit-area {\n flex: 0 0 auto;\n overflow: hidden;\n}\n\n.fx-formula-kity-host .kf-editor,\n.fx-formula-kity-host .kf-editor svg text,\n.fx-formula-kity-host .kf-editor-ui-area-item-text,\n.fx-formula-kity-host .kf-editor-ui-box-item-text,\n.fx-formula-kity-host .kf-editor-ui-box-item-val {\n font-family: \"KF AMS MAIN\", \"Cambria Math\", \"Latin Modern Math\", \"Times New Roman\", serif !important;\n}\n\n.fx-formula-kity-host .kf-editor-ui-box-item-content,\n.fx-formula-kity-host .kf-editor-ui-box-item-val {\n min-width: 32px;\n min-height: 32px;\n}\n\n.fx-formula-kity-host .kf-editor-ui-box-item-val svg,\n.fx-formula-kity-host .kf-editor-ui-box-item-val img,\n.fx-formula-kity-host .kf-editor-ui-area-item-img,\n.fx-formula-kity-host .kf-editor-ui-area-item-text {\n display: block;\n}\n\n.fx-formula-editor-loading {\n height: var(--fx-formula-editor-body-height);\n padding: 24px;\n color: #4b5563;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.fx-formula-editor-error {\n padding: 24px;\n color: #dc2626;\n font-size: 14px;\n}\n\n.fx-formula-editor-error pre {\n white-space: pre-wrap;\n word-break: break-all;\n color: #991b1b;\n background: #fef2f2;\n border: 1px solid #fecaca;\n border-radius: 8px;\n padding: 12px;\n margin-top: 8px;\n}\n\n.fx-formula-modal__footer {\n min-height: 64px;\n padding: 12px 20px;\n border-top: 1px solid #e5e7eb;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 12px;\n flex-shrink: 0;\n position: relative;\n z-index: 1;\n background: #fff;\n border-radius: 0 0 14px 14px;\n}\n\n.fx-formula-modal__button {\n appearance: none;\n border: 1px solid #d1d5db;\n background: #fff;\n color: #111827;\n border-radius: 8px;\n padding: 8px 14px;\n font-size: 14px;\n cursor: pointer;\n}\n\n.fx-formula-modal__button--primary {\n border-color: #2563eb;\n background: #2563eb;\n color: #fff;\n}\n`;\n\nexport function ensureFormulaXModalStyles(doc: Document = document): void {\n ensureFormulaXBaseStyles(doc);\n\n if (doc.getElementById(STYLE_ID)) return;\n\n const style = doc.createElement('style');\n style.id = STYLE_ID;\n style.textContent = formulaXModalStyles;\n doc.head.appendChild(style);\n}\n\nexport function renderFormulaXEditorLoadingState(root: HTMLElement): void {\n root.classList.add('fx-formula-kity-host');\n root.innerHTML = `\n <div class=\"fx-formula-editor-loading\" role=\"status\" aria-live=\"polite\">\n Loading FormulaX editor...\n </div>\n `;\n}\n\nexport function mountFormulaXEditor(\n root: HTMLElement,\n options: FormulaXEditorOptions = {},\n): MountedFormulaXEditor {\n recordFormulaXPerfPoint('fx:formula-editor:mount:start');\n const mountStart = markFormulaXPerf('fx:formula-editor:mount:start:scope');\n let destroyed = false;\n let latestLatex = options.initialLatex ?? '';\n let handle: KityEditorHandle | null = null;\n const initialLatex = latestLatex.trim() ? latestLatex : EMPTY_FORMULA_PLACEHOLDER;\n\n renderFormulaXEditorLoadingState(root);\n const loadingVisibleMark = markFormulaXPerf('fx:formula-editor:loading-visible');\n measureFormulaXPerf('fx:formula-editor:loading-visible', mountStart, loadingVisibleMark);\n clearFormulaXPerfMarks(loadingVisibleMark);\n\n const readyPromise = mountKityEditor(root, {\n initialLatex,\n height: options.height ?? '100%',\n autofocus: options.autofocus ?? true,\n assets: options.assets,\n render: {\n fontsize: options.render?.fontsize ?? 40,\n },\n })\n .then((nextHandle) => {\n if (destroyed) {\n nextHandle.destroy();\n throw new Error('FormulaX editor mount cancelled');\n }\n\n const readyMark = markFormulaXPerf('fx:kity-editor:ready');\n measureFormulaXPerf('fx:kity-editor:ready', mountStart, readyMark);\n clearFormulaXPerfMarks(readyMark);\n handle = nextHandle;\n return nextHandle;\n })\n .catch((error) => {\n console.error('[FormulaX] Failed to load FormulaX editor:', error);\n\n if (!destroyed) {\n root.innerHTML = `\n <div class=\"fx-formula-editor-error\">\n Failed to load FormulaX editor.\n <pre>${escapeHtml(error instanceof Error ? error.message : String(error))}</pre>\n </div>\n `;\n }\n\n throw error;\n })\n .finally(() => {\n clearFormulaXPerfMarks(mountStart);\n });\n\n const getCurrentLatex = async (): Promise<string> => {\n const readyHandle = handle ?? await readyPromise;\n const latex = await tryReadLatexFromKityHandle(readyHandle);\n\n if (latex !== null) {\n latestLatex = latex;\n }\n\n return latestLatex;\n };\n\n return {\n root,\n\n getLatex: getCurrentLatex,\n\n async getState(): Promise<FormulaState> {\n const latex = await getCurrentLatex();\n\n try {\n return {\n ...createEmptyState(),\n doc: parseLatex(latex),\n };\n } catch {\n return createEmptyState();\n }\n },\n\n async getRenderHtml(): Promise<string> {\n await readyPromise;\n await waitForKityFormulaSvgLayout(root);\n return serializeKityFormulaFromRoot(root);\n },\n\n destroy(): void {\n if (destroyed) return;\n destroyed = true;\n\n void readyPromise\n .then((readyHandle) => readyHandle.destroy())\n .catch(() => undefined);\n\n root.innerHTML = '';\n },\n };\n}\n\nasync function tryReadLatexFromKityHandle(handle: KityEditorHandle): Promise<string | null> {\n try {\n let isEmpty = false;\n\n handle.ready(function ready() {\n const result = this.execCommand('content.is.empty');\n isEmpty = result === true;\n });\n\n if (isEmpty) {\n return '';\n }\n } catch {\n // Fall back to source commands for runtimes without content.is.empty.\n }\n\n const candidates = [\n 'get.source',\n 'getSource',\n 'getLatex',\n 'get.latex',\n 'get.content',\n 'getContent',\n ];\n\n for (const command of candidates) {\n try {\n let value: unknown = null;\n\n handle.ready(function ready() {\n value = this.execCommand(command);\n });\n\n if (typeof value === 'string' && value.trim()) {\n return value;\n }\n\n if (value && typeof value === 'object' && 'latex' in value) {\n const latex = (value as { latex?: unknown }).latex;\n if (typeof latex === 'string' && latex.trim()) {\n return latex;\n }\n }\n } catch {\n // Try the next available command name.\n }\n }\n\n return null;\n}\n","import { ensureKityRuntime } from '@formulaxjs/kity-runtime';\n\ntype FormulaXPerfState = {\n reportedMeasureCount: number;\n reportScheduled: boolean;\n};\n\ntype FormulaXPerfHost = typeof globalThis & {\n __FORMULAX_PERF__?: boolean;\n __FORMULAX_PERF_STATE__?: FormulaXPerfState;\n requestIdleCallback?: (callback: () => void) => number;\n cancelIdleCallback?: (handle: number) => void;\n};\n\nexport type FormulaXEditorPreloadMode = 'idle' | 'hover' | false;\n\nfunction getPerfHost(): FormulaXPerfHost {\n return globalThis as FormulaXPerfHost;\n}\n\nfunction getPerfState(): FormulaXPerfState {\n const host = getPerfHost();\n\n host.__FORMULAX_PERF_STATE__ ??= {\n reportedMeasureCount: 0,\n reportScheduled: false,\n };\n\n return host.__FORMULAX_PERF_STATE__;\n}\n\nfunction hasPerfSupport(): boolean {\n return typeof performance !== 'undefined'\n && typeof performance.mark === 'function'\n && typeof performance.measure === 'function'\n && typeof performance.getEntriesByType === 'function';\n}\n\nfunction isPerfDebugEnabled(): boolean {\n return getPerfHost().__FORMULAX_PERF__ === true;\n}\n\nfunction schedulePerfReport(): void {\n if (!hasPerfSupport() || !isPerfDebugEnabled()) {\n return;\n }\n\n const state = getPerfState();\n if (state.reportScheduled) {\n return;\n }\n\n state.reportScheduled = true;\n\n queueMicrotask(() => {\n state.reportScheduled = false;\n\n const entries = performance\n .getEntriesByType('measure')\n .filter((entry): entry is PerformanceMeasure => entry.name.startsWith('fx:'))\n .sort((left, right) => left.startTime - right.startTime);\n\n const nextEntries = entries.slice(state.reportedMeasureCount);\n state.reportedMeasureCount = entries.length;\n\n if (!nextEntries.length) {\n return;\n }\n\n console.table(nextEntries.map((entry) => ({\n name: entry.name,\n duration: Number(entry.duration.toFixed(2)),\n startTime: Number(entry.startTime.toFixed(2)),\n })));\n });\n}\n\nexport function markFormulaXPerf(name: string): string | null {\n if (!hasPerfSupport()) {\n return null;\n }\n\n const markName = `${name}::${Date.now()}::${Math.random().toString(36).slice(2, 8)}`;\n performance.mark(markName);\n return markName;\n}\n\nexport function measureFormulaXPerf(\n name: string,\n startMark: string | null,\n endMark?: string | null,\n): string | null {\n if (!hasPerfSupport() || !startMark) {\n return null;\n }\n\n const resolvedEndMark = endMark ?? markFormulaXPerf(`${name}:end`);\n if (!resolvedEndMark) {\n return null;\n }\n\n performance.measure(name, startMark, resolvedEndMark);\n schedulePerfReport();\n return resolvedEndMark;\n}\n\nexport function recordFormulaXPerfPoint(name: string): void {\n const markName = markFormulaXPerf(name);\n if (!markName) {\n return;\n }\n\n measureFormulaXPerf(name, markName, markName);\n clearFormulaXPerfMarks(markName);\n}\n\nexport function clearFormulaXPerfMarks(...marks: Array<string | null | undefined>): void {\n if (!hasPerfSupport()) {\n return;\n }\n\n for (const mark of marks) {\n if (!mark) {\n continue;\n }\n\n performance.clearMarks(mark);\n }\n}\n\nexport async function preloadFormulaXEditor(): Promise<void> {\n await ensureKityRuntime();\n}\n\nexport function scheduleFormulaXEditorPreload(\n mode: FormulaXEditorPreloadMode,\n target?: EventTarget | null,\n): () => void {\n if (mode === false || typeof window === 'undefined') {\n return () => undefined;\n }\n\n let disposed = false;\n let triggered = false;\n const cleanupCallbacks: Array<() => void> = [];\n\n const trigger = (): void => {\n if (disposed || triggered) {\n return;\n }\n\n triggered = true;\n\n while (cleanupCallbacks.length) {\n cleanupCallbacks.pop()?.();\n }\n\n void preloadFormulaXEditor();\n };\n\n if (mode === 'idle') {\n const host = getPerfHost();\n\n if (typeof host.requestIdleCallback === 'function') {\n const handle = host.requestIdleCallback(() => {\n trigger();\n });\n\n cleanupCallbacks.push(() => {\n host.cancelIdleCallback?.(handle);\n });\n } else {\n const handle = window.setTimeout(() => {\n trigger();\n }, 1);\n\n cleanupCallbacks.push(() => {\n window.clearTimeout(handle);\n });\n }\n\n return () => {\n disposed = true;\n\n while (cleanupCallbacks.length) {\n cleanupCallbacks.pop()?.();\n }\n };\n }\n\n if (target && 'addEventListener' in target && 'removeEventListener' in target) {\n const eventTarget = target as EventTarget;\n\n const onActivate = (): void => {\n trigger();\n };\n\n eventTarget.addEventListener('pointerenter', onActivate, { once: true, passive: true });\n eventTarget.addEventListener('focusin', onActivate, { once: true });\n\n cleanupCallbacks.push(() => {\n eventTarget.removeEventListener('pointerenter', onActivate);\n eventTarget.removeEventListener('focusin', onActivate);\n });\n }\n\n return () => {\n disposed = true;\n\n while (cleanupCallbacks.length) {\n cleanupCallbacks.pop()?.();\n }\n };\n}\n\nexport function waitForFormulaXAnimationFrame(): Promise<void> {\n if (typeof window === 'undefined' || typeof window.requestAnimationFrame !== 'function') {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n window.requestAnimationFrame(() => resolve());\n });\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,kBAAqC;AAChE,SAAS,uBAAqE;AAC9E,SAAS,YAAY,gCAAgC;AACrD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACNP,SAAS,yBAAyB;AAgBlC,SAAS,cAAgC;AACvC,SAAO;AACT;AAEA,SAAS,eAAkC;AACzC,QAAM,OAAO,YAAY;AAEzB,OAAK,4BAA4B;AAAA,IAC/B,sBAAsB;AAAA,IACtB,iBAAiB;AAAA,EACnB;AAEA,SAAO,KAAK;AACd;AAEA,SAAS,iBAA0B;AACjC,SAAO,OAAO,gBAAgB,eACzB,OAAO,YAAY,SAAS,cAC5B,OAAO,YAAY,YAAY,cA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AAC7C,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/formula-modal.ts","../src/perf.ts","../src/i18n.ts"],"sourcesContent":["import { createEmptyState, parseLatex, type FormulaState } from '@formulaxjs/core';\nimport {\n mountKityEditor,\n type FormulaXLocale,\n type KityEditorAssets,\n type KityEditorHandle,\n} from '@formulaxjs/kity-runtime';\nimport { escapeHtml, ensureFormulaXBaseStyles } from '@formulaxjs/renderer';\nimport {\n serializeKityFormulaFromRoot,\n waitForKityFormulaSvgLayout,\n} from '@formulaxjs/renderer-kity';\nimport {\n clearFormulaXPerfMarks,\n markFormulaXPerf,\n measureFormulaXPerf,\n recordFormulaXPerfPoint,\n} from './perf';\n\nconst EMPTY_FORMULA_PLACEHOLDER = '\\\\placeholder ';\nconst STYLE_ID = 'fx-formula-modal-styles';\n\nexport interface FormulaXEditorOptions {\n initialLatex?: string;\n height?: number | string;\n autofocus?: boolean;\n locale?: FormulaXLocale;\n assets?: Partial<KityEditorAssets>;\n render?: {\n fontsize?: number;\n };\n}\n\nexport interface MountedFormulaXEditor {\n root: HTMLElement;\n getLatex: () => Promise<string>;\n getState: () => Promise<FormulaState>;\n getRenderHtml: () => Promise<string>;\n destroy: () => void;\n}\n\nexport const formulaXModalStyles = `\n.fx-formula-modal-open {\n overflow: hidden;\n}\n\n.fx-formula-modal-root {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 16px;\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n.fx-formula-modal-backdrop {\n position: absolute;\n inset: 0;\n background: rgba(15, 23, 42, 0.48);\n}\n\n.fx-formula-modal {\n --fx-formula-editor-body-height: 264px;\n --fx-formula-workspace-height: 168px;\n position: relative;\n width: min(920px, calc(100vw - 32px));\n height: auto;\n max-height: none;\n margin: 0 auto;\n background: #fff;\n border-radius: 14px;\n box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);\n display: flex;\n flex-direction: column;\n overflow: visible;\n isolation: isolate;\n}\n\n.fx-formula-modal__header,\n.fx-formula-modal__footer,\n.fx-formula-modal__title,\n.fx-formula-modal__close,\n.fx-formula-modal__button,\n.fx-formula-editor-loading,\n.fx-formula-editor-error {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n}\n\n.fx-formula-modal__header {\n min-height: 56px;\n padding: 0 20px;\n border-bottom: 1px solid #e5e7eb;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n position: relative;\n z-index: 3;\n background: #fff;\n border-radius: 14px 14px 0 0;\n}\n\n.fx-formula-modal__title {\n font-size: 16px;\n font-weight: 650;\n margin: 0;\n color: #111827;\n}\n\n.fx-formula-modal__close {\n border: 0;\n background: transparent;\n font-size: 24px;\n line-height: 1;\n cursor: pointer;\n color: #6b7280;\n}\n\n.fx-formula-modal__body {\n flex: 0 0 auto;\n height: var(--fx-formula-editor-body-height);\n padding: 0;\n overflow: visible;\n min-height: var(--fx-formula-editor-body-height);\n position: relative;\n z-index: 2;\n}\n\n.fx-formula-editor-host {\n width: 100%;\n height: var(--fx-formula-editor-body-height);\n min-height: var(--fx-formula-editor-body-height);\n overflow: visible;\n position: relative;\n}\n\n.fx-formula-kity-host {\n width: 100%;\n height: var(--fx-formula-editor-body-height);\n min-height: var(--fx-formula-editor-body-height);\n overflow: visible;\n position: relative;\n}\n\n.fx-formula-kity-host .kf-editor {\n box-sizing: border-box;\n width: 100%;\n height: var(--fx-formula-editor-body-height) !important;\n overflow: visible !important;\n}\n\n.fx-formula-kity-host .kf-editor-toolbar {\n overflow: visible;\n position: relative;\n z-index: 20;\n}\n\n.fx-formula-kity-host .kf-editor-ui-button-mount-point,\n.fx-formula-kity-host .kf-editor-ui-area-mount,\n.fx-formula-kity-host .kf-editor-ui-box,\n.fx-formula-kity-host .kf-editor-ui-list {\n z-index: 1000;\n}\n\n.fx-formula-kity-host .kf-editor-edit-area,\n.fx-formula-kity-host .kf-editor-canvas-container {\n min-height: var(--fx-formula-workspace-height);\n height: var(--fx-formula-workspace-height);\n}\n\n.fx-formula-kity-host .kf-editor-edit-area {\n flex: 0 0 auto;\n overflow: hidden;\n}\n\n.fx-formula-kity-host .kf-editor,\n.fx-formula-kity-host .kf-editor svg text,\n.fx-formula-kity-host .kf-editor-ui-area-item-text,\n.fx-formula-kity-host .kf-editor-ui-box-item-text,\n.fx-formula-kity-host .kf-editor-ui-box-item-val {\n font-family: \"KF AMS MAIN\", \"Cambria Math\", \"Latin Modern Math\", \"Times New Roman\", serif !important;\n}\n\n.fx-formula-kity-host .kf-editor-ui-box-item-content,\n.fx-formula-kity-host .kf-editor-ui-box-item-val {\n min-width: 32px;\n min-height: 32px;\n}\n\n.fx-formula-kity-host .kf-editor-ui-box-item-val svg,\n.fx-formula-kity-host .kf-editor-ui-box-item-val img,\n.fx-formula-kity-host .kf-editor-ui-area-item-img,\n.fx-formula-kity-host .kf-editor-ui-area-item-text {\n display: block;\n}\n\n.fx-formula-editor-loading {\n height: var(--fx-formula-editor-body-height);\n padding: 24px;\n color: #4b5563;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.fx-formula-editor-error {\n padding: 24px;\n color: #dc2626;\n font-size: 14px;\n}\n\n.fx-formula-editor-error pre {\n white-space: pre-wrap;\n word-break: break-all;\n color: #991b1b;\n background: #fef2f2;\n border: 1px solid #fecaca;\n border-radius: 8px;\n padding: 12px;\n margin-top: 8px;\n}\n\n.fx-formula-modal__footer {\n min-height: 64px;\n padding: 12px 20px;\n border-top: 1px solid #e5e7eb;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 12px;\n flex-shrink: 0;\n position: relative;\n z-index: 1;\n background: #fff;\n border-radius: 0 0 14px 14px;\n}\n\n.fx-formula-modal__button {\n appearance: none;\n border: 1px solid #d1d5db;\n background: #fff;\n color: #111827;\n border-radius: 8px;\n padding: 8px 14px;\n font-size: 14px;\n cursor: pointer;\n}\n\n.fx-formula-modal__button--primary {\n border-color: #2563eb;\n background: #2563eb;\n color: #fff;\n}\n`;\n\nexport function ensureFormulaXModalStyles(doc: Document = document): void {\n ensureFormulaXBaseStyles(doc);\n\n if (doc.getElementById(STYLE_ID)) return;\n\n const style = doc.createElement('style');\n style.id = STYLE_ID;\n style.textContent = formulaXModalStyles;\n doc.head.appendChild(style);\n}\n\nexport function renderFormulaXEditorLoadingState(root: HTMLElement): void {\n root.classList.add('fx-formula-kity-host');\n root.innerHTML = `\n <div class=\"fx-formula-editor-loading\" role=\"status\" aria-live=\"polite\">\n Loading FormulaX editor...\n </div>\n `;\n}\n\nexport function mountFormulaXEditor(\n root: HTMLElement,\n options: FormulaXEditorOptions = {},\n): MountedFormulaXEditor {\n recordFormulaXPerfPoint('fx:formula-editor:mount:start');\n const mountStart = markFormulaXPerf('fx:formula-editor:mount:start:scope');\n let destroyed = false;\n let latestLatex = options.initialLatex ?? '';\n let handle: KityEditorHandle | null = null;\n const initialLatex = latestLatex.trim() ? latestLatex : EMPTY_FORMULA_PLACEHOLDER;\n\n renderFormulaXEditorLoadingState(root);\n const loadingVisibleMark = markFormulaXPerf('fx:formula-editor:loading-visible');\n measureFormulaXPerf('fx:formula-editor:loading-visible', mountStart, loadingVisibleMark);\n clearFormulaXPerfMarks(loadingVisibleMark);\n\n const readyPromise = mountKityEditor(root, {\n initialLatex,\n height: options.height ?? '100%',\n autofocus: options.autofocus ?? true,\n locale: options.locale,\n assets: options.assets,\n render: {\n fontsize: options.render?.fontsize ?? 40,\n },\n })\n .then((nextHandle) => {\n if (destroyed) {\n nextHandle.destroy();\n throw new Error('FormulaX editor mount cancelled');\n }\n\n const readyMark = markFormulaXPerf('fx:kity-editor:ready');\n measureFormulaXPerf('fx:kity-editor:ready', mountStart, readyMark);\n clearFormulaXPerfMarks(readyMark);\n handle = nextHandle;\n return nextHandle;\n })\n .catch((error) => {\n console.error('[FormulaX] Failed to load FormulaX editor:', error);\n\n if (!destroyed) {\n root.innerHTML = `\n <div class=\"fx-formula-editor-error\">\n Failed to load FormulaX editor.\n <pre>${escapeHtml(error instanceof Error ? error.message : String(error))}</pre>\n </div>\n `;\n }\n\n throw error;\n })\n .finally(() => {\n clearFormulaXPerfMarks(mountStart);\n });\n\n const getCurrentLatex = async (): Promise<string> => {\n const readyHandle = handle ?? await readyPromise;\n const latex = await tryReadLatexFromKityHandle(readyHandle);\n\n if (latex !== null) {\n latestLatex = latex;\n }\n\n return latestLatex;\n };\n\n return {\n root,\n\n getLatex: getCurrentLatex,\n\n async getState(): Promise<FormulaState> {\n const latex = await getCurrentLatex();\n\n try {\n return {\n ...createEmptyState(),\n doc: parseLatex(latex),\n };\n } catch {\n return createEmptyState();\n }\n },\n\n async getRenderHtml(): Promise<string> {\n await readyPromise;\n await waitForKityFormulaSvgLayout(root);\n return serializeKityFormulaFromRoot(root);\n },\n\n destroy(): void {\n if (destroyed) return;\n destroyed = true;\n\n void readyPromise\n .then((readyHandle) => readyHandle.destroy())\n .catch(() => undefined);\n\n root.innerHTML = '';\n },\n };\n}\n\nasync function tryReadLatexFromKityHandle(handle: KityEditorHandle): Promise<string | null> {\n try {\n let isEmpty = false;\n\n handle.ready(function ready() {\n const result = this.execCommand('content.is.empty');\n isEmpty = result === true;\n });\n\n if (isEmpty) {\n return '';\n }\n } catch {\n // Fall back to source commands for runtimes without content.is.empty.\n }\n\n const candidates = [\n 'get.source',\n 'getSource',\n 'getLatex',\n 'get.latex',\n 'get.content',\n 'getContent',\n ];\n\n for (const command of candidates) {\n try {\n let value: unknown = null;\n\n handle.ready(function ready() {\n value = this.execCommand(command);\n });\n\n if (typeof value === 'string' && value.trim()) {\n return value;\n }\n\n if (value && typeof value === 'object' && 'latex' in value) {\n const latex = (value as { latex?: unknown }).latex;\n if (typeof latex === 'string' && latex.trim()) {\n return latex;\n }\n }\n } catch {\n // Try the next available command name.\n }\n }\n\n return null;\n}\n","import { ensureKityRuntime } from '@formulaxjs/kity-runtime';\n\ntype FormulaXPerfState = {\n reportedMeasureCount: number;\n reportScheduled: boolean;\n};\n\ntype FormulaXPerfHost = typeof globalThis & {\n __FORMULAX_PERF__?: boolean;\n __FORMULAX_PERF_STATE__?: FormulaXPerfState;\n requestIdleCallback?: (callback: () => void) => number;\n cancelIdleCallback?: (handle: number) => void;\n};\n\nexport type FormulaXEditorPreloadMode = 'idle' | 'hover' | false;\n\nfunction getPerfHost(): FormulaXPerfHost {\n return globalThis as FormulaXPerfHost;\n}\n\nfunction getPerfState(): FormulaXPerfState {\n const host = getPerfHost();\n\n host.__FORMULAX_PERF_STATE__ ??= {\n reportedMeasureCount: 0,\n reportScheduled: false,\n };\n\n return host.__FORMULAX_PERF_STATE__;\n}\n\nfunction hasPerfSupport(): boolean {\n return typeof performance !== 'undefined'\n && typeof performance.mark === 'function'\n && typeof performance.measure === 'function'\n && typeof performance.getEntriesByType === 'function';\n}\n\nfunction isPerfDebugEnabled(): boolean {\n return getPerfHost().__FORMULAX_PERF__ === true;\n}\n\nfunction schedulePerfReport(): void {\n if (!hasPerfSupport() || !isPerfDebugEnabled()) {\n return;\n }\n\n const state = getPerfState();\n if (state.reportScheduled) {\n return;\n }\n\n state.reportScheduled = true;\n\n queueMicrotask(() => {\n state.reportScheduled = false;\n\n const entries = performance\n .getEntriesByType('measure')\n .filter((entry): entry is PerformanceMeasure => entry.name.startsWith('fx:'))\n .sort((left, right) => left.startTime - right.startTime);\n\n const nextEntries = entries.slice(state.reportedMeasureCount);\n state.reportedMeasureCount = entries.length;\n\n if (!nextEntries.length) {\n return;\n }\n\n console.table(nextEntries.map((entry) => ({\n name: entry.name,\n duration: Number(entry.duration.toFixed(2)),\n startTime: Number(entry.startTime.toFixed(2)),\n })));\n });\n}\n\nexport function markFormulaXPerf(name: string): string | null {\n if (!hasPerfSupport()) {\n return null;\n }\n\n const markName = `${name}::${Date.now()}::${Math.random().toString(36).slice(2, 8)}`;\n performance.mark(markName);\n return markName;\n}\n\nexport function measureFormulaXPerf(\n name: string,\n startMark: string | null,\n endMark?: string | null,\n): string | null {\n if (!hasPerfSupport() || !startMark) {\n return null;\n }\n\n const resolvedEndMark = endMark ?? markFormulaXPerf(`${name}:end`);\n if (!resolvedEndMark) {\n return null;\n }\n\n performance.measure(name, startMark, resolvedEndMark);\n schedulePerfReport();\n return resolvedEndMark;\n}\n\nexport function recordFormulaXPerfPoint(name: string): void {\n const markName = markFormulaXPerf(name);\n if (!markName) {\n return;\n }\n\n measureFormulaXPerf(name, markName, markName);\n clearFormulaXPerfMarks(markName);\n}\n\nexport function clearFormulaXPerfMarks(...marks: Array<string | null | undefined>): void {\n if (!hasPerfSupport()) {\n return;\n }\n\n for (const mark of marks) {\n if (!mark) {\n continue;\n }\n\n performance.clearMarks(mark);\n }\n}\n\nexport async function preloadFormulaXEditor(): Promise<void> {\n await ensureKityRuntime();\n}\n\nexport function scheduleFormulaXEditorPreload(\n mode: FormulaXEditorPreloadMode,\n target?: EventTarget | null,\n): () => void {\n if (mode === false || typeof window === 'undefined') {\n return () => undefined;\n }\n\n let disposed = false;\n let triggered = false;\n const cleanupCallbacks: Array<() => void> = [];\n\n const trigger = (): void => {\n if (disposed || triggered) {\n return;\n }\n\n triggered = true;\n\n while (cleanupCallbacks.length) {\n cleanupCallbacks.pop()?.();\n }\n\n void preloadFormulaXEditor();\n };\n\n if (mode === 'idle') {\n const host = getPerfHost();\n\n if (typeof host.requestIdleCallback === 'function') {\n const handle = host.requestIdleCallback(() => {\n trigger();\n });\n\n cleanupCallbacks.push(() => {\n host.cancelIdleCallback?.(handle);\n });\n } else {\n const handle = window.setTimeout(() => {\n trigger();\n }, 1);\n\n cleanupCallbacks.push(() => {\n window.clearTimeout(handle);\n });\n }\n\n return () => {\n disposed = true;\n\n while (cleanupCallbacks.length) {\n cleanupCallbacks.pop()?.();\n }\n };\n }\n\n if (target && 'addEventListener' in target && 'removeEventListener' in target) {\n const eventTarget = target as EventTarget;\n\n const onActivate = (): void => {\n trigger();\n };\n\n eventTarget.addEventListener('pointerenter', onActivate, { once: true, passive: true });\n eventTarget.addEventListener('focusin', onActivate, { once: true });\n\n cleanupCallbacks.push(() => {\n eventTarget.removeEventListener('pointerenter', onActivate);\n eventTarget.removeEventListener('focusin', onActivate);\n });\n }\n\n return () => {\n disposed = true;\n\n while (cleanupCallbacks.length) {\n cleanupCallbacks.pop()?.();\n }\n };\n}\n\nexport function waitForFormulaXAnimationFrame(): Promise<void> {\n if (typeof window === 'undefined' || typeof window.requestAnimationFrame !== 'function') {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n window.requestAnimationFrame(() => resolve());\n });\n}\n","import {\n DEFAULT_FORMULAX_LOCALE,\n normalizeFormulaXLocale,\n type FormulaXLocale,\n} from '@formulaxjs/kity-runtime';\n\nexport type FormulaXEditorMessageKey =\n | 'modal.title'\n | 'modal.insert'\n | 'modal.update'\n | 'modal.cancel';\n\nconst FORMULAX_EDITOR_MESSAGES: Record<FormulaXLocale, Record<FormulaXEditorMessageKey, string>> = {\n en_US: {\n 'modal.title': 'FormulaX Editor',\n 'modal.insert': 'Insert',\n 'modal.update': 'Update',\n 'modal.cancel': 'Cancel',\n },\n zh_CN: {\n 'modal.title': 'FormulaX 编辑器',\n 'modal.insert': '插入',\n 'modal.update': '更新',\n 'modal.cancel': '取消',\n },\n};\n\nexport function getFormulaXEditorMessage(\n key: FormulaXEditorMessageKey,\n locale: FormulaXLocale = DEFAULT_FORMULAX_LOCALE,\n): string {\n const normalizedLocale = normalizeFormulaXLocale(locale);\n return FORMULAX_EDITOR_MESSAGES[normalizedLocale][key] ?? FORMULAX_EDITOR_MESSAGES[DEFAULT_FORMULAX_LOCALE][key];\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,kBAAqC;AAChE;AAAA,EACE;AAAA,OAIK;AACP,SAAS,YAAY,gCAAgC;AACrD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACXP,SAAS,yBAAyB;AAgBlC,SAAS,cAA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AY;AAChC,QAAI;AACF,UAAI,QAAiB;AAErB,aAAO,MAAM,SAAS,QAAQ;AAC5B,gBAAQ,KAAK,YAAY,OAAO;AAAA,MAClC,CAAC;AAED,UAAI,OAAO,UAAU,YAAY,MAAM,KAAK,GAAG;AAC7C,eAAO;AAAA,MACT;AAEA,UAAI,SAAS,OAAO,UAAU,YAAY,WAAW,OAAO;AAC1D,cAAM,QAAS,MAA8B;AAC7C,YAAI,OAAO,UAAU,YAAY,MAAM,KAAK,GAAG;AAC7C,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,SAAO;AACT;;;AEhbA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAQP,IAAM,2BAA6F;AAAA,EACjG,OAAO;AAAA,IACL,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,IACL,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AACF;AAEO,SAAS,yBACd,KACA,SAAyB,yBACjB;AACR,QAAM,mBAAmB,wBAAwB,MAAM;AACvD,SAAO,yBAAyB,gBAAgB,EAAE,GAAG,KAAK,yBAAyB,uBAAuB,EAAE,GAAG;AACjH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formulaxjs/editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Modern formula editor foundation for FormulaX.",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/vndmea/formulaX.git",
|
|
11
|
+
"directory": "packages/editor"
|
|
12
|
+
},
|
|
8
13
|
"keywords": [
|
|
9
14
|
"formulax",
|
|
10
15
|
"formula",
|
|
@@ -22,7 +27,7 @@
|
|
|
22
27
|
"require": "./dist/index.cjs"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
|
-
"unpkg": "./dist/
|
|
30
|
+
"unpkg": "./dist/index.global.js",
|
|
26
31
|
"files": [
|
|
27
32
|
"dist"
|
|
28
33
|
],
|
|
@@ -30,10 +35,10 @@
|
|
|
30
35
|
"access": "public"
|
|
31
36
|
},
|
|
32
37
|
"dependencies": {
|
|
33
|
-
"@formulaxjs/core": "0.1.
|
|
34
|
-
"@formulaxjs/renderer
|
|
35
|
-
"@formulaxjs/
|
|
36
|
-
"@formulaxjs/kity
|
|
38
|
+
"@formulaxjs/core": "0.1.1",
|
|
39
|
+
"@formulaxjs/renderer": "0.2.1",
|
|
40
|
+
"@formulaxjs/kity-runtime": "0.5.1",
|
|
41
|
+
"@formulaxjs/renderer-kity": "0.3.1"
|
|
37
42
|
},
|
|
38
43
|
"scripts": {
|
|
39
44
|
"build": "tsup --config ../../tsup.config.mjs",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|