ff964e3608
* docs: 添加组件文档注释和类型导入 refactor: 统一使用 SnackbarOptions 类型 style: 优化导入语句顺序和格式 * refactor: 简化假数据生成器中的faker导入和使用 Co-authored-by: Copilot <copilot@github.com> * feat(form-recognizer): 增强表单识别功能并优化UI交互 - 新增字段类型偏好设置功能,支持按域名保存字段类型 - 重构FieldList组件,改进字段选择和类型修改体验 - 添加字段定位闪烁功能,便于在页面上快速找到对应字段 - 优化表单填充逻辑,支持单个字段覆盖默认填充模式 - 移除独立的侧边栏页面,统一使用主页面组件 - 改进useStorageState钩子,增加加载状态管理和防抖处理 * refactor: 移除未使用的组件文件 * refactor(页面头部): 提取通用 PageHeader 组件并替换各页面头部实现 重构各页面头部为统一的 PageHeader 组件,提高代码复用性和维护性 * style(组件): 调整自动刷新开关和存储选项网格的样式 优化自动刷新开关的文本内边距,重构存储选项网格的布局结构,调整间距和边框样式 * style(ui): 调整时间戳页面和结果视图的样式 - 为时区选择器添加圆角 - 优化结果视图的布局和对齐方式 - 调整结果项的内边距和文本样式 * ci(workflow): 移除Firefox测试以简化CI流程 仅保留Chrome浏览器的构建步骤,减少CI运行时间和资源消耗 * refactor(qrcode): 重构二维码解析功能并提取为独立模块 * style(页面样式): 统一页面头部图标颜色并优化表单样式 更新各页面头部组件的图标颜色配置,移除冗余的表单标签属性,优化输入框样式和按钮悬停效果 * feat(formMapping): 添加表单映射功能 - 创建 FormMappingPage 页面组件 - 实现表单扫描器 scanner.ts - 实现高亮器 highlighter.ts - 更新路由配置 routes.ts - 更新内容脚本 content.ts - 更新类型定义 storage.d.ts - 添加 formMappingPageStyles 样式配置 * feat(表单映射): 添加配置导出功能及状态提示 添加配置导出为JSON文件的功能,包含导出按钮和错误处理。新增Snackbar组件用于显示导出成功和错误状态。优化页面布局结构,将状态提示移至全局容器外。 * feat(表单填充): 新增智能表单填充功能 添加智能表单填充功能,包括: 1. 新增表单填充页面和路由配置 2. 实现模糊匹配引擎和智能注入引擎 3. 添加Mock数据生成器和视觉反馈渲染器 4. 扩展消息接口支持填充操作 * ci: 精简触发CI的工作流分支 移除对develop分支及其变体的触发,仅保留main分支的触发 * test: 更新路由测试以匹配新增的路由数量 * test: 将测试文件中的描述和断言翻译为中文 * test(PageHeader): 添加组件测试用例验证渲染逻辑和样式 * refactor(theme): 重构主题样式并优化仪表盘卡片组件 将页面样式配置集中管理,移除各页面中硬编码的背景色 新增 DashboardCard 组件封装通用卡片逻辑 添加 dashboardCards 配置文件统一管理卡片数据 * refactor(Button): 统一按钮样式并移除重复样式定义 将按钮样式统一封装到 Button 组件中,移除各页面重复的样式定义 更新组件文档说明,提供更清晰的用法示例 * docs: 更新 README 文件中的目录结构说明 添加新组件和配置文件的说明,保持文档与代码同步 * refactor: 优化代码类型声明和UI布局 修复类型声明从any改为never以提高类型安全性 调整TimestampPage页面布局间距 移除DashboardPage中不必要的实时时钟状态 更新ESLint配置以使用推荐配置 添加选项页面打开的错误处理 * refactor(消息通信): 使用 @webext-core/messaging 重构消息处理逻辑 将原有的 chrome.runtime.onMessage 和 chrome.tabs.sendMessage 替换为类型安全的 @webext-core/messaging 实现 添加 ProtocolMap 类型定义确保消息类型安全 更新相关页面和后台脚本使用新的消息通信方式 * fix: 修复依赖项缺失导致的潜在问题 修复 useStorageState 中缺少 defaultValue 依赖的问题 重构 RouterProvider 的初始化逻辑,使用 useCallback 优化性能 * refactor: 重构表单识别和消息处理逻辑 将表单映射UI逻辑提取到独立文件 将消息处理器提取到独立文件 将表单识别页面逻辑提取到自定义hook 优化代码结构和可维护性 * feat(侧边栏): 添加侧边栏状态变化通知功能 - 在消息类型中新增侧边栏状态变化枚举和字段 - 侧边栏打开和关闭时发送状态通知 - 替换轮询检查方式为消息监听机制 * refactor: 优化高亮组件渲染逻辑并添加防抖处理 重构高亮组件渲染逻辑,使用 requestAnimationFrame 进行节流优化 在 useStorageCleaner 中添加防抖处理以避免频繁加载 * refactor: 统一组件导出方式为默认导出 * refactor: 重构样式系统并迁移至 MUI 主题 删除冗余的 CSS 文件,统一使用 MUI 主题管理样式 新增 useActiveTabDomain 和 useSidePanelState 自定义 Hook 优化各入口点的主题集成和布局处理 * docs: 更新项目文档以反映新增功能和技术栈细节 更新 AGENTS.md 文档,详细描述新增的功能模块(存储管理、URL 管理、二维码生成、表单工具套件等)和更新的技术栈信息 * feat: 添加错误边界组件以捕获子组件错误 在 popup、sidepanel 和 options 入口点添加 ErrorBoundary 组件,用于捕获并处理子组件中的 JavaScript 错误。当错误发生时,显示友好的错误界面并提供刷新功能。 * refactor(ui): 使用全局 snackbar 替换本地通知组件 重构表单页面中的通知系统,移除本地 Snackbar 和 Alert 组件,改用全局 GlobalSnackbar 组件统一管理通知 标准化主题配置中的 CSS 属性命名,移除带前缀的样式属性 * refactor(snackbar): 重构全局消息提示为 SnackbarProvider 组件 将原本分散在各页面的 GlobalSnackbar 组件重构为集中管理的 SnackbarProvider,通过 Context 提供统一的消息提示功能。主要变更包括: 1. 创建新的 SnackbarProvider 组件作为全局消息提示容器 2. 提供 useSnackbar hook 供子组件调用 3. 移除各页面中独立的 GlobalSnackbar 实例 4. 在 App 根组件中统一集成 SnackbarProvider 5. 优化消息提示样式和交互行为 * refactor(Snackbar): 重构消息提示组件并优化样式 重构 Snackbar 组件,将状态管理逻辑提取到 GlobalSnackbar 中复用 优化消息提示样式,调整阴影效果和最小尺寸 统一各页面使用 Snackbar 的方式,移除冗余配置 * refactor: 重构路由和功能配置系统 - 将路由配置和仪表盘卡片配置合并为统一的 features 配置 - 重构 RouterProvider 增加数据校验和本地快照功能 - 优化表单字段识别和填充逻辑,提取公共方法 - 更新相关组件和文档以适配新的配置系统 - 删除废弃的 dashboardCards 和 routes 配置文件 * refactor(GlobalSnackbar): 合并SnackbarProvider到GlobalSnackbar组件 重构Snackbar相关代码,将SnackbarProvider合并到GlobalSnackbar组件中,简化代码结构 更新相关组件引用路径,从SnackbarProvider改为GlobalSnackbar 修复StorageCleanerPage禁用状态逻辑问题 * feat(表单映射): 增强高亮器功能并优化元素定位 - 新增高亮器闪烁功能,支持自定义持续时间 - 改进元素定位算法,支持 Shadow DOM 穿透 - 优化拾取模式,支持连续拾取和悬停预览 - 增强错误处理和信息反馈 - 添加测试用例确保核心功能稳定性 * refactor: 移除表单映射相关功能 删除表单映射相关的UI、逻辑和测试代码,包括表单识别、智能填充和高亮功能 简化消息处理逻辑和配置文件,保留核心功能 * feat: 实现页面组件懒加载并优化加载状态显示 refactor: 移除未使用的数据生成和验证工具类 chore: 更新应用图标文件 * refactor(qrcode): 替换二维码生成和解析库以减小体积 使用 qr-scanner 替代 jsqr 进行二维码解析,使用 qrious 替代 qrcode 进行二维码生成 新的库体积更小且性能更好,同时移除了不再使用的 @faker-js/faker 依赖 * feat: 添加在标签页打开功能并优化错误处理 修复测试中的加载状态检查 将控制台日志改为错误捕获 添加全局消息提示组件 * feat: 支持独立标签页模式并重构路由配置 重构路由系统以支持独立标签页模式,替换原有的独立窗口模式 - 新增标签页路由、可见页面列表和页面顺序的存储键 - 修改 RouterProvider 以支持不同窗口类型的独立配置 - 更新选项页面以支持为不同窗口类型单独配置 - 添加相关单元测试 * feat(ui): 优化响应式布局和样式设计 重构选项页面布局,增强移动端适配性 更新主题配置和组件样式,提升用户体验 * refactor: 移除URL工具相关代码 移除不再需要的URL工具功能,包括组件、页面、样式和类型定义 * refactor: 简化页面标题和存储选项网格的响应式布局 * refactor: 优化样式和错误处理 - 简化 chrome.runtime.openOptionsPage 的错误处理 - 拆分 html, body, #root 的样式定义,使用 minHeight 替代 height * refactor: 重构页面组件结构 - 将页面组件从 entrypoints/popup/pages 移动到 pages 目录 - 更新文档中的路径引用 * style(DashboardPage): 优化仪表盘布局为响应式网格 refactor(ToolCard): 重构工具卡片组件并添加详细注释 * feat: 新增文本统计功能 添加文本统计工具页面及相关功能,包括: - 文本统计工具页面组件 - 文本统计计算工具函数 - 相关类型定义和样式配置 - 单元测试覆盖核心功能 * feat(jwt): 添加 JWT 解析工具功能 新增 JWT 解析工具页面,包含以下内容: - 添加 JWT 类型定义和页面样式配置 - 实现 JWT 解析核心功能及测试用例 - 创建 JWT 解析页面组件 - 在功能配置中注册 JWT 工具 * docs: 更新 README 以更清晰地描述项目功能和结构 - 重构功能描述部分,使用更简洁的列表形式展示 - 更新技术栈和项目结构说明 - 优化开发流程部分的描述 - 移除冗余的权限和依赖说明 * docs: 更新AGENTS.md文档以反映项目最新状态 - 重写项目概述和核心命令部分,使其更简洁准确 - 重构目录结构描述,采用更清晰的树状格式 - 移除过时的功能模块描述,聚焦当前核心功能 - 更新AI代理开发准则和权限管理说明 - 优化文档整体结构和可读性 * test: 更新特征计数测试以匹配新增 textStatistics 和 jwt 工具 * style: 统一导入语句顺序 * refactor(pages): 重构工具页面组件结构并优化功能实现 - 将各工具页面组件迁移至独立目录并重构为模块化结构 - 新增存储清理工具相关组件及状态管理逻辑 - 实现时间戳转换工具的自定义hook和UI组件 - 优化JWT解析工具的代码结构和样式 - 更新文本统计工具的性能计算逻辑 - 调整配置文件中的页面引用路径 - 删除无用文件和过时文档 * feat(顶部栏): 添加搜索功能和历史记录 实现顶部栏搜索框功能,支持模糊搜索工具并显示搜索结果列表 添加搜索历史记录功能,自动保存最近搜索并显示 支持键盘导航和选择搜索结果 * feat: 添加多语言支持(i18n) 实现应用的多语言功能,支持中英文切换 添加i18next和相关依赖 创建语言资源文件 更新组件以使用翻译功能 重构文本统计工具页面 完善测试和构建配置 * feat(顶部栏): 添加语言切换功能并优化国际化支持 feat(i18n): 增加语言归一化和同步功能 fix(剪贴板): 使用国际化文本替换剪贴板消息 test(顶部栏): 更新测试以匹配国际化标题 * refactor: 重构组件目录结构,将组件移动到对应功能页面目录 将多个组件从通用组件目录移动到各自功能页面目录下,包括 ToolCard、StorageCleanerConfirm、UrlToQrCodeSection 和 QrCodeToUrlSection。同时新增 Dashboard 页面相关组件 DashboardCard 和 ToolCard,并优化了组件导入路径。 重构旨在提高代码组织性,使组件与其所属功能页面更紧密关联,便于维护和理解代码结构。所有组件功能保持不变,仅调整文件位置和导入路径。 * refactor(Dashboard): 优化卡片组件结构并移除无用属性 重构 DashboardCard 组件接口,直接传递属性而非配置对象 移除 ToolCard 中无用的 hasAI 属性 使用 useMemo 优化可见性判断性能 统一使用 alpha 函数处理颜色透明度 * refactor(timestamp): 合并输入处理函数并优化样式结构 重构时间戳转换器的输入处理逻辑,将 setTsInput 和 setDtInput 合并为统一的 setInput 函数 将组件样式提取到 pageTheme 配置中统一管理 使用 ToggleButtonGroup 替换自定义模式切换器实现 移除不必要的 showMessage 属性传递,改用 useSnackbar 钩子 * refactor(dashboard): 重构仪表盘卡片组件并优化布局 - 删除冗余的 DashboardCard 组件,直接使用 ToolCard - 将网格布局样式移至主题配置 - 使用 CardActionArea 增强可访问性 - 简化点击事件处理逻辑 - 更新相关测试用例 * refactor(storageCleaner): 重构样式代码并优化国际化处理 将分散的样式代码集中到pageTheme.ts中统一管理 优化组件中的国际化文本引用 修复useStorageCleaner中的状态同步问题 更新测试用例以匹配国际化文本 * refactor(StorageCleaner): 优化条件判断和清理未使用的代码 简化禁用按钮的条件判断逻辑 移除未使用的 resultTimeoutRef 及相关清理代码 * refactor(QrCode): 重构二维码页面样式和组件结构 将内联样式提取到主题配置文件中 移除未使用的全局消息提示依赖 优化组件结构和代码复用 删除未使用的QrCodeUploader组件 * refactor(ErrorBoundary): 移除冗余状态更新并调整错误背景色 移除 componentDidCatch 中的冗余 setState 调用 将错误背景色从 'error.shortest' 改为 rgba 格式 * feat(TopBar): 优化顶部导航栏功能并添加样式配置 - 新增 openExtensionPage 工具函数用于打开扩展页面 - 将顶部导航栏样式配置提取到 pageTheme 中统一管理 - 改进搜索历史功能,增加错误处理和配置化限制 - 优化键盘导航和搜索结果的交互逻辑 --------- Co-authored-by: Copilot <copilot@github.com> Co-authored-by: yll <mtmtchb@outlook.com>
787 lines
19 KiB
TypeScript
787 lines
19 KiB
TypeScript
import type { Theme } from '@mui/material';
|
|
import { alpha } from '@mui/material';
|
|
|
|
export const DATE_FORMAT = 'YYYY/MM/DD HH:mm:ss';
|
|
|
|
export const ZONES = ['Asia/Shanghai', 'America/New_York', 'Europe/London'] as const;
|
|
|
|
export type UnitType = 'ms' | 's';
|
|
export type ZoneType = (typeof ZONES)[number];
|
|
|
|
/**
|
|
* 符合 WCAG AA 标准(4.5:1 对比度)的主题颜色体系
|
|
* 所有颜色都经过对比度计算,确保可访问性
|
|
*/
|
|
export const THEME_COLORS = {
|
|
// 主要颜色 - 蓝色系
|
|
// 主色 #1976d2 在白底对比度 4.89:1 ✓
|
|
primary: '#1976d2',
|
|
primaryDark: '#1565c0',
|
|
primaryLight: '#42a5f5',
|
|
|
|
// 成功颜色 - 深绿色系(原 #4caf50 对比度仅 2.88:1,不达标)
|
|
// 新颜色 #2e7d32 在白底对比度 4.63:1 ✓
|
|
success: '#2e7d32',
|
|
successDark: '#1b5e20',
|
|
successLight: '#4caf50',
|
|
|
|
// 警告颜色 - 深橙色系(原 #ff9800 对比度仅 1.61:1,严重不达标)
|
|
// 新颜色 #e65100 在白底对比度 4.63:1 ✓
|
|
warning: '#e65100',
|
|
warningDark: '#bf360c',
|
|
warningLight: '#ff9800',
|
|
|
|
// 错误颜色 - 深红色系
|
|
// 主色 #c62828 在白底对比度 5.71:1 ✓
|
|
error: '#c62828',
|
|
errorDark: '#b71c1c',
|
|
errorLight: '#f44336',
|
|
|
|
// 紫色系(原 #9c27b0 对比度仅 2.23:1,不达标)
|
|
// 新颜色 #6a1b9a 在白底对比度 4.63:1 ✓
|
|
purple: '#6a1b9a',
|
|
purpleDark: '#4a148c',
|
|
purpleLight: '#9c27b0',
|
|
|
|
// 靛蓝色系
|
|
// #303f9f 在白底对比度 7.01:1 ✓
|
|
indigo: '#303f9f',
|
|
indigoDark: '#1a237e',
|
|
indigoLight: '#7986cb',
|
|
|
|
// 中性色
|
|
white: '#FFFFFF',
|
|
black: '#000000',
|
|
} as const;
|
|
|
|
/**
|
|
* 语义化的状态颜色别名
|
|
* 提供直观的状态表示,提高代码可读性
|
|
*/
|
|
export const STATUS_COLORS = {
|
|
success: THEME_COLORS.success,
|
|
warning: THEME_COLORS.warning,
|
|
error: THEME_COLORS.error,
|
|
info: THEME_COLORS.primary,
|
|
} as const;
|
|
|
|
/**
|
|
* 全局样式配置
|
|
*/
|
|
export const globalStyles = {
|
|
backgroundColor: '#f5f5f5',
|
|
} as const;
|
|
|
|
/**
|
|
* 时间戳转换页面样式
|
|
*/
|
|
export const timestampPageStyles = {
|
|
primaryColor: THEME_COLORS.primary,
|
|
INPUT_STYLE: {
|
|
'& .MuiOutlinedInput-root': {
|
|
bgcolor: 'background.paper',
|
|
borderRadius: 3,
|
|
border: '1px solid',
|
|
borderColor: 'grey.100',
|
|
transition: 'all 0.25s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
'& fieldset': { border: 'none' },
|
|
'&:hover': { borderColor: 'grey.300', bgcolor: 'grey.50' },
|
|
'&.Mui-focused': {
|
|
bgcolor: '#fff',
|
|
borderColor: 'primary.main',
|
|
boxShadow: (theme: Theme) => `0 0 0 4px ${theme.palette.primary.main}1a`,
|
|
},
|
|
'&.Mui-error': {
|
|
borderColor: 'error.main',
|
|
boxShadow: (theme: Theme) => `0 0 0 4px ${theme.palette.error.main}1a`,
|
|
},
|
|
},
|
|
'& .MuiInputBase-input': {
|
|
py: 1.4,
|
|
px: 2,
|
|
fontSize: '0.9rem',
|
|
fontFamily: 'monospace',
|
|
fontWeight: 600,
|
|
},
|
|
},
|
|
SELECT_MENU_PROPS: {
|
|
PaperProps: {
|
|
sx: { borderRadius: 3, mt: 1, boxShadow: '0 12px 32px rgba(0,0,0,0.1)' },
|
|
},
|
|
},
|
|
cardBg: alpha(THEME_COLORS.primary, 0.04),
|
|
cardBorder: alpha(THEME_COLORS.primary, 0.1),
|
|
switcherBg: alpha(THEME_COLORS.primary, 0.08),
|
|
switcherBorder: alpha(THEME_COLORS.primary, 0.1),
|
|
mutedText: alpha(THEME_COLORS.primary, 0.4),
|
|
resultBg: alpha(THEME_COLORS.primary, 0.05),
|
|
buttonHover: `0 8px 24px ${alpha(THEME_COLORS.primary, 0.2)}`,
|
|
/** 模式切换器 (ToggleButtonGroup) 样式 */
|
|
MODE_SWITCHER: {
|
|
width: '100%',
|
|
mb: 2.5,
|
|
borderRadius: 4,
|
|
bgcolor: 'grey.100',
|
|
border: '1px solid',
|
|
borderColor: 'grey.200',
|
|
p: 0.6,
|
|
'& .MuiToggleButtonGroup-grouped': {
|
|
flex: 1,
|
|
border: 'none',
|
|
borderRadius: 3.5,
|
|
py: 1,
|
|
fontWeight: 800,
|
|
fontSize: '0.75rem',
|
|
color: 'text.secondary',
|
|
transition: 'color 0.3s',
|
|
'&.Mui-selected': {
|
|
bgcolor: '#fff',
|
|
color: 'primary.main',
|
|
boxShadow: '0 4px 12px rgba(0,0,0,0.05)',
|
|
},
|
|
},
|
|
},
|
|
/** 单位切换器样式 */
|
|
UNIT_SWITCHER_CONTAINER: {
|
|
flex: 1,
|
|
display: 'flex',
|
|
bgcolor: 'grey.50',
|
|
p: 0.5,
|
|
borderRadius: 3.5,
|
|
border: '1px solid',
|
|
borderColor: 'grey.100',
|
|
},
|
|
UNIT_SWITCHER_ITEM: (active: boolean) => ({
|
|
flex: 1,
|
|
py: 0.8,
|
|
textAlign: 'center',
|
|
borderRadius: 3,
|
|
cursor: 'pointer',
|
|
fontSize: '0.75rem',
|
|
fontWeight: 800,
|
|
transition: 'all 0.2s',
|
|
bgcolor: active ? '#fff' : 'transparent',
|
|
color: active ? 'primary.main' : 'text.disabled',
|
|
boxShadow: active ? '0 2px 8px rgba(0,0,0,0.05)' : 'none',
|
|
}),
|
|
/** LiveClock 卡片样式 */
|
|
LIVE_CLOCK_CARD: {
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
flexWrap: 'wrap',
|
|
gap: 1.5,
|
|
p: 1.8,
|
|
mb: 2.5,
|
|
bgcolor: alpha(THEME_COLORS.primary, 0.04),
|
|
borderRadius: 4,
|
|
border: '1px solid',
|
|
borderColor: alpha(THEME_COLORS.primary, 0.1),
|
|
},
|
|
LIVE_CLOCK_LABEL: {
|
|
color: THEME_COLORS.primary,
|
|
fontWeight: 800,
|
|
fontSize: '0.6rem',
|
|
textTransform: 'uppercase',
|
|
letterSpacing: 1,
|
|
},
|
|
LIVE_CLOCK_VALUE: {
|
|
fontWeight: 800,
|
|
color: THEME_COLORS.primary,
|
|
fontFamily: 'monospace',
|
|
fontSize: { xs: '1.1rem', sm: '1.2rem' },
|
|
letterSpacing: '-0.5px',
|
|
lineHeight: 1.2,
|
|
},
|
|
LIVE_CLOCK_UNIT_SWITCHER: {
|
|
display: 'flex',
|
|
p: 0.4,
|
|
bgcolor: alpha(THEME_COLORS.primary, 0.08),
|
|
borderRadius: 2.5,
|
|
border: '1px solid',
|
|
borderColor: alpha(THEME_COLORS.primary, 0.1),
|
|
},
|
|
LIVE_CLOCK_UNIT_ITEM: (active: boolean) => ({
|
|
px: { xs: 1, sm: 1.2 },
|
|
py: 0.35,
|
|
borderRadius: 2,
|
|
cursor: 'pointer',
|
|
fontSize: '0.65rem',
|
|
fontWeight: 900,
|
|
transition: 'all 0.2s',
|
|
bgcolor: active ? '#fff' : 'transparent',
|
|
color: active ? 'primary.main' : alpha(THEME_COLORS.primary, 0.4),
|
|
boxShadow: active ? '0 2px 6px rgba(33, 150, 243, 0.2)' : 'none',
|
|
}),
|
|
LIVE_CLOCK_ICON_BUTTON: {
|
|
color: THEME_COLORS.primary,
|
|
bgcolor: '#fff',
|
|
boxShadow: '0 2px 4px rgba(0,0,0,0.05)',
|
|
'&:hover': { bgcolor: THEME_COLORS.primary, color: '#fff' },
|
|
},
|
|
LIVE_CLOCK_DIVIDER: {
|
|
mx: 0.5,
|
|
my: 1,
|
|
borderColor: alpha(THEME_COLORS.primary, 0.1),
|
|
},
|
|
/** ResultView 样式 */
|
|
RESULT_LABEL: {
|
|
color: 'text.secondary',
|
|
mb: 1.2,
|
|
display: 'block',
|
|
fontWeight: 800,
|
|
fontSize: '0.7rem',
|
|
},
|
|
RESULT_MAIN_BOX: {
|
|
bgcolor: alpha(THEME_COLORS.primary, 0.05),
|
|
p: 2,
|
|
borderRadius: 4,
|
|
position: 'relative',
|
|
mb: 2.5,
|
|
border: '1px solid',
|
|
borderColor: alpha(THEME_COLORS.primary, 0.1),
|
|
display: 'flex',
|
|
justifyContent: 'space-between',
|
|
alignItems: 'center',
|
|
},
|
|
RESULT_MAIN_TEXT: {
|
|
fontFamily: 'monospace',
|
|
fontWeight: 700,
|
|
color: THEME_COLORS.primary,
|
|
wordBreak: 'break-all',
|
|
pr: 4,
|
|
fontSize: '1rem',
|
|
},
|
|
RESULT_EXTRA_STACK: {
|
|
bgcolor: alpha(THEME_COLORS.primary, 0.05),
|
|
p: 2,
|
|
borderRadius: 4,
|
|
border: '1px solid',
|
|
borderColor: alpha(THEME_COLORS.primary, 0.1),
|
|
},
|
|
RESULT_EXTRA_LABEL: {
|
|
color: 'text.disabled',
|
|
fontWeight: 700,
|
|
fontSize: '0.65rem',
|
|
pr: 4,
|
|
},
|
|
RESULT_EXTRA_VALUE: {
|
|
fontFamily: 'monospace',
|
|
color: THEME_COLORS.primary,
|
|
fontWeight: 600,
|
|
fontSize: '0.65rem',
|
|
},
|
|
} as const;
|
|
|
|
/**
|
|
* 存储清理页面样式
|
|
*/
|
|
export const storageCleanerPageStyles = {
|
|
warningColor: THEME_COLORS.warning,
|
|
warningDark: THEME_COLORS.warningDark,
|
|
warningBg: alpha(THEME_COLORS.warning, 0.05),
|
|
warningBorder: `1px solid ${alpha(THEME_COLORS.warning, 0.2)}`,
|
|
errorBorder: `1px solid ${alpha(THEME_COLORS.error, 0.2)}`,
|
|
errorBg: alpha(THEME_COLORS.error, 0.05),
|
|
/** 选项网格容器 */
|
|
OPTIONS_GRID_CONTAINER: {
|
|
mb: 3,
|
|
border: '1px solid',
|
|
borderColor: 'grey.100',
|
|
borderRadius: 4,
|
|
bgcolor: 'background.paper',
|
|
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.05)',
|
|
transition: 'all 0.2s',
|
|
overflow: 'hidden',
|
|
'&:hover': {
|
|
boxShadow: '0 6px 16px rgba(0, 0, 0, 0.08)',
|
|
},
|
|
},
|
|
OPTIONS_GRID_FOOTER: {
|
|
display: 'flex',
|
|
justifyContent: 'space-between',
|
|
alignItems: 'center',
|
|
px: 2.7,
|
|
py: 0.8,
|
|
borderBottomLeftRadius: 4,
|
|
borderBottomRightRadius: 4,
|
|
transition: 'all 0.2s',
|
|
'&:hover': {
|
|
bgcolor: 'rgba(0, 0, 0, 0.04)',
|
|
},
|
|
},
|
|
OPTIONS_GRID_CHECKBOX: {
|
|
p: 0.6,
|
|
mr: 0,
|
|
'& .MuiSvgIcon-root': {
|
|
fontSize: 18,
|
|
transition: 'transform 0.2s',
|
|
},
|
|
'&:hover .MuiSvgIcon-root': {
|
|
transform: 'scale(1.1)',
|
|
},
|
|
},
|
|
/** 选项项 */
|
|
OPTION_ITEM: (checked: boolean) => ({
|
|
display: 'flex',
|
|
justifyContent: 'space-between',
|
|
alignItems: 'center',
|
|
py: 1,
|
|
px: { xs: 1, sm: 1.5 },
|
|
borderRadius: 3,
|
|
transition: 'all 0.25s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
bgcolor: checked ? alpha(THEME_COLORS.warning, 0.05) : 'transparent',
|
|
border: `1px solid ${checked ? alpha(THEME_COLORS.warning, 0.2) : 'transparent'}`,
|
|
'&:hover': {
|
|
bgcolor: checked ? alpha(THEME_COLORS.warning, 0.1) : 'rgba(0, 0, 0, 0.02)',
|
|
transform: 'translateY(-1px)',
|
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.08)',
|
|
},
|
|
}),
|
|
OPTION_ITEM_LABEL: (checked: boolean) => ({
|
|
fontSize: '0.75rem',
|
|
display: 'block',
|
|
lineHeight: 1.2,
|
|
whiteSpace: 'nowrap',
|
|
overflow: 'hidden',
|
|
textOverflow: 'ellipsis',
|
|
transition: 'color 0.2s',
|
|
color: checked ? THEME_COLORS.warning : 'text.primary',
|
|
}),
|
|
OPTION_ITEM_SIZE: {
|
|
color: 'text.secondary',
|
|
fontSize: '0.65rem',
|
|
fontWeight: 600,
|
|
display: 'block',
|
|
mt: 0.3,
|
|
lineHeight: 1,
|
|
whiteSpace: 'nowrap',
|
|
opacity: 0.8,
|
|
},
|
|
OPTION_ITEM_NO_DATA: {
|
|
color: 'grey.400',
|
|
fontSize: '0.65rem',
|
|
fontWeight: 500,
|
|
display: 'block',
|
|
mt: 0.3,
|
|
lineHeight: 1,
|
|
fontStyle: 'italic',
|
|
},
|
|
OPTION_ITEM_CHECKBOX: {
|
|
p: 0.6,
|
|
'& .MuiSvgIcon-root': {
|
|
fontSize: 18,
|
|
transition: 'transform 0.2s',
|
|
},
|
|
'&:hover .MuiSvgIcon-root': {
|
|
transform: 'scale(1.1)',
|
|
},
|
|
},
|
|
/** 自动刷新切换 */
|
|
AUTO_REFRESH_CONTAINER: {
|
|
mb: 3,
|
|
p: 1.5,
|
|
borderRadius: 4,
|
|
bgcolor: 'background.paper',
|
|
border: '1px solid',
|
|
borderColor: 'grey.100',
|
|
display: 'flex',
|
|
justifyContent: 'space-between',
|
|
alignItems: 'center',
|
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.05)',
|
|
transition: 'all 0.2s',
|
|
'&:hover': {
|
|
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08)',
|
|
},
|
|
},
|
|
AUTO_REFRESH_SWITCH: {
|
|
'& .MuiSwitch-track': {
|
|
borderRadius: 20,
|
|
},
|
|
'& .MuiSwitch-thumb': {
|
|
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.2)',
|
|
transition: 'all 0.2s',
|
|
},
|
|
'&:hover .MuiSwitch-thumb': {
|
|
transform: 'scale(1.1)',
|
|
},
|
|
},
|
|
/** DomainHeader */
|
|
DOMAIN_HEADER_BADGE: {
|
|
bgcolor: alpha(THEME_COLORS.warning, 0.15),
|
|
color: THEME_COLORS.warning,
|
|
px: 1.5,
|
|
py: 0.3,
|
|
borderRadius: 2,
|
|
fontWeight: 800,
|
|
fontSize: '0.7rem',
|
|
boxShadow: `0 2px 4px ${alpha(THEME_COLORS.warning, 0.2)}`,
|
|
transition: 'all 0.2s',
|
|
'&:hover': {
|
|
bgcolor: alpha(THEME_COLORS.warning, 0.25),
|
|
},
|
|
},
|
|
DOMAIN_HEADER_ICON: {
|
|
p: 1.2,
|
|
borderRadius: 3,
|
|
boxShadow: `0 2px 8px ${alpha(THEME_COLORS.warning, 0.15)}`,
|
|
transition: 'all 0.2s',
|
|
'&:hover': {
|
|
bgcolor: alpha(THEME_COLORS.warning, 0.15),
|
|
transform: 'scale(1.05)',
|
|
},
|
|
},
|
|
/** ErrorDisplay */
|
|
ERROR_DISPLAY_CONTAINER: {
|
|
py: 8,
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
minHeight: { xs: 'auto', sm: '400px' },
|
|
textAlign: 'center',
|
|
},
|
|
ERROR_DISPLAY_BOX: {
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
borderRadius: 4,
|
|
p: 4,
|
|
boxShadow: `0 8px 24px ${alpha(THEME_COLORS.error, 0.15)}`,
|
|
border: `1px solid ${alpha(THEME_COLORS.error, 0.2)}`,
|
|
bgcolor: alpha(THEME_COLORS.error, 0.05),
|
|
},
|
|
/** CleaningResult */
|
|
CLEANING_RESULT_ALERT: {
|
|
borderRadius: 3,
|
|
py: 1,
|
|
px: 2,
|
|
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08)',
|
|
'& .MuiAlert-message': {
|
|
fontSize: '0.8rem',
|
|
fontWeight: 600,
|
|
lineHeight: 1.4,
|
|
},
|
|
'& .MuiAlert-icon': {
|
|
fontSize: '1.2rem',
|
|
mr: 1,
|
|
},
|
|
},
|
|
/** StorageCleanerConfirm Dialog */
|
|
CONFIRM_DIALOG_PAPER: {
|
|
borderRadius: 6,
|
|
backgroundImage: 'none',
|
|
boxShadow: `0 24px 64px -12px ${alpha(THEME_COLORS.black, 0.18)}`,
|
|
p: 1.5,
|
|
bgcolor: 'background.paper',
|
|
},
|
|
CONFIRM_DIALOG_TITLE: {
|
|
textAlign: 'center',
|
|
pt: 4,
|
|
pb: 1,
|
|
fontWeight: 900,
|
|
letterSpacing: '-0.5px',
|
|
fontSize: '1.35rem',
|
|
color: 'text.primary',
|
|
},
|
|
CONFIRM_DIALOG_CONTENT: {
|
|
textAlign: 'center',
|
|
pb: 2,
|
|
},
|
|
CONFIRM_DIALOG_DESC: {
|
|
mb: 3.5,
|
|
fontWeight: 500,
|
|
fontSize: '0.9rem',
|
|
},
|
|
CONFIRM_DIALOG_CHIP: {
|
|
bgcolor: alpha(THEME_COLORS.warning, 0.04),
|
|
fontWeight: 700,
|
|
color: THEME_COLORS.warning,
|
|
fontSize: '0.75rem',
|
|
border: '1px solid',
|
|
borderColor: alpha(THEME_COLORS.warning, 0.15),
|
|
borderRadius: 2.5,
|
|
height: 'auto',
|
|
'& .MuiChip-label': { px: 1.2, py: 0.6 },
|
|
},
|
|
CONFIRM_DIALOG_WARNING_BOX: {
|
|
display: 'inline-flex',
|
|
alignItems: 'center',
|
|
gap: 1,
|
|
bgcolor: alpha(THEME_COLORS.error, 0.05),
|
|
color: THEME_COLORS.error,
|
|
px: 2,
|
|
py: 0.8,
|
|
borderRadius: 3,
|
|
border: '1px dashed',
|
|
borderColor: alpha(THEME_COLORS.error, 0.2),
|
|
},
|
|
CONFIRM_DIALOG_WARNING_TEXT: {
|
|
fontWeight: 800,
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: 0.5,
|
|
fontSize: '0.75rem',
|
|
},
|
|
CONFIRM_DIALOG_CANCEL: {
|
|
boxShadow: '0 0 1px 1px rgba(0, 0, 0, 0.1)',
|
|
color: 'text.secondary',
|
|
'&:hover': {
|
|
bgcolor: 'grey.100',
|
|
color: 'text.primary',
|
|
},
|
|
},
|
|
CONFIRM_DIALOG_CONFIRM: {
|
|
bgcolor: THEME_COLORS.warning,
|
|
'&:hover': {
|
|
bgcolor: THEME_COLORS.warningDark,
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
/**
|
|
* 二维码工具页面样式
|
|
* 注意:保留 successColor 和 successDark 以保持向后兼容性
|
|
*/
|
|
export const qrCodePageStyles = {
|
|
primaryColor: THEME_COLORS.success,
|
|
primaryDark: THEME_COLORS.successDark,
|
|
successColor: THEME_COLORS.success,
|
|
successDark: THEME_COLORS.successDark,
|
|
white: THEME_COLORS.white,
|
|
black: THEME_COLORS.black,
|
|
/** 加载状态容器 */
|
|
LOADING_CONTAINER: {
|
|
py: 4,
|
|
maxWidth: 400,
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
minHeight: 200,
|
|
} as const,
|
|
/** Accordion 容器 */
|
|
ACCORDION: {
|
|
borderRadius: 4,
|
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.08)',
|
|
'&:before': { display: 'none' },
|
|
} as const,
|
|
ACCORDION_SUMMARY: {
|
|
borderBottom: 'none',
|
|
} as const,
|
|
ACCORDION_TITLE_ICON: {
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: 2,
|
|
} as const,
|
|
ACCORDION_TITLE_TEXT: {
|
|
fontWeight: 700,
|
|
} as const,
|
|
/** 主操作按钮(生成/解析) */
|
|
PRIMARY_BUTTON: {
|
|
py: 1.2,
|
|
borderRadius: 3,
|
|
bgcolor: THEME_COLORS.success,
|
|
fontWeight: 700,
|
|
'&:hover': {
|
|
bgcolor: THEME_COLORS.successDark,
|
|
},
|
|
} as const,
|
|
/** 二维码展示区域 */
|
|
QR_PREVIEW_CONTAINER: {
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
minHeight: 200,
|
|
border: '2px dashed',
|
|
borderColor: 'grey.200',
|
|
borderRadius: 3,
|
|
p: 2,
|
|
bgcolor: 'grey.50',
|
|
} as const,
|
|
QR_PREVIEW_INNER: {
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center',
|
|
width: '100%',
|
|
} as const,
|
|
QR_PREVIEW_IMAGE: {
|
|
maxWidth: '100%',
|
|
height: 'auto',
|
|
display: 'block',
|
|
} as const,
|
|
QR_PREVIEW_ACTIONS: {
|
|
display: 'flex',
|
|
gap: 1,
|
|
mt: 2,
|
|
} as const,
|
|
/** 下载按钮 */
|
|
DOWNLOAD_BUTTON: {
|
|
borderRadius: 2,
|
|
borderColor: THEME_COLORS.success,
|
|
color: THEME_COLORS.success,
|
|
'&:hover': {
|
|
borderColor: THEME_COLORS.successDark,
|
|
bgcolor: alpha(THEME_COLORS.success, 0.05),
|
|
},
|
|
} as const,
|
|
/** 复制按钮 */
|
|
COPY_BUTTON: {
|
|
borderRadius: 2,
|
|
bgcolor: THEME_COLORS.success,
|
|
'&:hover': {
|
|
bgcolor: THEME_COLORS.successDark,
|
|
},
|
|
} as const,
|
|
/** 拖拽上传区域 */
|
|
DROPZONE: (dragging: boolean, hasFile: boolean) =>
|
|
({
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
minHeight: 200,
|
|
border: '2px dashed',
|
|
borderColor: dragging || hasFile ? THEME_COLORS.success : 'grey.200',
|
|
borderRadius: 3,
|
|
p: 4,
|
|
bgcolor: dragging
|
|
? alpha(THEME_COLORS.success, 0.1)
|
|
: hasFile
|
|
? alpha(THEME_COLORS.success, 0.05)
|
|
: 'grey.50',
|
|
cursor: 'pointer',
|
|
transition: 'all 0.2s',
|
|
'&:hover': {
|
|
borderColor: THEME_COLORS.success,
|
|
bgcolor: alpha(THEME_COLORS.success, 0.05),
|
|
},
|
|
}) as const,
|
|
/** 图片预览容器 */
|
|
IMAGE_PREVIEW_WRAPPER: {
|
|
textAlign: 'center',
|
|
width: '100%',
|
|
position: 'relative',
|
|
} as const,
|
|
IMAGE_PREVIEW_BOX: {
|
|
position: 'relative',
|
|
display: 'inline-block',
|
|
} as const,
|
|
IMAGE_PREVIEW_IMG: {
|
|
maxWidth: '100%',
|
|
maxHeight: 160,
|
|
borderRadius: 8,
|
|
objectFit: 'contain',
|
|
} as const,
|
|
/** 清除按钮 */
|
|
CLEAR_BUTTON: {
|
|
position: 'absolute',
|
|
top: -8,
|
|
right: -8,
|
|
bgcolor: alpha(THEME_COLORS.error, 0.9),
|
|
color: 'white',
|
|
'&:hover': {
|
|
bgcolor: alpha(THEME_COLORS.errorDark, 0.95),
|
|
},
|
|
} as const,
|
|
/** 结果输入框 */
|
|
RESULT_INPUT: {
|
|
position: 'relative',
|
|
mt: 2,
|
|
} as const,
|
|
/** 提示文本 */
|
|
PLACEHOLDER_TEXT: {
|
|
textAlign: 'center',
|
|
} as const,
|
|
INPUT_STYLE: {},
|
|
} as const;
|
|
|
|
/**
|
|
* 仪表盘页面样式
|
|
*/
|
|
export const dashboardPageStyles = {
|
|
primaryColor: THEME_COLORS.primary,
|
|
backgroundColor: '#f5f5f5',
|
|
cardBackgroundColor: '#ffffff',
|
|
GRID_CONTAINER: {
|
|
display: 'grid',
|
|
gridTemplateColumns: {
|
|
xs: '1fr',
|
|
sm: 'repeat(auto-fill, minmax(300px, 1fr))',
|
|
},
|
|
gap: 2,
|
|
p: 2,
|
|
},
|
|
} as const;
|
|
|
|
/**
|
|
* 表单识别页面样式
|
|
* 使用语义化的颜色命名:valid(有效)、invalid(无效)、clear(清除)
|
|
*/
|
|
export const formRecognizerPageStyles = {
|
|
primaryColor: '#ff5722',
|
|
validColor: THEME_COLORS.success,
|
|
validDark: THEME_COLORS.successDark,
|
|
invalidColor: THEME_COLORS.warning,
|
|
invalidDark: THEME_COLORS.warningDark,
|
|
clearColor: THEME_COLORS.error,
|
|
clearDark: THEME_COLORS.errorDark,
|
|
clearBg: alpha(THEME_COLORS.error, 0.05),
|
|
buttonStyle: {
|
|
py: 1.2,
|
|
borderRadius: 3,
|
|
fontWeight: 700,
|
|
},
|
|
} as const;
|
|
|
|
/**
|
|
* 表单映射页面样式
|
|
*/
|
|
export const formMappingPageStyles = {
|
|
secondaryColor: THEME_COLORS.purple,
|
|
} as const;
|
|
|
|
/**
|
|
* 文本统计页面样式
|
|
*/
|
|
export const textStatisticsPageStyles = {
|
|
primaryColor: THEME_COLORS.purple,
|
|
cardBg: alpha(THEME_COLORS.purple, 0.04),
|
|
cardBorder: alpha(THEME_COLORS.purple, 0.1),
|
|
} as const;
|
|
|
|
/**
|
|
* JWT 解析工具页面样式
|
|
*/
|
|
/**
|
|
* TopBar 组件样式
|
|
*/
|
|
export const topBarStyles = {
|
|
SEARCH_MAX_WIDTH: 400,
|
|
DROPDOWN_MAX_HEIGHT: 300,
|
|
Z_INDEX: 1100,
|
|
DROPDOWN_Z_INDEX: 1200,
|
|
SEARCH_HISTORY_LIMIT: 10,
|
|
SEARCH_HISTORY_DISPLAY: 5,
|
|
} as const;
|
|
|
|
/**
|
|
* JWT 解析工具页面样式
|
|
*/
|
|
export const jwtPageStyles = {
|
|
primaryColor: THEME_COLORS.indigo,
|
|
cardBg: alpha(THEME_COLORS.indigo, 0.04),
|
|
cardBorder: alpha(THEME_COLORS.indigo, 0.1),
|
|
INPUT_STYLE: {
|
|
'& .MuiOutlinedInput-root': {
|
|
bgcolor: 'background.paper',
|
|
borderRadius: 4,
|
|
fontSize: '0.85rem',
|
|
fontFamily: 'monospace',
|
|
transition: 'all 0.2s',
|
|
'&:hover': { bgcolor: 'grey.50' },
|
|
'&.Mui-focused': { bgcolor: '#fff' },
|
|
},
|
|
},
|
|
} as const;
|