@visulima/tui 2.0.0 → 3.0.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +13 -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-CZ-O0Ckm.js} +1 -1
  69. package/dist/packem_shared/FocusContext-BWFqf9kb.js +1 -0
  70. package/dist/packem_shared/InputParser-CUAGWKQQ.js +2 -0
  71. package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
  72. package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
  73. package/dist/packem_shared/{TuiApp-DjIgv5Sk.js → TuiApp-CCVaiKbf.js} +1 -1
  74. package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
  75. package/dist/packem_shared/{buffer.d-j_dP5JyC.d.ts → buffer.d-CttIC480.d.ts} +26 -26
  76. package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
  77. package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
  78. package/dist/packem_shared/createInlineLoop-BMDYJkRp.js +2 -0
  79. package/dist/packem_shared/{dom.d-g-nsYquD.d.ts → dom.d-CLGlidfI.d.ts} +138 -151
  80. package/dist/packem_shared/{input.d-D-Yxqha8.d.ts → input.d-CL_4MfL-.d.ts} +30 -24
  81. package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
  82. package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
  83. package/dist/packem_shared/reconciler-D4fi5NfR.js +1 -0
  84. package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
  85. package/dist/packem_shared/render-CPVY5vpQ.js +1 -0
  86. package/dist/packem_shared/render-CvhjGwOg.js +24 -0
  87. package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
  88. package/dist/packem_shared/{renderToString-DqLFFPvO.js → renderToString-B1LgWcJe.js} +1 -1
  89. package/dist/packem_shared/{renderToString-DkTmJPaS.js → renderToString-Df6HST7u.js} +1 -1
  90. package/dist/packem_shared/{selection.d-KWphH--_.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
  91. package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
  92. package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
  93. package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
  94. package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
  95. package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
  96. package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
  97. package/dist/react/index.d.ts +160 -178
  98. package/dist/react/index.js +1 -1
  99. package/dist/testing/index.d.ts +151 -151
  100. package/dist/testing/index.js +1 -1
  101. package/index.js +52 -52
  102. package/package.json +13 -13
  103. package/dist/packem_shared/FocusContext-C2Sosxa4.js +0 -1
  104. package/dist/packem_shared/InputParser-CiBitCva.js +0 -2
  105. package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
  106. package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +0 -56
  107. package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
  108. package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
  109. package/dist/packem_shared/createInlineLoop-BT40Wpmx.js +0 -2
  110. package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
  111. package/dist/packem_shared/reconciler-ClpU7Y-V.js +0 -1
  112. package/dist/packem_shared/reconciler-DhUGYWCr.js +0 -1
  113. package/dist/packem_shared/render-D7aV_hO1.js +0 -24
  114. package/dist/packem_shared/render-DMcWfI6-.js +0 -1
  115. package/dist/packem_shared/render.d-BvfwvSCx.d.ts +0 -435
  116. package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
  117. package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
  118. package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
  119. package/dist/packem_shared/styles.d-D7iZuNC-.d.ts +0 -492
  120. package/dist/packem_shared/utils-C8l_3Dzw.js +0 -1
@@ -1,65 +1,65 @@
1
1
  type PersistentStorage = {
2
2
  /**
3
- * Return the persisted JSON-encoded string for `key`, or `undefined` if
4
- * nothing has been stored yet.
5
- */
3
+ * Return the persisted JSON-encoded string for `key`, or `undefined` if
4
+ * nothing has been stored yet.
5
+ */
6
6
  readonly read: (key: string) => string | undefined;
7
7
  /**
8
- * Persist `value` (a JSON-encoded string) for `key`. Errors are swallowed
9
- * by the hook so the UI keeps working in read-only environments.
10
- */
8
+ * Persist `value` (a JSON-encoded string) for `key`. Errors are swallowed
9
+ * by the hook so the UI keeps working in read-only environments.
10
+ */
11
11
  readonly write: (key: string, value: string) => void;
12
12
  };
13
13
  type UsePersistentStateOptions = {
14
14
  /**
15
- * Namespace used by the default file storage. Separates keys across
16
- * independent applications sharing the user's home directory.
17
- * @default "tui"
18
- */
15
+ * Namespace used by the default file storage. Separates keys across
16
+ * independent applications sharing the user's home directory.
17
+ * @default "tui"
18
+ */
19
19
  readonly namespace?: string;
20
20
  /**
21
- * Custom storage backend. When omitted, the default is a file on disk at
22
- * `~/.cache/visulima-tui/<namespace>.json`.
23
- */
21
+ * Custom storage backend. When omitted, the default is a file on disk at
22
+ * `~/.cache/visulima-tui/<namespace>.json`.
23
+ */
24
24
  readonly storage?: PersistentStorage;
25
25
  };
26
26
  /**
27
- * In-memory storage shared across all hook instances that use it. Useful in
28
- * tests and in environments without file access.
29
- */
27
+ * In-memory storage shared across all hook instances that use it. Useful in
28
+ * tests and in environments without file access.
29
+ */
30
30
  declare const createMemoryStorage: () => PersistentStorage;
31
31
  /**
32
- * Default file-backed storage. Reads/writes a single JSON object per
33
- * namespace, keyed by `key`. The directory is created on first write and
34
- * updates use a temp-file + rename to avoid partial writes if the process
35
- * crashes mid-write. Errors are forwarded to `process.stderr.write` so they
36
- * are visible without crashing the UI.
37
- *
38
- * The namespace object is parsed from disk once (lazily) and kept in memory;
39
- * subsequent reads/writes operate on the cached object instead of re-reading
40
- * and re-parsing the whole file on every call.
41
- */
32
+ * Default file-backed storage. Reads/writes a single JSON object per
33
+ * namespace, keyed by `key`. The directory is created on first write and
34
+ * updates use a temp-file + rename to avoid partial writes if the process
35
+ * crashes mid-write. Errors are forwarded to `process.stderr.write` so they
36
+ * are visible without crashing the UI.
37
+ *
38
+ * The namespace object is parsed from disk once (lazily) and kept in memory;
39
+ * subsequent reads/writes operate on the cached object instead of re-reading
40
+ * and re-parsing the whole file on every call.
41
+ */
42
42
  declare const createFileStorage: (namespace: string) => PersistentStorage;
43
43
  /**
44
- * `useState` that persists its value through the configured `storage`
45
- * backend (file on disk by default). Behaves identically to `useState` at
46
- * the call-site.
47
- *
48
- * Persistence happens in a commit-phase effect, **not** inside the state
49
- * updater — updaters must be pure (React may double-invoke them under
50
- * StrictMode or discard them under concurrent rendering), so writing from
51
- * inside one risked double or phantom disk writes. Writing after commit means
52
- * only values that actually render are persisted.
53
- *
54
- * **Lifecycle note:** the storage backend (resolved from `options.storage`
55
- * or a fresh `createFileStorage(namespace)`) is captured once on mount and
56
- * never replaced. Mutating `options.storage` on subsequent renders has no
57
- * effect — remount the hook (e.g. via a `key` prop) if you need to swap
58
- * backends at runtime.
59
- * @param key Unique identifier within the backend namespace.
60
- * @param initialValue Value used when the backend has no entry for `key`.
61
- * @param options Optional storage backend + namespace overrides.
62
- * @returns A `[value, setValue]` tuple. Writes flush in a post-commit effect.
63
- */
44
+ * `useState` that persists its value through the configured `storage`
45
+ * backend (file on disk by default). Behaves identically to `useState` at
46
+ * the call-site.
47
+ *
48
+ * Persistence happens in a commit-phase effect, **not** inside the state
49
+ * updater — updaters must be pure (React may double-invoke them under
50
+ * StrictMode or discard them under concurrent rendering), so writing from
51
+ * inside one risked double or phantom disk writes. Writing after commit means
52
+ * only values that actually render are persisted.
53
+ *
54
+ * **Lifecycle note:** the storage backend (resolved from `options.storage`
55
+ * or a fresh `createFileStorage(namespace)`) is captured once on mount and
56
+ * never replaced. Mutating `options.storage` on subsequent renders has no
57
+ * effect — remount the hook (e.g. via a `key` prop) if you need to swap
58
+ * backends at runtime.
59
+ * @param key Unique identifier within the backend namespace.
60
+ * @param initialValue Value used when the backend has no entry for `key`.
61
+ * @param options Optional storage backend + namespace overrides.
62
+ * @returns A `[value, setValue]` tuple. Writes flush in a post-commit effect.
63
+ */
64
64
  declare const usePersistentState: <T>(key: string, initialValue: T, options?: UsePersistentStateOptions) => readonly [T, (value: T | ((previous: T) => T)) => void];
65
65
  export { PersistentStorage, UsePersistentStateOptions, createFileStorage, createMemoryStorage, usePersistentState as default, usePersistentState };
@@ -1,2 +1,2 @@
1
- import{createRequire as g}from"node:module";import{useRef as m,useState as N,useEffect as b,useCallback as E}from"react";const S=g(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[r,s]=a.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return a.getBuiltinModule(e)}return S(e)},{mkdirSync:v,writeFileSync:h,renameSync:_,readFileSync:w}=l("node:fs"),{homedir:j}=l("node:os"),f=l("node:path"),p=a,q=()=>{const e=new Map;return{read:r=>e.get(r),write:(r,s)=>{e.set(r,s)}}},O=/[/\\]/,$=e=>{if(e===""||e==="."||e===".."||O.test(e)||e.includes("\0"))throw new Error(`[visulima/tui] usePersistentState: invalid namespace ${JSON.stringify(e)} — must not be empty or contain path separators.`)},k=e=>{$(e);const r=f.join(j(),".cache","visulima-tui",`${e}.json`);let s;const i=(t,n)=>{const o=n instanceof Error?n.message:String(n);p.stderr.write(`[visulima/tui] persistent-state ${t} failed: ${o}
2
- `)},c=()=>{if(s!==void 0)return s;try{const t=w(r,"utf8"),n=JSON.parse(t);s=n&&typeof n=="object"?n:{}}catch(t){const n=t?.code;n!=="ENOENT"&&n!=="EACCES"&&i("read",t),s={}}return s};return{read:t=>c()[t],write:(t,n)=>{const o=f.dirname(r),u=`${r}.tmp.${p.pid}`,d=c();d[t]=n;try{v(o,{recursive:!0}),h(u,JSON.stringify(d,null,2),{encoding:"utf8",flag:"w"}),_(u,r)}catch(y){i("write",y)}}}},J=(e,r,s)=>{const i=e.read(r);if(i===void 0)return s;try{return JSON.parse(i)}catch{return s}},C=(e,r,s)=>{const i=m(void 0);i.current??=s?.storage??k(s?.namespace??"tui");const c=i.current,[t,n]=N(()=>J(c,e,r)),o=m(void 0);o.current??={key:e,value:t},b(()=>{if(!(o.current?.key===e&&Object.is(o.current.value,t)))try{c.write(e,JSON.stringify(t)),o.current={key:e,value:t}}catch{}},[e,t,c]);const u=E(d=>{n(d)},[]);return[t,u]};export{k as createFileStorage,q as createMemoryStorage,C as default,C as usePersistentState};
1
+ import{createRequire as g}from"node:module";import{useRef as m,useState as b,useEffect as E,useCallback as O}from"react";let S;const v=e=>(S??=g(import.meta.url))(e),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[r,s]=a.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return a.getBuiltinModule(e)}return v(e)},{mkdirSync:_,writeFileSync:h,renameSync:j,readFileSync:w}=l("node:fs"),{homedir:N}=l("node:os"),f=l("node:path"),p=a,T=()=>{const e=new Map;return{read:r=>e.get(r),write:(r,s)=>{e.set(r,s)}}},$=/[/\\]/,k=e=>{if(e===""||e==="."||e===".."||$.test(e)||e.includes("\0"))throw new Error(`[visulima/tui] usePersistentState: invalid namespace ${JSON.stringify(e)} — must not be empty or contain path separators.`)},J=e=>{k(e);const r=f.join(N(),".cache","visulima-tui",`${e}.json`);let s;const i=(t,n)=>{const o=n instanceof Error?n.message:String(n);p.stderr.write(`[visulima/tui] persistent-state ${t} failed: ${o}
2
+ `)},c=()=>{if(s!==void 0)return s;try{const t=w(r,"utf8"),n=JSON.parse(t);s=n&&typeof n=="object"?n:{}}catch(t){const n=t?.code;n!=="ENOENT"&&n!=="EACCES"&&i("read",t),s={}}return s};return{read:t=>c()[t],write:(t,n)=>{const o=f.dirname(r),u=`${r}.tmp.${p.pid}`,d=c();d[t]=n;try{_(o,{recursive:!0}),h(u,JSON.stringify(d,null,2),{encoding:"utf8",flag:"w"}),j(u,r)}catch(y){i("write",y)}}}},q=(e,r,s)=>{const i=e.read(r);if(i===void 0)return s;try{return JSON.parse(i)}catch{return s}},C=(e,r,s)=>{const i=m(void 0);i.current??=s?.storage??J(s?.namespace??"tui");const c=i.current,[t,n]=b(()=>q(c,e,r)),o=m(void 0);o.current??={key:e,value:t},E(()=>{if(!(o.current?.key===e&&Object.is(o.current.value,t)))try{c.write(e,JSON.stringify(t)),o.current={key:e,value:t}}catch{}},[e,t,c]);const u=O(d=>{n(d)},[]);return[t,u]};export{J as createFileStorage,T as createMemoryStorage,C as default,C as usePersistentState};
@@ -1,27 +1,27 @@
1
1
  type UseScrollAccelerationOptions = {
2
2
  /**
3
- * Velocity multiplier per rapid scroll event.
4
- * @default 1.5
5
- */
3
+ * Velocity multiplier per rapid scroll event.
4
+ * @default 1.5
5
+ */
6
6
  readonly acceleration?: number;
7
7
  /**
8
- * Velocity decay factor per tick (0-1). Lower = faster stop.
9
- * @default 0.92
10
- */
8
+ * Velocity decay factor per tick (0-1). Lower = faster stop.
9
+ * @default 0.92
10
+ */
11
11
  readonly decayRate?: number;
12
12
  /**
13
- * Enable or disable acceleration.
14
- * @default true
15
- */
13
+ * Enable or disable acceleration.
14
+ * @default true
15
+ */
16
16
  readonly isActive?: boolean;
17
17
  /**
18
- * Maximum velocity in lines per tick.
19
- * @default 20
20
- */
18
+ * Maximum velocity in lines per tick.
19
+ * @default 20
20
+ */
21
21
  readonly maxVelocity?: number;
22
22
  /**
23
- * Callback invoked with the scroll delta (signed integer lines) on each tick.
24
- */
23
+ * Callback invoked with the scroll delta (signed integer lines) on each tick.
24
+ */
25
25
  readonly onScroll?: (delta: number) => void;
26
26
  };
27
27
  type UseScrollAccelerationResult = {
@@ -33,15 +33,15 @@ type UseScrollAccelerationResult = {
33
33
  readonly velocity: number;
34
34
  };
35
35
  /**
36
- * Hook providing scroll acceleration with momentum physics.
37
- *
38
- * ```tsx
39
- * const { handleScroll } = useScrollAcceleration({
40
- * onScroll: (delta) => scrollViewRef.current?.scrollBy(delta),
41
- * });
42
- *
43
- * useMouseAction(); // call handleScroll("up") or handleScroll("down") on scroll events
44
- * ```
45
- */
36
+ * Hook providing scroll acceleration with momentum physics.
37
+ *
38
+ * ```tsx
39
+ * const { handleScroll } = useScrollAcceleration({
40
+ * onScroll: (delta) => scrollViewRef.current?.scrollBy(delta),
41
+ * });
42
+ *
43
+ * useMouseAction(); // call handleScroll("up") or handleScroll("down") on scroll events
44
+ * ```
45
+ */
46
46
  declare const useScrollAcceleration: (options?: UseScrollAccelerationOptions) => UseScrollAccelerationResult;
47
47
  export { UseScrollAccelerationOptions, UseScrollAccelerationResult, useScrollAcceleration as default, useScrollAcceleration };
@@ -1,30 +1,30 @@
1
1
  type UseScrollInputOptions = {
2
2
  /**
3
- * Returns the current viewport height in lines. Called on each key event
4
- * so the value is always fresh (avoids stale-closure issues with refs).
5
- */
3
+ * Returns the current viewport height in lines. Called on each key event
4
+ * so the value is always fresh (avoids stale-closure issues with refs).
5
+ */
6
6
  getViewportHeight: () => number;
7
7
  /**
8
- * Enable or disable scroll input handling.
9
- * @default true
10
- */
8
+ * Enable or disable scroll input handling.
9
+ * @default true
10
+ */
11
11
  isActive?: boolean;
12
12
  /**
13
- * Scroll by a relative delta (in lines).
14
- */
13
+ * Scroll by a relative delta (in lines).
14
+ */
15
15
  scrollBy: (delta: number) => void;
16
16
  /**
17
- * Jump to the bottom of the content.
18
- */
17
+ * Jump to the bottom of the content.
18
+ */
19
19
  scrollToBottom: () => void;
20
20
  /**
21
- * Jump to the top of the content.
22
- */
21
+ * Jump to the top of the content.
22
+ */
23
23
  scrollToTop: () => void;
24
24
  /**
25
- * Enable vim-style keybindings (j/k/g/G/u/d).
26
- * @default false
27
- */
25
+ * Enable vim-style keybindings (j/k/g/G/u/d).
26
+ * @default false
27
+ */
28
28
  vimBindings?: boolean;
29
29
  };
30
30
  type UseScrollInputReturn = {
@@ -1,16 +1,16 @@
1
1
  import 'react';
2
2
  type Props = {
3
3
  /**
4
- * Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
5
- */
4
+ * Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
5
+ */
6
6
  readonly stderr: NodeJS.WriteStream;
7
7
  /**
8
- * Write any string to stderr while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `&lt;Static>`, except it can't accept components; it only works with strings.
9
- */
8
+ * Write any string to stderr while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `&lt;Static>`, except it can't accept components; it only works with strings.
9
+ */
10
10
  readonly write: (data: string) => void;
11
11
  };
12
12
  /**
13
- * A React hook that returns the stderr stream.
14
- */
13
+ * A React hook that returns the stderr stream.
14
+ */
15
15
  declare const useStderr: () => Props;
16
16
  export { type Props as StderrProps, useStderr as default, useStderr };
@@ -1 +1 @@
1
- import{useContext as t}from"react";import{t as o}from"../../packem_shared/stderr-context-Bvnik0hL.js";const s=()=>t(o);export{s as default,s as useStderr};
1
+ import{useContext as t}from"react";import{t as o}from"../../packem_shared/stderr-context-CR2LLec6.js";const s=()=>t(o);export{s as default,s as useStderr};
@@ -2,29 +2,29 @@ import { EventEmitter } from 'node:events';
2
2
  import 'react';
3
3
  type PublicProps = {
4
4
  /**
5
- * A boolean flag determining if the current `stdin` supports `setRawMode`. A component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.
6
- */
5
+ * A boolean flag determining if the current `stdin` supports `setRawMode`. A component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.
6
+ */
7
7
  readonly isRawModeSupported: boolean;
8
8
  /**
9
- * Ink exposes this function via own `&lt;StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`. If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
10
- */
9
+ * Ink exposes this function via own `&lt;StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`. If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
10
+ */
11
11
  readonly setRawMode: (value: boolean) => void;
12
12
  /**
13
- * The stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default. Useful if your app needs to handle user input.
14
- */
13
+ * The stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default. Useful if your app needs to handle user input.
14
+ */
15
15
  readonly stdin: NodeJS.ReadStream;
16
16
  };
17
17
  type Props = PublicProps & {
18
18
  readonly internal_eventEmitter: EventEmitter;
19
19
  readonly internal_exitOnCtrlC: boolean;
20
20
  /**
21
- * Enable or disable bracketed paste mode on the terminal. When enabled, pasted text is wrapped in escape sequences that allow it to be distinguished from typed input.
22
- */
21
+ * Enable or disable bracketed paste mode on the terminal. When enabled, pasted text is wrapped in escape sequences that allow it to be distinguished from typed input.
22
+ */
23
23
  readonly setBracketedPasteMode: (value: boolean) => void;
24
24
  };
25
25
  /**
26
- * A React hook that returns the stdin stream and stdin-related utilities.
27
- */
26
+ * A React hook that returns the stdin stream and stdin-related utilities.
27
+ */
28
28
  declare const useStdin: () => PublicProps;
29
29
  declare const useStdinContext: () => Props;
30
30
  export { type PublicProps as StdinProps, useStdin as default, useStdin, useStdinContext };
@@ -1 +1 @@
1
- import{useContext as t}from"react";import{e}from"../../packem_shared/stdin-context-88AhuztD.js";const n=()=>t(e),r=()=>t(e);export{n as default,n as useStdin,r as useStdinContext};
1
+ import{useContext as t}from"react";import{e}from"../../packem_shared/stdin-context-BjMA9Sbi.js";const n=()=>t(e),r=()=>t(e);export{n as default,n as useStdin,r as useStdinContext};
@@ -1,16 +1,16 @@
1
1
  import 'react';
2
2
  type Props = {
3
3
  /**
4
- * Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
5
- */
4
+ * Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
5
+ */
6
6
  readonly stdout: NodeJS.WriteStream;
7
7
  /**
8
- * Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `&lt;Static>`, except it can't accept components; it only works with strings.
9
- */
8
+ * Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `&lt;Static>`, except it can't accept components; it only works with strings.
9
+ */
10
10
  readonly write: (data: string) => void;
11
11
  };
12
12
  /**
13
- * A React hook that returns the stdout stream where Ink renders your app.
14
- */
13
+ * A React hook that returns the stdout stream where Ink renders your app.
14
+ */
15
15
  declare const useStdout: () => Props;
16
16
  export { type Props as StdoutProps, useStdout as default, useStdout };
@@ -1 +1 @@
1
- import{useContext as t}from"react";import{t as o}from"../../packem_shared/stdout-context-BnblEPez.js";const r=()=>t(o);export{r as default,r as useStdout};
1
+ import{useContext as t}from"react";import{t as o}from"../../packem_shared/stdout-context-DAAlQct2.js";const r=()=>t(o);export{r as default,r as useStdout};
@@ -1,13 +1,13 @@
1
1
  type UseStopwatchOptions = {
2
2
  /**
3
- * Whether to start counting immediately.
4
- * @default false
5
- */
3
+ * Whether to start counting immediately.
4
+ * @default false
5
+ */
6
6
  readonly autoStart?: boolean;
7
7
  /**
8
- * Tick interval in milliseconds.
9
- * @default 1000
10
- */
8
+ * Tick interval in milliseconds.
9
+ * @default 1000
10
+ */
11
11
  readonly interval?: number;
12
12
  };
13
13
  type UseStopwatchResult = {
@@ -29,11 +29,11 @@ type UseStopwatchResult = {
29
29
  readonly toggle: () => void;
30
30
  };
31
31
  /**
32
- * A count-up stopwatch hook built on `useAnimation`.
33
- *
34
- * ```tsx
35
- * const { elapsed, isRunning, start, stop, reset, lap, laps } = useStopwatch();
36
- * ```
37
- */
32
+ * A count-up stopwatch hook built on `useAnimation`.
33
+ *
34
+ * ```tsx
35
+ * const { elapsed, isRunning, start, stop, reset, lap, laps } = useStopwatch();
36
+ * ```
37
+ */
38
38
  declare function useStopwatch(options?: UseStopwatchOptions): UseStopwatchResult;
39
39
  export { UseStopwatchOptions, UseStopwatchResult, useStopwatch as default, useStopwatch };
@@ -1,4 +1,4 @@
1
- import { T as TerminalPalette } from "../../packem_shared/terminal-palette.d-D2SQjfn-.js";
1
+ import { T as TerminalPalette } from "../../packem_shared/terminal-palette.d-JbWHISW-.js";
2
2
  import 'node:stream';
3
3
  type UseTerminalPaletteResult = {
4
4
  readonly isLoading: boolean;
@@ -6,15 +6,15 @@ type UseTerminalPaletteResult = {
6
6
  readonly palette: Partial<TerminalPalette> | null;
7
7
  };
8
8
  /**
9
- * Hook that queries the terminal for its current color palette.
10
- * Returns the detected palette colors or null if not yet loaded.
11
- *
12
- * ```tsx
13
- * const { palette, isLoading } = useTerminalPalette();
14
- * if (palette?.background) {
15
- * console.log("Terminal background:", palette.background);
16
- * }
17
- * ```
18
- */
9
+ * Hook that queries the terminal for its current color palette.
10
+ * Returns the detected palette colors or null if not yet loaded.
11
+ *
12
+ * ```tsx
13
+ * const { palette, isLoading } = useTerminalPalette();
14
+ * if (palette?.background) {
15
+ * console.log("Terminal background:", palette.background);
16
+ * }
17
+ * ```
18
+ */
19
19
  declare const useTerminalPalette: () => UseTerminalPaletteResult;
20
20
  export { UseTerminalPaletteResult, useTerminalPalette as default, useTerminalPalette };
@@ -36,7 +36,7 @@ type UseTextBufferResult = {
36
36
  readonly value: string;
37
37
  };
38
38
  /**
39
- * Hook managing a multi-line text buffer with cursor, selection, and undo/redo.
40
- */
39
+ * Hook managing a multi-line text buffer with cursor, selection, and undo/redo.
40
+ */
41
41
  declare const useTextBuffer: (initialValue?: string) => UseTextBufferResult;
42
42
  export { CursorPosition, TextBufferState, UseTextBufferResult, useTextBuffer as default, useTextBuffer };
@@ -1,25 +1,25 @@
1
1
  import { RefObject } from 'react';
2
- import { D as DOMElement } from "../../packem_shared/dom.d-g-nsYquD.js";
3
- import { S as Selection } from "../../packem_shared/selection.d-KWphH--_.js";
2
+ import { D as DOMElement } from "../../packem_shared/dom.d-CLGlidfI.js";
3
+ import { S as Selection } from "../../packem_shared/selection.d-BSAWa4ey.js";
4
4
  import 'yoga-layout';
5
5
  import "../public/cursor.js";
6
6
  import '@visulima/colorize';
7
- import "../../packem_shared/styles.d-D7iZuNC-.js";
7
+ import "../../packem_shared/styles.d-CKGQFfm4.js";
8
8
  import 'type-fest';
9
9
  type UseTextSelectionOptions = {
10
10
  /**
11
- * Automatically copy selected text to clipboard when selection changes.
12
- * @default false
13
- */
11
+ * Automatically copy selected text to clipboard when selection changes.
12
+ * @default false
13
+ */
14
14
  readonly copyOnSelect?: boolean;
15
15
  /**
16
- * Enable or disable text selection.
17
- * @default true
18
- */
16
+ * Enable or disable text selection.
17
+ * @default true
18
+ */
19
19
  readonly isActive?: boolean;
20
20
  /**
21
- * Called whenever the selection changes.
22
- */
21
+ * Called whenever the selection changes.
22
+ */
23
23
  readonly onSelectionChange?: (selectedText: string) => void;
24
24
  };
25
25
  type UseTextSelectionResult = {
@@ -33,12 +33,12 @@ type UseTextSelectionResult = {
33
33
  readonly selection: Selection;
34
34
  };
35
35
  /**
36
- * Hook for managing text selection on a DOM element.
37
- *
38
- * ```tsx
39
- * const ref = useRef(null);
40
- * const { selectedText, selectAll, clearSelection } = useTextSelection(ref);
41
- * ```
42
- */
36
+ * Hook for managing text selection on a DOM element.
37
+ *
38
+ * ```tsx
39
+ * const ref = useRef(null);
40
+ * const { selectedText, selectAll, clearSelection } = useTextSelection(ref);
41
+ * ```
42
+ */
43
43
  declare const useTextSelection: (ref: RefObject<DOMElement | null>, options?: UseTextSelectionOptions) => UseTextSelectionResult;
44
44
  export { UseTextSelectionOptions, UseTextSelectionResult, useTextSelection as default, useTextSelection };
@@ -1,24 +1,24 @@
1
1
  type UseTimeoutOptions = {
2
2
  /**
3
- * When false, the timer never starts. Flipping to true restarts it.
4
- * @default true
5
- */
3
+ * When false, the timer never starts. Flipping to true restarts it.
4
+ * @default true
5
+ */
6
6
  readonly isActive?: boolean;
7
7
  };
8
8
  type UseTimeoutResult = {
9
9
  /**
10
- * Cancel the pending timer (no-op if already fired or never scheduled).
11
- */
10
+ * Cancel the pending timer (no-op if already fired or never scheduled).
11
+ */
12
12
  readonly cancel: () => void;
13
13
  /**
14
- * Restart the timer from now with the current delay.
15
- */
14
+ * Restart the timer from now with the current delay.
15
+ */
16
16
  readonly reset: () => void;
17
17
  };
18
18
  /**
19
- * A React hook that fires `callback` once after `delay` ms. Changing `delay`
20
- * or toggling `isActive` reschedules the timer from zero. Call `reset()` to
21
- * restart on demand.
22
- */
19
+ * A React hook that fires `callback` once after `delay` ms. Changing `delay`
20
+ * or toggling `isActive` reschedules the timer from zero. Call `reset()` to
21
+ * restart on demand.
22
+ */
23
23
  declare const useTimeout: (callback: () => void, delay: number, options?: UseTimeoutOptions) => UseTimeoutResult;
24
24
  export { UseTimeoutOptions, UseTimeoutResult, useTimeout as default, useTimeout };
@@ -1,21 +1,21 @@
1
1
  type UseTimerOptions = {
2
2
  /**
3
- * Whether to start the timer immediately.
4
- * @default false
5
- */
3
+ * Whether to start the timer immediately.
4
+ * @default false
5
+ */
6
6
  readonly autoStart?: boolean;
7
7
  /**
8
- * Total countdown duration in milliseconds.
9
- */
8
+ * Total countdown duration in milliseconds.
9
+ */
10
10
  readonly duration: number;
11
11
  /**
12
- * Tick interval in milliseconds.
13
- * @default 1000
14
- */
12
+ * Tick interval in milliseconds.
13
+ * @default 1000
14
+ */
15
15
  readonly interval?: number;
16
16
  /**
17
- * Called once when the timer reaches zero.
18
- */
17
+ * Called once when the timer reaches zero.
18
+ */
19
19
  readonly onTimeout?: () => void;
20
20
  };
21
21
  type UseTimerResult = {
@@ -35,14 +35,14 @@ type UseTimerResult = {
35
35
  readonly toggle: () => void;
36
36
  };
37
37
  /**
38
- * A countdown timer hook built on `useAnimation`.
39
- *
40
- * ```tsx
41
- * const { remaining, isRunning, start, stop, reset, isFinished } = useTimer({
42
- * duration: 60_000,
43
- * onTimeout: () => console.log("Time's up!"),
44
- * });
45
- * ```
46
- */
38
+ * A countdown timer hook built on `useAnimation`.
39
+ *
40
+ * ```tsx
41
+ * const { remaining, isRunning, start, stop, reset, isFinished } = useTimer({
42
+ * duration: 60_000,
43
+ * onTimeout: () => console.log("Time's up!"),
44
+ * });
45
+ * ```
46
+ */
47
47
  declare function useTimer(options: UseTimerOptions): UseTimerResult;
48
48
  export { UseTimerOptions, UseTimerResult, useTimer as default, useTimer };
@@ -1,18 +1,18 @@
1
1
  /**
2
- * Dimensions of the terminal window.
3
- */
2
+ * Dimensions of the terminal window.
3
+ */
4
4
  type WindowSize = {
5
5
  /**
6
- * Number of columns (horizontal character cells).
7
- */
6
+ * Number of columns (horizontal character cells).
7
+ */
8
8
  readonly columns: number;
9
9
  /**
10
- * Number of rows (vertical character cells).
11
- */
10
+ * Number of rows (vertical character cells).
11
+ */
12
12
  readonly rows: number;
13
13
  };
14
14
  /**
15
- * A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
16
- */
15
+ * A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
16
+ */
17
17
  declare const useWindowSize: () => WindowSize;
18
18
  export { WindowSize, useWindowSize as default, useWindowSize };
@@ -1 +1 @@
1
- import{useState as i,useEffect as n}from"react";import{g as o}from"../../packem_shared/utils-C8l_3Dzw.js";import f from"./use-stdout.js";const c=()=>{const{stdout:e}=f(),[r,s]=i(()=>o(e));return n(()=>{const t=()=>{s(o(e))};return e.on("resize",t),()=>{e.off("resize",t)}},[e]),r};export{c as default,c as useWindowSize};
1
+ import{useState as i,useEffect as n}from"react";import{g as o}from"../../packem_shared/utils-CVgM8kTn.js";import f from"./use-stdout.js";const c=()=>{const{stdout:e}=f(),[r,s]=i(()=>o(e));return n(()=>{const t=()=>{s(o(e))};return e.on("resize",t),()=>{e.off("resize",t)}},[e]),r};export{c as default,c as useWindowSize};