@canyonjs/report-component 0.0.7 → 0.0.9

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.d.ts CHANGED
@@ -8,7 +8,10 @@ import { FileCoverageData } from "istanbul-lib-coverage";
8
8
  interface FileDataResponse {
9
9
  fileCoverage: FileCoverageData;
10
10
  fileContent: string;
11
- fileCodeChange: number[];
11
+ fileCodeChange: {
12
+ additions: number[];
13
+ deletions: number[];
14
+ };
12
15
  }
13
16
  interface DataSourceItem {
14
17
  path: string;
package/dist/index.js CHANGED
@@ -412,7 +412,7 @@ const CoverageDetail = ({ source, coverage, diff }) => {
412
412
  });
413
413
  })();
414
414
  const lineNumbersMinChars = (() => {
415
- return Math.max(...linesState.map((line) => line.hit)).toString().length + 8;
415
+ return Math.max(...linesState.map((line) => line.hit)).toString().length + 9;
416
416
  })();
417
417
  useEffect(() => {
418
418
  if (ref.current && ref.current.innerHTML === "") {
@@ -961,7 +961,10 @@ const CanyonReport = ({ value, name, dataSource, onSelect, defaultOnlyChange = f
961
961
  b: {}
962
962
  });
963
963
  const [fileContent, setFileContent] = useState("");
964
- const [fileCodeChange, setFileCodeChange] = useState([]);
964
+ const [fileCodeChange, setFileCodeChange] = useState({
965
+ additions: [],
966
+ deletions: []
967
+ });
965
968
  const isControlled = controlledOnlyChange !== void 0 && controlledOnChangeOnlyChange !== void 0;
966
969
  const [internalOnlyChange, setInternalOnlyChange] = useState(defaultOnlyChange);
967
970
  const onlyChange = isControlled ? controlledOnlyChange : internalOnlyChange;
@@ -975,7 +978,10 @@ const CanyonReport = ({ value, name, dataSource, onSelect, defaultOnlyChange = f
975
978
  const res = await onSelect(val);
976
979
  setFileContent(res.fileContent || "");
977
980
  setFileCoverage(res.fileCoverage || {});
978
- setFileCodeChange(res.fileCodeChange || "");
981
+ setFileCodeChange(res.fileCodeChange || {
982
+ additions: [],
983
+ deletions: []
984
+ });
979
985
  return res;
980
986
  };
981
987
  }, [onSelect]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canyonjs/report-component",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "author": "Travis Zhang<https://github.com/travzhang>",
6
6
  "repository": {
7
7
  "type": "git",