@visulima/tui 1.0.0-alpha.1 → 1.0.0-alpha.10
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 +137 -0
- package/LICENSE.md +203 -9
- package/README.md +6 -6
- package/dist/core/index.d.ts +58 -5
- package/dist/core/index.js +1 -5
- package/dist/ink/index.d.ts +6574 -159
- package/dist/ink/index.js +1 -100
- package/dist/packem_chunks/devtools.js +3 -26
- package/dist/packem_shared/Accordion-BXsqchV-.js +1 -0
- package/dist/packem_shared/Alert-BhYVMHtR.js +1 -0
- package/dist/packem_shared/AnimatePresence-Eu7Z8KHc.js +1 -0
- package/dist/packem_shared/ApprovalPrompt-BSn0FT1g.js +1 -0
- package/dist/packem_shared/AreaChart-Chy-frI7.js +1 -0
- package/dist/packem_shared/Badge-B8WPyRsK.js +1 -0
- package/dist/packem_shared/BarChart-rpZtlMcF.js +1 -0
- package/dist/packem_shared/BigText-CRpwUzrt.js +1 -0
- package/dist/packem_shared/BlinkDot-BvnRuWP8.js +1 -0
- package/dist/packem_shared/Box-BwqSvWuq.js +1 -0
- package/dist/packem_shared/Breadcrumb-D0hClbRV.js +1 -0
- package/dist/packem_shared/Button-B89Yvbc6.js +1 -0
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +1 -0
- package/dist/packem_shared/Calendar-Dmflvm2S.js +1 -0
- package/dist/packem_shared/Canvas-CKg6WV47.js +1 -0
- package/dist/packem_shared/Card-B_9fXdtU.js +1 -0
- package/dist/packem_shared/Cell-BrXn3jxY.js +1 -0
- package/dist/packem_shared/Checkbox-BN71eCWU.js +1 -0
- package/dist/packem_shared/Code-HhevcyiH.js +2 -0
- package/dist/packem_shared/Collapsible-u6uf_FdV.js +1 -0
- package/dist/packem_shared/CommandBlock-B-nslpCv.js +4 -0
- package/dist/packem_shared/CommandPalette-CEFdaURo.js +1 -0
- package/dist/packem_shared/ConfirmDialog-5Jje_Xpu.js +1 -0
- package/dist/packem_shared/ConfirmInput-D44Mb9oo.js +1 -0
- package/dist/packem_shared/ConsoleOverlay-CM3APfgP.js +1 -0
- package/dist/packem_shared/ContentSwitcher-Dm5BkrCt.js +1 -0
- package/dist/packem_shared/ControlledScrollView-DI8KZOQB.js +1 -0
- package/dist/packem_shared/Cursor-BoLFIMol.js +1 -0
- package/dist/packem_shared/DatePicker-CnSrFFAE.js +1 -0
- package/dist/packem_shared/DefinitionList-v8RDuF_R.js +1 -0
- package/dist/packem_shared/DevTools-O8EbCfHa.js +1 -0
- package/dist/packem_shared/Dialog-CTaL8pn0.js +1 -0
- package/dist/packem_shared/DiffView-BUIFqUB0.js +1 -0
- package/dist/packem_shared/Divider-C47bKmqu.js +1 -0
- package/dist/packem_shared/FilePicker-CUo7R5Qb.js +1 -0
- package/dist/packem_shared/FocusContext-Xy0cwJpO.js +1 -0
- package/dist/packem_shared/FormField-af3aUpRL.js +1 -0
- package/dist/packem_shared/Fullscreen-CuJ8y0s0.js +1 -0
- package/dist/packem_shared/Gauge-Dz-usH__.js +1 -0
- package/dist/packem_shared/Gradient-DYNc0GZA.js +1 -0
- package/dist/packem_shared/Heading-mwEYza3Y.js +1 -0
- package/dist/packem_shared/Heatmap-ChL97U1-.js +1 -0
- package/dist/packem_shared/Help-Zcelyw_U.js +1 -0
- package/dist/packem_shared/Histogram-FIf2F83d.js +1 -0
- package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +1 -0
- package/dist/packem_shared/InputParser-rZKjY_7Y.js +2 -0
- package/dist/packem_shared/KEY-Bk8B-3h_.js +1 -0
- package/dist/packem_shared/Kbd-DpkPp4jB.js +1 -0
- package/dist/packem_shared/LayoutNode-rxblE317.js +1 -0
- package/dist/packem_shared/LineChart-BXE_girm.js +1 -0
- package/dist/packem_shared/Link-i2o2EG4-.js +1 -0
- package/dist/packem_shared/LoadingIndicator-TC1Fjwyt.js +1 -0
- package/dist/packem_shared/Markdown-R1XqK63D.js +1 -0
- package/dist/packem_shared/MaskedInput-J01phOZs.js +1 -0
- package/dist/packem_shared/Menu-CfrH4ymk.js +1 -0
- package/dist/packem_shared/MessageBubble-BmBBU2Rm.js +1 -0
- package/dist/packem_shared/ModelBadge-D3wrXncu.js +1 -0
- package/dist/packem_shared/MouseProvider-pjza-lpc.js +1 -0
- package/dist/packem_shared/MultiSelect-Dqmn-bVo.js +1 -0
- package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +1 -0
- package/dist/packem_shared/Newline-BSG4iUqp.js +2 -0
- package/dist/packem_shared/OperationTree-DksxjMIV.js +1 -0
- package/dist/packem_shared/OptionList-CNx7r9yN.js +1 -0
- package/dist/packem_shared/OrderedList-BeDy035w.js +1 -0
- package/dist/packem_shared/Paginator-B56s6bhS.js +1 -0
- package/dist/packem_shared/Paragraph-BqJlH0R-.js +1 -0
- package/dist/packem_shared/Placeholder-GMpHRGC8.js +1 -0
- package/dist/packem_shared/ProgressBar-Bj3fmORR.js +1 -0
- package/dist/packem_shared/RadioGroup-Br8BeEwS.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/ScatterPlot-OhfYco5l.js +1 -0
- package/dist/packem_shared/ScrollBar-Da5Y3z7N.js +1 -0
- package/dist/packem_shared/ScrollBarBox-Dz6F-Eat.js +1 -0
- package/dist/packem_shared/ScrollList-DiVGyEjv.js +1 -0
- package/dist/packem_shared/ScrollView-BojONotI.js +1 -0
- package/dist/packem_shared/SearchInput-BoPTRbhV.js +1 -0
- package/dist/packem_shared/SelectInput-CAJ7SCBq.js +1 -0
- package/dist/packem_shared/SelectInputIndicator-N1n8ULHs.js +1 -0
- package/dist/packem_shared/SelectInputItem-BEkbmobs.js +1 -0
- package/dist/packem_shared/ShimmerText-CuGQ2NDC.js +1 -0
- package/dist/packem_shared/Slider-Cg_tJpKa.js +1 -0
- package/dist/packem_shared/Spacer-eT3HOrXk.js +1 -0
- package/dist/packem_shared/Sparkline-T6_FPVET.js +1 -0
- package/dist/packem_shared/Spinner-B0-A50pu.js +1 -0
- package/dist/packem_shared/Static-DLynr5pn.js +1 -0
- package/dist/packem_shared/Static-jzLPaHJF.js +1 -0
- package/dist/packem_shared/StaticRender-BgD61E7x.js +1 -0
- package/dist/packem_shared/StatusLine-Ch4jjef1.js +1 -0
- package/dist/packem_shared/StatusMessage-B1qfKeMM.js +1 -0
- package/dist/packem_shared/Stepper-CNPAqxiU.js +1 -0
- package/dist/packem_shared/Stopwatch-CAx2EWwq.js +1 -0
- package/dist/packem_shared/StreamingText-BYOKSB2T.js +1 -0
- package/dist/packem_shared/Switch-DzSpKYu7.js +1 -0
- package/dist/packem_shared/Tab-BcXzSUdj.js +1 -0
- package/dist/packem_shared/Table-DJp1TLrR.js +1 -0
- package/dist/packem_shared/Tabs-D68z0SOt.js +1 -0
- package/dist/packem_shared/Tag-BvLHnYRn.js +1 -0
- package/dist/packem_shared/Text-mTAve9R2.js +1 -0
- package/dist/packem_shared/TextInput-C_gYQlnF.js +1 -0
- package/dist/packem_shared/Textarea-C2ET_oMb.js +2 -0
- package/dist/packem_shared/Timer-CI3aQX65.js +1 -0
- package/dist/packem_shared/Toast-Drvc8XfG.js +1 -0
- package/dist/packem_shared/Tooltip-C5UnQlLd.js +1 -0
- package/dist/packem_shared/Transform-fYmcdqRT.js +1 -0
- package/dist/packem_shared/Transition-CJDBKYUB.js +1 -0
- package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +1 -0
- package/dist/packem_shared/TreeView-DjhacGJ5.js +1 -0
- package/dist/packem_shared/TuiApp-DrjI_i-R.js +1 -0
- package/dist/packem_shared/TuiContext-BoJvG3NN.js +3 -0
- package/dist/packem_shared/UnorderedList-BnfqexZs.js +1 -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/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/braille-BBjIoaN0.js +1 -0
- package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
- package/dist/packem_shared/comparePoints-C85EsmNz.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-CmrAEvJk.js +1 -0
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
- package/dist/packem_shared/createLinkedScrollGroup-BMTJ7rAj.js +1 -0
- package/dist/packem_shared/createMemoryStorage-QVZNXbWz.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/dom-4y__5fWB.js +1 -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-B2tKmx3i.js +1 -0
- package/dist/packem_shared/getScrollHeight-BTEY8ewu.js +1 -0
- package/dist/packem_shared/input-utils-fAxzSlNh.js +1 -0
- package/dist/packem_shared/input.d-Bfq7oc06.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/line-chart-DrM8PwnI.js +1 -0
- package/dist/packem_shared/measure-element-DSp7YDus.js +2 -0
- package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
- package/dist/packem_shared/measureElement-DA8WqFP_.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-DXDfFb_d.js +1 -0
- package/dist/packem_shared/reconciler-BuOP-TZ6.js +1 -0
- package/dist/packem_shared/reconciler-DSYCrIZs.js +1 -0
- package/dist/packem_shared/render-DDqtMAFN.js +1 -0
- package/dist/packem_shared/render-_r0K9K11.js +28 -0
- package/dist/packem_shared/render.d-BR3gA-N8.d.ts +1257 -0
- package/dist/packem_shared/renderToString-DeqOWRP8.js +4 -0
- package/dist/packem_shared/renderToString-IYYPyASm.js +2 -0
- package/dist/packem_shared/renderTreeToBuffer-DPkoCgP2.js +2 -0
- package/dist/packem_shared/renderer-D2p6av2X.js +17 -0
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
- package/dist/packem_shared/squashTextNodesWithMap-Cpqmc45i.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/text-width-CZ9vPvM0.js +2 -0
- package/dist/packem_shared/token-to-elements-BYxT6J_Q.js +1 -0
- package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +1 -0
- package/dist/packem_shared/useAnimation-B9we6ZzL.js +1 -0
- package/dist/packem_shared/useApp-B6fvM42d.js +1 -0
- package/dist/packem_shared/useBoxMetrics-D5pkIr6P.js +1 -0
- package/dist/packem_shared/useClipboard-CBxy0hT8.js +1 -0
- package/dist/packem_shared/useColorBlindness-BvWcu2Bb.js +1 -0
- package/dist/packem_shared/useConsoleCapture-BxiG8iLJ.js +1 -0
- package/dist/packem_shared/useCursor-CPu8T5Db.js +1 -0
- package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +1 -0
- package/dist/packem_shared/useFocus-DSmziO_x.js +1 -0
- package/dist/packem_shared/useFocusManager-Uapn3LQo.js +1 -0
- package/dist/packem_shared/useForm-CzV-Oext.js +1 -0
- package/dist/packem_shared/useHotkey-D0dGey14.js +1 -0
- package/dist/packem_shared/useInput-D1_jG26Z.js +2 -0
- package/dist/packem_shared/useInterval-AobjZT3u.js +1 -0
- package/dist/packem_shared/useIsScreenReaderEnabled-DjWHh-II.js +1 -0
- package/dist/packem_shared/useKeyBindings-zabkEJQs.js +1 -0
- package/dist/packem_shared/useKeyChord-CICQIxXj.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/usePaste-CKKB9H-Z.js +1 -0
- package/dist/packem_shared/useScrollAcceleration-NrY1oVMs.js +1 -0
- package/dist/packem_shared/useScrollInput-Caghtn-Q.js +1 -0
- package/dist/packem_shared/useStderr-BDZb6InG.js +1 -0
- package/dist/packem_shared/useStdin-DKa4h35k.js +1 -0
- package/dist/packem_shared/useStdout-B-2lX4C5.js +1 -0
- package/dist/packem_shared/useStopwatch-DffK7iMh.js +1 -0
- package/dist/packem_shared/useTerminalPalette-Cv7tSduR.js +1 -0
- package/dist/packem_shared/useTextBuffer-DekkGLxI.js +4 -0
- package/dist/packem_shared/useTextSelection-CGT0GLDR.js +1 -0
- package/dist/packem_shared/useTimeout-7LEFYTnG.js +1 -0
- package/dist/packem_shared/useTimer-DyoqSyGi.js +1 -0
- package/dist/packem_shared/useTreeView-8UlTK6sW.js +1 -0
- package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +1 -0
- package/dist/packem_shared/useWindowSize-yDZsXF8z.js +1 -0
- package/dist/packem_shared/utils-THUhYKG2.js +1 -0
- package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -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 +274 -135
- package/dist/testing/index.js +1 -260
- package/index.js +691 -539
- package/package.json +24 -28
- 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 -97
- 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/hooks/use-animation.d.ts +0 -43
- package/dist/ink/hooks/use-app.d.ts +0 -6
- package/dist/ink/hooks/use-box-metrics.d.ts +0 -58
- package/dist/ink/hooks/use-clipboard.d.ts +0 -29
- package/dist/ink/hooks/use-color-blindness.d.ts +0 -33
- package/dist/ink/hooks/use-console-capture.d.ts +0 -43
- package/dist/ink/hooks/use-cursor.d.ts +0 -12
- package/dist/ink/hooks/use-focus-manager.d.ts +0 -42
- package/dist/ink/hooks/use-focus.d.ts +0 -30
- package/dist/ink/hooks/use-input.d.ts +0 -149
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +0 -6
- package/dist/ink/hooks/use-key-bindings.d.ts +0 -61
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -41
- package/dist/ink/hooks/use-paste.d.ts +0 -44
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +0 -47
- package/dist/ink/hooks/use-scroll-input.d.ts +0 -34
- package/dist/ink/hooks/use-stderr.d.ts +0 -6
- package/dist/ink/hooks/use-stdin.d.ts +0 -7
- package/dist/ink/hooks/use-stdout.d.ts +0 -6
- package/dist/ink/hooks/use-stopwatch.d.ts +0 -40
- package/dist/ink/hooks/use-terminal-palette.d.ts +0 -19
- package/dist/ink/hooks/use-text-buffer.d.ts +0 -42
- package/dist/ink/hooks/use-text-selection.d.ts +0 -45
- package/dist/ink/hooks/use-timer.d.ts +0 -49
- package/dist/ink/hooks/use-window-size.d.ts +0 -18
- 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-BXpZwLWo.js +0 -146
- 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 N=Object.defineProperty;var g=(n,t)=>N(n,"name",{value:t,configurable:!0});import{g as m}from"./dom-4y__5fWB.js";import{t as O}from"./measure-text-DDjHT1jD.js";import{squashTextNodesWithMap as S}from"./squashTextNodesWithMap-Cpqmc45i.js";var v=Object.defineProperty,l=g((n,t)=>v(n,"name",{value:t,configurable:!0}),"f");const x=l(n=>{if(n.nodeName==="#text"){const r=O(n.nodeValue);return{charOffsetMap:new Map([[n,{end:r.length,start:0}]]),styledLine:r}}const t=new Map,e=S(n,t,{current:0}),s=O(e);return t.set(n,{end:s.length,start:0}),{charOffsetMap:t,styledLine:s}},"getPlainTextFromDomNode"),y=l((n,t)=>{if(!n.startContainer||!n.endContainer)return;const e=l((i,h)=>{const o=t.get(i);if(!o)return;if(i.nodeName==="#text")return o.start+h;const d=i;if(h>=d.childNodes.length)return o.end;const a=d.childNodes[h],u=t.get(a);if(u)return u.start;for(let f=h-1;f>=0;f--){const c=d.childNodes[f],C=t.get(c);if(C)return C.end}return o.start},"getOffset"),s=e(n.startContainer,n.startOffset),r=e(n.endContainer,n.endOffset);if(!(s===void 0||r===void 0))return{end:r,start:s}},"getRangeCharacterOffsets"),p=l((n,t,e,s)=>{if(n===e)return t===s?0:t<s?-1:1;const r=m(n),i=m(e);let h,o=0;for(;o<r.length&&o<i.length&&r[o]===i[o];)h=r[o],o++;if(!h)return 0;if(o===r.length){const c=i[o],C=n.childNodes.indexOf(c);return t<=C?-1:1}if(o===i.length){const c=r[o];return e.childNodes.indexOf(c)<s?-1:1}const d=r[o],a=i[o],u=h.childNodes.indexOf(d),f=h.childNodes.indexOf(a);return u<f?-1:1},"comparePoints");class A{static{g(this,"Range")}static{l(this,"Range")}startContainer=void 0;startOffset=0;endContainer=void 0;endOffset=0;collapsed=!0;commonAncestorContainer=void 0;setStart(t,e){this.startContainer=t,this.startOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}setEnd(t,e){this.endContainer=t,this.endOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}collapse(t){t?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset),this.collapsed=!0,this.updateCommonAncestor()}selectNode(t){if(!t.parentNode)throw new Error("Node has no parent");const e=t.parentNode.childNodes.indexOf(t);this.setStart(t.parentNode,e),this.setEnd(t.parentNode,e+1)}selectNodeContents(t){this.setStart(t,0),t.nodeName==="#text"?this.setEnd(t,t.nodeValue.length):this.setEnd(t,t.childNodes.length)}toString(){if(this.collapsed||!this.startContainer||!this.endContainer||!this.commonAncestorContainer)return"";const{charOffsetMap:t,styledLine:e}=x(this.commonAncestorContainer),s=y(this,t);if(!s)return"";const r=e.slice(s.start,s.end);return r.getTextRange(0,r.length)}updateCollapsed(){this.collapsed=this.startContainer===this.endContainer&&this.startOffset===this.endOffset}updateCommonAncestor(){if(!this.startContainer||!this.endContainer){this.commonAncestorContainer=void 0;return}if(this.startContainer===this.endContainer){this.commonAncestorContainer=this.startContainer;return}const t=m(this.startContainer),e=m(this.endContainer);let s;for(let r=0;r<Math.min(t.length,e.length)&&t[r]===e[r];r++)s=t[r];this.commonAncestorContainer=s}}class L{static{g(this,"Selection")}static{l(this,"Selection")}anchorNode=void 0;anchorOffset=0;focusNode=void 0;focusOffset=0;isCollapsed=!0;rangeCount=0;ranges=[];listeners=new Set;onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}toString(){return this.ranges.map(t=>t.toString()).join("")}getRangeAt(t){return this.ranges[t]}addRange(t){this.ranges.includes(t)||(this.ranges.push(t),this.rangeCount=this.ranges.length,this.rangeCount===1&&(this.anchorNode=t.startContainer,this.anchorOffset=t.startOffset,this.focusNode=t.endContainer,this.focusOffset=t.endOffset,this.isCollapsed=t.collapsed),this.notifyChange())}removeRange(t){const e=this.ranges.indexOf(t);e!==-1&&(this.ranges.splice(e,1),this.rangeCount=this.ranges.length,this.rangeCount===0&&this.clearState(),this.notifyChange())}removeAllRanges(){this.ranges=[],this.rangeCount=0,this.clearState(),this.notifyChange()}collapse(t,e){this.removeAllRanges();const s=new A;s.setStart(t,e),s.setEnd(t,e),this.addRange(s)}containsNode(t,e=!1){if(!t.parentNode)return!1;const s=t.parentNode,r=s.childNodes.indexOf(t),i=s,h=r,o=s,d=r+1;return this.ranges.some(a=>{if(!a.startContainer||!a.endContainer)return!1;const u=p(a.startContainer,a.startOffset,i,h),f=p(a.endContainer,a.endOffset,o,d);if(e){const c=p(a.startContainer,a.startOffset,o,d),C=p(a.endContainer,a.endOffset,i,h);return c<0&&C>0}return u<=0&&f>=0})}clearState(){this.anchorNode=void 0,this.anchorOffset=0,this.focusNode=void 0,this.focusOffset=0,this.isCollapsed=!0}notifyChange(){for(const t of this.listeners)t()}}const T=l((n,t)=>{if(n.length===0||t.start>=t.end)return n;const e=n.clone(),s=Math.max(0,t.start),r=Math.min(n.length,t.end);for(let i=s;i<r;i++)e.setInverted(i,!0);return e},"applySelectionToStyledLine");export{A as Range,L as Selection,T as applySelectionToStyledLine,p as comparePoints};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var tr=Object.defineProperty;var q=(n,o)=>tr(n,"name",{value:o,configurable:!0});import{jsx as M,jsxs as nr}from"react/jsx-runtime";import{useState as U,useRef as d,useCallback as A,useLayoutEffect as B,isValidElement as E,useImperativeHandle as cr,Fragment as G}from"react";import{P as W}from"./measure-element-DSp7YDus.js";import b from"./Box-BwqSvWuq.js";var ur=Object.defineProperty,or=q((n,o)=>ur(n,"name",{value:o,configurable:!0}),"r");const Q=or(n=>{const[o,m]=U(n),s=d(n),H=A(C=>{const S=typeof C=="function"?C(s.current):C;s.current=S,m(S)},[]),v=A(()=>s.current,[]);return[o,H,v]},"useStateRef");var ir=Object.defineProperty,x=q((n,o)=>ir(n,"name",{value:o,configurable:!0}),"b");const lr=x(({children:n,index:o,measureKey:m,onMeasure:s,width:H})=>{const v=d(null);return B(()=>{if(v.current){const{height:C}=W(v.current);s(o,C)}},[o,s,H,m,n]),M(b,{flexDirection:"column",flexShrink:0,ref:v,width:"100%",children:n})},"MeasurableItem"),R=x(n=>{if(n==null)return[];if(Array.isArray(n)){const o=[];for(let m=0;m<n.length;m+=1){const s=n[m];E(s)&&s.type===G?o.push(...R(s.props.children)):o.push(s)}return o}return E(n)&&n.type===G?R(n.props.children):[n]},"toChildArray"),mr=x(({children:n,debug:o=!1,onContentHeightChange:m,onItemHeightChange:s,onViewportSizeChange:H,overscan:v=3,ref:C,scrollOffset:S,virtualize:X=!1,...Y})=>{const $=d(!1),[J,N,V]=Q({height:0,width:0}),[O,D,P]=Q(0),[Z,_]=U({}),j=d(null),K=d(0);B(()=>{O!==K.current&&(m?.(O,K.current),K.current=O)},[O,m]);const i=d({}),h=d([]),p=d([]),f=d(0),rr=A((r,e)=>{const t=h.current[r]??r;if(i.current[t]!==e){const l=i.current[t]??0;i.current={...i.current,[t]:e};let c=0;for(let a=0;a<h.current.length;a+=1){const y=h.current[a];y!=null&&(c+=i.current[y]??0)}const u=P();c!==u&&D(c),s?.(r,e,l),f.current=Math.min(f.current,r+1)}},[s,P,D]),T=A(()=>{if(j.current){const{height:r,width:e}=W(j.current),t=V();(e!==t.width||r!==t.height)&&(H?.({height:r,width:e},t),N({height:r,width:e}))}},[j,H,V,N]);B(()=>{T()});const z=d(null);if(z.current!==n){z.current=n;const r=[],e={};R(n).forEach((c,u)=>{if(!c)return;const a=(E(c)?c.key:null)??u;r[u]=a;const y=i.current[a]??0;e[a]=y}),i.current=e,h.current=r,p.current=Array.from({length:r.length}).fill(0),f.current=0;let t=0;r.forEach(c=>{t+=e[c]??0});const l=P();t!==l&&D(t)}cr(C,()=>({getBottomOffset:x(()=>Math.max(0,P()-V().height),"getBottomOffset"),getContentHeight:P,getItemHeight:x(r=>{const e=h.current[r]??r;return i.current[e]??0},"getItemHeight"),getItemPosition:x(r=>{if(r<0||r>=h.current.length)return null;if(r>=f.current){let l=0,c=0;if(f.current>0){c=f.current;const u=c-1,a=h.current[u]??u,y=i.current[a]??0;l=(p.current[u]??0)+y}for(let u=c;u<=r;u+=1){p.current[u]=l;const a=h.current[u]??u,y=i.current[a]??0;l+=y}f.current=r+1}const e=p.current[r]??0,t=h.current[r]??r;return{height:i.current[t]??0,top:e}},"getItemPosition"),getViewportHeight:x(()=>V().height,"getViewportHeight"),remeasure:T,remeasureItem:x(r=>{_(e=>({...e,[r]:(e[r]??0)+1}))},"remeasureItem")}),[T,P,V,_]);const I=R(n);!$.current&&O>0&&($.current=!0);let w=0,g=I.length-1,F=0,L=0;const er=I.length>0&&I.every((r,e)=>{const t=h.current[e]??e;return(i.current[t]??0)>0}),k=X&&$.current&&er;if(k){const r=h.current.length;if(f.current<r){let t=0,l=0;if(f.current>0){l=f.current;const c=l-1,u=h.current[c]??c,a=i.current[u]??0;t=(p.current[c]??0)+a}for(let c=l;c<r;c+=1){p.current[c]=t;const u=h.current[c]??c;t+=i.current[u]??0}f.current=r}const e=S+J.height;w=I.length,g=-1;for(let t=0;t<r;t+=1){const l=p.current[t]??0,c=h.current[t]??t,u=i.current[c]??0;l+u>S&&l<e&&(t<w&&(w=t),g=t)}if(w>g&&(w=0,g=-1),w=Math.max(0,w-v),g=Math.min(I.length-1,Math.max(-1,g)+v),F=p.current[w]??0,g<I.length-1){const t=h.current[g]??g,l=(p.current[g]??0)+(i.current[t]??0);L=O-l}}return M(b,{...Y,children:M(b,{ref:j,width:"100%",children:M(b,{overflow:o?void 0:"hidden",width:"100%",children:nr(b,{flexDirection:"column",marginTop:-S,width:"100%",children:[k&&F>0&&M(b,{height:F}),I.map((r,e)=>!r||k&&(e<w||e>g)?null:M(lr,{index:e,measureKey:Z[e],onMeasure:rr,width:J.width,children:r},E(r)?r.key??e:e)),k&&L>0&&M(b,{height:L})]})})})})},"ControlledScrollView");export{mr as C,Q as R};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var g=Object.defineProperty;var s=(i,o)=>g(i,"name",{value:o,configurable:!0});import{createDecMode as L,setMode as v,resetMode as S,BracketedPasteMode as O,cursorUp as N,cursorToColumn1 as Y,cursorHide as k,REQUEST_CURSOR_POSITION as z,cursorPosition as m,eraseLine as A,cursorShow as B}from"@visulima/ansi";import{terminalSize as C,Renderer as D}from"./Renderer-DJXooAsp.js";var G=Object.defineProperty,n=s((i,o)=>G(i,"name",{value:o,configurable:!0}),"r");const y=L(2026),_=v(y),j=S(y),H=v(O),Q=S(O);function q(i,o={}){const E=o.rows??10,P=o.fps??60,U=o.onExit??"preserve";let d=null,c=null,l=null,u=80,r=10,h=0,a=1;function e(t){c.writeRaw(t)}s(e,"e"),n(e,"write");function p(){l.fill(0),i(l,u,r,h++),e(_);try{c.render(l)}finally{e(j)}}s(p,"u"),n(p,"tick");function w(t){a=t-r,e(N(r)+Y),c.setRowOffset(a),p(),d=setInterval(()=>{p()},Math.round(1e3/P))}s(w,"E"),n(w,"startRendering");function I(){const t=C();u=t.cols;const x=t.rows;r=Math.min(E,x),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8"),c=new D(u,r),l=new Uint32Array(u*r*2),e(k),e(H),e(`
|
|
2
|
+
`.repeat(r)),e(z),process.on("SIGINT",f);let R="";const M=n(b=>{R+=b;const T=R.match(/\u001B\[(\d+);(\d+)R/);T&&(process.stdin.off("data",M),w(Number.parseInt(T[1],10)))},"onData");process.stdin.on("data",M)}s(I,"P"),n(I,"start");function f(){if(d&&(clearInterval(d),d=null),c){if(U==="destroy"){for(let t=0;t<r;t++)e(m(a+1+t,1)+A);e(m(a+1,1))}else e(m(a+r+1,1));e(Q),e(B)}process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause(),process.exit(0)}return s(f,"f"),n(f,"stop"),{start:I,stop:f}}s(q,"createInlineLoop");n(q,"createInlineLoop");export{q as createInlineLoop};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var u=(e,r)=>i(e,"name",{value:r,configurable:!0});import{useRef as c,useState as d,useEffect as S,useCallback as k}from"react";var p=Object.defineProperty,n=u((e,r)=>p(e,"name",{value:r,configurable:!0}),"t");const v=n(()=>{const e=new Set;let r=!1;return{useLinkedScroll:n(()=>{const l=c(null),[,a]=d(0),f={ref:l,setOffset:n(()=>{a(t=>t+1)},"setOffset")},o=c(f);return o.current=f,S(()=>{const{current:t}=o;return e.add(t),()=>{e.delete(t)}},[]),{onScroll:k(t=>{if(!r){r=!0;try{for(const s of e)s.ref!==l&&s.ref.current?.scrollTo(t)}finally{r=!1}}},[]),ref:l}},"useLinkedScroll")}},"createLinkedScrollGroup");export{v as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var y=Object.defineProperty;var l=(t,e)=>y(t,"name",{value:e,configurable:!0});import{createRequire as S}from"node:module";import{useRef as E,useState as N,useCallback as O}from"react";const _=S(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=l(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,n]=u.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return u.getBuiltinModule(t)}return _(t)},"__cjs_getBuiltinModule"),{readFileSync:h,mkdirSync:v,writeFileSync:w,renameSync:j}=f("node:fs"),{homedir:b}=f("node:os"),m=f("node:path"),g=u;var $=Object.defineProperty,s=l((t,e)=>$(t,"name",{value:e,configurable:!0}),"s");const C=s(()=>{const t=new Map;return{read:s(e=>t.get(e),"read"),write:s((e,n)=>{t.set(e,n)},"write")}},"createMemoryStorage"),M=s(t=>{const e=m.join(b(),".cache","visulima-tui",`${t}.json`),n=s((o,r)=>{const d=r instanceof Error?r.message:String(r);g.stderr.write(`[visulima/tui] persistent-state ${o} failed: ${d}
|
|
2
|
+
`)},"reportError"),i=s(()=>{try{const o=h(e,"utf8"),r=JSON.parse(o);return r&&typeof r=="object"?r:{}}catch(o){const r=o?.code;return r!=="ENOENT"&&r!=="EACCES"&&n("read",o),{}}},"load");return{read:s(o=>i()[o],"read"),write:s((o,r)=>{const d=m.dirname(e),c=`${e}.tmp.${g.pid}`;try{v(d,{recursive:!0});const a=i();a[o]=r,w(c,JSON.stringify(a,null,2),{encoding:"utf8",flag:"w"}),j(c,e)}catch(a){n("write",a)}},"write")}},"createFileStorage"),F=s((t,e,n)=>{const i=t.read(e);if(i===void 0)return n;try{return JSON.parse(i)}catch{return n}},"readInitial"),P=s((t,e,n)=>{const i=E(n?.storage??M(n?.namespace??"tui")),[o,r]=N(()=>F(i.current,t,e)),d=O(c=>{r(a=>{const p=typeof c=="function"?c(a):c;try{i.current.write(t,JSON.stringify(p))}catch{}return p})},[t]);return[o,d]},"usePersistentState");export{M as createFileStorage,C as createMemoryStorage,P as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var u=Object.defineProperty;var n=(t,r)=>u(t,"name",{value:r,configurable:!0});import{strip as i}from"@visulima/ansi";var c=Object.defineProperty,s=n((t,r)=>c(t,"name",{value:r,configurable:!0}),"e");const m=s((t,r)=>{const a=s(e=>e===void 0?"":i(e),"clean");return{contains(e){return this.text().includes(e)},frames(){return r.map(e=>i(e))},line(e){return this.text().split(`
|
|
2
|
+
`)[e]??""},lines(){return this.text().split(`
|
|
3
|
+
`).filter(e=>e.trim()!=="")},matches(e){return e.test(this.text())},rawFrames(){return[...r]},rawText(){return t()??""},text(){return a(t())}}},"createScreen");export{m as createScreen};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as o}from"react";const t=o({setCursorPosition(){}});t.displayName="InternalCursorContext";export{t as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var s=(e,t)=>p(e,"name",{value:t,configurable:!0});import f from"yoga-layout";import{e as c}from"./measure-text-DDjHT1jD.js";import m from"./squashTextNodesWithMap-Cpqmc45i.js";import{wordWrap as C,truncate as v}from"@visulima/string";var x=Object.defineProperty,R=s((e,t)=>x(e,"name",{value:t,configurable:!0}),"R");const u={},T={hard:"STRICT_WIDTH",wrap:"BREAK_WORDS","wrap-anywhere":"BREAK_AT_CHARACTERS","wrap-preserve-words":"PRESERVE_WORDS","wrap-strict":"STRICT_WIDTH"},k=R((e,t,o)=>{const r=e+String(t)+String(o),n=u[r];if(n)return n;let d=e;const N=T[o];if(N)d=C(e,{trim:!1,width:t,wrapMode:N}).replace(/\n$/,"");else if(o.startsWith("truncate")){let i="end";o==="truncate-middle"&&(i="middle"),o==="truncate-start"&&(i="start"),d=v(e,t,{position:i})}return u[r]=d,d},"wrapText");var S=Object.defineProperty,a=s((e,t)=>S(e,"name",{value:t,configurable:!0}),"n");let b=0;const P=a(e=>{const t={attributes:{},childNodes:[],internal_accessibility:{},internal_id:b++,nodeName:e,parentNode:void 0,style:{},yogaNode:e==="ink-virtual-text"||e==="ink-cursor"?void 0:f.Node.create()};return e==="ink-text"&&t.yogaNode?.setMeasureFunc(_.bind(null,t)),t},"createNode"),l=a(e=>{g(e.nodeName==="ink-static-render"&&e.cachedRender?e.parentNode:e)},"markNodeAndParentIfStaticAsDirty"),O=a((e,t)=>{t.parentNode&&y(t.parentNode,t),t.parentNode=e,e.childNodes.push(t),t.yogaNode&&e.yogaNode?.insertChild(t.yogaNode,e.yogaNode.getChildCount()),l(e)},"appendChildNode"),V=a((e,t,o)=>{t.parentNode&&y(t.parentNode,t),t.parentNode=e;const r=e.childNodes.indexOf(o);if(r===-1)e.childNodes.push(t),t.yogaNode&&e.yogaNode?.insertChild(t.yogaNode,e.yogaNode.getChildCount());else if(e.childNodes.splice(r,0,t),t.yogaNode){const n=e.childNodes.slice(0,r).filter(d=>!!d.yogaNode).length;e.yogaNode?.insertChild(t.yogaNode,n)}l(e)},"insertBeforeNode"),y=a((e,t)=>{if(t.yogaNode){const r=t.yogaNode.getParent();r&&r.removeChild(t.yogaNode)}t.parentNode=void 0;const o=e.childNodes.indexOf(t);o!==-1&&e.childNodes.splice(o,1),l(e)},"removeChildNode"),I=a((e,t,o)=>{if(t==="internal_accessibility"){e.internal_accessibility=o;return}e.attributes[t]=o},"setAttribute"),B=a((e,t)=>{e.style=t??{}},"setStyle"),H=a(e=>{const t={nodeName:"#text",nodeValue:e,parentNode:void 0,style:{},yogaNode:void 0};return w(t,e),t},"createTextNode"),_=a(function(e,t){const o=e.nodeName==="#text"?e.nodeValue:m(e),r=c(o);if(r.width<=t||r.width>=1&&t>0&&t<1)return r;const n=e.style?.textWrap??"wrap",d=k(o,Math.floor(t),n);return c(d)},"measureTextNode"),h=a(e=>{if(e?.parentNode)return e.yogaNode??h(e.parentNode)},"findClosestYogaNode"),g=a(e=>{(e?.nodeName==="#text"||e?.nodeName==="ink-text"||e?.nodeName==="ink-virtual-text")&&h(e)?.markDirty();let t=e;for(;t;){if((t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&(t.internal_textCache=void 0),"childNodes"in t){if(t!==e&&t.nodeName==="ink-static-render"&&t.cachedRender)break;t.cachedRender=void 0}t=t.parentNode}},"markNodeAsDirty"),w=a((e,t)=>{typeof t!="string"&&(t=String(t)),e.nodeValue=t,g(e)},"setTextNodeValue"),$=a((e,t)=>e.nodeName!=="ink-root"?()=>{}:(e.internal_layoutListeners??=new Set,e.internal_layoutListeners.add(t),()=>{e.internal_layoutListeners?.delete(t)}),"addLayoutListener"),j=a(e=>{if(!(e.nodeName!=="ink-root"||!e.internal_layoutListeners))for(const t of e.internal_layoutListeners)t()},"emitLayoutListeners"),M=a((e,t)=>{if(e.cachedRender=t,e.yogaNode){for(e.yogaNode.setWidth(t.width),e.yogaNode.setHeight(t.height);e.yogaNode.getChildCount()>0;)e.yogaNode.removeChild(e.yogaNode.getChild(0));e.isYogaTreeDetached=!0}},"setCachedRender"),K=a(e=>{const t=[];let o=e;for(;o;)t.unshift(o),o=o.parentNode;return t},"getPathToRoot"),Y=a(e=>{let t=e;for(;t;){const{userSelect:o}=t.style;if(o==="none")return!1;if(o==="text"||o==="all")return!0;t=t.parentNode}return!0},"isNodeSelectable");export{k as T,$ as a,V as b,P as c,O as d,j as e,H as f,K as g,B as h,Y as i,I as j,M as k,g as m,y as r,w as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as e}from"react";const o=e({activate(){},activeId:void 0,add(){},deactivate(){},disableFocus(){},enableFocus(){},focus(){},focusNext(){},focusPrevious(){},remove(){}});o.displayName="InternalFocusContext";export{o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var r=(a,t)=>i(a,"name",{value:t,configurable:!0});var S=Object.defineProperty,f=r((a,t)=>S(a,"name",{value:t,configurable:!0}),"S");function p(a){const t=Math.max(0,Math.floor(a/1e3)),o=Math.floor(t/3600),n=Math.floor(t%3600/60),e=t%60;return o>0?`${String(o).padStart(2,"0")}:${String(n).padStart(2,"0")}:${String(e).padStart(2,"0")}`:`${String(n).padStart(2,"0")}:${String(e).padStart(2,"0")}`}r(p,"formatDuration");f(p,"formatDuration");export{p as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"yoga-layout";import"./measure-text-DDjHT1jD.js";import"./squashTextNodesWithMap-Cpqmc45i.js";import{a as r,d,c as i,f as m,e as N,g as l,b as p,i as c,m as h,r as n,j as u,k as y,h as L,s as b}from"./dom-4y__5fWB.js";export{r as addLayoutListener,d as appendChildNode,i as createNode,m as createTextNode,N as emitLayoutListeners,l as getPathToRoot,p as insertBeforeNode,c as isNodeSelectable,h as markNodeAsDirty,n as removeChildNode,u as setAttribute,y as setCachedRender,L as setStyle,b as setTextNodeValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var u=(t,e)=>p(t,"name",{value:e,configurable:!0});import l from"yoga-layout";var E=Object.defineProperty,n=u((t,e)=>E(t,"name",{value:e,configurable:!0}),"n");const T=n(t=>{const{yogaNode:e}=t;if(!e)return{scrollHeight:0,scrollWidth:0};const a=e.getComputedBorder(l.EDGE_TOP),d=e.getComputedBorder(l.EDGE_LEFT);let c=a,r=e.getComputedPadding(l.EDGE_LEFT);for(let i=0;i<e.getChildCount();i++){const o=e.getChild(i),h=o.getComputedTop()+o.getComputedHeight()+o.getComputedMargin(l.EDGE_BOTTOM);h>c&&(c=h);const m=o.getComputedLeft()+o.getComputedWidth()+o.getComputedMargin(l.EDGE_RIGHT);m>r&&(r=m)}const s=c-a+e.getComputedPadding(l.EDGE_BOTTOM),g=r-d+e.getComputedPadding(l.EDGE_RIGHT);return{scrollHeight:Math.round(s),scrollWidth:Math.round(g)}},"calculateScrollDimensions"),C=n(t=>Math.round(t.internal_scrollState?.scrollHeight??0),"getScrollHeight"),M=n(t=>Math.round(t.internal_scrollState?.scrollWidth??0),"getScrollWidth"),f=n(t=>{const{yogaNode:e}=t;if(!e)return;const{scrollHeight:a,scrollWidth:d}=T(t);let c=a;const r=Math.max(0,e.getComputedHeight()-e.getComputedBorder(l.EDGE_TOP)-e.getComputedBorder(l.EDGE_BOTTOM));if(t.style.stableScrollback&&t.style.overflowToBackbuffer){const o=Math.max(0,a-r);t.internal_isScrollbackDirty?(t.internal_maxScrollTop=o,t.internal_isScrollbackDirty=!1):t.internal_maxScrollTop=Math.max(t.internal_maxScrollTop??0,o),c=Math.max(a,(t.internal_maxScrollTop??0)+r)}const s=Math.max(0,Math.min(t.style.scrollTop??0,c-r)),g=Math.max(0,e.getComputedWidth()-e.getComputedBorder(l.EDGE_LEFT)-e.getComputedBorder(l.EDGE_RIGHT)),i=Math.max(0,Math.min(t.style.scrollLeft??0,d-g));t.internal_scrollState={actualScrollHeight:a,clientHeight:r,clientWidth:g,scrollHeight:c,scrollLeft:i,scrollTop:s,scrollWidth:d}},"calculateScroll"),D=n(t=>Math.round(t.internal_scrollState?.scrollTop??0),"getScrollTop"),G=n(t=>Math.round(t.internal_scrollState?.scrollLeft??0),"getScrollLeft");export{f as calculateScroll,C as getScrollHeight,G as getScrollLeft,D as getScrollTop,M as getScrollWidth};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var r=(e,t)=>n(e,"name",{value:t,configurable:!0});var o=Object.defineProperty,a=r((e,t)=>o(e,"name",{value:t,configurable:!0}),"r");const s=/^[a-z]$/i,c=a(e=>{const t=e.codePointAt(0);return t!==void 0&&(t<32||t===127)},"isControlCharacter"),l=a((e,t)=>e.length===0||c(e)?!1:t.ctrl&&t.meta?!s.test(e):!(t.ctrl||t.meta),"isInsertableInput");export{l as i};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
declare class TuiApp extends EventEmitter {
|
|
3
|
+
private renderer;
|
|
4
|
+
private terminal;
|
|
5
|
+
private backBuffer;
|
|
6
|
+
private width;
|
|
7
|
+
private height;
|
|
8
|
+
private isRunning;
|
|
9
|
+
private stdoutBuffer;
|
|
10
|
+
private stderrBuffer;
|
|
11
|
+
constructor();
|
|
12
|
+
/** Enters raw mode + alternate screen. Does NOT start any render loop. */
|
|
13
|
+
start(): void;
|
|
14
|
+
/** Request a clean exit — restores terminal, stops input, exits the process. */
|
|
15
|
+
quit(): void;
|
|
16
|
+
/** Exits raw mode + alternate screen, then flushes any buffered stdout/stderr. */
|
|
17
|
+
stop(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Buffer a write to stdout. While the alternate screen is active, writing
|
|
20
|
+
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
21
|
+
*/
|
|
22
|
+
writeStdout(text: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Buffer a write to stderr. While the alternate screen is active, writing
|
|
25
|
+
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
26
|
+
*/
|
|
27
|
+
writeStderr(text: string): void;
|
|
28
|
+
/** Returns the shared Uint32Array back-buffer (width * height * 2 u32 cells). */
|
|
29
|
+
getBuffer(): Uint32Array;
|
|
30
|
+
/** Returns current terminal dimensions. */
|
|
31
|
+
getSize(): {
|
|
32
|
+
height: number;
|
|
33
|
+
width: number;
|
|
34
|
+
};
|
|
35
|
+
/** Update terminal dimensions (called on SIGWINCH). */
|
|
36
|
+
resize(width: number, height: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Callbacks fired on every frame after React paints the buffer but before
|
|
39
|
+
* the Rust diff engine flushes to stdout. Use for direct buffer painting
|
|
40
|
+
* that needs to overlay React output (animated graphs, overlays, FPS counters).
|
|
41
|
+
* Multiple listeners are supported — they fire in registration order.
|
|
42
|
+
*/
|
|
43
|
+
private beforeFlushListeners;
|
|
44
|
+
onBeforeFlush(function_: (buffer: Uint32Array, width: number, height: number) => void): () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Layout + paint synchronously. Called from the render loop on every dirty frame,
|
|
47
|
+
* and directly on resize for immediate response.
|
|
48
|
+
*/
|
|
49
|
+
paintNow(calculateLayout: (w: number, h: number) => void, renderToBuffer: (buf: Uint32Array, w: number, h: number) => void): void;
|
|
50
|
+
}
|
|
51
|
+
interface InlineOptions {
|
|
52
|
+
/** Frames per second. Default: 60 */
|
|
53
|
+
fps?: number;
|
|
54
|
+
/**
|
|
55
|
+
* What to do with the rendered content when the loop stops.
|
|
56
|
+
* - 'preserve' (default) — content stays in terminal scrollback
|
|
57
|
+
* - 'destroy' — content is cleared, terminal looks untouched
|
|
58
|
+
*/
|
|
59
|
+
onExit?: "preserve" | "destroy";
|
|
60
|
+
/** Number of terminal rows to reserve. Default: 10 */
|
|
61
|
+
rows?: number;
|
|
62
|
+
}
|
|
63
|
+
type InlinePaintFn = (buf: Uint32Array, cols: number, rows: number, frame: number) => void;
|
|
64
|
+
interface InlineLoop {
|
|
65
|
+
start: () => void;
|
|
66
|
+
stop: () => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create an inline render loop. Renders `rows` lines immediately below the
|
|
70
|
+
* current cursor position (no alternate screen).
|
|
71
|
+
*/
|
|
72
|
+
declare function createInlineLoop(paint: InlinePaintFn, options?: InlineOptions): InlineLoop;
|
|
73
|
+
interface MouseEvent {
|
|
74
|
+
button: "left" | "right" | "middle" | "scrollUp" | "scrollDown";
|
|
75
|
+
ctrl: boolean;
|
|
76
|
+
meta: boolean;
|
|
77
|
+
shift: boolean;
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
}
|
|
81
|
+
declare class InputParser extends EventEmitter {
|
|
82
|
+
private stdin;
|
|
83
|
+
private _boundHandleData;
|
|
84
|
+
private _pasteBuffer;
|
|
85
|
+
constructor(stdin: NodeJS.ReadStream);
|
|
86
|
+
start(): void;
|
|
87
|
+
stop(): void;
|
|
88
|
+
private handleData;
|
|
89
|
+
}
|
|
90
|
+
export { InlineLoop as I, MouseEvent as M, TuiApp as T, InlineOptions as a, InlinePaintFn as b, InputParser as c, createInlineLoop as d };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var n=(e,t)=>s(e,"name",{value:t,configurable:!0});var u=Object.defineProperty,l=n((e,t)=>u(e,"name",{value:t,configurable:!0}),"s");const f=l(({element:e,mouse:{x:t,y:r}})=>{const a=t<e.left||t>=e.left+e.width,o=r<e.top||r>=e.top+e.height;return!a&&!o},"isIntersecting");export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var c=(r,e)=>n(r,"name",{value:e,configurable:!0});var i=Object.defineProperty,s=c((r,e)=>i(r,"name",{value:e,configurable:!0}),"e");const a=new Set(["Alacritty","contour","foot","Ghostty","iTerm2","iTerm.app","kitty","rio","WezTerm"]),f=s(()=>{const r=process.env.TERM_PROGRAM??"";if(a.has(r))return!0;const e=process.env.TERM??"";return!!(e.startsWith("xterm")||process.env.WT_SESSION||process.env.TMUX||e.startsWith("screen"))},"isOsc52Supported"),p=new Set(["c","p","s"]),O=s((r,e,t="c")=>{if(!p.has(t))throw new Error(`Invalid clipboard target: ${t}`);const o=Buffer.from(e,"utf8").toString("base64");r.write(`\x1B]52;${t};${o}\x07`)},"writeOsc52"),v=s((r,e="c")=>{r.write(`\x1B]52;${e};\x07`)},"clearOsc52");export{v as clearOsc52,f as isOsc52Supported,O as writeOsc52};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var x=Object.defineProperty;var m=(t,r)=>x(t,"name",{value:r,configurable:!0});var T=Object.defineProperty,c=m((t,r)=>T(t,"name",{value:r,configurable:!0}),"i");const p=c(t=>{const r=/rgb:([\da-f]{2,4})\/([\da-f]{2,4})\/([\da-f]{2,4})/i.exec(t);if(!r)return null;const o=c(n=>n.length<=2?n.padStart(2,"0"):n.slice(0,2),"toHex");return`#${o(r[1])}${o(r[2])}${o(r[3])}`},"parseOscColorResponse"),h=c(()=>{const t=process.env.TERM_PROGRAM??"";return new Set(["Alacritty","contour","foot","Ghostty","iTerm2","iTerm.app","kitty","rio","WezTerm"]).has(t)?!0:(process.env.TERM??"").startsWith("xterm")||!!process.env.WT_SESSION},"isTerminalPaletteQuerySupported"),y=256,f=c((t,r,o,n=500)=>new Promise(i=>{let s="",l;const a=c(()=>{l&&clearTimeout(l),t.removeListener("data",e)},"cleanup"),e=c(u=>{if(s+=u.toString(),s.length>y){a(),i(null);return}(s.includes("\x07")||s.includes("\x1B\\"))&&(a(),i(s))},"onData");l=setTimeout(()=>{a(),i(null)},n),t.on("data",e),r.write(o)}),"queryOsc"),S=c(async(t,r,o=500)=>{const n={},i=await f(t,r,"\x1B]10;?\x07",o);if(i){const e=p(i);e&&(n.foreground=e)}const s=await f(t,r,"\x1B]11;?\x07",o);if(s){const e=p(s);e&&(n.background=e)}const l=await f(t,r,"\x1B]12;?\x07",o);if(l){const e=p(l);e&&(n.cursor=e)}const a=[];for(let e=0;e<16;e++){const u=await f(t,r,`\x1B]4;${e};?\x07`,o);if(u){const d=p(u);a.push(d??"")}else a.push("")}return a.some(e=>e.length>0)&&(n.colors=a),n},"queryTerminalPalette");export{h as isTerminalPaletteQuerySupported,S as queryTerminalPalette};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var r=(t,e)=>o(t,"name",{value:e,configurable:!0});var a=Object.defineProperty,c=r((t,e)=>a(t,"name",{value:e,configurable:!0}),"o");const l={disambiguateEscapeCodes:1,reportAllKeysAsEscapeCodes:8,reportAlternateKeys:4,reportAssociatedText:16,reportEventTypes:2};function n(t){let e=0;for(const s of t)e|=l[s];return e}r(n,"resolveFlags");c(n,"resolveFlags");const i={alt:2,capsLock:64,ctrl:4,hyper:16,meta:32,numLock:128,shift:1,super:8};export{l as kittyFlags,i as kittyModifiers,n as resolveFlags};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T=Object.defineProperty;var I=(e,o)=>T(e,"name",{value:o,configurable:!0});import{jsxs as f,jsx as h}from"react/jsx-runtime";import{useMemo as g}from"react";import{c as E}from"./braille-BBjIoaN0.js";import u from"./Box-BwqSvWuq.js";import b from"./Canvas-CKg6WV47.js";import d from"./Text-mTAve9R2.js";var P=Object.defineProperty,y=I((e,o)=>P(e,"name",{value:o,configurable:!0}),"i");const w=["cyan","magenta","yellow","green","blue","red"],v=y(e=>e.length===0?[]:typeof e[0]=="number"?e.map((o,t)=>({x:t,y:o})):e,"toPoints"),C=y((e,o,t)=>e.color??t[o%t.length]??"cyan","pickSeriesColor"),Y=y(e=>{let o=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const{points:l}of e)for(const r of l)r.x<o&&(o=r.x),r.x>t&&(t=r.x),r.y<n&&(n=r.y),r.y>s&&(s=r.y);return{xMax:t,xMin:o,yMax:s,yMin:n}},"computeExtents");var _=Object.defineProperty,N=I((e,o)=>_(e,"name",{value:o,configurable:!0}),"x");const F=w,M=N((e,o,t,n)=>{const s=o.xMax-o.xMin||1,l=o.yMax-o.yMin||1,r=(e.x-o.xMin)/s,x=(e.y-o.yMin)/l;return{px:Math.max(0,Math.min(t-1,Math.round(r*(t-1)))),py:Math.max(0,Math.min(n-1,Math.round((1-x)*(n-1))))}},"projectPoint"),S=N((e,o,t)=>{e.clear();const{axisColor:n,seriesList:s}=t,l=Math.max(1,e.width*2),r=Math.max(1,e.height*4);for(let x=0;x<e.width;x+=2)e.setCell(x,e.height-1,"·",{color:n,dim:!0});for(const{color:x,points:p}of s){if(p.length===0)continue;const c=E(e.width,e.height);if(o==="scatter")for(const i of p){const a=M(i,t,l,r);c.plotPoint(a.px,a.py)}else{let i=M(p[0],t,l,r);c.plotPoint(i.px,i.py);for(let a=1;a<p.length;a+=1){const m=M(p[a],t,l,r);c.plotLine(i.px,i.py,m.px,m.py),i=m}}c.flush(e,{color:x})}},"drawSeriesOnCanvas");function L({axisColor:e="gray",height:o=10,maxY:t,minY:n,palette:s=F,series:l,showLegend:r=!0,width:x=40}){const p=g(()=>{const c=l.map((a,m)=>({color:C(a,m,s),points:v(a.data),series:a})),i=Y(c);return{axisColor:e,palette:s,seriesList:c,xMax:i.xMax===Number.NEGATIVE_INFINITY?1:i.xMax,xMin:i.xMin===Number.POSITIVE_INFINITY?0:i.xMin,yMax:t??(i.yMax===Number.NEGATIVE_INFINITY?1:i.yMax),yMin:n??(i.yMin===Number.POSITIVE_INFINITY?0:i.yMin)}},[l,e,s,n,t]);return f(u,{flexDirection:"column",children:[h(b,{draw:I(c=>{S(c,"line",p)},"draw"),height:o,version:[l,x,o,n,t,e,s],width:x}),r?h(u,{gap:2,marginTop:1,children:p.seriesList.map(({color:c,series:i},a)=>f(u,{gap:1,children:[h(d,{color:c,children:"●"}),h(d,{children:i.label??`Series ${a+1}`})]},`${a}:${i.label??""}`))}):void 0]})}I(L,"E");N(L,"LineChart");export{w as D,L as E,M as a,Y as c,S as d,C as p,v as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var F=Object.defineProperty;var M=(t,e)=>F(t,"name",{value:e,configurable:!0});import l from"yoga-layout";import{getScrollTop as k,getScrollLeft as W}from"./getScrollHeight-BTEY8ewu.js";import Y from"./squashTextNodesWithMap-Cpqmc45i.js";var A=Object.defineProperty,_=M((t,e)=>A(t,"name",{value:e,configurable:!0}),"a");const O=_(t=>{let e=t,o=0,r=0;for(;e?.parentNode;){if(!e.yogaNode)return;o+=e.yogaNode.getComputedLeft(),r+=e.yogaNode.getComputedTop(),e=e.parentNode}return{x:o,y:r}},"getAbsoluteBorderPosition"),$=_(t=>O(t),"getAbsolutePosition"),Q=_(t=>{const e=O(t);if(!(!e||!t.yogaNode))return{x:e.x+t.yogaNode.getComputedBorder(l.EDGE_LEFT)+t.yogaNode.getComputedPadding(l.EDGE_LEFT),y:e.y+t.yogaNode.getComputedBorder(l.EDGE_TOP)+t.yogaNode.getComputedPadding(l.EDGE_TOP)}},"getAbsoluteContentPosition"),Z=_((t,e)=>{const{initialState:o,onNewline:r,onSpace:s,onText:n}=e;if(t.nodeName!=="ink-box"&&t.nodeName!=="ink-root"&&t.nodeName!=="ink-text"&&t.nodeName!=="ink-virtual-text"||!t.yogaNode)return{lineBottom:0,state:o()};const{fragments:d}=j(t),a=o();a.currentX=0,a.lineBottom=0,a.yieldedContent=!1;for(const i of d){if(i.y>=a.lineBottom){const g=i.y-a.lineBottom,u=a.yieldedContent?1+g:g;u>0&&(r(u,a),a.currentX=0),a.lineBottom=i.y}if(i.x>a.currentX){const g=i.x-a.currentX;s(g,a),a.currentX=i.x}if(i.text.length>0&&(a.yieldedContent=!0,n(i,a)),(i.text.match(/\n/g)??[]).length>0){const g=i.text.lastIndexOf(`
|
|
2
|
+
`);a.currentX=i.text.length-g-1}else a.currentX+=i.text.length;a.lineBottom=Math.max(a.lineBottom,i.y+i.height)}return{lineBottom:a.lineBottom,state:a}},"processLayout");var V=Object.defineProperty,c=M((t,e)=>V(t,"name",{value:e,configurable:!0}),"u");const tt=c(t=>{const e=$(t);return{height:Math.round(t.yogaNode?.getComputedHeight()??0),width:Math.round(t.yogaNode?.getComputedWidth()??0),x:Math.round(e?.x??0),y:Math.round(e?.y??0)}},"measureElement"),et=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedWidth()??0,r=e.getComputedBorder(l.EDGE_LEFT),s=e.getComputedBorder(l.EDGE_RIGHT);return Math.round(o-r-s)},"getInnerWidth"),ot=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedHeight()??0,r=e.getComputedBorder(l.EDGE_TOP),s=e.getComputedBorder(l.EDGE_BOTTOM);return Math.round(o-r-s)},"getInnerHeight"),L=c(t=>{const{yogaNode:e}=t;if(!e)return{height:0,width:0,x:0,y:0};const o=e.getComputedWidth()??0,r=e.getComputedHeight()??0;let s=e.getComputedLeft(),n=e.getComputedTop(),d=t.parentNode;for(;d?.yogaNode;){if(s+=d.yogaNode.getComputedLeft(),n+=d.yogaNode.getComputedTop(),d.nodeName==="ink-box"){const a=d.style.overflow??"visible",i=d.style.overflowX??a;(d.style.overflowY??a)==="scroll"&&(n-=k(d)),i==="scroll"&&(s-=W(d))}d=d.parentNode}return{height:Math.round(r),width:Math.round(o),x:Math.round(s),y:Math.round(n)}},"getBoundingBox"),nt=c(t=>{const e=t.internal_scrollState?.scrollHeight??0,o=t.internal_scrollState?.actualScrollHeight??0;return Math.max(0,e-o)},"getAddedScrollHeight"),G=c(t=>{const{axis:e,clientDimension:o,scrollbarDimension:r,scrollDimension:s,scrollPosition:n}=t,d=r*2,a=Math.max(e==="vertical"?2:1,Math.round(o/s*d)),i=s-o,g=d-a,u=i>0?Math.round(n/i*g):0,m=u,h=u+a,p=Math.floor(m/2);return{endIndex:Math.min(r,Math.ceil(h/2)),startIndex:p,thumbEndHalf:h,thumbStartHalf:m}},"calculateScrollbarThumb"),P=c(t=>{const{axis:e,clientDimension:o,hasOppositeScrollbar:r,height:s,marginBottom:n,marginRight:d,scrollDimension:a,scrollPosition:i,width:g,x:u,y:m}=t;if(a<=o)return;if(e==="vertical"){const{endIndex:x,startIndex:B,thumbEndHalf:v,thumbStartHalf:D}=G({axis:e,clientDimension:o,scrollbarDimension:s,scrollDimension:a,scrollPosition:i}),E=u+g-1-d;return{height:s,thumb:{end:x,endHalf:v,height:x-B,start:B,startHalf:D,width:1,x:E,y:m+B},width:1,x:E,y:m}}const h=g-(r?1:0),{endIndex:p,startIndex:y,thumbEndHalf:C,thumbStartHalf:f}=G({axis:e,clientDimension:o,scrollbarDimension:h,scrollDimension:a,scrollPosition:i}),T=m+s-1-n;return{height:1,thumb:{end:p,endHalf:C,height:1,start:y,startHalf:f,width:p-y,x:u+y,y:T},width:h,x:u,y:T}},"calculateScrollbarLayout"),rt=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowY??r)!=="scroll")return;const s=t.internal_scrollState?.clientHeight??0,n=t.internal_scrollState?.scrollHeight??0;if(n<=s)return;const{x:d,y:a}=e??L(t),i=o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP)-o.getComputedBorder(l.EDGE_BOTTOM);return P({axis:"vertical",clientDimension:s,hasOppositeScrollbar:!1,height:i,marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollTop??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getVerticalScrollbarBoundingBox"),at=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowX??r)!=="scroll")return;const s=t.internal_scrollState?.clientWidth??0,n=t.internal_scrollState?.scrollWidth??0;if(n<=s)return;const{x:d,y:a}=e??L(t),i=t.style.overflowY??r,g=t.internal_scrollState?.clientHeight??0,u=t.internal_scrollState?.scrollHeight??0,m=i==="scroll"&&u>g;return P({axis:"horizontal",clientDimension:s,hasOppositeScrollbar:m,height:o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP),marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollLeft??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT)-o.getComputedBorder(l.EDGE_RIGHT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getHorizontalScrollbarBoundingBox"),it=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedTop(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedTop()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeTop"),lt=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedLeft(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedLeft()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeLeft"),z=c(t=>t.nodeName==="#text"?t.nodeValue:t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text"?Y(t):"","getText"),j=c(t=>{const e=[],o=c((n,d,a)=>{const{visualX:i,visualY:g,x:u,y:m}=d;let h=0,p=0,y=a;const{userSelect:C}=n.style;if(C==="none"?y=!1:(C==="text"||C==="all")&&(y=!0),n.nodeName==="ink-text"||n.nodeName==="ink-virtual-text"){if(y){const f=z(n);return e.push({height:Math.round(n.yogaNode?.getComputedHeight()??0),node:n,text:f,visualX:Math.round(i),visualY:Math.round(g),width:Math.round(n.yogaNode?.getComputedWidth()??0),x:Math.round(u),y:Math.round(m)}),{h:0,hasContent:!0,v:0}}return{h:n.yogaNode?.getComputedWidth()??0,hasContent:!1,v:n.yogaNode?.getComputedHeight()??0}}if(n.nodeName==="ink-box"||n.nodeName==="ink-root"){if(!n.yogaNode||n.yogaNode.getDisplay()===l.DISPLAY_NONE)return{h:0,hasContent:!1,v:0};const f=n.yogaNode.getComputedBorder(l.EDGE_TOP),T=n.yogaNode.getComputedBorder(l.EDGE_BOTTOM),x=n.yogaNode.getComputedBorder(l.EDGE_LEFT),B=n.yogaNode.getComputedBorder(l.EDGE_RIGHT);h+=f+T,p+=x+B;const v=n.yogaNode.getFlexDirection(),D=v===l.FLEX_DIRECTION_COLUMN||v===l.FLEX_DIRECTION_COLUMN_REVERSE;let E=0,b=0,S=!1;for(const N of n.childNodes)if(N.yogaNode){const w=u+N.yogaNode.getComputedLeft()-x-E,I=m+N.yogaNode.getComputedTop()-f-b,R=i+N.yogaNode.getComputedLeft(),X=g+N.yogaNode.getComputedTop(),H=o(N,{visualX:R,visualY:X,x:w,y:I},y);H.hasContent&&(S=!0),D?b+=H.v:E+=H.h}return D?h+=b:p+=E,{h:p,hasContent:S,v:h}}return{h:0,hasContent:!1,v:0}},"collect"),{h:r,v:s}=o(t,{visualX:0,visualY:0,x:0,y:0},!0);return e.sort((n,d)=>n.y!==d.y?n.y-d.y:n.x-d.x),{fragments:e,removedHorizontal:Math.round(r),removedVertical:Math.round(s)}},"collectSortedFragments");export{tt as P,G as a,j as b,P as c,L as d,at as e,ot as f,nt as g,et as h,lt as i,it as j,z as k,rt as l,Q as m,$ as n,Z as p};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var X=Object.defineProperty;var k=(r,t)=>X(r,"name",{value:t,configurable:!0});import{isFullwidthCodePoint as Y,getStringWidth as Z}from"@visulima/string";import{t as tt}from"./ansi-tokenizer-DqX9nJuk.js";var et=Object.defineProperty,st=k((r,t)=>et(r,"name",{value:t,configurable:!0}),"r$1");let H=class{static{k(this,"h")}static{st(this,"DataLimitedLruMap")}map;maxDataSize;maxKeys;currentDataSize=0;constructor(t,e){this.map=new Map,this.maxKeys=t,this.maxDataSize=e}get size(){return this.map.size}clear(){this.map.clear(),this.currentDataSize=0}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){const s=t.length;if(!(s>this.maxDataSize)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const at=1,nt=2,K=4,j=8,R=16,M=32,V=64,x=128;var rt=Object.defineProperty,it=k((r,t)=>rt(r,"name",{value:t,configurable:!0}),"x");const p=1073741823,C=1073741824;class d{static{k(this,"StyledLine")}static{it(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;s.length=t,s.text=" ".repeat(t),s.charData=Array.from({length:t});for(let a=0;a<t;a++)s.charData[a]=a;return s.spans=[{formatFlags:0,length:t}],s._cachedTrimmedLength=0,Object.freeze(s.spans[0]),Object.freeze(s.spans),Object.freeze(s),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p:this.text.length;return this.text.slice(e,s)}getTextRange(t,e){if(this.text===void 0||t<0||e>this.length||t>=e)return"";const s=this.charData[t]&p,a=e<this.length?this.charData[e]&p:this.text.length;return this.text.slice(s,a)}getSpan(t){if(this.spans===void 0||t<0||t>=this.length)return;let e=0;for(const s of this.spans){if(t<e+s.length)return s;e+=s.length}}getFullWidth(t){return this.charData===void 0||t<0||t>=this.length?!1:(this.charData[t]&C)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~x)!==0||e.fgColor!==void 0||e.bgColor!==void 0||e.link!==void 0:!1}getFormatFlags(t){let e=this.getSpan(t)?.formatFlags??0;return this.getFullWidth(t)&&(e|=x),e}getFgColor(t){return this.getSpan(t)?.fgColor}getBgColor(t){return this.getSpan(t)?.bgColor}getLink(t){return this.getSpan(t)?.link}setInverted(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{e?s.formatFlags|=M:s.formatFlags&=~M})}setBackgroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.bgColor=e})}setForegroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.fgColor=e})}setChar(t,e,s,a,n,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&x)!==0,o=s&~x,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let S=t+1;S<this.length;S++){const T=this.charData[S],w=T&p,L=T&C;this.charData[S]=w+f|L}}if(this.charData[t]=l|(i?C:0),this.trySetStyleAtIndex(t,o,a,n,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const S=this.spans[f];if(u===t&&S.length===1){this.spans[f]={bgColor:n,fgColor:a,formatFlags:o,length:1,link:h};break}u+=S.length}this.mergeSpans()}setCharFast(t,e,s,a,n,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&x)!==0,o=s&~x,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?C:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const S=this.charData[f];this.charData[f]=(S&p)+u|S&C}}this.charData[t]=l|(i?C:0)}if(this.trySetStyleAtIndex(t,o,a,n,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:n,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const n=a??e.length-s;if(n<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(n,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?C:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&C}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,P=Math.max(s,f),E=Math.min(s+h,D);if(P<E&&u.push({...g,length:E-P}),f=D,f>=s+h)break}let S=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){S=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=S;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(S,w,...u),this.mergeSpans()}pushChar(t,e,s,a,n){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&x)!==0,i=e&~x,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?C:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===n?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:n}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;return t.length=this.length,t.text=this.text,t.charData=[...this.charData],t.spans=this.spans.map(e=>({...e})),t._cachedTrimmedLength=this._cachedTrimmedLength,t}slice(t,e){if(this.charData===void 0)return new d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const n=new d;n.length=a-s,n.charData=Array.from({length:n.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;n.text=this.text.slice(h,i);for(let c=0;c<n.length;c++){const m=this.charData[s+c],b=m&p,u=m&C;n.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return n.spans=o,n.mergeSpans(),n}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let n=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&C;a.charData[n+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[n+c]=h+c;n+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),a.mergeSpans(),a}getTrimmedLength(){if(this._cachedTrimmedLength!==void 0)return this._cachedTrimmedLength;if(this.length===0)return this._cachedTrimmedLength=0,0;if(this.text===void 0||this.charData===void 0)return this._cachedTrimmedLength=0,0;let t=this.length-1;if(this.spans)for(let e=this.spans.length-1;e>=0;e--){const s=this.spans[e];if((s.formatFlags&~x)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const n=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-n!==1||this.text[n]!==" ")return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;t--}}return this._cachedTrimmedLength=0,0}trimEnd(){const t=this.getTrimmedLength();return t===this.length?this:t===0?new d:this.slice(0,t)}equals(t){if(this.length!==t.length)return!1;if(this.length===0)return!0;if(this.getText()!==t.getText())return!1;const e=this.getSpans(),s=t.getSpans();if(e.length!==s.length)return!1;for(const[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,n=t.charData;if(a&&n){for(let h=0;h<this.length;h++)if(a[h]!==n[h])return!1}return!0}getText(){return this.text??""}getSpans(){return this.spans??[]}getValues(){return Array.from({length:this.length},(t,e)=>this.getValue(e))}*[Symbol.iterator](){if(this.length===0)return;let t=0,e=0;const s=this.getSpans();for(let a=0;a<this.length;a++){const n=s[t],h=n?n.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:n?.bgColor,fgColor:n?.fgColor,formatFlags:h|(i?x:0),fullWidth:i,hasStyles:(h&~x)!==0||n?.fgColor!==void 0||n?.bgColor!==void 0||n?.link!==void 0,link:n?.link,value:this.getValue(a)},n&&(e++,e>=n.length&&(t++,e=0))}}updateSpanAt(t,e){if(t<0||t>=this.length)return;this.ensureInitialized(),this.splitSpansAt(t),this.splitSpansAt(t+1);let s=0;for(const a of this.spans){if(s===t&&a.length===1){e(a);break}s+=a.length}this.mergeSpans()}ensureWidth(t){if(t<=this.length)return;this.ensureInitialized();const e=this.length,s=t-e,a=this.text.length;for(let h=0;h<s;h++)this.charData.push(a);this.length=t;const n=this.spans.at(-1);n?.formatFlags===0&&n.fgColor===void 0&&n.bgColor===void 0&&n.link===void 0?n.length+=s:this.spans.push({formatFlags:0,length:s})}ensureInitialized(){if(this.charData===void 0&&(this.text="",this.charData=Array.from({length:this.length}),this.spans=this.length>0?[{formatFlags:0,length:this.length}]:[],this.length>0&&this.text.length===0)){this.text=" ".repeat(this.length);for(let t=0;t<this.length;t++)this.charData[t]=t}}splitSpansAt(t){if(this.spans===void 0||t<=0||t>=this.length)return;let e=0;for(let s=0;s<this.spans.length;s++){const a=this.spans[s];if(t>e&&t<e+a.length){const n=t-e,h=a.length-n;this.spans.splice(s,1,{...a,length:n},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,n){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===n)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}return!1}mergeSpans(){if(this.spans===void 0)return;const t=[];for(const e of this.spans){if(e.length===0)continue;const s=t.at(-1);s?.formatFlags===e.formatFlags&&s.fgColor===e.fgColor&&s.bgColor===e.bgColor&&s.link===e.link?s.length+=e.length:t.push({...e})}this.spans=t}}var ht=Object.defineProperty,I=k((r,t)=>ht(r,"name",{value:t,configurable:!0}),"u$1");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Nt=I(r=>{const t=G[r];if(t!==void 0)return t;const e=U[r];if(e!==void 0)return e;const s=q.exec(r);if(s)return Number(s[1])&255;if(r.startsWith("#")&&r.length===7){const n=Number.parseInt(r.slice(1,3),16),h=Number.parseInt(r.slice(3,5),16),i=Number.parseInt(r.slice(5,7),16);return 16+36*Math.round(n/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(r);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),lt=I((r,t)=>{const e=t?30:40,s=G[r];if(s!==void 0)return[e+s];const a=U[r];if(a!==void 0)return[e+60+(a-8)];if(r.startsWith("#")&&r.length===7){const i=Number.parseInt(r.slice(1,3),16),o=Number.parseInt(r.slice(3,5),16),l=Number.parseInt(r.slice(5,7),16);return[t?38:48,2,i,o,l]}const n=q.exec(r);if(n)return[t?38:48,5,Number(n[1])];const h=J.exec(r);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");I((r,t)=>{const e=lt(r,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=I(r=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return r>=0&&r<=7?t[r]:`ansi256(${r})`},"ansi256ToColorName");var ot=Object.defineProperty,y=k((r,t)=>ot(r,"name",{value:t,configurable:!0}),"u");const _=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),ct=y((r,t)=>{if(t.length===0)return _();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:n,link:h}=r,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{n=0,a=void 0,s=void 0,h=void 0;break}case 1:{n|=at;break}case 2:{n|=nt;break}case 3:{n|=K;break}case 4:{n|=j;break}case 7:{n|=M;break}case 8:{n|=V;break}case 9:{n|=R;break}case 22:{n&=-4;break}case 23:{n&=~K;break}case 24:{n&=~j;break}case 27:{n&=~M;break}case 28:{n&=~V;break}case 29:{n&=~R;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:n,link:h}},"applySgrParams"),z=127462,N=127487,gt=127995,ft=127999,ut=8205,dt=917504,mt=917631,pt=new RegExp("\\p{Mark}","u"),bt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),St=y((r,t)=>!!(Y(t)||r.includes("️")||t>=z&&t<=N),"isFullwidthGrapheme"),xt=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,Ct=y(r=>{const t=xt.exec(r);return!t?.[2]||t[2].length===0?void 0:r.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((r,t,e)=>{const s=bt.segment(r),a=[];for(const{segment:n}of s)a.push(n);for(let n=0;n<a.length;n++){let h=a[n];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=z&&i<=N&&n+1<a.length){const l=a[n+1],c=l.codePointAt(0);c&&c>=z&&c<=N&&(h+=l,n++)}else for(;n+1<a.length;){const l=a[n+1],c=l.codePointAt(0);if(!c)break;const m=pt.test(String.fromCodePoint(c)),b=c>=gt&&c<=ft,u=c===ut,f=c>=dt&&c<=mt;if(!m&&!b&&!u&&!f)break;h+=l,n++,u&&n+1<a.length&&(h+=a[n+1],n++)}const o=St(h,i)?e.formatFlags|x:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),vt=y(r=>{if(r.length===0)return new d;const t=tt(r),e=new d;let s=_();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=ct(s,a.parameterString));break}case"osc":{const n=Ct(a.value);n!==void 0?s={...s,link:n}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),kt=/^[\u0020-\u007E]*$/,$t=y(r=>{if(r.length===0)return new d;const t=new d;if(kt.test(r)){for(const e of r)t.pushChar(e,0);return t}return Q(r,t,_()),t},"plainTextToStyledLine");var Dt=Object.defineProperty,v=k((r,t)=>Dt(r,"name",{value:t,configurable:!0}),"r");const $=new H(1e4,1e6),W=new Map,F=new H(1e4,1e6);let B=!0,O=Z;const Wt=v(r=>{B=r,r||F.clear()},"setEnableStyledLineCache"),Bt=v(()=>{F.clear()},"clearStyledLineCache"),_t=v(r=>{O=r,yt()},"setStringWidthFunction"),yt=v(()=>{$.clear(),W.clear(),F.clear()},"clearStringWidthCache"),Tt=v(r=>{if(r.length===1){const s=r.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=W.get(r);if(t!==void 0)return t;let e;try{e=O(r)}catch{e=1}return W.set(r,e),e},"inkCharacterWidth"),Ft=v(r=>{try{return O(r)}catch{return 1}},"safeGetStringWidth"),Ot=v(r=>{if(r.length===0)return{height:0,width:0};const t=$.get(r);if(t)return t;const e=r.split(`
|
|
2
|
+
`),s=Math.max(...e.map(n=>Ft(n))),a={height:e.length,width:s};return $.set(r,a),a},"measureText"),Pt=v(r=>{if(B){const e=F.get(r);if(e!==void 0)return e}const t=vt(r);return B&&F.set(r,t),t},"toStyledLine"),wt=v(r=>{let t=0;for(let e=0;e<r.length;e++)t+=Tt(r.getValue(e));return t},"styledLineWidth"),Lt=v(r=>{if(r.length===0)return[new d];const t=[];let e=0;for(let s=0;s<r.length;s++)r.getValue(s)===`
|
|
3
|
+
`&&(t.push(s>e?r.slice(e,s):new d),e=s+1);return t.push(e<r.length?r.slice(e):new d),t},"splitStyledLineByNewline"),Et=v(r=>{if(r.length===0)return{height:0,width:0};const t=Lt(r);let e=0;for(const s of t)e=Math.max(e,wt(s));return{height:t.length,width:e}},"measureStyledLine");export{at as B,nt as D,x as F,V as H,K as I,d as S,j as U,Bt as a,_t as b,yt as c,wt as d,Ot as e,M as f,R as g,lt as h,Tt as i,Nt as j,vt as k,Lt as l,Et as m,$t as p,Wt as s,Pt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"yoga-layout";import{c as r,a as g,b as i,P as s,g as c,d as n,e as d,f as u,h as b,i as m,j as B,k as S,l as h}from"./measure-element-DSp7YDus.js";import"./getScrollHeight-BTEY8ewu.js";import"./squashTextNodesWithMap-Cpqmc45i.js";export{r as calculateScrollbarLayout,g as calculateScrollbarThumb,i as collectSortedFragments,s as default,c as getAddedScrollHeight,n as getBoundingBox,d as getHorizontalScrollbarBoundingBox,u as getInnerHeight,b as getInnerWidth,m as getRelativeLeft,B as getRelativeTop,S as getText,h as getVerticalScrollbarBoundingBox};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as o}from"react";const t=o(null);t.displayName="MouseContext";export{t as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./ansi-parser-B6uXaq65.js";export{e as parseSgrMouse};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"yoga-layout";import{m as e,n as i,p as n}from"./measure-element-DSp7YDus.js";export{e as getAbsoluteContentPosition,i as getAbsolutePosition,n as processLayout};
|
|
@@ -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 h,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-4y__5fWB.js";const re=b(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=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"),x=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}),"l");if(S.env.DEV==="true"){let e=!1;try{import.meta.resolve("react-devtools-core"),e=!0}catch{}e&&await import("../packem_chunks/devtools.js")}const A=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"),y=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)y(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(S.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=A(r,s),a=A(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&&x(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&&x(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:h,insertInContainerBefore:h,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),y(t)},removeChildFromContainer(e,t){I(e,t),y(t)},rendererPackageName:f.name,rendererVersion:f.version,requestPostPaintCallback(){},resetAfterCommit(e){if(typeof e.onComputeLayout=="function"&&e.onComputeLayout(),M(e),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,x 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-rxblE317.js";import{applyStyles as h,resolveColor as g}from"./NAMED_COLORS-B9fJsYdg.js";import{g as N}from"./text-width-CZ9vPvM0.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 @@
|
|
|
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-rxblE317.js";import{T as f,s as P}from"./reconciler-DSYCrIZs.js";import{renderTreeToBuffer as F}from"./renderTreeToBuffer-DPkoCgP2.js";import{TuiApp as j}from"./TuiApp-DrjI_i-R.js";import{InputParser as H}from"./InputParser-rZKjY_7Y.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,28 @@
|
|
|
1
|
+
var Ge=Object.defineProperty;var m=(e,t)=>Ge(e,"name",{value:t,configurable:!0});import{createRequire as Ye}from"node:module";import{jsxs as D,jsx as C}from"react/jsx-runtime";import{setMode as ve,BracketedPasteMode as ye,resetMode as we,cursorShow as pt,cursorUp as Lt,cursorTo as Wt,cursorDown as Xe,cursorHide as Z,eraseLines as X,cursorNextLine as Ze,eraseLineEnd as Je,createDecMode as tr,ALT_SCREEN_ON as er,clearScreenAndHomeCursor as rr,ALT_SCREEN_OFF as ir}from"@visulima/ansi";import{wordWrap as sr}from"@visulima/string";import nr from"patch-console";import{ConcurrentRoot as or,LegacyRoot as ar}from"react-reconciler/constants.js";import ie from"yoga-layout";import{a as ur}from"./accessibility-context-DDyHTwmA.js";import{PureComponent as cr,useState as yt,useRef as F,useCallback as T,useEffect as Et,useMemo as V}from"react";import{e as dr}from"./animation-context-DW3p-vpk.js";import{t as hr}from"./app-context-BVpKlG1z.js";import{o as pr}from"./cursor-context-CFviBqPX.js";import K from"./Box-BwqSvWuq.js";import H from"./Text-mTAve9R2.js";import{o as vr}from"./focus-context-CsT69klR.js";import{t as yr}from"./stderr-context-BzEaUICS.js";import{e as wr}from"./stdin-context-BTaaFagk.js";import{t as br}from"./stdout-context-BnblEPez.js";import{c as xr}from"./dom-4y__5fWB.js";import{resolveFlags as Tr}from"./kittyFlags-C3rZLbcK.js";import{a as Sr}from"./measure-text-DDjHT1jD.js";import{L as U,u as Rr}from"./reconciler-BuOP-TZ6.js";import{r as Cr,R as Er}from"./renderer-D2p6av2X.js";import{measureAndExtractObservers as Or}from"./ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Pr}from"./getScrollHeight-BTEY8ewu.js";import{g as et}from"./utils-THUhYKG2.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
const ze=Ye(import.meta.url),it=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,at=m(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 ze(e)},"__cjs_getBuiltinModule"),W=it,{env:Ct,cwd:ge}=W,{Stream:Ve}=at("node:stream"),{Buffer:re}=at("node:buffer"),{Console:Qe}=at("node:console"),{EventEmitter:lr}=at("node:events"),{existsSync:fr,readFileSync:mr}=at("node:fs"),gr=at("module");var Nr=Object.defineProperty,Y=m((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"n$3");function be(e,t,{signal:r,edges:i}={}){let s,l=null;const u=i!=null&&i.includes("leading"),n=i==null||i.includes("trailing"),a=Y(()=>{l!==null&&(e.apply(s,l),s=void 0,l=null)},"invoke"),f=Y(()=>{n&&a(),d()},"onTimerEnd");let y=null;const c=Y(()=>{y!=null&&clearTimeout(y),y=setTimeout(()=>{y=null,f()},t)},"schedule"),o=Y(()=>{y!==null&&(clearTimeout(y),y=null)},"cancelTimer"),d=Y(()=>{o(),s=void 0,l=null},"cancel"),g=Y(()=>{a()},"flush"),w=Y(function(...p){if(r?.aborted)return;s=this,l=p;const P=y==null;c(),u&&P&&a()},"debounced");return w.schedule=c,w.cancel=d,w.flush=g,r?.addEventListener("abort",d,{once:!0}),w}m(be,"E$2");Y(be,"debounce");var $r=Object.defineProperty,_t=m((e,t)=>$r(e,"name",{value:t,configurable:!0}),"c$7");function xe(e,t=0,r={}){typeof r!="object"&&(r={});const{leading:i=!1,trailing:s=!0,maxWait:l}=r,u=Array(2);i&&(u[0]="leading"),s&&(u[1]="trailing");let n,a=null;const f=be(function(...o){n=e.apply(this,o),a=null},t,{edges:u}),y=_t(function(...o){return l!=null&&(a===null&&(a=Date.now()),Date.now()-a>=l)?(n=e.apply(this,o),a=Date.now(),f.cancel(),f.schedule(),n):(f.apply(this,o),n)},"debounced"),c=_t(()=>(f.flush(),n),"flush");return y.cancel=f.cancel,y.flush=c,y}m(xe,"g$2");_t(xe,"debounce");var Ir=Object.defineProperty,kr=m((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"e$2");function jt(e,t=0,r={}){const{leading:i=!0,trailing:s=!0}=r;return xe(e,t,{leading:i,maxWait:t,trailing:s})}m(jt,"c$6");kr(jt,"throttle");var Lr=Object.defineProperty,_r=m((e,t)=>Lr(e,"name",{value:t,configurable:!0}),"t$4");const se=_r(e=>e in Ct&&Ct[e]!=="0"&&Ct[e]!=="false","check"),Te=se("CI")||se("CONTINUOUS_INTEGRATION"),st=[];st.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&st.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&st.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var jr=Object.defineProperty,ut=m((e,t)=>jr(e,"name",{value:t,configurable:!0}),"r$2");const bt=ut(e=>!!e&&!0&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function","processOk"),Ot=Symbol.for("signal-exit emitter"),Pt=globalThis,Ar=Object.defineProperty.bind(Object);let Dr=class{static{m(this,"y")}static{ut(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Pt[Ot])return Pt[Ot];Ar(Pt,Ot,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){const i=this.listeners[t],s=i.indexOf(r);s!==-1&&(s===0&&i.length===1?i.length=0:i.splice(s,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let s=!1;for(const l of this.listeners[t])s=l(r,i)===!0||s;return t==="exit"&&(s=this.emit("afterExit",r,i)||s),s}},Se=class{static{m(this,"c")}static{ut(this,"SignalExitBase")}};const Ur=ut(e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),"signalExitWrap");class Wr extends Se{static{m(this,"_")}static{ut(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}}let Mr=class extends Se{static{m(this,"p")}static{ut(this,"SignalExit")}#o=At.platform==="win32"?"SIGINT":"SIGHUP";#e=new Dr;#t;#s;#n;#i={};#r=!1;constructor(t){super(),this.#t=t,this.#i={};for(const r of st)this.#i[r]=()=>{const i=this.#t.listeners(r);let{count:s}=this.#e;const l=t;if(typeof l.__signal_exit_emitter__=="object"&&typeof l.__signal_exit_emitter__.count=="number"&&(s+=l.__signal_exit_emitter__.count),i.length===s){this.unload();const u=this.#e.emit("exit",null,r),n=r==="SIGHUP"?this.#o:r;u||t.kill(t.pid,n)}};this.#n=t.reallyExit,this.#s=t.emit}onExit(t,r){if(!bt(this.#t))return()=>{};this.#r===!1&&this.load();const i=r?.alwaysLast?"afterExit":"exit";return this.#e.on(i,t),()=>{this.#e.removeListener(i,t),this.#e.listeners.exit.length===0&&this.#e.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#e.count+=1;for(const t of st)try{const r=this.#i[t];r&&this.#t.on(t,r)}catch{}this.#t.emit=(t,...r)=>this.#u(t,...r),this.#t.reallyExit=t=>this.#a(t)}}unload(){this.#r&&(this.#r=!1,st.forEach(t=>{const r=this.#i[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,r)}catch{}}),this.#t.emit=this.#s,this.#t.reallyExit=this.#n,this.#e.count-=1)}#a(t){return bt(this.#t)?(this.#t.exitCode=t||0,this.#e.emit("exit",this.#t.exitCode,null),this.#n.call(this.#t,this.#t.exitCode)):0}#u(t,...r){const i=this.#s;if(t==="exit"&&bt(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);const s=i.call(this.#t,t,...r);return this.#e.emit("exit",this.#t.exitCode,null),s}else return i.call(this.#t,t,...r)}};const At=globalThis.process,{onExit:Br}=Ur(bt(At)?new Mr(At):new Wr);var Hr=Object.defineProperty,A=m((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"i$3");const Re="\x1B[200~",ne="\x1B[201~",Fr=A(e=>e>=48&&e<=63,"isCsiParameterByte"),Kr=A(e=>e>=32&&e<=47,"isCsiIntermediateByte"),Ce=A(e=>e>=64&&e<=126,"isCsiFinalByte"),qr=A((e,t,r)=>{const i=t+r+1;let s=i;for(;s<e.length;s++){const l=e.codePointAt(s);if(l===void 0)return"pending";if(!(Fr(l)||Kr(l))&&!(l===91&&s===i))return Ce(l)?{nextIndex:s+1,sequence:e.slice(t,s+1)}:void 0}return"pending"},"parseCsiSequence"),Gr=A((e,t,r)=>{const i=t+r+2;if(i>e.length)return"pending";const s=e.codePointAt(i-1);if(!(s===void 0||!Ce(s)))return{nextIndex:i,sequence:e.slice(t,i)}},"parseSs3Sequence"),oe=A((e,t,r)=>{const i=e[t+r];if(i===void 0)return"pending";if(i==="[")return qr(e,t,r);if(i==="O")return Gr(e,t,r)},"parseControlSequence"),Yr=A((e,t)=>{const r=e.codePointAt(t+1),i=r!==void 0&&r>65535?2:1,s=t+1+i;return{nextIndex:s,sequence:e.slice(t,s)}},"parseEscapedCodePoint"),zr=A((e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const i=oe(e,t,2);return i==="pending"?"pending":i||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const r=oe(e,t,1);return r==="pending"?"pending":r||Yr(e,t)},"parseEscapeSequence"),ae=A((e,t)=>{let r=0;for(let i=0;i<e.length;i++){const s=e[i];(s===""||s==="\b")&&(i>r&&t.push(e.slice(r,i)),t.push(s),r=i+1)}r<e.length&&t.push(e.slice(r))},"splitDeleteAndBackspace"),Vr=A(e=>{const t=[];let r=0;const i=A(s=>({events:t,pending:e.slice(s)}),"pendingFrom");for(;r<e.length;){const s=e.indexOf("\x1B",r);if(s===-1)return ae(e.slice(r),t),{events:t,pending:""};s>r&&ae(e.slice(r,s),t);const l=zr(e,s);if(l==="pending")return i(s);if(l.sequence===Re){const u=l.nextIndex,n=e.indexOf(ne,u);if(n===-1)return i(s);t.push({paste:e.slice(u,n)}),r=n+ne.length;continue}t.push(l.sequence),r=l.nextIndex}return{events:t,pending:""}},"parseKeypresses"),Qr=A(()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(Re)&&e!=="\x1B[200"},push(t){const r=Vr(e+t);return e=r.pending,r.events},reset(){e=""}}},"createInputParser");var Xr=Object.defineProperty,Zr=m((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"r$1");const Jr=Zr((e,t=2)=>e.replace(/^\t+/gm,r=>" ".repeat(r.length*t)),"convertToSpaces");var ti=Object.defineProperty,Ee=m((e,t)=>ti(e,"name",{value:t,configurable:!0}),"i$2");const ei=Ee((e,t)=>{const r=[],i=e-t,s=e+t;for(let l=i;l<=s;l++)r.push(l);return r},"generateLineNumbers"),ri=Ee((e,t,r={})=>{var i;if(typeof e!="string")throw new TypeError("Source code is missing.");if(!t||t<1)throw new TypeError("Line number must start from `1`.");const s=Jr(e).split(/\r?\n/);if(!(t>s.length))return ei(t,(i=r.around)!==null&&i!==void 0?i:3).filter(l=>s[l-1]!==void 0).map(l=>({line:l,value:s[l-1]}))},"codeExcerpt");var ii=Object.defineProperty,ot=m((e,t)=>ii(e,"name",{value:t,configurable:!0}),"t$3");function Oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}m(Oe,"getDefaultExportFromCjs");ot(Oe,"getDefaultExportFromCjs");function si(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}m(si,"getDefaultExportFromNamespaceIfPresent");ot(si,"getDefaultExportFromNamespaceIfPresent");function ni(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.keys(e).length===1?e.default:e}m(ni,"getDefaultExportFromNamespaceIfNotNamed");ot(ni,"getDefaultExportFromNamespaceIfNotNamed");function oi(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=ot(m(function i(){var s=!1;try{s=this instanceof i}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)},"a"),"a");r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:ot(function(){return e[i]},"get")})}),r}m(oi,"getAugmentedNamespace");ot(oi,"getAugmentedNamespace");var Nt,ue;function ai(){if(ue)return Nt;ue=1;const e=/[|\\{}()[\]^$+*?.-]/g;return Nt=m(t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(e,"\\$&")},"escapeStringRegexp"),Nt}m(ai,"requireEscapeStringRegexp");var $t,le;function ui(){if(le)return $t;le=1;var e=Object.defineProperty,t=m((y,c)=>e(y,"name",{value:c,configurable:!0}),"h");const r=ai(),i=process&&typeof process.cwd=="function"?process.cwd():".",s=[].concat(gr.builtinModules,"bootstrap_node","node").map(y=>new RegExp(`(?:\\((?:node:)?${y}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${y}(?:\\.js)?:\\d+:\\d+$)`));s.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);class l{static{m(this,"StackUtils")}static{t(this,"StackUtils")}constructor(c){c={ignoredPackages:[],...c},"internals"in c||(c.internals=l.nodeInternals()),"cwd"in c||(c.cwd=i),this._cwd=c.cwd.replace(/\\/g,"/"),this._internals=[].concat(c.internals,n(c.ignoredPackages)),this._wrapCallSite=c.wrapCallSite||!1}static nodeInternals(){return[...s]}clean(c,o=0){o=" ".repeat(o),Array.isArray(c)||(c=c.split(`
|
|
4
|
+
`)),!/^\s*at /.test(c[0])&&/^\s*at /.test(c[1])&&(c=c.slice(1));let d=!1,g=null;const w=[];return c.forEach(p=>{if(p=p.replace(/\\/g,"/"),this._internals.some(E=>E.test(p)))return;const P=/^\s*at /.test(p);d?p=p.trimEnd().replace(/^(\s+)at /,"$1"):(p=p.trim(),P&&(p=p.slice(3))),p=p.replace(`${this._cwd}/`,""),p&&(P?(g&&(w.push(g),g=null),w.push(p)):(d=!0,g=p))}),w.map(p=>`${o}${p}
|
|
5
|
+
`).join("")}captureString(c,o=this.captureString){typeof c=="function"&&(o=c,c=1/0);const{stackTraceLimit:d}=Error;c&&(Error.stackTraceLimit=c);const g={};Error.captureStackTrace(g,o);const{stack:w}=g;return Error.stackTraceLimit=d,this.clean(w)}capture(c,o=this.capture){typeof c=="function"&&(o=c,c=1/0);const{prepareStackTrace:d,stackTraceLimit:g}=Error;Error.prepareStackTrace=(P,E)=>this._wrapCallSite?E.map(this._wrapCallSite):E,c&&(Error.stackTraceLimit=c);const w={};Error.captureStackTrace(w,o);const{stack:p}=w;return Object.assign(Error,{prepareStackTrace:d,stackTraceLimit:g}),p}at(c=this.at){const[o]=this.capture(1,c);if(!o)return{};const d={line:o.getLineNumber(),column:o.getColumnNumber()};u(d,o.getFileName(),this._cwd),o.isConstructor()&&Object.defineProperty(d,"constructor",{value:!0,configurable:!0}),o.isEval()&&(d.evalOrigin=o.getEvalOrigin()),o.isNative()&&(d.native=!0);let g;try{g=o.getTypeName()}catch{}g&&g!=="Object"&&g!=="[object Object]"&&(d.type=g);const w=o.getFunctionName();w&&(d.function=w);const p=o.getMethodName();return p&&w!==p&&(d.method=p),d}parseLine(c){const o=c&&c.match(a);if(!o)return null;const d=o[1]==="new";let g=o[2];const w=o[3],p=o[4],P=Number(o[5]),E=Number(o[6]);let S=o[7];const N=o[8],k=o[9],I=o[10]==="native",$=o[11]===")";let L;const O={};if(N&&(O.line=Number(N)),k&&(O.column=Number(k)),$&&S){let M=0;for(let B=S.length-1;B>0;B--)if(S.charAt(B)===")")M++;else if(S.charAt(B)==="("&&S.charAt(B-1)===" "&&(M--,M===-1&&S.charAt(B-1)===" ")){const q=S.slice(0,B-1);S=S.slice(B+1),g+=` (${q}`;break}}if(g){const M=g.match(f);M&&(g=M[1],L=M[2])}return u(O,S,this._cwd),d&&Object.defineProperty(O,"constructor",{value:!0,configurable:!0}),w&&(O.evalOrigin=w,O.evalLine=P,O.evalColumn=E,O.evalFile=p&&p.replace(/\\/g,"/")),I&&(O.native=!0),g&&(O.function=g),L&&g!==L&&(O.method=L),O}}function u(y,c,o){c&&(c=c.replace(/\\/g,"/"),c.startsWith(`${o}/`)&&(c=c.slice(o.length+1)),y.file=c)}m(u,"setFile"),t(u,"setFile");function n(y){if(y.length===0)return[];const c=y.map(o=>r(o));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${c.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}m(n,"ignoredPackagesRegExp"),t(n,"ignoredPackagesRegExp");const a=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),f=/^(.*?) \[as (.*?)\]$/;return $t=l,$t}m(ui,"requireStackUtils");var li=ui();const ce=Oe(li);var ci=Object.defineProperty,Pe=m((e,t)=>ci(e,"name",{value:t,configurable:!0}),"p$1");const It=Pe(e=>e?.replace(`file://${ge()}/`,""),"cleanupPath"),de=new ce({cwd:ge(),internals:ce.nodeInternals()});function Ne({error:e}){const t=e.stack?e.stack.split(`
|
|
6
|
+
`).slice(1):void 0,r=t?de.parseLine(t[0]):void 0,i=It(r?.file);let s,l=0;if(i&&r?.line&&fr(i)){const u=mr(i,"utf8");if(s=ri(u,r.line),s)for(const{line:n}of s)l=Math.max(l,String(n).length)}return D(K,{flexDirection:"column",padding:1,children:[D(K,{children:[D(H,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),D(H,{children:[" ",e.message]})]}),r&&i?C(K,{marginTop:1,children:D(H,{dimColor:!0,children:[i,":",r.line,":",r.column]})}):null,r&&s?C(K,{flexDirection:"column",marginTop:1,children:s.map(({line:u,value:n})=>D(K,{children:[C(K,{width:l+1,children:D(H,{"aria-label":u===r.line?`Line ${u}, error`:`Line ${u}`,backgroundColor:u===r.line?"red":void 0,color:u===r.line?"white":void 0,dimColor:u!==r.line,children:[String(u).padStart(l," "),":"]})}),C(H,{backgroundColor:u===r.line?"red":void 0,color:u===r.line?"white":void 0,children:` ${n}`},u)]},u))}):null,t?C(K,{flexDirection:"column",marginTop:1,children:t.map(u=>{const n=de.parseLine(u);return n?D(K,{children:[C(H,{dimColor:!0,children:"- "}),C(H,{bold:!0,dimColor:!0,children:n.function}),D(H,{"aria-label":`at ${It(n.file)??""} line ${n.line} column ${n.column}`,color:"gray",dimColor:!0,children:[" ","(",It(n.file)??"",":",n.line,":",n.column,")"]})]},u):D(K,{children:[C(H,{dimColor:!0,children:"- "}),D(H,{bold:!0,dimColor:!0,children:[u,"\\t"," "]})]},u)})}):null]})}m(Ne,"B");Pe(Ne,"ErrorOverview");var di=Object.defineProperty,hi=m((e,t)=>di(e,"name",{value:t,configurable:!0}),"o$1");let pi=class extends cr{static{m(this,"i")}static{hi(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?C(Ne,{error:this.state.error}):this.props.children}};var fi=Object.defineProperty,he=m((e,t)=>fi(e,"name",{value:t,configurable:!0}),"V$1");const mi=" ",gi="\x1B[Z",vi="\x1B",yi=ve(ye),pe=we(ye),$e=he(({children:e,exitOnCtrlC:t,interactive:r,onExit:i,onWaitUntilRenderFlush:s,renderThrottleMs:l,setCursorPosition:u,stderr:n,stdin:a,stdout:f,writeToStderr:y,writeToStdout:c})=>{const[o,d]=yt(!0),[g,w]=yt(void 0),[,p]=yt([]),P=F(0),E=F(new Map),S=F(void 0),N=F(0),k=F(0),[I]=yt(()=>{const h=new lr;return h.setMaxListeners(1/0),h}),$=F(void 0),L=F(void 0);L.current??=Qr();const O=F(void 0),M=F(!1),B=20,q=T(()=>{O.current&&(clearTimeout(O.current),O.current=void 0)},[]),J=T(()=>{S.current&&(clearTimeout(S.current),S.current=void 0)},[]),mt=T(()=>{if(J(),E.current.size===0)return;let h=Number.POSITIVE_INFINITY;for(const v of E.current.values())h=Math.min(h,v.nextDueTime);const b=Math.max(0,h-performance.now());S.current=setTimeout(()=>{S.current=void 0;const v=performance.now(),R=[...E.current.values()];for(const _ of R){if(v<_.nextDueTime)continue;_.callback(v);const Ke=v-_.startTime,qe=Math.floor(Ke/_.interval)+1;_.nextDueTime=_.startTime+qe*_.interval}mt()},b)},[J]),Bt=T((h,b)=>{const v=performance.now();return E.current.set(h,{callback:h,interval:b,nextDueTime:v+b,startTime:v}),mt(),{startTime:v,unsubscribe(){if(E.current.delete(h),E.current.size===0){J();return}mt()}}},[J,mt]);Et(()=>()=>{J()},[J]);const G=a.isTTY,Ht=T(()=>{$.current&&(a.removeListener("readable",$.current),$.current=void 0)},[a]),tt=T(()=>{a.setRawMode(!1),Ht(),a.unref(),N.current=0,L.current?.reset(),q()},[a,Ht,q]),lt=T(h=>{G&&N.current>0&&tt(),i(h)},[G,tt,i]),Ft=T(h=>{if(h.includes("")&&t){lt();return}h===vi&&w(b=>{if(!b)return b})},[t,lt]),ct=T(h=>{Ft(h),I.emit("input",h)},[Ft,I]),Kt=T(()=>{q(),O.current=setTimeout(()=>{O.current=void 0;const h=L.current.flushPendingEscape();h&&ct(h)},B)},[q,ct]),Rt=T(()=>{q();let h;for(;(h=a.read())!==null;){const b=L.current.push(h);for(const v of b)if(typeof v=="string")ct(v);else{if(I.listenerCount("paste")===0){M.current||(M.current=!0,y(`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().
|
|
7
|
+
`)),ct(v.paste);continue}I.emit("paste",v.paste)}}L.current.hasPendingEscape()&&Kt()},[a,ct,q,Kt,y,I]),qt=T(h=>{if(!G)throw a===W.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
|
|
8
|
+
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.
|
|
9
|
+
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(a.setEncoding("utf8"),h){N.current===0&&(a.ref(),a.setRawMode(!0),$.current=Rt,a.addListener("readable",Rt)),N.current++;return}N.current!==0&&--N.current===0&&tt()},[G,a,Rt,tt]),Gt=T(h=>{if(f.isTTY){if(h){k.current===0&&f.write(yi),k.current++;return}k.current!==0&&--k.current===0&&f.write(pe)}},[f]),Yt=T((h,b)=>{const v=h.findIndex(R=>R.id===b);for(let R=v+1;R<h.length;R++){const _=h[R];if(_?.isActive)return _.id}},[]),zt=T((h,b)=>{const v=h.findIndex(R=>R.id===b);for(let R=v-1;R>=0;R--){const _=h[R];if(_?.isActive)return _.id}},[]),gt=T(()=>{p(h=>(w(b=>{const v=h.find(R=>R.isActive)?.id;return Yt(h,b)??v}),h))},[Yt]),vt=T(()=>{p(h=>(w(b=>{const v=h.findLast(R=>R.isActive)?.id;return zt(h,b)??v}),h))},[zt]);Et(()=>{const h=he(v=>{!o||P.current===0||(v===mi&>(),v===gi&&vt())},"handleTabNavigation");I.on("input",h);const b=I;return()=>{b.off("input",h)}},[o,gt,vt,I]);const Vt=T(()=>{d(!0)},[]),Qt=T(()=>{d(!1)},[]),Xt=T(h=>{p(b=>(b.some(v=>v?.id===h)&&w(h),b))},[]),Zt=T((h,{autoFocus:b})=>{p(v=>(P.current=v.length+1,[...v,{id:h,isActive:!0}])),b&&w(v=>v||h)},[]),Jt=T(h=>{w(b=>{if(b!==h)return b}),p(b=>{const v=b.filter(R=>R.id!==h);return P.current=v.length,v})},[]),te=T(h=>{p(b=>b.map(v=>v.id!==h?v:{id:h,isActive:!0}))},[]),ee=T(h=>{w(b=>{if(b!==h)return b}),p(b=>b.map(v=>v.id!==h?v:{id:h,isActive:!1}))},[]);Et(()=>()=>{const h=!f.destroyed&&!f.writableEnded;r&&h&&f.write(pt),G&&N.current>0&&tt(),k.current>0&&(f.isTTY&&h&&f.write(pe),k.current=0)},[f,G,tt,r]);const De=V(()=>({exit:lt,waitUntilRenderFlush:s}),[lt,s]),Ue=V(()=>({internal_eventEmitter:I,internal_exitOnCtrlC:t,isRawModeSupported:G,setBracketedPasteMode:Gt,setRawMode:qt,stdin:a}),[a,qt,Gt,G,t,I]),We=V(()=>({stdout:f,write:c}),[f,c]),Me=V(()=>({stderr:n,write:y}),[n,y]),Be=V(()=>({setCursorPosition:u}),[u]),He=V(()=>({activate:te,activeId:g,add:Zt,deactivate:ee,disableFocus:Qt,enableFocus:Vt,focus:Xt,focusNext:gt,focusPrevious:vt,remove:Jt}),[g,Zt,Jt,te,ee,Vt,Qt,gt,vt,Xt]),Fe=V(()=>({renderThrottleMs:l,subscribe:Bt}),[Bt,l]);return C(hr.Provider,{value:De,children:C(wr.Provider,{value:Ue,children:C(br.Provider,{value:We,children:C(yr.Provider,{value:Me,children:C(vr.Provider,{value:He,children:C(dr.Provider,{value:Fe,children:C(pr.Provider,{value:Be,children:C(pi,{onError:lt,children:e})})})})})})})})},"App");$e.displayName="InternalApp";const Dt=new WeakMap;var wi=Object.defineProperty,ft=m((e,t)=>wi(e,"name",{value:t,configurable:!0}),"e");const xt=ft((e,t)=>e?.x!==t?.x||e?.y!==t?.y,"cursorPositionChanged"),nt=ft((e,t)=>{if(!t)return"";const r=e-t.y;return(r>0?Lt(r):"")+Wt(t.x)+pt},"buildCursorSuffix"),Ie=ft((e,t)=>{if(!t)return"";const r=e-1-t.y;return(r>0?Xe(r):"")+Wt(0)},"buildReturnToBottom"),ke=ft(e=>{const t=e.cursorWasShown?Z:"",r=Ie(e.previousLineCount,e.previousCursorPosition),i=nt(e.visibleLineCount,e.cursorPosition);return t+r+i},"buildCursorOnlySequence"),Tt=ft((e,t,r)=>e?Z+Ie(t,r):"","buildReturnToBottomPrefix");var bi=Object.defineProperty,j=m((e,t)=>bi(e,"name",{value:t,configurable:!0}),"c$2");const ht=j((e,t)=>t.endsWith(`
|
|
10
|
+
`)?e.length-1:e.length,"visibleLineCount"),Le=j(e=>e.rows||1/0,"getViewportRows"),St=j((e,t)=>Math.min(e,Le(t)),"clampToViewport"),xi=j((e,{showCursor:t=!1}={})=>{let r=0,i="",s=!1,l,u=!1,n,a=!1;const f=j(()=>u?l:void 0,"getActiveCursor"),y=j((o,d)=>{const g=xt(d,n);return o!==i||g},"hasChanges"),c=j(o=>{!t&&!s&&(e.write(Z),s=!0);const d=f();u=!1;const g=xt(d,n);if(!y(o,d))return!1;const w=o.split(`
|
|
11
|
+
`),p=ht(w,o),P=nt(p,d);if(o===i&&g)e.write(ke({cursorPosition:d,cursorWasShown:a,previousCursorPosition:n,previousLineCount:r,visibleLineCount:p}));else{i=o;const E=Tt(a,r,n);e.write(E+X(St(r,e))+o+P),r=w.length}return n=d?{...d}:void 0,a=d!==void 0,!0},"render");return c.clear=()=>{const o=Tt(a,r,n);e.write(o+X(St(r,e))),i="",r=0,n=void 0,a=!1},c.done=()=>{i="",r=0,n=void 0,a=!1,t||(e.write(pt),s=!1)},c.reset=()=>{i="",r=0,n=void 0,a=!1},c.sync=o=>{const d=u?l:void 0;u=!1;const g=o.split(`
|
|
12
|
+
`);i=o,r=g.length,!d&&a&&e.write(Z),d&&e.write(nt(ht(g,o),d)),n=d?{...d}:void 0,a=d!==void 0},c.setCursorPosition=o=>{l=o,u=!0},c.isCursorDirty=()=>u,c.willRender=o=>y(o,f()),c},"createStandard"),Ti=j((e,{showCursor:t=!1}={})=>{let r=[],i="",s=!1,l,u=!1,n,a=!1;const f=j(()=>u?l:void 0,"getActiveCursor"),y=j((o,d)=>{const g=xt(d,n);return o!==i||g},"hasChanges"),c=j(o=>{!t&&!s&&(e.write(Z),s=!0);const d=f();u=!1;const g=xt(d,n);if(!y(o,d))return!1;const w=o.split(`
|
|
13
|
+
`),p=ht(w,o),P=ht(r,i);if(o===i&&g)return e.write(ke({cursorPosition:d,cursorWasShown:a,previousCursorPosition:n,previousLineCount:r.length,visibleLineCount:p})),n=d?{...d}:void 0,a=d!==void 0,!0;const E=Tt(a,r.length,n);if(o===`
|
|
14
|
+
`||i.length===0){const $=nt(p,d);return e.write(E+X(St(r.length,e))+o+$),a=d!==void 0,n=d?{...d}:void 0,i=o,r=w,!0}const S=o.endsWith(`
|
|
15
|
+
`),N=[E],k=Le(e);if(p<P){const $=i.endsWith(`
|
|
16
|
+
`)?1:0;N.push(X(Math.min(P-p+$,k)),Lt(Math.min(p,k-1)))}else N.push(Lt(Math.min(P-1,k-1)));for(let $=0;$<p;$++){const L=$===p-1;if(w[$]===r[$]){(!L||S)&&N.push(Ze());continue}N.push(Wt(0)+w[$]+Je+(L&&!S?"":`
|
|
17
|
+
`))}const I=nt(p,d);return N.push(I),e.write(N.join("")),a=d!==void 0,n=d?{...d}:void 0,i=o,r=w,!0},"render");return c.clear=()=>{const o=Tt(a,r.length,n);e.write(o+X(St(r.length,e))),i="",r=[],n=void 0,a=!1},c.done=()=>{i="",r=[],n=void 0,a=!1,t||(e.write(pt),s=!1)},c.reset=()=>{i="",r=[],n=void 0,a=!1},c.sync=o=>{const d=u?l:void 0;u=!1;const g=o.split(`
|
|
18
|
+
`);i=o,r=g,!d&&a&&e.write(Z),d&&e.write(nt(ht(g,o),d)),n=d?{...d}:void 0,a=d!==void 0},c.setCursorPosition=o=>{l=o,u=!0},c.isCursorDirty=()=>u,c.willRender=o=>y(o,f()),c},"createIncremental"),Si=j((e,{incremental:t=!1,showCursor:r=!1}={})=>t?Ti(e,{showCursor:r}):xi(e,{showCursor:r}),"create"),Ri={create:Si};var Ci=Object.defineProperty,Ei=m((e,t)=>Ci(e,"name",{value:t,configurable:!0}),"t");const _e=tr(2026),Q=ve(_e),z=we(_e);function je(e,t){return"isTTY"in e&&e.isTTY&&(t??!Te)}m(je,"shouldSynchronize");Ei(je,"shouldSynchronize");var Oi=Object.defineProperty,Ut=m((e,t)=>Oi(e,"name",{value:t,configurable:!0}),"o");let rt;const Pi=Ut(()=>{if(rt!==!1){if(rt!==void 0)return rt;try{return rt=require("../../index.js").Renderer,rt}catch{rt=!1;return}}},"getRendererClass"),Ni=Ut(e=>{const t=Pi();if(!t)return;let r,i=0,s=0;const l=Ut((u,n)=>{(!r||i!==u||s!==n)&&(r?r.resize(u,n):r=new t(u,n),i=u,s=n)},"ensureRenderer");return{clear(){if(r){const u=new Uint32Array(i*s*2),n=65535;for(let a=0;a<u.length;a+=2)u[a]=32,u[a+1]=n;r.render(u)}},destroy(){r=void 0},render(u,n,a){if(l(n,a),!!r){e.isTTY&&r.writeRaw(Q);try{r.render(u)}finally{e.isTTY&&r.writeRaw(z)}}},resize(u,n){l(u,n)}}},"createNative");var $i=Object.defineProperty,x=m((e,t)=>$i(e,"name",{value:t,configurable:!0}),"n");console.Console||(console.Console=Qe);const dt=x(()=>{},"noop"),fe=x(async()=>new Promise(e=>{setImmediate(e)}),"yieldImmediate"),Ii=27,ki=91,Li=63,_i=117,ji=48,Ai=57,Di=x(e=>e>=ji&&e<=Ai,"isDigitByte"),Ae=x((e,t)=>{if(e[t]!==Ii||e[t+1]!==ki||e[t+2]!==Li)return;let r=t+3;const i=r;for(;r<e.length&&Di(e[r]);)r++;if(r!==i){if(r===e.length)return{state:"partial"};if(e[r]===_i)return{endIndex:r,state:"complete"}}},"matchKittyQueryResponse"),Ui=x(e=>{for(let t=0;t<e.length;t++)if(Ae(e,t)?.state==="complete")return!0;return!1},"hasCompleteKittyQueryResponse"),Wi=x(e=>{const t=[];let r=0;for(;r<e.length;){const i=Ae(e,r);if(i?.state==="complete"){r=i.endIndex+1;continue}if(i?.state==="partial")break;t.push(e[r]),r++}return t},"stripKittyQueryResponsesAndTrailingPartial"),Mi=x(({isTty:e,isUnmounting:t,nextOutputHeight:r,previousOutputHeight:i,viewportRows:s})=>{if(!e)return!1;const l=i>0,u=i>=s,n=i>s,a=r>s,f=u&&r<s;return n||a&&l||f||t&&u},"shouldClearTerminalForFrame"),kt=x(e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]","isErrorInput"),me=x(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"),wt=x((e,t)=>{if(!e||typeof e.flush!="function")return;const r=e;t?r.flush():typeof r.cancel=="function"&&r.cancel()},"settleThrottle");class Bi{static{m(this,"ft")}static{x(this,"Ink")}isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=xr("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??W.env.INK_SCREEN_READER==="true",this.interactive=this.resolveInteractiveOption(t.interactive),this.alternateScreen=!1;const r=t.debug||this.isScreenReaderEnabled,i=t.maxFps??30,s=i>0?Math.max(1,Math.ceil(1e3/i)):0;this.renderThrottleMs=r?0:s;const l=r?this.onRender:(()=>{const n=jt(this.onRender,s,{leading:!0,trailing:!0});return this.throttledOnRender=n,()=>{this.hasPendingThrottledRender=!0,n()}})();if(r&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let n=!1;const a=x(()=>{n||(n=!0,queueMicrotask(()=>{n=!1,this.onRender()}))},"deferredRender");this.rootNode.onRender=a,this.rootNode.onImmediateRender=a}else this.rootNode.onRender=l,this.rootNode.onImmediateRender=this.onRender;this.log=Ri.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=Ni(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=r?this.log:jt(n=>{const a=this.log.willRender(n),f=this.shouldSync();f&&a&&this.options.stdout.write(Q),this.log(n),f&&a&&this.options.stdout.write(z)},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=et(this.options.stdout).columns,this.fullStaticOutput="";const u=t.concurrent?or:ar;this.container=U.createContainer(this.rootNode,u,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=Br(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(),W.env.DEV==="true"&&U.injectIntoDevTools(),this.exitPromise=new Promise((n,a)=>{this.resolveExitPromise=n,this.rejectExitPromise=a}),this.exitPromise.catch(dt)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=x(()=>{const t=et(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),Sr(),this.calculateLayout(),this.onRender(),this.lastTerminalWidth=t},"resized");resolveExitPromise=x(()=>{},"resolveExitPromise");rejectExitPromise=x(()=>{},"rejectExitPromise");unsubscribeExit=x(()=>{},"unsubscribeExit");handleAppExit=x(t=>{if(!(this.isUnmounted||this.isUnmounting)){if(kt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}},"handleAppExit");getActiveCursorPosition=x(()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition,"getActiveCursorPosition");setCursorPosition=x(t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())},"setCursorPosition");restoreLastOutput=x(()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
|
|
19
|
+
`))},"restoreLastOutput");calculateLayout=x(()=>{const t=x(i=>{const s=new Map;this.calculateScrollAndTriggerObservers(i,s);for(const[l,u]of s)l.internalTrigger(u)},"flushLayoutObservers");this.prepareYogaTree(this.rootNode,t);const r=et(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(r),this.rootNode.yogaNode.calculateLayout(void 0,void 0,ie.DIRECTION_LTR),t(this.rootNode)},"calculateLayout");calculateScrollAndTriggerObservers(t,r){if(t.nodeName==="ink-box"){const{style:i}=t,s=i.overflow??"visible",l=i.overflowX??s,u=i.overflowY??s;l==="scroll"||u==="scroll"?Pr(t):t.internal_scrollState&&delete t.internal_scrollState}if(Or(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(),Rr(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let i=0;for(const s of t.childNodes){const l=s;s.nodeName!=="#text"&&l.yogaNode&&(t.yogaNode.insertChild(l.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=et(this.options.stdout).columns,{width:s}=t.style;t.yogaNode&&(t.yogaNode.setWidth(typeof s=="number"?s:i),t.yogaNode.calculateLayout(void 0,void 0,ie.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)}}onRender=x(()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=Er(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:r,cursorRequested:i,output:s,outputBuffer:l,outputHeight:u,outputWidth:n,staticOutput:a}=t;if(this.renderedCursorRequested=i,this.renderedCursorPosition=r,this.useNativeRenderer&&this.nativeLog&&l&&n){a&&a!==`
|
|
20
|
+
`&&this.options.stdout.write(a),this.nativeLog.render(l,n,u),this.lastOutputHeight=u;return}i&&this.log.setCursorPosition(this.getActiveCursorPosition());const f=a&&a!==`
|
|
21
|
+
`;if(this.options.debug){f&&(this.fullStaticOutput+=a),this.lastOutput=s,this.lastOutputToRender=s,this.lastOutputHeight=u,this.options.stdout.write(this.fullStaticOutput+s);return}if(!this.interactive){f&&this.options.stdout.write(a),this.lastOutput=s,this.lastOutputToRender=`${s}
|
|
22
|
+
`,this.lastOutputHeight=u;return}if(this.isScreenReaderEnabled){const y=this.shouldSync();if(y&&this.options.stdout.write(Q),f){const d=this.lastOutputHeight>0?X(this.lastOutputHeight):"";this.options.stdout.write(d+a),this.lastOutputHeight=0}if(s===this.lastOutput&&!f){y&&this.options.stdout.write(z);return}const c=et(this.options.stdout).columns,o=sr(s,{trim:!1,width:c,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(f)this.options.stdout.write(o);else{const d=this.lastOutputHeight>0?X(this.lastOutputHeight):"";this.options.stdout.write(d+o)}this.lastOutput=s,this.lastOutputToRender=o,this.lastOutputHeight=o===""?0:o.split(`
|
|
23
|
+
`).length,y&&this.options.stdout.write(z);return}f&&(this.fullStaticOutput+=a),this.renderInteractiveFrame(s,u,f?a:"")},"onRender");accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const r=C(ur.Provider,{value:this.accessibilityContextValue,children:C($e,{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?U.updateContainer(r,this.container,null,dt):(U.updateContainerSync(r,this.container,null,dt),U.flushSyncWork())}writeToStdout=x(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(Q),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),r&&this.options.stdout.write(z)},"writeToStdout");writeToStderr=x(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(Q),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),r&&this.options.stdout.write(z)},"writeToStderr");unmount=x(t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(W.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const r=this.options.stdout,{canWriteToStdout:i,hasWritableState:s}=me(r);wt(this.throttledOnRender,i),i&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),wt(this.throttledLog,i),typeof this.restoreConsole=="function"&&this.restoreConsole();const l=x(()=>{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,ir),this.writeBestEffort(this.options.stdout,pt),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
|
|
24
|
+
`:`${this.lastOutput}
|
|
25
|
+
`)),this.kittyProtocolEnabled=!1,Dt.delete(this.options.stdout);const{exitResult:n}=this,a=x(()=>{kt(t)?this.rejectExitPromise(t):this.resolveExitPromise(n)},"resolveOrReject");t!==void 0&&!kt(t)?a():i&&s?this.options.stdout.write("",a):setImmediate(a)},"finishUnmount"),u=U;this.options.concurrent?(U.updateContainerSync(null,this.container,null,dt),U.flushSyncWork(),u.flushPassiveEffects?.(),l()):(U.updateContainerSync(null,this.container,null,dt),U.flushSyncWork(),l())},"unmount");async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},W.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await fe(),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}U.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:r,hasWritableState:i}=me(t);if(wt(this.throttledOnRender,r),wt(this.throttledLog,r),r&&i){await new Promise(s=>{this.options.stdout.write("",()=>{s()})});return}await fe()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
|
|
26
|
+
`))}patchConsole(){this.options.debug||(this.restoreConsole=nr((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,er),this.writeBestEffort(this.options.stdout,Z))}resolveInteractiveOption(t){return t??(!Te&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,r){return!!t&&r&&!!this.options.stdout.isTTY}shouldSync(){return je(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){const s=i!=="",l=this.options.stdout.isTTY,u=l?et(this.options.stdout).rows:24,n=l&&r>=u?t:`${t}
|
|
27
|
+
`;if(Mi({isTty:l,isUnmounting:this.isUnmounting,nextOutputHeight:r,previousOutputHeight:this.lastOutputHeight,viewportRows:u})){if(this.options.incrementalRendering){s&&(this.log.clear(),this.options.stdout.write(i)),(t!==this.lastOutput||this.log.isCursorDirty()||s)&&this.throttledLog(n),this.lastOutput=t,this.lastOutputToRender=n,this.lastOutputHeight=r;return}const a=this.shouldSync();a&&this.options.stdout.write(Q),this.options.stdout.write(rr+this.fullStaticOutput+t),this.lastOutput=t,this.lastOutputToRender=n,this.lastOutputHeight=r,this.log.sync(n),a&&this.options.stdout.write(z);return}if(s){const a=this.shouldSync();a&&this.options.stdout.write(Q),this.log.clear(),this.options.stdout.write(i),this.log(n),a&&this.options.stdout.write(z)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(n);this.lastOutput=t,this.lastOutputToRender=n,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 s=[];const l=x(()=>{this.cancelKittyDetection=void 0,clearTimeout(n),r.removeListener("data",u);const a=Wi(s);s=[],a.length>0&&r.unshift(re.from(a))},"cleanup"),u=x(a=>{const f=typeof a=="string"?re.from(a):a;for(const y of f)s.push(y);Ui(s)&&(l(),this.isUnmounted||this.enableKittyProtocol(t))},"onData");r.on("data",u);const n=setTimeout(l,200);this.cancelKittyDetection=l,i.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${Tr(t)}u`),this.kittyProtocolEnabled=!0}}var Hi=Object.defineProperty,Mt=m((e,t)=>Hi(e,"name",{value:t,configurable:!0}),"i");const Ts=Mt((e,t)=>{const r={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:W.stderr,stdin:W.stdin,stdout:W.stdout,...Fi(t)},i=Ki(r.stdout,()=>new Bi(r));return i.render(e),{cleanup(){i.unmount()},clear(){i.clear()},rerender(s){i.render(s)},rootNode:i.rootNode,unmount(){i.unmount()},waitUntilExit(){return i.waitUntilExit()},waitUntilRenderFlush(){return i.waitUntilRenderFlush()}}},"render"),Fi=Mt((e={})=>e instanceof Ve?{stdin:W.stdin,stdout:e}:e,"getOptions"),Ki=Mt((e,t)=>{const r=Dt.get(e);if(r===void 0){const i=t();return Dt.set(e,i),i}return W.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.
|
|
28
|
+
`),r},"getInstance");export{Ts as default};
|