@simon_he/vue-tui 1.1.3 → 1.1.5

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.
Files changed (52) hide show
  1. package/README.md +18 -18
  2. package/dist/{TMermaidText-frVr8Ysb.js → TMermaidText-wLnMMvVS.js} +1 -1
  3. package/dist/{TSelect-Dx34M1pF.js → TSelect-CMBOOFwK.js} +5 -5
  4. package/dist/{TTree-DdAjCPHu.js → TTree-kk8ntrpg.js} +6 -5
  5. package/dist/agent/mermaid.d.cts +2 -2
  6. package/dist/agent/mermaid.d.ts +2 -2
  7. package/dist/agent.cjs +542 -266
  8. package/dist/agent.js +25 -82
  9. package/dist/{block-source-Crro3mxi.js → block-source-DhzajB9H.js} +299 -239
  10. package/dist/cli.cjs +57 -16
  11. package/dist/cli.js +70 -15
  12. package/dist/core.js +3 -3
  13. package/dist/{hyperlink-_1FAj7Wq.js → create-terminal-Db_-UGVQ.js} +474 -102
  14. package/dist/{dom-renderer-DXx8fWzD.js → dom-renderer-BfwAEQMf.js} +3 -2
  15. package/dist/experimental.cjs +103 -66
  16. package/dist/experimental.js +20 -74
  17. package/dist/hyperlink-clbb_ha_.js +100 -0
  18. package/dist/index.js +8 -8
  19. package/dist/{linkify-BjI4zVfY.js → linkify-CL9wwnZN.js} +3 -3
  20. package/dist/markdown.cjs +521 -212
  21. package/dist/markdown.d.cts +3 -0
  22. package/dist/markdown.d.ts +3 -0
  23. package/dist/markdown.js +75 -8
  24. package/dist/math-image-BZhmfUeu.js +308 -0
  25. package/dist/mermaid-N3kGTHFy.js +1697 -0
  26. package/dist/mermaid.cjs +1460 -6
  27. package/dist/mermaid.d.cts +4 -0
  28. package/dist/mermaid.d.ts +4 -0
  29. package/dist/mermaid.js +7 -5
  30. package/dist/{rect-DUpeDfBg.js → rect-JzWMJxxc.js} +1 -1
  31. package/dist/renderer/cli/stdout-renderer.d.ts +44 -0
  32. package/dist/renderer/terminal-graphics.d.ts +61 -0
  33. package/dist/renderer-dom.js +4 -4
  34. package/dist/{terminal-graphics-Bbe83wSr.js → terminal-graphics-2FTRg9x3.js} +90 -2
  35. package/dist/{tlog-theme-i6S_Oftd.js → tlog-theme-B91Wv7Zj.js} +5 -4
  36. package/dist/vue/components/TAgentTerminalGraphic.d.ts +1 -1
  37. package/dist/vue/components/TMarkdownText.d.ts +70 -2
  38. package/dist/vue/components/TMermaidImage.d.ts +920 -0
  39. package/dist/vue/components/TMermaidText.d.ts +2 -2
  40. package/dist/vue/components/TVirtualMarkdown.d.ts +70 -2
  41. package/dist/vue/markdown/ast.d.ts +5 -0
  42. package/dist/vue/markdown/document.d.ts +3 -0
  43. package/dist/vue/markdown/math-image.d.ts +68 -0
  44. package/dist/vue/markdown/theme.d.ts +12 -0
  45. package/dist/vue/markdown/types.d.ts +12 -2
  46. package/dist/vue/mermaid/beautiful-mermaid.d.ts +284 -240
  47. package/dist/vue/mermaid/mermaid-image.d.ts +73 -0
  48. package/dist/vue.js +9 -9
  49. package/package.json +24 -10
  50. package/dist/mermaid-BNhM1jAZ.js +0 -123
  51. package/dist/width-GqllnV8C.js +0 -474
  52. /package/dist/{ansi-palette-CH6jc2Z7.js → ansi-palette-BHF1rN7R.js} +0 -0
@@ -522,10 +522,10 @@ export declare const TMermaidText: import("vue").DefineComponent<import("vue").E
522
522
  }>;
523
523
  readonly final: boolean;
524
524
  readonly streaming: boolean;
525
+ readonly ascii: boolean;
525
526
  readonly paddingX: number;
526
527
  readonly paddingY: number;
527
528
  readonly boxBorderPadding: number;
528
- readonly ascii: boolean;
529
529
  readonly isTransientError: TMermaidTransientErrorClassifier;
530
530
  readonly shouldRenderSource: TMermaidRenderEligibility;
531
531
  readonly incompleteText: string;
@@ -880,10 +880,10 @@ export declare const TMermaid: import("vue").DefineComponent<import("vue").Extra
880
880
  }>;
881
881
  readonly final: boolean;
882
882
  readonly streaming: boolean;
883
+ readonly ascii: boolean;
883
884
  readonly paddingX: number;
884
885
  readonly paddingY: number;
885
886
  readonly boxBorderPadding: number;
886
- readonly ascii: boolean;
887
887
  readonly isTransientError: TMermaidTransientErrorClassifier;
888
888
  readonly shouldRenderSource: TMermaidRenderEligibility;
889
889
  readonly incompleteText: string;
@@ -88,6 +88,34 @@ export declare const TVirtualMarkdown: import("vue").DefineComponent<import("vue
88
88
  type: BooleanConstructor;
89
89
  default: boolean;
90
90
  };
91
+ mathImages: {
92
+ type: BooleanConstructor;
93
+ default: boolean;
94
+ };
95
+ mathCellWidthPx: {
96
+ type: NumberConstructor;
97
+ default: undefined;
98
+ };
99
+ mathCellHeightPx: {
100
+ type: NumberConstructor;
101
+ default: undefined;
102
+ };
103
+ mathScale: {
104
+ type: NumberConstructor;
105
+ default: undefined;
106
+ };
107
+ mathColor: {
108
+ type: StringConstructor;
109
+ default: undefined;
110
+ };
111
+ mathMaxWidthCells: {
112
+ type: NumberConstructor;
113
+ default: undefined;
114
+ };
115
+ mathBaselineRatio: {
116
+ type: NumberConstructor;
117
+ default: undefined;
118
+ };
91
119
  imageActions: {
92
120
  type: BooleanConstructor;
93
121
  default: boolean;
@@ -200,6 +228,34 @@ export declare const TVirtualMarkdown: import("vue").DefineComponent<import("vue
200
228
  type: BooleanConstructor;
201
229
  default: boolean;
202
230
  };
231
+ mathImages: {
232
+ type: BooleanConstructor;
233
+ default: boolean;
234
+ };
235
+ mathCellWidthPx: {
236
+ type: NumberConstructor;
237
+ default: undefined;
238
+ };
239
+ mathCellHeightPx: {
240
+ type: NumberConstructor;
241
+ default: undefined;
242
+ };
243
+ mathScale: {
244
+ type: NumberConstructor;
245
+ default: undefined;
246
+ };
247
+ mathColor: {
248
+ type: StringConstructor;
249
+ default: undefined;
250
+ };
251
+ mathMaxWidthCells: {
252
+ type: NumberConstructor;
253
+ default: undefined;
254
+ };
255
+ mathBaselineRatio: {
256
+ type: NumberConstructor;
257
+ default: undefined;
258
+ };
203
259
  imageActions: {
204
260
  type: BooleanConstructor;
205
261
  default: boolean;
@@ -227,6 +283,8 @@ export declare const TVirtualMarkdown: import("vue").DefineComponent<import("vue
227
283
  source: string;
228
284
  raw: string;
229
285
  rendered: boolean;
286
+ pendingImage?: boolean;
287
+ mode?: "inline" | "display";
230
288
  }>;
231
289
  rect: Readonly<{
232
290
  x: number;
@@ -241,9 +299,11 @@ export declare const TVirtualMarkdown: import("vue").DefineComponent<import("vue
241
299
  }>) => any) | undefined;
242
300
  onImageAction?: ((_payload: Readonly<{
243
301
  image: Readonly<{
244
- kind: "image";
245
- src: string;
302
+ kind: "image" | "math";
303
+ src?: string;
246
304
  alt?: string;
305
+ tex?: string;
306
+ raw?: string;
247
307
  mime?: string;
248
308
  base64?: string;
249
309
  originalBase64?: string;
@@ -309,6 +369,7 @@ export declare const TVirtualMarkdown: import("vue").DefineComponent<import("vue
309
369
  codeBlock: Partial<Style>;
310
370
  thematicBreak: Partial<Style>;
311
371
  html: Partial<Style>;
372
+ math: Partial<Style>;
312
373
  }>>;
313
374
  blocks: readonly TuiMarkdownBlock[];
314
375
  imageRenderer: TuiMarkdownImageResolver;
@@ -317,6 +378,13 @@ export declare const TVirtualMarkdown: import("vue").DefineComponent<import("vue
317
378
  imageMinHeight: number;
318
379
  imageMaxHeight: number;
319
380
  imagePreserveAspectRatio: boolean;
381
+ mathImages: boolean;
382
+ mathCellWidthPx: number;
383
+ mathCellHeightPx: number;
384
+ mathScale: number;
385
+ mathColor: string;
386
+ mathMaxWidthCells: number;
387
+ mathBaselineRatio: number;
320
388
  imageActions: boolean;
321
389
  mathActions: boolean;
322
390
  linkActions: boolean;
@@ -1,6 +1,11 @@
1
+ import { type TuiMarkdownMathImageOptions } from "./math-image.js";
1
2
  import { type TuiMarkdownTheme } from "./theme.js";
2
3
  import type { TuiMarkdownBlock, TuiMarkdownImageResolver, TuiMarkdownImageSize, TuiMarkdownNode } from "./types.js";
4
+ export type TuiMarkdownMathOptions = Readonly<{
5
+ enabled?: boolean;
6
+ } & TuiMarkdownMathImageOptions>;
3
7
  export declare function markdownAstToBlocks(nodes: readonly TuiMarkdownNode[], theme: TuiMarkdownTheme, options?: Readonly<{
4
8
  imageResolver?: TuiMarkdownImageResolver;
5
9
  imageSize?: TuiMarkdownImageSize;
10
+ math?: TuiMarkdownMathOptions;
6
11
  }>): readonly TuiMarkdownBlock[];
@@ -1,4 +1,5 @@
1
1
  import type { TuiMarkdownImageResolver, TuiMarkdownImageSize } from "./types.js";
2
+ import { type TuiMarkdownMathOptions } from "./ast.js";
2
3
  import { type TuiMarkdownParser } from "./parser.js";
3
4
  import { type TuiMarkdownThemeOverrides } from "./theme.js";
4
5
  import type { TuiMarkdownBlock, TuiMarkdownNode, TuiMarkdownVisualRow } from "./types.js";
@@ -12,6 +13,7 @@ export declare function buildMarkdownBlocks(content: string, parser: TuiMarkdown
12
13
  theme?: TuiMarkdownThemeOverrides;
13
14
  imageResolver?: TuiMarkdownImageResolver;
14
15
  imageSize?: TuiMarkdownImageSize;
16
+ math?: TuiMarkdownMathOptions;
15
17
  }>): Readonly<{
16
18
  nodes: readonly TuiMarkdownNode[];
17
19
  blocks: readonly TuiMarkdownBlock[];
@@ -22,4 +24,5 @@ export declare function buildMarkdownVisualRows(content: string, width: number,
22
24
  widthProvider?: WidthProvider;
23
25
  imageResolver?: TuiMarkdownImageResolver;
24
26
  imageSize?: TuiMarkdownImageSize;
27
+ math?: TuiMarkdownMathOptions;
25
28
  }>): readonly TuiMarkdownVisualRow[];
@@ -0,0 +1,68 @@
1
+ import type { TuiMarkdownVisualRow } from "./types.js";
2
+ export type TuiMarkdownMathMode = "inline" | "display";
3
+ export type TuiMarkdownMathImageCells = Readonly<{
4
+ base64: string;
5
+ widthCells: number;
6
+ heightCells: number;
7
+ }>;
8
+ export type TuiMarkdownMathImageOptions = Readonly<{
9
+ cellWidthPx?: number;
10
+ cellHeightPx?: number;
11
+ scale?: number;
12
+ color?: string;
13
+ maxWidthCells?: number;
14
+ /**
15
+ * Vertical position of the text baseline inside a terminal cell, as a
16
+ * fraction of the cell height (0 = top, 1 = bottom). Inline formula images
17
+ * are padded so their baseline lands here. Defaults to 0.78.
18
+ */
19
+ baselineRatio?: number;
20
+ }>;
21
+ export type TuiMarkdownMathRasterizer = (tex: string, mode: TuiMarkdownMathMode, options: Required<TuiMarkdownMathImageOptions>) => Promise<TuiMarkdownMathImageCells | null>;
22
+ type RequiredMathImageOptions = Required<TuiMarkdownMathImageOptions>;
23
+ export declare function resolveMarkdownMathColor(fg: unknown): string | undefined;
24
+ export declare function normalizeMathImageOptions(options?: TuiMarkdownMathImageOptions): RequiredMathImageOptions;
25
+ /**
26
+ * Install a custom TeX -> PNG rasterizer (e.g. consumers that already have a
27
+ * katex/mathjax pipeline). Passing `null` restores the built-in lazy loader.
28
+ */
29
+ export declare function setMarkdownMathRasterizer(rasterizer: TuiMarkdownMathRasterizer | null): void;
30
+ export declare function subscribeMarkdownMathImage(listener: () => void): () => void;
31
+ /**
32
+ * True when a rasterizer is confirmed available (a custom one was installed or
33
+ * the built-in MathJax+resvg stack finished loading). Components should gate
34
+ * image production on this so they never spend time rasterizing formulas while
35
+ * the math engine is still loading or missing.
36
+ */
37
+ export declare function isMarkdownMathImageRendererReady(): boolean;
38
+ /**
39
+ * Ensure the math image rasterizer is loaded (or resolved as unavailable).
40
+ * Resolves `true` once a rasterizer is usable. Safe to call repeatedly; the
41
+ * underlying load is shared and its outcome is cached.
42
+ */
43
+ export declare function loadMarkdownMathImageRenderer(): Promise<boolean>;
44
+ /** Synchronous cache lookup used by the markdown AST/layout phase. */
45
+ export declare function getCachedMarkdownMathImage(tex: string, mode: TuiMarkdownMathMode, options?: TuiMarkdownMathImageOptions): TuiMarkdownMathImageCells | null;
46
+ /**
47
+ * Drop all cached rasterized formulas (PNG + failed lookups). Useful for long
48
+ * running processes that change cell metrics, and for tests.
49
+ */
50
+ export declare function clearMarkdownMathImageCache(): void;
51
+ /**
52
+ * Resolve a TeX formula to a PNG base64 + cell size. Cached per
53
+ * (tex, mode, cell metrics, color). In-flight requests are deduped. When a new
54
+ * image finishes, `subscribeMarkdownMathImage` listeners are notified so
55
+ * components can rebuild/re-paint with the real size.
56
+ */
57
+ export declare function getMarkdownMathImage(tex: string, mode: TuiMarkdownMathMode, options?: TuiMarkdownMathImageOptions): Promise<TuiMarkdownMathImageCells | null>;
58
+ /**
59
+ * Kick off rasterization for every math graphic segment in the given row range
60
+ * that does not have a cached PNG yet. Safe to call after every row rebuild;
61
+ * in-flight and cached requests are deduped inside getMarkdownMathImage. Pass a
62
+ * viewport to avoid rasterizing off-screen formulas (e.g. virtualized views).
63
+ */
64
+ export declare function enqueueMarkdownMathImages(rows: readonly TuiMarkdownVisualRow[], options?: TuiMarkdownMathImageOptions, viewport?: Readonly<{
65
+ firstRow: number;
66
+ lastRow: number;
67
+ }>): void;
68
+ export {};
@@ -11,6 +11,7 @@ export type TuiMarkdownTheme = Readonly<{
11
11
  codeBlock: Style;
12
12
  thematicBreak: Style;
13
13
  html: Style;
14
+ math: Style;
14
15
  }>;
15
16
  export type TuiMarkdownThemeOverrides = Readonly<Partial<{
16
17
  heading: readonly Partial<Style>[];
@@ -24,6 +25,7 @@ export type TuiMarkdownThemeOverrides = Readonly<Partial<{
24
25
  codeBlock: Partial<Style>;
25
26
  thematicBreak: Partial<Style>;
26
27
  html: Partial<Style>;
28
+ math: Partial<Style>;
27
29
  }>>;
28
30
  export declare const DEFAULT_TUI_MARKDOWN_THEME: Readonly<{
29
31
  heading: readonly [Readonly<{
@@ -181,6 +183,16 @@ export declare const DEFAULT_TUI_MARKDOWN_THEME: Readonly<{
181
183
  inverse?: boolean;
182
184
  href?: string;
183
185
  }>;
186
+ math: Readonly<{
187
+ fg?: string;
188
+ bg?: string;
189
+ bold?: boolean;
190
+ dim?: boolean;
191
+ italic?: boolean;
192
+ underline?: boolean;
193
+ inverse?: boolean;
194
+ href?: string;
195
+ }>;
184
196
  }>;
185
197
  export declare function markdownThemeSignature(overrides?: TuiMarkdownThemeOverrides): string;
186
198
  export declare function resolveTuiMarkdownTheme(overrides?: TuiMarkdownThemeOverrides): TuiMarkdownTheme;
@@ -13,9 +13,11 @@ export type TuiMarkdownImageSize = Readonly<{
13
13
  preserveAspectRatio?: boolean;
14
14
  }>;
15
15
  export type TuiMarkdownGraphicSegment = Readonly<{
16
- kind: "image";
17
- src: string;
16
+ kind: "image" | "math";
17
+ src?: string;
18
18
  alt?: string;
19
+ tex?: string;
20
+ raw?: string;
19
21
  mime?: string;
20
22
  base64?: string;
21
23
  originalBase64?: string;
@@ -63,6 +65,14 @@ export type TuiMarkdownMathSegment = Readonly<{
63
65
  source: string;
64
66
  raw: string;
65
67
  rendered: boolean;
68
+ /**
69
+ * Set on the boxed fallback of block-level math / raw inline math: the
70
+ * formula still needs to be rasterized once the graphics/raster stack is
71
+ * available. `mode` tells the rasterizer whether to render inline (fits one
72
+ * line, baseline-aligned) or display style.
73
+ */
74
+ pendingImage?: boolean;
75
+ mode?: "inline" | "display";
66
76
  }>;
67
77
  export type TuiMarkdownMathActionPayload = Readonly<{
68
78
  math: TuiMarkdownMathSegment;