@effect-tui/react 0.6.3 → 0.7.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.
- package/dist/jsx-runtime.d.ts +4 -1
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/src/components/ListView.d.ts +3 -1
- package/dist/src/components/ListView.d.ts.map +1 -1
- package/dist/src/components/ListView.js +38 -11
- package/dist/src/components/ListView.js.map +1 -1
- package/dist/src/hooks/use-scroll.d.ts +5 -3
- package/dist/src/hooks/use-scroll.d.ts.map +1 -1
- package/dist/src/hooks/use-scroll.js +4 -2
- package/dist/src/hooks/use-scroll.js.map +1 -1
- package/dist/src/hosts/index.d.ts +1 -1
- package/dist/src/hosts/index.d.ts.map +1 -1
- package/dist/src/hosts/index.js +3 -2
- package/dist/src/hosts/index.js.map +1 -1
- package/dist/src/hosts/scroll.d.ts +5 -0
- package/dist/src/hosts/scroll.d.ts.map +1 -1
- package/dist/src/hosts/scroll.js +10 -0
- package/dist/src/hosts/scroll.js.map +1 -1
- package/dist/src/hosts/text.d.ts +48 -1
- package/dist/src/hosts/text.d.ts.map +1 -1
- package/dist/src/hosts/text.js +200 -5
- package/dist/src/hosts/text.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/remote/Procedures.d.ts +11 -0
- package/dist/src/remote/Procedures.d.ts.map +1 -1
- package/dist/src/remote/Procedures.js +17 -1
- package/dist/src/remote/Procedures.js.map +1 -1
- package/dist/src/remote/Router.d.ts +12 -1
- package/dist/src/remote/Router.d.ts.map +1 -1
- package/dist/src/remote/Router.js +1 -0
- package/dist/src/remote/Router.js.map +1 -1
- package/dist/src/remote/index.d.ts.map +1 -1
- package/dist/src/remote/index.js +14 -0
- package/dist/src/remote/index.js.map +1 -1
- package/dist/src/test/render-tui.js +2 -2
- package/dist/src/test/render-tui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jsx-runtime.ts +2 -1
- package/package.json +2 -2
- package/src/components/ListView.tsx +50 -13
- package/src/hooks/use-scroll.ts +9 -5
- package/src/hosts/index.ts +13 -2
- package/src/hosts/scroll.ts +13 -0
- package/src/hosts/text.ts +242 -5
- package/src/index.ts +1 -1
- package/src/remote/Procedures.ts +19 -1
- package/src/remote/Router.ts +14 -1
- package/src/remote/index.ts +15 -1
- package/src/test/render-tui.ts +2 -2
package/src/remote/index.ts
CHANGED
|
@@ -13,8 +13,9 @@ export { getSocketPath, makeServerLayer } from "./Server.js"
|
|
|
13
13
|
|
|
14
14
|
import * as fs from "node:fs"
|
|
15
15
|
import { Effect, Exit, Layer, Scope } from "effect"
|
|
16
|
+
import { getConsoleCapture } from "../console/ConsoleCapture.js"
|
|
16
17
|
import type { TuiRenderer } from "../renderer-types.js"
|
|
17
|
-
import type { TuiSessionImpl } from "./Router.js"
|
|
18
|
+
import type { LogEntryResult, TuiSessionImpl } from "./Router.js"
|
|
18
19
|
import { getSocketPath, makeServerLayer } from "./Server.js"
|
|
19
20
|
|
|
20
21
|
export interface EnableRemoteOptions {
|
|
@@ -76,6 +77,19 @@ export function enableRemote(renderer: TuiRenderer, options?: EnableRemoteOption
|
|
|
76
77
|
entryPath: opts.entryPath,
|
|
77
78
|
name,
|
|
78
79
|
}),
|
|
80
|
+
getLogEntries: (limit?: number): { entries: LogEntryResult[]; total: number } => {
|
|
81
|
+
const all = getConsoleCapture().getEntries()
|
|
82
|
+
const total = all.length
|
|
83
|
+
const sliced = limit ? all.slice(-limit) : all
|
|
84
|
+
const entries: LogEntryResult[] = sliced.map((e) => ({
|
|
85
|
+
timestamp: e.timestamp.toISOString(),
|
|
86
|
+
level: e.level,
|
|
87
|
+
message: e.message,
|
|
88
|
+
file: e.location?.file,
|
|
89
|
+
line: e.location?.line,
|
|
90
|
+
}))
|
|
91
|
+
return { entries, total }
|
|
92
|
+
},
|
|
79
93
|
}
|
|
80
94
|
|
|
81
95
|
// Build and run the server layer
|
package/src/test/render-tui.ts
CHANGED
|
@@ -71,9 +71,9 @@ export function renderTUI(element: ReactElement, options?: RenderTUIOptions): Re
|
|
|
71
71
|
const root = createRoot(renderer)
|
|
72
72
|
let bump: (() => void) | null = null
|
|
73
73
|
const Harness = ({ children }: { children: ReactElement }) => {
|
|
74
|
-
const [, setTick] = useState(0)
|
|
74
|
+
const [tick, setTick] = useState(0)
|
|
75
75
|
bump = () => setTick((value) => value + 1)
|
|
76
|
-
return children
|
|
76
|
+
return React.cloneElement(children, { __renderTick: tick } as Record<string, unknown>)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const harnessed = React.createElement(Harness, null, element)
|