@repometry/cli 0.0.0-dev.0 → 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.
- package/LICENSE +21 -0
- package/README.md +70 -3
- package/package.json +65 -2
- package/target/main/resources/language-catalog.json +61 -0
- package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
- package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
- package/target/main/resources/report/json/config-v2.schema.json +224 -0
- package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
- package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
- package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
- package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
- package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
- package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
- package/target/main/resources/report/json/report-v2.schema.json +530 -0
- package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -0
- package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
- package/target/main/resources/viewer/files.css +616 -0
- package/target/main/resources/viewer/index.html +120 -0
- package/target/main/resources/viewer/projects.html +52 -0
- package/target/main/resources/viewer/styles.css +579 -0
- package/target/main/resources/viewer/viewer-pulls.css +64 -0
- package/target/main/ts/api/cache/root.d.ts +2 -0
- package/target/main/ts/api/cache/root.js +21 -0
- package/target/main/ts/api/gh/github.d.ts +4 -0
- package/target/main/ts/api/gh/github.js +47 -0
- package/target/main/ts/api/git/blob-batch.d.ts +10 -0
- package/target/main/ts/api/git/blob-batch.js +107 -0
- package/target/main/ts/api/git/blob-history.d.ts +20 -0
- package/target/main/ts/api/git/blob-history.js +54 -0
- package/target/main/ts/api/git/changes.d.ts +27 -0
- package/target/main/ts/api/git/changes.js +117 -0
- package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
- package/target/main/ts/api/git/commit-metadata.js +46 -0
- package/target/main/ts/api/git/git-churn.d.ts +9 -0
- package/target/main/ts/api/git/git-churn.js +72 -0
- package/target/main/ts/api/git/git-executable.d.ts +1 -0
- package/target/main/ts/api/git/git-executable.js +31 -0
- package/target/main/ts/api/git/git-reader.d.ts +24 -0
- package/target/main/ts/api/git/git-reader.js +113 -0
- package/target/main/ts/api/git/git.d.ts +47 -0
- package/target/main/ts/api/git/git.js +289 -0
- package/target/main/ts/api/git/inspection-source.d.ts +17 -0
- package/target/main/ts/api/git/inspection-source.js +36 -0
- package/target/main/ts/api/git/line-changes.d.ts +6 -0
- package/target/main/ts/api/git/line-changes.js +57 -0
- package/target/main/ts/api/git/local-sources.d.ts +5 -0
- package/target/main/ts/api/git/local-sources.js +48 -0
- package/target/main/ts/api/git/local.d.ts +7 -0
- package/target/main/ts/api/git/local.js +106 -0
- package/target/main/ts/api/git/source-cache.d.ts +1 -0
- package/target/main/ts/api/git/source-cache.js +42 -0
- package/target/main/ts/api/import/cobertura.d.ts +2 -0
- package/target/main/ts/api/import/cobertura.js +160 -0
- package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
- package/target/main/ts/api/import/coverage-xml.js +135 -0
- package/target/main/ts/api/import/finding-import.d.ts +9 -0
- package/target/main/ts/api/import/finding-import.js +227 -0
- package/target/main/ts/api/import/go-cover.d.ts +13 -0
- package/target/main/ts/api/import/go-cover.js +150 -0
- package/target/main/ts/api/import/lcov-files.d.ts +12 -0
- package/target/main/ts/api/import/lcov-files.js +53 -0
- package/target/main/ts/api/import/profile-file.d.ts +4 -0
- package/target/main/ts/api/import/profile-file.js +17 -0
- package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
- package/target/main/ts/api/process/docker-tool-runner.js +92 -0
- package/target/main/ts/api/process/failure.d.ts +1 -0
- package/target/main/ts/api/process/failure.js +12 -0
- package/target/main/ts/api/process/plugin.d.ts +13 -0
- package/target/main/ts/api/process/plugin.js +100 -0
- package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
- package/target/main/ts/api/process/tool-snapshot.js +26 -0
- package/target/main/ts/cli/arguments.d.ts +28 -0
- package/target/main/ts/cli/arguments.js +109 -0
- package/target/main/ts/cli/config.d.ts +63 -0
- package/target/main/ts/cli/config.js +165 -0
- package/target/main/ts/cli/imports.d.ts +9 -0
- package/target/main/ts/cli/imports.js +37 -0
- package/target/main/ts/cli/main.d.ts +2 -0
- package/target/main/ts/cli/main.js +4 -0
- package/target/main/ts/cli/range-inspection.d.ts +38 -0
- package/target/main/ts/cli/range-inspection.js +34 -0
- package/target/main/ts/cli/range-jobs.d.ts +23 -0
- package/target/main/ts/cli/range-jobs.js +152 -0
- package/target/main/ts/cli/range-worker.d.ts +1 -0
- package/target/main/ts/cli/range-worker.js +40 -0
- package/target/main/ts/cli/reporting.d.ts +42 -0
- package/target/main/ts/cli/reporting.js +98 -0
- package/target/main/ts/cli/revisions.d.ts +6 -0
- package/target/main/ts/cli/revisions.js +16 -0
- package/target/main/ts/cli/run.d.ts +2 -0
- package/target/main/ts/cli/run.js +306 -0
- package/target/main/ts/cli/store.d.ts +13 -0
- package/target/main/ts/cli/store.js +39 -0
- package/target/main/ts/compose/analysis-report.d.ts +6 -0
- package/target/main/ts/compose/analysis-report.js +131 -0
- package/target/main/ts/compose/analysis-results.d.ts +42 -0
- package/target/main/ts/compose/analysis-results.js +84 -0
- package/target/main/ts/compose/analysis-steps.d.ts +23 -0
- package/target/main/ts/compose/analysis-steps.js +217 -0
- package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
- package/target/main/ts/compose/analyze-snapshot.js +21 -0
- package/target/main/ts/compose/attach-churn.d.ts +2 -0
- package/target/main/ts/compose/attach-churn.js +50 -0
- package/target/main/ts/compose/built-ins.d.ts +6 -0
- package/target/main/ts/compose/built-ins.js +12 -0
- package/target/main/ts/compose/diff-coverage.d.ts +25 -0
- package/target/main/ts/compose/diff-coverage.js +82 -0
- package/target/main/ts/compose/distribution.d.ts +17 -0
- package/target/main/ts/compose/distribution.js +13 -0
- package/target/main/ts/compose/docker-image.d.ts +5 -0
- package/target/main/ts/compose/docker-image.js +49 -0
- package/target/main/ts/compose/file-selection.d.ts +9 -0
- package/target/main/ts/compose/file-selection.js +38 -0
- package/target/main/ts/compose/history-cache.d.ts +31 -0
- package/target/main/ts/compose/history-cache.js +62 -0
- package/target/main/ts/compose/inspect.d.ts +34 -0
- package/target/main/ts/compose/inspect.js +51 -0
- package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
- package/target/main/ts/compose/inspection-coverage.js +9 -0
- package/target/main/ts/compose/js-plugin.d.ts +113 -0
- package/target/main/ts/compose/js-plugin.js +99 -0
- package/target/main/ts/compose/language-discovery.d.ts +12 -0
- package/target/main/ts/compose/language-discovery.js +51 -0
- package/target/main/ts/compose/languages.d.ts +64 -0
- package/target/main/ts/compose/languages.js +98 -0
- package/target/main/ts/compose/load-plugins.d.ts +6 -0
- package/target/main/ts/compose/load-plugins.js +71 -0
- package/target/main/ts/compose/parser-order.d.ts +20 -0
- package/target/main/ts/compose/parser-order.js +90 -0
- package/target/main/ts/compose/phases.d.ts +140 -0
- package/target/main/ts/compose/phases.js +147 -0
- package/target/main/ts/compose/plugin-list.d.ts +37 -0
- package/target/main/ts/compose/plugin-list.js +30 -0
- package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
- package/target/main/ts/compose/plugin-manifest.js +50 -0
- package/target/main/ts/compose/plugin-options.d.ts +2 -0
- package/target/main/ts/compose/plugin-options.js +29 -0
- package/target/main/ts/compose/plugin-reference.d.ts +9 -0
- package/target/main/ts/compose/plugin-reference.js +40 -0
- package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
- package/target/main/ts/compose/plugin-requirements.js +83 -0
- package/target/main/ts/compose/plugin-scope.d.ts +9 -0
- package/target/main/ts/compose/plugin-scope.js +60 -0
- package/target/main/ts/compose/process-plugins.d.ts +89 -0
- package/target/main/ts/compose/process-plugins.js +74 -0
- package/target/main/ts/compose/registered-plugin.d.ts +17 -0
- package/target/main/ts/compose/registered-plugin.js +8 -0
- package/target/main/ts/compose/review.d.ts +26 -0
- package/target/main/ts/compose/review.js +54 -0
- package/target/main/ts/compose/schema-error.d.ts +2 -0
- package/target/main/ts/compose/schema-error.js +16 -0
- package/target/main/ts/compose/sources.d.ts +2 -0
- package/target/main/ts/compose/sources.js +32 -0
- package/target/main/ts/compose/structure-measures.d.ts +9 -0
- package/target/main/ts/compose/structure-measures.js +63 -0
- package/target/main/ts/index.d.ts +8 -0
- package/target/main/ts/index.js +5 -0
- package/target/main/ts/plugin.d.ts +2 -0
- package/target/main/ts/plugin.js +2 -0
- package/target/main/ts/plugins/built-in.d.ts +3 -0
- package/target/main/ts/plugins/built-in.js +19 -0
- package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
- package/target/main/ts/plugins/coverage/coverage.js +289 -0
- package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
- package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
- package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
- package/target/main/ts/plugins/duplication/duplication.js +95 -0
- package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
- package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
- package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
- package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
- package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
- package/target/main/ts/plugins/language-js/code-lines.js +36 -0
- package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
- package/target/main/ts/plugins/language-js/extensions.js +3 -0
- package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
- package/target/main/ts/plugins/language-js/function-facts.js +74 -0
- package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
- package/target/main/ts/plugins/language-js/js-security.js +497 -0
- package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
- package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
- package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
- package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
- package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
- package/target/main/ts/plugins/language-js/syntax.js +11 -0
- package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
- package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
- package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
- package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
- package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
- package/target/main/ts/plugins/security/actions-security.js +581 -0
- package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
- package/target/main/ts/plugins/security/dockerfile.js +487 -0
- package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
- package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
- package/target/main/ts/plugins/security/secrets.d.ts +12 -0
- package/target/main/ts/plugins/security/secrets.js +254 -0
- package/target/main/ts/plugins/source/forges.d.ts +4 -0
- package/target/main/ts/plugins/source/forges.js +80 -0
- package/target/main/ts/plugins/structure/structure.d.ts +2 -0
- package/target/main/ts/plugins/structure/structure.js +42 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
- package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
- package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
- package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
- package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
- package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
- package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
- package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
- package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-chart.js +50 -0
- package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
- package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
- package/target/main/ts/report/html/app/viewer-columns.js +97 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
- package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-commits.js +81 -0
- package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
- package/target/main/ts/report/html/app/viewer-controls.js +141 -0
- package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-copy.js +64 -0
- package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-data.js +78 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
- package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-dom.js +99 -0
- package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
- package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
- package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
- package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-files.js +40 -0
- package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
- package/target/main/ts/report/html/app/viewer-filter.js +161 -0
- package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
- package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
- package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
- package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
- package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-issues.js +173 -0
- package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
- package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
- package/target/main/ts/report/html/app/viewer-languages.js +97 -0
- package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
- package/target/main/ts/report/html/app/viewer-layout.js +134 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
- package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
- package/target/main/ts/report/html/app/viewer-locations.js +31 -0
- package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
- package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
- package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
- package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
- package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
- package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
- package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
- package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
- package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
- package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-profile.js +180 -0
- package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer-projects.js +90 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
- package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
- package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
- package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
- package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
- package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
- package/target/main/ts/report/html/app/viewer-route.js +55 -0
- package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-shell.js +113 -0
- package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
- package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
- package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-source.js +57 -0
- package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
- package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
- package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
- package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
- package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
- package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
- package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-totals.js +100 -0
- package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
- package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
- package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
- package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
- package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
- package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
- package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trends.js +89 -0
- package/target/main/ts/report/html/app/viewer.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer.js +222 -0
- package/target/main/ts/report/html/site/badges.d.ts +11 -0
- package/target/main/ts/report/html/site/badges.js +72 -0
- package/target/main/ts/report/html/site/export-site.d.ts +16 -0
- package/target/main/ts/report/html/site/export-site.js +129 -0
- package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
- package/target/main/ts/report/html/site/exported-server.js +72 -0
- package/target/main/ts/report/html/site/local-server.d.ts +7 -0
- package/target/main/ts/report/html/site/local-server.js +59 -0
- package/target/main/ts/report/html/site/projects.d.ts +1 -0
- package/target/main/ts/report/html/site/projects.js +69 -0
- package/target/main/ts/report/html/site/server.d.ts +4 -0
- package/target/main/ts/report/html/site/server.js +65 -0
- package/target/main/ts/report/html/site/source-route.d.ts +6 -0
- package/target/main/ts/report/html/site/source-route.js +23 -0
- package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
- package/target/main/ts/report/json/projections/commit-summary.js +125 -0
- package/target/main/ts/report/json/projections/components.d.ts +4 -0
- package/target/main/ts/report/json/projections/components.js +30 -0
- package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
- package/target/main/ts/report/json/projections/file-metrics.js +260 -0
- package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
- package/target/main/ts/report/json/projections/ignore-view.js +13 -0
- package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
- package/target/main/ts/report/json/projections/inspection-context.js +104 -0
- package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
- package/target/main/ts/report/json/projections/inspection-details.js +98 -0
- package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
- package/target/main/ts/report/json/projections/metric-values.js +104 -0
- package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
- package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
- package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
- package/target/main/ts/report/json/projections/security-summary.js +22 -0
- package/target/main/ts/report/json/store/directory.d.ts +3 -0
- package/target/main/ts/report/json/store/directory.js +19 -0
- package/target/main/ts/report/json/store/local-store.d.ts +25 -0
- package/target/main/ts/report/json/store/local-store.js +214 -0
- package/target/main/ts/report/json/store/object-store.d.ts +14 -0
- package/target/main/ts/report/json/store/object-store.js +73 -0
- package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
- package/target/main/ts/report/json/store/operation-cache.js +32 -0
- package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
- package/target/main/ts/report/json/store/pull-review-store.js +33 -0
- package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
- package/target/main/ts/report/json/store/replace-file.js +35 -0
- package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
- package/target/main/ts/report/json/store/report-tree.js +295 -0
- package/target/main/ts/report/json/store/store-check.d.ts +32 -0
- package/target/main/ts/report/json/store/store-check.js +153 -0
- package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
- package/target/main/ts/report/json/validation/metabranch.js +11 -0
- package/target/main/ts/report/json/validation/report.d.ts +20 -0
- package/target/main/ts/report/json/validation/report.js +77 -0
- package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
- package/target/main/ts/report/json/validation/summary-validation.js +26 -0
- package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
- package/target/main/ts/report/json/wire/compact-json.js +76 -0
- package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
- package/target/main/ts/report/json/wire/component-model.js +1 -0
- package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
- package/target/main/ts/report/json/wire/domain-types.js +1 -0
- package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
- package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
- package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
- package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
- package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
- package/target/main/ts/report/json/wire/project-model.js +1 -0
- package/target/main/ts/report/json/wire/public-history-model.d.ts +36 -0
- package/target/main/ts/report/json/wire/public-history-model.js +5 -0
- package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
- package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
- package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
- package/target/main/ts/report/json/wire/summary-model.js +1 -0
- package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
- package/target/main/ts/report/markdown/pull-review.js +132 -0
- package/target/main/ts/report.d.ts +23 -0
- package/target/main/ts/report.js +12 -0
- package/target/main/ts/runtime.d.ts +17 -0
- package/target/main/ts/runtime.js +30 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { pluginApi } from '@repometry/core/internal/engine/plugin.js';
|
|
2
|
+
const manifest = {
|
|
3
|
+
api: pluginApi, version: '1.0.0', kinds: ['source'],
|
|
4
|
+
operations: [], produces: [{ contract: 'repometry.source-locator/v1', persistence: 'transient' }],
|
|
5
|
+
};
|
|
6
|
+
export const localSource = {
|
|
7
|
+
...manifest, id: 'local',
|
|
8
|
+
locate: () => ({ provider: 'local', url: './sources/{revision}/{path}' }),
|
|
9
|
+
};
|
|
10
|
+
export const githubSource = {
|
|
11
|
+
...manifest, id: 'github',
|
|
12
|
+
locate(context) {
|
|
13
|
+
const project = forgeProject(context, 'github.com', context.env.GITHUB_REPOSITORY, context.env.GITHUB_SERVER_URL, 2);
|
|
14
|
+
if (!project)
|
|
15
|
+
return undefined;
|
|
16
|
+
const { origin, path } = project;
|
|
17
|
+
const url = origin === 'https://github.com' ? `https://raw.githubusercontent.com/${path}/{revision}/{path}`
|
|
18
|
+
: `${origin}/${path}/raw/{revision}/{path}`;
|
|
19
|
+
return { provider: 'github', url, web: `${origin}/${path}/blob/{revision}/{path}#L{line}` };
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const gitlabSource = {
|
|
23
|
+
...manifest, id: 'gitlab',
|
|
24
|
+
locate(context) {
|
|
25
|
+
const project = forgeProject(context, 'gitlab.com', context.env.CI_PROJECT_PATH, context.env.CI_SERVER_URL);
|
|
26
|
+
if (!project)
|
|
27
|
+
return undefined;
|
|
28
|
+
const { origin, path } = project;
|
|
29
|
+
return { provider: 'gitlab', url: `${origin}/api/v4/projects/${encodeURIComponent(path)}/repository/files/{path:component}/raw?ref={revision}`,
|
|
30
|
+
web: `${origin}/${path}/-/blob/{revision}/{path}#L{line}` };
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
function forgeProject(context, host, ciProject, ciServer, segments) {
|
|
34
|
+
if (context.option !== undefined && context.option !== '') {
|
|
35
|
+
const explicit = remoteProject(context.option) ?? projectAt('https://' + host, context.option);
|
|
36
|
+
return validProject(explicit, segments);
|
|
37
|
+
}
|
|
38
|
+
if (ciProject)
|
|
39
|
+
return validProject(projectAt(ciServer ?? 'https://' + host, ciProject), segments);
|
|
40
|
+
for (const remote of context.remotes) {
|
|
41
|
+
const project = validProject(remoteProject(remote), segments);
|
|
42
|
+
if (project && new URL(project.origin).hostname.toLowerCase() === host)
|
|
43
|
+
return project;
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
function validProject(project, segments) {
|
|
48
|
+
if (!project)
|
|
49
|
+
return undefined;
|
|
50
|
+
const parts = project.path.split('/');
|
|
51
|
+
return parts.length >= 2 && (segments === undefined || parts.length === segments) ? project : undefined;
|
|
52
|
+
}
|
|
53
|
+
function projectAt(server, path) {
|
|
54
|
+
try {
|
|
55
|
+
const url = new URL(server);
|
|
56
|
+
if (!['https:', 'http:'].includes(url.protocol) || url.username || url.password)
|
|
57
|
+
return undefined;
|
|
58
|
+
const project = path.replace(/^\/+|\/+$/g, '').replace(/\.git$/, '');
|
|
59
|
+
return project.split('/').every(part => /^[A-Za-z0-9_.-]+$/.test(part) && part !== '.' && part !== '..')
|
|
60
|
+
? { origin: url.origin, path: project } : undefined;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function remoteProject(remote) {
|
|
67
|
+
const scp = /^(?:[^@/]+@)?([a-z\d.-]+):([^/][^?#]*)$/i.exec(remote);
|
|
68
|
+
if (scp)
|
|
69
|
+
return projectAt(`https://${scp[1]}`, scp[2]);
|
|
70
|
+
try {
|
|
71
|
+
const url = new URL(remote);
|
|
72
|
+
if (!['https:', 'http:', 'ssh:'].includes(url.protocol))
|
|
73
|
+
return undefined;
|
|
74
|
+
return projectAt((url.protocol === 'ssh:' ? 'https://' + url.hostname : url.origin), url.pathname);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=forges.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { codeStructure } from '@repometry/core/internal/engine/author-contracts.js';
|
|
2
|
+
import { pluginManifestSchema } from '@repometry/core/internal/engine/plugin-manifest.js';
|
|
3
|
+
import { definitions, measurements } from '@repometry/core/internal/model/measurement.js';
|
|
4
|
+
export const structure = {
|
|
5
|
+
schema: pluginManifestSchema,
|
|
6
|
+
id: 'structure',
|
|
7
|
+
category: 'maintainability',
|
|
8
|
+
version: '1.0.0',
|
|
9
|
+
create() {
|
|
10
|
+
return {
|
|
11
|
+
produces: [{ contract: measurements.id, persistence: 'report', metrics: [
|
|
12
|
+
{ id: definitions.lines, label: 'Physical lines', unit: 'count', scope: 'file', aggregate: 'sum', better: 'none', group: 'Size' },
|
|
13
|
+
{ id: definitions.functions, label: 'Functions', unit: 'count', scope: 'file', aggregate: 'sum', better: 'none', group: 'Size' },
|
|
14
|
+
{ id: definitions.complexity, label: 'Most complex function', short: 'Peak cyclomatic', unit: 'count', scope: 'file',
|
|
15
|
+
aggregate: 'max', better: 'lower', bands: [5, 10, 20, 50], group: 'Maintainability' },
|
|
16
|
+
] }],
|
|
17
|
+
operations: [{
|
|
18
|
+
id: 'size',
|
|
19
|
+
role: 'inspection',
|
|
20
|
+
inputs: { syntax: codeStructure },
|
|
21
|
+
output: measurements,
|
|
22
|
+
execute(inputs) {
|
|
23
|
+
const { path, lines, functions } = inputs.read('syntax', codeStructure);
|
|
24
|
+
return [
|
|
25
|
+
{ definition: definitions.lines, target: 'file', path, value: lines },
|
|
26
|
+
...(functions === undefined ? [] : [{ definition: definitions.functions, target: 'file', path, value: functions }]),
|
|
27
|
+
];
|
|
28
|
+
},
|
|
29
|
+
}, {
|
|
30
|
+
id: 'complexity',
|
|
31
|
+
role: 'inspection',
|
|
32
|
+
inputs: { syntax: codeStructure },
|
|
33
|
+
output: measurements,
|
|
34
|
+
execute(inputs) {
|
|
35
|
+
const { path, cyclomaticFunctions = [] } = inputs.read('syntax', codeStructure);
|
|
36
|
+
return cyclomaticFunctions.map(({ line, column, name, value }) => ({ definition: definitions.complexity, target: 'function', path, line, column, name, value }));
|
|
37
|
+
},
|
|
38
|
+
}],
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=structure.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartPoint } from './viewer-chart-points.js';
|
|
2
|
+
import type { Layout } from './viewer-chart-svg.js';
|
|
3
|
+
export interface BarOptions {
|
|
4
|
+
readonly format: (value: number) => string;
|
|
5
|
+
readonly compact: boolean;
|
|
6
|
+
/** Positive values are bad news (for example, added debt). */
|
|
7
|
+
readonly upIsWorse: boolean;
|
|
8
|
+
/** Round tick values to this unit, as for line charts. */
|
|
9
|
+
readonly tickUnit?: number | undefined;
|
|
10
|
+
/** Draw a dashed line where the inspection profile changed; off unless asked for. */
|
|
11
|
+
readonly boundaries?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function barChart(svg: SVGSVGElement, layout: Layout, points: readonly ChartPoint[], options: BarOptions): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { markBoundaries, measuredValues, pointLink } from './viewer-chart-points.js';
|
|
2
|
+
import { yAxis } from './viewer-chart-scale.js';
|
|
3
|
+
import { centredText, line, setAttributes, svgNode } from './viewer-chart-svg.js';
|
|
4
|
+
import { placeX } from './viewer-chart-x.js';
|
|
5
|
+
/** One width for every bar, set by the two closest inspections: only a bar's height says how much changed. */
|
|
6
|
+
function barWidth(xs) {
|
|
7
|
+
const gaps = xs.slice(1).map((at, index) => at - xs[index]);
|
|
8
|
+
return Math.max(2, Math.min(28, gaps.length ? Math.min(...gaps) * .62 : 28));
|
|
9
|
+
}
|
|
10
|
+
/** The room beside a bar: the distance to the nearer neighbour. */
|
|
11
|
+
function room(x, count, index) {
|
|
12
|
+
const before = index > 0 ? x(index) - x(index - 1) : Infinity;
|
|
13
|
+
const after = index < count - 1 ? x(index + 1) - x(index) : Infinity;
|
|
14
|
+
return Math.min(before, after);
|
|
15
|
+
}
|
|
16
|
+
/** A bar from zero to the value, labelled where the label fits or the commit is the selected one. */
|
|
17
|
+
function bar({ points, x, y, format, upIsWorse, width }, index, space) {
|
|
18
|
+
const point = points[index];
|
|
19
|
+
const value = point.value;
|
|
20
|
+
const worse = upIsWorse ? value > 0 : value < 0;
|
|
21
|
+
const rect = svgNode('rect', `tc-bar ${worse ? 'tc-bar-worse' : 'tc-bar-better'}${point.current ? ' tc-bar-current' : ''}`);
|
|
22
|
+
setAttributes(rect, { x: x(index) - width / 2, y: Math.min(y(value), y(0)), width, height: Math.max(1, Math.abs(y(value) - y(0))) });
|
|
23
|
+
if (!point.current && format(value).length * 7.6 >= space)
|
|
24
|
+
return [rect];
|
|
25
|
+
const at = value > 0 ? y(value) - 7 : y(value) + 16;
|
|
26
|
+
return [rect, centredText(format(value), point.current ? 'tc-value tc-value-current' : 'tc-value', x(index), at)];
|
|
27
|
+
}
|
|
28
|
+
/** A point's marks: its bar, a flat mark for no change, or a tick on the zero line where nothing was measured. */
|
|
29
|
+
function barMarks(context, index) {
|
|
30
|
+
const { points, x, y, width } = context;
|
|
31
|
+
const value = points[index].value;
|
|
32
|
+
const space = room(x, points.length, index);
|
|
33
|
+
const cx = x(index);
|
|
34
|
+
if (value === null)
|
|
35
|
+
return [line('tc-missing-mark', { x1: cx, x2: cx, y1: y(0) - 3.5, y2: y(0) + 3.5 })];
|
|
36
|
+
if (value === 0)
|
|
37
|
+
return [line('tc-zero-mark', { x1: cx - width / 2, x2: cx + width / 2, y1: y(0), y2: y(0) })];
|
|
38
|
+
return bar(context, index, space);
|
|
39
|
+
}
|
|
40
|
+
export function barChart(svg, layout, points, options) {
|
|
41
|
+
svg.classList.add('tc-bars');
|
|
42
|
+
const y = yAxis(svg, layout, { values: measuredValues(points.map(point => point.value)), ratio: false, count: options.compact ? 3 : 4,
|
|
43
|
+
format: options.format, tickUnit: options.tickUnit ?? 1, zero: true });
|
|
44
|
+
placeX(svg, layout, points);
|
|
45
|
+
if (options.boundaries)
|
|
46
|
+
markBoundaries(svg, layout, points);
|
|
47
|
+
const x = (index) => layout.xs[index];
|
|
48
|
+
layout.ys = points.map(point => point.value === null ? null : y(point.value));
|
|
49
|
+
// In a long history the zero line already says "no change" and "not measured"; only bars that moved are drawn.
|
|
50
|
+
const dense = layout.xs.some((at, index) => index > 0 && at - layout.xs[index - 1] < 7);
|
|
51
|
+
const context = { ...options, points, x, y, width: barWidth(layout.xs) };
|
|
52
|
+
for (const [index, point] of points.entries()) {
|
|
53
|
+
const link = pointLink(point, index);
|
|
54
|
+
const quiet = !point.current && !point.value;
|
|
55
|
+
if (!dense || !quiet)
|
|
56
|
+
link.append(...barMarks(context, index));
|
|
57
|
+
svg.append(link);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChartPoint } from './viewer-chart-points.js';
|
|
2
|
+
export interface LabelContext {
|
|
3
|
+
readonly points: readonly ChartPoint[];
|
|
4
|
+
readonly x: (index: number) => number;
|
|
5
|
+
readonly y: (value: number) => number;
|
|
6
|
+
readonly format: (value: number) => string;
|
|
7
|
+
/** The y of the plot's bottom edge. */
|
|
8
|
+
readonly axis: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The value of the labelled point. A flag on this point or one just beside it takes the space above, so the value
|
|
12
|
+
* moves left of the pole; a label pushed far from its point would sit on the line, so it goes under the point instead,
|
|
13
|
+
* where a flag never is.
|
|
14
|
+
*/
|
|
15
|
+
export declare function valueLabel(context: LabelContext, index: number): SVGTextElement;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { text } from './viewer-chart-svg.js';
|
|
2
|
+
/** The x of every flag whose pole and pennant a label between `left` and `anchor` at `top` would cover. */
|
|
3
|
+
function flagsCrossed({ points, x, y }, left, anchor, top) {
|
|
4
|
+
return points.flatMap((other, at) => {
|
|
5
|
+
if (!other.flag || other.value === null)
|
|
6
|
+
return [];
|
|
7
|
+
const foot = y(other.value) - 4;
|
|
8
|
+
const across = x(at) >= left && x(at) <= anchor + 11;
|
|
9
|
+
return across && top > foot - 22 && top - 14 < foot ? [x(at)] : [];
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** The label runs left from its anchor; it steps left of every flag it would cross, so it never covers one. */
|
|
13
|
+
function clearOfFlags(context, start, top, width) {
|
|
14
|
+
let anchor = start;
|
|
15
|
+
let poles = [];
|
|
16
|
+
for (let pass = 0; pass < 4; pass += 1) {
|
|
17
|
+
const crossed = flagsCrossed(context, anchor - width - 4, anchor, top);
|
|
18
|
+
if (!crossed.length || Math.min(...crossed) - 7 >= anchor)
|
|
19
|
+
break;
|
|
20
|
+
poles = crossed;
|
|
21
|
+
anchor = Math.min(...crossed) - 7;
|
|
22
|
+
}
|
|
23
|
+
return { anchor, poles };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The value of the labelled point. A flag on this point or one just beside it takes the space above, so the value
|
|
27
|
+
* moves left of the pole; a label pushed far from its point would sit on the line, so it goes under the point instead,
|
|
28
|
+
* where a flag never is.
|
|
29
|
+
*/
|
|
30
|
+
export function valueLabel(context, index) {
|
|
31
|
+
const { points, x, y, format, axis } = context;
|
|
32
|
+
const point = points[index];
|
|
33
|
+
const value = point.value;
|
|
34
|
+
const last = index === points.length - 1;
|
|
35
|
+
const top = y(value) - 11;
|
|
36
|
+
const cleared = clearOfFlags(context, x(index), top, format(value).length * 7.2);
|
|
37
|
+
const below = x(index) - cleared.anchor > 40 && y(value) + 22 <= axis;
|
|
38
|
+
const anchor = below ? x(index) + (last ? 4 : 0) : cleared.anchor;
|
|
39
|
+
const label = text(format(value), point.current ? 'tc-value tc-value-current' : 'tc-value', anchor, below ? y(value) + 21 : top);
|
|
40
|
+
const flush = (cleared.poles.length > 0 && !below) || (last && points.length > 1);
|
|
41
|
+
label.setAttribute('text-anchor', flush ? 'end' : 'middle');
|
|
42
|
+
return label;
|
|
43
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ChartPoint } from './viewer-chart-points.js';
|
|
2
|
+
import type { Layout } from './viewer-chart-svg.js';
|
|
3
|
+
export interface ChartOptions {
|
|
4
|
+
readonly format: (value: number) => string;
|
|
5
|
+
/** Values are ratios within [0, 1]. */
|
|
6
|
+
readonly ratio: boolean;
|
|
7
|
+
readonly compact: boolean;
|
|
8
|
+
/** Ticks fall on whole multiples of this unit, for example 60 to tick minutes in whole hours. */
|
|
9
|
+
readonly tickUnit?: number;
|
|
10
|
+
/** Label the selected point's value; off where the page already shows it next to the chart. */
|
|
11
|
+
readonly labelCurrent?: boolean;
|
|
12
|
+
/** Overall height in pixels, where the layout needs the chart to fill a given space. */
|
|
13
|
+
readonly height?: number | undefined;
|
|
14
|
+
/** A second series drawn as a grey line behind the first, on its own scale labelled at the right edge. */
|
|
15
|
+
readonly secondary?: SecondarySeries | undefined;
|
|
16
|
+
/** Draw a dashed line where the inspection profile changed; off unless asked for. */
|
|
17
|
+
readonly boundaries?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SecondarySeries {
|
|
20
|
+
/** One value per point, in the same order. */
|
|
21
|
+
readonly values: readonly (number | null)[];
|
|
22
|
+
readonly format: (value: number) => string;
|
|
23
|
+
/** Ticks fall on whole multiples of this unit, as for the main series. */
|
|
24
|
+
readonly tickUnit?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A dot per commit is noise once commits sit close together: the line carries the curve, and a dot marks only what
|
|
28
|
+
* says something (the selected and the last commit, flags, and a lone measurement with no line to join). A profile
|
|
29
|
+
* change is no reason for a dot, and an inspection without a value gets none.
|
|
30
|
+
* Hover and the keyboard move one dot along the line instead. Only a short, sparse series keeps a dot per commit.
|
|
31
|
+
*/
|
|
32
|
+
export declare function marked(points: readonly ChartPoint[], index: number, sparse: boolean): boolean;
|
|
33
|
+
export declare function lineChart(svg: SVGSVGElement, layout: Layout, points: readonly ChartPoint[], { format, ratio, compact, tickUnit, labelCurrent, secondary, boundaries }: ChartOptions): void;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { valueLabel } from './viewer-chart-label.js';
|
|
2
|
+
import { flagMark, markBoundaries, measuredValues, pointLink, segments, stepPath } from './viewer-chart-points.js';
|
|
3
|
+
import { niceStep, yAxis } from './viewer-chart-scale.js';
|
|
4
|
+
import { setAttributes, svgNode } from './viewer-chart-svg.js';
|
|
5
|
+
import { placeX } from './viewer-chart-x.js';
|
|
6
|
+
/**
|
|
7
|
+
* The second scale starts at zero and shares the main grid lines: each line carries one round value of each. Its top
|
|
8
|
+
* is known once the main axis has settled how many lines there are.
|
|
9
|
+
*/
|
|
10
|
+
function secondScale(secondary) {
|
|
11
|
+
const values = measuredValues(secondary.values);
|
|
12
|
+
const scale = { high: 0, labels: undefined };
|
|
13
|
+
if (!values.length)
|
|
14
|
+
return scale;
|
|
15
|
+
scale.labels = ticks => {
|
|
16
|
+
const unit = secondary.tickUnit ?? 1;
|
|
17
|
+
const step = niceStep(Math.max(...values, 0) / unit / Math.max(1, ticks - 1)) * unit;
|
|
18
|
+
scale.high = step * (ticks - 1);
|
|
19
|
+
return Array.from({ length: ticks }, (_, index) => index === 0 ? '0' : secondary.format(step * index));
|
|
20
|
+
};
|
|
21
|
+
return scale;
|
|
22
|
+
}
|
|
23
|
+
function drawSecondary(svg, layout, secondary, high, x) {
|
|
24
|
+
const y = (value) => layout.top + layout.plotHeight - value / high * layout.plotHeight;
|
|
25
|
+
for (const segment of segments(secondary.values)) {
|
|
26
|
+
const path = svgNode('path', 'tc-line tc-line-secondary');
|
|
27
|
+
path.setAttribute('d', stepPath(segment, index => secondary.values[index], x, y));
|
|
28
|
+
svg.append(path);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A dot per commit is noise once commits sit close together: the line carries the curve, and a dot marks only what
|
|
33
|
+
* says something (the selected and the last commit, flags, and a lone measurement with no line to join). A profile
|
|
34
|
+
* change is no reason for a dot, and an inspection without a value gets none.
|
|
35
|
+
* Hover and the keyboard move one dot along the line instead. Only a short, sparse series keeps a dot per commit.
|
|
36
|
+
*/
|
|
37
|
+
export function marked(points, index, sparse) {
|
|
38
|
+
const point = points[index];
|
|
39
|
+
if (point.value === null)
|
|
40
|
+
return false;
|
|
41
|
+
if (sparse || point.current || index === points.length - 1 || point.flag)
|
|
42
|
+
return true;
|
|
43
|
+
return points.filter(entry => entry.value !== null).length < 2;
|
|
44
|
+
}
|
|
45
|
+
function pointMarks(point, cx, cy) {
|
|
46
|
+
const dot = svgNode('circle', point.current ? 'tc-dot tc-dot-current' : 'tc-dot');
|
|
47
|
+
if (point.partial)
|
|
48
|
+
dot.classList.add('tc-dot-partial');
|
|
49
|
+
setAttributes(dot, { cx, cy, r: point.current ? 5 : 3.5 });
|
|
50
|
+
return point.flag ? [flagMark(point.flag, cx, cy), dot] : [dot];
|
|
51
|
+
}
|
|
52
|
+
/** Each marked point's dot, flag or gap mark, and the one value the chart labels. */
|
|
53
|
+
function drawMarks(svg, layout, points, { format, labelCurrent, y }) {
|
|
54
|
+
const x = (index) => layout.xs[index];
|
|
55
|
+
const axis = layout.top + layout.plotHeight;
|
|
56
|
+
const sparse = points.length <= 12 && layout.xs.every((at, index) => index === 0 || at - layout.xs[index - 1] >= 24);
|
|
57
|
+
// One value is labelled: the selected commit's, or the last one when the selection is off the chart.
|
|
58
|
+
const selectedIndex = points.findIndex(point => point.current && point.value !== null);
|
|
59
|
+
const labelled = labelCurrent && selectedIndex >= 0 ? selectedIndex : points.length - 1;
|
|
60
|
+
const context = { points, x, y, format, axis };
|
|
61
|
+
for (const [index, point] of points.entries()) {
|
|
62
|
+
if (!marked(points, index, sparse))
|
|
63
|
+
continue;
|
|
64
|
+
const link = pointLink(point, index);
|
|
65
|
+
link.append(...pointMarks(point, x(index), y(point.value)));
|
|
66
|
+
if (index === labelled)
|
|
67
|
+
link.append(valueLabel(context, index));
|
|
68
|
+
svg.append(link);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function lineChart(svg, layout, points, { format, ratio, compact, tickUnit = 1, labelCurrent = true, secondary, boundaries = false }) {
|
|
72
|
+
const second = secondary && secondScale(secondary);
|
|
73
|
+
const y = yAxis(svg, layout, { values: measuredValues(points.map(point => point.value)), ratio, count: compact ? 3 : 4, format, tickUnit,
|
|
74
|
+
zero: false, rightLabels: second?.labels });
|
|
75
|
+
placeX(svg, layout, points);
|
|
76
|
+
const x = (index) => layout.xs[index];
|
|
77
|
+
if (boundaries)
|
|
78
|
+
markBoundaries(svg, layout, points);
|
|
79
|
+
if (secondary && second.high > 0)
|
|
80
|
+
drawSecondary(svg, layout, secondary, second.high, x);
|
|
81
|
+
for (const segment of segments(points.map(point => point.value))) {
|
|
82
|
+
const path = svgNode('path', 'tc-line');
|
|
83
|
+
path.setAttribute('d', stepPath(segment, index => points[index].value, x, y));
|
|
84
|
+
svg.append(path);
|
|
85
|
+
}
|
|
86
|
+
layout.ys = points.map(point => point.value === null ? null : y(point.value));
|
|
87
|
+
drawMarks(svg, layout, points, { format, labelCurrent, y });
|
|
88
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ProfileBoundary } from '../../json/wire/inspection-context-model.js';
|
|
2
|
+
import type { Layout } from './viewer-chart-svg.js';
|
|
3
|
+
export interface ChartPoint {
|
|
4
|
+
readonly value: number | null;
|
|
5
|
+
/** Axis label used only when the points have no commit times. */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/** Accessible name of the point. */
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly href: string;
|
|
10
|
+
readonly current: boolean;
|
|
11
|
+
readonly partial: boolean;
|
|
12
|
+
readonly boundary?: ProfileBoundary | null;
|
|
13
|
+
/** Commit time in milliseconds; the x axis is a time scale when every point has one. */
|
|
14
|
+
readonly time: number | null;
|
|
15
|
+
/** Hover card lines: a heading, then details. */
|
|
16
|
+
readonly tip: ChartTip;
|
|
17
|
+
/** A green flag on the best value of the series, a red one at half-mast on the worst. */
|
|
18
|
+
readonly flag?: 'best' | 'worst' | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface ChartTip {
|
|
21
|
+
readonly heading: string;
|
|
22
|
+
readonly commit: string;
|
|
23
|
+
/** The commit's message, first line: what the chart's step was. */
|
|
24
|
+
readonly subject?: string;
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly change?: {
|
|
27
|
+
readonly text: string;
|
|
28
|
+
readonly direction: string;
|
|
29
|
+
} | null;
|
|
30
|
+
readonly notes: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export type Flag = NonNullable<ChartPoint['flag']>;
|
|
33
|
+
/** The values the points measured, in order, without the gaps. */
|
|
34
|
+
export declare function measuredValues(values: readonly (number | null)[]): number[];
|
|
35
|
+
/**
|
|
36
|
+
* The measured points joined into one line: an inspection with no value is skipped, not a break, since most commits
|
|
37
|
+
* import no coverage; a profile change does not cut the line either. Fewer than two measurements draw no line.
|
|
38
|
+
*/
|
|
39
|
+
export declare function segments(values: readonly (number | null)[]): number[][];
|
|
40
|
+
/**
|
|
41
|
+
* Code keeps its state until the next commit, so the line holds each value and steps at the commit that changed it;
|
|
42
|
+
* a slope would invent values for the days between commits. A run of equal values is one horizontal stroke, so ten
|
|
43
|
+
* thousand quiet commits cost a single segment.
|
|
44
|
+
*/
|
|
45
|
+
export declare function stepPath(segment: readonly number[], valueAt: (index: number) => number, x: (index: number) => number, y: (value: number) => number): string;
|
|
46
|
+
/** A dashed line where the profile changed between two inspections. */
|
|
47
|
+
export declare function markBoundaries(svg: SVGSVGElement, layout: Layout, points: readonly ChartPoint[]): void;
|
|
48
|
+
/** A tiny flag planted in the point: the pennant of the logo on a short pole, both in the flag's colour. */
|
|
49
|
+
export declare function flagMark(kind: Flag, x: number, y: number): SVGGElement;
|
|
50
|
+
export declare function flagIcon(kind: Flag): SVGSVGElement;
|
|
51
|
+
/** A point's link to its commit, which holds its marks. */
|
|
52
|
+
export declare function pointLink(point: ChartPoint, index: number): SVGAElement;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { line, setAttributes, svgNode } from './viewer-chart-svg.js';
|
|
2
|
+
/** The values the points measured, in order, without the gaps. */
|
|
3
|
+
export function measuredValues(values) {
|
|
4
|
+
return values.flatMap(value => value === null ? [] : [value]);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The measured points joined into one line: an inspection with no value is skipped, not a break, since most commits
|
|
8
|
+
* import no coverage; a profile change does not cut the line either. Fewer than two measurements draw no line.
|
|
9
|
+
*/
|
|
10
|
+
export function segments(values) {
|
|
11
|
+
const run = values.flatMap((value, index) => value === null ? [] : [index]);
|
|
12
|
+
return run.length > 1 ? [run] : [];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Code keeps its state until the next commit, so the line holds each value and steps at the commit that changed it;
|
|
16
|
+
* a slope would invent values for the days between commits. A run of equal values is one horizontal stroke, so ten
|
|
17
|
+
* thousand quiet commits cost a single segment.
|
|
18
|
+
*/
|
|
19
|
+
export function stepPath(segment, valueAt, x, y) {
|
|
20
|
+
return segment.map((index, order) => {
|
|
21
|
+
const value = valueAt(index);
|
|
22
|
+
if (!order)
|
|
23
|
+
return `M${x(index).toFixed(1)},${y(value).toFixed(1)}`;
|
|
24
|
+
const last = order === segment.length - 1;
|
|
25
|
+
return value === valueAt(segment[order - 1]) && !last ? '' : `H${x(index).toFixed(1)}V${y(value).toFixed(1)}`;
|
|
26
|
+
}).join('');
|
|
27
|
+
}
|
|
28
|
+
/** A dashed line where the profile changed between two inspections. */
|
|
29
|
+
export function markBoundaries(svg, layout, points) {
|
|
30
|
+
for (const [index, point] of points.entries()) {
|
|
31
|
+
if (index === 0 || !point.boundary)
|
|
32
|
+
continue;
|
|
33
|
+
const x = layout.xs[index];
|
|
34
|
+
svg.append(line(`tc-profile-${point.boundary}`, { x1: x, x2: x, y1: layout.top, y2: layout.top + layout.plotHeight }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** A tiny flag planted in the point: the pennant of the logo on a short pole, both in the flag's colour. */
|
|
38
|
+
export function flagMark(kind, x, y) {
|
|
39
|
+
const group = svgNode('g', `tc-flag tc-flag-${kind}`);
|
|
40
|
+
const foot = y - 4;
|
|
41
|
+
const head = foot - 12;
|
|
42
|
+
const pole = svgNode('rect');
|
|
43
|
+
setAttributes(pole, { x: x - .75, y: head, width: 1.5, height: foot - head });
|
|
44
|
+
const pennant = svgNode('path');
|
|
45
|
+
pennant.setAttribute('d', `M${(x + .75).toFixed(1)},${head.toFixed(1)}L${(x + 10).toFixed(1)},${(head - .4).toFixed(1)}L${(x + .75).toFixed(1)},${(head + 5.5).toFixed(1)}Z`);
|
|
46
|
+
group.append(pole, pennant);
|
|
47
|
+
return group;
|
|
48
|
+
}
|
|
49
|
+
export function flagIcon(kind) {
|
|
50
|
+
const icon = svgNode('svg', `tc-flag tc-flag-${kind}`);
|
|
51
|
+
icon.setAttribute('viewBox', '0 -1 11 14');
|
|
52
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
53
|
+
icon.append(flagMark(kind, 1, 16));
|
|
54
|
+
return icon;
|
|
55
|
+
}
|
|
56
|
+
/** A point's link to its commit, which holds its marks. */
|
|
57
|
+
export function pointLink(point, index) {
|
|
58
|
+
const link = svgNode('a', 'tc-point');
|
|
59
|
+
link.setAttribute('href', point.href);
|
|
60
|
+
link.setAttribute('aria-label', point.title);
|
|
61
|
+
link.dataset.index = String(index);
|
|
62
|
+
if (point.current)
|
|
63
|
+
link.setAttribute('aria-current', 'true');
|
|
64
|
+
return link;
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Layout } from './viewer-chart-svg.js';
|
|
2
|
+
export interface YScale {
|
|
3
|
+
readonly values: readonly number[];
|
|
4
|
+
/** Values are ratios within [0, 1]. */
|
|
5
|
+
readonly ratio: boolean;
|
|
6
|
+
/** About how many grid lines the scale has. */
|
|
7
|
+
readonly count: number;
|
|
8
|
+
readonly format: (value: number) => string;
|
|
9
|
+
/** Ticks fall on whole multiples of this unit. */
|
|
10
|
+
readonly tickUnit: number;
|
|
11
|
+
/** The scale holds zero and marks it: the base of diverging bars. */
|
|
12
|
+
readonly zero: boolean;
|
|
13
|
+
/** Labels for a second scale at the right edge, one per grid line. */
|
|
14
|
+
readonly rightLabels?: ((ticks: number) => readonly string[]) | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Draws the value axis and its grid, sets the plot's left edge and width, and returns the value-to-y mapping. */
|
|
17
|
+
export declare function yAxis(svg: SVGSVGElement, layout: Layout, scale: YScale): (value: number) => number;
|
|
18
|
+
/** A round step near the given one: 1, 2, 2.5 or 5 times a power of ten. */
|
|
19
|
+
export declare function niceStep(raw: number): number;
|
|
20
|
+
/** Evenly spaced round ticks that cover the data with a margin. */
|
|
21
|
+
export declare function niceTicks(values: readonly number[], ratio: boolean, count: number): number[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { line, plotRight, text } from './viewer-chart-svg.js';
|
|
2
|
+
let measure;
|
|
3
|
+
/** Rendered width of a 13 px tick label; an estimate where the page cannot measure text. */
|
|
4
|
+
function tickWidth(label) {
|
|
5
|
+
if (measure === undefined) {
|
|
6
|
+
measure = typeof document === 'undefined' ? null : document.createElement('canvas').getContext('2d');
|
|
7
|
+
if (measure)
|
|
8
|
+
measure.font = `13px ${getComputedStyle(document.documentElement).fontFamily}`;
|
|
9
|
+
}
|
|
10
|
+
return measure ? measure.measureText(label).width : label.length * 8.6;
|
|
11
|
+
}
|
|
12
|
+
function widest(labels) {
|
|
13
|
+
return Math.ceil(Math.max(...labels.map(tickWidth)));
|
|
14
|
+
}
|
|
15
|
+
/** The ticks' words: percentages with as many decimals as the step needs, zero plainly on a diverging scale. */
|
|
16
|
+
function tickTexts(ticks, { ratio, zero, format }) {
|
|
17
|
+
const tickStep = ticks.length > 1 ? ticks[1] - ticks[0] : 1;
|
|
18
|
+
const digits = Math.min(3, Math.max(0, -Math.floor(Math.log10(tickStep * 100) + 1e-9)));
|
|
19
|
+
const tickPercent = new Intl.NumberFormat(undefined, { style: 'percent', minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
20
|
+
const word = ratio ? (tick) => tickPercent.format(tick) : format;
|
|
21
|
+
return ticks.map(tick => zero && tick === 0 ? '0' : word(tick));
|
|
22
|
+
}
|
|
23
|
+
/** Draws the value axis and its grid, sets the plot's left edge and width, and returns the value-to-y mapping. */
|
|
24
|
+
export function yAxis(svg, layout, scale) {
|
|
25
|
+
const { values, ratio, count, tickUnit, zero } = scale;
|
|
26
|
+
const ticks = niceTicks((zero ? [...values, 0] : values).map(value => value / tickUnit), ratio, count).map(tick => tick * tickUnit);
|
|
27
|
+
const labels = tickTexts(ticks, scale);
|
|
28
|
+
layout.left = widest(labels) + 12;
|
|
29
|
+
// A second scale takes a label column at the right, one label per grid line.
|
|
30
|
+
const secondLabels = scale.rightLabels?.(ticks.length) ?? [];
|
|
31
|
+
const reserve = secondLabels.length ? widest(secondLabels) + 12 - plotRight : 0;
|
|
32
|
+
layout.plotWidth = Math.max(40, layout.width - layout.left - plotRight - reserve);
|
|
33
|
+
const low = ticks[0];
|
|
34
|
+
const high = ticks.at(-1);
|
|
35
|
+
const y = (value) => layout.top + layout.plotHeight - (high === low ? .5 : (value - low) / (high - low)) * layout.plotHeight;
|
|
36
|
+
const across = (at) => ({ x1: layout.left, x2: layout.left + layout.plotWidth, y1: at, y2: at });
|
|
37
|
+
for (const [index, tick] of ticks.entries()) {
|
|
38
|
+
const base = zero ? tick === 0 : index === 0;
|
|
39
|
+
const label = text(labels[index], 'tc-tick', layout.left - 8, y(tick) + 4.5);
|
|
40
|
+
label.setAttribute('text-anchor', 'end');
|
|
41
|
+
svg.append(line(base ? 'tc-base' : 'tc-grid', across(y(tick))), label);
|
|
42
|
+
const second = secondLabels[index];
|
|
43
|
+
if (second !== undefined)
|
|
44
|
+
svg.append(text(second, 'tc-tick tc-tick-secondary', layout.left + layout.plotWidth + 8, y(tick) + 4.5));
|
|
45
|
+
}
|
|
46
|
+
if (zero && low !== 0)
|
|
47
|
+
svg.append(line('tc-grid', across(y(low))));
|
|
48
|
+
return y;
|
|
49
|
+
}
|
|
50
|
+
function paddedRange(values, ratio) {
|
|
51
|
+
let low = Math.min(...values);
|
|
52
|
+
let high = Math.max(...values);
|
|
53
|
+
// A minimum visible range keeps noise flat: 2 percentage points for ratios, 10% of the value for counts.
|
|
54
|
+
const minimum = ratio ? .02 : Math.max(Math.abs(high) * .1, 2);
|
|
55
|
+
if (high - low < minimum) {
|
|
56
|
+
const middle = (high + low) / 2;
|
|
57
|
+
low = middle - minimum / 2;
|
|
58
|
+
high = middle + minimum / 2;
|
|
59
|
+
}
|
|
60
|
+
const span = high - low;
|
|
61
|
+
low -= span * .12;
|
|
62
|
+
high += span * .12;
|
|
63
|
+
if (Math.min(...values) >= 0)
|
|
64
|
+
low = Math.max(0, low);
|
|
65
|
+
if (ratio && Math.max(...values) <= 1)
|
|
66
|
+
high = Math.min(1, high);
|
|
67
|
+
return [low, high];
|
|
68
|
+
}
|
|
69
|
+
/** A round step near the given one: 1, 2, 2.5 or 5 times a power of ten. */
|
|
70
|
+
export function niceStep(raw) {
|
|
71
|
+
if (!(raw > 0))
|
|
72
|
+
return 1;
|
|
73
|
+
const power = 10 ** Math.floor(Math.log10(raw));
|
|
74
|
+
const fraction = raw / power;
|
|
75
|
+
return ([1, 2, 2.5, 5].find(factor => fraction <= factor) ?? 10) * power;
|
|
76
|
+
}
|
|
77
|
+
/** Evenly spaced round ticks that cover the data with a margin. */
|
|
78
|
+
export function niceTicks(values, ratio, count) {
|
|
79
|
+
if (values.length === 0)
|
|
80
|
+
return ratio ? [0, .5, 1] : [0, 1];
|
|
81
|
+
const [low, high] = paddedRange(values, ratio);
|
|
82
|
+
const raw = (high - low) / count;
|
|
83
|
+
const magnitude = 10 ** Math.floor(Math.log10(raw));
|
|
84
|
+
const step = [1, 2, 2.5, 5, 10].map(factor => factor * magnitude).find(candidate => candidate >= raw) ?? raw;
|
|
85
|
+
const integral = !ratio && values.every(Number.isInteger);
|
|
86
|
+
const unit = integral ? Math.max(1, step) : step;
|
|
87
|
+
const first = Math.floor(low / unit) * unit;
|
|
88
|
+
const last = Math.ceil(high / unit) * unit;
|
|
89
|
+
const ticks = [];
|
|
90
|
+
for (let tick = first; tick <= last + unit / 2; tick += unit)
|
|
91
|
+
ticks.push(Number(tick.toPrecision(12)));
|
|
92
|
+
return ticks;
|
|
93
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The chart's SVG building blocks and the plot's layout, shared by its axes, marks and hover card. */
|
|
2
|
+
export interface Layout {
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
readonly top: number;
|
|
6
|
+
readonly plotHeight: number;
|
|
7
|
+
left: number;
|
|
8
|
+
plotWidth: number;
|
|
9
|
+
/** Horizontal position of each point. */
|
|
10
|
+
xs: number[];
|
|
11
|
+
/** Y of each point's mark, for the hover card. */
|
|
12
|
+
ys: (number | null)[];
|
|
13
|
+
}
|
|
14
|
+
export declare const plotTop = 34;
|
|
15
|
+
export declare const plotBottom = 30;
|
|
16
|
+
export declare const plotRight = 18;
|
|
17
|
+
/** Keeps the first and last marks off the plot edges. */
|
|
18
|
+
export declare const inset = 12;
|
|
19
|
+
export declare function svgNode<K extends keyof SVGElementTagNameMap>(tag: K, className?: string): SVGElementTagNameMap[K];
|
|
20
|
+
/** Sets numeric attributes, rounded to a tenth of a pixel. */
|
|
21
|
+
export declare function setAttributes(node: SVGElement, attributes: Record<string, number>): void;
|
|
22
|
+
export declare function text(content: string, className: string, x: number, y: number): SVGTextElement;
|
|
23
|
+
/** A label centred on its anchor. */
|
|
24
|
+
export declare function centredText(content: string, className: string, x: number, y: number): SVGTextElement;
|
|
25
|
+
/** Where a centred label stands so that it stays inside the plot. */
|
|
26
|
+
export declare function clampLabel(x: number, label: string, { left, plotWidth }: Pick<Layout, 'left' | 'plotWidth'>): number;
|
|
27
|
+
/** A line across the plot, at a height or at a point. */
|
|
28
|
+
export declare function line(className: string, attributes: Record<string, number>): SVGLineElement;
|