@talex-touch/utils 1.0.42 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -0
- package/__tests__/cloud-sync-sdk.test.ts +442 -0
- package/__tests__/icons/icons.test.ts +84 -0
- package/__tests__/plugin-sdk-lifecycle.test.ts +130 -0
- package/__tests__/power-sdk.test.ts +143 -0
- package/__tests__/preset-export-types.test.ts +108 -0
- package/__tests__/search/fuzzy-match.test.ts +137 -0
- package/__tests__/transport/port-policy.test.ts +44 -0
- package/__tests__/transport-domain-sdks.test.ts +152 -0
- package/__tests__/types/update.test.ts +67 -0
- package/account/account-sdk.ts +915 -0
- package/account/index.ts +2 -0
- package/account/types.ts +321 -0
- package/analytics/client.ts +136 -0
- package/analytics/index.ts +2 -0
- package/analytics/types.ts +156 -0
- package/animation/auto-resize.ts +322 -0
- package/animation/window-node.ts +26 -19
- package/auth/clerk-types.ts +12 -30
- package/auth/index.ts +0 -2
- package/auth/useAuthState.ts +6 -14
- package/base/index.ts +2 -0
- package/base/log-level.ts +105 -0
- package/channel/index.ts +170 -69
- package/cloud-sync/cloud-sync-sdk.ts +450 -0
- package/cloud-sync/index.ts +1 -0
- package/common/file-scan-utils.ts +17 -9
- package/common/index.ts +4 -0
- package/common/logger/index.ts +46 -0
- package/common/logger/logger-manager.ts +303 -0
- package/common/logger/module-logger.ts +270 -0
- package/common/logger/transport-logger.ts +234 -0
- package/common/logger/types.ts +93 -0
- package/common/search/gather.ts +48 -6
- package/common/search/index.ts +8 -0
- package/common/storage/constants.ts +13 -0
- package/common/storage/entity/app-settings.ts +245 -0
- package/common/storage/entity/index.ts +3 -0
- package/common/storage/entity/layout-atom-types.ts +147 -0
- package/common/storage/entity/openers.ts +1 -0
- package/common/storage/entity/preset-cloud-api.ts +132 -0
- package/common/storage/entity/preset-export-types.ts +256 -0
- package/common/storage/entity/shortcut-settings.ts +1 -0
- package/common/storage/shortcut-storage.ts +11 -0
- package/common/utils/clone-diagnostics.ts +105 -0
- package/common/utils/file.ts +16 -8
- package/common/utils/index.ts +6 -2
- package/common/utils/payload-preview.ts +173 -0
- package/common/utils/polling.ts +167 -13
- package/common/utils/safe-path.ts +103 -0
- package/common/utils/safe-shell.ts +115 -0
- package/common/utils/task-queue.ts +4 -1
- package/core-box/builder/tuff-builder.ts +0 -1
- package/core-box/index.ts +1 -1
- package/core-box/recommendation.ts +38 -1
- package/core-box/tuff/tuff-dsl.ts +32 -0
- package/electron/download-manager.ts +10 -7
- package/electron/env-tool.ts +42 -40
- package/electron/index.ts +0 -1
- package/env/index.ts +156 -0
- package/eslint.config.js +55 -0
- package/i18n/index.ts +62 -0
- package/i18n/locales/en.json +226 -0
- package/i18n/locales/zh.json +226 -0
- package/i18n/message-keys.ts +236 -0
- package/i18n/resolver.ts +181 -0
- package/icons/index.ts +257 -0
- package/icons/svg.ts +69 -0
- package/index.ts +9 -1
- package/intelligence/client.ts +72 -42
- package/market/constants.ts +9 -5
- package/market/index.ts +1 -1
- package/market/types.ts +19 -4
- package/package.json +15 -5
- package/permission/index.ts +143 -46
- package/permission/legacy.ts +26 -0
- package/permission/registry.ts +304 -0
- package/permission/types.ts +164 -0
- package/plugin/channel.ts +68 -39
- package/plugin/index.ts +80 -7
- package/plugin/install.ts +3 -0
- package/plugin/log/types.ts +22 -5
- package/plugin/node/logger-manager.ts +11 -3
- package/plugin/node/logger.ts +24 -17
- package/plugin/preload.ts +25 -2
- package/plugin/providers/index.ts +4 -4
- package/plugin/providers/market-client.ts +6 -3
- package/plugin/providers/npm-provider.ts +22 -7
- package/plugin/providers/tpex-provider.ts +22 -8
- package/plugin/sdk/box-items.ts +14 -0
- package/plugin/sdk/box-sdk.ts +64 -0
- package/plugin/sdk/channel.ts +119 -4
- package/plugin/sdk/clipboard.ts +26 -12
- package/plugin/sdk/cloud-sync.ts +113 -0
- package/plugin/sdk/common.ts +19 -11
- package/plugin/sdk/core-box.ts +6 -15
- package/plugin/sdk/division-box.ts +160 -65
- package/plugin/sdk/examples/storage-onDidChange-example.js +5 -2
- package/plugin/sdk/feature-sdk.ts +111 -76
- package/plugin/sdk/flow.ts +146 -45
- package/plugin/sdk/hooks/bridge.ts +13 -6
- package/plugin/sdk/hooks/life-cycle.ts +35 -16
- package/plugin/sdk/index.ts +14 -3
- package/plugin/sdk/intelligence.ts +87 -0
- package/plugin/sdk/meta/README.md +179 -0
- package/plugin/sdk/meta-sdk.ts +244 -0
- package/plugin/sdk/notification.ts +9 -0
- package/plugin/sdk/plugin-info.ts +64 -0
- package/plugin/sdk/power.ts +155 -0
- package/plugin/sdk/recommend.ts +21 -0
- package/plugin/sdk/service/index.ts +12 -8
- package/plugin/sdk/sqlite.ts +141 -0
- package/plugin/sdk/storage.ts +2 -6
- package/plugin/sdk/system.ts +2 -9
- package/plugin/sdk/temp-files.ts +41 -0
- package/plugin/sdk/touch-sdk.ts +18 -0
- package/plugin/sdk/types.ts +44 -4
- package/plugin/sdk/window/index.ts +12 -9
- package/plugin/sdk-version.ts +231 -0
- package/preload/renderer.ts +3 -2
- package/renderer/hooks/arg-mapper.ts +16 -2
- package/renderer/hooks/index.ts +13 -0
- package/renderer/hooks/initialize.ts +2 -1
- package/renderer/hooks/use-agent-market-sdk.ts +7 -0
- package/renderer/hooks/use-agent-market.ts +106 -0
- package/renderer/hooks/use-agents-sdk.ts +7 -0
- package/renderer/hooks/use-app-sdk.ts +7 -0
- package/renderer/hooks/use-channel.ts +33 -4
- package/renderer/hooks/use-download-sdk.ts +21 -0
- package/renderer/hooks/use-intelligence-sdk.ts +7 -0
- package/renderer/hooks/use-intelligence-stats.ts +290 -0
- package/renderer/hooks/use-intelligence.ts +55 -214
- package/renderer/hooks/use-market-sdk.ts +16 -0
- package/renderer/hooks/use-notification-sdk.ts +7 -0
- package/renderer/hooks/use-permission-sdk.ts +7 -0
- package/renderer/hooks/use-permission.ts +325 -0
- package/renderer/hooks/use-platform-sdk.ts +7 -0
- package/renderer/hooks/use-plugin-sdk.ts +16 -0
- package/renderer/hooks/use-settings-sdk.ts +7 -0
- package/renderer/hooks/use-update-sdk.ts +21 -0
- package/renderer/index.ts +1 -0
- package/renderer/ref.ts +19 -10
- package/renderer/shared/components/SharedPluginDetailContent.vue +84 -0
- package/renderer/shared/components/SharedPluginDetailHeader.vue +116 -0
- package/renderer/shared/components/SharedPluginDetailMetaList.vue +39 -0
- package/renderer/shared/components/SharedPluginDetailReadme.vue +45 -0
- package/renderer/shared/components/SharedPluginDetailVersions.vue +98 -0
- package/renderer/shared/components/index.ts +5 -0
- package/renderer/shared/components/shims-vue.d.ts +5 -0
- package/renderer/shared/index.ts +2 -0
- package/renderer/shared/plugin-detail.ts +62 -0
- package/renderer/storage/app-settings.ts +3 -1
- package/renderer/storage/base-storage.ts +508 -82
- package/renderer/storage/intelligence-storage.ts +31 -40
- package/renderer/storage/openers.ts +3 -1
- package/renderer/storage/storage-subscription.ts +126 -42
- package/renderer/touch-sdk/env.ts +10 -10
- package/renderer/touch-sdk/index.ts +114 -18
- package/renderer/touch-sdk/terminal.ts +24 -13
- package/search/feature-matcher.ts +279 -0
- package/search/fuzzy-match.ts +64 -34
- package/search/index.ts +10 -0
- package/search/levenshtein-utils.ts +17 -11
- package/transport/errors.ts +310 -0
- package/transport/event/builder.ts +378 -0
- package/transport/event/index.ts +7 -0
- package/transport/event/types.ts +292 -0
- package/transport/events/index.ts +2690 -0
- package/transport/events/meta-overlay.ts +79 -0
- package/transport/events/types/agents.ts +177 -0
- package/transport/events/types/app-index.ts +20 -0
- package/transport/events/types/app.ts +475 -0
- package/transport/events/types/box-item.ts +222 -0
- package/transport/events/types/clipboard.ts +80 -0
- package/transport/events/types/core-box.ts +534 -0
- package/transport/events/types/device-idle.ts +7 -0
- package/transport/events/types/division-box.ts +99 -0
- package/transport/events/types/download.ts +115 -0
- package/transport/events/types/file-index.ts +84 -0
- package/transport/events/types/flow.ts +149 -0
- package/transport/events/types/index.ts +70 -0
- package/transport/events/types/market.ts +39 -0
- package/transport/events/types/meta-overlay.ts +184 -0
- package/transport/events/types/notification.ts +140 -0
- package/transport/events/types/permission.ts +90 -0
- package/transport/events/types/platform.ts +8 -0
- package/transport/events/types/plugin.ts +631 -0
- package/transport/events/types/sentry.ts +20 -0
- package/transport/events/types/storage.ts +208 -0
- package/transport/events/types/transport.ts +60 -0
- package/transport/events/types/tray.ts +16 -0
- package/transport/events/types/update.ts +78 -0
- package/transport/index.ts +141 -0
- package/transport/main.ts +2 -0
- package/transport/prelude.ts +208 -0
- package/transport/sdk/constants.ts +29 -0
- package/transport/sdk/domains/agents-market.ts +47 -0
- package/transport/sdk/domains/agents.ts +62 -0
- package/transport/sdk/domains/app.ts +48 -0
- package/transport/sdk/domains/disposable.ts +35 -0
- package/transport/sdk/domains/download.ts +139 -0
- package/transport/sdk/domains/index.ts +13 -0
- package/transport/sdk/domains/intelligence.ts +616 -0
- package/transport/sdk/domains/market.ts +35 -0
- package/transport/sdk/domains/notification.ts +62 -0
- package/transport/sdk/domains/permission.ts +85 -0
- package/transport/sdk/domains/platform.ts +19 -0
- package/transport/sdk/domains/plugin.ts +144 -0
- package/transport/sdk/domains/settings.ts +102 -0
- package/transport/sdk/domains/update.ts +64 -0
- package/transport/sdk/index.ts +60 -0
- package/transport/sdk/main-transport.ts +710 -0
- package/transport/sdk/main.ts +9 -0
- package/transport/sdk/plugin-transport.ts +654 -0
- package/transport/sdk/port-policy.ts +38 -0
- package/transport/sdk/renderer-transport.ts +1165 -0
- package/transport/types.ts +605 -0
- package/types/agent.ts +399 -0
- package/types/cloud-sync.ts +157 -0
- package/types/division-box.ts +31 -31
- package/types/download.ts +1 -0
- package/types/flow.ts +63 -12
- package/types/icon.ts +2 -1
- package/types/index.ts +5 -0
- package/types/intelligence.ts +166 -173
- package/types/modules/base.ts +2 -0
- package/types/path-browserify.d.ts +5 -0
- package/types/platform.ts +12 -0
- package/types/startup-info.ts +32 -0
- package/types/touch-app-core.ts +8 -8
- package/types/update.ts +94 -1
- package/vitest.config.ts +25 -0
- package/auth/useClerkConfig.ts +0 -40
- package/auth/useClerkProvider.ts +0 -52
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CoreBoxCanvasConfig,
|
|
3
|
+
CoreBoxThemeConfig,
|
|
4
|
+
LayoutAtomConfig,
|
|
5
|
+
LayoutCanvasConfig,
|
|
6
|
+
} from './layout-atom-types'
|
|
7
|
+
|
|
8
|
+
/** Default layout atom for 'simple' preset */
|
|
9
|
+
const defaultLayoutAtomSimple: LayoutAtomConfig = {
|
|
10
|
+
preset: 'simple',
|
|
11
|
+
header: { border: 'solid', opacity: 1, height: 26, blur: false },
|
|
12
|
+
aside: { position: 'left', width: 68, border: 'solid', opacity: 0.5, collapsed: false },
|
|
13
|
+
view: { radius: [0, 0, 0, 0], shadow: 'none', padding: 0, background: 'transparent' },
|
|
14
|
+
nav: { style: 'icon', activeIndicator: 'dot' },
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Default CoreBox theme */
|
|
18
|
+
const defaultCoreBoxTheme: CoreBoxThemeConfig = {
|
|
19
|
+
preset: 'default',
|
|
20
|
+
logo: { position: 'left', size: 24, style: 'default' },
|
|
21
|
+
input: { border: 'bottom', radius: 8, background: 'transparent' },
|
|
22
|
+
results: { itemRadius: 6, itemPadding: 8, divider: false, hoverStyle: 'background' },
|
|
23
|
+
container: { radius: 0, shadow: 'none', border: false },
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const defaultLayoutCanvasConfig: LayoutCanvasConfig = {
|
|
27
|
+
enabled: false,
|
|
28
|
+
preset: 'simple',
|
|
29
|
+
columns: 12,
|
|
30
|
+
rowHeight: 24,
|
|
31
|
+
gap: 8,
|
|
32
|
+
items: [
|
|
33
|
+
{ id: 'header', area: 'header', x: 0, y: 0, w: 12, h: 2, minW: 6, minH: 1 },
|
|
34
|
+
{ id: 'aside', area: 'aside', x: 0, y: 2, w: 2, h: 10, minW: 1, minH: 4 },
|
|
35
|
+
{ id: 'view', area: 'view', x: 2, y: 2, w: 10, h: 10, minW: 4, minH: 4 },
|
|
36
|
+
],
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const defaultCoreBoxCanvasConfig: CoreBoxCanvasConfig = {
|
|
40
|
+
enabled: false,
|
|
41
|
+
preset: 'default',
|
|
42
|
+
columns: 12,
|
|
43
|
+
rowHeight: 24,
|
|
44
|
+
gap: 8,
|
|
45
|
+
items: [
|
|
46
|
+
{ id: 'logo', area: 'logo', x: 0, y: 0, w: 1, h: 1, minW: 1, minH: 1 },
|
|
47
|
+
{ id: 'input', area: 'input', x: 1, y: 0, w: 9, h: 1, minW: 4, minH: 1 },
|
|
48
|
+
{ id: 'actions', area: 'actions', x: 10, y: 0, w: 2, h: 1, minW: 1, minH: 1 },
|
|
49
|
+
{ id: 'tags', area: 'tags', x: 1, y: 1, w: 11, h: 1, minW: 4, minH: 1 },
|
|
50
|
+
{ id: 'results', area: 'results', x: 0, y: 2, w: 10, h: 8, minW: 5, minH: 4 },
|
|
51
|
+
{ id: 'addon', area: 'addon', x: 10, y: 2, w: 2, h: 8, minW: 2, minH: 4 },
|
|
52
|
+
{ id: 'footer', area: 'footer', x: 0, y: 10, w: 10, h: 1, minW: 4, minH: 1 },
|
|
53
|
+
],
|
|
54
|
+
}
|
|
55
|
+
|
|
1
56
|
/**
|
|
2
57
|
* Default configuration object for application settings
|
|
3
58
|
*/
|
|
@@ -9,8 +64,91 @@ const _appSettingOriginData = {
|
|
|
9
64
|
syncLatest: false,
|
|
10
65
|
dataSync: false,
|
|
11
66
|
},
|
|
67
|
+
sync: {
|
|
68
|
+
/**
|
|
69
|
+
* Whether sync is currently enabled.
|
|
70
|
+
* Login flow will auto-enable this unless the user has overridden it.
|
|
71
|
+
*/
|
|
72
|
+
enabled: false,
|
|
73
|
+
/**
|
|
74
|
+
* Whether user manually changed sync preference.
|
|
75
|
+
* Once true, login auto-enable will no longer override this choice.
|
|
76
|
+
*/
|
|
77
|
+
userOverridden: false,
|
|
78
|
+
/**
|
|
79
|
+
* Timestamp when sync was auto-enabled by login flow.
|
|
80
|
+
*/
|
|
81
|
+
autoEnabledAt: '',
|
|
82
|
+
/**
|
|
83
|
+
* Timestamp of latest successful sync-related activity.
|
|
84
|
+
* Used for user-facing status display (best-effort, client-side).
|
|
85
|
+
*/
|
|
86
|
+
lastActivityAt: '',
|
|
87
|
+
/**
|
|
88
|
+
* Timestamp of latest successful push activity.
|
|
89
|
+
*/
|
|
90
|
+
lastPushAt: '',
|
|
91
|
+
/**
|
|
92
|
+
* Timestamp of latest successful pull activity.
|
|
93
|
+
*/
|
|
94
|
+
lastPullAt: '',
|
|
95
|
+
/**
|
|
96
|
+
* Runtime sync status for UI visibility.
|
|
97
|
+
*/
|
|
98
|
+
status: 'idle' as 'idle' | 'syncing' | 'paused' | 'error',
|
|
99
|
+
/**
|
|
100
|
+
* Timestamp of latest successful sync task (pull or push).
|
|
101
|
+
*/
|
|
102
|
+
lastSuccessAt: '',
|
|
103
|
+
/**
|
|
104
|
+
* Timestamp of latest sync error.
|
|
105
|
+
*/
|
|
106
|
+
lastErrorAt: '',
|
|
107
|
+
/**
|
|
108
|
+
* Latest sync error code.
|
|
109
|
+
*/
|
|
110
|
+
lastErrorCode: '',
|
|
111
|
+
/**
|
|
112
|
+
* Latest sync error message.
|
|
113
|
+
*/
|
|
114
|
+
lastErrorMessage: '',
|
|
115
|
+
/**
|
|
116
|
+
* Consecutive sync failure counter.
|
|
117
|
+
*/
|
|
118
|
+
consecutiveFailures: 0,
|
|
119
|
+
/**
|
|
120
|
+
* Pending sync queue depth (best-effort).
|
|
121
|
+
*/
|
|
122
|
+
queueDepth: 0,
|
|
123
|
+
/**
|
|
124
|
+
* Next scheduled pull timestamp.
|
|
125
|
+
*/
|
|
126
|
+
nextPullAt: '',
|
|
127
|
+
/**
|
|
128
|
+
* Latest pulled cursor for incremental sync.
|
|
129
|
+
*/
|
|
130
|
+
cursor: 0,
|
|
131
|
+
/**
|
|
132
|
+
* Local op sequence for push ordering.
|
|
133
|
+
*/
|
|
134
|
+
opSeq: 0,
|
|
135
|
+
/**
|
|
136
|
+
* Timestamp of latest conflict observed during push.
|
|
137
|
+
*/
|
|
138
|
+
lastConflictAt: '',
|
|
139
|
+
/**
|
|
140
|
+
* Count of latest conflicts observed during push.
|
|
141
|
+
*/
|
|
142
|
+
lastConflictCount: 0,
|
|
143
|
+
/**
|
|
144
|
+
* If sync is blocked by a policy/error class.
|
|
145
|
+
*/
|
|
146
|
+
blockedReason: '' as '' | 'quota' | 'device' | 'auth',
|
|
147
|
+
},
|
|
12
148
|
dev: {
|
|
13
149
|
autoCloseDev: true,
|
|
150
|
+
authServer: 'production' as 'production' | 'local',
|
|
151
|
+
developerMode: false,
|
|
14
152
|
},
|
|
15
153
|
lang: {
|
|
16
154
|
followSystem: true,
|
|
@@ -25,6 +163,31 @@ const _appSettingOriginData = {
|
|
|
25
163
|
beginner: {
|
|
26
164
|
init: false,
|
|
27
165
|
},
|
|
166
|
+
security: {
|
|
167
|
+
/**
|
|
168
|
+
* 本地随机种子,用于生成 machine_code_hash。
|
|
169
|
+
* 只存本地;用户清空应用数据后自然会重置(符合“删除数据即删除机器码”语义)。
|
|
170
|
+
*/
|
|
171
|
+
machineSeed: '',
|
|
172
|
+
/**
|
|
173
|
+
* 最近一次已上报的 machine_code_hash(用于避免重复上报)。
|
|
174
|
+
* 注意:这是 hash(摘要),不含原始硬件信息。
|
|
175
|
+
*/
|
|
176
|
+
machineCodeHash: '',
|
|
177
|
+
/**
|
|
178
|
+
* 最近一次上报时间(ISO 字符串,可选,仅用于调试/排查)。
|
|
179
|
+
*/
|
|
180
|
+
machineCodeAttestedAt: '',
|
|
181
|
+
/**
|
|
182
|
+
* 明文 seed 迁移完成时间(用于排查历史版本遗留)。
|
|
183
|
+
*/
|
|
184
|
+
machineSeedMigratedAt: '',
|
|
185
|
+
/**
|
|
186
|
+
* 安全回退开关:当系统安全存储不可用时,是否允许继续使用明文 seed。
|
|
187
|
+
* 默认关闭,避免退回不安全路径。
|
|
188
|
+
*/
|
|
189
|
+
allowLegacyMachineSeedFallback: false,
|
|
190
|
+
},
|
|
28
191
|
tools: {
|
|
29
192
|
autoPaste: {
|
|
30
193
|
enable: true,
|
|
@@ -32,6 +195,13 @@ const _appSettingOriginData = {
|
|
|
32
195
|
},
|
|
33
196
|
autoHide: true,
|
|
34
197
|
autoClear: 600,
|
|
198
|
+
clipboardPolling: {
|
|
199
|
+
interval: 5,
|
|
200
|
+
lowBatteryPolicy: {
|
|
201
|
+
enable: true,
|
|
202
|
+
interval: 10,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
35
205
|
},
|
|
36
206
|
dashboard: {
|
|
37
207
|
enable: false,
|
|
@@ -39,6 +209,63 @@ const _appSettingOriginData = {
|
|
|
39
209
|
searchEngine: {
|
|
40
210
|
logsEnabled: false,
|
|
41
211
|
},
|
|
212
|
+
diagnostics: {
|
|
213
|
+
verboseLogs: false,
|
|
214
|
+
},
|
|
215
|
+
recommendation: {
|
|
216
|
+
enabled: true,
|
|
217
|
+
maxItems: 10,
|
|
218
|
+
showReason: true,
|
|
219
|
+
},
|
|
220
|
+
animation: {
|
|
221
|
+
listItemStagger: false,
|
|
222
|
+
resultTransition: false,
|
|
223
|
+
coreBoxResize: false,
|
|
224
|
+
autoDisableOnLowBattery: true,
|
|
225
|
+
lowBatteryThreshold: 20,
|
|
226
|
+
},
|
|
227
|
+
viewCache: {
|
|
228
|
+
maxCachedViews: 4,
|
|
229
|
+
hotCacheDurationMs: 120000,
|
|
230
|
+
},
|
|
231
|
+
background: {
|
|
232
|
+
/** 背景图来源: 'none' | 'bing' | 'custom' | 'folder' | 'desktop' */
|
|
233
|
+
source: 'none' as 'none' | 'bing' | 'custom' | 'folder' | 'desktop',
|
|
234
|
+
/** 自定义背景图路径 */
|
|
235
|
+
customPath: '',
|
|
236
|
+
/** 文件夹路径 */
|
|
237
|
+
folderPath: '',
|
|
238
|
+
/** 文件夹轮播间隔(分钟) */
|
|
239
|
+
folderIntervalMinutes: 30,
|
|
240
|
+
/** 文件夹轮播是否随机 */
|
|
241
|
+
folderRandom: true,
|
|
242
|
+
/** 背景图模糊度 0-20 */
|
|
243
|
+
blur: 0,
|
|
244
|
+
/** 背景图透明度 10-100 */
|
|
245
|
+
opacity: 100,
|
|
246
|
+
/** 背景图滤镜 */
|
|
247
|
+
filter: {
|
|
248
|
+
brightness: 100,
|
|
249
|
+
contrast: 100,
|
|
250
|
+
saturate: 100,
|
|
251
|
+
},
|
|
252
|
+
/** 桌面壁纸路径 */
|
|
253
|
+
desktopPath: '',
|
|
254
|
+
/** 壁纸库信息 */
|
|
255
|
+
library: {
|
|
256
|
+
enabled: false,
|
|
257
|
+
folderStoredPath: '',
|
|
258
|
+
fileStoredPath: '',
|
|
259
|
+
},
|
|
260
|
+
/** 云同步配置 */
|
|
261
|
+
sync: {
|
|
262
|
+
enabled: false,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
coreBox: {
|
|
266
|
+
/** 自定义 placeholder 文本,空则使用默认 */
|
|
267
|
+
customPlaceholder: '',
|
|
268
|
+
},
|
|
42
269
|
window: {
|
|
43
270
|
closeToTray: true,
|
|
44
271
|
startMinimized: false,
|
|
@@ -55,6 +282,24 @@ const _appSettingOriginData = {
|
|
|
55
282
|
customDesktop: false,
|
|
56
283
|
},
|
|
57
284
|
layout: 'simple',
|
|
285
|
+
layoutAtomConfig: defaultLayoutAtomSimple,
|
|
286
|
+
coreBoxThemeConfig: defaultCoreBoxTheme,
|
|
287
|
+
layoutCanvasConfig: defaultLayoutCanvasConfig,
|
|
288
|
+
coreBoxCanvasConfig: defaultCoreBoxCanvasConfig,
|
|
289
|
+
presetState: {
|
|
290
|
+
lastRemotePresetId: '',
|
|
291
|
+
lastRemotePresetName: '',
|
|
292
|
+
lastRemotePresetChannel: 'beta' as 'stable' | 'beta',
|
|
293
|
+
lastRemotePresetAppliedAt: '',
|
|
294
|
+
rollbackSnapshot: null as null | {
|
|
295
|
+
layout: string
|
|
296
|
+
layoutAtomConfig: LayoutAtomConfig
|
|
297
|
+
coreBoxThemeConfig: CoreBoxThemeConfig
|
|
298
|
+
layoutCanvasConfig: LayoutCanvasConfig
|
|
299
|
+
coreBoxCanvasConfig: CoreBoxCanvasConfig
|
|
300
|
+
themeStyle?: Record<string, unknown>
|
|
301
|
+
},
|
|
302
|
+
},
|
|
58
303
|
}
|
|
59
304
|
|
|
60
305
|
export const appSettingOriginData = Object.freeze(_appSettingOriginData)
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout atom configuration for app layout customization.
|
|
3
|
+
* Used for atomic layout styling (header, aside, view, nav).
|
|
4
|
+
*/
|
|
5
|
+
export interface LayoutAtomConfig {
|
|
6
|
+
preset: string | 'custom'
|
|
7
|
+
|
|
8
|
+
header: {
|
|
9
|
+
border: 'solid' | 'none' | 'gradient'
|
|
10
|
+
opacity: number
|
|
11
|
+
height: number
|
|
12
|
+
blur: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
aside: {
|
|
16
|
+
position: 'left' | 'right' | 'bottom' | 'hidden'
|
|
17
|
+
width: number
|
|
18
|
+
border: 'solid' | 'none'
|
|
19
|
+
opacity: number
|
|
20
|
+
collapsed: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
view: {
|
|
24
|
+
radius: [number, number, number, number]
|
|
25
|
+
shadow: 'none' | 'sm' | 'md' | 'lg'
|
|
26
|
+
padding: number
|
|
27
|
+
background: 'transparent' | 'solid' | 'blur'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
nav: {
|
|
31
|
+
style: 'icon' | 'icon-text' | 'text'
|
|
32
|
+
activeIndicator: 'dot' | 'bar' | 'background' | 'none'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
customCSS?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* CoreBox theme configuration for search box UI customization.
|
|
40
|
+
*/
|
|
41
|
+
export interface CoreBoxThemeConfig {
|
|
42
|
+
preset: string | 'custom'
|
|
43
|
+
|
|
44
|
+
logo: {
|
|
45
|
+
position: 'left' | 'right' | 'hidden'
|
|
46
|
+
size: number
|
|
47
|
+
style: 'default' | 'circle' | 'rounded'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
input: {
|
|
51
|
+
border: 'none' | 'bottom' | 'full'
|
|
52
|
+
radius: number
|
|
53
|
+
background: 'transparent' | 'subtle' | 'solid'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
results: {
|
|
57
|
+
itemRadius: number
|
|
58
|
+
itemPadding: number
|
|
59
|
+
divider: boolean
|
|
60
|
+
hoverStyle: 'background' | 'border' | 'scale'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
container: {
|
|
64
|
+
radius: number
|
|
65
|
+
shadow: 'none' | 'sm' | 'md' | 'lg'
|
|
66
|
+
border: boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
customCSS?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type ThemeWindowStyle = 'Default' | 'Mica' | 'Filter'
|
|
73
|
+
export type ThemeRouteTransitionStyle = 'slide' | 'fade' | 'zoom'
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Theme-level preset fields used by preset v2.
|
|
77
|
+
*/
|
|
78
|
+
export interface ThemePresetConfig {
|
|
79
|
+
window?: ThemeWindowStyle
|
|
80
|
+
style?: {
|
|
81
|
+
dark: boolean
|
|
82
|
+
auto: boolean
|
|
83
|
+
}
|
|
84
|
+
addon?: {
|
|
85
|
+
contrast: boolean
|
|
86
|
+
coloring: boolean
|
|
87
|
+
}
|
|
88
|
+
transition?: {
|
|
89
|
+
route: ThemeRouteTransitionStyle
|
|
90
|
+
}
|
|
91
|
+
palette?: {
|
|
92
|
+
primary?: string
|
|
93
|
+
accent?: string
|
|
94
|
+
surface?: string
|
|
95
|
+
text?: string
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface LayoutCanvasItem {
|
|
100
|
+
id: string
|
|
101
|
+
area: 'header' | 'aside' | 'view' | 'nav' | 'plugins' | 'title' | 'icon'
|
|
102
|
+
x: number
|
|
103
|
+
y: number
|
|
104
|
+
w: number
|
|
105
|
+
h: number
|
|
106
|
+
minW?: number
|
|
107
|
+
minH?: number
|
|
108
|
+
maxW?: number
|
|
109
|
+
maxH?: number
|
|
110
|
+
visible?: boolean
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface LayoutCanvasConfig {
|
|
114
|
+
enabled: boolean
|
|
115
|
+
preset: string | 'custom'
|
|
116
|
+
columns: number
|
|
117
|
+
rowHeight: number
|
|
118
|
+
gap: number
|
|
119
|
+
items: LayoutCanvasItem[]
|
|
120
|
+
colorVars?: Record<string, string>
|
|
121
|
+
customCSS?: string
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface CoreBoxCanvasItem {
|
|
125
|
+
id: string
|
|
126
|
+
area: 'logo' | 'input' | 'tags' | 'actions' | 'results' | 'footer' | 'addon'
|
|
127
|
+
x: number
|
|
128
|
+
y: number
|
|
129
|
+
w: number
|
|
130
|
+
h: number
|
|
131
|
+
minW?: number
|
|
132
|
+
minH?: number
|
|
133
|
+
maxW?: number
|
|
134
|
+
maxH?: number
|
|
135
|
+
visible?: boolean
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface CoreBoxCanvasConfig {
|
|
139
|
+
enabled: boolean
|
|
140
|
+
preset: string | 'custom'
|
|
141
|
+
columns: number
|
|
142
|
+
rowHeight: number
|
|
143
|
+
gap: number
|
|
144
|
+
items: CoreBoxCanvasItem[]
|
|
145
|
+
colorVars?: Record<string, string>
|
|
146
|
+
customCSS?: string
|
|
147
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { CloudPresetItem, CloudPresetListResponse, CloudPresetPublishRequest, PresetExportData } from './preset-export-types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cloud preset API endpoints (for future implementation)
|
|
5
|
+
*/
|
|
6
|
+
export const PRESET_CLOUD_API = {
|
|
7
|
+
/** Base URL for preset cloud service */
|
|
8
|
+
baseUrl: 'https://api.talextouch.com/v1/presets',
|
|
9
|
+
|
|
10
|
+
/** List public presets */
|
|
11
|
+
list: '/list',
|
|
12
|
+
|
|
13
|
+
/** Get single preset by ID */
|
|
14
|
+
get: (id: string) => `/${id}`,
|
|
15
|
+
|
|
16
|
+
/** Publish a preset */
|
|
17
|
+
publish: '/publish',
|
|
18
|
+
|
|
19
|
+
/** Like a preset */
|
|
20
|
+
like: (id: string) => `/${id}/like`,
|
|
21
|
+
|
|
22
|
+
/** Download a preset */
|
|
23
|
+
download: (id: string) => `/${id}/download`,
|
|
24
|
+
|
|
25
|
+
/** Delete a preset (owner only) */
|
|
26
|
+
delete: (id: string) => `/${id}`,
|
|
27
|
+
|
|
28
|
+
/** Update a preset (owner only) */
|
|
29
|
+
update: (id: string) => `/${id}`,
|
|
30
|
+
|
|
31
|
+
/** Get user's own presets */
|
|
32
|
+
myPresets: '/my'
|
|
33
|
+
} as const
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Cloud preset service interface (for future implementation)
|
|
37
|
+
*/
|
|
38
|
+
export interface IPresetCloudService {
|
|
39
|
+
/** List public presets with pagination */
|
|
40
|
+
listPresets(options?: {
|
|
41
|
+
page?: number
|
|
42
|
+
pageSize?: number
|
|
43
|
+
sort?: 'popular' | 'recent' | 'likes'
|
|
44
|
+
tags?: string[]
|
|
45
|
+
search?: string
|
|
46
|
+
}): Promise<CloudPresetListResponse>
|
|
47
|
+
|
|
48
|
+
/** Get single preset by ID */
|
|
49
|
+
getPreset(id: string): Promise<PresetExportData | null>
|
|
50
|
+
|
|
51
|
+
/** Publish a preset to the cloud */
|
|
52
|
+
publishPreset(request: CloudPresetPublishRequest): Promise<CloudPresetItem>
|
|
53
|
+
|
|
54
|
+
/** Like a preset */
|
|
55
|
+
likePreset(id: string): Promise<{ liked: boolean; likes: number }>
|
|
56
|
+
|
|
57
|
+
/** Download a preset (increments download count) */
|
|
58
|
+
downloadPreset(id: string): Promise<PresetExportData>
|
|
59
|
+
|
|
60
|
+
/** Delete a preset (owner only) */
|
|
61
|
+
deletePreset(id: string): Promise<boolean>
|
|
62
|
+
|
|
63
|
+
/** Update a preset (owner only) */
|
|
64
|
+
updatePreset(id: string, preset: PresetExportData): Promise<CloudPresetItem>
|
|
65
|
+
|
|
66
|
+
/** Get user's own presets */
|
|
67
|
+
getMyPresets(): Promise<CloudPresetItem[]>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Cloud service status
|
|
72
|
+
*/
|
|
73
|
+
export interface PresetCloudStatus {
|
|
74
|
+
/** Whether cloud service is available */
|
|
75
|
+
available: boolean
|
|
76
|
+
/** Error message if unavailable */
|
|
77
|
+
error?: string
|
|
78
|
+
/** User authentication status */
|
|
79
|
+
authenticated: boolean
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Placeholder cloud service (returns unavailable)
|
|
84
|
+
* Will be replaced with actual implementation when cloud service is ready
|
|
85
|
+
*/
|
|
86
|
+
export class PresetCloudServicePlaceholder implements IPresetCloudService {
|
|
87
|
+
private readonly notAvailableError = new Error('Cloud preset service is not yet available')
|
|
88
|
+
|
|
89
|
+
async listPresets(): Promise<CloudPresetListResponse> {
|
|
90
|
+
throw this.notAvailableError
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async getPreset(): Promise<PresetExportData | null> {
|
|
94
|
+
throw this.notAvailableError
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async publishPreset(): Promise<CloudPresetItem> {
|
|
98
|
+
throw this.notAvailableError
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async likePreset(): Promise<{ liked: boolean; likes: number }> {
|
|
102
|
+
throw this.notAvailableError
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async downloadPreset(): Promise<PresetExportData> {
|
|
106
|
+
throw this.notAvailableError
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async deletePreset(): Promise<boolean> {
|
|
110
|
+
throw this.notAvailableError
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async updatePreset(): Promise<CloudPresetItem> {
|
|
114
|
+
throw this.notAvailableError
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async getMyPresets(): Promise<CloudPresetItem[]> {
|
|
118
|
+
throw this.notAvailableError
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Check if cloud service is available */
|
|
122
|
+
getStatus(): PresetCloudStatus {
|
|
123
|
+
return {
|
|
124
|
+
available: false,
|
|
125
|
+
error: 'Cloud preset service is coming soon',
|
|
126
|
+
authenticated: false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Singleton placeholder instance */
|
|
132
|
+
export const presetCloudService = new PresetCloudServicePlaceholder()
|