@effect-tui/react 0.1.1 → 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 +31 -26
- 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 -96
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../../src/dev/Toast.tsx"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,wEAAwE;AAExE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAoBxD,gEAAgE;AAChE,UAAU;AACV,gEAAgE;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,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dev/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAA8B,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development utilities for hot module replacement (HMR).
|
|
3
|
+
*
|
|
4
|
+
* Enables hot reload during development:
|
|
5
|
+
* - File changes trigger re-render without process restart
|
|
6
|
+
* - Terminal stays stable (no screen flash)
|
|
7
|
+
* - State preserved when using Effect's globalValue with effect-atom
|
|
8
|
+
* - Debug console panel (` to toggle, ~ for screenshot)
|
|
9
|
+
* - Remote control when EFFECT_TUI_REMOTE=1
|
|
10
|
+
*/
|
|
11
|
+
import { type Root } from "./renderer.js";
|
|
12
|
+
import type { RendererOptions } from "./renderer-types.js";
|
|
13
|
+
import type { TuiRenderer } from "./renderer-types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Pipeable combinator that makes an atom persist across hot reloads.
|
|
16
|
+
*
|
|
17
|
+
* This is the cleanest way to define HMR-persistent atoms - just pipe it!
|
|
18
|
+
* Combines globalValue (for persistence) + keepAlive (prevents registry cleanup).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { Atom } from "@effect-atom/atom-react"
|
|
23
|
+
* import { hmr, devRender } from "@effect-tui/react"
|
|
24
|
+
*
|
|
25
|
+
* // Just pipe hmr() - that's it!
|
|
26
|
+
* const countAtom = Atom.make(0).pipe(hmr("count"))
|
|
27
|
+
* const userAtom = Atom.make<User | null>(null).pipe(hmr("user"))
|
|
28
|
+
*
|
|
29
|
+
* export default function App() {
|
|
30
|
+
* const count = useAtomValue(countAtom)
|
|
31
|
+
* // Edit this file - count persists!
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function hmr<A>(key: string): (self: A) => A;
|
|
36
|
+
/**
|
|
37
|
+
* Wrap any value creation in HMR persistence.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const countAtom = hmrState("count", () => Atom.make(0).pipe(Atom.keepAlive))
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function hmrState<T>(key: string, create: () => T): T;
|
|
45
|
+
/**
|
|
46
|
+
* Simple self-running dev mode. Just add this at the bottom of your file:
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* export default function App() { ... }
|
|
51
|
+
*
|
|
52
|
+
* devMain(import.meta)
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* That's it! Handles:
|
|
56
|
+
* - Only runs when file is the entry point (import.meta.main)
|
|
57
|
+
* - Only initializes once across HMR reloads
|
|
58
|
+
* - Automatically finds the file path
|
|
59
|
+
*/
|
|
60
|
+
export declare function devMain(importMeta: {
|
|
61
|
+
main?: boolean;
|
|
62
|
+
url: string;
|
|
63
|
+
}, options?: Omit<DevRenderOptions, never>): void;
|
|
64
|
+
/**
|
|
65
|
+
* Auto-keyed HMR persistence for atoms.
|
|
66
|
+
*
|
|
67
|
+
* When used with the HMR plugin (recommended), keys are injected at load time
|
|
68
|
+
* based on the variable name. Without the plugin, falls back to runtime
|
|
69
|
+
* stack trace parsing.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* import { Atom } from "@effect-atom/atom-react"
|
|
74
|
+
* import { autoHmr, devRender } from "@effect-tui/react"
|
|
75
|
+
*
|
|
76
|
+
* // No manual key needed - derived from variable name!
|
|
77
|
+
* const countAtom = Atom.make(0).pipe(autoHmr)
|
|
78
|
+
* const userAtom = Atom.make<User | null>(null).pipe(autoHmr)
|
|
79
|
+
*
|
|
80
|
+
* // To enable compile-time transform (faster, more reliable):
|
|
81
|
+
* // bun --preload @effect-tui/react/hmr-plugin run src/app.tsx
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function autoHmr<A>(self: A): A;
|
|
85
|
+
export interface DevRenderOptions extends RendererOptions {
|
|
86
|
+
/** Directories to watch (defaults to entry file's directory) */
|
|
87
|
+
watchDirs?: string[];
|
|
88
|
+
/** File extensions to watch (defaults to [".ts", ".tsx"]) */
|
|
89
|
+
watchExtensions?: string[];
|
|
90
|
+
/** Debounce delay in ms (defaults to 150) */
|
|
91
|
+
debounce?: number;
|
|
92
|
+
/** Wait for file writes to stabilize (defaults to 50ms) */
|
|
93
|
+
awaitWriteFinish?: number;
|
|
94
|
+
/** Called before each hot reload */
|
|
95
|
+
onReload?: () => void;
|
|
96
|
+
/** Called on errors */
|
|
97
|
+
onError?: (error: Error) => void;
|
|
98
|
+
/** Show renderer diagnostics overlay. */
|
|
99
|
+
showStats?: boolean;
|
|
100
|
+
/** Sampling window for renderer stats (ms). */
|
|
101
|
+
statsSampleMs?: number;
|
|
102
|
+
/** Override diagnostics panel title. */
|
|
103
|
+
statsTitle?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface DevRenderResult {
|
|
106
|
+
renderer: TuiRenderer;
|
|
107
|
+
root: Root;
|
|
108
|
+
/** Manually trigger a reload */
|
|
109
|
+
rerender: () => Promise<void>;
|
|
110
|
+
/** Stop watching and cleanup */
|
|
111
|
+
stop: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
export declare function devRender(entryPath: string, options?: DevRenderOptions): Promise<DevRenderResult>;
|
|
114
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/dev.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,OAAO,EAA8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AE,MAAM,CAAA;IACtB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,WAAW,CAAA;IACrB,IAAI,EAAE,IAAI,CAAA;IACV,gCAAgC;IAChC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,gCAAgC;IAChC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAsKD,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAmGvG"}
|
package/dist/src/dev.js
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@effect-tui/react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Development utilities for hot module replacement (HMR).
|
|
12
|
+
*
|
|
13
|
+
* Enables hot reload during development:
|
|
14
|
+
* - File changes trigger re-render without process restart
|
|
15
|
+
* - Terminal stays stable (no screen flash)
|
|
16
|
+
* - State preserved when using Effect's globalValue with effect-atom
|
|
17
|
+
* - Debug console panel (` to toggle, ~ for screenshot)
|
|
18
|
+
* - Remote control when EFFECT_TUI_REMOTE=1
|
|
19
|
+
*/
|
|
20
|
+
import { globalValue } from "effect/GlobalValue";
|
|
21
|
+
import * as watcher from "@parcel/watcher";
|
|
22
|
+
import { dirname } from "path";
|
|
23
|
+
import { stat } from "fs/promises";
|
|
24
|
+
import { readFileSync } from "fs";
|
|
25
|
+
import React from "react";
|
|
26
|
+
import { Colors } from "@effect-tui/core";
|
|
27
|
+
import { createRenderer, createRoot } from "./renderer.js";
|
|
28
|
+
import { ConsolePopover } from "./console/ConsolePopover.js";
|
|
29
|
+
import { useConsole } from "./console/useConsole.js";
|
|
30
|
+
import { enableRemote } from "./remote/index.js";
|
|
31
|
+
import { ToastProvider, ToastContainer, useToast } from "./dev/Toast.js";
|
|
32
|
+
import { useKeyboard } from "./hooks/use-keyboard.js";
|
|
33
|
+
import { useRenderer, useTerminalSize } from "./renderer-context.js";
|
|
34
|
+
import { copyToClipboardSync, copyToClipboard } from "./console/clipboard.js";
|
|
35
|
+
import { DiagnosticsPanel } from "./debug/DiagnosticsPanel.js";
|
|
36
|
+
import { Overlay } from "./components/Overlay.js";
|
|
37
|
+
/**
|
|
38
|
+
* Pipeable combinator that makes an atom persist across hot reloads.
|
|
39
|
+
*
|
|
40
|
+
* This is the cleanest way to define HMR-persistent atoms - just pipe it!
|
|
41
|
+
* Combines globalValue (for persistence) + keepAlive (prevents registry cleanup).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { Atom } from "@effect-atom/atom-react"
|
|
46
|
+
* import { hmr, devRender } from "@effect-tui/react"
|
|
47
|
+
*
|
|
48
|
+
* // Just pipe hmr() - that's it!
|
|
49
|
+
* const countAtom = Atom.make(0).pipe(hmr("count"))
|
|
50
|
+
* const userAtom = Atom.make<User | null>(null).pipe(hmr("user"))
|
|
51
|
+
*
|
|
52
|
+
* export default function App() {
|
|
53
|
+
* const count = useAtomValue(countAtom)
|
|
54
|
+
* // Edit this file - count persists!
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function hmr(key) {
|
|
59
|
+
return (self) => {
|
|
60
|
+
return globalValue(Symbol.for(`hmr/${key}`), () => {
|
|
61
|
+
// Apply keepAlive if it's an atom (just sets keepAlive: true)
|
|
62
|
+
if (typeof self === "object" && self !== null && "keepAlive" in self) {
|
|
63
|
+
return Object.assign(Object.create(Object.getPrototypeOf(self)), {
|
|
64
|
+
...self,
|
|
65
|
+
keepAlive: true,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return self;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Wrap any value creation in HMR persistence.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* const countAtom = hmrState("count", () => Atom.make(0).pipe(Atom.keepAlive))
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function hmrState(key, create) {
|
|
81
|
+
return globalValue(Symbol.for(`hmr/${key}`), create);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Simple self-running dev mode. Just add this at the bottom of your file:
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* export default function App() { ... }
|
|
89
|
+
*
|
|
90
|
+
* devMain(import.meta)
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* That's it! Handles:
|
|
94
|
+
* - Only runs when file is the entry point (import.meta.main)
|
|
95
|
+
* - Only initializes once across HMR reloads
|
|
96
|
+
* - Automatically finds the file path
|
|
97
|
+
*/
|
|
98
|
+
export function devMain(importMeta, options) {
|
|
99
|
+
// Skip if not main entry point
|
|
100
|
+
if (!importMeta.main)
|
|
101
|
+
return;
|
|
102
|
+
// Skip if this is a HMR re-import (has cache-busting query string)
|
|
103
|
+
if (importMeta.url.includes("?"))
|
|
104
|
+
return;
|
|
105
|
+
const key = `devMain/${importMeta.url}`;
|
|
106
|
+
const initialized = hmrState(key, () => ({ done: false }));
|
|
107
|
+
if (!initialized.done) {
|
|
108
|
+
initialized.done = true;
|
|
109
|
+
const filePath = new URL(importMeta.url).pathname;
|
|
110
|
+
devRender(filePath, options);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Cache for runtime key extraction
|
|
114
|
+
const keyCache = new Map();
|
|
115
|
+
/**
|
|
116
|
+
* Parse stack trace to get file path and line number.
|
|
117
|
+
* Returns null if parsing fails.
|
|
118
|
+
*/
|
|
119
|
+
function parseStack(stack) {
|
|
120
|
+
// Bun stack format: " at functionName (file:line:col)" or " at file:line:col"
|
|
121
|
+
const lines = stack.split("\n");
|
|
122
|
+
// Skip first line (Error message) and find caller (skip autoHmr itself)
|
|
123
|
+
for (let i = 2; i < lines.length; i++) {
|
|
124
|
+
const match = lines[i].match(/\((.+?):(\d+):(\d+)\)/) || lines[i].match(/at\s+(.+?):(\d+):(\d+)/);
|
|
125
|
+
if (match) {
|
|
126
|
+
return { file: match[1], line: parseInt(match[2], 10), col: parseInt(match[3], 10) };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Extract variable name from source line using regex.
|
|
133
|
+
* Returns null if extraction fails.
|
|
134
|
+
*/
|
|
135
|
+
function extractVarName(source, line) {
|
|
136
|
+
const lines = source.split("\n");
|
|
137
|
+
if (line < 1 || line > lines.length)
|
|
138
|
+
return null;
|
|
139
|
+
const sourceLine = lines[line - 1];
|
|
140
|
+
const match = sourceLine.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=/);
|
|
141
|
+
return match?.[1] ?? null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Auto-keyed HMR persistence for atoms.
|
|
145
|
+
*
|
|
146
|
+
* When used with the HMR plugin (recommended), keys are injected at load time
|
|
147
|
+
* based on the variable name. Without the plugin, falls back to runtime
|
|
148
|
+
* stack trace parsing.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```tsx
|
|
152
|
+
* import { Atom } from "@effect-atom/atom-react"
|
|
153
|
+
* import { autoHmr, devRender } from "@effect-tui/react"
|
|
154
|
+
*
|
|
155
|
+
* // No manual key needed - derived from variable name!
|
|
156
|
+
* const countAtom = Atom.make(0).pipe(autoHmr)
|
|
157
|
+
* const userAtom = Atom.make<User | null>(null).pipe(autoHmr)
|
|
158
|
+
*
|
|
159
|
+
* // To enable compile-time transform (faster, more reliable):
|
|
160
|
+
* // bun --preload @effect-tui/react/hmr-plugin run src/app.tsx
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export function autoHmr(self) {
|
|
164
|
+
// Get stack trace for caller location
|
|
165
|
+
const stack = new Error().stack ?? "";
|
|
166
|
+
const location = parseStack(stack);
|
|
167
|
+
if (!location) {
|
|
168
|
+
// Fallback: use a hash of the stack trace
|
|
169
|
+
const fallbackKey = `unknown:${stack.slice(0, 100)}`;
|
|
170
|
+
return hmr(fallbackKey)(self);
|
|
171
|
+
}
|
|
172
|
+
const cacheKey = `${location.file}:${location.line}:${location.col}`;
|
|
173
|
+
// Check cache first
|
|
174
|
+
let key = keyCache.get(cacheKey);
|
|
175
|
+
if (!key) {
|
|
176
|
+
try {
|
|
177
|
+
// Read source file and extract variable name
|
|
178
|
+
const source = readFileSync(location.file, "utf-8");
|
|
179
|
+
const varName = extractVarName(source, location.line);
|
|
180
|
+
key = `${location.file}:${varName ?? `line${location.line}`}`;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// File read failed, use line-based key
|
|
184
|
+
key = `${location.file}:line${location.line}`;
|
|
185
|
+
}
|
|
186
|
+
keyCache.set(cacheKey, key);
|
|
187
|
+
}
|
|
188
|
+
return hmr(key)(self);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Wait for a file to stabilize (no size changes) before proceeding.
|
|
192
|
+
* This avoids importing partially-written files.
|
|
193
|
+
*/
|
|
194
|
+
async function awaitWriteFinish(path, stabilityMs) {
|
|
195
|
+
let lastSize = -1;
|
|
196
|
+
let stableCount = 0;
|
|
197
|
+
const checkInterval = 10;
|
|
198
|
+
while (stableCount < stabilityMs / checkInterval) {
|
|
199
|
+
try {
|
|
200
|
+
const stats = await stat(path);
|
|
201
|
+
if (stats.size === lastSize) {
|
|
202
|
+
stableCount++;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
lastSize = stats.size;
|
|
206
|
+
stableCount = 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// File might be temporarily unavailable during write
|
|
211
|
+
stableCount = 0;
|
|
212
|
+
}
|
|
213
|
+
await new Promise((r) => setTimeout(r, checkInterval));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Render a TUI app with hot module replacement support.
|
|
218
|
+
*
|
|
219
|
+
* Uses @parcel/watcher for reliable, cross-platform file watching.
|
|
220
|
+
* When files change, the module is re-imported and the app re-renders
|
|
221
|
+
* without restarting the process or tearing down the terminal.
|
|
222
|
+
*
|
|
223
|
+
* For state preservation, use effect-atom with the hmr() combinator:
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```tsx
|
|
227
|
+
* import { Atom, useAtomValue } from "@effect-atom/atom-react"
|
|
228
|
+
* import { hmr, devRender } from "@effect-tui/react"
|
|
229
|
+
*
|
|
230
|
+
* const countAtom = Atom.make(0).pipe(hmr("count"))
|
|
231
|
+
*
|
|
232
|
+
* export default function App() {
|
|
233
|
+
* const count = useAtomValue(countAtom)
|
|
234
|
+
* return <text>Count: {count}</text>
|
|
235
|
+
* }
|
|
236
|
+
*
|
|
237
|
+
* devRender(import.meta.path, { mode: "inline" })
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
/**
|
|
241
|
+
* Internal component that handles screenshot with toast notification
|
|
242
|
+
*/
|
|
243
|
+
function ScreenshotHandler() {
|
|
244
|
+
const renderer = useRenderer();
|
|
245
|
+
const { show } = useToast();
|
|
246
|
+
useKeyboard((key) => {
|
|
247
|
+
// ~ (tilde) - screenshot
|
|
248
|
+
if (key.name === "char" && key.text === "~") {
|
|
249
|
+
const ansiOutput = renderer.getScreenshot();
|
|
250
|
+
if (!ansiOutput)
|
|
251
|
+
return;
|
|
252
|
+
// Copy actual content to clipboard
|
|
253
|
+
const copied = copyToClipboardSync(ansiOutput);
|
|
254
|
+
if (!copied) {
|
|
255
|
+
copyToClipboard(ansiOutput);
|
|
256
|
+
}
|
|
257
|
+
// Also save to file as backup
|
|
258
|
+
const tmpPath = `/tmp/tui-screenshot-${Date.now()}.txt`;
|
|
259
|
+
Bun.write(tmpPath, ansiOutput);
|
|
260
|
+
show("Screenshot copied!", "success", 1500);
|
|
261
|
+
key.preventDefault?.();
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Overlay for renderer diagnostics stats.
|
|
268
|
+
*/
|
|
269
|
+
function StatsOverlay({ sampleMs, title }) {
|
|
270
|
+
const { width, height } = useTerminalSize();
|
|
271
|
+
return (_jsxs("vstack", { width: width, height: height, children: [_jsxs("hstack", { width: width, children: [_jsx("spacer", {}), _jsx("box", { padding: 1, border: "rounded", borderColor: Colors.gray(8), bg: Colors.gray(2), children: _jsx(DiagnosticsPanel, { sampleMs: sampleMs, title: title ?? "Renderer Stats" }) })] }), _jsx("spacer", {})] }));
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Internal wrapper component that provides dev mode features:
|
|
275
|
+
* - Debug console panel (` backtick to toggle)
|
|
276
|
+
* - Screenshot support (~ tilde) with toast notification
|
|
277
|
+
* - Auto-show console on errors
|
|
278
|
+
* - Optional renderer stats overlay (showStats)
|
|
279
|
+
*/
|
|
280
|
+
function DevWrapper({ children, showStats, statsSampleMs, statsTitle, mode, }) {
|
|
281
|
+
const { visible } = useConsole({ autoShowOnError: true, initiallyVisible: false });
|
|
282
|
+
// Inline mode: content flows naturally in vstack
|
|
283
|
+
if (mode === "inline") {
|
|
284
|
+
return (_jsx(ToastProvider, { children: _jsxs("vstack", { children: [_jsx(ScreenshotHandler, {}), _jsx(ToastContainer, {}), children, visible && _jsx(ConsolePopover, { fixedHeight: 5, mode: "inline" })] }) }));
|
|
285
|
+
}
|
|
286
|
+
// Fullscreen mode: Overlay with toast/console positioned by alignment
|
|
287
|
+
return (_jsx(ToastProvider, { children: _jsxs(Overlay, { children: [_jsxs(_Fragment, { children: [_jsx(ScreenshotHandler, {}), children] }), visible && (_jsx(Overlay.Item, { alignment: { v: "bottom" }, children: _jsx(ConsolePopover, { fixedHeight: 12 }) })), showStats && (_jsx(Overlay.Item, { alignment: { v: "top", h: "right" }, children: _jsx(StatsOverlay, { sampleMs: statsSampleMs, title: statsTitle }) })), _jsx(Overlay.Item, { alignment: { v: "top" }, children: _jsx(ToastContainer, {}) })] }) }));
|
|
288
|
+
}
|
|
289
|
+
export async function devRender(entryPath, options) {
|
|
290
|
+
const watchExtensions = options?.watchExtensions ?? [".ts", ".tsx"];
|
|
291
|
+
const debounceMs = options?.debounce ?? 150;
|
|
292
|
+
const stabilityMs = options?.awaitWriteFinish ?? 50;
|
|
293
|
+
const renderer = createRenderer(options);
|
|
294
|
+
const root = createRoot(renderer);
|
|
295
|
+
// Dev mode always enables remote control
|
|
296
|
+
const stopRemote = enableRemote(renderer);
|
|
297
|
+
let debounceTimer = null;
|
|
298
|
+
let version = 0;
|
|
299
|
+
let subscription = null;
|
|
300
|
+
// Import and render the module
|
|
301
|
+
const render = async () => {
|
|
302
|
+
const thisVersion = ++version;
|
|
303
|
+
try {
|
|
304
|
+
// Cache-bust by adding query string with version
|
|
305
|
+
const mod = await import(__rewriteRelativeImportExtension(`${entryPath}?v=${thisVersion}`));
|
|
306
|
+
// Skip if a newer render was triggered
|
|
307
|
+
if (thisVersion !== version)
|
|
308
|
+
return;
|
|
309
|
+
const App = mod.default;
|
|
310
|
+
if (!App) {
|
|
311
|
+
const err = new Error(`No default export found in ${entryPath}`);
|
|
312
|
+
options?.onError?.(err);
|
|
313
|
+
console.error("[devRender]", err.message);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
// Render the component wrapped in DevWrapper for console panel
|
|
317
|
+
const appElement = typeof App === "function" ? React.createElement(App) : App;
|
|
318
|
+
const wrapped = React.createElement(DevWrapper, {
|
|
319
|
+
showStats: options?.showStats,
|
|
320
|
+
statsSampleMs: options?.statsSampleMs,
|
|
321
|
+
statsTitle: options?.statsTitle,
|
|
322
|
+
mode: options?.mode,
|
|
323
|
+
}, appElement);
|
|
324
|
+
root.render(wrapped);
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
328
|
+
options?.onError?.(error);
|
|
329
|
+
console.error("[devRender] Error loading module:", error.message);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
// Initial render
|
|
333
|
+
await render();
|
|
334
|
+
// Watch for changes using @parcel/watcher
|
|
335
|
+
const watchDir = options?.watchDirs?.[0] ?? dirname(entryPath);
|
|
336
|
+
try {
|
|
337
|
+
subscription = await watcher.subscribe(watchDir, async (err, events) => {
|
|
338
|
+
if (err) {
|
|
339
|
+
options?.onError?.(err);
|
|
340
|
+
console.error("[devRender] Watcher error:", err);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
// Filter to relevant file extensions
|
|
344
|
+
const relevantEvents = events.filter((event) => watchExtensions.some((ext) => event.path.endsWith(ext)));
|
|
345
|
+
if (relevantEvents.length === 0)
|
|
346
|
+
return;
|
|
347
|
+
// Debounce rapid changes
|
|
348
|
+
if (debounceTimer)
|
|
349
|
+
clearTimeout(debounceTimer);
|
|
350
|
+
debounceTimer = setTimeout(async () => {
|
|
351
|
+
// Wait for file writes to stabilize
|
|
352
|
+
const changedPath = relevantEvents[0].path;
|
|
353
|
+
await awaitWriteFinish(changedPath, stabilityMs);
|
|
354
|
+
options?.onReload?.();
|
|
355
|
+
await render();
|
|
356
|
+
}, debounceMs);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
catch (err) {
|
|
360
|
+
console.error(`[devRender] Failed to watch ${watchDir}:`, err);
|
|
361
|
+
}
|
|
362
|
+
const stop = async () => {
|
|
363
|
+
if (debounceTimer)
|
|
364
|
+
clearTimeout(debounceTimer);
|
|
365
|
+
if (subscription) {
|
|
366
|
+
await subscription.unsubscribe();
|
|
367
|
+
}
|
|
368
|
+
stopRemote();
|
|
369
|
+
renderer.stop();
|
|
370
|
+
};
|
|
371
|
+
return { renderer, root, rerender: render, stop };
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/dev.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAa,MAAM,eAAe,CAAA;AAGrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE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C,CAAC,CAAC,CAAA;YAExG,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAM;YAEvC,yBAAyB;YACzB,IAAI,aAAa;gBAAE,YAAY,CAAC,aAAa,CAAC,CAAA;YAC9C,aAAa,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE;gBACrC,oCAAoC;gBACpC,MAAM,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;gBAC1C,MAAM,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;gBAEhD,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAA;gBACrB,MAAM,MAAM,EAAE,CAAA;YACf,CAAC,EAAE,UAAU,CAAC,CAAA;QACf,CAAC,CAAC,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,+BAA+B,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;QACvB,IAAI,aAAa;YAAE,YAAY,CAAC,aAAa,CAAC,CAAA;QAC9C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,YAAY,CAAC,WAAW,EAAE,CAAA;QACjC,CAAC;QACD,UAAU,EAAE,CAAA;QACZ,QAAQ,CAAC,IAAI,EAAE,CAAA;IAChB,CAAC,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAClD,CAAC"}
|
package/dist/src/highlight.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type BundledLanguage, type BundledTheme } from "shiki";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Color } from "@effect-tui/core";
|
|
3
3
|
export interface HighlightTokenStyle {
|
|
4
|
-
fg?:
|
|
5
|
-
bg?:
|
|
4
|
+
fg?: Color;
|
|
5
|
+
bg?: Color;
|
|
6
6
|
bold?: boolean;
|
|
7
7
|
italic?: boolean;
|
|
8
8
|
underline?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AACpG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AACpG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,WAAW,mBAAmB;IACnC,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,EAAE,CAAA;AAoB5C,wBAAsB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,eAAe,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,GACrD,OAAO,CAAC,aAAa,EAAE,CAAC,CA+B1B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAG1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../src/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6D,MAAM,OAAO,CAAA;AA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CAAC,CAAC,CACF,CAAA;AACF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,CAAC,CAAA;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmr-plugin.d.ts","sourceRoot":"","sources":["../../src/hmr-plugin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
// Only enable in development
|
|
18
|
+
if (process.env.NODE_ENV !== "production") {
|
|
19
|
+
plugin({
|
|
20
|
+
name: "auto-hmr",
|
|
21
|
+
setup(build) {
|
|
22
|
+
build.onLoad({ filter: /\.[tj]sx?$/ }, async (args) => {
|
|
23
|
+
const source = await Bun.file(args.path).text();
|
|
24
|
+
// Skip files that don't use autoHmr
|
|
25
|
+
if (!source.includes("autoHmr")) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
// Get relative path for cleaner keys
|
|
29
|
+
const relativePath = relative(process.cwd(), args.path);
|
|
30
|
+
// Transform: const varName = ...pipe(autoHmr) → ...pipe(hmr("path:varName"))
|
|
31
|
+
// This regex handles the common case of variable declarations
|
|
32
|
+
const transformed = source.replace(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*([^;]+)\.pipe\(\s*autoHmr\s*\)/g, (match, varName, expr) => {
|
|
33
|
+
const key = `${relativePath}:${varName}`;
|
|
34
|
+
// Preserve export if present
|
|
35
|
+
const exportPrefix = match.startsWith("export") ? "export " : "";
|
|
36
|
+
return `${exportPrefix}const ${varName} = ${expr}.pipe(hmr("${key}"))`;
|
|
37
|
+
});
|
|
38
|
+
// Also handle: someAtom.pipe(autoHmr) without assignment (less common)
|
|
39
|
+
// For these, we use a counter-based key as fallback
|
|
40
|
+
let counter = 0;
|
|
41
|
+
const finalTransformed = transformed.replace(/\.pipe\(\s*autoHmr\s*\)/g, () => {
|
|
42
|
+
counter++;
|
|
43
|
+
return `.pipe(hmr("${relativePath}:anon${counter}"))`;
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
contents: finalTransformed,
|
|
47
|
+
loader: args.path.endsWith("x") ? "tsx" : "ts",
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=hmr-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmr-plugin.js","sourceRoot":"","sources":["../../src/hmr-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAE/B,6BAA6B;AAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC3C,MAAM,CAAC;QACN,IAAI,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AAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;iBAC9C,CAAA;YACF,CAAC,CAAC,CAAA;QACH,CAAC;KACD,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
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";
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA"}
|