@canyonjs/report-component 1.0.19 → 1.0.21

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/dist/index.css CHANGED
@@ -1,9 +1,7 @@
1
1
  .canyonjs-report-html .canyon-coverage-detail-spin-wrapper {
2
2
  height: 100%;
3
3
  }
4
- .canyonjs-report-html
5
- .canyon-coverage-detail-spin-wrapper
6
- > .ant-spin-container {
4
+ .canyonjs-report-html .canyon-coverage-detail-spin-wrapper > .ant-spin-container {
7
5
  height: 100%;
8
6
  }
9
7
  .canyonjs-report-html {
@@ -118,8 +116,7 @@
118
116
  border-bottom: 1px solid #e0e0e0;
119
117
  color: #333333;
120
118
  font-size: 13px;
121
- font-family:
122
- -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
119
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
123
120
  cursor: pointer;
124
121
  text-align: left;
125
122
  display: flex;
@@ -158,36 +155,29 @@
158
155
  opacity: 0;
159
156
  }
160
157
 
161
- .canyonjs-report-html
162
- .canyon-changed-code-coverage-content[style*="max-height: auto"] {
158
+ .canyonjs-report-html .canyon-changed-code-coverage-content[style*="max-height: auto"] {
163
159
  opacity: 1;
164
160
  }
165
161
 
166
162
  .canyonjs-report-html .canyon-changed-code-coverage-select-wrapper {
167
163
  padding: 12px 16px;
168
164
  background: #ffffff;
169
- font-family:
170
- -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
165
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
171
166
  display: flex;
172
167
  justify-content: flex-start;
173
168
  }
174
169
 
175
170
  /* 下拉选项样式优化 */
176
- .canyonjs-report-html .canyon-changed-code-coverage-select-wrapper
177
- .ant-select-item {
171
+ .canyonjs-report-html .canyon-changed-code-coverage-select-wrapper .ant-select-item {
178
172
  padding: 6px 12px !important;
179
173
  line-height: 20px !important;
180
174
  }
181
175
 
182
- .canyonjs-report-html
183
- .canyon-changed-code-coverage-select-wrapper
184
- .ant-select-item-option-active {
176
+ .canyonjs-report-html .canyon-changed-code-coverage-select-wrapper .ant-select-item-option-active {
185
177
  background-color: #f5f5f5;
186
178
  }
187
179
 
188
- .canyonjs-report-html
189
- .canyon-changed-code-coverage-select-wrapper
190
- .ant-select-item-option-content {
180
+ .canyonjs-report-html .canyon-changed-code-coverage-select-wrapper .ant-select-item-option-content {
191
181
  display: flex;
192
182
  align-items: center;
193
183
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigProvider, Divider, Input, Progress, Segmented, Select, Space, Spin, Switch, Table, Tag, Typography, theme } from "antd";
1
+ import { ConfigProvider, Divider, Input, Progress, Segmented, Select, Space, Spin, Switch, Table, Tag, Typography } from "antd";
2
2
  import { Suspense, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { genSummaryTreeItem } from "canyon-data";
@@ -48,7 +48,7 @@ const generateCoreDataForEachComponent = ({ dataSource, filenameKeywords, value,
48
48
 
49
49
  //#endregion
50
50
  //#region src/helpers/annotate.ts
51
- function annotateStatements(fileCoverage) {
51
+ function annotateStatements(fileCoverage, structuredText) {
52
52
  const annotateStatementsList = [];
53
53
  const statementStats = fileCoverage.s;
54
54
  const statementMeta = fileCoverage.statementMap;
@@ -59,13 +59,16 @@ function annotateStatements(fileCoverage) {
59
59
  const endCol = meta.end.column + 1;
60
60
  const startLine = meta.start.line;
61
61
  const endLine = meta.end.line;
62
- if (type === "no") annotateStatementsList.push({
63
- startLine,
64
- endLine,
65
- startCol: startCol + 1,
66
- endCol: endCol + 1,
67
- type: "S"
68
- });
62
+ if (type === "no") {
63
+ const realEndCol = startCol > endCol ? structuredText.split("\n")[startLine - 1].length : endCol;
64
+ annotateStatementsList.push({
65
+ startLine,
66
+ endLine,
67
+ startCol: startCol + 1,
68
+ endCol: realEndCol + 1,
69
+ type: "S"
70
+ });
71
+ }
69
72
  });
70
73
  return annotateStatementsList;
71
74
  }
@@ -392,8 +395,7 @@ const ChangedCodeCoverageTable = ({ coverage, addLines, onJumpToRange }) => {
392
395
  coverageStats.coveredCount,
393
396
  "/",
394
397
  coverageStats.totalCount,
395
- ") -",
396
- " ",
398
+ ") - ",
397
399
  coverageStats.notCoveredCount,
398
400
  " Not Covered"
399
401
  ] }),
@@ -644,7 +646,7 @@ const CoverageDetail = ({ source, coverage, diff }) => {
644
646
  editorRef.current = editor;
645
647
  const decorations = (() => {
646
648
  const all = [];
647
- const annotateStatementsList = annotateStatements(coverage);
649
+ const annotateStatementsList = annotateStatements(coverage, source);
648
650
  all.push(...annotateStatementsList);
649
651
  const annotateFunctionsList = annotateFunctions(coverage, source);
650
652
  all.push(...annotateFunctionsList);
@@ -758,9 +760,14 @@ const getColor = (pct) => {
758
760
  //#endregion
759
761
  //#region src/widgets/SummaryHeader.tsx
760
762
  const { Text } = Typography;
761
- const { useToken } = theme;
763
+ const SUMMARY_LABELS = {
764
+ statements: "Statements",
765
+ branches: "Branches",
766
+ functions: "Functions",
767
+ lines: "Lines",
768
+ changestatements: "Change Statements"
769
+ };
762
770
  const SummaryNav = ({ value, onClick, reportName }) => {
763
- const { token } = useToken();
764
771
  return /* @__PURE__ */ jsx("div", {
765
772
  style: {
766
773
  display: "flex",
@@ -830,7 +837,7 @@ const SummaryMetric = ({ data, onlyChange }) => {
830
837
  /* @__PURE__ */ jsxs(Text, {
831
838
  style: { fontSize: "14px" },
832
839
  type: "secondary",
833
- children: [t$1(`${key}`), ":"]
840
+ children: [t$1(SUMMARY_LABELS[key] || key), ":"]
834
841
  }),
835
842
  /* @__PURE__ */ jsxs(Tag, {
836
843
  bordered: false,
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
1
  {
2
2
  "name": "@canyonjs/report-component",
3
- "type": "module",
4
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
+ "homepage": "https://github.com/canyon-project/canyon#readme",
5
+ "bugs": {
6
+ "url": "https://github.com/canyon-project/canyon/issues"
7
+ },
8
+ "license": "MIT",
5
9
  "author": "Travis Zhang<https://github.com/travzhang>",
6
10
  "repository": {
7
11
  "type": "git",
8
12
  "url": "https://github.com/canyon-project/canyon"
9
13
  },
10
- "bugs": {
11
- "url": "https://github.com/canyon-project/canyon/issues"
12
- },
13
- "homepage": "https://github.com/canyon-project/canyon#readme",
14
- "license": "MIT",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "type": "module",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
15
21
  "exports": {
16
22
  ".": "./dist/index.js",
17
23
  "./package.json": "./package.json",
18
24
  "./index.css": "./dist/index.css"
19
25
  },
20
- "main": "./dist/index.js",
21
- "module": "./dist/index.js",
22
- "types": "./dist/index.d.ts",
23
- "files": [
24
- "dist"
25
- ],
26
+ "dependencies": {
27
+ "@ant-design/icons": "6.1.0",
28
+ "@ibm/plex-mono": "1.1.0",
29
+ "antd": "6.1.0",
30
+ "canyon-data": "2.0.0-beta.36",
31
+ "monaco-editor": "0.55.1",
32
+ "react": "19.2.3",
33
+ "react-dom": "19.2.3",
34
+ "react-highlight-words": "0.21.0"
35
+ },
26
36
  "devDependencies": {
37
+ "@monaco-editor/react": "4.7.0",
27
38
  "@tsconfig/strictest": "^2.0.8",
28
39
  "@types/istanbul-lib-coverage": "^2.0.6",
29
40
  "@types/node": "^24.10.1",
30
41
  "@types/react": "19.2.3",
31
42
  "@types/react-dom": "19.2.3",
43
+ "@typescript/native-preview": "7.0.0-dev.20260223.1",
32
44
  "@vitejs/plugin-react": "^5.1.1",
33
45
  "istanbul-lib-coverage": "^3.2.2",
34
46
  "tsdown": "^0.17.0",
35
- "@typescript/native-preview": "7.0.0-dev.20260204.1",
36
- "vite": "8.0.0-beta.13",
37
- "@monaco-editor/react": "4.7.0"
38
- },
39
- "dependencies": {
40
- "react": "19.2.3",
41
- "react-dom": "19.2.3",
42
- "@ant-design/icons": "6.1.0",
43
- "@ibm/plex-mono": "1.1.0",
44
- "antd": "6.1.0",
45
- "canyon-data": "2.0.0-beta.36",
46
- "monaco-editor": "0.55.1",
47
- "react-highlight-words": "0.21.0"
47
+ "vite": "8.0.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsdown",