@aiready/components 0.13.19 → 0.13.20

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
@@ -214,11 +214,12 @@ interface ThemeProviderProps {
214
214
  declare function ThemeProvider({ children, defaultTheme, storageKey, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
215
215
  declare function useTheme(): ThemeContextValue;
216
216
 
217
+ type RatingSlug = 'excellent' | 'good' | 'fair' | 'needs-work' | 'critical';
217
218
  declare function scoreColor(score: number | null | undefined): string;
218
219
  declare function scoreBg(score: number | null | undefined): string;
219
220
  declare function scoreLabel(score: number | null | undefined): string;
220
221
  declare function scoreGlow(score: number | null | undefined): string;
221
- declare function getScoreRating(score: number | null | undefined): 'excellent' | 'good' | 'fair' | 'needs-work' | 'critical';
222
+ declare function getScoreRating(score: number | null | undefined): RatingSlug;
222
223
 
223
224
  interface GraphControlsProps {
224
225
  dragEnabled?: boolean;
package/dist/index.js CHANGED
@@ -1952,60 +1952,60 @@ function formatRange(min, max) {
1952
1952
  function formatDecimal(value, decimals = 2) {
1953
1953
  return value.toFixed(decimals);
1954
1954
  }
1955
- function scoreColor(score) {
1956
- if (score == null) return "text-slate-400";
1957
- const rating = getRatingSlug(score);
1958
- switch (rating) {
1959
- case "excellent":
1960
- case "good":
1961
- return "text-emerald-400";
1962
- case "fair":
1963
- return "text-amber-400";
1964
- default:
1965
- return "text-red-400";
1955
+ var SCORE_METADATA = {
1956
+ excellent: {
1957
+ color: "text-emerald-400",
1958
+ bg: "bg-emerald-900/30 border-emerald-500/30",
1959
+ label: "Excellent",
1960
+ glow: "shadow-emerald-500/20"
1961
+ },
1962
+ good: {
1963
+ color: "text-emerald-400",
1964
+ bg: "bg-emerald-900/30 border-emerald-500/30",
1965
+ label: "AI-Ready",
1966
+ glow: "shadow-emerald-500/20"
1967
+ },
1968
+ fair: {
1969
+ color: "text-amber-400",
1970
+ bg: "bg-amber-900/30 border-amber-500/30",
1971
+ label: "Fair",
1972
+ glow: "shadow-amber-500/20"
1973
+ },
1974
+ "needs-work": {
1975
+ color: "text-red-400",
1976
+ bg: "bg-red-900/30 border-red-500/30",
1977
+ label: "Needs Improvement",
1978
+ glow: "shadow-red-500/20"
1979
+ },
1980
+ critical: {
1981
+ color: "text-red-400",
1982
+ bg: "bg-red-900/30 border-red-500/30",
1983
+ label: "Critical Issues",
1984
+ glow: "shadow-red-500/20"
1966
1985
  }
1986
+ };
1987
+ var DEFAULT_METADATA = {
1988
+ color: "text-slate-400",
1989
+ bg: "bg-slate-800/50 border-slate-700",
1990
+ label: "Not analyzed",
1991
+ glow: ""
1992
+ };
1993
+ function getMetadata(score) {
1994
+ if (score == null) return DEFAULT_METADATA;
1995
+ const rating = getRatingSlug(score);
1996
+ return SCORE_METADATA[rating] || SCORE_METADATA.critical;
1997
+ }
1998
+ function scoreColor(score) {
1999
+ return getMetadata(score).color;
1967
2000
  }
1968
2001
  function scoreBg(score) {
1969
- if (score == null) return "bg-slate-800/50 border-slate-700";
1970
- const rating = getRatingSlug(score);
1971
- switch (rating) {
1972
- case "excellent":
1973
- case "good":
1974
- return "bg-emerald-900/30 border-emerald-500/30";
1975
- case "fair":
1976
- return "bg-amber-900/30 border-amber-500/30";
1977
- default:
1978
- return "bg-red-900/30 border-red-500/30";
1979
- }
2002
+ return getMetadata(score).bg;
1980
2003
  }
1981
2004
  function scoreLabel(score) {
1982
- if (score == null) return "Not analyzed";
1983
- const rating = getRatingSlug(score);
1984
- switch (rating) {
1985
- case "excellent":
1986
- return "Excellent";
1987
- case "good":
1988
- return "AI-Ready";
1989
- case "fair":
1990
- return "Fair";
1991
- case "needs-work":
1992
- return "Needs Improvement";
1993
- default:
1994
- return "Critical Issues";
1995
- }
2005
+ return getMetadata(score).label;
1996
2006
  }
1997
2007
  function scoreGlow(score) {
1998
- if (score == null) return "";
1999
- const rating = getRatingSlug(score);
2000
- switch (rating) {
2001
- case "excellent":
2002
- case "good":
2003
- return "shadow-emerald-500/20";
2004
- case "fair":
2005
- return "shadow-amber-500/20";
2006
- default:
2007
- return "shadow-red-500/20";
2008
- }
2008
+ return getMetadata(score).glow;
2009
2009
  }
2010
2010
  function getScoreRating(score) {
2011
2011
  if (score == null) return "critical";