@simonklee/opentui-tex 0.3.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 +87 -46
- package/dist/backend.d.ts +6 -0
- package/dist/{chunk-pgj24z8a.js → chunk-gbwc618x.js} +520 -157
- package/dist/{chunk-k9sn9j1p.js → chunk-qz8qag2e.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/math-layout.d.ts +5 -1
- package/dist/math-parser.d.ts +5 -2
- package/dist/math-types.d.ts +25 -1
- package/dist/react.js +2 -2
- package/dist/solid.js +2 -2
- package/dist/tex-renderable.d.ts +2 -0
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { TexBackend, TexRenderOutput, TexRenderRequest, } from "./backend.js";
|
|
1
|
+
export type { TexBackend, TexRenderOutput, TexRenderRequest, TexTextSpan, } from "./backend.js";
|
|
2
2
|
export { measureTex, TexRenderable } from "./tex-renderable.js";
|
|
3
3
|
export type { TexDimensions, TexFallback, TexRenderableOptions } from "./tex-renderable.js";
|
|
4
4
|
export { UnicodeTexBackend } from "./unicode-tex-backend.js";
|
package/dist/index.js
CHANGED
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,10 +48,23 @@ 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;
|
|
@@ -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/react.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BindingTexRenderable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-qz8qag2e.js";
|
|
4
4
|
import {
|
|
5
5
|
TexRenderable,
|
|
6
6
|
UnicodeTexBackend,
|
|
7
7
|
measureTex
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-gbwc618x.js";
|
|
9
9
|
import"./chunk-v0bahtg2.js";
|
|
10
10
|
|
|
11
11
|
// src/react.ts
|
package/dist/solid.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BindingTexRenderable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-qz8qag2e.js";
|
|
4
4
|
import {
|
|
5
5
|
TexRenderable,
|
|
6
6
|
UnicodeTexBackend,
|
|
7
7
|
measureTex
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-gbwc618x.js";
|
|
9
9
|
import"./chunk-v0bahtg2.js";
|
|
10
10
|
|
|
11
11
|
// src/solid.ts
|
package/dist/tex-renderable.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface TexRenderableOptions extends BoxOptions {
|
|
|
14
14
|
imageOptions?: Omit<ImageRenderableOptions, "source" | "width" | "height">;
|
|
15
15
|
onError?: (error: unknown) => void;
|
|
16
16
|
streaming?: boolean;
|
|
17
|
+
strict?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export interface TexDimensions {
|
|
19
20
|
columns: number;
|
|
@@ -28,6 +29,7 @@ export declare class TexRenderable extends BoxRenderable {
|
|
|
28
29
|
ready: Promise<void>;
|
|
29
30
|
private readonly backend;
|
|
30
31
|
private readonly fallback;
|
|
32
|
+
private readonly strict;
|
|
31
33
|
private readonly widthMax;
|
|
32
34
|
private readonly heightMax;
|
|
33
35
|
private autoWidth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonklee/opentui-tex",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "TeX renderable with Unicode and native image backends for OpenTUI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"packageManager": "bun@1.3.14",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dev": "bun demo/app.ts",
|
|
53
53
|
"start": "bun demo/app.ts",
|
|
54
54
|
"start:node": "bun run build:demo:node && node --permission --allow-fs-read=.. --allow-child-process --allow-worker --allow-ffi --experimental-ffi dist/app.node.js",
|
|
55
|
-
"test": "bun test src/document.test.ts src/tex-renderable.test.ts src/unicode-tex-backend.test.ts scripts/release.test.ts",
|
|
55
|
+
"test": "bun test src/document.test.ts src/tex-renderable.test.ts src/unicode-tex-backend.test.ts src/math-parser.test.ts src/math-layout.test.ts scripts/release.test.ts",
|
|
56
56
|
"test:native": "bun run build:native && bun run test:native:zig && bun test src/native",
|
|
57
57
|
"test:native:zig": "bash scripts/bootstrap-native && zig build test",
|
|
58
58
|
"test:release": "bun scripts/test-release.ts",
|
|
@@ -88,14 +88,14 @@
|
|
|
88
88
|
"typescript": "^5"
|
|
89
89
|
},
|
|
90
90
|
"optionalDependencies": {
|
|
91
|
-
"@simonklee/opentui-tex-native-darwin-arm64": "0.3.
|
|
92
|
-
"@simonklee/opentui-tex-native-darwin-x64": "0.3.
|
|
93
|
-
"@simonklee/opentui-tex-native-linux-arm64": "0.3.
|
|
94
|
-
"@simonklee/opentui-tex-native-linux-arm64-musl": "0.3.
|
|
95
|
-
"@simonklee/opentui-tex-native-linux-x64": "0.3.
|
|
96
|
-
"@simonklee/opentui-tex-native-linux-x64-musl": "0.3.
|
|
97
|
-
"@simonklee/opentui-tex-native-win32-arm64": "0.3.
|
|
98
|
-
"@simonklee/opentui-tex-native-win32-x64": "0.3.
|
|
91
|
+
"@simonklee/opentui-tex-native-darwin-arm64": "0.3.1",
|
|
92
|
+
"@simonklee/opentui-tex-native-darwin-x64": "0.3.1",
|
|
93
|
+
"@simonklee/opentui-tex-native-linux-arm64": "0.3.1",
|
|
94
|
+
"@simonklee/opentui-tex-native-linux-arm64-musl": "0.3.1",
|
|
95
|
+
"@simonklee/opentui-tex-native-linux-x64": "0.3.1",
|
|
96
|
+
"@simonklee/opentui-tex-native-linux-x64-musl": "0.3.1",
|
|
97
|
+
"@simonklee/opentui-tex-native-win32-arm64": "0.3.1",
|
|
98
|
+
"@simonklee/opentui-tex-native-win32-x64": "0.3.1"
|
|
99
99
|
},
|
|
100
100
|
"publishConfig": {
|
|
101
101
|
"access": "public",
|