@contraagent/elements 0.0.0-stage → 0.1.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 (609) hide show
  1. package/README.md +72 -2
  2. package/custom-elements.json +4260 -0
  3. package/dist/charts/bar-chart.d.ts +32 -0
  4. package/dist/charts/bar-chart.d.ts.map +1 -0
  5. package/dist/charts/bar-chart.js +70 -0
  6. package/dist/charts/bar-chart.js.map +1 -0
  7. package/dist/charts/base.d.ts +48 -0
  8. package/dist/charts/base.d.ts.map +1 -0
  9. package/dist/charts/base.js +203 -0
  10. package/dist/charts/base.js.map +1 -0
  11. package/dist/charts/column-chart.d.ts +42 -0
  12. package/dist/charts/column-chart.d.ts.map +1 -0
  13. package/dist/charts/column-chart.js +146 -0
  14. package/dist/charts/column-chart.js.map +1 -0
  15. package/dist/charts/heatmap.d.ts +42 -0
  16. package/dist/charts/heatmap.d.ts.map +1 -0
  17. package/dist/charts/heatmap.js +124 -0
  18. package/dist/charts/heatmap.js.map +1 -0
  19. package/dist/charts/index.d.ts +9 -0
  20. package/dist/charts/index.d.ts.map +1 -0
  21. package/dist/charts/index.js +11 -0
  22. package/dist/charts/index.js.map +1 -0
  23. package/dist/charts/line-chart.d.ts +36 -0
  24. package/dist/charts/line-chart.d.ts.map +1 -0
  25. package/dist/charts/line-chart.js +118 -0
  26. package/dist/charts/line-chart.js.map +1 -0
  27. package/dist/charts/scale.d.ts +32 -0
  28. package/dist/charts/scale.d.ts.map +1 -0
  29. package/dist/charts/scale.js +50 -0
  30. package/dist/charts/scale.js.map +1 -0
  31. package/dist/charts/state-grid.d.ts +64 -0
  32. package/dist/charts/state-grid.d.ts.map +1 -0
  33. package/dist/charts/state-grid.js +223 -0
  34. package/dist/charts/state-grid.js.map +1 -0
  35. package/dist/charts/types.d.ts +34 -0
  36. package/dist/charts/types.d.ts.map +1 -0
  37. package/dist/charts/types.js +11 -0
  38. package/dist/charts/types.js.map +1 -0
  39. package/dist/checks/check-table.d.ts +32 -0
  40. package/dist/checks/check-table.d.ts.map +1 -0
  41. package/dist/checks/check-table.js +94 -0
  42. package/dist/checks/check-table.js.map +1 -0
  43. package/dist/checks/index.d.ts +4 -0
  44. package/dist/checks/index.d.ts.map +1 -0
  45. package/dist/checks/index.js +6 -0
  46. package/dist/checks/index.js.map +1 -0
  47. package/dist/checks/styles.d.ts +5 -0
  48. package/dist/checks/styles.d.ts.map +1 -0
  49. package/dist/checks/styles.js +30 -0
  50. package/dist/checks/styles.js.map +1 -0
  51. package/dist/checks/types.d.ts +35 -0
  52. package/dist/checks/types.d.ts.map +1 -0
  53. package/dist/checks/types.js +12 -0
  54. package/dist/checks/types.js.map +1 -0
  55. package/dist/core/clock.d.ts +20 -0
  56. package/dist/core/clock.d.ts.map +1 -0
  57. package/dist/core/clock.js +45 -0
  58. package/dist/core/clock.js.map +1 -0
  59. package/dist/core/define.d.ts +3 -0
  60. package/dist/core/define.d.ts.map +1 -0
  61. package/dist/core/define.js +8 -0
  62. package/dist/core/define.js.map +1 -0
  63. package/dist/core/events.d.ts +78 -0
  64. package/dist/core/events.d.ts.map +1 -0
  65. package/dist/core/events.js +8 -0
  66. package/dist/core/events.js.map +1 -0
  67. package/dist/core/format.d.ts +8 -0
  68. package/dist/core/format.d.ts.map +1 -0
  69. package/dist/core/format.js +28 -0
  70. package/dist/core/format.js.map +1 -0
  71. package/dist/core/frame.d.ts +4 -0
  72. package/dist/core/frame.d.ts.map +1 -0
  73. package/dist/core/frame.js +5 -0
  74. package/dist/core/frame.js.map +1 -0
  75. package/dist/core/strings.d.ts +3 -0
  76. package/dist/core/strings.d.ts.map +1 -0
  77. package/dist/core/strings.js +14 -0
  78. package/dist/core/strings.js.map +1 -0
  79. package/dist/core/tone.d.ts +8 -0
  80. package/dist/core/tone.d.ts.map +1 -0
  81. package/dist/core/tone.js +9 -0
  82. package/dist/core/tone.js.map +1 -0
  83. package/dist/count/count.d.ts +22 -0
  84. package/dist/count/count.d.ts.map +1 -0
  85. package/dist/count/count.js +60 -0
  86. package/dist/count/count.js.map +1 -0
  87. package/dist/count/elapsed.d.ts +18 -0
  88. package/dist/count/elapsed.d.ts.map +1 -0
  89. package/dist/count/elapsed.js +33 -0
  90. package/dist/count/elapsed.js.map +1 -0
  91. package/dist/count/index.d.ts +3 -0
  92. package/dist/count/index.d.ts.map +1 -0
  93. package/dist/count/index.js +5 -0
  94. package/dist/count/index.js.map +1 -0
  95. package/dist/define/all.d.ts +13 -0
  96. package/dist/define/all.d.ts.map +1 -0
  97. package/dist/define/all.js +14 -0
  98. package/dist/define/all.js.map +1 -0
  99. package/dist/define/charts.d.ts +8 -0
  100. package/dist/define/charts.d.ts.map +1 -0
  101. package/dist/define/charts.js +15 -0
  102. package/dist/define/charts.js.map +1 -0
  103. package/dist/define/check-table.d.ts +4 -0
  104. package/dist/define/check-table.d.ts.map +1 -0
  105. package/dist/define/check-table.js +7 -0
  106. package/dist/define/check-table.js.map +1 -0
  107. package/dist/define/count.d.ts +5 -0
  108. package/dist/define/count.d.ts.map +1 -0
  109. package/dist/define/count.js +9 -0
  110. package/dist/define/count.js.map +1 -0
  111. package/dist/define/data-table.d.ts +4 -0
  112. package/dist/define/data-table.d.ts.map +1 -0
  113. package/dist/define/data-table.js +7 -0
  114. package/dist/define/data-table.js.map +1 -0
  115. package/dist/define/graph.d.ts +6 -0
  116. package/dist/define/graph.d.ts.map +1 -0
  117. package/dist/define/graph.js +9 -0
  118. package/dist/define/graph.js.map +1 -0
  119. package/dist/define/json-tree.d.ts +4 -0
  120. package/dist/define/json-tree.d.ts.map +1 -0
  121. package/dist/define/json-tree.js +7 -0
  122. package/dist/define/json-tree.js.map +1 -0
  123. package/dist/define/lanes.d.ts +4 -0
  124. package/dist/define/lanes.d.ts.map +1 -0
  125. package/dist/define/lanes.js +7 -0
  126. package/dist/define/lanes.js.map +1 -0
  127. package/dist/define/markdown.d.ts +4 -0
  128. package/dist/define/markdown.d.ts.map +1 -0
  129. package/dist/define/markdown.js +7 -0
  130. package/dist/define/markdown.js.map +1 -0
  131. package/dist/define/matrix.d.ts +4 -0
  132. package/dist/define/matrix.d.ts.map +1 -0
  133. package/dist/define/matrix.js +7 -0
  134. package/dist/define/matrix.js.map +1 -0
  135. package/dist/define/segmented.d.ts +4 -0
  136. package/dist/define/segmented.d.ts.map +1 -0
  137. package/dist/define/segmented.js +7 -0
  138. package/dist/define/segmented.js.map +1 -0
  139. package/dist/define/tiles.d.ts +5 -0
  140. package/dist/define/tiles.d.ts.map +1 -0
  141. package/dist/define/tiles.js +9 -0
  142. package/dist/define/tiles.js.map +1 -0
  143. package/dist/define/transcript.d.ts +4 -0
  144. package/dist/define/transcript.d.ts.map +1 -0
  145. package/dist/define/transcript.js +7 -0
  146. package/dist/define/transcript.js.map +1 -0
  147. package/dist/graph/arrange.d.ts +43 -0
  148. package/dist/graph/arrange.d.ts.map +1 -0
  149. package/dist/graph/arrange.js +390 -0
  150. package/dist/graph/arrange.js.map +1 -0
  151. package/dist/graph/card.d.ts +71 -0
  152. package/dist/graph/card.d.ts.map +1 -0
  153. package/dist/graph/card.js +185 -0
  154. package/dist/graph/card.js.map +1 -0
  155. package/dist/graph/host.d.ts +82 -0
  156. package/dist/graph/host.d.ts.map +1 -0
  157. package/dist/graph/host.js +21 -0
  158. package/dist/graph/host.js.map +1 -0
  159. package/dist/graph/icons.d.ts +7 -0
  160. package/dist/graph/icons.d.ts.map +1 -0
  161. package/dist/graph/icons.js +18 -0
  162. package/dist/graph/icons.js.map +1 -0
  163. package/dist/graph/index.d.ts +15 -0
  164. package/dist/graph/index.d.ts.map +1 -0
  165. package/dist/graph/index.js +17 -0
  166. package/dist/graph/index.js.map +1 -0
  167. package/dist/graph/layered-graph.d.ts +226 -0
  168. package/dist/graph/layered-graph.d.ts.map +1 -0
  169. package/dist/graph/layered-graph.js +396 -0
  170. package/dist/graph/layered-graph.js.map +1 -0
  171. package/dist/graph/layout.d.ts +80 -0
  172. package/dist/graph/layout.d.ts.map +1 -0
  173. package/dist/graph/layout.js +264 -0
  174. package/dist/graph/layout.js.map +1 -0
  175. package/dist/graph/marks.d.ts +24 -0
  176. package/dist/graph/marks.d.ts.map +1 -0
  177. package/dist/graph/marks.js +38 -0
  178. package/dist/graph/marks.js.map +1 -0
  179. package/dist/graph/nav.d.ts +14 -0
  180. package/dist/graph/nav.d.ts.map +1 -0
  181. package/dist/graph/nav.js +14 -0
  182. package/dist/graph/nav.js.map +1 -0
  183. package/dist/graph/pan-zoom.d.ts +80 -0
  184. package/dist/graph/pan-zoom.d.ts.map +1 -0
  185. package/dist/graph/pan-zoom.js +191 -0
  186. package/dist/graph/pan-zoom.js.map +1 -0
  187. package/dist/graph/paths.d.ts +9 -0
  188. package/dist/graph/paths.d.ts.map +1 -0
  189. package/dist/graph/paths.js +44 -0
  190. package/dist/graph/paths.js.map +1 -0
  191. package/dist/graph/place-card.d.ts +36 -0
  192. package/dist/graph/place-card.d.ts.map +1 -0
  193. package/dist/graph/place-card.js +68 -0
  194. package/dist/graph/place-card.js.map +1 -0
  195. package/dist/graph/strings.d.ts +50 -0
  196. package/dist/graph/strings.d.ts.map +1 -0
  197. package/dist/graph/strings.js +37 -0
  198. package/dist/graph/strings.js.map +1 -0
  199. package/dist/graph/styles.d.ts +2 -0
  200. package/dist/graph/styles.d.ts.map +1 -0
  201. package/dist/graph/styles.js +203 -0
  202. package/dist/graph/styles.js.map +1 -0
  203. package/dist/graph/types.d.ts +184 -0
  204. package/dist/graph/types.d.ts.map +1 -0
  205. package/dist/graph/types.js +2 -0
  206. package/dist/graph/types.js.map +1 -0
  207. package/dist/graph/view.d.ts +17 -0
  208. package/dist/graph/view.d.ts.map +1 -0
  209. package/dist/graph/view.js +21 -0
  210. package/dist/graph/view.js.map +1 -0
  211. package/dist/graph/views/dag.d.ts +10 -0
  212. package/dist/graph/views/dag.d.ts.map +1 -0
  213. package/dist/graph/views/dag.js +292 -0
  214. package/dist/graph/views/dag.js.map +1 -0
  215. package/dist/graph/views/foot.d.ts +8 -0
  216. package/dist/graph/views/foot.d.ts.map +1 -0
  217. package/dist/graph/views/foot.js +103 -0
  218. package/dist/graph/views/foot.js.map +1 -0
  219. package/dist/graph/views/node-table.d.ts +17 -0
  220. package/dist/graph/views/node-table.d.ts.map +1 -0
  221. package/dist/graph/views/node-table.js +80 -0
  222. package/dist/graph/views/node-table.js.map +1 -0
  223. package/dist/index.d.ts +22 -0
  224. package/dist/index.d.ts.map +1 -0
  225. package/dist/index.js +26 -0
  226. package/dist/index.js.map +1 -0
  227. package/dist/json/index.d.ts +2 -0
  228. package/dist/json/index.d.ts.map +1 -0
  229. package/dist/json/index.js +3 -0
  230. package/dist/json/index.js.map +1 -0
  231. package/dist/json/json-tree.d.ts +21 -0
  232. package/dist/json/json-tree.d.ts.map +1 -0
  233. package/dist/json/json-tree.js +51 -0
  234. package/dist/json/json-tree.js.map +1 -0
  235. package/dist/lanes/index.d.ts +5 -0
  236. package/dist/lanes/index.d.ts.map +1 -0
  237. package/dist/lanes/index.js +7 -0
  238. package/dist/lanes/index.js.map +1 -0
  239. package/dist/lanes/lanes.d.ts +56 -0
  240. package/dist/lanes/lanes.d.ts.map +1 -0
  241. package/dist/lanes/lanes.js +160 -0
  242. package/dist/lanes/lanes.js.map +1 -0
  243. package/dist/lanes/stack.d.ts +26 -0
  244. package/dist/lanes/stack.d.ts.map +1 -0
  245. package/dist/lanes/stack.js +43 -0
  246. package/dist/lanes/stack.js.map +1 -0
  247. package/dist/lanes/styles.d.ts +2 -0
  248. package/dist/lanes/styles.d.ts.map +1 -0
  249. package/dist/lanes/styles.js +30 -0
  250. package/dist/lanes/styles.js.map +1 -0
  251. package/dist/lanes/types.d.ts +41 -0
  252. package/dist/lanes/types.d.ts.map +1 -0
  253. package/dist/lanes/types.js +6 -0
  254. package/dist/lanes/types.js.map +1 -0
  255. package/dist/markdown/cae-markdown.d.ts +37 -0
  256. package/dist/markdown/cae-markdown.d.ts.map +1 -0
  257. package/dist/markdown/cae-markdown.js +68 -0
  258. package/dist/markdown/cae-markdown.js.map +1 -0
  259. package/dist/markdown/highlight.d.ts +5 -0
  260. package/dist/markdown/highlight.d.ts.map +1 -0
  261. package/dist/markdown/highlight.js +86 -0
  262. package/dist/markdown/highlight.js.map +1 -0
  263. package/dist/markdown/index.d.ts +4 -0
  264. package/dist/markdown/index.d.ts.map +1 -0
  265. package/dist/markdown/index.js +6 -0
  266. package/dist/markdown/index.js.map +1 -0
  267. package/dist/markdown/markdown.d.ts +4 -0
  268. package/dist/markdown/markdown.d.ts.map +1 -0
  269. package/dist/markdown/markdown.js +105 -0
  270. package/dist/markdown/markdown.js.map +1 -0
  271. package/dist/matrix/grid-step.d.ts +8 -0
  272. package/dist/matrix/grid-step.d.ts.map +1 -0
  273. package/dist/matrix/grid-step.js +69 -0
  274. package/dist/matrix/grid-step.js.map +1 -0
  275. package/dist/matrix/index.d.ts +5 -0
  276. package/dist/matrix/index.d.ts.map +1 -0
  277. package/dist/matrix/index.js +7 -0
  278. package/dist/matrix/index.js.map +1 -0
  279. package/dist/matrix/mark-matrix.d.ts +97 -0
  280. package/dist/matrix/mark-matrix.d.ts.map +1 -0
  281. package/dist/matrix/mark-matrix.js +272 -0
  282. package/dist/matrix/mark-matrix.js.map +1 -0
  283. package/dist/matrix/styles.d.ts +4 -0
  284. package/dist/matrix/styles.d.ts.map +1 -0
  285. package/dist/matrix/styles.js +47 -0
  286. package/dist/matrix/styles.js.map +1 -0
  287. package/dist/matrix/types.d.ts +79 -0
  288. package/dist/matrix/types.d.ts.map +1 -0
  289. package/dist/matrix/types.js +5 -0
  290. package/dist/matrix/types.js.map +1 -0
  291. package/dist/primitives/fact-line.d.ts +14 -0
  292. package/dist/primitives/fact-line.d.ts.map +1 -0
  293. package/dist/primitives/fact-line.js +18 -0
  294. package/dist/primitives/fact-line.js.map +1 -0
  295. package/dist/primitives/icon.d.ts +14 -0
  296. package/dist/primitives/icon.d.ts.map +1 -0
  297. package/dist/primitives/icon.js +19 -0
  298. package/dist/primitives/icon.js.map +1 -0
  299. package/dist/primitives/index.d.ts +10 -0
  300. package/dist/primitives/index.d.ts.map +1 -0
  301. package/dist/primitives/index.js +13 -0
  302. package/dist/primitives/index.js.map +1 -0
  303. package/dist/primitives/legend.d.ts +28 -0
  304. package/dist/primitives/legend.d.ts.map +1 -0
  305. package/dist/primitives/legend.js +28 -0
  306. package/dist/primitives/legend.js.map +1 -0
  307. package/dist/primitives/pill.d.ts +23 -0
  308. package/dist/primitives/pill.d.ts.map +1 -0
  309. package/dist/primitives/pill.js +40 -0
  310. package/dist/primitives/pill.js.map +1 -0
  311. package/dist/primitives/roving-focus.d.ts +47 -0
  312. package/dist/primitives/roving-focus.d.ts.map +1 -0
  313. package/dist/primitives/roving-focus.js +111 -0
  314. package/dist/primitives/roving-focus.js.map +1 -0
  315. package/dist/primitives/segmented.d.ts +41 -0
  316. package/dist/primitives/segmented.d.ts.map +1 -0
  317. package/dist/primitives/segmented.js +88 -0
  318. package/dist/primitives/segmented.js.map +1 -0
  319. package/dist/primitives/share-bar.d.ts +37 -0
  320. package/dist/primitives/share-bar.d.ts.map +1 -0
  321. package/dist/primitives/share-bar.js +69 -0
  322. package/dist/primitives/share-bar.js.map +1 -0
  323. package/dist/primitives/states.d.ts +19 -0
  324. package/dist/primitives/states.d.ts.map +1 -0
  325. package/dist/primitives/states.js +11 -0
  326. package/dist/primitives/states.js.map +1 -0
  327. package/dist/primitives/window.d.ts +24 -0
  328. package/dist/primitives/window.d.ts.map +1 -0
  329. package/dist/primitives/window.js +56 -0
  330. package/dist/primitives/window.js.map +1 -0
  331. package/dist/styles/chips.d.ts +2 -0
  332. package/dist/styles/chips.d.ts.map +1 -0
  333. package/dist/styles/chips.js +18 -0
  334. package/dist/styles/chips.js.map +1 -0
  335. package/dist/styles/facts.d.ts +2 -0
  336. package/dist/styles/facts.d.ts.map +1 -0
  337. package/dist/styles/facts.js +7 -0
  338. package/dist/styles/facts.js.map +1 -0
  339. package/dist/styles/index.d.ts +16 -0
  340. package/dist/styles/index.d.ts.map +1 -0
  341. package/dist/styles/index.js +15 -0
  342. package/dist/styles/index.js.map +1 -0
  343. package/dist/styles/layout.d.ts +2 -0
  344. package/dist/styles/layout.d.ts.map +1 -0
  345. package/dist/styles/layout.js +33 -0
  346. package/dist/styles/layout.js.map +1 -0
  347. package/dist/styles/marks.d.ts +2 -0
  348. package/dist/styles/marks.d.ts.map +1 -0
  349. package/dist/styles/marks.js +30 -0
  350. package/dist/styles/marks.js.map +1 -0
  351. package/dist/styles/meter.d.ts +3 -0
  352. package/dist/styles/meter.d.ts.map +1 -0
  353. package/dist/styles/meter.js +9 -0
  354. package/dist/styles/meter.js.map +1 -0
  355. package/dist/styles/motion.d.ts +2 -0
  356. package/dist/styles/motion.d.ts.map +1 -0
  357. package/dist/styles/motion.js +27 -0
  358. package/dist/styles/motion.js.map +1 -0
  359. package/dist/styles/prose.d.ts +3 -0
  360. package/dist/styles/prose.d.ts.map +1 -0
  361. package/dist/styles/prose.js +59 -0
  362. package/dist/styles/prose.js.map +1 -0
  363. package/dist/styles/reset.d.ts +2 -0
  364. package/dist/styles/reset.d.ts.map +1 -0
  365. package/dist/styles/reset.js +13 -0
  366. package/dist/styles/reset.js.map +1 -0
  367. package/dist/styles/status.d.ts +2 -0
  368. package/dist/styles/status.d.ts.map +1 -0
  369. package/dist/styles/status.js +52 -0
  370. package/dist/styles/status.js.map +1 -0
  371. package/dist/styles/text.d.ts +2 -0
  372. package/dist/styles/text.d.ts.map +1 -0
  373. package/dist/styles/text.js +21 -0
  374. package/dist/styles/text.js.map +1 -0
  375. package/dist/styles/tokens.d.ts +8 -0
  376. package/dist/styles/tokens.d.ts.map +1 -0
  377. package/dist/styles/tokens.js +32 -0
  378. package/dist/styles/tokens.js.map +1 -0
  379. package/dist/table/data-table.d.ts +106 -0
  380. package/dist/table/data-table.d.ts.map +1 -0
  381. package/dist/table/data-table.js +408 -0
  382. package/dist/table/data-table.js.map +1 -0
  383. package/dist/table/index.d.ts +4 -0
  384. package/dist/table/index.d.ts.map +1 -0
  385. package/dist/table/index.js +6 -0
  386. package/dist/table/index.js.map +1 -0
  387. package/dist/table/styles.d.ts +2 -0
  388. package/dist/table/styles.d.ts.map +1 -0
  389. package/dist/table/styles.js +32 -0
  390. package/dist/table/styles.js.map +1 -0
  391. package/dist/table/types.d.ts +48 -0
  392. package/dist/table/types.d.ts.map +1 -0
  393. package/dist/table/types.js +30 -0
  394. package/dist/table/types.js.map +1 -0
  395. package/dist/themes/boot.d.ts +7 -0
  396. package/dist/themes/boot.d.ts.map +1 -0
  397. package/dist/themes/boot.js +14 -0
  398. package/dist/themes/boot.js.map +1 -0
  399. package/dist/themes/choice.d.ts +16 -0
  400. package/dist/themes/choice.d.ts.map +1 -0
  401. package/dist/themes/choice.js +45 -0
  402. package/dist/themes/choice.js.map +1 -0
  403. package/dist/themes/data.d.ts +43 -0
  404. package/dist/themes/data.d.ts.map +1 -0
  405. package/dist/themes/data.js +408 -0
  406. package/dist/themes/data.js.map +1 -0
  407. package/dist/themes/index.d.ts +7 -0
  408. package/dist/themes/index.d.ts.map +1 -0
  409. package/dist/themes/index.js +11 -0
  410. package/dist/themes/index.js.map +1 -0
  411. package/dist/themes/sheet.d.ts +16 -0
  412. package/dist/themes/sheet.d.ts.map +1 -0
  413. package/dist/themes/sheet.js +28 -0
  414. package/dist/themes/sheet.js.map +1 -0
  415. package/dist/themes/token-meanings.d.ts +3 -0
  416. package/dist/themes/token-meanings.d.ts.map +1 -0
  417. package/dist/themes/token-meanings.js +67 -0
  418. package/dist/themes/token-meanings.js.map +1 -0
  419. package/dist/themes/tokens-list.d.ts +14 -0
  420. package/dist/themes/tokens-list.d.ts.map +1 -0
  421. package/dist/themes/tokens-list.js +69 -0
  422. package/dist/themes/tokens-list.js.map +1 -0
  423. package/dist/tiles/index.d.ts +4 -0
  424. package/dist/tiles/index.d.ts.map +1 -0
  425. package/dist/tiles/index.js +6 -0
  426. package/dist/tiles/index.js.map +1 -0
  427. package/dist/tiles/stat-tiles.d.ts +40 -0
  428. package/dist/tiles/stat-tiles.d.ts.map +1 -0
  429. package/dist/tiles/stat-tiles.js +99 -0
  430. package/dist/tiles/stat-tiles.js.map +1 -0
  431. package/dist/tiles/styles.d.ts +2 -0
  432. package/dist/tiles/styles.d.ts.map +1 -0
  433. package/dist/tiles/styles.js +23 -0
  434. package/dist/tiles/styles.js.map +1 -0
  435. package/dist/tiles/types.d.ts +22 -0
  436. package/dist/tiles/types.d.ts.map +1 -0
  437. package/dist/tiles/types.js +2 -0
  438. package/dist/tiles/types.js.map +1 -0
  439. package/dist/transcript/follow-scroll.d.ts +21 -0
  440. package/dist/transcript/follow-scroll.d.ts.map +1 -0
  441. package/dist/transcript/follow-scroll.js +76 -0
  442. package/dist/transcript/follow-scroll.js.map +1 -0
  443. package/dist/transcript/index.d.ts +5 -0
  444. package/dist/transcript/index.d.ts.map +1 -0
  445. package/dist/transcript/index.js +7 -0
  446. package/dist/transcript/index.js.map +1 -0
  447. package/dist/transcript/styles.d.ts +2 -0
  448. package/dist/transcript/styles.d.ts.map +1 -0
  449. package/dist/transcript/styles.js +114 -0
  450. package/dist/transcript/styles.js.map +1 -0
  451. package/dist/transcript/tags.d.ts +6 -0
  452. package/dist/transcript/tags.d.ts.map +1 -0
  453. package/dist/transcript/tags.js +13 -0
  454. package/dist/transcript/tags.js.map +1 -0
  455. package/dist/transcript/tool-card.d.ts +16 -0
  456. package/dist/transcript/tool-card.d.ts.map +1 -0
  457. package/dist/transcript/tool-card.js +87 -0
  458. package/dist/transcript/tool-card.js.map +1 -0
  459. package/dist/transcript/transcript.d.ts +103 -0
  460. package/dist/transcript/transcript.d.ts.map +1 -0
  461. package/dist/transcript/transcript.js +397 -0
  462. package/dist/transcript/transcript.js.map +1 -0
  463. package/dist/transcript/types.d.ts +161 -0
  464. package/dist/transcript/types.d.ts.map +1 -0
  465. package/dist/transcript/types.js +25 -0
  466. package/dist/transcript/types.js.map +1 -0
  467. package/docs/charts.md +58 -0
  468. package/docs/check-table.md +40 -0
  469. package/docs/data-table.md +57 -0
  470. package/docs/examples/charts.ts +61 -0
  471. package/docs/examples/check-table.ts +19 -0
  472. package/docs/examples/ci-pipeline.ts +271 -0
  473. package/docs/examples/data-table.ts +39 -0
  474. package/docs/examples/graph.ts +57 -0
  475. package/docs/examples/lanes.ts +40 -0
  476. package/docs/examples/matrix.ts +56 -0
  477. package/docs/examples/page.css +34 -0
  478. package/docs/examples/segmented.ts +18 -0
  479. package/docs/examples/status.ts +30 -0
  480. package/docs/examples/theme.css +54 -0
  481. package/docs/examples/tiles.ts +27 -0
  482. package/docs/examples/transcript.ts +59 -0
  483. package/docs/graph.md +112 -0
  484. package/docs/lanes.md +48 -0
  485. package/docs/matrix.md +34 -0
  486. package/docs/page.md +87 -0
  487. package/docs/primitives.md +57 -0
  488. package/docs/strings.md +16 -0
  489. package/docs/theming.md +147 -0
  490. package/docs/tiles.md +40 -0
  491. package/docs/transcript.md +73 -0
  492. package/docs/tsconfig.json +20 -0
  493. package/package.json +161 -4
  494. package/src/charts/bar-chart.ts +74 -0
  495. package/src/charts/base.ts +188 -0
  496. package/src/charts/column-chart.ts +153 -0
  497. package/src/charts/heatmap.ts +129 -0
  498. package/src/charts/index.ts +10 -0
  499. package/src/charts/line-chart.ts +128 -0
  500. package/src/charts/scale.ts +61 -0
  501. package/src/charts/state-grid.ts +245 -0
  502. package/src/charts/types.ts +48 -0
  503. package/src/checks/check-table.ts +85 -0
  504. package/src/checks/index.ts +5 -0
  505. package/src/checks/styles.ts +31 -0
  506. package/src/checks/types.ts +48 -0
  507. package/src/core/clock.ts +46 -0
  508. package/src/core/define.ts +7 -0
  509. package/src/core/events.ts +89 -0
  510. package/src/core/format.ts +25 -0
  511. package/src/core/frame.ts +5 -0
  512. package/src/core/strings.ts +11 -0
  513. package/src/core/tone.ts +14 -0
  514. package/src/count/count.ts +54 -0
  515. package/src/count/elapsed.ts +33 -0
  516. package/src/count/index.ts +4 -0
  517. package/src/define/all.ts +13 -0
  518. package/src/define/charts.ts +17 -0
  519. package/src/define/check-table.ts +9 -0
  520. package/src/define/count.ts +11 -0
  521. package/src/define/data-table.ts +9 -0
  522. package/src/define/graph.ts +11 -0
  523. package/src/define/json-tree.ts +9 -0
  524. package/src/define/lanes.ts +9 -0
  525. package/src/define/markdown.ts +9 -0
  526. package/src/define/matrix.ts +9 -0
  527. package/src/define/segmented.ts +9 -0
  528. package/src/define/tiles.ts +11 -0
  529. package/src/define/transcript.ts +9 -0
  530. package/src/graph/arrange.ts +399 -0
  531. package/src/graph/card.ts +209 -0
  532. package/src/graph/host.ts +100 -0
  533. package/src/graph/icons.ts +23 -0
  534. package/src/graph/index.ts +16 -0
  535. package/src/graph/layered-graph.ts +417 -0
  536. package/src/graph/layout.ts +331 -0
  537. package/src/graph/marks.ts +42 -0
  538. package/src/graph/nav.ts +19 -0
  539. package/src/graph/pan-zoom.ts +219 -0
  540. package/src/graph/paths.ts +41 -0
  541. package/src/graph/place-card.ts +93 -0
  542. package/src/graph/strings.ts +86 -0
  543. package/src/graph/styles.ts +204 -0
  544. package/src/graph/types.ts +202 -0
  545. package/src/graph/view.ts +28 -0
  546. package/src/graph/views/dag.ts +294 -0
  547. package/src/graph/views/foot.ts +109 -0
  548. package/src/graph/views/node-table.ts +90 -0
  549. package/src/index.ts +25 -0
  550. package/src/json/index.ts +2 -0
  551. package/src/json/json-tree.ts +49 -0
  552. package/src/lanes/index.ts +6 -0
  553. package/src/lanes/lanes.ts +143 -0
  554. package/src/lanes/stack.ts +51 -0
  555. package/src/lanes/styles.ts +30 -0
  556. package/src/lanes/types.ts +51 -0
  557. package/src/markdown/cae-markdown.ts +64 -0
  558. package/src/markdown/highlight.ts +94 -0
  559. package/src/markdown/index.ts +5 -0
  560. package/src/markdown/markdown.ts +110 -0
  561. package/src/matrix/grid-step.ts +58 -0
  562. package/src/matrix/index.ts +6 -0
  563. package/src/matrix/mark-matrix.ts +285 -0
  564. package/src/matrix/styles.ts +48 -0
  565. package/src/matrix/types.ts +83 -0
  566. package/src/primitives/fact-line.ts +26 -0
  567. package/src/primitives/icon.ts +26 -0
  568. package/src/primitives/index.ts +12 -0
  569. package/src/primitives/legend.ts +56 -0
  570. package/src/primitives/pill.ts +58 -0
  571. package/src/primitives/roving-focus.ts +138 -0
  572. package/src/primitives/segmented.ts +92 -0
  573. package/src/primitives/share-bar.ts +94 -0
  574. package/src/primitives/states.ts +28 -0
  575. package/src/primitives/window.ts +65 -0
  576. package/src/styles/chips.ts +18 -0
  577. package/src/styles/facts.ts +7 -0
  578. package/src/styles/index.ts +19 -0
  579. package/src/styles/layout.ts +33 -0
  580. package/src/styles/marks.ts +30 -0
  581. package/src/styles/meter.ts +9 -0
  582. package/src/styles/motion.ts +27 -0
  583. package/src/styles/prose.ts +59 -0
  584. package/src/styles/reset.ts +13 -0
  585. package/src/styles/status.ts +52 -0
  586. package/src/styles/text.ts +21 -0
  587. package/src/styles/tokens.ts +35 -0
  588. package/src/table/data-table.ts +367 -0
  589. package/src/table/index.ts +5 -0
  590. package/src/table/styles.ts +32 -0
  591. package/src/table/types.ts +73 -0
  592. package/src/themes/boot.ts +14 -0
  593. package/src/themes/choice.ts +47 -0
  594. package/src/themes/data.ts +433 -0
  595. package/src/themes/index.ts +10 -0
  596. package/src/themes/sheet.ts +29 -0
  597. package/src/themes/token-meanings.ts +67 -0
  598. package/src/themes/tokens-list.ts +82 -0
  599. package/src/tiles/index.ts +5 -0
  600. package/src/tiles/stat-tiles.ts +92 -0
  601. package/src/tiles/styles.ts +23 -0
  602. package/src/tiles/types.ts +20 -0
  603. package/src/transcript/follow-scroll.ts +72 -0
  604. package/src/transcript/index.ts +6 -0
  605. package/src/transcript/styles.ts +114 -0
  606. package/src/transcript/tags.ts +18 -0
  607. package/src/transcript/tool-card.ts +103 -0
  608. package/src/transcript/transcript.ts +358 -0
  609. package/src/transcript/types.ts +167 -0
@@ -0,0 +1,358 @@
1
+ import { LitElement, html, nothing, type PropertyValues, type TemplateResult } from 'lit';
2
+ import { property, query, state } from 'lit/decorators.js';
3
+ import { keyed } from 'lit/directives/keyed.js';
4
+ import { repeat } from 'lit/directives/repeat.js';
5
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
6
+ import { emit } from '../core/events.js';
7
+ import { withDefaults } from '../core/strings.js';
8
+ import { toneAttr } from '../core/tone.js';
9
+ import { base, prose } from '../styles/index.js';
10
+ import { FollowScroll } from './follow-scroll.js';
11
+ import { transcriptStyles } from './styles.js';
12
+ import { tagChips, tagStyles } from './tags.js';
13
+ import { toolCard, type CardHost } from './tool-card.js';
14
+ import {
15
+ DEFAULT_TRANSCRIPT_STRINGS,
16
+ type TranscriptDetail,
17
+ type TranscriptItem,
18
+ type TranscriptMemory,
19
+ type TranscriptSection,
20
+ type TranscriptStrings,
21
+ } from './types.js';
22
+
23
+ const reducedMotion = (): boolean => globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
24
+
25
+ /**
26
+ * A conversation with an agent, in sections (one session each): chat bubbles,
27
+ * reasoning, notices and collapsible tool cards (a web search lists the pages
28
+ * it returned as links). Above two sections, a picker shows one at a time;
29
+ * the latest is followed unless `shown` names another. While the reader is at
30
+ * the bottom, new content scrolls into view; once they scroll up, it stays,
31
+ * and a button counts what arrived below. A new section that starts while
32
+ * they read the latest one keeps the one they read on screen.
33
+ *
34
+ * Give it a new element (or set `loading` until the content arrives) for
35
+ * another transcript: what the reader opened and where they were belong to one
36
+ * transcript, kept in `memory`.
37
+ *
38
+ * @tagname cae-transcript
39
+ * @fires cae-section-change - `{index}`: the reader picked a section (null: the latest)
40
+ * @fires cae-section-shown - `{index}`: the section on screen changed (-1: none)
41
+ * @fires cae-load-earlier - the reader asked for the content before `earlier`
42
+ * @csspart picker - the section picker
43
+ * @csspart section - the section shown
44
+ * @csspart tag - a chip at the head of the section
45
+ * @csspart bubble - a prompt, an answer, reasoning or an event
46
+ * @csspart notice - a line of the agent's log
47
+ * @csspart tool - a tool card
48
+ * @csspart tool-body - an open tool card's body
49
+ * @csspart verdict - the box after the items (`footer`)
50
+ */
51
+ export class CaeTranscript extends LitElement {
52
+ static override styles = [base, prose, tagStyles, transcriptStyles];
53
+
54
+ @property({ attribute: false }) sections: readonly TranscriptSection[] = [];
55
+ /** The section to show, 0-based; null follows the latest. */
56
+ @property({ attribute: false }) shown: number | null = null;
57
+ /** The transcript is still being written: it shows the agent working; a tool call with no result is running, not interrupted. */
58
+ @property({ type: Boolean }) live = false;
59
+ /** Lines before the content that are not loaded: above 0, a button asks for them (`cae-load-earlier`). */
60
+ @property({ type: Number }) earlier = 0;
61
+ /** The content has not arrived yet: the reader's position is restored once it has. */
62
+ @property({ type: Boolean }) loading = false;
63
+ /** How much the transcript holds, for the count of what arrived below; by default its sections and items. */
64
+ @property({ attribute: false }) count: number | null = null;
65
+ /** `full`; `tabs`: only the section picker; `none`: hidden. */
66
+ @property({ reflect: true }) mode: 'full' | 'tabs' | 'none' = 'full';
67
+ /** Where the open tool cards and the scroll position are kept. */
68
+ @property({ attribute: false }) memory: TranscriptMemory | null = null;
69
+ /** Markdown to safe HTML (the text escaped), for answers and reasoning; without it they show as plain text. */
70
+ @property({ attribute: false }) markdown: ((text: string) => string) | null = null;
71
+ /** Draws an open prose detail (a prompt); by default as `markdown`. */
72
+ @property({ attribute: false }) renderDetail: ((detail: TranscriptDetail) => unknown) | null = null;
73
+ @property({ attribute: false }) strings: Partial<TranscriptStrings> = {};
74
+
75
+ @state() private bulk = true;
76
+ @state() private unseen = 0;
77
+ /** A section kept on screen while the reader reads it and a new one starts (`shown` still says "latest"). */
78
+ @state() private pinned: number | null = null;
79
+ /** The card `reveal` asked for: scrolled to once it is drawn. */
80
+ @state() private revealed = '';
81
+ private revealPending = false;
82
+
83
+ @query('.scroller') private scroller?: HTMLElement;
84
+ private readonly follow = new FollowScroll(() => this.scroller);
85
+ private started = false;
86
+ private total = 0;
87
+ /** The next `sections` is the content again, from further back (`cae-load-earlier`). */
88
+ private reloading = false;
89
+ private lastShown = -1;
90
+ private readonly opened = new Set<string>();
91
+ private readonly folds = new Set<string>();
92
+ private readonly openDetails = new Set<string>();
93
+ private readonly mdCache = new Map<string, { raw: string; html: string }>();
94
+
95
+ /** The section on screen, 0-based; -1 with none. */
96
+ get shownIndex(): number {
97
+ const n = this.sections.length;
98
+ if (!n) return -1;
99
+ const want = this.shown ?? this.pinned ?? n - 1;
100
+ return Math.max(0, Math.min(n - 1, want));
101
+ }
102
+
103
+ /**
104
+ * Opens the tool card `id` and scrolls it into view once its section is shown.
105
+ * Returns that section's index (the host shows it), or -1 when no section has the card.
106
+ */
107
+ reveal(id: string): number {
108
+ const i = this.sections.findIndex((s) => s.items.some((it) => it.id === id));
109
+ if (i < 0) return -1;
110
+ this.setOpen(id, true);
111
+ this.pinned = null;
112
+ this.revealed = id;
113
+ this.revealPending = true;
114
+ this.requestUpdate();
115
+ return i;
116
+ }
117
+
118
+ private onLatest(): boolean {
119
+ const n = this.sections.length;
120
+ return n < 2 || this.shownIndex === n - 1;
121
+ }
122
+
123
+ private isOpen(id: string): boolean {
124
+ return this.memory ? this.memory.isOpen(id) : this.opened.has(id);
125
+ }
126
+
127
+ private setOpen(id: string, open: boolean): void {
128
+ if (this.memory) this.memory.setOpen(id, open);
129
+ else if (open) this.opened.add(id);
130
+ else this.opened.delete(id);
131
+ }
132
+
133
+ protected override willUpdate(changed: PropertyValues<this>): void {
134
+ const total = this.count ?? this.sections.reduce((n, s) => n + 1 + s.items.length, 0);
135
+ if (changed.has('sections')) {
136
+ const was = changed.get('sections')?.length ?? 0;
137
+ // A new section while the reader is scrolled up in the latest one: keep showing the one being read.
138
+ if (was && this.sections.length > was && this.shown === null && this.pinned === null && !this.follow.stick && !this.bulk)
139
+ this.pinned = was - 1;
140
+ if (this.reloading) {
141
+ this.reloading = false;
142
+ this.lastShown = -1;
143
+ this.total = total;
144
+ }
145
+ }
146
+ if (this.loading) return;
147
+ if (!this.started) {
148
+ this.started = true;
149
+ this.total = total;
150
+ void this.afterFirst();
151
+ } else if (total !== this.total) {
152
+ const n = total - this.total;
153
+ this.total = total;
154
+ if (n > 0)
155
+ void this.updateComplete.then(() => {
156
+ // New content glides into view, as a log does; at once with reduced motion.
157
+ if (this.follow.stick && this.onLatest()) this.follow.toBottom(!reducedMotion());
158
+ else this.unseen += n;
159
+ });
160
+ }
161
+ }
162
+
163
+ /** The first content is drawn without entry animations, then the reader is put back where they were. */
164
+ private async afterFirst(): Promise<void> {
165
+ await this.updateComplete;
166
+ await this.follow.restore(this.memory?.scroll(), () => !this.isConnected);
167
+ requestAnimationFrame(() => (this.bulk = false));
168
+ }
169
+
170
+ private onScroll(): void {
171
+ const at = this.follow.read();
172
+ if (!at) return;
173
+ if (this.follow.stick && this.onLatest()) this.unseen = 0;
174
+ if (this.follow.restored) this.memory?.setScroll(at);
175
+ }
176
+
177
+ protected override updated(changed: PropertyValues<this>): void {
178
+ const shown = this.shownIndex;
179
+ if (shown !== this.lastShown) {
180
+ const before = this.lastShown;
181
+ this.lastShown = shown;
182
+ if (before !== -1 && this.follow.restored) {
183
+ this.follow.toBottom();
184
+ // Another section in place of the one shown: it fades in once, the list as a whole.
185
+ if (!reducedMotion()) this.scroller?.animate?.([{ opacity: 0.25 }, { opacity: 1 }], { duration: 240, easing: 'ease-out' });
186
+ }
187
+ emit(this, 'cae-section-shown', { index: shown });
188
+ }
189
+ const prevMode = changed.get('mode');
190
+ // Shown again after another view: back to where the reader was.
191
+ if (prevMode && prevMode !== 'full' && this.mode === 'full') this.follow.reshow();
192
+ if (this.revealPending) {
193
+ const card = this.renderRoot.querySelector<HTMLElement>(`[data-card="${CSS.escape(this.revealed)}"]`);
194
+ if (card && this.mode === 'full') {
195
+ this.revealPending = false;
196
+ this.follow.stick = false;
197
+ card.scrollIntoView({ block: 'center' });
198
+ }
199
+ }
200
+ }
201
+
202
+ private pick(i: number): void {
203
+ this.pinned = null;
204
+ emit(this, 'cae-section-change', { index: i === this.sections.length - 1 ? null : i });
205
+ }
206
+
207
+ private toLatest(): void {
208
+ const n = this.sections.length;
209
+ if (n > 1 && this.shownIndex !== n - 1) {
210
+ this.pinned = null;
211
+ if (this.shown !== null) emit(this, 'cae-section-change', { index: null });
212
+ }
213
+ this.follow.stick = true;
214
+ this.unseen = 0;
215
+ void this.updateComplete.then(() => this.follow.toBottom(true));
216
+ }
217
+
218
+ private loadEarlier(): void {
219
+ this.reloading = true;
220
+ emit(this, 'cae-load-earlier', {});
221
+ }
222
+
223
+ override render() {
224
+ const s = withDefaults(DEFAULT_TRANSCRIPT_STRINGS, this.strings);
225
+ const sections = this.sections;
226
+ const shown = this.shownIndex;
227
+ const section = sections[shown];
228
+ const cards: CardHost = {
229
+ s,
230
+ live: this.live,
231
+ revealed: this.revealed,
232
+ folds: this.folds,
233
+ isOpen: (id) => this.isOpen(id),
234
+ toggle: (id) => {
235
+ this.setOpen(id, !this.isOpen(id));
236
+ this.requestUpdate();
237
+ },
238
+ requestUpdate: () => this.requestUpdate(),
239
+ };
240
+ return html`${this.renderPicker(sections, shown, s)}
241
+ <div class="scroller ${this.bulk ? 'bulk' : ''}" @scroll=${() => this.onScroll()}>
242
+ ${this.earlier
243
+ ? html`<div class="meta"><button type="button" class="back" @click=${() => this.loadEarlier()}>
244
+ ${s.loadEarlier(this.earlier)}</button></div>`
245
+ : nothing}
246
+ ${section ? keyed(section.id, this.renderSection(section, shown === sections.length - 1, s, cards)) : nothing}
247
+ ${!section && this.live ? this.typing(s) : nothing}
248
+ </div>
249
+ ${this.unseen
250
+ ? html`<button type="button" class="newpill" @click=${() => this.toLatest()}>
251
+ ${this.onLatest() ? s.newBelow(this.unseen) : s.newInLatest(this.unseen)}</button>`
252
+ : nothing}`;
253
+ }
254
+
255
+ private renderPicker(sections: readonly TranscriptSection[], shown: number, s: TranscriptStrings) {
256
+ if (sections.length < 2) return nothing;
257
+ return html`<div class="rounds" role="group" aria-label=${s.sections} part="picker">
258
+ <span class="rounds-lbl" title=${s.sectionsTip || nothing}>${s.sections}</span>
259
+ ${sections.map((sec, i) => {
260
+ const v = sec.verdict;
261
+ return html`<button type="button" class="stab ${i === shown ? 'sel' : ''}" title=${v?.tip || nothing} aria-pressed=${i === shown}
262
+ @click=${() => this.pick(i)}>
263
+ ${v ? html`<span class="mk ${v.tone === 'done' ? 'ok' : 'bad'}" aria-hidden="true">${v.tone === 'done' ? '✓' : '✕'}</span><span class="sr">${v.text}</span>` : nothing}${sec.title}
264
+ ${sec.facts?.length ? html` <span class="stab-m">${sec.facts.join(' | ')}</span>` : nothing}
265
+ ${sec.active ? html`<span class="dot" data-tone="running"></span>` : nothing}
266
+ </button>`;
267
+ })}
268
+ </div>`;
269
+ }
270
+
271
+ private renderSection(sec: TranscriptSection, isLast: boolean, s: TranscriptStrings, cards: CardHost) {
272
+ const f = sec.footer;
273
+ return html`<div class="inv-body" part="section">
274
+ ${sec.tags?.length || sec.details?.length ? this.renderHead(sec) : nothing}
275
+ ${repeat(sec.items, (it) => it.id, (it) => this.renderItem(it, s, cards))}
276
+ ${isLast && this.live ? this.typing(s) : nothing}
277
+ ${f
278
+ ? html`<div class="verdict" part="verdict" data-tone=${toneAttr(f.tone)}>
279
+ <b>${f.title}</b>
280
+ ${f.list?.length
281
+ ? html`<ul>${f.list.map((e) => html`<li>${e}</li>`)}</ul>`
282
+ : f.note
283
+ ? html`<span class="meta">${f.note}</span>`
284
+ : nothing}
285
+ </div>`
286
+ : nothing}
287
+ </div>`;
288
+ }
289
+
290
+ private renderHead(sec: TranscriptSection) {
291
+ return html`<div class="inv-head">
292
+ <div class="inv-who">${tagChips(sec.tags ?? [])}</div>
293
+ ${(sec.details ?? []).map((d) => (d.code ? html`<details class="inv-cmdbox"><summary>${d.summary}</summary><pre class="inv-cmd"><code>${d.text}</code></pre></details>` : this.renderProse(sec, d)))}
294
+ </div>`;
295
+ }
296
+
297
+ /** A prose detail is drawn only while it is open. */
298
+ private renderProse(sec: TranscriptSection, d: TranscriptDetail) {
299
+ const key = `${sec.id}:${d.id}`;
300
+ const open = this.openDetails.has(key);
301
+ return html`<details class="inv-prompt" ?open=${open}
302
+ @toggle=${(e: Event) => {
303
+ const on = (e.target as HTMLDetailsElement).open;
304
+ if (on === this.openDetails.has(key)) return;
305
+ if (on) this.openDetails.add(key);
306
+ else this.openDetails.delete(key);
307
+ this.requestUpdate();
308
+ }}>
309
+ <summary>${d.summary}</summary>
310
+ ${open ? html`<div class="inv-ptext">${this.renderDetail ? this.renderDetail(d) : html`<div class="tx">${this.md(key, d.text)}</div>`}</div>` : nothing}
311
+ </details>`;
312
+ }
313
+
314
+ private md(id: string, raw: string) {
315
+ if (!this.markdown) return raw;
316
+ const hit = this.mdCache.get(id);
317
+ if (hit?.raw === raw) return unsafeHTML(hit.html);
318
+ const out = this.markdown(raw);
319
+ this.mdCache.set(id, { raw, html: out });
320
+ return unsafeHTML(out);
321
+ }
322
+
323
+ private bubble(av: string, avCls: string, head: string, body: TemplateResult | string, title?: string) {
324
+ return html`<div class="msg" part="bubble" title=${title ?? nothing}>
325
+ <div class="av ${avCls}">${av}</div>
326
+ <div class="bd"><div class="hd">${head}</div>${body}</div>
327
+ </div>`;
328
+ }
329
+
330
+ private renderItem(it: TranscriptItem, s: TranscriptStrings, cards: CardHost) {
331
+ switch (it.type) {
332
+ case 'prompt':
333
+ return this.bubble('▸', 'av-l', s.prompt, html`<div class="tx meta">${s.characters(it.text.length)}</div>`, it.text.slice(0, 600));
334
+ case 'message':
335
+ return this.bubble('A', 'av-a', s.assistant, html`<div class="tx">${this.md(it.id, it.text)}</div>`);
336
+ case 'reasoning':
337
+ return this.bubble('✦', 'av-t', s.reasoning, html`<div class="tx">${this.md(it.id, it.text)}</div>`);
338
+ case 'event':
339
+ return html`<div class="msg" part="bubble"><div class="av av-t" aria-hidden="true">${it.icon}</div><div class="bd"><div class="hd">${it.title}</div>${it.text
340
+ ? html`<div class="tx meta">${it.text}</div>`
341
+ : nothing}</div></div>`;
342
+ case 'notice':
343
+ return html`<div class="sysline" part="notice"><span aria-hidden="true">⚙</span><span class="tx">${it.text}</span></div>`;
344
+ case 'tool':
345
+ return toolCard(cards, it);
346
+ }
347
+ }
348
+
349
+ private typing(s: TranscriptStrings) {
350
+ return html`<div class="typing"><span class="av av-a">A</span><span class="dots"><i></i><i></i><i></i></span><span class="meta">${s.running}</span></div>`;
351
+ }
352
+ }
353
+
354
+ declare global {
355
+ interface HTMLElementTagNameMap {
356
+ 'cae-transcript': CaeTranscript;
357
+ }
358
+ }
@@ -0,0 +1,167 @@
1
+ // What `<cae-transcript>` shows: a conversation with an agent in sections (one
2
+ // session each), each a list of items: chat bubbles, reasoning, notices and
3
+ // tool cards.
4
+ import type { Tone } from '../core/tone.js';
5
+
6
+ /** A page a tool returned (a web search's results). */
7
+ export interface ToolLink {
8
+ title: string;
9
+ url: string;
10
+ }
11
+
12
+ /** One tool call: the card that opens on its start and shows its result. */
13
+ export interface ToolCard {
14
+ type: 'tool';
15
+ id: string;
16
+ name: string;
17
+ /**
18
+ * The card's glyph: `bash`, `read`, `grep`, `glob`, `edit`, `write`, `task`
19
+ * or `agent`; any other key shows ⚒. A web search (`query`) and a page read
20
+ * (`page`) have their own. Set as `data-tool` on the card.
21
+ */
22
+ icon: string;
23
+ /** One line: the command, pattern, path or URL. */
24
+ summary: string;
25
+ /** Why the call was made, beside the summary. */
26
+ intent?: string;
27
+ /** A web search's query: shown above the pages it returned (`links`). */
28
+ query?: string;
29
+ /** A page the call read: its URL, a link when it is http(s). */
30
+ page?: string;
31
+ /** The command in full, above the output (not for a `query` or a `page`). */
32
+ body?: string;
33
+ /** The result; null while the call runs. */
34
+ output: string | null;
35
+ status: 'running' | 'ok' | 'error';
36
+ /** The pages the call returned: listed as links, and counted beside the summary. */
37
+ links?: readonly ToolLink[];
38
+ }
39
+
40
+ export type TranscriptItem =
41
+ /** A prompt sent to the agent: its length, the start of it as a tooltip. */
42
+ | { type: 'prompt'; id: string; text: string }
43
+ /** The agent's answer, in markdown. */
44
+ | { type: 'message'; id: string; text: string }
45
+ /** The model's reasoning, in markdown. */
46
+ | { type: 'reasoning'; id: string; text: string }
47
+ /** Something that happened in the session, as a bubble: a glyph, a title and a detail. */
48
+ | { type: 'event'; id: string; icon: string; title: string; text?: string }
49
+ /** A line of the agent's own log. */
50
+ | { type: 'notice'; id: string; text: string }
51
+ | ToolCard;
52
+
53
+ /** A labelled value in a section's head (who ran it). */
54
+ export interface TranscriptTag {
55
+ label: string;
56
+ value: string;
57
+ tip?: string;
58
+ /** `mono`: the value in the monospace font; `quiet`: monospace, muted and without a background. */
59
+ look?: 'mono' | 'quiet';
60
+ }
61
+
62
+ /** A folded text in a section's head: code (a command line) or prose (a prompt, drawn by `renderDetail`). */
63
+ export interface TranscriptDetail {
64
+ id: string;
65
+ summary: string;
66
+ text: string;
67
+ code?: boolean;
68
+ }
69
+
70
+ export interface TranscriptSection {
71
+ id: string;
72
+ /** Its name in the section picker. */
73
+ title: string;
74
+ /** Short facts after the title in the picker (a model). */
75
+ facts?: readonly string[];
76
+ /** How the section ended, in the picker: ✓ with tone `done`, else ✕; `text` for screen readers, `tip` as its tooltip. */
77
+ verdict?: { tone: Tone; text: string; tip?: string };
78
+ /** The section is still being written: a dot in the picker. */
79
+ active?: boolean;
80
+ /** Chips at the head of the section. */
81
+ tags?: readonly TranscriptTag[];
82
+ /** Folded texts at the head of the section. */
83
+ details?: readonly TranscriptDetail[];
84
+ items: readonly TranscriptItem[];
85
+ /** A box after the items: how the section ended, and a list (errors) or a note. */
86
+ footer?: { tone: Tone; title: string; list?: readonly string[]; note?: string };
87
+ }
88
+
89
+ /** Where the reader was in a transcript. */
90
+ export interface TranscriptScroll {
91
+ /** Following the end. */
92
+ stick: boolean;
93
+ top: number;
94
+ }
95
+
96
+ /**
97
+ * Where a host keeps what the reader did across visits: the open tool cards
98
+ * and the scroll position. Without one, they last as long as the element.
99
+ */
100
+ export interface TranscriptMemory {
101
+ isOpen(id: string): boolean;
102
+ setOpen(id: string, open: boolean): void;
103
+ /** The position to restore when the content first arrives; undefined: the end. */
104
+ scroll(): TranscriptScroll | undefined;
105
+ setScroll(at: TranscriptScroll): void;
106
+ }
107
+
108
+ export interface TranscriptStrings {
109
+ /** The section picker's name. */
110
+ sections: string;
111
+ /** The section picker's tooltip. */
112
+ sectionsTip: string;
113
+ /** The button above the content when `earlier` is above 0. */
114
+ loadEarlier: (n: number) => string;
115
+ /** The button shown when `n` items arrived below while the reader was scrolled up. */
116
+ newBelow: (n: number) => string;
117
+ /** As `newBelow`, while another section than the latest is shown. */
118
+ newInLatest: (n: number) => string;
119
+ prompt: string;
120
+ assistant: string;
121
+ reasoning: string;
122
+ characters: (n: number) => string;
123
+ /** A tool card's name when the call has none. */
124
+ tool: string;
125
+ /** The number of `links` beside a card's summary. */
126
+ results: (n: number) => string;
127
+ done: string;
128
+ failed: string;
129
+ running: string;
130
+ /** A call with no result in a transcript that is not `live`. */
131
+ interrupted: string;
132
+ interruptedTip: string;
133
+ /** The label of a web search's query. */
134
+ query: string;
135
+ /** The label of a page's URL. */
136
+ page: string;
137
+ /** The fold of a web search's full output under its links. */
138
+ fullText: string;
139
+ showAll: (n: number) => string;
140
+ showLess: string;
141
+ }
142
+
143
+ const plural = (n: number, one: string, many: string) => (n === 1 ? `1 ${one}` : `${n} ${many}`);
144
+
145
+ export const DEFAULT_TRANSCRIPT_STRINGS: Readonly<TranscriptStrings> = {
146
+ sections: 'Sessions',
147
+ sectionsTip: '',
148
+ loadEarlier: (n) => `Show ${plural(n, 'earlier line', 'earlier lines')}`,
149
+ newBelow: (n) => `Show ${plural(n, 'new event', 'new events')}`,
150
+ newInLatest: (n) => `Show ${plural(n, 'new event', 'new events')} in the latest session`,
151
+ prompt: 'Prompt',
152
+ assistant: 'Assistant',
153
+ reasoning: 'Reasoning',
154
+ characters: (n) => `${n} characters`,
155
+ tool: 'tool',
156
+ results: (n) => plural(n, 'result', 'results'),
157
+ done: 'done',
158
+ failed: 'failed',
159
+ running: 'running',
160
+ interrupted: 'interrupted',
161
+ interruptedTip: 'Ended with no result',
162
+ query: 'query',
163
+ page: 'page',
164
+ fullText: 'Full text',
165
+ showAll: (n) => `Show all (${n} characters)`,
166
+ showLess: 'Show less',
167
+ };