@promptctl/rich-js 0.10.0 → 0.11.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 (410) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -110
  3. package/THIRD-PARTY-NOTICES +81 -0
  4. package/dist/core/box.d.ts +0 -1
  5. package/dist/core/box.js +0 -1
  6. package/dist/core/cells.d.ts +0 -1
  7. package/dist/core/cells.js +0 -1
  8. package/dist/core/color.d.ts +6 -1
  9. package/dist/core/color.js +6 -1
  10. package/dist/core/console.d.ts +13 -4
  11. package/dist/core/console.js +78 -87
  12. package/dist/core/emoji.d.ts +0 -1
  13. package/dist/core/emoji.js +0 -1
  14. package/dist/core/export-html.d.ts +24 -0
  15. package/dist/core/export-html.js +106 -0
  16. package/dist/core/export-lines.d.ts +121 -0
  17. package/dist/core/export-lines.js +141 -0
  18. package/dist/core/highlighter.d.ts +0 -1
  19. package/dist/core/highlighter.js +0 -1
  20. package/dist/core/json.d.ts +0 -1
  21. package/dist/core/json.js +0 -1
  22. package/dist/core/markup.d.ts +33 -2
  23. package/dist/core/markup.js +128 -16
  24. package/dist/core/measure.d.ts +0 -1
  25. package/dist/core/measure.js +0 -1
  26. package/dist/core/oklch.d.ts +0 -1
  27. package/dist/core/oklch.js +0 -1
  28. package/dist/core/osc8.d.ts +68 -0
  29. package/dist/core/osc8.js +90 -0
  30. package/dist/core/pretty.d.ts +21 -2
  31. package/dist/core/pretty.js +90 -16
  32. package/dist/core/protocol.d.ts +18 -2
  33. package/dist/core/protocol.js +0 -1
  34. package/dist/core/render.d.ts +0 -1
  35. package/dist/core/render.js +3 -10
  36. package/dist/core/segment.d.ts +0 -1
  37. package/dist/core/segment.js +0 -1
  38. package/dist/core/spinnerData.d.ts +0 -1
  39. package/dist/core/spinnerData.js +0 -1
  40. package/dist/core/strip.d.ts +0 -1
  41. package/dist/core/strip.js +12 -1
  42. package/dist/core/style.d.ts +1 -7
  43. package/dist/core/style.js +84 -67
  44. package/dist/core/subscription.d.ts +0 -1
  45. package/dist/core/subscription.js +0 -1
  46. package/dist/core/text.d.ts +1 -8
  47. package/dist/core/text.js +25 -29
  48. package/dist/core/wrap.d.ts +0 -1
  49. package/dist/core/wrap.js +0 -1
  50. package/dist/host/host-stream.d.ts +0 -1
  51. package/dist/host/host-stream.js +0 -1
  52. package/dist/host/index.d.ts +0 -1
  53. package/dist/host/index.js +0 -1
  54. package/dist/host/terminal-host.d.ts +0 -1
  55. package/dist/host/terminal-host.js +0 -1
  56. package/dist/index.d.ts +4 -3
  57. package/dist/index.js +3 -2
  58. package/dist/node/prompt.d.ts +0 -1
  59. package/dist/node/prompt.js +0 -1
  60. package/dist/node/save.d.ts +2 -7
  61. package/dist/node/save.js +0 -1
  62. package/dist/node/terminal-host.d.ts +0 -1
  63. package/dist/node/terminal-host.js +0 -1
  64. package/dist/node/traceback.d.ts +0 -1
  65. package/dist/node/traceback.js +0 -1
  66. package/dist/renderables/align.d.ts +0 -1
  67. package/dist/renderables/align.js +0 -1
  68. package/dist/renderables/columns.d.ts +12 -1
  69. package/dist/renderables/columns.js +29 -5
  70. package/dist/renderables/constrain.d.ts +0 -1
  71. package/dist/renderables/constrain.js +0 -1
  72. package/dist/renderables/flexStrip.d.ts +0 -1
  73. package/dist/renderables/flexStrip.js +0 -1
  74. package/dist/renderables/group.d.ts +0 -1
  75. package/dist/renderables/group.js +0 -1
  76. package/dist/renderables/layout.d.ts +0 -1
  77. package/dist/renderables/layout.js +20 -7
  78. package/dist/renderables/live.d.ts +0 -1
  79. package/dist/renderables/live.js +0 -1
  80. package/dist/renderables/markdown.d.ts +0 -1
  81. package/dist/renderables/markdown.js +0 -1
  82. package/dist/renderables/padding.d.ts +0 -1
  83. package/dist/renderables/padding.js +0 -1
  84. package/dist/renderables/panel.d.ts +0 -1
  85. package/dist/renderables/panel.js +12 -4
  86. package/dist/renderables/progress.d.ts +0 -1
  87. package/dist/renderables/progress.js +7 -2
  88. package/dist/renderables/progressBar.d.ts +0 -1
  89. package/dist/renderables/progressBar.js +0 -1
  90. package/dist/renderables/prompt.d.ts +0 -1
  91. package/dist/renderables/prompt.js +0 -1
  92. package/dist/renderables/rule.d.ts +0 -1
  93. package/dist/renderables/rule.js +0 -1
  94. package/dist/renderables/spinner.d.ts +0 -1
  95. package/dist/renderables/spinner.js +0 -1
  96. package/dist/renderables/status.d.ts +0 -1
  97. package/dist/renderables/status.js +0 -1
  98. package/dist/renderables/syntax.d.ts +0 -1
  99. package/dist/renderables/syntax.js +0 -1
  100. package/dist/renderables/table.d.ts +0 -1
  101. package/dist/renderables/table.js +8 -3
  102. package/dist/renderables/traceback.d.ts +8 -7
  103. package/dist/renderables/traceback.js +14 -10
  104. package/dist/renderables/tree.d.ts +0 -1
  105. package/dist/renderables/tree.js +0 -1
  106. package/dist/template-bindings/color-funcs.d.ts +0 -1
  107. package/dist/template-bindings/color-funcs.js +0 -1
  108. package/dist/template-bindings/helpers.d.ts +0 -1
  109. package/dist/template-bindings/helpers.js +0 -1
  110. package/dist/template-bindings/index.d.ts +0 -1
  111. package/dist/template-bindings/index.js +0 -1
  112. package/dist/template-bindings/palette-funcs.d.ts +0 -1
  113. package/dist/template-bindings/palette-funcs.js +0 -1
  114. package/dist/template-bindings/style-funcs.d.ts +0 -1
  115. package/dist/template-bindings/style-funcs.js +0 -1
  116. package/dist/themes/buildPalette.d.ts +0 -1
  117. package/dist/themes/buildPalette.js +0 -1
  118. package/dist/themes/colorMath.d.ts +0 -1
  119. package/dist/themes/colorMath.js +0 -1
  120. package/dist/themes/colorRef.d.ts +0 -1
  121. package/dist/themes/colorRef.js +0 -1
  122. package/dist/themes/data/atom-one-dark.d.ts +0 -1
  123. package/dist/themes/data/atom-one-dark.js +0 -1
  124. package/dist/themes/data/atom-one-light.d.ts +0 -1
  125. package/dist/themes/data/atom-one-light.js +0 -1
  126. package/dist/themes/data/catppuccin-frappe.d.ts +0 -1
  127. package/dist/themes/data/catppuccin-frappe.js +0 -1
  128. package/dist/themes/data/catppuccin-latte.d.ts +0 -1
  129. package/dist/themes/data/catppuccin-latte.js +0 -1
  130. package/dist/themes/data/catppuccin-macchiato.d.ts +0 -1
  131. package/dist/themes/data/catppuccin-macchiato.js +0 -1
  132. package/dist/themes/data/catppuccin-mocha.d.ts +0 -1
  133. package/dist/themes/data/catppuccin-mocha.js +0 -1
  134. package/dist/themes/data/cyberpunk.d.ts +0 -1
  135. package/dist/themes/data/cyberpunk.js +0 -1
  136. package/dist/themes/data/default.d.ts +0 -1
  137. package/dist/themes/data/default.js +0 -1
  138. package/dist/themes/data/dracula.d.ts +0 -1
  139. package/dist/themes/data/dracula.js +0 -1
  140. package/dist/themes/data/flexoki.d.ts +0 -1
  141. package/dist/themes/data/flexoki.js +0 -1
  142. package/dist/themes/data/gruvbox.d.ts +0 -1
  143. package/dist/themes/data/gruvbox.js +0 -1
  144. package/dist/themes/data/index.d.ts +0 -1
  145. package/dist/themes/data/index.js +0 -1
  146. package/dist/themes/data/monokai.d.ts +0 -1
  147. package/dist/themes/data/monokai.js +0 -1
  148. package/dist/themes/data/nord.d.ts +0 -1
  149. package/dist/themes/data/nord.js +0 -1
  150. package/dist/themes/data/rose-pine-dawn.d.ts +0 -1
  151. package/dist/themes/data/rose-pine-dawn.js +0 -1
  152. package/dist/themes/data/rose-pine-moon.d.ts +0 -1
  153. package/dist/themes/data/rose-pine-moon.js +0 -1
  154. package/dist/themes/data/rose-pine.d.ts +0 -1
  155. package/dist/themes/data/rose-pine.js +0 -1
  156. package/dist/themes/data/solarized-dark.d.ts +0 -1
  157. package/dist/themes/data/solarized-dark.js +0 -1
  158. package/dist/themes/data/solarized-light.d.ts +0 -1
  159. package/dist/themes/data/solarized-light.js +0 -1
  160. package/dist/themes/data/svg-export.d.ts +0 -1
  161. package/dist/themes/data/svg-export.js +0 -1
  162. package/dist/themes/data/textual-ansi.d.ts +0 -1
  163. package/dist/themes/data/textual-ansi.js +0 -1
  164. package/dist/themes/data/textual-dark.d.ts +0 -1
  165. package/dist/themes/data/textual-dark.js +0 -1
  166. package/dist/themes/data/textual-light.d.ts +0 -1
  167. package/dist/themes/data/textual-light.js +0 -1
  168. package/dist/themes/data/tokyo-night.d.ts +0 -1
  169. package/dist/themes/data/tokyo-night.js +0 -1
  170. package/dist/themes/data/types.d.ts +0 -1
  171. package/dist/themes/data/types.js +0 -1
  172. package/dist/themes/palette.d.ts +0 -1
  173. package/dist/themes/palette.js +0 -1
  174. package/dist/themes/ramp.d.ts +0 -1
  175. package/dist/themes/ramp.js +0 -1
  176. package/dist/themes/registry.d.ts +0 -1
  177. package/dist/themes/registry.js +0 -1
  178. package/dist/themes/terminalThemes.d.ts +0 -1
  179. package/dist/themes/terminalThemes.js +0 -1
  180. package/dist/themes/transpose.d.ts +0 -1
  181. package/dist/themes/transpose.js +0 -1
  182. package/dist/widgets/button.d.ts +0 -1
  183. package/dist/widgets/button.js +0 -1
  184. package/dist/widgets/checkbox.d.ts +0 -1
  185. package/dist/widgets/checkbox.js +0 -1
  186. package/dist/widgets/dropdown.d.ts +0 -1
  187. package/dist/widgets/dropdown.js +0 -1
  188. package/dist/widgets/event-router.d.ts +0 -1
  189. package/dist/widgets/event-router.js +0 -1
  190. package/dist/widgets/focus-manager.d.ts +0 -1
  191. package/dist/widgets/focus-manager.js +0 -1
  192. package/dist/widgets/index.d.ts +0 -1
  193. package/dist/widgets/index.js +0 -1
  194. package/dist/widgets/screen.d.ts +0 -1
  195. package/dist/widgets/screen.js +0 -1
  196. package/dist/widgets/slider.d.ts +0 -1
  197. package/dist/widgets/slider.js +0 -1
  198. package/dist/widgets/static-item.d.ts +0 -1
  199. package/dist/widgets/static-item.js +0 -1
  200. package/dist/widgets/text-input.d.ts +0 -1
  201. package/dist/widgets/text-input.js +0 -1
  202. package/dist/widgets/toggle.d.ts +0 -1
  203. package/dist/widgets/toggle.js +0 -1
  204. package/dist/widgets/types.d.ts +0 -1
  205. package/dist/widgets/types.js +0 -1
  206. package/dist/widgets/widget-base.d.ts +0 -1
  207. package/dist/widgets/widget-base.js +0 -1
  208. package/package.json +4 -3
  209. package/dist/core/box.d.ts.map +0 -1
  210. package/dist/core/box.js.map +0 -1
  211. package/dist/core/cells.d.ts.map +0 -1
  212. package/dist/core/cells.js.map +0 -1
  213. package/dist/core/color.d.ts.map +0 -1
  214. package/dist/core/color.js.map +0 -1
  215. package/dist/core/console.d.ts.map +0 -1
  216. package/dist/core/console.js.map +0 -1
  217. package/dist/core/emoji.d.ts.map +0 -1
  218. package/dist/core/emoji.js.map +0 -1
  219. package/dist/core/highlighter.d.ts.map +0 -1
  220. package/dist/core/highlighter.js.map +0 -1
  221. package/dist/core/json.d.ts.map +0 -1
  222. package/dist/core/json.js.map +0 -1
  223. package/dist/core/markup.d.ts.map +0 -1
  224. package/dist/core/markup.js.map +0 -1
  225. package/dist/core/measure.d.ts.map +0 -1
  226. package/dist/core/measure.js.map +0 -1
  227. package/dist/core/oklch.d.ts.map +0 -1
  228. package/dist/core/oklch.js.map +0 -1
  229. package/dist/core/pretty.d.ts.map +0 -1
  230. package/dist/core/pretty.js.map +0 -1
  231. package/dist/core/protocol.d.ts.map +0 -1
  232. package/dist/core/protocol.js.map +0 -1
  233. package/dist/core/render.d.ts.map +0 -1
  234. package/dist/core/render.js.map +0 -1
  235. package/dist/core/sanitize.d.ts +0 -16
  236. package/dist/core/sanitize.d.ts.map +0 -1
  237. package/dist/core/sanitize.js +0 -19
  238. package/dist/core/sanitize.js.map +0 -1
  239. package/dist/core/segment.d.ts.map +0 -1
  240. package/dist/core/segment.js.map +0 -1
  241. package/dist/core/spinnerData.d.ts.map +0 -1
  242. package/dist/core/spinnerData.js.map +0 -1
  243. package/dist/core/strip.d.ts.map +0 -1
  244. package/dist/core/strip.js.map +0 -1
  245. package/dist/core/style.d.ts.map +0 -1
  246. package/dist/core/style.js.map +0 -1
  247. package/dist/core/subscription.d.ts.map +0 -1
  248. package/dist/core/subscription.js.map +0 -1
  249. package/dist/core/text.d.ts.map +0 -1
  250. package/dist/core/text.js.map +0 -1
  251. package/dist/core/wrap.d.ts.map +0 -1
  252. package/dist/core/wrap.js.map +0 -1
  253. package/dist/host/host-stream.d.ts.map +0 -1
  254. package/dist/host/host-stream.js.map +0 -1
  255. package/dist/host/index.d.ts.map +0 -1
  256. package/dist/host/index.js.map +0 -1
  257. package/dist/host/terminal-host.d.ts.map +0 -1
  258. package/dist/host/terminal-host.js.map +0 -1
  259. package/dist/index.d.ts.map +0 -1
  260. package/dist/index.js.map +0 -1
  261. package/dist/node/prompt.d.ts.map +0 -1
  262. package/dist/node/prompt.js.map +0 -1
  263. package/dist/node/save.d.ts.map +0 -1
  264. package/dist/node/save.js.map +0 -1
  265. package/dist/node/terminal-host.d.ts.map +0 -1
  266. package/dist/node/terminal-host.js.map +0 -1
  267. package/dist/node/traceback.d.ts.map +0 -1
  268. package/dist/node/traceback.js.map +0 -1
  269. package/dist/renderables/align.d.ts.map +0 -1
  270. package/dist/renderables/align.js.map +0 -1
  271. package/dist/renderables/columns.d.ts.map +0 -1
  272. package/dist/renderables/columns.js.map +0 -1
  273. package/dist/renderables/constrain.d.ts.map +0 -1
  274. package/dist/renderables/constrain.js.map +0 -1
  275. package/dist/renderables/flexStrip.d.ts.map +0 -1
  276. package/dist/renderables/flexStrip.js.map +0 -1
  277. package/dist/renderables/group.d.ts.map +0 -1
  278. package/dist/renderables/group.js.map +0 -1
  279. package/dist/renderables/layout.d.ts.map +0 -1
  280. package/dist/renderables/layout.js.map +0 -1
  281. package/dist/renderables/live.d.ts.map +0 -1
  282. package/dist/renderables/live.js.map +0 -1
  283. package/dist/renderables/markdown.d.ts.map +0 -1
  284. package/dist/renderables/markdown.js.map +0 -1
  285. package/dist/renderables/padding.d.ts.map +0 -1
  286. package/dist/renderables/padding.js.map +0 -1
  287. package/dist/renderables/panel.d.ts.map +0 -1
  288. package/dist/renderables/panel.js.map +0 -1
  289. package/dist/renderables/progress.d.ts.map +0 -1
  290. package/dist/renderables/progress.js.map +0 -1
  291. package/dist/renderables/progressBar.d.ts.map +0 -1
  292. package/dist/renderables/progressBar.js.map +0 -1
  293. package/dist/renderables/prompt.d.ts.map +0 -1
  294. package/dist/renderables/prompt.js.map +0 -1
  295. package/dist/renderables/rule.d.ts.map +0 -1
  296. package/dist/renderables/rule.js.map +0 -1
  297. package/dist/renderables/spinner.d.ts.map +0 -1
  298. package/dist/renderables/spinner.js.map +0 -1
  299. package/dist/renderables/status.d.ts.map +0 -1
  300. package/dist/renderables/status.js.map +0 -1
  301. package/dist/renderables/syntax.d.ts.map +0 -1
  302. package/dist/renderables/syntax.js.map +0 -1
  303. package/dist/renderables/table.d.ts.map +0 -1
  304. package/dist/renderables/table.js.map +0 -1
  305. package/dist/renderables/traceback.d.ts.map +0 -1
  306. package/dist/renderables/traceback.js.map +0 -1
  307. package/dist/renderables/tree.d.ts.map +0 -1
  308. package/dist/renderables/tree.js.map +0 -1
  309. package/dist/template-bindings/color-funcs.d.ts.map +0 -1
  310. package/dist/template-bindings/color-funcs.js.map +0 -1
  311. package/dist/template-bindings/helpers.d.ts.map +0 -1
  312. package/dist/template-bindings/helpers.js.map +0 -1
  313. package/dist/template-bindings/index.d.ts.map +0 -1
  314. package/dist/template-bindings/index.js.map +0 -1
  315. package/dist/template-bindings/palette-funcs.d.ts.map +0 -1
  316. package/dist/template-bindings/palette-funcs.js.map +0 -1
  317. package/dist/template-bindings/style-funcs.d.ts.map +0 -1
  318. package/dist/template-bindings/style-funcs.js.map +0 -1
  319. package/dist/themes/buildPalette.d.ts.map +0 -1
  320. package/dist/themes/buildPalette.js.map +0 -1
  321. package/dist/themes/colorMath.d.ts.map +0 -1
  322. package/dist/themes/colorMath.js.map +0 -1
  323. package/dist/themes/colorRef.d.ts.map +0 -1
  324. package/dist/themes/colorRef.js.map +0 -1
  325. package/dist/themes/data/atom-one-dark.d.ts.map +0 -1
  326. package/dist/themes/data/atom-one-dark.js.map +0 -1
  327. package/dist/themes/data/atom-one-light.d.ts.map +0 -1
  328. package/dist/themes/data/atom-one-light.js.map +0 -1
  329. package/dist/themes/data/catppuccin-frappe.d.ts.map +0 -1
  330. package/dist/themes/data/catppuccin-frappe.js.map +0 -1
  331. package/dist/themes/data/catppuccin-latte.d.ts.map +0 -1
  332. package/dist/themes/data/catppuccin-latte.js.map +0 -1
  333. package/dist/themes/data/catppuccin-macchiato.d.ts.map +0 -1
  334. package/dist/themes/data/catppuccin-macchiato.js.map +0 -1
  335. package/dist/themes/data/catppuccin-mocha.d.ts.map +0 -1
  336. package/dist/themes/data/catppuccin-mocha.js.map +0 -1
  337. package/dist/themes/data/cyberpunk.d.ts.map +0 -1
  338. package/dist/themes/data/cyberpunk.js.map +0 -1
  339. package/dist/themes/data/default.d.ts.map +0 -1
  340. package/dist/themes/data/default.js.map +0 -1
  341. package/dist/themes/data/dracula.d.ts.map +0 -1
  342. package/dist/themes/data/dracula.js.map +0 -1
  343. package/dist/themes/data/flexoki.d.ts.map +0 -1
  344. package/dist/themes/data/flexoki.js.map +0 -1
  345. package/dist/themes/data/gruvbox.d.ts.map +0 -1
  346. package/dist/themes/data/gruvbox.js.map +0 -1
  347. package/dist/themes/data/index.d.ts.map +0 -1
  348. package/dist/themes/data/index.js.map +0 -1
  349. package/dist/themes/data/monokai.d.ts.map +0 -1
  350. package/dist/themes/data/monokai.js.map +0 -1
  351. package/dist/themes/data/nord.d.ts.map +0 -1
  352. package/dist/themes/data/nord.js.map +0 -1
  353. package/dist/themes/data/rose-pine-dawn.d.ts.map +0 -1
  354. package/dist/themes/data/rose-pine-dawn.js.map +0 -1
  355. package/dist/themes/data/rose-pine-moon.d.ts.map +0 -1
  356. package/dist/themes/data/rose-pine-moon.js.map +0 -1
  357. package/dist/themes/data/rose-pine.d.ts.map +0 -1
  358. package/dist/themes/data/rose-pine.js.map +0 -1
  359. package/dist/themes/data/solarized-dark.d.ts.map +0 -1
  360. package/dist/themes/data/solarized-dark.js.map +0 -1
  361. package/dist/themes/data/solarized-light.d.ts.map +0 -1
  362. package/dist/themes/data/solarized-light.js.map +0 -1
  363. package/dist/themes/data/svg-export.d.ts.map +0 -1
  364. package/dist/themes/data/svg-export.js.map +0 -1
  365. package/dist/themes/data/textual-ansi.d.ts.map +0 -1
  366. package/dist/themes/data/textual-ansi.js.map +0 -1
  367. package/dist/themes/data/textual-dark.d.ts.map +0 -1
  368. package/dist/themes/data/textual-dark.js.map +0 -1
  369. package/dist/themes/data/textual-light.d.ts.map +0 -1
  370. package/dist/themes/data/textual-light.js.map +0 -1
  371. package/dist/themes/data/tokyo-night.d.ts.map +0 -1
  372. package/dist/themes/data/tokyo-night.js.map +0 -1
  373. package/dist/themes/data/types.d.ts.map +0 -1
  374. package/dist/themes/data/types.js.map +0 -1
  375. package/dist/themes/palette.d.ts.map +0 -1
  376. package/dist/themes/palette.js.map +0 -1
  377. package/dist/themes/ramp.d.ts.map +0 -1
  378. package/dist/themes/ramp.js.map +0 -1
  379. package/dist/themes/registry.d.ts.map +0 -1
  380. package/dist/themes/registry.js.map +0 -1
  381. package/dist/themes/terminalThemes.d.ts.map +0 -1
  382. package/dist/themes/terminalThemes.js.map +0 -1
  383. package/dist/themes/transpose.d.ts.map +0 -1
  384. package/dist/themes/transpose.js.map +0 -1
  385. package/dist/widgets/button.d.ts.map +0 -1
  386. package/dist/widgets/button.js.map +0 -1
  387. package/dist/widgets/checkbox.d.ts.map +0 -1
  388. package/dist/widgets/checkbox.js.map +0 -1
  389. package/dist/widgets/dropdown.d.ts.map +0 -1
  390. package/dist/widgets/dropdown.js.map +0 -1
  391. package/dist/widgets/event-router.d.ts.map +0 -1
  392. package/dist/widgets/event-router.js.map +0 -1
  393. package/dist/widgets/focus-manager.d.ts.map +0 -1
  394. package/dist/widgets/focus-manager.js.map +0 -1
  395. package/dist/widgets/index.d.ts.map +0 -1
  396. package/dist/widgets/index.js.map +0 -1
  397. package/dist/widgets/screen.d.ts.map +0 -1
  398. package/dist/widgets/screen.js.map +0 -1
  399. package/dist/widgets/slider.d.ts.map +0 -1
  400. package/dist/widgets/slider.js.map +0 -1
  401. package/dist/widgets/static-item.d.ts.map +0 -1
  402. package/dist/widgets/static-item.js.map +0 -1
  403. package/dist/widgets/text-input.d.ts.map +0 -1
  404. package/dist/widgets/text-input.js.map +0 -1
  405. package/dist/widgets/toggle.d.ts.map +0 -1
  406. package/dist/widgets/toggle.js.map +0 -1
  407. package/dist/widgets/types.d.ts.map +0 -1
  408. package/dist/widgets/types.js.map +0 -1
  409. package/dist/widgets/widget-base.d.ts.map +0 -1
  410. package/dist/widgets/widget-base.js.map +0 -1
@@ -0,0 +1,24 @@
1
+ /**
2
+ * export-html — recorded segments drawn as a standalone HTML document.
3
+ *
4
+ * An encoding of `export-lines` and nothing more. What a run looks like under
5
+ * a theme is decided there; this module decides only how CSS says it. It never
6
+ * sees a `Style`, so it cannot disagree with the SVG exporter about what
7
+ * `reverse` or `dim` means — the two old converters that did disagree were
8
+ * deleted when this replaced them.
9
+ *
10
+ * The rows are already laid out at console width, so `pre` never re-wraps
11
+ * them: `white-space: pre`, and a scrollbar rather than a reflow when the page
12
+ * is narrower than the terminal was.
13
+ */
14
+ import type { TerminalTheme } from "./color.js";
15
+ import type { Segment } from "./segment.js";
16
+ /**
17
+ * `segments` under `theme` as a complete HTML document.
18
+ *
19
+ * A browser draws no line for a newline at either edge of a `pre`: the parser
20
+ * drops the one straight after `<pre>`, and the one before `</pre>` ends a
21
+ * line without starting another. So the page opens with a newline of its own
22
+ * and every row ends with one, and a blank first or last row is still drawn.
23
+ */
24
+ export declare function encodeHtml(segments: Iterable<Segment>, theme?: TerminalTheme): string;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * export-html — recorded segments drawn as a standalone HTML document.
3
+ *
4
+ * An encoding of `export-lines` and nothing more. What a run looks like under
5
+ * a theme is decided there; this module decides only how CSS says it. It never
6
+ * sees a `Style`, so it cannot disagree with the SVG exporter about what
7
+ * `reverse` or `dim` means — the two old converters that did disagree were
8
+ * deleted when this replaced them.
9
+ *
10
+ * The rows are already laid out at console width, so `pre` never re-wraps
11
+ * them: `white-space: pre`, and a scrollbar rather than a reflow when the page
12
+ * is narrower than the terminal was.
13
+ */
14
+ import { exportCanvas, exportLines } from "./export-lines.js";
15
+ const ENTITIES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" };
16
+ const escapeText = (text) => text.replace(/[&<>]/g, (c) => ENTITIES[c]);
17
+ const escapeAttribute = (value) => value.replace(/[&"<>]/g, (c) => ENTITIES[c]);
18
+ const BLINK_KEYFRAMES = "rich-blink";
19
+ // [LAW:dataflow-not-control-flow] Each enum-valued field of a look is a table
20
+ // from its values to the declarations it adds, so every value is spelled once
21
+ // and `Record` makes a new value a compile error until it has a row.
22
+ // A double underline adds no line to the glyph's own span; `runHtml` draws it.
23
+ const UNDERLINE_LINE = {
24
+ none: [],
25
+ single: ["underline"],
26
+ double: [],
27
+ };
28
+ const BLINK = {
29
+ none: [],
30
+ slow: [`animation:${BLINK_KEYFRAMES} 1s step-end infinite`],
31
+ fast: [`animation:${BLINK_KEYFRAMES} 0.5s step-end infinite`],
32
+ };
33
+ const FRAME = "box-shadow:inset 0 0 0 1px currentColor";
34
+ const OUTLINE = {
35
+ none: [],
36
+ frame: [FRAME],
37
+ encircle: [FRAME, "border-radius:0.5em"],
38
+ };
39
+ /**
40
+ * The glyph colour, and the background when one is painted.
41
+ *
42
+ * Dim arrives already blended into `foreground`. `opacity` is never written:
43
+ * it fades a painted background along with the glyph, which is the bug the
44
+ * blend exists to avoid.
45
+ */
46
+ function paintCss(look) {
47
+ return [
48
+ `color:${look.foreground.hex}`,
49
+ ...(look.background === "canvas" ? [] : [`background-color:${look.background.hex}`]),
50
+ ];
51
+ }
52
+ /** What is drawn on the glyph: weight, slant, single-style lines, blink, outline. */
53
+ function glyphCss(look) {
54
+ const lines = [
55
+ ...UNDERLINE_LINE[look.underline],
56
+ ...(look.strike ? ["line-through"] : []),
57
+ ...(look.overline ? ["overline"] : []),
58
+ ];
59
+ return [
60
+ ...(look.bold ? ["font-weight:bold"] : []),
61
+ ...(look.italic ? ["font-style:italic"] : []),
62
+ ...(lines.length === 0 ? [] : [`text-decoration-line:${lines.join(" ")}`]),
63
+ ...BLINK[look.blink],
64
+ ...OUTLINE[look.outline],
65
+ ];
66
+ }
67
+ const span = (css, content) => `<span style="${escapeAttribute(css.join(";"))}">${content}</span>`;
68
+ /**
69
+ * One run as markup.
70
+ *
71
+ * An element has one `text-decoration-style`, so a double underline sharing a
72
+ * span with a strike would double the strike too. It gets an outer span of its
73
+ * own instead. That span carries the paint, because a descendant's background
74
+ * may be painted over an ancestor's underline, and the blink, so the underline
75
+ * blinks with the glyph.
76
+ */
77
+ function runHtml({ text, look }) {
78
+ const glyph = escapeText(text);
79
+ const drawn = look.underline === "double"
80
+ ? span([...paintCss(look), "text-decoration-line:underline", "text-decoration-style:double", ...BLINK[look.blink]], span([`color:${look.foreground.hex}`, ...glyphCss(look)], glyph))
81
+ : span([...paintCss(look), ...glyphCss(look)], glyph);
82
+ return look.href === null ? drawn : `<a href="${escapeAttribute(look.href)}">${drawn}</a>`;
83
+ }
84
+ /**
85
+ * `segments` under `theme` as a complete HTML document.
86
+ *
87
+ * A browser draws no line for a newline at either edge of a `pre`: the parser
88
+ * drops the one straight after `<pre>`, and the one before `</pre>` ends a
89
+ * line without starting another. So the page opens with a newline of its own
90
+ * and every row ends with one, and a blank first or last row is still drawn.
91
+ */
92
+ export function encodeHtml(segments, theme) {
93
+ const canvas = exportCanvas(theme);
94
+ const rows = exportLines(segments, theme).map((row) => `${row.map(runHtml).join("")}\n`);
95
+ const css = [
96
+ `body{background:${canvas.background.hex};color:${canvas.foreground.hex};padding:1em}`,
97
+ "pre{margin:0;font-family:monospace;white-space:pre;overflow-x:auto}",
98
+ "a{color:inherit;text-decoration:inherit}",
99
+ `@keyframes ${BLINK_KEYFRAMES}{50%{color:transparent}}`,
100
+ ].join("\n");
101
+ return [
102
+ "<!DOCTYPE html>",
103
+ `<html><head><meta charset="utf-8"><style>\n${css}\n</style></head>`,
104
+ `<body><pre>\n${rows.join("")}</pre></body></html>`,
105
+ ].join("\n");
106
+ }
@@ -0,0 +1,121 @@
1
+ /**
2
+ * export-lines — recorded segments resolved against a `TerminalTheme` into the
3
+ * lines every exporter draws.
4
+ *
5
+ * The HTML and SVG exporters are two encodings of one picture, and this module
6
+ * is the picture. What a styled cell *looks like* — which colour its glyph is,
7
+ * whether its background is painted, which decorations it carries, where it
8
+ * links — is decided here, once, and an exporter decides only how to write
9
+ * that down. Before it existed the decision was made twice, by a CSS method
10
+ * on `Style` and by a private converter on `Console`, and the two had already
11
+ * disagreed: one honoured `underline2`, the other dropped it.
12
+ *
13
+ * [LAW:types-are-the-program] `ExportLook` has no `reverse`, `dim`, `conceal`
14
+ * or default colour, because all four are consumed by `resolveLook` and turned
15
+ * into plain RGB. An exporter holding a look cannot forget to swap a reversed
16
+ * run or to fade a dim one: there is nothing left in its hands to forget. That
17
+ * is the whole reason the representation is resolved rather than a `Style`
18
+ * handed through.
19
+ *
20
+ * Runs rather than a cell grid. A grid gives a wide character a phantom
21
+ * continuation cell every consumer must know to skip, and gives an HTML
22
+ * exporter — which lays text out by flowing it — nothing it needs. A run's
23
+ * column and cell width are `cellLen` of the text before it and of its own
24
+ * text; they are not stored, so they cannot disagree with the text
25
+ * [LAW:one-source-of-truth]. The SVG exporter, the one consumer that positions
26
+ * anything, derives them.
27
+ *
28
+ * Browser-safe by construction: this imports `color`, `style`, `segment` and
29
+ * nothing that touches the host, so `Console` can reach it from the main
30
+ * barrel and the fs half of exporting stays in `src/node/save.ts`.
31
+ */
32
+ import { type ColorRgba, type TerminalTheme } from "./color.js";
33
+ import { type Style } from "./style.js";
34
+ import type { Segment } from "./segment.js";
35
+ declare const _href: unique symbol;
36
+ /**
37
+ * A link target that is safe to write into a published document.
38
+ *
39
+ * [LAW:parse-dont-validate] Only `parseHref` produces one, so an exporter that
40
+ * writes an `href` attribute from an `Href` cannot have skipped the check.
41
+ */
42
+ export type Href = string & {
43
+ readonly [_href]: true;
44
+ };
45
+ /**
46
+ * Where a run's background comes from. `"canvas"` is the theme background
47
+ * showing through — nothing painted — and is distinct from a painted colour
48
+ * that happens to equal it, because `on default` and `on #000000` are
49
+ * different requests even over a black theme.
50
+ */
51
+ export type Background = ColorRgba | "canvas";
52
+ /** Everything an exporter needs to draw one run, and nothing left to resolve. */
53
+ export interface ExportLook {
54
+ readonly foreground: ColorRgba;
55
+ readonly background: Background;
56
+ readonly bold: boolean;
57
+ readonly italic: boolean;
58
+ readonly underline: "none" | "single" | "double";
59
+ readonly strike: boolean;
60
+ readonly overline: boolean;
61
+ readonly blink: "none" | "slow" | "fast";
62
+ readonly outline: "none" | "frame" | "encircle";
63
+ readonly href: Href | null;
64
+ }
65
+ export interface ExportRun {
66
+ readonly text: string;
67
+ readonly look: ExportLook;
68
+ }
69
+ /** One terminal row, left to right. An empty array is a blank row. */
70
+ export type ExportLine = readonly ExportRun[];
71
+ /**
72
+ * `Style.link` as a link an export may write, or `null` when it may not.
73
+ *
74
+ * A refused link loses only its target: the run keeps its text and every other
75
+ * attribute, so nothing the terminal showed disappears from the export. The
76
+ * canonical `URL.href` is what comes back, since the parse is what vouches for
77
+ * it.
78
+ */
79
+ export declare function parseHref(link: string): Href | null;
80
+ /** What an unstyled cell shows under a theme: the canvas, and ink on it. */
81
+ export interface ExportCanvas {
82
+ readonly background: ColorRgba;
83
+ readonly foreground: ColorRgba;
84
+ }
85
+ /**
86
+ * The ground every export is drawn on under `theme`.
87
+ *
88
+ * An exporter paints its page or window with this; `resolveLook` flattens
89
+ * every run over the same `background`, so a run showing the canvas and the
90
+ * page around it cannot come out different colours.
91
+ */
92
+ export declare function exportCanvas(theme?: TerminalTheme): ExportCanvas;
93
+ /**
94
+ * A `Style` as it appears on screen under `theme`.
95
+ *
96
+ * The order is the terminal's: colours resolve through the theme and lose
97
+ * their alpha — paper over the canvas, ink over the paper, as `toSgrCodes`
98
+ * flattens them — `reverse` swaps them, `dim` fades the glyph toward whatever
99
+ * background it ended up on, and `conceal` finally paints the glyph in that
100
+ * background. Every step after flattening works on opaque colour, so no
101
+ * exporter ever draws a translucent one. Text under `conceal` is still
102
+ * present, and still selectable, in both formats.
103
+ *
104
+ * The one difference from `toSgrCodes` is the substrate: a terminal cannot
105
+ * know what lies under its cells and assumes black, while an export draws its
106
+ * own canvas and flattens over that.
107
+ *
108
+ * `theme` omitted is `ColorSpec.getTruecolor`'s own fallback — black canvas,
109
+ * white ink, the standard ANSI table. Choosing it there rather than naming a
110
+ * preset here is what keeps `core/` from a third upward edge into `themes/`.
111
+ */
112
+ export declare function resolveLook(style: Style, theme?: TerminalTheme): ExportLook;
113
+ /**
114
+ * Recorded segments as terminal rows under `theme`.
115
+ *
116
+ * `"\n"` ends a row, so output that ends with a newline — every `print` does —
117
+ * has no empty row after it, and `"a\n\nb"` keeps its blank row. Callers pass
118
+ * the recording buffer, which already holds no control segments.
119
+ */
120
+ export declare function exportLines(segments: Iterable<Segment>, theme?: TerminalTheme): ExportLine[];
121
+ export {};
@@ -0,0 +1,141 @@
1
+ /**
2
+ * export-lines — recorded segments resolved against a `TerminalTheme` into the
3
+ * lines every exporter draws.
4
+ *
5
+ * The HTML and SVG exporters are two encodings of one picture, and this module
6
+ * is the picture. What a styled cell *looks like* — which colour its glyph is,
7
+ * whether its background is painted, which decorations it carries, where it
8
+ * links — is decided here, once, and an exporter decides only how to write
9
+ * that down. Before it existed the decision was made twice, by a CSS method
10
+ * on `Style` and by a private converter on `Console`, and the two had already
11
+ * disagreed: one honoured `underline2`, the other dropped it.
12
+ *
13
+ * [LAW:types-are-the-program] `ExportLook` has no `reverse`, `dim`, `conceal`
14
+ * or default colour, because all four are consumed by `resolveLook` and turned
15
+ * into plain RGB. An exporter holding a look cannot forget to swap a reversed
16
+ * run or to fade a dim one: there is nothing left in its hands to forget. That
17
+ * is the whole reason the representation is resolved rather than a `Style`
18
+ * handed through.
19
+ *
20
+ * Runs rather than a cell grid. A grid gives a wide character a phantom
21
+ * continuation cell every consumer must know to skip, and gives an HTML
22
+ * exporter — which lays text out by flowing it — nothing it needs. A run's
23
+ * column and cell width are `cellLen` of the text before it and of its own
24
+ * text; they are not stored, so they cannot disagree with the text
25
+ * [LAW:one-source-of-truth]. The SVG exporter, the one consumer that positions
26
+ * anything, derives them.
27
+ *
28
+ * Browser-safe by construction: this imports `color`, `style`, `segment` and
29
+ * nothing that touches the host, so `Console` can reach it from the main
30
+ * barrel and the fs half of exporting stays in `src/node/save.ts`.
31
+ */
32
+ import { blendRgb, ColorSpec } from "./color.js";
33
+ import { NULL_STYLE } from "./style.js";
34
+ /**
35
+ * The URL schemes an export will link.
36
+ *
37
+ * A terminal hands an OSC 8 target to the user's opener; an exported page hands
38
+ * it to whoever loads the page, and exports are made to be published. A
39
+ * `javascript:` target that was inert in a terminal is script in a README. The
40
+ * list is an allowance, not a denylist, so a scheme nobody considered is
41
+ * refused rather than trusted.
42
+ */
43
+ const LINKABLE_SCHEMES = new Set(["http:", "https:", "mailto:", "ftp:", "file:"]);
44
+ /**
45
+ * `Style.link` as a link an export may write, or `null` when it may not.
46
+ *
47
+ * A refused link loses only its target: the run keeps its text and every other
48
+ * attribute, so nothing the terminal showed disappears from the export. The
49
+ * canonical `URL.href` is what comes back, since the parse is what vouches for
50
+ * it.
51
+ */
52
+ export function parseHref(link) {
53
+ if (!URL.canParse(link))
54
+ return null;
55
+ const url = new URL(link);
56
+ return LINKABLE_SCHEMES.has(url.protocol) ? url.href : null;
57
+ }
58
+ /**
59
+ * How far a dim glyph moves toward its background — Rich's own factor, so an
60
+ * export of the same program matches the library this ports.
61
+ */
62
+ const DIM_FADE = 0.4;
63
+ const DEFAULT_COLOR = ColorSpec.default();
64
+ /**
65
+ * The ground every export is drawn on under `theme`.
66
+ *
67
+ * An exporter paints its page or window with this; `resolveLook` flattens
68
+ * every run over the same `background`, so a run showing the canvas and the
69
+ * page around it cannot come out different colours.
70
+ */
71
+ export function exportCanvas(theme) {
72
+ return {
73
+ background: DEFAULT_COLOR.getTruecolor(theme, false),
74
+ foreground: DEFAULT_COLOR.getTruecolor(theme, true),
75
+ };
76
+ }
77
+ /**
78
+ * A `Style` as it appears on screen under `theme`.
79
+ *
80
+ * The order is the terminal's: colours resolve through the theme and lose
81
+ * their alpha — paper over the canvas, ink over the paper, as `toSgrCodes`
82
+ * flattens them — `reverse` swaps them, `dim` fades the glyph toward whatever
83
+ * background it ended up on, and `conceal` finally paints the glyph in that
84
+ * background. Every step after flattening works on opaque colour, so no
85
+ * exporter ever draws a translucent one. Text under `conceal` is still
86
+ * present, and still selectable, in both formats.
87
+ *
88
+ * The one difference from `toSgrCodes` is the substrate: a terminal cannot
89
+ * know what lies under its cells and assumes black, while an export draws its
90
+ * own canvas and flattens over that.
91
+ *
92
+ * `theme` omitted is `ColorSpec.getTruecolor`'s own fallback — black canvas,
93
+ * white ink, the standard ANSI table. Choosing it there rather than naming a
94
+ * preset here is what keeps `core/` from a third upward edge into `themes/`.
95
+ */
96
+ export function resolveLook(style, theme) {
97
+ const inkSpec = style.color ?? DEFAULT_COLOR;
98
+ const paperSpec = style.bgcolor ?? DEFAULT_COLOR;
99
+ const canvas = exportCanvas(theme).background;
100
+ // [LAW:single-enforcer] `flattenAlpha` is the one place alpha is composited.
101
+ const paper = paperSpec.flattenAlpha(canvas).getTruecolor(theme, false);
102
+ const ink = inkSpec.flattenAlpha(paper).getTruecolor(theme, true);
103
+ // A reversed run always paints: its background is the ink, which is never
104
+ // the canvas, even when the ink is the theme's default foreground.
105
+ const glyph = style.reverse ? paper : ink;
106
+ const ground = style.reverse ? ink : paper;
107
+ const background = style.reverse || !paperSpec.isDefault ? ground : "canvas";
108
+ const faded = style.dim ? blendRgb(glyph, ground, DIM_FADE) : glyph;
109
+ return {
110
+ foreground: style.conceal ? ground : faded,
111
+ background,
112
+ bold: style.bold === true,
113
+ italic: style.italic === true,
114
+ underline: style.underline2 ? "double" : style.underline ? "single" : "none",
115
+ strike: style.strike === true,
116
+ overline: style.overline === true,
117
+ blink: style.blink2 ? "fast" : style.blink ? "slow" : "none",
118
+ outline: style.encircle ? "encircle" : style.frame ? "frame" : "none",
119
+ href: style.link === undefined ? null : parseHref(style.link),
120
+ };
121
+ }
122
+ /**
123
+ * Recorded segments as terminal rows under `theme`.
124
+ *
125
+ * `"\n"` ends a row, so output that ends with a newline — every `print` does —
126
+ * has no empty row after it, and `"a\n\nb"` keeps its blank row. Callers pass
127
+ * the recording buffer, which already holds no control segments.
128
+ */
129
+ export function exportLines(segments, theme) {
130
+ const rows = [[]];
131
+ for (const segment of segments) {
132
+ const look = resolveLook(segment.style ?? NULL_STYLE, theme);
133
+ segment.text.split("\n").forEach((piece, index) => {
134
+ if (index > 0)
135
+ rows.push([]);
136
+ if (piece.length > 0)
137
+ rows[rows.length - 1].push({ text: piece, look });
138
+ });
139
+ }
140
+ return rows[rows.length - 1].length === 0 ? rows.slice(0, -1) : rows;
141
+ }
@@ -31,4 +31,3 @@ export declare class ISO8601Highlighter extends RegexHighlighter {
31
31
  static baseStyle: string;
32
32
  static highlights: RegExp[];
33
33
  }
34
- //# sourceMappingURL=highlighter.d.ts.map
@@ -122,4 +122,3 @@ export class ISO8601Highlighter extends RegexHighlighter {
122
122
  /(?<timezone>[+-]\d{2}:\d{2}|Z)/g,
123
123
  ];
124
124
  }
125
- //# sourceMappingURL=highlighter.js.map
@@ -25,4 +25,3 @@ export declare class JSONRenderable implements Renderable, Measurable {
25
25
  maximum: number;
26
26
  };
27
27
  }
28
- //# sourceMappingURL=json.d.ts.map
package/dist/core/json.js CHANGED
@@ -51,4 +51,3 @@ export class JSONRenderable {
51
51
  return this.text.measure(options);
52
52
  }
53
53
  }
54
- //# sourceMappingURL=json.js.map
@@ -14,7 +14,7 @@
14
14
  * (`[bold]a[italic]b[/bold]c[/italic]`) because a style is an annotation and
15
15
  * annotations may overlap freely; a plugin tag is a replacement whose handler
16
16
  * takes one contiguous `inner`, so an overlapping pair has no slice to hand it
17
- * and is rejected with a `MarkupError`.
17
+ * and is rejected with a `MarkupSyntaxError`.
18
18
  */
19
19
  import { Style } from "./style.js";
20
20
  import { RichText } from "./text.js";
@@ -28,6 +28,38 @@ export declare class Tag {
28
28
  export declare class MarkupError extends Error {
29
29
  constructor(message: string);
30
30
  }
31
+ /**
32
+ * A markup string that cannot be parsed, with where it went wrong.
33
+ *
34
+ * [LAW:types-are-the-program] A subclass rather than optional fields on
35
+ * `MarkupError`, because the parent is also what `MarkupRegistry.register`
36
+ * throws, and a registration has no source text to point into. Every error this
37
+ * class describes has a location, so none of its fields is optional and no
38
+ * caller has to ask whether one is present — `instanceof` is the only question.
39
+ *
40
+ * [LAW:one-source-of-truth] The constructor takes the facts the parser holds —
41
+ * the string, the offset of the offending tag, what was open — and derives
42
+ * `line`, `column` and the message from them, so the numbers a caller reads
43
+ * and the caret the message draws cannot disagree.
44
+ */
45
+ export declare class MarkupSyntaxError extends MarkupError {
46
+ /** The problem alone, with no location, for callers building their own message. */
47
+ readonly reason: string;
48
+ /** The whole markup string that failed, as the caller passed it. */
49
+ readonly markup: string;
50
+ /** Index into `markup` of the tag the parser rejected. */
51
+ readonly offset: number;
52
+ /** 1-based line of `offset`; lines are separated by `\n`. */
53
+ readonly line: number;
54
+ /** 1-based column of `offset` within its line, in UTF-16 code units. */
55
+ readonly column: number;
56
+ /**
57
+ * The opening tags still open at `offset`, outermost first, as written. For
58
+ * overlapping plugin tags, only plugin tags are named.
59
+ */
60
+ readonly openTags: readonly string[];
61
+ constructor(reason: string, markup: string, offset: number, openTags: readonly string[]);
62
+ }
31
63
  /**
32
64
  * Escapes markup characters so they render as literal text.
33
65
  */
@@ -63,4 +95,3 @@ export interface RenderMarkupOptions {
63
95
  * append path is uniform.
64
96
  */
65
97
  export declare function renderMarkup(markup: string, options?: RenderMarkupOptions): RichText;
66
- //# sourceMappingURL=markup.d.ts.map