@repometry/cli 0.0.0-stage → 0.0.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 (415) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -2
  3. package/package.json +75 -4
  4. package/target/main/resources/language-catalog.json +61 -0
  5. package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
  6. package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
  7. package/target/main/resources/report/json/config-v2.schema.json +224 -0
  8. package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
  9. package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
  10. package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
  11. package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
  12. package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
  13. package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
  14. package/target/main/resources/report/json/report-v2.schema.json +530 -0
  15. package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -0
  16. package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
  17. package/target/main/resources/viewer/files.css +616 -0
  18. package/target/main/resources/viewer/index.html +120 -0
  19. package/target/main/resources/viewer/projects.html +52 -0
  20. package/target/main/resources/viewer/styles.css +579 -0
  21. package/target/main/resources/viewer/viewer-pulls.css +64 -0
  22. package/target/main/ts/api/cache/root.d.ts +2 -0
  23. package/target/main/ts/api/cache/root.js +21 -0
  24. package/target/main/ts/api/gh/github.d.ts +4 -0
  25. package/target/main/ts/api/gh/github.js +47 -0
  26. package/target/main/ts/api/git/blob-batch.d.ts +10 -0
  27. package/target/main/ts/api/git/blob-batch.js +107 -0
  28. package/target/main/ts/api/git/blob-history.d.ts +20 -0
  29. package/target/main/ts/api/git/blob-history.js +54 -0
  30. package/target/main/ts/api/git/changes.d.ts +27 -0
  31. package/target/main/ts/api/git/changes.js +117 -0
  32. package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
  33. package/target/main/ts/api/git/commit-metadata.js +46 -0
  34. package/target/main/ts/api/git/git-churn.d.ts +9 -0
  35. package/target/main/ts/api/git/git-churn.js +72 -0
  36. package/target/main/ts/api/git/git-executable.d.ts +1 -0
  37. package/target/main/ts/api/git/git-executable.js +31 -0
  38. package/target/main/ts/api/git/git-reader.d.ts +24 -0
  39. package/target/main/ts/api/git/git-reader.js +113 -0
  40. package/target/main/ts/api/git/git.d.ts +47 -0
  41. package/target/main/ts/api/git/git.js +289 -0
  42. package/target/main/ts/api/git/inspection-source.d.ts +17 -0
  43. package/target/main/ts/api/git/inspection-source.js +36 -0
  44. package/target/main/ts/api/git/line-changes.d.ts +6 -0
  45. package/target/main/ts/api/git/line-changes.js +57 -0
  46. package/target/main/ts/api/git/local-sources.d.ts +5 -0
  47. package/target/main/ts/api/git/local-sources.js +48 -0
  48. package/target/main/ts/api/git/local.d.ts +7 -0
  49. package/target/main/ts/api/git/local.js +106 -0
  50. package/target/main/ts/api/git/source-cache.d.ts +1 -0
  51. package/target/main/ts/api/git/source-cache.js +42 -0
  52. package/target/main/ts/api/import/cobertura.d.ts +2 -0
  53. package/target/main/ts/api/import/cobertura.js +160 -0
  54. package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
  55. package/target/main/ts/api/import/coverage-xml.js +135 -0
  56. package/target/main/ts/api/import/finding-import.d.ts +9 -0
  57. package/target/main/ts/api/import/finding-import.js +227 -0
  58. package/target/main/ts/api/import/go-cover.d.ts +13 -0
  59. package/target/main/ts/api/import/go-cover.js +150 -0
  60. package/target/main/ts/api/import/lcov-files.d.ts +12 -0
  61. package/target/main/ts/api/import/lcov-files.js +53 -0
  62. package/target/main/ts/api/import/profile-file.d.ts +4 -0
  63. package/target/main/ts/api/import/profile-file.js +17 -0
  64. package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
  65. package/target/main/ts/api/process/docker-tool-runner.js +92 -0
  66. package/target/main/ts/api/process/failure.d.ts +1 -0
  67. package/target/main/ts/api/process/failure.js +12 -0
  68. package/target/main/ts/api/process/plugin.d.ts +13 -0
  69. package/target/main/ts/api/process/plugin.js +100 -0
  70. package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
  71. package/target/main/ts/api/process/tool-snapshot.js +26 -0
  72. package/target/main/ts/cli/arguments.d.ts +28 -0
  73. package/target/main/ts/cli/arguments.js +109 -0
  74. package/target/main/ts/cli/config.d.ts +63 -0
  75. package/target/main/ts/cli/config.js +165 -0
  76. package/target/main/ts/cli/imports.d.ts +9 -0
  77. package/target/main/ts/cli/imports.js +37 -0
  78. package/target/main/ts/cli/main.d.ts +2 -0
  79. package/target/main/ts/cli/main.js +4 -0
  80. package/target/main/ts/cli/range-inspection.d.ts +38 -0
  81. package/target/main/ts/cli/range-inspection.js +34 -0
  82. package/target/main/ts/cli/range-jobs.d.ts +23 -0
  83. package/target/main/ts/cli/range-jobs.js +152 -0
  84. package/target/main/ts/cli/range-worker.d.ts +1 -0
  85. package/target/main/ts/cli/range-worker.js +40 -0
  86. package/target/main/ts/cli/reporting.d.ts +42 -0
  87. package/target/main/ts/cli/reporting.js +98 -0
  88. package/target/main/ts/cli/revisions.d.ts +6 -0
  89. package/target/main/ts/cli/revisions.js +16 -0
  90. package/target/main/ts/cli/run.d.ts +2 -0
  91. package/target/main/ts/cli/run.js +306 -0
  92. package/target/main/ts/cli/store.d.ts +13 -0
  93. package/target/main/ts/cli/store.js +39 -0
  94. package/target/main/ts/compose/analysis-report.d.ts +6 -0
  95. package/target/main/ts/compose/analysis-report.js +131 -0
  96. package/target/main/ts/compose/analysis-results.d.ts +42 -0
  97. package/target/main/ts/compose/analysis-results.js +84 -0
  98. package/target/main/ts/compose/analysis-steps.d.ts +23 -0
  99. package/target/main/ts/compose/analysis-steps.js +217 -0
  100. package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
  101. package/target/main/ts/compose/analyze-snapshot.js +21 -0
  102. package/target/main/ts/compose/attach-churn.d.ts +2 -0
  103. package/target/main/ts/compose/attach-churn.js +50 -0
  104. package/target/main/ts/compose/built-ins.d.ts +6 -0
  105. package/target/main/ts/compose/built-ins.js +12 -0
  106. package/target/main/ts/compose/diff-coverage.d.ts +25 -0
  107. package/target/main/ts/compose/diff-coverage.js +82 -0
  108. package/target/main/ts/compose/distribution.d.ts +17 -0
  109. package/target/main/ts/compose/distribution.js +13 -0
  110. package/target/main/ts/compose/docker-image.d.ts +5 -0
  111. package/target/main/ts/compose/docker-image.js +49 -0
  112. package/target/main/ts/compose/file-selection.d.ts +9 -0
  113. package/target/main/ts/compose/file-selection.js +38 -0
  114. package/target/main/ts/compose/history-cache.d.ts +31 -0
  115. package/target/main/ts/compose/history-cache.js +62 -0
  116. package/target/main/ts/compose/inspect.d.ts +34 -0
  117. package/target/main/ts/compose/inspect.js +51 -0
  118. package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
  119. package/target/main/ts/compose/inspection-coverage.js +9 -0
  120. package/target/main/ts/compose/js-plugin.d.ts +113 -0
  121. package/target/main/ts/compose/js-plugin.js +99 -0
  122. package/target/main/ts/compose/language-discovery.d.ts +12 -0
  123. package/target/main/ts/compose/language-discovery.js +51 -0
  124. package/target/main/ts/compose/languages.d.ts +64 -0
  125. package/target/main/ts/compose/languages.js +98 -0
  126. package/target/main/ts/compose/load-plugins.d.ts +6 -0
  127. package/target/main/ts/compose/load-plugins.js +71 -0
  128. package/target/main/ts/compose/parser-order.d.ts +20 -0
  129. package/target/main/ts/compose/parser-order.js +90 -0
  130. package/target/main/ts/compose/phases.d.ts +140 -0
  131. package/target/main/ts/compose/phases.js +147 -0
  132. package/target/main/ts/compose/plugin-list.d.ts +37 -0
  133. package/target/main/ts/compose/plugin-list.js +30 -0
  134. package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
  135. package/target/main/ts/compose/plugin-manifest.js +50 -0
  136. package/target/main/ts/compose/plugin-options.d.ts +2 -0
  137. package/target/main/ts/compose/plugin-options.js +29 -0
  138. package/target/main/ts/compose/plugin-reference.d.ts +9 -0
  139. package/target/main/ts/compose/plugin-reference.js +40 -0
  140. package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
  141. package/target/main/ts/compose/plugin-requirements.js +83 -0
  142. package/target/main/ts/compose/plugin-scope.d.ts +9 -0
  143. package/target/main/ts/compose/plugin-scope.js +60 -0
  144. package/target/main/ts/compose/process-plugins.d.ts +89 -0
  145. package/target/main/ts/compose/process-plugins.js +74 -0
  146. package/target/main/ts/compose/registered-plugin.d.ts +17 -0
  147. package/target/main/ts/compose/registered-plugin.js +8 -0
  148. package/target/main/ts/compose/review.d.ts +26 -0
  149. package/target/main/ts/compose/review.js +54 -0
  150. package/target/main/ts/compose/schema-error.d.ts +2 -0
  151. package/target/main/ts/compose/schema-error.js +16 -0
  152. package/target/main/ts/compose/sources.d.ts +2 -0
  153. package/target/main/ts/compose/sources.js +32 -0
  154. package/target/main/ts/compose/structure-measures.d.ts +9 -0
  155. package/target/main/ts/compose/structure-measures.js +63 -0
  156. package/target/main/ts/index.d.ts +8 -0
  157. package/target/main/ts/index.js +5 -0
  158. package/target/main/ts/plugin.d.ts +2 -0
  159. package/target/main/ts/plugin.js +2 -0
  160. package/target/main/ts/plugins/built-in.d.ts +3 -0
  161. package/target/main/ts/plugins/built-in.js +19 -0
  162. package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
  163. package/target/main/ts/plugins/coverage/coverage.js +289 -0
  164. package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
  165. package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
  166. package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
  167. package/target/main/ts/plugins/duplication/duplication.js +95 -0
  168. package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
  169. package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
  170. package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
  171. package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
  172. package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
  173. package/target/main/ts/plugins/language-js/code-lines.js +36 -0
  174. package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
  175. package/target/main/ts/plugins/language-js/extensions.js +3 -0
  176. package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
  177. package/target/main/ts/plugins/language-js/function-facts.js +74 -0
  178. package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
  179. package/target/main/ts/plugins/language-js/js-security.js +497 -0
  180. package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
  181. package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
  182. package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
  183. package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
  184. package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
  185. package/target/main/ts/plugins/language-js/syntax.js +11 -0
  186. package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
  187. package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
  188. package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
  189. package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
  190. package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
  191. package/target/main/ts/plugins/security/actions-security.js +581 -0
  192. package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
  193. package/target/main/ts/plugins/security/dockerfile.js +487 -0
  194. package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
  195. package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
  196. package/target/main/ts/plugins/security/secrets.d.ts +12 -0
  197. package/target/main/ts/plugins/security/secrets.js +254 -0
  198. package/target/main/ts/plugins/source/forges.d.ts +4 -0
  199. package/target/main/ts/plugins/source/forges.js +80 -0
  200. package/target/main/ts/plugins/structure/structure.d.ts +2 -0
  201. package/target/main/ts/plugins/structure/structure.js +42 -0
  202. package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
  203. package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
  204. package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
  205. package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
  206. package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
  207. package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
  208. package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
  209. package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
  210. package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
  211. package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
  212. package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
  213. package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
  214. package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
  215. package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
  216. package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
  217. package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
  218. package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
  219. package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
  220. package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
  221. package/target/main/ts/report/html/app/viewer-chart.js +50 -0
  222. package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
  223. package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
  224. package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
  225. package/target/main/ts/report/html/app/viewer-columns.js +97 -0
  226. package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
  227. package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
  228. package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
  229. package/target/main/ts/report/html/app/viewer-commits.js +81 -0
  230. package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
  231. package/target/main/ts/report/html/app/viewer-controls.js +141 -0
  232. package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
  233. package/target/main/ts/report/html/app/viewer-copy.js +64 -0
  234. package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
  235. package/target/main/ts/report/html/app/viewer-data.js +78 -0
  236. package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
  237. package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
  238. package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
  239. package/target/main/ts/report/html/app/viewer-dom.js +99 -0
  240. package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
  241. package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
  242. package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
  243. package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
  244. package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
  245. package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
  246. package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
  247. package/target/main/ts/report/html/app/viewer-files.js +40 -0
  248. package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
  249. package/target/main/ts/report/html/app/viewer-filter.js +161 -0
  250. package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
  251. package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
  252. package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
  253. package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
  254. package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
  255. package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
  256. package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
  257. package/target/main/ts/report/html/app/viewer-issues.js +173 -0
  258. package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
  259. package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
  260. package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
  261. package/target/main/ts/report/html/app/viewer-languages.js +97 -0
  262. package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
  263. package/target/main/ts/report/html/app/viewer-layout.js +134 -0
  264. package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
  265. package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
  266. package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
  267. package/target/main/ts/report/html/app/viewer-locations.js +31 -0
  268. package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
  269. package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
  270. package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
  271. package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
  272. package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
  273. package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
  274. package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
  275. package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
  276. package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
  277. package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
  278. package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
  279. package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
  280. package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
  281. package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
  282. package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
  283. package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
  284. package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
  285. package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
  286. package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
  287. package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
  288. package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
  289. package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
  290. package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
  291. package/target/main/ts/report/html/app/viewer-profile.js +180 -0
  292. package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
  293. package/target/main/ts/report/html/app/viewer-projects.js +90 -0
  294. package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
  295. package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
  296. package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
  297. package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
  298. package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
  299. package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
  300. package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
  301. package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
  302. package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
  303. package/target/main/ts/report/html/app/viewer-route.js +55 -0
  304. package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
  305. package/target/main/ts/report/html/app/viewer-shell.js +113 -0
  306. package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
  307. package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
  308. package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
  309. package/target/main/ts/report/html/app/viewer-source.js +57 -0
  310. package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
  311. package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
  312. package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
  313. package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
  314. package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
  315. package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
  316. package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
  317. package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
  318. package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
  319. package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
  320. package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
  321. package/target/main/ts/report/html/app/viewer-totals.js +100 -0
  322. package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
  323. package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
  324. package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
  325. package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
  326. package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
  327. package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
  328. package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
  329. package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
  330. package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
  331. package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
  332. package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
  333. package/target/main/ts/report/html/app/viewer-trends.js +89 -0
  334. package/target/main/ts/report/html/app/viewer.d.ts +1 -0
  335. package/target/main/ts/report/html/app/viewer.js +222 -0
  336. package/target/main/ts/report/html/site/badges.d.ts +11 -0
  337. package/target/main/ts/report/html/site/badges.js +72 -0
  338. package/target/main/ts/report/html/site/export-site.d.ts +16 -0
  339. package/target/main/ts/report/html/site/export-site.js +129 -0
  340. package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
  341. package/target/main/ts/report/html/site/exported-server.js +72 -0
  342. package/target/main/ts/report/html/site/local-server.d.ts +7 -0
  343. package/target/main/ts/report/html/site/local-server.js +59 -0
  344. package/target/main/ts/report/html/site/projects.d.ts +1 -0
  345. package/target/main/ts/report/html/site/projects.js +69 -0
  346. package/target/main/ts/report/html/site/server.d.ts +4 -0
  347. package/target/main/ts/report/html/site/server.js +65 -0
  348. package/target/main/ts/report/html/site/source-route.d.ts +6 -0
  349. package/target/main/ts/report/html/site/source-route.js +23 -0
  350. package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
  351. package/target/main/ts/report/json/projections/commit-summary.js +125 -0
  352. package/target/main/ts/report/json/projections/components.d.ts +4 -0
  353. package/target/main/ts/report/json/projections/components.js +30 -0
  354. package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
  355. package/target/main/ts/report/json/projections/file-metrics.js +260 -0
  356. package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
  357. package/target/main/ts/report/json/projections/ignore-view.js +13 -0
  358. package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
  359. package/target/main/ts/report/json/projections/inspection-context.js +104 -0
  360. package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
  361. package/target/main/ts/report/json/projections/inspection-details.js +98 -0
  362. package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
  363. package/target/main/ts/report/json/projections/metric-values.js +104 -0
  364. package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
  365. package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
  366. package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
  367. package/target/main/ts/report/json/projections/security-summary.js +22 -0
  368. package/target/main/ts/report/json/store/directory.d.ts +3 -0
  369. package/target/main/ts/report/json/store/directory.js +19 -0
  370. package/target/main/ts/report/json/store/local-store.d.ts +25 -0
  371. package/target/main/ts/report/json/store/local-store.js +214 -0
  372. package/target/main/ts/report/json/store/object-store.d.ts +14 -0
  373. package/target/main/ts/report/json/store/object-store.js +73 -0
  374. package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
  375. package/target/main/ts/report/json/store/operation-cache.js +32 -0
  376. package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
  377. package/target/main/ts/report/json/store/pull-review-store.js +33 -0
  378. package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
  379. package/target/main/ts/report/json/store/replace-file.js +35 -0
  380. package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
  381. package/target/main/ts/report/json/store/report-tree.js +295 -0
  382. package/target/main/ts/report/json/store/store-check.d.ts +32 -0
  383. package/target/main/ts/report/json/store/store-check.js +153 -0
  384. package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
  385. package/target/main/ts/report/json/validation/metabranch.js +11 -0
  386. package/target/main/ts/report/json/validation/report.d.ts +20 -0
  387. package/target/main/ts/report/json/validation/report.js +77 -0
  388. package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
  389. package/target/main/ts/report/json/validation/summary-validation.js +26 -0
  390. package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
  391. package/target/main/ts/report/json/wire/compact-json.js +76 -0
  392. package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
  393. package/target/main/ts/report/json/wire/component-model.js +1 -0
  394. package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
  395. package/target/main/ts/report/json/wire/domain-types.js +1 -0
  396. package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
  397. package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
  398. package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
  399. package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
  400. package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
  401. package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
  402. package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
  403. package/target/main/ts/report/json/wire/project-model.js +1 -0
  404. package/target/main/ts/report/json/wire/public-history-model.d.ts +36 -0
  405. package/target/main/ts/report/json/wire/public-history-model.js +5 -0
  406. package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
  407. package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
  408. package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
  409. package/target/main/ts/report/json/wire/summary-model.js +1 -0
  410. package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
  411. package/target/main/ts/report/markdown/pull-review.js +132 -0
  412. package/target/main/ts/report.d.ts +23 -0
  413. package/target/main/ts/report.js +12 -0
  414. package/target/main/ts/runtime.d.ts +17 -0
  415. package/target/main/ts/runtime.js +30 -0
@@ -0,0 +1,41 @@
1
+ /** The chart's SVG building blocks and the plot's layout, shared by its axes, marks and hover card. */
2
+ export const plotTop = 34;
3
+ export const plotBottom = 30;
4
+ export const plotRight = 18;
5
+ /** Keeps the first and last marks off the plot edges. */
6
+ export const inset = 12;
7
+ const svgNamespace = 'http://www.w3.org/2000/svg';
8
+ export function svgNode(tag, className) {
9
+ const node = document.createElementNS(svgNamespace, tag);
10
+ if (className)
11
+ node.setAttribute('class', className);
12
+ return node;
13
+ }
14
+ /** Sets numeric attributes, rounded to a tenth of a pixel. */
15
+ export function setAttributes(node, attributes) {
16
+ for (const [name, value] of Object.entries(attributes))
17
+ node.setAttribute(name, String(Number(value.toFixed(1))));
18
+ }
19
+ export function text(content, className, x, y) {
20
+ const node = svgNode('text', className);
21
+ node.textContent = content;
22
+ setAttributes(node, { x, y });
23
+ return node;
24
+ }
25
+ /** A label centred on its anchor. */
26
+ export function centredText(content, className, x, y) {
27
+ const node = text(content, className, x, y);
28
+ node.setAttribute('text-anchor', 'middle');
29
+ return node;
30
+ }
31
+ /** Where a centred label stands so that it stays inside the plot. */
32
+ export function clampLabel(x, label, { left, plotWidth }) {
33
+ const half = label.length * 3.6 + 2;
34
+ return Math.min(Math.max(x, left + half), left + plotWidth - half);
35
+ }
36
+ /** A line across the plot, at a height or at a point. */
37
+ export function line(className, attributes) {
38
+ const node = svgNode('line', className);
39
+ setAttributes(node, attributes);
40
+ return node;
41
+ }
@@ -0,0 +1,26 @@
1
+ import type { Layout } from './viewer-chart-svg.js';
2
+ export type TickUnit = 'minute' | 'hour' | 'day' | 'month' | 'year';
3
+ export interface TimeTick {
4
+ readonly time: number;
5
+ readonly label: string;
6
+ readonly unit: TickUnit;
7
+ }
8
+ /**
9
+ * Labels for ticks in time order. Each names its own unit, and the coarser units join it only where they change:
10
+ * Jul 2023, Nov, Dec, Jan 2024, Feb; 30 Jun, 1 Jul, 2; 23:00, 1 Jul, 01:00. The first tick always carries them.
11
+ */
12
+ export declare function tickLabels(times: readonly number[], unit: TickUnit): string[];
13
+ /**
14
+ * The labels under the ticks. Which ticks keep a label is settled first: one that would sit far off its tick at the
15
+ * edge, or touch the label before it, keeps only its mark. Only then are the labels written, so the first label shown
16
+ * carries the coarser units, and every later one carries them only where they change.
17
+ */
18
+ export declare function axisLabels(ticks: readonly {
19
+ time: number;
20
+ x: number;
21
+ }[], unit: TickUnit, layout: Pick<Layout, 'left' | 'plotWidth'>): {
22
+ at: number;
23
+ label: string;
24
+ }[];
25
+ /** Calendar-aligned ticks between two times, as many as fit the width without overlapping labels. */
26
+ export declare function timeTicks(start: number, end: number, width: number): TimeTick[];
@@ -0,0 +1,150 @@
1
+ import { clampLabel } from './viewer-chart-svg.js';
2
+ const monthLabel = new Intl.DateTimeFormat(undefined, { month: 'short' });
3
+ const monthYearLabel = new Intl.DateTimeFormat(undefined, { month: 'short', year: 'numeric' });
4
+ const dayLabel = new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'short' });
5
+ const dayYearLabel = new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'short', year: 'numeric' });
6
+ const hourLabel = new Intl.DateTimeFormat(undefined, { hour: '2-digit', minute: '2-digit' });
7
+ function changes(previous, date) {
8
+ const year = previous === null || previous.getFullYear() !== date.getFullYear();
9
+ const month = year || previous.getMonth() !== date.getMonth();
10
+ return { year, month, day: month || previous.getDate() !== date.getDate() };
11
+ }
12
+ /** A tick within a day names its time, and the date where the date changes; midnight is the date alone. */
13
+ function clockLabel(date, changed) {
14
+ if (!changed.day)
15
+ return hourLabel.format(date);
16
+ const days = (changed.year ? dayYearLabel : dayLabel).format(date);
17
+ return date.getHours() === 0 && date.getMinutes() === 0 ? days : `${days}, ${hourLabel.format(date)}`;
18
+ }
19
+ function dateLabel(date, changed) {
20
+ if (changed.year)
21
+ return dayYearLabel.format(date);
22
+ return changed.month ? dayLabel.format(date) : String(date.getDate());
23
+ }
24
+ const unitLabels = {
25
+ year: date => String(date.getFullYear()),
26
+ month: (date, changed) => (changed.year ? monthYearLabel : monthLabel).format(date),
27
+ day: dateLabel,
28
+ hour: clockLabel,
29
+ minute: clockLabel,
30
+ };
31
+ /**
32
+ * Labels for ticks in time order. Each names its own unit, and the coarser units join it only where they change:
33
+ * Jul 2023, Nov, Dec, Jan 2024, Feb; 30 Jun, 1 Jul, 2; 23:00, 1 Jul, 01:00. The first tick always carries them.
34
+ */
35
+ export function tickLabels(times, unit) {
36
+ let previous = null;
37
+ return times.map(time => {
38
+ const date = new Date(time);
39
+ const changed = changes(previous, date);
40
+ previous = date;
41
+ return unitLabels[unit](date, changed);
42
+ });
43
+ }
44
+ /**
45
+ * The labels under the ticks. Which ticks keep a label is settled first: one that would sit far off its tick at the
46
+ * edge, or touch the label before it, keeps only its mark. Only then are the labels written, so the first label shown
47
+ * carries the coarser units, and every later one carries them only where they change.
48
+ */
49
+ export function axisLabels(ticks, unit, layout) {
50
+ let shown = [...ticks];
51
+ for (;;) {
52
+ const labels = tickLabels(shown.map(tick => tick.time), unit);
53
+ let previous = -Infinity;
54
+ const placed = [];
55
+ const drop = shown.findIndex((tick, index) => {
56
+ const label = labels[index];
57
+ const at = clampLabel(tick.x, label, layout);
58
+ const half = label.length * 3.7;
59
+ if (Math.abs(at - tick.x) > 12 || at - half < previous + 10)
60
+ return true;
61
+ previous = at + half;
62
+ placed.push({ at, label });
63
+ return false;
64
+ });
65
+ if (drop < 0)
66
+ return placed;
67
+ shown = shown.filter((_, index) => index !== drop);
68
+ }
69
+ }
70
+ const minute = 60e3;
71
+ const hour = 60 * minute;
72
+ const day = 24 * hour;
73
+ const steps = [
74
+ { unit: 'minute', count: 5, size: 5 * minute }, { unit: 'minute', count: 10, size: 10 * minute },
75
+ { unit: 'minute', count: 15, size: 15 * minute }, { unit: 'minute', count: 30, size: 30 * minute },
76
+ { unit: 'hour', count: 1, size: hour }, { unit: 'hour', count: 3, size: 3 * hour }, { unit: 'hour', count: 6, size: 6 * hour },
77
+ { unit: 'hour', count: 12, size: 12 * hour }, { unit: 'day', count: 1, size: day }, { unit: 'day', count: 2, size: 2 * day },
78
+ { unit: 'day', count: 7, size: 7 * day }, { unit: 'day', count: 14, size: 14 * day }, { unit: 'month', count: 1, size: 30.4 * day },
79
+ { unit: 'month', count: 3, size: 91 * day }, { unit: 'month', count: 6, size: 182 * day }, { unit: 'year', count: 1, size: 365 * day },
80
+ { unit: 'year', count: 2, size: 730 * day }, { unit: 'year', count: 5, size: 1826 * day },
81
+ ];
82
+ /** Calendar-aligned ticks between two times, as many as fit the width without overlapping labels. */
83
+ export function timeTicks(start, end, width) {
84
+ for (const step of steps) {
85
+ const periods = (end - start) / step.size;
86
+ if (periods > Math.max(2, width / 64))
87
+ continue;
88
+ const ticks = calendarTicks(start, end, step.unit, step.count);
89
+ // Sized by the typical label: the few that carry a year or a date beside them are placed with care by the axis.
90
+ const lengths = ticks.map(tick => tick.label.length).sort((x, y) => x - y);
91
+ const widest = (lengths[Math.floor(lengths.length / 2)] ?? 0) * 7.4 + 14;
92
+ if (ticks.length < 2 || width / Math.max(1, periods) >= widest)
93
+ return ticks;
94
+ }
95
+ return calendarTicks(start, end, 'year', 10);
96
+ }
97
+ /** How coarse each unit is: a tick of a unit starts at zero in every finer one. */
98
+ const coarseness = { minute: 0, hour: 1, day: 2, month: 3, year: 4 };
99
+ function startOf(time, unit) {
100
+ const cursor = new Date(time);
101
+ cursor.setSeconds(0, 0);
102
+ const level = coarseness[unit];
103
+ if (level >= 1)
104
+ cursor.setMinutes(0);
105
+ if (level >= 2)
106
+ cursor.setHours(0);
107
+ if (level >= 3)
108
+ cursor.setDate(1);
109
+ if (level >= 4)
110
+ cursor.setMonth(0);
111
+ return cursor;
112
+ }
113
+ const advances = {
114
+ minute: cursor => cursor.setMinutes(cursor.getMinutes() + 1),
115
+ hour: cursor => cursor.setHours(cursor.getHours() + 1),
116
+ day: cursor => cursor.setDate(cursor.getDate() + 1),
117
+ month: cursor => cursor.setMonth(cursor.getMonth() + 1),
118
+ year: cursor => cursor.setFullYear(cursor.getFullYear() + 1),
119
+ };
120
+ function weekOf(date) {
121
+ return Math.floor(date.getTime() / (7 * day));
122
+ }
123
+ /** Weeks start on Mondays, every other one for two-week steps; days step from the first of the month, never to the 31st. */
124
+ function alignedDay(cursor, count) {
125
+ if (count !== 7 && count !== 14)
126
+ return (cursor.getDate() - 1) % count === 0 && cursor.getDate() < 31;
127
+ return cursor.getDay() === 1 && (count === 7 || weekOf(cursor) % 2 === 0);
128
+ }
129
+ const alignments = {
130
+ minute: (cursor, count) => cursor.getMinutes() % count === 0,
131
+ hour: (cursor, count) => cursor.getHours() % count === 0,
132
+ day: alignedDay,
133
+ month: (cursor, count) => cursor.getMonth() % count === 0,
134
+ year: (cursor, count) => cursor.getFullYear() % count === 0,
135
+ };
136
+ function calendarTicks(start, end, unit, count) {
137
+ const cursor = startOf(start, unit);
138
+ const advance = advances[unit];
139
+ const times = [];
140
+ let guard = 0;
141
+ while (cursor.getTime() < start && guard++ < 6000)
142
+ advance(cursor);
143
+ while (cursor.getTime() <= end && guard++ < 6000) {
144
+ if (alignments[unit](cursor, count))
145
+ times.push(cursor.getTime());
146
+ advance(cursor);
147
+ }
148
+ const labels = tickLabels(times, unit);
149
+ return times.map((time, index) => ({ time, label: labels[index], unit }));
150
+ }
@@ -0,0 +1,4 @@
1
+ import type { ChartPoint } from './viewer-chart-points.js';
2
+ import type { Layout } from './viewer-chart-svg.js';
3
+ /** One hover card for the whole chart: the point nearest the pointer, or the focused one. */
4
+ export declare function interact(svg: SVGSVGElement, tip: HTMLDivElement, layout: Layout, points: readonly ChartPoint[]): void;
@@ -0,0 +1,210 @@
1
+ import { flagIcon } from './viewer-chart-points.js';
2
+ import { setAttributes, svgNode } from './viewer-chart-svg.js';
3
+ const flagNotes = { best: 'Best of the shown inspections', worst: 'Worst of the shown inspections' };
4
+ /** The card scrolls, so a cluster lists its commits whole up to a bound a hand can still scroll through. */
5
+ const listed = 50;
6
+ function span(className, content) {
7
+ const node = document.createElement('span');
8
+ node.className = className;
9
+ node.textContent = content;
10
+ return node;
11
+ }
12
+ /** The value, and its change where it says something: in a cluster an unchanged value goes without saying. */
13
+ function valueLine(point, brief) {
14
+ const value = span('tc-tip-value', point.tip.value);
15
+ const change = point.tip.change;
16
+ if (!change || (brief && change.direction === 'same'))
17
+ return value;
18
+ const node = span('tc-tip-change', change.text);
19
+ node.dataset.direction = change.direction;
20
+ value.append(' ', node);
21
+ return value;
22
+ }
23
+ /** Each card opens its commit: in a cluster the card is how one of several commits at a point is picked. */
24
+ function card(point, brief) {
25
+ const entry = document.createElement(point.href ? 'a' : 'div');
26
+ entry.className = 'tc-tip-entry';
27
+ if (entry instanceof HTMLAnchorElement)
28
+ entry.href = point.href;
29
+ const heading = document.createElement('strong');
30
+ heading.textContent = point.tip.heading;
31
+ const commit = document.createElement('code');
32
+ commit.textContent = point.tip.commit;
33
+ entry.append(heading, commit);
34
+ if (point.tip.subject)
35
+ entry.append(span('tc-tip-subject', point.tip.subject));
36
+ entry.append(valueLine(point, brief));
37
+ if (point.flag) {
38
+ const flag = document.createElement('span');
39
+ flag.className = 'tc-tip-flag';
40
+ flag.append(flagIcon(point.flag), flagNotes[point.flag]);
41
+ entry.append(flag);
42
+ }
43
+ entry.append(...point.tip.notes.map(note => span('tc-tip-note', note)));
44
+ return entry;
45
+ }
46
+ /** Marks closer than a few pixels overlap, so the card lists every commit under the pointer, newest first. */
47
+ function fillTip(tip, points, layout, x) {
48
+ const cluster = points.flatMap((_, other) => Math.abs(layout.xs[other] - x) < 4 ? [other] : []).reverse();
49
+ tip.replaceChildren(...cluster.slice(0, listed).map(member => card(points[member], cluster.length > 1)));
50
+ if (cluster.length > listed)
51
+ tip.append(span('tc-tip-note', `${cluster.length - listed} more commits at this point`));
52
+ tip.scrollTop = 0;
53
+ // Only a card of several commits takes the pointer; a single card stays out of the way of scanning along the chart.
54
+ tip.classList.toggle('tc-tip-held', cluster.length > 1);
55
+ tip.hidden = false;
56
+ }
57
+ /** The card keeps the side it opened on while it fits, so it does not jump across the pointer heading for it. */
58
+ function placeTip(tip, svg, layout, mark, side) {
59
+ const { x, y: markY } = mark;
60
+ const scale = svg.getBoundingClientRect().width / Math.max(1, layout.width) || 1;
61
+ const width = tip.offsetWidth;
62
+ const room = svg.clientWidth || layout.width;
63
+ const right = x * scale + 14;
64
+ const leftSide = x * scale - 14 - width;
65
+ const keepsLeft = side === 'left' && leftSide >= 0;
66
+ const next = !keepsLeft && right + width <= room ? 'right' : 'left';
67
+ tip.style.left = `${Math.max(0, next === 'right' ? right : leftSide)}px`;
68
+ const bottom = layout.top * scale + layout.plotHeight * scale - tip.offsetHeight;
69
+ tip.style.top = `${Math.max(0, Math.min((markY ?? layout.top + layout.plotHeight) * scale - tip.offsetHeight / 2, bottom))}px`;
70
+ return next;
71
+ }
72
+ /** Marks the point as active, and puts the hover dot on it where the point draws no dot of its own. */
73
+ function highlight(svg, pointer, layout, index) {
74
+ svg.querySelectorAll('.tc-point.is-active').forEach(node => node.classList.remove('is-active'));
75
+ const own = svg.querySelector(`.tc-point[data-index="${index}"]`);
76
+ own?.classList.add('is-active');
77
+ const markY = layout.ys[index];
78
+ if (markY == null || own?.querySelector('.tc-dot') || svg.classList.contains('tc-bars')) {
79
+ pointer.setAttribute('visibility', 'hidden');
80
+ return;
81
+ }
82
+ setAttributes(pointer, { cx: layout.xs[index], cy: markY });
83
+ pointer.setAttribute('visibility', 'visible');
84
+ }
85
+ /** The point nearest the pointer; the later point on ties, so the newest of a cluster is reachable. */
86
+ function nearestPoint(svg, layout, clientX) {
87
+ const box = svg.getBoundingClientRect();
88
+ const px = (clientX - box.left) * (layout.width / Math.max(1, box.width));
89
+ let best = 0;
90
+ for (const [index, position] of layout.xs.entries()) {
91
+ if (Math.abs(position - px) <= Math.abs(layout.xs[best] - px))
92
+ best = index;
93
+ }
94
+ return best;
95
+ }
96
+ /** Whether the pointer is on its way to a held card: moving towards it and not there yet. */
97
+ function headingForCard(tip, side, dx, clientX) {
98
+ if (tip.hidden || !tip.classList.contains('tc-tip-held'))
99
+ return false;
100
+ const box = tip.getBoundingClientRect();
101
+ return side === 'right' ? dx > 0 && clientX < box.left : dx < 0 && clientX > box.right;
102
+ }
103
+ const keySteps = new Map([
104
+ ['ArrowLeft', (from) => Math.max(0, from - 1)],
105
+ ['ArrowRight', (from, last) => Math.min(last, from + 1)],
106
+ ['Home', () => 0],
107
+ ['End', (_, last) => last],
108
+ ]);
109
+ function guideLine(svg) {
110
+ const guide = svgNode('line', 'tc-guide');
111
+ guide.setAttribute('visibility', 'hidden');
112
+ svg.insertBefore(guide, svg.firstChild);
113
+ return guide;
114
+ }
115
+ /** One dot follows the pointer or the keyboard along the line, so the chart needs no element per commit. */
116
+ function hoverDot(svg) {
117
+ const pointer = svgNode('circle', 'tc-dot tc-hover-dot');
118
+ pointer.setAttribute('r', '4.5');
119
+ pointer.setAttribute('visibility', 'hidden');
120
+ svg.append(pointer);
121
+ return pointer;
122
+ }
123
+ /** One hover card for the whole chart: the point nearest the pointer, or the focused one. */
124
+ export function interact(svg, tip, layout, points) {
125
+ if (points.length === 0)
126
+ return;
127
+ const guide = guideLine(svg);
128
+ const pointer = hoverDot(svg);
129
+ const state = {
130
+ active: -1, side: null, pending: undefined, lastX: 0
131
+ };
132
+ const show = (index) => {
133
+ if (index === state.active)
134
+ return;
135
+ state.active = index;
136
+ const x = layout.xs[index];
137
+ setAttributes(guide, { x1: x, x2: x, y1: layout.top - 6, y2: layout.top + layout.plotHeight });
138
+ guide.setAttribute('visibility', 'visible');
139
+ highlight(svg, pointer, layout, index);
140
+ fillTip(tip, points, layout, x);
141
+ state.side = placeTip(tip, svg, layout, { x, y: layout.ys[index] }, state.side);
142
+ };
143
+ const hide = () => {
144
+ clearTimeout(state.pending);
145
+ state.side = null;
146
+ state.active = -1;
147
+ tip.hidden = true;
148
+ guide.setAttribute('visibility', 'hidden');
149
+ pointer.setAttribute('visibility', 'hidden');
150
+ svg.querySelectorAll('.tc-point.is-active').forEach(node => node.classList.remove('is-active'));
151
+ };
152
+ // A pointer heading for the card may cross other commits on the way. While it moves towards the card, the switch
153
+ // waits a moment; reaching the card keeps it, so its commits can be scrolled and picked.
154
+ svg.addEventListener('pointermove', event => {
155
+ const candidate = nearestPoint(svg, layout, event.clientX);
156
+ const dx = event.clientX - state.lastX;
157
+ state.lastX = event.clientX;
158
+ clearTimeout(state.pending);
159
+ if (candidate === state.active)
160
+ return;
161
+ if (headingForCard(tip, state.side, dx, event.clientX))
162
+ state.pending = setTimeout(() => show(candidate), 220);
163
+ else
164
+ show(candidate);
165
+ });
166
+ svg.addEventListener('pointerleave', event => {
167
+ if (!tip.contains(event.relatedTarget))
168
+ hide();
169
+ });
170
+ tip.addEventListener('pointerenter', () => clearTimeout(state.pending));
171
+ tip.addEventListener('pointerleave', event => {
172
+ if (!svg.contains(event.relatedTarget))
173
+ hide();
174
+ });
175
+ svg.addEventListener('click', event => {
176
+ if (event.target.closest('.tc-point'))
177
+ return;
178
+ const href = points[nearestPoint(svg, layout, event.clientX)]?.href;
179
+ if (href)
180
+ location.assign(href);
181
+ });
182
+ svg.addEventListener('focusin', event => {
183
+ const index = Number(event.target.closest('.tc-point')?.dataset.index);
184
+ if (Number.isInteger(index))
185
+ show(index);
186
+ });
187
+ svg.addEventListener('focusout', hide);
188
+ // The chart itself takes focus: arrows step through commits, Home and End jump to the ends, Enter opens the commit.
189
+ svg.tabIndex = 0;
190
+ svg.setAttribute('aria-keyshortcuts', 'ArrowLeft ArrowRight Home End Enter');
191
+ svg.setAttribute('aria-label', `${points.length} ${points.length === 1 ? 'commit' : 'commits'}; arrow keys move between them, Enter opens one`);
192
+ svg.addEventListener('focus', () => {
193
+ const current = points.findIndex(point => point.current);
194
+ show(current >= 0 ? current : points.length - 1);
195
+ });
196
+ svg.addEventListener('keydown', event => {
197
+ const last = points.length - 1;
198
+ const step = keySteps.get(event.key);
199
+ if (step) {
200
+ event.preventDefault();
201
+ const next = step(state.active < 0 ? last : state.active, last);
202
+ state.active = -1;
203
+ show(next);
204
+ }
205
+ else if (event.key === 'Enter' && state.active >= 0) {
206
+ event.preventDefault();
207
+ location.assign(points[state.active].href);
208
+ }
209
+ });
210
+ }
@@ -0,0 +1,12 @@
1
+ import type { Layout } from './viewer-chart-svg.js';
2
+ interface Placed {
3
+ readonly label: string;
4
+ readonly time: number | null;
5
+ }
6
+ /**
7
+ * Positions points on the x axis and draws it. When every point has a commit time the axis is time: equal periods take
8
+ * equal width, and the ticks step by one calendar period (a day, a week, a month, a quarter, a year) chosen to fit the
9
+ * width. Without times the points stand evenly in order under their own labels.
10
+ */
11
+ export declare function placeX(svg: SVGSVGElement, layout: Layout, points: readonly Placed[]): void;
12
+ export {};
@@ -0,0 +1,50 @@
1
+ import { centredText, clampLabel, inset, line } from './viewer-chart-svg.js';
2
+ import { axisLabels, timeTicks } from './viewer-chart-time.js';
3
+ /** Equal periods take equal width; the ticks step by one calendar period chosen to fit the width. */
4
+ function placeTimed(svg, layout, times, from, span) {
5
+ const axis = layout.top + layout.plotHeight;
6
+ const low = Math.min(...times);
7
+ const high = Math.max(...times);
8
+ const at = (time) => high === low ? from + span / 2 : from + (time - low) / (high - low) * span;
9
+ layout.xs = times.map(at);
10
+ if (high === low)
11
+ return;
12
+ const ticks = timeTicks(low, high, span);
13
+ for (const tick of ticks)
14
+ svg.append(line('tc-xtick', { x1: at(tick.time), x2: at(tick.time), y1: axis, y2: axis + 4 }));
15
+ for (const label of axisLabels(ticks.map(tick => ({ time: tick.time, x: at(tick.time) })), ticks[0]?.unit ?? 'day', layout)) {
16
+ svg.append(centredText(label.label, 'tc-label', label.at, layout.height - 9));
17
+ }
18
+ }
19
+ /** Whether an ordered point keeps its label: every so many points, and always the last, which the one before yields to. */
20
+ function labelled(index, every, last) {
21
+ if (index === last)
22
+ return true;
23
+ return index % every === 0 && last - index >= every;
24
+ }
25
+ /** Without times the points stand evenly in order under their own labels, as many labels as fit. */
26
+ function placeOrdered(svg, layout, points, from, span) {
27
+ const step = points.length > 1 ? span / (points.length - 1) : 0;
28
+ layout.xs = points.map((_, index) => points.length > 1 ? from + index * step : from + span / 2);
29
+ const labelWidth = Math.max(...points.map(point => point.label.length)) * 7.6 + 10;
30
+ const every = step > 0 ? Math.max(1, Math.ceil(labelWidth / step)) : 1;
31
+ for (const [index, point] of points.entries()) {
32
+ if (!labelled(index, every, points.length - 1))
33
+ continue;
34
+ svg.append(centredText(point.label, 'tc-label', clampLabel(layout.xs[index], point.label, layout), layout.height - 9));
35
+ }
36
+ }
37
+ /**
38
+ * Positions points on the x axis and draws it. When every point has a commit time the axis is time: equal periods take
39
+ * equal width, and the ticks step by one calendar period (a day, a week, a month, a quarter, a year) chosen to fit the
40
+ * width. Without times the points stand evenly in order under their own labels.
41
+ */
42
+ export function placeX(svg, layout, points) {
43
+ const from = layout.left + inset;
44
+ const span = Math.max(1, layout.plotWidth - inset * 2);
45
+ const times = points.map(point => point.time);
46
+ if (points.length > 0 && times.every((time) => time !== null))
47
+ placeTimed(svg, layout, times, from, span);
48
+ else
49
+ placeOrdered(svg, layout, points, from, span);
50
+ }
@@ -0,0 +1,7 @@
1
+ import type { BarOptions } from './viewer-chart-bars.js';
2
+ import type { ChartOptions } from './viewer-chart-line.js';
3
+ import type { ChartPoint } from './viewer-chart-points.js';
4
+ export type { ChartPoint } from './viewer-chart-points.js';
5
+ export declare function renderLineChart(container: HTMLElement, points: readonly ChartPoint[], options: ChartOptions): void;
6
+ /** Diverging bars around zero, one per point; a point without a value gets a mark on the zero line. */
7
+ export declare function renderBarChart(container: HTMLElement, points: readonly ChartPoint[], options: BarOptions): void;
@@ -0,0 +1,50 @@
1
+ // Line and bar charts for the viewer. Drawn as SVG at the container's pixel width,
2
+ // so labels keep their size on every screen. Colours come from CSS classes and theme tokens.
3
+ import { barChart } from './viewer-chart-bars.js';
4
+ import { lineChart } from './viewer-chart-line.js';
5
+ import { plotBottom, plotTop, svgNode } from './viewer-chart-svg.js';
6
+ import { interact } from './viewer-chart-tip.js';
7
+ const observed = new WeakMap();
8
+ const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(entries => {
9
+ for (const entry of entries) {
10
+ const record = observed.get(entry.target);
11
+ const width = Math.round(entry.contentRect.width);
12
+ if (!record || width <= 0 || width === record.width)
13
+ continue;
14
+ record.width = width;
15
+ record.draw(width);
16
+ }
17
+ });
18
+ /** Draws into the container now and again whenever its width changes. */
19
+ function mount(container, draw) {
20
+ const width = Math.round(container.clientWidth);
21
+ observed.set(container, { width, draw });
22
+ observer?.observe(container);
23
+ draw(width || 640);
24
+ }
25
+ function chartHeight(compact) {
26
+ return compact ? 200 : 248;
27
+ }
28
+ export function renderLineChart(container, points, options) {
29
+ const height = options.height ?? chartHeight(options.compact);
30
+ mount(container, width => draw(container, points, width, height, (svg, layout) => lineChart(svg, layout, points, options)));
31
+ }
32
+ /** Diverging bars around zero, one per point; a point without a value gets a mark on the zero line. */
33
+ export function renderBarChart(container, points, options) {
34
+ mount(container, width => draw(container, points, width, chartHeight(options.compact), (svg, layout) => barChart(svg, layout, points, options)));
35
+ }
36
+ function draw(container, points, width, height, body) {
37
+ const layout = { width, height, top: plotTop, plotHeight: height - plotTop - plotBottom, left: 0, plotWidth: 0, xs: [], ys: [] };
38
+ const svg = svgNode('svg', 'tc');
39
+ svg.setAttribute('width', String(width));
40
+ svg.setAttribute('height', String(height));
41
+ svg.setAttribute('viewBox', `0 0 ${width} ${height}`);
42
+ body(svg, layout);
43
+ const tip = document.createElement('div');
44
+ tip.className = 'tc-tip';
45
+ tip.hidden = true;
46
+ tip.setAttribute('aria-hidden', 'true');
47
+ container.classList.add('chart-interactive');
48
+ container.replaceChildren(svg, tip);
49
+ interact(svg, tip, layout, points);
50
+ }
@@ -0,0 +1,27 @@
1
+ import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
2
+ import type { HotspotMetric } from './viewer-inspection.js';
3
+ import type { MapShape } from './viewer-map-shape.js';
4
+ export interface SunburstOptions {
5
+ readonly metric: HotspotMetric;
6
+ readonly directory?: string;
7
+ readonly compact?: boolean;
8
+ /** Rings (a sunburst) or tiles (a treemap); the last choice is remembered for this viewer. */
9
+ readonly shape?: MapShape;
10
+ /** Offered beside the map's title, where the page lets the viewer switch shapes. */
11
+ readonly reshape?: (shape: MapShape) => void;
12
+ /** More controls for the map's title row, such as what it is coloured by. */
13
+ readonly controls?: HTMLElement;
14
+ /** Sizes only, in grey: the map stands for an area with no measurement of its own, as security without a scanner. */
15
+ readonly muted?: boolean;
16
+ /**
17
+ * Security: each file's worst finding level, 0 none to 4 critical, coloured in the grade steps of the security mark.
18
+ * A folder takes the worst level inside it. Files missing from the map have no findings.
19
+ */
20
+ readonly levels?: ReadonlyMap<string, number>;
21
+ href(view: 'hotspots' | 'metrics', options?: {
22
+ directory?: string;
23
+ file?: string;
24
+ }): string;
25
+ }
26
+ /** The code map of a folder: its files sized by lines and coloured by the metric, as rings or tiles. */
27
+ export declare function renderSunburst(details: InspectionDetails, options: SunburstOptions): HTMLElement;