@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
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized event subscription management for the renderer.
|
|
3
|
+
* Provides type-safe subscription methods with automatic cleanup.
|
|
4
|
+
*/
|
|
5
|
+
export class EventBus {
|
|
6
|
+
keyHandlers = new Set();
|
|
7
|
+
mouseHandlers = new Set();
|
|
8
|
+
pasteHandlers = new Set();
|
|
9
|
+
resizeHandlers = new Set();
|
|
10
|
+
frameHandlers = new Set();
|
|
11
|
+
onKey(handler) {
|
|
12
|
+
this.keyHandlers.add(handler);
|
|
13
|
+
return () => this.keyHandlers.delete(handler);
|
|
14
|
+
}
|
|
15
|
+
onMouse(handler) {
|
|
16
|
+
this.mouseHandlers.add(handler);
|
|
17
|
+
return () => this.mouseHandlers.delete(handler);
|
|
18
|
+
}
|
|
19
|
+
onPaste(handler) {
|
|
20
|
+
this.pasteHandlers.add(handler);
|
|
21
|
+
return () => this.pasteHandlers.delete(handler);
|
|
22
|
+
}
|
|
23
|
+
onResize(handler) {
|
|
24
|
+
this.resizeHandlers.add(handler);
|
|
25
|
+
return () => this.resizeHandlers.delete(handler);
|
|
26
|
+
}
|
|
27
|
+
onFrameStats(handler) {
|
|
28
|
+
this.frameHandlers.add(handler);
|
|
29
|
+
return () => this.frameHandlers.delete(handler);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Dispatch a key event to all handlers.
|
|
33
|
+
* Stops early if preventDefault is called.
|
|
34
|
+
*/
|
|
35
|
+
dispatchKey(key) {
|
|
36
|
+
for (const handler of this.keyHandlers) {
|
|
37
|
+
if (key.defaultPrevented)
|
|
38
|
+
break;
|
|
39
|
+
handler(key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Dispatch a mouse event to all handlers.
|
|
44
|
+
*/
|
|
45
|
+
dispatchMouse(mouse) {
|
|
46
|
+
for (const handler of this.mouseHandlers) {
|
|
47
|
+
handler(mouse);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Dispatch a paste event to all handlers.
|
|
52
|
+
*/
|
|
53
|
+
dispatchPaste(text) {
|
|
54
|
+
for (const handler of this.pasteHandlers) {
|
|
55
|
+
handler(text);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Dispatch a resize event to all handlers.
|
|
60
|
+
*/
|
|
61
|
+
dispatchResize(width, height) {
|
|
62
|
+
for (const handler of this.resizeHandlers) {
|
|
63
|
+
handler(width, height);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Dispatch frame stats to all handlers.
|
|
68
|
+
*/
|
|
69
|
+
dispatchFrame(stats) {
|
|
70
|
+
for (const handler of this.frameHandlers) {
|
|
71
|
+
handler(stats);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
get hasFrameHandlers() {
|
|
75
|
+
return this.frameHandlers.size > 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=EventBus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBus.js","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/EventBus.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACZ,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAA;IAC9C,aAAa,GAAG,IAAI,GAAG,EAA6B,CAAA;IACpD,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAA;IACjD,cAAc,GAAG,IAAI,GAAG,EAA2C,CAAA;IACnE,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAA;IAE9D,KAAK,CAAC,OAA8B;QACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC7B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED,OAAO,CAAC,OAAkC;QACzC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC/B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAChD,CAAC;IAED,OAAO,CAAC,OAA+B;QACtC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC/B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAChD,CAAC;IAED,QAAQ,CAAC,OAAgD;QACxD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AC,IAAI,GAAG,CAAC,CAAA;IACnC,CAAC;CACD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TuiWriteStream } from "../../renderer-types.js";
|
|
2
|
+
export interface ResizeState {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
lastWidth: number;
|
|
6
|
+
previousHeight: number;
|
|
7
|
+
inlineClearHeight: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ResizeResult {
|
|
10
|
+
newWidth: number;
|
|
11
|
+
newHeight: number;
|
|
12
|
+
needsFullClear: boolean;
|
|
13
|
+
inlineClearHeight: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Handles terminal resize events and calculates necessary clear/redraw actions.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ResizeManager {
|
|
19
|
+
private stdout;
|
|
20
|
+
private mode;
|
|
21
|
+
constructor(stdout: TuiWriteStream, mode: "fullscreen" | "inline");
|
|
22
|
+
/**
|
|
23
|
+
* Process a resize event and determine what actions are needed.
|
|
24
|
+
*/
|
|
25
|
+
handleResize(currentState: ResizeState): ResizeResult;
|
|
26
|
+
/**
|
|
27
|
+
* Get current terminal dimensions.
|
|
28
|
+
*/
|
|
29
|
+
getDimensions(): {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ResizeManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizeManager.d.ts","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/ResizeManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;CACzB;AAED;;GAEG;AACH,qBAAa,aAAa;IAExB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,IAAI;gBADJ,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,YAAY,GAAG,QAAQ;IAGtC;;OAEG;IACH,YAAY,CAAC,YAAY,EAAE,WAAW,GAAG,YAAY;IA0BrD;;OAEG;IACH,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAMlD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles terminal resize events and calculates necessary clear/redraw actions.
|
|
3
|
+
*/
|
|
4
|
+
export class ResizeManager {
|
|
5
|
+
stdout;
|
|
6
|
+
mode;
|
|
7
|
+
constructor(stdout, mode) {
|
|
8
|
+
this.stdout = stdout;
|
|
9
|
+
this.mode = mode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Process a resize event and determine what actions are needed.
|
|
13
|
+
*/
|
|
14
|
+
handleResize(currentState) {
|
|
15
|
+
const newWidth = this.stdout.columns || 80;
|
|
16
|
+
const newHeight = this.stdout.rows || 24;
|
|
17
|
+
let needsFullClear = false;
|
|
18
|
+
let inlineClearHeight = currentState.inlineClearHeight;
|
|
19
|
+
if (this.mode === "fullscreen") {
|
|
20
|
+
// Fullscreen: defer clear to renderFrame so it's written atomically with content
|
|
21
|
+
needsFullClear = true;
|
|
22
|
+
}
|
|
23
|
+
else if (newWidth !== currentState.lastWidth || newHeight !== currentState.height) {
|
|
24
|
+
// Inline: on dimension change, request clear on next render
|
|
25
|
+
const clearHeight = Math.max(currentState.previousHeight, currentState.height, newHeight);
|
|
26
|
+
if (clearHeight > inlineClearHeight) {
|
|
27
|
+
inlineClearHeight = clearHeight;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
newWidth,
|
|
32
|
+
newHeight,
|
|
33
|
+
needsFullClear,
|
|
34
|
+
inlineClearHeight,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get current terminal dimensions.
|
|
39
|
+
*/
|
|
40
|
+
getDimensions() {
|
|
41
|
+
return {
|
|
42
|
+
width: this.stdout.columns || 80,
|
|
43
|
+
height: this.stdout.rows || 24,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ResizeManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizeManager.js","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/ResizeManager.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,MAAM,OAAO,aAAa;IAEhB;IACA;IAFT,YACS,MAAsB,EACtB,IAA6B;QAD7B,WAAM,GAAN,MAAM,CAAgB;QACtB,SAAI,GAAJ,IAAI,CAAyB;IACnC,CAAC;IAEJ;;OAEG;IACH,YAAY,CAAC,YAAyB;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAA;QAExC,IAAI,cAAc,GAAG,KAAK,CAAA;QAC1B,IAAI,iBAAiB,GAAG,YAAY,CAAC,iBAAiB,CAAA;QAEtD,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAChC,iFAAiF;YACjF,cAAc,GAAG,IAAI,CAAA;QACtB,CAAC;aAAM,IAAI,QAAQ,KAAK,YAAY,CAAC,SAAS,IAAI,SAAS,KAAK,YAAY,CAAC,MAAM,EAAE,CAAC;YACrF,4DAA4D;YAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;YACzF,IAAI,WAAW,GAAG,iBAAiB,EAAE,CAAC;gBACrC,iBAAiB,GAAG,WAAW,CAAA;YAChC,CAAC;QACF,CAAC;QAED,OAAO;YACN,QAAQ;YACR,SAAS;YACT,cAAc;YACd,iBAAiB;SACjB,CAAA;IACF,CAAC;IAED;;OAEG;IACH,aAAa;QACZ,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE;YAChC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;SAC9B,CAAA;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TuiWriteStream, TuiReadStream } from "../../renderer-types.js";
|
|
2
|
+
export interface TerminalSetupConfig {
|
|
3
|
+
mode: "fullscreen" | "inline";
|
|
4
|
+
enablePaste: boolean;
|
|
5
|
+
enableMouse: boolean;
|
|
6
|
+
skipTerminalSetup: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Enable Kitty keyboard protocol for enhanced modifier detection.
|
|
9
|
+
* When enabled, Ctrl+Shift+C can be distinguished from Ctrl+C.
|
|
10
|
+
* Supported by: Kitty, iTerm2 3.5+, WezTerm, Ghostty, foot, Contour, rio.
|
|
11
|
+
* Gracefully ignored by terminals that don't support it.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
enableKittyKeyboard?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Manages terminal setup and teardown sequences.
|
|
18
|
+
* Handles fullscreen mode, cursor visibility, paste bracketing, mouse tracking, and raw mode.
|
|
19
|
+
*/
|
|
20
|
+
export declare class TerminalSetup {
|
|
21
|
+
private stdout;
|
|
22
|
+
private stdin;
|
|
23
|
+
private config;
|
|
24
|
+
constructor(stdout: TuiWriteStream, stdin: TuiReadStream, config: TerminalSetupConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Set up terminal for rendering.
|
|
27
|
+
* Call this before starting the render loop.
|
|
28
|
+
*/
|
|
29
|
+
setup(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Restore terminal to normal state.
|
|
32
|
+
* Call this when stopping the renderer.
|
|
33
|
+
*/
|
|
34
|
+
teardown(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=TerminalSetup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalSetup.d.ts","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/TerminalSetup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5E,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAA;IAC7B,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,iBAAiB,EAAE,OAAO,CAAA;IAC1B;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED;;;GAGG;AACH,qBAAa,aAAa;IAExB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;gBAFN,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,mBAAmB;IAGpC;;;OAGG;IACH,KAAK,IAAI,IAAI;IAoCb;;;OAGG;IACH,QAAQ,IAAI,IAAI;CA+BhB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ANSI, Terminal } from "@effect-tui/core";
|
|
2
|
+
/**
|
|
3
|
+
* Manages terminal setup and teardown sequences.
|
|
4
|
+
* Handles fullscreen mode, cursor visibility, paste bracketing, mouse tracking, and raw mode.
|
|
5
|
+
*/
|
|
6
|
+
export class TerminalSetup {
|
|
7
|
+
stdout;
|
|
8
|
+
stdin;
|
|
9
|
+
config;
|
|
10
|
+
constructor(stdout, stdin, config) {
|
|
11
|
+
this.stdout = stdout;
|
|
12
|
+
this.stdin = stdin;
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Set up terminal for rendering.
|
|
17
|
+
* Call this before starting the render loop.
|
|
18
|
+
*/
|
|
19
|
+
setup() {
|
|
20
|
+
if (this.config.skipTerminalSetup)
|
|
21
|
+
return;
|
|
22
|
+
if (this.config.mode === "fullscreen") {
|
|
23
|
+
this.stdout.write(Terminal.enterFullscreen);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Inline mode: try to disable reflow (DEC mode 2028)
|
|
27
|
+
// Supported by Contour, some others. Ignored by unsupported terminals.
|
|
28
|
+
this.stdout.write(ANSI.reflow.disable);
|
|
29
|
+
}
|
|
30
|
+
// Hide cursor during rendering (both modes)
|
|
31
|
+
this.stdout.write(Terminal.hideCursor);
|
|
32
|
+
if (this.config.enablePaste) {
|
|
33
|
+
this.stdout.write(ANSI.paste.enable);
|
|
34
|
+
}
|
|
35
|
+
if (this.config.enableMouse) {
|
|
36
|
+
this.stdout.write(ANSI.mouse.enable);
|
|
37
|
+
}
|
|
38
|
+
// Enable enhanced keyboard protocols for modifier detection
|
|
39
|
+
// This allows distinguishing Ctrl+Shift+C from Ctrl+C on supported terminals
|
|
40
|
+
// NOTE: Many terminals intercept Ctrl+Shift+C for their own copy function!
|
|
41
|
+
if (this.config.enableKittyKeyboard !== false) {
|
|
42
|
+
this.stdout.write(ANSI.keyboard.enable(1)); // Kitty protocol (flag 1 = disambiguate)
|
|
43
|
+
this.stdout.write(ANSI.modifyOtherKeys.enable); // xterm protocol (mode 2)
|
|
44
|
+
}
|
|
45
|
+
if (this.stdin.isTTY && this.stdin.setRawMode) {
|
|
46
|
+
this.stdin.setRawMode(true);
|
|
47
|
+
this.stdin.resume?.();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Restore terminal to normal state.
|
|
52
|
+
* Call this when stopping the renderer.
|
|
53
|
+
*/
|
|
54
|
+
teardown() {
|
|
55
|
+
if (this.config.skipTerminalSetup)
|
|
56
|
+
return;
|
|
57
|
+
if (this.config.mode === "fullscreen") {
|
|
58
|
+
this.stdout.write(Terminal.exitFullscreen);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Re-enable reflow on exit
|
|
62
|
+
this.stdout.write(ANSI.reflow.enable);
|
|
63
|
+
this.stdout.write("\r\n");
|
|
64
|
+
}
|
|
65
|
+
if (this.config.enablePaste) {
|
|
66
|
+
this.stdout.write(ANSI.paste.disable);
|
|
67
|
+
}
|
|
68
|
+
if (this.config.enableMouse) {
|
|
69
|
+
this.stdout.write(ANSI.mouse.disable);
|
|
70
|
+
}
|
|
71
|
+
// Disable enhanced keyboard protocols
|
|
72
|
+
if (this.config.enableKittyKeyboard !== false) {
|
|
73
|
+
this.stdout.write(ANSI.keyboard.disable);
|
|
74
|
+
this.stdout.write(ANSI.modifyOtherKeys.disable);
|
|
75
|
+
}
|
|
76
|
+
this.stdout.write(Terminal.showCursor);
|
|
77
|
+
if (this.stdin.isTTY && this.stdin.setRawMode) {
|
|
78
|
+
this.stdin.setRawMode(false);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=TerminalSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalSetup.js","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/TerminalSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAkBjD;;;GAGG;AACH,MAAM,OAAO,aAAa;IAEhB;IACA;IACA;IAHT,YACS,MAAsB,EACtB,KAAoB,EACpB,MAA2B;QAF3B,WAAM,GAAN,MAAM,CAAgB;QACtB,UAAK,GAAL,KAAK,CAAe;QACpB,WAAM,GAAN,MA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I,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAC7B,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/renderer/lifecycle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAuC,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RendererMode, RenderContext, RenderOutput } from "./RendererMode.js";
|
|
2
|
+
/**
|
|
3
|
+
* Fullscreen rendering mode using alternate buffer.
|
|
4
|
+
* Supports line-by-line diffing for efficient updates.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FullscreenRenderer implements RendererMode {
|
|
7
|
+
private needsFullClear;
|
|
8
|
+
generateOutput(ctx: RenderContext): RenderOutput;
|
|
9
|
+
handleResize(_newWidth: number, _newHeight: number, _prevWidth: number): void;
|
|
10
|
+
reset(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=FullscreenRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullscreenRenderer.d.ts","sourceRoot":"","sources":["../../../../src/renderer/modes/FullscreenRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAElF;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACtD,OAAO,CAAC,cAAc,CAAQ;IAE9B,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY;IAkChD,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAK7E,KAAK,IAAI,IAAI;CAGb"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ANSI, emitRowWithReset, findChangeWindow } from "@effect-tui/core";
|
|
2
|
+
/**
|
|
3
|
+
* Fullscreen rendering mode using alternate buffer.
|
|
4
|
+
* Supports line-by-line diffing for efficient updates.
|
|
5
|
+
*/
|
|
6
|
+
export class FullscreenRenderer {
|
|
7
|
+
needsFullClear = false;
|
|
8
|
+
generateOutput(ctx) {
|
|
9
|
+
const { nextBuffer, prevBuffer, palette, frameWidth, frameHeight, enableDiff } = ctx;
|
|
10
|
+
let output = "";
|
|
11
|
+
// If a full clear was requested (e.g., on resize), prepend it to output
|
|
12
|
+
// so clear + content are written atomically (no visible flash)
|
|
13
|
+
if (this.needsFullClear) {
|
|
14
|
+
output += ANSI.cursor.to(1, 1);
|
|
15
|
+
this.needsFullClear = false;
|
|
16
|
+
// After clear, we must redraw everything - can't rely on diff
|
|
17
|
+
for (let y = 0; y < frameHeight; y++) {
|
|
18
|
+
if (y > 0)
|
|
19
|
+
output += ANSI.cursor.to(1, y + 1);
|
|
20
|
+
output += emitRowWithReset(nextBuffer, palette, y, frameWidth);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (enableDiff && prevBuffer) {
|
|
24
|
+
// Diff per line for minimal writes
|
|
25
|
+
for (let y = 0; y < frameHeight; y++) {
|
|
26
|
+
const change = findChangeWindow(prevBuffer, nextBuffer, y, frameWidth);
|
|
27
|
+
if (!change)
|
|
28
|
+
continue;
|
|
29
|
+
output += ANSI.cursor.to(change.left + 1, y + 1);
|
|
30
|
+
output += emitRowWithReset(nextBuffer, palette, y, frameWidth, change.left, change.right + 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Full redraw (tests/manual mode)
|
|
35
|
+
output += ANSI.cursor.to(1, 1) + palette.sgr(0);
|
|
36
|
+
for (let y = 0; y < frameHeight; y++) {
|
|
37
|
+
output += emitRowWithReset(nextBuffer, palette, y, frameWidth);
|
|
38
|
+
if (y < frameHeight - 1)
|
|
39
|
+
output += "\r\n";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { output, contentHeight: frameHeight };
|
|
43
|
+
}
|
|
44
|
+
handleResize(_newWidth, _newHeight, _prevWidth) {
|
|
45
|
+
// Defer clear to generateOutput so it's written atomically with content
|
|
46
|
+
this.needsFullClear = true;
|
|
47
|
+
}
|
|
48
|
+
reset() {
|
|
49
|
+
// Nothing to reset for fullscreen mode
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=FullscreenRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullscreenRenderer.js","sourceRoot":"","sources":["../../../../src/renderer/modes/FullscreenRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAG3E;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACtB,cAAc,GAAG,KAAK,CAAA;IAE9B,cAAc,CAAC,GAAkB;QAChC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;QACpF,IAAI,MAAM,GAAG,EAAE,CAAA;QAEf,wEAAwE;QACxE,+DAA+D;QAC/D,IAAI,IAA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/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,MAAM,IAAI,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,CAAA;gBAC9D,IAAI,CAAC,GAAG,WAAW,GAAG,CAAC;oBAAE,MAAM,IAAI,MAAM,CAAA;YAC1C,CAAC;QACF,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;IAC9C,CAAC;IAED,YAAY,CAAC,SAAiB,EAAE,UAAkB,EAAE,UAAkB;QACrE,wEAAwE;QACxE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;IAC3B,CAAC;IAED,KAAK;QACJ,uCAAuC;IACxC,CAAC;CACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RendererMode, RenderContext, RenderOutput } from "./RendererMode.js";
|
|
2
|
+
/**
|
|
3
|
+
* Inline rendering mode that renders in-place without alternate buffer.
|
|
4
|
+
* When content exceeds terminal height, shows the bottom portion (bottom-aligned truncation).
|
|
5
|
+
*/
|
|
6
|
+
export declare class InlineRenderer implements RendererMode {
|
|
7
|
+
private previousHeight;
|
|
8
|
+
private previousStartRow;
|
|
9
|
+
private _needsFullRerender;
|
|
10
|
+
private printedWidths;
|
|
11
|
+
generateOutput(ctx: RenderContext): RenderOutput;
|
|
12
|
+
private generateDiffOutput;
|
|
13
|
+
private generateFullOutput;
|
|
14
|
+
handleResize(newWidth: number, _newHeight: number, prevWidth: number): void;
|
|
15
|
+
/** Check if full rerender is needed (clear screen + replay static) */
|
|
16
|
+
needsFullRerender(): boolean;
|
|
17
|
+
/** Clear the full rerender flag after handling */
|
|
18
|
+
clearFullRerenderFlag(): void;
|
|
19
|
+
reset(): void;
|
|
20
|
+
getPreviousHeight(): number;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=InlineRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineRenderer.d.ts","sourceRoot":"","sources":["../../../../src/renderer/modes/InlineRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAElF;;;GAGG;AACH,qBAAa,cAAe,YAAW,YAAY;IAClD,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,gBAAgB,CAAI;IAC5B,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,aAAa,CAAe;IAEpC,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY;IAwChD,OAAO,CAAC,kBAAkB;IAkE1B,OAAO,CAAC,kBAAkB;IA6B1B,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAO3E,sEAAsE;IACtE,iBAAiB,IAAI,OAAO;IAI5B,kDAAkD;IAClD,qBAAqB,IAAI,IAAI;IAO7B,KAAK,IAAI,IAAI;IAMb,iBAAiB,IAAI,MAAM;CAG3B"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { ANSI, emitRowWithReset, rowContentWidth, findChangeWindow } from "@effect-tui/core";
|
|
2
|
+
/**
|
|
3
|
+
* Inline rendering mode that renders in-place without alternate buffer.
|
|
4
|
+
* When content exceeds terminal height, shows the bottom portion (bottom-aligned truncation).
|
|
5
|
+
*/
|
|
6
|
+
export class InlineRenderer {
|
|
7
|
+
previousHeight = 0;
|
|
8
|
+
previousStartRow = 0; // Track which row we started from (for truncation)
|
|
9
|
+
_needsFullRerender = false;
|
|
10
|
+
printedWidths = [];
|
|
11
|
+
generateOutput(ctx) {
|
|
12
|
+
const { prevBuffer, frameHeight, contentHeight } = ctx;
|
|
13
|
+
let output = "";
|
|
14
|
+
// Calculate visible region (bottom-aligned when overflowing)
|
|
15
|
+
const isOverflowing = contentHeight > frameHeight;
|
|
16
|
+
const visibleHeight = Math.min(contentHeight, frameHeight);
|
|
17
|
+
const startRow = isOverflowing ? contentHeight - frameHeight : 0;
|
|
18
|
+
// Detect if viewport shifted (content grew/shrank affecting visible region)
|
|
19
|
+
const startRowChanged = startRow !== this.previousStartRow;
|
|
20
|
+
const needsFullRedraw = this.previousHeight >= frameHeight || startRowChanged;
|
|
21
|
+
// Need full redraw if: at terminal limit, or viewport shifted
|
|
22
|
+
if (needsFullRedraw) {
|
|
23
|
+
// Clear visible area and redraw (prepend to output for atomic write)
|
|
24
|
+
if (this.previousHeight > 0) {
|
|
25
|
+
output += ANSI.cursor.up(this.previousHeight);
|
|
26
|
+
}
|
|
27
|
+
output += ANSI.cursor.startOfLine;
|
|
28
|
+
this.previousStartRow = startRow;
|
|
29
|
+
this.printedWidths = [];
|
|
30
|
+
}
|
|
31
|
+
else if (this.previousHeight > 0) {
|
|
32
|
+
// Normal case: move cursor up to start of previous output
|
|
33
|
+
output += ANSI.cursor.up(this.previousHeight);
|
|
34
|
+
output += ANSI.cursor.startOfLine;
|
|
35
|
+
}
|
|
36
|
+
// Generate output for visible region
|
|
37
|
+
if (prevBuffer && !needsFullRedraw) {
|
|
38
|
+
output += this.generateDiffOutput(ctx, visibleHeight, startRow);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
output += this.generateFullOutput(ctx, visibleHeight, startRow, startRow + visibleHeight);
|
|
42
|
+
}
|
|
43
|
+
this.previousHeight = visibleHeight;
|
|
44
|
+
this.previousStartRow = startRow;
|
|
45
|
+
return { output, contentHeight: visibleHeight };
|
|
46
|
+
}
|
|
47
|
+
generateDiffOutput(ctx, visibleHeight, startRow) {
|
|
48
|
+
const { nextBuffer, prevBuffer, palette, frameWidth } = ctx;
|
|
49
|
+
if (!prevBuffer)
|
|
50
|
+
return "";
|
|
51
|
+
let output = "";
|
|
52
|
+
const rowsToProcess = Math.max(visibleHeight, this.previousHeight);
|
|
53
|
+
let cursorRow = 0;
|
|
54
|
+
const moveToRow = (targetRow) => {
|
|
55
|
+
const delta = targetRow - cursorRow;
|
|
56
|
+
if (delta > 0) {
|
|
57
|
+
output += ANSI.cursor.down(delta);
|
|
58
|
+
}
|
|
59
|
+
else if (delta < 0) {
|
|
60
|
+
output += ANSI.cursor.up(-delta);
|
|
61
|
+
}
|
|
62
|
+
cursorRow = targetRow;
|
|
63
|
+
};
|
|
64
|
+
for (let screenY = 0; screenY < rowsToProcess; screenY++) {
|
|
65
|
+
const bufferY = startRow + screenY;
|
|
66
|
+
// Rows beyond visible height: clear if previously printed
|
|
67
|
+
if (screenY >= visibleHeight) {
|
|
68
|
+
const prevW = this.printedWidths[screenY] ?? 0;
|
|
69
|
+
if (prevW > 0) {
|
|
70
|
+
moveToRow(screenY);
|
|
71
|
+
output += ANSI.cursor.toCol(1) + palette.sgr(0) + " ".repeat(prevW);
|
|
72
|
+
this.printedWidths[screenY] = 0;
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const change = findChangeWindow(prevBuffer, nextBuffer, bufferY, frameWidth);
|
|
77
|
+
const newW = rowContentWidth(nextBuffer, bufferY, frameWidth);
|
|
78
|
+
const prevW = this.printedWidths[screenY] ?? 0;
|
|
79
|
+
if (!change) {
|
|
80
|
+
// No change; maybe need to clear tail if content shrunk
|
|
81
|
+
if (prevW > newW) {
|
|
82
|
+
moveToRow(screenY);
|
|
83
|
+
output += ANSI.cursor.toCol(newW + 1) + palette.sgr(0) + " ".repeat(prevW - newW);
|
|
84
|
+
this.printedWidths[screenY] = newW;
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
// Emit changed region [left..right]
|
|
89
|
+
moveToRow(screenY);
|
|
90
|
+
output += ANSI.cursor.toCol(change.left + 1);
|
|
91
|
+
output += emitRowWithReset(nextBuffer, palette, bufferY, frameWidth, change.left, change.right + 1);
|
|
92
|
+
// Clear tail if shrunk
|
|
93
|
+
const effectiveW = Math.max(newW, change.right + 1);
|
|
94
|
+
if (prevW > effectiveW) {
|
|
95
|
+
output += ANSI.cursor.toCol(effectiveW + 1) + palette.sgr(0) + " ".repeat(prevW - effectiveW);
|
|
96
|
+
}
|
|
97
|
+
this.printedWidths[screenY] = newW;
|
|
98
|
+
}
|
|
99
|
+
// Ensure cursor ends just after the dynamic block for next frame positioning
|
|
100
|
+
moveToRow(visibleHeight);
|
|
101
|
+
output += ANSI.cursor.toCol(1);
|
|
102
|
+
return output;
|
|
103
|
+
}
|
|
104
|
+
generateFullOutput(ctx, rowCount, startRow, endRow) {
|
|
105
|
+
const { nextBuffer, palette, frameWidth } = ctx;
|
|
106
|
+
let output = "";
|
|
107
|
+
// Full redraw inline: clear each line first, then emit content
|
|
108
|
+
for (let bufferY = startRow; bufferY < endRow; bufferY++) {
|
|
109
|
+
const screenY = bufferY - startRow;
|
|
110
|
+
const trimmedWidth = rowContentWidth(nextBuffer, bufferY, frameWidth);
|
|
111
|
+
// Full-width emit avoids reliance on line clears.
|
|
112
|
+
output += emitRowWithReset(nextBuffer, palette, bufferY, frameWidth, 0, frameWidth);
|
|
113
|
+
output += "\r\n";
|
|
114
|
+
// Track line widths for resize reflow calculation
|
|
115
|
+
this.printedWidths[screenY] = trimmedWidth;
|
|
116
|
+
}
|
|
117
|
+
// Clear any extra lines if content shrank
|
|
118
|
+
for (let screenY = rowCount; screenY < this.previousHeight; screenY++) {
|
|
119
|
+
output += palette.sgr(0) + " ".repeat(frameWidth) + "\r\n";
|
|
120
|
+
this.printedWidths[screenY] = 0;
|
|
121
|
+
}
|
|
122
|
+
// Move cursor back up to end of content
|
|
123
|
+
if (this.previousHeight > rowCount) {
|
|
124
|
+
output += ANSI.cursor.up(this.previousHeight - rowCount);
|
|
125
|
+
}
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
handleResize(newWidth, _newHeight, prevWidth) {
|
|
129
|
+
// Any width change triggers full rerender (Ink-style: clear + replay static)
|
|
130
|
+
if (newWidth !== prevWidth) {
|
|
131
|
+
this._needsFullRerender = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Check if full rerender is needed (clear screen + replay static) */
|
|
135
|
+
needsFullRerender() {
|
|
136
|
+
return this._needsFullRerender;
|
|
137
|
+
}
|
|
138
|
+
/** Clear the full rerender flag after handling */
|
|
139
|
+
clearFullRerenderFlag() {
|
|
140
|
+
this._needsFullRerender = false;
|
|
141
|
+
this.previousHeight = 0;
|
|
142
|
+
this.previousStartRow = 0;
|
|
143
|
+
this.printedWidths = [];
|
|
144
|
+
}
|
|
145
|
+
reset() {
|
|
146
|
+
this.previousHeight = 0;
|
|
147
|
+
this.previousStartRow = 0;
|
|
148
|
+
this.printedWidths = [];
|
|
149
|
+
}
|
|
150
|
+
getPreviousHeight() {
|
|
151
|
+
return this.previousHeight;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=InlineRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineRenderer.js","sourceRoot":"","sources":["../../../../src/renderer/modes/InlineRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAG5F;;;GAGG;AACH,MAAM,OAAO,cAAc;IAClB,cAAc,GAAG,CAAC,CAAA;IAClB,gBAAgB,GAAG,CAAC,CAAA,CAAC,mDAAmD;IACxE,kBAAkB,GAAG,KAAK,CAAA;IAC1B,aAAa,GAAa,EAAE,CAAA;IAEpC,cAAc,CAAC,GAAkB;QAChC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,GAAG,CAAA;QACtD,IAAI,MAAM,GAAG,EAAE,CAAA;QAEf,6DAA6D;QAC7D,MAAM,aAAa,GAAG,aAAa,GAAG,WAAW,CAAA;QACjD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW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
|
|
2
|
+
import type { TuiWriteStream } from "../../renderer-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Context passed to render mode output generation.
|
|
5
|
+
*/
|
|
6
|
+
export interface RenderContext {
|
|
7
|
+
nextBuffer: CellBuffer;
|
|
8
|
+
prevBuffer: CellBuffer | null;
|
|
9
|
+
palette: Palette;
|
|
10
|
+
frameWidth: number;
|
|
11
|
+
/** Terminal height (viewport) */
|
|
12
|
+
frameHeight: number;
|
|
13
|
+
/** Actual content height (may exceed frameHeight in inline mode) */
|
|
14
|
+
contentHeight: number;
|
|
15
|
+
enableDiff: boolean;
|
|
16
|
+
stdout: TuiWriteStream;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Result of generating output for a frame.
|
|
20
|
+
*/
|
|
21
|
+
export interface RenderOutput {
|
|
22
|
+
output: string;
|
|
23
|
+
contentHeight: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface for render mode implementations.
|
|
27
|
+
*/
|
|
28
|
+
export interface RendererMode {
|
|
29
|
+
/**
|
|
30
|
+
* Generate ANSI output for the current frame.
|
|
31
|
+
*/
|
|
32
|
+
generateOutput(ctx: RenderContext): RenderOutput;
|
|
33
|
+
/**
|
|
34
|
+
* Handle a resize event. Returns true if a full clear is needed.
|
|
35
|
+
*/
|
|
36
|
+
handleResize(newWidth: number, newHeight: number, prevWidth: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Reset any mode-specific state (e.g., after static content flush).
|
|
39
|
+
*/
|
|
40
|
+
reset(): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=RendererMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RendererMode.d.ts","sourceRoot":"","sources":["../../../../src/renderer/modes/RendererMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,oEAAoE;IACpE,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,cAAc,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY,CAAA;IAEhD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1E;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RendererMode.js","sourceRoot":"","sources":["../../../../src/renderer/modes/RendererMode.ts"],"names":[],"mappings":""}
|