mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
chore: format
This commit is contained in:
parent
9da3e82c47
commit
d321cd23ef
@ -1,6 +1,6 @@
|
||||
**THIS DIRECTORY IS NOT FOR RUNTIME USE**
|
||||
|
||||
- Using `libsql` as the `sqlite3` driver, and `drizzle` as the ORM and database migration tool
|
||||
- `migrations/sqlite-drizzle` contains auto-generated migration data. Please **DO NOT** modify it.
|
||||
- `migrations/sqlite-drizzle` contains auto-generated migration data. Please **DO NOT** modify it.
|
||||
- If table structure changes, we should run migrations.
|
||||
- To generate migrations, use the command `yarn run migrations:generate`
|
||||
|
||||
@ -1,117 +1,114 @@
|
||||
{
|
||||
"version": "6",
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
},
|
||||
"dialect": "sqlite",
|
||||
"enums": {},
|
||||
"id": "de8009d7-95b9-4f99-99fa-4b8795708f21",
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
},
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"tables": {
|
||||
"app_state": {
|
||||
"name": "app_state",
|
||||
"checkConstraints": {},
|
||||
"columns": {
|
||||
"key": {
|
||||
"name": "key",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"value": {
|
||||
"name": "value",
|
||||
"type": "text",
|
||||
"created_at": {
|
||||
"autoincrement": false,
|
||||
"name": "created_at",
|
||||
"notNull": false,
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"autoincrement": false,
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"preference": {
|
||||
"name": "preference",
|
||||
"columns": {
|
||||
"scope": {
|
||||
"name": "scope",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
"type": "text"
|
||||
},
|
||||
"key": {
|
||||
"autoincrement": false,
|
||||
"name": "key",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"value": {
|
||||
"name": "value",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
"primaryKey": true,
|
||||
"type": "text"
|
||||
},
|
||||
"updated_at": {
|
||||
"autoincrement": false,
|
||||
"name": "updated_at",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
"primaryKey": false,
|
||||
"type": "integer"
|
||||
},
|
||||
"value": {
|
||||
"autoincrement": false,
|
||||
"name": "value",
|
||||
"notNull": true,
|
||||
"primaryKey": false,
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"foreignKeys": {},
|
||||
"indexes": {},
|
||||
"name": "app_state",
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"preference": {
|
||||
"checkConstraints": {},
|
||||
"columns": {
|
||||
"created_at": {
|
||||
"autoincrement": false,
|
||||
"name": "created_at",
|
||||
"notNull": false,
|
||||
"primaryKey": false,
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"autoincrement": false,
|
||||
"name": "key",
|
||||
"notNull": true,
|
||||
"primaryKey": false,
|
||||
"type": "text"
|
||||
},
|
||||
"scope": {
|
||||
"autoincrement": false,
|
||||
"name": "scope",
|
||||
"notNull": true,
|
||||
"primaryKey": false,
|
||||
"type": "text"
|
||||
},
|
||||
"updated_at": {
|
||||
"autoincrement": false,
|
||||
"name": "updated_at",
|
||||
"notNull": false,
|
||||
"primaryKey": false,
|
||||
"type": "integer"
|
||||
},
|
||||
"value": {
|
||||
"autoincrement": false,
|
||||
"name": "value",
|
||||
"notNull": false,
|
||||
"primaryKey": false,
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"foreignKeys": {},
|
||||
"indexes": {
|
||||
"scope_name_idx": {
|
||||
"name": "scope_name_idx",
|
||||
"columns": [
|
||||
"scope",
|
||||
"key"
|
||||
],
|
||||
"isUnique": false
|
||||
"columns": ["scope", "key"],
|
||||
"isUnique": false,
|
||||
"name": "scope_name_idx"
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
"name": "preference",
|
||||
"uniqueConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
"version": "6",
|
||||
"views": {}
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "sqlite",
|
||||
"entries": [
|
||||
{
|
||||
"breakpoints": true,
|
||||
"idx": 0,
|
||||
"version": "6",
|
||||
"when": 1754745234572,
|
||||
"tag": "0000_solid_lord_hawal",
|
||||
"breakpoints": true
|
||||
"version": "6",
|
||||
"when": 1754745234572
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "7"
|
||||
}
|
||||
|
||||
@ -1,62 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Cherry Studio - Data Refactor Migration</title>
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:;" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Cherry Studio - Data Refactor Migration</title>
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:;" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body id="root" theme-mode="light">
|
||||
<script type="module" src="/src/windows/dataRefactorMigrate/entryPoint.tsx"></script>
|
||||
<style>
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
<body id="root" theme-mode="light">
|
||||
<script type="module" src="/src/windows/dataRefactorMigrate/entryPoint.tsx"></script>
|
||||
<style>
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* Custom button styles */
|
||||
.ant-btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* Custom button styles */
|
||||
.ant-btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
.ant-btn-primary:hover {
|
||||
background-color: var(--color-primary-soft) !important;
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
}
|
||||
|
||||
.ant-btn-primary:hover {
|
||||
background-color: var(--color-primary-soft) !important;
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
}
|
||||
.ant-btn-primary:active,
|
||||
.ant-btn-primary:focus {
|
||||
background-color: var(--color-primary) !important;
|
||||
border-color: var(--color-primary) !important;
|
||||
}
|
||||
|
||||
.ant-btn-primary:active,
|
||||
.ant-btn-primary:focus {
|
||||
background-color: var(--color-primary) !important;
|
||||
border-color: var(--color-primary) !important;
|
||||
}
|
||||
|
||||
/* Non-primary button hover styles */
|
||||
.ant-btn:not(.ant-btn-primary):hover {
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
color: var(--color-primary) !important;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
/* Non-primary button hover styles */
|
||||
.ant-btn:not(.ant-btn-primary):hover {
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
color: var(--color-primary) !important;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,63 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Data Refactor Test Window - PreferenceService Testing</title>
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:;" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Data Refactor Test Window - PreferenceService Testing</title>
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:;" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body id="root" theme-mode="light">
|
||||
<script type="module" src="/src/windows/dataRefactorTest/entryPoint.tsx"></script>
|
||||
<style>
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
<body id="root" theme-mode="light">
|
||||
<script type="module" src="/src/windows/dataRefactorTest/entryPoint.tsx"></script>
|
||||
<style>
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
#root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* Custom button styles */
|
||||
.ant-btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* Custom button styles */
|
||||
.ant-btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
.ant-btn-primary:hover {
|
||||
background-color: var(--color-primary-soft) !important;
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
}
|
||||
|
||||
.ant-btn-primary:hover {
|
||||
background-color: var(--color-primary-soft) !important;
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
}
|
||||
.ant-btn-primary:active,
|
||||
.ant-btn-primary:focus {
|
||||
background-color: var(--color-primary) !important;
|
||||
border-color: var(--color-primary) !important;
|
||||
}
|
||||
|
||||
.ant-btn-primary:active,
|
||||
.ant-btn-primary:focus {
|
||||
background-color: var(--color-primary) !important;
|
||||
border-color: var(--color-primary) !important;
|
||||
}
|
||||
|
||||
/* Non-primary button hover styles */
|
||||
.ant-btn:not(.ant-btn-primary):hover {
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
color: var(--color-primary) !important;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
/* Non-primary button hover styles */
|
||||
.ant-btn:not(.ant-btn-primary):hover {
|
||||
border-color: var(--color-primary-soft) !important;
|
||||
color: var(--color-primary) !important;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
## 🎯 当前实现
|
||||
|
||||
✅ **已完成的功能**:
|
||||
|
||||
- 专用的测试窗口 (DataRefactorTestWindow)
|
||||
- **双窗口启动**:应用启动时会同时打开主窗口和两个测试窗口
|
||||
- **跨窗口同步测试**:两个测试窗口可以相互验证偏好设置的实时同步
|
||||
@ -18,11 +19,13 @@
|
||||
## 测试组件
|
||||
|
||||
### 1. PreferenceService 基础测试
|
||||
|
||||
- 直接测试服务层API:get, set, getCachedValue, isCached, preload, getMultiple
|
||||
- 支持各种数据类型:字符串、数字、布尔值、JSON对象
|
||||
- 实时显示操作结果
|
||||
|
||||
### 2. usePreference Hook 测试
|
||||
### 2. usePreference Hook 测试
|
||||
|
||||
- 测试单个偏好设置的React hooks
|
||||
- 支持的测试键:
|
||||
- `app.theme.mode` - 主题模式
|
||||
@ -35,6 +38,7 @@
|
||||
- **Slider联动控制**:数值类型偏好设置提供交互式滑块,支持实时拖拽调整
|
||||
|
||||
### 3. usePreferences 批量操作测试
|
||||
|
||||
- 测试多个偏好设置的批量管理
|
||||
- 5种预设场景:基础设置、UI设置、用户设置、🎛️数值设置、自定义组合
|
||||
- **🎛️ 数值设置场景**:专门的Slider联动控制区域,包含缩放、字体、选择窗口透明度三个滑块
|
||||
@ -42,6 +46,7 @@
|
||||
- 快速切换操作
|
||||
|
||||
### 4. Hook 高级功能测试
|
||||
|
||||
- 预加载机制测试
|
||||
- 订阅机制验证
|
||||
- 缓存管理测试
|
||||
@ -53,6 +58,7 @@
|
||||
**自动启动**:应用正常启动时会自动创建两个测试窗口,窗口会自动错位显示避免重叠
|
||||
|
||||
**手动启动**:
|
||||
|
||||
```javascript
|
||||
// 在开发者控制台中执行 - 创建单个测试窗口
|
||||
const { dataRefactorMigrateService } = require('./out/main/data/migrate/dataRefactor/DataRefactorMigrateService')
|
||||
@ -71,7 +77,7 @@ dataRefactorMigrateService.closeTestWindows()
|
||||
```
|
||||
src/renderer/src/windows/dataRefactorTest/
|
||||
├── entryPoint.tsx # 窗口入口
|
||||
├── TestApp.tsx # 主应用组件
|
||||
├── TestApp.tsx # 主应用组件
|
||||
└── components/
|
||||
├── PreferenceServiceTests.tsx # 服务层测试
|
||||
├── PreferenceBasicTests.tsx # 基础Hook测试
|
||||
@ -82,12 +88,14 @@ src/renderer/src/windows/dataRefactorTest/
|
||||
## 跨窗口同步测试
|
||||
|
||||
🔄 **测试场景**:
|
||||
|
||||
1. **实时同步验证**:在窗口#1中修改某个偏好设置,立即观察窗口#2是否同步更新
|
||||
2. **并发修改测试**:在两个窗口中快速连续修改同一设置,验证数据一致性
|
||||
3. **批量操作同步**:在一个窗口中批量更新多个设置,观察另一个窗口的同步表现
|
||||
4. **Hook实例同步**:验证多个usePreference hook实例是否正确同步
|
||||
|
||||
📋 **测试步骤**:
|
||||
|
||||
1. 同时打开两个测试窗口(自动启动)
|
||||
2. 选择相同的偏好设置键进行测试
|
||||
3. 在窗口#1中修改值,观察窗口#2的反应
|
||||
@ -125,4 +133,4 @@ src/renderer/src/windows/dataRefactorTest/
|
||||
- **实时主题**: 使用 useSyncExternalStore 实现主题、缩放等设置的实时UI响应
|
||||
- **跨窗口识别**: 多源窗口编号支持,确保每个窗口都有唯一标识
|
||||
- **UI框架**: Ant Design + styled-components + React 18
|
||||
- **类型安全**: 完整的 TypeScript 类型检查和偏好设置键约束
|
||||
- **类型安全**: 完整的 TypeScript 类型检查和偏好设置键约束
|
||||
|
||||
Loading…
Reference in New Issue
Block a user