@formulaxjs/kity-runtime 0.1.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/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 FormulaX Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Legacy KityFormula Code
26
+
27
+ Portions of FormulaX, specifically within the `@formulaxjs/kity-runtime` package,
28
+ contain code adapted from [KityFormula](https://github.com/BaiduFE/kityformula)
29
+ by Baidu FEX Team, originally released under the MIT License.
30
+
31
+ KityFormula-related code in FormulaX is retained under the same MIT License
32
+ and is subject to the copyright notice above.
33
+
34
+ For details on the original KityFormula project, see:
35
+ https://github.com/BaiduFE/kityformula
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @formulaxjs/kity-runtime
2
+
3
+ Legacy KityFormula runtime adapter for FormulaX.
4
+
5
+ `@formulaxjs/kity-runtime` packages the compatibility runtime that powers FormulaX's Kity-based editing and rendering flows. It wires legacy runtime code to the modern asset pipeline and provides helpers for mounting the editor in browser applications.
6
+
7
+ > Status: experimental. Public APIs may change before the first stable release.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @formulaxjs/kity-runtime @formulaxjs/kity-assets
13
+ ```
14
+
15
+ ## Highlights
16
+
17
+ - `ensureKityRuntime` for lazy runtime bootstrapping
18
+ - `createKityEditor` and `mountKityEditor` for mounting a Kity editor into the DOM
19
+ - `FormulaXEditor` as a small wrapper around the mounted runtime
20
+ - Legacy compatibility exports used by existing KityFormula-oriented integrations
21
+
22
+ ## Example
23
+
24
+ ```ts
25
+ import { mountKityEditor } from '@formulaxjs/kity-runtime';
26
+
27
+ const root = document.getElementById('editor');
28
+
29
+ if (!root) {
30
+ throw new Error('Missing #editor');
31
+ }
32
+
33
+ const handle = await mountKityEditor(root, {
34
+ value: 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}',
35
+ });
36
+
37
+ console.log(handle.getLatex());
38
+ ```
39
+
40
+ ## Package role
41
+
42
+ Use this package when you need the legacy Kity editing experience or compatibility with historical KityFormula behavior. For host-editor integrations, prefer the dedicated adapter packages that already depend on this runtime.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file