@principal-ade/code-quality-panels 0.1.15 → 0.1.16

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 (34) hide show
  1. package/dist/components/QualityEmptyState.d.ts +22 -0
  2. package/dist/components/QualityEmptyState.d.ts.map +1 -0
  3. package/dist/components/QualityHexagon.d.ts +52 -0
  4. package/dist/components/QualityHexagon.d.ts.map +1 -0
  5. package/dist/components/QualityHexagon.stories.d.ts +54 -0
  6. package/dist/components/QualityHexagon.stories.d.ts.map +1 -0
  7. package/dist/components/RepositoryQualityGrid.d.ts +84 -0
  8. package/dist/components/RepositoryQualityGrid.d.ts.map +1 -0
  9. package/dist/components/RepositoryQualityGrid.stories.d.ts +45 -0
  10. package/dist/components/RepositoryQualityGrid.stories.d.ts.map +1 -0
  11. package/dist/components/index.d.ts +4 -0
  12. package/dist/components/index.d.ts.map +1 -0
  13. package/dist/index.d.ts +18 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/lib/utils.d.ts +3 -0
  16. package/dist/lib/utils.d.ts.map +1 -0
  17. package/dist/mocks/panelContext.d.ts +33 -0
  18. package/dist/mocks/panelContext.d.ts.map +1 -0
  19. package/dist/panels/QualityHexagonPanel.d.ts +7 -0
  20. package/dist/panels/QualityHexagonPanel.d.ts.map +1 -0
  21. package/dist/panels/QualityHexagonPanel.stories.d.ts +64 -0
  22. package/dist/panels/QualityHexagonPanel.stories.d.ts.map +1 -0
  23. package/dist/panels/RepositoryQualityGridPanel.d.ts +8 -0
  24. package/dist/panels/RepositoryQualityGridPanel.d.ts.map +1 -0
  25. package/dist/panels/RepositoryQualityGridPanel.stories.d.ts +26 -0
  26. package/dist/panels/RepositoryQualityGridPanel.stories.d.ts.map +1 -0
  27. package/dist/panels.bundle.js +49 -44
  28. package/dist/panels.bundle.js.map +1 -1
  29. package/dist/tools/index.d.ts +7 -0
  30. package/dist/tools/index.d.ts.map +1 -0
  31. package/dist/tools.bundle.js +7 -0
  32. package/dist/types/index.d.ts +7 -0
  33. package/dist/types/index.d.ts.map +1 -0
  34. package/package.json +1 -1
@@ -348,11 +348,11 @@ function getThemeColors(theme) {
348
348
  textColor: theme.colors.text,
349
349
  scoreColor: theme.colors.text,
350
350
  tierColors: {
351
- none: { fill: theme.colors.muted, stroke: theme.colors.border, bg: theme.colors.backgroundLight },
352
- bronze: { fill: theme.colors.warning, stroke: theme.colors.warning, bg: theme.colors.backgroundLight },
353
- silver: { fill: theme.colors.secondary, stroke: theme.colors.secondary, bg: theme.colors.backgroundLight },
354
- gold: { fill: theme.colors.accent, stroke: theme.colors.accent, bg: theme.colors.backgroundLight },
355
- platinum: { fill: theme.colors.primary, stroke: theme.colors.primary, bg: theme.colors.backgroundLight }
351
+ none: { fill: "#808080", stroke: "#808080", bg: theme.colors.backgroundLight },
352
+ bronze: { fill: "#CD7F32", stroke: "#CD7F32", bg: theme.colors.backgroundLight },
353
+ silver: { fill: "#C0C0C0", stroke: "#C0C0C0", bg: theme.colors.backgroundLight },
354
+ gold: { fill: "#FFD700", stroke: "#FFD700", bg: theme.colors.backgroundLight },
355
+ platinum: { fill: "#E5E4E2", stroke: "#E5E4E2", bg: theme.colors.backgroundLight }
356
356
  },
357
357
  metricColors: {
358
358
  types: theme.colors.warning,
@@ -369,13 +369,19 @@ function getThemeColors(theme) {
369
369
  }
370
370
  };
371
371
  }
372
+ function getValueColor$1(value, key) {
373
+ const effectiveValue = key === "deadCode" ? 100 - value : value;
374
+ if (effectiveValue >= 80) return "#2E7D32";
375
+ if (effectiveValue >= 60) return "#E6A700";
376
+ return "#C62828";
377
+ }
372
378
  const getMetricConfig = (themeColors) => [
373
- { key: "types", label: "Types", color: themeColors.metricColors.types, angle: -120 },
374
- { key: "documentation", label: "Docs", color: themeColors.metricColors.documentation, angle: -60 },
375
- { key: "tests", label: "Tests", color: themeColors.metricColors.tests, angle: 0 },
376
- { key: "deadCode", label: "Dead Code", color: themeColors.metricColors.deadCode, angle: 60 },
377
- { key: "formatting", label: "Format", color: themeColors.metricColors.formatting, angle: 120 },
378
- { key: "linting", label: "Linting", color: themeColors.metricColors.linting, angle: 180 }
379
+ { key: "formatting", label: "Format", color: themeColors.metricColors.formatting, angle: -120 },
380
+ { key: "linting", label: "Linting", color: themeColors.metricColors.linting, angle: -60 },
381
+ { key: "types", label: "Types", color: themeColors.metricColors.types, angle: 0 },
382
+ { key: "tests", label: "Tests", color: themeColors.metricColors.tests, angle: 60 },
383
+ { key: "deadCode", label: "Dead Code", color: themeColors.metricColors.deadCode, angle: 120 },
384
+ { key: "documentation", label: "Docs", color: themeColors.metricColors.documentation, angle: 180 }
379
385
  ];
380
386
  function calculateHexagonPoints(center, radius, metricConfig) {
381
387
  return metricConfig.map(({ angle }) => {
@@ -731,9 +737,8 @@ function QualityHexagonDetailed({
731
737
  showValues: false
732
738
  }
733
739
  ) }),
734
- /* @__PURE__ */ jsx("div", { style: { flex: "1 1 200px", minWidth: 200, display: "flex", flexDirection: "column", gap: 8, padding: "8px 24px" }, children: metricConfig.map(({ key, label, color }) => {
740
+ /* @__PURE__ */ jsx("div", { style: { flex: "1 1 200px", minWidth: 200, display: "flex", flexDirection: "column", gap: 8, padding: "8px 24px" }, children: metricConfig.map(({ key, label }) => {
735
741
  const value = metrics[key];
736
- const displayValue = value;
737
742
  return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }, children: [
738
743
  /* @__PURE__ */ jsxs("span", { style: {
739
744
  fontSize: 14,
@@ -745,9 +750,9 @@ function QualityHexagonDetailed({
745
750
  /* @__PURE__ */ jsxs("span", { style: {
746
751
  fontSize: 14,
747
752
  fontWeight: 500,
748
- color
753
+ color: getValueColor$1(value, key)
749
754
  }, children: [
750
- displayValue,
755
+ value,
751
756
  "%"
752
757
  ] })
753
758
  ] }, key);
@@ -905,7 +910,7 @@ function QualityHexagonExpandable({
905
910
  padding: "8px 24px",
906
911
  borderTop: `1px solid ${theme.colors.border}`,
907
912
  marginTop: 8
908
- }, children: metricConfig.map(({ key, label, color }) => {
913
+ }, children: metricConfig.map(({ key, label }) => {
909
914
  const value = metrics[key];
910
915
  return /* @__PURE__ */ jsxs(
911
916
  "div",
@@ -944,7 +949,7 @@ function QualityHexagonExpandable({
944
949
  /* @__PURE__ */ jsxs("span", { style: {
945
950
  fontSize: 14,
946
951
  fontWeight: 500,
947
- color
952
+ color: getValueColor$1(value, key)
948
953
  }, children: [
949
954
  value,
950
955
  "%"
@@ -1064,10 +1069,10 @@ const CommandLine = ({ command, theme, label }) => {
1064
1069
  };
1065
1070
  const MetricsPreview = ({ theme }) => {
1066
1071
  const metrics = [
1067
- { key: "tests", label: "Tests", description: "Test coverage & pass rate", Icon: FlaskConical },
1072
+ { key: "formatting", label: "Formatting", description: "Prettier code style", Icon: Sparkles },
1068
1073
  { key: "linting", label: "Linting", description: "ESLint code quality", Icon: FileSearch },
1069
1074
  { key: "types", label: "Types", description: "TypeScript type safety", Icon: Braces },
1070
- { key: "formatting", label: "Formatting", description: "Prettier code style", Icon: Sparkles },
1075
+ { key: "tests", label: "Tests", description: "Test coverage & pass rate", Icon: FlaskConical },
1071
1076
  { key: "deadCode", label: "Dead Code", description: "Unused exports & deps", Icon: Trash2 },
1072
1077
  { key: "documentation", label: "Docs", description: "Code documentation", Icon: BookOpen }
1073
1078
  ];
@@ -1483,11 +1488,11 @@ const QualityHexagonPanelContent = ({
1483
1488
  return () => unsubscribers.forEach((unsub) => unsub());
1484
1489
  }, [events, context, packages]);
1485
1490
  const tierColors = {
1486
- none: theme.colors.muted,
1487
- bronze: theme.colors.warning,
1488
- silver: theme.colors.secondary,
1489
- gold: theme.colors.accent,
1490
- platinum: theme.colors.primary
1491
+ none: "#808080",
1492
+ bronze: "#CD7F32",
1493
+ silver: "#C0C0C0",
1494
+ gold: "#FFD700",
1495
+ platinum: "#E5E4E2"
1491
1496
  };
1492
1497
  const overallTier = packages.length > 0 ? calculateQualityTier(
1493
1498
  packages.reduce((acc, pkg) => ({
@@ -1631,12 +1636,12 @@ const QualityHexagonPanelContent = ({
1631
1636
  };
1632
1637
  const QualityHexagonPanel = QualityHexagonPanelContent;
1633
1638
  const METRIC_OPTIONS = [
1639
+ { key: "formatting", label: "Format" },
1640
+ { key: "linting", label: "Linting" },
1634
1641
  { key: "types", label: "Types" },
1635
- { key: "documentation", label: "Docs" },
1636
1642
  { key: "tests", label: "Tests" },
1637
1643
  { key: "deadCode", label: "Dead Code" },
1638
- { key: "formatting", label: "Format" },
1639
- { key: "linting", label: "Linting" }
1644
+ { key: "documentation", label: "Docs" }
1640
1645
  ];
1641
1646
  function flattenRepositories(repositories) {
1642
1647
  const items = [];
@@ -1677,11 +1682,11 @@ function formatLabel(item, showRepositoryName, isSameAsRepo) {
1677
1682
  }
1678
1683
  return `${item.repositoryName} / ${item.packageName}`;
1679
1684
  }
1680
- function getValueColor(value, key, theme) {
1685
+ function getValueColor(value, key) {
1681
1686
  const effectiveValue = key === "deadCode" ? 100 - value : value;
1682
- if (effectiveValue >= 80) return theme.colors.success;
1683
- if (effectiveValue >= 60) return theme.colors.warning;
1684
- return theme.colors.error;
1687
+ if (effectiveValue >= 80) return "#2E7D32";
1688
+ if (effectiveValue >= 60) return "#E6A700";
1689
+ return "#C62828";
1685
1690
  }
1686
1691
  function RepositoryQualityGridItem({
1687
1692
  item,
@@ -1696,11 +1701,11 @@ function RepositoryQualityGridItem({
1696
1701
  const isSameAsRepo = item.packageName === item.repositoryName;
1697
1702
  const label = formatLabel(item, showRepositoryName, isSameAsRepo);
1698
1703
  const tierColors = {
1699
- none: theme.colors.muted,
1700
- bronze: theme.colors.warning,
1701
- silver: theme.colors.secondary,
1702
- gold: theme.colors.accent,
1703
- platinum: theme.colors.primary
1704
+ none: "#808080",
1705
+ bronze: "#CD7F32",
1706
+ silver: "#C0C0C0",
1707
+ gold: "#FFD700",
1708
+ platinum: "#E5E4E2"
1704
1709
  };
1705
1710
  const displayInfo = React2.useMemo(() => {
1706
1711
  if (selectedMetric) {
@@ -1710,7 +1715,7 @@ function RepositoryQualityGridItem({
1710
1715
  return {
1711
1716
  label: option.label,
1712
1717
  value,
1713
- valueColor: getValueColor(value, selectedMetric, theme)
1718
+ valueColor: getValueColor(value, selectedMetric)
1714
1719
  };
1715
1720
  }
1716
1721
  }
@@ -1718,11 +1723,11 @@ function RepositoryQualityGridItem({
1718
1723
  return {
1719
1724
  label: hoveredVertex.label,
1720
1725
  value: hoveredVertex.value,
1721
- valueColor: getValueColor(hoveredVertex.value, hoveredVertex.key, theme)
1726
+ valueColor: getValueColor(hoveredVertex.value, hoveredVertex.key)
1722
1727
  };
1723
1728
  }
1724
1729
  return null;
1725
- }, [selectedMetric, hoveredVertex, item.metrics, theme]);
1730
+ }, [selectedMetric, hoveredVertex, item.metrics]);
1726
1731
  return /* @__PURE__ */ jsxs(
1727
1732
  "div",
1728
1733
  {
@@ -1877,11 +1882,11 @@ function RepositoryQualityGrid({
1877
1882
  });
1878
1883
  }, [items, selectedMetric]);
1879
1884
  const tierColors = {
1880
- none: theme.colors.muted,
1881
- bronze: theme.colors.warning,
1882
- silver: theme.colors.secondary,
1883
- gold: theme.colors.accent,
1884
- platinum: theme.colors.primary
1885
+ none: "#808080",
1886
+ bronze: "#CD7F32",
1887
+ silver: "#C0C0C0",
1888
+ gold: "#FFD700",
1889
+ platinum: "#E5E4E2"
1885
1890
  };
1886
1891
  const tierLabels = {
1887
1892
  none: "No Data",