mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
* refactor(web): migrate icons to unplugin-icons Replace the hand-written gen-icon-data.mjs + @iconify/utils runtime rendering with unplugin-icons build-time imports. The public API (<Icon name>, iconSvg, IconName, SIZE_PX, NAME_TO_REMIX) is unchanged; 127+ call sites are untouched. - add unplugin-icons@^23.0.0 (devDep) + Vite Icons() plugin (compiler: vue3) - rewrite src/lib/icons.ts: static ~icons/ri/* imports (component + ?raw) for 56 distinct Remix icons across 59 IconName entries - Icon.vue renders <component :is> with unknown-name fallback - append ICON_GROUPS export for DesignSystemView catalog - DesignSystemView: v-for catalog, remove legacy-script references - delete gen-icon-data.mjs, gen-icon-catalog.mjs, icon-data.ts, gen:icons script - remove @iconify/vue and @iconify/utils from dependencies; move @iconify-json/ri to devDependencies - drop Icon.vue from check-style ICON_EXEMPT (no hand-written <svg>) * refactor(web): drop unused NAME_TO_REMIX icon mapping NAME_TO_REMIX was a Record<IconName, string> table introduced to map internal icon names to their ri: ids. After the unplugin-icons migration it has no production consumers — only icons.test.ts imported it (for two drift tests) and DesignSystemView mentioned it in descriptive copy. The ICONS table already conveys the same ri: id via each entry's paired component + ?raw imports (e.g. RiFolderOpenLine / RawFolderOpenLine). - remove NAME_TO_REMIX const from src/lib/icons.ts (-63 lines) - remove NAME_TO_REMIX import + describe block from icons.test.ts - update DesignSystemView §02 copy: describe the import-pair idiom and stop claiming ICON_GROUPS is sourced from NAME_TO_REMIX * chore: add changeset for web icon migration * chore(nix): bump pnpmDeps hash for unplugin-icons Adding unplugin-icons changed pnpm-lock.yaml, so the fixed-output pnpmDeps derivation hash is stale. Update to the hash reported by the Nix Build CI run.
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
/// <reference types="vite/client" />
|
|
|
|
// Injected by Vite `define` (see vite.config.ts): the dev proxy's upstream
|
|
// daemon target, so the UI can display which daemon it actually talks to.
|
|
// In production builds this is still defined but unused (same-origin daemon).
|
|
declare const __KIMI_DEV_PROXY_TARGET__: string;
|
|
|
|
// Injected by Vite `define` from apps/kimi-web/package.json.
|
|
declare const __KIMI_WEB_VERSION__: string;
|
|
|
|
// Injected by Vite `define`: true only in the web bundle embedded in the Kimi
|
|
// Desktop app. Gates the internal-build banner (see InternalBuildBanner.vue).
|
|
declare const __KIMI_WEB_DESKTOP__: boolean;
|
|
|
|
declare module '*.vue' {
|
|
import type { DefineComponent } from 'vue';
|
|
|
|
const component: DefineComponent<Record<string, never>, Record<string, never>, unknown>;
|
|
export default component;
|
|
}
|
|
|
|
// Vite's `?worker&type=module` imports — not declared in `vite/client`,
|
|
// which only covers `?worker`, `?worker&inline`, and `?worker&url` for classic
|
|
// workers. ES module workers need this additional declaration so TypeScript
|
|
// can resolve the import without errors.
|
|
declare module '*?worker&type=module' {
|
|
const WorkerFactory: new () => Worker;
|
|
export default WorkerFactory;
|
|
}
|
|
|
|
// unplugin-icons `?raw` imports — `unplugin-icons/types/vue` declares
|
|
// `~icons/*` as a Vue FunctionalComponent (for direct component imports). The
|
|
// `?raw` query re-exports the raw SVG source, which must type as `string`;
|
|
// this more-specific pattern overrides the component declaration for `?raw`
|
|
// imports only (e.g. `~icons/ri/add-line?raw`), leaving component imports
|
|
// (`~icons/ri/add-line`) typed as components.
|
|
declare module '~icons/*?raw' {
|
|
const src: string;
|
|
export default src;
|
|
}
|