@effect-tui/react 0.1.3 → 0.1.4
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 +13 -0
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/src/codeblock.d.ts.map +1 -1
- package/dist/src/codeblock.js.map +1 -1
- package/dist/src/components/Divider.d.ts +18 -0
- package/dist/src/components/Divider.d.ts.map +1 -0
- package/dist/src/components/Divider.js +17 -0
- package/dist/src/components/Divider.js.map +1 -0
- package/dist/src/components/Markdown.d.ts +66 -0
- package/dist/src/components/Markdown.d.ts.map +1 -0
- package/dist/src/components/Markdown.js +226 -0
- package/dist/src/components/Markdown.js.map +1 -0
- package/dist/src/components/MultilineTextInput.d.ts +65 -0
- package/dist/src/components/MultilineTextInput.d.ts.map +1 -0
- package/dist/src/components/MultilineTextInput.js +607 -0
- package/dist/src/components/MultilineTextInput.js.map +1 -0
- package/dist/src/components/Overlay.d.ts +46 -0
- package/dist/src/components/Overlay.d.ts.map +1 -0
- package/dist/src/components/Overlay.js +11 -0
- package/dist/src/components/Overlay.js.map +1 -0
- package/dist/src/components/Static.d.ts +44 -0
- package/dist/src/components/Static.d.ts.map +1 -0
- package/dist/src/components/Static.js +53 -0
- package/dist/src/components/Static.js.map +1 -0
- package/dist/src/components/TextInput.d.ts +53 -0
- package/dist/src/components/TextInput.d.ts.map +1 -0
- package/dist/src/components/TextInput.js +210 -0
- package/dist/src/components/TextInput.js.map +1 -0
- package/dist/src/components/index.d.ts +7 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +7 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/text-editing.d.ts +62 -0
- package/dist/src/components/text-editing.d.ts.map +1 -0
- package/dist/src/components/text-editing.js +385 -0
- package/dist/src/components/text-editing.js.map +1 -0
- package/dist/src/console/ConsoleCapture.d.ts +36 -0
- package/dist/src/console/ConsoleCapture.d.ts.map +1 -0
- package/dist/src/console/ConsoleCapture.js +210 -0
- package/dist/src/console/ConsoleCapture.js.map +1 -0
- package/dist/src/console/ConsolePopover.d.ts +18 -0
- package/dist/src/console/ConsolePopover.d.ts.map +1 -0
- package/dist/src/console/ConsolePopover.js +324 -0
- package/dist/src/console/ConsolePopover.js.map +1 -0
- package/dist/src/console/clipboard.d.ts +10 -0
- package/dist/src/console/clipboard.d.ts.map +1 -0
- package/dist/src/console/clipboard.js +74 -0
- package/dist/src/console/clipboard.js.map +1 -0
- package/dist/src/console/index.d.ts +5 -0
- package/dist/src/console/index.d.ts.map +1 -0
- package/dist/src/console/index.js +33 -0
- package/dist/src/console/index.js.map +1 -0
- package/dist/src/console/useConsole.d.ts +44 -0
- package/dist/src/console/useConsole.d.ts.map +1 -0
- package/dist/src/console/useConsole.js +91 -0
- package/dist/src/console/useConsole.js.map +1 -0
- package/dist/src/debug/DebugOverlay.d.ts +49 -0
- package/dist/src/debug/DebugOverlay.d.ts.map +1 -0
- package/dist/src/debug/DebugOverlay.js +438 -0
- package/dist/src/debug/DebugOverlay.js.map +1 -0
- package/dist/src/debug/DiagnosticsPanel.d.ts.map +1 -1
- package/dist/src/debug/DiagnosticsPanel.js.map +1 -1
- package/dist/src/dev/Toast.d.ts +19 -0
- package/dist/src/dev/Toast.d.ts.map +1 -0
- package/dist/src/dev/Toast.js +72 -0
- package/dist/src/dev/Toast.js.map +1 -0
- package/dist/src/dev/index.d.ts +2 -0
- package/dist/src/dev/index.d.ts.map +1 -0
- package/dist/src/dev/index.js +3 -0
- package/dist/src/dev/index.js.map +1 -0
- package/dist/src/dev.d.ts +114 -0
- package/dist/src/dev.d.ts.map +1 -0
- package/dist/src/dev.js +373 -0
- package/dist/src/dev.js.map +1 -0
- package/dist/src/highlight.d.ts +3 -3
- package/dist/src/highlight.d.ts.map +1 -1
- package/dist/src/highlight.js.map +1 -1
- package/dist/src/hmr-plugin.d.ts +2 -0
- package/dist/src/hmr-plugin.d.ts.map +1 -0
- package/dist/src/hmr-plugin.js +53 -0
- package/dist/src/hmr-plugin.js.map +1 -0
- package/dist/src/hooks/index.d.ts +4 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/use-keyboard.d.ts +11 -0
- package/dist/src/hooks/use-keyboard.d.ts.map +1 -1
- package/dist/src/hooks/use-keyboard.js +22 -4
- package/dist/src/hooks/use-keyboard.js.map +1 -1
- package/dist/src/hooks/use-mouse.d.ts +24 -0
- package/dist/src/hooks/use-mouse.d.ts.map +1 -0
- package/dist/src/hooks/use-mouse.js +41 -0
- package/dist/src/hooks/use-mouse.js.map +1 -0
- package/dist/src/hooks/use-paste.d.ts +11 -0
- package/dist/src/hooks/use-paste.d.ts.map +1 -1
- package/dist/src/hooks/use-paste.js +17 -3
- package/dist/src/hooks/use-paste.js.map +1 -1
- package/dist/src/hooks/use-scroll.d.ts +79 -0
- package/dist/src/hooks/use-scroll.d.ts.map +1 -0
- package/dist/src/hooks/use-scroll.js +239 -0
- package/dist/src/hooks/use-scroll.js.map +1 -0
- package/dist/src/hooks/useFrameStats.js.map +1 -1
- package/dist/src/hosts/base.d.ts +62 -1
- package/dist/src/hosts/base.d.ts.map +1 -1
- package/dist/src/hosts/base.js +118 -5
- package/dist/src/hosts/base.js.map +1 -1
- package/dist/src/hosts/box.d.ts +7 -7
- package/dist/src/hosts/box.d.ts.map +1 -1
- package/dist/src/hosts/box.js +30 -23
- package/dist/src/hosts/box.js.map +1 -1
- package/dist/src/hosts/canvas.d.ts +8 -8
- package/dist/src/hosts/canvas.d.ts.map +1 -1
- package/dist/src/hosts/canvas.js +13 -22
- package/dist/src/hosts/canvas.js.map +1 -1
- package/dist/src/hosts/codeblock.d.ts +7 -7
- package/dist/src/hosts/codeblock.d.ts.map +1 -1
- package/dist/src/hosts/codeblock.js +11 -20
- package/dist/src/hosts/codeblock.js.map +1 -1
- package/dist/src/hosts/flex-container.d.ts +45 -0
- package/dist/src/hosts/flex-container.d.ts.map +1 -0
- package/dist/src/hosts/flex-container.js +90 -0
- package/dist/src/hosts/flex-container.js.map +1 -0
- package/dist/src/hosts/hstack.d.ts +6 -11
- package/dist/src/hosts/hstack.d.ts.map +1 -1
- package/dist/src/hosts/hstack.js +6 -41
- package/dist/src/hosts/hstack.js.map +1 -1
- package/dist/src/hosts/index.d.ts +4 -0
- package/dist/src/hosts/index.d.ts.map +1 -1
- package/dist/src/hosts/index.js +10 -0
- package/dist/src/hosts/index.js.map +1 -1
- package/dist/src/hosts/overlay-item.d.ts +32 -0
- package/dist/src/hosts/overlay-item.d.ts.map +1 -0
- package/dist/src/hosts/overlay-item.js +54 -0
- package/dist/src/hosts/overlay-item.js.map +1 -0
- package/dist/src/hosts/overlay.d.ts +30 -0
- package/dist/src/hosts/overlay.d.ts.map +1 -0
- package/dist/src/hosts/overlay.js +105 -0
- package/dist/src/hosts/overlay.js.map +1 -0
- package/dist/src/hosts/scroll.d.ts +56 -0
- package/dist/src/hosts/scroll.d.ts.map +1 -0
- package/dist/src/hosts/scroll.js +204 -0
- package/dist/src/hosts/scroll.js.map +1 -0
- package/dist/src/hosts/single-child.d.ts +16 -0
- package/dist/src/hosts/single-child.d.ts.map +1 -0
- package/dist/src/hosts/single-child.js +45 -0
- package/dist/src/hosts/single-child.js.map +1 -0
- package/dist/src/hosts/spacer.d.ts.map +1 -1
- package/dist/src/hosts/spacer.js +7 -3
- package/dist/src/hosts/spacer.js.map +1 -1
- package/dist/src/hosts/text.d.ts +9 -6
- package/dist/src/hosts/text.d.ts.map +1 -1
- package/dist/src/hosts/text.js +49 -22
- package/dist/src/hosts/text.js.map +1 -1
- package/dist/src/hosts/vstack.d.ts +6 -11
- package/dist/src/hosts/vstack.d.ts.map +1 -1
- package/dist/src/hosts/vstack.js +6 -41
- package/dist/src/hosts/vstack.js.map +1 -1
- package/dist/src/hosts/zstack.d.ts.map +1 -1
- package/dist/src/hosts/zstack.js +16 -5
- package/dist/src/hosts/zstack.js.map +1 -1
- package/dist/src/index.d.ts +9 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/inline/index.d.ts.map +1 -1
- package/dist/src/inline/index.js.map +1 -1
- package/dist/src/motion/color-motion-value.d.ts.map +1 -1
- package/dist/src/motion/color-motion-value.js.map +1 -1
- package/dist/src/motion/color.d.ts +1 -29
- package/dist/src/motion/color.d.ts.map +1 -1
- package/dist/src/motion/color.js +2 -170
- package/dist/src/motion/color.js.map +1 -1
- package/dist/src/motion/color.test.js.map +1 -1
- package/dist/src/motion/event-emitter.d.ts.map +1 -1
- package/dist/src/motion/event-emitter.js.map +1 -1
- package/dist/src/motion/frame.js.map +1 -1
- package/dist/src/motion/hooks.d.ts.map +1 -1
- package/dist/src/motion/hooks.js +8 -3
- package/dist/src/motion/hooks.js.map +1 -1
- package/dist/src/motion/index.d.ts.map +1 -1
- package/dist/src/motion/index.js.map +1 -1
- package/dist/src/motion/motion-value.d.ts.map +1 -1
- package/dist/src/motion/motion-value.js.map +1 -1
- package/dist/src/motion/motion-value.test.js.map +1 -1
- package/dist/src/motion/spring-math.d.ts +6 -1
- package/dist/src/motion/spring-math.d.ts.map +1 -1
- package/dist/src/motion/spring-math.js +6 -1
- package/dist/src/motion/spring-math.js.map +1 -1
- package/dist/src/motion/types.d.ts.map +1 -1
- package/dist/src/motion/types.js.map +1 -1
- package/dist/src/profiler.js.map +1 -1
- package/dist/src/reconciler/host-config.d.ts +5 -5
- package/dist/src/reconciler/host-config.d.ts.map +1 -1
- package/dist/src/reconciler/host-config.js +43 -51
- package/dist/src/reconciler/host-config.js.map +1 -1
- package/dist/src/reconciler/noop-methods.d.ts +29 -0
- package/dist/src/reconciler/noop-methods.d.ts.map +1 -0
- package/dist/src/reconciler/noop-methods.js +43 -0
- package/dist/src/reconciler/noop-methods.js.map +1 -0
- package/dist/src/reconciler/types.d.ts +68 -14
- package/dist/src/reconciler/types.d.ts.map +1 -1
- package/dist/src/remote/Procedures.d.ts +22 -0
- package/dist/src/remote/Procedures.d.ts.map +1 -0
- package/dist/src/remote/Procedures.js +42 -0
- package/dist/src/remote/Procedures.js.map +1 -0
- package/dist/src/remote/Router.d.ts +20 -0
- package/dist/src/remote/Router.d.ts.map +1 -0
- package/dist/src/remote/Router.js +26 -0
- package/dist/src/remote/Router.js.map +1 -0
- package/dist/src/remote/Server.d.ts +6 -0
- package/dist/src/remote/Server.d.ts.map +1 -0
- package/dist/src/remote/Server.js +53 -0
- package/dist/src/remote/Server.js.map +1 -0
- package/dist/src/remote/index.d.ts +18 -0
- package/dist/src/remote/index.d.ts.map +1 -0
- package/dist/src/remote/index.js +74 -0
- package/dist/src/remote/index.js.map +1 -0
- package/dist/src/renderer/core/FrameBuilder.d.ts +18 -0
- package/dist/src/renderer/core/FrameBuilder.d.ts.map +1 -0
- package/dist/src/renderer/core/FrameBuilder.js +38 -0
- package/dist/src/renderer/core/FrameBuilder.js.map +1 -0
- package/dist/src/renderer/core/RendererState.d.ts +41 -0
- package/dist/src/renderer/core/RendererState.d.ts.map +1 -0
- package/dist/src/renderer/core/RendererState.js +70 -0
- package/dist/src/renderer/core/RendererState.js.map +1 -0
- package/dist/src/renderer/core/index.d.ts +3 -0
- package/dist/src/renderer/core/index.d.ts.map +1 -0
- package/dist/src/renderer/core/index.js +3 -0
- package/dist/src/renderer/core/index.js.map +1 -0
- package/dist/src/renderer/input/InputProcessor.d.ts +25 -0
- package/dist/src/renderer/input/InputProcessor.d.ts.map +1 -0
- package/dist/src/renderer/input/InputProcessor.js +81 -0
- package/dist/src/renderer/input/InputProcessor.js.map +1 -0
- package/dist/src/renderer/input/index.d.ts +2 -0
- package/dist/src/renderer/input/index.d.ts.map +1 -0
- package/dist/src/renderer/input/index.js +2 -0
- package/dist/src/renderer/input/index.js.map +1 -0
- package/dist/src/renderer/lifecycle/EventBus.d.ts +41 -0
- package/dist/src/renderer/lifecycle/EventBus.d.ts.map +1 -0
- package/dist/src/renderer/lifecycle/EventBus.js +78 -0
- package/dist/src/renderer/lifecycle/EventBus.js.map +1 -0
- package/dist/src/renderer/lifecycle/ResizeManager.d.ts +34 -0
- package/dist/src/renderer/lifecycle/ResizeManager.d.ts.map +1 -0
- package/dist/src/renderer/lifecycle/ResizeManager.js +47 -0
- package/dist/src/renderer/lifecycle/ResizeManager.js.map +1 -0
- package/dist/src/renderer/lifecycle/TerminalSetup.d.ts +36 -0
- package/dist/src/renderer/lifecycle/TerminalSetup.d.ts.map +1 -0
- package/dist/src/renderer/lifecycle/TerminalSetup.js +82 -0
- package/dist/src/renderer/lifecycle/TerminalSetup.js.map +1 -0
- package/dist/src/renderer/lifecycle/index.d.ts +4 -0
- package/dist/src/renderer/lifecycle/index.d.ts.map +1 -0
- package/dist/src/renderer/lifecycle/index.js +4 -0
- package/dist/src/renderer/lifecycle/index.js.map +1 -0
- package/dist/src/renderer/modes/FullscreenRenderer.d.ts +12 -0
- package/dist/src/renderer/modes/FullscreenRenderer.d.ts.map +1 -0
- package/dist/src/renderer/modes/FullscreenRenderer.js +52 -0
- package/dist/src/renderer/modes/FullscreenRenderer.js.map +1 -0
- package/dist/src/renderer/modes/InlineRenderer.d.ts +22 -0
- package/dist/src/renderer/modes/InlineRenderer.d.ts.map +1 -0
- package/dist/src/renderer/modes/InlineRenderer.js +154 -0
- package/dist/src/renderer/modes/InlineRenderer.js.map +1 -0
- package/dist/src/renderer/modes/RendererMode.d.ts +42 -0
- package/dist/src/renderer/modes/RendererMode.d.ts.map +1 -0
- package/dist/src/renderer/modes/RendererMode.js +2 -0
- package/dist/src/renderer/modes/RendererMode.js.map +1 -0
- package/dist/src/renderer/modes/StaticContentRenderer.d.ts +25 -0
- package/dist/src/renderer/modes/StaticContentRenderer.d.ts.map +1 -0
- package/dist/src/renderer/modes/StaticContentRenderer.js +47 -0
- package/dist/src/renderer/modes/StaticContentRenderer.js.map +1 -0
- package/dist/src/renderer/modes/index.d.ts +5 -0
- package/dist/src/renderer/modes/index.d.ts.map +1 -0
- package/dist/src/renderer/modes/index.js +4 -0
- package/dist/src/renderer/modes/index.js.map +1 -0
- package/dist/src/renderer-context.d.ts +9 -0
- package/dist/src/renderer-context.d.ts.map +1 -0
- package/dist/src/renderer-context.js +22 -0
- package/dist/src/renderer-context.js.map +1 -0
- package/dist/src/renderer-types.d.ts +103 -0
- package/dist/src/renderer-types.d.ts.map +1 -0
- package/dist/src/renderer-types.js +2 -0
- package/dist/src/renderer-types.js.map +1 -0
- package/dist/src/renderer.d.ts +4 -86
- package/dist/src/renderer.d.ts.map +1 -1
- package/dist/src/renderer.js +213 -384
- package/dist/src/renderer.js.map +1 -1
- package/dist/src/test/index.d.ts.map +1 -1
- package/dist/src/test/index.js.map +1 -1
- package/dist/src/test/mock-streams.d.ts.map +1 -1
- package/dist/src/test/mock-streams.js.map +1 -1
- package/dist/src/test/render-tui.d.ts.map +1 -1
- package/dist/src/test/render-tui.js +2 -5
- package/dist/src/test/render-tui.js.map +1 -1
- package/dist/src/trace/SpanTree.d.ts.map +1 -1
- package/dist/src/trace/SpanTree.js +21 -11
- package/dist/src/trace/SpanTree.js.map +1 -1
- package/dist/src/trace/format-value.d.ts +15 -0
- package/dist/src/trace/format-value.d.ts.map +1 -0
- package/dist/src/trace/format-value.js +77 -0
- package/dist/src/trace/format-value.js.map +1 -0
- package/dist/src/trace/index.d.ts.map +1 -1
- package/dist/src/trace/index.js.map +1 -1
- package/dist/src/trace/location.js +1 -1
- package/dist/src/trace/location.js.map +1 -1
- package/dist/src/trace/span-processor.d.ts.map +1 -1
- package/dist/src/trace/span-processor.js.map +1 -1
- package/dist/src/trace/span-state.d.ts +19 -2
- package/dist/src/trace/span-state.d.ts.map +1 -1
- package/dist/src/trace/span-state.js +62 -31
- package/dist/src/trace/span-state.js.map +1 -1
- package/dist/src/trace/tui-logger.js.map +1 -1
- package/dist/src/utils/border.d.ts +1 -1
- package/dist/src/utils/border.d.ts.map +1 -1
- package/dist/src/utils/border.js +6 -0
- package/dist/src/utils/border.js.map +1 -1
- package/dist/src/utils/flex-layout.d.ts +2 -1
- package/dist/src/utils/flex-layout.d.ts.map +1 -1
- package/dist/src/utils/flex-layout.js +22 -33
- package/dist/src/utils/flex-layout.js.map +1 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/padding.d.ts.map +1 -1
- package/dist/src/utils/padding.js.map +1 -1
- package/dist/src/utils/styles.d.ts +20 -1
- package/dist/src/utils/styles.d.ts.map +1 -1
- package/dist/src/utils/styles.js +36 -1
- package/dist/src/utils/styles.js.map +1 -1
- package/dist/src/visualize/index.d.ts +8 -19
- package/dist/src/visualize/index.d.ts.map +1 -1
- package/dist/src/visualize/index.js +11 -25
- package/dist/src/visualize/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jsx-dev-runtime.ts +5 -0
- package/jsx-runtime.ts +54 -0
- package/package.json +124 -92
- package/src/codeblock.tsx +34 -34
- package/src/components/Divider.tsx +23 -0
- package/src/components/Markdown.tsx +380 -0
- package/src/components/MultilineTextInput.tsx +749 -0
- package/src/components/Overlay.tsx +56 -0
- package/src/components/Static.tsx +68 -0
- package/src/components/TextInput.tsx +285 -0
- package/src/components/index.ts +6 -0
- package/src/components/text-editing.ts +464 -0
- package/src/console/ConsoleCapture.ts +272 -0
- package/src/console/ConsolePopover.tsx +487 -0
- package/src/console/clipboard.ts +81 -0
- package/src/console/index.ts +42 -0
- package/src/console/useConsole.ts +129 -0
- package/src/debug/DebugOverlay.ts +557 -0
- package/src/debug/DiagnosticsPanel.tsx +27 -27
- package/src/dev/Toast.tsx +117 -0
- package/src/dev/index.ts +2 -0
- package/src/dev.tsx +489 -0
- package/src/highlight.ts +46 -46
- package/src/hmr-plugin.ts +61 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use-keyboard.ts +44 -24
- package/src/hooks/use-mouse.ts +51 -0
- package/src/hooks/use-paste.ts +21 -6
- package/src/hooks/use-scroll.ts +386 -0
- package/src/hooks/useFrameStats.ts +17 -17
- package/src/hosts/base.ts +180 -59
- package/src/hosts/box.ts +117 -94
- package/src/hosts/canvas.ts +137 -141
- package/src/hosts/codeblock.ts +117 -133
- package/src/hosts/flex-container.ts +124 -0
- package/src/hosts/hstack.ts +11 -59
- package/src/hosts/index.ts +24 -14
- package/src/hosts/overlay-item.ts +72 -0
- package/src/hosts/overlay.ts +125 -0
- package/src/hosts/scroll.ts +255 -0
- package/src/hosts/single-child.ts +52 -0
- package/src/hosts/spacer.ts +30 -26
- package/src/hosts/text.ts +198 -164
- package/src/hosts/vstack.ts +11 -59
- package/src/hosts/zstack.ts +79 -67
- package/src/index.ts +44 -19
- package/src/inline/index.tsx +123 -123
- package/src/motion/color-motion-value.ts +67 -67
- package/src/motion/color.test.ts +107 -107
- package/src/motion/color.ts +9 -190
- package/src/motion/event-emitter.ts +20 -20
- package/src/motion/frame.ts +35 -35
- package/src/motion/hooks.ts +144 -139
- package/src/motion/index.ts +10 -10
- package/src/motion/motion-value.test.ts +207 -207
- package/src/motion/motion-value.ts +112 -112
- package/src/motion/spring-math.ts +88 -83
- package/src/motion/types.ts +25 -25
- package/src/profiler.ts +50 -50
- package/src/reconciler/host-config.ts +152 -174
- package/src/reconciler/noop-methods.ts +55 -0
- package/src/reconciler/types.ts +112 -46
- package/src/remote/Procedures.ts +52 -0
- package/src/remote/Router.ts +58 -0
- package/src/remote/Server.ts +76 -0
- package/src/remote/index.ts +90 -0
- package/src/renderer/core/FrameBuilder.ts +49 -0
- package/src/renderer/core/RendererState.ts +80 -0
- package/src/renderer/core/index.ts +2 -0
- package/src/renderer/input/InputProcessor.ts +94 -0
- package/src/renderer/input/index.ts +1 -0
- package/src/renderer/lifecycle/EventBus.ts +90 -0
- package/src/renderer/lifecycle/ResizeManager.ts +65 -0
- package/src/renderer/lifecycle/TerminalSetup.ts +105 -0
- package/src/renderer/lifecycle/index.ts +3 -0
- package/src/renderer/modes/FullscreenRenderer.ts +53 -0
- package/src/renderer/modes/InlineRenderer.ts +178 -0
- package/src/renderer/modes/RendererMode.ts +46 -0
- package/src/renderer/modes/StaticContentRenderer.ts +56 -0
- package/src/renderer/modes/index.ts +4 -0
- package/src/renderer-context.ts +27 -0
- package/src/renderer-types.ts +109 -0
- package/src/renderer.ts +391 -642
- package/src/test/index.ts +5 -5
- package/src/test/mock-streams.ts +115 -115
- package/src/test/render-tui.ts +84 -87
- package/src/utils/border.ts +79 -73
- package/src/utils/flex-layout.ts +80 -93
- package/src/utils/index.ts +1 -1
- package/src/utils/padding.ts +27 -27
- package/src/utils/styles.ts +50 -7
- package/src/visualize/index.tsx +225 -240
- package/dist/src/output.d.ts +0 -47
- package/dist/src/output.d.ts.map +0 -1
- package/dist/src/output.js +0 -125
- package/dist/src/output.js.map +0 -1
- package/dist/src/terminal.d.ts +0 -37
- package/dist/src/terminal.d.ts.map +0 -1
- package/dist/src/terminal.js +0 -65
- package/dist/src/terminal.js.map +0 -1
- package/src/output.ts +0 -156
- package/src/terminal.ts +0 -67
- package/src/trace/SpanTree.tsx +0 -195
- package/src/trace/index.tsx +0 -205
- package/src/trace/location.ts +0 -90
- package/src/trace/span-processor.ts +0 -65
- package/src/trace/span-state.ts +0 -286
- package/src/trace/tui-logger.ts +0 -72
|
@@ -2,6 +2,7 @@ import Reconciler from "react-reconciler"
|
|
|
2
2
|
import { createContext } from "react"
|
|
3
3
|
import type { HostInstance, HostContext } from "./types.js"
|
|
4
4
|
import { createHostInstance, createTextInstance, type RawTextHost, type BaseHost } from "../hosts/index.js"
|
|
5
|
+
import { noopMethods } from "./noop-methods.js"
|
|
5
6
|
|
|
6
7
|
// ============================================================================
|
|
7
8
|
// Type Definitions
|
|
@@ -11,6 +12,10 @@ import { createHostInstance, createTextInstance, type RawTextHost, type BaseHost
|
|
|
11
12
|
export interface Container {
|
|
12
13
|
root: HostInstance | null
|
|
13
14
|
ctx: HostContext
|
|
15
|
+
/** @internal Static content root node (for Static component) */
|
|
16
|
+
staticRoot?: HostInstance | null
|
|
17
|
+
/** @internal Flag indicating static content needs flushing */
|
|
18
|
+
staticDirty?: boolean
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
/** Props passed to host instances */
|
|
@@ -47,209 +52,183 @@ let currentUpdatePriority = NoEventPriority
|
|
|
47
52
|
// each method while avoiding type compatibility issues with the reconciler.
|
|
48
53
|
|
|
49
54
|
const hostConfig = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
createInstance(type: Type, props: Props, rootContainer: Container) {
|
|
55
|
-
return createHostInstance(type, props, rootContainer.ctx)
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
appendChild(parent: Instance, child: Instance) {
|
|
59
|
-
parent.appendChild(child)
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
removeChild(parent: Instance, child: Instance) {
|
|
63
|
-
parent.removeChild(child)
|
|
64
|
-
child.destroy()
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
insertBefore(parent: Instance, child: Instance, beforeChild: Instance) {
|
|
68
|
-
parent.insertBefore(child, beforeChild)
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
insertInContainerBefore(container: Container, child: Instance, beforeChild: Instance) {
|
|
72
|
-
if (container.root) {
|
|
73
|
-
container.root.insertBefore(child, beforeChild)
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
removeChildFromContainer(container: Container, child: Instance) {
|
|
78
|
-
if (container.root) {
|
|
79
|
-
container.root.removeChild(child)
|
|
80
|
-
child.destroy()
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
prepareForCommit() {
|
|
85
|
-
return null
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
resetAfterCommit(container: Container) {
|
|
89
|
-
container.ctx.requestRender()
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
getRootHostContext(): ReconcilerHostContext {
|
|
93
|
-
return { isInsideText: false }
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
getChildHostContext(parentHostContext: ReconcilerHostContext, type: Type): ReconcilerHostContext {
|
|
97
|
-
const isInsideText = type === "text" || parentHostContext.isInsideText
|
|
98
|
-
return { ...parentHostContext, isInsideText }
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
shouldSetTextContent() {
|
|
102
|
-
return false
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
createTextInstance(text: string, rootContainer: Container, hostContext: ReconcilerHostContext): TextInstance {
|
|
106
|
-
// Raw text nodes are only valid inside <text> elements
|
|
107
|
-
if (!hostContext.isInsideText) {
|
|
108
|
-
console.warn("Text nodes should be inside <text> elements")
|
|
109
|
-
}
|
|
110
|
-
return createTextInstance(text, rootContainer.ctx)
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
scheduleTimeout: setTimeout,
|
|
114
|
-
cancelTimeout: clearTimeout,
|
|
115
|
-
noTimeout: -1,
|
|
116
|
-
|
|
117
|
-
shouldAttemptEagerTransition() {
|
|
118
|
-
return false
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
finalizeInitialChildren(instance: Instance, _type: Type, props: Props) {
|
|
122
|
-
instance.updateProps(props)
|
|
123
|
-
return false
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
commitMount() {
|
|
127
|
-
// Could handle focus here
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
commitUpdate(
|
|
131
|
-
instance: Instance,
|
|
132
|
-
_updatePayload: unknown,
|
|
133
|
-
_type: Type,
|
|
134
|
-
_oldProps: Props,
|
|
135
|
-
newProps: Props | { pendingProps?: Props; memoizedProps?: Props },
|
|
136
|
-
) {
|
|
137
|
-
// Handle case where newProps might be a Fiber node (react-reconciler API varies)
|
|
138
|
-
const props =
|
|
139
|
-
(newProps as { pendingProps?: Props }).pendingProps ??
|
|
140
|
-
(newProps as { memoizedProps?: Props }).memoizedProps ??
|
|
141
|
-
(newProps as Props)
|
|
142
|
-
instance.updateProps(props)
|
|
143
|
-
},
|
|
55
|
+
supportsMutation: true,
|
|
56
|
+
supportsPersistence: false,
|
|
57
|
+
supportsHydration: false,
|
|
144
58
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
},
|
|
59
|
+
createInstance(type: Type, props: Props, rootContainer: Container) {
|
|
60
|
+
const instance = createHostInstance(type, props, rootContainer.ctx)
|
|
148
61
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
62
|
+
// Track static content (from <Static> component)
|
|
63
|
+
if (props.__static) {
|
|
64
|
+
instance.__static = true
|
|
65
|
+
rootContainer.staticRoot = instance
|
|
66
|
+
rootContainer.staticDirty = true
|
|
67
|
+
}
|
|
154
68
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
69
|
+
return instance
|
|
70
|
+
},
|
|
158
71
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
72
|
+
appendChild(parent: Instance, child: Instance) {
|
|
73
|
+
parent.appendChild(child)
|
|
74
|
+
},
|
|
162
75
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
76
|
+
removeChild(parent: Instance, child: Instance) {
|
|
77
|
+
parent.removeChild(child)
|
|
78
|
+
child.destroy()
|
|
79
|
+
},
|
|
166
80
|
|
|
167
|
-
|
|
81
|
+
insertBefore(parent: Instance, child: Instance, beforeChild: Instance) {
|
|
82
|
+
parent.insertBefore(child, beforeChild)
|
|
83
|
+
},
|
|
168
84
|
|
|
169
|
-
|
|
85
|
+
insertInContainerBefore(container: Container, child: Instance, _beforeChild: Instance) {
|
|
86
|
+
// Static content is stored separately in staticRoot, not inserted into the tree
|
|
87
|
+
if (child.__static) {
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
// For non-static children at container level, they become the root
|
|
91
|
+
// (Our container model only supports one root - multiple root children aren't supported)
|
|
92
|
+
container.root = child
|
|
93
|
+
child.parent = null
|
|
94
|
+
},
|
|
170
95
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
96
|
+
removeChildFromContainer(container: Container, child: Instance) {
|
|
97
|
+
if (container.root) {
|
|
98
|
+
container.root.removeChild(child)
|
|
99
|
+
child.destroy()
|
|
100
|
+
}
|
|
101
|
+
// Clear static root if we're removing it
|
|
102
|
+
if (container.staticRoot === child) {
|
|
103
|
+
container.staticRoot = null
|
|
104
|
+
}
|
|
105
|
+
},
|
|
174
106
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
107
|
+
prepareForCommit() {
|
|
108
|
+
return null
|
|
109
|
+
},
|
|
178
110
|
|
|
179
|
-
|
|
111
|
+
resetAfterCommit(container: Container) {
|
|
112
|
+
// If static content is dirty, flush immediately (bypassing throttle)
|
|
113
|
+
if (container.staticDirty && container.ctx.requestImmediateRender) {
|
|
114
|
+
container.ctx.requestImmediateRender()
|
|
115
|
+
} else {
|
|
116
|
+
container.ctx.requestRender()
|
|
117
|
+
}
|
|
118
|
+
},
|
|
180
119
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
return DefaultEventPriority
|
|
186
|
-
},
|
|
120
|
+
getRootHostContext(): ReconcilerHostContext {
|
|
121
|
+
return { isInsideText: false }
|
|
122
|
+
},
|
|
187
123
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
124
|
+
getChildHostContext(parentHostContext: ReconcilerHostContext, type: Type): ReconcilerHostContext {
|
|
125
|
+
const isInsideText = type === "text" || parentHostContext.isInsideText
|
|
126
|
+
return { ...parentHostContext, isInsideText }
|
|
127
|
+
},
|
|
191
128
|
|
|
192
|
-
|
|
129
|
+
shouldSetTextContent() {
|
|
130
|
+
return false
|
|
131
|
+
},
|
|
193
132
|
|
|
194
|
-
|
|
133
|
+
createTextInstance(text: string, rootContainer: Container, hostContext: ReconcilerHostContext): TextInstance {
|
|
134
|
+
// Raw text nodes are only valid inside <text> elements
|
|
135
|
+
if (!hostContext.isInsideText) {
|
|
136
|
+
console.warn("Text nodes should be inside <text> elements")
|
|
137
|
+
}
|
|
138
|
+
return createTextInstance(text, rootContainer.ctx)
|
|
139
|
+
},
|
|
195
140
|
|
|
196
|
-
|
|
141
|
+
scheduleTimeout: setTimeout,
|
|
142
|
+
cancelTimeout: clearTimeout,
|
|
143
|
+
noTimeout: -1,
|
|
197
144
|
|
|
198
|
-
|
|
145
|
+
shouldAttemptEagerTransition() {
|
|
146
|
+
return false
|
|
147
|
+
},
|
|
199
148
|
|
|
200
|
-
|
|
149
|
+
finalizeInitialChildren(instance: Instance, _type: Type, props: Props) {
|
|
150
|
+
instance.updateProps(props)
|
|
151
|
+
return false
|
|
152
|
+
},
|
|
201
153
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
154
|
+
commitMount() {
|
|
155
|
+
// Could handle focus here
|
|
156
|
+
},
|
|
205
157
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
158
|
+
commitUpdate(
|
|
159
|
+
instance: Instance,
|
|
160
|
+
_updatePayload: unknown,
|
|
161
|
+
_type: Type,
|
|
162
|
+
_oldProps: Props,
|
|
163
|
+
newProps: Props | { pendingProps?: Props; memoizedProps?: Props },
|
|
164
|
+
container: Container,
|
|
165
|
+
) {
|
|
166
|
+
// Handle case where newProps might be a Fiber node (react-reconciler API varies)
|
|
167
|
+
const props =
|
|
168
|
+
(newProps as { pendingProps?: Props }).pendingProps ??
|
|
169
|
+
(newProps as { memoizedProps?: Props }).memoizedProps ??
|
|
170
|
+
(newProps as Props)
|
|
171
|
+
instance.updateProps(props)
|
|
209
172
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
173
|
+
// Mark static content as needing flush
|
|
174
|
+
if (instance.__static) {
|
|
175
|
+
container.staticDirty = true
|
|
176
|
+
}
|
|
177
|
+
},
|
|
213
178
|
|
|
214
|
-
|
|
179
|
+
commitTextUpdate(textInstance: TextInstance, _oldText: string, newText: string) {
|
|
180
|
+
textInstance.updateText(newText)
|
|
181
|
+
},
|
|
215
182
|
|
|
216
|
-
|
|
183
|
+
appendChildToContainer(container: Container, child: Instance) {
|
|
184
|
+
// Static content is stored separately - don't let it become the main root
|
|
185
|
+
if (!child.__static) {
|
|
186
|
+
container.root = child
|
|
187
|
+
}
|
|
188
|
+
child.parent = null
|
|
189
|
+
},
|
|
217
190
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
191
|
+
appendInitialChild(parent: Instance, child: Instance) {
|
|
192
|
+
parent.appendChild(child)
|
|
193
|
+
},
|
|
221
194
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
instance.destroy()
|
|
225
|
-
}
|
|
226
|
-
},
|
|
195
|
+
// Spread noop methods required by react-reconciler but unused in this renderer
|
|
196
|
+
...noopMethods,
|
|
227
197
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
198
|
+
clearContainer(container: Container) {
|
|
199
|
+
container.root = null
|
|
200
|
+
container.staticRoot = null
|
|
201
|
+
container.staticDirty = false
|
|
202
|
+
},
|
|
231
203
|
|
|
232
|
-
|
|
204
|
+
setCurrentUpdatePriority(newPriority: number) {
|
|
205
|
+
currentUpdatePriority = newPriority
|
|
206
|
+
},
|
|
233
207
|
|
|
234
|
-
|
|
208
|
+
getCurrentUpdatePriority: () => currentUpdatePriority,
|
|
235
209
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
210
|
+
resolveUpdatePriority() {
|
|
211
|
+
if (currentUpdatePriority !== NoEventPriority) {
|
|
212
|
+
return currentUpdatePriority
|
|
213
|
+
}
|
|
214
|
+
return DefaultEventPriority
|
|
215
|
+
},
|
|
239
216
|
|
|
240
|
-
|
|
217
|
+
NotPendingTransition: null,
|
|
241
218
|
|
|
242
|
-
|
|
219
|
+
HostTransitionContext: createContext(null),
|
|
243
220
|
|
|
244
|
-
|
|
221
|
+
detachDeletedInstance(instance: Instance) {
|
|
222
|
+
if (!instance.parent) {
|
|
223
|
+
instance.destroy()
|
|
224
|
+
}
|
|
225
|
+
},
|
|
245
226
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
227
|
+
getPublicInstance(instance: Instance) {
|
|
228
|
+
return instance
|
|
229
|
+
},
|
|
249
230
|
|
|
250
|
-
|
|
251
|
-
return true
|
|
252
|
-
},
|
|
231
|
+
isPrimaryRenderer: true,
|
|
253
232
|
}
|
|
254
233
|
|
|
255
234
|
// Cast to any at the boundary - the config is internally typed but
|
|
@@ -264,14 +243,13 @@ export const reconciler = Reconciler(hostConfig as any)
|
|
|
264
243
|
|
|
265
244
|
type ReconcilerWithOptionalMethods = typeof reconciler & {
|
|
266
245
|
flushPassiveEffects?: () => void
|
|
267
|
-
|
|
246
|
+
flushSyncFromReconciler?: <T>(fn?: () => T) => T
|
|
268
247
|
batchedUpdates?: <T>(fn: () => T) => T
|
|
269
|
-
discreteUpdates?: <T>(fn: () => T) => T
|
|
270
248
|
}
|
|
271
249
|
|
|
272
250
|
const r = reconciler as ReconcilerWithOptionalMethods
|
|
273
251
|
|
|
274
252
|
export const flushPassiveEffects = r.flushPassiveEffects?.bind(r) ?? (() => {})
|
|
275
|
-
|
|
253
|
+
// react-reconciler 0.33.0 renamed flushSync to flushSyncFromReconciler
|
|
254
|
+
export const flushSync = r.flushSyncFromReconciler?.bind(r) ?? (<T>(fn?: () => T) => fn?.())
|
|
276
255
|
export const batchedUpdates = r.batchedUpdates?.bind(r) ?? (<T>(fn: () => T) => fn())
|
|
277
|
-
export const discreteUpdates = r.discreteUpdates?.bind(r) ?? (<T>(fn: () => T) => fn())
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-op methods required by react-reconciler that we don't use.
|
|
3
|
+
* Extracted to reduce clutter in host-config.ts.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Empty function stub */
|
|
7
|
+
const noop = () => {}
|
|
8
|
+
|
|
9
|
+
/** Stub methods that must be implemented but are unused in this renderer */
|
|
10
|
+
export const noopMethods = {
|
|
11
|
+
// Visibility (could implement later)
|
|
12
|
+
hideInstance: noop,
|
|
13
|
+
unhideInstance: noop,
|
|
14
|
+
hideTextInstance: noop,
|
|
15
|
+
unhideTextInstance: noop,
|
|
16
|
+
|
|
17
|
+
// Form handling (not applicable to TUI)
|
|
18
|
+
resetFormInstance: noop,
|
|
19
|
+
|
|
20
|
+
// Post-paint callbacks (not applicable)
|
|
21
|
+
requestPostPaintCallback: noop,
|
|
22
|
+
|
|
23
|
+
// Scheduler events (not applicable)
|
|
24
|
+
trackSchedulerEvent: noop,
|
|
25
|
+
|
|
26
|
+
// Event types (not applicable)
|
|
27
|
+
resolveEventType: () => null,
|
|
28
|
+
resolveEventTimeStamp: () => -1.1,
|
|
29
|
+
|
|
30
|
+
// Instance preloading (always ready)
|
|
31
|
+
preloadInstance: () => true,
|
|
32
|
+
|
|
33
|
+
// Suspense commit handling (not using Suspense)
|
|
34
|
+
startSuspendingCommit: noop,
|
|
35
|
+
suspendInstance: noop,
|
|
36
|
+
waitForCommitToBeReady: () => null,
|
|
37
|
+
maySuspendCommit: () => false,
|
|
38
|
+
|
|
39
|
+
// Portal mounting (not using portals)
|
|
40
|
+
preparePortalMount: noop,
|
|
41
|
+
|
|
42
|
+
// Instance from node lookup (not applicable)
|
|
43
|
+
getInstanceFromNode: () => null,
|
|
44
|
+
|
|
45
|
+
// Active instance blur (not applicable)
|
|
46
|
+
beforeActiveInstanceBlur: noop,
|
|
47
|
+
afterActiveInstanceBlur: noop,
|
|
48
|
+
|
|
49
|
+
// Scope updates (not using scopes)
|
|
50
|
+
prepareScopeUpdate: noop,
|
|
51
|
+
getInstanceFromScope: () => null,
|
|
52
|
+
|
|
53
|
+
// Update preparation (always update)
|
|
54
|
+
prepareUpdate: () => true,
|
|
55
|
+
} as const
|
package/src/reconciler/types.ts
CHANGED
|
@@ -1,66 +1,132 @@
|
|
|
1
|
-
import type { CellBuffer, Palette } from "@effect-tui/core"
|
|
1
|
+
import type { CellBuffer, Palette, Size, Rect } from "@effect-tui/core"
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
y: number
|
|
6
|
-
w: number
|
|
7
|
-
h: number
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface Size {
|
|
11
|
-
w: number
|
|
12
|
-
h: number
|
|
13
|
-
}
|
|
3
|
+
// Re-export for backwards compatibility
|
|
4
|
+
export type { Size, Rect }
|
|
14
5
|
|
|
15
6
|
export interface HostInstance {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
/** Unique identifier */
|
|
8
|
+
id: string
|
|
9
|
+
/** Component type name */
|
|
10
|
+
type: string
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
/** Parent in tree */
|
|
13
|
+
parent: HostInstance | null
|
|
14
|
+
/** Children in tree */
|
|
15
|
+
children: HostInstance[]
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
/** Computed layout rect (set during layout phase) */
|
|
18
|
+
rect: Rect | null
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
/** @internal Marks this node as static content (for Static component) */
|
|
21
|
+
__static?: boolean
|
|
31
22
|
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
/** Measure natural size given constraints */
|
|
24
|
+
measure(maxW: number, maxH: number): Size
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
/** Assign final rect and layout children */
|
|
27
|
+
layout(rect: Rect): void
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
/** Render to buffer */
|
|
30
|
+
render(buffer: CellBuffer, palette: Palette): void
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
/** Update props from React */
|
|
33
|
+
updateProps(props: Record<string, unknown>): void
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
/** Cleanup on unmount */
|
|
36
|
+
destroy(): void
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
/** Add child */
|
|
39
|
+
appendChild(child: HostInstance): void
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
/** Remove child */
|
|
42
|
+
removeChild(child: HostInstance): void
|
|
43
|
+
|
|
44
|
+
/** Insert child before another */
|
|
45
|
+
insertBefore(child: HostInstance, before: HostInstance): void
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
export interface HostContext {
|
|
55
|
-
|
|
49
|
+
requestRender(): void
|
|
50
|
+
/** @internal Trigger immediate render (bypasses throttling) for static content */
|
|
51
|
+
requestImmediateRender?(): void
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Props common to all host components.
|
|
56
|
+
*
|
|
57
|
+
* ## Frame Constraints (SwiftUI-style)
|
|
58
|
+
*
|
|
59
|
+
* Frame constraints control how a view negotiates size with its parent and children.
|
|
60
|
+
* They work like SwiftUI's `.frame()` modifier:
|
|
61
|
+
*
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // Fixed size - view reports exactly this size to parent,
|
|
64
|
+
* // and proposes this size to children
|
|
65
|
+
* <vstack height={10} width={20}>
|
|
66
|
+
*
|
|
67
|
+
* // Min/max constraints - clamp the natural size
|
|
68
|
+
* <vstack minHeight={5} maxHeight={20}>
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* ### How Layout Works (Two Phases)
|
|
72
|
+
*
|
|
73
|
+
* 1. **Measure phase**: Parent proposes a size → child returns its required size
|
|
74
|
+
* 2. **Layout phase**: Parent assigns final rect to child
|
|
75
|
+
*
|
|
76
|
+
* Frame constraints affect BOTH phases:
|
|
77
|
+
* - `constrainProposal()`: Modifies what we propose to children during measure
|
|
78
|
+
* - `constrainResult()`: Modifies what we report back to parent after measure
|
|
79
|
+
*
|
|
80
|
+
* ### Example: Popover at Bottom
|
|
81
|
+
*
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <vstack height={termHeight}> // Full screen
|
|
84
|
+
* <spacer /> // Takes remaining space
|
|
85
|
+
* <vstack height={10}> // Fixed 10 rows - key constraint!
|
|
86
|
+
* <scroll>...</scroll> // Greedy, but constrained by parent
|
|
87
|
+
* </vstack>
|
|
88
|
+
* </vstack>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* Without `height={10}`, the inner vstack would report the scroll's greedy size.
|
|
92
|
+
* With the constraint, it reports exactly 10, so spacer gets the rest.
|
|
93
|
+
*/
|
|
59
94
|
export interface CommonProps {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
95
|
+
/** Flex grow factor - how much extra space this view takes (default: 0) */
|
|
96
|
+
flexGrow?: number
|
|
97
|
+
/** Flex shrink factor - how much this view shrinks when space is tight (default: 1) */
|
|
98
|
+
flexShrink?: number
|
|
99
|
+
|
|
100
|
+
// ─────────────────────────────────────────────────────────────
|
|
101
|
+
// Frame constraints (like SwiftUI's .frame modifier)
|
|
102
|
+
// ─────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Fixed width constraint.
|
|
106
|
+
* - Proposes this width to children (they measure within this constraint)
|
|
107
|
+
* - Reports this width to parent (regardless of children's natural size)
|
|
108
|
+
*/
|
|
109
|
+
width?: number
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Fixed height constraint.
|
|
113
|
+
* - Proposes this height to children (they measure within this constraint)
|
|
114
|
+
* - Reports this height to parent (regardless of children's natural size)
|
|
115
|
+
*/
|
|
116
|
+
height?: number
|
|
117
|
+
|
|
118
|
+
/** Minimum width - natural size won't go below this */
|
|
119
|
+
minWidth?: number
|
|
120
|
+
|
|
121
|
+
/** Maximum width - natural size won't exceed this */
|
|
122
|
+
maxWidth?: number
|
|
123
|
+
|
|
124
|
+
/** Minimum height - natural size won't go below this */
|
|
125
|
+
minHeight?: number
|
|
126
|
+
|
|
127
|
+
/** Maximum height - natural size won't exceed this */
|
|
128
|
+
maxHeight?: number
|
|
129
|
+
|
|
130
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
131
|
+
[key: string]: unknown
|
|
66
132
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// RPC procedure definitions for remote session control
|
|
2
|
+
import { Rpc, RpcGroup } from "@effect/rpc"
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
|
|
5
|
+
// Screenshot - returns the current screen as ANSI string
|
|
6
|
+
const Screenshot = Rpc.make("Screenshot", {
|
|
7
|
+
success: Schema.String,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
// SendKey - fires a key event into the TUI
|
|
11
|
+
const SendKey = Rpc.make("SendKey", {
|
|
12
|
+
payload: {
|
|
13
|
+
name: Schema.String,
|
|
14
|
+
text: Schema.optional(Schema.String),
|
|
15
|
+
ctrl: Schema.optional(Schema.Boolean),
|
|
16
|
+
shift: Schema.optional(Schema.Boolean),
|
|
17
|
+
meta: Schema.optional(Schema.Boolean),
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// Paste - sends text as a paste event
|
|
22
|
+
const Paste = Rpc.make("Paste", {
|
|
23
|
+
payload: {
|
|
24
|
+
text: Schema.String,
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// Resize - simulate terminal resize
|
|
29
|
+
const Resize = Rpc.make("Resize", {
|
|
30
|
+
payload: {
|
|
31
|
+
width: Schema.Number,
|
|
32
|
+
height: Schema.Number,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// Info - get session info
|
|
37
|
+
const Info = Rpc.make("Info", {
|
|
38
|
+
success: Schema.Struct({
|
|
39
|
+
pid: Schema.Number,
|
|
40
|
+
width: Schema.Number,
|
|
41
|
+
height: Schema.Number,
|
|
42
|
+
}),
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// Group all RPCs together
|
|
46
|
+
export class TuiRpcs extends RpcGroup.make(
|
|
47
|
+
Screenshot,
|
|
48
|
+
SendKey,
|
|
49
|
+
Paste,
|
|
50
|
+
Resize,
|
|
51
|
+
Info,
|
|
52
|
+
) {}
|