@simonklee/opentui-tex 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -47
- package/dist/backend.d.ts +6 -0
- package/dist/chunk-gbwc618x.js +1797 -0
- package/dist/chunk-qz8qag2e.js +119 -0
- package/dist/chunk-v0bahtg2.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -1373
- package/dist/math-graphemes.d.ts +1 -0
- package/dist/math-layout.d.ts +5 -1
- package/dist/math-parser.d.ts +5 -2
- package/dist/math-types.d.ts +26 -2
- package/dist/native.js +5 -4
- package/dist/react.js +8 -1488
- package/dist/solid.js +8 -1488
- package/dist/tex-renderable.d.ts +5 -1
- package/docs/native.md +14 -0
- package/docs/releasing.md +51 -11
- package/package.json +17 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const graphemeSegmenter: Intl.Segmenter;
|
package/dist/math-layout.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { MathBox, MathNode } from "./math-types.js";
|
|
2
|
+
import type { TexTextSpan } from "./backend.js";
|
|
2
3
|
export declare function layoutMath(node: MathNode, displayMode: boolean): MathBox;
|
|
3
|
-
export declare function
|
|
4
|
+
export declare function boxToOutput(box: MathBox, widthMax: number, heightMax: number): {
|
|
5
|
+
text: string;
|
|
6
|
+
spans?: TexTextSpan[];
|
|
7
|
+
};
|
package/dist/math-parser.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { MathNode } from "./math-types.js";
|
|
2
2
|
export declare const MAX_NESTING_DEPTH = 256;
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export interface MathParseOptions {
|
|
4
|
+
strict?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseMath(source: string, options?: MathParseOptions): MathNode;
|
|
7
|
+
export declare function parseMathIncomplete(source: string, options?: MathParseOptions): MathNode;
|
package/dist/math-types.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export type SymbolRole = "ordinary" | "binary" | "relation" | "operator" | "punctuation" | "opening" | "closing";
|
|
2
2
|
export type MathEnvironment = "matrix" | "pmatrix" | "bmatrix" | "Bmatrix" | "vmatrix" | "Vmatrix" | "cases" | "aligned" | "align" | "gathered" | "gather" | "smallmatrix" | "array";
|
|
3
3
|
export type AccentKind = "hat" | "widehat" | "bar" | "overline" | "underline" | "vec" | "tilde" | "dot" | "ddot";
|
|
4
|
+
export type MathVariant = "normal" | "bold" | "italic" | "sans" | "monospace" | "double-struck" | "script" | "fraktur";
|
|
5
|
+
export interface MathStyle {
|
|
6
|
+
color?: string;
|
|
7
|
+
bold?: boolean;
|
|
8
|
+
italic?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface MathCell {
|
|
11
|
+
char: string;
|
|
12
|
+
style?: MathStyle;
|
|
13
|
+
}
|
|
4
14
|
export type MathNode = {
|
|
5
15
|
type: "row";
|
|
6
16
|
body: MathNode[];
|
|
@@ -19,6 +29,7 @@ export type MathNode = {
|
|
|
19
29
|
numerator: MathNode;
|
|
20
30
|
denominator: MathNode;
|
|
21
31
|
bar: boolean;
|
|
32
|
+
numeratorAlign?: "left" | "right";
|
|
22
33
|
} | {
|
|
23
34
|
type: "root";
|
|
24
35
|
body: MathNode;
|
|
@@ -37,14 +48,27 @@ export type MathNode = {
|
|
|
37
48
|
type: "matrix";
|
|
38
49
|
rows: MathNode[][];
|
|
39
50
|
environment: MathEnvironment;
|
|
51
|
+
columns?: string;
|
|
40
52
|
} | {
|
|
41
53
|
type: "accent";
|
|
42
54
|
accent: AccentKind;
|
|
43
55
|
body: MathNode;
|
|
56
|
+
} | {
|
|
57
|
+
type: "brace";
|
|
58
|
+
body: MathNode;
|
|
59
|
+
position: "over" | "under";
|
|
60
|
+
} | {
|
|
61
|
+
type: "variant";
|
|
62
|
+
variant: MathVariant;
|
|
63
|
+
body: MathNode;
|
|
64
|
+
} | {
|
|
65
|
+
type: "color";
|
|
66
|
+
color: string;
|
|
67
|
+
body: MathNode;
|
|
44
68
|
} | {
|
|
45
69
|
type: "operator";
|
|
46
70
|
value: string;
|
|
47
|
-
limits: boolean;
|
|
71
|
+
limits: boolean | "display";
|
|
48
72
|
} | {
|
|
49
73
|
type: "overunder";
|
|
50
74
|
base: MathNode;
|
|
@@ -55,5 +79,5 @@ export interface MathBox {
|
|
|
55
79
|
width: number;
|
|
56
80
|
height: number;
|
|
57
81
|
baseline: number;
|
|
58
|
-
cells: Array<Array<
|
|
82
|
+
cells: Array<Array<MathCell | undefined>>;
|
|
59
83
|
}
|
package/dist/native.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./chunk-v0bahtg2.js";
|
|
3
4
|
|
|
4
5
|
// src/native/native-renderer.ts
|
|
5
6
|
import { isMainThread } from "node:worker_threads";
|
|
6
7
|
import { NativeImage } from "@opentui/core";
|
|
7
8
|
|
|
8
9
|
// src/native/ffi.ts
|
|
9
|
-
import { createRequire
|
|
10
|
-
var require2 =
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
|
+
var require2 = createRequire(import.meta.url);
|
|
11
12
|
function openNativeLibrary(path) {
|
|
12
13
|
if (globalThis.Bun) {
|
|
13
14
|
const ffi2 = require2("bun:ffi");
|