# frontend/src/lib
dir: frontend/src/lib

index: frontend/src/lib/.pi-map.index.md

## role
Shared utility library providing metric formatting, chart axis scaling, and CSS class manipulation for the frontend application.
## files
- metricFormat.ts | Formats metric values and computes axis scaling using decimal prefixes for chart widgets. | exp: MetricUnit, MetricScale, METRIC_UNIT_LABELS, METRIC_SCALE_LABELS, ScaleInfo, func:metricScaleInfo(maxAbs: number, unit: MetricUnit, scale: MetricScale) → ScaleInfo, call:Math.floor, call:Math.log, call:Math.max, call:Math.min, func:formatScaled(value: number | null | undefined, { divisor, suffix }: ScaleInfo, unit: MetricUnit) → string, call:Number.isNaN, call:trim, call:formatDuration, call:`${trim(value / divisor)} ${suffix}`.trim, func:formatMetricValue(value: number | null | undefined, unit: MetricUnit, scale: MetricScale) → string, call:Number.isNaN, call:metricScaleInfo, call:Math.abs, call:formatScaled
- utils.ts | Utility function that merges Tailwind CSS classes with proper deduplication and conflict resolution | exp: func:cn(...inputs: ClassValue[]), call:twMerge, call:clsx | dep: clsx, tailwind-merge
## arch
Functional utility module pattern exposing pure helper functions, leveraging external libraries (decimal prefixes, tailwind-merge) for stateless transformations.
## tags
metric, scale, info, format, unit, labels, scaled, call:number.is
## symbols
- metricScaleInfo
- formatScaled
- formatMetricValue
- cn
- MetricUnit
- MetricScale
- METRIC_UNIT_LABELS
- METRIC_SCALE_LABELS
## workflows
- change lib behavior
  read: metricFormat.ts, utils.ts
- explore lib subdirectories
  index: frontend/src/lib/__tests__/.pi-map.index.md
## dirty
-
