@aquiferre/theme-kit 0.1.0 → 0.1.2

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/components.css CHANGED
@@ -130,7 +130,7 @@
130
130
  }
131
131
 
132
132
  .table {
133
- @apply min-w-full divide-y divide-border-primary;
133
+ @apply w-full divide-y divide-border-primary;
134
134
  }
135
135
 
136
136
  .table-header {
@@ -325,8 +325,36 @@
325
325
  }
326
326
 
327
327
  /* ========== Page Layout ========== */
328
+ .breadcrumb {
329
+ @apply mb-2;
330
+ }
331
+
332
+ .breadcrumb-list {
333
+ @apply flex items-center gap-2 text-sm flex-nowrap;
334
+ }
335
+
336
+ .breadcrumb-item {
337
+ @apply flex items-center;
338
+ }
339
+
340
+ .breadcrumb-link {
341
+ @apply text-text-tertiary hover:text-accent-primary transition-colors;
342
+ }
343
+
344
+ .breadcrumb-text {
345
+ @apply text-text-tertiary;
346
+ }
347
+
348
+ .breadcrumb-current {
349
+ @apply text-text-primary font-medium;
350
+ }
351
+
352
+ .breadcrumb-separator {
353
+ @apply mx-2 text-text-tertiary;
354
+ }
355
+
328
356
  .page-container {
329
- @apply max-w-7xl mx-auto px-8 py-12;
357
+ @apply px-8 py-12;
330
358
  }
331
359
 
332
360
  .page-header {
package/index.ts CHANGED
@@ -1 +1 @@
1
- export { useThemeStore, type ThemeMode } from './theme'
1
+ export { useThemeStore, themeList, type ThemeMode, type ThemeInfo } from './theme'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquiferre/theme-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/theme.ts CHANGED
@@ -1,13 +1,49 @@
1
1
  import { defineStore } from 'pinia'
2
- import { ref, watch } from 'vue'
2
+ import { ref, watch, computed } from 'vue'
3
3
 
4
4
  export type ThemeMode = 'light' | 'dark' | 'neutral'
5
5
 
6
+ export interface ThemeInfo {
7
+ mode: ThemeMode
8
+ label: string
9
+ icon: string
10
+ description: string
11
+ }
12
+
13
+ /**
14
+ * 主题列表 (内置数据)
15
+ */
16
+ export const themeList: ThemeInfo[] = [
17
+ {
18
+ mode: 'light',
19
+ label: '浅色模式',
20
+ icon: '☀️',
21
+ description: '明亮清晰的界面'
22
+ },
23
+ {
24
+ mode: 'dark',
25
+ label: '深色模式',
26
+ icon: '🌙',
27
+ description: '护眼科普的暗色主题'
28
+ },
29
+ {
30
+ mode: 'neutral',
31
+ label: '中性模式',
32
+ icon: '✨',
33
+ description: '低饱和度的柔和色调'
34
+ }
35
+ ]
36
+
6
37
  export const useThemeStore = defineStore('theme', () => {
7
38
  const theme = ref<ThemeMode>(
8
39
  (localStorage.getItem('theme') as ThemeMode) || 'dark'
9
40
  )
10
41
 
42
+ // 当前主题信息
43
+ const currentThemeInfo = computed<ThemeInfo | undefined>(() =>
44
+ themeList.find(t => t.mode === theme.value)
45
+ )
46
+
11
47
  function toggle() {
12
48
  const cycle: ThemeMode[] = ['light', 'dark', 'neutral']
13
49
  const idx = cycle.indexOf(theme.value)
@@ -43,10 +79,22 @@ export const useThemeStore = defineStore('theme', () => {
43
79
  theme.value = e.matches ? 'dark' : 'light'
44
80
  }
45
81
  })
82
+
83
+ // 监听其他 tab 的主题变化
84
+ window.addEventListener('storage', (event) => {
85
+ if (event.key === 'theme' && event.newValue) {
86
+ const newTheme = event.newValue as ThemeMode
87
+ if (['light', 'dark', 'neutral'].includes(newTheme)) {
88
+ theme.value = newTheme
89
+ }
90
+ }
91
+ })
46
92
  }
47
93
 
48
94
  return {
49
95
  theme,
96
+ themeList,
97
+ currentThemeInfo,
50
98
  toggle,
51
99
  setTheme,
52
100
  getSystemTheme,
package/variables.css CHANGED
@@ -88,9 +88,9 @@
88
88
  --color-sidebar-active: #22222e;
89
89
  --color-sidebar-border: #2a2a36;
90
90
 
91
- --color-input-bg: #f0f0f5;
92
- --color-input-text: #1a1a2e;
93
- --color-input-placeholder: #6a6a7a;
91
+ --color-input-bg: #1e1e28;
92
+ --color-input-text: #f0f0f5;
93
+ --color-input-placeholder: #7a7a8a;
94
94
 
95
95
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
96
96
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);