@formulaxjs/renderer-kity 0.2.1 → 0.3.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 -9
- package/README.zh-CN.md +48 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +127 -149
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
- /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/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# @formulaxjs/renderer-kity
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @formulaxjs/renderer-kity
|
|
2
|
+
|
|
3
|
+
English | [简体中文](https://github.com/vndmea/formulaX/blob/main/packages/renderer-kity/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Kity-based read-only renderer for FormulaX.
|
|
4
6
|
|
|
5
7
|
`@formulaxjs/renderer-kity` turns LaTeX into inline SVG markup by using the legacy Kity runtime behind the shared `@formulaxjs/renderer` contract. It is the current concrete renderer package for adapters that want runtime SVG output without depending on editor UI helpers.
|
|
6
8
|
|
|
@@ -14,11 +16,11 @@ npm install @formulaxjs/renderer-kity
|
|
|
14
16
|
|
|
15
17
|
## Highlights
|
|
16
18
|
|
|
17
|
-
- `createKityFormulaRenderer`
|
|
18
|
-
- `renderLatexToSvgMarkup`
|
|
19
|
-
- `serializeKityFormulaFromRoot`
|
|
20
|
-
- `waitForKityFormulaSvgLayout`
|
|
21
|
-
- cache-safe asset overrides through `
|
|
19
|
+
- `createKityFormulaRenderer`
|
|
20
|
+
- `renderLatexToSvgMarkup`
|
|
21
|
+
- `serializeKityFormulaFromRoot`
|
|
22
|
+
- `waitForKityFormulaSvgLayout`
|
|
23
|
+
- cache-safe asset overrides through `assetCacheKey`
|
|
22
24
|
|
|
23
25
|
## Example
|
|
24
26
|
|
|
@@ -35,7 +37,7 @@ console.log(result.engine); // kity
|
|
|
35
37
|
console.log(result.html); // inline SVG markup
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
If you pass custom runtime asset overrides and want caching to stay enabled, also pass an `
|
|
40
|
+
If you pass custom runtime asset overrides and want caching to stay enabled, also pass an `assetCacheKey` string so different asset sets do not share the same cache entry.
|
|
39
41
|
|
|
40
42
|
## Package role
|
|
41
43
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @formulaxjs/renderer-kity
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/vndmea/formulaX/blob/main/packages/renderer-kity/README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
FormulaX 的基于 Kity 的只读 renderer。
|
|
6
|
+
|
|
7
|
+
`@formulaxjs/renderer-kity` 通过共享的 `@formulaxjs/renderer` 协议,利用旧版 Kity runtime 将 LaTeX 转成可内联的 SVG markup。对于需要运行时 SVG 输出、但不想依赖编辑器 UI helper 的 adapter 来说,它是当前的具体 renderer 包。
|
|
8
|
+
|
|
9
|
+
> 状态:实验阶段。在首个稳定版本发布前,公共 API 仍可能调整。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @formulaxjs/renderer-kity
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 功能概览
|
|
18
|
+
|
|
19
|
+
- `createKityFormulaRenderer`
|
|
20
|
+
- `renderLatexToSvgMarkup`
|
|
21
|
+
- `serializeKityFormulaFromRoot`
|
|
22
|
+
- `waitForKityFormulaSvgLayout`
|
|
23
|
+
- 通过 `assetCacheKey` 支持安全缓存的资源覆盖
|
|
24
|
+
|
|
25
|
+
## 示例
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { createKityFormulaRenderer } from '@formulaxjs/renderer-kity';
|
|
29
|
+
|
|
30
|
+
const renderer = createKityFormulaRenderer({
|
|
31
|
+
fontSize: 40,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const result = await renderer.renderLatex('\\frac{a}{b}');
|
|
35
|
+
|
|
36
|
+
console.log(result.engine); // kity
|
|
37
|
+
console.log(result.html); // inline SVG markup
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
如果你传入了自定义 runtime 资源覆盖,并且希望继续启用缓存,请同时传入一个 `assetCacheKey` 字符串,避免不同资源集共用同一条 cache 记录。
|
|
41
|
+
|
|
42
|
+
## 包职责
|
|
43
|
+
|
|
44
|
+
当你需要今天就能直接使用的 FormulaX 具体 renderer 实现时,请使用这个包。
|
|
45
|
+
|
|
46
|
+
- 它依赖 `@formulaxjs/renderer` 提供共享 renderer 协议与 SVG helper
|
|
47
|
+
- 它依赖 `@formulaxjs/kity-runtime` 提供旧版 Kity 后端
|
|
48
|
+
- 它不依赖 `@formulaxjs/editor`
|
package/dist/index.cjs
CHANGED
|
@@ -115,7 +115,7 @@ function createKityFormulaRenderer(defaults = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
function renderLatexToSvgMarkup(latex, options = {}) {
|
|
117
117
|
const normalizedLatex = latex.trim();
|
|
118
|
-
const shouldUseCache = options.cache !== false && !(hasCustomAssetOverrides(options.assets) && !options.
|
|
118
|
+
const shouldUseCache = options.cache !== false && !(hasCustomAssetOverrides(options.assets) && !options.assetCacheKey);
|
|
119
119
|
if (!normalizedLatex) {
|
|
120
120
|
return Promise.resolve({
|
|
121
121
|
engine: "kity",
|
|
@@ -131,7 +131,7 @@ function renderLatexToSvgMarkup(latex, options = {}) {
|
|
|
131
131
|
fontSize: options.fontSize,
|
|
132
132
|
displayMode: options.displayMode,
|
|
133
133
|
className: options.className,
|
|
134
|
-
|
|
134
|
+
assetCacheKey: options.assetCacheKey
|
|
135
135
|
});
|
|
136
136
|
if (shouldUseCache) {
|
|
137
137
|
const cached = renderCache.get(cacheKey);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/renderer.ts","../src/dom.ts","../src/serialize.ts"],"sourcesContent":["export type { KityFormulaRenderOptions } from './types';\n\nexport {\n createKityFormulaRenderer,\n renderLatexToSvgMarkup,\n} from './renderer';\n\nexport {\n findKityFormulaSvg,\n serializeKityFormulaFromRoot,\n waitForKityFormulaSvgLayout,\n} from './serialize';\n","import {\n createFormulaRenderCacheKey,\n type FormulaRenderer,\n type FormulaRenderResult,\n} from '@formulaxjs/renderer';\nimport { mountKityEditor, type KityEditorAssets } from '@formulaxjs/kity-runtime';\nimport { createHiddenRenderHost } from './dom';\nimport {\n serializeKityFormulaFromRoot,\n waitForKityFormulaSvgLayout,\n} from './serialize';\nimport type { KityFormulaRenderOptions } from './types';\n\nconst renderCache = new Map<string, Promise<FormulaRenderResult>>();\n\nfunction hasCustomAssetOverrides(assets?: Partial<KityEditorAssets>): boolean {\n return Boolean(assets && Object.keys(assets).length > 0);\n}\n\nexport function createKityFormulaRenderer(\n defaults: KityFormulaRenderOptions = {},\n): FormulaRenderer {\n return {\n renderLatex(latex, options = {}) {\n return renderLatexToSvgMarkup(latex, {\n ...defaults,\n ...options,\n });\n },\n };\n}\n\nexport function renderLatexToSvgMarkup(\n latex: string,\n options: KityFormulaRenderOptions = {},\n): Promise<FormulaRenderResult> {\n const normalizedLatex = latex.trim();\n const shouldUseCache = options.cache !== false\n && !(hasCustomAssetOverrides(options.assets) && !options.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/renderer.ts","../src/dom.ts","../src/serialize.ts"],"sourcesContent":["export type { KityFormulaRenderOptions } from './types';\n\nexport {\n createKityFormulaRenderer,\n renderLatexToSvgMarkup,\n} from './renderer';\n\nexport {\n findKityFormulaSvg,\n serializeKityFormulaFromRoot,\n waitForKityFormulaSvgLayout,\n} from './serialize';\n","import {\n createFormulaRenderCacheKey,\n type FormulaRenderer,\n type FormulaRenderResult,\n} from '@formulaxjs/renderer';\nimport { mountKityEditor, type KityEditorAssets } from '@formulaxjs/kity-runtime';\nimport { createHiddenRenderHost } from './dom';\nimport {\n serializeKityFormulaFromRoot,\n waitForKityFormulaSvgLayout,\n} from './serialize';\nimport type { KityFormulaRenderOptions } from './types';\n\nconst renderCache = new Map<string, Promise<FormulaRenderResult>>();\n\nfunction hasCustomAssetOverrides(assets?: Partial<KityEditorAssets>): boolean {\n return Boolean(assets && Object.keys(assets).length > 0);\n}\n\nexport function createKityFormulaRenderer(\n defaults: KityFormulaRenderOptions = {},\n): FormulaRenderer {\n return {\n renderLatex(latex, options = {}) {\n return renderLatexToSvgMarkup(latex, {\n ...defaults,\n ...options,\n });\n },\n };\n}\n\nexport function renderLatexToSvgMarkup(\n latex: string,\n options: KityFormulaRenderOptions = {},\n): Promise<FormulaRenderResult> {\n const normalizedLatex = latex.trim();\n const shouldUseCache = options.cache !== false\n && !(hasCustomAssetOverrides(options.assets) && !options.assetCacheKey);\n\n if (!normalizedLatex) {\n return Promise.resolve({\n engine: 'kity',\n output: 'svg',\n latex: normalizedLatex,\n html: '',\n });\n }\n\n const cacheKey = createFormulaRenderCacheKey({\n engine: 'kity',\n latex: normalizedLatex,\n output: 'svg',\n fontSize: options.fontSize,\n displayMode: options.displayMode,\n className: options.className,\n assetCacheKey: options.assetCacheKey,\n });\n\n if (shouldUseCache) {\n const cached = renderCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n }\n\n const pending = renderLatexToSvgMarkupUncached(normalizedLatex, options);\n\n if (shouldUseCache) {\n renderCache.set(cacheKey, pending);\n pending.catch(() => {\n if (renderCache.get(cacheKey) === pending) {\n renderCache.delete(cacheKey);\n }\n });\n }\n\n return pending;\n}\n\nasync function renderLatexToSvgMarkupUncached(\n latex: string,\n options: KityFormulaRenderOptions,\n): Promise<FormulaRenderResult> {\n if (typeof document === 'undefined') {\n throw new Error('Kity renderer requires a browser document.');\n }\n\n const host = createHiddenRenderHost(document);\n const handle = await mountKityEditor(host, {\n initialLatex: latex,\n height: options.height ?? '100%',\n autofocus: false,\n assets: options.assets,\n render: {\n fontsize: options.fontSize ?? 40,\n },\n });\n\n try {\n await waitForKityFormulaSvgLayout(host);\n\n return {\n engine: 'kity',\n output: 'svg',\n latex,\n html: serializeKityFormulaFromRoot(host),\n };\n } finally {\n handle.destroy();\n host.remove();\n }\n}\n","export function createHiddenRenderHost(doc: Document = document): HTMLElement {\n const host = doc.createElement('div');\n\n host.style.position = 'fixed';\n host.style.left = '-100000px';\n host.style.top = '0';\n host.style.width = '1px';\n host.style.height = '1px';\n host.style.opacity = '0';\n host.style.pointerEvents = 'none';\n host.setAttribute('aria-hidden', 'true');\n\n doc.body.appendChild(host);\n\n return host;\n}\n\nexport async function waitForDocumentFonts(doc: Document): Promise<void> {\n if (!doc.fonts?.ready) return;\n\n try {\n await doc.fonts.ready;\n } catch {\n // Ignore font readiness failures and fall back to frame-based settling.\n }\n}\n\nexport function waitForAnimationFrame(view: Window): Promise<void> {\n return new Promise((resolve) => {\n view.requestAnimationFrame(() => resolve());\n });\n}\n","import {\n readRenderedFormulaSvgBox,\n serializeSvgForInsertion,\n type SvgBox,\n} from '@formulaxjs/renderer';\nimport { waitForAnimationFrame, waitForDocumentFonts } from './dom';\n\nexport function findKityFormulaSvg(root: HTMLElement): SVGSVGElement | null {\n return root.querySelector<SVGSVGElement>(\n '.kf-editor-edit-area svg, .kf-editor-canvas-container svg, svg',\n );\n}\n\nexport function serializeKityFormulaFromRoot(root: HTMLElement): string {\n const svg = findKityFormulaSvg(root);\n\n if (!svg) {\n return '';\n }\n\n return serializeSvgForInsertion(svg);\n}\n\nexport async function waitForKityFormulaSvgLayout(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 readRenderedFormulaBox(root: HTMLElement): SvgBox | null {\n const svg = findKityFormulaSvg(root);\n\n if (!svg) {\n return null;\n }\n\n return readRenderedFormulaSvgBox(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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,mBAIO;AACP,0BAAuD;;;ACLhD,SAAS,uBAAuB,MAAgB,UAAuB;AAC5E,QAAM,OAAO,IAAI,cAAc,KAAK;AAEpC,OAAK,MAAM,WAAW;AACtB,OAAK,MAAM,OAAO;AAClB,OAAK,MAAM,MAAM;AACjB,OAAK,MAAM,QAAQ;AACnB,OAAK,MAAM,SAAS;AACpB,OAAK,MAAM,UAAU;AACrB,OAAK,MAAM,gBAAgB;AAC3B,OAAK,aAAa,eAAe,MAAM;AAEvC,MAAI,KAAK,YAAY,IAAI;AAEzB,SAAO;AACT;AAEA,eAAsB,qBAAqB,KAA8B;AACvE,MAAI,CAAC,IAAI,OAAO,MAAO;AAEvB,MAAI;AACF,UAAM,IAAI,MAAM;AAAA,EAClB,QAAQ;AAAA,EAER;AACF;AAEO,SAAS,sBAAsB,MAA6B;AACjE,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,SAAK,sBAAsB,MAAM,QAAQ,CAAC;AAAA,EAC5C,CAAC;AACH;;;AC/BA,sBAIO;AAGA,SAAS,mBAAmB,MAAyC;AAC1E,SAAO,KAAK;AAAA,IACV;AAAA,EACF;AACF;AAEO,SAAS,6BAA6B,MAA2B;AACtE,QAAM,MAAM,mBAAmB,IAAI;AAEnC,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,aAAO,0CAAyB,GAAG;AACrC;AAEA,eAAsB,4BAA4B,MAAkC;AAClF,QAAM,MAAM,KAAK,iBAAiB;AAClC,QAAM,OAAO,IAAI,eAAe;AAEhC,QAAM,qBAAqB,GAAG;AAE9B,MAAI,WAAW,uBAAuB,IAAI;AAE1C,WAAS,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG;AAC/C,UAAM,sBAAsB,IAAI;AAChC,UAAM,UAAU,uBAAuB,IAAI;AAE3C,QAAI,YAAY,WAAW,iBAAiB,UAAU,OAAO,GAAG;AAC9D;AAAA,IACF;AAEA,eAAW;AAAA,EACb;AACF;AAEA,SAAS,uBAAuB,MAAkC;AAChE,QAAM,MAAM,mBAAmB,IAAI;AAEnC,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,aAAO,2CAA0B,GAAG;AACtC;AAEA,SAAS,iBAAiB,MAAc,OAAwB;AAC9D,SAAO,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,IAAI,QAC/B,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,IAAI,QAC7B,KAAK,IAAI,KAAK,QAAQ,MAAM,KAAK,IAAI,QACrC,KAAK,IAAI,KAAK,SAAS,MAAM,MAAM,IAAI;AAC9C;;;AF7CA,IAAM,cAAc,oBAAI,IAA0C;AAElE,SAAS,wBAAwB,QAA6C;AAC5E,SAAO,QAAQ,UAAU,OAAO,KAAK,MAAM,EAAE,SAAS,CAAC;AACzD;AAEO,SAAS,0BACd,WAAqC,CAAC,GACrB;AACjB,SAAO;AAAA,IACL,YAAY,OAAO,UAAU,CAAC,GAAG;AAC/B,aAAO,uBAAuB,OAAO;AAAA,QACnC,GAAG;AAAA,QACH,GAAG;AAAA,MACL,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,SAAS,uBACd,OACA,UAAoC,CAAC,GACP;AAC9B,QAAM,kBAAkB,MAAM,KAAK;AACnC,QAAM,iBAAiB,QAAQ,UAAU,SACpC,EAAE,wBAAwB,QAAQ,MAAM,KAAK,CAAC,QAAQ;AAE3D,MAAI,CAAC,iBAAiB;AACpB,WAAO,QAAQ,QAAQ;AAAA,MACrB,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,QAAM,eAAW,8CAA4B;AAAA,IAC3C,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU,QAAQ;AAAA,IAClB,aAAa,QAAQ;AAAA,IACrB,WAAW,QAAQ;AAAA,IACnB,eAAe,QAAQ;AAAA,EACzB,CAAC;AAED,MAAI,gBAAgB;AAClB,UAAM,SAAS,YAAY,IAAI,QAAQ;AACvC,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,UAAU,+BAA+B,iBAAiB,OAAO;AAEvE,MAAI,gBAAgB;AAClB,gBAAY,IAAI,UAAU,OAAO;AACjC,YAAQ,MAAM,MAAM;AAClB,UAAI,YAAY,IAAI,QAAQ,MAAM,SAAS;AACzC,oBAAY,OAAO,QAAQ;AAAA,MAC7B;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAEA,eAAe,+BACb,OACA,SAC8B;AAC9B,MAAI,OAAO,aAAa,aAAa;AACnC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,OAAO,uBAAuB,QAAQ;AAC5C,QAAM,SAAS,UAAM,qCAAgB,MAAM;AAAA,IACzC,cAAc;AAAA,IACd,QAAQ,QAAQ,UAAU;AAAA,IAC1B,WAAW;AAAA,IACX,QAAQ,QAAQ;AAAA,IAChB,QAAQ;AAAA,MACN,UAAU,QAAQ,YAAY;AAAA,IAChC;AAAA,EACF,CAAC;AAED,MAAI;AACF,UAAM,4BAA4B,IAAI;AAEtC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR;AAAA,MACA,MAAM,6BAA6B,IAAI;AAAA,IACzC;AAAA,EACF,UAAE;AACA,WAAO,QAAQ;AACf,SAAK,OAAO;AAAA,EACd;AACF;","names":["import_renderer"]}
|
package/dist/index.global.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var FormulaX = (() => {
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
7
15
|
var __esm = (fn, res) => function __init() {
|
|
8
16
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
17
|
};
|
|
@@ -19,98 +27,42 @@ var FormulaX = (() => {
|
|
|
19
27
|
}
|
|
20
28
|
return to;
|
|
21
29
|
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
+
mod
|
|
37
|
+
));
|
|
22
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
39
|
|
|
24
|
-
// ../kity-runtime/public/assets/images/toolbar/btn.png
|
|
25
|
-
var btn_default;
|
|
26
|
-
var init_btn = __esm({
|
|
27
|
-
"../kity-runtime/public/assets/images/toolbar/btn.png"() {
|
|
28
|
-
btn_default = "./btn-5DANP6JY.png";
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// ../kity-runtime/public/assets/images/toolbar/other.png
|
|
33
|
-
var other_default;
|
|
34
|
-
var init_other = __esm({
|
|
35
|
-
"../kity-runtime/public/assets/images/toolbar/other.png"() {
|
|
36
|
-
other_default = "./other-OMWJFGL5.png";
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// ../kity-runtime/public/assets/styles/editor.css?url
|
|
41
|
-
var editor_default;
|
|
42
|
-
var init_editor = __esm({
|
|
43
|
-
"../kity-runtime/public/assets/styles/editor.css?url"() {
|
|
44
|
-
editor_default = "./editor-JT5KLVXX.css?url";
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// ../kity-runtime/public/resource/KF_AMS_BB.woff
|
|
49
|
-
var KF_AMS_BB_default;
|
|
50
|
-
var init_KF_AMS_BB = __esm({
|
|
51
|
-
"../kity-runtime/public/resource/KF_AMS_BB.woff"() {
|
|
52
|
-
KF_AMS_BB_default = "./KF_AMS_BB-5QF7FUSO.woff";
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// ../kity-runtime/public/resource/KF_AMS_CAL.woff
|
|
57
|
-
var KF_AMS_CAL_default;
|
|
58
|
-
var init_KF_AMS_CAL = __esm({
|
|
59
|
-
"../kity-runtime/public/resource/KF_AMS_CAL.woff"() {
|
|
60
|
-
KF_AMS_CAL_default = "./KF_AMS_CAL-NXRNLAZN.woff";
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ../kity-runtime/public/resource/KF_AMS_FRAK.woff
|
|
65
|
-
var KF_AMS_FRAK_default;
|
|
66
|
-
var init_KF_AMS_FRAK = __esm({
|
|
67
|
-
"../kity-runtime/public/resource/KF_AMS_FRAK.woff"() {
|
|
68
|
-
KF_AMS_FRAK_default = "./KF_AMS_FRAK-CO33WWN4.woff";
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// ../kity-runtime/public/resource/KF_AMS_MAIN.woff
|
|
73
|
-
var KF_AMS_MAIN_default;
|
|
74
|
-
var init_KF_AMS_MAIN = __esm({
|
|
75
|
-
"../kity-runtime/public/resource/KF_AMS_MAIN.woff"() {
|
|
76
|
-
KF_AMS_MAIN_default = "./KF_AMS_MAIN-25QJVAWY.woff";
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// ../kity-runtime/public/resource/KF_AMS_ROMAN.woff
|
|
81
|
-
var KF_AMS_ROMAN_default;
|
|
82
|
-
var init_KF_AMS_ROMAN = __esm({
|
|
83
|
-
"../kity-runtime/public/resource/KF_AMS_ROMAN.woff"() {
|
|
84
|
-
KF_AMS_ROMAN_default = "./KF_AMS_ROMAN-243BR7HH.woff";
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
40
|
// ../kity-runtime/src/asset-manifest.ts
|
|
89
|
-
var kityFontAssets, kityToolbarAssets, kityStyleAssets, kityAssetManifest;
|
|
41
|
+
var import_btn, import_other, import_editor, import_KF_AMS_BB, import_KF_AMS_CAL, import_KF_AMS_FRAK, import_KF_AMS_MAIN, import_KF_AMS_ROMAN, kityFontAssets, kityToolbarAssets, kityStyleAssets, kityAssetManifest;
|
|
90
42
|
var init_asset_manifest = __esm({
|
|
91
43
|
"../kity-runtime/src/asset-manifest.ts"() {
|
|
92
44
|
"use strict";
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
45
|
+
import_btn = __toESM(__require("./btn.png"), 1);
|
|
46
|
+
import_other = __toESM(__require("./other.png"), 1);
|
|
47
|
+
import_editor = __toESM(__require("./editor.css?url"), 1);
|
|
48
|
+
import_KF_AMS_BB = __toESM(__require("./KF_AMS_BB.woff"), 1);
|
|
49
|
+
import_KF_AMS_CAL = __toESM(__require("./KF_AMS_CAL.woff"), 1);
|
|
50
|
+
import_KF_AMS_FRAK = __toESM(__require("./KF_AMS_FRAK.woff"), 1);
|
|
51
|
+
import_KF_AMS_MAIN = __toESM(__require("./KF_AMS_MAIN.woff"), 1);
|
|
52
|
+
import_KF_AMS_ROMAN = __toESM(__require("./KF_AMS_ROMAN.woff"), 1);
|
|
101
53
|
kityFontAssets = {
|
|
102
|
-
KF_AMS_BB:
|
|
103
|
-
KF_AMS_CAL:
|
|
104
|
-
KF_AMS_FRAK:
|
|
105
|
-
KF_AMS_MAIN:
|
|
106
|
-
KF_AMS_ROMAN:
|
|
54
|
+
KF_AMS_BB: import_KF_AMS_BB.default,
|
|
55
|
+
KF_AMS_CAL: import_KF_AMS_CAL.default,
|
|
56
|
+
KF_AMS_FRAK: import_KF_AMS_FRAK.default,
|
|
57
|
+
KF_AMS_MAIN: import_KF_AMS_MAIN.default,
|
|
58
|
+
KF_AMS_ROMAN: import_KF_AMS_ROMAN.default
|
|
107
59
|
};
|
|
108
60
|
kityToolbarAssets = {
|
|
109
|
-
btn:
|
|
110
|
-
other:
|
|
61
|
+
btn: import_btn.default,
|
|
62
|
+
other: import_other.default
|
|
111
63
|
};
|
|
112
64
|
kityStyleAssets = {
|
|
113
|
-
editor:
|
|
65
|
+
editor: import_editor.default
|
|
114
66
|
};
|
|
115
67
|
kityAssetManifest = {
|
|
116
68
|
fonts: kityFontAssets,
|
|
@@ -5079,11 +5031,76 @@ var FormulaX = (() => {
|
|
|
5079
5031
|
}
|
|
5080
5032
|
return DEFAULT_FORMULAX_LOCALE;
|
|
5081
5033
|
}
|
|
5082
|
-
|
|
5034
|
+
function translateFormulaXText(namespace, value, locale) {
|
|
5035
|
+
if (locale === "zh_CN") {
|
|
5036
|
+
return value;
|
|
5037
|
+
}
|
|
5038
|
+
const normalizedValue = value.replace(/<br\s*\/?>/gi, "").trim();
|
|
5039
|
+
const translatedValue = FORMULAX_TRANSLATIONS[locale]?.[namespace]?.[normalizedValue];
|
|
5040
|
+
if (!translatedValue) {
|
|
5041
|
+
return value;
|
|
5042
|
+
}
|
|
5043
|
+
const lineBreakMatch = value.match(/<br\s*\/?>/i);
|
|
5044
|
+
if (/<br\s*\/?>/i.test(translatedValue)) {
|
|
5045
|
+
return translatedValue;
|
|
5046
|
+
}
|
|
5047
|
+
return lineBreakMatch ? `${translatedValue}${lineBreakMatch[0]}` : translatedValue;
|
|
5048
|
+
}
|
|
5049
|
+
function getFormulaXRuntimeMessage(key, locale = DEFAULT_FORMULAX_LOCALE) {
|
|
5050
|
+
const normalizedLocale = normalizeFormulaXLocale(locale);
|
|
5051
|
+
return FORMULAX_RUNTIME_MESSAGES[normalizedLocale][key] ?? FORMULAX_RUNTIME_MESSAGES[DEFAULT_FORMULAX_LOCALE][key];
|
|
5052
|
+
}
|
|
5053
|
+
var DEFAULT_FORMULAX_LOCALE, FORMULAX_TRANSLATIONS, FORMULAX_RUNTIME_MESSAGES;
|
|
5083
5054
|
var init_i18n = __esm({
|
|
5084
5055
|
"../kity-runtime/src/i18n.ts"() {
|
|
5085
5056
|
"use strict";
|
|
5086
5057
|
DEFAULT_FORMULAX_LOCALE = "en_US";
|
|
5058
|
+
FORMULAX_TRANSLATIONS = {
|
|
5059
|
+
en_US: {
|
|
5060
|
+
toolbar: {
|
|
5061
|
+
\u9884\u8BBE: "Presets",
|
|
5062
|
+
\u9884\u8BBE\u516C\u5F0F: "Presets",
|
|
5063
|
+
\u4E8C\u6B21\u516C\u5F0F: "Quadratic",
|
|
5064
|
+
\u4E8C\u9879\u5F0F\u5B9A\u7406: "Binomial",
|
|
5065
|
+
\u52FE\u80A1\u5B9A\u7406: "Pythagorean",
|
|
5066
|
+
\u57FA\u7840\u6570\u5B66: "Basic math",
|
|
5067
|
+
\u5E0C\u814A\u5B57\u6BCD: "Greek",
|
|
5068
|
+
\u6C42\u53CD\u5173\u7CFB\u8FD0\u7B97\u7B26: "Negated operators",
|
|
5069
|
+
\u5B57\u6BCD\u7C7B\u7B26\u53F7: "Letter symbols",
|
|
5070
|
+
\u7BAD\u5934: "Arrows",
|
|
5071
|
+
\u624B\u5199\u4F53: "Script",
|
|
5072
|
+
\u5206\u6570: "Fraction",
|
|
5073
|
+
\u5E38\u7528\u5206\u6570: "Common fractions",
|
|
5074
|
+
\u4E0A\u4E0B\u6807: "Scripts",
|
|
5075
|
+
\u4E0A\u6807\u548C\u4E0B\u6807: "Super/subscripts",
|
|
5076
|
+
\u5E38\u7528\u7684\u4E0A\u6807\u548C\u4E0B\u6807: "Common super/subscripts",
|
|
5077
|
+
\u6839\u5F0F: "Radicals",
|
|
5078
|
+
\u5E38\u7528\u6839\u5F0F: "Common radicals",
|
|
5079
|
+
\u79EF\u5206: "Integrals",
|
|
5080
|
+
\u5927\u578B\u8FD0\u7B97\u7B26: "Large<br/>ops",
|
|
5081
|
+
\u6C42\u548C: "Summations",
|
|
5082
|
+
\u62EC\u53F7: "Brackets",
|
|
5083
|
+
\u65B9\u62EC\u53F7: "Brackets",
|
|
5084
|
+
\u51FD\u6570: "Functions",
|
|
5085
|
+
\u4E09\u89D2\u51FD\u6570: "Trig functions",
|
|
5086
|
+
\u5E38\u7528\u51FD\u6570: "Common functions",
|
|
5087
|
+
\u5C0F\u5199: "Lowercase",
|
|
5088
|
+
\u5927\u5199: "Uppercase",
|
|
5089
|
+
\u53D8\u4F53: "Variants",
|
|
5090
|
+
\u82B1\u4F53: "Fraktur",
|
|
5091
|
+
\u53CC\u7EBF: "Double-struck",
|
|
5092
|
+
\u7F57\u9A6C: "Roman"
|
|
5093
|
+
}
|
|
5094
|
+
}
|
|
5095
|
+
};
|
|
5096
|
+
FORMULAX_RUNTIME_MESSAGES = {
|
|
5097
|
+
en_US: {
|
|
5098
|
+
"editor.placeholder.root": "Type formula here"
|
|
5099
|
+
},
|
|
5100
|
+
zh_CN: {
|
|
5101
|
+
"editor.placeholder.root": "\u8BF7\u8F93\u5165\u516C\u5F0F"
|
|
5102
|
+
}
|
|
5103
|
+
};
|
|
5087
5104
|
}
|
|
5088
5105
|
});
|
|
5089
5106
|
|
|
@@ -14980,8 +14997,8 @@ var FormulaX = (() => {
|
|
|
14980
14997
|
}
|
|
14981
14998
|
return serviceObject;
|
|
14982
14999
|
}
|
|
14983
|
-
var defaultOptions, components, kity2, kf, KFEditor,
|
|
14984
|
-
var
|
|
15000
|
+
var defaultOptions, components, kity2, kf, KFEditor, editor_default;
|
|
15001
|
+
var init_editor = __esm({
|
|
14985
15002
|
"../kity-runtime/src/legacy/editor.ts"() {
|
|
14986
15003
|
"use strict";
|
|
14987
15004
|
init_legacy_utils();
|
|
@@ -15092,7 +15109,7 @@ var FormulaX = (() => {
|
|
|
15092
15109
|
components[name] = component;
|
|
15093
15110
|
}
|
|
15094
15111
|
});
|
|
15095
|
-
|
|
15112
|
+
editor_default = KFEditor;
|
|
15096
15113
|
}
|
|
15097
15114
|
});
|
|
15098
15115
|
|
|
@@ -15101,13 +15118,13 @@ var FormulaX = (() => {
|
|
|
15101
15118
|
var init_factory = __esm({
|
|
15102
15119
|
"../kity-runtime/src/legacy/factory.ts"() {
|
|
15103
15120
|
"use strict";
|
|
15104
|
-
|
|
15121
|
+
init_editor();
|
|
15105
15122
|
init_runtime_interop();
|
|
15106
15123
|
EditorWrapper = class {
|
|
15107
15124
|
callbacks = [];
|
|
15108
15125
|
editor;
|
|
15109
15126
|
constructor(container, options) {
|
|
15110
|
-
this.editor = new
|
|
15127
|
+
this.editor = new editor_default(container, options);
|
|
15111
15128
|
this.editor.ready(() => {
|
|
15112
15129
|
this.trigger();
|
|
15113
15130
|
});
|
|
@@ -16675,6 +16692,7 @@ var FormulaX = (() => {
|
|
|
16675
16692
|
to: "\u2192",
|
|
16676
16693
|
downarrow: "\u2193",
|
|
16677
16694
|
leftrightarrow: "\u2194",
|
|
16695
|
+
updownarrow: "\u2195",
|
|
16678
16696
|
therefore: "\u2234",
|
|
16679
16697
|
because: "\u2235",
|
|
16680
16698
|
"+": "+",
|
|
@@ -16791,7 +16809,7 @@ var FormulaX = (() => {
|
|
|
16791
16809
|
Uparrow: "\u21D1",
|
|
16792
16810
|
Downarrow: "\u21D3",
|
|
16793
16811
|
Leftrightarrow: "\u21D4",
|
|
16794
|
-
Updownarrow: "\
|
|
16812
|
+
Updownarrow: "\u21D5",
|
|
16795
16813
|
longleftarrow: "\u27F5",
|
|
16796
16814
|
longrightarrow: "\u27F6",
|
|
16797
16815
|
longleftrightarrow: "\u27F7",
|
|
@@ -16859,16 +16877,7 @@ var FormulaX = (() => {
|
|
|
16859
16877
|
Object.keys(list).forEach((key) => callback(list[key], key));
|
|
16860
16878
|
}
|
|
16861
16879
|
function translateToolbarText(value, locale) {
|
|
16862
|
-
|
|
16863
|
-
return value;
|
|
16864
|
-
}
|
|
16865
|
-
const normalizedValue = value.replace(/<br\s*\/?>/gi, "").trim();
|
|
16866
|
-
const translatedValue = zhCnToEnUsText.get(normalizedValue);
|
|
16867
|
-
if (!translatedValue) {
|
|
16868
|
-
return value;
|
|
16869
|
-
}
|
|
16870
|
-
const lineBreakMatch = value.match(/<br\s*\/?>/i);
|
|
16871
|
-
return lineBreakMatch ? `${translatedValue}${lineBreakMatch[0]}` : translatedValue;
|
|
16880
|
+
return translateFormulaXText("toolbar", value, locale);
|
|
16872
16881
|
}
|
|
16873
16882
|
function localizeToolbarConfig(value, locale) {
|
|
16874
16883
|
if (Array.isArray(value)) {
|
|
@@ -16912,7 +16921,7 @@ var FormulaX = (() => {
|
|
|
16912
16921
|
normalizeFormulaXLocale(locale)
|
|
16913
16922
|
);
|
|
16914
16923
|
}
|
|
16915
|
-
var UI_ELE_TYPE, BOX_TYPE2, OTHER_POSITION,
|
|
16924
|
+
var UI_ELE_TYPE, BOX_TYPE2, OTHER_POSITION, baseToolbarConfig, toolbar_config_default;
|
|
16916
16925
|
var init_toolbar_config = __esm({
|
|
16917
16926
|
"../kity-runtime/src/legacy/toolbar-config.ts"() {
|
|
16918
16927
|
"use strict";
|
|
@@ -16925,40 +16934,6 @@ var FormulaX = (() => {
|
|
|
16925
16934
|
UI_ELE_TYPE = legacyEleType;
|
|
16926
16935
|
BOX_TYPE2 = legacyBoxType;
|
|
16927
16936
|
OTHER_POSITION = legacyOtherPosition;
|
|
16928
|
-
zhCnToEnUsText = /* @__PURE__ */ new Map([
|
|
16929
|
-
["\u9884\u8BBE", "Presets"],
|
|
16930
|
-
["\u9884\u8BBE\u516C\u5F0F", "Preset formulas"],
|
|
16931
|
-
["\u4E8C\u6B21\u516C\u5F0F", "Quadratic formula"],
|
|
16932
|
-
["\u4E8C\u9879\u5F0F\u5B9A\u7406", "Binomial theorem"],
|
|
16933
|
-
["\u52FE\u80A1\u5B9A\u7406", "Pythagorean theorem"],
|
|
16934
|
-
["\u57FA\u7840\u6570\u5B66", "Basic math"],
|
|
16935
|
-
["\u5E0C\u814A\u5B57\u6BCD", "Greek letters"],
|
|
16936
|
-
["\u6C42\u53CD\u5173\u7CFB\u8FD0\u7B97\u7B26", "Negated operators"],
|
|
16937
|
-
["\u5B57\u6BCD\u7C7B\u7B26\u53F7", "Letter-like symbols"],
|
|
16938
|
-
["\u7BAD\u5934", "Arrows"],
|
|
16939
|
-
["\u624B\u5199\u4F53", "Script"],
|
|
16940
|
-
["\u5206\u6570", "Fraction"],
|
|
16941
|
-
["\u5E38\u7528\u5206\u6570", "Common fractions"],
|
|
16942
|
-
["\u4E0A\u4E0B\u6807", "Scripts"],
|
|
16943
|
-
["\u4E0A\u6807\u548C\u4E0B\u6807", "Superscripts and subscripts"],
|
|
16944
|
-
["\u5E38\u7528\u7684\u4E0A\u6807\u548C\u4E0B\u6807", "Common superscripts and subscripts"],
|
|
16945
|
-
["\u6839\u5F0F", "Radicals"],
|
|
16946
|
-
["\u5E38\u7528\u6839\u5F0F", "Common radicals"],
|
|
16947
|
-
["\u79EF\u5206", "Integrals"],
|
|
16948
|
-
["\u5927\u578B\u8FD0\u7B97\u7B26", "Large operators"],
|
|
16949
|
-
["\u6C42\u548C", "Summations"],
|
|
16950
|
-
["\u62EC\u53F7", "Brackets"],
|
|
16951
|
-
["\u65B9\u62EC\u53F7", "Brackets"],
|
|
16952
|
-
["\u51FD\u6570", "Functions"],
|
|
16953
|
-
["\u4E09\u89D2\u51FD\u6570", "Trigonometric functions"],
|
|
16954
|
-
["\u5E38\u7528\u51FD\u6570", "Common functions"],
|
|
16955
|
-
["\u5C0F\u5199", "Lowercase"],
|
|
16956
|
-
["\u5927\u5199", "Uppercase"],
|
|
16957
|
-
["\u53D8\u4F53", "Variants"],
|
|
16958
|
-
["\u82B1\u4F53", "Fraktur"],
|
|
16959
|
-
["\u53CC\u7EBF", "Double-struck"],
|
|
16960
|
-
["\u7F57\u9A6C", "Roman"]
|
|
16961
|
-
]);
|
|
16962
16937
|
baseToolbarConfig = [{
|
|
16963
16938
|
type: UI_ELE_TYPE.DRAPDOWN_BOX,
|
|
16964
16939
|
options: {
|
|
@@ -18189,6 +18164,9 @@ var FormulaX = (() => {
|
|
|
18189
18164
|
operand: []
|
|
18190
18165
|
};
|
|
18191
18166
|
}
|
|
18167
|
+
function getRootPlaceholderText() {
|
|
18168
|
+
return legacySysconf.rootPlaceholder.content;
|
|
18169
|
+
}
|
|
18192
18170
|
function processRootGroup(parser, tree) {
|
|
18193
18171
|
if (!parser.isResetId) {
|
|
18194
18172
|
tree.attr["data-type"] = legacyGroupType.VIRTUAL;
|
|
@@ -18236,7 +18214,7 @@ var FormulaX = (() => {
|
|
|
18236
18214
|
if (isRoot) {
|
|
18237
18215
|
processRootGroup(parser, tree);
|
|
18238
18216
|
} else if (parentTree?.attr?.["data-root"] && tree.name === "placeholder" && onlyPlaceholder(parentTree.operand)) {
|
|
18239
|
-
tree.attr.label =
|
|
18217
|
+
tree.attr.label = getRootPlaceholderText();
|
|
18240
18218
|
}
|
|
18241
18219
|
for (let i2 = 0; i2 < tree.operand.length; i2 += 1) {
|
|
18242
18220
|
const currentOperand = tree.operand[i2];
|
|
@@ -18248,7 +18226,7 @@ var FormulaX = (() => {
|
|
|
18248
18226
|
}
|
|
18249
18227
|
return tree;
|
|
18250
18228
|
}
|
|
18251
|
-
var CURSOR_CHAR,
|
|
18229
|
+
var CURSOR_CHAR, COMBINATION_NAME, PID_PREFIX, pidSeed, kity14, kf5, BaseComponent, Parser, parser_default;
|
|
18252
18230
|
var init_parser = __esm({
|
|
18253
18231
|
"../kity-runtime/src/legacy/parser.ts"() {
|
|
18254
18232
|
"use strict";
|
|
@@ -18259,7 +18237,6 @@ var FormulaX = (() => {
|
|
|
18259
18237
|
init_kf_ext_extension();
|
|
18260
18238
|
init_vgroup_def();
|
|
18261
18239
|
CURSOR_CHAR = legacySysconf.cursorCharacter;
|
|
18262
|
-
ROOT_P_TEXT = legacySysconf.rootPlaceholder.content;
|
|
18263
18240
|
COMBINATION_NAME = "combination";
|
|
18264
18241
|
PID_PREFIX = "_kf_editor_";
|
|
18265
18242
|
pidSeed = 0;
|
|
@@ -20139,26 +20116,26 @@ var FormulaX = (() => {
|
|
|
20139
20116
|
var start_exports = {};
|
|
20140
20117
|
__export(start_exports, {
|
|
20141
20118
|
Factory: () => factory_default,
|
|
20142
|
-
KFEditor: () =>
|
|
20119
|
+
KFEditor: () => editor_default,
|
|
20143
20120
|
default: () => start_default,
|
|
20144
20121
|
installKityEditorStart: () => installKityEditorStart
|
|
20145
20122
|
});
|
|
20146
20123
|
function installKityEditorStart(target = window) {
|
|
20147
20124
|
const runtimeTarget = target;
|
|
20148
20125
|
if (!installed3) {
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20126
|
+
editor_default.registerComponents("ui", ui_default);
|
|
20127
|
+
editor_default.registerComponents("parser", parser_default);
|
|
20128
|
+
editor_default.registerComponents("render", render_default);
|
|
20129
|
+
editor_default.registerComponents("position", position_default);
|
|
20130
|
+
editor_default.registerComponents("syntax", syntax_default);
|
|
20131
|
+
editor_default.registerComponents("control", controller_default);
|
|
20132
|
+
editor_default.registerComponents("print", printer_default);
|
|
20156
20133
|
installed3 = true;
|
|
20157
20134
|
}
|
|
20158
20135
|
runtimeTarget.kf = runtimeTarget.kf ?? {};
|
|
20159
20136
|
runtimeTarget.kf.EditorFactory = factory_default;
|
|
20160
20137
|
return {
|
|
20161
|
-
KFEditor:
|
|
20138
|
+
KFEditor: editor_default,
|
|
20162
20139
|
Factory: factory_default
|
|
20163
20140
|
};
|
|
20164
20141
|
}
|
|
@@ -20166,7 +20143,7 @@ var FormulaX = (() => {
|
|
|
20166
20143
|
var init_start = __esm({
|
|
20167
20144
|
"../kity-runtime/src/boot/start.ts"() {
|
|
20168
20145
|
"use strict";
|
|
20169
|
-
|
|
20146
|
+
init_editor();
|
|
20170
20147
|
init_factory();
|
|
20171
20148
|
init_ui();
|
|
20172
20149
|
init_parser();
|
|
@@ -20199,7 +20176,7 @@ var FormulaX = (() => {
|
|
|
20199
20176
|
fontSize: input.fontSize,
|
|
20200
20177
|
displayMode: input.displayMode,
|
|
20201
20178
|
className: input.className,
|
|
20202
|
-
|
|
20179
|
+
assetCacheKey: input.assetCacheKey
|
|
20203
20180
|
});
|
|
20204
20181
|
}
|
|
20205
20182
|
|
|
@@ -24104,6 +24081,7 @@ var FormulaX = (() => {
|
|
|
24104
24081
|
const locale = normalizeFormulaXLocale(options.locale ?? DEFAULT_FORMULAX_LOCALE);
|
|
24105
24082
|
const assets = resolveEditorAssets(options.assets);
|
|
24106
24083
|
try {
|
|
24084
|
+
legacySysconf.rootPlaceholder.content = getFormulaXRuntimeMessage("editor.placeholder.root", locale);
|
|
24107
24085
|
const stylesheetInserted = ensureKityStylesheet(document, assets.styles.editor);
|
|
24108
24086
|
if (stylesheetInserted) {
|
|
24109
24087
|
const stylesheetInsertedMark = markFormulaXPerf("fx:kity-css:link-inserted");
|
|
@@ -24317,7 +24295,7 @@ var FormulaX = (() => {
|
|
|
24317
24295
|
}
|
|
24318
24296
|
function renderLatexToSvgMarkup(latex, options = {}) {
|
|
24319
24297
|
const normalizedLatex = latex.trim();
|
|
24320
|
-
const shouldUseCache = options.cache !== false && !(hasCustomAssetOverrides(options.assets) && !options.
|
|
24298
|
+
const shouldUseCache = options.cache !== false && !(hasCustomAssetOverrides(options.assets) && !options.assetCacheKey);
|
|
24321
24299
|
if (!normalizedLatex) {
|
|
24322
24300
|
return Promise.resolve({
|
|
24323
24301
|
engine: "kity",
|
|
@@ -24333,7 +24311,7 @@ var FormulaX = (() => {
|
|
|
24333
24311
|
fontSize: options.fontSize,
|
|
24334
24312
|
displayMode: options.displayMode,
|
|
24335
24313
|
className: options.className,
|
|
24336
|
-
|
|
24314
|
+
assetCacheKey: options.assetCacheKey
|
|
24337
24315
|
});
|
|
24338
24316
|
if (shouldUseCache) {
|
|
24339
24317
|
const cached = renderCache.get(cacheKey);
|