@acarmisc/backstage-plugin-litellm 0.12.3 → 0.13.0
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/components/DashboardHeader.d.ts +2 -0
- package/dist/components/ui.d.ts +186 -0
- package/dist/index.cjs.js +1745 -560
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.esm.js +1664 -585
- package/dist/index.esm.js.map +4 -4
- package/package.json +2 -1
|
@@ -6,6 +6,8 @@ interface DashboardHeaderProps {
|
|
|
6
6
|
keys: VirtualKey[];
|
|
7
7
|
loading: boolean;
|
|
8
8
|
onGenerateKeyClick: () => void;
|
|
9
|
+
/** Page tab bar, rendered flush with the bottom edge of the header card. */
|
|
10
|
+
tabs?: React.ReactNode;
|
|
9
11
|
}
|
|
10
12
|
export declare const DashboardHeader: React.FC<DashboardHeaderProps>;
|
|
11
13
|
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared presentation primitives for the LiteLLM plugin.
|
|
3
|
+
*
|
|
4
|
+
* The plugin renders inside whatever Backstage theme the host app supplies, so
|
|
5
|
+
* everything here derives its colour from the MUI palette rather than hard-coded
|
|
6
|
+
* values. The one exception is the chart series palette: Recharts has no theme
|
|
7
|
+
* awareness, and its stock colours (#8884d8 / #82ca9d / #ffc658) read as a demo
|
|
8
|
+
* rather than a product, so we ship a curated ramp that holds up on both light
|
|
9
|
+
* and dark surfaces.
|
|
10
|
+
*/
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
13
|
+
/** `2026-08-16` → `Aug 16`. Falls back to the raw value for anything else. */
|
|
14
|
+
export declare const fmtDateShort: (value: string) => string;
|
|
15
|
+
/** 54253484 → `54.3M`. Keeps axis labels from swallowing the plot area. */
|
|
16
|
+
export declare const fmtCompact: (n: number) => string;
|
|
17
|
+
/** Compact currency for axis ticks — `$24`, `$1.2K`. */
|
|
18
|
+
export declare const fmtUsdCompact: (n: number) => string;
|
|
19
|
+
/** Categorical ramp, ordered so neighbouring series stay distinguishable. */
|
|
20
|
+
export declare const CHART_COLORS: readonly ["#6366F1", "#14B8A6", "#F59E0B", "#EC4899", "#38BDF8", "#84CC16", "#F97316", "#A855F7"];
|
|
21
|
+
/** Fixed colours for series that carry meaning rather than identity. */
|
|
22
|
+
export declare const SERIES: {
|
|
23
|
+
readonly input: "#6366F1";
|
|
24
|
+
readonly output: "#14B8A6";
|
|
25
|
+
readonly success: "#10B981";
|
|
26
|
+
readonly failure: "#EF4444";
|
|
27
|
+
readonly spend: "#F59E0B";
|
|
28
|
+
readonly budget: "#EF4444";
|
|
29
|
+
};
|
|
30
|
+
/** Stable colour per series name, so a model keeps its colour across charts. */
|
|
31
|
+
export declare function chartColor(name: string): string;
|
|
32
|
+
/** Axis / grid / legend props shared by every chart, derived from the theme. */
|
|
33
|
+
export declare function useChartTheme(): {
|
|
34
|
+
grid: {
|
|
35
|
+
stroke: string;
|
|
36
|
+
strokeDasharray: string;
|
|
37
|
+
vertical: boolean;
|
|
38
|
+
};
|
|
39
|
+
axis: {
|
|
40
|
+
tick: {
|
|
41
|
+
fontSize: number;
|
|
42
|
+
fill: string;
|
|
43
|
+
};
|
|
44
|
+
tickLine: boolean;
|
|
45
|
+
axisLine: {
|
|
46
|
+
stroke: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
legend: {
|
|
50
|
+
wrapperStyle: {
|
|
51
|
+
fontSize: number;
|
|
52
|
+
color: string;
|
|
53
|
+
paddingTop: number;
|
|
54
|
+
};
|
|
55
|
+
iconType: "circle";
|
|
56
|
+
iconSize: number;
|
|
57
|
+
};
|
|
58
|
+
cursor: {
|
|
59
|
+
fill: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
interface ChartTooltipProps {
|
|
63
|
+
active?: boolean;
|
|
64
|
+
label?: string | number;
|
|
65
|
+
payload?: Array<{
|
|
66
|
+
name?: string;
|
|
67
|
+
value?: number;
|
|
68
|
+
color?: string;
|
|
69
|
+
dataKey?: string | number;
|
|
70
|
+
}>;
|
|
71
|
+
/** Formats each series value; defaults to a localised integer. */
|
|
72
|
+
valueFormatter?: (value: number) => string;
|
|
73
|
+
/** Formats the header; defaults to the short date form. */
|
|
74
|
+
labelFormatter?: (label: string) => string;
|
|
75
|
+
/** Drop zero-valued series — useful for stacked charts with many series. */
|
|
76
|
+
hideZero?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Recharts' default tooltip is an opaque white card with a hard border — it
|
|
80
|
+
* disappears on dark themes. This one uses the theme's own surface tokens.
|
|
81
|
+
*/
|
|
82
|
+
export declare const ChartTooltip: React.FC<ChartTooltipProps>;
|
|
83
|
+
/**
|
|
84
|
+
* Colour key rendered outside the SVG. Recharts' own `<Legend>` cannot ellipsize,
|
|
85
|
+
* so a handful of fully-qualified model names ("bedrock/eu.anthropic.…") wrap
|
|
86
|
+
* into a ragged block that eats the plot area.
|
|
87
|
+
*/
|
|
88
|
+
export declare const SeriesLegend: React.FC<{
|
|
89
|
+
series: Array<{
|
|
90
|
+
name: string;
|
|
91
|
+
color: string;
|
|
92
|
+
}>;
|
|
93
|
+
}>;
|
|
94
|
+
export type Tone = 'neutral' | 'success' | 'warning' | 'danger' | 'info' | 'accent';
|
|
95
|
+
/**
|
|
96
|
+
* A soft status badge. Deliberately *not* MUI's filled `Chip` — host themes
|
|
97
|
+
* tend to render those as saturated pills, and a table with one screaming
|
|
98
|
+
* orange pill per row is unreadable. Tinted background, hairline border,
|
|
99
|
+
* squared-off corners.
|
|
100
|
+
*/
|
|
101
|
+
export declare const StatusPill: React.FC<{
|
|
102
|
+
label: React.ReactNode;
|
|
103
|
+
tone?: Tone;
|
|
104
|
+
/** Show the leading tone dot. */
|
|
105
|
+
dot?: boolean;
|
|
106
|
+
title?: string;
|
|
107
|
+
sx?: SxProps<Theme>;
|
|
108
|
+
}>;
|
|
109
|
+
/** Quiet monospace tag for identifiers: model names, team slugs, roles. */
|
|
110
|
+
export declare const TagChip: React.FC<{
|
|
111
|
+
label: React.ReactNode;
|
|
112
|
+
title?: string;
|
|
113
|
+
mono?: boolean;
|
|
114
|
+
}>;
|
|
115
|
+
/** Page-level surface with a consistent title row. */
|
|
116
|
+
export declare const SectionCard: React.FC<{
|
|
117
|
+
title?: React.ReactNode;
|
|
118
|
+
subtitle?: React.ReactNode;
|
|
119
|
+
actions?: React.ReactNode;
|
|
120
|
+
/** Set when the body renders its own edge-to-edge content (e.g. a table). */
|
|
121
|
+
flush?: boolean;
|
|
122
|
+
children: React.ReactNode;
|
|
123
|
+
}>;
|
|
124
|
+
/** Bordered frame around a single chart, with its own caption row. */
|
|
125
|
+
export declare const ChartCard: React.FC<{
|
|
126
|
+
title: React.ReactNode;
|
|
127
|
+
meta?: React.ReactNode;
|
|
128
|
+
height?: number;
|
|
129
|
+
children: React.ReactNode;
|
|
130
|
+
}>;
|
|
131
|
+
export interface MetricDef {
|
|
132
|
+
label: string;
|
|
133
|
+
value: string;
|
|
134
|
+
hint?: string;
|
|
135
|
+
tone?: Tone;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* KPI row rendered as one framed strip divided into cells, rather than four
|
|
139
|
+
* loose cards. Cells share a baseline grid so the numbers line up even when
|
|
140
|
+
* only some of them carry a hint.
|
|
141
|
+
*/
|
|
142
|
+
export declare const MetricStrip: React.FC<{
|
|
143
|
+
metrics: MetricDef[];
|
|
144
|
+
}>;
|
|
145
|
+
/** Label + value pair used inside cards. */
|
|
146
|
+
export declare const Stat: React.FC<{
|
|
147
|
+
label: string;
|
|
148
|
+
value: React.ReactNode;
|
|
149
|
+
}>;
|
|
150
|
+
/**
|
|
151
|
+
* Progress meter with an explicitly drawn track. MUI's `LinearProgress` tints
|
|
152
|
+
* its track from the bar colour, which makes an empty bar look full.
|
|
153
|
+
*/
|
|
154
|
+
export declare const Meter: React.FC<{
|
|
155
|
+
value: number;
|
|
156
|
+
tone?: Tone;
|
|
157
|
+
height?: number;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* Secondary navigation inside a card. Hand-rolled rather than a second set of
|
|
161
|
+
* `Tabs` so it reads as subordinate to the page tabs instead of competing
|
|
162
|
+
* with them, and so host theme overrides on `MuiTab` don't leak in.
|
|
163
|
+
*/
|
|
164
|
+
export declare function SegmentedControl<T extends string>({ value, onChange, options, }: {
|
|
165
|
+
value: T;
|
|
166
|
+
onChange: (value: T) => void;
|
|
167
|
+
options: Array<{
|
|
168
|
+
value: T;
|
|
169
|
+
label: string;
|
|
170
|
+
}>;
|
|
171
|
+
}): React.JSX.Element;
|
|
172
|
+
/**
|
|
173
|
+
* Shared table chrome: quiet uppercase headers, hairline row rules, a hover
|
|
174
|
+
* highlight, and tabular figures so numeric columns align.
|
|
175
|
+
*/
|
|
176
|
+
export declare const dataTableSx: SxProps<Theme>;
|
|
177
|
+
/** Muted icon button that only picks up its semantic colour on hover. */
|
|
178
|
+
export declare const quietIconButtonSx: (tone?: Tone) => SxProps<Theme>;
|
|
179
|
+
/** Centered empty / loading state for a card body. */
|
|
180
|
+
export declare const EmptyState: React.FC<{
|
|
181
|
+
message: string;
|
|
182
|
+
hint?: string;
|
|
183
|
+
height?: number;
|
|
184
|
+
action?: React.ReactNode;
|
|
185
|
+
}>;
|
|
186
|
+
export {};
|