From 06a7b1668b44f111eca5d08bc8c2c9d41d8e617e Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Fri, 18 Sep 2026 08:26:30 +0800 Subject: chore(frontend): shadcn-svelte / Tailwind / layerchart 工具链初始化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [变更性质] 本轮为维护性依赖与配置初始化,不改变业务页面(页面迁移见后续提交)。 [维护内容] 按 Leader 返工指令,前端 UI 组件库全量迁移 shadcn-svelte,图表渲染 从 echarts 换为 layerchart,需要一次性引入配套依赖与构建配置。 [实现方案] package.json/pnpm-lock.yaml:tailwindcss@4、@tailwindcss/vite、 tw-animate-css、shadcn-svelte、bits-ui、tailwind-variants、clsx、 tailwind-merge、@lucide/svelte、layerchart、@fontsource-variable/inter 与 @types/node;echarts 保留至页面迁移完成后移除。pnpm-workspace.yaml 声明 allowBuilds(esbuild、@tailwindcss/oxide)。components.json 采用 mira preset,别名 $lib。tsconfig 新增 $lib paths;vite.config.ts 加入 tailwindcss 插件、$lib alias(vitest 需要)与 test 环境配置。 src/lib/components/ 为 shadcn 生成的 UI 组件源码(button/input/label/ card/badge/alert/select/table/tabs/separator/chart),src/lib/utils.ts 为 cn 工具。app.css 引入 tailwind 与 shadcn CSS 变量并调整为 teal 主题(primary #0f766e、radius 0.375rem、双主题 chart-1..5),保留 legacy 选择器(banner/beat/table.data/metric 等),mobileCss.test.ts 依赖其语义断言。 [影响范围] 构建链与主题变量;后续页面提交逐步消费这些组件,npm run check/test/ build 已全绿验证。 --- frontend/src/lib/components/ui/select/index.ts | 40 +++++++++++++++++++ .../lib/components/ui/select/select-content.svelte | 45 ++++++++++++++++++++++ .../ui/select/select-group-heading.svelte | 21 ++++++++++ .../lib/components/ui/select/select-group.svelte | 17 ++++++++ .../lib/components/ui/select/select-item.svelte | 42 ++++++++++++++++++++ .../lib/components/ui/select/select-label.svelte | 20 ++++++++++ .../lib/components/ui/select/select-portal.svelte | 7 ++++ .../ui/select/select-scroll-down-button.svelte | 20 ++++++++++ .../ui/select/select-scroll-up-button.svelte | 20 ++++++++++ .../components/ui/select/select-separator.svelte | 18 +++++++++ .../lib/components/ui/select/select-trigger.svelte | 29 ++++++++++++++ .../lib/components/ui/select/select-value.svelte | 7 ++++ .../src/lib/components/ui/select/select.svelte | 11 ++++++ 13 files changed, 297 insertions(+) create mode 100644 frontend/src/lib/components/ui/select/index.ts create mode 100644 frontend/src/lib/components/ui/select/select-content.svelte create mode 100644 frontend/src/lib/components/ui/select/select-group-heading.svelte create mode 100644 frontend/src/lib/components/ui/select/select-group.svelte create mode 100644 frontend/src/lib/components/ui/select/select-item.svelte create mode 100644 frontend/src/lib/components/ui/select/select-label.svelte create mode 100644 frontend/src/lib/components/ui/select/select-portal.svelte create mode 100644 frontend/src/lib/components/ui/select/select-scroll-down-button.svelte create mode 100644 frontend/src/lib/components/ui/select/select-scroll-up-button.svelte create mode 100644 frontend/src/lib/components/ui/select/select-separator.svelte create mode 100644 frontend/src/lib/components/ui/select/select-trigger.svelte create mode 100644 frontend/src/lib/components/ui/select/select-value.svelte create mode 100644 frontend/src/lib/components/ui/select/select.svelte (limited to 'frontend/src/lib/components/ui/select') diff --git a/frontend/src/lib/components/ui/select/index.ts b/frontend/src/lib/components/ui/select/index.ts new file mode 100644 index 0000000..4960d45 --- /dev/null +++ b/frontend/src/lib/components/ui/select/index.ts @@ -0,0 +1,40 @@ +import Content from "./select-content.svelte"; +import GroupHeading from "./select-group-heading.svelte"; +import Group from "./select-group.svelte"; +import Item from "./select-item.svelte"; +import Label from "./select-label.svelte"; +import Portal from "./select-portal.svelte"; +import ScrollDownButton from "./select-scroll-down-button.svelte"; +import ScrollUpButton from "./select-scroll-up-button.svelte"; +import Separator from "./select-separator.svelte"; +import Trigger from "./select-trigger.svelte"; +import Value from "./select-value.svelte"; +import Root from "./select.svelte"; + +export { + Root, + Group, + Label, + Item, + Content, + Trigger, + Separator, + ScrollDownButton, + ScrollUpButton, + GroupHeading, + Portal, + Value, + // + Root as Select, + Group as SelectGroup, + Label as SelectLabel, + Item as SelectItem, + Content as SelectContent, + Trigger as SelectTrigger, + Separator as SelectSeparator, + ScrollDownButton as SelectScrollDownButton, + ScrollUpButton as SelectScrollUpButton, + GroupHeading as SelectGroupHeading, + Portal as SelectPortal, + Value as SelectValue, +}; diff --git a/frontend/src/lib/components/ui/select/select-content.svelte b/frontend/src/lib/components/ui/select/select-content.svelte new file mode 100644 index 0000000..3ec8408 --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-content.svelte @@ -0,0 +1,45 @@ + + + + + + + {@render children?.()} + + + + diff --git a/frontend/src/lib/components/ui/select/select-group-heading.svelte b/frontend/src/lib/components/ui/select/select-group-heading.svelte new file mode 100644 index 0000000..1fab5f0 --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-group-heading.svelte @@ -0,0 +1,21 @@ + + + + {@render children?.()} + diff --git a/frontend/src/lib/components/ui/select/select-group.svelte b/frontend/src/lib/components/ui/select/select-group.svelte new file mode 100644 index 0000000..f666cb2 --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-group.svelte @@ -0,0 +1,17 @@ + + + diff --git a/frontend/src/lib/components/ui/select/select-item.svelte b/frontend/src/lib/components/ui/select/select-item.svelte new file mode 100644 index 0000000..446dfdc --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-item.svelte @@ -0,0 +1,42 @@ + + + + {#snippet children({ selected, highlighted })} + + {#if selected} + + {/if} + + + {#if childrenProp} + {@render childrenProp({ selected, highlighted })} + {:else} + {label || value} + {/if} + + {/snippet} + diff --git a/frontend/src/lib/components/ui/select/select-label.svelte b/frontend/src/lib/components/ui/select/select-label.svelte new file mode 100644 index 0000000..4696025 --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-label.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/frontend/src/lib/components/ui/select/select-portal.svelte b/frontend/src/lib/components/ui/select/select-portal.svelte new file mode 100644 index 0000000..424bcdd --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-portal.svelte @@ -0,0 +1,7 @@ + + + diff --git a/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte b/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte new file mode 100644 index 0000000..7bc111e --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte @@ -0,0 +1,20 @@ + + + + + diff --git a/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte b/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte new file mode 100644 index 0000000..6c066ff --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte @@ -0,0 +1,20 @@ + + + + + diff --git a/frontend/src/lib/components/ui/select/select-separator.svelte b/frontend/src/lib/components/ui/select/select-separator.svelte new file mode 100644 index 0000000..aac5ca3 --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-separator.svelte @@ -0,0 +1,18 @@ + + + diff --git a/frontend/src/lib/components/ui/select/select-trigger.svelte b/frontend/src/lib/components/ui/select/select-trigger.svelte new file mode 100644 index 0000000..3acff3b --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-trigger.svelte @@ -0,0 +1,29 @@ + + + + {@render children?.()} + + diff --git a/frontend/src/lib/components/ui/select/select-value.svelte b/frontend/src/lib/components/ui/select/select-value.svelte new file mode 100644 index 0000000..ff34b0e --- /dev/null +++ b/frontend/src/lib/components/ui/select/select-value.svelte @@ -0,0 +1,7 @@ + + + diff --git a/frontend/src/lib/components/ui/select/select.svelte b/frontend/src/lib/components/ui/select/select.svelte new file mode 100644 index 0000000..05eb663 --- /dev/null +++ b/frontend/src/lib/components/ui/select/select.svelte @@ -0,0 +1,11 @@ + + + -- cgit v1.2.3