@visulima/tui 1.0.0-alpha.5 → 1.0.0-alpha.7

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.
Files changed (414) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/core/index.js +1 -5
  3. package/dist/ink/index.d.ts +17 -36
  4. package/dist/ink/index.js +1 -155
  5. package/dist/packem_chunks/devtools.js +3 -26
  6. package/dist/packem_shared/Accordion-BXsqchV-.js +1 -0
  7. package/dist/packem_shared/Alert-BhYVMHtR.js +1 -0
  8. package/dist/packem_shared/AnimatePresence-Eu7Z8KHc.js +1 -0
  9. package/dist/packem_shared/ApprovalPrompt-BSn0FT1g.js +1 -0
  10. package/dist/packem_shared/AreaChart-Chy-frI7.js +1 -0
  11. package/dist/packem_shared/Badge-B8WPyRsK.js +1 -0
  12. package/dist/packem_shared/BarChart-rpZtlMcF.js +1 -0
  13. package/dist/packem_shared/BigText-CRpwUzrt.js +1 -0
  14. package/dist/packem_shared/BlinkDot-BvnRuWP8.js +1 -0
  15. package/dist/packem_shared/Box-BwqSvWuq.js +1 -0
  16. package/dist/packem_shared/Breadcrumb-D0hClbRV.js +1 -0
  17. package/dist/packem_shared/Button-B89Yvbc6.js +1 -0
  18. package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +1 -0
  19. package/dist/packem_shared/Calendar-Dmflvm2S.js +1 -0
  20. package/dist/packem_shared/Canvas-CKg6WV47.js +1 -0
  21. package/dist/packem_shared/Card-B_9fXdtU.js +1 -0
  22. package/dist/packem_shared/Cell-BrXn3jxY.js +1 -0
  23. package/dist/packem_shared/Checkbox-BN71eCWU.js +1 -0
  24. package/dist/packem_shared/Code-HhevcyiH.js +2 -0
  25. package/dist/packem_shared/Collapsible-u6uf_FdV.js +1 -0
  26. package/dist/packem_shared/CommandBlock-B-nslpCv.js +4 -0
  27. package/dist/packem_shared/CommandPalette-CEFdaURo.js +1 -0
  28. package/dist/packem_shared/ConfirmDialog-5Jje_Xpu.js +1 -0
  29. package/dist/packem_shared/ConfirmInput-D44Mb9oo.js +1 -0
  30. package/dist/packem_shared/ConsoleOverlay-CM3APfgP.js +1 -0
  31. package/dist/packem_shared/ContentSwitcher-Dm5BkrCt.js +1 -0
  32. package/dist/packem_shared/ControlledScrollView-DI8KZOQB.js +1 -0
  33. package/dist/packem_shared/Cursor-BoLFIMol.js +1 -0
  34. package/dist/packem_shared/DatePicker-CnSrFFAE.js +1 -0
  35. package/dist/packem_shared/DefinitionList-v8RDuF_R.js +1 -0
  36. package/dist/packem_shared/DevTools-O8EbCfHa.js +1 -0
  37. package/dist/packem_shared/Dialog-CTaL8pn0.js +1 -0
  38. package/dist/packem_shared/DiffView-BUIFqUB0.js +1 -0
  39. package/dist/packem_shared/Divider-C47bKmqu.js +1 -0
  40. package/dist/packem_shared/FilePicker-CUo7R5Qb.js +1 -0
  41. package/dist/packem_shared/FocusContext-Xy0cwJpO.js +1 -0
  42. package/dist/packem_shared/FormField-af3aUpRL.js +1 -0
  43. package/dist/packem_shared/Fullscreen-CuJ8y0s0.js +1 -0
  44. package/dist/packem_shared/Gauge-Dz-usH__.js +1 -0
  45. package/dist/packem_shared/Gradient-DYNc0GZA.js +1 -0
  46. package/dist/packem_shared/Heading-mwEYza3Y.js +1 -0
  47. package/dist/packem_shared/Heatmap-ChL97U1-.js +1 -0
  48. package/dist/packem_shared/Help-Zcelyw_U.js +1 -0
  49. package/dist/packem_shared/Histogram-FIf2F83d.js +1 -0
  50. package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +1 -0
  51. package/dist/packem_shared/InputParser-rZKjY_7Y.js +2 -0
  52. package/dist/packem_shared/KEY-Bk8B-3h_.js +1 -0
  53. package/dist/packem_shared/Kbd-DpkPp4jB.js +1 -0
  54. package/dist/packem_shared/LayoutNode-rxblE317.js +1 -0
  55. package/dist/packem_shared/LineChart-BXE_girm.js +1 -0
  56. package/dist/packem_shared/Link-i2o2EG4-.js +1 -0
  57. package/dist/packem_shared/LoadingIndicator-TC1Fjwyt.js +1 -0
  58. package/dist/packem_shared/Markdown-R1XqK63D.js +1 -0
  59. package/dist/packem_shared/MaskedInput-J01phOZs.js +1 -0
  60. package/dist/packem_shared/Menu-CfrH4ymk.js +1 -0
  61. package/dist/packem_shared/MessageBubble-BmBBU2Rm.js +1 -0
  62. package/dist/packem_shared/ModelBadge-D3wrXncu.js +1 -0
  63. package/dist/packem_shared/MouseProvider-pjza-lpc.js +1 -0
  64. package/dist/packem_shared/MultiSelect-Dqmn-bVo.js +1 -0
  65. package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +1 -0
  66. package/dist/packem_shared/Newline-BSG4iUqp.js +2 -0
  67. package/dist/packem_shared/OperationTree-DksxjMIV.js +1 -0
  68. package/dist/packem_shared/OptionList-CNx7r9yN.js +1 -0
  69. package/dist/packem_shared/OrderedList-BeDy035w.js +1 -0
  70. package/dist/packem_shared/Paginator-B56s6bhS.js +1 -0
  71. package/dist/packem_shared/Paragraph-BqJlH0R-.js +1 -0
  72. package/dist/packem_shared/Placeholder-GMpHRGC8.js +1 -0
  73. package/dist/packem_shared/ProgressBar-Bj3fmORR.js +1 -0
  74. package/dist/packem_shared/RadioGroup-Br8BeEwS.js +1 -0
  75. package/dist/packem_shared/Renderer-DJXooAsp.js +1 -0
  76. package/dist/packem_shared/ResizeObserverEntry-Dq0dk8Kq.js +1 -0
  77. package/dist/packem_shared/ScatterPlot-OhfYco5l.js +1 -0
  78. package/dist/packem_shared/ScrollBar-Da5Y3z7N.js +1 -0
  79. package/dist/packem_shared/ScrollBarBox-Dz6F-Eat.js +1 -0
  80. package/dist/packem_shared/ScrollList-DiVGyEjv.js +1 -0
  81. package/dist/packem_shared/ScrollView-BojONotI.js +1 -0
  82. package/dist/packem_shared/SearchInput-BoPTRbhV.js +1 -0
  83. package/dist/packem_shared/SelectInput-CAJ7SCBq.js +1 -0
  84. package/dist/packem_shared/SelectInputIndicator-N1n8ULHs.js +1 -0
  85. package/dist/packem_shared/SelectInputItem-BEkbmobs.js +1 -0
  86. package/dist/packem_shared/ShimmerText-CuGQ2NDC.js +1 -0
  87. package/dist/packem_shared/Slider-Cg_tJpKa.js +1 -0
  88. package/dist/packem_shared/Spacer-eT3HOrXk.js +1 -0
  89. package/dist/packem_shared/Sparkline-T6_FPVET.js +1 -0
  90. package/dist/packem_shared/Spinner-B0-A50pu.js +1 -0
  91. package/dist/packem_shared/Static-DLynr5pn.js +1 -0
  92. package/dist/packem_shared/Static-jzLPaHJF.js +1 -0
  93. package/dist/packem_shared/StaticRender-BgD61E7x.js +1 -0
  94. package/dist/packem_shared/StatusLine-Ch4jjef1.js +1 -0
  95. package/dist/packem_shared/StatusMessage-B1qfKeMM.js +1 -0
  96. package/dist/packem_shared/Stepper-CNPAqxiU.js +1 -0
  97. package/dist/packem_shared/Stopwatch-CAx2EWwq.js +1 -0
  98. package/dist/packem_shared/StreamingText-BYOKSB2T.js +1 -0
  99. package/dist/packem_shared/Switch-DzSpKYu7.js +1 -0
  100. package/dist/packem_shared/Tab-BcXzSUdj.js +1 -0
  101. package/dist/packem_shared/Table-DJp1TLrR.js +1 -0
  102. package/dist/packem_shared/Tabs-D68z0SOt.js +1 -0
  103. package/dist/packem_shared/Tag-BvLHnYRn.js +1 -0
  104. package/dist/packem_shared/Text-mTAve9R2.js +1 -0
  105. package/dist/packem_shared/TextInput-C_gYQlnF.js +1 -0
  106. package/dist/packem_shared/Textarea-C2ET_oMb.js +2 -0
  107. package/dist/packem_shared/Timer-CI3aQX65.js +1 -0
  108. package/dist/packem_shared/Toast-Drvc8XfG.js +1 -0
  109. package/dist/packem_shared/Tooltip-C5UnQlLd.js +1 -0
  110. package/dist/packem_shared/Transform-fYmcdqRT.js +1 -0
  111. package/dist/packem_shared/Transition-CJDBKYUB.js +1 -0
  112. package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +1 -0
  113. package/dist/packem_shared/TreeView-DjhacGJ5.js +1 -0
  114. package/dist/packem_shared/TuiApp-DrjI_i-R.js +1 -0
  115. package/dist/packem_shared/TuiContext-BoJvG3NN.js +3 -0
  116. package/dist/packem_shared/UnorderedList-BnfqexZs.js +1 -0
  117. package/dist/packem_shared/accessibility-context-DDyHTwmA.js +1 -0
  118. package/dist/packem_shared/animation-context-DW3p-vpk.js +1 -0
  119. package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
  120. package/dist/packem_shared/ansi-tokenizer-DqX9nJuk.js +1 -0
  121. package/dist/packem_shared/app-context-BVpKlG1z.js +1 -0
  122. package/dist/packem_shared/background-context-rjOaWFki.js +1 -0
  123. package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
  124. package/dist/packem_shared/braille-BBjIoaN0.js +1 -0
  125. package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
  126. package/dist/packem_shared/comparePoints-C85EsmNz.js +1 -0
  127. package/dist/packem_shared/controlled-scroll-view-CmrAEvJk.js +1 -0
  128. package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
  129. package/dist/packem_shared/createLinkedScrollGroup-BMTJ7rAj.js +1 -0
  130. package/dist/packem_shared/createMemoryStorage-QVZNXbWz.js +2 -0
  131. package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
  132. package/dist/packem_shared/cursor-context-CFviBqPX.js +1 -0
  133. package/dist/packem_shared/dom-4y__5fWB.js +1 -0
  134. package/dist/packem_shared/focus-context-CsT69klR.js +1 -0
  135. package/dist/packem_shared/format-time-C7Q-hQZq.js +1 -0
  136. package/dist/packem_shared/getPathToRoot-B2tKmx3i.js +1 -0
  137. package/dist/packem_shared/getScrollHeight-BTEY8ewu.js +1 -0
  138. package/dist/packem_shared/input-utils-fAxzSlNh.js +1 -0
  139. package/dist/packem_shared/isIntersecting-B3KbKTmu.js +1 -0
  140. package/dist/packem_shared/isOsc52Supported-DKK7Uee6.js +1 -0
  141. package/dist/packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js +1 -0
  142. package/dist/packem_shared/kittyFlags-C3rZLbcK.js +1 -0
  143. package/dist/packem_shared/line-chart-DrM8PwnI.js +1 -0
  144. package/dist/packem_shared/measure-element-DSp7YDus.js +2 -0
  145. package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
  146. package/dist/packem_shared/measureElement-DA8WqFP_.js +1 -0
  147. package/dist/packem_shared/mouse-context-DaARgUu1.js +1 -0
  148. package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
  149. package/dist/packem_shared/processLayout-DXDfFb_d.js +1 -0
  150. package/dist/packem_shared/reconciler-BuOP-TZ6.js +1 -0
  151. package/dist/packem_shared/reconciler-DSYCrIZs.js +1 -0
  152. package/dist/packem_shared/render-DDqtMAFN.js +1 -0
  153. package/dist/packem_shared/render-_r0K9K11.js +28 -0
  154. package/dist/packem_shared/renderToString-DeqOWRP8.js +4 -0
  155. package/dist/packem_shared/renderToString-IYYPyASm.js +2 -0
  156. package/dist/packem_shared/renderTreeToBuffer-DPkoCgP2.js +2 -0
  157. package/dist/packem_shared/renderer-D2p6av2X.js +17 -0
  158. package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
  159. package/dist/packem_shared/squashTextNodesWithMap-Cpqmc45i.js +1 -0
  160. package/dist/packem_shared/stderr-context-BzEaUICS.js +1 -0
  161. package/dist/packem_shared/stdin-context-BTaaFagk.js +1 -0
  162. package/dist/packem_shared/stdout-context-BnblEPez.js +1 -0
  163. package/dist/packem_shared/text-width-CZ9vPvM0.js +2 -0
  164. package/dist/packem_shared/token-to-elements-BYxT6J_Q.js +1 -0
  165. package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +1 -0
  166. package/dist/packem_shared/useAnimation-B9we6ZzL.js +1 -0
  167. package/dist/packem_shared/useApp-B6fvM42d.js +1 -0
  168. package/dist/packem_shared/useBoxMetrics-D5pkIr6P.js +1 -0
  169. package/dist/packem_shared/useClipboard-CBxy0hT8.js +1 -0
  170. package/dist/packem_shared/useColorBlindness-BvWcu2Bb.js +1 -0
  171. package/dist/packem_shared/useConsoleCapture-BxiG8iLJ.js +1 -0
  172. package/dist/packem_shared/useCursor-CPu8T5Db.js +1 -0
  173. package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +1 -0
  174. package/dist/packem_shared/useFocus-DSmziO_x.js +1 -0
  175. package/dist/packem_shared/useFocusManager-Uapn3LQo.js +1 -0
  176. package/dist/packem_shared/useForm-CzV-Oext.js +1 -0
  177. package/dist/packem_shared/useHotkey-D0dGey14.js +1 -0
  178. package/dist/packem_shared/useInput-D1_jG26Z.js +2 -0
  179. package/dist/packem_shared/useInterval-AobjZT3u.js +1 -0
  180. package/dist/packem_shared/useIsScreenReaderEnabled-DjWHh-II.js +1 -0
  181. package/dist/packem_shared/useKeyBindings-zabkEJQs.js +1 -0
  182. package/dist/packem_shared/useKeyChord-CICQIxXj.js +1 -0
  183. package/dist/packem_shared/useMouseAction-2dRfU1vE.js +1 -0
  184. package/dist/packem_shared/useMouseContext-C746G7kY.js +1 -0
  185. package/dist/packem_shared/useMousePosition-BTWfV4JK.js +1 -0
  186. package/dist/packem_shared/useOnMouseClick-nY8xLZmt.js +1 -0
  187. package/dist/packem_shared/useOnMouseHover-D3DczIol.js +1 -0
  188. package/dist/packem_shared/useOnMouseState-cRK8QvzD.js +1 -0
  189. package/dist/packem_shared/usePaste-CKKB9H-Z.js +1 -0
  190. package/dist/packem_shared/useScrollAcceleration-NrY1oVMs.js +1 -0
  191. package/dist/packem_shared/useScrollInput-Caghtn-Q.js +1 -0
  192. package/dist/packem_shared/useStderr-BDZb6InG.js +1 -0
  193. package/dist/packem_shared/useStdin-DKa4h35k.js +1 -0
  194. package/dist/packem_shared/useStdout-B-2lX4C5.js +1 -0
  195. package/dist/packem_shared/useStopwatch-DffK7iMh.js +1 -0
  196. package/dist/packem_shared/useTerminalPalette-Cv7tSduR.js +1 -0
  197. package/dist/packem_shared/useTextBuffer-DekkGLxI.js +4 -0
  198. package/dist/packem_shared/useTextSelection-CGT0GLDR.js +1 -0
  199. package/dist/packem_shared/useTimeout-7LEFYTnG.js +1 -0
  200. package/dist/packem_shared/useTimer-DyoqSyGi.js +1 -0
  201. package/dist/packem_shared/useTreeView-8UlTK6sW.js +1 -0
  202. package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +1 -0
  203. package/dist/packem_shared/useWindowSize-yDZsXF8z.js +1 -0
  204. package/dist/packem_shared/utils-THUhYKG2.js +1 -0
  205. package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
  206. package/dist/packem_shared/waitFor-Dj5zfL5s.js +4 -0
  207. package/dist/packem_shared/wrapOrTruncateStyledLine-BZ00SM8i.js +3 -0
  208. package/dist/react/index.js +1 -9
  209. package/dist/testing/index.d.ts +1 -1
  210. package/dist/testing/index.js +1 -152
  211. package/package.json +10 -10
  212. package/dist/packem_shared/Accordion-BG-yfIkV.js +0 -80
  213. package/dist/packem_shared/Alert-BLcwIW8V.js +0 -17
  214. package/dist/packem_shared/AnimatePresence-D8nEOr_B.js +0 -98
  215. package/dist/packem_shared/ApprovalPrompt-BXdPros1.js +0 -104
  216. package/dist/packem_shared/AreaChart-CmTcxLum.js +0 -116
  217. package/dist/packem_shared/Badge-CUfbXwAB.js +0 -13
  218. package/dist/packem_shared/BarChart-DWRae67P.js +0 -87
  219. package/dist/packem_shared/BigText-CVq2X7B5.js +0 -24
  220. package/dist/packem_shared/BlinkDot-CrbHMR3L.js +0 -11
  221. package/dist/packem_shared/Box-W1w_NGin.js +0 -71
  222. package/dist/packem_shared/Breadcrumb-CPdNxVYs.js +0 -26
  223. package/dist/packem_shared/Button-CBmTbJ_D.js +0 -57
  224. package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-BsMy5Ewl.js +0 -81
  225. package/dist/packem_shared/Calendar-C2Qxt-LA.js +0 -139
  226. package/dist/packem_shared/Canvas-COttmLPX.js +0 -246
  227. package/dist/packem_shared/Card-D3tGkNCm.js +0 -24
  228. package/dist/packem_shared/Cell-DCg1kJY-.js +0 -48
  229. package/dist/packem_shared/Checkbox-Dpy_4Lws.js +0 -49
  230. package/dist/packem_shared/Code-CwzzbsLx.js +0 -53
  231. package/dist/packem_shared/Collapsible-BMDrXf5C.js +0 -45
  232. package/dist/packem_shared/CommandBlock-jdOGJPjY.js +0 -80
  233. package/dist/packem_shared/CommandPalette-B5IfUQwi.js +0 -146
  234. package/dist/packem_shared/ConfirmDialog-5XJv3Cc4.js +0 -67
  235. package/dist/packem_shared/ConfirmInput-CxUS0XAA.js +0 -44
  236. package/dist/packem_shared/ConsoleOverlay-BvnCEgjG.js +0 -57
  237. package/dist/packem_shared/ContentSwitcher-BHFpO5Za.js +0 -81
  238. package/dist/packem_shared/ControlledScrollView-C2wOOlJO.js +0 -5
  239. package/dist/packem_shared/Cursor-DiW7YoSK.js +0 -18
  240. package/dist/packem_shared/DatePicker-CPejKoqS.js +0 -73
  241. package/dist/packem_shared/DefinitionList-BAwr0l5J.js +0 -18
  242. package/dist/packem_shared/DevTools-BdxRSkhL.js +0 -63
  243. package/dist/packem_shared/Dialog-S9r7Izff.js +0 -71
  244. package/dist/packem_shared/DiffView-BR4T6-Sj.js +0 -329
  245. package/dist/packem_shared/Divider-DocXIqNn.js +0 -30
  246. package/dist/packem_shared/FilePicker-BZ55oF_n.js +0 -261
  247. package/dist/packem_shared/FocusContext-D5wFxSRz.js +0 -153
  248. package/dist/packem_shared/FormField-BSG16cnA.js +0 -29
  249. package/dist/packem_shared/Fullscreen-DO7voOq5.js +0 -11
  250. package/dist/packem_shared/Gauge-CKXUXxft.js +0 -122
  251. package/dist/packem_shared/Gradient-Dg0NezWc.js +0 -136
  252. package/dist/packem_shared/Heading-BnR7McmP.js +0 -29
  253. package/dist/packem_shared/Heatmap-_jqISOU0.js +0 -79
  254. package/dist/packem_shared/Help-0yZ_IcQg.js +0 -105
  255. package/dist/packem_shared/Histogram-CB6XcmZW.js +0 -92
  256. package/dist/packem_shared/IMECompositionBuffer-Dl3S0KnF.js +0 -55
  257. package/dist/packem_shared/InputParser-BlsfeY9J.js +0 -158
  258. package/dist/packem_shared/KEY-STOdi-nc.js +0 -74
  259. package/dist/packem_shared/Kbd-BNDXQgey.js +0 -19
  260. package/dist/packem_shared/LayoutNode-DAkKg9TE.js +0 -129
  261. package/dist/packem_shared/LineChart-ef3HF816.js +0 -7
  262. package/dist/packem_shared/Link-DZ2Tiq1m.js +0 -66
  263. package/dist/packem_shared/LoadingIndicator-DzbLGfyJ.js +0 -13
  264. package/dist/packem_shared/Markdown-33bpCUoe.js +0 -212
  265. package/dist/packem_shared/MaskedInput-Ctr6v2dO.js +0 -119
  266. package/dist/packem_shared/Menu-CeKxhEix.js +0 -112
  267. package/dist/packem_shared/MessageBubble-BMoU8L2Q.js +0 -26
  268. package/dist/packem_shared/ModelBadge-CNIxPs7v.js +0 -40
  269. package/dist/packem_shared/MouseProvider-CekPbXCh.js +0 -136
  270. package/dist/packem_shared/MultiSelect-yz7-w0Zv.js +0 -129
  271. package/dist/packem_shared/NAMED_COLORS-DcI3erCu.js +0 -300
  272. package/dist/packem_shared/Newline-DBtYEg8x.js +0 -7
  273. package/dist/packem_shared/OperationTree-Dudx5o1o.js +0 -67
  274. package/dist/packem_shared/OptionList-CTyqQaZ1.js +0 -24
  275. package/dist/packem_shared/OrderedList-VsvSmHUC.js +0 -26
  276. package/dist/packem_shared/Paginator-DmGogvEI.js +0 -104
  277. package/dist/packem_shared/Paragraph-CNNhfepo.js +0 -9
  278. package/dist/packem_shared/Placeholder-DkM69Q8Z.js +0 -29
  279. package/dist/packem_shared/ProgressBar-B7cS4uQm.js +0 -22
  280. package/dist/packem_shared/RadioGroup-B4F9PUyL.js +0 -108
  281. package/dist/packem_shared/Renderer-zZ5O3vxc.js +0 -31
  282. package/dist/packem_shared/ResizeObserverEntry-Vr8GZ74x.js +0 -102
  283. package/dist/packem_shared/ScatterPlot-CWOg4G5h.js +0 -63
  284. package/dist/packem_shared/ScrollBar-DFeWH43I.js +0 -106
  285. package/dist/packem_shared/ScrollBarBox-C7VL6Izd.js +0 -72
  286. package/dist/packem_shared/ScrollList-DRcr_RrN.js +0 -227
  287. package/dist/packem_shared/ScrollView-C6rdlGwU.js +0 -196
  288. package/dist/packem_shared/SearchInput-cB8zFhSg.js +0 -32
  289. package/dist/packem_shared/SelectInput-WzZSqp72.js +0 -260
  290. package/dist/packem_shared/SelectInputIndicator-DKeN6v5Z.js +0 -9
  291. package/dist/packem_shared/SelectInputItem-CxFL3spM.js +0 -8
  292. package/dist/packem_shared/ShimmerText-B2VbPUSB.js +0 -34
  293. package/dist/packem_shared/Slider-BOrNTOQe.js +0 -116
  294. package/dist/packem_shared/Spacer-DhmXyTb8.js +0 -8
  295. package/dist/packem_shared/Sparkline-BSbjPrwK.js +0 -44
  296. package/dist/packem_shared/Spinner-BcO5BCAa.js +0 -1942
  297. package/dist/packem_shared/Static-DpTd6Eed.js +0 -22
  298. package/dist/packem_shared/Static-xmD9giJj.js +0 -18
  299. package/dist/packem_shared/StaticRender-C3XWvJdC.js +0 -69
  300. package/dist/packem_shared/StatusLine-DQNUstN9.js +0 -22
  301. package/dist/packem_shared/StatusMessage-BYTL6Pl-.js +0 -14
  302. package/dist/packem_shared/Stepper-CmUPRK3z.js +0 -60
  303. package/dist/packem_shared/Stopwatch-zqLQAxXC.js +0 -21
  304. package/dist/packem_shared/StreamingText-BmuoJtGu.js +0 -38
  305. package/dist/packem_shared/Switch-DcPdy8nm.js +0 -59
  306. package/dist/packem_shared/Tab-C6r5q4hR.js +0 -7
  307. package/dist/packem_shared/Table-Bgxo87Df.js +0 -88
  308. package/dist/packem_shared/Tabs-DubuHdYV.js +0 -164
  309. package/dist/packem_shared/Tag-CCqM7Ee9.js +0 -35
  310. package/dist/packem_shared/Text-CtUwV89_.js +0 -65
  311. package/dist/packem_shared/TextInput-C9r7zT0U.js +0 -137
  312. package/dist/packem_shared/Textarea-CGmgt-Nl.js +0 -272
  313. package/dist/packem_shared/Timer-D7ZZ0_wz.js +0 -20
  314. package/dist/packem_shared/Toast-DXSCXFPY.js +0 -37
  315. package/dist/packem_shared/Tooltip-SvVjj-2k.js +0 -32
  316. package/dist/packem_shared/Transform-Cfyva2wd.js +0 -14
  317. package/dist/packem_shared/Transition-CbNfKhaj.js +0 -108
  318. package/dist/packem_shared/TreeNodeMap-CtJUvBnd.js +0 -155
  319. package/dist/packem_shared/TreeView-DGlZeSsK.js +0 -148
  320. package/dist/packem_shared/TuiApp-DtdgNRWa.js +0 -122
  321. package/dist/packem_shared/TuiContext-lXmJFd-x.js +0 -418
  322. package/dist/packem_shared/UnorderedList-D8RPaEAW.js +0 -33
  323. package/dist/packem_shared/accessibility-context-BLelHhNU.js +0 -7
  324. package/dist/packem_shared/animation-context-BcJg8Jr6.js +0 -15
  325. package/dist/packem_shared/ansi-parser-BOP8fNdT.js +0 -43
  326. package/dist/packem_shared/ansi-tokenizer-LHq2LUWA.js +0 -307
  327. package/dist/packem_shared/app-context-CP0U6H7O.js +0 -11
  328. package/dist/packem_shared/background-context-BAUaxfOb.js +0 -5
  329. package/dist/packem_shared/boxes-oi3WUbyR.js +0 -92
  330. package/dist/packem_shared/braille-BoEWoH2I.js +0 -93
  331. package/dist/packem_shared/colorize-88_Vk8cn.js +0 -48
  332. package/dist/packem_shared/comparePoints-CAAlhiMS.js +0 -287
  333. package/dist/packem_shared/controlled-scroll-view-DJXfdWMm.js +0 -286
  334. package/dist/packem_shared/createInlineLoop-Dnfm1ZSJ.js +0 -99
  335. package/dist/packem_shared/createLinkedScrollGroup-Djw4Ceo0.js +0 -44
  336. package/dist/packem_shared/createMemoryStorage-esFJ61La.js +0 -115
  337. package/dist/packem_shared/createScreen-Dh0sZlQ0.js +0 -38
  338. package/dist/packem_shared/cursor-context-JxRzlqAx.js +0 -9
  339. package/dist/packem_shared/dom-CrbpQgat.js +0 -228
  340. package/dist/packem_shared/focus-context-CWkYtgcm.js +0 -26
  341. package/dist/packem_shared/format-time-BGmnDukX.js +0 -12
  342. package/dist/packem_shared/getPathToRoot-BbvlppLC.js +0 -4
  343. package/dist/packem_shared/getScrollHeight-Cz3CDQN2.js +0 -63
  344. package/dist/packem_shared/input-utils-ViAEXa0Z.js +0 -19
  345. package/dist/packem_shared/isIntersecting-fEXHJN5R.js +0 -10
  346. package/dist/packem_shared/isOsc52Supported-G0k4sXJx.js +0 -36
  347. package/dist/packem_shared/isTerminalPaletteQuerySupported-EeiwMKbr.js +0 -93
  348. package/dist/packem_shared/kittyFlags-bNNf_9kX.js +0 -26
  349. package/dist/packem_shared/line-chart-VGU2l7pu.js +0 -139
  350. package/dist/packem_shared/measure-element-Bc6PEaIe.js +0 -405
  351. package/dist/packem_shared/measure-text-BdOhbOeh.js +0 -1256
  352. package/dist/packem_shared/measureElement-DTELRaij.js +0 -4
  353. package/dist/packem_shared/mouse-context-BUHWKEIe.js +0 -6
  354. package/dist/packem_shared/parseSgrMouse-4hpBJBsW.js +0 -1
  355. package/dist/packem_shared/processLayout-B0Coz0Ua.js +0 -2
  356. package/dist/packem_shared/reconciler-Dd7Z0A97.js +0 -696
  357. package/dist/packem_shared/reconciler-mzMwSOft.js +0 -221
  358. package/dist/packem_shared/render-Bm9Oa1sG.js +0 -2799
  359. package/dist/packem_shared/render-CjlKdg4m.js +0 -199
  360. package/dist/packem_shared/renderToString-CWYS1ZXE.js +0 -86
  361. package/dist/packem_shared/renderToString-DB3ILWFm.js +0 -62
  362. package/dist/packem_shared/renderTreeToBuffer-CDDTGyZn.js +0 -311
  363. package/dist/packem_shared/renderer-GE9OLNNM.js +0 -1437
  364. package/dist/packem_shared/setEnableStyledLineCache-D5f4favX.js +0 -2
  365. package/dist/packem_shared/squashTextNodesWithMap-iqm6OMMT.js +0 -100
  366. package/dist/packem_shared/stderr-context-Bj4Mf7v7.js +0 -17
  367. package/dist/packem_shared/stdin-context-Bq_GNJ3z.js +0 -38
  368. package/dist/packem_shared/stdout-context-CgjWeCdO.js +0 -17
  369. package/dist/packem_shared/text-width-Db-AxMea.js +0 -43
  370. package/dist/packem_shared/token-to-elements-CK4s8MJd.js +0 -249
  371. package/dist/packem_shared/treeViewTheme-BpSw9TMf.js +0 -52
  372. package/dist/packem_shared/useAnimation-DV22qxiJ.js +0 -62
  373. package/dist/packem_shared/useApp-Cbi788rV.js +0 -6
  374. package/dist/packem_shared/useBoxMetrics-_5icypir.js +0 -54
  375. package/dist/packem_shared/useClipboard-MNj6MNR-.js +0 -23
  376. package/dist/packem_shared/useColorBlindness-D_sTIhcb.js +0 -30
  377. package/dist/packem_shared/useConsoleCapture-Dvt7G1W1.js +0 -61
  378. package/dist/packem_shared/useCursor-DS6LjIgv.js +0 -19
  379. package/dist/packem_shared/useElementDimensions-CAoKitVD.js +0 -67
  380. package/dist/packem_shared/useFocus-DLoGQJd9.js +0 -37
  381. package/dist/packem_shared/useFocusManager-UeZWtnNc.js +0 -16
  382. package/dist/packem_shared/useForm-sQENbEuv.js +0 -88
  383. package/dist/packem_shared/useHotkey-D9giUX3q.js +0 -112
  384. package/dist/packem_shared/useInput-DKZbqMRc.js +0 -594
  385. package/dist/packem_shared/useInterval-CSXM8c2I.js +0 -32
  386. package/dist/packem_shared/useIsScreenReaderEnabled-BeoVqo1R.js +0 -9
  387. package/dist/packem_shared/useKeyBindings-S4fSIEAk.js +0 -66
  388. package/dist/packem_shared/useKeyChord-BmXGNuEO.js +0 -114
  389. package/dist/packem_shared/useMouseAction-C5gZ2nj7.js +0 -29
  390. package/dist/packem_shared/useMouseContext-D-rFy60Q.js +0 -12
  391. package/dist/packem_shared/useMousePosition-BHBJ-kBk.js +0 -25
  392. package/dist/packem_shared/useOnMouseClick--ZIyBOBO.js +0 -35
  393. package/dist/packem_shared/useOnMouseHover-26diuXUC.js +0 -32
  394. package/dist/packem_shared/useOnMouseState-NO_Kda_C.js +0 -13
  395. package/dist/packem_shared/usePaste-png73gvT.js +0 -35
  396. package/dist/packem_shared/useScrollAcceleration-R9LfrPVG.js +0 -73
  397. package/dist/packem_shared/useScrollInput-DfzRGQFe.js +0 -72
  398. package/dist/packem_shared/useStderr-BSWerMZ7.js +0 -6
  399. package/dist/packem_shared/useStdin-Rf0zPzVA.js +0 -7
  400. package/dist/packem_shared/useStdout-B5yRcg9N.js +0 -6
  401. package/dist/packem_shared/useStopwatch-C__Zu6hd.js +0 -33
  402. package/dist/packem_shared/useTerminalPalette-CtFG2JTq.js +0 -38
  403. package/dist/packem_shared/useTextBuffer-C8fEe9Ly.js +0 -398
  404. package/dist/packem_shared/useTextSelection-ChrYZXsn.js +0 -50
  405. package/dist/packem_shared/useTimeout-DuCqgWPX.js +0 -34
  406. package/dist/packem_shared/useTimer-DnBtbhB5.js +0 -46
  407. package/dist/packem_shared/useTreeView-mkN5Di7w.js +0 -101
  408. package/dist/packem_shared/useTreeViewState-BpS_KZ-K.js +0 -502
  409. package/dist/packem_shared/useWindowSize-D3UU41mv.js +0 -20
  410. package/dist/packem_shared/utils-BgdlrbOH.js +0 -140
  411. package/dist/packem_shared/variant-config-DSZoX5TM.js +0 -8
  412. package/dist/packem_shared/waitFor-Cv9M2jKA.js +0 -39
  413. package/dist/packem_shared/wrapOrTruncateStyledLine-49Mne3t3.js +0 -147
  414. package/dist/packem_shared/{render.d-CNIzVQTh.d.ts → render.d-BR3gA-N8.d.ts} +4 -4
@@ -1,1437 +0,0 @@
1
- import { w as wrapText, i as isNodeSelectable } from './dom-CrbpQgat.js';
2
- import { getStringWidth, isFullwidthCodePoint, indent } from '@visulima/string';
3
- import { B as BOLD_MASK, D as DIM_MASK, I as ITALIC_MASK, U as UNDERLINE_MASK, e as INVERSE_MASK, H as HIDDEN_MASK, f as STRIKETHROUGH_MASK, g as colorToSgrParams, F as FULL_WIDTH_MASK, h as colorToAnsi256, S as StyledLine, j as textToStyledLine, p as plainTextToStyledLine } from './measure-text-BdOhbOeh.js';
4
- import Yoga from 'yoga-layout';
5
- import { j as getRelativeTop, i as getRelativeLeft, n as getAbsoluteContentPosition, c as calculateScrollbarLayout } from './measure-element-Bc6PEaIe.js';
6
- import { g as getBackgroundColorEscape, c as colorize } from './colorize-88_Vk8cn.js';
7
- import colorizeDefault from '@visulima/colorize';
8
- import { c as cliBoxes } from './boxes-oi3WUbyR.js';
9
- import { getScrollTop } from './getScrollHeight-Cz3CDQN2.js';
10
- import squashTextNodes from './squashTextNodesWithMap-iqm6OMMT.js';
11
-
12
- import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
13
- const require = __cjs_mod__.createRequire(import.meta.url);
14
- const getMaxWidth = (yogaNode) => Math.round(
15
- yogaNode.getComputedWidth() - Math.max(0, yogaNode.getComputedLeft() + yogaNode.getComputedWidth() - (yogaNode.getParent()?.getComputedWidth() ?? yogaNode.getComputedWidth())) - yogaNode.getComputedPadding(Yoga.EDGE_LEFT) - yogaNode.getComputedPadding(Yoga.EDGE_RIGHT) - yogaNode.getComputedBorder(Yoga.EDGE_LEFT) - yogaNode.getComputedBorder(Yoga.EDGE_RIGHT)
16
- );
17
-
18
- const CONTINUATION_CELL_CODE = 1114112;
19
-
20
- const SGR_BOLD = 1;
21
- const SGR_DIM = 2;
22
- const SGR_ITALIC = 3;
23
- const SGR_UNDERLINE = 4;
24
- const SGR_INVERSE = 7;
25
- const SGR_HIDDEN = 8;
26
- const SGR_STRIKETHROUGH = 9;
27
- const SGR_NO_BOLD = 22;
28
- const SGR_NO_ITALIC = 23;
29
- const SGR_NO_UNDERLINE = 24;
30
- const SGR_NO_INVERSE = 27;
31
- const SGR_NO_HIDDEN = 28;
32
- const SGR_NO_STRIKETHROUGH = 29;
33
- const SGR_FG_DEFAULT = 39;
34
- const SGR_BG_DEFAULT = 49;
35
- const ESC = "\x1B[";
36
- const sgr = (params) => {
37
- if (params.length === 0) {
38
- return "";
39
- }
40
- return `${ESC}${params.join(";")}m`;
41
- };
42
- const styledLineToString = (line) => {
43
- if (line.length === 0) {
44
- return "";
45
- }
46
- let result = "";
47
- let previousFlags = 0;
48
- let previousFg;
49
- let previousBg;
50
- let previousLink;
51
- let hasActiveStyles = false;
52
- let charIndex = 0;
53
- const spans = line.getSpans();
54
- for (const span of spans) {
55
- const spanFlags = span.formatFlags & 127;
56
- const { fgColor } = span;
57
- const { bgColor } = span;
58
- const { link } = span;
59
- const flags = spanFlags;
60
- if (flags !== previousFlags || fgColor !== previousFg || bgColor !== previousBg || link !== previousLink) {
61
- if (link !== previousLink) {
62
- if (previousLink) {
63
- result += previousLink.startsWith("ST:") ? "\x1B]8;;\x1B\\" : "\x1B]8;;\x07";
64
- }
65
- if (link) {
66
- const useST = link.startsWith("ST:");
67
- result += `\x1B]8;;${useST ? link.slice(3) : link}${useST ? "\x1B\\" : "\x07"}`;
68
- }
69
- }
70
- const previousBoldDim = previousFlags & (BOLD_MASK | DIM_MASK);
71
- const newBoldDim = flags & (BOLD_MASK | DIM_MASK);
72
- if (previousBoldDim !== newBoldDim) {
73
- const removingBold = previousFlags & BOLD_MASK && !(flags & BOLD_MASK);
74
- const removingDim = previousFlags & DIM_MASK && !(flags & DIM_MASK);
75
- if (removingBold || removingDim) {
76
- result += sgr([SGR_NO_BOLD]);
77
- }
78
- if (flags & BOLD_MASK && (!(previousFlags & BOLD_MASK) || removingDim)) {
79
- result += sgr([SGR_BOLD]);
80
- }
81
- if (flags & DIM_MASK && (!(previousFlags & DIM_MASK) || removingBold)) {
82
- result += sgr([SGR_DIM]);
83
- }
84
- }
85
- if (flags & ITALIC_MASK && !(previousFlags & ITALIC_MASK)) {
86
- result += sgr([SGR_ITALIC]);
87
- } else if (!(flags & ITALIC_MASK) && previousFlags & ITALIC_MASK) {
88
- result += sgr([SGR_NO_ITALIC]);
89
- }
90
- if (flags & UNDERLINE_MASK && !(previousFlags & UNDERLINE_MASK)) {
91
- result += sgr([SGR_UNDERLINE]);
92
- } else if (!(flags & UNDERLINE_MASK) && previousFlags & UNDERLINE_MASK) {
93
- result += sgr([SGR_NO_UNDERLINE]);
94
- }
95
- if (flags & INVERSE_MASK && !(previousFlags & INVERSE_MASK)) {
96
- result += sgr([SGR_INVERSE]);
97
- } else if (!(flags & INVERSE_MASK) && previousFlags & INVERSE_MASK) {
98
- result += sgr([SGR_NO_INVERSE]);
99
- }
100
- if (flags & HIDDEN_MASK && !(previousFlags & HIDDEN_MASK)) {
101
- result += sgr([SGR_HIDDEN]);
102
- } else if (!(flags & HIDDEN_MASK) && previousFlags & HIDDEN_MASK) {
103
- result += sgr([SGR_NO_HIDDEN]);
104
- }
105
- if (flags & STRIKETHROUGH_MASK && !(previousFlags & STRIKETHROUGH_MASK)) {
106
- result += sgr([SGR_STRIKETHROUGH]);
107
- } else if (!(flags & STRIKETHROUGH_MASK) && previousFlags & STRIKETHROUGH_MASK) {
108
- result += sgr([SGR_NO_STRIKETHROUGH]);
109
- }
110
- if (fgColor !== previousFg) {
111
- result += fgColor ? sgr(colorToSgrParams(fgColor, true)) : sgr([SGR_FG_DEFAULT]);
112
- }
113
- if (bgColor !== previousBg) {
114
- result += bgColor ? sgr(colorToSgrParams(bgColor, false)) : sgr([SGR_BG_DEFAULT]);
115
- }
116
- hasActiveStyles = flags !== 0 || fgColor !== void 0 || bgColor !== void 0;
117
- previousFlags = flags;
118
- previousFg = fgColor;
119
- previousBg = bgColor;
120
- previousLink = link;
121
- }
122
- result += line.getTextRange(charIndex, charIndex + span.length);
123
- charIndex += span.length;
124
- }
125
- if (hasActiveStyles) {
126
- if (previousFlags & (BOLD_MASK | DIM_MASK)) {
127
- result += sgr([SGR_NO_BOLD]);
128
- }
129
- if (previousFlags & ITALIC_MASK) {
130
- result += sgr([SGR_NO_ITALIC]);
131
- }
132
- if (previousFlags & UNDERLINE_MASK) {
133
- result += sgr([SGR_NO_UNDERLINE]);
134
- }
135
- if (previousFlags & INVERSE_MASK) {
136
- result += sgr([SGR_NO_INVERSE]);
137
- }
138
- if (previousFlags & HIDDEN_MASK) {
139
- result += sgr([SGR_NO_HIDDEN]);
140
- }
141
- if (previousFlags & STRIKETHROUGH_MASK) {
142
- result += sgr([SGR_NO_STRIKETHROUGH]);
143
- }
144
- if (previousFg !== void 0) {
145
- result += sgr([SGR_FG_DEFAULT]);
146
- }
147
- if (previousBg !== void 0) {
148
- result += sgr([SGR_BG_DEFAULT]);
149
- }
150
- }
151
- if (previousLink) {
152
- result += previousLink.startsWith("ST:") ? "\x1B]8;;\x1B\\" : "\x1B]8;;\x07";
153
- }
154
- return result;
155
- };
156
-
157
- class OutputCaches {
158
- widths = /* @__PURE__ */ new Map();
159
- blockWidths = /* @__PURE__ */ new Map();
160
- styledLines = /* @__PURE__ */ new Map();
161
- lines = /* @__PURE__ */ new Map();
162
- maxEntries;
163
- pruneToFactor;
164
- constructor(options = {}) {
165
- const { maxEntries = 3e4, pruneToFactor = 0.8 } = options;
166
- this.maxEntries = Math.max(1, maxEntries);
167
- this.pruneToFactor = Math.min(0.99, Math.max(0.1, pruneToFactor));
168
- }
169
- getStyledLine(line) {
170
- let cached = this.styledLines.get(line);
171
- if (cached === void 0) {
172
- cached = this.hasAnsiControlMarker(line) ? textToStyledLine(line) : plainTextToStyledLine(line);
173
- this.setCacheEntry(this.styledLines, line, cached);
174
- }
175
- return cached;
176
- }
177
- getStringWidth(text) {
178
- let cached = this.widths.get(text);
179
- if (cached === void 0) {
180
- cached = getStringWidth(text);
181
- this.setCacheEntry(this.widths, text, cached);
182
- }
183
- return cached;
184
- }
185
- getWidestLine(text) {
186
- let cached = this.blockWidths.get(text);
187
- if (cached === void 0) {
188
- let lineWidth = 0;
189
- for (const line of this.getLines(text)) {
190
- lineWidth = Math.max(lineWidth, this.getStringWidth(line));
191
- }
192
- cached = lineWidth;
193
- this.setCacheEntry(this.blockWidths, text, cached);
194
- }
195
- return cached;
196
- }
197
- getLines(text) {
198
- let cached = this.lines.get(text);
199
- if (cached === void 0) {
200
- cached = text.split("\n");
201
- this.setCacheEntry(this.lines, text, cached);
202
- }
203
- return cached;
204
- }
205
- hasAnsiControlMarker(text) {
206
- for (const character of text) {
207
- const codePoint = character.codePointAt(0);
208
- if (ansiControlMarkerCodePoints.has(codePoint)) {
209
- return true;
210
- }
211
- }
212
- return false;
213
- }
214
- setCacheEntry(cache, key, value) {
215
- if (!cache.has(key) && cache.size >= this.maxEntries) {
216
- this.pruneCache(cache);
217
- }
218
- cache.set(key, value);
219
- }
220
- pruneCache(cache) {
221
- const targetSize = Math.floor(this.maxEntries * this.pruneToFactor);
222
- for (const existingKey of cache.keys()) {
223
- cache.delete(existingKey);
224
- if (cache.size <= targetSize) {
225
- break;
226
- }
227
- }
228
- }
229
- }
230
- const ansiControlMarkerCodePoints = /* @__PURE__ */ new Set([27, 144, 152, 155, 157, 158, 159]);
231
- const memoizationDisableRatio = 0.6;
232
- const memoizationProbeInterval = 30;
233
- class Output {
234
- width;
235
- height;
236
- caches;
237
- // Single flat grid — all writes go directly here, clipped by bounds.
238
- grid;
239
- // Clip stack — bounds for writes. No child region allocation or compositing.
240
- clipStack = [];
241
- previousLines = [];
242
- previousRenderedLines = [];
243
- lineMemoizationEnabled = true;
244
- memoizationProbeCountdown = 0;
245
- constructor(options) {
246
- const { caches, height, width } = options;
247
- this.width = Math.round(width);
248
- this.height = Math.round(height);
249
- this.caches = caches ?? new OutputCaches();
250
- this.grid = this.createGrid(this.width, this.height);
251
- }
252
- reset(width, height) {
253
- this.width = Math.round(width);
254
- this.height = Math.round(height);
255
- this.clipStack.length = 0;
256
- this.grid = this.createGrid(this.width, this.height);
257
- }
258
- startChildRegion(absX, absY, width, height) {
259
- const x1 = Math.round(absX);
260
- const y1 = Math.round(absY);
261
- this.clipStack.push({ x1, x2: x1 + Math.round(width), y1, y2: y1 + Math.round(height) });
262
- }
263
- endChildRegion() {
264
- this.clipStack.pop();
265
- }
266
- write(x, y, text, options) {
267
- if (!text) {
268
- return;
269
- }
270
- const { transformers } = options;
271
- const clip = this.clipStack.at(-1);
272
- const lines = this.caches.getLines(text);
273
- const hasTransformers = transformers.length > 0;
274
- for (const [lineIndex, rawLine] of lines.entries()) {
275
- const rowIndex = y + lineIndex;
276
- if (rowIndex < 0 || rowIndex >= this.grid.length) {
277
- continue;
278
- }
279
- if (clip && (rowIndex < clip.y1 || rowIndex >= clip.y2)) {
280
- continue;
281
- }
282
- let line = rawLine;
283
- if (hasTransformers) {
284
- for (const transformer of transformers) {
285
- line = transformer(line, lineIndex);
286
- }
287
- }
288
- if (line.length === 0) {
289
- continue;
290
- }
291
- const row = this.grid[rowIndex];
292
- const parsed = this.caches.getStyledLine(line);
293
- let offsetX = x;
294
- const maxX = clip ? Math.min(clip.x2, row.length) : Infinity;
295
- for (let i = 0; i < parsed.length; i++) {
296
- if (offsetX >= maxX) {
297
- break;
298
- }
299
- if (clip && (offsetX < clip.x1 || offsetX >= clip.x2)) {
300
- offsetX++;
301
- if (parsed.getFullWidth(i)) {
302
- offsetX++;
303
- }
304
- continue;
305
- }
306
- if (offsetX >= 0) {
307
- if (offsetX >= row.length) {
308
- row.ensureWidth(offsetX + 2);
309
- }
310
- const span = parsed.getSpan(i);
311
- const isFullWidth = parsed.getFullWidth(i);
312
- const flags = (span?.formatFlags ?? 0) | (isFullWidth ? FULL_WIDTH_MASK : 0);
313
- row.setCharFast(offsetX, parsed.getValue(i), flags, span?.fgColor, span?.bgColor, span?.link);
314
- if (isFullWidth) {
315
- offsetX++;
316
- if (offsetX >= row.length) {
317
- row.ensureWidth(offsetX + 1);
318
- }
319
- row.setCharFast(offsetX, "", flags & ~FULL_WIDTH_MASK, span?.fgColor, span?.bgColor, span?.link);
320
- }
321
- }
322
- offsetX++;
323
- }
324
- }
325
- }
326
- writeStyledLine(x, y, line) {
327
- if (line.length === 0 || y < 0 || y >= this.grid.length) {
328
- return;
329
- }
330
- const clip = this.clipStack.at(-1);
331
- if (clip && (y < clip.y1 || y >= clip.y2)) {
332
- return;
333
- }
334
- this.writeStyledLineToRow(this.grid[y], x, line, this.width, clip);
335
- }
336
- getRootLines() {
337
- return this.grid;
338
- }
339
- getCurrentClip() {
340
- return this.clipStack.at(-1);
341
- }
342
- addRegionTree(region, x, y) {
343
- for (let ry = 0; ry < region.height; ry++) {
344
- const targetY = y + ry;
345
- if (targetY < 0 || targetY >= this.grid.length) {
346
- continue;
347
- }
348
- const srcLine = region.lines[ry];
349
- if (!srcLine) {
350
- continue;
351
- }
352
- const destinationRow = this.grid[targetY];
353
- for (let rx = 0; rx < srcLine.length; rx++) {
354
- const targetX = x + rx;
355
- if (targetX < 0 || targetX >= destinationRow.length) {
356
- continue;
357
- }
358
- const value = srcLine.getValue(rx);
359
- if (value !== " " || srcLine.hasStyles(rx)) {
360
- destinationRow.setCharFast(targetX, value, srcLine.getFormatFlags(rx), srcLine.getFgColor(rx), srcLine.getBgColor(rx), srcLine.getLink(rx));
361
- }
362
- }
363
- }
364
- for (const child of region.children) {
365
- this.addRegionTree(child, x + child.x, y + child.y);
366
- }
367
- }
368
- writeStyledLineToRow(row, x, source, maxWidth, clip) {
369
- let col = x;
370
- const effectiveMax = clip ? Math.min(clip.x2, maxWidth) : Infinity;
371
- for (let i = 0; i < source.length; i++) {
372
- if (col >= effectiveMax) {
373
- break;
374
- }
375
- if (clip && (col < clip.x1 || col >= clip.x2)) {
376
- col++;
377
- if (source.getFullWidth(i)) {
378
- col++;
379
- }
380
- continue;
381
- }
382
- if (col >= 0) {
383
- if (col >= row.length) {
384
- row.ensureWidth(col + 2);
385
- }
386
- const span = source.getSpan(i);
387
- const isFullWidth = source.getFullWidth(i);
388
- const flags = (span?.formatFlags ?? 0) | (isFullWidth ? FULL_WIDTH_MASK : 0);
389
- row.setCharFast(col, source.getValue(i), flags, span?.fgColor, span?.bgColor, span?.link);
390
- if (isFullWidth) {
391
- col++;
392
- if (col >= row.length) {
393
- row.ensureWidth(col + 1);
394
- }
395
- row.setCharFast(col, "", flags & ~FULL_WIDTH_MASK, span?.fgColor, span?.bgColor, span?.link);
396
- }
397
- }
398
- col++;
399
- }
400
- }
401
- get() {
402
- const output = this.grid;
403
- if (!this.lineMemoizationEnabled) {
404
- if (this.memoizationProbeCountdown > 0) {
405
- this.memoizationProbeCountdown--;
406
- } else {
407
- this.lineMemoizationEnabled = true;
408
- }
409
- }
410
- const canUseMemoization = this.lineMemoizationEnabled;
411
- const hasPrevious = this.previousLines.length > 0;
412
- const canReuseRows = canUseMemoization && hasPrevious && this.previousLines.length === output.length && this.previousRenderedLines.length === output.length;
413
- if (this.previousLines.length > output.length) {
414
- this.previousLines.length = output.length;
415
- }
416
- if (this.previousRenderedLines.length > output.length) {
417
- this.previousRenderedLines.length = output.length;
418
- }
419
- const generatedLines = Array.from({ length: output.length });
420
- let changedRows = 0;
421
- for (const [rowIndex, element] of output.entries()) {
422
- const row = element;
423
- if (canReuseRows && this.previousLines[rowIndex]?.equals(row)) {
424
- generatedLines[rowIndex] = this.previousRenderedLines[rowIndex] ?? "";
425
- continue;
426
- }
427
- changedRows++;
428
- const trimmed = row.trimEnd();
429
- const renderedLine = styledLineToString(trimmed);
430
- generatedLines[rowIndex] = renderedLine;
431
- if (canUseMemoization) {
432
- this.previousRenderedLines[rowIndex] = renderedLine;
433
- this.previousLines[rowIndex] = row.clone();
434
- }
435
- }
436
- if (canUseMemoization && canReuseRows && output.length > 0) {
437
- const changedRatio = changedRows / output.length;
438
- if (changedRatio > memoizationDisableRatio) {
439
- this.disableLineMemoization();
440
- }
441
- }
442
- return {
443
- height: output.length,
444
- output: generatedLines.join("\n")
445
- };
446
- }
447
- getBuffer() {
448
- const output = this.grid;
449
- const rows = output.length;
450
- const buffer = new Uint32Array(this.width * rows * 2);
451
- const defaultAttribute = 0 << 16 | 255 << 8 | 255;
452
- for (let index = 0; index < buffer.length; index += 2) {
453
- buffer[index] = 32;
454
- buffer[index + 1] = defaultAttribute;
455
- }
456
- for (let y = 0; y < rows; y++) {
457
- const row = output[y];
458
- for (let x = 0; x < row.length && x < this.width; x++) {
459
- const value = row.getValue(x);
460
- if (value.length === 0) {
461
- continue;
462
- }
463
- const charCode = value.codePointAt(0) ?? 32;
464
- const bufIndex = (y * this.width + x) * 2;
465
- const span = row.getSpan(x);
466
- const formatFlags = span?.formatFlags ?? 0;
467
- const fgColor = span?.fgColor;
468
- const bgColor = span?.bgColor;
469
- const fg = fgColor ? colorToAnsi256(fgColor) : 255;
470
- const bg = bgColor ? colorToAnsi256(bgColor) : 255;
471
- const styleBits = formatFlags & 255;
472
- const attributeCode = styleBits << 16 | (bg & 255) << 8 | fg & 255;
473
- buffer[bufIndex] = charCode;
474
- buffer[bufIndex + 1] = attributeCode;
475
- if (row.getFullWidth(x) && x + 1 < this.width) {
476
- const nextIndex = bufIndex + 2;
477
- buffer[nextIndex] = CONTINUATION_CELL_CODE;
478
- buffer[nextIndex + 1] = attributeCode;
479
- x++;
480
- }
481
- }
482
- }
483
- return { buffer, height: rows };
484
- }
485
- createGrid(width, height) {
486
- const grid = [];
487
- for (let y = 0; y < height; y++) {
488
- grid.push(StyledLine.empty(width));
489
- }
490
- return grid;
491
- }
492
- disableLineMemoization() {
493
- this.lineMemoizationEnabled = false;
494
- this.memoizationProbeCountdown = memoizationProbeInterval;
495
- this.previousLines.length = 0;
496
- this.previousRenderedLines.length = 0;
497
- }
498
- }
499
-
500
- const renderBackground = (x, y, node, output) => {
501
- if (!node.style.backgroundColor) {
502
- return;
503
- }
504
- const width = Math.round(node.yogaNode.getComputedWidth());
505
- const height = Math.round(node.yogaNode.getComputedHeight());
506
- const leftBorderWidth = node.style.borderStyle && node.style.borderLeft !== false ? 1 : 0;
507
- const rightBorderWidth = node.style.borderStyle && node.style.borderRight !== false ? 1 : 0;
508
- const topBorderHeight = node.style.borderStyle && node.style.borderTop !== false ? 1 : 0;
509
- const bottomBorderHeight = node.style.borderStyle && node.style.borderBottom !== false ? 1 : 0;
510
- const contentWidth = width - leftBorderWidth - rightBorderWidth;
511
- const contentHeight = height - topBorderHeight - bottomBorderHeight;
512
- if (!(contentWidth > 0 && contentHeight > 0)) {
513
- return;
514
- }
515
- const bgEsc = getBackgroundColorEscape(node.style.backgroundColor);
516
- if (!bgEsc) {
517
- return;
518
- }
519
- const backgroundLine = `${bgEsc}${" ".repeat(contentWidth)}\x1B[49m`;
520
- for (let row = 0; row < contentHeight; row++) {
521
- output.write(x + leftBorderWidth, y + topBorderHeight + row, backgroundLine, { transformers: [] });
522
- }
523
- };
524
-
525
- const stylePiece = (segment, fg, bg, dim) => {
526
- let styled = colorize(segment, fg, "foreground");
527
- styled = colorize(styled, bg, "background");
528
- if (dim) {
529
- styled = colorizeDefault.dim(styled);
530
- }
531
- return styled;
532
- };
533
- const buildBorderWithTitle = (borderChar, contentWidth, title, titleAlignment, rightTitle, borderFg, borderBg, borderDim) => {
534
- if (!title && !rightTitle) {
535
- return stylePiece(borderChar.repeat(contentWidth), borderFg, borderBg, borderDim);
536
- }
537
- const leftTitle = title ? ` ${title} ` : "";
538
- const right = rightTitle ? ` ${rightTitle} ` : "";
539
- const leftLength = leftTitle.length;
540
- const rightLength = right.length;
541
- const alignment = titleAlignment ?? "left";
542
- if (leftLength + rightLength >= contentWidth) {
543
- if (leftLength >= contentWidth) {
544
- return `${leftTitle.slice(0, contentWidth - 1)}…`;
545
- }
546
- const remainingForRight = contentWidth - leftLength;
547
- if (remainingForRight > 3) {
548
- return leftTitle + right.slice(0, remainingForRight);
549
- }
550
- return leftTitle + stylePiece(borderChar.repeat(contentWidth - leftLength), borderFg, borderBg, borderDim);
551
- }
552
- const middleWidth = contentWidth - leftLength - rightLength;
553
- if (alignment === "left" || rightTitle) {
554
- return leftTitle + stylePiece(borderChar.repeat(middleWidth), borderFg, borderBg, borderDim) + right;
555
- }
556
- if (alignment === "right") {
557
- const fillWidth = contentWidth - leftLength;
558
- return stylePiece(borderChar.repeat(fillWidth), borderFg, borderBg, borderDim) + leftTitle;
559
- }
560
- const leftFill = Math.floor(middleWidth / 2);
561
- const rightFill = middleWidth - leftFill;
562
- return stylePiece(borderChar.repeat(leftFill), borderFg, borderBg, borderDim) + leftTitle + stylePiece(borderChar.repeat(rightFill), borderFg, borderBg, borderDim);
563
- };
564
- const renderBorder = (x, y, node, output) => {
565
- if (node.style.borderStyle) {
566
- const width = Math.round(node.yogaNode.getComputedWidth());
567
- const height = Math.round(node.yogaNode.getComputedHeight());
568
- const box = typeof node.style.borderStyle === "string" ? cliBoxes[node.style.borderStyle] : node.style.borderStyle;
569
- const topBorderColor = node.style.borderTopColor ?? node.style.borderColor;
570
- const bottomBorderColor = node.style.borderBottomColor ?? node.style.borderColor;
571
- const leftBorderColor = node.style.borderLeftColor ?? node.style.borderColor;
572
- const rightBorderColor = node.style.borderRightColor ?? node.style.borderColor;
573
- const topBorderBackgroundColor = node.style.borderTopBackgroundColor ?? node.style.borderBackgroundColor;
574
- const bottomBorderBackgroundColor = node.style.borderBottomBackgroundColor ?? node.style.borderBackgroundColor;
575
- const leftBorderBackgroundColor = node.style.borderLeftBackgroundColor ?? node.style.borderBackgroundColor;
576
- const rightBorderBackgroundColor = node.style.borderRightBackgroundColor ?? node.style.borderBackgroundColor;
577
- const dimTopBorderColor = node.style.borderTopDimColor ?? node.style.borderDimColor;
578
- const dimBottomBorderColor = node.style.borderBottomDimColor ?? node.style.borderDimColor;
579
- const dimLeftBorderColor = node.style.borderLeftDimColor ?? node.style.borderDimColor;
580
- const dimRightBorderColor = node.style.borderRightDimColor ?? node.style.borderDimColor;
581
- const showTopBorder = node.style.borderTop !== false;
582
- const showBottomBorder = node.style.borderBottom !== false;
583
- const showLeftBorder = node.style.borderLeft !== false;
584
- const showRightBorder = node.style.borderRight !== false;
585
- const contentWidth = Math.max(0, width - (showLeftBorder ? 1 : 0) - (showRightBorder ? 1 : 0));
586
- let topBorder;
587
- if (showTopBorder) {
588
- const topLeftCorner = showLeftBorder ? stylePiece(box.topLeft, topBorderColor, topBorderBackgroundColor, dimTopBorderColor) : "";
589
- const topRightCorner = showRightBorder ? stylePiece(box.topRight, topBorderColor, topBorderBackgroundColor, dimTopBorderColor) : "";
590
- const topContent = buildBorderWithTitle(
591
- box.top,
592
- contentWidth,
593
- node.style.borderTopTitle,
594
- node.style.borderTopTitleAlignment,
595
- node.style.borderTopRightTitle,
596
- topBorderColor,
597
- topBorderBackgroundColor,
598
- dimTopBorderColor
599
- );
600
- topBorder = topLeftCorner + topContent + topRightCorner;
601
- }
602
- let verticalBorderHeight = height;
603
- if (showTopBorder) {
604
- verticalBorderHeight -= 1;
605
- }
606
- if (showBottomBorder) {
607
- verticalBorderHeight -= 1;
608
- }
609
- verticalBorderHeight = Math.max(0, verticalBorderHeight);
610
- let leftBorder = "";
611
- if (showLeftBorder) {
612
- const one = stylePiece(box.left, leftBorderColor, leftBorderBackgroundColor, dimLeftBorderColor);
613
- leftBorder = `${one}
614
- `.repeat(verticalBorderHeight);
615
- }
616
- let rightBorder = "";
617
- if (showRightBorder) {
618
- const one = stylePiece(box.right, rightBorderColor, rightBorderBackgroundColor, dimRightBorderColor);
619
- rightBorder = `${one}
620
- `.repeat(verticalBorderHeight);
621
- }
622
- let bottomBorder;
623
- if (showBottomBorder) {
624
- const bottomLeftCorner = showLeftBorder ? stylePiece(box.bottomLeft, bottomBorderColor, bottomBorderBackgroundColor, dimBottomBorderColor) : "";
625
- const bottomRightCorner = showRightBorder ? stylePiece(box.bottomRight, bottomBorderColor, bottomBorderBackgroundColor, dimBottomBorderColor) : "";
626
- const bottomContent = buildBorderWithTitle(
627
- box.bottom,
628
- contentWidth,
629
- node.style.borderBottomTitle,
630
- node.style.borderBottomTitleAlignment,
631
- void 0,
632
- bottomBorderColor,
633
- bottomBorderBackgroundColor,
634
- dimBottomBorderColor
635
- );
636
- bottomBorder = bottomLeftCorner + bottomContent + bottomRightCorner;
637
- }
638
- const offsetY = showTopBorder ? 1 : 0;
639
- if (topBorder) {
640
- output.write(x, y, topBorder, { transformers: [] });
641
- }
642
- if (leftBorder) {
643
- output.write(x, y + offsetY, leftBorder, { transformers: [] });
644
- }
645
- if (rightBorder) {
646
- output.write(x + width - 1, y + offsetY, rightBorder, {
647
- transformers: []
648
- });
649
- }
650
- if (bottomBorder) {
651
- output.write(x, y + height - 1, bottomBorder, { transformers: [] });
652
- }
653
- }
654
- };
655
-
656
- const noTransformers = [];
657
- const renderScrollbar = ({ axis, color, layout, output }) => {
658
- const {
659
- thumb: { end: endIndex, endHalf: thumbEndHalf, start: startIndex, startHalf: thumbStartHalf },
660
- x,
661
- y
662
- } = layout;
663
- if (axis === "vertical") {
664
- for (let index = startIndex; index < endIndex; index++) {
665
- let char = "█";
666
- const hasUpper = 2 * index >= thumbStartHalf && 2 * index < thumbEndHalf;
667
- const hasLower = 2 * index + 1 >= thumbStartHalf && 2 * index + 1 < thumbEndHalf;
668
- if (hasUpper && !hasLower) {
669
- char = "▀";
670
- } else if (!hasUpper && hasLower) {
671
- char = "▄";
672
- }
673
- const charString = color ? colorize(char, color, "foreground") : char;
674
- output.write(x, y + index, charString, { transformers: noTransformers });
675
- }
676
- } else {
677
- for (let index = startIndex; index < endIndex; index++) {
678
- let char = "█";
679
- const hasLeft = 2 * index >= thumbStartHalf && 2 * index < thumbEndHalf;
680
- const hasRight = 2 * index + 1 >= thumbStartHalf && 2 * index + 1 < thumbEndHalf;
681
- if (hasLeft && !hasRight) {
682
- char = "▌";
683
- } else if (!hasLeft && hasRight) {
684
- char = "▐";
685
- }
686
- const charString = color ? colorize(char, color, "foreground") : char;
687
- output.write(x + index, y, charString, { transformers: noTransformers });
688
- }
689
- }
690
- };
691
-
692
- const getStickyDescendants = (node, result = []) => {
693
- for (const child of node.childNodes) {
694
- if (child.nodeName === "#text") {
695
- continue;
696
- }
697
- const domChild = child;
698
- if (domChild.internal_stickyAlternate) {
699
- continue;
700
- }
701
- if (domChild.internal_sticky) {
702
- result.push({
703
- node: domChild,
704
- type: domChild.internal_sticky === "bottom" ? "bottom" : "top"
705
- });
706
- } else {
707
- const overflow = domChild.style.overflow ?? "visible";
708
- const overflowX = domChild.style.overflowX ?? overflow;
709
- const overflowY = domChild.style.overflowY ?? overflow;
710
- const isScrollable = overflowX === "scroll" || overflowY === "scroll";
711
- if (!isScrollable && domChild.childNodes) {
712
- getStickyDescendants(domChild, result);
713
- }
714
- }
715
- }
716
- return result;
717
- };
718
- const identifyActiveStickyNodes = (stickyNodes, node, scrollTop, viewportBottom) => {
719
- let activeTopStickyNode;
720
- let activeTopStickyNodeIndex = -1;
721
- let activeBottomStickyNode;
722
- let activeBottomStickyNodeIndex = -1;
723
- for (const [index, stickyNodeInfo] of stickyNodes.entries()) {
724
- const { node: stickyChild, type: stickyType } = stickyNodeInfo;
725
- if (!stickyChild.yogaNode) {
726
- continue;
727
- }
728
- const stickyNodeTop = getRelativeTop(stickyChild, node) ?? 0;
729
- const stickyNodeHeight = Math.round(stickyChild.yogaNode.getComputedHeight());
730
- const stickyNodeBottom = stickyNodeTop + stickyNodeHeight;
731
- const parent = stickyChild.parentNode;
732
- let parentTop = 0;
733
- let parentHeight = Number.MAX_SAFE_INTEGER;
734
- if (parent?.yogaNode) {
735
- parentTop = getRelativeTop(parent, node) ?? 0;
736
- parentHeight = Math.round(parent.yogaNode.getComputedHeight());
737
- }
738
- if (stickyType === "top" && stickyNodeTop < scrollTop && parentTop + parentHeight > scrollTop) {
739
- activeTopStickyNode = stickyNodeInfo;
740
- activeTopStickyNodeIndex = index;
741
- }
742
- if (stickyType === "bottom" && Math.floor(stickyNodeBottom) > Math.floor(viewportBottom) && parentTop < viewportBottom) {
743
- activeBottomStickyNode = stickyNodeInfo;
744
- activeBottomStickyNodeIndex = index;
745
- }
746
- }
747
- const result = [];
748
- if (activeTopStickyNode) {
749
- let nextStickyNodeInfo;
750
- for (let index = activeTopStickyNodeIndex + 1; index < stickyNodes.length; index++) {
751
- const info = stickyNodes[index];
752
- if (info.type !== "bottom") {
753
- nextStickyNodeInfo = info;
754
- break;
755
- }
756
- }
757
- result.push({
758
- nextStickyNodeInfo,
759
- stickyNode: activeTopStickyNode.node,
760
- type: "top"
761
- });
762
- }
763
- if (activeBottomStickyNode) {
764
- let nextStickyNodeInfo;
765
- for (let index = activeBottomStickyNodeIndex - 1; index >= 0; index--) {
766
- const info = stickyNodes[index];
767
- if (info.type === "bottom") {
768
- nextStickyNodeInfo = info;
769
- break;
770
- }
771
- }
772
- result.push({
773
- nextStickyNodeInfo,
774
- stickyNode: activeBottomStickyNode.node,
775
- type: "bottom"
776
- });
777
- }
778
- return result;
779
- };
780
- const renderActiveStickyNodes = (activeStickyNodes, node, output, createOutput, options) => {
781
- const { newTransformers, skipStaticElements, x, y } = options;
782
- const { yogaNode } = node;
783
- if (!yogaNode) {
784
- return;
785
- }
786
- const currentBorderTop = yogaNode.getComputedBorder(Yoga.EDGE_TOP);
787
- const currentBorderLeft = yogaNode.getComputedBorder(Yoga.EDGE_LEFT);
788
- const currentScrollTop = getScrollTop(node);
789
- const currentClientHeight = node.internal_scrollState?.clientHeight ?? 0;
790
- for (const { nextStickyNodeInfo, stickyNode, type } of activeStickyNodes) {
791
- if (!stickyNode.yogaNode) {
792
- continue;
793
- }
794
- const stickyNodeTop = getRelativeTop(stickyNode, node) ?? 0;
795
- const stickyNodeHeight = Math.round(stickyNode.yogaNode.getComputedHeight());
796
- const stickyOffsetX = x + (getRelativeLeft(stickyNode, node) ?? 0);
797
- const parent = stickyNode.parentNode;
798
- let parentTop = 0;
799
- let parentHeight = Number.MAX_SAFE_INTEGER;
800
- if (parent?.yogaNode) {
801
- parentTop = getRelativeTop(parent, node) ?? 0;
802
- parentHeight = Math.round(parent.yogaNode.getComputedHeight());
803
- }
804
- let finalStickyY;
805
- if (type === "top") {
806
- const parentBorderBottom = parent?.yogaNode?.getComputedBorder(Yoga.EDGE_BOTTOM) ?? 0;
807
- const parentBottom = parentTop + parentHeight - parentBorderBottom;
808
- let maxStickyTop = y - currentScrollTop + parentBottom - stickyNodeHeight;
809
- const naturalStickyY = y - currentScrollTop + stickyNodeTop;
810
- const stuckStickyY = y + currentBorderTop;
811
- if (nextStickyNodeInfo?.node?.yogaNode) {
812
- const nextNodeTop = getRelativeTop(nextStickyNodeInfo.node, node) ?? 0;
813
- const nextNodeTopInViewport = y - currentScrollTop + nextNodeTop;
814
- const nextNodePushTop = nextNodeTopInViewport - stickyNodeHeight;
815
- if (nextNodePushTop < maxStickyTop) {
816
- maxStickyTop = nextNodePushTop;
817
- }
818
- }
819
- finalStickyY = Math.min(Math.max(stuckStickyY, naturalStickyY), maxStickyTop);
820
- } else {
821
- const parentBorderTop = parent?.yogaNode?.getComputedBorder(Yoga.EDGE_TOP) ?? 0;
822
- let minStickyTop = y - currentScrollTop + parentTop + parentBorderTop;
823
- const naturalStickyY = y - currentScrollTop + stickyNodeTop;
824
- const stuckStickyY = y + currentBorderTop + currentClientHeight - stickyNodeHeight;
825
- if (nextStickyNodeInfo?.node?.yogaNode) {
826
- const nextNodeHeight = Math.round(nextStickyNodeInfo.node.yogaNode.getComputedHeight());
827
- const nextNodeTop = getRelativeTop(nextStickyNodeInfo.node, node) ?? 0;
828
- const nextNodeBottomInViewport = y - currentScrollTop + nextNodeTop + nextNodeHeight;
829
- if (nextNodeBottomInViewport > minStickyTop) {
830
- minStickyTop = nextNodeBottomInViewport;
831
- }
832
- }
833
- finalStickyY = Math.max(Math.min(stuckStickyY, naturalStickyY), minStickyTop);
834
- }
835
- const stickyOutput = createOutput({
836
- height: stickyNodeHeight,
837
- width: Math.round(stickyNode.yogaNode.getComputedWidth())
838
- });
839
- renderNodeToOutput(stickyNode, stickyOutput, {
840
- offsetX: -Math.round(stickyNode.yogaNode.getComputedLeft()),
841
- offsetY: -Math.round(stickyNode.yogaNode.getComputedTop()),
842
- skipStaticElements,
843
- transformers: newTransformers
844
- });
845
- const renderedResult = stickyOutput.get();
846
- const renderedLines = renderedResult.output.split("\n");
847
- for (const [lineIndex, line] of renderedLines.entries()) {
848
- if (line && line.length > 0) {
849
- output.write(stickyOffsetX - (x + currentBorderLeft), finalStickyY - (y + currentBorderTop) + lineIndex, line, {
850
- transformers: []
851
- });
852
- }
853
- }
854
- }
855
- };
856
-
857
- const applyPaddingToText = (node, text) => {
858
- const yogaNode = node.childNodes[0]?.yogaNode;
859
- if (yogaNode) {
860
- const offsetX = Math.round(yogaNode.getComputedLeft());
861
- const offsetY = Math.round(yogaNode.getComputedTop());
862
- text = "\n".repeat(offsetY) + indent(text, offsetX);
863
- }
864
- return text;
865
- };
866
- const c0ControlUpperBound = 31;
867
- const deleteCodePoint = 127;
868
- const c1ControlStart = 128;
869
- const c1ControlEnd = 159;
870
- const mightExceedWidth = (text, maxWidth) => {
871
- if (!Number.isFinite(maxWidth)) {
872
- return false;
873
- }
874
- if (maxWidth < 0) {
875
- return true;
876
- }
877
- let lineCodePointCount = 0;
878
- for (const character of text) {
879
- if (character === "\n") {
880
- if (lineCodePointCount > maxWidth) {
881
- return true;
882
- }
883
- lineCodePointCount = 0;
884
- continue;
885
- }
886
- const codePoint = character.codePointAt(0);
887
- if (codePoint <= c0ControlUpperBound || codePoint === deleteCodePoint || codePoint >= c1ControlStart && codePoint <= c1ControlEnd) {
888
- return true;
889
- }
890
- if (isFullwidthCodePoint(codePoint)) {
891
- return true;
892
- }
893
- lineCodePointCount++;
894
- if (lineCodePointCount > maxWidth) {
895
- return true;
896
- }
897
- }
898
- return false;
899
- };
900
- const isNodeHidden = (node) => (node.internal_hidden ?? false) || node.yogaNode?.getDisplay() === Yoga.DISPLAY_NONE;
901
- const isNodeOrAncestorHidden = (node) => {
902
- let currentNode = node;
903
- while (currentNode) {
904
- if (isNodeHidden(currentNode)) {
905
- return true;
906
- }
907
- currentNode = currentNode.parentNode;
908
- }
909
- return false;
910
- };
911
- const renderNodeToScreenReaderOutput = (node, options = {}) => {
912
- if (options.skipStaticElements && node.internal_static) {
913
- return "";
914
- }
915
- if (node.internal_hidden) {
916
- return "";
917
- }
918
- if (node.internal_stickyAlternate) {
919
- return "";
920
- }
921
- if (node.yogaNode?.getDisplay() === Yoga.DISPLAY_NONE) {
922
- return "";
923
- }
924
- let output = "";
925
- if (node.nodeName === "ink-text") {
926
- output = squashTextNodes(node);
927
- } else if (node.nodeName === "ink-box" || node.nodeName === "ink-root") {
928
- const separator = node.style.flexDirection === "row" || node.style.flexDirection === "row-reverse" ? " " : "\n";
929
- const childNodes = node.style.flexDirection === "row-reverse" || node.style.flexDirection === "column-reverse" ? node.childNodes.toReversed() : [...node.childNodes];
930
- output = childNodes.map((childNode) => {
931
- const screenReaderOutput = renderNodeToScreenReaderOutput(childNode, {
932
- parentRole: node.internal_accessibility?.role,
933
- skipStaticElements: options.skipStaticElements
934
- });
935
- return screenReaderOutput;
936
- }).filter(Boolean).join(separator);
937
- }
938
- if (node.internal_accessibility) {
939
- const { role, state } = node.internal_accessibility;
940
- if (state) {
941
- const stateKeys = Object.keys(state);
942
- const stateDescription = stateKeys.filter((key) => state[key]).join(", ");
943
- if (stateDescription) {
944
- output = `(${stateDescription}) ${output}`;
945
- }
946
- }
947
- if (role && role !== options.parentRole) {
948
- output = `${role}: ${output}`;
949
- }
950
- }
951
- return output;
952
- };
953
- const renderNodeToOutput = (node, output, options) => {
954
- const { absoluteOffsetX, absoluteOffsetY, offsetX = 0, offsetY = 0, renderState, skipStaticElements, transformers = [] } = options;
955
- if (skipStaticElements && node.internal_static) {
956
- return;
957
- }
958
- if (node.internal_hidden) {
959
- return;
960
- }
961
- if (node.cachedRender) {
962
- const x = Math.round(offsetX + (node.yogaNode?.getComputedLeft() ?? 0));
963
- const y = Math.round(offsetY + (node.yogaNode?.getComputedTop() ?? 0));
964
- output.addRegionTree(node.cachedRender, x, y);
965
- return;
966
- }
967
- if (node.nodeName === "ink-cursor") {
968
- if (!renderState) {
969
- return;
970
- }
971
- renderState.cursorRequested = true;
972
- const marker = node.internal_cursor;
973
- if (!marker) {
974
- renderState.cursorPosition = void 0;
975
- return;
976
- }
977
- if (marker.inline) {
978
- if (renderState.lastTextWriteEnd) {
979
- renderState.cursorPosition = {
980
- x: renderState.lastTextWriteEnd.x,
981
- y: renderState.lastTextWriteEnd.y
982
- };
983
- } else {
984
- const parentPosition = node.parentNode ? getAbsoluteContentPosition(node.parentNode) : void 0;
985
- renderState.cursorPosition = parentPosition ? { x: parentPosition.x, y: parentPosition.y } : void 0;
986
- }
987
- return;
988
- }
989
- const resolvedAnchorNode = marker.anchorRef ? marker.anchorRef.current : node.parentNode;
990
- if (!resolvedAnchorNode) {
991
- renderState.cursorPosition = void 0;
992
- return;
993
- }
994
- if (marker.anchorRef && isNodeOrAncestorHidden(resolvedAnchorNode)) {
995
- renderState.cursorPosition = void 0;
996
- return;
997
- }
998
- const anchorPosition = getAbsoluteContentPosition(resolvedAnchorNode);
999
- if (!anchorPosition) {
1000
- renderState.cursorPosition = void 0;
1001
- return;
1002
- }
1003
- renderState.cursorPosition = {
1004
- x: anchorPosition.x + marker.x,
1005
- y: anchorPosition.y + marker.y
1006
- };
1007
- return;
1008
- }
1009
- const { yogaNode } = node;
1010
- if (yogaNode) {
1011
- if (yogaNode.getDisplay() === Yoga.DISPLAY_NONE) {
1012
- return;
1013
- }
1014
- const computedLeft = yogaNode.getComputedLeft();
1015
- const computedTop = yogaNode.getComputedTop();
1016
- const x = Math.round(offsetX + computedLeft);
1017
- const y = Math.round(offsetY + computedTop);
1018
- const absX = Math.round((absoluteOffsetX ?? offsetX) + computedLeft);
1019
- const absY = Math.round((absoluteOffsetY ?? offsetY) + computedTop);
1020
- const currentClip = output.getCurrentClip();
1021
- if (currentClip) {
1022
- const nodeWidth = Math.round(yogaNode.getComputedWidth());
1023
- const nodeHeight = Math.round(yogaNode.getComputedHeight());
1024
- const nodeRight = absX + nodeWidth;
1025
- const nodeBottom = absY + nodeHeight;
1026
- const clipLeft = currentClip.x1 ?? -Infinity;
1027
- const clipRight = currentClip.x2 ?? Infinity;
1028
- const clipTop = currentClip.y1 ?? -Infinity;
1029
- const clipBottom = currentClip.y2 ?? Infinity;
1030
- if (nodeRight <= clipLeft || absX >= clipRight || nodeBottom <= clipTop || absY >= clipBottom) {
1031
- return;
1032
- }
1033
- }
1034
- let newTransformers = transformers;
1035
- if (typeof node.internal_transform === "function") {
1036
- newTransformers = [node.internal_transform, ...transformers];
1037
- }
1038
- if (node.nodeName === "ink-text") {
1039
- let text = squashTextNodes(node);
1040
- if (text.length > 0) {
1041
- const maxWidth = getMaxWidth(yogaNode);
1042
- if (mightExceedWidth(text, maxWidth)) {
1043
- const currentWidth = Math.max(...text.split("\n").map((line) => getStringWidth(line)));
1044
- if (currentWidth > maxWidth) {
1045
- const textWrap = node.style.textWrap ?? "wrap";
1046
- text = wrapText(text, Math.floor(maxWidth), textWrap);
1047
- }
1048
- }
1049
- text = applyPaddingToText(node, text);
1050
- output.write(x, y, text, { transformers: newTransformers });
1051
- if (renderState) {
1052
- const lines = text.split("\n");
1053
- const lastLine = lines.at(-1) ?? "";
1054
- renderState.lastTextWriteEnd = {
1055
- x: x + getStringWidth(lastLine),
1056
- y: y + lines.length - 1
1057
- };
1058
- }
1059
- }
1060
- return;
1061
- }
1062
- let clipped = false;
1063
- let scrollOffsetX = 0;
1064
- let scrollOffsetY = 0;
1065
- if (node.nodeName === "ink-box") {
1066
- renderBackground(x, y, node, output);
1067
- renderBorder(x, y, node, output);
1068
- const overflow = node.style.overflow ?? "visible";
1069
- const overflowX = node.style.overflowX ?? overflow;
1070
- const overflowY = node.style.overflowY ?? overflow;
1071
- const clipHorizontally = overflowX === "hidden" || overflowX === "scroll";
1072
- const clipVertically = overflowY === "hidden" || overflowY === "scroll";
1073
- if (clipHorizontally || clipVertically) {
1074
- const nodeW = Math.round(yogaNode.getComputedWidth());
1075
- const nodeH = Math.round(yogaNode.getComputedHeight());
1076
- const regionX = clipHorizontally ? x + yogaNode.getComputedBorder(Yoga.EDGE_LEFT) : x;
1077
- const regionW = clipHorizontally ? nodeW - yogaNode.getComputedBorder(Yoga.EDGE_LEFT) - yogaNode.getComputedBorder(Yoga.EDGE_RIGHT) : nodeW;
1078
- const regionY = clipVertically ? y + yogaNode.getComputedBorder(Yoga.EDGE_TOP) : y;
1079
- const regionH = clipVertically ? nodeH - yogaNode.getComputedBorder(Yoga.EDGE_TOP) - yogaNode.getComputedBorder(Yoga.EDGE_BOTTOM) : nodeH;
1080
- output.startChildRegion(regionX, regionY, Math.max(0, regionW), Math.max(0, regionH));
1081
- clipped = true;
1082
- if (overflowY === "scroll" && node.internal_scrollState) {
1083
- scrollOffsetY = -node.internal_scrollState.scrollTop;
1084
- }
1085
- if (overflowX === "scroll" && node.internal_scrollState) {
1086
- scrollOffsetX = -node.internal_scrollState.scrollLeft;
1087
- }
1088
- }
1089
- }
1090
- if (node.nodeName === "ink-root" || node.nodeName === "ink-box" || node.nodeName === "ink-static-render") {
1091
- for (const childNode of node.childNodes) {
1092
- renderNodeToOutput(childNode, output, {
1093
- absoluteOffsetX: absX + scrollOffsetX,
1094
- absoluteOffsetY: absY + scrollOffsetY,
1095
- offsetX: x + scrollOffsetX,
1096
- offsetY: y + scrollOffsetY,
1097
- renderState,
1098
- skipStaticElements,
1099
- transformers: newTransformers
1100
- });
1101
- }
1102
- if (node.nodeName === "ink-box" && node.internal_scrollState) {
1103
- const stickyNodes = getStickyDescendants(node);
1104
- if (stickyNodes.length > 0) {
1105
- const currentScrollTop = getScrollTop(node);
1106
- const currentClientHeight = node.internal_scrollState.clientHeight;
1107
- const viewportBottom = currentScrollTop + currentClientHeight;
1108
- const activeStickyNodes = identifyActiveStickyNodes(stickyNodes, node, currentScrollTop, viewportBottom);
1109
- if (activeStickyNodes.length > 0) {
1110
- const createOutput = (options_) => new Output(options_);
1111
- renderActiveStickyNodes(activeStickyNodes, node, output, createOutput, {
1112
- newTransformers,
1113
- skipStaticElements,
1114
- x,
1115
- y
1116
- });
1117
- }
1118
- }
1119
- }
1120
- if (node.nodeName === "ink-box" && node.internal_scrollState) {
1121
- const overflow = node.style.overflow ?? "visible";
1122
- const overflowX = node.style.overflowX ?? overflow;
1123
- const overflowY = node.style.overflowY ?? overflow;
1124
- const borderLeft = yogaNode.getComputedBorder(Yoga.EDGE_LEFT);
1125
- const borderRight = yogaNode.getComputedBorder(Yoga.EDGE_RIGHT);
1126
- const borderTop = yogaNode.getComputedBorder(Yoga.EDGE_TOP);
1127
- const borderBottom = yogaNode.getComputedBorder(Yoga.EDGE_BOTTOM);
1128
- const innerWidth = Math.round(yogaNode.getComputedWidth() - borderLeft - borderRight);
1129
- const innerHeight = Math.round(yogaNode.getComputedHeight() - borderTop - borderBottom);
1130
- const { clientHeight, clientWidth, scrollHeight, scrollLeft, scrollTop, scrollWidth } = node.internal_scrollState;
1131
- const isVerticalScrollable = overflowY === "scroll" && scrollHeight > clientHeight;
1132
- const isHorizontalScrollable = overflowX === "scroll" && scrollWidth > clientWidth;
1133
- const showScrollbar = node.internal_scrollbar !== false;
1134
- if (isVerticalScrollable && showScrollbar) {
1135
- const verticalLayout = calculateScrollbarLayout({
1136
- axis: "vertical",
1137
- clientDimension: clientHeight,
1138
- hasOppositeScrollbar: false,
1139
- height: innerHeight,
1140
- marginBottom: 0,
1141
- marginRight: 0,
1142
- scrollDimension: scrollHeight,
1143
- scrollPosition: scrollTop,
1144
- width: innerWidth,
1145
- x: x + borderLeft,
1146
- y: y + borderTop
1147
- });
1148
- if (verticalLayout) {
1149
- renderScrollbar({
1150
- axis: "vertical",
1151
- color: node.style.scrollbarThumbColor,
1152
- layout: verticalLayout,
1153
- output
1154
- });
1155
- }
1156
- }
1157
- if (isHorizontalScrollable && showScrollbar) {
1158
- const horizontalLayout = calculateScrollbarLayout({
1159
- axis: "horizontal",
1160
- clientDimension: clientWidth,
1161
- hasOppositeScrollbar: isVerticalScrollable,
1162
- height: innerHeight,
1163
- marginBottom: 0,
1164
- marginRight: 0,
1165
- scrollDimension: scrollWidth,
1166
- scrollPosition: scrollLeft,
1167
- width: innerWidth,
1168
- x: x + borderLeft,
1169
- y: y + borderTop
1170
- });
1171
- if (horizontalLayout) {
1172
- renderScrollbar({
1173
- axis: "horizontal",
1174
- color: node.style.scrollbarThumbColor,
1175
- layout: horizontalLayout,
1176
- output
1177
- });
1178
- }
1179
- }
1180
- }
1181
- if (clipped) {
1182
- output.endChildRegion();
1183
- }
1184
- }
1185
- }
1186
- };
1187
- const renderToStatic = (node, options) => {
1188
- if (!node.yogaNode) {
1189
- return;
1190
- }
1191
- const width = Math.round(node.yogaNode.getComputedWidth());
1192
- const height = Math.round(node.yogaNode.getComputedHeight());
1193
- if (width <= 0 || height <= 0) {
1194
- return;
1195
- }
1196
- const { setCachedRender } = require("./dom");
1197
- const staticOutput = new Output({
1198
- height,
1199
- width
1200
- });
1201
- for (const childNode of node.childNodes) {
1202
- renderNodeToOutput(childNode, staticOutput, {
1203
- skipStaticElements: options?.skipStaticElements
1204
- });
1205
- }
1206
- const region = {
1207
- children: [],
1208
- cursorPosition: void 0,
1209
- height,
1210
- id: node.internalId ?? "static",
1211
- isScrollable: false,
1212
- lines: [...staticOutput.getRootLines()],
1213
- selectableSpans: [],
1214
- stickyHeaders: [],
1215
- styledOutput: [...staticOutput.getRootLines()],
1216
- width,
1217
- x: 0,
1218
- y: 0
1219
- };
1220
- setCachedRender(node, region);
1221
- };
1222
-
1223
- const calculateSelectionMap = (root, selection) => {
1224
- const map = /* @__PURE__ */ new Map();
1225
- if (selection.rangeCount === 0) {
1226
- return map;
1227
- }
1228
- const range = selection.getRangeAt(0);
1229
- const { endContainer, endOffset, startContainer, startOffset } = range;
1230
- if (!startContainer || !endContainer) {
1231
- return map;
1232
- }
1233
- let hasFoundStart = false;
1234
- let hasFoundEnd = false;
1235
- const visitChildren = (node, localLengthRef, startRef, endRef, startFoundRef, endFoundRef) => {
1236
- if (node.nodeName === "#text") {
1237
- const { length } = node.nodeValue;
1238
- if (startContainer === node) {
1239
- startFoundRef.value = true;
1240
- startRef.value = localLengthRef.value + startOffset;
1241
- }
1242
- if (endContainer === node) {
1243
- endFoundRef.value = true;
1244
- endRef.value = localLengthRef.value + endOffset;
1245
- }
1246
- localLengthRef.value += length;
1247
- } else if ("childNodes" in node) {
1248
- for (const child of node.childNodes) {
1249
- if (node === startContainer) {
1250
- startFoundRef.value = true;
1251
- startRef.value = localLengthRef.value;
1252
- }
1253
- if (node === endContainer) {
1254
- endFoundRef.value = true;
1255
- endRef.value = localLengthRef.value;
1256
- }
1257
- visitChildren(child, localLengthRef, startRef, endRef, startFoundRef, endFoundRef);
1258
- }
1259
- if (node === startContainer && startOffset === node.childNodes.length) {
1260
- startFoundRef.value = true;
1261
- startRef.value = localLengthRef.value;
1262
- }
1263
- if (node === endContainer && endOffset === node.childNodes.length) {
1264
- endFoundRef.value = true;
1265
- endRef.value = localLengthRef.value;
1266
- }
1267
- }
1268
- };
1269
- const visit = (node) => {
1270
- if (node.nodeName === "ink-text") {
1271
- if (!isNodeSelectable(node)) {
1272
- return;
1273
- }
1274
- const localLengthRef = { value: 0 };
1275
- const nodeStartRef = { value: -1 };
1276
- const nodeEndRef = { value: -1 };
1277
- const foundStartRef = { value: false };
1278
- const foundEndRef = { value: false };
1279
- for (const child of node.childNodes) {
1280
- if (node === startContainer) {
1281
- foundStartRef.value = true;
1282
- nodeStartRef.value = localLengthRef.value;
1283
- }
1284
- if (node === endContainer) {
1285
- foundEndRef.value = true;
1286
- nodeEndRef.value = localLengthRef.value;
1287
- }
1288
- visitChildren(child, localLengthRef, nodeStartRef, nodeEndRef, foundStartRef, foundEndRef);
1289
- }
1290
- if (node === startContainer && startOffset === node.childNodes.length) {
1291
- foundStartRef.value = true;
1292
- nodeStartRef.value = localLengthRef.value;
1293
- }
1294
- if (node === endContainer && endOffset === node.childNodes.length) {
1295
- foundEndRef.value = true;
1296
- nodeEndRef.value = localLengthRef.value;
1297
- }
1298
- if ((hasFoundStart || foundStartRef.value) && (!hasFoundEnd || foundEndRef.value)) {
1299
- const start = foundStartRef.value ? nodeStartRef.value : 0;
1300
- const end = foundEndRef.value ? nodeEndRef.value : localLengthRef.value;
1301
- if (start !== -1 && end !== -1 && start < end) {
1302
- map.set(node, { end, start });
1303
- }
1304
- }
1305
- if (foundStartRef.value) {
1306
- hasFoundStart = true;
1307
- }
1308
- if (foundEndRef.value) {
1309
- hasFoundEnd = true;
1310
- }
1311
- } else {
1312
- const { childNodes } = node;
1313
- if (childNodes) {
1314
- for (const child of childNodes) {
1315
- if (node === startContainer) {
1316
- hasFoundStart = true;
1317
- }
1318
- if (node === endContainer) {
1319
- hasFoundEnd = true;
1320
- }
1321
- visit(child);
1322
- }
1323
- if (node === startContainer && startOffset === childNodes.length) {
1324
- hasFoundStart = true;
1325
- }
1326
- if (node === endContainer && endOffset === childNodes.length) {
1327
- hasFoundEnd = true;
1328
- }
1329
- }
1330
- }
1331
- };
1332
- visit(root);
1333
- return map;
1334
- };
1335
- const interactiveOutputCaches = new OutputCaches();
1336
- const staticOutputCaches = new OutputCaches();
1337
- const interactiveOutputs = /* @__PURE__ */ new WeakMap();
1338
- const staticOutputs = /* @__PURE__ */ new WeakMap();
1339
- const getReusableOutput = ({ caches, height, node, outputs, width }) => {
1340
- let output = outputs.get(node);
1341
- if (!output) {
1342
- output = new Output({
1343
- caches,
1344
- height,
1345
- width
1346
- });
1347
- outputs.set(node, output);
1348
- }
1349
- output.reset(width, height);
1350
- return output;
1351
- };
1352
- const renderer = (node, isScreenReaderEnabled, options) => {
1353
- if (node.yogaNode) {
1354
- if (isScreenReaderEnabled) {
1355
- const output2 = renderNodeToScreenReaderOutput(node, {
1356
- skipStaticElements: true
1357
- });
1358
- const outputHeight2 = output2 === "" ? 0 : output2.split("\n").length;
1359
- let staticOutput2 = "";
1360
- if (node.staticNode) {
1361
- staticOutput2 = renderNodeToScreenReaderOutput(node.staticNode, {
1362
- skipStaticElements: false
1363
- });
1364
- }
1365
- return {
1366
- cursorPosition: void 0,
1367
- cursorRequested: false,
1368
- output: output2,
1369
- outputHeight: outputHeight2,
1370
- staticOutput: staticOutput2 ? `${staticOutput2}
1371
- ` : ""
1372
- };
1373
- }
1374
- options?.selection && options.selection.rangeCount > 0 ? calculateSelectionMap(node, options.selection) : void 0;
1375
- const output = getReusableOutput({
1376
- caches: interactiveOutputCaches,
1377
- height: node.yogaNode.getComputedHeight(),
1378
- node,
1379
- outputs: interactiveOutputs,
1380
- width: node.yogaNode.getComputedWidth()
1381
- });
1382
- const renderState = {
1383
- cursorPosition: void 0,
1384
- cursorRequested: false
1385
- };
1386
- renderNodeToOutput(node, output, {
1387
- renderState,
1388
- skipStaticElements: true
1389
- });
1390
- let staticOutput;
1391
- if (node.staticNode?.yogaNode) {
1392
- staticOutput = getReusableOutput({
1393
- caches: staticOutputCaches,
1394
- height: node.staticNode.yogaNode.getComputedHeight(),
1395
- node,
1396
- outputs: staticOutputs,
1397
- width: node.staticNode.yogaNode.getComputedWidth()
1398
- });
1399
- renderNodeToOutput(node.staticNode, staticOutput, {
1400
- skipStaticElements: false
1401
- });
1402
- }
1403
- if (options?.useNativeRenderer) {
1404
- const { buffer: outputBuffer, height: outputHeight2 } = output.getBuffer();
1405
- return {
1406
- cursorPosition: renderState.cursorPosition,
1407
- cursorRequested: renderState.cursorRequested,
1408
- output: "",
1409
- outputBuffer,
1410
- outputHeight: outputHeight2,
1411
- outputWidth: output.width,
1412
- staticOutput: staticOutput ? `${staticOutput.get().output}
1413
- ` : ""
1414
- };
1415
- }
1416
- const { height: outputHeight, output: generatedOutput } = output.get();
1417
- return {
1418
- cursorPosition: renderState.cursorPosition,
1419
- cursorRequested: renderState.cursorRequested,
1420
- output: generatedOutput,
1421
- outputHeight,
1422
- // Newline at the end is needed, because static output doesn't have one, so
1423
- // interactive output will override last line of static output
1424
- staticOutput: staticOutput ? `${staticOutput.get().output}
1425
- ` : ""
1426
- };
1427
- }
1428
- return {
1429
- cursorPosition: void 0,
1430
- cursorRequested: false,
1431
- output: "",
1432
- outputHeight: 0,
1433
- staticOutput: ""
1434
- };
1435
- };
1436
-
1437
- export { renderToStatic as a, renderer as r };