@visulima/tui 2.0.0 → 2.0.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/components/box.d.ts +25 -25
  3. package/dist/components/canvas.d.ts +26 -31
  4. package/dist/components/cursor.d.ts +39 -44
  5. package/dist/components/error-overview.d.ts +1 -3
  6. package/dist/components/error-overview.js +1 -1
  7. package/dist/components/newline.d.ts +6 -8
  8. package/dist/components/spacer.d.ts +4 -4
  9. package/dist/components/static-render.d.ts +9 -40
  10. package/dist/components/static.d.ts +13 -13
  11. package/dist/components/text.d.ts +34 -47
  12. package/dist/components/transform.d.ts +7 -11
  13. package/dist/core/index.d.ts +11 -11
  14. package/dist/core/index.js +1 -1
  15. package/dist/ink/canvas/index.d.ts +10 -10
  16. package/dist/ink/hooks/use-animation.d.ts +22 -22
  17. package/dist/ink/hooks/use-app.d.ts +3 -3
  18. package/dist/ink/hooks/use-box-metrics.d.ts +16 -16
  19. package/dist/ink/hooks/use-clipboard.d.ts +16 -16
  20. package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
  21. package/dist/ink/hooks/use-console-capture.d.ts +19 -19
  22. package/dist/ink/hooks/use-cursor.d.ts +6 -6
  23. package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
  24. package/dist/ink/hooks/use-focus.d.ts +14 -18
  25. package/dist/ink/hooks/use-form.d.ts +32 -32
  26. package/dist/ink/hooks/use-hotkey.d.ts +17 -17
  27. package/dist/ink/hooks/use-input.d.ts +92 -92
  28. package/dist/ink/hooks/use-input.js +2 -2
  29. package/dist/ink/hooks/use-interval.d.ts +14 -14
  30. package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
  31. package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
  32. package/dist/ink/hooks/use-key-chord.d.ts +15 -15
  33. package/dist/ink/hooks/use-paste.d.ts +38 -38
  34. package/dist/ink/hooks/use-paste.js +1 -1
  35. package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
  36. package/dist/ink/hooks/use-persistent-state.js +2 -2
  37. package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
  38. package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
  39. package/dist/ink/hooks/use-stderr.d.ts +6 -6
  40. package/dist/ink/hooks/use-stderr.js +1 -1
  41. package/dist/ink/hooks/use-stdin.d.ts +10 -10
  42. package/dist/ink/hooks/use-stdin.js +1 -1
  43. package/dist/ink/hooks/use-stdout.d.ts +6 -6
  44. package/dist/ink/hooks/use-stdout.js +1 -1
  45. package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
  46. package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
  47. package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
  48. package/dist/ink/hooks/use-text-selection.d.ts +18 -18
  49. package/dist/ink/hooks/use-timeout.d.ts +11 -11
  50. package/dist/ink/hooks/use-timer.d.ts +19 -19
  51. package/dist/ink/hooks/use-window-size.d.ts +8 -8
  52. package/dist/ink/hooks/use-window-size.js +1 -1
  53. package/dist/ink/index.d.ts +109 -122
  54. package/dist/ink/index.js +1 -1
  55. package/dist/ink/mouse/use-element-position.d.ts +6 -6
  56. package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
  57. package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
  58. package/dist/ink/mouse/use-mouse.d.ts +1 -1
  59. package/dist/ink/mouse/use-on-mouse-click.d.ts +3 -3
  60. package/dist/ink/mouse/use-on-mouse-hover.d.ts +2 -2
  61. package/dist/ink/mouse/use-on-mouse-state.d.ts +2 -2
  62. package/dist/ink/public/cursor.d.ts +21 -21
  63. package/dist/ink/public/dom.d.ts +2 -2
  64. package/dist/ink/public/highlighter.d.ts +16 -26
  65. package/dist/ink/public/input.d.ts +6 -6
  66. package/dist/ink/public/styles.d.ts +1 -1
  67. package/dist/ink/public/utils.d.ts +2 -2
  68. package/dist/packem_shared/{DevTools-D9tfChBc.js → DevTools-BxD3PYAN.js} +1 -1
  69. package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
  70. package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
  71. package/dist/packem_shared/{TuiApp-DjIgv5Sk.js → TuiApp-CCVaiKbf.js} +1 -1
  72. package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
  73. package/dist/packem_shared/{buffer.d-j_dP5JyC.d.ts → buffer.d-CttIC480.d.ts} +26 -26
  74. package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
  75. package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
  76. package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
  77. package/dist/packem_shared/{dom.d-g-nsYquD.d.ts → dom.d-CLGlidfI.d.ts} +138 -151
  78. package/dist/packem_shared/{input.d-D-Yxqha8.d.ts → input.d-Bb8pWHvp.d.ts} +24 -24
  79. package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
  80. package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
  81. package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
  82. package/dist/packem_shared/{render-D7aV_hO1.js → render-CuCo-R-l.js} +17 -17
  83. package/dist/packem_shared/{render-DMcWfI6-.js → render-DtQd8qQq.js} +1 -1
  84. package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
  85. package/dist/packem_shared/{renderToString-DqLFFPvO.js → renderToString-B1LgWcJe.js} +1 -1
  86. package/dist/packem_shared/{selection.d-KWphH--_.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
  87. package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
  88. package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
  89. package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
  90. package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
  91. package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
  92. package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
  93. package/dist/react/index.d.ts +160 -178
  94. package/dist/react/index.js +1 -1
  95. package/dist/testing/index.d.ts +151 -151
  96. package/dist/testing/index.js +1 -1
  97. package/index.js +52 -52
  98. package/package.json +9 -9
  99. package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
  100. package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +0 -56
  101. package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
  102. package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
  103. package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
  104. package/dist/packem_shared/reconciler-DhUGYWCr.js +0 -1
  105. package/dist/packem_shared/render.d-BvfwvSCx.d.ts +0 -435
  106. package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
  107. package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
  108. package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
  109. package/dist/packem_shared/styles.d-D7iZuNC-.d.ts +0 -492
  110. package/dist/packem_shared/utils-C8l_3Dzw.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## @visulima/tui [2.0.1](https://github.com/visulima/visulima/compare/%40visulima%2Ftui%402.0.0...%40visulima%2Ftui%402.0.1) (2026-07-27)
2
+
1
3
  ## @visulima/tui [2.0.0](https://github.com/visulima/visulima/compare/%40visulima%2Ftui%401.0.8...%40visulima%2Ftui%402.0.0) (2026-07-27)
2
4
 
3
5
  ## @visulima/tui [1.0.8](https://github.com/visulima/visulima/compare/%40visulima%2Ftui%401.0.7...%40visulima%2Ftui%401.0.8) (2026-07-27)
@@ -1,26 +1,26 @@
1
1
  import { ReactNode, PropsWithChildren, RefAttributes, ForwardRefExoticComponent } from 'react';
2
2
  import { Except } from 'type-fest';
3
- import { D as DOMElement } from "../packem_shared/dom.d-g-nsYquD.js";
4
- import { S as Styles } from "../packem_shared/styles.d-D7iZuNC-.js";
3
+ import { D as DOMElement } from "../packem_shared/dom.d-CLGlidfI.js";
4
+ import { S as Styles } from "../packem_shared/styles.d-CKGQFfm4.js";
5
5
  import 'yoga-layout';
6
6
  import "../ink/public/cursor.js";
7
7
  import '@visulima/colorize';
8
8
  type Props = Except<Styles, "textWrap"> & {
9
9
  /**
10
- * Hide the element from screen readers.
11
- */
10
+ * Hide the element from screen readers.
11
+ */
12
12
  readonly "aria-hidden"?: boolean;
13
13
  /**
14
- * A label for the element for screen readers.
15
- */
14
+ * A label for the element for screen readers.
15
+ */
16
16
  readonly "aria-label"?: string;
17
17
  /**
18
- * The role of the element.
19
- */
18
+ * The role of the element.
19
+ */
20
20
  readonly "aria-role"?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
21
21
  /**
22
- * The state of the element.
23
- */
22
+ * The state of the element.
23
+ */
24
24
  readonly "aria-state"?: {
25
25
  readonly busy?: boolean;
26
26
  readonly checked?: boolean;
@@ -33,29 +33,29 @@ type Props = Except<Styles, "textWrap"> & {
33
33
  readonly selected?: boolean;
34
34
  };
35
35
  /**
36
- * Whether this element is opaque (prevents rendering of covered content beneath it).
37
- * Useful for performance optimization with layered content.
38
- */
36
+ * Whether this element is opaque (prevents rendering of covered content beneath it).
37
+ * Useful for performance optimization with layered content.
38
+ */
39
39
  readonly opaque?: boolean;
40
40
  /**
41
- * Whether to render a scrollbar for this scrollable element.
42
- * Only applies when `overflow` is `'scroll'`. Defaults to `true`.
43
- */
41
+ * Whether to render a scrollbar for this scrollable element.
42
+ * Only applies when `overflow` is `'scroll'`. Defaults to `true`.
43
+ */
44
44
  readonly scrollbar?: boolean;
45
45
  /**
46
- * Makes this element sticky within its scroll container.
47
- * - `true` or `'top'`: pinned to the top during scroll
48
- * - `'bottom'`: pinned to the bottom during scroll
49
- */
46
+ * Makes this element sticky within its scroll container.
47
+ * - `true` or `'top'`: pinned to the top during scroll
48
+ * - `'bottom'`: pinned to the bottom during scroll
49
+ */
50
50
  readonly sticky?: boolean | "top" | "bottom";
51
51
  /**
52
- * Alternate content to render when this element is in its sticky (pinned) state.
53
- * Only applies when `sticky` is set. When omitted, the normal children are used.
54
- */
52
+ * Alternate content to render when this element is in its sticky (pinned) state.
53
+ * Only applies when `sticky` is set. When omitted, the normal children are used.
54
+ */
55
55
  readonly stickyChildren?: ReactNode;
56
56
  };
57
57
  /**
58
- * `&lt;Box>` is an essential Ink component to build your layout. It's like `&lt;div style="display: flex">` in the browser.
59
- */
58
+ * `&lt;Box>` is an essential Ink component to build your layout. It's like `&lt;div style="display: flex">` in the browser.
59
+ */
60
60
  declare const Box: ForwardRefExoticComponent<PropsWithChildren<Props> & RefAttributes<DOMElement>>;
61
61
  export { Box, type Props as BoxProps, Props, Box as default };
@@ -1,44 +1,39 @@
1
1
  import { ReactElement } from 'react';
2
- import { C as CanvasContext } from "../packem_shared/buffer.d-j_dP5JyC.js";
3
- export type { a as CanvasColor, b as CellStyle } from "../packem_shared/buffer.d-j_dP5JyC.js";
2
+ import { C as CanvasContext } from "../packem_shared/buffer.d-CttIC480.js";
3
+ export type { a as CanvasColor, b as CellStyle } from "../packem_shared/buffer.d-CttIC480.js";
4
4
  type Props = {
5
5
  /**
6
- * Imperative draw callback. Mutates the underlying typed-array buffer via
7
- * the provided `CanvasContext`. Runs in a `useMemo` keyed by `version` —
8
- * pass a stable reference (or hash) so the canvas only re-renders when
9
- * the input data truly changes.
10
- */
6
+ * Imperative draw callback. Mutates the underlying typed-array buffer via
7
+ * the provided `CanvasContext`. Runs in a `useMemo` keyed by `version` —
8
+ * pass a stable reference (or hash) so the canvas only re-renders when
9
+ * the input data truly changes.
10
+ */
11
11
  readonly draw: (context: CanvasContext) => void;
12
12
  /**
13
- * Number of rows (character cells vertically).
14
- */
13
+ * Number of rows (character cells vertically).
14
+ */
15
15
  readonly height: number;
16
16
  /**
17
- * Invalidation key — required so the memoization contract is explicit.
18
- * Re-runs `draw` and re-serializes only the rows the draw callback
19
- * dirtied. Pass the data you render (or a hash of it). Use a stable
20
- * value (e.g. a counter) when you intentionally want to redraw on
21
- * every render.
22
- */
17
+ * Invalidation key — required so the memoization contract is explicit.
18
+ * Re-runs `draw` and re-serializes only the rows the draw callback
19
+ * dirtied. Pass the data you render (or a hash of it). Use a stable
20
+ * value (e.g. a counter) when you intentionally want to redraw on
21
+ * every render.
22
+ */
23
23
  readonly version: unknown;
24
24
  /**
25
- * Number of columns (character cells horizontally).
26
- */
25
+ * Number of columns (character cells horizontally).
26
+ */
27
27
  readonly width: number;
28
28
  };
29
29
  /**
30
- * A fixed-size cell grid backed by typed arrays. Use the imperative `draw`
31
- * callback to paint. The canvas emits one `Text` child per row (not per cell)
32
- * and caches the ANSI output of each row: only rows marked dirty by the last
33
- * draw pass are re-serialized, and only when `version` changes.
34
- *
35
- * This is the foundation for chart/grid components that need more layout
36
- * control than `Text` alone.
37
- */
38
- declare function Canvas({
39
- draw,
40
- height,
41
- version,
42
- width
43
- }: Props): ReactElement;
30
+ * A fixed-size cell grid backed by typed arrays. Use the imperative `draw`
31
+ * callback to paint. The canvas emits one `Text` child per row (not per cell)
32
+ * and caches the ANSI output of each row: only rows marked dirty by the last
33
+ * draw pass are re-serialized, and only when `version` changes.
34
+ *
35
+ * This is the foundation for chart/grid components that need more layout
36
+ * control than `Text` alone.
37
+ */
38
+ declare function Canvas({ draw, height, version, width }: Props): ReactElement;
44
39
  export { Canvas, type CanvasContext, type Props as CanvasProps, Props, Canvas as default };
@@ -1,61 +1,56 @@
1
1
  import React, { RefObject } from 'react';
2
2
  import { CursorShape } from "../ink/public/cursor.js";
3
- import { D as DOMElement } from "../packem_shared/dom.d-g-nsYquD.js";
3
+ import { D as DOMElement } from "../packem_shared/dom.d-CLGlidfI.js";
4
4
  import 'yoga-layout';
5
5
  import '@visulima/colorize';
6
- import "../packem_shared/styles.d-D7iZuNC-.js";
6
+ import "../packem_shared/styles.d-CKGQFfm4.js";
7
7
  import 'type-fest';
8
8
  type Props = {
9
9
  /**
10
- * Optional reference to anchor cursor coordinates to a different element.
11
- * If omitted, `&lt;Cursor>` uses the parent container as anchor.
12
- * If `anchorRef` is set but currently unresolved, Ink hides the cursor for that frame.
13
- * If multiple `&lt;Cursor>` components are rendered in one frame, the last rendered one controls the terminal cursor position.
14
- */
10
+ * Optional reference to anchor cursor coordinates to a different element.
11
+ * If omitted, `&lt;Cursor>` uses the parent container as anchor.
12
+ * If `anchorRef` is set but currently unresolved, Ink hides the cursor for that frame.
13
+ * If multiple `&lt;Cursor>` components are rendered in one frame, the last rendered one controls the terminal cursor position.
14
+ */
15
15
  readonly anchorRef?: RefObject<DOMElement | null>;
16
16
  /**
17
- * Optional cursor shape (DECSCUSR). The shape is restored to the terminal
18
- * default on unmount, SIGINT, and unhandled React tree throws, so the
19
- * parent shell never inherits a leaked shape.
20
- *
21
- * Steady variants are non-blinking; `blinking-*` variants opt into blink.
22
- */
17
+ * Optional cursor shape (DECSCUSR). The shape is restored to the terminal
18
+ * default on unmount, SIGINT, and unhandled React tree throws, so the
19
+ * parent shell never inherits a leaked shape.
20
+ *
21
+ * Steady variants are non-blinking; `blinking-*` variants opt into blink.
22
+ */
23
23
  readonly shape?: CursorShape;
24
24
  /**
25
- * Horizontal offset from anchor content origin.
26
- */
25
+ * Horizontal offset from anchor content origin.
26
+ */
27
27
  readonly x?: number;
28
28
  /**
29
- * Vertical offset from anchor content origin.
30
- */
29
+ * Vertical offset from anchor content origin.
30
+ */
31
31
  readonly y?: number;
32
32
  };
33
33
  /**
34
- * Declaratively position the terminal cursor.
35
- * `&lt;Cursor>` must not be rendered inside `&lt;Text>`.
36
- *
37
- * **Inline mode** (no props): place `&lt;Cursor />` after a `&lt;Text>` node and the
38
- * cursor appears where that text ended — even when text wraps across lines.
39
- *
40
- * **Anchor mode**: pass `anchorRef` and/or `x`/`y` to position relative to
41
- * another element's content origin.
42
- * @example Inline mode — cursor follows text naturally
43
- * ```jsx
44
- * <Box>
45
- * <Text>{prompt + value}</Text>
46
- * <Cursor />
47
- * </Box>
48
- * ```
49
- * @example Anchor mode — offset from a referenced element
50
- * ```jsx
51
- * <Box ref={ref} />
52
- * <Cursor anchorRef={ref} x={5} />
53
- * ```
54
- */
55
- declare function Cursor({
56
- anchorRef,
57
- shape,
58
- x,
59
- y
60
- }: Props): React.JSX.Element;
34
+ * Declaratively position the terminal cursor.
35
+ * `&lt;Cursor>` must not be rendered inside `&lt;Text>`.
36
+ *
37
+ * **Inline mode** (no props): place `&lt;Cursor />` after a `&lt;Text>` node and the
38
+ * cursor appears where that text ended — even when text wraps across lines.
39
+ *
40
+ * **Anchor mode**: pass `anchorRef` and/or `x`/`y` to position relative to
41
+ * another element's content origin.
42
+ * @example Inline mode — cursor follows text naturally
43
+ * ```jsx
44
+ * <Box>
45
+ * <Text>{prompt + value}</Text>
46
+ * <Cursor />
47
+ * </Box>
48
+ * ```
49
+ * @example Anchor mode — offset from a referenced element
50
+ * ```jsx
51
+ * <Box ref={ref} />
52
+ * <Cursor anchorRef={ref} x={5} />
53
+ * ```
54
+ */
55
+ declare function Cursor({ anchorRef, shape, x, y }: Props): React.JSX.Element;
61
56
  export { Cursor, type Props as CursorProps, Props, Cursor as default };
@@ -2,7 +2,5 @@ import { ReactElement } from 'react';
2
2
  type Props = {
3
3
  readonly error: Error;
4
4
  };
5
- declare function ErrorOverview({
6
- error
7
- }: Props): ReactElement;
5
+ declare function ErrorOverview({ error }: Props): ReactElement;
8
6
  export { type Props as ErrorOverviewProps, ErrorOverview as default };
@@ -1 +1 @@
1
- import{createRequire as $}from"node:module";import{jsxs as c,jsx as s}from"react/jsx-runtime";import{parseStacktrace as _}from"@visulima/error/stacktrace";import{Box as a}from"./box.js";import{Text as d}from"./text.js";const w=$(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=o=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,t]=m.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return m.getBuiltinModule(o)}return w(o)},{existsSync:v,readFileSync:x}=b("node:fs"),{cwd:y}=m,C=(o,e=2)=>o.replace(/^\t+/gm,t=>" ".repeat(t.length*e)),T=(o,e)=>{const t=[],u=o-e,n=o+e;for(let l=u;l<=n;l++)t.push(l);return t},j=(o,e,t={})=>{var u;if(typeof o!="string")throw new TypeError("Source code is missing.");if(!e||e<1)throw new TypeError("Line number must start from `1`.");const n=C(o).split(/\r?\n/);if(!(e>n.length))return T(e,(u=t.around)!==null&&u!==void 0?u:3).filter(l=>n[l-1]!==void 0).map(l=>({line:l,value:n[l-1]}))},g=o=>{if(!o)return o;const e=y();return o.replace(`file://${e}/`,"").replace(`${e}/`,"")};function q({error:o}){const e=_(o),t=new Map,u=e.map(r=>{const i=!r.methodName&&!r.file?`raw:${r.raw}`:`${g(r.file)??""}:${r.line}:${r.column}:${r.methodName??""}`,h=t.get(i)??0;return t.set(i,h+1),{key:`${i}#${h}`,trace:r}}),n=e[0],l=g(n?.file);let f,p=0;if(l&&n?.line&&v(l)){const r=x(l,"utf8");if(f=j(r,n.line),f)for(const{line:i}of f)p=Math.max(p,String(i).length)}return c(a,{flexDirection:"column",padding:1,children:[c(a,{children:[c(d,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),c(d,{children:[" ",o.message]})]}),n&&l?s(a,{marginTop:1,children:c(d,{dimColor:!0,children:[l,":",n.line,":",n.column]})}):null,n&&f?s(a,{flexDirection:"column",marginTop:1,children:f.map(({line:r,value:i})=>c(a,{children:[s(a,{width:p+1,children:c(d,{"aria-label":r===n.line?`Line ${r}, error`:`Line ${r}`,backgroundColor:r===n.line?"red":void 0,color:r===n.line?"white":void 0,dimColor:r!==n.line,children:[String(r).padStart(p," "),":"]})}),s(d,{backgroundColor:r===n.line?"red":void 0,color:r===n.line?"white":void 0,children:` ${i}`})]},`excerpt-${r}`))}):null,e.length>0?s(a,{flexDirection:"column",marginTop:1,children:u.map(({key:r,trace:i})=>{const h=g(i.file)??"";return!i.methodName&&!i.file?c(a,{children:[s(d,{dimColor:!0,children:"- "}),s(d,{bold:!0,dimColor:!0,children:i.raw})]},r):c(a,{children:[s(d,{dimColor:!0,children:"- "}),s(d,{bold:!0,dimColor:!0,children:i.methodName??"<anonymous>"}),c(d,{"aria-label":`at ${h} line ${i.line} column ${i.column}`,color:"gray",dimColor:!0,children:[" ","(",h,":",i.line,":",i.column,")"]})]},r)})}):null]})}export{q as default};
1
+ import{createRequire as $}from"node:module";import{jsxs as c,jsx as s}from"react/jsx-runtime";import{parseStacktrace as C}from"@visulima/error/stacktrace";import{Box as a}from"./box.js";import{Text as d}from"./text.js";let _;const w=n=>(_??=$(import.meta.url))(n),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=n=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[r,t]=m.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return m.getBuiltinModule(n)}return w(n)},{existsSync:v,readFileSync:x}=b("node:fs"),{cwd:y}=m,T=(n,r=2)=>n.replace(/^\t+/gm,t=>" ".repeat(t.length*r)),j=(n,r)=>{const t=[],u=n-r,o=n+r;for(let l=u;l<=o;l++)t.push(l);return t},k=(n,r,t={})=>{var u;if(typeof n!="string")throw new TypeError("Source code is missing.");if(!r||r<1)throw new TypeError("Line number must start from `1`.");const o=T(n).split(/\r?\n/);if(!(r>o.length))return j(r,(u=t.around)!==null&&u!==void 0?u:3).filter(l=>o[l-1]!==void 0).map(l=>({line:l,value:o[l-1]}))},g=n=>{if(!n)return n;const r=y();return n.replace(`file://${r}/`,"").replace(`${r}/`,"")};function B({error:n}){const r=C(n),t=new Map,u=r.map(e=>{const i=!e.methodName&&!e.file?`raw:${e.raw}`:`${g(e.file)??""}:${e.line}:${e.column}:${e.methodName??""}`,f=t.get(i)??0;return t.set(i,f+1),{key:`${i}#${f}`,trace:e}}),o=r[0],l=g(o?.file);let h,p=0;if(l&&o?.line&&v(l)){const e=x(l,"utf8");if(h=k(e,o.line),h)for(const{line:i}of h)p=Math.max(p,String(i).length)}return c(a,{flexDirection:"column",padding:1,children:[c(a,{children:[c(d,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),c(d,{children:[" ",n.message]})]}),o&&l?s(a,{marginTop:1,children:c(d,{dimColor:!0,children:[l,":",o.line,":",o.column]})}):null,o&&h?s(a,{flexDirection:"column",marginTop:1,children:h.map(({line:e,value:i})=>c(a,{children:[s(a,{width:p+1,children:c(d,{"aria-label":e===o.line?`Line ${e}, error`:`Line ${e}`,backgroundColor:e===o.line?"red":void 0,color:e===o.line?"white":void 0,dimColor:e!==o.line,children:[String(e).padStart(p," "),":"]})}),s(d,{backgroundColor:e===o.line?"red":void 0,color:e===o.line?"white":void 0,children:` ${i}`})]},`excerpt-${e}`))}):null,r.length>0?s(a,{flexDirection:"column",marginTop:1,children:u.map(({key:e,trace:i})=>{const f=g(i.file)??"";return!i.methodName&&!i.file?c(a,{children:[s(d,{dimColor:!0,children:"- "}),s(d,{bold:!0,dimColor:!0,children:i.raw})]},e):c(a,{children:[s(d,{dimColor:!0,children:"- "}),s(d,{bold:!0,dimColor:!0,children:i.methodName??"<anonymous>"}),c(d,{"aria-label":`at ${f} line ${i.line} column ${i.column}`,color:"gray",dimColor:!0,children:[" ","(",f,":",i.line,":",i.column,")"]})]},e)})}):null]})}export{B as default};
@@ -1,15 +1,13 @@
1
1
  import { ReactElement } from 'react';
2
2
  type Props = {
3
3
  /**
4
- * Number of newlines to insert.
5
- * @default 1
6
- */
4
+ * Number of newlines to insert.
5
+ * @default 1
6
+ */
7
7
  readonly count?: number;
8
8
  };
9
9
  /**
10
- * Adds one or more newline (`\n`) characters. Must be used within `&lt;Text>` components.
11
- */
12
- declare function Newline({
13
- count
14
- }: Props): ReactElement;
10
+ * Adds one or more newline (`\n`) characters. Must be used within `&lt;Text>` components.
11
+ */
12
+ declare function Newline({ count }: Props): ReactElement;
15
13
  export { Newline, type Props as NewlineProps, Props, Newline as default };
@@ -1,8 +1,8 @@
1
1
  import { ReactElement } from 'react';
2
2
  /**
3
- * A flexible space that expands along the major axis of its containing layout.
4
- *
5
- * It's useful as a shortcut for filling all the available space between elements.
6
- */
3
+ * A flexible space that expands along the major axis of its containing layout.
4
+ *
5
+ * It's useful as a shortcut for filling all the available space between elements.
6
+ */
7
7
  declare function Spacer(): ReactElement;
8
8
  export { Spacer, Spacer as default };
@@ -1,42 +1,17 @@
1
1
  import React, { ReactNode, DependencyList } from 'react';
2
- import { D as DOMElement } from "../packem_shared/dom.d-g-nsYquD.js";
3
- import { S as Styles } from "../packem_shared/styles.d-D7iZuNC-.js";
2
+ import { D as DOMElement } from "../packem_shared/dom.d-CLGlidfI.js";
3
+ import { S as Styles } from "../packem_shared/styles.d-CKGQFfm4.js";
4
4
  import 'yoga-layout';
5
5
  import "../ink/public/cursor.js";
6
6
  import '@visulima/colorize';
7
7
  import 'type-fest';
8
-
9
8
  /**
10
- * StaticRender component pre-renders children once and caches the result.
11
- *
12
- * When mounted, StaticRender renders its children into a Region via
13
- * prepareYogaTree() in the Ink layout phase, then caches the result on the
14
- * DOM node. On subsequent renders, the cached Region is composited directly
15
- * via addRegionTree(), skipping the entire subtree traversal.
16
- *
17
- * Children are passed as a render function `() => ReactNode`. Once the cache
18
- * is ready, the component stops calling the function so React does not
19
- * re-reconcile the subtree on subsequent renders.
20
- *
21
- * Re-rendering the cached content is controlled via the `deps` prop (similar
22
- * to React's hook deps). When `deps` changes, the cache is invalidated and
23
- * `children()` is invoked again. If `deps` is omitted, the cache is
24
- * invalidated whenever the `children` function reference changes.
25
- *
26
- * Use this for content that renders once and doesn't change (e.g., completed
27
- * task output, logged messages, static headers).
28
- *
29
- * Ported from jacob314/ink (Google LLC, Apache-2.0).
30
- * @license Apache-2.0
31
- */
32
-
33
- /**
34
- * @property children Render function invoked once to produce the cached content.
35
- * @property deps Dependencies that control when the static content is re-rendered. When any dependency changes (shallow, Object.is comparison), the cache is invalidated and children() is invoked again. If omitted, the cache is invalidated whenever the children function reference changes.
36
- * @property onRender Callback fired after the static content has been rendered and cached. The node's cachedRender holds the measured width/height — useful for reacting to the cached block's size without setting up a full ResizeObserver.
37
- * @property style Optional style applied to the static-render container.
38
- * @property width Optional fixed width for the cached region.
39
- */
9
+ * @property children Render function invoked once to produce the cached content.
10
+ * @property deps Dependencies that control when the static content is re-rendered. When any dependency changes (shallow, Object.is comparison), the cache is invalidated and children() is invoked again. If omitted, the cache is invalidated whenever the children function reference changes.
11
+ * @property onRender Callback fired after the static content has been rendered and cached. The node's cachedRender holds the measured width/height — useful for reacting to the cached block's size without setting up a full ResizeObserver.
12
+ * @property style Optional style applied to the static-render container.
13
+ * @property width Optional fixed width for the cached region.
14
+ */
40
15
  type Props = {
41
16
  readonly children: () => ReactNode;
42
17
  readonly deps?: DependencyList;
@@ -44,11 +19,5 @@ type Props = {
44
19
  readonly style?: Styles;
45
20
  readonly width?: number;
46
21
  };
47
- declare const StaticRender: ({
48
- children,
49
- deps,
50
- onRender,
51
- style,
52
- width
53
- }: Props) => React.ReactNode;
22
+ declare const StaticRender: ({ children, deps, onRender, style, width }: Props) => React.ReactNode;
54
23
  export { Props, StaticRender, type Props as StaticRenderProps, StaticRender as default };
@@ -1,28 +1,28 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { S as Styles } from "../packem_shared/styles.d-D7iZuNC-.js";
2
+ import { S as Styles } from "../packem_shared/styles.d-CKGQFfm4.js";
3
3
  import '@visulima/colorize';
4
4
  import 'type-fest';
5
5
  import 'yoga-layout';
6
6
  type Props<T> = {
7
7
  /**
8
- * Function that is called to render every item in the `items` array. The first argument is the item itself, and the second argument is the index of that item in the `items` array. Note that a `key` must be assigned to the root component.
9
- */
8
+ * Function that is called to render every item in the `items` array. The first argument is the item itself, and the second argument is the index of that item in the `items` array. Note that a `key` must be assigned to the root component.
9
+ */
10
10
  readonly children: (item: T, index: number) => ReactNode;
11
11
  /**
12
- * Array of items of any type to render using the function you pass as a component child.
13
- */
12
+ * Array of items of any type to render using the function you pass as a component child.
13
+ */
14
14
  readonly items: T[];
15
15
  /**
16
- * Styles to apply to a container of child elements. See &lt;Box> for supported properties.
17
- */
16
+ * Styles to apply to a container of child elements. See &lt;Box> for supported properties.
17
+ */
18
18
  readonly style?: Styles;
19
19
  };
20
20
  /**
21
- * `&lt;Static>` component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs—things that don't change after they're rendered (hence the name "Static").
22
- *
23
- * It's preferred to use `&lt;Static>` for use cases like these when you can't know or control the number of items that need to be rendered.
24
- *
25
- * For example, [Tap](https://github.com/tapjs/node-tap) uses `&lt;Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
26
- */
21
+ * `&lt;Static>` component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs—things that don't change after they're rendered (hence the name "Static").
22
+ *
23
+ * It's preferred to use `&lt;Static>` for use cases like these when you can't know or control the number of items that need to be rendered.
24
+ *
25
+ * For example, [Tap](https://github.com/tapjs/node-tap) uses `&lt;Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
26
+ */
27
27
  declare function Static<T>(props: Props<T>): ReactElement;
28
28
  export { Props, Static, type Props as StaticProps, Static as default };
@@ -1,78 +1,65 @@
1
1
  import { AnsiColors } from '@visulima/colorize';
2
2
  import { ReactNode, ReactElement } from 'react';
3
3
  import { LiteralUnion } from 'type-fest';
4
- import { S as Styles } from "../packem_shared/styles.d-D7iZuNC-.js";
4
+ import { S as Styles } from "../packem_shared/styles.d-CKGQFfm4.js";
5
5
  import 'yoga-layout';
6
6
  type Props = {
7
7
  /**
8
- * Hide the element from screen readers.
9
- */
8
+ * Hide the element from screen readers.
9
+ */
10
10
  readonly "aria-hidden"?: boolean;
11
11
  /**
12
- * A label for the element for screen readers.
13
- */
12
+ * A label for the element for screen readers.
13
+ */
14
14
  readonly "aria-label"?: string;
15
15
  /**
16
- * Same as `color`, but for the background.
17
- */
16
+ * Same as `color`, but for the background.
17
+ */
18
18
  readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
19
19
  /**
20
- * Make the text bold.
21
- */
20
+ * Make the text bold.
21
+ */
22
22
  readonly bold?: boolean;
23
23
  readonly children?: ReactNode;
24
24
  /**
25
- * Change text color. Ink uses @visulima/colorize under the hood, so all its functionality is supported.
26
- */
25
+ * Change text color. Ink uses @visulima/colorize under the hood, so all its functionality is supported.
26
+ */
27
27
  readonly color?: LiteralUnion<AnsiColors, string>;
28
28
  /**
29
- * Dim the color (make it less bright).
30
- */
29
+ * Dim the color (make it less bright).
30
+ */
31
31
  readonly dimColor?: boolean;
32
32
  /**
33
- * Inverse background and foreground colors.
34
- */
33
+ * Inverse background and foreground colors.
34
+ */
35
35
  readonly inverse?: boolean;
36
36
  /**
37
- * Make the text italic.
38
- */
37
+ * Make the text italic.
38
+ */
39
39
  readonly italic?: boolean;
40
40
  /**
41
- * Make the text crossed out with a line.
42
- */
41
+ * Make the text crossed out with a line.
42
+ */
43
43
  readonly strikethrough?: boolean;
44
44
  /**
45
- * Make the text underlined.
46
- */
45
+ * Make the text underlined.
46
+ */
47
47
  readonly underline?: boolean;
48
48
  /**
49
- * Controls how text wraps when it exceeds the container width.
50
- *
51
- * - `wrap` (default) — Wrap at word boundaries; break inside words only when a single word exceeds the width.
52
- * - `wrap-anywhere` — Break at any character boundary, even when a whitespace break exists earlier.
53
- * - `wrap-preserve-words` — Wrap at word boundaries; never break inside words (long words may overflow).
54
- * - `wrap-strict` — Enforce exact width; always break at the column limit.
55
- * - `truncate` / `truncate-end` — Truncate at the end with an ellipsis.
56
- * - `truncate-start` — Truncate at the start with an ellipsis.
57
- * - `truncate-middle` — Truncate in the middle with an ellipsis.
58
- */
49
+ * Controls how text wraps when it exceeds the container width.
50
+ *
51
+ * - `wrap` (default) — Wrap at word boundaries; break inside words only when a single word exceeds the width.
52
+ * - `wrap-anywhere` — Break at any character boundary, even when a whitespace break exists earlier.
53
+ * - `wrap-preserve-words` — Wrap at word boundaries; never break inside words (long words may overflow).
54
+ * - `wrap-strict` — Enforce exact width; always break at the column limit.
55
+ * - `truncate` / `truncate-end` — Truncate at the end with an ellipsis.
56
+ * - `truncate-start` — Truncate at the start with an ellipsis.
57
+ * - `truncate-middle` — Truncate in the middle with an ellipsis.
58
+ */
59
59
  readonly wrap?: Styles["textWrap"];
60
60
  };
61
61
  /**
62
- * This component can display text and change its style to make it bold, underlined, italic, or strikethrough.
63
- */
64
- declare function Text({
65
- "aria-hidden": ariaHidden,
66
- "aria-label": ariaLabel,
67
- backgroundColor,
68
- bold,
69
- children,
70
- color,
71
- dimColor,
72
- inverse,
73
- italic,
74
- strikethrough,
75
- underline,
76
- wrap
77
- }: Props): ReactElement | null;
62
+ * This component can display text and change its style to make it bold, underlined, italic, or strikethrough.
63
+ */
64
+ declare function Text({ "aria-hidden": ariaHidden, "aria-label": ariaLabel, backgroundColor, bold, children, color, dimColor, inverse, italic, strikethrough, underline, wrap }: Props): ReactElement | null;
78
65
  export { Props, Text, type Props as TextProps, Text as default };
@@ -1,21 +1,17 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
2
  type Props = {
3
3
  /**
4
- * Screen-reader-specific text to output. If this is set, all children will be ignored.
5
- */
4
+ * Screen-reader-specific text to output. If this is set, all children will be ignored.
5
+ */
6
6
  readonly accessibilityLabel?: string;
7
7
  readonly children?: ReactNode;
8
8
  /**
9
- * Function that transforms children output. It accepts children and must return transformed children as well. Note that when children use `&lt;Text>` styling props (e.g. `color`, `bold`), the string will contain ANSI escape codes.
10
- */
9
+ * Function that transforms children output. It accepts children and must return transformed children as well. Note that when children use `&lt;Text>` styling props (e.g. `color`, `bold`), the string will contain ANSI escape codes.
10
+ */
11
11
  readonly transform: (children: string, index: number) => string;
12
12
  };
13
13
  /**
14
- * Transform a string representation of React components before they're written to output. For example, you might want to apply a gradient to text, add a clickable link, or create some text effects. These use cases can't accept React nodes as input; they expect a string. That's what the &lt;Transform> component does: it gives you an output string of its child components and lets you transform it in any way.
15
- */
16
- declare function Transform({
17
- accessibilityLabel,
18
- children,
19
- transform
20
- }: Props): ReactElement | null;
14
+ * Transform a string representation of React components before they're written to output. For example, you might want to apply a gradient to text, add a clickable link, or create some text effects. These use cases can't accept React nodes as input; they expect a string. That's what the &lt;Transform> component does: it gives you an output string of its child components and lets you transform it in any way.
15
+ */
16
+ declare function Transform({ accessibilityLabel, children, transform }: Props): ReactElement | null;
21
17
  export { Props, Transform, type Props as TransformProps, Transform as default };
@@ -1,9 +1,9 @@
1
- export { I as InlineLoop, a as InlineOptions, b as InlinePaintFn, c as InputParser, M as MouseEvent, T as TuiApp, d as createInlineLoop } from "../packem_shared/input.d-D-Yxqha8.js";
1
+ export { I as InlineLoop, a as InlineOptions, b as InlinePaintFn, c as InputParser, M as MouseEvent, T as TuiApp, d as createInlineLoop } from "../packem_shared/input.d-Bb8pWHvp.js";
2
2
  /**
3
- * 2×u32 per-cell back-buffer layout:
4
- * buffer[idx * 2] = charCode (Unicode codepoint, u32)
5
- * buffer[idx * 2 + 1] = attrCode = (styles &lt;< 16) | (bg &lt;< 8) | fg
6
- */
3
+ * 2×u32 per-cell back-buffer layout:
4
+ * buffer[idx * 2] = charCode (Unicode codepoint, u32)
5
+ * buffer[idx * 2 + 1] = attrCode = (styles &lt;< 16) | (bg &lt;< 8) | fg
6
+ */
7
7
  declare const Cell: {
8
8
  /** Read bg color from an attr slot value (buffer[idx*2+1]) — bits 15:8 */
9
9
  getBg(attributeSlot: number): number;
@@ -14,12 +14,12 @@ declare const Cell: {
14
14
  /** Read styles bitmask from an attr slot value (buffer[idx*2+1]) — bits 23:16 */
15
15
  getStyles(attributeSlot: number): number;
16
16
  /**
17
- * Pack a cell into a [charCode, attrCode] tuple.
18
- * charCode = char.codePointAt(0)
19
- * attrCode = (styles & 0xFF) &lt;< 16 | (bg & 0xFF) &lt;< 8 | (fg & 0xFF)
20
- *
21
- * Write to buffer as: buffer[idx*2] = charCode; buffer[idx*2+1] = attrCode
22
- */
17
+ * Pack a cell into a [charCode, attrCode] tuple.
18
+ * charCode = char.codePointAt(0)
19
+ * attrCode = (styles & 0xFF) &lt;< 16 | (bg & 0xFF) &lt;< 8 | (fg & 0xFF)
20
+ *
21
+ * Write to buffer as: buffer[idx*2] = charCode; buffer[idx*2+1] = attrCode
22
+ */
23
23
  pack(char: string, fg?: number, bg?: number, styles?: number): [number, number];
24
24
  };
25
25
  declare const StyleMasks: {
@@ -1 +1 @@
1
- import{TuiApp as o}from"../packem_shared/TuiApp-DjIgv5Sk.js";import{Cell as t,StyleMasks as m}from"../packem_shared/Cell-BrXn3jxY.js";import{createInlineLoop as l}from"../packem_shared/createInlineLoop-BT40Wpmx.js";import{InputParser as f}from"../packem_shared/InputParser-CiBitCva.js";import{Renderer as x,TerminalGuard as s,terminalSize as u}from"../packem_shared/Renderer-DsskdkUd.js";export{t as Cell,f as InputParser,x as Renderer,m as StyleMasks,s as TerminalGuard,o as TuiApp,l as createInlineLoop,u as terminalSize};
1
+ import{TuiApp as o}from"../packem_shared/TuiApp-CCVaiKbf.js";import{Cell as t,StyleMasks as m}from"../packem_shared/Cell-BrXn3jxY.js";import{createInlineLoop as l}from"../packem_shared/createInlineLoop-DnEvE2eM.js";import{InputParser as f}from"../packem_shared/InputParser-CiBitCva.js";import{Renderer as x,TerminalGuard as s,terminalSize as u}from"../packem_shared/Renderer-BeS49FNq.js";export{t as Cell,f as InputParser,x as Renderer,m as StyleMasks,s as TerminalGuard,o as TuiApp,l as createInlineLoop,u as terminalSize};