Initial import of weiyuan frontend

This commit is contained in:
qiubaishen
2026-10-15 16:33:46 +08:00
commit d8f3aee261
774 changed files with 374914 additions and 0 deletions
+410
View File
@@ -0,0 +1,410 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
/*
* 企业中心精修层(方案 A+,见 docs/11-前端与体验中心/02-前端风格整体升级方案.md)
*
* 三部分:
* 1. 动效工具类 —— stagger 入场 / shimmer 骨架,全站可复用,不带 .org-center 前缀;
* 2. .org-center 作用域 —— Semi 非 portal 组件(Table/Tag/表单控件)的实底精修;
* 3. .org-modal / .org-sidesheet —— portal 弹窗的 opt-in 样式
* (Semi 弹窗渲染到 body,作用域选择器够不着,必须由 OrgModal/OrgSideSheet
* 包装组件注入 className,沿用 index.css 中 .notice-modal-enhanced 的先例模式)。
*
* 护栏:动效只动 transform/opacity,时长走 tokens.css 的 --motion-*,
* 全部动效在 prefers-reduced-motion 下禁用。
*/
/* ============ 1. 动效工具类(全站可复用) ============ */
@keyframes org-fade-up {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 容器加 .org-stagger,直接子元素依次渐入(70ms 步进,最多编排 8 个,
* 再往后的子元素统一用第 8 档延迟,保证总时长 < 500ms 护栏)。 */
.org-stagger > * {
animation: org-fade-up var(--motion-slow) var(--motion-ease) both;
}
.org-stagger > *:nth-child(1) {
animation-delay: 0ms;
}
.org-stagger > *:nth-child(2) {
animation-delay: 70ms;
}
.org-stagger > *:nth-child(3) {
animation-delay: 140ms;
}
.org-stagger > *:nth-child(4) {
animation-delay: 210ms;
}
.org-stagger > *:nth-child(5) {
animation-delay: 280ms;
}
.org-stagger > *:nth-child(6) {
animation-delay: 350ms;
}
.org-stagger > *:nth-child(7) {
animation-delay: 420ms;
}
.org-stagger > *:nth-child(n + 8) {
animation-delay: 480ms;
}
/* 骨架 shimmer 扫光:叠加在骨架块上(元素需 position:relative + overflow:hidden) */
@keyframes org-shimmer {
from {
transform: translateX(-100%);
}
to {
transform: translateX(100%);
}
}
.org-skeleton {
position: relative;
overflow: hidden;
}
.org-skeleton::after {
content: '';
position: absolute;
inset: 0;
transform: translateX(-100%);
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.55),
transparent
);
animation: org-shimmer 1.6s var(--motion-ease) infinite;
}
html.dark .org-skeleton::after {
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.08),
transparent
);
}
/* Hero action buttons sit on a strong brand gradient; Semi's light buttons use
* brand-colored text by default, which gets lost on the same blue background.
* Force pure white on the label and the lucide SVG icons directly so contrast
* holds in light mode regardless of Semi's inner-span coloring. */
.org-hero-actions .semi-button {
color: #fff !important;
background: rgba(255, 255, 255, 0.16) !important;
border: 1px solid rgba(255, 255, 255, 0.3) !important;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.org-hero-actions .semi-button:hover,
.org-hero-actions .semi-button:focus,
.org-hero-actions .semi-button:active {
color: #fff !important;
background: rgba(255, 255, 255, 0.26) !important;
border-color: rgba(255, 255, 255, 0.48) !important;
}
.org-hero-actions .semi-button .semi-icon,
.org-hero-actions .semi-button .semi-button-content {
color: #fff !important;
}
.org-hero-actions .semi-button svg {
color: #fff !important;
stroke: currentColor;
}
@media (prefers-reduced-motion: reduce) {
.org-stagger > * {
animation: none;
}
.org-skeleton::after {
animation: none;
display: none;
}
}
/* ============ 2. .org-center 作用域精修(非 portal) ============ */
/* --- Table:实底、行高收紧、表头分层、hover 品牌浅底 --- */
.org-center .semi-table {
background: transparent;
}
.org-center .semi-table-thead > .semi-table-row > .semi-table-row-head {
background: var(--semi-color-fill-0);
font-size: 12px;
font-weight: 600;
color: var(--text-secondary);
padding-top: 9px;
padding-bottom: 9px;
border-bottom: 1px solid var(--border-subtle);
}
.org-center .semi-table-tbody > .semi-table-row > .semi-table-row-cell {
padding-top: 10px;
padding-bottom: 10px;
border-bottom: 1px solid var(--border-subtle);
transition: background-color var(--motion-fast) var(--motion-ease);
}
.org-center .semi-table-tbody > .semi-table-row:hover > .semi-table-row-cell {
background: rgb(var(--brand-primary-rgb) / 0.04);
}
html.dark
.org-center
.semi-table-tbody
> .semi-table-row:hover
> .semi-table-row-cell {
background: rgb(var(--brand-primary-rgb) / 0.08);
}
/* 最后一行不再压一条边框,避免与卡片容器边框叠加 */
.org-center
.semi-table-tbody
> .semi-table-row:last-child
> .semi-table-row-cell {
border-bottom: none;
}
/* Keep the prompt-record expander centered when token metrics make rows tall. */
.org-prompt-records-table
.semi-table-tbody
> .semi-table-row:not(.semi-table-row-expand)
> .semi-table-column-expand {
position: relative;
padding-left: 44px;
}
/* Center via top/bottom:0 + margin:auto instead of top:50%/translateY: a
percentage `top` resolves against a table-cell's height unreliably across
browsers, which left the icon floating toward the top of tall rows. */
.org-prompt-records-table .semi-table-column-expand > .semi-table-expand-icon {
position: absolute;
top: 0;
bottom: 0;
left: 16px;
height: fit-content;
margin-top: auto;
margin-bottom: auto;
margin-right: 0;
transform: none;
}
/* --- Tag:统一浅底描边式(去实底重色块) --- */
.org-center .semi-tag {
border-radius: 6px;
font-weight: 500;
}
/* --- 表单控件:统一圆角、边框与品牌聚焦环 --- */
.org-center .semi-input-wrapper,
.org-center .semi-select,
.org-center .semi-datepicker-range-input,
.org-center .semi-autocomplete {
border-radius: 8px;
}
.org-center .semi-input-wrapper-focus,
.org-center .semi-select-focus {
box-shadow: var(--ring-brand);
}
/* --- 分页条:与实底底盘对齐 --- */
.org-center .semi-page {
padding-top: 4px;
}
/* ============ 3. portal 弹窗 opt-in 样式 ============ */
/* OrgModal 注入 .org-modal;OrgSideSheet 注入 .org-sidesheet。
* 与底盘同语言:实底、12px 圆角、细边框、lg 海拔。 */
.org-modal .semi-modal-content {
border-radius: 12px;
border: 1px solid var(--border-subtle);
background: var(--surface-card);
box-shadow: var(--elevation-lg);
}
.org-modal .semi-modal-header {
padding-bottom: 12px;
margin-bottom: 0;
border-bottom: 1px solid var(--border-subtle);
}
.org-modal .semi-modal-title {
font-size: 15px;
font-weight: 600;
}
.org-modal .semi-modal-body {
padding-top: 16px;
}
/* footer={null} 的弹窗:body 是 .semi-modal-content 的最后一个子节点,而 Semi
的底部留白本来由 footer 的下外边距提供,没有 footer 时内容会紧贴弹窗底边
(如项目「成员」「令牌」弹窗)。仅在无 footer 时补回底部呼吸空间,带 footer
的弹窗不受影响。 */
.org-modal .semi-modal-content > .semi-modal-body:last-child {
padding-bottom: 24px;
}
.org-sidesheet .semi-sidesheet-inner {
background: var(--surface-card);
box-shadow: var(--elevation-lg);
}
.org-sidesheet .semi-sidesheet-header {
border-bottom: 1px solid var(--border-subtle);
}
/* ============ 4. 品牌色跟随修复 ============ */
/* button 型 Tabs(如员工管理页的「员工权限/员工账号」切换):
* Semi 默认激活态用固定蓝,改为跟随品牌主题色(与 invite-detail-tabs 同方案)。 */
.org-center .semi-tabs-tab-button.semi-tabs-tab-active,
.org-center .semi-tabs-tab-button.semi-tabs-tab-active:hover {
background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
color: var(--brand-primary);
}
.org-center .semi-tabs-tab-button:hover:not(.semi-tabs-tab-active) {
background: color-mix(in srgb, var(--brand-primary) 6%, transparent);
color: var(--text-primary);
}
/* info Banner(如预算页的 cap 说明):全局语义"信息=蓝"在企业中心内
* 改为跟随品牌色 —— 线框/左侧光条/icon/微底全部吃 --toast-accent。 */
.org-center .semi-banner-info {
--toast-accent: var(--brand-primary);
}
/* ============ 5. 合并页二级页签(OrgSubpageTabs) ============ */
/* 页签条与子页面留白对齐(16/24/32 三档);子页面自带留白,内容区不重复加。
* line 型 Tabs 激活态同样跟随品牌色,不吃 Semi 默认蓝。 */
.org-subpage-tabs > .semi-tabs > .semi-tabs-bar {
padding: 12px 16px 0;
}
@media (min-width: 640px) {
.org-subpage-tabs > .semi-tabs > .semi-tabs-bar {
padding: 16px 24px 0;
}
}
@media (min-width: 1024px) {
.org-subpage-tabs > .semi-tabs > .semi-tabs-bar {
padding: 16px 32px 0;
}
}
.org-center .org-subpage-tabs .semi-tabs-tab-line.semi-tabs-tab-active {
color: var(--brand-primary);
border-bottom-color: var(--brand-primary);
}
/* ============ 6. 页签内的页签(三级页签,如企业设置 → 数据安全) ============ */
/* 一级页签是 line 型(下划线)。三级如果也用 line 型,两条页签条上下相邻、
* 形态与视觉权重完全一致,用户读不出"数据安全的五个子页签属于下一层",
* 只能靠位置猜。这里统一换成 segmented(分段控件)形态:整组页签收进一条
* 凹陷轨道,激活项是轨道里的实底小块 —— 与上一层的下划线形成形态差,
* 而不是靠字号/颜色这类弱信号去区分层级。
* 用 button 型 Tabs 承载(Semi 自带 pill 结构),这里只覆盖轨道与尺寸;
* 激活态配色继承第 4 节的品牌色跟随规则。 */
.org-nested-tabs > .semi-tabs > .semi-tabs-bar-button {
display: inline-flex;
align-items: center;
max-width: 100%;
margin: 4px 0 12px;
padding: 3px;
border: 1px solid var(--border-subtle);
border-radius: 10px;
/* 轨道底色用文字色低透明度混出,不吃 --surface-bg-base:页签条既可能落在
* 页面底色上、也可能落在白卡里,取固定表面色会在其中一种场景里完全隐形。 */
background: color-mix(in srgb, var(--text-primary) 6%, transparent);
/* 窄屏页签多于一屏时横向滚动,不换行撑破轨道 */
overflow-x: auto;
scrollbar-width: none;
}
.org-nested-tabs > .semi-tabs > .semi-tabs-bar-button::-webkit-scrollbar {
display: none;
}
/* Semi 给 button 型页签之间留了 8px,轨道内收紧到 2px */
.org-nested-tabs
.semi-tabs-bar-button.semi-tabs-bar-top
.semi-tabs-tab:not(:last-of-type) {
margin-right: 2px;
}
/* 比一级页签小一档:字号 13、内距更紧,层级差再加一层冗余信号 */
.org-nested-tabs .semi-tabs-tab-button {
padding: 5px 14px;
font-size: 13px;
line-height: 20px;
border-radius: 7px;
white-space: nowrap;
color: var(--text-secondary);
}
.org-center .org-nested-tabs .semi-tabs-tab-button.semi-tabs-tab-active,
.org-center .org-nested-tabs .semi-tabs-tab-button.semi-tabs-tab-active:hover {
font-weight: 600;
/* 品牌淡底(继承第 4 节)之上再补一层描边+微阴影,暗色下淡底对比不足时
* 仍能看清"哪一块是激活的"。 */
box-shadow:
inset 0 0 0 1px color-mix(in srgb, var(--brand-primary) 24%, transparent),
var(--elevation-xs);
}
/* ============ 5. 侧滑面板移动端适配 ============ */
/* OrgSideSheet 已在 JS 层把像素宽钳到 min(Npx, 100vw),这里是样式兜底 +
* 手机上的留白/底部操作区收敛。SideSheet 走 portal 渲染到 body,
* 页面级 CSS(如 skill-market.css)作用域够不着,必须写在这里。 */
@media (max-width: 767.98px) {
/* 注意选择器:Semi 把 className 合并到 .semi-sidesheet 这个节点本身
(cls(prefixCls, className, ...)),所以 `.org-sidesheet .semi-sidesheet`
永远匹配不到;而像素宽是内联打在 .semi-sidesheet-inner 上的,钳制必须落在它身上。
这条兜底覆盖没走 OrgSideSheet 包装、直接用 <SideSheet className='org-sidesheet'>
的调用点(如 OrgSkillLibrary 的「引入技能」面板)。 */
.org-sidesheet .semi-sidesheet-inner {
max-width: 100vw;
}
.org-sidesheet .semi-sidesheet-header {
padding: 14px 16px;
}
/* 标题多为技能名/成员名,窄屏下单行截断,避免把关闭按钮挤出可视区。
必须显式覆盖 Semi 的 `flex: 1 0 auto`——shrink 为 0 且 basis 为 auto 时,
标题恒等于 max-content 宽度,只加 overflow/text-overflow 不会触发省略号,
反而会把 .semi-sidesheet-content 的 overflow:hidden 变成把关闭按钮裁掉。 */
.org-sidesheet .semi-sidesheet-title {
flex: 1 1 auto;
font-size: 15px;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.org-sidesheet .semi-sidesheet-body {
padding: 16px;
/* iOS 惯性滚动,否则长详情在手机上滚动发涩 */
-webkit-overflow-scrolling: touch;
}
.org-sidesheet .semi-sidesheet-footer {
padding: 12px 16px;
/* 避开 iOS 底部 Home Indicator */
padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
}
+242
View File
@@ -0,0 +1,242 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
export const PRESETS = {
/* 默认 - AI 科技感(当前线上风格)。
* 渐变改为单调收敛的 indigo→violet(原 to=#a78bfa 比 via 更浅,呈"浅-深-浅"显生硬);
* bg-glow 取更通透的 300 级浅调,页面氛围更柔。
* primary 取 indigo-600(原 indigo-500 白字对比 4.47:1 差临界)——
* 实底按钮白字 6.29:1 过 AA,观感也更沉稳高级;鲜亮的 500 阶留给渐变与光晕。 */
default: {
name: '默认',
desc: 'AI 科技感 · 靛紫主色',
light: {
'brand-primary': '#4f46e5', /* indigo-600 白字 6.29:1 */
'brand-primary-hover': '#4338ca', /* indigo-700 */
'brand-primary-soft': 'rgba(79, 70, 229, 0.10)',
'brand-gradient-from': '#818cf8', /* indigo-400 */
'brand-gradient-via': '#6366f1', /* indigo-500 */
'brand-gradient-to': '#8b5cf6', /* violet-500 收敛同明度 */
'bg-glow-from': '#a5b4fc', /* indigo-300 通透 */
'bg-glow-to': '#c4b5fd', /* violet-300 通透 */
'accent-blue': '#3b82f6',
'accent-teal': '#14b8a6',
'accent-emerald': '#10b981',
},
dark: {
/* primary 取 indigo-500(非更亮的 400)—— 暗色实色按钮用白字需足够对比度 */
'brand-primary': '#6366f1',
'brand-primary-hover': '#818cf8',
'brand-primary-soft': 'rgba(99, 102, 241, 0.18)',
'brand-gradient-from': '#a5b4fc', /* indigo-300 */
'brand-gradient-via': '#818cf8', /* indigo-400 */
'brand-gradient-to': '#a855f7', /* purple-500 */
'bg-glow-from': '#818cf8',
'bg-glow-to': '#a855f7',
'accent-blue': '#60a5fa',
'accent-teal': '#2dd4bf',
'accent-emerald': '#34d399',
},
},
/* 海洋 - 云平台 azure(重点优化)。
* 采用 Ant Design / 阿里云蓝阶(#1677ff 系),同色阶平滑过渡,
* 主色干净专业、渐变无跳色;bg-glow 取通透天蓝(云控制台那种轻盈氛围);
* teal accent 用 cyan(#13c2c2) 点出"云·科技"气质。 */
ocean: {
name: '海洋',
desc: '云端 azure · 专业云平台',
light: {
/* 原 blue-5(#1677ff) 白字对比仅 4.10:1 不达 AA;取 Ant 深色系 blue-6(#1668dc)
* 白字 5.18:1 达标,且比 #0958d9 保留更多云蓝的鲜度。 */
'brand-primary': '#1668dc', /* 白字 5.18:1 */
'brand-primary-hover': '#0958d9', /* blue-6 */
'brand-primary-soft': 'rgba(22, 104, 220, 0.10)',
'brand-gradient-from': '#4096ff', /* blue-4 */
'brand-gradient-via': '#1677ff', /* blue-5 */
'brand-gradient-to': '#0958d9', /* blue-6 同阶收敛 */
'bg-glow-from': '#69b1ff', /* blue-3 通透云天 */
'bg-glow-to': '#91caff', /* blue-2 更轻盈 */
'accent-blue': '#1677ff',
'accent-teal': '#13c2c2', /* cyan 云科技点缀 */
'accent-emerald': '#10b981',
},
dark: {
/* primary 取 blue-5(非更亮的 blue-4)—— 暗色实色按钮白字对比度 ~4.3 可读 */
'brand-primary': '#1677ff', /* blue-5 */
'brand-primary-hover': '#4096ff', /* blue-4 */
'brand-primary-soft': 'rgba(22, 119, 255, 0.18)',
'brand-gradient-from': '#69b1ff', /* blue-3 */
'brand-gradient-via': '#4096ff', /* blue-4 */
'brand-gradient-to': '#1677ff', /* blue-5 */
'bg-glow-from': '#4096ff',
'bg-glow-to': '#69b1ff',
'accent-blue': '#4096ff',
'accent-teal': '#36cfc9', /* cyan-5 */
'accent-emerald': '#34d399',
},
},
/* 森林 - 自然绿。emerald→teal 本就平滑,bg-glow 取通透薄荷调更轻盈。 */
forest: {
name: '森林',
desc: '森林绿 · 健康自然',
light: {
/* 原 emerald-600(#059669) 白字对比仅 3.77:1;下沉一阶到 emerald-700
* 白字 5.48:1 过 AA,绿意更深沉;鲜绿留给渐变与光晕。 */
'brand-primary': '#047857', /* emerald-700 白字 5.48:1 */
'brand-primary-hover': '#065f46', /* emerald-800 */
'brand-primary-soft': 'rgba(4, 120, 87, 0.10)',
'brand-gradient-from': '#34d399', /* emerald-400 嫩绿 */
'brand-gradient-via': '#10b981', /* emerald-500 */
'brand-gradient-to': '#0d9488', /* teal-600 松石 */
'bg-glow-from': '#6ee7b7', /* emerald-300 通透 */
'bg-glow-to': '#99f6e4', /* teal-200 薄荷 */
'accent-blue': '#3b82f6',
'accent-teal': '#0d9488',
'accent-emerald': '#059669',
},
dark: {
/* primary 取 emerald-600 —— 暗色实色按钮白字需足够深的绿底 */
'brand-primary': '#059669', /* emerald-600 */
'brand-primary-hover': '#10b981', /* emerald-500 */
'brand-primary-soft': 'rgba(5, 150, 105, 0.18)',
'brand-gradient-from': '#6ee7b7', /* emerald-300 */
'brand-gradient-via': '#34d399', /* emerald-400 */
'brand-gradient-to': '#2dd4bf', /* teal-400 */
'bg-glow-from': '#34d399',
'bg-glow-to': '#2dd4bf',
'accent-blue': '#60a5fa',
'accent-teal': '#2dd4bf',
'accent-emerald': '#34d399',
},
},
/* 日落 - 暖橙调(营销、电商)。
* 渐变改 amber→orange→rose 的连续暖色旋转(经 400 级桥接),柔化原本的橙→玫红硬跳;
* bg-glow 取浅暖金→浅玫,霞光感更通透。 */
sunset: {
name: '日落',
desc: '暖橙 · 营销活力',
light: {
/* 原 orange-600(#ea580c) 白字对比仅 3.56:1(六预设中最低);下沉到 orange-700
* 白字 5.18:1 过 AA,暖而不刺;活力鲜橙留给渐变与光晕。 */
'brand-primary': '#c2410c', /* orange-700 白字 5.18:1 */
'brand-primary-hover': '#9a3412', /* orange-800 */
'brand-primary-soft': 'rgba(194, 65, 12, 0.10)',
'brand-gradient-from': '#fcd34d', /* amber-300 暮金 */
'brand-gradient-via': '#fb923c', /* orange-400 桥接 */
'brand-gradient-to': '#fb7185', /* rose-400 霞玫 */
'bg-glow-from': '#fde68a', /* amber-200 通透 */
'bg-glow-to': '#fecdd3', /* rose-200 浅霞 */
'accent-blue': '#3b82f6',
'accent-teal': '#14b8a6',
'accent-emerald': '#10b981',
},
dark: {
/* primary 取 orange-600 —— 暗色实色按钮白字需足够深的橙底 */
'brand-primary': '#ea580c', /* orange-600 */
'brand-primary-hover': '#f97316', /* orange-500 */
'brand-primary-soft': 'rgba(234, 88, 12, 0.18)',
'brand-gradient-from': '#fcd34d', /* amber-300 */
'brand-gradient-via': '#fb923c', /* orange-400 */
'brand-gradient-to': '#fb7185', /* rose-400 */
'bg-glow-from': '#fcd34d',
'bg-glow-to': '#fb7185',
'accent-blue': '#60a5fa',
'accent-teal': '#2dd4bf',
'accent-emerald': '#34d399',
},
},
/* 暗夜 - 紫色游戏感。bg-glow 取通透紫调,沉浸但不闷。 */
midnight: {
name: '暗夜',
desc: '暗夜紫 · 沉浸专注',
light: {
'brand-primary': '#7c3aed', /* violet-600 */
'brand-primary-hover': '#6d28d9', /* violet-700 */
'brand-primary-soft': 'rgba(124, 58, 237, 0.10)',
'brand-gradient-from': '#a78bfa', /* violet-400 */
'brand-gradient-via': '#8b5cf6', /* violet-500 */
'brand-gradient-to': '#9333ea', /* purple-600 兰紫,不刺眼 */
'bg-glow-from': '#c4b5fd', /* violet-300 通透 */
'bg-glow-to': '#d8b4fe', /* purple-300 通透 */
'accent-blue': '#6366f1',
'accent-teal': '#14b8a6',
'accent-emerald': '#10b981',
},
dark: {
/* primary 取 violet-500 —— 暗色实色按钮白字对比度 ~3.6 可读 */
'brand-primary': '#8b5cf6', /* violet-500 */
'brand-primary-hover': '#a78bfa', /* violet-400 */
'brand-primary-soft': 'rgba(139, 92, 246, 0.18)',
'brand-gradient-from': '#c4b5fd', /* violet-300 */
'brand-gradient-via': '#a78bfa',
'brand-gradient-to': '#c084fc', /* purple-400 */
'bg-glow-from': '#c4b5fd',
'bg-glow-to': '#c084fc',
'accent-blue': '#818cf8',
'accent-teal': '#2dd4bf',
'accent-emerald': '#34d399',
},
},
/* 极简 - 中性灰。渐变收到 slate-700(原 to=slate-800 近黑偏硬);
* bg-glow 取浅 slate,背景更通透干净。 */
mono: {
name: '极简',
desc: '中性灰 · 简洁克制',
light: {
'brand-primary': '#475569', /* slate-600 石墨蓝灰 */
'brand-primary-hover': '#334155', /* slate-700 */
'brand-primary-soft': 'rgba(71, 85, 105, 0.10)',
'brand-gradient-from': '#64748b', /* slate-500 */
'brand-gradient-via': '#475569', /* slate-600 */
'brand-gradient-to': '#334155', /* slate-700 收敛 */
'bg-glow-from': '#94a3b8', /* slate-400 通透 */
'bg-glow-to': '#cbd5e1', /* slate-300 */
'accent-blue': '#3b82f6',
'accent-teal': '#14b8a6',
'accent-emerald': '#10b981',
},
dark: {
/* primary 取 slate-500 —— 暗色实色按钮白字对比度 ~4.7 可读 */
'brand-primary': '#64748b', /* slate-500 */
'brand-primary-hover': '#94a3b8', /* slate-400 */
'brand-primary-soft': 'rgba(100, 116, 139, 0.18)',
'brand-gradient-from': '#cbd5e1', /* slate-300 */
'brand-gradient-via': '#94a3b8',
'brand-gradient-to': '#64748b', /* slate-500 */
'bg-glow-from': '#cbd5e1',
'bg-glow-to': '#64748b',
'accent-blue': '#60a5fa',
'accent-teal': '#2dd4bf',
'accent-emerald': '#34d399',
},
},
};
// 站点默认预设 —— 马甲包以「海洋」云平台 azure 作为出厂主题。
// 影响:① 后端无 theme 配置时的激活主题;② 未知 key 的回落;③ tokens.css 冷启动兜底已同步为 ocean。
export const DEFAULT_PRESET_KEY = 'ocean';
export function getPreset(key) {
return PRESETS[key] || PRESETS[DEFAULT_PRESET_KEY];
}
+158
View File
@@ -0,0 +1,158 @@
/*
* 主题语义 token 定义
*
* 这是默认主题(preset=default)的兜底值,确保即使 JS 注入失败或
* applyThemeFromCache 命中前的第一帧渲染也是正确的视觉。
*
* 运行时若加载了非默认预设,helpers/theme.js 会用 <style> 标签
* 注入更高优先级的同名变量覆盖这里的默认值。
*
* 命名规约:
* --brand-* : 品牌核心
* --accent-* : 强调辅助色
* --surface-* : 背景层
* --text-* : 文本
* --border-* : 边框
*
* 双选择器(html.dark, body[theme-mode="dark"])兼容 Tailwind 与 Semi
* 两套暗色模式切换机制。
*/
:root {
/* === 品牌色 ===
* 每个核心色都额外暴露 *-rgb 三元组("R G B" 空格分隔,无逗号无 rgb() 包装),
* 供 tailwind.config.js 用 `rgb(var(--*-rgb) / <alpha-value>)` 模式生成
* 支持透明度后缀的工具类(如 bg-brand/20、text-brand-from/60)。
* helpers/theme.js 会在运行时同步注入对应 rgb 版本。 */
/* 冷启动兜底色 = 站点默认预设(DEFAULT_PRESET_KEY = ocean 云平台 azure)。
* 与 presets.js 的 ocean.light 保持一致,避免首帧闪色。 */
--brand-primary: #1668dc; /* 云控制台主蓝(白字对比 5.18:1 过 AA,与 presets.js ocean 同步) */
--brand-primary-rgb: 22 104 220;
--brand-primary-hover: #0958d9; /* blue-6 */
--brand-primary-hover-rgb: 9 88 217;
--brand-primary-soft: rgba(22, 104, 220, 0.10);
/* 滚动条颜色(基于 brand-primary 派生半透明)
* 第一行 rgba 是 color-mix 不支持时的兜底(Chrome <111 / Firefox <113 / Safari <16.2),
* 第二行被现代浏览器识别,覆盖第一行。 */
--brand-scroll: rgba(22, 104, 220, 0.25);
--brand-scroll: color-mix(in srgb, var(--brand-primary) 25%, transparent);
--brand-scroll-hover: rgba(22, 104, 220, 0.45);
--brand-scroll-hover: color-mix(in srgb, var(--brand-primary) 45%, transparent);
/* === 签名渐变(核心识别) === */
--brand-gradient-from: #4096ff; /* blue-4 */
--brand-gradient-from-rgb: 64 150 255;
--brand-gradient-via: #1677ff; /* blue-5 */
--brand-gradient-via-rgb: 22 119 255;
--brand-gradient-to: #0958d9; /* blue-6 同阶收敛 */
--brand-gradient-to-rgb: 9 88 217;
/* === 页面背景晕染(大面积底色 / 光晕 blob) ===
* 与 brand-gradient-* 独立 —— 调它只影响页面背景大色块、动态光晕,
* 不影响按钮 / 气泡 / icon / 文字渐变(那些仍走 brand-gradient-*)。
* 只 2 stop(from/to),简单且全场所有页面统一使用。
* 取通透天蓝(云控制台轻盈氛围,与 presets.js ocean 同步)。 */
--bg-glow-from: #69b1ff; /* blue-3 通透云天 */
--bg-glow-from-rgb: 105 177 255;
--bg-glow-to: #91caff; /* blue-2 更轻盈 */
--bg-glow-to-rgb: 145 202 255;
/* === 强调色 === */
--accent-blue: #1677ff;
--accent-teal: #13c2c2; /* cyan 云科技点缀 */
--accent-emerald: #10b981;
/* === 表面层 ===
* 极淡冷蓝调(云平台质感):底色微偏蓝灰而非中性灰,白卡浮其上更通透。
* 所有页面 shell 用 bg-[var(--surface-bg-base)] 统一吃这个值。 */
--surface-bg-base: #f3f7fc; /* 冷调近白 */
--surface-card: #ffffff;
--surface-sidebar: #f6f9fd;
--surface-header: #ffffff;
/* === 文本与边框 === */
--text-primary: #1e293b;
--text-secondary: #475569;
/* 实底卡片方案靠 1px 边框分层(阴影极轻),比玻璃时代加深一档保证可辨 */
--border-subtle: rgba(15, 23, 42, 0.08);
/* === 动效 token(明暗共用)===
* 全站动效统一走这三档时长 + 一条 easing,禁止散落自定义 cubic-bezier。
* 只允许动 transform / opacity(不触发重排);入场动画只播一次。 */
--motion-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
--motion-fast: 150ms;
--motion-base: 240ms;
--motion-slow: 400ms;
/* === 海拔阴影体系(统一所有卡片/弹层/输入框的层次感) ===
* 极简但有层次:冷色调阴影(带一点蓝)比纯黑更通透高级。
* xs 描边级、sm 卡片静置、md 卡片 hover/弹层、lg 模态。 */
--elevation-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
--elevation-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
--elevation-md: 0 10px 28px -8px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
--elevation-lg: 0 24px 56px -12px rgba(15, 23, 42, 0.18), 0 6px 16px -6px rgba(15, 23, 42, 0.10);
/* 品牌聚焦环 —— 输入框/可聚焦元素统一用它 */
--ring-brand: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}
html.dark,
body[theme-mode='dark'] {
/* 冷启动兜底色 = ocean.dark(与 presets.js 同步)。
* primary 取 blue-5(#1677ff)——暗色实色按钮白字对比度 ~4.3 可读,不再用更浅的 blue-4。 */
--brand-primary: #1677ff; /* blue-5 */
--brand-primary-rgb: 22 119 255;
--brand-primary-hover: #4096ff; /* blue-4 */
--brand-primary-hover-rgb: 64 150 255;
--brand-primary-soft: rgba(22, 119, 255, 0.18);
--brand-scroll: rgba(22, 119, 255, 0.30);
--brand-scroll: color-mix(in srgb, var(--brand-primary) 30%, transparent);
--brand-scroll-hover: rgba(22, 119, 255, 0.50);
--brand-scroll-hover: color-mix(in srgb, var(--brand-primary) 50%, transparent);
--brand-gradient-from: #69b1ff; /* blue-3 */
--brand-gradient-from-rgb: 105 177 255;
--brand-gradient-via: #4096ff; /* blue-4 */
--brand-gradient-via-rgb: 64 150 255;
--brand-gradient-to: #1677ff; /* blue-5 */
--brand-gradient-to-rgb: 22 119 255;
/* 暗色页面背景晕染 —— 承接 ocean 暗色蓝阶,可单独调 */
--bg-glow-from: #4096ff;
--bg-glow-from-rgb: 64 150 255;
--bg-glow-to: #69b1ff;
--bg-glow-to-rgb: 105 177 255;
--accent-blue: #4096ff;
--accent-teal: #36cfc9; /* cyan-5 */
--accent-emerald: #34d399;
/* 暗色冷调底(微偏蓝黑,非纯中性黑),与浅色冷调呼应 */
--surface-bg-base: #0a0b10;
--surface-card: #16171d;
--surface-sidebar: #16171d;
--surface-header: #16171d;
--text-primary: #f4f4f5;
--text-secondary: #a1a1aa;
--border-subtle: rgba(255, 255, 255, 0.10);
/* 暗色海拔 —— 用更深的黑 + 略大扩散,暗背景上仍有层次 */
--elevation-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
--elevation-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.30);
--elevation-md: 0 10px 28px -8px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.40);
--elevation-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.65), 0 6px 16px -6px rgba(0, 0, 0, 0.45);
--ring-brand: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 32%, transparent);
}
/*
* 切换主题瞬间临时禁用所有 transition / animation,
* 避免大量带 transition 的组件同时渐变产生"卡 200ms"的观感。
* helpers/theme.js 在每次 applyTheme 时短暂挂载这个类。
*/
.theme-switching,
.theme-switching * {
transition: none !important;
animation-duration: 0s !important;
animation-delay: 0s !important;
}
+77
View File
@@ -0,0 +1,77 @@
.usage-record-action-button {
min-height: 34px;
border-radius: 999px !important;
font-weight: 650 !important;
letter-spacing: 0.01em;
transition:
transform 160ms ease,
box-shadow 160ms ease,
border-color 160ms ease,
background 160ms ease !important;
}
.usage-record-action-button:hover {
transform: translateY(-1px);
}
.usage-record-action-button:disabled,
.usage-record-action-button.semi-button-disabled {
transform: none;
opacity: 0.58;
}
.usage-record-action-button-primary {
border: 0 !important;
background: linear-gradient(
135deg,
var(--brand-gradient-from),
var(--brand-gradient-to)
) !important;
color: #fff !important;
box-shadow: 0 12px 28px
color-mix(in srgb, var(--brand-gradient-via) 28%, transparent) !important;
}
.usage-record-action-button-primary:hover {
box-shadow: 0 16px 34px
color-mix(in srgb, var(--brand-gradient-via) 36%, transparent) !important;
}
.usage-record-action-button-soft {
border: 1px solid rgb(255 255 255 / 0.52) !important;
background: rgb(255 255 255 / 0.5) !important;
color: var(--brand-gradient-to) !important;
box-shadow:
0 10px 24px rgb(15 23 42 / 0.06),
inset 0 1px 0 rgb(255 255 255 / 0.5) !important;
backdrop-filter: blur(14px) saturate(1.2);
}
.usage-record-action-button-soft:hover {
border-color: color-mix(
in srgb,
var(--brand-gradient-via) 45%,
white
) !important;
background: color-mix(
in srgb,
var(--brand-gradient-via) 10%,
white
) !important;
}
.dark .usage-record-action-button-soft {
border-color: rgb(255 255 255 / 0.1) !important;
background: rgb(255 255 255 / 0.06) !important;
color: color-mix(in srgb, var(--brand-gradient-from) 82%, white) !important;
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06) !important;
}
.dark .usage-record-action-button-soft:hover {
border-color: color-mix(
in srgb,
var(--brand-gradient-from) 36%,
transparent
) !important;
background: rgb(255 255 255 / 0.09) !important;
}