@visulima/tui 1.0.8 → 2.0.1
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 +4 -0
- package/LICENSE.md +54 -2444
- package/MIGRATION-GUIDE.md +164 -0
- package/README.md +15 -12
- package/dist/components/box.d.ts +26 -27
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/canvas.js +1 -1
- package/dist/components/cursor.d.ts +40 -46
- package/dist/components/error-boundary.d.ts +16 -0
- package/dist/components/error-boundary.js +1 -0
- package/dist/components/error-overview.d.ts +6 -0
- package/dist/components/error-overview.js +1 -0
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +10 -42
- package/dist/components/static.d.ts +13 -14
- package/dist/components/text.d.ts +34 -48
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -12
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +24 -0
- package/dist/ink/canvas/index.js +1 -0
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -34
- package/dist/ink/hooks/use-app.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +17 -18
- package/dist/ink/hooks/use-clipboard.d.ts +16 -16
- package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
- package/dist/ink/hooks/use-console-capture.d.ts +19 -19
- package/dist/ink/hooks/use-cursor.d.ts +7 -7
- package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
- package/dist/ink/hooks/use-focus.d.ts +14 -18
- package/dist/ink/hooks/use-form.d.ts +32 -32
- package/dist/ink/hooks/use-hotkey.d.ts +17 -17
- package/dist/ink/hooks/use-input.d.ts +92 -92
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-interval.d.ts +14 -14
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
- package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
- package/dist/ink/hooks/use-key-chord.d.ts +15 -15
- package/dist/ink/hooks/use-paste.d.ts +38 -38
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
- package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
- package/dist/ink/hooks/use-stderr.d.ts +6 -6
- package/dist/ink/hooks/use-stderr.js +1 -1
- package/dist/ink/hooks/use-stdin.d.ts +10 -10
- package/dist/ink/hooks/use-stdin.js +1 -1
- package/dist/ink/hooks/use-stdout.d.ts +6 -6
- package/dist/ink/hooks/use-stdout.js +1 -1
- package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
- package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
- package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +19 -20
- package/dist/ink/hooks/use-timeout.d.ts +11 -11
- package/dist/ink/hooks/use-timer.d.ts +19 -19
- package/dist/ink/hooks/use-window-size.d.ts +8 -8
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +110 -123
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +7 -8
- package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
- package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
- package/dist/ink/mouse/use-mouse.d.ts +1 -1
- package/dist/ink/mouse/use-on-mouse-click.d.ts +4 -5
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
- package/dist/ink/public/cursor.d.ts +47 -0
- package/dist/ink/public/cursor.js +1 -0
- package/dist/ink/public/dom.d.ts +6 -0
- package/dist/ink/public/dom.js +0 -0
- package/dist/ink/public/highlighter.d.ts +44 -0
- package/dist/ink/public/highlighter.js +1 -0
- package/dist/ink/public/input.d.ts +14 -0
- package/dist/ink/public/input.js +1 -0
- package/dist/ink/public/styles.d.ts +4 -0
- package/dist/ink/public/styles.js +0 -0
- package/dist/ink/public/utils.d.ts +5 -0
- package/dist/ink/public/utils.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-BxD3PYAN.js} +1 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
- package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
- package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
- package/dist/packem_shared/TuiApp-CCVaiKbf.js +1 -0
- package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/buffer.d-CttIC480.d.ts +67 -0
- package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
- package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
- package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
- package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
- package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
- package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
- package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-CLGlidfI.d.ts} +140 -154
- package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
- package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
- package/dist/packem_shared/input.d-Bb8pWHvp.d.ts +172 -0
- package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
- package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
- package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
- package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
- package/dist/packem_shared/render-CuCo-R-l.js +24 -0
- package/dist/packem_shared/{render-DFZ8NHlG.js → render-DtQd8qQq.js} +1 -1
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
- package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
- package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
- package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
- package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
- package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
- package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
- package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
- package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
- package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
- package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
- package/dist/react/index.d.ts +160 -179
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +152 -152
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +49 -384
- package/dist/components/accordion.d.ts +0 -59
- package/dist/components/accordion.js +0 -1
- package/dist/components/alert.d.ts +0 -26
- package/dist/components/alert.js +0 -1
- package/dist/components/animate-presence.d.ts +0 -18
- package/dist/components/animate-presence.js +0 -1
- package/dist/components/approval-prompt.d.ts +0 -65
- package/dist/components/approval-prompt.js +0 -1
- package/dist/components/area-chart.d.ts +0 -66
- package/dist/components/area-chart.js +0 -1
- package/dist/components/badge.d.ts +0 -22
- package/dist/components/badge.js +0 -1
- package/dist/components/bar-chart.d.ts +0 -67
- package/dist/components/bar-chart.js +0 -1
- package/dist/components/big-text.d.ts +0 -81
- package/dist/components/big-text.js +0 -1
- package/dist/components/blink-dot.d.ts +0 -36
- package/dist/components/blink-dot.js +0 -1
- package/dist/components/breadcrumb.d.ts +0 -33
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/button.d.ts +0 -45
- package/dist/components/button.js +0 -1
- package/dist/components/calendar.d.ts +0 -72
- package/dist/components/calendar.js +0 -1
- package/dist/components/card.d.ts +0 -57
- package/dist/components/card.js +0 -1
- package/dist/components/checkbox.d.ts +0 -48
- package/dist/components/checkbox.js +0 -1
- package/dist/components/code.d.ts +0 -48
- package/dist/components/code.js +0 -2
- package/dist/components/collapsible.d.ts +0 -53
- package/dist/components/collapsible.js +0 -1
- package/dist/components/command-block.d.ts +0 -47
- package/dist/components/command-block.js +0 -4
- package/dist/components/command-palette.d.ts +0 -82
- package/dist/components/command-palette.js +0 -1
- package/dist/components/confirm-dialog.d.ts +0 -75
- package/dist/components/confirm-dialog.js +0 -1
- package/dist/components/confirm-input.d.ts +0 -38
- package/dist/components/confirm-input.js +0 -1
- package/dist/components/console-overlay.d.ts +0 -54
- package/dist/components/console-overlay.js +0 -1
- package/dist/components/content-switcher.d.ts +0 -57
- package/dist/components/content-switcher.js +0 -1
- package/dist/components/controlled-scroll-view.d.ts +0 -61
- package/dist/components/controlled-scroll-view.js +0 -1
- package/dist/components/date-picker.d.ts +0 -65
- package/dist/components/date-picker.js +0 -1
- package/dist/components/definition-list.d.ts +0 -44
- package/dist/components/definition-list.js +0 -1
- package/dist/components/dialog.d.ts +0 -117
- package/dist/components/dialog.js +0 -1
- package/dist/components/diff-view.d.ts +0 -85
- package/dist/components/diff-view.js +0 -1
- package/dist/components/divider.d.ts +0 -49
- package/dist/components/divider.js +0 -1
- package/dist/components/file-picker-entry.d.ts +0 -104
- package/dist/components/file-picker-entry.js +0 -1
- package/dist/components/form.d.ts +0 -81
- package/dist/components/form.js +0 -1
- package/dist/components/gauge.d.ts +0 -87
- package/dist/components/gauge.js +0 -1
- package/dist/components/gradient.d.ts +0 -42
- package/dist/components/gradient.js +0 -1
- package/dist/components/heading.d.ts +0 -33
- package/dist/components/heading.js +0 -1
- package/dist/components/heatmap.d.ts +0 -62
- package/dist/components/heatmap.js +0 -1
- package/dist/components/help.d.ts +0 -52
- package/dist/components/help.js +0 -1
- package/dist/components/histogram.d.ts +0 -62
- package/dist/components/histogram.js +0 -1
- package/dist/components/kbd.d.ts +0 -31
- package/dist/components/kbd.js +0 -1
- package/dist/components/line-chart.d.ts +0 -109
- package/dist/components/line-chart.js +0 -1
- package/dist/components/link.d.ts +0 -38
- package/dist/components/link.js +0 -1
- package/dist/components/loading-indicator.d.ts +0 -29
- package/dist/components/loading-indicator.js +0 -1
- package/dist/components/markdown.d.ts +0 -40
- package/dist/components/markdown.js +0 -1
- package/dist/components/masked-input.d.ts +0 -50
- package/dist/components/masked-input.js +0 -1
- package/dist/components/menu.d.ts +0 -78
- package/dist/components/menu.js +0 -1
- package/dist/components/message-bubble.d.ts +0 -43
- package/dist/components/message-bubble.js +0 -1
- package/dist/components/model-badge.d.ts +0 -39
- package/dist/components/model-badge.js +0 -1
- package/dist/components/multi-select.d.ts +0 -65
- package/dist/components/multi-select.js +0 -1
- package/dist/components/operation-tree.d.ts +0 -49
- package/dist/components/operation-tree.js +0 -1
- package/dist/components/option-list.d.ts +0 -47
- package/dist/components/option-list.js +0 -1
- package/dist/components/ordered-list.d.ts +0 -24
- package/dist/components/ordered-list.js +0 -1
- package/dist/components/paginator.d.ts +0 -69
- package/dist/components/paginator.js +0 -1
- package/dist/components/paragraph.d.ts +0 -38
- package/dist/components/paragraph.js +0 -1
- package/dist/components/placeholder.d.ts +0 -55
- package/dist/components/placeholder.js +0 -1
- package/dist/components/progress-bar.d.ts +0 -56
- package/dist/components/progress-bar.js +0 -1
- package/dist/components/radio-group.d.ts +0 -74
- package/dist/components/radio-group.js +0 -1
- package/dist/components/scatter-plot.d.ts +0 -35
- package/dist/components/scatter-plot.js +0 -1
- package/dist/components/scroll-bar-box.d.ts +0 -37
- package/dist/components/scroll-bar-box.js +0 -1
- package/dist/components/scroll-bar.d.ts +0 -25
- package/dist/components/scroll-bar.js +0 -1
- package/dist/components/scroll-list.d.ts +0 -20
- package/dist/components/scroll-list.js +0 -1
- package/dist/components/scroll-view.d.ts +0 -10
- package/dist/components/scroll-view.js +0 -1
- package/dist/components/search-input.d.ts +0 -55
- package/dist/components/search-input.js +0 -1
- package/dist/components/select-input-indicator.d.ts +0 -32
- package/dist/components/select-input-indicator.js +0 -1
- package/dist/components/select-input-item.d.ts +0 -41
- package/dist/components/select-input-item.js +0 -1
- package/dist/components/select-input.d.ts +0 -110
- package/dist/components/select-input.js +0 -1
- package/dist/components/shimmer-text.d.ts +0 -47
- package/dist/components/shimmer-text.js +0 -1
- package/dist/components/slider.d.ts +0 -103
- package/dist/components/slider.js +0 -1
- package/dist/components/sparkline.d.ts +0 -35
- package/dist/components/sparkline.js +0 -1
- package/dist/components/spinner.d.ts +0 -17
- package/dist/components/spinner.js +0 -1
- package/dist/components/status-line.d.ts +0 -37
- package/dist/components/status-line.js +0 -1
- package/dist/components/status-message.d.ts +0 -21
- package/dist/components/status-message.js +0 -1
- package/dist/components/stepper.d.ts +0 -48
- package/dist/components/stepper.js +0 -1
- package/dist/components/stopwatch.d.ts +0 -49
- package/dist/components/stopwatch.js +0 -1
- package/dist/components/streaming-text.d.ts +0 -46
- package/dist/components/streaming-text.js +0 -1
- package/dist/components/switch.d.ts +0 -55
- package/dist/components/switch.js +0 -1
- package/dist/components/tab.d.ts +0 -19
- package/dist/components/tab.js +0 -1
- package/dist/components/table.d.ts +0 -119
- package/dist/components/table.js +0 -1
- package/dist/components/tabs.d.ts +0 -107
- package/dist/components/tabs.js +0 -1
- package/dist/components/tag.d.ts +0 -35
- package/dist/components/tag.js +0 -1
- package/dist/components/text-input.d.ts +0 -48
- package/dist/components/text-input.js +0 -1
- package/dist/components/textarea.d.ts +0 -68
- package/dist/components/textarea.js +0 -2
- package/dist/components/timer.d.ts +0 -59
- package/dist/components/timer.js +0 -1
- package/dist/components/toast.d.ts +0 -49
- package/dist/components/toast.js +0 -1
- package/dist/components/tooltip.d.ts +0 -43
- package/dist/components/tooltip.js +0 -1
- package/dist/components/transition.d.ts +0 -74
- package/dist/components/transition.js +0 -1
- package/dist/components/tree-view-entry.d.ts +0 -357
- package/dist/components/tree-view-entry.js +0 -1
- package/dist/components/unordered-list.d.ts +0 -30
- package/dist/components/unordered-list.js +0 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
- package/dist/ink/hooks/use-linked-scroll.js +0 -1
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
- package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +0 -39
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
- package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-CFyBVf7l.js +0 -1
- package/dist/packem_shared/render-CuQecTAs.js +0 -24
- package/dist/packem_shared/render.d-CBnYBDk2.d.ts +0 -417
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
- package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
- package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +0 -396
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
- package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
- package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as H,jsxs as rr}from"react/jsx-runtime";import{useState as K,useRef as d,useCallback as j,useLayoutEffect as T,isValidElement as z,useImperativeHandle as tr,Fragment as G}from"react";import{R as N}from"./measure-element-D4M9iSYp.js";import{Box as M}from"../components/box.js";const J=u=>{const[g,m]=K(u),l=d(u),k=j(C=>{const E=typeof C=="function"?C(l.current):C;l.current=E,m(E)},[]),x=j(()=>l.current,[]);return[g,k,x]},er=({children:u,index:g,measureKey:m,onMeasure:l,width:k})=>{const x=d(null);return T(()=>{if(x.current){const{height:C}=N(x.current);l(g,C)}},[g,l,k,m,u]),H(M,{flexDirection:"column",flexShrink:0,ref:x,width:"100%",children:u})},B=u=>{if(u==null)return[];if(Array.isArray(u)){const g=[];for(let m=0;m<u.length;m+=1){const l=u[m];z(l)&&l.type===G?g.push(...B(l.props.children)):g.push(l)}return g}return z(u)&&u.type===G?B(u.props.children):[u]},hr=({children:u,debug:g=!1,onContentHeightChange:m,onItemHeightChange:l,onViewportSizeChange:k,overscan:x=3,ref:C,scrollOffset:E,virtualize:Q=!1,...U})=>{const D=d(!1),[$,q,S]=J({height:0,width:0}),[I,O,R]=J(0),[W,X]=K({}),V=d(null),b=d(0);T(()=>{I!==b.current&&(m?.(I,b.current),b.current=I)},[I,m]);const o=d({}),i=d([]),p=d([]),f=d(0),Y=j((r,t)=>{const e=i.current[r]??r;if(o.current[e]!==t){const h=o.current[e]??0;o.current={...o.current,[e]:t};let n=0;for(let s=0;s<i.current.length;s+=1){const y=i.current[s];y!=null&&(n+=o.current[y]??0)}const c=R();n!==c&&O(n),l?.(r,t,h),f.current=Math.min(f.current,r+1)}},[l,R,O]),F=j(()=>{if(V.current){const{height:r,width:t}=N(V.current),e=S();(t!==e.width||r!==e.height)&&(k?.({height:r,width:t},e),q({height:r,width:t}))}},[V,k,S,q]);T(()=>{F()});const Z=d(null);if(Z.current!==u){Z.current=u;const r=[],t={};B(u).forEach((n,c)=>{if(!n)return;const s=(z(n)?n.key:null)??c;r[c]=s;const y=o.current[s]??0;t[s]=y}),o.current=t,i.current=r,p.current=Array.from({length:r.length}).fill(0),f.current=0;let e=0;r.forEach(n=>{e+=t[n]??0});const h=R();e!==h&&O(e)}tr(C,()=>({getBottomOffset:()=>Math.max(0,R()-S().height),getContentHeight:R,getItemHeight:r=>{const t=i.current[r]??r;return o.current[t]??0},getItemPosition:r=>{if(r<0||r>=i.current.length)return null;if(r>=f.current){let h=0,n=0;if(f.current>0){n=f.current;const c=n-1,s=i.current[c]??c,y=o.current[s]??0;h=(p.current[c]??0)+y}for(let c=n;c<=r;c+=1){p.current[c]=h;const s=i.current[c]??c,y=o.current[s]??0;h+=y}f.current=r+1}const t=p.current[r]??0,e=i.current[r]??r;return{height:o.current[e]??0,top:t}},getViewportHeight:()=>S().height,remeasure:F,remeasureItem:r=>{X(t=>({...t,[r]:(t[r]??0)+1}))}}),[F,R,S,X]);const v=B(u);!D.current&&I>0&&(D.current=!0);let w=0,a=v.length-1,L=0,P=0;const _=v.length>0&&v.every((r,t)=>{const e=i.current[t]??t;return(o.current[e]??0)>0}),A=Q&&D.current&&_;if(A){const r=i.current.length;if(f.current<r){let e=0,h=0;if(f.current>0){h=f.current;const n=h-1,c=i.current[n]??n,s=o.current[c]??0;e=(p.current[n]??0)+s}for(let n=h;n<r;n+=1){p.current[n]=e;const c=i.current[n]??n;e+=o.current[c]??0}f.current=r}const t=E+$.height;w=v.length,a=-1;for(let e=0;e<r;e+=1){const h=p.current[e]??0,n=i.current[e]??e,c=o.current[n]??0;h+c>E&&h<t&&(e<w&&(w=e),a=e)}if(w>a&&(w=0,a=-1),w=Math.max(0,w-x),a=Math.min(v.length-1,Math.max(-1,a)+x),L=p.current[w]??0,a<v.length-1){const e=i.current[a]??a,h=(p.current[a]??0)+(o.current[e]??0);P=I-h}}return H(M,{...U,children:H(M,{ref:V,width:"100%",children:H(M,{overflow:g?void 0:"hidden",width:"100%",children:rr(M,{flexDirection:"column",marginTop:-E,width:"100%",children:[A&&L>0&&H(M,{height:L}),v.map((r,t)=>!r||A&&(t<w||t>a)?null:H(er,{index:t,measureKey:W[t],onMeasure:Y,width:$.width,children:r},z(r)?r.key??t:t)),A&&P>0&&H(M,{height:P})]})})})})};export{hr as C,J as f};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type CursorPosition = {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Declarative cursor shape, mapped to DECSCUSR (`CSI Ps SP q`).
|
|
7
|
-
*
|
|
8
|
-
* `"default"` restores the terminal's user-configured shape (`Ps=0`).
|
|
9
|
-
* Steady variants are non-blinking; `blinking-*` variants opt into blink.
|
|
10
|
-
*/
|
|
11
|
-
type CursorShape = "bar" | "blinking-bar" | "blinking-block" | "blinking-underline" | "block" | "default" | "underline";
|
|
12
|
-
export { CursorShape as C, CursorPosition as a };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function S(o){const t=Math.max(0,Math.floor(o/1e3)),a=Math.floor(t/3600),r=Math.floor(t%3600/60),n=t%60;return a>0?`${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`}export{S as f};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'tseep';
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as N,jsx as I}from"react/jsx-runtime";import{useMemo as u}from"react";import{c as d}from"./braille-ch3O5D7I.js";import{Box as h}from"../components/box.js";import{Canvas as f}from"../components/canvas.js";import{Text as y}from"../components/text.js";const T=["cyan","magenta","yellow","green","blue","red"],g=e=>e.length===0?[]:typeof e[0]=="number"?e.map((o,t)=>({x:t,y:o})):e,E=(e,o,t)=>e.color??t[o%t.length]??"cyan",b=e=>{let o=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const{points:x}of e)for(const n of x)n.x<o&&(o=n.x),n.x>t&&(t=n.x),n.y<r&&(r=n.y),n.y>s&&(s=n.y);return{xMax:t,xMin:o,yMax:s,yMin:r}},Y=T,M=(e,o,t,r)=>{const s=o.xMax-o.xMin||1,x=o.yMax-o.yMin||1,n=(e.x-o.xMin)/s,c=(e.y-o.yMin)/x;return{px:Math.max(0,Math.min(t-1,Math.round(n*(t-1)))),py:Math.max(0,Math.min(r-1,Math.round((1-c)*(r-1))))}},_=(e,o,t)=>{e.clear();const{axisColor:r,seriesList:s}=t,x=Math.max(1,e.width*2),n=Math.max(1,e.height*4);for(let c=0;c<e.width;c+=2)e.setCell(c,e.height-1,"·",{color:r,dim:!0});for(const{color:c,points:m}of s){if(m.length===0)continue;const l=d(e.width,e.height);if(o==="scatter")for(const i of m){const a=M(i,t,x,n);l.plotPoint(a.px,a.py)}else{let i=M(m[0],t,x,n);l.plotPoint(i.px,i.py);for(let a=1;a<m.length;a+=1){const p=M(m[a],t,x,n);l.plotLine(i.px,i.py,p.px,p.py),i=p}}l.flush(e,{color:c})}};function L({axisColor:e="gray",height:o=10,maxY:t,minY:r,palette:s=Y,series:x,showLegend:n=!0,width:c=40}){const m=u(()=>{const l=x.map((a,p)=>({color:E(a,p,s),points:g(a.data),series:a})),i=b(l);return{axisColor:e,palette:s,seriesList:l,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:r??(i.yMin===Number.POSITIVE_INFINITY?0:i.yMin)}},[x,e,s,r,t]);return N(h,{flexDirection:"column",children:[I(f,{draw:l=>{_(l,"line",m)},height:o,version:[x,c,o,r,t,e,s],width:c}),n?I(h,{gap:2,marginTop:1,children:m.seriesList.map(({color:l,series:i},a)=>N(h,{gap:1,children:[I(y,{color:l,children:"●"}),I(y,{children:i.label??`Series ${a+1}`})]},`${a}:${i.label??""}`))}):void 0]})}export{T as D,M as a,b as c,_ as d,L as h,E as p,g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";const f=l(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=s=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,n]=t.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return t.getBuiltinModule(s)}return f(s)},{existsSync:u}=i("node:fs"),{createRequire:p}=i("node:module"),{dirname:a,join:r}=i("node:path"),{fileURLToPath:_}=i("node:url"),j=12,g=s=>{const e=p(s),n=a(_(s));let o=n;for(let c=0;c<j;c+=1){if(u(r(o,"package.json"))&&u(r(o,"index.js")))return e(r(o,"index.js"));const d=a(o);if(d===o)break;o=d}return e(r(n,"..","index.js"))};export{g as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as x}from"node:module";import{version as L,createContext as R}from"react";import b from"react-reconciler";import{NoEventPriority as A,DefaultEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as D,unstable_scheduleCallback as O,unstable_now as G,unstable_cancelCallback as F}from"scheduler";import n from"yoga-layout";import{b as _,d as f,s as m,m as p,e as v,r as T,f as w,c as W,h,j as I}from"./dom-rphpG0kf.js";const $=x(import.meta.url),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=S,k=[["top",n.EDGE_TOP],["right",n.EDGE_RIGHT],["bottom",n.EDGE_BOTTOM],["left",n.EDGE_LEFT]],B=(t,e)=>{if("position"in e){let r=n.POSITION_TYPE_RELATIVE;e.position==="absolute"?r=n.POSITION_TYPE_ABSOLUTE:e.position==="static"&&(r=n.POSITION_TYPE_STATIC),t.setPositionType(r)}for(const[r,s]of k){if(!(r in e))continue;const l=e[r];if(typeof l=="string"){t.setPositionPercent(s,Number.parseFloat(l));continue}t.setPosition(s,l)}},H=(t,e)=>{"margin"in e&&t.setMargin(n.EDGE_ALL,e.margin??0),"marginX"in e&&t.setMargin(n.EDGE_HORIZONTAL,e.marginX??0),"marginY"in e&&t.setMargin(n.EDGE_VERTICAL,e.marginY??0),"marginLeft"in e&&t.setMargin(n.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(n.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(n.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(n.EDGE_BOTTOM,e.marginBottom||0)},M=(t,e)=>{"padding"in e&&t.setPadding(n.EDGE_ALL,e.padding??0),"paddingX"in e&&t.setPadding(n.EDGE_HORIZONTAL,e.paddingX??0),"paddingY"in e&&t.setPadding(n.EDGE_VERTICAL,e.paddingY??0),"paddingLeft"in e&&t.setPadding(n.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(n.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(n.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(n.EDGE_BOTTOM,e.paddingBottom||0)},U=(t,e)=>{"flexGrow"in e&&t.setFlexGrow(e.flexGrow??0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexWrap"in e&&(e.flexWrap==="nowrap"&&t.setFlexWrap(n.WRAP_NO_WRAP),e.flexWrap==="wrap"&&t.setFlexWrap(n.WRAP_WRAP),e.flexWrap==="wrap-reverse"&&t.setFlexWrap(n.WRAP_WRAP_REVERSE)),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(n.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(n.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(n.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(n.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(Number.NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(n.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(n.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(n.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(n.ALIGN_FLEX_END),e.alignItems==="baseline"&&t.setAlignItems(n.ALIGN_BASELINE)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(n.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(n.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(n.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(n.ALIGN_FLEX_END),e.alignSelf==="stretch"&&t.setAlignSelf(n.ALIGN_STRETCH),e.alignSelf==="baseline"&&t.setAlignSelf(n.ALIGN_BASELINE)),"alignContent"in e&&((e.alignContent==="flex-start"||!e.alignContent)&&t.setAlignContent(n.ALIGN_FLEX_START),e.alignContent==="center"&&t.setAlignContent(n.ALIGN_CENTER),e.alignContent==="flex-end"&&t.setAlignContent(n.ALIGN_FLEX_END),e.alignContent==="space-between"&&t.setAlignContent(n.ALIGN_SPACE_BETWEEN),e.alignContent==="space-around"&&t.setAlignContent(n.ALIGN_SPACE_AROUND),e.alignContent==="space-evenly"&&t.setAlignContent(n.ALIGN_SPACE_EVENLY),e.alignContent==="stretch"&&t.setAlignContent(n.ALIGN_STRETCH)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(n.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(n.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(n.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(n.JUSTIFY_SPACE_AROUND),e.justifyContent==="space-evenly"&&t.setJustifyContent(n.JUSTIFY_SPACE_EVENLY))},Y=(t,e)=>{"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth(e.minWidth??0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight(e.minHeight??0)),"maxWidth"in e&&(typeof e.maxWidth=="string"?t.setMaxWidthPercent(Number.parseInt(e.maxWidth,10)):t.setMaxWidth(e.maxWidth)),"maxHeight"in e&&(typeof e.maxHeight=="string"?t.setMaxHeightPercent(Number.parseInt(e.maxHeight,10)):t.setMaxHeight(e.maxHeight)),"aspectRatio"in e&&t.setAspectRatio(e.aspectRatio)},j=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?n.DISPLAY_FLEX:n.DISPLAY_NONE)},X=(t,e,r)=>{if(!("borderStyle"in e||"borderTop"in e||"borderBottom"in e||"borderLeft"in e||"borderRight"in e))return;const s=r.borderStyle?1:0;t.setBorder(n.EDGE_TOP,r.borderTop===!1?0:s),t.setBorder(n.EDGE_BOTTOM,r.borderBottom===!1?0:s),t.setBorder(n.EDGE_LEFT,r.borderLeft===!1?0:s),t.setBorder(n.EDGE_RIGHT,r.borderRight===!1?0:s)},V=(t,e)=>{"gap"in e&&t.setGap(n.GUTTER_ALL,e.gap??0),"columnGap"in e&&t.setGap(n.GUTTER_COLUMN,e.columnGap??0),"rowGap"in e&&t.setGap(n.GUTTER_ROW,e.rowGap??0)},J=(t,e)=>{const r=e.overflow??"visible",s=e.overflowX??r,l=e.overflowY??r;s==="scroll"||l==="scroll"?t.setOverflow(n.OVERFLOW_SCROLL):s==="hidden"||l==="hidden"?t.setOverflow(n.OVERFLOW_HIDDEN):t.setOverflow(n.OVERFLOW_VISIBLE)},C=(t,e={},r=e)=>{B(t,e),H(t,e),M(t,e),U(t,e),Y(t,e),j(t,e),X(t,e,r),V(t,e),J(t,r)};if(y.env.DEV==="true"){let t=!1;try{import.meta.resolve("react-devtools-core"),t=!0}catch{}t&&await import("../packem_chunks/devtools.js")}const N=(t,e)=>{if(t===e)return;if(!t)return e;const r={};let s=!1;for(const l of Object.keys(t))(!e||!Object.hasOwn(e,l))&&(r[l]=void 0,s=!0);if(e)for(const l of Object.keys(e))e[l]!==t[l]&&(r[l]=e[l],s=!0);return s?r:void 0},E=t=>{if(t){if(t.yogaNode?.unsetMeasureFunc(),"resizeObservers"in t&&t.resizeObservers?.clear(),"childNodes"in t&&t.childNodes)for(const e of t.childNodes)E(e);t.yogaNode?.free(),"cachedRender"in t&&(t.cachedRender=void 0),"childNodes"in t&&(t.childNodes=[]),t.parentNode=void 0}};let u=A,g;async function q(){const t=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),e=JSON.parse(t);return{name:e?.name,version:e?.version}}let d={name:"ink",version:L};if(y.env.DEV==="true")try{const t=await q();d={name:t.name||d.name,version:t.version||d.version}}catch(t){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",t)}const rt=b({afterActiveInstanceBlur(){},appendChild:f,appendChildToContainer:f,appendInitialChild:f,beforeActiveInstanceBlur(){},cancelCallback:F,cancelTimeout:clearTimeout,clearContainer:()=>!1,commitTextUpdate(t,e,r){m(t,r)},commitUpdate(t,e,r,s){g&&t.internal_static&&(g.isStaticDirty=!0);const l=N(r,s),a=N(r.style,s.style);if(!l&&!a)return;let i=!!a;if(l){for(const[o,c]of Object.entries(l))if(o!=="children"){if(o==="style"){h(t,c);continue}if(o==="internal_transform"){t.internal_transform=c,i=!0;continue}if(o==="internal_cursor"){t.internal_cursor=c,i=!0;continue}if(o==="internal_static"){t.internal_static=!0,i=!0;continue}if(o==="sticky"){t.internal_sticky=c,i=!0;continue}if(o==="internalStickyAlternate"){t.internal_stickyAlternate=c,i=!0;continue}if(o==="opaque"){t.internal_opaque=c,i=!0;continue}if(o==="scrollbar"){t.internal_scrollbar=c,i=!0;continue}if(o==="internal_terminalCursorFocus"){t.internal_terminalCursorFocus=c,i=!0;continue}if(o==="internal_terminalCursorPosition"){t.internal_terminalCursorPosition=c,i=!0;continue}if(o==="cachedRender"){t.cachedRender=c,i=!0;continue}I(t,o,c),i=!0}}a&&t.yogaNode&&C(t.yogaNode,a,s.style??{}),i&&p(t)},createInstance(t,e,r,s){if(s.isInsideText&&t==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(s.isInsideText&&t==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const l=t==="ink-text"&&s.isInsideText?"ink-virtual-text":t,a=W(l);for(const[i,o]of Object.entries(e))if(i!=="children"){if(i==="style"){h(a,o),a.yogaNode&&C(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"){g=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}I(a,i,o)}return a},createTextInstance(t,e,r){if(!r.isInsideText)throw new Error(`Text string "${t}" must be rendered inside <Text> component`);return w(t)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(t,e){const r=t.isInsideText,s=e==="ink-text"||e==="ink-virtual-text";return r===s?t:{isInsideText:s}},getCurrentUpdatePriority:()=>u,getInstanceFromNode:()=>null,getInstanceFromScope:()=>null,getPublicInstance:t=>t,getRootHostContext:()=>({isInsideText:!1}),hideInstance(t){t.internal_hidden=!0,t.yogaNode?.setDisplay(n.DISPLAY_NONE),p(t)},hideTextInstance(t){m(t,"")},HostTransitionContext:R(null),insertBefore:_,insertInContainerBefore:_,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:G,preloadInstance(){return!0},prepareForCommit:()=>null,preparePortalMount:()=>null,prepareScopeUpdate(){},removeChild(t,e){T(t,e),E(e)},removeChildFromContainer(t,e){T(t,e),E(e)},rendererPackageName:d.name,rendererVersion:d.version,requestPostPaintCallback(){},resetAfterCommit(t){if(typeof t.onComputeLayout=="function"&&t.onComputeLayout(),v(t),t.staticNode!==t.previousStaticNode&&(t.previousStaticNode=t.staticNode,typeof t.onStaticChange=="function"&&t.onStaticChange()),t.isStaticDirty){t.isStaticDirty=!1,typeof t.onImmediateRender=="function"&&t.onImmediateRender();return}typeof t.onRender=="function"&&t.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return u!==A?u:P},scheduleCallback:O,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(t){u=t},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:()=>!1,shouldYield:D,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(t){t.internal_hidden=!1,t.yogaNode?.setDisplay(n.DISPLAY_FLEX),p(t)},unhideTextInstance(t,e){m(t,e)},waitForCommitToBeReady(){return null}});export{C as c,rt as j};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{createRequire as we}from"node:module";import{jsxs as W,jsx as x}from"react/jsx-runtime";import{cursorShow as nt,setMode as Vt,BracketedPasteMode as Xt,resetMode as Zt,cursorUp as yt,cursorTo as Ct,cursorHide as q,cursorDown as Te,setCursorStyle as Re,eraseLines as j,cursorNextLine as Se,eraseLineEnd as Ee,createDecMode as Oe,ALT_SCREEN_ON as Pe,clearScreenAndHomeCursor as Ne,ALT_SCREEN_OFF as ke}from"@visulima/ansi";import{wordWrap as De}from"@visulima/string";import Jt from"is-in-ci";import Le from"patch-console";import{ConcurrentRoot as Ie,LegacyRoot as We}from"react-reconciler/constants.js";import{onExit as $e}from"signal-exit";import A from"yoga-layout";import{a as Me}from"./accessibility-context-DDyHTwmA.js";import{PureComponent as Ae,useState as ct,useRef as $,useCallback as y,useEffect as vt,useMemo as F}from"react";import{e as Be}from"./animation-context-DW3p-vpk.js";import{t as He}from"./app-context-BVpKlG1z.js";import{o as Ue}from"./cursor-context-CFviBqPX.js";import{parseStacktrace as Ye}from"@visulima/error/stacktrace";import je from"code-excerpt";import{Box as _}from"../components/box.js";import{Text as M}from"../components/text.js";import{o as qe}from"./focus-context-CsT69klR.js";import{t as ze}from"./stderr-context-Bvnik0hL.js";import{e as Ge}from"./stdin-context-88AhuztD.js";import{t as Ve}from"./stdout-context-BnblEPez.js";import{I as Xe,_ as Ze,r as Je,H as Qe}from"./renderer-k-xShm1P.js";import{c as ti,e as ei}from"./dom-rphpG0kf.js";import{resolveFlags as ii}from"./kittyFlags-g8ALyoCU.js";import{p as ri}from"./load-native-root-binding-DDikxNox.js";import{a as si}from"./measure-text-B7juNq4Y.js";import{j as L,c as oi}from"./reconciler-CFyBVf7l.js";import{measureAndExtractObservers as ni}from"./ResizeObserver-BI9bDy-j.js";import{calculateScroll as ui}from"./calculateScroll-D4Y_JR4H.js";import{g as X}from"./utils-Bup8lyK8.js";const be=we(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ot=e=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[t,i]=Q.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Q.getBuiltinModule(e)}return be(e)},k=Q,{cwd:ye}=k,{Stream:xe}=ot("node:stream"),{Buffer:Ht}=ot("node:buffer"),{Console:Ce}=ot("node:console"),{EventEmitter:_e}=ot("node:events"),{existsSync:Ke,readFileSync:Fe}=ot("node:fs"),Qt="\x1B[200~",Ut="\x1B[201~",ai=e=>e>=48&&e<=63,li=e=>e>=32&&e<=47,te=e=>e>=64&&e<=126,di=(e,t,i)=>{const r=t+i+1;let o=r;for(;o<e.length;o++){const u=e.codePointAt(o);if(u===void 0)return"pending";if(!(ai(u)||li(u))&&!(u===91&&o===r))return te(u)?{nextIndex:o+1,sequence:e.slice(t,o+1)}:void 0}return"pending"},ci=(e,t,i)=>{const r=t+i+2;if(r>e.length)return"pending";const o=e.codePointAt(r-1);if(!(o===void 0||!te(o)))return{nextIndex:r,sequence:e.slice(t,r)}},Kt=(e,t,i)=>{const r=e[t+i];if(r===void 0)return"pending";if(r==="[")return di(e,t,i);if(r==="O")return ci(e,t,i)},hi=(e,t)=>{const i=e.codePointAt(t+1),r=i!==void 0&&i>65535?2:1,o=t+1+r;return{nextIndex:o,sequence:e.slice(t,o)}},fi=(e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const r=Kt(e,t,2);return r==="pending"?"pending":r||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const i=Kt(e,t,1);return i==="pending"?"pending":i||hi(e,t)},Ft=(e,t)=>{let i=0;for(let r=0;r<e.length;r++){const o=e[r];(o===""||o==="\b")&&(r>i&&t.push(e.slice(i,r)),t.push(o),i=r+1)}i<e.length&&t.push(e.slice(i))},pi=e=>{const t=[];let i=0;const r=o=>({events:t,pending:e.slice(o)});for(;i<e.length;){const o=e.indexOf("\x1B",i);if(o===-1)return Ft(e.slice(i),t),{events:t,pending:""};o>i&&Ft(e.slice(i,o),t);const u=fi(e,o);if(u==="pending")return r(o);if(u.sequence===Qt){const l=u.nextIndex,n=e.indexOf(Ut,l);if(n===-1)return r(o);t.push({paste:e.slice(l,n)}),i=n+Ut.length;continue}t.push(u.sequence),i=u.nextIndex}return{events:t,pending:""}},mi=()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(Qt)&&e!=="\x1B[200"},push(t){const i=pi(e+t);return e=i.pending,i.events},reset(){e=""}}},wt=e=>{if(!e)return e;const t=ye();return e.replace(`file://${t}/`,"").replace(`${t}/`,"")};function gi({error:e}){const t=Ye(e),i=new Map,r=t.map(s=>{const a=!s.methodName&&!s.file?`raw:${s.raw}`:`${wt(s.file)??""}:${s.line}:${s.column}:${s.methodName??""}`,p=i.get(a)??0;return i.set(a,p+1),{key:`${a}#${p}`,trace:s}}),o=t[0],u=wt(o?.file);let l,n=0;if(u&&o?.line&&Ke(u)){const s=Fe(u,"utf8");if(l=je(s,o.line),l)for(const{line:a}of l)n=Math.max(n,String(a).length)}return W(_,{flexDirection:"column",padding:1,children:[W(_,{children:[W(M,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),W(M,{children:[" ",e.message]})]}),o&&u?x(_,{marginTop:1,children:W(M,{dimColor:!0,children:[u,":",o.line,":",o.column]})}):null,o&&l?x(_,{flexDirection:"column",marginTop:1,children:l.map(({line:s,value:a})=>W(_,{children:[x(_,{width:n+1,children:W(M,{"aria-label":s===o.line?`Line ${s}, error`:`Line ${s}`,backgroundColor:s===o.line?"red":void 0,color:s===o.line?"white":void 0,dimColor:s!==o.line,children:[String(s).padStart(n," "),":"]})}),x(M,{backgroundColor:s===o.line?"red":void 0,color:s===o.line?"white":void 0,children:` ${a}`})]},`excerpt-${s}`))}):null,t.length>0?x(_,{flexDirection:"column",marginTop:1,children:r.map(({key:s,trace:a})=>{const p=wt(a.file)??"";return!a.methodName&&!a.file?W(_,{children:[x(M,{dimColor:!0,children:"- "}),x(M,{bold:!0,dimColor:!0,children:a.raw})]},s):W(_,{children:[x(M,{dimColor:!0,children:"- "}),x(M,{bold:!0,dimColor:!0,children:a.methodName??"<anonymous>"}),W(M,{"aria-label":`at ${p} line ${a.line} column ${a.column}`,color:"gray",dimColor:!0,children:[" ","(",p,":",a.line,":",a.column,")"]})]},s)})}):null]})}class vi extends Ae{static displayName="InternalErrorBoundary";static getDerivedStateFromError(t){return{error:t}}state={error:void 0};componentDidCatch(t){this.props.onError(t)}render(){return this.state.error?x(gi,{error:this.state.error}):this.props.children}}const wi=" ",bi="\x1B[Z",yi="\x1B",xi=Vt(Xt),Yt=Zt(Xt),ee=({children:e,exitOnCtrlC:t,interactive:i,onExit:r,onWaitUntilRenderFlush:o,renderThrottleMs:u,setCursorPosition:l,stderr:n,stdin:s,stdout:a,writeToStderr:p,writeToStdout:w})=>{const[g,d]=ct(!0),[h,v]=ct(void 0),[,b]=ct([]),P=$(0),T=$(new Map),D=$(void 0),N=$(0),I=$(!1),E=$(0),[S]=ct(()=>{const c=new _e;return c.setMaxListeners(1/0),c}),K=$(void 0),R=$(void 0);R.current??=mi();const B=$(void 0),Tt=$(!1),ae=20,z=y(()=>{B.current&&(clearTimeout(B.current),B.current=void 0)},[]),G=y(()=>{D.current&&(clearTimeout(D.current),D.current=void 0)},[]),ut=y(()=>{if(G(),T.current.size===0)return;let c=Number.POSITIVE_INFINITY;for(const f of T.current.values())c=Math.min(c,f.nextDueTime);const m=Math.max(0,c-performance.now());D.current=setTimeout(()=>{D.current=void 0;const f=performance.now(),C=[...T.current.values()];for(const O of C){if(f<O.nextDueTime)continue;O.callback(f);const ge=f-O.startTime,ve=Math.floor(ge/O.interval)+1;O.nextDueTime=O.startTime+ve*O.interval}ut()},m)},[G]),Rt=y((c,m)=>{const f=performance.now();return T.current.set(c,{callback:c,interval:m,nextDueTime:f+m,startTime:f}),ut(),{startTime:f,unsubscribe(){if(T.current.delete(c),T.current.size===0){G();return}ut()}}},[G,ut]);vt(()=>()=>{G()},[G]);const H=s.isTTY,St=y(()=>{K.current&&(s.removeListener("readable",K.current),K.current=void 0)},[s]),at=y(()=>{R.current?.reset(),z(),St()},[z,St]),V=y(()=>{I.current=!1,s.setRawMode(!1),s.unref(),N.current=0,at()},[s,at]),et=y(c=>{H&&(N.current>0||I.current)&&V(),r(c)},[H,V,r]),Et=y(c=>{if(c.includes("")&&t){et();return}c===yi&&g&&v(m=>{if(!m)return m})},[t,et,g]),it=y(c=>{Et(c),S.emit("input",c)},[Et,S]),Ot=y(()=>{z(),B.current=setTimeout(()=>{B.current=void 0;const c=R.current.flushPendingEscape();c&&it(c)},ae)},[z,it]),gt=y(()=>{z();let c;for(;(c=s.read())!==null;){const m=R.current.push(c);for(const f of m)if(typeof f=="string")it(f);else{if(S.listenerCount("paste")===0){Tt.current||(Tt.current=!0,p(`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().
|
|
2
|
-
`)),it(f.paste);continue}S.emit("paste",f.paste)}}R.current.hasPendingEscape()&&Ot()},[s,it,z,Ot,p,S]),Pt=y(()=>{K.current||(K.current=gt,s.addListener("readable",gt))},[s,gt]),Nt=y(c=>{if(!H)throw s===k.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
|
|
3
|
-
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.
|
|
4
|
-
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(s.setEncoding("utf8"),c){if(N.current===0){const m=I.current;I.current=!1,m||(s.ref(),s.setRawMode(!0)),Pt()}N.current++;return}N.current!==0&&--N.current===0&&(at(),I.current=!0,queueMicrotask(()=>{I.current&&V()}))},[H,s,Pt,at,V]),kt=y(c=>{if(a.isTTY){if(c){E.current===0&&a.write(xi),E.current++;return}E.current!==0&&--E.current===0&&a.write(Yt)}},[a]),Dt=y((c,m)=>{const f=c.findIndex(C=>C.id===m);for(let C=f+1;C<c.length;C++){const O=c[C];if(O?.isActive)return O.id}},[]),Lt=y((c,m)=>{const f=c.findIndex(C=>C.id===m);for(let C=f-1;C>=0;C--){const O=c[C];if(O?.isActive)return O.id}},[]),lt=y(()=>{b(c=>(v(m=>{const f=c.find(C=>C.isActive)?.id;return Dt(c,m)??f}),c))},[Dt]),dt=y(()=>{b(c=>(v(m=>{const f=c.findLast(C=>C.isActive)?.id;return Lt(c,m)??f}),c))},[Lt]);vt(()=>{const c=f=>{!g||P.current===0||(f===wi&<(),f===bi&&dt())};S.on("input",c);const m=S;return()=>{m.off("input",c)}},[g,lt,dt,S]);const It=y(()=>{d(!0)},[]),Wt=y(()=>{d(!1)},[]),$t=y(c=>{b(m=>(m.some(f=>f?.id===c)&&v(c),m))},[]),Mt=y((c,{autoFocus:m})=>{b(f=>(P.current=f.length+1,[...f,{id:c,isActive:!0}])),m&&v(f=>f||c)},[]),_t=y(c=>{v(m=>{if(m!==c)return m}),b(m=>{const f=m.filter(C=>C.id!==c);return P.current=f.length,f})},[]),At=y(c=>{b(m=>m.map(f=>f.id!==c?f:{id:c,isActive:!0}))},[]),Bt=y(c=>{v(m=>{if(m!==c)return m}),b(m=>m.map(f=>f.id!==c?f:{id:c,isActive:!1}))},[]);vt(()=>()=>{const c=!a.destroyed&&!a.writableEnded;i&&c&&a.write(nt),H&&(N.current>0||I.current)&&V(),E.current>0&&(a.isTTY&&c&&a.write(Yt),E.current=0)},[a,H,V,i]);const le=F(()=>({exit:et,waitUntilRenderFlush:o}),[et,o]),de=F(()=>({internal_eventEmitter:S,internal_exitOnCtrlC:t,isRawModeSupported:H,setBracketedPasteMode:kt,setRawMode:Nt,stdin:s}),[s,Nt,kt,H,t,S]),ce=F(()=>({stdout:a,write:w}),[a,w]),he=F(()=>({stderr:n,write:p}),[n,p]),fe=F(()=>({setCursorPosition:l}),[l]),pe=F(()=>({activate:At,activeId:h,add:Mt,deactivate:Bt,disableFocus:Wt,enableFocus:It,focus:$t,focusNext:lt,focusPrevious:dt,remove:_t}),[h,Mt,_t,At,Bt,It,Wt,lt,dt,$t]),me=F(()=>({renderThrottleMs:u,subscribe:Rt}),[Rt,u]);return x(He.Provider,{value:le,children:x(Ge.Provider,{value:de,children:x(Ve.Provider,{value:ce,children:x(ze.Provider,{value:he,children:x(qe.Provider,{value:pe,children:x(Be.Provider,{value:me,children:x(Ue.Provider,{value:fe,children:x(vi,{onError:et,children:e})})})})})})})})};ee.displayName="InternalApp";const Ci=(e,t,i)=>{if(i<=0||!e.yogaNode)return"";const{yogaNode:r}=e,o=r.getComputedBorder(A.EDGE_LEFT),u=r.getComputedBorder(A.EDGE_RIGHT),l=r.getComputedBorder(A.EDGE_TOP),n=r.getComputedPadding(A.EDGE_LEFT),s=r.getComputedPadding(A.EDGE_RIGHT),a=r.getComputedPadding(A.EDGE_TOP),p=Math.round(r.getComputedWidth()-o-u-n-s);if(p<=0)return"";const w=new Xe({height:i,width:p}),g=-(e.internal_scrollState?.scrollLeft??0)-o-n,d=-t-l-a;for(const h of e.childNodes)Ze(h,w,{absoluteOffsetX:g,absoluteOffsetY:d,offsetX:g,offsetY:d,skipStaticElements:!1});return w.get().output},xt=new WeakMap,Ti={bar:6,"blinking-bar":5,"blinking-block":1,"blinking-underline":3,block:2,default:0,underline:4},jt=e=>Re(Ti[e]),ft=(e,t)=>e?.x!==t?.x||e?.y!==t?.y,tt=(e,t)=>{if(!t)return"";const i=e-t.y;return(i>0?yt(i):"")+Ct(t.x)+nt},ie=(e,t)=>{if(!t)return"";const i=e-1-t.y;return(i>0?Te(i):"")+Ct(0)},re=e=>{const t=e.cursorWasShown?q:"",i=ie(e.previousLineCount,e.previousCursorPosition),r=tt(e.visibleLineCount,e.cursorPosition);return t+i+r},pt=(e,t,i)=>e?q+ie(t,i):"",Z=e=>e??"default",se=()=>{let e,t;return{consumeDelta:()=>{if(Z(t)===Z(e))return"";const i=Z(t);return e=t,jt(i)},consumeRestoreOnDone:()=>{const i=Z(e)!=="default";return e=void 0,t=void 0,i?jt("default"):""},isDirty:()=>Z(t)!==Z(e),setPending:i=>{t=i}}},st=(e,t)=>t.endsWith(`
|
|
5
|
-
`)?e.length-1:e.length,oe=e=>e.rows||1/0,mt=(e,t)=>Math.min(e,oe(t)),Ri=(e,{showCursor:t=!1}={})=>{let i=0,r="",o=!1,u,l=!1,n,s=!1;const a=se(),p=()=>l?u:void 0,w=(d,h)=>{const v=ft(h,n);return d!==r||v||a.isDirty()},g=d=>{!t&&!o&&(e.write(q),o=!0);const h=p();l=!1;const v=ft(h,n);if(!w(d,h))return!1;const b=a.consumeDelta(),P=d.split(`
|
|
6
|
-
`),T=st(P,d),D=tt(T,h);if(d===r&&v)e.write(b+re({cursorPosition:h,cursorWasShown:s,previousCursorPosition:n,previousLineCount:i,visibleLineCount:T}));else if(d===r&&b!=="")e.write(b);else{r=d;const N=pt(s,i,n);e.write(b+N+j(mt(i,e))+d+D),i=P.length}return n=h?{...h}:void 0,s=h!==void 0,!0};return g.clear=()=>{const d=pt(s,i,n);e.write(d+j(mt(i,e))),r="",i=0,n=void 0,s=!1},g.done=()=>{r="",i=0,n=void 0,s=!1;const d=a.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(nt),o=!1)},g.reset=()=>{r="",i=0,n=void 0,s=!1},g.sync=d=>{const h=l?u:void 0;l=!1;const v=d.split(`
|
|
7
|
-
`);r=d,i=v.length;const b=a.consumeDelta();b!==""&&e.write(b),!h&&s&&e.write(q),h&&e.write(tt(st(v,d),h)),n=h?{...h}:void 0,s=h!==void 0},g.setCursorPosition=d=>{u=d,l=!0},g.setCursorShape=a.setPending,g.isCursorDirty=()=>l||a.isDirty(),g.willRender=d=>w(d,p()),g},Si=(e,{showCursor:t=!1}={})=>{let i=[],r="",o=!1,u,l=!1,n,s=!1;const a=se(),p=()=>l?u:void 0,w=(d,h)=>{const v=ft(h,n);return d!==r||v||a.isDirty()},g=d=>{!t&&!o&&(e.write(q),o=!0);const h=p();l=!1;const v=ft(h,n);if(!w(d,h))return!1;const b=a.consumeDelta(),P=d.split(`
|
|
8
|
-
`),T=st(P,d),D=st(i,r);if(d===r&&v)return e.write(b+re({cursorPosition:h,cursorWasShown:s,previousCursorPosition:n,previousLineCount:i.length,visibleLineCount:T})),n=h?{...h}:void 0,s=h!==void 0,!0;if(d===r&&b!=="")return e.write(b),!0;const N=pt(s,i.length,n);if(d===`
|
|
9
|
-
`||r.length===0){const R=tt(T,h);return e.write(b+N+j(mt(i.length,e))+d+R),s=h!==void 0,n=h?{...h}:void 0,r=d,i=P,!0}const I=d.endsWith(`
|
|
10
|
-
`),E=[b,N],S=oe(e);if(T<D){const R=r.endsWith(`
|
|
11
|
-
`)?1:0;E.push(j(Math.min(D-T+R,S)),yt(Math.min(T,S-1)))}else E.push(yt(Math.min(D-1,S-1)));for(let R=0;R<T;R++){const B=R===T-1;if(P[R]===i[R]){(!B||I)&&E.push(Se());continue}E.push(Ct(0)+P[R]+Ee+(B&&!I?"":`
|
|
12
|
-
`))}const K=tt(T,h);return E.push(K),e.write(E.join("")),s=h!==void 0,n=h?{...h}:void 0,r=d,i=P,!0};return g.clear=()=>{const d=pt(s,i.length,n);e.write(d+j(mt(i.length,e))),r="",i=[],n=void 0,s=!1},g.done=()=>{r="",i=[],n=void 0,s=!1;const d=a.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(nt),o=!1)},g.reset=()=>{r="",i=[],n=void 0,s=!1},g.sync=d=>{const h=l?u:void 0;l=!1;const v=d.split(`
|
|
13
|
-
`);r=d,i=v;const b=a.consumeDelta();b!==""&&e.write(b),!h&&s&&e.write(q),h&&e.write(tt(st(v,d),h)),n=h?{...h}:void 0,s=h!==void 0},g.setCursorPosition=d=>{u=d,l=!0},g.setCursorShape=a.setPending,g.isCursorDirty=()=>l||a.isDirty(),g.willRender=d=>w(d,p()),g},Ei=(e,{incremental:t=!1,showCursor:i=!1}={})=>t?Si(e,{showCursor:i}):Ri(e,{showCursor:i}),Oi={create:Ei},ne=Oe(2026),Y=Vt(ne),U=Zt(ne);function Pi(e,t){return"isTTY"in e&&e.isTTY&&(t??!Jt)}let J;const Ni=()=>{if(J!==!1){if(J!==void 0)return J;try{return J=ri(import.meta.url).Renderer,J}catch{J=!1;return}}},ki=e=>{const t=Ni();if(!t)return;let i,r=0,o=0;const u=(l,n)=>{(!i||r!==l||o!==n)&&(i?i.resize(l,n):i=new t(l,n),r=l,o=n)};return{clear(){if(i){const l=new Uint32Array(r*o*2),n=65535;for(let s=0;s<l.length;s+=2)l[s]=32,l[s+1]=n;i.render(l)}},destroy(){i=void 0},render(l,n,s){if(u(n,s),!!i){e.isTTY&&i.writeRaw(Y);try{i.render(l)}finally{e.isTTY&&i.writeRaw(U)}}},resize(l,n){u(l,n)}}};function qt(e,t=0,i={}){const r=i.leading??!0,o=i.trailing??!0;let u,l,n,s;const a=()=>{if(l===void 0)return;const h=l;l=void 0,s=e(...h)},p=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},w=()=>{u=void 0,o&&a(),l=void 0,n=void 0},g=()=>{p(),u=setTimeout(w,t)},d=function(...h){const v=Date.now();if(n??=v,v-n>=t)return l=h,a(),n=v,g(),s;l=h;const b=u===void 0;return g(),r&&b&&a(),s};return d.cancel=()=>{p(),l=void 0,n=void 0},d.flush=()=>(p(),a(),n=void 0,s),d}console.Console||(console.Console=Ce);const rt=()=>{},zt=async()=>new Promise(e=>{setImmediate(e)}),Di=27,Li=91,Ii=63,Wi=117,$i=48,Mi=57,_i=e=>e>=$i&&e<=Mi,ue=(e,t)=>{if(e[t]!==Di||e[t+1]!==Li||e[t+2]!==Ii)return;let i=t+3;const r=i;for(;i<e.length&&_i(e[i]);)i++;if(i!==r){if(i===e.length)return{state:"partial"};if(e[i]===Wi)return{endIndex:i,state:"complete"}}},Ai=e=>{for(let t=0;t<e.length;t++)if(ue(e,t)?.state==="complete")return!0;return!1},Bi=e=>{const t=[];let i=0;for(;i<e.length;){const r=ue(e,i);if(r?.state==="complete"){i=r.endIndex+1;continue}if(r?.state==="partial")break;t.push(e[i]),i++}return t},Hi=({isTty:e,isUnmounting:t,isWindows:i,nextOutputHeight:r,previousOutputHeight:o,viewportRows:u})=>{if(!e)return!1;const l=o>0,n=o>=u,s=r>=u,a=o>u,p=r>u,w=n&&r<u;return a||p&&l||w||t&&n||i&&(s||n)},bt=e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]",Gt=e=>{const t=!e.destroyed&&!e.writableEnded&&(e.writable??!0),i=e._writableState!==void 0||e.writableLength!==void 0;return{canWriteToStdout:t,hasWritableState:i}},ht=(e,t)=>{if(!e||typeof e.flush!="function")return;const i=e;t?i.flush():typeof i.cancel=="function"&&i.cancel()};class Ui{isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;backbufferNode;backbufferMultiWarned=!1;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=ti("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??k.env.INK_SCREEN_READER==="true",this.interactive=this.resolveInteractiveOption(t.interactive),this.alternateScreen=!1;const i=t.debug||this.isScreenReaderEnabled,r=t.maxFps??30,o=r>0?Math.max(1,Math.ceil(1e3/r)):0;this.renderThrottleMs=i?0:o;const u=i?this.onRender:(()=>{const n=qt(this.onRender,o,{leading:!0,trailing:!0});return this.throttledOnRender=n,()=>{this.hasPendingThrottledRender=!0,n()}})();if(i&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let n=!1;const s=()=>{n||(n=!0,queueMicrotask(()=>{n=!1,this.onRender()}))};this.rootNode.onRender=s,this.rootNode.onImmediateRender=s}else this.rootNode.onRender=u,this.rootNode.onImmediateRender=this.onRender;this.rootNode.onStaticChange=this.handleStaticChange,this.log=Oi.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=ki(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=i?this.log:qt(n=>{const s=this.log.willRender(n),a=this.shouldSync();a&&s&&this.options.stdout.write(Y),this.log(n),a&&s&&this.options.stdout.write(U)},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=X(this.options.stdout).columns,this.fullStaticOutput="";const l=t.concurrent?Ie:We;this.container=L.createContainer(this.rootNode,l,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=$e(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(),k.env.DEV==="true"&&L.injectIntoDevTools(),this.exitPromise=new Promise((n,s)=>{this.resolveExitPromise=n,this.rejectExitPromise=s}),this.exitPromise.catch(rt)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=()=>{const t=X(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),si(),this.calculateLayout(),ei(this.rootNode),this.onRender(),this.lastTerminalWidth=t};resolveExitPromise=()=>{};rejectExitPromise=()=>{};unsubscribeExit=()=>{};handleAppExit=t=>{if(!(this.isUnmounted||this.isUnmounting)){if(bt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}};getActiveCursorPosition=()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition;setCursorPosition=t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())};restoreLastOutput=()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
|
|
14
|
-
`))};calculateLayout=()=>{const t=r=>{const o=new Map;this.calculateScrollAndTriggerObservers(r,o);for(const[u,l]of o)u.internalTrigger(l)};this.backbufferNode=void 0,this.prepareYogaTree(this.rootNode,t);const i=X(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(i),this.rootNode.yogaNode.calculateLayout(void 0,void 0,A.DIRECTION_LTR),t(this.rootNode)};calculateScrollAndTriggerObservers(t,i){if(t.nodeName==="ink-box"){const{style:r}=t,o=r.overflow??"visible",u=r.overflowX??o,l=r.overflowY??o;u==="scroll"||l==="scroll"?(ui(t),r.overflowToBackbuffer&&(this.backbufferNode&&this.backbufferNode!==t&&!this.backbufferMultiWarned&&(this.backbufferMultiWarned=!0,console.warn("[@visulima/tui] Multiple scrollable regions have `overflowToBackbuffer` enabled; only one is supported. The last one in render order wins.")),this.backbufferNode=t)):t.internal_scrollState&&delete t.internal_scrollState}if(ni(t,i),!t.internal_static)for(const r of t.childNodes)r.nodeName!=="#text"&&this.calculateScrollAndTriggerObservers(r,i)}recalculateLayout(){this.markAllTextNodesDirty(this.rootNode),this.calculateLayout(),this.onRender()}prepareYogaTree(t,i){if(t.isYogaTreeDetached&&!t.cachedRender&&t.yogaNode){for(t.yogaNode.setWidthAuto(),t.yogaNode.setHeightAuto(),oi(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let r=0;for(const o of t.childNodes){const u=o;o.nodeName!=="#text"&&u.yogaNode&&(t.yogaNode.insertChild(u.yogaNode,r),r++)}t.isYogaTreeDetached=!1,this.markAllTextNodesDirty(t)}for(const r of t.childNodes)r.nodeName!=="#text"&&this.prepareYogaTree(r,i);if(t.nodeName==="ink-static-render"&&!t.cachedRender){const r=X(this.options.stdout).columns,{width:o}=t.style;t.yogaNode&&(t.yogaNode.setWidth(typeof o=="number"?o:r),t.yogaNode.calculateLayout(void 0,void 0,A.DIRECTION_LTR)),i(t),Je(t,{skipStaticElements:!1}),t.internal_onRendered?.()}}markAllTextNodesDirty(t){if(!t.cachedRender){t.nodeName==="ink-text"&&t.yogaNode&&t.yogaNode.markDirty();for(const i of t.childNodes)i.nodeName!=="#text"&&this.markAllTextNodesDirty(i)}}handleStaticChange=()=>{this.fullStaticOutput=""};computeBackbufferOutput(){const t=this.backbufferNode;if(!t?.internal_scrollState||!this.interactive||!this.options.stdout.isTTY||this.alternateScreen||this.isScreenReaderEnabled||this.options.debug)return"";const i=Math.round(t.internal_scrollState.scrollTop),r=t.yogaNode?.getComputedPadding(A.EDGE_TOP)??0,o=Math.max(0,i-Math.round(r)),u=t.internal_maxPushedScrollTop??0,{maxScrollbackLength:l}=t.style,n=l===void 0?u:Math.max(u,o-Math.max(0,l)),s=o-n;if(s<=0)return"";const a=Ci(t,n,s);return a===""?"":(t.internal_maxPushedScrollTop=o,`${a}\x1B[0m
|
|
15
|
-
`)}onRender=()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=Qe(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:i,cursorRequested:r,cursorShape:o,output:u,outputBuffer:l,outputHeight:n,outputWidth:s,staticOutput:a}=t;this.renderedCursorRequested=r,this.renderedCursorPosition=i,this.log.setCursorShape(r?o:void 0);const p=this.computeBackbufferOutput();if(this.useNativeRenderer&&this.nativeLog&&l&&s){a&&a!==`
|
|
16
|
-
`&&this.options.stdout.write(a),p&&this.options.stdout.write(p),this.nativeLog.render(l,s,n),this.lastOutputHeight=n;return}r&&this.log.setCursorPosition(this.getActiveCursorPosition());const w=a&&a!==`
|
|
17
|
-
`;if(this.options.debug){w&&(this.fullStaticOutput+=a),this.lastOutput=u,this.lastOutputToRender=u,this.lastOutputHeight=n,this.options.stdout.write(this.fullStaticOutput+u);return}if(!this.interactive){w&&this.options.stdout.write(a),this.lastOutput=u,this.lastOutputToRender=`${u}
|
|
18
|
-
`,this.lastOutputHeight=n;return}if(this.isScreenReaderEnabled){const g=this.shouldSync();if(g&&this.options.stdout.write(Y),w){const v=this.lastOutputHeight>0?j(this.lastOutputHeight):"";this.options.stdout.write(v+a),this.lastOutputHeight=0}if(u===this.lastOutput&&!w){g&&this.options.stdout.write(U);return}const d=X(this.options.stdout).columns,h=De(u,{trim:!1,width:d,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(w)this.options.stdout.write(h);else{const v=this.lastOutputHeight>0?j(this.lastOutputHeight):"";this.options.stdout.write(v+h)}this.lastOutput=u,this.lastOutputToRender=h,this.lastOutputHeight=h===""?0:h.split(`
|
|
19
|
-
`).length,g&&this.options.stdout.write(U);return}w&&(this.fullStaticOutput+=a),this.renderInteractiveFrame(u,n,w?a:"",p)};accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const i=x(Me.Provider,{value:this.accessibilityContextValue,children:x(ee,{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?L.updateContainer(i,this.container,null,rt):(L.updateContainerSync(i,this.container,null,rt),L.flushSyncWork())}writeToStdout=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 i=this.shouldSync();i&&this.options.stdout.write(Y),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(U)};writeToStderr=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 i=this.shouldSync();i&&this.options.stdout.write(Y),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(U)};unmount=t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(k.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const i=this.options.stdout,{canWriteToStdout:r,hasWritableState:o}=Gt(i);ht(this.throttledOnRender,r),r&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),ht(this.throttledLog,r),typeof this.restoreConsole=="function"&&this.restoreConsole();const u=()=>{typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),this.cancelKittyDetection&&this.cancelKittyDetection(),r&&(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,ke),this.writeBestEffort(this.options.stdout,nt),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
|
|
20
|
-
`:`${this.lastOutput}
|
|
21
|
-
`)),this.kittyProtocolEnabled=!1,xt.delete(this.options.stdout);const{exitResult:n}=this,s=()=>{bt(t)?this.rejectExitPromise(t):this.resolveExitPromise(n)};t!==void 0&&!bt(t)?s():r&&o?this.options.stdout.write("",s):setImmediate(s)},l=L;this.options.concurrent?(L.updateContainerSync(null,this.container,null,rt),L.flushSyncWork(),l.flushPassiveEffects?.(),u()):(L.updateContainerSync(null,this.container,null,rt),L.flushSyncWork(),u())};async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},k.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await zt(),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}L.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:i,hasWritableState:r}=Gt(t);if(ht(this.throttledOnRender,i),ht(this.throttledLog,i),i&&r){await new Promise(o=>{this.options.stdout.write("",()=>{o()})});return}await zt()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
|
|
22
|
-
`))}patchConsole(){this.options.debug||(this.restoreConsole=Le((t,i)=>{t==="stdout"&&this.writeToStdout(i),t==="stderr"&&(i.startsWith("The above error occurred")||this.writeToStderr(i))}))}setAlternateScreen(t){this.alternateScreen=this.resolveAlternateScreenOption(t,this.interactive),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,Pe),this.writeBestEffort(this.options.stdout,q))}resolveInteractiveOption(t){return t??(!Jt&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,i){return!!t&&i&&!!this.options.stdout.isTTY}shouldSync(){return Pi(this.options.stdout,this.interactive)}writeBestEffort(t,i){try{t.write(i)}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 i=new Promise(r=>{t=r});this.nextRenderCommit={promise:i,resolve:t}}return this.nextRenderCommit.promise}renderInteractiveFrame(t,i,r,o=""){const u=r+o,l=u!=="",n=this.options.stdout.isTTY,s=n?X(this.options.stdout).rows:24,a=n&&i>=s,p=a?t:`${t}
|
|
23
|
-
`,w=k.platform==="win32",g=n&&w&&(a||this.lastOutputHeight>=s);if(Hi({isTty:n,isUnmounting:this.isUnmounting,isWindows:w,nextOutputHeight:i,previousOutputHeight:this.lastOutputHeight,viewportRows:s})){if(this.options.incrementalRendering&&!g){l&&(this.log.clear(),this.options.stdout.write(u)),(t!==this.lastOutput||this.log.isCursorDirty()||l)&&this.throttledLog(p),this.lastOutput=t,this.lastOutputToRender=p,this.lastOutputHeight=i;return}const d=this.shouldSync();d&&this.options.stdout.write(Y),this.options.stdout.write(Ne+this.fullStaticOutput+o+t),this.lastOutput=t,this.lastOutputToRender=p,this.lastOutputHeight=i,this.log.sync(p),d&&this.options.stdout.write(U);return}if(l){const d=this.shouldSync();d&&this.options.stdout.write(Y),this.log.clear(),this.options.stdout.write(u),this.log(p),d&&this.options.stdout.write(U)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(p);this.lastOutput=t,this.lastOutputToRender=p,this.lastOutputHeight=i}initImmediateKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="enabled")return;const i=t.flags??["disambiguateEscapeCodes"];this.options.stdin.isTTY&&this.options.stdout.isTTY&&this.enableKittyProtocol(i)}initDeferredKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="auto")return;const i=t.flags??["disambiguateEscapeCodes"];!this.interactive||!this.options.stdin.isTTY||!this.options.stdout.isTTY||this.confirmKittySupport(i)}confirmKittySupport(t){const{stdin:i,stdout:r}=this.options;let o=[];const u=()=>{this.cancelKittyDetection=void 0,clearTimeout(n),i.removeListener("data",l);const s=Bi(o);o=[],s.length>0&&i.unshift(Ht.from(s))},l=s=>{const a=typeof s=="string"?Ht.from(s):s;for(const p of a)o.push(p);Ai(o)&&(u(),this.isUnmounted||this.enableKittyProtocol(t))};i.on("data",l);const n=setTimeout(u,200);this.cancelKittyDetection=u,r.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${ii(t)}u`),this.kittyProtocolEnabled=!0}}const xr=(e,t)=>{const i={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:k.stderr,stdin:k.stdin,stdout:k.stdout,...Ki(t)},r=Fi(i.stdout,()=>new Ui(i));return r.render(e),{cleanup(){r.unmount()},clear(){r.clear()},rerender(o){r.render(o)},rootNode:r.rootNode,unmount(){r.unmount()},waitUntilExit(){return r.waitUntilExit()},waitUntilRenderFlush(){return r.waitUntilRenderFlush()}}},Ki=(e={})=>e instanceof xe?{stdin:k.stdin,stdout:e}:e,Fi=(e,t)=>{const i=xt.get(e);if(i===void 0){const r=t();return xt.set(e,r),r}return k.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.
|
|
24
|
-
`),i};export{xr as default};
|