@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,417 @@
1
+ // A layered graph: nodes in layers, joined by edges, in clusters; each node a
2
+ // group of marks, one per series. The views are in `views/`.
3
+ import { LitElement, adoptStyles, html, nothing, type CSSResult, type PropertyValueMap, type PropertyValues } from 'lit';
4
+ import { keyed } from 'lit/directives/keyed.js';
5
+ import { emit } from '../core/events.js';
6
+ import { withDefaults } from '../core/strings.js';
7
+ import type { CaeMarkMatrix } from '../matrix/mark-matrix.js';
8
+ import type { MarkMatrixInput, MarkMatrixStrings } from '../matrix/types.js';
9
+ import { legendStyles } from '../primitives/legend.js';
10
+ import { icon } from '../primitives/icon.js';
11
+ import type { StateStyles } from '../primitives/states.js';
12
+ import { base, markStyles } from '../styles/index.js';
13
+ import { arrange } from './arrange.js';
14
+ import { CardController } from './card.js';
15
+ import { slotsOf, type GraphHost } from './host.js';
16
+ import { layoutGraph, type GraphLayout, type Size } from './layout.js';
17
+ import { BAR_MARKS, fillNode } from './marks.js';
18
+ import { PanZoomController } from './pan-zoom.js';
19
+ import { DEFAULT_LAYERED_GRAPH_STRINGS, type LayeredGraphStrings } from './strings.js';
20
+ import { graphStyles } from './styles.js';
21
+ import type { Arrangement, DrawnGraph, GraphClusterInput, GraphInput, GraphNode, GraphOrder } from './types.js';
22
+ import { dag } from './views/dag.js';
23
+ import { foot } from './views/foot.js';
24
+ import { nodeTable } from './views/node-table.js';
25
+
26
+ /** Below this width, `direction: 'auto'` draws top to bottom, without zoom. */
27
+ export const NARROW = 640;
28
+
29
+ /** The changes `willUpdate` reads: the properties, and the private `down`. */
30
+ type Changed = PropertyValues<CaeLayeredGraph> & PropertyValueMap<{ down: boolean }>;
31
+
32
+ const EMPTY: GraphInput = { series: [], nodes: [], clusters: [], edges: [], stubs: [] };
33
+
34
+ /**
35
+ * A layered graph: each node in a layer by the longest path to it, edges bending only
36
+ * in the gaps between layers and never passing a node or a cluster's label; a cluster
37
+ * of nodes in a box (a cluster in a cluster: a box in a box), with, when it `cycle`s,
38
+ * a dotted return from its last layer to its first; an edge from outside the graph
39
+ * from a named stub. Inside each node, one mark per series id, at the same place in
40
+ * every node, so a series can be followed across the graph; a mark is drawn in its
41
+ * state's look (`states`). Above `barAt` marks, a node shows a bar of its counts and
42
+ * lists its failed marks. The order depends on the structure only, and keeps a
43
+ * previous `order`: nodes that appear later are added at the end of their layer.
44
+ *
45
+ * A click selects a mark, a node or a cluster (`cae-select`); a card beside it (the
46
+ * host's content, in the `inspector` slot) moves with it as the graph pans and zooms,
47
+ * and hides while it is out of the frame; on a narrow screen it is a sheet under the
48
+ * frame. A double click or Enter is the item's action (`cae-activate`), or opens its
49
+ * inner view (`cae-drill`, for an item with `drill`). Hovering or focusing a mark
50
+ * highlights its series and what `related` names. The frame first shows the whole
51
+ * graph; Ctrl (or ⌘) and the wheel, or the buttons, zoom; dragging pans; "Show all"
52
+ * goes back. "Graph | Table" changes the view (`cae-view-change`): the table is a row
53
+ * per node, with its status and the nodes it is joined to. With `matrix`, the frame
54
+ * shows that `<cae-mark-matrix>` as the table instead.
55
+ *
56
+ * Size: the element is as wide as its container. Without a height set on it, the
57
+ * frame is as tall as the whole drawing at that width (never scaled up), up to 70% of
58
+ * the window's height or 360 px, whichever is more, and taller when the card needs
59
+ * it; top to bottom, as tall as the drawing. A height set on the element
60
+ * (or given it by a flex or grid container) is shared: the `crumbs` slot and the row
61
+ * under the frame keep theirs, and the frame takes the rest, the drawing fitted in it.
62
+ *
63
+ * Keyboard: Tab moves between nodes; the arrow keys, Home and End move between a
64
+ * node's marks, and a mark out of the frame is brought into it; Shift and an arrow
65
+ * key move along an edge to an earlier or a later node, on the same series; what has
66
+ * the focus is selected (Tab goes on to the card); Enter is the item's action; Escape
67
+ * clears the selection (and, with none, is left to the host).
68
+ *
69
+ * @tagname cae-layered-graph
70
+ * @fires cae-select - `{id}`: a mark, a node, a cluster or a table row was selected; `{id: null}`: the selection was cleared
71
+ * @fires cae-activate - `{id}`: an item's action (a double click or Enter)
72
+ * @fires cae-drill - `{id}`: an item's inner view (a double click or Enter on an item with `drill`, a cluster's chip in the table, a later part of a cluster's `path`)
73
+ * @fires cae-toggle - `{id, open}`: an item's open or close control (`toggle`) was used
74
+ * @fires cae-view-change - `{view}`: "Graph" or "Table" was chosen
75
+ * @slot inspector - the selected item's card: its first heading and its `[data-status]` name it to a screen reader
76
+ * @slot crumbs - a line above the frame (where the graph is)
77
+ * @csspart frame - the frame every view is drawn in
78
+ * @csspart stage - what pans and zooms
79
+ * @csspart node - each node
80
+ * @csspart node-header - a node's first line
81
+ * @csspart node-name - a node's name
82
+ * @csspart mark - each mark
83
+ * @csspart cluster - each cluster
84
+ * @csspart cluster-label - a cluster's header
85
+ * @csspart edge - each edge
86
+ * @csspart stub - each stub
87
+ * @csspart legend - the legend
88
+ * @csspart keys - the line of key hints under the legend
89
+ * @csspart inspector - the selected item's card
90
+ * @csspart table - the node table
91
+ * @csspart row - each row of the node table
92
+ */
93
+ export class CaeLayeredGraph extends LitElement {
94
+ static override styles = [base, markStyles, legendStyles, graphStyles];
95
+ static override properties = {
96
+ graph: { attribute: false },
97
+ states: { attribute: false },
98
+ selected: { attribute: false },
99
+ highlight: { attribute: false },
100
+ order: { attribute: false },
101
+ key: {},
102
+ direction: {},
103
+ view: {},
104
+ matrix: { attribute: false },
105
+ barAt: { type: Number },
106
+ related: { attribute: false },
107
+ strings: { attribute: false },
108
+ matrixStrings: { attribute: false },
109
+ renderIcon: { attribute: false },
110
+ iconStyles: { attribute: false },
111
+ hover: { state: true },
112
+ down: { state: true },
113
+ lay: { state: true },
114
+ announced: { state: true },
115
+ };
116
+
117
+ graph: GraphInput = EMPTY;
118
+ states: StateStyles = {};
119
+ /** The selected item's id (a mark's, a node's or a cluster's), or null. */
120
+ selected: string | null = null;
121
+ /** The series highlighted while no mark is hovered, focused or selected. */
122
+ highlight: string | null = null;
123
+ /** The order of an earlier drawing of this graph (`arrange(...).order`): its items stay where they are. */
124
+ order: GraphOrder | undefined = undefined;
125
+ /** The graph's identity: a new key is a new graph (the frame shows all of it again); the same key while the graph changes keeps the zoom and pan. */
126
+ key = '';
127
+ /** Left to right, top to bottom, or by the width (`auto`: top to bottom below `NARROW` px). */
128
+ direction: 'auto' | 'across' | 'down' = 'auto';
129
+ /** The node table instead of the drawing. */
130
+ view: 'graph' | 'table' = 'graph';
131
+ /** A mark matrix shown in the frame as the table, or null. */
132
+ matrix: MarkMatrixInput | null = null;
133
+ /** Above this many marks, a node shows a bar of its counts. */
134
+ barAt = BAR_MARKS;
135
+ /** The marks a hovered or selected series (or a mark's id, outside any series) lights; default: its own. */
136
+ related: ((key: string) => ReadonlySet<string>) | undefined = undefined;
137
+ strings: Partial<LayeredGraphStrings> = {};
138
+ matrixStrings: Partial<MarkMatrixStrings> = {};
139
+ /** Draws an icon of a node, a matrix header and the legend; default: `icon(name)`. */
140
+ renderIcon: (name: string) => unknown = (name) => icon(name);
141
+ /** Styles for what `renderIcon` draws, added to the element's own. */
142
+ iconStyles: readonly CSSResult[] = [];
143
+
144
+ /** The series (or a mark's id) under the pointer or focus. */
145
+ private hover: string | null = null;
146
+ /** Top to bottom. */
147
+ private down = false;
148
+ /** Where everything is drawn, from the sizes measured after the last render. */
149
+ private lay: GraphLayout | null = null;
150
+ /** What the live region says: the item just selected, and its status. */
151
+ private announced = '';
152
+
153
+ private arr: Arrangement = arrange(EMPTY);
154
+ private words: LayeredGraphStrings = DEFAULT_LAYERED_GRAPH_STRINGS;
155
+ /** The graph, its nodes with their defaults. */
156
+ private drawn: DrawnGraph = { ...EMPTY, nodes: [] };
157
+ private nodes = new Map<string, GraphNode>();
158
+ private clusters = new Map<string, GraphClusterInput>();
159
+ /** Each mark's series ('' outside any series), by its id. */
160
+ private markSeries = new Map<string, string>();
161
+ /** Each group's focused mark (roving tabindex): one tab stop per group. */
162
+ private readonly active = new Map<string, number>();
163
+ /** What the sizes were last measured for, what the layout was computed from, and the graph it is of. */
164
+ private measured: { graph: GraphInput; key: string } | null = null;
165
+ private layKey = '';
166
+ private layFor: string | null = null;
167
+ private litCache: { key: string | null; graph: GraphInput; related: unknown; on: ReadonlySet<string> | null } | null = null;
168
+ private scrolled: Element | null = null;
169
+
170
+ private readonly pz = new PanZoomController(this, {
171
+ frame: () => this.renderRoot.querySelector<HTMLElement>('.frame'),
172
+ stage: () => this.renderRoot.querySelector<HTMLElement>('.stage'),
173
+ drawing: () => (this.lay && !this.matrix ? { w: this.lay.w, h: this.lay.h, down: this.down, room: this.card.room } : null),
174
+ wheel: () => this.view !== 'table' && !this.matrix,
175
+ down: () => this.down,
176
+ onMove: () => this.card.place(),
177
+ onResize: () => {
178
+ this.fit();
179
+ this.card.place();
180
+ },
181
+ });
182
+
183
+ private readonly card: CardController = new CardController(this, {
184
+ docked: () => this.down,
185
+ frameH: () => this.pz.frameH,
186
+ // A mark matrix: the frame's least height holds the card.
187
+ grow: () => (this.matrix ? this.requestUpdate() : this.fit()),
188
+ pressed: () => this.pz.pressed,
189
+ inner: () => this.matrixEl()?.renderRoot ?? null,
190
+ });
191
+
192
+ /** This element as its views see it (`host.ts`), its private members included. */
193
+ private readonly h = this as unknown as GraphHost;
194
+
195
+ private matrixEl(): CaeMarkMatrix | null {
196
+ return this.renderRoot.querySelector<CaeMarkMatrix>('cae-mark-matrix');
197
+ }
198
+
199
+ protected override willUpdate(changed: Changed): void {
200
+ if (changed.has('key') && changed.get('key') !== undefined) {
201
+ this.pz.reset();
202
+ this.active.clear();
203
+ }
204
+ if (changed.has('strings')) this.words = withDefaults(DEFAULT_LAYERED_GRAPH_STRINGS, this.strings);
205
+ if (changed.has('direction') && this.direction !== 'auto') this.down = this.direction === 'down';
206
+ if (changed.has('graph') || changed.has('order') || changed.has('down') || changed.has('direction')) {
207
+ this.arr = arrange(this.graph, this.order, this.down);
208
+ this.clusters = new Map(this.graph.clusters.map((c) => [c.id, c]));
209
+ }
210
+ if (changed.has('graph') || changed.has('states') || changed.has('strings')) {
211
+ const g = this.graph;
212
+ this.drawn = { ...g, nodes: g.nodes.map((n) => fillNode(n, this.states, this.words.progress)) };
213
+ this.nodes = new Map(this.drawn.nodes.map((n) => [n.id, n]));
214
+ this.markSeries = new Map(this.drawn.nodes.flatMap((n) => slotsOf(n, g.series).flatMap((s) => (s ? [[s.m.id, s.series] as const] : []))));
215
+ }
216
+ }
217
+
218
+ override connectedCallback(): void {
219
+ super.connectedCallback();
220
+ this.addEventListener('keydown', this.onEscape);
221
+ }
222
+
223
+ override disconnectedCallback(): void {
224
+ super.disconnectedCallback();
225
+ this.removeEventListener('keydown', this.onEscape);
226
+ }
227
+
228
+
229
+ protected override updated(changed: PropertyValues<this>): void {
230
+ if (changed.has('iconStyles') && this.renderRoot instanceof ShadowRoot)
231
+ adoptStyles(this.renderRoot, [...(this.constructor as typeof LitElement).elementStyles, ...this.iconStyles]);
232
+ const mx = this.matrixEl();
233
+ if (mx && mx !== this.scrolled) {
234
+ // A scroll inside the matrix moves the selected mark: the card follows it.
235
+ this.scrolled = mx;
236
+ mx.renderRoot.addEventListener('scroll', () => this.card.place(), { capture: true });
237
+ }
238
+ this.place();
239
+ this.card.place();
240
+ if (changed.has('selected')) this.selectionChanged();
241
+ }
242
+
243
+ /**
244
+ * Put the focus on an item without selecting it: a node (its focused mark, else its
245
+ * name) or a cluster (its name); with null, or when it is not drawn, on the first
246
+ * thing to focus (in the `crumbs` slot, else the first node).
247
+ */
248
+ /** Put the focus on an item's open or close control (`toggle`), else on the item: where it was after the item was drawn again. */
249
+ focusToggle(id: string, tries = 4): void {
250
+ const root = this.renderRoot;
251
+ // A drawing of a new structure is first drawn hidden, to be measured: focus it once it is placed.
252
+ if (root.querySelector('.dag.unplaced') && tries > 0) {
253
+ void this.updateComplete.then(() => requestAnimationFrame(() => this.focusToggle(id, tries - 1)));
254
+ return;
255
+ }
256
+ const sel = this.clusters.has(id) ? `.cluster[data-cluster="${CSS.escape(id)}"] > .cue .tog` : `.node[data-id="${CSS.escape(id)}"] .tog`;
257
+ const el = root.querySelector<HTMLElement>(sel);
258
+ if (el) this.card.focusQuietly(el);
259
+ else this.focusItem(id);
260
+ }
261
+
262
+ focusItem(id: string | null): void {
263
+ const root = this.renderRoot;
264
+ let el: HTMLElement | null = null;
265
+ if (id && this.clusters.has(id)) el = root.querySelector<HTMLElement>(`.cluster[data-cluster="${CSS.escape(id)}"] > .hd .name`);
266
+ else if (id) el = root.querySelector<HTMLElement>(`.node[data-id="${CSS.escape(id)}"] [tabindex="0"]`);
267
+ const crumbs = root.querySelector<HTMLSlotElement>('slot[name="crumbs"]')?.assignedElements({ flatten: true }) ?? [];
268
+ const first = () =>
269
+ crumbs.map((c) => (c.matches('button') ? (c as HTMLElement) : c.querySelector<HTMLElement>('button'))).find(Boolean) ??
270
+ root.querySelector<HTMLElement>('.mark[tabindex="0"], .node .name') ??
271
+ this.matrixEl()?.renderRoot.querySelector<HTMLElement>('.mark[tabindex="0"]') ??
272
+ null;
273
+ this.card.focusQuietly(el ?? first());
274
+ }
275
+
276
+ /** After a new selection: the card describes the item, the live region names it, and on a narrow screen the item is scrolled into view. */
277
+ private selectionChanged(): void {
278
+ const [name, status] = this.card.describe();
279
+ const said = name ? [name, status].filter(Boolean).join(' | ') : '';
280
+ if (said !== this.announced) this.announced = said;
281
+ if (this.down) this.card.whenReleased(() => this.card.revealOverSheet());
282
+ }
283
+
284
+ /** Measure what was drawn when the graph or the width changed; lay it out again when the structure or a size changed. */
285
+ private place(): void {
286
+ const dagEl = this.renderRoot.querySelector<HTMLElement>('.dag');
287
+ if (!dagEl) return;
288
+ const g = this.graph;
289
+ const seen = `${this.down}|${this.clientWidth}`;
290
+ if (this.measured?.graph === g && this.measured.key === seen) return this.fit();
291
+ this.measured = { graph: g, key: seen };
292
+ const sizes = new Map<string, Size>();
293
+ for (const el of dagEl.querySelectorAll<HTMLElement>('[data-id]')) sizes.set(el.dataset['id'] ?? '', { w: el.offsetWidth, h: el.offsetHeight });
294
+ const a = this.arr;
295
+ const key = JSON.stringify([this.key, a.slots, a.edgePaths.map((r) => r.steps.map((s) => s.id)), this.down, [...sizes]]);
296
+ if (key === this.layKey) return this.fit();
297
+ this.layKey = key;
298
+ this.layFor = this.key;
299
+ this.lay = layoutGraph(a, sizes, this.down);
300
+ void this.updateComplete.then(() => this.fit());
301
+ }
302
+
303
+ /** Top to bottom on a narrow screen (`auto`); otherwise the whole graph in a frame, until the reader zooms or pans. */
304
+ private fit(): void {
305
+ if (this.direction === 'auto') {
306
+ const w = this.clientWidth;
307
+ const down = w > 0 && w < NARROW;
308
+ if (down !== this.down) this.down = down;
309
+ }
310
+ this.pz.fit();
311
+ }
312
+
313
+ private readonly onEscape = (e: KeyboardEvent): void => {
314
+ if (e.key !== 'Escape' || e.defaultPrevented || !this.selected) return;
315
+ e.preventDefault();
316
+ this.select(null);
317
+ };
318
+
319
+ private select(id: string | null): void {
320
+ if (id !== this.selected) emit(this, 'cae-select', { id });
321
+ }
322
+
323
+ /** An item's action: its inner view when it has one. */
324
+ protected act(id: string): void {
325
+ const x = this.nodes.get(id) ?? this.clusters.get(id) ?? this.findMark(id);
326
+ if (x?.drill) this.drill(id);
327
+ else if (x) emit(this, 'cae-activate', { id });
328
+ }
329
+
330
+ private findMark(id: string): { drill?: boolean } | null {
331
+ for (const n of this.drawn.nodes) for (const m of [...n.marks, ...n.loose]) if (m?.id === id) return m;
332
+ for (const r of this.matrix?.rows ?? []) for (const m of r.cells) if (m?.id === id) return m;
333
+ return null;
334
+ }
335
+
336
+ /** The series (or mark id) highlighted: the one hovered or focused, else the selected mark's, else `highlight`; and the marks it lights. */
337
+ protected lit(): { key: string | null; on: ReadonlySet<string> | null } {
338
+ const sel = this.selected;
339
+ const mine = this.hover === null && sel !== null && this.markSeries.has(sel) ? this.markSeries.get(sel) || sel : null;
340
+ const key = this.hover ?? mine ?? this.highlight ?? null;
341
+ const c = this.litCache;
342
+ if (c && c.key === key && c.graph === this.graph && c.related === this.related) return c;
343
+ const on = key === null ? null : (this.related ?? ((k: string) => new Set([k])))(key);
344
+ this.litCache = { key, graph: this.graph, related: this.related, on };
345
+ return this.litCache;
346
+ }
347
+
348
+ private known(id: string): boolean {
349
+ return this.nodes.has(id) || this.clusters.has(id) || !!this.findMark(id);
350
+ }
351
+
352
+ override render() {
353
+ const h = this.h;
354
+ const mx = this.matrix;
355
+ const body = mx ? this.matrixView(mx) : this.view === 'table' ? nodeTable(h) : dag(h);
356
+ const sel = this.selected;
357
+ const card =
358
+ sel && this.querySelector('[slot=inspector]') && this.known(sel)
359
+ ? keyed(
360
+ sel,
361
+ html`<section id="insp" class="insp ${this.down ? 'sheet' : ''}" part="inspector" aria-label=${this.words.inspector} @keydown=${this.card.onCardKey}>
362
+ <span class="ptr" aria-hidden="true"></span>
363
+ <div class="scroll"><slot name="inspector"></slot></div>
364
+ </section>`,
365
+ )
366
+ : nothing;
367
+ return html`<div class="col">
368
+ <slot name="crumbs"></slot>
369
+ <div class="main">${body}${card}<div class="sr" role="status">${this.announced}</div></div>
370
+ ${foot(h, mx)}
371
+ </div>`;
372
+ }
373
+
374
+ /** A mark matrix in the frame, at least as tall as the drawing was (and as the card needs), centred in it. */
375
+ private matrixView(mx: MarkMatrixInput) {
376
+ const least = this.down ? 0 : Math.round(Math.max(this.pz.frameH, this.card.room));
377
+ return html`<div class="frame mxframe" part="frame" style=${least ? `min-height:${least}px` : ''}>
378
+ <cae-mark-matrix .matrix=${mx} .states=${this.states} .selected=${this.selected} .highlight=${this.highlight} .key=${this.key}
379
+ .strings=${this.matrixStrings} .renderIcon=${this.renderIcon} .iconStyles=${this.iconStyles}></cae-mark-matrix>
380
+ </div>`;
381
+ }
382
+
383
+ // What the views read and call besides the members above (`host.ts`).
384
+ protected get laidOut(): boolean {
385
+ return this.layFor === this.key;
386
+ }
387
+
388
+ protected get asTable(): boolean {
389
+ return this.view === 'table';
390
+ }
391
+
392
+ protected focusSelect(id: string): void {
393
+ if (!this.card.quiet) this.select(id);
394
+ }
395
+
396
+ protected drill(id: string): void {
397
+ emit(this, 'cae-drill', { id });
398
+ }
399
+
400
+ protected toggle(id: string, open: boolean): void {
401
+ emit(this, 'cae-toggle', { id, open });
402
+ }
403
+
404
+ protected showView(v: 'graph' | 'table'): void {
405
+ // A mark matrix is the table: only "Graph" leaves it, and the host decides where to.
406
+ if (this.matrix && v === 'table') return;
407
+ if (!this.matrix) this.view = v;
408
+ emit(this, 'cae-view-change', { view: v });
409
+ }
410
+
411
+ }
412
+
413
+ declare global {
414
+ interface HTMLElementTagNameMap {
415
+ 'cae-layered-graph': CaeLayeredGraph;
416
+ }
417
+ }