@effect-tui/react 0.2.0 → 0.2.2

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 (289) hide show
  1. package/dist/jsx-runtime.d.ts +6 -6
  2. package/dist/jsx-runtime.d.ts.map +1 -1
  3. package/dist/src/codeblock.js.map +1 -1
  4. package/dist/src/components/Divider.d.ts.map +1 -1
  5. package/dist/src/components/Divider.js +1 -1
  6. package/dist/src/components/Divider.js.map +1 -1
  7. package/dist/src/components/Markdown.d.ts.map +1 -1
  8. package/dist/src/components/Markdown.js +1 -1
  9. package/dist/src/components/Markdown.js.map +1 -1
  10. package/dist/src/components/MultilineTextInput.d.ts.map +1 -1
  11. package/dist/src/components/MultilineTextInput.js +2 -2
  12. package/dist/src/components/MultilineTextInput.js.map +1 -1
  13. package/dist/src/components/Static.d.ts.map +1 -1
  14. package/dist/src/components/Static.js +1 -1
  15. package/dist/src/components/Static.js.map +1 -1
  16. package/dist/src/components/TextInput.d.ts.map +1 -1
  17. package/dist/src/components/TextInput.js +3 -3
  18. package/dist/src/components/TextInput.js.map +1 -1
  19. package/dist/src/components/index.d.ts +4 -4
  20. package/dist/src/components/index.d.ts.map +1 -1
  21. package/dist/src/components/index.js +4 -4
  22. package/dist/src/components/index.js.map +1 -1
  23. package/dist/src/console/ConsoleCapture.d.ts.map +1 -1
  24. package/dist/src/console/ConsoleCapture.js +1 -1
  25. package/dist/src/console/ConsoleCapture.js.map +1 -1
  26. package/dist/src/console/ConsolePopover.d.ts.map +1 -1
  27. package/dist/src/console/ConsolePopover.js +11 -13
  28. package/dist/src/console/ConsolePopover.js.map +1 -1
  29. package/dist/src/console/index.d.ts +1 -1
  30. package/dist/src/console/index.d.ts.map +1 -1
  31. package/dist/src/console/index.js +1 -1
  32. package/dist/src/console/index.js.map +1 -1
  33. package/dist/src/console/useConsole.d.ts.map +1 -1
  34. package/dist/src/console/useConsole.js +2 -2
  35. package/dist/src/console/useConsole.js.map +1 -1
  36. package/dist/src/debug/DebugOverlay.d.ts +1 -1
  37. package/dist/src/debug/DebugOverlay.d.ts.map +1 -1
  38. package/dist/src/debug/DebugOverlay.js +1 -1
  39. package/dist/src/debug/DebugOverlay.js.map +1 -1
  40. package/dist/src/dev/Toast.d.ts.map +1 -1
  41. package/dist/src/dev/Toast.js +2 -2
  42. package/dist/src/dev/Toast.js.map +1 -1
  43. package/dist/src/dev/index.d.ts +1 -1
  44. package/dist/src/dev/index.d.ts.map +1 -1
  45. package/dist/src/dev/index.js +1 -1
  46. package/dist/src/dev/index.js.map +1 -1
  47. package/dist/src/dev.d.ts +1 -2
  48. package/dist/src/dev.d.ts.map +1 -1
  49. package/dist/src/dev.js +10 -10
  50. package/dist/src/dev.js.map +1 -1
  51. package/dist/src/exit.d.ts +7 -0
  52. package/dist/src/exit.d.ts.map +1 -0
  53. package/dist/src/exit.js +9 -0
  54. package/dist/src/exit.js.map +1 -0
  55. package/dist/src/highlight.d.ts +1 -1
  56. package/dist/src/highlight.d.ts.map +1 -1
  57. package/dist/src/highlight.js.map +1 -1
  58. package/dist/src/hooks/index.d.ts +3 -3
  59. package/dist/src/hooks/index.d.ts.map +1 -1
  60. package/dist/src/hooks/index.js.map +1 -1
  61. package/dist/src/hooks/use-keyboard.d.ts.map +1 -1
  62. package/dist/src/hooks/use-keyboard.js.map +1 -1
  63. package/dist/src/hooks/use-mouse.d.ts +1 -1
  64. package/dist/src/hooks/use-mouse.d.ts.map +1 -1
  65. package/dist/src/hooks/use-mouse.js.map +1 -1
  66. package/dist/src/hooks/use-quit.d.ts.map +1 -1
  67. package/dist/src/hooks/use-quit.js +2 -1
  68. package/dist/src/hooks/use-quit.js.map +1 -1
  69. package/dist/src/hooks/use-scroll.d.ts.map +1 -1
  70. package/dist/src/hooks/use-scroll.js +2 -2
  71. package/dist/src/hooks/use-scroll.js.map +1 -1
  72. package/dist/src/hooks/useFrameStats.d.ts.map +1 -1
  73. package/dist/src/hooks/useFrameStats.js.map +1 -1
  74. package/dist/src/hosts/base.d.ts +2 -2
  75. package/dist/src/hosts/base.d.ts.map +1 -1
  76. package/dist/src/hosts/box.d.ts +3 -3
  77. package/dist/src/hosts/box.d.ts.map +1 -1
  78. package/dist/src/hosts/box.js +1 -1
  79. package/dist/src/hosts/box.js.map +1 -1
  80. package/dist/src/hosts/canvas.d.ts +6 -3
  81. package/dist/src/hosts/canvas.d.ts.map +1 -1
  82. package/dist/src/hosts/canvas.js +9 -1
  83. package/dist/src/hosts/canvas.js.map +1 -1
  84. package/dist/src/hosts/codeblock.d.ts +2 -2
  85. package/dist/src/hosts/codeblock.d.ts.map +1 -1
  86. package/dist/src/hosts/codeblock.js +1 -1
  87. package/dist/src/hosts/codeblock.js.map +1 -1
  88. package/dist/src/hosts/flex-container.d.ts +3 -3
  89. package/dist/src/hosts/flex-container.d.ts.map +1 -1
  90. package/dist/src/hosts/flex-container.js +1 -1
  91. package/dist/src/hosts/flex-container.js.map +1 -1
  92. package/dist/src/hosts/hstack.d.ts +1 -1
  93. package/dist/src/hosts/index.d.ts +8 -8
  94. package/dist/src/hosts/index.d.ts.map +1 -1
  95. package/dist/src/hosts/index.js +13 -13
  96. package/dist/src/hosts/index.js.map +1 -1
  97. package/dist/src/hosts/overlay-item.d.ts +1 -1
  98. package/dist/src/hosts/overlay.d.ts +1 -1
  99. package/dist/src/hosts/overlay.d.ts.map +1 -1
  100. package/dist/src/hosts/overlay.js +1 -1
  101. package/dist/src/hosts/overlay.js.map +1 -1
  102. package/dist/src/hosts/scroll.d.ts +2 -2
  103. package/dist/src/hosts/scroll.d.ts.map +1 -1
  104. package/dist/src/hosts/scroll.js +1 -1
  105. package/dist/src/hosts/scroll.js.map +1 -1
  106. package/dist/src/hosts/single-child.d.ts +1 -1
  107. package/dist/src/hosts/single-child.d.ts.map +1 -1
  108. package/dist/src/hosts/spacer.d.ts +1 -1
  109. package/dist/src/hosts/spacer.d.ts.map +1 -1
  110. package/dist/src/hosts/text.d.ts +2 -2
  111. package/dist/src/hosts/text.d.ts.map +1 -1
  112. package/dist/src/hosts/text.js +1 -1
  113. package/dist/src/hosts/text.js.map +1 -1
  114. package/dist/src/hosts/vstack.d.ts +1 -1
  115. package/dist/src/hosts/zstack.d.ts +2 -2
  116. package/dist/src/hosts/zstack.d.ts.map +1 -1
  117. package/dist/src/hosts/zstack.js +1 -1
  118. package/dist/src/hosts/zstack.js.map +1 -1
  119. package/dist/src/index.d.ts +17 -21
  120. package/dist/src/index.d.ts.map +1 -1
  121. package/dist/src/index.js +11 -15
  122. package/dist/src/index.js.map +1 -1
  123. package/dist/src/inline/index.d.ts.map +1 -1
  124. package/dist/src/inline/index.js +1 -1
  125. package/dist/src/inline/index.js.map +1 -1
  126. package/dist/src/motion/color-motion-value.d.ts +1 -1
  127. package/dist/src/motion/color-motion-value.d.ts.map +1 -1
  128. package/dist/src/motion/color-motion-value.js.map +1 -1
  129. package/dist/src/motion/color.d.ts +1 -1
  130. package/dist/src/motion/color.d.ts.map +1 -1
  131. package/dist/src/motion/color.js +1 -1
  132. package/dist/src/motion/color.js.map +1 -1
  133. package/dist/src/motion/color.test.js +2 -2
  134. package/dist/src/motion/color.test.js.map +1 -1
  135. package/dist/src/motion/hooks.d.ts +3 -3
  136. package/dist/src/motion/hooks.d.ts.map +1 -1
  137. package/dist/src/motion/hooks.js +1 -1
  138. package/dist/src/motion/hooks.js.map +1 -1
  139. package/dist/src/motion/index.d.ts +2 -2
  140. package/dist/src/motion/index.d.ts.map +1 -1
  141. package/dist/src/motion/index.js +3 -3
  142. package/dist/src/motion/index.js.map +1 -1
  143. package/dist/src/motion/motion-value.d.ts +5 -5
  144. package/dist/src/motion/motion-value.d.ts.map +1 -1
  145. package/dist/src/motion/motion-value.js +4 -4
  146. package/dist/src/motion/motion-value.js.map +1 -1
  147. package/dist/src/motion/motion-value.test.js +1 -1
  148. package/dist/src/motion/motion-value.test.js.map +1 -1
  149. package/dist/src/reconciler/host-config.d.ts +1 -1
  150. package/dist/src/reconciler/host-config.d.ts.map +1 -1
  151. package/dist/src/reconciler/host-config.js +1 -1
  152. package/dist/src/reconciler/host-config.js.map +1 -1
  153. package/dist/src/reconciler/types.d.ts +1 -1
  154. package/dist/src/remote/Procedures.d.ts.map +1 -1
  155. package/dist/src/remote/Procedures.js.map +1 -1
  156. package/dist/src/remote/Router.d.ts +1 -1
  157. package/dist/src/remote/Router.d.ts.map +1 -1
  158. package/dist/src/remote/Router.js +1 -1
  159. package/dist/src/remote/Router.js.map +1 -1
  160. package/dist/src/remote/Server.d.ts +1 -1
  161. package/dist/src/remote/Server.d.ts.map +1 -1
  162. package/dist/src/remote/Server.js +3 -3
  163. package/dist/src/remote/Server.js.map +1 -1
  164. package/dist/src/remote/index.d.ts +2 -2
  165. package/dist/src/remote/index.d.ts.map +1 -1
  166. package/dist/src/remote/index.js +5 -5
  167. package/dist/src/remote/index.js.map +1 -1
  168. package/dist/src/renderer/core/FrameBuilder.d.ts.map +1 -1
  169. package/dist/src/renderer/core/FrameBuilder.js.map +1 -1
  170. package/dist/src/renderer/input/InputProcessor.js +1 -1
  171. package/dist/src/renderer/input/InputProcessor.js.map +1 -1
  172. package/dist/src/renderer/lifecycle/TerminalSetup.d.ts +1 -1
  173. package/dist/src/renderer/lifecycle/TerminalSetup.d.ts.map +1 -1
  174. package/dist/src/renderer/lifecycle/index.d.ts +1 -1
  175. package/dist/src/renderer/lifecycle/index.d.ts.map +1 -1
  176. package/dist/src/renderer/lifecycle/index.js +1 -1
  177. package/dist/src/renderer/lifecycle/index.js.map +1 -1
  178. package/dist/src/renderer/modes/FullscreenRenderer.d.ts +1 -1
  179. package/dist/src/renderer/modes/FullscreenRenderer.d.ts.map +1 -1
  180. package/dist/src/renderer/modes/InlineRenderer.d.ts +1 -1
  181. package/dist/src/renderer/modes/InlineRenderer.d.ts.map +1 -1
  182. package/dist/src/renderer/modes/InlineRenderer.js +1 -1
  183. package/dist/src/renderer/modes/InlineRenderer.js.map +1 -1
  184. package/dist/src/renderer/modes/StaticContentRenderer.d.ts.map +1 -1
  185. package/dist/src/renderer/modes/StaticContentRenderer.js.map +1 -1
  186. package/dist/src/renderer/modes/index.d.ts +1 -1
  187. package/dist/src/renderer/modes/index.d.ts.map +1 -1
  188. package/dist/src/renderer/modes/index.js.map +1 -1
  189. package/dist/src/renderer-context.js +1 -1
  190. package/dist/src/renderer-context.js.map +1 -1
  191. package/dist/src/renderer-types.d.ts +7 -1
  192. package/dist/src/renderer-types.d.ts.map +1 -1
  193. package/dist/src/renderer.d.ts +2 -2
  194. package/dist/src/renderer.d.ts.map +1 -1
  195. package/dist/src/renderer.js +41 -16
  196. package/dist/src/renderer.js.map +1 -1
  197. package/dist/src/test/index.d.ts +2 -2
  198. package/dist/src/test/index.d.ts.map +1 -1
  199. package/dist/src/test/index.js +1 -1
  200. package/dist/src/test/index.js.map +1 -1
  201. package/dist/src/test/render-tui.d.ts +2 -2
  202. package/dist/src/test/render-tui.d.ts.map +1 -1
  203. package/dist/src/test/render-tui.js +2 -2
  204. package/dist/src/test/render-tui.js.map +1 -1
  205. package/dist/src/utils/flex-layout.d.ts +15 -1
  206. package/dist/src/utils/flex-layout.d.ts.map +1 -1
  207. package/dist/src/utils/flex-layout.js +79 -24
  208. package/dist/src/utils/flex-layout.js.map +1 -1
  209. package/dist/src/utils/index.d.ts +4 -4
  210. package/dist/src/utils/index.d.ts.map +1 -1
  211. package/dist/src/utils/index.js +2 -2
  212. package/dist/src/utils/index.js.map +1 -1
  213. package/dist/src/utils/styles.d.ts.map +1 -1
  214. package/dist/src/utils/styles.js.map +1 -1
  215. package/dist/src/visualize/index.js +2 -2
  216. package/dist/src/visualize/index.js.map +1 -1
  217. package/dist/tsconfig.tsbuildinfo +1 -1
  218. package/jsx-runtime.ts +6 -6
  219. package/package.json +2 -2
  220. package/src/codeblock.tsx +1 -1
  221. package/src/components/Divider.tsx +1 -1
  222. package/src/components/Markdown.tsx +2 -2
  223. package/src/components/MultilineTextInput.tsx +9 -9
  224. package/src/components/Static.tsx +1 -1
  225. package/src/components/TextInput.tsx +9 -9
  226. package/src/components/index.ts +4 -4
  227. package/src/console/ConsoleCapture.ts +1 -1
  228. package/src/console/ConsolePopover.tsx +112 -119
  229. package/src/console/index.ts +1 -3
  230. package/src/console/useConsole.ts +2 -2
  231. package/src/debug/DebugOverlay.ts +3 -6
  232. package/src/dev/Toast.tsx +12 -10
  233. package/src/dev/index.ts +1 -1
  234. package/src/dev.tsx +11 -12
  235. package/src/exit.ts +8 -0
  236. package/src/highlight.ts +1 -1
  237. package/src/hooks/index.ts +3 -3
  238. package/src/hooks/use-keyboard.ts +1 -1
  239. package/src/hooks/use-mouse.ts +1 -1
  240. package/src/hooks/use-quit.ts +2 -1
  241. package/src/hooks/use-scroll.ts +9 -11
  242. package/src/hooks/useFrameStats.ts +1 -1
  243. package/src/hosts/base.ts +2 -2
  244. package/src/hosts/box.ts +4 -4
  245. package/src/hosts/canvas.ts +14 -3
  246. package/src/hosts/codeblock.ts +3 -3
  247. package/src/hosts/flex-container.ts +3 -3
  248. package/src/hosts/hstack.ts +1 -1
  249. package/src/hosts/index.ts +14 -14
  250. package/src/hosts/overlay-item.ts +1 -1
  251. package/src/hosts/overlay.ts +2 -2
  252. package/src/hosts/scroll.ts +3 -3
  253. package/src/hosts/single-child.ts +1 -1
  254. package/src/hosts/spacer.ts +1 -1
  255. package/src/hosts/text.ts +3 -3
  256. package/src/hosts/vstack.ts +1 -1
  257. package/src/hosts/zstack.ts +2 -2
  258. package/src/index.ts +60 -60
  259. package/src/inline/index.tsx +1 -1
  260. package/src/motion/color-motion-value.ts +1 -1
  261. package/src/motion/color.test.ts +2 -2
  262. package/src/motion/color.ts +2 -2
  263. package/src/motion/hooks.ts +3 -3
  264. package/src/motion/index.ts +8 -8
  265. package/src/motion/motion-value.test.ts +1 -1
  266. package/src/motion/motion-value.ts +11 -11
  267. package/src/reconciler/host-config.ts +3 -3
  268. package/src/reconciler/types.ts +1 -1
  269. package/src/remote/Procedures.ts +1 -7
  270. package/src/remote/Router.ts +3 -7
  271. package/src/remote/Server.ts +7 -12
  272. package/src/remote/index.ts +6 -10
  273. package/src/renderer/core/FrameBuilder.ts +1 -1
  274. package/src/renderer/input/InputProcessor.ts +1 -1
  275. package/src/renderer/lifecycle/TerminalSetup.ts +1 -1
  276. package/src/renderer/lifecycle/index.ts +1 -1
  277. package/src/renderer/modes/FullscreenRenderer.ts +1 -1
  278. package/src/renderer/modes/InlineRenderer.ts +2 -2
  279. package/src/renderer/modes/StaticContentRenderer.ts +1 -1
  280. package/src/renderer/modes/index.ts +1 -1
  281. package/src/renderer-context.ts +1 -1
  282. package/src/renderer-types.ts +7 -1
  283. package/src/renderer.ts +53 -28
  284. package/src/test/index.ts +4 -4
  285. package/src/test/render-tui.ts +3 -3
  286. package/src/utils/flex-layout.ts +83 -24
  287. package/src/utils/index.ts +8 -8
  288. package/src/utils/styles.ts +2 -2
  289. package/src/visualize/index.tsx +2 -2
@@ -1,4 +1,5 @@
1
1
  import { useCallback } from "react"
2
+ import { requestExit } from "../exit.js"
2
3
  import { useRenderer } from "../renderer-context.js"
3
4
 
4
5
  /**
@@ -26,7 +27,7 @@ export function useQuit(): (code?: number) => void {
26
27
  return useCallback(
27
28
  (code = 0) => {
28
29
  renderer.stop()
29
- process.exit(code)
30
+ requestExit(code)
30
31
  },
31
32
  [renderer],
32
33
  )
@@ -1,8 +1,9 @@
1
1
  // use-scroll.ts — Hook for managing scroll state with keyboard/mouse input
2
- import { useState, useCallback, useRef, useMemo, useLayoutEffect } from "react"
2
+
3
3
  import type { KeyMsg } from "@effect-tui/core"
4
- import { useKeyboard } from "./use-keyboard.js"
4
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react"
5
5
  import { useTerminalSize } from "../renderer.js"
6
+ import { useKeyboard } from "./use-keyboard.js"
6
7
 
7
8
  // ============================================================================
8
9
  // Scroll Acceleration (macOS-style)
@@ -356,15 +357,12 @@ export function useScroll(options: UseScrollOptions = {}): UseScrollReturn {
356
357
  }
357
358
 
358
359
  // Handle effective offset sync from host (when sticky adjusts the offset)
359
- const handleEffectiveOffset = useCallback(
360
- (effectiveOffset: number) => {
361
- // Sync the ref so scrollToVisible uses the actual rendered position
362
- offsetRef.current = effectiveOffset
363
- // Also update state to keep in sync (but don't trigger wasAtEnd change)
364
- setOffsetRaw(effectiveOffset)
365
- },
366
- [],
367
- )
360
+ const handleEffectiveOffset = useCallback((effectiveOffset: number) => {
361
+ // Sync the ref so scrollToVisible uses the actual rendered position
362
+ offsetRef.current = effectiveOffset
363
+ // Also update state to keep in sync (but don't trigger wasAtEnd change)
364
+ setOffsetRaw(effectiveOffset)
365
+ }, [])
368
366
 
369
367
  const scrollProps = {
370
368
  offset,
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from "react"
2
- import { useRenderer } from "../renderer.js"
3
2
  import type { FrameStats } from "../renderer.js"
3
+ import { useRenderer } from "../renderer.js"
4
4
 
5
5
  /**
6
6
  * Subscribe to per-frame renderer stats (if enabled).
package/src/hosts/base.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { CellBuffer, Palette, Color } from "@effect-tui/core"
2
- import type { HostInstance, Rect, Size, HostContext, CommonProps } from "../reconciler/types.js"
1
+ import type { CellBuffer, Color, Palette } from "@effect-tui/core"
2
+ import type { CommonProps, HostContext, HostInstance, Rect, Size } from "../reconciler/types.js"
3
3
 
4
4
  /** Host that may have a background color (e.g., BoxHost) */
5
5
  export interface HostWithBg extends HostInstance {
package/src/hosts/box.ts CHANGED
@@ -1,17 +1,17 @@
1
- import type { CellBuffer, Palette, Color } from "@effect-tui/core"
1
+ import type { CellBuffer, Color, Palette } from "@effect-tui/core"
2
2
  import { Colors } from "@effect-tui/core"
3
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
4
- import { SingleChildHost } from "./single-child.js"
3
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
5
4
  import {
6
5
  type BorderKind,
7
6
  borderChars,
8
7
  drawBorder,
9
8
  type Padding,
10
9
  type PaddingInput,
11
- resolvePadding,
12
10
  resolveInheritedBgStyle,
11
+ resolvePadding,
13
12
  toColorValue,
14
13
  } from "../utils/index.js"
14
+ import { SingleChildHost } from "./single-child.js"
15
15
 
16
16
  export type { BorderKind }
17
17
 
@@ -1,15 +1,16 @@
1
- import type { CellBuffer, Palette, Color } from "@effect-tui/core"
1
+ import type { CellBuffer, Color, Palette } from "@effect-tui/core"
2
2
  import { Colors } from "@effect-tui/core"
3
- import type { HostContext, Size, CommonProps } from "../reconciler/types.js"
4
- import { BaseHost } from "./base.js"
3
+ import type { CommonProps, HostContext, Size } from "../reconciler/types.js"
5
4
  import {
6
5
  type BorderKind,
7
6
  borderChars,
8
7
  drawBorder,
9
8
  resolveBgStyle,
9
+ resolveInheritedBgStyle,
10
10
  styleIdFromProps,
11
11
  toColorValue,
12
12
  } from "../utils/index.js"
13
+ import { BaseHost } from "./base.js"
13
14
 
14
15
  export type { BorderKind }
15
16
 
@@ -62,12 +63,15 @@ export interface CanvasProps extends CommonProps {
62
63
  width?: number
63
64
  /** Fixed height (default: fill available) */
64
65
  height?: number
66
+ /** Inherit background color from parent and pre-fill canvas (default: false) */
67
+ inheritBg?: boolean
65
68
  }
66
69
 
67
70
  export class CanvasHost extends BaseHost {
68
71
  draw: CanvasProps["draw"] = () => {}
69
72
  fixedWidth?: number
70
73
  fixedHeight?: number
74
+ inheritBg = false
71
75
 
72
76
  constructor(props: CanvasProps, ctx: HostContext) {
73
77
  super("canvas", props, ctx)
@@ -85,6 +89,12 @@ export class CanvasHost extends BaseHost {
85
89
  if (!this.rect) return
86
90
  const { x: ox, y: oy, w, h } = this.rect
87
91
 
92
+ // Pre-fill with inherited background if requested
93
+ if (this.inheritBg) {
94
+ const { styleId } = resolveInheritedBgStyle(palette, undefined, this.parent)
95
+ buffer.fillRect(ox, oy, w, h, " ".codePointAt(0)!, styleId)
96
+ }
97
+
88
98
  // Create draw context
89
99
  const ctx: DrawContext = {
90
100
  width: w,
@@ -180,5 +190,6 @@ export class CanvasHost extends BaseHost {
180
190
  }
181
191
  if (props.width !== undefined) this.fixedWidth = props.width as number
182
192
  if (props.height !== undefined) this.fixedHeight = props.height as number
193
+ if (props.inheritBg !== undefined) this.inheritBg = props.inheritBg as boolean
183
194
  }
184
195
  }
@@ -1,8 +1,8 @@
1
- import { Colors, displayWidth, type CellBuffer, type Color, type Palette } from "@effect-tui/core"
1
+ import { type CellBuffer, type Color, Colors, displayWidth, type Palette } from "@effect-tui/core"
2
2
  import type { HighlightLine } from "../highlight.js"
3
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
3
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
4
+ import { type Padding, type PaddingInput, resolveBgStyle, resolvePadding, styleIdFromProps } from "../utils/index.js"
4
5
  import { BaseHost } from "./base.js"
5
- import { type Padding, type PaddingInput, resolvePadding, resolveBgStyle, styleIdFromProps } from "../utils/index.js"
6
6
 
7
7
  export interface CodeBlockProps extends CommonProps {
8
8
  lines: HighlightLine[]
@@ -1,9 +1,9 @@
1
1
  // flex-container.ts — Unified base class for VStackHost and HStackHost
2
- import type { CellBuffer, Palette, Color } from "@effect-tui/core"
2
+ import type { CellBuffer, Color, Palette } from "@effect-tui/core"
3
3
  import { splitConstraints } from "@effect-tui/core"
4
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
4
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
5
+ import { type FlexAlignment, type FlexAxis, layoutFlex, measureFlex, resolveBgStyle } from "../utils/index.js"
5
6
  import { BaseHost } from "./base.js"
6
- import { measureFlex, layoutFlex, type FlexAxis, type FlexAlignment, resolveBgStyle } from "../utils/index.js"
7
7
 
8
8
  export type CrossAlignment<A extends FlexAxis> = A extends "vertical"
9
9
  ? "leading" | "center" | "trailing"
@@ -1,4 +1,4 @@
1
- import type { HostContext, CommonProps } from "../reconciler/types.js"
1
+ import type { CommonProps, HostContext } from "../reconciler/types.js"
2
2
  import { FlexContainerHost, type FlexContainerProps } from "./flex-container.js"
3
3
 
4
4
  export interface HStackProps extends CommonProps {
@@ -1,30 +1,30 @@
1
- import type { HostContext, CommonProps } from "../reconciler/types.js"
1
+ import type { CommonProps, HostContext } from "../reconciler/types.js"
2
2
  import type { BaseHost } from "./base.js"
3
- import { TextHost, RawTextHost } from "./text.js"
4
- import { SpacerHost } from "./spacer.js"
5
- import { VStackHost } from "./vstack.js"
6
- import { HStackHost } from "./hstack.js"
7
- import { ZStackHost } from "./zstack.js"
8
3
  import { BoxHost } from "./box.js"
9
4
  import { CanvasHost } from "./canvas.js"
10
5
  import { CodeBlockHost } from "./codeblock.js"
11
- import { ScrollHost } from "./scroll.js"
6
+ import { HStackHost } from "./hstack.js"
12
7
  import { OverlayHost } from "./overlay.js"
13
8
  import { OverlayItemHost } from "./overlay-item.js"
14
- export { SingleChildHost } from "./single-child.js"
9
+ import { ScrollHost } from "./scroll.js"
10
+ import { SpacerHost } from "./spacer.js"
11
+ import { RawTextHost, TextHost } from "./text.js"
12
+ import { VStackHost } from "./vstack.js"
13
+ import { ZStackHost } from "./zstack.js"
15
14
 
16
15
  export { BaseHost } from "./base.js"
17
- export { TextHost, RawTextHost, type TextProps } from "./text.js"
18
- export { SpacerHost, type SpacerProps } from "./spacer.js"
19
- export { VStackHost, type VStackProps } from "./vstack.js"
20
- export { HStackHost, type HStackProps } from "./hstack.js"
21
- export { ZStackHost, type ZStackProps } from "./zstack.js"
22
16
  export { BoxHost, type BoxProps } from "./box.js"
23
17
  export { CanvasHost, type CanvasProps, type DrawContext } from "./canvas.js"
24
18
  export { CodeBlockHost, type CodeBlockProps } from "./codeblock.js"
25
- export { ScrollHost, type ScrollProps } from "./scroll.js"
19
+ export { HStackHost, type HStackProps } from "./hstack.js"
26
20
  export { OverlayHost, type OverlayProps } from "./overlay.js"
27
21
  export { OverlayItemHost, type OverlayItemProps } from "./overlay-item.js"
22
+ export { ScrollHost, type ScrollProps } from "./scroll.js"
23
+ export { SingleChildHost } from "./single-child.js"
24
+ export { SpacerHost, type SpacerProps } from "./spacer.js"
25
+ export { RawTextHost, TextHost, type TextProps } from "./text.js"
26
+ export { VStackHost, type VStackProps } from "./vstack.js"
27
+ export { ZStackHost, type ZStackProps } from "./zstack.js"
28
28
 
29
29
  // Use any to allow specialized props on each host type
30
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { CellBuffer, Palette, Rect, Size } from "@effect-tui/core"
9
- import type { HostContext, CommonProps } from "../reconciler/types.js"
9
+ import type { CommonProps, HostContext } from "../reconciler/types.js"
10
10
  import { SingleChildHost } from "./single-child.js"
11
11
 
12
12
  type HAlign = "left" | "center" | "right"
@@ -17,9 +17,9 @@
17
17
  */
18
18
 
19
19
  import type { CellBuffer, Palette, Rect, Size } from "@effect-tui/core"
20
- import type { HostContext, CommonProps } from "../reconciler/types.js"
21
- import { BaseHost } from "./base.js"
20
+ import type { CommonProps, HostContext } from "../reconciler/types.js"
22
21
  import { alignInRect } from "../utils/index.js"
22
+ import { BaseHost } from "./base.js"
23
23
  import type { OverlayItemHost } from "./overlay-item.js"
24
24
 
25
25
  export interface OverlayProps extends CommonProps {}
@@ -1,8 +1,8 @@
1
1
  // scroll.ts — Scrollable container host
2
- import type { CellBuffer, Palette, Color } from "@effect-tui/core"
3
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
4
- import { SingleChildHost } from "./single-child.js"
2
+ import type { CellBuffer, Color, Palette } from "@effect-tui/core"
3
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
5
4
  import { resolveInheritedBgStyle } from "../utils/index.js"
5
+ import { SingleChildHost } from "./single-child.js"
6
6
 
7
7
  export interface ScrollProps extends CommonProps {
8
8
  /** Scroll axis: "vertical" (default), "horizontal", or "both" */
@@ -1,4 +1,4 @@
1
- import type { HostInstance, CommonProps, HostContext } from "../reconciler/types.js"
1
+ import type { CommonProps, HostContext, HostInstance } from "../reconciler/types.js"
2
2
  import { BaseHost } from "./base.js"
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import type { CellBuffer, Palette } from "@effect-tui/core"
2
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
2
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
3
3
  import { BaseHost } from "./base.js"
4
4
 
5
5
  export interface SpacerProps extends CommonProps {
package/src/hosts/text.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { displayWidth, type CellBuffer, type Palette, type Color } from "@effect-tui/core"
2
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
3
- import { BaseHost, getInheritedBg } from "./base.js"
1
+ import { type CellBuffer, type Color, displayWidth, type Palette } from "@effect-tui/core"
2
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
4
3
  import { resolveInheritedBgStyle, styleIdFromProps } from "../utils/index.js"
4
+ import { BaseHost, getInheritedBg } from "./base.js"
5
5
 
6
6
  export interface TextProps extends CommonProps {
7
7
  fg?: Color
@@ -1,4 +1,4 @@
1
- import type { HostContext, CommonProps } from "../reconciler/types.js"
1
+ import type { CommonProps, HostContext } from "../reconciler/types.js"
2
2
  import { FlexContainerHost, type FlexContainerProps } from "./flex-container.js"
3
3
 
4
4
  export interface VStackProps extends CommonProps {
@@ -1,7 +1,7 @@
1
1
  import type { CellBuffer, Palette } from "@effect-tui/core"
2
- import type { HostContext, Rect, Size, CommonProps } from "../reconciler/types.js"
3
- import { BaseHost } from "./base.js"
2
+ import type { CommonProps, HostContext, Rect, Size } from "../reconciler/types.js"
4
3
  import { alignInRect, type HAlign, type VAlign } from "../utils/index.js"
4
+ import { BaseHost } from "./base.js"
5
5
 
6
6
  export interface ZStackProps extends CommonProps {
7
7
  alignment?: { h?: "leading" | "center" | "trailing"; v?: "top" | "center" | "bottom" }
package/src/index.ts CHANGED
@@ -1,88 +1,88 @@
1
1
  // Convenience: re-export core theming/types so apps can import from one place
2
2
  export * from "@effect-tui/core"
3
-
4
- // Renderer
5
- export {
6
- createRenderer,
7
- createRoot,
8
- render,
9
- useRenderer,
10
- useTerminalSize,
11
- RendererContext,
12
- } from "./renderer.js"
13
- export type { TuiRenderer, RendererOptions, Root, FrameStats, RenderInstance } from "./renderer.js"
14
-
3
+ export type { CodeBlockProps } from "./codeblock.js"
15
4
  // CodeBlock (syntax highlighting)
16
5
  export { CodeBlock } from "./codeblock.js"
17
- export type { CodeBlockProps } from "./codeblock.js"
18
-
6
+ // Input components
7
+ export {
8
+ Markdown,
9
+ type MarkdownProps,
10
+ type MarkdownTheme,
11
+ MultilineTextInput,
12
+ type MultilineTextInputProps,
13
+ Overlay,
14
+ type OverlayItemProps,
15
+ type OverlayProps,
16
+ Static,
17
+ type StaticProps,
18
+ TextInput,
19
+ type TextInputProps,
20
+ } from "./components/index.js"
21
+ // Debug
22
+ export { DiagnosticsPanel } from "./debug/DiagnosticsPanel.js"
23
+ // Development utilities (HMR)
24
+ export {
25
+ autoHmr,
26
+ type DevRenderOptions,
27
+ type DevRenderResult,
28
+ devMain,
29
+ devRender,
30
+ hmr,
31
+ hmrState,
32
+ } from "./dev.js"
19
33
  // Highlight utilities
20
34
  export {
21
- highlightCode,
22
- toPlainLines,
23
35
  type HighlightLine,
24
36
  type HighlightToken,
25
37
  type HighlightTokenStyle,
38
+ highlightCode,
39
+ toPlainLines,
26
40
  } from "./highlight.js"
27
-
28
- // Hooks
29
- export { useKeyboard, useMouse, usePaste, useScroll } from "./hooks/index.js"
30
- export { useFrameStats } from "./hooks/useFrameStats.js"
31
41
  export type {
42
+ ScrollState,
32
43
  UseKeyboardOptions,
33
44
  UseMouseOptions,
34
45
  UseScrollOptions,
35
46
  UseScrollReturn,
36
- ScrollState,
37
47
  } from "./hooks/index.js"
38
-
48
+ // Hooks
49
+ export { useKeyboard, useMouse, usePaste, useQuit, useScroll } from "./hooks/index.js"
50
+ export { useFrameStats } from "./hooks/useFrameStats.js"
51
+ export type { BorderKind, BoxProps } from "./hosts/box.js"
52
+ export type { CanvasProps, DrawContext } from "./hosts/canvas.js"
53
+ export type { HStackProps } from "./hosts/hstack.js"
54
+ export type { ScrollProps } from "./hosts/scroll.js"
55
+ export type { SpacerProps } from "./hosts/spacer.js"
56
+ export type { TextProps } from "./hosts/text.js"
57
+ export type { VStackProps } from "./hosts/vstack.js"
58
+ export type { ZStackProps } from "./hosts/zstack.js"
59
+ export type { ColorInput, MotionValue, RGBA, SpringOptions } from "./motion/index.js"
39
60
  // Motion (spring animations)
40
61
  export {
41
- useMotionValue,
42
- useSpring,
43
- useSprings,
44
- useSpringRenderer,
45
- useMotionValueEvent,
46
- useAnimationFrame,
47
- motionValue,
48
62
  // Color springs
49
63
  ColorMotionValue,
64
+ motionValue,
65
+ useAnimationFrame,
50
66
  useColorMotionValue,
51
67
  useColorSpring,
68
+ useMotionValue,
69
+ useMotionValueEvent,
70
+ useSpring,
71
+ useSpringRenderer,
72
+ useSprings,
52
73
  } from "./motion/index.js"
53
- export type { SpringOptions, MotionValue, RGBA, ColorInput } from "./motion/index.js"
54
-
55
74
  // Types
56
- export type { HostInstance, HostContext, Rect, Size, CommonProps } from "./reconciler/types.js"
57
- export type { TextProps } from "./hosts/text.js"
58
- export type { SpacerProps } from "./hosts/spacer.js"
59
- export type { VStackProps } from "./hosts/vstack.js"
60
- export type { HStackProps } from "./hosts/hstack.js"
61
- export type { ZStackProps } from "./hosts/zstack.js"
62
- export type { BoxProps, BorderKind } from "./hosts/box.js"
63
- export type { CanvasProps, DrawContext } from "./hosts/canvas.js"
64
- export type { ScrollProps } from "./hosts/scroll.js"
65
-
66
- // Debug
67
- export { DiagnosticsPanel } from "./debug/DiagnosticsPanel.js"
68
-
69
- // Input components
70
- export { TextInput, type TextInputProps } from "./components/index.js"
71
- export { MultilineTextInput, type MultilineTextInputProps } from "./components/index.js"
72
- export { Markdown, type MarkdownProps, type MarkdownTheme } from "./components/index.js"
73
- export { Static, type StaticProps } from "./components/index.js"
74
- export { Overlay, type OverlayProps, type OverlayItemProps } from "./components/index.js"
75
-
76
- // Development utilities (HMR)
75
+ export type { CommonProps, HostContext, HostInstance, Rect, Size } from "./reconciler/types.js"
76
+ export type { FrameStats, RendererOptions, RenderInstance, Root, TuiRenderer } from "./renderer.js"
77
+ // Renderer
77
78
  export {
78
- devRender,
79
- devMain,
80
- hmr,
81
- hmrState,
82
- autoHmr,
83
- type DevRenderOptions,
84
- type DevRenderResult,
85
- } from "./dev.js"
79
+ createRenderer,
80
+ createRoot,
81
+ RendererContext,
82
+ render,
83
+ useRenderer,
84
+ useTerminalSize,
85
+ } from "./renderer.js"
86
86
 
87
87
  // JSX types are provided via jsxImportSource: "@effect-tui/react"
88
88
  // See jsx-runtime.ts at package root for the JSX namespace
@@ -7,8 +7,8 @@
7
7
  // }).pipe(Effect.provide(InlineRendererLive))
8
8
  // Effect.runPromise(program)
9
9
 
10
- import { Context, Effect, Either, Layer } from "effect"
11
10
  import { Colors } from "@effect-tui/core"
11
+ import { Context, Effect, Either, Layer } from "effect"
12
12
  import { createRenderer, createRoot } from "../renderer.js"
13
13
 
14
14
  // Spinner frames
@@ -2,7 +2,7 @@
2
2
  * ColorMotionValue - animates RGBA colors using 4 internal numeric springs.
3
3
  */
4
4
 
5
- import { parseColor, type RGBA, type ColorInput } from "./color.js"
5
+ import { type ColorInput, parseColor, type RGBA } from "./color.js"
6
6
  import { EventEmitter } from "./event-emitter.js"
7
7
  import { MotionValue } from "./motion-value.js"
8
8
  import type { SpringOptions } from "./types.js"
@@ -1,5 +1,5 @@
1
- import { describe, it, expect } from "vitest"
2
- import { parseColor, isColorInput } from "./color.js"
1
+ import { describe, expect, it } from "vitest"
2
+ import { isColorInput, parseColor } from "./color.js"
3
3
 
4
4
  describe("parseColor", () => {
5
5
  describe("hex", () => {
@@ -2,9 +2,9 @@
2
2
  // Re-exports from @effect-tui/core with local aliases
3
3
 
4
4
  export {
5
- parseColorRGBA as parseColor,
5
+ type ColorInput,
6
6
  hslToRgba as hslToRgb,
7
7
  isColorInput,
8
+ parseColorRGBA as parseColor,
8
9
  type RGBA,
9
- type ColorInput,
10
10
  } from "@effect-tui/core"
@@ -4,11 +4,11 @@
4
4
 
5
5
  import { useCallback, useEffect, useRef } from "react"
6
6
  import { useRenderer } from "../renderer.js"
7
- import { MotionValue } from "./motion-value.js"
7
+ import type { ColorInput } from "./color.js"
8
8
  import { ColorMotionValue } from "./color-motion-value.js"
9
- import type { SpringOptions } from "./types.js"
10
9
  import type { EventName, Subscriber } from "./event-emitter.js"
11
- import type { ColorInput } from "./color.js"
10
+ import { MotionValue } from "./motion-value.js"
11
+ import type { SpringOptions } from "./types.js"
12
12
 
13
13
  // Global requestRender callback - set by useSpringRenderer hook
14
14
  let globalRequestRender: (() => void) | null = null
@@ -1,17 +1,17 @@
1
1
  // Motion-inspired animation system for TUI
2
2
  // Analytical spring physics (not Euler integration) + setTimeout-based frame loop
3
3
 
4
- export type { SpringOptions, MotionValue, RGBA, ColorInput } from "./motion-value.js"
4
+ export { useAnimationFrame } from "./frame.js"
5
+ export type { ColorInput, MotionValue, RGBA, SpringOptions } from "./motion-value.js"
5
6
  export {
6
- motionValue,
7
- useMotionValue,
8
- useSpring,
9
- useSprings,
10
- useSpringRenderer,
11
- useMotionValueEvent,
12
7
  // Color springs
13
8
  ColorMotionValue,
9
+ motionValue,
14
10
  useColorMotionValue,
15
11
  useColorSpring,
12
+ useMotionValue,
13
+ useMotionValueEvent,
14
+ useSpring,
15
+ useSpringRenderer,
16
+ useSprings,
16
17
  } from "./motion-value.js"
17
- export { useAnimationFrame } from "./frame.js"
@@ -1,4 +1,4 @@
1
- import { describe, it, expect } from "vitest"
1
+ import { describe, expect, it } from "vitest"
2
2
  import { motionValue } from "./motion-value.js"
3
3
 
4
4
  describe("MotionValue", () => {
@@ -3,10 +3,10 @@
3
3
  * Inspired by framer-motion's MotionValue.
4
4
  */
5
5
 
6
- import { subscribeFrame } from "./frame.js"
7
6
  import { EventEmitter } from "./event-emitter.js"
7
+ import { subscribeFrame } from "./frame.js"
8
8
  import { createSpringResolver, springFromVisualDuration } from "./spring-math.js"
9
- import { type SpringOptions, DEFAULT_SPRING_OPTIONS } from "./types.js"
9
+ import { DEFAULT_SPRING_OPTIONS, type SpringOptions } from "./types.js"
10
10
 
11
11
  /** Create a MotionValue. Factory function like Motion's motionValue(). */
12
12
  export function motionValue<T>(initial: T): MotionValue<T> {
@@ -123,18 +123,18 @@ export class MotionValue<T = number> extends EventEmitter<T> {
123
123
  }
124
124
  }
125
125
 
126
- // Re-export everything for backwards compatibility
127
- export { type SpringOptions, DEFAULT_SPRING_OPTIONS } from "./types.js"
128
- export type { EventName, Subscriber } from "./event-emitter.js"
129
- export { createSpringResolver, springFromVisualDuration, isSpringSettled } from "./spring-math.js"
126
+ export type { ColorInput, RGBA } from "./color.js"
130
127
  export { ColorMotionValue } from "./color-motion-value.js"
128
+ export type { EventName, Subscriber } from "./event-emitter.js"
131
129
  export {
130
+ useColorMotionValue,
131
+ useColorSpring,
132
132
  useMotionValue,
133
+ useMotionValueEvent,
133
134
  useSpring,
134
- useSprings,
135
135
  useSpringRenderer,
136
- useMotionValueEvent,
137
- useColorMotionValue,
138
- useColorSpring,
136
+ useSprings,
139
137
  } from "./hooks.js"
140
- export type { RGBA, ColorInput } from "./color.js"
138
+ export { createSpringResolver, isSpringSettled, springFromVisualDuration } from "./spring-math.js"
139
+ // Re-export everything for backwards compatibility
140
+ export { DEFAULT_SPRING_OPTIONS, type SpringOptions } from "./types.js"
@@ -1,8 +1,8 @@
1
- import Reconciler from "react-reconciler"
2
1
  import { createContext } from "react"
3
- import type { HostInstance, HostContext } from "./types.js"
4
- import { createHostInstance, createTextInstance, type RawTextHost, type BaseHost } from "../hosts/index.js"
2
+ import Reconciler from "react-reconciler"
3
+ import { type BaseHost, createHostInstance, createTextInstance, type RawTextHost } from "../hosts/index.js"
5
4
  import { noopMethods } from "./noop-methods.js"
5
+ import type { HostContext, HostInstance } from "./types.js"
6
6
 
7
7
  // ============================================================================
8
8
  // Type Definitions
@@ -1,4 +1,4 @@
1
- import type { CellBuffer, Palette, Size, Rect } from "@effect-tui/core"
1
+ import type { CellBuffer, Palette, Rect, Size } from "@effect-tui/core"
2
2
 
3
3
  // Re-export for backwards compatibility
4
4
  export type { Size, Rect }
@@ -47,10 +47,4 @@ const Info = Rpc.make("Info", {
47
47
  })
48
48
 
49
49
  // Group all RPCs together
50
- export class TuiRpcs extends RpcGroup.make(
51
- Screenshot,
52
- SendKey,
53
- Paste,
54
- Resize,
55
- Info,
56
- ) {}
50
+ export class TuiRpcs extends RpcGroup.make(Screenshot, SendKey, Paste, Resize, Info) {}