diff --git a/webui/package-lock.json b/webui/package-lock.json index 824e808..872ae69 100644 --- a/webui/package-lock.json +++ b/webui/package-lock.json @@ -8,14 +8,10 @@ "name": "webui", "version": "0.0.0", "dependencies": { - "@fortawesome/fontawesome-svg-core": "^7.3.1", "@fortawesome/free-brands-svg-icons": "^7.3.1", "@fortawesome/free-solid-svg-icons": "^7.3.1", - "@fortawesome/vue-fontawesome": "^3.3.3", "@perfect-design/ui": "https://github.com/lukaszraczylo/perfect-design/releases/download/v0.4.0/perfect-design-ui-0.4.0.tgz", - "@tanstack/vue-table": "^8.21.3", "@vueuse/core": "^14.4.0", - "chart.js": "^4.5.1", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "pinia": "^4.0.3", @@ -23,8 +19,7 @@ "shadcn-vue": "^2.8.2", "tailwind-merge": "^3.6.0", "tw-animate-css": "^1.4.0", - "vue": "^3.5.40", - "vue-chartjs": "^5.3.4" + "vue": "^3.5.40" }, "devDependencies": { "@axe-core/playwright": "^4.14.1", @@ -696,18 +691,6 @@ "node": ">=6" } }, - "node_modules/@fortawesome/fontawesome-svg-core": { - "version": "7.3.1", - "resolved": "https://npm.fontawesome.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-7.3.1.tgz", - "integrity": "sha512-BoxVN3PKnMbgStHhjoaky/oWdxHomDqmBVA24IA3KEmssFGeI7u9YT/BJceOjIum/t6TpPa/vcMKaVYQeIQ/3Q==", - "license": "MIT", - "dependencies": { - "@fortawesome/fontawesome-common-types": "7.3.1" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/@fortawesome/free-brands-svg-icons": { "version": "7.3.1", "resolved": "https://npm.fontawesome.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-7.3.1.tgz", @@ -732,16 +715,6 @@ "node": ">=6" } }, - "node_modules/@fortawesome/vue-fontawesome": { - "version": "3.3.3", - "resolved": "https://npm.fontawesome.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.3.3.tgz", - "integrity": "sha512-Jbjze98gGcVBSdkscLbnDlHECumMAFVWDarMtycctn9qL3p92ApnV36VW4PwVrcm9IWrHnnE6ZL9x7MXStSCfA==", - "license": "MIT", - "peerDependencies": { - "@fortawesome/fontawesome-svg-core": "~1 || ~6 || ~7", - "vue": ">= 3.0.0 < 4" - } - }, "node_modules/@hono/node-server": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz", @@ -892,12 +865,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@kurkle/color": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz", - "integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==", - "license": "MIT" - }, "node_modules/@modelcontextprotocol/sdk": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.30.0.tgz", @@ -1890,19 +1857,6 @@ "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, - "node_modules/@tanstack/table-core": { - "version": "8.21.3", - "resolved": "https://registry.npmjs.org/@tanstack/table-core/-/table-core-8.21.3.tgz", - "integrity": "sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - } - }, "node_modules/@tanstack/virtual-core": { "version": "3.17.8", "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.17.8.tgz", @@ -1913,25 +1867,6 @@ "url": "https://github.com/sponsors/tannerlinsley" } }, - "node_modules/@tanstack/vue-table": { - "version": "8.21.3", - "resolved": "https://registry.npmjs.org/@tanstack/vue-table/-/vue-table-8.21.3.tgz", - "integrity": "sha512-rusRyd77c5tDPloPskctMyPLFEQUeBzxdQ+2Eow4F7gDPlPOB1UnnhzfpdvqZ8ZyX2rRNGmqNnQWm87OI2OQPw==", - "license": "MIT", - "dependencies": { - "@tanstack/table-core": "8.21.3" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - }, - "peerDependencies": { - "vue": ">=3.2" - } - }, "node_modules/@tanstack/vue-virtual": { "version": "3.13.36", "resolved": "https://registry.npmjs.org/@tanstack/vue-virtual/-/vue-virtual-3.13.36.tgz", @@ -2863,18 +2798,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chart.js": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.1.tgz", - "integrity": "sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw==", - "license": "MIT", - "dependencies": { - "@kurkle/color": "^0.3.0" - }, - "engines": { - "pnpm": ">=8" - } - }, "node_modules/chokidar": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", @@ -7228,16 +7151,6 @@ } } }, - "node_modules/vue-chartjs": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.3.4.tgz", - "integrity": "sha512-x3Fqob8RQvrTdssfi9ecsCzEkFOd8JPmNwSkSQzdfKj/uBsRJs/Y88cZcZIEcPsTVfMGwMo4MOoihoDG2DoE/g==", - "license": "MIT", - "peerDependencies": { - "chart.js": "^4.1.1", - "vue": "^3.0.0-0 || ^2.7.0" - } - }, "node_modules/vue-eslint-parser": { "version": "10.4.1", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-10.4.1.tgz", diff --git a/webui/package.json b/webui/package.json index b28e2ee..2f9ed5a 100644 --- a/webui/package.json +++ b/webui/package.json @@ -12,14 +12,10 @@ "test:visual": "playwright test" }, "dependencies": { - "@fortawesome/fontawesome-svg-core": "^7.3.1", "@fortawesome/free-brands-svg-icons": "^7.3.1", "@fortawesome/free-solid-svg-icons": "^7.3.1", - "@fortawesome/vue-fontawesome": "^3.3.3", "@perfect-design/ui": "https://github.com/lukaszraczylo/perfect-design/releases/download/v0.4.0/perfect-design-ui-0.4.0.tgz", - "@tanstack/vue-table": "^8.21.3", "@vueuse/core": "^14.4.0", - "chart.js": "^4.5.1", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "pinia": "^4.0.3", @@ -27,8 +23,7 @@ "shadcn-vue": "^2.8.2", "tailwind-merge": "^3.6.0", "tw-animate-css": "^1.4.0", - "vue": "^3.5.40", - "vue-chartjs": "^5.3.4" + "vue": "^3.5.40" }, "devDependencies": { "@axe-core/playwright": "^4.14.1", diff --git a/webui/scripts/bundle-size.d.mts b/webui/scripts/bundle-size.d.mts new file mode 100644 index 0000000..0974642 --- /dev/null +++ b/webui/scripts/bundle-size.d.mts @@ -0,0 +1,5 @@ +export const LIMIT: number +export const DIST: string +export function hasDist(): boolean +export function measure(dir?: string): { file: string; gzip: number }[] +export function totalGzip(dir?: string): number diff --git a/webui/scripts/bundle-size.mjs b/webui/scripts/bundle-size.mjs new file mode 100644 index 0000000..74149b3 --- /dev/null +++ b/webui/scripts/bundle-size.mjs @@ -0,0 +1,32 @@ +// Gate scope: gzip (level 9) of every .js and .css in dist/assets, lazy chunks included. +import { existsSync, readdirSync, readFileSync } from 'node:fs' +import { join } from 'node:path' +import { fileURLToPath } from 'node:url' +import { gzipSync } from 'node:zlib' + +export const LIMIT = 324300 +export const DIST = fileURLToPath(new URL('../dist/assets', import.meta.url)) + +export const hasDist = () => existsSync(DIST) + +export function totalGzip(dir = DIST) { + return measure(dir).reduce((n, r) => n + r.gzip, 0) +} + +export function measure(dir = DIST) { + return readdirSync(dir) + .filter((f) => /\.(js|css)$/.test(f)) + .map((f) => ({ file: f, gzip: gzipSync(readFileSync(join(dir, f)), { level: 9 }).length })) + .sort((a, b) => b.gzip - a.gzip) +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) { + const rows = measure() + const total = totalGzip() + for (const r of rows.slice(0, 10)) console.log(`${String(r.gzip).padStart(8)} ${r.file}`) + console.log(`total gzip JS+CSS: ${total} B (limit ${LIMIT}); ${rows.length} files`) + if (total > LIMIT) { + console.error('bundle gate FAILED') + process.exit(1) + } +} diff --git a/webui/src/assets/main.css b/webui/src/assets/main.css index 318ac83..187e25c 100644 --- a/webui/src/assets/main.css +++ b/webui/src/assets/main.css @@ -1,11 +1,68 @@ @import "tailwindcss"; -/* Layered below utilities so Tailwind classes such as `hidden` still win over the FontAwesome icon display rule. */ -@import "@fortawesome/fontawesome-svg-core/styles.css" layer(base); @import "tw-animate-css"; @import "shadcn-vue/tailwind.css"; @import "@perfect-design/ui/theme.css"; @import "@perfect-design/ui/packs.css"; -@source "../../node_modules/@perfect-design/ui/dist"; +/* Tailwind scans only the perfect-design components this app bundles; scanning all of dist adds ~15 KB gzip of unused utilities. Add a component's directory here when a new one is imported. */ +@source "../../node_modules/@perfect-design/ui/dist/lib/*.js"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/*.js"; +@source "../../node_modules/@perfect-design/ui/dist/components/navigation/*.js"; +@source "../../node_modules/@perfect-design/ui/dist/components/overlays/*.js"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/Card"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/CodeViewer"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/DataTable"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/DescriptionList"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/Heatmap"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/KpiTile"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/LineChart"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/Sparkline"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/StatBar"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/StatGroup"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/Table"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/YamlViewer"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/_chart"; +@source "../../node_modules/@perfect-design/ui/dist/components/data-display/_shared"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/Callout"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/EmptyState"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/ErrorState"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/LoadingState"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/OfflineIndicator"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/StaleNotice"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/ToastItem"; +@source "../../node_modules/@perfect-design/ui/dist/components/feedback/Toaster"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/Checkbox"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/CheckboxCard"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/Combobox"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/DateInput"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/Field"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/FilterBar"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/Input"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/InputGroup"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/Label"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/NativeSelect"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/NumberInput"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/SearchInput"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/SegmentedControl"; +@source "../../node_modules/@perfect-design/ui/dist/components/forms/TimeInput"; +@source "../../node_modules/@perfect-design/ui/dist/components/layout/AppShell"; +@source "../../node_modules/@perfect-design/ui/dist/components/layout/ConfigProvider"; +@source "../../node_modules/@perfect-design/ui/dist/components/layout/Container"; +@source "../../node_modules/@perfect-design/ui/dist/components/navigation/NavLink"; +@source "../../node_modules/@perfect-design/ui/dist/components/navigation/Pagination"; +@source "../../node_modules/@perfect-design/ui/dist/components/navigation/SidebarNav"; +@source "../../node_modules/@perfect-design/ui/dist/components/navigation/ThemeToggle"; +@source "../../node_modules/@perfect-design/ui/dist/components/overlays/Command"; +@source "../../node_modules/@perfect-design/ui/dist/components/overlays/Dialog"; +@source "../../node_modules/@perfect-design/ui/dist/components/overlays/Popover"; +@source "../../node_modules/@perfect-design/ui/dist/components/overlays/Sheet"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/Badge"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/Button"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/Icon"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/Kbd"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/Spinner"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/StatusBadge"; +@source "../../node_modules/@perfect-design/ui/dist/components/primitives/StatusDot"; +@source "../../node_modules/@perfect-design/ui/dist/components/typography/RelativeTime/**/*.js"; /* * The base palette (background, primary, border, radius, ...) now comes from @@ -220,3 +277,15 @@ .wb-model-provider::after { content: '/'; } .wb-model-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } @media (min-width: 640px) { .wb-table td.wb-text:has(.wb-model) { width: 100%; max-width: 0; overflow: hidden; } } + +/* FaIcon.vue's box; layered below utilities so classes such as `hidden` still win. */ +@layer base { + .svg-inline--fa { + box-sizing: content-box; + display: inline-block; + height: 1em; + overflow: visible; + vertical-align: -0.125em; + width: 1.25em; + } +} diff --git a/webui/src/components/AccessMatrix.vue b/webui/src/components/AccessMatrix.vue deleted file mode 100644 index 15c1117..0000000 --- a/webui/src/components/AccessMatrix.vue +++ /dev/null @@ -1,206 +0,0 @@ - - - diff --git a/webui/src/components/AttributionDrilldown.vue b/webui/src/components/AttributionDrilldown.vue deleted file mode 100644 index 1ced77c..0000000 --- a/webui/src/components/AttributionDrilldown.vue +++ /dev/null @@ -1,197 +0,0 @@ - - - diff --git a/webui/src/components/BudgetRatioBars.vue b/webui/src/components/BudgetRatioBars.vue deleted file mode 100644 index df80a17..0000000 --- a/webui/src/components/BudgetRatioBars.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/webui/src/components/BurnDownChart.vue b/webui/src/components/BurnDownChart.vue deleted file mode 100644 index 5593e65..0000000 --- a/webui/src/components/BurnDownChart.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - diff --git a/webui/src/components/ChangeHelper.vue b/webui/src/components/ChangeHelper.vue deleted file mode 100644 index a4693c8..0000000 --- a/webui/src/components/ChangeHelper.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - diff --git a/webui/src/components/ChartCard.vue b/webui/src/components/ChartCard.vue deleted file mode 100644 index 6942ee5..0000000 --- a/webui/src/components/ChartCard.vue +++ /dev/null @@ -1,124 +0,0 @@ - - - diff --git a/webui/src/components/ClampedRangeNotice.vue b/webui/src/components/ClampedRangeNotice.vue deleted file mode 100644 index 35f0f70..0000000 --- a/webui/src/components/ClampedRangeNotice.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/webui/src/components/ConfigTree.vue b/webui/src/components/ConfigTree.vue deleted file mode 100644 index d8121cb..0000000 --- a/webui/src/components/ConfigTree.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/webui/src/components/ConsumerDirectory.vue b/webui/src/components/ConsumerDirectory.vue deleted file mode 100644 index 261df87..0000000 --- a/webui/src/components/ConsumerDirectory.vue +++ /dev/null @@ -1,492 +0,0 @@ - - - diff --git a/webui/src/components/CostAvoidedCard.vue b/webui/src/components/CostAvoidedCard.vue deleted file mode 100644 index 8ab5c44..0000000 --- a/webui/src/components/CostAvoidedCard.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - diff --git a/webui/src/components/CostForecastCard.vue b/webui/src/components/CostForecastCard.vue deleted file mode 100644 index a391cff..0000000 --- a/webui/src/components/CostForecastCard.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - diff --git a/webui/src/components/CsvExportButton.vue b/webui/src/components/CsvExportButton.vue deleted file mode 100644 index dfab2f2..0000000 --- a/webui/src/components/CsvExportButton.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - diff --git a/webui/src/components/DataTable.vue b/webui/src/components/DataTable.vue deleted file mode 100644 index 7fd157d..0000000 --- a/webui/src/components/DataTable.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - diff --git a/webui/src/components/DetailField.vue b/webui/src/components/DetailField.vue deleted file mode 100644 index e44362f..0000000 --- a/webui/src/components/DetailField.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/webui/src/components/EmptyState.vue b/webui/src/components/EmptyState.vue deleted file mode 100644 index 5f54051..0000000 --- a/webui/src/components/EmptyState.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/webui/src/components/EntityLink.vue b/webui/src/components/EntityLink.vue deleted file mode 100644 index 77365cc..0000000 --- a/webui/src/components/EntityLink.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - diff --git a/webui/src/components/ErrorState.vue b/webui/src/components/ErrorState.vue deleted file mode 100644 index 730f315..0000000 --- a/webui/src/components/ErrorState.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - diff --git a/webui/src/components/EventsView.vue b/webui/src/components/EventsView.vue deleted file mode 100644 index cc0ba44..0000000 --- a/webui/src/components/EventsView.vue +++ /dev/null @@ -1,170 +0,0 @@ - - - diff --git a/webui/src/components/FaIcon.vue b/webui/src/components/FaIcon.vue new file mode 100644 index 0000000..c87fbff --- /dev/null +++ b/webui/src/components/FaIcon.vue @@ -0,0 +1,25 @@ + + + diff --git a/webui/src/components/KpiTile.vue b/webui/src/components/KpiTile.vue deleted file mode 100644 index 616451c..0000000 --- a/webui/src/components/KpiTile.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - diff --git a/webui/src/components/LoadStateView.vue b/webui/src/components/LoadStateView.vue deleted file mode 100644 index bb19d5e..0000000 --- a/webui/src/components/LoadStateView.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - diff --git a/webui/src/components/ModelCatalogTable.vue b/webui/src/components/ModelCatalogTable.vue deleted file mode 100644 index e8da3d3..0000000 --- a/webui/src/components/ModelCatalogTable.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - diff --git a/webui/src/components/PricingHealthTable.vue b/webui/src/components/PricingHealthTable.vue deleted file mode 100644 index 4397ae4..0000000 --- a/webui/src/components/PricingHealthTable.vue +++ /dev/null @@ -1,157 +0,0 @@ - - - diff --git a/webui/src/components/ProviderHealthPanel.vue b/webui/src/components/ProviderHealthPanel.vue deleted file mode 100644 index 9f6c241..0000000 --- a/webui/src/components/ProviderHealthPanel.vue +++ /dev/null @@ -1,563 +0,0 @@ - - - diff --git a/webui/src/components/ProviderRateBadge.vue b/webui/src/components/ProviderRateBadge.vue deleted file mode 100644 index 21ac4d3..0000000 --- a/webui/src/components/ProviderRateBadge.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - diff --git a/webui/src/components/SearchInput.vue b/webui/src/components/SearchInput.vue deleted file mode 100644 index 3d3ce2f..0000000 --- a/webui/src/components/SearchInput.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - diff --git a/webui/src/components/SkeletonChart.vue b/webui/src/components/SkeletonChart.vue deleted file mode 100644 index dd256ed..0000000 --- a/webui/src/components/SkeletonChart.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/webui/src/components/SkeletonKpiTile.vue b/webui/src/components/SkeletonKpiTile.vue deleted file mode 100644 index b2e6225..0000000 --- a/webui/src/components/SkeletonKpiTile.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/webui/src/components/SkeletonList.vue b/webui/src/components/SkeletonList.vue deleted file mode 100644 index 3753a02..0000000 --- a/webui/src/components/SkeletonList.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/webui/src/components/SkeletonTable.vue b/webui/src/components/SkeletonTable.vue deleted file mode 100644 index 142f9a6..0000000 --- a/webui/src/components/SkeletonTable.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/webui/src/components/SmartRoutersCard.spec.ts b/webui/src/components/SmartRoutersCard.spec.ts deleted file mode 100644 index 7b478ee..0000000 --- a/webui/src/components/SmartRoutersCard.spec.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { createSSRApp } from 'vue' -import { renderToString } from 'vue/server-renderer' -import { describe, expect, it } from 'vitest' - -import SmartRoutersCard from '@/components/SmartRoutersCard.vue' -import type { AdminRouterView } from '@/types/api' - -const router: AdminRouterView = { - name: 'auto', - defaultTier: 'small', - selection: 'hash', - maxAttempts: 3, - contextEscalation: false, - shadowEnabled: false, - classifier: 'v1', - riskZ: 128, - calibration: { mode: 'off', delta: [], maxLower: 150, maxRaise: 0, freeze: false }, - saturationDowngrade: false, - downgradeBand: 100, - downgraded: 0, - timeoutFallback: false, - fellBack: 0, - tiers: [ - { name: 'small', minScore: 0, models: ['openai/gpt-5-mini'] }, - { name: 'big', minScore: 400, models: ['anthropic/claude-opus', 'openai/gpt-5'] }, - ], - keywordRules: [{ tier: 'big', keywords: ['prove', 'audit'] }], - contextTokens: 262144, - stats: { - scope: 'shared', - requests: 4, - tiers: [ - { name: 'small', count: 1 }, - { name: 'big', count: 3 }, - ], - reasons: [ - { name: 'keyword', count: 1 }, - { name: 'score', count: 3 }, - ], - escalations: [{ from: 'small', to: 'big', count: 2 }], - shadow: [], - outcomes: [], - }, -} - -function render(routers: AdminRouterView[]): Promise { - return renderToString(createSSRApp(SmartRoutersCard, { routers })) -} - -describe('SmartRoutersCard', () => { - it('shows an empty message with no routers', async () => { - expect(await render([])).toContain('None configured.') - }) - - it('shows calibration, adaptive selection and downgrade settings', async () => { - const live: AdminRouterView = { - ...router, - selection: 'adaptive', - adaptive: { explorePct: 5, windowHours: 6, latencyWeightPct: 30 }, - calibration: { mode: 'shadow', delta: [{ tier: 'big', delta: 25 }], maxLower: 150, maxRaise: 0, freeze: false }, - saturationDowngrade: true, - downgradeBand: 100, - downgraded: 7, - } - const html = await render([live]) - expect(html).toContain('selection: adaptive') - expect(html).toContain('explore 5%, window 6h') - expect(html).toContain('calibration: shadow') - expect(html).toContain('offsets (not applied): big -25') - expect(html).toContain('saturation downgrade: on, band 100') - expect(html).toContain('downgraded: 7') - const off = await render([router]) - expect(off).toContain('calibration: off') - expect(off).toContain('saturation downgrade: off') - expect(off).not.toContain('offsets') - expect(off).not.toContain('explore') - expect(off).not.toContain('downgraded:') - }) - - it('shows the timeout fallback flag and its count only when on', async () => { - const on = await render([{ ...router, timeoutFallback: true, fellBack: 3 }]) - expect(on).toContain('timeout fallback: on') - expect(on).toContain('fell back: 3') - const off = await render([router]) - expect(off).toContain('timeout fallback: off') - expect(off).not.toContain('fell back:') - }) - - it('renders router settings, tiers and keyword rules', async () => { - const html = await render([router]) - expect(html).toContain('Smart routers') - expect(html).toContain('auto') - expect(html).toContain('default tier: small') - expect(html).toContain('selection: hash') - expect(html).toContain('max attempts: 3') - expect(html).toContain('context escalation: off') - expect(html).toContain('from score 400') - expect(html).toContain('anthropic/claude-opus, openai/gpt-5') - expect(html).toContain('prove, audit') - }) - - it('shows the first byte timeout only when set', async () => { - expect(await render([{ ...router, firstByteTimeout: '40s' }])).toContain('first byte timeout: 40s') - expect(await render([router])).not.toContain('first byte timeout') - }) - - it('shows the tools min tier only when set', async () => { - expect(await render([{ ...router, toolsMinTier: 'big' }])).toContain('tools min tier: big') - expect(await render([router])).not.toContain('tools min tier') - }) - - it('shows the classifier and the risk margin only when v2 is involved', async () => { - const plain = await render([router]) - expect(plain).toContain('classifier: v1') - expect(plain).not.toContain('risk z') - expect(plain).not.toContain('shadow classifier') - const shadowed = await render([{ ...router, shadowEnabled: true, shadowClassifier: 'v2', riskZ: 90 }]) - expect(shadowed).toContain('shadow classifier: v2') - expect(shadowed).toContain('risk z: 90') - expect(await render([{ ...router, classifier: 'v2' }])).toContain('risk z: 128') - }) - - it('renders the shadow agreement matrix only when shadow weights are set', async () => { - const shadowed: AdminRouterView = { - ...router, - shadowEnabled: true, - stats: { - ...router.stats!, - shadow: [ - { live: 'small', shadow: 'small', count: 6 }, - { live: 'big', shadow: 'small', count: 2 }, - { live: 'big', shadow: 'big', count: 2 }, - ], - }, - } - const html = await render([shadowed]) - expect(html).toContain('Shadow weights') - expect(html).toContain('aria-label="Shadow agreement matrix for auto"') - expect(html).toContain('agreement: 80%') - expect(html).toMatch(/]*>small<\/th>/) - expect(html).toMatch(/data-cell="big:small"[^>]*>2]*>0 { - const html = await render([{ ...router, shadowEnabled: true }]) - expect(html).toContain('Shadow weights') - expect(html).toContain('agreement: 0%') - expect(html).not.toContain('NaN') - }) - - it('renders outcome counts per tier summed over reasons', async () => { - const withOutcomes: AdminRouterView = { - ...router, - stats: { - ...router.stats!, - outcomes: [ - { tier: 'small', reason: 'score', outcome: 'ok', count: 3 }, - { tier: 'small', reason: 'keyword', outcome: 'ok', count: 1 }, - { tier: 'small', reason: 'score', outcome: 'escalated', count: 2 }, - { tier: 'big', reason: 'score', outcome: 'error', count: 1 }, - { tier: 'big', reason: 'score', outcome: 'bad', count: 2 }, - { tier: 'big', reason: 'score', outcome: 'slow', count: 5 }, - { tier: 'big', reason: 'keyword', outcome: 'slow', count: 1 }, - ], - }, - } - const html = await render([withOutcomes]) - expect(html).toContain('aria-label="Outcomes for auto"') - expect(html).toMatch(/data-cell="small:ok"[^>]*>4]*>2]*>1]*>2]*>slow<\/th>/) - expect(html).toMatch(/data-cell="big:slow"[^>]*>6]*>0 { - const html = await render([{ ...router, shadowEnabled: true, stats: { ...router.stats!, scope: 'instance' } }]) - expect(html).toContain('This gateway instance, since start') - }) - - it('shows the context window, per-tier counts and shares, reasons and escalations', async () => { - const html = await render([router]) - expect(html).toContain('context window: 256k') - expect(html).toContain('requests: 4') - expect(html).toContain('1 req (25%)') - expect(html).toContain('3 req (75%)') - expect(html).toContain('width:75%') - expect(html).toContain('keyword: 1') - expect(html).toContain('score: 3') - expect(html).toMatch(/Escalated[\s\S]*small[\s\S]*to[\s\S]*big[\s\S]*: 2/) - expect(html).toContain('All replicas, this month (UTC)') - }) - - it('labels per-instance counts when Redis is not shared', async () => { - const html = await render([{ ...router, stats: { ...router.stats!, scope: 'instance' } }]) - expect(html).toContain('This gateway instance, since start') - expect(html).not.toContain('All replicas') - }) - - it('renders zero counts and no window without stats', async () => { - const { contextTokens: _c, stats: _s, ...bare } = router - const html = await render([bare]) - expect(html).not.toContain('context window:') - expect(html).toContain('requests: 0') - expect(html).toContain('0 req (0%)') - expect(html).not.toContain('Routing reasons') - expect(html).not.toContain('Escalated') - }) - - it('handles zero-filled stats without dividing by zero', async () => { - const zero: AdminRouterView = { - ...router, - stats: { scope: 'instance', requests: 0, tiers: [{ name: 'small', count: 0 }, { name: 'big', count: 0 }], reasons: [], escalations: [], shadow: [], outcomes: [] }, - } - const html = await render([zero]) - expect(html).toContain('0 req (0%)') - expect(html).not.toContain('NaN') - }) -}) diff --git a/webui/src/components/SmartRoutersCard.vue b/webui/src/components/SmartRoutersCard.vue deleted file mode 100644 index a8aaeea..0000000 --- a/webui/src/components/SmartRoutersCard.vue +++ /dev/null @@ -1,180 +0,0 @@ - - - diff --git a/webui/src/components/SortHeaderButton.vue b/webui/src/components/SortHeaderButton.vue deleted file mode 100644 index 50b7f0c..0000000 --- a/webui/src/components/SortHeaderButton.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - diff --git a/webui/src/components/StaleNotice.vue b/webui/src/components/StaleNotice.vue deleted file mode 100644 index 0c1563c..0000000 --- a/webui/src/components/StaleNotice.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/webui/src/components/StatDisabledAlert.vue b/webui/src/components/StatDisabledAlert.vue deleted file mode 100644 index 4df5f41..0000000 --- a/webui/src/components/StatDisabledAlert.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - diff --git a/webui/src/components/StatItem.vue b/webui/src/components/StatItem.vue deleted file mode 100644 index e116e66..0000000 --- a/webui/src/components/StatItem.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - diff --git a/webui/src/components/TargetCallers.vue b/webui/src/components/TargetCallers.vue deleted file mode 100644 index 01e98ca..0000000 --- a/webui/src/components/TargetCallers.vue +++ /dev/null @@ -1,105 +0,0 @@ - - - diff --git a/webui/src/components/TargetsView.vue b/webui/src/components/TargetsView.vue deleted file mode 100644 index 6516b16..0000000 --- a/webui/src/components/TargetsView.vue +++ /dev/null @@ -1,150 +0,0 @@ - - - diff --git a/webui/src/components/TimeSeriesChart.vue b/webui/src/components/TimeSeriesChart.vue deleted file mode 100644 index 5787278..0000000 --- a/webui/src/components/TimeSeriesChart.vue +++ /dev/null @@ -1,190 +0,0 @@ - - - diff --git a/webui/src/components/TopList.vue b/webui/src/components/TopList.vue deleted file mode 100644 index c5e056f..0000000 --- a/webui/src/components/TopList.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - diff --git a/webui/src/components/TryLongerRangeButton.vue b/webui/src/components/TryLongerRangeButton.vue deleted file mode 100644 index c61a8a4..0000000 --- a/webui/src/components/TryLongerRangeButton.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/webui/src/components/UsageBar.vue b/webui/src/components/UsageBar.vue deleted file mode 100644 index 3082aa4..0000000 --- a/webui/src/components/UsageBar.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - diff --git a/webui/src/components/UsageTable.vue b/webui/src/components/UsageTable.vue deleted file mode 100644 index 7e1bd28..0000000 --- a/webui/src/components/UsageTable.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - diff --git a/webui/src/components/UserDetail.vue b/webui/src/components/UserDetail.vue deleted file mode 100644 index 4af8535..0000000 --- a/webui/src/components/UserDetail.vue +++ /dev/null @@ -1,320 +0,0 @@ - - - diff --git a/webui/src/components/ui/accordion/Accordion.vue b/webui/src/components/ui/accordion/Accordion.vue deleted file mode 100644 index 757d951..0000000 --- a/webui/src/components/ui/accordion/Accordion.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/webui/src/components/ui/accordion/AccordionContent.vue b/webui/src/components/ui/accordion/AccordionContent.vue deleted file mode 100644 index 394dd71..0000000 --- a/webui/src/components/ui/accordion/AccordionContent.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/webui/src/components/ui/accordion/AccordionItem.vue b/webui/src/components/ui/accordion/AccordionItem.vue deleted file mode 100644 index 31a89dd..0000000 --- a/webui/src/components/ui/accordion/AccordionItem.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/webui/src/components/ui/accordion/AccordionTrigger.vue b/webui/src/components/ui/accordion/AccordionTrigger.vue deleted file mode 100644 index dd5e340..0000000 --- a/webui/src/components/ui/accordion/AccordionTrigger.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/webui/src/components/ui/accordion/index.ts b/webui/src/components/ui/accordion/index.ts deleted file mode 100644 index 9340ac0..0000000 --- a/webui/src/components/ui/accordion/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { default as Accordion } from './Accordion.vue' -export { default as AccordionContent } from './AccordionContent.vue' -export { default as AccordionItem } from './AccordionItem.vue' -export { default as AccordionTrigger } from './AccordionTrigger.vue' diff --git a/webui/src/components/ui/select/SelectItem.vue b/webui/src/components/ui/select/SelectItem.vue index 2923708..1289893 100644 --- a/webui/src/components/ui/select/SelectItem.vue +++ b/webui/src/components/ui/select/SelectItem.vue @@ -3,7 +3,7 @@ import type { SelectItemProps } from 'reka-ui' import type { HTMLAttributes } from 'vue' import { faCheck } from '@fortawesome/free-solid-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' +import FontAwesomeIcon from '@/components/FaIcon.vue' import { reactiveOmit } from '@vueuse/core' import { SelectItem, diff --git a/webui/src/components/ui/select/SelectScrollDownButton.vue b/webui/src/components/ui/select/SelectScrollDownButton.vue index d0e87e4..12cf533 100644 --- a/webui/src/components/ui/select/SelectScrollDownButton.vue +++ b/webui/src/components/ui/select/SelectScrollDownButton.vue @@ -3,7 +3,7 @@ import type { SelectScrollDownButtonProps } from 'reka-ui' import type { HTMLAttributes } from 'vue' import { faChevronDown } from '@fortawesome/free-solid-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' +import FontAwesomeIcon from '@/components/FaIcon.vue' import { reactiveOmit } from '@vueuse/core' import { SelectScrollDownButton, useForwardProps } from 'reka-ui' import { cn } from '@/lib/utils' diff --git a/webui/src/components/ui/select/SelectScrollUpButton.vue b/webui/src/components/ui/select/SelectScrollUpButton.vue index fa5a9ee..c4c76ea 100644 --- a/webui/src/components/ui/select/SelectScrollUpButton.vue +++ b/webui/src/components/ui/select/SelectScrollUpButton.vue @@ -3,7 +3,7 @@ import type { SelectScrollUpButtonProps } from 'reka-ui' import type { HTMLAttributes } from 'vue' import { faChevronUp } from '@fortawesome/free-solid-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' +import FontAwesomeIcon from '@/components/FaIcon.vue' import { reactiveOmit } from '@vueuse/core' import { SelectScrollUpButton, useForwardProps } from 'reka-ui' import { cn } from '@/lib/utils' diff --git a/webui/src/components/ui/select/SelectTrigger.vue b/webui/src/components/ui/select/SelectTrigger.vue index 01ebe08..bd51edd 100644 --- a/webui/src/components/ui/select/SelectTrigger.vue +++ b/webui/src/components/ui/select/SelectTrigger.vue @@ -3,7 +3,7 @@ import type { SelectTriggerProps } from 'reka-ui' import type { HTMLAttributes } from 'vue' import { faChevronDown } from '@fortawesome/free-solid-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' +import FontAwesomeIcon from '@/components/FaIcon.vue' import { reactiveOmit } from '@vueuse/core' import { SelectIcon, SelectTrigger, useForwardProps } from 'reka-ui' import { cn } from '@/lib/utils' diff --git a/webui/src/components/ui/skeleton/Skeleton.vue b/webui/src/components/ui/skeleton/Skeleton.vue deleted file mode 100644 index 2f14ebf..0000000 --- a/webui/src/components/ui/skeleton/Skeleton.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/webui/src/components/ui/skeleton/index.ts b/webui/src/components/ui/skeleton/index.ts deleted file mode 100644 index be21fad..0000000 --- a/webui/src/components/ui/skeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as Skeleton } from './Skeleton.vue' diff --git a/webui/src/components/ui/table/Table.vue b/webui/src/components/ui/table/Table.vue deleted file mode 100644 index db1a0fe..0000000 --- a/webui/src/components/ui/table/Table.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/TableBody.vue b/webui/src/components/ui/table/TableBody.vue deleted file mode 100644 index af688cb..0000000 --- a/webui/src/components/ui/table/TableBody.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/TableCell.vue b/webui/src/components/ui/table/TableCell.vue deleted file mode 100644 index 5cc93e2..0000000 --- a/webui/src/components/ui/table/TableCell.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/TableEmpty.vue b/webui/src/components/ui/table/TableEmpty.vue deleted file mode 100644 index 4ea2da7..0000000 --- a/webui/src/components/ui/table/TableEmpty.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/TableHead.vue b/webui/src/components/ui/table/TableHead.vue deleted file mode 100644 index 7ce19c5..0000000 --- a/webui/src/components/ui/table/TableHead.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/TableHeader.vue b/webui/src/components/ui/table/TableHeader.vue deleted file mode 100644 index 0b0f481..0000000 --- a/webui/src/components/ui/table/TableHeader.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/TableRow.vue b/webui/src/components/ui/table/TableRow.vue deleted file mode 100644 index afcbcdd..0000000 --- a/webui/src/components/ui/table/TableRow.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/webui/src/components/ui/table/index.ts b/webui/src/components/ui/table/index.ts deleted file mode 100644 index 2b74803..0000000 --- a/webui/src/components/ui/table/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { default as Table } from './Table.vue' -export { default as TableBody } from './TableBody.vue' -export { default as TableCell } from './TableCell.vue' -export { default as TableEmpty } from './TableEmpty.vue' -export { default as TableHead } from './TableHead.vue' -export { default as TableHeader } from './TableHeader.vue' -export { default as TableRow } from './TableRow.vue' -export { valueUpdater } from './utils' diff --git a/webui/src/components/ui/table/utils.ts b/webui/src/components/ui/table/utils.ts deleted file mode 100644 index ed3e301..0000000 --- a/webui/src/components/ui/table/utils.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { RowData, Updater } from '@tanstack/vue-table' -import type { Ref } from 'vue' - -/** - * valueUpdater applies one TanStack Table `Updater` — either a new - * value, or a function from the old value to the new one — to a plain Vue - * ref. This is the standard shadcn-vue glue between TanStack Table's - * callback-based state updates (`onSortingChange`, etc.) and Vue's - * ref-based reactivity (shadcn-vue docs: /docs/components/data-table). - */ -export function valueUpdater(updaterOrValue: Updater, ref: Ref): void { - ref.value = typeof updaterOrValue === 'function' ? (updaterOrValue as (old: T) => T)(ref.value) : updaterOrValue -} - -declare module '@tanstack/vue-table' { - interface ColumnMeta { - /** Right-align this column's header button and cell content, with tabular-nums — set on numeric columns (DataTable.vue reads this). */ - align?: 'right' - } -} diff --git a/webui/src/components/ui/tabs/Tabs.vue b/webui/src/components/ui/tabs/Tabs.vue deleted file mode 100644 index 7505f12..0000000 --- a/webui/src/components/ui/tabs/Tabs.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/webui/src/components/ui/tabs/TabsContent.vue b/webui/src/components/ui/tabs/TabsContent.vue deleted file mode 100644 index ca78a0f..0000000 --- a/webui/src/components/ui/tabs/TabsContent.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/webui/src/components/ui/tabs/TabsList.vue b/webui/src/components/ui/tabs/TabsList.vue deleted file mode 100644 index a8b1b7c..0000000 --- a/webui/src/components/ui/tabs/TabsList.vue +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/webui/src/components/ui/tabs/TabsTrigger.vue b/webui/src/components/ui/tabs/TabsTrigger.vue deleted file mode 100644 index 7b1c53e..0000000 --- a/webui/src/components/ui/tabs/TabsTrigger.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/webui/src/components/ui/tabs/index.ts b/webui/src/components/ui/tabs/index.ts deleted file mode 100644 index ac63d45..0000000 --- a/webui/src/components/ui/tabs/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { VariantProps } from 'class-variance-authority' -import { cva } from 'class-variance-authority' - -export { default as Tabs } from './Tabs.vue' -export { default as TabsContent } from './TabsContent.vue' -export { default as TabsList } from './TabsList.vue' -export { default as TabsTrigger } from './TabsTrigger.vue' - -export const tabsListVariants = cva( - // Horizontal orientation (the only one this app actually uses, in every - // tab strip switching between pages/kinds/forms) is capped to the - // available width and made horizontally scrollable instead of letting - // `w-fit` push it wider than its container — every Card (ui/card) - // clips overflow with `overflow-hidden` by design (rounded corners), so - // an uncapped TabsList wider than its Card doesn't spill onto the page - // (confirmed via live audit: zero page-level scrollWidth overflow - // anywhere) — it just gets silently CLIPPED with no scrollbar and no - // way to reach the hidden triggers. That silent clipping, not page - // overflow, is what broke "switching tabs on mobile" (measured live: - // the 5-trigger Config change-helper strip loses its last ~1.5 triggers - // under its Card at 360-390px). `justify-start` overrides the default - // centering only for this case: centering an overflowing flex row can - // otherwise leave its first item unreachable by scroll in some browsers - // (the well-known justify-content/overflow interaction) — reka-ui's own - // roving-tabindex keyboard handling on TabsTrigger is untouched by any - // of this, so arrow-key/Home/End navigation still works. - // - // `overflow-x-auto` alone (verify-ui-states.md #2) makes the computed - // `overflow-y` resolve to `auto` too (the CSS `overflow` shorthand - // behavior when only one axis is set explicitly) — combined with - // TabsTrigger's own active-indicator pseudo-element extending 5px below - // the 32px-tall list (`after:bottom-[-5px]`), that produced a real, - // always-visible vertical scrollbar on every TabsList on any platform - // that shows classic (non-overlay) scrollbars. `overflow-y-hidden` - // clips that harmless 5px indicator overflow without touching the - // horizontal scroll this rule exists for. - 'rounded-lg p-0.75 group-data-horizontal/tabs:h-8 group-data-horizontal/tabs:max-w-full group-data-horizontal/tabs:justify-start group-data-horizontal/tabs:overflow-x-auto group-data-horizontal/tabs:overflow-y-hidden data-[variant=line]:rounded-none group/tabs-list inline-flex w-fit items-center justify-center text-muted-foreground group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col', - { - variants: { - variant: { - default: 'bg-muted', - line: 'gap-1 bg-transparent', - }, - }, - defaultVariants: { - variant: 'default', - }, - }, -) - -export type TabsListVariants = VariantProps diff --git a/webui/src/composables/useSearchQuery.spec.ts b/webui/src/composables/useSearchQuery.spec.ts deleted file mode 100644 index 011ca4f..0000000 --- a/webui/src/composables/useSearchQuery.spec.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { ref } from 'vue' -import { describe, expect, it } from 'vitest' - -import { useSearchQuery } from './useSearchQuery' - -describe('useSearchQuery', () => { - it('normalized trims leading/trailing whitespace', () => { - const { query, normalized } = useSearchQuery() - query.value = ' alice ' - expect(normalized.value).toBe('alice') - }) - - it('normalized lowercases the query', () => { - const { query, normalized } = useSearchQuery() - query.value = 'AlIcE' - expect(normalized.value).toBe('alice') - }) - - it('hasQuery is false for a whitespace-only query', () => { - const { query, hasQuery } = useSearchQuery() - query.value = ' ' - expect(hasQuery.value).toBe(false) - }) - - // F9 (hash-state): a caller can supply the ref this composable reads and - // writes instead of a private local one, so the query round-trips - // through an external owner (e.g. ConsumerDirectory.vue's own - // `nav.params.q`-backed computed, or EventsView.vue's store-backed - // `userFilter` — useSearchQuery.ts's own doc comment) rather than being - // lost on remount. - describe('with an external ref', () => { - it('reads and derives from the external ref\'s current value, rather than starting blank', () => { - const external = ref('preset') - const { query, normalized, hasQuery } = useSearchQuery(external) - - expect(query.value).toBe('preset') - expect(normalized.value).toBe('preset') - expect(hasQuery.value).toBe(true) - }) - - it('writes THROUGH to the external ref — the same ref instance, not a copy', () => { - const external = ref('') - const { query } = useSearchQuery(external) - - query.value = 'typed' - - expect(external.value).toBe('typed') - }) - - it('reflects a change made directly to the external ref (bidirectional, not a one-time snapshot)', () => { - const external = ref('') - const { query, normalized } = useSearchQuery(external) - - external.value = 'set-elsewhere' - - expect(query.value).toBe('set-elsewhere') - expect(normalized.value).toBe('set-elsewhere') - }) - - it('without an external ref, two calls own independent state (no accidental sharing)', () => { - const a = useSearchQuery() - const b = useSearchQuery() - - a.query.value = 'alice' - - expect(b.query.value).toBe('') - }) - }) -}) diff --git a/webui/src/composables/useSearchQuery.ts b/webui/src/composables/useSearchQuery.ts deleted file mode 100644 index 485c6fb..0000000 --- a/webui/src/composables/useSearchQuery.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { Ref } from 'vue' -import { computed, ref } from 'vue' - -/** - * useSearchQuery is the one raw-query → {normalized, hasQuery} adapter - * every search filter in this panel uses — ProviderHealthPanel's - * model/provider search, ConsumerDirectory's user/group search - * (lib/usage-search.ts), EventsView's user/group filter, TargetsView's - * target search, each with its own matching logic but the identical - * query/normalizedQuery/hasQuery pairing; extracted so it exists once - * (vue.md: "if you've written it twice, you owe an abstraction"). Callers - * still own their own matching logic entirely — this only normalizes the - * raw input the same way every call site already agreed on: trimmed, - * lowercased. - * - * No `clear()` here — clearing is just setting `query.value = ''`, and - * every caller already gets that for free from SearchInput.vue's own - * clear button emitting `update:modelValue('')` through the `v-model` - * binding, so a separate clear function would be dead API surface no - * caller needs. - * - * `external` (F9, hash-state) lets a caller supply the ref this composable - * reads and writes instead of owning a private local one, so that ref's - * own search text round-trips through the URL hash. Two current callers - * pass it: ConsumerDirectory.vue binds a local `computed` get/set over - * `nav.params.q` directly (stores/nav.ts's own `params` is opaque, so the - * page owns interpreting/writing its own `q` key — see that computed's - * own doc comment for why this replaced an earlier, page-specific - * `nav.usageQuery` special case), and EventsView.vue binds - * `storeToRefs(events).userFilter`, which composables/useHashState.ts - * reads/writes directly against the same hash. Every OTHER caller - * (ProviderHealthPanel's model/provider search, TargetsView's target - * search) omits it and keeps its private, hash-independent ref instead — - * passing `external` changes nothing about `normalized`/`hasQuery`'s own - * derivation, only where the raw value itself lives. - */ -export function useSearchQuery(external?: Ref) { - const query = external ?? ref('') - const normalized = computed(() => query.value.trim().toLowerCase()) - const hasQuery = computed(() => normalized.value.length > 0) - - return { query, normalized, hasQuery } -} diff --git a/webui/src/composables/useThemeColors.ts b/webui/src/composables/useThemeColors.ts deleted file mode 100644 index 58067f2..0000000 --- a/webui/src/composables/useThemeColors.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { onBeforeUnmount, onMounted, ref } from 'vue' - -/** - * useThemeColors exposes the current computed values of the design - * tokens Chart.js needs to draw axis/grid/legend text (main.css) — Chart.js - * paints to a , so it cannot pick up CSS variables the way a DOM - * element does; the caller must read them and hand them to Chart.js as - * plain color strings. Every color literal in main.css is oklch()/hex, - * both valid canvas fillStyle values in current evergreen browsers (the - * only ones this admin panel targets — see vite.config.ts's - * modulePreload note for the same reasoning), so no conversion is needed. - * - * Re-reads when the `class` of changes (perfect-design's theme - * store toggles `.dark` there, including on an OS flip in "system" mode), - * so an open chart repaints on a theme switch. - */ -export function useThemeColors() { - const foreground = ref('') - const mutedForeground = ref('') - const border = ref('') - - function sync(): void { - const style = getComputedStyle(document.documentElement) - foreground.value = style.getPropertyValue('--foreground').trim() - mutedForeground.value = style.getPropertyValue('--muted-foreground').trim() - border.value = style.getPropertyValue('--border').trim() - } - - let observer: MutationObserver | undefined - onMounted(() => { - sync() - observer = new MutationObserver(sync) - observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] }) - }) - onBeforeUnmount(() => { - observer?.disconnect() - }) - - return { foreground, mutedForeground, border } -} diff --git a/webui/src/lib/bundle-gate.spec.ts b/webui/src/lib/bundle-gate.spec.ts new file mode 100644 index 0000000..7934c01 --- /dev/null +++ b/webui/src/lib/bundle-gate.spec.ts @@ -0,0 +1,10 @@ +import { describe, expect, it } from 'vitest' + +import { hasDist, LIMIT, totalGzip } from '../../scripts/bundle-size.mjs' + +// Needs a prior `npm run build`; skipped when dist/ is absent. +describe.skipIf(!hasDist())('bundle gate', () => { + it('keeps gzip JS+CSS within the size limit', () => { + expect(totalGzip()).toBeLessThanOrEqual(LIMIT) + }) +}) diff --git a/webui/src/lib/chart-palette.spec.ts b/webui/src/lib/chart-palette.spec.ts deleted file mode 100644 index ae5ef95..0000000 --- a/webui/src/lib/chart-palette.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { BREAKDOWN_PALETTE, CHART_SERIES_COLORS, seriesColor } from './chart-palette' - -describe('BREAKDOWN_PALETTE', () => { - it('starts with the same four colors as CHART_SERIES_COLORS, in the same order', () => { - expect(BREAKDOWN_PALETTE.slice(0, 4)).toEqual(CHART_SERIES_COLORS) - }) - - it('has 8 entries total', () => { - expect(BREAKDOWN_PALETTE).toHaveLength(8) - }) -}) - -describe('seriesColor', () => { - it('cycles through the default palette (CHART_SERIES_COLORS) by index', () => { - expect(seriesColor(0)).toBe(CHART_SERIES_COLORS[0]) - expect(seriesColor(CHART_SERIES_COLORS.length)).toBe(CHART_SERIES_COLORS[0]) - expect(seriesColor(CHART_SERIES_COLORS.length + 1)).toBe(CHART_SERIES_COLORS[1]) - }) - - it('cycles through an explicitly passed palette (e.g. BREAKDOWN_PALETTE) instead', () => { - expect(seriesColor(0, BREAKDOWN_PALETTE)).toBe(BREAKDOWN_PALETTE[0]) - expect(seriesColor(7, BREAKDOWN_PALETTE)).toBe(BREAKDOWN_PALETTE[7]) - expect(seriesColor(8, BREAKDOWN_PALETTE)).toBe(BREAKDOWN_PALETTE[0]) - }) -}) diff --git a/webui/src/lib/chart-palette.ts b/webui/src/lib/chart-palette.ts deleted file mode 100644 index 4df5e7a..0000000 --- a/webui/src/lib/chart-palette.ts +++ /dev/null @@ -1,49 +0,0 @@ -// reuse-audit.md F13: the ONE chart colour palette module. Two call sites -// used to each own a palette + its own cycling function — stores/ -// reliability.ts's RELIABILITY_SERIES_COLORS (a UI concern that had drifted -// into a Pinia store) and pages/SpendPage.vue's BREAKDOWN_PALETTE (the -// identical first four colours, plus four more) — this module is their one -// shared home. - -/** - * CHART_SERIES_COLORS cycles through main.css's four existing --chart-* - * tokens (assets/main.css is owned by WP-E — this module does not add a - * fifth) — used to colour the Reliability page's per-provider error-rate/ - * timeout/failover overlay charts. With more than four configured - * providers, colors repeat — a known, documented limitation rather than a - * silent one. - */ -export const CHART_SERIES_COLORS = ['--chart-requests', '--chart-tokens-in', '--chart-tokens-out', '--chart-cost'] as const - -/** - * BREAKDOWN_PALETTE cycles a colorblind-safe (Okabe & Ito, 2008) 8-color - * qualitative set across the Spend page's breakdown chart's per-model/ - * provider/group series. The first four reuse CHART_SERIES_COLORS (already - * that same palette's requests/tokens-in/tokens-out/cost members); the - * remaining four (--chart-series-a..d) extend it, defined alongside them in - * assets/main.css — main.css's original four tokens were sized for four - * FIXED semantic metrics, not an open-ended breakdown series count, so this - * page needed four more, but every chart color token lives in the one - * design-tokens file (Tailwind-only rule), never a component-local