@visulima/tui 1.0.0-alpha.2 → 1.0.0-alpha.21
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/CHANGELOG.md +300 -0
- package/LICENSE.md +2490 -69
- package/README.md +38 -10
- package/dist/components/accordion.d.ts +59 -0
- package/dist/components/accordion.js +1 -0
- package/dist/components/alert.d.ts +26 -0
- package/dist/components/alert.js +1 -0
- package/dist/components/animate-presence.d.ts +18 -0
- package/dist/components/animate-presence.js +1 -0
- package/dist/components/approval-prompt.d.ts +65 -0
- package/dist/components/approval-prompt.js +1 -0
- package/dist/components/area-chart.d.ts +66 -0
- package/dist/components/area-chart.js +1 -0
- package/dist/components/badge.d.ts +22 -0
- package/dist/components/badge.js +1 -0
- package/dist/components/bar-chart.d.ts +67 -0
- package/dist/components/bar-chart.js +1 -0
- package/dist/components/big-text.d.ts +81 -0
- package/dist/components/big-text.js +1 -0
- package/dist/components/blink-dot.d.ts +36 -0
- package/dist/components/blink-dot.js +1 -0
- package/dist/components/box.d.ts +62 -0
- package/dist/components/box.js +1 -0
- package/dist/components/breadcrumb.d.ts +33 -0
- package/dist/components/breadcrumb.js +1 -0
- package/dist/components/button.d.ts +45 -0
- package/dist/components/button.js +1 -0
- package/dist/components/calendar.d.ts +72 -0
- package/dist/components/calendar.js +1 -0
- package/dist/components/canvas.d.ts +44 -0
- package/dist/components/canvas.js +1 -0
- package/dist/components/card.d.ts +57 -0
- package/dist/components/card.js +1 -0
- package/dist/components/checkbox.d.ts +48 -0
- package/dist/components/checkbox.js +1 -0
- package/dist/components/code.d.ts +48 -0
- package/dist/components/code.js +2 -0
- package/dist/components/collapsible.d.ts +53 -0
- package/dist/components/collapsible.js +1 -0
- package/dist/components/command-block.d.ts +47 -0
- package/dist/components/command-block.js +4 -0
- package/dist/components/command-palette.d.ts +82 -0
- package/dist/components/command-palette.js +1 -0
- package/dist/components/confirm-dialog.d.ts +75 -0
- package/dist/components/confirm-dialog.js +1 -0
- package/dist/components/confirm-input.d.ts +38 -0
- package/dist/components/confirm-input.js +1 -0
- package/dist/components/console-overlay.d.ts +54 -0
- package/dist/components/console-overlay.js +1 -0
- package/dist/components/content-switcher.d.ts +57 -0
- package/dist/components/content-switcher.js +1 -0
- package/dist/components/controlled-scroll-view.d.ts +61 -0
- package/dist/components/controlled-scroll-view.js +1 -0
- package/dist/components/cursor.d.ts +62 -0
- package/dist/components/cursor.js +1 -0
- package/dist/components/date-picker.d.ts +65 -0
- package/dist/components/date-picker.js +1 -0
- package/dist/components/definition-list.d.ts +44 -0
- package/dist/components/definition-list.js +1 -0
- package/dist/components/dialog.d.ts +117 -0
- package/dist/components/dialog.js +1 -0
- package/dist/components/diff-view.d.ts +85 -0
- package/dist/components/diff-view.js +1 -0
- package/dist/components/divider.d.ts +49 -0
- package/dist/components/divider.js +1 -0
- package/dist/components/file-picker-entry.d.ts +104 -0
- package/dist/components/file-picker-entry.js +1 -0
- package/dist/components/form.d.ts +81 -0
- package/dist/components/form.js +1 -0
- package/dist/components/gauge.d.ts +87 -0
- package/dist/components/gauge.js +1 -0
- package/dist/components/gradient.d.ts +42 -0
- package/dist/components/gradient.js +1 -0
- package/dist/components/heading.d.ts +33 -0
- package/dist/components/heading.js +1 -0
- package/dist/components/heatmap.d.ts +62 -0
- package/dist/components/heatmap.js +1 -0
- package/dist/components/help.d.ts +52 -0
- package/dist/components/help.js +1 -0
- package/dist/components/histogram.d.ts +62 -0
- package/dist/components/histogram.js +1 -0
- package/dist/components/kbd.d.ts +31 -0
- package/dist/components/kbd.js +1 -0
- package/dist/components/line-chart.d.ts +109 -0
- package/dist/components/line-chart.js +1 -0
- package/dist/components/link.d.ts +38 -0
- package/dist/components/link.js +1 -0
- package/dist/components/loading-indicator.d.ts +29 -0
- package/dist/components/loading-indicator.js +1 -0
- package/dist/components/markdown.d.ts +40 -0
- package/dist/components/markdown.js +1 -0
- package/dist/components/masked-input.d.ts +50 -0
- package/dist/components/masked-input.js +1 -0
- package/dist/components/menu.d.ts +78 -0
- package/dist/components/menu.js +1 -0
- package/dist/components/message-bubble.d.ts +43 -0
- package/dist/components/message-bubble.js +1 -0
- package/dist/components/model-badge.d.ts +39 -0
- package/dist/components/model-badge.js +1 -0
- package/dist/components/multi-select.d.ts +65 -0
- package/dist/components/multi-select.js +1 -0
- package/dist/components/newline.d.ts +15 -0
- package/dist/components/newline.js +2 -0
- package/dist/components/operation-tree.d.ts +49 -0
- package/dist/components/operation-tree.js +1 -0
- package/dist/components/option-list.d.ts +47 -0
- package/dist/components/option-list.js +1 -0
- package/dist/components/ordered-list.d.ts +24 -0
- package/dist/components/ordered-list.js +1 -0
- package/dist/components/paginator.d.ts +69 -0
- package/dist/components/paginator.js +1 -0
- package/dist/components/paragraph.d.ts +38 -0
- package/dist/components/paragraph.js +1 -0
- package/dist/components/placeholder.d.ts +55 -0
- package/dist/components/placeholder.js +1 -0
- package/dist/components/progress-bar.d.ts +56 -0
- package/dist/components/progress-bar.js +1 -0
- package/dist/components/radio-group.d.ts +74 -0
- package/dist/components/radio-group.js +1 -0
- package/dist/components/scatter-plot.d.ts +35 -0
- package/dist/components/scatter-plot.js +1 -0
- package/dist/components/scroll-bar-box.d.ts +37 -0
- package/dist/components/scroll-bar-box.js +1 -0
- package/dist/components/scroll-bar.d.ts +25 -0
- package/dist/components/scroll-bar.js +1 -0
- package/dist/components/scroll-list.d.ts +20 -0
- package/dist/components/scroll-list.js +1 -0
- package/dist/components/scroll-view.d.ts +10 -0
- package/dist/components/scroll-view.js +1 -0
- package/dist/components/search-input.d.ts +55 -0
- package/dist/components/search-input.js +1 -0
- package/dist/components/select-input-indicator.d.ts +32 -0
- package/dist/components/select-input-indicator.js +1 -0
- package/dist/components/select-input-item.d.ts +41 -0
- package/dist/components/select-input-item.js +1 -0
- package/dist/components/select-input.d.ts +110 -0
- package/dist/components/select-input.js +1 -0
- package/dist/components/shimmer-text.d.ts +47 -0
- package/dist/components/shimmer-text.js +1 -0
- package/dist/components/slider.d.ts +103 -0
- package/dist/components/slider.js +1 -0
- package/dist/components/spacer.d.ts +8 -0
- package/dist/components/spacer.js +1 -0
- package/dist/components/sparkline.d.ts +35 -0
- package/dist/components/sparkline.js +1 -0
- package/dist/components/spinner.d.ts +17 -0
- package/dist/components/spinner.js +1 -0
- package/dist/components/static-render.d.ts +55 -0
- package/dist/components/static-render.js +1 -0
- package/dist/components/static.d.ts +29 -0
- package/dist/components/static.js +1 -0
- package/dist/components/status-line.d.ts +37 -0
- package/dist/components/status-line.js +1 -0
- package/dist/components/status-message.d.ts +21 -0
- package/dist/components/status-message.js +1 -0
- package/dist/components/stepper.d.ts +48 -0
- package/dist/components/stepper.js +1 -0
- package/dist/components/stopwatch.d.ts +49 -0
- package/dist/components/stopwatch.js +1 -0
- package/dist/components/streaming-text.d.ts +46 -0
- package/dist/components/streaming-text.js +1 -0
- package/dist/components/switch.d.ts +55 -0
- package/dist/components/switch.js +1 -0
- package/dist/components/tab.d.ts +19 -0
- package/dist/components/tab.js +1 -0
- package/dist/components/table.d.ts +119 -0
- package/dist/components/table.js +1 -0
- package/dist/components/tabs.d.ts +107 -0
- package/dist/components/tabs.js +1 -0
- package/dist/components/tag.d.ts +35 -0
- package/dist/components/tag.js +1 -0
- package/dist/components/text-input.d.ts +48 -0
- package/dist/components/text-input.js +1 -0
- package/dist/components/text.d.ts +79 -0
- package/dist/components/text.js +1 -0
- package/dist/components/textarea.d.ts +68 -0
- package/dist/components/textarea.js +2 -0
- package/dist/components/timer.d.ts +59 -0
- package/dist/components/timer.js +1 -0
- package/dist/components/toast.d.ts +49 -0
- package/dist/components/toast.js +1 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +1 -0
- package/dist/components/transform.d.ts +21 -0
- package/dist/components/transform.js +1 -0
- package/dist/components/transition.d.ts +74 -0
- package/dist/components/transition.js +1 -0
- package/dist/components/tree-view-entry.d.ts +357 -0
- package/dist/components/tree-view-entry.js +1 -0
- package/dist/components/unordered-list.d.ts +30 -0
- package/dist/components/unordered-list.js +1 -0
- package/dist/core/index.d.ts +58 -5
- package/dist/core/index.js +1 -5
- package/dist/ink/hooks/use-animation.d.ts +37 -39
- package/dist/ink/hooks/use-animation.js +1 -0
- package/dist/ink/hooks/use-app.d.ts +36 -4
- package/dist/ink/hooks/use-app.js +1 -0
- package/dist/ink/hooks/use-box-metrics.d.ts +58 -50
- package/dist/ink/hooks/use-box-metrics.js +1 -0
- package/dist/ink/hooks/use-clipboard.d.ts +26 -25
- package/dist/ink/hooks/use-clipboard.js +1 -0
- package/dist/ink/hooks/use-color-blindness.d.ts +29 -29
- package/dist/ink/hooks/use-color-blindness.js +1 -0
- package/dist/ink/hooks/use-console-capture.d.ts +38 -38
- package/dist/ink/hooks/use-console-capture.js +1 -0
- package/dist/ink/hooks/use-cursor.d.ts +10 -9
- package/dist/ink/hooks/use-cursor.js +1 -0
- package/dist/ink/hooks/use-focus-manager.d.ts +53 -38
- package/dist/ink/hooks/use-focus-manager.js +1 -0
- package/dist/ink/hooks/use-focus.d.ts +29 -25
- package/dist/ink/hooks/use-focus.js +1 -0
- package/dist/ink/hooks/use-form.d.ts +68 -0
- package/dist/ink/hooks/use-form.js +1 -0
- package/dist/ink/hooks/use-hotkey.d.ts +37 -0
- package/dist/ink/hooks/use-hotkey.js +1 -0
- package/dist/ink/hooks/use-input.d.ts +142 -142
- package/dist/ink/hooks/use-input.js +2 -0
- package/dist/ink/hooks/use-interval.d.ts +25 -0
- package/dist/ink/hooks/use-interval.js +1 -0
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +4 -4
- package/dist/ink/hooks/use-is-screen-reader-enabled.js +1 -0
- package/dist/ink/hooks/use-key-bindings.d.ts +50 -52
- package/dist/ink/hooks/use-key-bindings.js +1 -0
- package/dist/ink/hooks/use-key-chord.d.ts +25 -0
- package/dist/ink/hooks/use-key-chord.js +1 -0
- package/dist/ink/hooks/use-linked-scroll.d.ts +45 -37
- package/dist/ink/hooks/use-linked-scroll.js +1 -0
- package/dist/ink/hooks/use-paste.d.ts +41 -40
- package/dist/ink/hooks/use-paste.js +1 -0
- package/dist/ink/hooks/use-persistent-state.d.ts +56 -0
- package/dist/ink/hooks/use-persistent-state.js +2 -0
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +43 -43
- package/dist/ink/hooks/use-scroll-acceleration.js +1 -0
- package/dist/ink/hooks/use-scroll-input.d.ts +31 -31
- package/dist/ink/hooks/use-scroll-input.js +1 -0
- package/dist/ink/hooks/use-stderr.d.ts +14 -4
- package/dist/ink/hooks/use-stderr.js +1 -0
- package/dist/ink/hooks/use-stdin.d.ts +28 -5
- package/dist/ink/hooks/use-stdin.js +1 -0
- package/dist/ink/hooks/use-stdout.d.ts +14 -4
- package/dist/ink/hooks/use-stdout.js +1 -0
- package/dist/ink/hooks/use-stopwatch.d.ts +36 -37
- package/dist/ink/hooks/use-stopwatch.js +1 -0
- package/dist/ink/hooks/use-terminal-palette.d.ts +17 -16
- package/dist/ink/hooks/use-terminal-palette.js +1 -0
- package/dist/ink/hooks/use-text-buffer.d.ts +37 -37
- package/dist/ink/hooks/use-text-buffer.js +4 -0
- package/dist/ink/hooks/use-text-selection.d.ts +41 -41
- package/dist/ink/hooks/use-text-selection.js +1 -0
- package/dist/ink/hooks/use-timeout.d.ts +24 -0
- package/dist/ink/hooks/use-timeout.js +1 -0
- package/dist/ink/hooks/use-timer.d.ts +45 -46
- package/dist/ink/hooks/use-timer.js +1 -0
- package/dist/ink/hooks/use-window-size.d.ts +14 -14
- package/dist/ink/hooks/use-window-size.js +1 -0
- package/dist/ink/index.d.ts +398 -159
- package/dist/ink/index.js +1 -100
- package/dist/packem_chunks/devtools.js +3 -26
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +1 -0
- package/dist/packem_shared/Cell-BrXn3jxY.js +1 -0
- package/dist/packem_shared/ControlledScrollView-CIc-x1Cx.js +1 -0
- package/dist/packem_shared/DevTools-ClAYpMVI.js +1 -0
- package/dist/packem_shared/FilePicker-tYj_CIau.js +1 -0
- package/dist/packem_shared/FocusContext-Xy0cwJpO.js +1 -0
- package/dist/packem_shared/Fullscreen-CxLd1-Zu.js +1 -0
- package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +1 -0
- package/dist/packem_shared/InputParser-B_qZcN3r.js +2 -0
- package/dist/packem_shared/KEY-Bk8B-3h_.js +1 -0
- package/dist/packem_shared/LayoutNode-B8zej4dm.js +1 -0
- package/dist/packem_shared/MouseProvider-PnIUKURs.js +1 -0
- package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +1 -0
- package/dist/packem_shared/Renderer-DJXooAsp.js +1 -0
- package/dist/packem_shared/ResizeObserverEntry-Dq0dk8Kq.js +1 -0
- package/dist/packem_shared/ScrollBar-U_37hlIT.js +1 -0
- package/dist/packem_shared/ScrollBarBox-DwiCxilX.js +1 -0
- package/dist/packem_shared/ScrollList-C7nZ9ufK.js +1 -0
- package/dist/packem_shared/ScrollView-DKZ8OM-m.js +1 -0
- package/dist/packem_shared/Static-DLynr5pn.js +1 -0
- package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +1 -0
- package/dist/packem_shared/TreeView-C0Iv3et8.js +1 -0
- package/dist/packem_shared/TuiApp-BVDXP0Cv.js +1 -0
- package/dist/packem_shared/TuiContext-BoJvG3NN.js +3 -0
- package/dist/packem_shared/accessibility-context-DDyHTwmA.js +1 -0
- package/dist/packem_shared/animation-context-DW3p-vpk.js +1 -0
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
- package/dist/packem_shared/ansi-tokenizer-DqX9nJuk.js +1 -0
- package/dist/packem_shared/app-context-BVpKlG1z.js +1 -0
- package/dist/packem_shared/background-context-rjOaWFki.js +1 -0
- package/dist/packem_shared/braille-BBjIoaN0.js +1 -0
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +39 -0
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +50 -0
- package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
- package/dist/packem_shared/comparePoints-YxQfR_zq.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-CcUS50jx.js +1 -0
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
- package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
- package/dist/packem_shared/cursor-context-CFviBqPX.js +1 -0
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +12 -0
- package/dist/packem_shared/dom-BG-LS10p.js +1 -0
- package/dist/packem_shared/dom.d-C1IxuLJ9.d.ts +414 -0
- package/dist/packem_shared/focus-context-CsT69klR.js +1 -0
- package/dist/packem_shared/format-time-C7Q-hQZq.js +1 -0
- package/dist/packem_shared/getPathToRoot-D5Hns9Er.js +1 -0
- package/dist/packem_shared/getScrollHeight-ClEOyLHH.js +1 -0
- package/dist/packem_shared/input-utils-fAxzSlNh.js +1 -0
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +90 -0
- package/dist/packem_shared/isIntersecting-B3KbKTmu.js +1 -0
- package/dist/packem_shared/isOsc52Supported-DKK7Uee6.js +1 -0
- package/dist/packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js +1 -0
- package/dist/packem_shared/kittyFlags-C3rZLbcK.js +1 -0
- package/dist/packem_shared/layout-BMo200nF.js +2 -0
- package/dist/packem_shared/line-chart-kf7uhR0K.js +1 -0
- package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
- package/dist/packem_shared/measureElement-BTtTFZg4.js +1 -0
- package/dist/packem_shared/mouse-context-DaARgUu1.js +1 -0
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
- package/dist/packem_shared/processLayout-FEKj_mWu.js +1 -0
- package/dist/packem_shared/reconciler-CUbhOvcr.js +1 -0
- package/dist/packem_shared/reconciler-DIfG72R9.js +1 -0
- package/dist/packem_shared/render-BFio00DS.js +26 -0
- package/dist/packem_shared/render-Dh7HMhK1.js +1 -0
- package/dist/packem_shared/render.d-DuyG0zip.d.ts +417 -0
- package/dist/packem_shared/renderToString-BbQiRHrd.js +2 -0
- package/dist/packem_shared/renderToString-SDrrFvu8.js +4 -0
- package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +2 -0
- package/dist/packem_shared/renderer-DG986Pcr.js +17 -0
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +119 -0
- package/dist/packem_shared/selection.d-Dbha5bMS.d.ts +62 -0
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
- package/dist/packem_shared/squashTextNodesWithMap-DCdi3SZ2.js +1 -0
- package/dist/packem_shared/stderr-context-BzEaUICS.js +1 -0
- package/dist/packem_shared/stdin-context-BTaaFagk.js +1 -0
- package/dist/packem_shared/stdout-context-BnblEPez.js +1 -0
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +396 -0
- package/dist/packem_shared/terminal-palette.d-D2SQjfn-.d.ts +19 -0
- package/dist/packem_shared/text-width-BU2eeTWn.js +2 -0
- package/dist/packem_shared/token-to-elements-BAZpNZsu.js +1 -0
- package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +1 -0
- package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +1 -0
- package/dist/packem_shared/useMouseAction-2dRfU1vE.js +1 -0
- package/dist/packem_shared/useMouseContext-C746G7kY.js +1 -0
- package/dist/packem_shared/useMousePosition-BTWfV4JK.js +1 -0
- package/dist/packem_shared/useOnMouseClick-nY8xLZmt.js +1 -0
- package/dist/packem_shared/useOnMouseHover-D3DczIol.js +1 -0
- package/dist/packem_shared/useOnMouseState-cRK8QvzD.js +1 -0
- package/dist/packem_shared/useTreeView-BoMMeRPq.js +1 -0
- package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +1 -0
- package/dist/packem_shared/utils-CoviI5Vm.js +1 -0
- package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
- package/dist/packem_shared/waitFor-Dj5zfL5s.js +4 -0
- package/dist/packem_shared/wrapOrTruncateStyledLine-BZ00SM8i.js +3 -0
- package/dist/react/index.d.ts +519 -8
- package/dist/react/index.js +1 -9
- package/dist/testing/index.d.ts +278 -135
- package/dist/testing/index.js +1 -260
- package/index.js +52 -52
- package/package.json +563 -38
- package/dist/core/app.d.ts +0 -50
- package/dist/core/cell.d.ts +0 -33
- package/dist/core/inline.d.ts +0 -22
- package/dist/core/input.d.ts +0 -18
- package/dist/core/native-binding.d.ts +0 -22
- package/dist/ink/ansi-to-cell.d.ts +0 -5
- package/dist/ink/ansi-tokenizer.d.ts +0 -38
- package/dist/ink/clipboard.d.ts +0 -29
- package/dist/ink/color-matrix.d.ts +0 -49
- package/dist/ink/color-utils.d.ts +0 -30
- package/dist/ink/colorize.d.ts +0 -4
- package/dist/ink/components/AccessibilityContext.d.ts +0 -4
- package/dist/ink/components/Alert.d.ts +0 -30
- package/dist/ink/components/AnimationContext.d.ts +0 -10
- package/dist/ink/components/App.d.ts +0 -19
- package/dist/ink/components/AppContext.d.ts +0 -38
- package/dist/ink/components/BackgroundContext.d.ts +0 -5
- package/dist/ink/components/Badge.d.ts +0 -27
- package/dist/ink/components/BigText.d.ts +0 -71
- package/dist/ink/components/Box.d.ts +0 -58
- package/dist/ink/components/Code.d.ts +0 -46
- package/dist/ink/components/ConfirmInput.d.ts +0 -40
- package/dist/ink/components/ConsoleOverlay.d.ts +0 -52
- package/dist/ink/components/Cursor.d.ts +0 -43
- package/dist/ink/components/CursorContext.d.ts +0 -12
- package/dist/ink/components/Dialog.d.ts +0 -93
- package/dist/ink/components/DiffView.d.ts +0 -71
- package/dist/ink/components/ErrorBoundary.d.ts +0 -17
- package/dist/ink/components/ErrorOverview.d.ts +0 -6
- package/dist/ink/components/FocusContext.d.ts +0 -17
- package/dist/ink/components/Gradient.d.ts +0 -38
- package/dist/ink/components/Help.d.ts +0 -49
- package/dist/ink/components/Link.d.ts +0 -34
- package/dist/ink/components/Markdown.d.ts +0 -34
- package/dist/ink/components/MultiSelect.d.ts +0 -63
- package/dist/ink/components/Newline.d.ts +0 -12
- package/dist/ink/components/OrderedList.d.ts +0 -30
- package/dist/ink/components/Paginator.d.ts +0 -75
- package/dist/ink/components/ProgressBar.d.ts +0 -51
- package/dist/ink/components/SelectInput.d.ts +0 -96
- package/dist/ink/components/SelectInputIndicator.d.ts +0 -36
- package/dist/ink/components/SelectInputItem.d.ts +0 -43
- package/dist/ink/components/Slider.d.ts +0 -92
- package/dist/ink/components/Spacer.d.ts +0 -7
- package/dist/ink/components/Spinner.d.ts +0 -42
- package/dist/ink/components/Static.d.ts +0 -24
- package/dist/ink/components/StaticRender.d.ts +0 -28
- package/dist/ink/components/StatusMessage.d.ts +0 -26
- package/dist/ink/components/StderrContext.d.ts +0 -16
- package/dist/ink/components/StdinContext.d.ts +0 -29
- package/dist/ink/components/StdoutContext.d.ts +0 -16
- package/dist/ink/components/Stopwatch.d.ts +0 -44
- package/dist/ink/components/Tab.d.ts +0 -25
- package/dist/ink/components/Table.d.ts +0 -80
- package/dist/ink/components/Tabs.d.ts +0 -104
- package/dist/ink/components/Text.d.ts +0 -63
- package/dist/ink/components/TextInput.d.ts +0 -48
- package/dist/ink/components/Textarea.d.ts +0 -62
- package/dist/ink/components/Timer.d.ts +0 -52
- package/dist/ink/components/Transform.d.ts +0 -16
- package/dist/ink/components/UnorderedList.d.ts +0 -35
- package/dist/ink/components/file-picker/FilePicker.d.ts +0 -75
- package/dist/ink/components/file-picker/index.d.ts +0 -3
- package/dist/ink/components/file-picker/types.d.ts +0 -38
- package/dist/ink/components/file-picker/use-file-system.d.ts +0 -16
- package/dist/ink/components/scroll/ControlledScrollView.d.ts +0 -43
- package/dist/ink/components/scroll/ScrollBar.d.ts +0 -20
- package/dist/ink/components/scroll/ScrollBarBox.d.ts +0 -15
- package/dist/ink/components/scroll/ScrollList.d.ts +0 -12
- package/dist/ink/components/scroll/ScrollView.d.ts +0 -98
- package/dist/ink/components/scroll/index.d.ts +0 -10
- package/dist/ink/components/scroll/use-state-ref.d.ts +0 -8
- package/dist/ink/components/tree-view/TreeView.d.ts +0 -89
- package/dist/ink/components/tree-view/TreeViewNode.d.ts +0 -29
- package/dist/ink/components/tree-view/index.d.ts +0 -11
- package/dist/ink/components/tree-view/theme.d.ts +0 -24
- package/dist/ink/components/tree-view/tree-node-map.d.ts +0 -72
- package/dist/ink/components/tree-view/types.d.ts +0 -55
- package/dist/ink/components/tree-view/use-tree-view-state.d.ts +0 -135
- package/dist/ink/components/tree-view/use-tree-view.d.ts +0 -26
- package/dist/ink/components/variant-config.d.ts +0 -10
- package/dist/ink/cursor-helpers.d.ts +0 -38
- package/dist/ink/data-limited-lru-map.d.ts +0 -21
- package/dist/ink/devtools-window-polyfill.d.ts +0 -1
- package/dist/ink/devtools.d.ts +0 -1
- package/dist/ink/dom.d.ts +0 -213
- package/dist/ink/get-max-width.d.ts +0 -3
- package/dist/ink/highlighter.d.ts +0 -28
- package/dist/ink/ime-utils.d.ts +0 -25
- package/dist/ink/ink.d.ts +0 -189
- package/dist/ink/input-parser.d.ts +0 -10
- package/dist/ink/input-utils.d.ts +0 -16
- package/dist/ink/instances.d.ts +0 -3
- package/dist/ink/kitty-keyboard.d.ts +0 -23
- package/dist/ink/layout.d.ts +0 -26
- package/dist/ink/log-update-native.d.ts +0 -14
- package/dist/ink/log-update.d.ts +0 -21
- package/dist/ink/measure-element.d.ts +0 -147
- package/dist/ink/measure-text.d.ts +0 -56
- package/dist/ink/mouse/Fullscreen.d.ts +0 -8
- package/dist/ink/mouse/MouseProvider.d.ts +0 -11
- package/dist/ink/mouse/ansi-parser.d.ts +0 -37
- package/dist/ink/mouse/constants.d.ts +0 -59
- package/dist/ink/mouse/index.d.ts +0 -20
- package/dist/ink/mouse/is-intersecting.d.ts +0 -18
- package/dist/ink/mouse/mouse-context.d.ts +0 -36
- package/dist/ink/mouse/use-element-position.d.ts +0 -29
- package/dist/ink/mouse/use-mouse-action.d.ts +0 -7
- package/dist/ink/mouse/use-mouse-position.d.ts +0 -7
- package/dist/ink/mouse/use-mouse.d.ts +0 -7
- package/dist/ink/mouse/use-on-mouse-click.d.ts +0 -14
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +0 -8
- package/dist/ink/mouse/use-on-mouse-state.d.ts +0 -11
- package/dist/ink/output.d.ts +0 -74
- package/dist/ink/parse-keypress.d.ts +0 -22
- package/dist/ink/reconciler.d.ts +0 -3
- package/dist/ink/region.d.ts +0 -99
- package/dist/ink/render-background.d.ts +0 -4
- package/dist/ink/render-border.d.ts +0 -4
- package/dist/ink/render-node-to-output.d.ts +0 -38
- package/dist/ink/render-scrollbar.d.ts +0 -9
- package/dist/ink/render-sticky.d.ts +0 -44
- package/dist/ink/render-to-string.d.ts +0 -37
- package/dist/ink/render.d.ts +0 -191
- package/dist/ink/renderer.d.ts +0 -17
- package/dist/ink/resize-observer.d.ts +0 -44
- package/dist/ink/sanitize-ansi.d.ts +0 -2
- package/dist/ink/scroll.d.ts +0 -23
- package/dist/ink/selection.d.ts +0 -70
- package/dist/ink/squash-text-nodes.d.ts +0 -18
- package/dist/ink/style-flags.d.ts +0 -17
- package/dist/ink/styled-line-factory.d.ts +0 -25
- package/dist/ink/styled-line-serializer.d.ts +0 -18
- package/dist/ink/styled-line.d.ts +0 -109
- package/dist/ink/styles.d.ts +0 -369
- package/dist/ink/terminal-palette.d.ts +0 -25
- package/dist/ink/text-wrap.d.ts +0 -10
- package/dist/ink/token-to-elements.d.ts +0 -22
- package/dist/ink/utils/format-time.d.ts +0 -4
- package/dist/ink/utils.d.ts +0 -9
- package/dist/ink/wrap-text.d.ts +0 -3
- package/dist/ink/write-synchronized.d.ts +0 -4
- package/dist/packem_shared/AccessibilityContext-BLelHhNU.js +0 -7
- package/dist/packem_shared/Alert-Dr3s_LD9.js +0 -17
- package/dist/packem_shared/AnimationContext-BcJg8Jr6.js +0 -15
- package/dist/packem_shared/AppContext-CP0U6H7O.js +0 -11
- package/dist/packem_shared/BackgroundContext-BAUaxfOb.js +0 -5
- package/dist/packem_shared/Badge-Dk7EGGM6.js +0 -13
- package/dist/packem_shared/BigText-CjMdY63X.js +0 -24
- package/dist/packem_shared/Box-D_pSJ9Jp.js +0 -73
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-BsMy5Ewl.js +0 -81
- package/dist/packem_shared/Cell-DCg1kJY-.js +0 -48
- package/dist/packem_shared/Code-DjQvPBD9.js +0 -53
- package/dist/packem_shared/ConfirmInput-85Y4kRQW.js +0 -44
- package/dist/packem_shared/ConsoleOverlay-DBNa4vtj.js +0 -57
- package/dist/packem_shared/ControlledScrollView-BlOaxcsN.js +0 -286
- package/dist/packem_shared/ControlledScrollView-DfAhcufF.js +0 -5
- package/dist/packem_shared/Cursor-DiW7YoSK.js +0 -18
- package/dist/packem_shared/CursorContext-JxRzlqAx.js +0 -9
- package/dist/packem_shared/DevTools-aMPIsaHx.js +0 -61
- package/dist/packem_shared/Dialog-DsSNAVgC.js +0 -71
- package/dist/packem_shared/DiffView-hqaw-2S6.js +0 -329
- package/dist/packem_shared/FilePicker-DNwFxRhq.js +0 -254
- package/dist/packem_shared/FocusContext-CWkYtgcm.js +0 -26
- package/dist/packem_shared/FocusContext-D5wFxSRz.js +0 -153
- package/dist/packem_shared/Fullscreen-DrElAE1o.js +0 -11
- package/dist/packem_shared/Gradient-Ql5P0GUd.js +0 -136
- package/dist/packem_shared/Help-6wanGG38.js +0 -112
- package/dist/packem_shared/IMECompositionBuffer-Dl3S0KnF.js +0 -55
- package/dist/packem_shared/InputParser-BKHpWfvN.js +0 -156
- package/dist/packem_shared/LayoutNode-Cjnsodiy.js +0 -131
- package/dist/packem_shared/Link-COcKYfGT.js +0 -66
- package/dist/packem_shared/Markdown-y1ISztof.js +0 -212
- package/dist/packem_shared/MouseProvider-Y9TSSEGl.js +0 -136
- package/dist/packem_shared/MultiSelect-ChoLUcDI.js +0 -129
- package/dist/packem_shared/NAMED_COLORS-a4QBvb5r.js +0 -262
- package/dist/packem_shared/Newline-DBtYEg8x.js +0 -7
- package/dist/packem_shared/OrderedList-Cp7pXr6m.js +0 -26
- package/dist/packem_shared/Paginator-D1AuD-kj.js +0 -104
- package/dist/packem_shared/ProgressBar-DOfpVagn.js +0 -22
- package/dist/packem_shared/Renderer-zZ5O3vxc.js +0 -31
- package/dist/packem_shared/ResizeObserverEntry-Br4seLeQ.js +0 -102
- package/dist/packem_shared/ScrollBar-EWAs2Uc7.js +0 -106
- package/dist/packem_shared/ScrollBarBox-DTNNlh7R.js +0 -72
- package/dist/packem_shared/ScrollList-DCeIFL8M.js +0 -227
- package/dist/packem_shared/ScrollView-v3MCNIyX.js +0 -196
- package/dist/packem_shared/SelectInput-BN2TMyxp.js +0 -260
- package/dist/packem_shared/SelectInputIndicator-DkRMoH_b.js +0 -9
- package/dist/packem_shared/SelectInputItem-BF9LQgKu.js +0 -8
- package/dist/packem_shared/Slider-BWD7xZX6.js +0 -116
- package/dist/packem_shared/Spacer-Bs4ER-HK.js +0 -8
- package/dist/packem_shared/Spinner-BuI-kN4p.js +0 -1799
- package/dist/packem_shared/Static-DpTd6Eed.js +0 -22
- package/dist/packem_shared/Static-xmD9giJj.js +0 -18
- package/dist/packem_shared/StaticRender-tYwH6QXl.js +0 -33
- package/dist/packem_shared/StatusMessage-BtSYxzwb.js +0 -14
- package/dist/packem_shared/StderrContext-Bj4Mf7v7.js +0 -17
- package/dist/packem_shared/StdinContext-Bq_GNJ3z.js +0 -38
- package/dist/packem_shared/StdoutContext-CgjWeCdO.js +0 -17
- package/dist/packem_shared/Stopwatch-DjtTCyHn.js +0 -23
- package/dist/packem_shared/Tab-C6r5q4hR.js +0 -7
- package/dist/packem_shared/Table-D-rSVlzb.js +0 -82
- package/dist/packem_shared/Tabs-hki-KRnx.js +0 -153
- package/dist/packem_shared/Text-DvAUdZcK.js +0 -65
- package/dist/packem_shared/TextInput-C79WEQ5U.js +0 -137
- package/dist/packem_shared/Textarea-Dj06R6Zd.js +0 -272
- package/dist/packem_shared/Timer-wi9zuh4n.js +0 -22
- package/dist/packem_shared/Transform-BHxY_dAM.js +0 -14
- package/dist/packem_shared/TreeNodeMap-CtJUvBnd.js +0 -155
- package/dist/packem_shared/TreeView-C2062dtj.js +0 -148
- package/dist/packem_shared/TuiApp-DfxOnXqi.js +0 -120
- package/dist/packem_shared/TuiContext-CqEjMyXd.js +0 -415
- package/dist/packem_shared/UnorderedList-DhnadWjX.js +0 -33
- package/dist/packem_shared/ansi-parser-0BdVTKho.js +0 -41
- package/dist/packem_shared/ansi-tokenizer-LHq2LUWA.js +0 -307
- package/dist/packem_shared/boxes-oi3WUbyR.js +0 -92
- package/dist/packem_shared/colorize-88_Vk8cn.js +0 -48
- package/dist/packem_shared/comparePoints-CGMDnd3_.js +0 -287
- package/dist/packem_shared/createInlineLoop-BxMmcq9D.js +0 -93
- package/dist/packem_shared/createLinkedScrollGroup-Djw4Ceo0.js +0 -44
- package/dist/packem_shared/dom-DvzhsAez.js +0 -225
- package/dist/packem_shared/format-time-BGmnDukX.js +0 -12
- package/dist/packem_shared/getPathToRoot-a1wbwxfL.js +0 -4
- package/dist/packem_shared/getScrollHeight-BubfU_df.js +0 -63
- package/dist/packem_shared/input-utils-ViAEXa0Z.js +0 -19
- package/dist/packem_shared/isIntersecting-fEXHJN5R.js +0 -10
- package/dist/packem_shared/isOsc52Supported-G0k4sXJx.js +0 -36
- package/dist/packem_shared/isTerminalPaletteQuerySupported-EeiwMKbr.js +0 -93
- package/dist/packem_shared/kittyFlags-bNNf_9kX.js +0 -26
- package/dist/packem_shared/measure-element-Reza_yfC.js +0 -396
- package/dist/packem_shared/measure-text-DItZYotK.js +0 -1189
- package/dist/packem_shared/measureElement-CTgFCmKd.js +0 -4
- package/dist/packem_shared/mouse-context-BUHWKEIe.js +0 -6
- package/dist/packem_shared/parseSgrMouse-BHVBPP9G.js +0 -1
- package/dist/packem_shared/processLayout-BQ9kXfd3.js +0 -2
- package/dist/packem_shared/reconciler-BXf6miSS.js +0 -211
- package/dist/packem_shared/reconciler-gfmqURLy.js +0 -680
- package/dist/packem_shared/render-BAwdjfki.js +0 -2806
- package/dist/packem_shared/render-Bpjhf0lD.js +0 -195
- package/dist/packem_shared/renderToString-Cfg55DRD.js +0 -62
- package/dist/packem_shared/renderToString-ClIaXgrC.js +0 -86
- package/dist/packem_shared/renderTreeToBuffer-D3mo7M7m.js +0 -308
- package/dist/packem_shared/renderer-B3wROkeg.js +0 -1431
- package/dist/packem_shared/setEnableStyledLineCache-BpskngSJ.js +0 -2
- package/dist/packem_shared/squashTextNodesWithMap-iqm6OMMT.js +0 -100
- package/dist/packem_shared/text-width-DhuarWcB.js +0 -42
- package/dist/packem_shared/token-to-elements-BRFl_rzw.js +0 -249
- package/dist/packem_shared/treeViewTheme-BpSw9TMf.js +0 -52
- package/dist/packem_shared/useAnimation-kj31sA-T.js +0 -62
- package/dist/packem_shared/useApp-DPQlRzi5.js +0 -6
- package/dist/packem_shared/useBoxMetrics-rBjKc-g4.js +0 -54
- package/dist/packem_shared/useClipboard-B_9-adw1.js +0 -23
- package/dist/packem_shared/useColorBlindness-D_sTIhcb.js +0 -30
- package/dist/packem_shared/useConsoleCapture-Dvt7G1W1.js +0 -61
- package/dist/packem_shared/useCursor-BIJzc8k9.js +0 -19
- package/dist/packem_shared/useElementDimensions-CAoKitVD.js +0 -67
- package/dist/packem_shared/useFocus-CNl5QHHf.js +0 -37
- package/dist/packem_shared/useFocusManager-BPYaUuKQ.js +0 -16
- package/dist/packem_shared/useInput-Cfp5zB2s.js +0 -594
- package/dist/packem_shared/useIsScreenReaderEnabled-CnGKCe0f.js +0 -9
- package/dist/packem_shared/useKeyBindings-B78l1E1n.js +0 -66
- package/dist/packem_shared/useMouseAction-C5gZ2nj7.js +0 -29
- package/dist/packem_shared/useMouseContext-D-rFy60Q.js +0 -12
- package/dist/packem_shared/useMousePosition-BHBJ-kBk.js +0 -25
- package/dist/packem_shared/useOnMouseClick--ZIyBOBO.js +0 -35
- package/dist/packem_shared/useOnMouseHover-26diuXUC.js +0 -32
- package/dist/packem_shared/useOnMouseState-NO_Kda_C.js +0 -13
- package/dist/packem_shared/usePaste-Ct8J4AGR.js +0 -35
- package/dist/packem_shared/useScrollAcceleration-R9LfrPVG.js +0 -73
- package/dist/packem_shared/useScrollInput-D3CpBq_a.js +0 -72
- package/dist/packem_shared/useStderr-CAOVUh4E.js +0 -6
- package/dist/packem_shared/useStdin-X-O0kd-n.js +0 -7
- package/dist/packem_shared/useStdout-DyF6DSH0.js +0 -6
- package/dist/packem_shared/useStopwatch-qC4Beai4.js +0 -33
- package/dist/packem_shared/useTerminalPalette-BaWO2c4Q.js +0 -38
- package/dist/packem_shared/useTextBuffer-C8fEe9Ly.js +0 -398
- package/dist/packem_shared/useTextSelection-mXtxgsPK.js +0 -50
- package/dist/packem_shared/useTimer-CPQ7j827.js +0 -46
- package/dist/packem_shared/useTreeView-BT57P3Kx.js +0 -101
- package/dist/packem_shared/useTreeViewState-BpS_KZ-K.js +0 -502
- package/dist/packem_shared/useWindowSize-ugEmGZJm.js +0 -20
- package/dist/packem_shared/utils-BgdlrbOH.js +0 -140
- package/dist/packem_shared/variant-config-DSZoX5TM.js +0 -8
- package/dist/packem_shared/wrapOrTruncateStyledLine-DN3Nogoc.js +0 -147
- package/dist/react/devtools.d.ts +0 -27
- package/dist/react/focus.d.ts +0 -39
- package/dist/react/hooks.d.ts +0 -238
- package/dist/react/layout.d.ts +0 -35
- package/dist/react/react.d.ts +0 -57
- package/dist/react/reconciler.d.ts +0 -4
- package/dist/react/render-to-string.d.ts +0 -21
- package/dist/react/renderer.d.ts +0 -2
- package/dist/react/scene.d.ts +0 -3
- package/dist/react/static.d.ts +0 -39
- package/dist/react/styles.d.ts +0 -83
- package/dist/react/text-width.d.ts +0 -20
- package/dist/testing/keys.d.ts +0 -89
- package/dist/testing/screen.d.ts +0 -35
- package/dist/testing/wait-for.d.ts +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var P=Object.defineProperty;var p=(e,t)=>P(e,"name",{value:t,configurable:!0});import{createRequire as b}from"node:module";import{version as O,createContext as F}from"react";import G from"react-reconciler";import{NoEventPriority as L,DefaultEventPriority as v}from"react-reconciler/constants.js";import{unstable_shouldYield as w,unstable_scheduleCallback as k,unstable_now as B,unstable_cancelCallback as W}from"scheduler";import n from"yoga-layout";import{b as y,d as g,s as E,m as _,e as M,r as I,f as H,c as U,h as C,j as N}from"./dom-BG-LS10p.js";const re=b(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=D;var Y=Object.defineProperty,u=p((e,t)=>Y(e,"name",{value:t,configurable:!0}),"t");const j=[["top",n.EDGE_TOP],["right",n.EDGE_RIGHT],["bottom",n.EDGE_BOTTOM],["left",n.EDGE_LEFT]],X=u((e,t)=>{if("position"in t){let r=n.POSITION_TYPE_RELATIVE;t.position==="absolute"?r=n.POSITION_TYPE_ABSOLUTE:t.position==="static"&&(r=n.POSITION_TYPE_STATIC),e.setPositionType(r)}for(const[r,s]of j){if(!(r in t))continue;const l=t[r];if(typeof l=="string"){e.setPositionPercent(s,Number.parseFloat(l));continue}e.setPosition(s,l)}},"applyPositionStyles"),V=u((e,t)=>{"margin"in t&&e.setMargin(n.EDGE_ALL,t.margin??0),"marginX"in t&&e.setMargin(n.EDGE_HORIZONTAL,t.marginX??0),"marginY"in t&&e.setMargin(n.EDGE_VERTICAL,t.marginY??0),"marginLeft"in t&&e.setMargin(n.EDGE_START,t.marginLeft||0),"marginRight"in t&&e.setMargin(n.EDGE_END,t.marginRight||0),"marginTop"in t&&e.setMargin(n.EDGE_TOP,t.marginTop||0),"marginBottom"in t&&e.setMargin(n.EDGE_BOTTOM,t.marginBottom||0)},"applyMarginStyles"),J=u((e,t)=>{"padding"in t&&e.setPadding(n.EDGE_ALL,t.padding??0),"paddingX"in t&&e.setPadding(n.EDGE_HORIZONTAL,t.paddingX??0),"paddingY"in t&&e.setPadding(n.EDGE_VERTICAL,t.paddingY??0),"paddingLeft"in t&&e.setPadding(n.EDGE_LEFT,t.paddingLeft||0),"paddingRight"in t&&e.setPadding(n.EDGE_RIGHT,t.paddingRight||0),"paddingTop"in t&&e.setPadding(n.EDGE_TOP,t.paddingTop||0),"paddingBottom"in t&&e.setPadding(n.EDGE_BOTTOM,t.paddingBottom||0)},"applyPaddingStyles"),q=u((e,t)=>{"flexGrow"in t&&e.setFlexGrow(t.flexGrow??0),"flexShrink"in t&&e.setFlexShrink(typeof t.flexShrink=="number"?t.flexShrink:1),"flexWrap"in t&&(t.flexWrap==="nowrap"&&e.setFlexWrap(n.WRAP_NO_WRAP),t.flexWrap==="wrap"&&e.setFlexWrap(n.WRAP_WRAP),t.flexWrap==="wrap-reverse"&&e.setFlexWrap(n.WRAP_WRAP_REVERSE)),"flexDirection"in t&&(t.flexDirection==="row"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW),t.flexDirection==="row-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_ROW_REVERSE),t.flexDirection==="column"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN),t.flexDirection==="column-reverse"&&e.setFlexDirection(n.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in t&&(typeof t.flexBasis=="number"?e.setFlexBasis(t.flexBasis):typeof t.flexBasis=="string"?e.setFlexBasisPercent(Number.parseInt(t.flexBasis,10)):e.setFlexBasis(Number.NaN)),"alignItems"in t&&((t.alignItems==="stretch"||!t.alignItems)&&e.setAlignItems(n.ALIGN_STRETCH),t.alignItems==="flex-start"&&e.setAlignItems(n.ALIGN_FLEX_START),t.alignItems==="center"&&e.setAlignItems(n.ALIGN_CENTER),t.alignItems==="flex-end"&&e.setAlignItems(n.ALIGN_FLEX_END),t.alignItems==="baseline"&&e.setAlignItems(n.ALIGN_BASELINE)),"alignSelf"in t&&((t.alignSelf==="auto"||!t.alignSelf)&&e.setAlignSelf(n.ALIGN_AUTO),t.alignSelf==="flex-start"&&e.setAlignSelf(n.ALIGN_FLEX_START),t.alignSelf==="center"&&e.setAlignSelf(n.ALIGN_CENTER),t.alignSelf==="flex-end"&&e.setAlignSelf(n.ALIGN_FLEX_END),t.alignSelf==="stretch"&&e.setAlignSelf(n.ALIGN_STRETCH),t.alignSelf==="baseline"&&e.setAlignSelf(n.ALIGN_BASELINE)),"alignContent"in t&&((t.alignContent==="flex-start"||!t.alignContent)&&e.setAlignContent(n.ALIGN_FLEX_START),t.alignContent==="center"&&e.setAlignContent(n.ALIGN_CENTER),t.alignContent==="flex-end"&&e.setAlignContent(n.ALIGN_FLEX_END),t.alignContent==="space-between"&&e.setAlignContent(n.ALIGN_SPACE_BETWEEN),t.alignContent==="space-around"&&e.setAlignContent(n.ALIGN_SPACE_AROUND),t.alignContent==="space-evenly"&&e.setAlignContent(n.ALIGN_SPACE_EVENLY),t.alignContent==="stretch"&&e.setAlignContent(n.ALIGN_STRETCH)),"justifyContent"in t&&((t.justifyContent==="flex-start"||!t.justifyContent)&&e.setJustifyContent(n.JUSTIFY_FLEX_START),t.justifyContent==="center"&&e.setJustifyContent(n.JUSTIFY_CENTER),t.justifyContent==="flex-end"&&e.setJustifyContent(n.JUSTIFY_FLEX_END),t.justifyContent==="space-between"&&e.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),t.justifyContent==="space-around"&&e.setJustifyContent(n.JUSTIFY_SPACE_AROUND),t.justifyContent==="space-evenly"&&e.setJustifyContent(n.JUSTIFY_SPACE_EVENLY))},"applyFlexStyles"),$=u((e,t)=>{"width"in t&&(typeof t.width=="number"?e.setWidth(t.width):typeof t.width=="string"?e.setWidthPercent(Number.parseInt(t.width,10)):e.setWidthAuto()),"height"in t&&(typeof t.height=="number"?e.setHeight(t.height):typeof t.height=="string"?e.setHeightPercent(Number.parseInt(t.height,10)):e.setHeightAuto()),"minWidth"in t&&(typeof t.minWidth=="string"?e.setMinWidthPercent(Number.parseInt(t.minWidth,10)):e.setMinWidth(t.minWidth??0)),"minHeight"in t&&(typeof t.minHeight=="string"?e.setMinHeightPercent(Number.parseInt(t.minHeight,10)):e.setMinHeight(t.minHeight??0)),"maxWidth"in t&&(typeof t.maxWidth=="string"?e.setMaxWidthPercent(Number.parseInt(t.maxWidth,10)):e.setMaxWidth(t.maxWidth)),"maxHeight"in t&&(typeof t.maxHeight=="string"?e.setMaxHeightPercent(Number.parseInt(t.maxHeight,10)):e.setMaxHeight(t.maxHeight)),"aspectRatio"in t&&e.setAspectRatio(t.aspectRatio)},"applyDimensionStyles"),z=u((e,t)=>{"display"in t&&e.setDisplay(t.display==="flex"?n.DISPLAY_FLEX:n.DISPLAY_NONE)},"applyDisplayStyles"),Z=u((e,t,r)=>{if(!("borderStyle"in t||"borderTop"in t||"borderBottom"in t||"borderLeft"in t||"borderRight"in t))return;const s=r.borderStyle?1:0;e.setBorder(n.EDGE_TOP,r.borderTop===!1?0:s),e.setBorder(n.EDGE_BOTTOM,r.borderBottom===!1?0:s),e.setBorder(n.EDGE_LEFT,r.borderLeft===!1?0:s),e.setBorder(n.EDGE_RIGHT,r.borderRight===!1?0:s)},"applyBorderStyles"),K=u((e,t)=>{"gap"in t&&e.setGap(n.GUTTER_ALL,t.gap??0),"columnGap"in t&&e.setGap(n.GUTTER_COLUMN,t.columnGap??0),"rowGap"in t&&e.setGap(n.GUTTER_ROW,t.rowGap??0)},"applyGapStyles"),Q=u((e,t)=>{const r=t.overflow??"visible",s=t.overflowX??r,l=t.overflowY??r;s==="scroll"||l==="scroll"?e.setOverflow(n.OVERFLOW_SCROLL):s==="hidden"||l==="hidden"?e.setOverflow(n.OVERFLOW_HIDDEN):e.setOverflow(n.OVERFLOW_VISIBLE)},"applyOverflowStyles"),S=u((e,t={},r=t)=>{X(e,t),V(e,t),J(e,t),q(e,t),$(e,t),z(e,t),Z(e,t,r),K(e,t),Q(e,r)},"styles");var ee=Object.defineProperty,c=p((e,t)=>ee(e,"name",{value:t,configurable:!0}),"c");if(A.env.DEV==="true"){let e=!1;try{import.meta.resolve("react-devtools-core"),e=!0}catch{}e&&await import("../packem_chunks/devtools.js")}const x=c((e,t)=>{if(e===t)return;if(!e)return t;const r={};let s=!1;for(const l of Object.keys(e))(!t||!Object.hasOwn(t,l))&&(r[l]=void 0,s=!0);if(t)for(const l of Object.keys(t))t[l]!==e[l]&&(r[l]=t[l],s=!0);return s?r:void 0},"diff"),h=c(e=>{if(e){if(e.yogaNode?.unsetMeasureFunc(),"resizeObservers"in e&&e.resizeObservers?.clear(),"childNodes"in e&&e.childNodes)for(const t of e.childNodes)h(t);e.yogaNode?.free(),"cachedRender"in e&&(e.cachedRender=void 0),"childNodes"in e&&(e.childNodes=[]),e.parentNode=void 0}},"cleanupNodeTree");let m=L,T;async function R(){const e=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),t=JSON.parse(e);return{name:t?.name,version:t?.version}}p(R,"B");c(R,"loadPackageJson");let f={name:"ink",version:O};if(A.env.DEV==="true")try{const e=await R();f={name:e.name||f.name,version:e.version||f.version}}catch(e){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",e)}const de=G({afterActiveInstanceBlur(){},appendChild:g,appendChildToContainer:g,appendInitialChild:g,beforeActiveInstanceBlur(){},cancelCallback:W,cancelTimeout:clearTimeout,clearContainer:c(()=>!1,"clearContainer"),commitTextUpdate(e,t,r){E(e,r)},commitUpdate(e,t,r,s){T&&e.internal_static&&(T.isStaticDirty=!0);const l=x(r,s),a=x(r.style,s.style);if(!l&&!a)return;let i=!!a;if(l){for(const[o,d]of Object.entries(l))if(o!=="children"){if(o==="style"){C(e,d);continue}if(o==="internal_transform"){e.internal_transform=d,i=!0;continue}if(o==="internal_cursor"){e.internal_cursor=d,i=!0;continue}if(o==="internal_static"){e.internal_static=!0,i=!0;continue}if(o==="sticky"){e.internal_sticky=d,i=!0;continue}if(o==="internalStickyAlternate"){e.internal_stickyAlternate=d,i=!0;continue}if(o==="opaque"){e.internal_opaque=d,i=!0;continue}if(o==="scrollbar"){e.internal_scrollbar=d,i=!0;continue}if(o==="internal_terminalCursorFocus"){e.internal_terminalCursorFocus=d,i=!0;continue}if(o==="internal_terminalCursorPosition"){e.internal_terminalCursorPosition=d,i=!0;continue}if(o==="cachedRender"){e.cachedRender=d,i=!0;continue}N(e,o,d),i=!0}}a&&e.yogaNode&&S(e.yogaNode,a,s.style??{}),i&&_(e)},createInstance(e,t,r,s){if(s.isInsideText&&e==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(s.isInsideText&&e==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const l=e==="ink-text"&&s.isInsideText?"ink-virtual-text":e,a=U(l);for(const[i,o]of Object.entries(t))if(i!=="children"){if(i==="style"){C(a,o),a.yogaNode&&S(a.yogaNode,o);continue}if(i==="internal_transform"){a.internal_transform=o;continue}if(i==="internal_cursor"){a.internal_cursor=o;continue}if(i==="internal_static"){T=r,a.internal_static=!0,r.isStaticDirty=!0,r.staticNode=a;continue}if(i==="sticky"){a.internal_sticky=o;continue}if(i==="internalStickyAlternate"){a.internal_stickyAlternate=o;continue}if(i==="opaque"){a.internal_opaque=o;continue}if(i==="scrollbar"){a.internal_scrollbar=o;continue}if(i==="internal_terminalCursorFocus"){a.internal_terminalCursorFocus=o;continue}if(i==="internal_terminalCursorPosition"){a.internal_terminalCursorPosition=o;continue}if(i==="internal_static"){a.internal_static=!0;continue}if(i==="cachedRender"){a.cachedRender=o;continue}N(a,i,o)}return a},createTextInstance(e,t,r){if(!r.isInsideText)throw new Error(`Text string "${e}" must be rendered inside <Text> component`);return H(e)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(e,t){const r=e.isInsideText,s=t==="ink-text"||t==="ink-virtual-text";return r===s?e:{isInsideText:s}},getCurrentUpdatePriority:c(()=>m,"getCurrentUpdatePriority"),getInstanceFromNode:c(()=>null,"getInstanceFromNode"),getInstanceFromScope:c(()=>null,"getInstanceFromScope"),getPublicInstance:c(e=>e,"getPublicInstance"),getRootHostContext:c(()=>({isInsideText:!1}),"getRootHostContext"),hideInstance(e){e.internal_hidden=!0,e.yogaNode?.setDisplay(n.DISPLAY_NONE),_(e)},hideTextInstance(e){E(e,"")},HostTransitionContext:F(null),insertBefore:y,insertInContainerBefore:y,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:B,preloadInstance(){return!0},prepareForCommit:c(()=>null,"prepareForCommit"),preparePortalMount:c(()=>null,"preparePortalMount"),prepareScopeUpdate(){},removeChild(e,t){I(e,t),h(t)},removeChildFromContainer(e,t){I(e,t),h(t)},rendererPackageName:f.name,rendererVersion:f.version,requestPostPaintCallback(){},resetAfterCommit(e){if(typeof e.onComputeLayout=="function"&&e.onComputeLayout(),M(e),e.staticNode!==e.previousStaticNode&&(e.previousStaticNode=e.staticNode,typeof e.onStaticChange=="function"&&e.onStaticChange()),e.isStaticDirty){e.isStaticDirty=!1,typeof e.onImmediateRender=="function"&&e.onImmediateRender();return}typeof e.onRender=="function"&&e.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return m!==L?m:v},scheduleCallback:k,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){m=e},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:c(()=>!1,"shouldSetTextContent"),shouldYield:w,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(e){e.internal_hidden=!1,e.yogaNode?.setDisplay(n.DISPLAY_FLEX),_(e)},unhideTextInstance(e,t){E(e,t)},waitForCommitToBeReady(){return null}});export{de as L,S as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var c=(e,t)=>y(e,"name",{value:t,configurable:!0});import{createContext as b}from"react";import T from"react-reconciler";import{NoEventPriority as C,DefaultEventPriority as I,DiscreteEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as k,unstable_scheduleCallback as x,unstable_now as S,unstable_cancelCallback as E}from"scheduler";import{LayoutNode as f}from"./LayoutNode-B8zej4dm.js";import{applyStyles as h,resolveColor as g}from"./NAMED_COLORS-B9fJsYdg.js";import{a as N}from"./text-width-BU2eeTWn.js";var A=Object.defineProperty,n=c((e,t)=>A(e,"name",{value:t,configurable:!0}),"o");let m=null;function _(e){m=e}c(_,"setOnAfterCommit");n(_,"setOnAfterCommit");let u=C;function p(e){const t=g(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=g(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let r;return e.styles===void 0?(r=0,e.bold&&(r|=1),(e.dim||e.dimColor)&&(r|=2),e.italic&&(r|=4),e.underline&&(r|=8),e.blink&&(r|=16),e.inverse&&(r|=32),e.hidden&&(r|=64),e.strikethrough&&(r|=128)):r=e.styles,{bg:o,fg:t,styles:r}}c(p,"m");n(p,"resolveNodeColors");const U={afterActiveInstanceBlur:n(()=>{},"afterActiveInstanceBlur"),appendChild(e,t){e.insertChild(t,e.children.length)},appendChildToContainer(e,t){e.insertChild(t,e.children.length)},appendInitialChild(e,t){e.insertChild(t,e.children.length)},beforeActiveInstanceBlur:n(()=>{},"beforeActiveInstanceBlur"),cancelCallback:E,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,r,a){h(e.yogaNode,r);const{bg:i,fg:s,styles:d}=p(r);e.fg=s,e.bg=i,e.styles=d,e._style=r,e.transform=typeof r.transform=="function"?r.transform:void 0},createInstance(e,t,o,r,a){const i=new f,s={...t};s.flexDirection===void 0&&(s.flexDirection="row"),s.flexShrink===void 0&&(s.flexShrink=1),h(i.yogaNode,s);const{bg:d,fg:l,styles:v}=p(t);return i.fg=l,i.bg=d,i.styles=v,i._style=t,typeof t.transform=="function"&&(i.transform=t.transform),i},createTextInstance(e,t,o,r){const a=new f;return a.text=e,a.yogaNode.setWidth(N(e)),a.yogaNode.setHeight(1),a},detachDeletedInstance:n(e=>{e.destroy()},"detachDeletedInstance"),finalizeInitialChildren(e,t,o,r,a){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:n(()=>P,"getCurrentEventPriority"),getCurrentUpdatePriority:n(()=>u,"getCurrentUpdatePriority"),getInstanceFromNode:n(()=>null,"getInstanceFromNode"),getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:b(null),insertBefore(e,t,o){t.parent&&t.remove();const r=e.children.indexOf(o);e.insertChild(t,r)},isPrimaryRenderer:!0,maySuspendCommit:n(()=>!0,"maySuspendCommit"),noTimeout:-1,NotPendingTransition:void 0,now:S,preloadInstance:n(()=>!0,"preloadInstance"),prepareForCommit(e){return null},preparePortalMount:n(()=>{},"preparePortalMount"),prepareScopeUpdate:n(()=>{},"prepareScopeUpdate"),prepareUpdate(e,t,o,r,a,i){const s=Object.keys(o).filter(l=>l!=="children"),d=Object.keys(r).filter(l=>l!=="children");if(s.length!==d.length)return!0;for(const l of d)if(o[l]!==r[l])return!0;return null},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:n(()=>{},"requestPostPaintCallback"),resetAfterCommit(e){typeof m=="function"&&m()},resolveEventTimeStamp:n(()=>-1.1,"resolveEventTimeStamp"),resolveEventType:n(()=>null,"resolveEventType"),resolveUpdatePriority(){return u!==C?u:I},scheduleCallback:x,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){u=e},shouldAttemptEagerTransition:n(()=>!1,"shouldAttemptEagerTransition"),shouldSetTextContent(e,t){return!1},shouldYield:k,startSuspendingCommit:n(()=>{},"startSuspendingCommit"),supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:n(()=>{},"suspendInstance"),trackSchedulerEvent:n(()=>{},"trackSchedulerEvent"),unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:n(()=>null,"waitForCommitToBeReady"),warnsIfNotActing:!0},j=T(U);export{j as T,_ as s};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var ke=Object.defineProperty;var x=(e,t)=>ke(e,"name",{value:t,configurable:!0});import{createRequire as De}from"node:module";import{jsxs as W,jsx as T}from"react/jsx-runtime";import{setMode as se,BracketedPasteMode as oe,resetMode as ne,cursorShow as ht,setCursorStyle as Me,cursorUp as Pt,cursorTo as kt,cursorDown as Ae,cursorHide as Q,eraseLines as V,cursorNextLine as We,eraseLineEnd as _e,createDecMode as He,ALT_SCREEN_ON as Ue,clearScreenAndHomeCursor as Ke,ALT_SCREEN_OFF as je}from"@visulima/ansi";import{wordWrap as Fe}from"@visulima/string";import ue from"is-in-ci";import qe from"patch-console";import{ConcurrentRoot as Ye,LegacyRoot as ze}from"react-reconciler/constants.js";import{onExit as Ge}from"signal-exit";import K from"yoga-layout";import{a as Ve}from"./accessibility-context-DDyHTwmA.js";import{PureComponent as Xe,useState as vt,useRef as _,useCallback as y,useEffect as Rt,useMemo as z}from"react";import{e as Je}from"./animation-context-DW3p-vpk.js";import{t as Ze}from"./app-context-BVpKlG1z.js";import{o as tr}from"./cursor-context-CFviBqPX.js";import{parseStacktrace as ir}from"@visulima/error/stacktrace";import sr from"code-excerpt";import{Box as U}from"../components/box.js";import{Text as H}from"../components/text.js";import{o as or}from"./focus-context-CsT69klR.js";import{t as nr}from"./stderr-context-BzEaUICS.js";import{e as ur}from"./stdin-context-BTaaFagk.js";import{t as ar}from"./stdout-context-BnblEPez.js";import{A as lr,B as dr,r as cr,R as hr}from"./renderer-DG986Pcr.js";import{c as fr,e as pr}from"./dom-BG-LS10p.js";import{resolveFlags as mr}from"./kittyFlags-C3rZLbcK.js";import{a as gr}from"./measure-text-DDjHT1jD.js";import{L as B,u as vr}from"./reconciler-CUbhOvcr.js";import{measureAndExtractObservers as br}from"./ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as wr}from"./getScrollHeight-ClEOyLHH.js";import{g as tt}from"./utils-CoviI5Vm.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
const $e=De(import.meta.url),it=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ct=x(e=>{if(typeof it<"u"&&it.versions&&it.versions.node){const[t,r]=it.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return it.getBuiltinModule(e)}return $e(e)},"__cjs_getBuiltinModule"),M=it,{cwd:Le}=M,{Stream:Ie}=ct("node:stream"),{Buffer:Vt}=ct("node:buffer"),{Console:Be}=ct("node:console"),{EventEmitter:Qe}=ct("node:events"),{existsSync:er,readFileSync:rr}=ct("node:fs");var yr=Object.defineProperty,L=x((e,t)=>yr(e,"name",{value:t,configurable:!0}),"i$2");const ae="\x1B[200~",Qt="\x1B[201~",Cr=L(e=>e>=48&&e<=63,"isCsiParameterByte"),Tr=L(e=>e>=32&&e<=47,"isCsiIntermediateByte"),le=L(e=>e>=64&&e<=126,"isCsiFinalByte"),Rr=L((e,t,r)=>{const i=t+r+1;let o=i;for(;o<e.length;o++){const a=e.codePointAt(o);if(a===void 0)return"pending";if(!(Cr(a)||Tr(a))&&!(a===91&&o===i))return le(a)?{nextIndex:o+1,sequence:e.slice(t,o+1)}:void 0}return"pending"},"parseCsiSequence"),xr=L((e,t,r)=>{const i=t+r+2;if(i>e.length)return"pending";const o=e.codePointAt(i-1);if(!(o===void 0||!le(o)))return{nextIndex:i,sequence:e.slice(t,i)}},"parseSs3Sequence"),Xt=L((e,t,r)=>{const i=e[t+r];if(i===void 0)return"pending";if(i==="[")return Rr(e,t,r);if(i==="O")return xr(e,t,r)},"parseControlSequence"),Sr=L((e,t)=>{const r=e.codePointAt(t+1),i=r!==void 0&&r>65535?2:1,o=t+1+i;return{nextIndex:o,sequence:e.slice(t,o)}},"parseEscapedCodePoint"),Pr=L((e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const i=Xt(e,t,2);return i==="pending"?"pending":i||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const r=Xt(e,t,1);return r==="pending"?"pending":r||Sr(e,t)},"parseEscapeSequence"),Jt=L((e,t)=>{let r=0;for(let i=0;i<e.length;i++){const o=e[i];(o===""||o==="\b")&&(i>r&&t.push(e.slice(r,i)),t.push(o),r=i+1)}r<e.length&&t.push(e.slice(r))},"splitDeleteAndBackspace"),Or=L(e=>{const t=[];let r=0;const i=L(o=>({events:t,pending:e.slice(o)}),"pendingFrom");for(;r<e.length;){const o=e.indexOf("\x1B",r);if(o===-1)return Jt(e.slice(r),t),{events:t,pending:""};o>r&&Jt(e.slice(r,o),t);const a=Pr(e,o);if(a==="pending")return i(o);if(a.sequence===ae){const l=a.nextIndex,n=e.indexOf(Qt,l);if(n===-1)return i(o);t.push({paste:e.slice(l,n)}),r=n+Qt.length;continue}t.push(a.sequence),r=a.nextIndex}return{events:t,pending:""}},"parseKeypresses"),Er=L(()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(ae)&&e!=="\x1B[200"},push(t){const r=Or(e+t);return e=r.pending,r.events},reset(){e=""}}},"createInputParser");var Nr=Object.defineProperty,de=x((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"x");const xt=de(e=>{if(!e)return e;const t=Le();return e.replace(`file://${t}/`,"").replace(`${t}/`,"")},"cleanupPath");function ce({error:e}){const t=ir(e),r=new Map,i=t.map(s=>{const u=!s.methodName&&!s.file?`raw:${s.raw}`:`${xt(s.file)??""}:${s.line}:${s.column}:${s.methodName??""}`,m=r.get(u)??0;return r.set(u,m+1),{key:`${u}#${m}`,trace:s}}),o=t[0],a=xt(o?.file);let l,n=0;if(a&&o?.line&&er(a)){const s=rr(a,"utf8");if(l=sr(s,o.line),l)for(const{line:u}of l)n=Math.max(n,String(u).length)}return W(U,{flexDirection:"column",padding:1,children:[W(U,{children:[W(H,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),W(H,{children:[" ",e.message]})]}),o&&a?T(U,{marginTop:1,children:W(H,{dimColor:!0,children:[a,":",o.line,":",o.column]})}):null,o&&l?T(U,{flexDirection:"column",marginTop:1,children:l.map(({line:s,value:u})=>W(U,{children:[T(U,{width:n+1,children:W(H,{"aria-label":s===o.line?`Line ${s}, error`:`Line ${s}`,backgroundColor:s===o.line?"red":void 0,color:s===o.line?"white":void 0,dimColor:s!==o.line,children:[String(s).padStart(n," "),":"]})}),T(H,{backgroundColor:s===o.line?"red":void 0,color:s===o.line?"white":void 0,children:` ${u}`})]},`excerpt-${s}`))}):null,t.length>0?T(U,{flexDirection:"column",marginTop:1,children:i.map(({key:s,trace:u})=>{const m=xt(u.file)??"";return!u.methodName&&!u.file?W(U,{children:[T(H,{dimColor:!0,children:"- "}),T(H,{bold:!0,dimColor:!0,children:u.raw})]},s):W(U,{children:[T(H,{dimColor:!0,children:"- "}),T(H,{bold:!0,dimColor:!0,children:u.methodName??"<anonymous>"}),W(H,{"aria-label":`at ${m} line ${u.line} column ${u.column}`,color:"gray",dimColor:!0,children:[" ","(",m,":",u.line,":",u.column,")"]})]},s)})}):null]})}x(ce,"b");de(ce,"ErrorOverview");var kr=Object.defineProperty,Dr=x((e,t)=>kr(e,"name",{value:t,configurable:!0}),"o$1");let $r=class extends Xe{static{x(this,"i")}static{Dr(this,"ErrorBoundary")}static displayName="InternalErrorBoundary";static getDerivedStateFromError(t){return{error:t}}state={error:void 0};componentDidCatch(t){this.props.onError(t)}render(){return this.state.error?T(ce,{error:this.state.error}):this.props.children}};var Lr=Object.defineProperty,Zt=x((e,t)=>Lr(e,"name",{value:t,configurable:!0}),"J");const Ir=" ",Br="\x1B[Z",Mr="\x1B",Ar=se(oe),te=ne(oe),he=Zt(({children:e,exitOnCtrlC:t,interactive:r,onExit:i,onWaitUntilRenderFlush:o,renderThrottleMs:a,setCursorPosition:l,stderr:n,stdin:s,stdout:u,writeToStderr:m,writeToStdout:C})=>{const[g,c]=vt(!0),[h,b]=vt(void 0),[,w]=vt([]),D=_(0),S=_(new Map),I=_(void 0),$=_(0),A=_(!1),N=_(0),[E]=vt(()=>{const d=new Qe;return d.setMaxListeners(1/0),d}),Y=_(void 0),O=_(void 0);O.current??=Er();const j=_(void 0),$t=_(!1),ye=20,X=y(()=>{j.current&&(clearTimeout(j.current),j.current=void 0)},[]),J=y(()=>{I.current&&(clearTimeout(I.current),I.current=void 0)},[]),ft=y(()=>{if(J(),S.current.size===0)return;let d=Number.POSITIVE_INFINITY;for(const f of S.current.values())d=Math.min(d,f.nextDueTime);const p=Math.max(0,d-performance.now());I.current=setTimeout(()=>{I.current=void 0;const f=performance.now(),R=[...S.current.values()];for(const k of R){if(f<k.nextDueTime)continue;k.callback(f);const Ee=f-k.startTime,Ne=Math.floor(Ee/k.interval)+1;k.nextDueTime=k.startTime+Ne*k.interval}ft()},p)},[J]),Lt=y((d,p)=>{const f=performance.now();return S.current.set(d,{callback:d,interval:p,nextDueTime:f+p,startTime:f}),ft(),{startTime:f,unsubscribe(){if(S.current.delete(d),S.current.size===0){J();return}ft()}}},[J,ft]);Rt(()=>()=>{J()},[J]);const F=s.isTTY,It=y(()=>{Y.current&&(s.removeListener("readable",Y.current),Y.current=void 0)},[s]),pt=y(()=>{O.current?.reset(),X(),It()},[X,It]),Z=y(()=>{A.current=!1,s.setRawMode(!1),s.unref(),$.current=0,pt()},[s,pt]),ut=y(d=>{F&&($.current>0||A.current)&&Z(),i(d)},[F,Z,i]),Bt=y(d=>{if(d.includes("")&&t){ut();return}d===Mr&&g&&b(p=>{if(!p)return p})},[t,ut,g]),at=y(d=>{Bt(d),E.emit("input",d)},[Bt,E]),Mt=y(()=>{X(),j.current=setTimeout(()=>{j.current=void 0;const d=O.current.flushPendingEscape();d&&at(d)},ye)},[X,at]),Tt=y(()=>{X();let d;for(;(d=s.read())!==null;){const p=O.current.push(d);for(const f of p)if(typeof f=="string")at(f);else{if(E.listenerCount("paste")===0){$t.current||($t.current=!0,m(`Warning: useInput() received bracketed paste because no usePaste() handler is active. This fallback is deprecated and will be removed in the next major version. Migrate paste handling to usePaste().
|
|
4
|
+
`)),at(f.paste);continue}E.emit("paste",f.paste)}}O.current.hasPendingEscape()&&Mt()},[s,at,X,Mt,m,E]),At=y(()=>{Y.current||(Y.current=Tt,s.addListener("readable",Tt))},[s,Tt]),Wt=y(d=>{if(!F)throw s===M.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
|
|
5
|
+
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
|
|
6
|
+
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(s.setEncoding("utf8"),d){if($.current===0){const p=A.current;A.current=!1,p||(s.ref(),s.setRawMode(!0)),At()}$.current++;return}$.current!==0&&--$.current===0&&(pt(),A.current=!0,queueMicrotask(()=>{A.current&&Z()}))},[F,s,At,pt,Z]),_t=y(d=>{if(u.isTTY){if(d){N.current===0&&u.write(Ar),N.current++;return}N.current!==0&&--N.current===0&&u.write(te)}},[u]),Ht=y((d,p)=>{const f=d.findIndex(R=>R.id===p);for(let R=f+1;R<d.length;R++){const k=d[R];if(k?.isActive)return k.id}},[]),Ut=y((d,p)=>{const f=d.findIndex(R=>R.id===p);for(let R=f-1;R>=0;R--){const k=d[R];if(k?.isActive)return k.id}},[]),mt=y(()=>{w(d=>(b(p=>{const f=d.find(R=>R.isActive)?.id;return Ht(d,p)??f}),d))},[Ht]),gt=y(()=>{w(d=>(b(p=>{const f=d.findLast(R=>R.isActive)?.id;return Ut(d,p)??f}),d))},[Ut]);Rt(()=>{const d=Zt(f=>{!g||D.current===0||(f===Ir&&mt(),f===Br&>())},"handleTabNavigation");E.on("input",d);const p=E;return()=>{p.off("input",d)}},[g,mt,gt,E]);const Kt=y(()=>{c(!0)},[]),jt=y(()=>{c(!1)},[]),Ft=y(d=>{w(p=>(p.some(f=>f?.id===d)&&b(d),p))},[]),qt=y((d,{autoFocus:p})=>{w(f=>(D.current=f.length+1,[...f,{id:d,isActive:!0}])),p&&b(f=>f||d)},[]),Yt=y(d=>{b(p=>{if(p!==d)return p}),w(p=>{const f=p.filter(R=>R.id!==d);return D.current=f.length,f})},[]),zt=y(d=>{w(p=>p.map(f=>f.id!==d?f:{id:d,isActive:!0}))},[]),Gt=y(d=>{b(p=>{if(p!==d)return p}),w(p=>p.map(f=>f.id!==d?f:{id:d,isActive:!1}))},[]);Rt(()=>()=>{const d=!u.destroyed&&!u.writableEnded;r&&d&&u.write(ht),F&&($.current>0||A.current)&&Z(),N.current>0&&(u.isTTY&&d&&u.write(te),N.current=0)},[u,F,Z,r]);const Ce=z(()=>({exit:ut,waitUntilRenderFlush:o}),[ut,o]),Te=z(()=>({internal_eventEmitter:E,internal_exitOnCtrlC:t,isRawModeSupported:F,setBracketedPasteMode:_t,setRawMode:Wt,stdin:s}),[s,Wt,_t,F,t,E]),Re=z(()=>({stdout:u,write:C}),[u,C]),xe=z(()=>({stderr:n,write:m}),[n,m]),Se=z(()=>({setCursorPosition:l}),[l]),Pe=z(()=>({activate:zt,activeId:h,add:qt,deactivate:Gt,disableFocus:jt,enableFocus:Kt,focus:Ft,focusNext:mt,focusPrevious:gt,remove:Yt}),[h,qt,Yt,zt,Gt,Kt,jt,mt,gt,Ft]),Oe=z(()=>({renderThrottleMs:a,subscribe:Lt}),[Lt,a]);return T(Ze.Provider,{value:Ce,children:T(ur.Provider,{value:Te,children:T(ar.Provider,{value:Re,children:T(nr.Provider,{value:xe,children:T(or.Provider,{value:Pe,children:T(Je.Provider,{value:Oe,children:T(tr.Provider,{value:Se,children:T($r,{onError:ut,children:e})})})})})})})})},"App");he.displayName="InternalApp";var Wr=Object.defineProperty,_r=x((e,t)=>Wr(e,"name",{value:t,configurable:!0}),"m$2");const Hr=_r((e,t,r)=>{if(r<=0||!e.yogaNode)return"";const{yogaNode:i}=e,o=i.getComputedBorder(K.EDGE_LEFT),a=i.getComputedBorder(K.EDGE_RIGHT),l=i.getComputedBorder(K.EDGE_TOP),n=i.getComputedPadding(K.EDGE_LEFT),s=i.getComputedPadding(K.EDGE_RIGHT),u=i.getComputedPadding(K.EDGE_TOP),m=Math.round(i.getComputedWidth()-o-a-n-s);if(m<=0)return"";const C=new lr({height:r,width:m}),g=-(e.internal_scrollState?.scrollLeft??0)-o-n,c=-t-l-u;for(const h of e.childNodes)dr(h,C,{absoluteOffsetX:g,absoluteOffsetY:c,offsetX:g,offsetY:c,skipStaticElements:!1});return C.get().output},"composeBackbufferSlice"),Ot=new WeakMap;var Ur=Object.defineProperty,nt=x((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"e");const Kr={bar:6,"blinking-bar":5,"blinking-block":1,"blinking-underline":3,block:2,default:0,underline:4},ee=nt(e=>Me(Kr[e]),"buildCursorShapeSequence"),wt=nt((e,t)=>e?.x!==t?.x||e?.y!==t?.y,"cursorPositionChanged"),ot=nt((e,t)=>{if(!t)return"";const r=e-t.y;return(r>0?Pt(r):"")+kt(t.x)+ht},"buildCursorSuffix"),fe=nt((e,t)=>{if(!t)return"";const r=e-1-t.y;return(r>0?Ae(r):"")+kt(0)},"buildReturnToBottom"),pe=nt(e=>{const t=e.cursorWasShown?Q:"",r=fe(e.previousLineCount,e.previousCursorPosition),i=ot(e.visibleLineCount,e.cursorPosition);return t+r+i},"buildCursorOnlySequence"),yt=nt((e,t,r)=>e?Q+fe(t,r):"","buildReturnToBottomPrefix");var jr=Object.defineProperty,P=x((e,t)=>jr(e,"name",{value:t,configurable:!0}),"l");const et=P(e=>e??"default","normalizeShape"),me=P(()=>{let e,t;return{consumeDelta:P(()=>{if(et(t)===et(e))return"";const r=et(t);return e=t,ee(r)},"consumeDelta"),consumeRestoreOnDone:P(()=>{const r=et(e)!=="default";return e=void 0,t=void 0,r?ee("default"):""},"consumeRestoreOnDone"),isDirty:P(()=>et(t)!==et(e),"isDirty"),setPending:P(r=>{t=r},"setPending")}},"createCursorShapeTracker"),dt=P((e,t)=>t.endsWith(`
|
|
7
|
+
`)?e.length-1:e.length,"visibleLineCount"),ge=P(e=>e.rows||1/0,"getViewportRows"),Ct=P((e,t)=>Math.min(e,ge(t)),"clampToViewport"),Fr=P((e,{showCursor:t=!1}={})=>{let r=0,i="",o=!1,a,l=!1,n,s=!1;const u=me(),m=P(()=>l?a:void 0,"getActiveCursor"),C=P((c,h)=>{const b=wt(h,n);return c!==i||b||u.isDirty()},"hasChanges"),g=P(c=>{!t&&!o&&(e.write(Q),o=!0);const h=m();l=!1;const b=wt(h,n);if(!C(c,h))return!1;const w=u.consumeDelta(),D=c.split(`
|
|
8
|
+
`),S=dt(D,c),I=ot(S,h);if(c===i&&b)e.write(w+pe({cursorPosition:h,cursorWasShown:s,previousCursorPosition:n,previousLineCount:r,visibleLineCount:S}));else if(c===i&&w!=="")e.write(w);else{i=c;const $=yt(s,r,n);e.write(w+$+V(Ct(r,e))+c+I),r=D.length}return n=h?{...h}:void 0,s=h!==void 0,!0},"render");return g.clear=()=>{const c=yt(s,r,n);e.write(c+V(Ct(r,e))),i="",r=0,n=void 0,s=!1},g.done=()=>{i="",r=0,n=void 0,s=!1;const c=u.consumeRestoreOnDone();c!==""&&e.write(c),t||(e.write(ht),o=!1)},g.reset=()=>{i="",r=0,n=void 0,s=!1},g.sync=c=>{const h=l?a:void 0;l=!1;const b=c.split(`
|
|
9
|
+
`);i=c,r=b.length;const w=u.consumeDelta();w!==""&&e.write(w),!h&&s&&e.write(Q),h&&e.write(ot(dt(b,c),h)),n=h?{...h}:void 0,s=h!==void 0},g.setCursorPosition=c=>{a=c,l=!0},g.setCursorShape=u.setPending,g.isCursorDirty=()=>l||u.isDirty(),g.willRender=c=>C(c,m()),g},"createStandard"),qr=P((e,{showCursor:t=!1}={})=>{let r=[],i="",o=!1,a,l=!1,n,s=!1;const u=me(),m=P(()=>l?a:void 0,"getActiveCursor"),C=P((c,h)=>{const b=wt(h,n);return c!==i||b||u.isDirty()},"hasChanges"),g=P(c=>{!t&&!o&&(e.write(Q),o=!0);const h=m();l=!1;const b=wt(h,n);if(!C(c,h))return!1;const w=u.consumeDelta(),D=c.split(`
|
|
10
|
+
`),S=dt(D,c),I=dt(r,i);if(c===i&&b)return e.write(w+pe({cursorPosition:h,cursorWasShown:s,previousCursorPosition:n,previousLineCount:r.length,visibleLineCount:S})),n=h?{...h}:void 0,s=h!==void 0,!0;if(c===i&&w!=="")return e.write(w),!0;const $=yt(s,r.length,n);if(c===`
|
|
11
|
+
`||i.length===0){const O=ot(S,h);return e.write(w+$+V(Ct(r.length,e))+c+O),s=h!==void 0,n=h?{...h}:void 0,i=c,r=D,!0}const A=c.endsWith(`
|
|
12
|
+
`),N=[w,$],E=ge(e);if(S<I){const O=i.endsWith(`
|
|
13
|
+
`)?1:0;N.push(V(Math.min(I-S+O,E)),Pt(Math.min(S,E-1)))}else N.push(Pt(Math.min(I-1,E-1)));for(let O=0;O<S;O++){const j=O===S-1;if(D[O]===r[O]){(!j||A)&&N.push(We());continue}N.push(kt(0)+D[O]+_e+(j&&!A?"":`
|
|
14
|
+
`))}const Y=ot(S,h);return N.push(Y),e.write(N.join("")),s=h!==void 0,n=h?{...h}:void 0,i=c,r=D,!0},"render");return g.clear=()=>{const c=yt(s,r.length,n);e.write(c+V(Ct(r.length,e))),i="",r=[],n=void 0,s=!1},g.done=()=>{i="",r=[],n=void 0,s=!1;const c=u.consumeRestoreOnDone();c!==""&&e.write(c),t||(e.write(ht),o=!1)},g.reset=()=>{i="",r=[],n=void 0,s=!1},g.sync=c=>{const h=l?a:void 0;l=!1;const b=c.split(`
|
|
15
|
+
`);i=c,r=b;const w=u.consumeDelta();w!==""&&e.write(w),!h&&s&&e.write(Q),h&&e.write(ot(dt(b,c),h)),n=h?{...h}:void 0,s=h!==void 0},g.setCursorPosition=c=>{a=c,l=!0},g.setCursorShape=u.setPending,g.isCursorDirty=()=>l||u.isDirty(),g.willRender=c=>C(c,m()),g},"createIncremental"),Yr=P((e,{incremental:t=!1,showCursor:r=!1}={})=>t?qr(e,{showCursor:r}):Fr(e,{showCursor:r}),"create"),zr={create:Yr};var Gr=Object.defineProperty,Vr=x((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"t");const ve=He(2026),G=se(ve),q=ne(ve);function be(e,t){return"isTTY"in e&&e.isTTY&&(t??!ue)}x(be,"shouldSynchronize");Vr(be,"shouldSynchronize");var Qr=Object.defineProperty,Et=x((e,t)=>Qr(e,"name",{value:t,configurable:!0}),"o");let rt;const Xr=Et(()=>{if(rt!==!1){if(rt!==void 0)return rt;try{return rt=require("../../index.js").Renderer,rt}catch{rt=!1;return}}},"getRendererClass"),Jr=Et(e=>{const t=Xr();if(!t)return;let r,i=0,o=0;const a=Et((l,n)=>{(!r||i!==l||o!==n)&&(r?r.resize(l,n):r=new t(l,n),i=l,o=n)},"ensureRenderer");return{clear(){if(r){const l=new Uint32Array(i*o*2),n=65535;for(let s=0;s<l.length;s+=2)l[s]=32,l[s+1]=n;r.render(l)}},destroy(){r=void 0},render(l,n,s){if(a(n,s),!!r){e.isTTY&&r.writeRaw(G);try{r.render(l)}finally{e.isTTY&&r.writeRaw(q)}}},resize(l,n){a(l,n)}}},"createNative");var Zr=Object.defineProperty,st=x((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"n$1");function Nt(e,t=0,r={}){const i=r.leading??!0,o=r.trailing??!0;let a,l,n,s;const u=st(()=>{if(l===void 0)return;const h=l;l=void 0,s=e(...h)},"invoke"),m=st(()=>{a!==void 0&&(clearTimeout(a),a=void 0)},"clearTimer"),C=st(()=>{a=void 0,o&&u(),l=void 0,n=void 0},"onTimerEnd"),g=st(()=>{m(),a=setTimeout(C,t)},"scheduleTimer"),c=st(function(...h){const b=Date.now();if(n??=b,b-n>=t)return l=h,u(),n=b,g(),s;l=h;const w=a===void 0;return g(),i&&w&&u(),s},"throttled");return c.cancel=()=>{m(),l=void 0,n=void 0},c.flush=()=>(m(),u(),n=void 0,s),c}x(Nt,"throttle");st(Nt,"throttle");var ti=Object.defineProperty,v=x((e,t)=>ti(e,"name",{value:t,configurable:!0}),"n");console.Console||(console.Console=Be);const lt=v(()=>{},"noop"),re=v(async()=>new Promise(e=>{setImmediate(e)}),"yieldImmediate"),ei=27,ri=91,ii=63,si=117,oi=48,ni=57,ui=v(e=>e>=oi&&e<=ni,"isDigitByte"),we=v((e,t)=>{if(e[t]!==ei||e[t+1]!==ri||e[t+2]!==ii)return;let r=t+3;const i=r;for(;r<e.length&&ui(e[r]);)r++;if(r!==i){if(r===e.length)return{state:"partial"};if(e[r]===si)return{endIndex:r,state:"complete"}}},"matchKittyQueryResponse"),ai=v(e=>{for(let t=0;t<e.length;t++)if(we(e,t)?.state==="complete")return!0;return!1},"hasCompleteKittyQueryResponse"),li=v(e=>{const t=[];let r=0;for(;r<e.length;){const i=we(e,r);if(i?.state==="complete"){r=i.endIndex+1;continue}if(i?.state==="partial")break;t.push(e[r]),r++}return t},"stripKittyQueryResponsesAndTrailingPartial"),di=v(({isTty:e,isUnmounting:t,nextOutputHeight:r,previousOutputHeight:i,viewportRows:o})=>{if(!e)return!1;const a=i>0,l=i>=o,n=i>o,s=r>o,u=l&&r<o;return n||s&&a||u||t&&l},"shouldClearTerminalForFrame"),St=v(e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]","isErrorInput"),ie=v(e=>{const t=!e.destroyed&&!e.writableEnded&&(e.writable??!0),r=e._writableState!==void 0||e.writableLength!==void 0;return{canWriteToStdout:t,hasWritableState:r}},"getWritableStreamState"),bt=v((e,t)=>{if(!e||typeof e.flush!="function")return;const r=e;t?r.flush():typeof r.cancel=="function"&&r.cancel()},"settleThrottle");class ci{static{x(this,"yt")}static{v(this,"Ink")}isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;backbufferNode;backbufferMultiWarned=!1;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=fr("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??M.env.INK_SCREEN_READER==="true",this.interactive=this.resolveInteractiveOption(t.interactive),this.alternateScreen=!1;const r=t.debug||this.isScreenReaderEnabled,i=t.maxFps??30,o=i>0?Math.max(1,Math.ceil(1e3/i)):0;this.renderThrottleMs=r?0:o;const a=r?this.onRender:(()=>{const n=Nt(this.onRender,o,{leading:!0,trailing:!0});return this.throttledOnRender=n,()=>{this.hasPendingThrottledRender=!0,n()}})();if(r&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let n=!1;const s=v(()=>{n||(n=!0,queueMicrotask(()=>{n=!1,this.onRender()}))},"deferredRender");this.rootNode.onRender=s,this.rootNode.onImmediateRender=s}else this.rootNode.onRender=a,this.rootNode.onImmediateRender=this.onRender;this.rootNode.onStaticChange=this.handleStaticChange,this.log=zr.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=Jr(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=r?this.log:Nt(n=>{const s=this.log.willRender(n),u=this.shouldSync();u&&s&&this.options.stdout.write(G),this.log(n),u&&s&&this.options.stdout.write(q)},void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.isUnmounting=!1,this.isConcurrent=t.concurrent??!1,this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.lastTerminalWidth=tt(this.options.stdout).columns,this.fullStaticOutput="";const l=t.concurrent?Ye:ze;this.container=B.createContainer(this.rootNode,l,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=Ge(this.unmount,{alwaysLast:!1}),this.setAlternateScreen(!!t.alternateScreen),t.patchConsole&&this.patchConsole(),this.interactive&&(t.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{t.stdout.off("resize",this.resized)}),this.initImmediateKittyKeyboard(),M.env.DEV==="true"&&B.injectIntoDevTools(),this.exitPromise=new Promise((n,s)=>{this.resolveExitPromise=n,this.rejectExitPromise=s}),this.exitPromise.catch(lt)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=v(()=>{const t=tt(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),gr(),this.calculateLayout(),pr(this.rootNode),this.onRender(),this.lastTerminalWidth=t},"resized");resolveExitPromise=v(()=>{},"resolveExitPromise");rejectExitPromise=v(()=>{},"rejectExitPromise");unsubscribeExit=v(()=>{},"unsubscribeExit");handleAppExit=v(t=>{if(!(this.isUnmounted||this.isUnmounting)){if(St(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}},"handleAppExit");getActiveCursorPosition=v(()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition,"getActiveCursorPosition");setCursorPosition=v(t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())},"setCursorPosition");restoreLastOutput=v(()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
|
|
16
|
+
`))},"restoreLastOutput");calculateLayout=v(()=>{const t=v(i=>{const o=new Map;this.calculateScrollAndTriggerObservers(i,o);for(const[a,l]of o)a.internalTrigger(l)},"flushLayoutObservers");this.backbufferNode=void 0,this.prepareYogaTree(this.rootNode,t);const r=tt(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(r),this.rootNode.yogaNode.calculateLayout(void 0,void 0,K.DIRECTION_LTR),t(this.rootNode)},"calculateLayout");calculateScrollAndTriggerObservers(t,r){if(t.nodeName==="ink-box"){const{style:i}=t,o=i.overflow??"visible",a=i.overflowX??o,l=i.overflowY??o;a==="scroll"||l==="scroll"?(wr(t),i.overflowToBackbuffer&&(this.backbufferNode&&this.backbufferNode!==t&&!this.backbufferMultiWarned&&(this.backbufferMultiWarned=!0,console.warn("[@visulima/tui] Multiple scrollable regions have `overflowToBackbuffer` enabled; only one is supported. The last one in render order wins.")),this.backbufferNode=t)):t.internal_scrollState&&delete t.internal_scrollState}if(br(t,r),!t.internal_static)for(const i of t.childNodes)i.nodeName!=="#text"&&this.calculateScrollAndTriggerObservers(i,r)}recalculateLayout(){this.markAllTextNodesDirty(this.rootNode),this.calculateLayout(),this.onRender()}prepareYogaTree(t,r){if(t.isYogaTreeDetached&&!t.cachedRender&&t.yogaNode){for(t.yogaNode.setWidthAuto(),t.yogaNode.setHeightAuto(),vr(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let i=0;for(const o of t.childNodes){const a=o;o.nodeName!=="#text"&&a.yogaNode&&(t.yogaNode.insertChild(a.yogaNode,i),i++)}t.isYogaTreeDetached=!1,this.markAllTextNodesDirty(t)}for(const i of t.childNodes)i.nodeName!=="#text"&&this.prepareYogaTree(i,r);if(t.nodeName==="ink-static-render"&&!t.cachedRender){const i=tt(this.options.stdout).columns,{width:o}=t.style;t.yogaNode&&(t.yogaNode.setWidth(typeof o=="number"?o:i),t.yogaNode.calculateLayout(void 0,void 0,K.DIRECTION_LTR)),r(t),cr(t,{skipStaticElements:!1,trackSelection:this.options.trackSelection}),t.internal_onRendered?.()}}markAllTextNodesDirty(t){if(!t.cachedRender){t.nodeName==="ink-text"&&t.yogaNode&&t.yogaNode.markDirty();for(const r of t.childNodes)r.nodeName!=="#text"&&this.markAllTextNodesDirty(r)}}handleStaticChange=v(()=>{this.fullStaticOutput=""},"handleStaticChange");computeBackbufferOutput(){const t=this.backbufferNode;if(!t?.internal_scrollState||!this.interactive||!this.options.stdout.isTTY||this.alternateScreen||this.isScreenReaderEnabled||this.options.debug)return"";const r=Math.round(t.internal_scrollState.scrollTop),i=t.yogaNode?.getComputedPadding(K.EDGE_TOP)??0,o=Math.max(0,r-Math.round(i)),a=t.internal_maxPushedScrollTop??0,{maxScrollbackLength:l}=t.style,n=l===void 0?a:Math.max(a,o-Math.max(0,l)),s=o-n;if(s<=0)return"";const u=Hr(t,n,s);return u===""?"":(t.internal_maxPushedScrollTop=o,`${u}\x1B[0m
|
|
17
|
+
`)}onRender=v(()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=hr(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:r,cursorRequested:i,cursorShape:o,output:a,outputBuffer:l,outputHeight:n,outputWidth:s,staticOutput:u}=t;this.renderedCursorRequested=i,this.renderedCursorPosition=r,this.log.setCursorShape(i?o:void 0);const m=this.computeBackbufferOutput();if(this.useNativeRenderer&&this.nativeLog&&l&&s){u&&u!==`
|
|
18
|
+
`&&this.options.stdout.write(u),m&&this.options.stdout.write(m),this.nativeLog.render(l,s,n),this.lastOutputHeight=n;return}i&&this.log.setCursorPosition(this.getActiveCursorPosition());const C=u&&u!==`
|
|
19
|
+
`;if(this.options.debug){C&&(this.fullStaticOutput+=u),this.lastOutput=a,this.lastOutputToRender=a,this.lastOutputHeight=n,this.options.stdout.write(this.fullStaticOutput+a);return}if(!this.interactive){C&&this.options.stdout.write(u),this.lastOutput=a,this.lastOutputToRender=`${a}
|
|
20
|
+
`,this.lastOutputHeight=n;return}if(this.isScreenReaderEnabled){const g=this.shouldSync();if(g&&this.options.stdout.write(G),C){const b=this.lastOutputHeight>0?V(this.lastOutputHeight):"";this.options.stdout.write(b+u),this.lastOutputHeight=0}if(a===this.lastOutput&&!C){g&&this.options.stdout.write(q);return}const c=tt(this.options.stdout).columns,h=Fe(a,{trim:!1,width:c,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(C)this.options.stdout.write(h);else{const b=this.lastOutputHeight>0?V(this.lastOutputHeight):"";this.options.stdout.write(b+h)}this.lastOutput=a,this.lastOutputToRender=h,this.lastOutputHeight=h===""?0:h.split(`
|
|
21
|
+
`).length,g&&this.options.stdout.write(q);return}C&&(this.fullStaticOutput+=u),this.renderInteractiveFrame(a,n,C?u:"",m)},"onRender");accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const r=T(Ve.Provider,{value:this.accessibilityContextValue,children:T(he,{exitOnCtrlC:this.options.exitOnCtrlC,interactive:this.interactive,onExit:this.handleAppExit,onWaitUntilRenderFlush:this.waitUntilRenderFlush,renderThrottleMs:this.renderThrottleMs,setCursorPosition:this.setCursorPosition,stderr:this.options.stderr,stdin:this.options.stdin,stdout:this.options.stdout,writeToStderr:this.writeToStderr,writeToStdout:this.writeToStdout,children:t})});this.options.concurrent?B.updateContainer(r,this.container,null,lt):(B.updateContainerSync(r,this.container,null,lt),B.flushSyncWork())}writeToStdout=v(t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stdout.write(t+this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stdout.write(t);return}const r=this.shouldSync();r&&this.options.stdout.write(G),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),r&&this.options.stdout.write(q)},"writeToStdout");writeToStderr=v(t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stderr.write(t),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stderr.write(t);return}const r=this.shouldSync();r&&this.options.stdout.write(G),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),r&&this.options.stdout.write(q)},"writeToStderr");unmount=v(t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(M.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const r=this.options.stdout,{canWriteToStdout:i,hasWritableState:o}=ie(r);bt(this.throttledOnRender,i),i&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),bt(this.throttledLog,i),typeof this.restoreConsole=="function"&&this.restoreConsole();const a=v(()=>{typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),this.cancelKittyDetection&&this.cancelKittyDetection(),i&&(this.kittyProtocolEnabled&&this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.alternateScreen?(this.log.clear(),this.log.done(),this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.fullStaticOutput="",this.writeBestEffort(this.options.stdout,je),this.writeBestEffort(this.options.stdout,ht),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
|
|
22
|
+
`:`${this.lastOutput}
|
|
23
|
+
`)),this.kittyProtocolEnabled=!1,Ot.delete(this.options.stdout);const{exitResult:n}=this,s=v(()=>{St(t)?this.rejectExitPromise(t):this.resolveExitPromise(n)},"resolveOrReject");t!==void 0&&!St(t)?s():i&&o?this.options.stdout.write("",s):setImmediate(s)},"finishUnmount"),l=B;this.options.concurrent?(B.updateContainerSync(null,this.container,null,lt),B.flushSyncWork(),l.flushPassiveEffects?.(),a()):(B.updateContainerSync(null,this.container,null,lt),B.flushSyncWork(),a())},"unmount");async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},M.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await re(),this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(this.isConcurrent&&this.hasPendingConcurrentWork()&&(await Promise.race([this.awaitNextRender(),this.awaitExit()]),this.isUnmounted||this.isUnmounting)){this.nextRenderCommit=void 0,await this.awaitExit();return}B.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:r,hasWritableState:i}=ie(t);if(bt(this.throttledOnRender,r),bt(this.throttledLog,r),r&&i){await new Promise(o=>{this.options.stdout.write("",()=>{o()})});return}await re()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
|
|
24
|
+
`))}patchConsole(){this.options.debug||(this.restoreConsole=qe((t,r)=>{t==="stdout"&&this.writeToStdout(r),t==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}setAlternateScreen(t){this.alternateScreen=this.resolveAlternateScreenOption(t,this.interactive),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,Ue),this.writeBestEffort(this.options.stdout,Q))}resolveInteractiveOption(t){return t??(!ue&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,r){return!!t&&r&&!!this.options.stdout.isTTY}shouldSync(){return be(this.options.stdout,this.interactive)}writeBestEffort(t,r){try{t.write(r)}catch{}}async awaitExit(){try{await this.exitPromise}catch{}}hasPendingConcurrentWork(){const t=this.container;return(t.pendingLanes??0)!==0&&t.callbackNode!==void 0&&t.callbackNode!==null}async awaitNextRender(){if(!this.nextRenderCommit){let t;const r=new Promise(i=>{t=i});this.nextRenderCommit={promise:r,resolve:t}}return this.nextRenderCommit.promise}renderInteractiveFrame(t,r,i,o=""){const a=i+o,l=a!=="",n=this.options.stdout.isTTY,s=n?tt(this.options.stdout).rows:24,u=n&&r>=s?t:`${t}
|
|
25
|
+
`;if(di({isTty:n,isUnmounting:this.isUnmounting,nextOutputHeight:r,previousOutputHeight:this.lastOutputHeight,viewportRows:s})){if(this.options.incrementalRendering){l&&(this.log.clear(),this.options.stdout.write(a)),(t!==this.lastOutput||this.log.isCursorDirty()||l)&&this.throttledLog(u),this.lastOutput=t,this.lastOutputToRender=u,this.lastOutputHeight=r;return}const m=this.shouldSync();m&&this.options.stdout.write(G),this.options.stdout.write(Ke+this.fullStaticOutput+o+t),this.lastOutput=t,this.lastOutputToRender=u,this.lastOutputHeight=r,this.log.sync(u),m&&this.options.stdout.write(q);return}if(l){const m=this.shouldSync();m&&this.options.stdout.write(G),this.log.clear(),this.options.stdout.write(a),this.log(u),m&&this.options.stdout.write(q)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(u);this.lastOutput=t,this.lastOutputToRender=u,this.lastOutputHeight=r}initImmediateKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="enabled")return;const r=t.flags??["disambiguateEscapeCodes"];this.options.stdin.isTTY&&this.options.stdout.isTTY&&this.enableKittyProtocol(r)}initDeferredKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="auto")return;const r=t.flags??["disambiguateEscapeCodes"];!this.interactive||!this.options.stdin.isTTY||!this.options.stdout.isTTY||this.confirmKittySupport(r)}confirmKittySupport(t){const{stdin:r,stdout:i}=this.options;let o=[];const a=v(()=>{this.cancelKittyDetection=void 0,clearTimeout(n),r.removeListener("data",l);const s=li(o);o=[],s.length>0&&r.unshift(Vt.from(s))},"cleanup"),l=v(s=>{const u=typeof s=="string"?Vt.from(s):s;for(const m of u)o.push(m);ai(o)&&(a(),this.isUnmounted||this.enableKittyProtocol(t))},"onData");r.on("data",l);const n=setTimeout(a,200);this.cancelKittyDetection=a,i.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${mr(t)}u`),this.kittyProtocolEnabled=!0}}var hi=Object.defineProperty,Dt=x((e,t)=>hi(e,"name",{value:t,configurable:!0}),"i");const zi=Dt((e,t)=>{const r={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:M.stderr,stdin:M.stdin,stdout:M.stdout,...fi(t)},i=pi(r.stdout,()=>new ci(r));return i.render(e),{cleanup(){i.unmount()},clear(){i.clear()},rerender(o){i.render(o)},rootNode:i.rootNode,unmount(){i.unmount()},waitUntilExit(){return i.waitUntilExit()},waitUntilRenderFlush(){return i.waitUntilRenderFlush()}}},"render"),fi=Dt((e={})=>e instanceof Ie?{stdin:M.stdin,stdout:e}:e,"getOptions"),pi=Dt((e,t)=>{const r=Ot.get(e);if(r===void 0){const i=t();return Ot.set(e,i),i}return M.stderr.write(`Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.
|
|
26
|
+
`),r},"getInstance");export{zi as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var W=Object.defineProperty;var v=(r,s)=>W(r,"name",{value:s,configurable:!0});import l from"react";import{FocusProvider as C,useFocusManager as z}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as T,useInput as B}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as b}from"./LayoutNode-B8zej4dm.js";import{T as f,s as P}from"./reconciler-DIfG72R9.js";import{renderTreeToBuffer as F}from"./renderTreeToBuffer-CZilzyhN.js";import{TuiApp as j}from"./TuiApp-BVDXP0Cv.js";import{InputParser as H}from"./InputParser-B_qZcN3r.js";import{terminalSize as q}from"./Renderer-DJXooAsp.js";import{createInlineLoop as G}from"./createInlineLoop-DRNZ7jqH.js";var M=Object.defineProperty,e=v((r,s)=>M(r,"name",{value:s,configurable:!0}),"e");const R=e(r=>l.createElement("box",r,r.children),"_Box"),ee=e(r=>l.createElement("text",r,r.children),"_Text"),te=e(()=>l.createElement(R,{flexGrow:1}),"_Spacer"),L=e(({children:r})=>{const{disableFocus:s,enableFocus:t,focusNext:c,focusPrevious:i}=z();return B((h,a)=>{a.tab&&!a.shift&&c(),a.tab&&a.shift&&i(),a.escape&&(s(),t())}),l.createElement(l.Fragment,null,r)},"TabHandler");function A(r,s){const t=new j,c=new H(process.stdin),i=new b,{height:h,width:a}=t.getSize();i.yogaNode.setWidth(a),i.yogaNode.setHeight(h);const p=f.createContainer(i,0,null,!1,null,"",o=>console.error(o),null),d=e(o=>l.createElement(T.Provider,{value:{app:t,input:c,writeStderr:e(u=>t.writeStderr(u),"writeStderr"),writeStdout:e(u=>t.writeStdout(u),"writeStdout")}},l.createElement(C,null,l.createElement(L,null,o))),"wrap");f.updateContainer(d(r),p,null,()=>{});const x=e((o,u)=>i.calculateLayout(o,u),"calcLayout"),S=e((o,u,_)=>F(i,o,u,_),"renderBuf"),g=e(()=>t.paintNow(x,S),"paintNow");let E=!1;P(()=>{E=!0});const m=Math.round(1e3/(s?.maxFps??60)),y=setInterval(()=>{E&&(E=!1,g())},m);let N;const n=new Promise(o=>{N=o}),w=e(()=>{clearInterval(y),f.updateContainer(null,p,null,()=>{}),i.destroy(),t.stop(),c.stop(),process.off("SIGWINCH",I),N()},"cleanup");c.on("exit",()=>{w(),process.exit(0)}),t.on("quit",()=>{w(),process.exit(0)}),c.start(),t.start();const I=e(()=>{const o=process.stdout.columns||80,u=process.stdout.rows||24;t.resize(o,u),i.yogaNode.setWidth(o),i.yogaNode.setHeight(u),t.emit("resize"),g()},"onSigwinch");return process.on("SIGWINCH",I),g(),{app:t,input:c,rerender(o){f.updateContainer(d(o),p,null,()=>{})},unmount(){w()},waitUntilExit(){return n}}}v(A,"render");e(A,"render");function O(r,s){const t=q(),c=s?.rows??10,{cols:i}=t,h=Math.min(c,t.rows),a=new H(process.stdin),p=new b;p.yogaNode.setWidth(i),p.yogaNode.setHeight(h);const d=[],x=[],S={quit:e(()=>m.stop(),"quit"),writeStderr:e(n=>x.push(n),"writeStderr"),writeStdout:e(n=>d.push(n),"writeStdout")},g=f.createContainer(p,0,null,!1,null,"",n=>console.error(n),null),E=e(n=>l.createElement(T.Provider,{value:{app:S,input:a,writeStderr:S.writeStderr,writeStdout:S.writeStdout}},l.createElement(C,null,l.createElement(L,null,n))),"wrap");f.updateContainer(E(r),g,null,()=>{}),P(()=>{});const m=G((n,w,I)=>{p.calculateLayout(w,I),F(p,n,w,I)},{...s,fps:s?.maxFps??s?.fps??60,rows:h});a.on("exit",()=>m.stop());let y;const N=new Promise(n=>{y=n});return process.on("exit",()=>{d.length>0&&process.stdout.write(d.join("")),x.length>0&&process.stderr.write(x.join("")),y()}),m.start(),a.start(),{unmount(){m.stop()},waitUntilExit(){return N}}}v(O,"renderInline");e(O,"renderInline");export{R as _Box,te as _Spacer,ee as _Text,A as render,O as renderInline};
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { D as DOMElement } from "./dom.d-C1IxuLJ9.js";
|
|
3
|
+
import 'node:stream';
|
|
4
|
+
import { a as CursorPosition } from "./cursor-helpers.d-BONB9tky.js";
|
|
5
|
+
declare const kittyFlags: {
|
|
6
|
+
readonly disambiguateEscapeCodes: 1;
|
|
7
|
+
readonly reportAllKeysAsEscapeCodes: 8;
|
|
8
|
+
readonly reportAlternateKeys: 4;
|
|
9
|
+
readonly reportAssociatedText: 16;
|
|
10
|
+
readonly reportEventTypes: 2;
|
|
11
|
+
};
|
|
12
|
+
type KittyFlagName = keyof typeof kittyFlags;
|
|
13
|
+
declare const kittyModifiers: {
|
|
14
|
+
readonly alt: 2;
|
|
15
|
+
readonly capsLock: 64;
|
|
16
|
+
readonly ctrl: 4;
|
|
17
|
+
readonly hyper: 16;
|
|
18
|
+
readonly meta: 32;
|
|
19
|
+
readonly numLock: 128;
|
|
20
|
+
readonly shift: 1;
|
|
21
|
+
readonly super: 8;
|
|
22
|
+
};
|
|
23
|
+
type KittyKeyboardOptions = {
|
|
24
|
+
flags?: KittyFlagName[];
|
|
25
|
+
mode?: "auto" | "enabled" | "disabled";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Performance metrics for a render operation.
|
|
29
|
+
*/
|
|
30
|
+
type RenderMetrics = {
|
|
31
|
+
/**
|
|
32
|
+
* Time spent rendering in milliseconds.
|
|
33
|
+
*/
|
|
34
|
+
renderTime: number;
|
|
35
|
+
};
|
|
36
|
+
type Options = {
|
|
37
|
+
/**
|
|
38
|
+
* Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
|
|
39
|
+
*
|
|
40
|
+
* Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
|
|
41
|
+
*
|
|
42
|
+
* Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
|
|
43
|
+
*
|
|
44
|
+
Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
|
|
45
|
+
|
|
46
|
+
Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
47
|
+
|
|
48
|
+
@default false
|
|
49
|
+
|
|
50
|
+
@see {@link RenderOptions.alternateScreen}
|
|
51
|
+
*/
|
|
52
|
+
alternateScreen?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Enable React Concurrent Rendering mode.
|
|
55
|
+
*
|
|
56
|
+
* When enabled:
|
|
57
|
+
* - Suspense boundaries work correctly with async data
|
|
58
|
+
* - `useTransition` and `useDeferredValue` are fully functional
|
|
59
|
+
- Updates can be interrupted for higher priority work
|
|
60
|
+
|
|
61
|
+
Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
|
|
62
|
+
|
|
63
|
+
@default false
|
|
64
|
+
@experimental
|
|
65
|
+
*/
|
|
66
|
+
concurrent?: boolean;
|
|
67
|
+
debug: boolean;
|
|
68
|
+
exitOnCtrlC: boolean;
|
|
69
|
+
incrementalRendering?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Override automatic interactive mode detection.
|
|
72
|
+
*
|
|
73
|
+
* By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
|
|
74
|
+
*
|
|
75
|
+
* When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
|
|
76
|
+
*
|
|
77
|
+
Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
|
|
78
|
+
|
|
79
|
+
Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
80
|
+
|
|
81
|
+
@default true (false if in CI or `stdout.isTTY` is falsy)
|
|
82
|
+
|
|
83
|
+
@see {@link RenderOptions.interactive}
|
|
84
|
+
*/
|
|
85
|
+
interactive?: boolean;
|
|
86
|
+
isScreenReaderEnabled?: boolean;
|
|
87
|
+
kittyKeyboard?: KittyKeyboardOptions;
|
|
88
|
+
maxFps?: number;
|
|
89
|
+
onRender?: (metrics: RenderMetrics) => void;
|
|
90
|
+
patchConsole: boolean;
|
|
91
|
+
standardReactLayoutTiming?: boolean;
|
|
92
|
+
stderr: NodeJS.WriteStream;
|
|
93
|
+
stdin: NodeJS.ReadStream;
|
|
94
|
+
stdout: NodeJS.WriteStream;
|
|
95
|
+
/**
|
|
96
|
+
* Whether to track text selection state during rendering.
|
|
97
|
+
*
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
trackSelection?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Use the native Rust cell-diff renderer instead of ANSI string-based log-update.
|
|
103
|
+
* Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
|
|
104
|
+
* generating minimal ANSI escape sequences. Significantly reduces GC pressure
|
|
105
|
+
* and improves rendering performance for complex UIs.
|
|
106
|
+
*
|
|
107
|
+
* Falls back to the string-based path if native bindings are not available.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
useNativeRenderer?: boolean;
|
|
111
|
+
waitUntilExit?: () => Promise<unknown>;
|
|
112
|
+
};
|
|
113
|
+
declare class Ink {
|
|
114
|
+
/**
|
|
115
|
+
* Whether this instance is using concurrent rendering mode.
|
|
116
|
+
*/
|
|
117
|
+
readonly isConcurrent: boolean;
|
|
118
|
+
private readonly options;
|
|
119
|
+
private readonly log;
|
|
120
|
+
private manualCursorPosition;
|
|
121
|
+
private renderedCursorPosition;
|
|
122
|
+
private renderedCursorRequested;
|
|
123
|
+
private readonly throttledLog;
|
|
124
|
+
private readonly isScreenReaderEnabled;
|
|
125
|
+
private readonly interactive;
|
|
126
|
+
private readonly renderThrottleMs;
|
|
127
|
+
private alternateScreen;
|
|
128
|
+
private isUnmounted;
|
|
129
|
+
private isUnmounting;
|
|
130
|
+
private lastOutput;
|
|
131
|
+
private lastOutputToRender;
|
|
132
|
+
private lastOutputHeight;
|
|
133
|
+
private lastTerminalWidth;
|
|
134
|
+
private readonly nativeLog;
|
|
135
|
+
private readonly useNativeRenderer;
|
|
136
|
+
private readonly container;
|
|
137
|
+
readonly rootNode: DOMElement;
|
|
138
|
+
private fullStaticOutput;
|
|
139
|
+
private backbufferNode;
|
|
140
|
+
private backbufferMultiWarned;
|
|
141
|
+
private readonly exitPromise!;
|
|
142
|
+
private exitResult;
|
|
143
|
+
private beforeExitHandler?;
|
|
144
|
+
private restoreConsole?;
|
|
145
|
+
private unsubscribeResize?;
|
|
146
|
+
private readonly throttledOnRender?;
|
|
147
|
+
private hasPendingThrottledRender;
|
|
148
|
+
private kittyProtocolEnabled;
|
|
149
|
+
private cancelKittyDetection?;
|
|
150
|
+
private nextRenderCommit?;
|
|
151
|
+
private deferredInitDone;
|
|
152
|
+
constructor(options: Options);
|
|
153
|
+
/**
|
|
154
|
+
* Perform deferred initialization on the first render frame.
|
|
155
|
+
* Kitty keyboard auto-detection is deferred here because the CSI ? u
|
|
156
|
+
* query sets up a synchronous stdin listener with a 200ms timeout.
|
|
157
|
+
* "enabled" mode runs immediately in the constructor (it's just a write).
|
|
158
|
+
*/
|
|
159
|
+
private runDeferredInit;
|
|
160
|
+
resized: () => void;
|
|
161
|
+
resolveExitPromise: (result?: unknown) => void;
|
|
162
|
+
rejectExitPromise: (reason?: Error) => void;
|
|
163
|
+
unsubscribeExit: () => void;
|
|
164
|
+
handleAppExit: (errorOrResult?: unknown) => void;
|
|
165
|
+
getActiveCursorPosition: () => CursorPosition | undefined;
|
|
166
|
+
setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
167
|
+
restoreLastOutput: () => void;
|
|
168
|
+
calculateLayout: () => void;
|
|
169
|
+
private calculateScrollAndTriggerObservers;
|
|
170
|
+
/**
|
|
171
|
+
* Force a full layout recalculation by marking all text nodes dirty.
|
|
172
|
+
* Useful when the string width function changes or terminal font changes.
|
|
173
|
+
*/
|
|
174
|
+
recalculateLayout(): void;
|
|
175
|
+
/**
|
|
176
|
+
* Walks the DOM tree before Yoga layout to handle StaticRender nodes.
|
|
177
|
+
*
|
|
178
|
+
* - Re-attach Yoga children if a cached render was invalidated.
|
|
179
|
+
* - Pre-render ink-static-render nodes that don't have a cached render yet.
|
|
180
|
+
*/
|
|
181
|
+
private prepareYogaTree;
|
|
182
|
+
private markAllTextNodesDirty;
|
|
183
|
+
handleStaticChange: () => void;
|
|
184
|
+
/**
|
|
185
|
+
* Compute the slice of lines that newly scrolled off the top of the single
|
|
186
|
+
* `overflowToBackbuffer` region and have not yet been flushed into the
|
|
187
|
+
* terminal's real scrollback. Advances the monotonic
|
|
188
|
+
* `internal_maxPushedScrollTop` bookkeeping so each line is emitted exactly
|
|
189
|
+
* once and scrolling back up is a no-op. Returns a newline-terminated
|
|
190
|
+
* string to write above the live frame, or "" when there is nothing to do.
|
|
191
|
+
*
|
|
192
|
+
* No-op outside inline mode (alternate-screen / non-TTY / non-interactive /
|
|
193
|
+
* screen-reader / debug), since terminal scrollback only exists for an
|
|
194
|
+
* inline, in-place-updated live region. Debug mode is excluded because it
|
|
195
|
+
* re-dumps the full grid every frame and never writes this slice — running
|
|
196
|
+
* it there would advance the monotonic pointer past lines that were never
|
|
197
|
+
* emitted.
|
|
198
|
+
*/
|
|
199
|
+
private computeBackbufferOutput;
|
|
200
|
+
onRender: () => void;
|
|
201
|
+
private accessibilityContextValue;
|
|
202
|
+
render(node: ReactNode): void;
|
|
203
|
+
writeToStdout: (data: string) => void;
|
|
204
|
+
writeToStderr: (data: string) => void;
|
|
205
|
+
unmount: (error?: Error | number | null) => void;
|
|
206
|
+
waitUntilExit(): Promise<unknown>;
|
|
207
|
+
waitUntilRenderFlush(): Promise<void>;
|
|
208
|
+
clear(): void;
|
|
209
|
+
patchConsole(): void;
|
|
210
|
+
private setAlternateScreen;
|
|
211
|
+
private resolveInteractiveOption;
|
|
212
|
+
private resolveAlternateScreenOption;
|
|
213
|
+
private shouldSync;
|
|
214
|
+
private writeBestEffort;
|
|
215
|
+
private awaitExit;
|
|
216
|
+
private hasPendingConcurrentWork;
|
|
217
|
+
private awaitNextRender;
|
|
218
|
+
private renderInteractiveFrame;
|
|
219
|
+
/**
|
|
220
|
+
* Handle kitty keyboard "enabled" mode immediately (just a stdout.write).
|
|
221
|
+
* Called from the constructor.
|
|
222
|
+
*/
|
|
223
|
+
private initImmediateKittyKeyboard;
|
|
224
|
+
/**
|
|
225
|
+
* Handle kitty keyboard "auto" mode detection. Deferred to first render
|
|
226
|
+
* because the CSI ? u query sets up a stdin listener with a 200ms timeout.
|
|
227
|
+
*/
|
|
228
|
+
private initDeferredKittyKeyboard;
|
|
229
|
+
private confirmKittySupport;
|
|
230
|
+
private enableKittyProtocol;
|
|
231
|
+
}
|
|
232
|
+
type RenderOptions = {
|
|
233
|
+
/**
|
|
234
|
+
* Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
|
|
235
|
+
*
|
|
236
|
+
* Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
|
|
237
|
+
*
|
|
238
|
+
* Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
|
|
239
|
+
*
|
|
240
|
+
* Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
|
|
241
|
+
*
|
|
242
|
+
*Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
243
|
+
* @default false
|
|
244
|
+
*/
|
|
245
|
+
alternateScreen?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Enable React Concurrent Rendering mode.
|
|
248
|
+
*
|
|
249
|
+
* When enabled:
|
|
250
|
+
* - Suspense boundaries work correctly with async data
|
|
251
|
+
* - `useTransition` and `useDeferredValue` are fully functional
|
|
252
|
+
* - Updates can be interrupted for higher priority work
|
|
253
|
+
*
|
|
254
|
+
*Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
|
|
255
|
+
* @default false
|
|
256
|
+
*/
|
|
257
|
+
concurrent?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* If true, each update will be rendered as separate output, without replacing the previous one.
|
|
260
|
+
* @default false
|
|
261
|
+
*/
|
|
262
|
+
debug?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Configure whether Ink should listen for Ctrl+C keyboard input and exit the app. This is needed in case `process.stdin` is in raw mode, because then Ctrl+C is ignored by default and the process is expected to handle it manually.
|
|
265
|
+
* @default true
|
|
266
|
+
*/
|
|
267
|
+
exitOnCtrlC?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Enable incremental rendering mode which only updates changed lines instead of redrawing the entire output.
|
|
270
|
+
*This can reduce flickering and improve performance for frequently updating UIs.
|
|
271
|
+
* @default false
|
|
272
|
+
*/
|
|
273
|
+
incrementalRendering?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Override automatic interactive mode detection.
|
|
276
|
+
*
|
|
277
|
+
* By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
|
|
278
|
+
*
|
|
279
|
+
* When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
|
|
280
|
+
*
|
|
281
|
+
* Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
|
|
282
|
+
*
|
|
283
|
+
*Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
284
|
+
* @default true (false if in CI or `stdout.isTTY` is falsy)
|
|
285
|
+
*/
|
|
286
|
+
interactive?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Enable screen reader support. See https://github.com/vadimdemedes/ink/blob/master/readme.md#screen-reader-support
|
|
289
|
+
* @default process.env['INK_SCREEN_READER'] === 'true'
|
|
290
|
+
*/
|
|
291
|
+
isScreenReaderEnabled?: boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Configure kitty keyboard protocol support for enhanced keyboard input.
|
|
294
|
+
* Enables additional modifiers (super, hyper, capsLock, numLock) and
|
|
295
|
+
*disambiguated key events in terminals that support the protocol.
|
|
296
|
+
* @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
|
|
297
|
+
*/
|
|
298
|
+
kittyKeyboard?: KittyKeyboardOptions;
|
|
299
|
+
/**
|
|
300
|
+
* Maximum frames per second for render updates.
|
|
301
|
+
* This controls how frequently the UI can update to prevent excessive re-rendering.
|
|
302
|
+
*Higher values allow more frequent updates but may impact performance.
|
|
303
|
+
* @default 30
|
|
304
|
+
*/
|
|
305
|
+
maxFps?: number;
|
|
306
|
+
/**
|
|
307
|
+
* Runs the given callback after each render and re-render with render metrics.
|
|
308
|
+
*
|
|
309
|
+
* Note: this callback runs after Ink commits a frame, but it does not wait for `stdout`/`stderr` stream callbacks.
|
|
310
|
+
* To run code after output is flushed, use `waitUntilRenderFlush()`.
|
|
311
|
+
*/
|
|
312
|
+
onRender?: (metrics: RenderMetrics) => void;
|
|
313
|
+
/**
|
|
314
|
+
* Patch console methods to ensure console output doesn't mix with Ink's output.
|
|
315
|
+
*
|
|
316
|
+
*Note: Once unmount starts, Ink restores the native console before React cleanup runs. Teardown-time `console.*` output then follows the normal console behavior instead of being rerouted through Ink.
|
|
317
|
+
* @default true
|
|
318
|
+
*/
|
|
319
|
+
patchConsole?: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* If true, Ink defers frame output until after React's commit phase completes,
|
|
322
|
+
* ensuring `useLayoutEffect` hooks run before the frame is written to the terminal.
|
|
323
|
+
*
|
|
324
|
+
* This eliminates the one-frame flicker when components measure layout
|
|
325
|
+
* (e.g., scroll position, element size) in `useLayoutEffect` and adjust state.
|
|
326
|
+
*
|
|
327
|
+
* **Warning:** Incompatible with the `<Static>` component, which relies on
|
|
328
|
+
* immediate render timing to append output.
|
|
329
|
+
* @default false
|
|
330
|
+
*/
|
|
331
|
+
standardReactLayoutTiming?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Error stream.
|
|
334
|
+
* @default process.stderr
|
|
335
|
+
*/
|
|
336
|
+
stderr?: NodeJS.WriteStream;
|
|
337
|
+
/**
|
|
338
|
+
* Input stream where app will listen for input.
|
|
339
|
+
* @default process.stdin
|
|
340
|
+
*/
|
|
341
|
+
stdin?: NodeJS.ReadStream;
|
|
342
|
+
/**
|
|
343
|
+
* Output stream where the app will be rendered.
|
|
344
|
+
* @default process.stdout
|
|
345
|
+
*/
|
|
346
|
+
stdout?: NodeJS.WriteStream;
|
|
347
|
+
/**
|
|
348
|
+
* Use the native Rust cell-diff renderer for terminal output.
|
|
349
|
+
* Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
|
|
350
|
+
* generating minimal ANSI escape sequences. Reduces GC pressure and
|
|
351
|
+
* improves rendering performance for complex UIs.
|
|
352
|
+
*
|
|
353
|
+
* Falls back to string-based rendering if native bindings are not available.
|
|
354
|
+
* @default false
|
|
355
|
+
*/
|
|
356
|
+
useNativeRenderer?: boolean;
|
|
357
|
+
};
|
|
358
|
+
type Instance = {
|
|
359
|
+
/**
|
|
360
|
+
* Unmount the current app and remove the internal Ink instance for this stdout.
|
|
361
|
+
*
|
|
362
|
+
* This is mostly useful for advanced cases where you need `render()` to create a fresh instance for the same stream without leaving terminal state such as the alternate screen behind.
|
|
363
|
+
*/
|
|
364
|
+
cleanup: () => void;
|
|
365
|
+
/**
|
|
366
|
+
* Clear output.
|
|
367
|
+
*/
|
|
368
|
+
clear: () => void;
|
|
369
|
+
/**
|
|
370
|
+
* Replace the previous root node with a new one or update props of the current root node.
|
|
371
|
+
*/
|
|
372
|
+
rerender: Ink["render"];
|
|
373
|
+
/**
|
|
374
|
+
* The root DOM element of the rendered tree.
|
|
375
|
+
* Useful for programmatic DOM inspection and advanced measurement.
|
|
376
|
+
*/
|
|
377
|
+
rootNode: DOMElement;
|
|
378
|
+
/**
|
|
379
|
+
* Manually unmount the whole Ink app.
|
|
380
|
+
*/
|
|
381
|
+
unmount: Ink["unmount"];
|
|
382
|
+
/**
|
|
383
|
+
* Returns a promise that settles when the app is unmounted.
|
|
384
|
+
*
|
|
385
|
+
* It resolves with the value passed to `exit(value)` and rejects with the error passed to `exit(error)`.
|
|
386
|
+
*When `unmount()` is called manually, it settles after unmount-related stdout writes complete.
|
|
387
|
+
* @example
|
|
388
|
+
* ```jsx
|
|
389
|
+
* const {unmount, waitUntilExit} = render(<MyApp />);
|
|
390
|
+
*
|
|
391
|
+
* setTimeout(unmount, 1000);
|
|
392
|
+
*
|
|
393
|
+
* await waitUntilExit(); // resolves after `unmount()` is called
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
waitUntilExit: Ink["waitUntilExit"];
|
|
397
|
+
/**
|
|
398
|
+
* Returns a promise that settles after pending render output is flushed to stdout.
|
|
399
|
+
*
|
|
400
|
+
*This can be used after `rerender()` when you need to run code only after the frame is written.
|
|
401
|
+
* @example
|
|
402
|
+
* ```jsx
|
|
403
|
+
* const {rerender, waitUntilRenderFlush} = render(<MyApp step="loading" />);
|
|
404
|
+
*
|
|
405
|
+
* rerender(<MyApp step="ready" />);
|
|
406
|
+
* await waitUntilRenderFlush(); // output for "ready" is flushed
|
|
407
|
+
*
|
|
408
|
+
* runNextCommand();
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
waitUntilRenderFlush: Ink["waitUntilRenderFlush"];
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Mount a component and render the output.
|
|
415
|
+
*/
|
|
416
|
+
declare const render: (node: ReactNode, options?: NodeJS.WriteStream | RenderOptions) => Instance;
|
|
417
|
+
export { Instance as I, KittyFlagName as K, RenderOptions as R, KittyKeyboardOptions as a, kittyModifiers as b, kittyFlags as k, render as r };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var T=Object.defineProperty;var c=(o,r)=>T(o,"name",{value:r,configurable:!0});import y from"react";import{FocusProvider as w}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as v}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as C}from"./LayoutNode-B8zej4dm.js";import{T as i}from"./reconciler-DIfG72R9.js";import{renderTreeToBuffer as E}from"./renderTreeToBuffer-CZilzyhN.js";import{Cell as N}from"./Cell-BrXn3jxY.js";var P=Object.defineProperty,d=c((o,r)=>P(o,"name",{value:r,configurable:!0}),"a");function W(o,r){const e=r?.columns??80,n=r?.rows??24,t=new C;t.yogaNode.setWidth(e),t.yogaNode.setHeight(n);const S={app:null,input:null,writeStderr:d(u=>{},"writeStderr"),writeStdout:d(u=>{},"writeStdout")},g=y.createElement(v.Provider,{value:S},y.createElement(w,null,o)),m=i.createContainer(t,0,null,!1,null,"renderToString",()=>{},null);i.updateContainerSync(g,m,null,()=>{}),i.flushSyncWork(),t.calculateLayout(e,n);const f=new Uint32Array(e*n*2);E(t,f,e,n);const l=[];for(let u=0;u<n;u++){let p="";for(let a=0;a<e;a++){const h=f[(u*e+a)*2],s=N.getChar(h);p+=s===""?" ":s}l.push(p.trimEnd())}for(;l.length>0&&l.at(-1)==="";)l.pop();return i.updateContainerSync(null,m,null,()=>{}),i.flushSyncWork(),t.destroy(),l.join(`
|
|
2
|
+
`)}c(W,"renderToString");d(W,"renderToString");export{W as renderToString};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var g=Object.defineProperty;var u=(t,n)=>g(t,"name",{value:n,configurable:!0});import{LegacyRoot as N}from"react-reconciler/constants.js";import S from"yoga-layout";import{c as h}from"./dom-BG-LS10p.js";import{L as c}from"./reconciler-CUbhOvcr.js";import{R as d}from"./renderer-DG986Pcr.js";import{calculateScroll as w}from"./getScrollHeight-ClEOyLHH.js";var R=Object.defineProperty,m=u((t,n)=>R(t,"name",{value:n,configurable:!0}),"u");const I=m((t,n)=>{const y=n?.columns??80,e=h("ink-root");let i="";e.onComputeLayout=()=>{e.yogaNode.setWidth(y),e.yogaNode.calculateLayout(void 0,void 0,S.DIRECTION_LTR);const o=m(r=>{if(r.nodeName==="ink-box"){const a=r.style.overflow??"visible",p=r.style.overflowX??a,v=r.style.overflowY??a;(p==="scroll"||v==="scroll")&&w(r)}for(const a of r.childNodes)a.nodeName!=="#text"&&o(a)},"walkScroll");o(e)},e.onImmediateRender=()=>{const{staticOutput:o}=d(e,!1);o&&o!==`
|
|
2
|
+
`&&(i+=o)};let l;const s=c.createContainer(e,N,null,!1,null,"render-to-string",o=>{l??=o},()=>{},()=>{},()=>{});let f=!1;try{c.updateContainerSync(t,s,null,()=>{}),c.flushSyncWork();const{output:o}=d(e,!1);if(c.updateContainerSync(null,s,null,()=>{}),c.flushSyncWork(),f=!0,e.yogaNode.free(),l!==void 0)throw l instanceof Error?l:new Error(String(l));const r=i.endsWith(`
|
|
3
|
+
`)?i.slice(0,-1):i;return r&&o?`${r}
|
|
4
|
+
${o}`:r||o}finally{if(!f&&e.yogaNode)try{e.yogaNode.freeRecursive()}catch{}}},"renderToString");export{I as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var D=Object.defineProperty;var R=(t,o)=>D(t,"name",{value:o,configurable:!0});import G from"cli-boxes";import{resolveColor as W}from"./NAMED_COLORS-B9fJsYdg.js";import{g as I}from"./text-width-BU2eeTWn.js";var K=Object.defineProperty,B=R((t,o)=>K(t,"name",{value:o,configurable:!0}),"N");const V=1114112,F=9608,J=9600,Q=9604;function j(t){const o=t?.borderStyle?1:0;return{bottom:t?.borderBottom===!1?0:o,left:t?.borderLeft===!1?0:o,right:t?.borderRight===!1?0:o,top:t?.borderTop===!1?0:o}}R(j,"k");B(j,"getEffectiveBorderWidths");function H(t){let o=0;for(const i of t.children){const b=i.getLayout(),e=b.top+b.height;e>o&&(o=e)}const n=t._style,l=n?.paddingBottom??n?.paddingY??n?.padding??0;return o+l}R(H,"q");B(H,"getScrollContentHeight");function N(t,o,n,l,i,b,e,m,v,_,g,d){const r=j(d),a=m-r.top-r.bottom,u=d.scrollTop??0,h=H(t),M=a;if(h<=M||a<=0)return;const f=a*2,y=Math.max(2,Math.round(M/h*f)),s=h-M,x=f-y,T=s>0?Math.round(u/s*x):0,c=typeof d.scrollbarThumbColor=="string"?W(d.scrollbarThumbColor):v,p=i+e-1-r.right,S=_<<16|65280|c;for(let w=0;w<a;w++){const Y=w*2,X=Y+1,k=Y>=T&&Y<T+y,L=X>=T&&X<T+y;if(!k&&!L)continue;let C=F;k&&!L?C=J:!k&&L&&(C=Q),A(o,n,l,p,b+r.top+w,C,S,g)}}R(N,"z");B(N,"paintScrollbar");function q(t,o,n,l,i,b,e,m,v,_,g,d,r,a){const u=j(a),h=a.scrollTop??0,M=b+u.top;for(const f of t.children){if(!f._style?.sticky)continue;const y=f.getLayout();if(y.top>=h)continue;const s=f.parent;if(s&&s!==t){const S=s.getLayout();if(S.top+S.height<=h)continue}const x=M,T=f.fg===255?v:f.fg,c=f.bg===255?_:f.bg,p=f.styles===0?g:f.styles;E(f,o,n,l,i-y.left,x-y.top,T,c,p,d,r)}}R(q,"G");B(q,"paintStickyHeaders");function Z(t,o,n,l){for(let e=0;e<o.length;e+=2)o[e]=32,o[e+1]=65535;const i=[],b={x0:0,x1:n,y0:0,y1:l};try{E(t,o,n,l,0,0,t.fg,t.bg,t.styles,i,b);for(const e of i)z(e.node,o,n,l,e.absX,e.absY,e.w,e.h,e.fg,e.bg,e.styles,e.clip)}catch(e){console.error("Renderer Error:",e)}}R(Z,"renderTreeToBuffer");B(Z,"renderTreeToBuffer");function A(t,o,n,l,i,b,e,m){if(l<m.x0||l>=m.x1||i<m.y0||i>=m.y1||l<0||l>=o||i<0||i>=n)return;const v=(i*o+l)*2;t[v]=b,t[v+1]=e}R(A,"M");B(A,"writeCell");function z(t,o,n,l,i,b,e,m,v,_,g,d){if(!t._style?.borderStyle||e<=0||m<=0)return;const r=G[t._style.borderStyle],a=t._style.borderColor===void 0?v:W(t._style.borderColor),u=g<<16|_<<8|a,h=t._style.borderTop!==!1,M=t._style.borderBottom!==!1,f=t._style.borderLeft!==!1,y=t._style.borderRight!==!1,s=M&&(m>1||!h);if(h)for(let c=0;c<e;c++){let p;e===1?p=f&&y?r.left:f?r.topLeft:y?r.topRight:r.top:c===0&&f?p=r.topLeft:c===e-1&&y?p=r.topRight:p=r.top,A(o,n,l,i+c,b,p.codePointAt(0),u,d)}if(s)for(let c=0;c<e;c++){let p;e===1?p=f&&y?r.left:f?r.bottomLeft:y?r.bottomRight:r.bottom:c===0&&f?p=r.bottomLeft:c===e-1&&y?p=r.bottomRight:p=r.bottom,A(o,n,l,i+c,b+m-1,p.codePointAt(0),u,d)}const x=h?1:0,T=s?m-1:m;for(let c=x;c<T;c++)f&&A(o,n,l,i,b+c,r.left.codePointAt(0),u,d),y&&A(o,n,l,i+e-1,b+c,r.right.codePointAt(0),u,d)}R(z,"K");B(z,"paintBorder");function U(t){if(t._hidden)return"";if(t.text!==void 0)return t.text;const o=t.children.map(U).join("");return typeof t.transform=="function"?t.transform(o,0):o}R(U,"X");B(U,"collectText");function O(t,o,n,l,i,b,e,m,v,_){if(e<=0||m<=0)return;let g=0,d=0;for(const r of t){if(r===`
|
|
2
|
+
`){g=0,d++;continue}const a=r.codePointAt(0)??32,u=I(r);if(g+u>e&&(g=0,d++),d>=m)break;if(u>e){A(o,n,l,i+g,b+d,32,v,_),g+=1;continue}A(o,n,l,i+g,b+d,a,v,_),u===2&&g+1<e&&A(o,n,l,i+g+1,b+d,V,v,_),g+=u}}R(O,"E");B(O,"paintText");function E(t,o,n,l,i,b,e,m,v,_,g){if(t._hidden)return;const d=t.getLayout(),r=Math.round(i+d.left),a=Math.round(b+d.top),u=Math.round(d.width),h=Math.round(d.height),M=t.fg===255?e:t.fg,f=t.bg===255?m:t.bg,y=t.styles===0?v:t.styles,s={x0:Math.max(g.x0,r),x1:Math.min(g.x1,r+u),y0:Math.max(g.y0,a),y1:Math.min(g.y1,a+h)};if(s.x0>=s.x1||s.y0>=s.y1)return;if(typeof t.transform=="function"){const L=U(t),C=t.transform(L,0),P=y<<16|f<<8|M;O(C,o,n,l,r,a,u,h,P,s);return}if(t.text===void 0){if(f!==255||y!==0){const L=y<<16|f<<8|M;for(let C=0;C<h;C++)for(let P=0;P<u;P++)A(o,n,l,r+P,a+C,32,L,s)}t._style?.borderStyle&&_.push({absX:r,absY:a,bg:f,clip:s,fg:M,h,node:t,styles:y,w:u})}else{const L=y<<16|f<<8|M;if(t.bg!==255)for(let C=0;C<h;C++)for(let P=0;P<u;P++)A(o,n,l,r+P,a+C,32,L,s);O(t.text,o,n,l,r,a,u,h,L,s)}const x=t._style,T=x?.overflow??"visible",c=x?.overflowX??T,p=x?.overflowY??T,S=c==="hidden"||c==="scroll",w=p==="hidden"||p==="scroll";let Y=s,X=0,k=0;if(S||w){const L=j(x);Y={x0:S?Math.max(s.x0,r+L.left):s.x0,x1:S?Math.min(s.x1,r+u-L.right):s.x1,y0:w?Math.max(s.y0,a+L.top):s.y0,y1:w?Math.min(s.y1,a+h-L.bottom):s.y1},p==="scroll"&&typeof x?.scrollTop=="number"&&(k=-x.scrollTop),c==="scroll"&&typeof x?.scrollLeft=="number"&&(X=-x.scrollLeft)}for(const L of t.children)L._style?.internalStickyAlternate||E(L,o,n,l,r+X,a+k,M,f,y,_,Y);(p==="scroll"||c==="scroll")&&x?.scrollbar!==!1&&N(t,o,n,l,r,a,u,h,M,y,s,x),p==="scroll"&&typeof x?.scrollTop=="number"&&q(t,o,n,l,r,a,u,h,M,f,y,_,Y,x)}R(E,"S");B(E,"paintNode");export{Z as renderTreeToBuffer};
|