@formulaxjs/editor 0.1.1 → 0.2.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/README.md +11 -22
- package/dist/index.cjs +19 -443
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +55 -590
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +17 -445
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dom-renderer.ts","../src/editor.ts","../src/styles.ts","../src/formula-modal.ts","../src/formula-node.ts","../src/i18n.ts"],"sourcesContent":["import type { FormulaDoc, FormulaNode, FormulaPath } from '@formulaxjs/core';\r\n\r\nconst joinPath = (path: FormulaPath): string => path.join('.');\r\n\r\nexport const renderInteractiveHtml = (doc: FormulaDoc, activePath: FormulaPath): string => `\r\n <div class=\"fx-editor-surface\" data-role=\"surface\">\r\n ${renderChildren(doc.body, [], activePath)}\r\n </div>\r\n`;\r\n\r\nconst renderChildren = (nodes: FormulaNode[], basePath: FormulaPath, activePath: FormulaPath): string => {\r\n const html: string[] = [];\r\n for (let index = 0; index <= nodes.length; index += 1) {\r\n const path = joinPath([...basePath, index]);\r\n const isActive = path === joinPath(activePath);\r\n html.push(\r\n `<button class=\"fx-slot${isActive ? ' is-active' : ''}\" data-path=\"${path}\" type=\"button\" title=\"${path}\"></button>`,\r\n );\r\n if (index < nodes.length) {\r\n html.push(renderNode(nodes[index], [...basePath, index], activePath));\r\n }\r\n }\r\n return html.join('');\r\n};\r\n\r\nconst renderNode = (node: FormulaNode, path: FormulaPath, activePath: FormulaPath): string => {\r\n const pathValue = joinPath(path);\r\n const isActive = (p: FormulaPath) => joinPath(p) === joinPath(activePath);\r\n\r\n switch (node.type) {\r\n case 'text':\r\n return `<span class=\"fx-node fx-text\" data-node-path=\"${pathValue}\">${node.value}</span>`;\r\n case 'group':\r\n return `<span class=\"fx-node fx-group\" data-node-path=\"${pathValue}\">${renderChildren(node.body, [...path, 0], activePath)}</span>`;\r\n case 'frac':\r\n return `<span class=\"fx-node fx-frac\" data-node-path=\"${pathValue}\">\r\n <span class=\"fx-frac-num${isActive([...path, 0]) ? ' is-active' : ''}\" data-path=\"${joinPath([...path, 0])}\">${renderChildren(node.numerator, [...path, 0], activePath)}</span>\r\n <span class=\"fx-frac-line\"></span>\r\n <span class=\"fx-frac-den${isActive([...path, 1]) ? ' is-active' : ''}\" data-path=\"${joinPath([...path, 1])}\">${renderChildren(node.denominator, [...path, 1], activePath)}</span>\r\n </span>`;\r\n case 'supsub':\r\n return `<span class=\"fx-node fx-supsub\" data-node-path=\"${pathValue}\">\r\n <span class=\"fx-supsub-base\">${renderChildren(node.base, [...path, 0], activePath)}</span>\r\n <span class=\"fx-supsub-stack\">\r\n <span class=\"fx-sup${isActive([...path, 1]) ? ' is-active' : ''}\" data-path=\"${joinPath([...path, 1])}\">${renderChildren(node.sup ?? [], [...path, 1], activePath)}</span>\r\n <span class=\"fx-sub${isActive([...path, 2]) ? ' is-active' : ''}\" data-path=\"${joinPath([...path, 2])}\">${renderChildren(node.sub ?? [], [...path, 2], activePath)}</span>\r\n </span>\r\n </span>`;\r\n case 'sqrt':\r\n return `<span class=\"fx-node fx-sqrt\" data-node-path=\"${pathValue}\">\r\n <span class=\"fx-sqrt-symbol\">√</span>\r\n <span class=\"fx-sqrt-body${isActive([...path, 0]) ? ' is-active' : ''}\" data-path=\"${joinPath([...path, 0])}\">${renderChildren(node.value, [...path, 0], activePath)}</span>\r\n </span>`;\r\n case 'fenced':\r\n return `<span class=\"fx-node fx-fenced\" data-node-path=\"${pathValue}\">\r\n <span class=\"fx-fence\">${node.left}</span>\r\n <span class=\"fx-fenced-body${isActive([...path, 0]) ? ' is-active' : ''}\" data-path=\"${joinPath([...path, 0])}\">${renderChildren(node.body, [...path, 0], activePath)}</span>\r\n <span class=\"fx-fence\">${node.right}</span>\r\n </span>`;\r\n case 'doc':\r\n return renderChildren(node.body, [0], activePath);\r\n }\r\n\r\n throw new Error(`Unsupported node type: ${String((node as { type?: string }).type)}`);\r\n};","import {\n applyCommand,\n backspace,\n createEmptyState,\n insertFenced,\n insertFraction,\n insertSqrt,\n insertSubscript,\n insertSuperscript,\n insertText,\n type FormulaPath,\n type FormulaState,\n} from '@formulaxjs/core';\nimport { renderInteractiveHtml } from './dom-renderer';\nimport { editorStyles } from './styles';\nimport { type Locale, type LocaleConfig } from './i18n';\n\nexport interface FormulaEditorOptions extends LocaleConfig {\n root: HTMLElement;\n initialState?: FormulaState;\n onChange?: (state: FormulaState) => void;\n}\n\nexport class FormulaEditor {\n private state: FormulaState;\n private readonly root: HTMLElement;\n private readonly onChange?: (state: FormulaState) => void;\n private readonly locale: Locale;\n\n constructor(options: FormulaEditorOptions) {\n this.root = options.root;\n this.state = options.initialState ?? createEmptyState();\n this.onChange = options.onChange;\n this.locale = options.locale ?? 'en';\n this.root.classList.add('fx-editor');\n this.root.tabIndex = 0;\n this.ensureStyles();\n this.bindEvents();\n this.render();\n }\n\n getState(): FormulaState {\n return structuredClone(this.state);\n }\n\n getLocale(): Locale {\n return this.locale;\n }\n\n setState(state: FormulaState): void {\n this.state = structuredClone(state);\n this.render();\n }\n\n dispatch(command: (state: FormulaState) => FormulaState): void {\n this.state = applyCommand(this.state, command);\n this.render();\n this.onChange?.(this.getState());\n }\n\n private ensureStyles(): void {\n if (document.getElementById('fx-editor-styles')) return;\n const style = document.createElement('style');\n style.id = 'fx-editor-styles';\n style.textContent = editorStyles;\n document.head.appendChild(style);\n }\n\n private bindEvents(): void {\n this.root.addEventListener('click', (event) => {\n const target = event.target as HTMLElement;\n const pathValue = target.dataset.path;\n if (pathValue === undefined) return;\n const path = pathValue === '' ? [] : pathValue.split('.').map(Number);\n this.moveSelection(path);\n });\n\n this.root.addEventListener('keydown', (event) => {\n if (event.key === 'Backspace') {\n event.preventDefault();\n this.dispatch(backspace());\n return;\n }\n\n if (event.key === '/') {\n event.preventDefault();\n this.dispatch(insertFraction());\n return;\n }\n\n if (event.key === '^') {\n event.preventDefault();\n this.dispatch(insertSuperscript());\n return;\n }\n\n if (event.key === '_') {\n event.preventDefault();\n this.dispatch(insertSubscript());\n return;\n }\n\n if (event.key === 'r' && event.ctrlKey) {\n event.preventDefault();\n this.dispatch(insertSqrt());\n return;\n }\n\n if (event.key === '(') {\n event.preventDefault();\n this.dispatch(insertFenced('(', ')'));\n return;\n }\n\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey) {\n event.preventDefault();\n this.dispatch(insertText(event.key));\n }\n });\n }\n\n private moveSelection(path: FormulaPath): void {\n this.state = {\n ...this.state,\n selection: {\n anchor: [...path],\n focus: [...path],\n },\n };\n this.render();\n this.onChange?.(this.getState());\n }\n\n private render(): void {\n this.root.innerHTML = renderInteractiveHtml(this.state.doc, this.state.selection.focus);\n }\n}\n","export const editorStyles = `\n@keyframes fx-blink {\n 0%, 50% { opacity: 1; }\n 51%, 100% { opacity: 0; }\n}\n.fx-editor {\n border: 1px solid #d8d4c7;\n border-radius: 2px;\n background: #fffefb;\n box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);\n padding: 24px 28px;\n font-family: Cambria, 'Times New Roman', serif;\n font-size: 25px;\n line-height: 1.7;\n min-height: 120px;\n position: relative;\n}\n.fx-editor:focus-within {\n border-color: #7bbb59;\n box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 0 0 3px rgba(123, 187, 89, 0.18);\n}\n.fx-editor-surface {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 3px;\n cursor: text;\n}\n.fx-node {\n position: relative;\n display: inline-flex;\n align-items: center;\n padding: 2px 3px;\n border-radius: 2px;\n transition: background 0.12s ease;\n}\n.fx-node:hover {\n background: rgba(122, 186, 89, 0.12);\n}\n.fx-text {\n color: #2b2925;\n}\n.fx-group {\n background: rgba(243, 241, 230, 0.82);\n border: 1px dashed #c8c0a8;\n}\n.fx-frac {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n vertical-align: middle;\n padding: 0 5px;\n}\n.fx-frac-num, .fx-frac-den {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n padding: 3px 8px;\n min-width: 24px;\n min-height: 28px;\n border-radius: 2px;\n transition: all 0.15s ease;\n}\n.fx-frac-num {\n border-bottom: 2px solid #2e2c29;\n padding-bottom: 6px;\n}\n.fx-frac-den {\n border-top: 2px solid #2e2c29;\n padding-top: 6px;\n}\n.fx-frac-num:hover, .fx-frac-den:hover {\n background: rgba(122, 186, 89, 0.1);\n}\n.fx-frac-num.is-active, .fx-frac-den.is-active {\n background: rgba(122, 186, 89, 0.16);\n box-shadow: inset 0 0 0 1px rgba(83, 184, 86, 0.5);\n}\n.fx-supsub {\n display: inline-flex;\n align-items: baseline;\n gap: 0;\n}\n.fx-supsub-base {\n display: inline-flex;\n align-items: center;\n padding: 0 2px;\n}\n.fx-supsub-stack {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-start;\n font-size: 0.65em;\n margin-left: 2px;\n}\n.fx-sup, .fx-sub {\n display: flex;\n align-items: center;\n min-width: 16px;\n min-height: 20px;\n padding: 0 4px;\n border-radius: 2px;\n transition: all 0.15s ease;\n}\n.fx-sup {\n vertical-align: super;\n}\n.fx-sub {\n vertical-align: sub;\n}\n.fx-sup:hover, .fx-sub:hover {\n background: rgba(122, 186, 89, 0.1);\n}\n.fx-sup.is-active, .fx-sub.is-active {\n background: rgba(122, 186, 89, 0.16);\n box-shadow: inset 0 0 0 1px rgba(83, 184, 86, 0.5);\n}\n.fx-sqrt {\n display: inline-flex;\n align-items: baseline;\n}\n.fx-sqrt-symbol {\n font-size: 1.1em;\n color: #2e2c29;\n margin-right: 2px;\n}\n.fx-sqrt-body {\n display: inline-flex;\n align-items: center;\n border-top: 2px solid #2e2c29;\n padding: 4px 6px 0;\n margin-left: 2px;\n}\n.fx-sqrt-body:hover {\n background: rgba(122, 186, 89, 0.1);\n}\n.fx-sqrt-body.is-active {\n background: rgba(122, 186, 89, 0.16);\n}\n.fx-fenced {\n display: inline-flex;\n align-items: center;\n background: rgba(243, 241, 230, 0.78);\n border-radius: 3px;\n padding: 0 4px;\n}\n.fx-fence {\n color: #59554d;\n font-size: 1.2em;\n padding: 0 2px;\n}\n.fx-fenced-body {\n display: inline-flex;\n align-items: center;\n padding: 0 6px;\n}\n.fx-fenced-body:hover {\n background: rgba(122, 186, 89, 0.1);\n border-radius: 2px;\n}\n.fx-fenced-body.is-active {\n background: rgba(122, 186, 89, 0.16);\n border-radius: 2px;\n}\n.fx-slot {\n width: 3px;\n height: 1.2em;\n border: none;\n background: #53b856;\n padding: 0;\n margin: 0 1px;\n cursor: text;\n border-radius: 1px;\n vertical-align: middle;\n}\n.fx-slot.is-active {\n animation: fx-blink 1s infinite;\n}\n.fx-slot:hover {\n background: #77c75b;\n}\n`;\n","import { createEmptyState, parseLatex, type FormulaState } from '@formulaxjs/core';\nimport { mountKityEditor, type KityEditorAssets, type KityEditorHandle } from '@formulaxjs/kity-runtime';\nimport { escapeHtml } from './formula-node';\n\nconst EMPTY_FORMULA_PLACEHOLDER = '\\\\placeholder ';\nconst STYLE_ID = 'fx-formula-modal-styles';\n\nexport interface FormulaXKityEditorOptions {\n initialLatex?: string;\n height?: number | string;\n autofocus?: boolean;\n assets?: Partial<KityEditorAssets>;\n render?: {\n fontsize?: number;\n };\n}\n\nexport interface MountedFormulaXKityEditor {\n root: HTMLElement;\n getLatex: () => Promise<string>;\n getState: () => Promise<FormulaState>;\n getRenderHtml: () => Promise<string>;\n destroy: () => void;\n}\n\ninterface SvgBox {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface InlineSvgContent {\n box: SvgBox;\n matrix: SVGMatrixLike;\n root: SVGGraphicsElement;\n}\n\ninterface SVGMatrixLike {\n a: number;\n b: number;\n c: number;\n d: number;\n e: number;\n f: number;\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 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.formulax-math__render {\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.formulax-math {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n line-height: 1;\n padding: 0 2px;\n margin: 0 1px;\n border-radius: 3px;\n background: transparent;\n cursor: pointer;\n user-select: none;\n}\n\n.formulax-math:hover {\n outline: 1px solid rgba(37, 99, 235, 0.35);\n background: rgba(37, 99, 235, 0.06);\n}\n\n.formulax-math__svg {\n display: inline-block;\n flex: 0 0 auto;\n max-width: 100%;\n vertical-align: -0.35em;\n pointer-events: none;\n}\n\n.formulax-math__image {\n display: inline-block;\n max-width: 100%;\n height: auto;\n vertical-align: middle;\n pointer-events: none;\n}\n`;\n\nexport function ensureFormulaXModalStyles(doc: Document = document): void {\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 mountFormulaXKityEditor(\n root: HTMLElement,\n options: FormulaXKityEditorOptions = {},\n): MountedFormulaXKityEditor {\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 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 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 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\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 waitForFormulaSvgLayout(root);\n return renderCurrentFormulaAsSvgHtml(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 next command\n }\n }\n\n return null;\n}\n\nfunction renderCurrentFormulaAsSvgHtml(root: HTMLElement): string {\n const svg = findFormulaSvg(root);\n\n if (!svg) {\n return '';\n }\n\n return serializeSvgForInsertion(svg);\n}\n\nasync function waitForFormulaSvgLayout(root: HTMLElement): Promise<void> {\n const doc = root.ownerDocument ?? document;\n const view = doc.defaultView ?? window;\n\n await waitForDocumentFonts(doc);\n\n let previous = readRenderedFormulaBox(root);\n\n for (let attempt = 0; attempt < 4; attempt += 1) {\n await waitForAnimationFrame(view);\n const current = readRenderedFormulaBox(root);\n\n if (previous && current && areSvgBoxesClose(previous, current)) {\n return;\n }\n\n previous = current;\n }\n}\n\nfunction findFormulaSvg(root: HTMLElement): SVGSVGElement | null {\n return root.querySelector<SVGSVGElement>(\n '.kf-editor-edit-area svg, .kf-editor-canvas-container svg, svg',\n );\n}\n\nfunction readRenderedFormulaBox(root: HTMLElement): SvgBox | null {\n const svg = findFormulaSvg(root);\n if (!svg) {\n return null;\n }\n\n return getInlineSvgContent(svg)?.box ?? readSvgBox(svg);\n}\n\nfunction areSvgBoxesClose(left: SvgBox, right: SvgBox): boolean {\n return Math.abs(left.x - right.x) < 0.01\n && Math.abs(left.y - right.y) < 0.01\n && Math.abs(left.width - right.width) < 0.01\n && Math.abs(left.height - right.height) < 0.01;\n}\n\nasync function waitForDocumentFonts(doc: Document): Promise<void> {\n if (!doc.fonts?.ready) {\n return;\n }\n\n try {\n await doc.fonts.ready;\n } catch {\n // ignore font readiness errors and fall back to frame-based settling\n }\n}\n\nfunction waitForAnimationFrame(view: Window): Promise<void> {\n return new Promise((resolve) => {\n view.requestAnimationFrame(() => resolve());\n });\n}\n\nexport function serializeSvgForInsertion(svg: SVGSVGElement): string {\n const content = getInlineSvgContent(svg);\n const inlineViewport = content ? createInlineSvgViewport(content.box) : null;\n const clone = content && inlineViewport\n ? createInlineSvgClone(svg, content, inlineViewport)\n : svg.cloneNode(true) as SVGSVGElement;\n\n uniquifySvgIds(clone);\n sizeSvgForInlineDisplay(clone, svg, inlineViewport);\n\n clone.removeAttribute('id');\n clone.removeAttribute('xmlns');\n clone.removeAttribute('xmlns:xlink');\n clone.setAttribute('class', mergeClassNames(clone.getAttribute('class'), 'formulax-math__svg'));\n clone.setAttribute('focusable', 'false');\n clone.setAttribute('aria-hidden', 'true');\n clone.setAttribute('preserveAspectRatio', clone.getAttribute('preserveAspectRatio') || 'xMinYMin meet');\n\n return new XMLSerializer().serializeToString(clone);\n}\n\nfunction getInlineSvgContent(svg: SVGSVGElement): InlineSvgContent | null {\n const candidates = [\n '[data-root=\"true\"] > g[data-type=\"kf-editor-exp-content-box\"]',\n 'g[data-type=\"kf-editor-exp-content-box\"]',\n 'g[data-type=\"kf-container\"]',\n 'svg > g, g',\n ];\n\n for (const selector of candidates) {\n const content = svg.querySelector<SVGGraphicsElement>(selector);\n const rootSpace = content ? readSvgBoxInRootSpace(content) : null;\n if (content && rootSpace) {\n return {\n root: content,\n box: rootSpace.box,\n matrix: rootSpace.matrix,\n };\n }\n }\n\n return null;\n}\n\nfunction readSvgBoxInRootSpace(\n element: SVGGraphicsElement,\n): Pick<InlineSvgContent, 'box' | 'matrix'> | null {\n const box = readSvgBox(element);\n const matrix = getSvgRootSpaceMatrix(element);\n\n if (!box || !matrix) {\n return null;\n }\n\n const points = [\n { x: box.x, y: box.y },\n { x: box.x + box.width, y: box.y },\n { x: box.x, y: box.y + box.height },\n { x: box.x + box.width, y: box.y + box.height },\n ].map((point) => ({\n x: matrix.a * point.x + matrix.c * point.y + matrix.e,\n y: matrix.b * point.x + matrix.d * point.y + matrix.f,\n }));\n\n const xs = points.map((point) => point.x);\n const ys = points.map((point) => point.y);\n const x = Math.min(...xs);\n const y = Math.min(...ys);\n const width = Math.max(...xs) - x;\n const height = Math.max(...ys) - y;\n\n if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {\n return null;\n }\n\n return {\n box: { x, y, width, height },\n matrix,\n };\n}\n\nfunction getSvgRootSpaceMatrix(element: SVGGraphicsElement): SVGMatrixLike | null {\n const elementMatrix = typeof element.getCTM === 'function' ? element.getCTM() : null;\n const rootMatrix = typeof element.ownerSVGElement?.getCTM === 'function'\n ? element.ownerSVGElement.getCTM()\n : null;\n\n if (!elementMatrix) {\n return null;\n }\n\n return rootMatrix\n ? multiplySvgMatrices(invertSvgMatrix(rootMatrix), elementMatrix)\n : toSvgMatrixLike(elementMatrix);\n}\n\nfunction invertSvgMatrix(matrix: DOMMatrix | SVGMatrix): SVGMatrixLike {\n const determinant = matrix.a * matrix.d - matrix.b * matrix.c;\n\n if (!Number.isFinite(determinant) || determinant === 0) {\n return {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n };\n }\n\n return {\n a: matrix.d / determinant,\n b: -matrix.b / determinant,\n c: -matrix.c / determinant,\n d: matrix.a / determinant,\n e: (matrix.c * matrix.f - matrix.d * matrix.e) / determinant,\n f: (matrix.b * matrix.e - matrix.a * matrix.f) / determinant,\n };\n}\n\nfunction multiplySvgMatrices(\n left: DOMMatrix | SVGMatrixLike,\n right: DOMMatrix | SVGMatrixLike,\n): SVGMatrixLike {\n return {\n a: left.a * right.a + left.c * right.b,\n b: left.b * right.a + left.d * right.b,\n c: left.a * right.c + left.c * right.d,\n d: left.b * right.c + left.d * right.d,\n e: left.a * right.e + left.c * right.f + left.e,\n f: left.b * right.e + left.d * right.f + left.f,\n };\n}\n\nfunction toSvgMatrixLike(matrix: DOMMatrix | SVGMatrix): SVGMatrixLike {\n return {\n a: matrix.a,\n b: matrix.b,\n c: matrix.c,\n d: matrix.d,\n e: matrix.e,\n f: matrix.f,\n };\n}\n\nfunction readSvgBox(element: SVGGraphicsElement): SvgBox | null {\n if (typeof element.getBBox !== 'function') {\n return null;\n }\n\n try {\n const box = element.getBBox();\n if (!Number.isFinite(box.width) || !Number.isFinite(box.height) || box.width <= 0 || box.height <= 0) {\n return null;\n }\n\n return {\n x: box.x,\n y: box.y,\n width: box.width,\n height: box.height,\n };\n } catch {\n return null;\n }\n}\n\nfunction createInlineSvgViewport(contentBox: SvgBox): SvgBox {\n const edgePadding = Math.max(0.5, Math.min(contentBox.width, contentBox.height) * 0.006);\n const inset = edgePadding / 2;\n\n return {\n x: contentBox.x - inset,\n y: contentBox.y - inset,\n width: contentBox.width + edgePadding,\n height: contentBox.height + edgePadding,\n };\n}\n\nfunction createInlineSvgClone(\n source: SVGSVGElement,\n content: InlineSvgContent,\n viewport: SvgBox,\n): SVGSVGElement {\n const clone = source.cloneNode(false) as SVGSVGElement;\n const ownerDocument = source.ownerDocument;\n\n copySvgRootAttributes(source, clone);\n clone.setAttribute(\n 'viewBox',\n `0 0 ${roundLength(viewport.width)} ${roundLength(viewport.height)}`,\n );\n\n Array.from(source.children).forEach((child) => {\n if (child.tagName.toLowerCase() === 'defs') {\n clone.appendChild(child.cloneNode(true));\n }\n });\n\n const wrapper = ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'g');\n wrapper.setAttribute(\n 'transform',\n `translate(${roundLength(-viewport.x)} ${roundLength(-viewport.y)})`,\n );\n const flattened = ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'g');\n flattened.setAttribute(\n 'transform',\n `matrix(${roundLength(content.matrix.a)} ${roundLength(content.matrix.b)} ${roundLength(content.matrix.c)} ${roundLength(content.matrix.d)} ${roundLength(content.matrix.e)} ${roundLength(content.matrix.f)})`,\n );\n flattened.appendChild(content.root.cloneNode(true));\n wrapper.appendChild(flattened);\n clone.appendChild(wrapper);\n\n return clone;\n}\n\nfunction copySvgRootAttributes(source: SVGSVGElement, target: SVGSVGElement): void {\n const excluded = new Set([\n 'id',\n 'width',\n 'height',\n 'viewBox',\n 'class',\n 'focusable',\n 'aria-hidden',\n 'xmlns',\n 'xmlns:xlink',\n ]);\n\n Array.from(source.attributes).forEach((attribute) => {\n if (excluded.has(attribute.name)) return;\n target.setAttribute(attribute.name, attribute.value);\n });\n}\n\nfunction sizeSvgForInlineDisplay(\n clone: SVGSVGElement,\n source: SVGSVGElement,\n viewport: SvgBox | null,\n): void {\n const viewBox = clone.viewBox?.baseVal;\n const rect = source.getBoundingClientRect();\n const width = viewport?.width || viewBox?.width || rect.width || Number(clone.getAttribute('width')) || 1;\n const height = viewport?.height || viewBox?.height || rect.height || Number(clone.getAttribute('height')) || 1;\n const ratio = Math.max(0.1, width / Math.max(1, height));\n const inlineHeightEm = 0.875;\n const inlineWidthEm = Math.min(40, Math.max(0.75, ratio * inlineHeightEm));\n\n clone.setAttribute('width', roundLength(width));\n clone.setAttribute('height', roundLength(height));\n clone.setAttribute(\n 'style',\n mergeInlineStyles(\n clone.getAttribute('style'),\n `width:${roundLength(inlineWidthEm)}em`,\n `height:${inlineHeightEm}em`,\n ),\n );\n}\n\nfunction roundLength(value: number): string {\n return String(Math.round(value * 1000) / 1000);\n}\n\nfunction uniquifySvgIds(svg: SVGSVGElement): void {\n const idMap = new Map<string, string>();\n const prefix = `fx-${randomIdPrefix()}-`;\n const elementsWithId = svg.querySelectorAll<Element>('[id]');\n\n elementsWithId.forEach((element) => {\n const id = element.getAttribute('id');\n if (!id) return;\n\n const nextId = `${prefix}${id}`;\n idMap.set(id, nextId);\n element.setAttribute('id', nextId);\n });\n\n if (!idMap.size) return;\n\n svg.querySelectorAll<Element>('*').forEach((element) => {\n Array.from(element.attributes).forEach((attribute) => {\n const nextValue = rewriteSvgReferences(attribute.value, idMap);\n if (nextValue !== attribute.value) {\n element.setAttribute(attribute.name, nextValue);\n }\n });\n });\n}\n\nfunction randomIdPrefix(): string {\n return Math.random().toString(36).slice(2, 5).padEnd(3, '0');\n}\n\nfunction rewriteSvgReferences(value: string, idMap: Map<string, string>): string {\n let nextValue = value;\n\n idMap.forEach((nextId, id) => {\n nextValue = nextValue\n .replaceAll(`#${id}`, `#${nextId}`)\n .replaceAll(`url(${id})`, `url(${nextId})`)\n .replaceAll(`url(#${id})`, `url(#${nextId})`);\n });\n\n return nextValue;\n}\n\nfunction mergeClassNames(...values: Array<string | null | undefined>): string {\n return values\n .flatMap((value) => value?.split(/\\s+/) ?? [])\n .filter(Boolean)\n .filter((value, index, list) => list.indexOf(value) === index)\n .join(' ');\n}\n\nfunction mergeInlineStyles(...values: Array<string | null | undefined>): string {\n return values\n .flatMap((value) => value?.split(';') ?? [])\n .map((value) => value.trim())\n .filter(Boolean)\n .join('; ');\n}\n","export const DEFAULT_FORMULA_ATTRIBUTE = 'data-formulax-latex';\nexport const FORMULA_FLAG_ATTRIBUTE = 'data-formulax';\nexport const DEFAULT_FORMULA_CLASS = 'formulax-math';\n\nexport interface CreateFormulaMarkupOptions {\n attributeName?: string;\n className?: string;\n displayMode?: boolean;\n renderHtml?: string;\n cursorStyle?: string;\n extraAttributes?: Record<string, string | boolean | null | undefined>;\n}\n\nexport function escapeAttribute(value: string): string {\n return value\n .replaceAll('&', '&')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n\nexport function createFormulaMarkup(\n latex: string,\n options: CreateFormulaMarkupOptions = {},\n): string {\n const attributeName = options.attributeName ?? DEFAULT_FORMULA_ATTRIBUTE;\n const className = options.className ?? DEFAULT_FORMULA_CLASS;\n const displayClass = options.displayMode ? `${className} ${className}--block` : className;\n const safeLatex = escapeAttribute(latex);\n const cursorStyle = options.cursorStyle?.trim() || 'pointer';\n const extraAttributes: Record<string, string | boolean | null | undefined> = {\n ...(options.extraAttributes ?? {}),\n style: mergeInlineStyles(\n typeof options.extraAttributes?.style === 'string' ? options.extraAttributes.style : '',\n cursorStyle ? `cursor: ${cursorStyle}` : '',\n ),\n };\n const serializedAttributes = Object.entries(extraAttributes)\n .filter(([, value]) => value !== null && value !== undefined && value !== false)\n .map(([key, value]) => value === true ? key : `${key}=\"${escapeAttribute(String(value))}\"`);\n\n return [\n '<span',\n ` class=\"${escapeAttribute(displayClass)}\"`,\n ` ${FORMULA_FLAG_ATTRIBUTE}=\"true\"`,\n ` ${attributeName}=\"${safeLatex}\"`,\n ` data-latex=\"${safeLatex}\"`,\n ' contenteditable=\"false\"',\n ' role=\"button\"',\n ' tabindex=\"0\"',\n serializedAttributes.length ? ` ${serializedAttributes.join(' ')}` : '',\n '>',\n options.renderHtml ?? `<span class=\"${escapeAttribute(className)}__render\">${escapeHtml(latex || '\\\\square')}</span>`,\n '</span>',\n ].join('');\n}\n\nfunction mergeInlineStyles(existingStyle: string, nextStyle: string): string {\n const existing = existingStyle.trim().replace(/;+\\s*$/, '');\n const next = nextStyle.trim().replace(/;+\\s*$/, '');\n\n if (!existing) return next;\n if (!next) return existing;\n\n return `${existing}; ${next}`;\n}\n\nexport function createFormulaElement(\n ownerDocument: Document,\n latex: string,\n options: CreateFormulaMarkupOptions = {},\n): HTMLElement | null {\n const wrapper = ownerDocument.createElement('span');\n wrapper.innerHTML = createFormulaMarkup(latex, options);\n return wrapper.firstElementChild as HTMLElement | null;\n}\n\nexport function replaceFormulaElement(\n target: HTMLElement,\n latex: string,\n options: CreateFormulaMarkupOptions = {},\n): HTMLElement | null {\n const next = createFormulaElement(target.ownerDocument ?? document, latex, options);\n if (!next) return null;\n target.replaceWith(next);\n return next;\n}\n\nexport function getFormulaLatexFromElement(\n element: HTMLElement,\n attributeName = DEFAULT_FORMULA_ATTRIBUTE,\n): string {\n return element.getAttribute(attributeName)\n ?? element.getAttribute('data-latex')\n ?? '';\n}\n\nexport function isFormulaElement(node: unknown): node is HTMLElement {\n if (!node || typeof node !== 'object') return false;\n const element = node as HTMLElement;\n return typeof element.getAttribute === 'function'\n && element.getAttribute(FORMULA_FLAG_ATTRIBUTE) === 'true';\n}\n\nexport function findFormulaElement(node: Node | null): HTMLElement | null {\n if (!node) return null;\n\n const element = node.nodeType === 1\n ? node as HTMLElement\n : node.parentElement;\n\n return element?.closest?.(`[${FORMULA_FLAG_ATTRIBUTE}=\"true\"]`) as HTMLElement | null;\n}\n","export const translations = {\n en: {\n equation: 'Equation',\n structures: 'Structures',\n symbols: 'Symbols',\n matrices: 'Matrices',\n templates: 'Templates',\n insert: 'Insert',\n greek: 'Greek',\n operators: 'Operators',\n relations: 'Relations',\n fraction: 'Fraction',\n superscript: 'Superscript',\n subscript: 'Subscript',\n squareRoot: 'Square Root',\n parentheses: 'Parentheses',\n plusMinus: 'Plus Minus',\n multiply: 'Multiply',\n divide: 'Divide',\n dot: 'Dot',\n union: 'Union',\n intersect: 'Intersection',\n lessOrEqual: 'Less or Equal',\n greaterOrEqual: 'Greater or Equal',\n notEqual: 'Not Equal',\n approximate: 'Approximate',\n infinity: 'Infinity',\n arrow: 'Arrow',\n limit: 'Limit',\n sine: 'Sine',\n logarithm: 'Logarithm',\n matrix: 'Matrix',\n summation: 'Summation',\n integral: 'Integral',\n placeholder: 'WPS-inspired ribbon layout. Some tiles are placeholders for future SDK features.',\n },\n zh: {\n equation: '公式',\n structures: '结构',\n symbols: '符号',\n matrices: '矩阵',\n templates: '模板',\n insert: '插入',\n greek: '希腊字母',\n operators: '运算符',\n relations: '关系',\n fraction: '分数',\n superscript: '上标',\n subscript: '下标',\n squareRoot: '平方根',\n parentheses: '括号',\n plusMinus: '加减',\n multiply: '乘',\n divide: '除',\n dot: '点乘',\n union: '并集',\n intersect: '交集',\n lessOrEqual: '小于等于',\n greaterOrEqual: '大于等于',\n notEqual: '不等于',\n approximate: '约等于',\n infinity: '无穷',\n arrow: '箭头',\n limit: '极限',\n sine: '正弦',\n logarithm: '对数',\n matrix: '矩阵',\n summation: '求和',\n integral: '积分',\n placeholder: 'WPS 风格的工具栏布局。部分按钮仍是未来 SDK 功能的占位项。',\n },\n} as const;\n\nexport type Locale = keyof typeof translations;\nexport type TranslationKey = keyof (typeof translations)['en'];\n\nexport interface LocaleConfig {\n locale?: Locale;\n}\n\nexport function t(locale: Locale, key: TranslationKey): string {\n return translations[locale][key] ?? translations.en[key];\n}\n"],"mappings":";AAEA,IAAM,WAAW,CAAC,SAA8B,KAAK,KAAK,GAAG;AAEtD,IAAM,wBAAwB,CAAC,KAAiB,eAAoC;AAAA;AAAA,MAErF,eAAe,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC;AAAA;AAAA;AAI9C,IAAM,iBAAiB,CAAC,OAAsB,UAAuB,eAAoC;AACvG,QAAM,OAAiB,CAAC;AACxB,WAAS,QAAQ,GAAG,SAAS,MAAM,QAAQ,SAAS,GAAG;AACrD,UAAM,OAAO,SAAS,CAAC,GAAG,UAAU,KAAK,CAAC;AAC1C,UAAM,WAAW,SAAS,SAAS,UAAU;AAC7C,SAAK;AAAA,MACH,yBAAyB,WAAW,eAAe,EAAE,gBAAgB,IAAI,0BAA0B,IAAI;AAAA,IACzG;AACA,QAAI,QAAQ,MAAM,QAAQ;AACxB,WAAK,KAAK,WAAW,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,KAAK,GAAG,UAAU,CAAC;AAAA,IACtE;AAAA,EACF;AACA,SAAO,KAAK,KAAK,EAAE;AACrB;AAEA,IAAM,aAAa,CAAC,MAAmB,MAAmB,eAAoC;AAC5F,QAAM,YAAY,SAAS,IAAI;AAC/B,QAAM,WAAW,CAAC,MAAmB,SAAS,CAAC,MAAM,SAAS,UAAU;AAExE,UAAQ,KAAK,MAAM;AAAA,IACjB,KAAK;AACH,aAAO,iDAAiD,SAAS,KAAK,KAAK,KAAK;AAAA,IAClF,KAAK;AACH,aAAO,kDAAkD,SAAS,KAAK,eAAe,KAAK,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,UAAU,CAAC;AAAA,IAC5H,KAAK;AACH,aAAO,iDAAiD,SAAS;AAAA,kCACrC,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,eAAe,EAAE,gBAAgB,SAAS,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,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EACA,IAAI;AAAA,IACF,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,aAAa;AAAA,IACb,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,aAAa;AAAA,EACf;AACF;AASO,SAAS,EAAE,QAAgB,KAA6B;AAC7D,SAAO,aAAa,MAAM,EAAE,GAAG,KAAK,aAAa,GAAG,GAAG;AACzD;","names":["createEmptyState","createEmptyState","mergeInlineStyles"]}
|
|
1
|
+
{"version":3,"sources":["../src/formula-modal.ts","../src/formula-node.ts","../src/index.ts"],"sourcesContent":["import { createEmptyState, parseLatex, type FormulaState } from '@formulaxjs/core';\nimport { mountKityEditor, type KityEditorAssets, type KityEditorHandle } from '@formulaxjs/kity-runtime';\nimport { escapeHtml } from './formula-node';\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\ninterface SvgBox {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface InlineSvgContent {\n box: SvgBox;\n matrix: SVGMatrixLike;\n root: SVGGraphicsElement;\n}\n\ninterface SVGMatrixLike {\n a: number;\n b: number;\n c: number;\n d: number;\n e: number;\n f: number;\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 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.formulax-math__render {\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.formulax-math {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n line-height: 1;\n padding: 0 2px;\n margin: 0 1px;\n border-radius: 3px;\n background: transparent;\n cursor: pointer;\n user-select: none;\n}\n\n.formulax-math:hover {\n outline: 1px solid rgba(37, 99, 235, 0.35);\n background: rgba(37, 99, 235, 0.06);\n}\n\n.formulax-math__svg {\n display: inline-block;\n flex: 0 0 auto;\n max-width: 100%;\n vertical-align: -0.35em;\n pointer-events: none;\n}\n\n.formulax-math__image {\n display: inline-block;\n max-width: 100%;\n height: auto;\n vertical-align: middle;\n pointer-events: none;\n}\n`;\n\nexport function ensureFormulaXModalStyles(doc: Document = document): void {\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 mountFormulaXEditor(\n root: HTMLElement,\n options: FormulaXEditorOptions = {},\n): MountedFormulaXEditor {\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 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 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 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\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 waitForFormulaSvgLayout(root);\n return renderCurrentFormulaAsSvgHtml(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 next command\n }\n }\n\n return null;\n}\n\nfunction renderCurrentFormulaAsSvgHtml(root: HTMLElement): string {\n const svg = findFormulaSvg(root);\n\n if (!svg) {\n return '';\n }\n\n return serializeSvgForInsertion(svg);\n}\n\nasync function waitForFormulaSvgLayout(root: HTMLElement): Promise<void> {\n const doc = root.ownerDocument ?? document;\n const view = doc.defaultView ?? window;\n\n await waitForDocumentFonts(doc);\n\n let previous = readRenderedFormulaBox(root);\n\n for (let attempt = 0; attempt < 4; attempt += 1) {\n await waitForAnimationFrame(view);\n const current = readRenderedFormulaBox(root);\n\n if (previous && current && areSvgBoxesClose(previous, current)) {\n return;\n }\n\n previous = current;\n }\n}\n\nfunction findFormulaSvg(root: HTMLElement): SVGSVGElement | null {\n return root.querySelector<SVGSVGElement>(\n '.kf-editor-edit-area svg, .kf-editor-canvas-container svg, svg',\n );\n}\n\nfunction readRenderedFormulaBox(root: HTMLElement): SvgBox | null {\n const svg = findFormulaSvg(root);\n if (!svg) {\n return null;\n }\n\n return getInlineSvgContent(svg)?.box ?? readSvgBox(svg);\n}\n\nfunction areSvgBoxesClose(left: SvgBox, right: SvgBox): boolean {\n return Math.abs(left.x - right.x) < 0.01\n && Math.abs(left.y - right.y) < 0.01\n && Math.abs(left.width - right.width) < 0.01\n && Math.abs(left.height - right.height) < 0.01;\n}\n\nasync function waitForDocumentFonts(doc: Document): Promise<void> {\n if (!doc.fonts?.ready) {\n return;\n }\n\n try {\n await doc.fonts.ready;\n } catch {\n // ignore font readiness errors and fall back to frame-based settling\n }\n}\n\nfunction waitForAnimationFrame(view: Window): Promise<void> {\n return new Promise((resolve) => {\n view.requestAnimationFrame(() => resolve());\n });\n}\n\nexport function serializeSvgForInsertion(svg: SVGSVGElement): string {\n const content = getInlineSvgContent(svg);\n const inlineViewport = content ? createInlineSvgViewport(content.box) : null;\n const clone = content && inlineViewport\n ? createInlineSvgClone(svg, content, inlineViewport)\n : svg.cloneNode(true) as SVGSVGElement;\n\n uniquifySvgIds(clone);\n sizeSvgForInlineDisplay(clone, svg, inlineViewport);\n\n clone.removeAttribute('id');\n clone.removeAttribute('xmlns');\n clone.removeAttribute('xmlns:xlink');\n clone.setAttribute('class', mergeClassNames(clone.getAttribute('class'), 'formulax-math__svg'));\n clone.setAttribute('focusable', 'false');\n clone.setAttribute('aria-hidden', 'true');\n clone.setAttribute('preserveAspectRatio', clone.getAttribute('preserveAspectRatio') || 'xMinYMin meet');\n\n return new XMLSerializer().serializeToString(clone);\n}\n\nfunction getInlineSvgContent(svg: SVGSVGElement): InlineSvgContent | null {\n const candidates = [\n '[data-root=\"true\"] > g[data-type=\"kf-editor-exp-content-box\"]',\n 'g[data-type=\"kf-editor-exp-content-box\"]',\n 'g[data-type=\"kf-container\"]',\n 'svg > g, g',\n ];\n\n for (const selector of candidates) {\n const content = svg.querySelector<SVGGraphicsElement>(selector);\n const rootSpace = content ? readSvgBoxInRootSpace(content) : null;\n if (content && rootSpace) {\n return {\n root: content,\n box: rootSpace.box,\n matrix: rootSpace.matrix,\n };\n }\n }\n\n return null;\n}\n\nfunction readSvgBoxInRootSpace(\n element: SVGGraphicsElement,\n): Pick<InlineSvgContent, 'box' | 'matrix'> | null {\n const box = readSvgBox(element);\n const matrix = getSvgRootSpaceMatrix(element);\n\n if (!box || !matrix) {\n return null;\n }\n\n const points = [\n { x: box.x, y: box.y },\n { x: box.x + box.width, y: box.y },\n { x: box.x, y: box.y + box.height },\n { x: box.x + box.width, y: box.y + box.height },\n ].map((point) => ({\n x: matrix.a * point.x + matrix.c * point.y + matrix.e,\n y: matrix.b * point.x + matrix.d * point.y + matrix.f,\n }));\n\n const xs = points.map((point) => point.x);\n const ys = points.map((point) => point.y);\n const x = Math.min(...xs);\n const y = Math.min(...ys);\n const width = Math.max(...xs) - x;\n const height = Math.max(...ys) - y;\n\n if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {\n return null;\n }\n\n return {\n box: { x, y, width, height },\n matrix,\n };\n}\n\nfunction getSvgRootSpaceMatrix(element: SVGGraphicsElement): SVGMatrixLike | null {\n const elementMatrix = typeof element.getCTM === 'function' ? element.getCTM() : null;\n const rootMatrix = typeof element.ownerSVGElement?.getCTM === 'function'\n ? element.ownerSVGElement.getCTM()\n : null;\n\n if (!elementMatrix) {\n return null;\n }\n\n return rootMatrix\n ? multiplySvgMatrices(invertSvgMatrix(rootMatrix), elementMatrix)\n : toSvgMatrixLike(elementMatrix);\n}\n\nfunction invertSvgMatrix(matrix: DOMMatrix | SVGMatrix): SVGMatrixLike {\n const determinant = matrix.a * matrix.d - matrix.b * matrix.c;\n\n if (!Number.isFinite(determinant) || determinant === 0) {\n return {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n };\n }\n\n return {\n a: matrix.d / determinant,\n b: -matrix.b / determinant,\n c: -matrix.c / determinant,\n d: matrix.a / determinant,\n e: (matrix.c * matrix.f - matrix.d * matrix.e) / determinant,\n f: (matrix.b * matrix.e - matrix.a * matrix.f) / determinant,\n };\n}\n\nfunction multiplySvgMatrices(\n left: DOMMatrix | SVGMatrixLike,\n right: DOMMatrix | SVGMatrixLike,\n): SVGMatrixLike {\n return {\n a: left.a * right.a + left.c * right.b,\n b: left.b * right.a + left.d * right.b,\n c: left.a * right.c + left.c * right.d,\n d: left.b * right.c + left.d * right.d,\n e: left.a * right.e + left.c * right.f + left.e,\n f: left.b * right.e + left.d * right.f + left.f,\n };\n}\n\nfunction toSvgMatrixLike(matrix: DOMMatrix | SVGMatrix): SVGMatrixLike {\n return {\n a: matrix.a,\n b: matrix.b,\n c: matrix.c,\n d: matrix.d,\n e: matrix.e,\n f: matrix.f,\n };\n}\n\nfunction readSvgBox(element: SVGGraphicsElement): SvgBox | null {\n if (typeof element.getBBox !== 'function') {\n return null;\n }\n\n try {\n const box = element.getBBox();\n if (!Number.isFinite(box.width) || !Number.isFinite(box.height) || box.width <= 0 || box.height <= 0) {\n return null;\n }\n\n return {\n x: box.x,\n y: box.y,\n width: box.width,\n height: box.height,\n };\n } catch {\n return null;\n }\n}\n\nfunction createInlineSvgViewport(contentBox: SvgBox): SvgBox {\n const edgePadding = Math.max(0.5, Math.min(contentBox.width, contentBox.height) * 0.006);\n const inset = edgePadding / 2;\n\n return {\n x: contentBox.x - inset,\n y: contentBox.y - inset,\n width: contentBox.width + edgePadding,\n height: contentBox.height + edgePadding,\n };\n}\n\nfunction createInlineSvgClone(\n source: SVGSVGElement,\n content: InlineSvgContent,\n viewport: SvgBox,\n): SVGSVGElement {\n const clone = source.cloneNode(false) as SVGSVGElement;\n const ownerDocument = source.ownerDocument;\n\n copySvgRootAttributes(source, clone);\n clone.setAttribute(\n 'viewBox',\n `0 0 ${roundLength(viewport.width)} ${roundLength(viewport.height)}`,\n );\n\n Array.from(source.children).forEach((child) => {\n if (child.tagName.toLowerCase() === 'defs') {\n clone.appendChild(child.cloneNode(true));\n }\n });\n\n const wrapper = ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'g');\n wrapper.setAttribute(\n 'transform',\n `translate(${roundLength(-viewport.x)} ${roundLength(-viewport.y)})`,\n );\n const flattened = ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'g');\n flattened.setAttribute(\n 'transform',\n `matrix(${roundLength(content.matrix.a)} ${roundLength(content.matrix.b)} ${roundLength(content.matrix.c)} ${roundLength(content.matrix.d)} ${roundLength(content.matrix.e)} ${roundLength(content.matrix.f)})`,\n );\n flattened.appendChild(content.root.cloneNode(true));\n wrapper.appendChild(flattened);\n clone.appendChild(wrapper);\n\n return clone;\n}\n\nfunction copySvgRootAttributes(source: SVGSVGElement, target: SVGSVGElement): void {\n const excluded = new Set([\n 'id',\n 'width',\n 'height',\n 'viewBox',\n 'class',\n 'focusable',\n 'aria-hidden',\n 'xmlns',\n 'xmlns:xlink',\n ]);\n\n Array.from(source.attributes).forEach((attribute) => {\n if (excluded.has(attribute.name)) return;\n target.setAttribute(attribute.name, attribute.value);\n });\n}\n\nfunction sizeSvgForInlineDisplay(\n clone: SVGSVGElement,\n source: SVGSVGElement,\n viewport: SvgBox | null,\n): void {\n const viewBox = clone.viewBox?.baseVal;\n const rect = source.getBoundingClientRect();\n const width = viewport?.width || viewBox?.width || rect.width || Number(clone.getAttribute('width')) || 1;\n const height = viewport?.height || viewBox?.height || rect.height || Number(clone.getAttribute('height')) || 1;\n const ratio = Math.max(0.1, width / Math.max(1, height));\n const inlineHeightEm = 0.875;\n const inlineWidthEm = Math.min(40, Math.max(0.75, ratio * inlineHeightEm));\n\n clone.setAttribute('width', roundLength(width));\n clone.setAttribute('height', roundLength(height));\n clone.setAttribute(\n 'style',\n mergeInlineStyles(\n clone.getAttribute('style'),\n `width:${roundLength(inlineWidthEm)}em`,\n `height:${inlineHeightEm}em`,\n ),\n );\n}\n\nfunction roundLength(value: number): string {\n return String(Math.round(value * 1000) / 1000);\n}\n\nfunction uniquifySvgIds(svg: SVGSVGElement): void {\n const idMap = new Map<string, string>();\n const prefix = `fx-${randomIdPrefix()}-`;\n const elementsWithId = svg.querySelectorAll<Element>('[id]');\n\n elementsWithId.forEach((element) => {\n const id = element.getAttribute('id');\n if (!id) return;\n\n const nextId = `${prefix}${id}`;\n idMap.set(id, nextId);\n element.setAttribute('id', nextId);\n });\n\n if (!idMap.size) return;\n\n svg.querySelectorAll<Element>('*').forEach((element) => {\n Array.from(element.attributes).forEach((attribute) => {\n const nextValue = rewriteSvgReferences(attribute.value, idMap);\n if (nextValue !== attribute.value) {\n element.setAttribute(attribute.name, nextValue);\n }\n });\n });\n}\n\nfunction randomIdPrefix(): string {\n return Math.random().toString(36).slice(2, 5).padEnd(3, '0');\n}\n\nfunction rewriteSvgReferences(value: string, idMap: Map<string, string>): string {\n let nextValue = value;\n\n idMap.forEach((nextId, id) => {\n nextValue = nextValue\n .replaceAll(`#${id}`, `#${nextId}`)\n .replaceAll(`url(${id})`, `url(${nextId})`)\n .replaceAll(`url(#${id})`, `url(#${nextId})`);\n });\n\n return nextValue;\n}\n\nfunction mergeClassNames(...values: Array<string | null | undefined>): string {\n return values\n .flatMap((value) => value?.split(/\\s+/) ?? [])\n .filter(Boolean)\n .filter((value, index, list) => list.indexOf(value) === index)\n .join(' ');\n}\n\nfunction mergeInlineStyles(...values: Array<string | null | undefined>): string {\n return values\n .flatMap((value) => value?.split(';') ?? [])\n .map((value) => value.trim())\n .filter(Boolean)\n .join('; ');\n}\n","export const DEFAULT_FORMULA_ATTRIBUTE = 'data-formulax-latex';\nexport const FORMULA_FLAG_ATTRIBUTE = 'data-formulax';\nexport const DEFAULT_FORMULA_CLASS = 'formulax-math';\n\nexport interface CreateFormulaMarkupOptions {\n attributeName?: string;\n className?: string;\n displayMode?: boolean;\n renderHtml?: string;\n cursorStyle?: string;\n extraAttributes?: Record<string, string | boolean | null | undefined>;\n}\n\nexport function escapeAttribute(value: string): string {\n return value\n .replaceAll('&', '&')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n\nexport function createFormulaMarkup(\n latex: string,\n options: CreateFormulaMarkupOptions = {},\n): string {\n const attributeName = options.attributeName ?? DEFAULT_FORMULA_ATTRIBUTE;\n const className = options.className ?? DEFAULT_FORMULA_CLASS;\n const displayClass = options.displayMode ? `${className} ${className}--block` : className;\n const safeLatex = escapeAttribute(latex);\n const cursorStyle = options.cursorStyle?.trim() || 'pointer';\n const extraAttributes: Record<string, string | boolean | null | undefined> = {\n ...(options.extraAttributes ?? {}),\n style: mergeInlineStyles(\n typeof options.extraAttributes?.style === 'string' ? options.extraAttributes.style : '',\n cursorStyle ? `cursor: ${cursorStyle}` : '',\n ),\n };\n const serializedAttributes = Object.entries(extraAttributes)\n .filter(([, value]) => value !== null && value !== undefined && value !== false)\n .map(([key, value]) => value === true ? key : `${key}=\"${escapeAttribute(String(value))}\"`);\n\n return [\n '<span',\n ` class=\"${escapeAttribute(displayClass)}\"`,\n ` ${FORMULA_FLAG_ATTRIBUTE}=\"true\"`,\n ` ${attributeName}=\"${safeLatex}\"`,\n ` data-latex=\"${safeLatex}\"`,\n ' contenteditable=\"false\"',\n ' role=\"button\"',\n ' tabindex=\"0\"',\n serializedAttributes.length ? ` ${serializedAttributes.join(' ')}` : '',\n '>',\n options.renderHtml ?? `<span class=\"${escapeAttribute(className)}__render\">${escapeHtml(latex || '\\\\square')}</span>`,\n '</span>',\n ].join('');\n}\n\nfunction mergeInlineStyles(existingStyle: string, nextStyle: string): string {\n const existing = existingStyle.trim().replace(/;+\\s*$/, '');\n const next = nextStyle.trim().replace(/;+\\s*$/, '');\n\n if (!existing) return next;\n if (!next) return existing;\n\n return `${existing}; ${next}`;\n}\n\nexport function createFormulaElement(\n ownerDocument: Document,\n latex: string,\n options: CreateFormulaMarkupOptions = {},\n): HTMLElement | null {\n const wrapper = ownerDocument.createElement('span');\n wrapper.innerHTML = createFormulaMarkup(latex, options);\n return wrapper.firstElementChild as HTMLElement | null;\n}\n\nexport function replaceFormulaElement(\n target: HTMLElement,\n latex: string,\n options: CreateFormulaMarkupOptions = {},\n): HTMLElement | null {\n const next = createFormulaElement(target.ownerDocument ?? document, latex, options);\n if (!next) return null;\n target.replaceWith(next);\n return next;\n}\n\nexport function getFormulaLatexFromElement(\n element: HTMLElement,\n attributeName = DEFAULT_FORMULA_ATTRIBUTE,\n): string {\n return element.getAttribute(attributeName)\n ?? element.getAttribute('data-latex')\n ?? '';\n}\n\nexport function isFormulaElement(node: unknown): node is HTMLElement {\n if (!node || typeof node !== 'object') return false;\n const element = node as HTMLElement;\n return typeof element.getAttribute === 'function'\n && element.getAttribute(FORMULA_FLAG_ATTRIBUTE) === 'true';\n}\n\nexport function findFormulaElement(node: Node | null): HTMLElement | null {\n if (!node) return null;\n\n const element = node.nodeType === 1\n ? node as HTMLElement\n : node.parentElement;\n\n return element?.closest?.(`[${FORMULA_FLAG_ATTRIBUTE}=\"true\"]`) as HTMLElement | null;\n}\n","export * from './formula-modal';\nexport * from './formula-node';\nexport {\n FormulaXEditor,\n createKityEditor,\n ensureKityRuntime,\n mountKityEditor,\n} from '@formulaxjs/kity-runtime';\nexport type {\n KityEditorAssets,\n KityEditorConstructorOptions,\n KityEditorHandle,\n KityEditorOptions,\n} from '@formulaxjs/kity-runtime';\n"],"mappings":";AAAA,SAAS,kBAAkB,kBAAqC;AAChE,SAAS,uBAAqE;;;ACDvE,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAW9B,SAAS,gBAAgB,OAAuB;AACrD,SAAO,MACJ,WAAW,KAAK,OAAO,EACvB,WAAW,KAAK,QAAQ,EACxB,WAAW,KAAK,MAAM,EACtB,WAAW,KAAK,MAAM;AAC3B;A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