@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
package/src/highlight.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createHighlighter, type Highlighter, type BundledLanguage, type BundledTheme } from "shiki"
|
|
2
|
-
import type {
|
|
2
|
+
import type { Color } from "@effect-tui/core"
|
|
3
3
|
|
|
4
4
|
export interface HighlightTokenStyle {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
fg?: Color
|
|
6
|
+
bg?: Color
|
|
7
|
+
bold?: boolean
|
|
8
|
+
italic?: boolean
|
|
9
|
+
underline?: boolean
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface HighlightToken {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
text: string
|
|
14
|
+
style?: HighlightTokenStyle
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export type HighlightLine = HighlightToken[]
|
|
@@ -22,55 +22,55 @@ const DEFAULT_THEME: BundledTheme = "nord"
|
|
|
22
22
|
const highlighterCache = new Map<string, Promise<Highlighter>>()
|
|
23
23
|
|
|
24
24
|
async function getCachedHighlighter(theme: BundledTheme): Promise<Highlighter> {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
const key = String(theme)
|
|
26
|
+
let cached = highlighterCache.get(key)
|
|
27
|
+
if (!cached) {
|
|
28
|
+
cached = createHighlighter({
|
|
29
|
+
themes: [theme],
|
|
30
|
+
langs: DEFAULT_LANGS,
|
|
31
|
+
})
|
|
32
|
+
highlighterCache.set(key, cached)
|
|
33
|
+
}
|
|
34
|
+
return cached
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export async function highlightCode(
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
code: string,
|
|
39
|
+
opts?: { lang?: BundledLanguage; theme?: BundledTheme },
|
|
40
40
|
): Promise<HighlightLine[]> {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const lang = opts?.lang ?? ("ts" satisfies BundledLanguage)
|
|
42
|
+
const theme = opts?.theme ?? DEFAULT_THEME
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const highlighter = await getCachedHighlighter(theme)
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (!highlighter.getLoadedLanguages().includes(lang)) {
|
|
47
|
+
await highlighter.loadLanguage(lang)
|
|
48
|
+
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const tokensResult = await highlighter.codeToTokens(code, { lang, theme })
|
|
51
|
+
const tokenLines = Array.isArray(tokensResult)
|
|
52
|
+
? tokensResult
|
|
53
|
+
: // Shiki v3 returns { tokens, theme }
|
|
54
|
+
(tokensResult as any).tokens
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
if (!Array.isArray(tokenLines)) return toPlainLines(code)
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
return tokenLines.map((line: any[]) =>
|
|
59
|
+
line.map((token) => {
|
|
60
|
+
const style: HighlightTokenStyle = {}
|
|
61
|
+
if (token.color) style.fg = token.color
|
|
62
|
+
const fs = token.fontStyle ?? 0
|
|
63
|
+
// fontStyle bitmask is: 1 = Italic, 2 = Bold, 4 = Underline
|
|
64
|
+
if (fs & 2) style.bold = true
|
|
65
|
+
if (fs & 1) style.italic = true
|
|
66
|
+
if (fs & 4) style.underline = true
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
return Object.keys(style).length > 0 ? { text: token.content, style } : { text: token.content }
|
|
69
|
+
}),
|
|
70
|
+
)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export function toPlainLines(code: string): HighlightLine[] {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
if (code.length === 0) return [[]]
|
|
75
|
+
return code.split(/\r?\n/).map((line) => [{ text: line }])
|
|
76
76
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun plugin that transforms autoHmr calls at load time.
|
|
3
|
+
* Transforms:
|
|
4
|
+
* const countAtom = Atom.make(0).pipe(autoHmr)
|
|
5
|
+
* Into:
|
|
6
|
+
* const countAtom = Atom.make(0).pipe(hmr("src/counter.tsx:countAtom"))
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* bun --preload ./node_modules/@effect-tui/react/dist/hmr-plugin.js run src/app.tsx
|
|
10
|
+
*
|
|
11
|
+
* Or in bunfig.toml:
|
|
12
|
+
* [run]
|
|
13
|
+
* preload = ["./node_modules/@effect-tui/react/dist/hmr-plugin.js"]
|
|
14
|
+
*/
|
|
15
|
+
import { plugin } from "bun"
|
|
16
|
+
import { relative } from "path"
|
|
17
|
+
|
|
18
|
+
// Only enable in development
|
|
19
|
+
if (process.env.NODE_ENV !== "production") {
|
|
20
|
+
plugin({
|
|
21
|
+
name: "auto-hmr",
|
|
22
|
+
setup(build) {
|
|
23
|
+
build.onLoad({ filter: /\.[tj]sx?$/ }, async (args) => {
|
|
24
|
+
const source = await Bun.file(args.path).text()
|
|
25
|
+
|
|
26
|
+
// Skip files that don't use autoHmr
|
|
27
|
+
if (!source.includes("autoHmr")) {
|
|
28
|
+
return undefined
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get relative path for cleaner keys
|
|
32
|
+
const relativePath = relative(process.cwd(), args.path)
|
|
33
|
+
|
|
34
|
+
// Transform: const varName = ...pipe(autoHmr) → ...pipe(hmr("path:varName"))
|
|
35
|
+
// This regex handles the common case of variable declarations
|
|
36
|
+
const transformed = source.replace(
|
|
37
|
+
/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*([^;]+)\.pipe\(\s*autoHmr\s*\)/g,
|
|
38
|
+
(match, varName, expr) => {
|
|
39
|
+
const key = `${relativePath}:${varName}`
|
|
40
|
+
// Preserve export if present
|
|
41
|
+
const exportPrefix = match.startsWith("export") ? "export " : ""
|
|
42
|
+
return `${exportPrefix}const ${varName} = ${expr}.pipe(hmr("${key}"))`
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
// Also handle: someAtom.pipe(autoHmr) without assignment (less common)
|
|
47
|
+
// For these, we use a counter-based key as fallback
|
|
48
|
+
let counter = 0
|
|
49
|
+
const finalTransformed = transformed.replace(/\.pipe\(\s*autoHmr\s*\)/g, () => {
|
|
50
|
+
counter++
|
|
51
|
+
return `.pipe(hmr("${relativePath}:anon${counter}"))`
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
contents: finalTransformed,
|
|
56
|
+
loader: args.path.endsWith("x") ? "tsx" : "ts",
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { useKeyboard } from "./use-keyboard.js"
|
|
2
2
|
export type { UseKeyboardOptions } from "./use-keyboard.js"
|
|
3
|
+
export { useMouse } from "./use-mouse.js"
|
|
4
|
+
export type { UseMouseOptions } from "./use-mouse.js"
|
|
3
5
|
export { usePaste } from "./use-paste.js"
|
|
6
|
+
export { useScroll } from "./use-scroll.js"
|
|
7
|
+
export type { UseScrollOptions, UseScrollReturn, ScrollState } from "./use-scroll.js"
|
|
@@ -1,37 +1,57 @@
|
|
|
1
|
-
import { useEffect } from "react"
|
|
1
|
+
import { useEffect, useRef } from "react"
|
|
2
2
|
import type { KeyMsg } from "@effect-tui/core"
|
|
3
3
|
import { useRenderer } from "../renderer.js"
|
|
4
4
|
|
|
5
5
|
export type UseKeyboardOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
/** Which phase to listen for; defaults to "press" and treats missing phase as "press". */
|
|
7
|
+
phase?: "press" | "repeat" | "release" | "any"
|
|
8
|
+
/** Optional predicate to drop keys before they reach the handler. */
|
|
9
|
+
filter?: (key: KeyMsg) => boolean
|
|
10
|
+
/**
|
|
11
|
+
* If true, call preventDefault when available before invoking handler.
|
|
12
|
+
* This stops further renderer-level handlers (not a terminal effect).
|
|
13
|
+
*/
|
|
14
|
+
stopPropagation?: boolean
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Subscribe to keyboard events.
|
|
19
19
|
* Handler is called for every key press while mounted.
|
|
20
|
+
*
|
|
21
|
+
* Uses a ref internally so you don't need useCallback - the handler
|
|
22
|
+
* always sees the latest props/state without re-subscribing.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // No useCallback needed - just pass your handler directly
|
|
27
|
+
* useKeyboard((key) => {
|
|
28
|
+
* if (key.name === "enter") submitForm(currentValue)
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
20
31
|
*/
|
|
21
32
|
export function useKeyboard(handler: (key: KeyMsg) => void, opts?: UseKeyboardOptions): void {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
const renderer = useRenderer()
|
|
34
|
+
const phase = opts?.phase ?? "press"
|
|
35
|
+
const filter = opts?.filter
|
|
36
|
+
const stopPropagation = opts?.stopPropagation ?? false
|
|
26
37
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
// Store handler in ref so we always call the latest version
|
|
39
|
+
// without needing to re-subscribe on every render
|
|
40
|
+
const handlerRef = useRef(handler)
|
|
41
|
+
handlerRef.current = handler
|
|
42
|
+
|
|
43
|
+
// Store filter in ref too for same reason
|
|
44
|
+
const filterRef = useRef(filter)
|
|
45
|
+
filterRef.current = filter
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const wrapped = (key: KeyMsg) => {
|
|
49
|
+
const keyPhase = key.phase ?? "press"
|
|
50
|
+
if (phase !== "any" && phase !== keyPhase) return
|
|
51
|
+
if (filterRef.current && !filterRef.current(key)) return
|
|
52
|
+
if (stopPropagation && key.preventDefault) key.preventDefault()
|
|
53
|
+
handlerRef.current(key)
|
|
54
|
+
}
|
|
55
|
+
return renderer.onKey(wrapped)
|
|
56
|
+
}, [renderer, phase, stopPropagation])
|
|
37
57
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react"
|
|
2
|
+
import type { MouseMsg, MouseButton } from "@effect-tui/core"
|
|
3
|
+
import { useRenderer } from "../renderer.js"
|
|
4
|
+
|
|
5
|
+
export type UseMouseOptions = {
|
|
6
|
+
/** Filter by action type */
|
|
7
|
+
action?: "press" | "release" | "drag" | "move" | "any"
|
|
8
|
+
/** Filter by button */
|
|
9
|
+
button?: MouseButton | MouseButton[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Subscribe to mouse events.
|
|
14
|
+
* Handler is called for mouse clicks, drags, and scroll while mounted.
|
|
15
|
+
*
|
|
16
|
+
* Uses a ref internally so you don't need useCallback - the handler
|
|
17
|
+
* always sees the latest props/state without re-subscribing.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // No useCallback needed - just pass your handler directly
|
|
22
|
+
* useMouse((mouse) => {
|
|
23
|
+
* if (mouse.action === "press") handleClick(mouse.x, mouse.y)
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function useMouse(handler: (mouse: MouseMsg) => void, opts?: UseMouseOptions): void {
|
|
28
|
+
const renderer = useRenderer()
|
|
29
|
+
const action = opts?.action ?? "any"
|
|
30
|
+
const button = opts?.button
|
|
31
|
+
|
|
32
|
+
// Store handler in ref so we always call the latest version
|
|
33
|
+
const handlerRef = useRef(handler)
|
|
34
|
+
handlerRef.current = handler
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const wrapped = (mouse: MouseMsg) => {
|
|
38
|
+
// Filter by action
|
|
39
|
+
if (action !== "any" && action !== mouse.action) return
|
|
40
|
+
|
|
41
|
+
// Filter by button
|
|
42
|
+
if (button !== undefined) {
|
|
43
|
+
const buttons = Array.isArray(button) ? button : [button]
|
|
44
|
+
if (!buttons.includes(mouse.button)) return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
handlerRef.current(mouse)
|
|
48
|
+
}
|
|
49
|
+
return renderer.onMouse(wrapped)
|
|
50
|
+
}, [renderer, action, button])
|
|
51
|
+
}
|
package/src/hooks/use-paste.ts
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import { useEffect } from "react"
|
|
1
|
+
import { useEffect, useRef } from "react"
|
|
2
2
|
import { useRenderer } from "../renderer.js"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Subscribe to bracketed paste events (if supported by renderer/terminal).
|
|
6
|
+
*
|
|
7
|
+
* Uses a ref internally so you don't need useCallback - the handler
|
|
8
|
+
* always sees the latest props/state without re-subscribing.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // No useCallback needed - just pass your handler directly
|
|
13
|
+
* usePaste((text) => {
|
|
14
|
+
* insertText(text, cursorPosition)
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
6
17
|
*/
|
|
7
18
|
export function usePaste(handler: (text: string) => void): void {
|
|
8
|
-
|
|
19
|
+
const renderer = useRenderer()
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
// Store handler in ref so we always call the latest version
|
|
22
|
+
const handlerRef = useRef(handler)
|
|
23
|
+
handlerRef.current = handler
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!renderer.onPaste) return
|
|
27
|
+
return renderer.onPaste((text) => handlerRef.current(text))
|
|
28
|
+
}, [renderer])
|
|
14
29
|
}
|