@flyingrobots/bijou-tui 7.0.0 → 7.2.0

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 (569) hide show
  1. package/README.md +27 -4
  2. package/dist/accordion.d.ts +3 -108
  3. package/dist/accordion.d.ts.map +1 -1
  4. package/dist/accordion.js +2 -161
  5. package/dist/accordion.js.map +1 -1
  6. package/dist/accordion.part01.d.ts +25 -0
  7. package/dist/accordion.part01.d.ts.map +1 -0
  8. package/dist/accordion.part01.js +61 -0
  9. package/dist/accordion.part01.js.map +1 -0
  10. package/dist/accordion.part02.d.ts +8 -0
  11. package/dist/accordion.part02.d.ts.map +1 -0
  12. package/dist/accordion.part02.js +15 -0
  13. package/dist/accordion.part02.js.map +1 -0
  14. package/dist/animate.d.ts.map +1 -1
  15. package/dist/animate.js +5 -6
  16. package/dist/animate.js.map +1 -1
  17. package/dist/app-frame-actions.d.ts +1 -18
  18. package/dist/app-frame-actions.d.ts.map +1 -1
  19. package/dist/app-frame-actions.js +47 -43
  20. package/dist/app-frame-actions.js.map +1 -1
  21. package/dist/app-frame-i18n.d.ts.map +1 -1
  22. package/dist/app-frame-i18n.js +20 -3
  23. package/dist/app-frame-i18n.js.map +1 -1
  24. package/dist/app-frame-overlays.d.ts +9 -1
  25. package/dist/app-frame-overlays.d.ts.map +1 -1
  26. package/dist/app-frame-overlays.js +117 -25
  27. package/dist/app-frame-overlays.js.map +1 -1
  28. package/dist/app-frame-palette.d.ts +1 -11
  29. package/dist/app-frame-palette.d.ts.map +1 -1
  30. package/dist/app-frame-palette.js +19 -18
  31. package/dist/app-frame-palette.js.map +1 -1
  32. package/dist/app-frame-render.d.ts +0 -7
  33. package/dist/app-frame-render.d.ts.map +1 -1
  34. package/dist/app-frame-render.js +17 -26
  35. package/dist/app-frame-render.js.map +1 -1
  36. package/dist/app-frame-types.d.ts +8 -4
  37. package/dist/app-frame-types.d.ts.map +1 -1
  38. package/dist/app-frame-types.js +5 -5
  39. package/dist/app-frame-types.js.map +1 -1
  40. package/dist/app-frame-utils.d.ts +2 -1
  41. package/dist/app-frame-utils.d.ts.map +1 -1
  42. package/dist/app-frame-utils.js +8 -1
  43. package/dist/app-frame-utils.js.map +1 -1
  44. package/dist/app-frame.d.ts +75 -4
  45. package/dist/app-frame.d.ts.map +1 -1
  46. package/dist/app-frame.js +346 -272
  47. package/dist/app-frame.js.map +1 -1
  48. package/dist/app-frame.test-support.part01.d.ts +149 -0
  49. package/dist/app-frame.test-support.part01.d.ts.map +1 -0
  50. package/dist/app-frame.test-support.part01.js +106 -0
  51. package/dist/app-frame.test-support.part01.js.map +1 -0
  52. package/dist/app-frame.test-support.part02.d.ts +15 -0
  53. package/dist/app-frame.test-support.part02.d.ts.map +1 -0
  54. package/dist/app-frame.test-support.part02.js +89 -0
  55. package/dist/app-frame.test-support.part02.js.map +1 -0
  56. package/dist/browsable-list.d.ts +5 -5
  57. package/dist/browsable-list.d.ts.map +1 -1
  58. package/dist/browsable-list.js.map +1 -1
  59. package/dist/canvas.d.ts +2 -34
  60. package/dist/canvas.d.ts.map +1 -1
  61. package/dist/canvas.js +43 -47
  62. package/dist/canvas.js.map +1 -1
  63. package/dist/cell-glyph-fit.js +1 -1
  64. package/dist/cell-glyph-fit.js.map +1 -1
  65. package/dist/collection-surface-types.d.ts +12 -0
  66. package/dist/collection-surface-types.d.ts.map +1 -0
  67. package/dist/collection-surface-types.js +2 -0
  68. package/dist/collection-surface-types.js.map +1 -0
  69. package/dist/collection-surface.d.ts +2 -7
  70. package/dist/collection-surface.d.ts.map +1 -1
  71. package/dist/collection-surface.js +8 -18
  72. package/dist/collection-surface.js.map +1 -1
  73. package/dist/command-palette.d.ts.map +1 -1
  74. package/dist/command-palette.js +2 -1
  75. package/dist/command-palette.js.map +1 -1
  76. package/dist/commands.d.ts.map +1 -1
  77. package/dist/commands.js +1 -1
  78. package/dist/commands.js.map +1 -1
  79. package/dist/css/install.js.map +1 -1
  80. package/dist/css/parser.js +9 -3
  81. package/dist/css/parser.js.map +1 -1
  82. package/dist/css/resolver-types.d.ts +13 -0
  83. package/dist/css/resolver-types.d.ts.map +1 -0
  84. package/dist/css/resolver-types.js +2 -0
  85. package/dist/css/resolver-types.js.map +1 -0
  86. package/dist/css/resolver.d.ts +2 -12
  87. package/dist/css/resolver.d.ts.map +1 -1
  88. package/dist/css/resolver.js +13 -20
  89. package/dist/css/resolver.js.map +1 -1
  90. package/dist/css/text-style.d.ts +4 -8
  91. package/dist/css/text-style.d.ts.map +1 -1
  92. package/dist/css/text-style.js +13 -18
  93. package/dist/css/text-style.js.map +1 -1
  94. package/dist/dag-pane.d.ts +4 -224
  95. package/dist/dag-pane.d.ts.map +1 -1
  96. package/dist/dag-pane.js +3 -516
  97. package/dist/dag-pane.js.map +1 -1
  98. package/dist/dag-pane.part01.d.ts +58 -0
  99. package/dist/dag-pane.part01.d.ts.map +1 -0
  100. package/dist/dag-pane.part01.js +2 -0
  101. package/dist/dag-pane.part01.js.map +1 -0
  102. package/dist/dag-pane.part02.d.ts +4 -0
  103. package/dist/dag-pane.part02.d.ts.map +1 -0
  104. package/dist/dag-pane.part02.js +56 -0
  105. package/dist/dag-pane.part02.js.map +1 -0
  106. package/dist/dag-pane.part03.d.ts +6 -0
  107. package/dist/dag-pane.part03.d.ts.map +1 -0
  108. package/dist/dag-pane.part03.js +76 -0
  109. package/dist/dag-pane.part03.js.map +1 -0
  110. package/dist/dag-pane.part04.d.ts +7 -0
  111. package/dist/dag-pane.part04.d.ts.map +1 -0
  112. package/dist/dag-pane.part04.js +66 -0
  113. package/dist/dag-pane.part04.js.map +1 -0
  114. package/dist/dag-pane.part05.d.ts +7 -0
  115. package/dist/dag-pane.part05.d.ts.map +1 -0
  116. package/dist/dag-pane.part05.js +78 -0
  117. package/dist/dag-pane.part05.js.map +1 -0
  118. package/dist/dag-pane.part06.d.ts +14 -0
  119. package/dist/dag-pane.part06.d.ts.map +1 -0
  120. package/dist/dag-pane.part06.js +65 -0
  121. package/dist/dag-pane.part06.js.map +1 -0
  122. package/dist/dag-pane.part07.d.ts +18 -0
  123. package/dist/dag-pane.part07.d.ts.map +1 -0
  124. package/dist/dag-pane.part07.js +22 -0
  125. package/dist/dag-pane.part07.js.map +1 -0
  126. package/dist/driver.d.ts +35 -21
  127. package/dist/driver.d.ts.map +1 -1
  128. package/dist/driver.js +69 -39
  129. package/dist/driver.js.map +1 -1
  130. package/dist/eventbus.d.ts.map +1 -1
  131. package/dist/eventbus.js +13 -23
  132. package/dist/eventbus.js.map +1 -1
  133. package/dist/file-picker.d.ts +4 -160
  134. package/dist/file-picker.d.ts.map +1 -1
  135. package/dist/file-picker.js +3 -284
  136. package/dist/file-picker.js.map +1 -1
  137. package/dist/file-picker.part01.d.ts +54 -0
  138. package/dist/file-picker.part01.d.ts.map +1 -0
  139. package/dist/file-picker.part01.js +47 -0
  140. package/dist/file-picker.part01.js.map +1 -0
  141. package/dist/file-picker.part02.d.ts +9 -0
  142. package/dist/file-picker.part02.d.ts.map +1 -0
  143. package/dist/file-picker.part02.js +77 -0
  144. package/dist/file-picker.part02.js.map +1 -0
  145. package/dist/file-picker.part03.d.ts +12 -0
  146. package/dist/file-picker.part03.d.ts.map +1 -0
  147. package/dist/file-picker.part03.js +35 -0
  148. package/dist/file-picker.part03.js.map +1 -0
  149. package/dist/flex.d.ts +0 -61
  150. package/dist/flex.d.ts.map +1 -1
  151. package/dist/flex.js +11 -161
  152. package/dist/flex.js.map +1 -1
  153. package/dist/focus-area.d.ts +6 -210
  154. package/dist/focus-area.d.ts.map +1 -1
  155. package/dist/focus-area.js +5 -425
  156. package/dist/focus-area.js.map +1 -1
  157. package/dist/focus-area.part01.d.ts +57 -0
  158. package/dist/focus-area.part01.d.ts.map +1 -0
  159. package/dist/focus-area.part01.js +23 -0
  160. package/dist/focus-area.part01.js.map +1 -0
  161. package/dist/focus-area.part02.d.ts +13 -0
  162. package/dist/focus-area.part02.d.ts.map +1 -0
  163. package/dist/focus-area.part02.js +65 -0
  164. package/dist/focus-area.part02.js.map +1 -0
  165. package/dist/focus-area.part03.d.ts +5 -0
  166. package/dist/focus-area.part03.d.ts.map +1 -0
  167. package/dist/focus-area.part03.js +42 -0
  168. package/dist/focus-area.part03.js.map +1 -0
  169. package/dist/focus-area.part04.d.ts +5 -0
  170. package/dist/focus-area.part04.d.ts.map +1 -0
  171. package/dist/focus-area.part04.js +49 -0
  172. package/dist/focus-area.part04.js.map +1 -0
  173. package/dist/focus-area.part05.d.ts +10 -0
  174. package/dist/focus-area.part05.d.ts.map +1 -0
  175. package/dist/focus-area.part05.js +66 -0
  176. package/dist/focus-area.part05.js.map +1 -0
  177. package/dist/focus-area.part06.d.ts +17 -0
  178. package/dist/focus-area.part06.d.ts.map +1 -0
  179. package/dist/focus-area.part06.js +48 -0
  180. package/dist/focus-area.part06.js.map +1 -0
  181. package/dist/focus-map.d.ts.map +1 -1
  182. package/dist/focus-map.js +8 -10
  183. package/dist/focus-map.js.map +1 -1
  184. package/dist/index.d.ts +8 -79
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +8 -105
  187. package/dist/index.js.map +1 -1
  188. package/dist/index.part01.d.ts +15 -0
  189. package/dist/index.part01.d.ts.map +1 -0
  190. package/dist/index.part01.js +11 -0
  191. package/dist/index.part01.js.map +1 -0
  192. package/dist/index.part02.d.ts +26 -0
  193. package/dist/index.part02.d.ts.map +1 -0
  194. package/dist/index.part02.js +24 -0
  195. package/dist/index.part02.js.map +1 -0
  196. package/dist/index.part03.d.ts +17 -0
  197. package/dist/index.part03.d.ts.map +1 -0
  198. package/dist/index.part03.js +11 -0
  199. package/dist/index.part03.js.map +1 -0
  200. package/dist/index.part04.d.ts +6 -0
  201. package/dist/index.part04.d.ts.map +1 -0
  202. package/dist/index.part04.js +11 -0
  203. package/dist/index.part04.js.map +1 -0
  204. package/dist/index.part05.d.ts +10 -0
  205. package/dist/index.part05.d.ts.map +1 -0
  206. package/dist/index.part05.js +26 -0
  207. package/dist/index.part05.js.map +1 -0
  208. package/dist/index.part06.d.ts +9 -0
  209. package/dist/index.part06.d.ts.map +1 -0
  210. package/dist/index.part06.js +16 -0
  211. package/dist/index.part06.js.map +1 -0
  212. package/dist/index.part07.d.ts +8 -0
  213. package/dist/index.part07.d.ts.map +1 -0
  214. package/dist/index.part07.js +15 -0
  215. package/dist/index.part07.js.map +1 -0
  216. package/dist/index.part08.d.ts +5 -0
  217. package/dist/index.part08.d.ts.map +1 -0
  218. package/dist/index.part08.js +9 -0
  219. package/dist/index.part08.js.map +1 -0
  220. package/dist/input-map.d.ts.map +1 -1
  221. package/dist/input-map.js +1 -2
  222. package/dist/input-map.js.map +1 -1
  223. package/dist/input-parser.d.ts +3 -0
  224. package/dist/input-parser.d.ts.map +1 -0
  225. package/dist/input-parser.js +95 -0
  226. package/dist/input-parser.js.map +1 -0
  227. package/dist/input-routing-inspector.js +3 -3
  228. package/dist/input-routing-inspector.js.map +1 -1
  229. package/dist/inputstack.d.ts.map +1 -1
  230. package/dist/inputstack.js +2 -0
  231. package/dist/inputstack.js.map +1 -1
  232. package/dist/keybindings.d.ts.map +1 -1
  233. package/dist/keybindings.js +5 -2
  234. package/dist/keybindings.js.map +1 -1
  235. package/dist/keys.d.ts +0 -36
  236. package/dist/keys.d.ts.map +1 -1
  237. package/dist/keys.js +11 -66
  238. package/dist/keys.js.map +1 -1
  239. package/dist/layout-inspector.d.ts +2 -30
  240. package/dist/layout-inspector.d.ts.map +1 -1
  241. package/dist/layout-inspector.js +1 -132
  242. package/dist/layout-inspector.js.map +1 -1
  243. package/dist/layout-inspector.part01.d.ts +52 -0
  244. package/dist/layout-inspector.part01.d.ts.map +1 -0
  245. package/dist/layout-inspector.part01.js +48 -0
  246. package/dist/layout-inspector.part01.js.map +1 -0
  247. package/dist/layout-inspector.part02.d.ts +11 -0
  248. package/dist/layout-inspector.part02.d.ts.map +1 -0
  249. package/dist/layout-inspector.part02.js +80 -0
  250. package/dist/layout-inspector.part02.js.map +1 -0
  251. package/dist/layout-inspector.part03.d.ts +5 -0
  252. package/dist/layout-inspector.part03.d.ts.map +1 -0
  253. package/dist/layout-inspector.part03.js +11 -0
  254. package/dist/layout-inspector.part03.js.map +1 -0
  255. package/dist/layout-preset.js +4 -4
  256. package/dist/layout-preset.js.map +1 -1
  257. package/dist/layout.d.ts.map +1 -1
  258. package/dist/layout.js +5 -3
  259. package/dist/layout.js.map +1 -1
  260. package/dist/motion/motion.js +8 -4
  261. package/dist/motion/motion.js.map +1 -1
  262. package/dist/motion/reconciler.d.ts.map +1 -1
  263. package/dist/motion/reconciler.js +9 -7
  264. package/dist/motion/reconciler.js.map +1 -1
  265. package/dist/mouse-mode.d.ts +5 -0
  266. package/dist/mouse-mode.d.ts.map +1 -0
  267. package/dist/mouse-mode.js +17 -0
  268. package/dist/mouse-mode.js.map +1 -0
  269. package/dist/navigable-table.d.ts +3 -136
  270. package/dist/navigable-table.d.ts.map +1 -1
  271. package/dist/navigable-table.js +2 -234
  272. package/dist/navigable-table.js.map +1 -1
  273. package/dist/navigable-table.part01.d.ts +42 -0
  274. package/dist/navigable-table.part01.d.ts.map +1 -0
  275. package/dist/navigable-table.part01.js +42 -0
  276. package/dist/navigable-table.part01.js.map +1 -0
  277. package/dist/navigable-table.part02.d.ts +16 -0
  278. package/dist/navigable-table.part02.d.ts.map +1 -0
  279. package/dist/navigable-table.part02.js +83 -0
  280. package/dist/navigable-table.part02.js.map +1 -0
  281. package/dist/notification-card.d.ts +11 -0
  282. package/dist/notification-card.d.ts.map +1 -0
  283. package/dist/notification-card.js +157 -0
  284. package/dist/notification-card.js.map +1 -0
  285. package/dist/notification-stack.d.ts +6 -0
  286. package/dist/notification-stack.d.ts.map +1 -0
  287. package/dist/notification-stack.js +257 -0
  288. package/dist/notification-stack.js.map +1 -0
  289. package/dist/notification.d.ts +14 -112
  290. package/dist/notification.d.ts.map +1 -1
  291. package/dist/notification.js +12 -1087
  292. package/dist/notification.js.map +1 -1
  293. package/dist/notification.part01.d.ts +77 -0
  294. package/dist/notification.part01.d.ts.map +1 -0
  295. package/dist/notification.part01.js +19 -0
  296. package/dist/notification.part01.js.map +1 -0
  297. package/dist/notification.part02.d.ts +42 -0
  298. package/dist/notification.part02.d.ts.map +1 -0
  299. package/dist/notification.part02.js +44 -0
  300. package/dist/notification.part02.js.map +1 -0
  301. package/dist/notification.part03.d.ts +6 -0
  302. package/dist/notification.part03.d.ts.map +1 -0
  303. package/dist/notification.part03.js +81 -0
  304. package/dist/notification.part03.js.map +1 -0
  305. package/dist/notification.part04.d.ts +4 -0
  306. package/dist/notification.part04.d.ts.map +1 -0
  307. package/dist/notification.part04.js +32 -0
  308. package/dist/notification.part04.js.map +1 -0
  309. package/dist/notification.part05.d.ts +6 -0
  310. package/dist/notification.part05.d.ts.map +1 -0
  311. package/dist/notification.part05.js +95 -0
  312. package/dist/notification.part05.js.map +1 -0
  313. package/dist/notification.part06.d.ts +9 -0
  314. package/dist/notification.part06.d.ts.map +1 -0
  315. package/dist/notification.part06.js +65 -0
  316. package/dist/notification.part06.js.map +1 -0
  317. package/dist/notification.part07.d.ts +10 -0
  318. package/dist/notification.part07.d.ts.map +1 -0
  319. package/dist/notification.part07.js +70 -0
  320. package/dist/notification.part07.js.map +1 -0
  321. package/dist/notification.part08.d.ts +5 -0
  322. package/dist/notification.part08.d.ts.map +1 -0
  323. package/dist/notification.part08.js +79 -0
  324. package/dist/notification.part08.js.map +1 -0
  325. package/dist/notification.part09.d.ts +14 -0
  326. package/dist/notification.part09.d.ts.map +1 -0
  327. package/dist/notification.part09.js +96 -0
  328. package/dist/notification.part09.js.map +1 -0
  329. package/dist/notification.part10.d.ts +13 -0
  330. package/dist/notification.part10.d.ts.map +1 -0
  331. package/dist/notification.part10.js +94 -0
  332. package/dist/notification.part10.js.map +1 -0
  333. package/dist/notification.part11.d.ts +6 -0
  334. package/dist/notification.part11.d.ts.map +1 -0
  335. package/dist/notification.part11.js +42 -0
  336. package/dist/notification.part11.js.map +1 -0
  337. package/dist/overlay.d.ts +8 -232
  338. package/dist/overlay.d.ts.map +1 -1
  339. package/dist/overlay.js +5 -629
  340. package/dist/overlay.js.map +1 -1
  341. package/dist/overlay.part01.d.ts +71 -0
  342. package/dist/overlay.part01.d.ts.map +1 -0
  343. package/dist/overlay.part01.js +34 -0
  344. package/dist/overlay.part01.js.map +1 -0
  345. package/dist/overlay.part02.d.ts +8 -0
  346. package/dist/overlay.part02.d.ts.map +1 -0
  347. package/dist/overlay.part02.js +81 -0
  348. package/dist/overlay.part02.js.map +1 -0
  349. package/dist/overlay.part03.d.ts +27 -0
  350. package/dist/overlay.part03.d.ts.map +1 -0
  351. package/dist/overlay.part03.js +83 -0
  352. package/dist/overlay.part03.js.map +1 -0
  353. package/dist/overlay.part04.d.ts +8 -0
  354. package/dist/overlay.part04.d.ts.map +1 -0
  355. package/dist/overlay.part04.js +103 -0
  356. package/dist/overlay.part04.js.map +1 -0
  357. package/dist/overlay.part05.d.ts +8 -0
  358. package/dist/overlay.part05.d.ts.map +1 -0
  359. package/dist/overlay.part05.js +66 -0
  360. package/dist/overlay.part05.js.map +1 -0
  361. package/dist/overlay.part06.d.ts +46 -0
  362. package/dist/overlay.part06.d.ts.map +1 -0
  363. package/dist/overlay.part06.js +35 -0
  364. package/dist/overlay.part06.js.map +1 -0
  365. package/dist/overlay.part07.d.ts +4 -0
  366. package/dist/overlay.part07.d.ts.map +1 -0
  367. package/dist/overlay.part07.js +64 -0
  368. package/dist/overlay.part07.js.map +1 -0
  369. package/dist/overlay.part08.d.ts +34 -0
  370. package/dist/overlay.part08.d.ts.map +1 -0
  371. package/dist/overlay.part08.js +54 -0
  372. package/dist/overlay.part08.js.map +1 -0
  373. package/dist/overlay.part09.d.ts +6 -0
  374. package/dist/overlay.part09.d.ts.map +1 -0
  375. package/dist/overlay.part09.js +42 -0
  376. package/dist/overlay.part09.js.map +1 -0
  377. package/dist/pager.d.ts.map +1 -1
  378. package/dist/pager.js +2 -4
  379. package/dist/pager.js.map +1 -1
  380. package/dist/panel-dock.d.ts.map +1 -1
  381. package/dist/panel-dock.js +9 -11
  382. package/dist/panel-dock.js.map +1 -1
  383. package/dist/panels.d.ts.map +1 -1
  384. package/dist/panels.js +2 -0
  385. package/dist/panels.js.map +1 -1
  386. package/dist/pipeline/middleware/css.d.ts +3 -5
  387. package/dist/pipeline/middleware/css.d.ts.map +1 -1
  388. package/dist/pipeline/middleware/css.js +12 -6
  389. package/dist/pipeline/middleware/css.js.map +1 -1
  390. package/dist/pipeline/middleware/grayscale.js +15 -10
  391. package/dist/pipeline/middleware/grayscale.js.map +1 -1
  392. package/dist/pipeline/middleware/motion.js +9 -1
  393. package/dist/pipeline/middleware/motion.js.map +1 -1
  394. package/dist/pipeline/middleware/paint.js +9 -1
  395. package/dist/pipeline/middleware/paint.js.map +1 -1
  396. package/dist/pipeline/middleware/surface-shaders.js +13 -11
  397. package/dist/pipeline/middleware/surface-shaders.js.map +1 -1
  398. package/dist/pipeline/pipeline.d.ts +7 -52
  399. package/dist/pipeline/pipeline.d.ts.map +1 -1
  400. package/dist/pipeline/pipeline.js +37 -27
  401. package/dist/pipeline/pipeline.js.map +1 -1
  402. package/dist/raster-glyph.d.ts +3 -0
  403. package/dist/raster-glyph.d.ts.map +1 -0
  404. package/dist/raster-glyph.js +2 -0
  405. package/dist/raster-glyph.js.map +1 -0
  406. package/dist/raster-glyph.part01.d.ts +75 -0
  407. package/dist/raster-glyph.part01.d.ts.map +1 -0
  408. package/dist/raster-glyph.part01.js +25 -0
  409. package/dist/raster-glyph.part01.js.map +1 -0
  410. package/dist/raster-glyph.part02.d.ts +12 -0
  411. package/dist/raster-glyph.part02.d.ts.map +1 -0
  412. package/dist/raster-glyph.part02.js +81 -0
  413. package/dist/raster-glyph.part02.js.map +1 -0
  414. package/dist/raster-glyph.part03.d.ts +6 -0
  415. package/dist/raster-glyph.part03.d.ts.map +1 -0
  416. package/dist/raster-glyph.part03.js +60 -0
  417. package/dist/raster-glyph.part03.js.map +1 -0
  418. package/dist/raster-glyph.part04.d.ts +7 -0
  419. package/dist/raster-glyph.part04.d.ts.map +1 -0
  420. package/dist/raster-glyph.part04.js +59 -0
  421. package/dist/raster-glyph.part04.js.map +1 -0
  422. package/dist/raster-glyph.part05.d.ts +6 -0
  423. package/dist/raster-glyph.part05.d.ts.map +1 -0
  424. package/dist/raster-glyph.part05.js +71 -0
  425. package/dist/raster-glyph.part05.js.map +1 -0
  426. package/dist/raster-glyph.part06.d.ts +18 -0
  427. package/dist/raster-glyph.part06.d.ts.map +1 -0
  428. package/dist/raster-glyph.part06.js +78 -0
  429. package/dist/raster-glyph.part06.js.map +1 -0
  430. package/dist/raster-glyph.part07.d.ts +11 -0
  431. package/dist/raster-glyph.part07.d.ts.map +1 -0
  432. package/dist/raster-glyph.part07.js +55 -0
  433. package/dist/raster-glyph.part07.js.map +1 -0
  434. package/dist/raytrace.d.ts +3 -58
  435. package/dist/raytrace.d.ts.map +1 -1
  436. package/dist/raytrace.js +2 -120
  437. package/dist/raytrace.js.map +1 -1
  438. package/dist/raytrace.part01.d.ts +47 -0
  439. package/dist/raytrace.part01.d.ts.map +1 -0
  440. package/dist/raytrace.part01.js +45 -0
  441. package/dist/raytrace.part01.js.map +1 -0
  442. package/dist/raytrace.part02.d.ts +12 -0
  443. package/dist/raytrace.part02.d.ts.map +1 -0
  444. package/dist/raytrace.part02.js +73 -0
  445. package/dist/raytrace.part02.js.map +1 -0
  446. package/dist/runtime-binding.d.ts +2 -3
  447. package/dist/runtime-binding.d.ts.map +1 -1
  448. package/dist/runtime-binding.js +49 -38
  449. package/dist/runtime-binding.js.map +1 -1
  450. package/dist/runtime-engine.d.ts +2 -2
  451. package/dist/runtime-engine.d.ts.map +1 -1
  452. package/dist/runtime-engine.js +15 -4
  453. package/dist/runtime-engine.js.map +1 -1
  454. package/dist/runtime.d.ts +2 -18
  455. package/dist/runtime.d.ts.map +1 -1
  456. package/dist/runtime.js +43 -62
  457. package/dist/runtime.js.map +1 -1
  458. package/dist/screen.js +1 -1
  459. package/dist/screen.js.map +1 -1
  460. package/dist/shell-quit.d.ts.map +1 -1
  461. package/dist/shell-quit.js +49 -6
  462. package/dist/shell-quit.js.map +1 -1
  463. package/dist/split-pane.d.ts +3 -104
  464. package/dist/split-pane.d.ts.map +1 -1
  465. package/dist/split-pane.js +2 -190
  466. package/dist/split-pane.js.map +1 -1
  467. package/dist/split-pane.part01.d.ts +60 -0
  468. package/dist/split-pane.part01.d.ts.map +1 -0
  469. package/dist/split-pane.part01.js +45 -0
  470. package/dist/split-pane.part01.js.map +1 -0
  471. package/dist/split-pane.part02.d.ts +8 -0
  472. package/dist/split-pane.part02.d.ts.map +1 -0
  473. package/dist/split-pane.part02.js +73 -0
  474. package/dist/split-pane.part02.js.map +1 -0
  475. package/dist/split-pane.part03.d.ts +4 -0
  476. package/dist/split-pane.part03.d.ts.map +1 -0
  477. package/dist/split-pane.part03.js +40 -0
  478. package/dist/split-pane.part03.js.map +1 -0
  479. package/dist/spring.d.ts +4 -187
  480. package/dist/spring.d.ts.map +1 -1
  481. package/dist/spring.js +2 -142
  482. package/dist/spring.js.map +1 -1
  483. package/dist/spring.part01.d.ts +90 -0
  484. package/dist/spring.part01.d.ts.map +1 -0
  485. package/dist/spring.part01.js +58 -0
  486. package/dist/spring.part01.js.map +1 -0
  487. package/dist/spring.part02.d.ts +25 -0
  488. package/dist/spring.part02.d.ts.map +1 -0
  489. package/dist/spring.part02.js +21 -0
  490. package/dist/spring.part02.js.map +1 -0
  491. package/dist/status-bar.js +1 -1
  492. package/dist/status-bar.js.map +1 -1
  493. package/dist/subapp/mount.d.ts +6 -6
  494. package/dist/subapp/mount.d.ts.map +1 -1
  495. package/dist/subapp/mount.js +19 -14
  496. package/dist/subapp/mount.js.map +1 -1
  497. package/dist/surface-budget-types.d.ts +26 -0
  498. package/dist/surface-budget-types.d.ts.map +1 -0
  499. package/dist/surface-budget-types.js +2 -0
  500. package/dist/surface-budget-types.js.map +1 -0
  501. package/dist/surface-budget.d.ts +2 -25
  502. package/dist/surface-budget.d.ts.map +1 -1
  503. package/dist/surface-budget.js.map +1 -1
  504. package/dist/surface-diff.js +26 -28
  505. package/dist/surface-diff.js.map +1 -1
  506. package/dist/surface-layout.d.ts.map +1 -1
  507. package/dist/surface-layout.js +1 -2
  508. package/dist/surface-layout.js.map +1 -1
  509. package/dist/timeline.d.ts +1 -1
  510. package/dist/timeline.d.ts.map +1 -1
  511. package/dist/timeline.js +17 -15
  512. package/dist/timeline.js.map +1 -1
  513. package/dist/transition-shaders.d.ts +5 -142
  514. package/dist/transition-shaders.d.ts.map +1 -1
  515. package/dist/transition-shaders.js +4 -391
  516. package/dist/transition-shaders.js.map +1 -1
  517. package/dist/transition-shaders.part01.d.ts +41 -0
  518. package/dist/transition-shaders.part01.d.ts.map +1 -0
  519. package/dist/transition-shaders.part01.js +38 -0
  520. package/dist/transition-shaders.part01.js.map +1 -0
  521. package/dist/transition-shaders.part02.d.ts +12 -0
  522. package/dist/transition-shaders.part02.d.ts.map +1 -0
  523. package/dist/transition-shaders.part02.js +88 -0
  524. package/dist/transition-shaders.part02.js.map +1 -0
  525. package/dist/transition-shaders.part03.d.ts +6 -0
  526. package/dist/transition-shaders.part03.d.ts.map +1 -0
  527. package/dist/transition-shaders.part03.js +82 -0
  528. package/dist/transition-shaders.part03.js.map +1 -0
  529. package/dist/transition-shaders.part04.d.ts +16 -0
  530. package/dist/transition-shaders.part04.d.ts.map +1 -0
  531. package/dist/transition-shaders.part04.js +98 -0
  532. package/dist/transition-shaders.part04.js.map +1 -0
  533. package/dist/types.d.ts +10 -42
  534. package/dist/types.d.ts.map +1 -1
  535. package/dist/types.js +9 -36
  536. package/dist/types.js.map +1 -1
  537. package/dist/view-output.d.ts +1 -1
  538. package/dist/view-output.d.ts.map +1 -1
  539. package/dist/view-output.js +3 -2
  540. package/dist/view-output.js.map +1 -1
  541. package/dist/viewport.d.ts +7 -213
  542. package/dist/viewport.d.ts.map +1 -1
  543. package/dist/viewport.js +6 -470
  544. package/dist/viewport.js.map +1 -1
  545. package/dist/viewport.part01.d.ts +51 -0
  546. package/dist/viewport.part01.d.ts.map +1 -0
  547. package/dist/viewport.part01.js +10 -0
  548. package/dist/viewport.part01.js.map +1 -0
  549. package/dist/viewport.part02.d.ts +2 -0
  550. package/dist/viewport.part02.d.ts.map +1 -0
  551. package/dist/viewport.part02.js +69 -0
  552. package/dist/viewport.part02.js.map +1 -0
  553. package/dist/viewport.part03.d.ts +10 -0
  554. package/dist/viewport.part03.d.ts.map +1 -0
  555. package/dist/viewport.part03.js +78 -0
  556. package/dist/viewport.part03.js.map +1 -0
  557. package/dist/viewport.part04.d.ts +4 -0
  558. package/dist/viewport.part04.d.ts.map +1 -0
  559. package/dist/viewport.part04.js +50 -0
  560. package/dist/viewport.part04.js.map +1 -0
  561. package/dist/viewport.part05.d.ts +5 -0
  562. package/dist/viewport.part05.d.ts.map +1 -0
  563. package/dist/viewport.part05.js +59 -0
  564. package/dist/viewport.part05.js.map +1 -0
  565. package/dist/viewport.part06.d.ts +14 -0
  566. package/dist/viewport.part06.d.ts.map +1 -0
  567. package/dist/viewport.part06.js +58 -0
  568. package/dist/viewport.part06.js.map +1 -0
  569. package/package.json +3 -3
package/dist/overlay.js CHANGED
@@ -1,630 +1,6 @@
1
- /**
2
- * Overlay compositing primitives for TUI apps.
3
- *
4
- * - `composite()` paint overlays onto a background string (ANSI-safe)
5
- * - `compositeSurface()` paint overlays onto a background surface
6
- * - `modal()` — centered dialog overlay with title, body, hint
7
- * - `toast()` — anchored notification overlay with variant icons
8
- * - `tooltip()` — positioned overlay relative to a target element
9
- */
10
- import { FLAG_DIM, FLAG_EMPTY } from '@flyingrobots/bijou';
11
- import { CELL_STRIDE, OFF_FLAGS, OFF_ALPHA, FLAG_BG_SET, parseHex, encodeModifiers } from '@flyingrobots/bijou/perf';
12
- import { createSurface, graphemeClusterWidth, isPackedSurface, parseAnsiToSurface, segmentGraphemes, shouldApplyBg, stripAnsi, surfaceToString, } from '@flyingrobots/bijou';
13
- import { sliceAnsi, visibleLength, clipToWidth } from './viewport.js';
14
- function resolvedColorRgb(ref) {
15
- return typeof ref === 'object'
16
- && ref !== null
17
- && 'kind' in ref
18
- && ref.kind === 'resolved-color'
19
- && 'rgb' in ref
20
- ? ref.rgb
21
- : undefined;
22
- }
23
- function resolvedColorHex(ref) {
24
- if (typeof ref === 'string')
25
- return ref;
26
- return typeof ref === 'object'
27
- && ref !== null
28
- && 'kind' in ref
29
- && ref.kind === 'resolved-color'
30
- && 'hex' in ref
31
- ? ref.hex
32
- : undefined;
33
- }
34
- import { clampCenteredPosition, resolveOverlayMargin } from './design-language.js';
35
- import { forceTextPresentation } from './icon-presentation.js';
36
- // ---------------------------------------------------------------------------
37
- // Border characters (same as core box.ts)
38
- // ---------------------------------------------------------------------------
39
- /** Unicode box-drawing characters for overlay borders. */
40
- const BORDER = {
41
- tl: '\u250c', // ┌
42
- tr: '\u2510', // ┐
43
- bl: '\u2514', // └
44
- br: '\u2518', // ┘
45
- h: '\u2500', // ─
46
- v: '\u2502', // │
47
- };
48
- // ---------------------------------------------------------------------------
49
- // spliceLine (internal)
50
- // ---------------------------------------------------------------------------
51
- /**
52
- * Splice an overlay line into a background line at a given column.
53
- *
54
- * Preserve background content to the left and right of the overlay,
55
- * inserting ANSI resets at splice boundaries.
56
- *
57
- * @param bgLine - Background line (may contain ANSI escapes).
58
- * @param overlayLine - Overlay line to paint over the background.
59
- * @param col - Starting visible column for the overlay (0-based).
60
- * @returns Merged line with the overlay replacing background characters.
61
- */
62
- function spliceLine(bgLine, overlayLine, col) {
63
- const overlayVis = visibleLength(overlayLine);
64
- const bgVis = visibleLength(bgLine);
65
- const left = bgVis <= col
66
- ? bgLine + ' '.repeat(col - bgVis)
67
- : sliceAnsi(bgLine, 0, col);
68
- const right = sliceAnsi(bgLine, col + overlayVis, bgVis);
69
- return left + '\x1b[0m' + overlayLine + '\x1b[0m' + right;
70
- }
71
- // ---------------------------------------------------------------------------
72
- // composite()
73
- // ---------------------------------------------------------------------------
74
- /**
75
- * Paint one or more overlays onto a background string.
76
- *
77
- * Overlay content replaces background characters at the specified position.
78
- * Overlays are applied in array order (later overlays paint over earlier ones).
79
- * ANSI escape sequences are preserved correctly at splice boundaries.
80
- *
81
- * @param background - Background content string (newline-delimited).
82
- * @param overlays - Positioned overlays to composite onto the background.
83
- * @param options - Optional compositing settings (e.g., dim background).
84
- * @returns Composited string with all overlays applied.
85
- */
86
- export function composite(background, overlays, options) {
87
- const bgLines = background.split('\n');
88
- if (options?.dim) {
89
- for (let i = 0; i < bgLines.length; i++) {
90
- if (visibleLength(bgLines[i]) > 0) {
91
- bgLines[i] = '\x1b[2m' + bgLines[i] + '\x1b[0m';
92
- }
93
- }
94
- }
95
- for (const overlay of overlays) {
96
- const oLines = overlay.content.split('\n');
97
- for (let i = 0; i < oLines.length; i++) {
98
- const targetRow = overlay.row + i;
99
- if (targetRow < 0 || targetRow >= bgLines.length)
100
- continue;
101
- bgLines[targetRow] = spliceLine(bgLines[targetRow], oLines[i], overlay.col);
102
- }
103
- }
104
- return bgLines.join('\n');
105
- }
106
- /**
107
- * Paint one or more overlays onto a background surface.
108
- *
109
- * Overlays are applied in array order, with later overlays painting over
110
- * earlier ones. String-only overlays are normalized through an explicit
111
- * ANSI-to-surface bridge at the composition edge.
112
- */
113
- export function compositeSurface(background, overlays, options) {
114
- const result = background.clone();
115
- return compositeSurfaceInto(result, result, overlays, options);
116
- }
117
- /**
118
- * Paint overlays onto an existing target surface, optionally starting from an
119
- * existing background surface.
120
- *
121
- * When `background` and `target` are the same object, the surface is
122
- * composited in place without an extra clone.
123
- */
124
- export function compositeSurfaceInto(background, target, overlays, options) {
125
- if (target !== background) {
126
- target.clear();
127
- target.blit(background, 0, 0);
128
- }
129
- if (options?.dim) {
130
- const packed = isPackedSurface(target);
131
- if (packed) {
132
- // Fast path: set the dim flag bit directly in the buffer
133
- const buf = target.buffer;
134
- const size = target.width * target.height;
135
- for (let i = 0; i < size; i++) {
136
- const off = i * CELL_STRIDE;
137
- if (buf[off + OFF_FLAGS] & FLAG_EMPTY)
138
- continue;
139
- // Skip space chars (charCode 0x20)
140
- if (buf[off] === 0x20 && buf[off + 1] === 0)
141
- continue;
142
- buf[off + OFF_FLAGS] = buf[off + OFF_FLAGS] | FLAG_DIM;
143
- }
144
- target.markAllDirty();
145
- }
146
- else {
147
- for (let y = 0; y < target.height; y++) {
148
- for (let x = 0; x < target.width; x++) {
149
- const cell = target.get(x, y);
150
- if (cell.empty || cell.char === ' ')
151
- continue;
152
- const modifiers = cell.modifiers ?? [];
153
- if (!modifiers.includes('dim')) {
154
- target.set(x, y, { ...cell, modifiers: [...modifiers, 'dim'], empty: false });
155
- }
156
- }
157
- }
158
- }
159
- }
160
- for (const overlay of overlays) {
161
- target.blit(overlay.surface ?? surfaceFromContent(overlay.content), overlay.col, overlay.row);
162
- }
163
- return target;
164
- }
165
- function styleFromToken(token, ctx) {
166
- if (!ctx || token == null)
167
- return {};
168
- const style = {
169
- fg: token.hex,
170
- bg: token.bg,
171
- modifiers: token.modifiers ? [...token.modifiers] : undefined,
172
- };
173
- if (token.fgRGB)
174
- style.fgRGB = token.fgRGB;
175
- if (token.bgRGB)
176
- style.bgRGB = token.bgRGB;
177
- return style;
178
- }
179
- function backgroundStyleFromToken(token, ctx) {
180
- if (!ctx || !shouldApplyBg(ctx) || !token?.bg)
181
- return {};
182
- const style = { bg: token.bg };
183
- if (token.bgRGB)
184
- style.bgRGB = token.bgRGB;
185
- return style;
186
- }
187
- function mergeStyles(base, extra) {
188
- const modifiers = [...(base.modifiers ?? []), ...(extra.modifiers ?? [])];
189
- const fg = extra.fg ?? base.fg;
190
- const bg = extra.bg ?? base.bg;
191
- return {
192
- fg,
193
- bg,
194
- // When extra.fg overrides base.fg, use extra's fgRGB (may be
195
- // undefined — correctly clearing the pre-parsed cache so the
196
- // differ falls back to inlineHexRGB for the new hex string).
197
- // When extra.fg is absent, inherit base's fgRGB if available.
198
- fgRGB: extra.fg != null ? extra.fgRGB : (extra.fgRGB ?? base.fgRGB),
199
- bgRGB: extra.bg != null ? extra.bgRGB : (extra.bgRGB ?? base.bgRGB),
200
- modifiers: modifiers.length > 0 ? Array.from(new Set(modifiers)) : undefined,
201
- };
202
- }
203
- function plainSurfaceToString(surface) {
204
- const lines = [];
205
- for (let y = 0; y < surface.height; y++) {
206
- let line = '';
207
- for (let x = 0; x < surface.width; x++) {
208
- line += surface.get(x, y).char;
209
- }
210
- lines.push(line);
211
- }
212
- return lines.join('\n');
213
- }
214
- function overlayContentFromSurface(surface, ctx) {
215
- return ctx ? surfaceToString(surface, ctx.style) : plainSurfaceToString(surface);
216
- }
217
- function setStyledCell(surface, x, y, char, style, numStyle) {
218
- if (numStyle && isPackedSurface(surface)) {
219
- surface.setRGB(x, y, char, numStyle.fR, numStyle.fG, numStyle.fB, numStyle.bR, numStyle.bG, numStyle.bB, numStyle.fl);
220
- }
221
- else {
222
- surface.set(x, y, { char, ...style, empty: false });
223
- }
224
- }
225
- function setStyledGrapheme(surface, x, y, char, style, numStyle) {
226
- if (x >= surface.width)
227
- return 0;
228
- const width = Math.max(1, graphemeClusterWidth(char));
229
- setStyledCell(surface, x, y, char, style, numStyle);
230
- for (let offset = 1; offset < width && x + offset < surface.width; offset++) {
231
- setStyledCell(surface, x + offset, y, '', style);
232
- }
233
- return width;
234
- }
235
- function lineSurface(text, style = {}) {
236
- if (text.length === 0)
237
- return createSurface(0, 1);
238
- const plain = stripAnsi(text);
239
- const width = Math.max(0, visibleLength(text));
240
- if (width === 0)
241
- return createSurface(0, 1);
242
- if (plain !== text && style.fg == null && style.bg == null && style.modifiers == null) {
243
- return parseAnsiToSurface(text, width, 1);
244
- }
245
- const graphemes = segmentGraphemes(plain);
246
- const surface = createSurface(width, 1);
247
- // Pre-parse style for setRGB fast path
248
- let ns;
249
- if (isPackedSurface(surface)) {
250
- let fR = -1, fG = 0, fB = 0, bR = -1, bG = 0, bB = 0;
251
- const fgHex = resolvedColorHex(style.fg);
252
- const fgRgb = style.fgRGB ?? resolvedColorRgb(style.fg) ?? (fgHex ? parseHex(fgHex) : undefined);
253
- if (fgRgb) {
254
- [fR, fG, fB] = fgRgb;
255
- }
256
- const bgHex = resolvedColorHex(style.bg);
257
- const bgRgb = style.bgRGB ?? resolvedColorRgb(style.bg) ?? (bgHex ? parseHex(bgHex) : undefined);
258
- if (bgRgb) {
259
- [bR, bG, bB] = bgRgb;
260
- }
261
- ns = { fR, fG, fB, bR, bG, bB, fl: style.modifiers ? encodeModifiers(style.modifiers) : 0 };
262
- }
263
- let x = 0;
264
- for (const grapheme of graphemes) {
265
- if (x >= width)
266
- break;
267
- x += setStyledGrapheme(surface, x, 0, grapheme, style, ns);
268
- }
269
- return surface;
270
- }
271
- function lineWithInheritedBackground(line, style) {
272
- if ((style.bg == null && style.bgRGB == null) || line.width === 0)
273
- return line;
274
- const result = line.clone();
275
- // Fast path: packed surface — write bg bytes directly
276
- const packedSurface = isPackedSurface(result) ? result : undefined;
277
- const bgHex = resolvedColorHex(style.bg);
278
- const rgb = packedSurface
279
- ? (style.bgRGB ?? resolvedColorRgb(style.bg) ?? (bgHex ? parseHex(bgHex) : undefined))
280
- : undefined;
281
- if (packedSurface && rgb) {
282
- const [bgR, bgG, bgB] = rgb;
283
- const buf = packedSurface.buffer;
284
- for (let i = 0; i < result.width; i++) {
285
- const off = i * CELL_STRIDE;
286
- if (buf[off + OFF_FLAGS] & FLAG_EMPTY)
287
- continue;
288
- if (buf[off + OFF_ALPHA] & FLAG_BG_SET)
289
- continue;
290
- buf[off + 5] = bgR;
291
- buf[off + 6] = bgG;
292
- buf[off + 7] = bgB;
293
- buf[off + OFF_ALPHA] = buf[off + OFF_ALPHA] | FLAG_BG_SET;
294
- }
295
- packedSurface.markAllDirty();
296
- return result;
297
- }
298
- for (let x = 0; x < result.width; x++) {
299
- const cell = result.get(x, 0);
300
- if (cell.empty)
301
- continue;
302
- result.set(x, 0, {
303
- ...cell,
304
- bg: cell.bg ?? style.bg,
305
- bgRGB: cell.bgRGB ?? style.bgRGB,
306
- empty: false,
307
- });
308
- }
309
- return result;
310
- }
311
- function surfaceRows(surface, maxWidth) {
312
- const width = maxWidth != null ? Math.max(0, Math.min(surface.width, maxWidth)) : surface.width;
313
- if (surface.height <= 0)
314
- return [createSurface(width, 1)];
315
- const rows = [];
316
- for (let y = 0; y < surface.height; y++) {
317
- const row = createSurface(width, 1);
318
- if (width > 0)
319
- row.blit(surface, 0, 0, 0, y, width, 1);
320
- rows.push(row);
321
- }
322
- return rows;
323
- }
324
- function contentLines(content, maxWidth) {
325
- if (typeof content === 'string') {
326
- return content.split('\n').map((line) => lineSurface(maxWidth != null ? clipToWidth(line, maxWidth) : line));
327
- }
328
- return surfaceRows(content, maxWidth);
329
- }
330
- function renderBoxSurface(lines, borderStyle, fillStyle, innerWidthOverride) {
331
- const innerWidth = innerWidthOverride ?? lines.reduce((max, line) => Math.max(max, line.width), 0);
332
- const width = innerWidth + 4;
333
- const height = lines.length + 2;
334
- const surface = createSurface(width, height);
335
- setStyledCell(surface, 0, 0, BORDER.tl, borderStyle);
336
- for (let x = 1; x < width - 1; x++)
337
- setStyledCell(surface, x, 0, BORDER.h, borderStyle);
338
- setStyledCell(surface, width - 1, 0, BORDER.tr, borderStyle);
339
- setStyledCell(surface, 0, height - 1, BORDER.bl, borderStyle);
340
- for (let x = 1; x < width - 1; x++)
341
- setStyledCell(surface, x, height - 1, BORDER.h, borderStyle);
342
- setStyledCell(surface, width - 1, height - 1, BORDER.br, borderStyle);
343
- for (let i = 0; i < lines.length; i++) {
344
- const y = i + 1;
345
- setStyledCell(surface, 0, y, BORDER.v, borderStyle);
346
- for (let x = 1; x < width - 1; x++)
347
- setStyledCell(surface, x, y, ' ', fillStyle);
348
- setStyledCell(surface, width - 1, y, BORDER.v, borderStyle);
349
- const line = lineWithInheritedBackground(lines[i], fillStyle);
350
- if (line.width > 0 && innerWidth > 0) {
351
- surface.blit(line, 2, y, 0, 0, Math.min(line.width, innerWidth), 1);
352
- }
353
- }
354
- return surface;
355
- }
356
- // ---------------------------------------------------------------------------
357
- // modal()
358
- // ---------------------------------------------------------------------------
359
- /**
360
- * Create a centered modal dialog overlay.
361
- *
362
- * Build a bordered box with optional title, body, and hint text,
363
- * then center it on screen.
364
- *
365
- * @param options - Modal configuration including content and screen dimensions.
366
- * @returns Overlay positioned at the center of the screen.
367
- */
368
- export function modal(options) {
369
- const { title, body, hint, screenWidth, screenHeight, ctx } = options;
370
- const lines = [];
371
- if (title != null) {
372
- lines.push(lineSurface(title, ctx ? { modifiers: ['bold'] } : {}), createSurface(0, 1));
373
- }
374
- lines.push(...contentLines(body));
375
- if (hint != null) {
376
- lines.push(createSurface(0, 1));
377
- if (typeof hint === 'string') {
378
- lines.push(lineSurface(hint, styleFromToken(ctx?.semantic('muted'), ctx)));
379
- }
380
- else {
381
- lines.push(...surfaceRows(hint));
382
- }
383
- }
384
- const surface = renderBoxSurface(lines, styleFromToken(options.borderToken, ctx), backgroundStyleFromToken(options.bgToken, ctx), options.width != null ? Math.max(0, options.width - 4) : undefined);
385
- const margin = resolveOverlayMargin(screenWidth, screenHeight, options.margin);
386
- const row = clampCenteredPosition(screenHeight, surface.height, margin);
387
- const col = clampCenteredPosition(screenWidth, surface.width, margin);
388
- return { content: overlayContentFromSurface(surface, ctx), surface, row, col };
389
- }
390
- // ---------------------------------------------------------------------------
391
- // toast()
392
- // ---------------------------------------------------------------------------
393
- /** Unicode icon characters mapped by toast variant. */
394
- const TOAST_ICONS = {
395
- success: forceTextPresentation('\u2714'), // ✔
396
- error: forceTextPresentation('\u2718'), // ✘
397
- info: forceTextPresentation('\u2139'), // ℹ
398
- };
399
- /** Semantic border token keys mapped by toast variant. */
400
- const TOAST_BORDER = {
401
- success: 'success',
402
- error: 'error',
403
- info: 'primary',
404
- };
405
- /**
406
- * Create an anchored toast notification overlay.
407
- *
408
- * Render a bordered box with a variant icon and message, positioned
409
- * at the specified screen corner with configurable margin.
410
- *
411
- * @param options - Toast configuration including message, variant, and screen dimensions.
412
- * @returns Overlay positioned at the specified screen corner.
413
- */
414
- export function toast(options) {
415
- const { message, variant = 'info', anchor = 'bottom-right', screenWidth, screenHeight, margin, ctx, } = options;
416
- const resolvedMargin = resolveOverlayMargin(screenWidth, screenHeight, margin);
417
- const icon = TOAST_ICONS[variant];
418
- const line = lineSurface(`${icon} ${message}`, styleFromToken(ctx?.semantic(variant), ctx));
419
- const surface = renderBoxSurface([line], styleFromToken(ctx?.border(TOAST_BORDER[variant]), ctx), backgroundStyleFromToken(options.bgToken, ctx));
420
- let row;
421
- let col;
422
- switch (anchor) {
423
- case 'top-right':
424
- row = resolvedMargin;
425
- col = screenWidth - surface.width - resolvedMargin;
426
- break;
427
- case 'bottom-right':
428
- row = screenHeight - surface.height - resolvedMargin;
429
- col = screenWidth - surface.width - resolvedMargin;
430
- break;
431
- case 'bottom-left':
432
- row = screenHeight - surface.height - resolvedMargin;
433
- col = resolvedMargin;
434
- break;
435
- case 'top-left':
436
- row = resolvedMargin;
437
- col = resolvedMargin;
438
- break;
439
- }
440
- row = Math.max(0, row);
441
- col = Math.max(0, col);
442
- return { content: overlayContentFromSurface(surface, ctx), surface, row, col };
443
- }
444
- // ---------------------------------------------------------------------------
445
- // drawer()
446
- // ---------------------------------------------------------------------------
447
- /**
448
- * Create a drawer overlay anchored to a screen edge.
449
- *
450
- * Supports horizontal anchors (`left`/`right`) that span the full screen height,
451
- * and vertical anchors (`top`/`bottom`) that span the full screen width.
452
- * Defaults to the right edge when no anchor is specified.
453
- * Renders a bordered panel with optional title in the top border.
454
- *
455
- * When an optional `region` is provided, the drawer is constrained to that
456
- * sub-region rectangle instead of spanning the full screen dimensions.
457
- *
458
- * @param options - Drawer configuration including content, anchor, and dimensions.
459
- * @returns Overlay positioned at the specified screen edge.
460
- */
461
- export function drawer(options) {
462
- const { content, screenWidth, screenHeight, title, ctx, } = options;
463
- const region = clampRegion(options.region, screenWidth, screenHeight);
464
- const dims = resolveDrawerDimensions(options, region);
465
- const { width, height, row, col } = dims;
466
- const innerWidth = Math.max(0, width - 4); // border + padding on each side
467
- const borderStyle = styleFromToken(options.borderToken, ctx);
468
- const fillStyle = backgroundStyleFromToken(options.bgToken, ctx);
469
- const titleStyle = ctx ? { modifiers: ['bold'] } : {};
470
- const surface = createSurface(width, height);
471
- if (width === 0 || height === 0) {
472
- return { content: overlayContentFromSurface(surface, ctx), surface, row, col };
473
- }
474
- for (let x = 0; x < width; x++) {
475
- const topChar = x === 0 ? BORDER.tl : x === width - 1 ? BORDER.tr : BORDER.h;
476
- setStyledCell(surface, x, 0, topChar, borderStyle);
477
- if (height > 1) {
478
- const bottomChar = x === 0 ? BORDER.bl : x === width - 1 ? BORDER.br : BORDER.h;
479
- setStyledCell(surface, x, height - 1, bottomChar, borderStyle);
480
- }
481
- }
482
- if (title != null && width > 2) {
483
- const titleLine = lineSurface(title, titleStyle);
484
- const spanWidth = Math.min(width - 2, titleLine.width + 2);
485
- const startX = 1 + Math.max(0, Math.floor(((width - 2) - spanWidth) / 2));
486
- setStyledCell(surface, startX, 0, ' ', borderStyle);
487
- const mergedTitleStyle = mergeStyles(borderStyle, titleStyle);
488
- for (let x = 0; x < Math.min(titleLine.width, Math.max(0, spanWidth - 2)); x++) {
489
- setStyledCell(surface, startX + 1 + x, 0, titleLine.get(x, 0).char, mergedTitleStyle);
490
- }
491
- if (spanWidth >= 2) {
492
- setStyledCell(surface, startX + spanWidth - 1, 0, ' ', borderStyle);
493
- }
494
- }
495
- const rows = contentLines(content, innerWidth);
496
- const availableHeight = Math.max(0, height - 2);
497
- for (let i = 0; i < availableHeight; i++) {
498
- const y = i + 1;
499
- if (width >= 1)
500
- setStyledCell(surface, 0, y, BORDER.v, borderStyle);
501
- for (let x = 1; x < Math.max(1, width - 1); x++) {
502
- if (x < width - 1)
503
- setStyledCell(surface, x, y, ' ', fillStyle);
504
- }
505
- if (width >= 2)
506
- setStyledCell(surface, width - 1, y, BORDER.v, borderStyle);
507
- const line = lineWithInheritedBackground(rows[i] ?? createSurface(0, 1), fillStyle);
508
- if (line.width > 0 && innerWidth > 0 && width >= 4) {
509
- surface.blit(line, 2, y, 0, 0, Math.min(line.width, innerWidth), 1);
510
- }
511
- }
512
- return {
513
- content: overlayContentFromSurface(surface, ctx),
514
- surface,
515
- row,
516
- col,
517
- };
518
- }
519
- /** Compute the final width, height, row, and col for a drawer given its anchor. */
520
- function resolveDrawerDimensions(options, region) {
521
- if (options.anchor === 'top' || options.anchor === 'bottom') {
522
- const anchor = options.anchor;
523
- const heightRaw = options.height;
524
- if (heightRaw == null || !Number.isFinite(heightRaw)) {
525
- throw new Error(`drawer(): "height" is required for anchor "${anchor}"`);
526
- }
527
- const height = clamp(Math.floor(heightRaw), 0, region.height);
528
- const width = region.width;
529
- const col = region.col;
530
- const row = anchor === 'top'
531
- ? region.row
532
- : region.row + region.height - height;
533
- return { width, height, row: Math.max(region.row, row), col };
534
- }
535
- const anchor = options.anchor ?? 'right';
536
- if (anchor === 'left' || anchor === 'right') {
537
- const widthRaw = options.width;
538
- if (widthRaw == null || !Number.isFinite(widthRaw)) {
539
- throw new Error(`drawer(): "width" is required for anchor "${anchor}"`);
540
- }
541
- const width = clamp(Math.floor(widthRaw), 0, region.width);
542
- const height = region.height;
543
- const row = region.row;
544
- const col = anchor === 'left'
545
- ? region.col
546
- : region.col + region.width - width;
547
- return { width, height, row, col: Math.max(region.col, col) };
548
- }
549
- return assertNever(anchor);
550
- }
551
- /** Exhaustive check — always throws. */
552
- function assertNever(value) {
553
- throw new Error(`Unexpected drawer anchor: ${String(value)}`);
554
- }
555
- /** Normalize an optional region into a clamped LayoutRect within screen bounds. */
556
- function clampRegion(region, screenWidth, screenHeight) {
557
- const sw = Math.floor(screenWidth);
558
- const sh = Math.floor(screenHeight);
559
- if (region == null) {
560
- return {
561
- row: 0,
562
- col: 0,
563
- width: Math.floor(Math.max(0, sw)),
564
- height: Math.floor(Math.max(0, sh)),
565
- };
566
- }
567
- const row = Math.floor(clamp(region.row, 0, Math.max(0, sh)));
568
- const col = Math.floor(clamp(region.col, 0, Math.max(0, sw)));
569
- const maxWidth = Math.max(0, sw - col);
570
- const maxHeight = Math.max(0, sh - row);
571
- return {
572
- row,
573
- col,
574
- width: Math.floor(clamp(region.width, 0, maxWidth)),
575
- height: Math.floor(clamp(region.height, 0, maxHeight)),
576
- };
577
- }
578
- /** Clamp a number between min and max. */
579
- function clamp(value, min, max) {
580
- return Math.max(min, Math.min(max, value));
581
- }
582
- // ---------------------------------------------------------------------------
583
- // tooltip()
584
- // ---------------------------------------------------------------------------
585
- /**
586
- * Create a tooltip overlay positioned relative to a target element.
587
- *
588
- * Render a bordered box containing the content, placed in the specified
589
- * direction from the target. Clamp to screen bounds to prevent overflow.
590
- *
591
- * @param options - Tooltip configuration including content, target position, and direction.
592
- * @returns Overlay positioned relative to the target, clamped to screen bounds.
593
- */
594
- export function tooltip(options) {
595
- const { content, row: targetRow, col: targetCol, direction = 'top', screenWidth, screenHeight, borderToken, bgToken, ctx, } = options;
596
- const maxContentWidth = Math.max(0, screenWidth - 4);
597
- const lines = contentLines(content, maxContentWidth);
598
- const surface = renderBoxSurface(lines, styleFromToken(borderToken, ctx), backgroundStyleFromToken(bgToken, ctx));
599
- let tipRow;
600
- let tipCol;
601
- switch (direction) {
602
- case 'top':
603
- tipRow = targetRow - surface.height;
604
- tipCol = targetCol - Math.floor(surface.width / 2);
605
- break;
606
- case 'bottom':
607
- tipRow = targetRow + 1;
608
- tipCol = targetCol - Math.floor(surface.width / 2);
609
- break;
610
- case 'left':
611
- tipRow = targetRow - Math.floor(surface.height / 2);
612
- tipCol = targetCol - surface.width;
613
- break;
614
- case 'right':
615
- tipRow = targetRow - Math.floor(surface.height / 2);
616
- tipCol = targetCol + 1;
617
- break;
618
- }
619
- // Clamp to screen bounds
620
- tipRow = Math.max(0, Math.min(tipRow, screenHeight - surface.height));
621
- tipCol = Math.max(0, Math.min(tipCol, screenWidth - surface.width));
622
- return { content: overlayContentFromSurface(surface, ctx), surface, row: tipRow, col: tipCol };
623
- }
624
- function surfaceFromContent(content) {
625
- const lines = content.split('\n');
626
- const width = Math.max(1, ...lines.map((line) => visibleLength(line)));
627
- const height = Math.max(1, lines.length);
628
- return parseAnsiToSurface(content, width, height);
629
- }
1
+ export { composite, compositeSurface, compositeSurfaceInto } from './overlay.part02.js';
2
+ export { modal } from './overlay.part05.js';
3
+ export { toast } from './overlay.part06.js';
4
+ export { drawer } from './overlay.part07.js';
5
+ export { tooltip } from './overlay.part09.js';
630
6
  //# sourceMappingURL=overlay.js.map