@k3000/ce 0.2.0 → 0.2.1
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/ce.mjs +1 -1
- package/console/components/div-test.mjs +11 -0
- package/console/components/g-button.mjs +79 -0
- package/console/components/g-cell.mjs +129 -0
- package/console/components/g-col.mjs +38 -0
- package/console/components/g-field.mjs +162 -0
- package/console/components/g-form.mjs +11 -0
- package/console/components/g-icon.mjs +82 -0
- package/console/components/g-image.mjs +127 -0
- package/console/components/g-popup.mjs +130 -0
- package/console/components/g-row.mjs +120 -0
- package/console/components/g-space.mjs +21 -0
- package/console/components/g-toast.mjs +116 -0
- package/console/components/layout-header.mjs +0 -179
- package/console/components/layout-menu.mjs +98 -1
- package/console/index.html +1 -0
- package/console/index2.html +46 -0
- package/console/pages/demo-button.mjs +116 -0
- package/console/pages/demo-cell.mjs +59 -0
- package/console/pages/demo-field.mjs +67 -0
- package/console/pages/demo-icon.mjs +200 -0
- package/console/pages/demo-image.mjs +113 -0
- package/console/pages/demo-layout.mjs +141 -0
- package/console/pages/demo-popup.mjs +158 -0
- package/console/pages/demo-space.mjs +51 -0
- package/console/pages/demo-toast.mjs +66 -0
- package/index.mjs +7 -0
- package/package.json +1 -1
- package/test.html +15 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export const innerHTML = `
|
|
3
|
-
<div class="h-20 w-full flex justify-between items-center relative z-30">
|
|
4
|
-
<!-- Floating Glass Container -->
|
|
5
|
-
<div class="absolute inset-x-2 top-2 bottom-2 rounded-2xl bg-white/60 dark:bg-gray-900/60 backdrop-blur-2xl border border-white/50 dark:border-white/10 shadow-[0_8px_32px_rgba(0,0,0,0.04)] ring-1 ring-black/5 flex justify-between items-center px-6 transition-all duration-300 hover:shadow-[0_12px_40px_rgba(0,0,0,0.06)] hover:bg-white/70 dark:hover:bg-gray-900/70">
|
|
6
|
-
|
|
7
|
-
<div class="flex items-center gap-6">
|
|
8
|
-
<!-- Logo -->
|
|
9
|
-
<div class="flex items-center gap-3 font-bold text-xl tracking-tight text-gray-900">
|
|
10
|
-
<div class="w-9 h-9 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-xl flex items-center justify-center shadow-lg shadow-blue-500/30 text-white">
|
|
11
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 10l-2 1m0 0l-2-1m2 1v2.5M20 7l-2 1m2-1l-2-1m2 1v2.5M14 4l-2-1-2 1M4 7l2-1M4 7l2 1M4 7v2.5M12 21l-2-1m2 1l2-1m-2 1v-2.5M6 18l-2-1v-2.5M18 18l2-1v-2.5"></path></svg>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<span class="bg-clip-text text-transparent bg-gradient-to-r from-gray-900 to-gray-600 dark:from-white dark:to-gray-300">Console</span>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<!-- Separator -->
|
|
18
|
-
<div class="h-4 w-px bg-gray-300/50 rounded-full"></div>
|
|
19
|
-
|
|
20
|
-
<!-- Breadcrumbs -->
|
|
21
|
-
<div class="flex items-center text-sm font-medium">
|
|
22
|
-
<span class="text-gray-400 hover:text-blue-600 cursor-pointer transition-colors duration-200">Start</span>
|
|
23
|
-
<svg class="w-3 h-3 mx-2 text-gray-300" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" /></svg>
|
|
24
|
-
<span class="text-gray-800 dark:text-gray-100 bg-gray-100/50 dark:bg-gray-800/50 px-2 py-0.5 rounded-md">Dashboard</span>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<!-- Right: User Actions -->
|
|
29
|
-
<div class="flex items-center gap-3">
|
|
30
|
-
<!-- Theme Dropdown -->
|
|
31
|
-
<div class="relative group" tabindex="0">
|
|
32
|
-
<button class="w-9 h-9 flex items-center justify-center text-gray-500 hover:text-purple-600 dark:text-gray-400 dark:hover:text-purple-400 transition-all duration-200 rounded-xl hover:bg-purple-50/50 dark:hover:bg-purple-500/10 active:scale-95 border border-transparent hover:border-purple-100 dark:hover:border-purple-500/20">
|
|
33
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"></path></svg>
|
|
34
|
-
</button>
|
|
35
|
-
|
|
36
|
-
<!-- Dropdown Menu -->
|
|
37
|
-
<div class="absolute right-0 top-full mt-2 w-56 bg-white/70 dark:bg-gray-800/80 backdrop-blur-3xl border border-white/50 dark:border-white/10 rounded-2xl shadow-[0_20px_50px_rgba(0,0,0,0.15)] opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-300 transform origin-top-right z-50 scale-95 group-hover:scale-100 translate-y-2 group-hover:translate-y-0 filter backdrop-brightness-110 dark:backdrop-brightness-90">
|
|
38
|
-
<div class="p-2 space-y-1">
|
|
39
|
-
<!-- Light Mode -->
|
|
40
|
-
<div onclick="{{setTheme}}" data-theme="light" class="flex items-center justify-between px-3 py-2.5 rounded-xl hover:bg-gray-100/50 dark:hover:bg-white/5 cursor-pointer group/item transition-colors theme-option">
|
|
41
|
-
<div class="flex items-center gap-3 text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
42
|
-
<div class="w-8 h-8 rounded-lg bg-orange-50 dark:bg-orange-500/10 text-orange-500 flex items-center justify-center">
|
|
43
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>
|
|
44
|
-
</div>
|
|
45
|
-
Day Mode
|
|
46
|
-
</div>
|
|
47
|
-
<!-- Checkmark for active state -->
|
|
48
|
-
<svg class="w-4 h-4 text-orange-500 opacity-0 group-[.active]:opacity-100 transition-opacity check-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<!-- Dark Mode -->
|
|
52
|
-
<div onclick="{{setTheme}}" data-theme="dark" class="flex items-center justify-between px-3 py-2.5 rounded-xl hover:bg-gray-100/50 dark:hover:bg-white/5 cursor-pointer group/item transition-colors theme-option">
|
|
53
|
-
<div class="flex items-center gap-3 text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
54
|
-
<div class="w-8 h-8 rounded-lg bg-indigo-50 dark:bg-indigo-500/10 text-indigo-500 dark:text-indigo-400 flex items-center justify-center">
|
|
55
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path></svg>
|
|
56
|
-
</div>
|
|
57
|
-
Night Mode
|
|
58
|
-
</div>
|
|
59
|
-
<svg class="w-4 h-4 text-indigo-500 dark:text-indigo-400 opacity-0 group-[.active]:opacity-100 transition-opacity check-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<!-- Eye Protection -->
|
|
63
|
-
<div onclick="{{setTheme}}" data-theme="eye-protection" class="flex items-center justify-between px-3 py-2.5 rounded-xl hover:bg-gray-100/50 dark:hover:bg-white/5 cursor-pointer group/item transition-colors theme-option">
|
|
64
|
-
<div class="flex items-center gap-3 text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
65
|
-
<div class="w-8 h-8 rounded-lg bg-green-50 dark:bg-green-500/10 text-green-600 dark:text-green-400 flex items-center justify-center">
|
|
66
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path></svg>
|
|
67
|
-
</div>
|
|
68
|
-
Eye Protect
|
|
69
|
-
</div>
|
|
70
|
-
<svg class="w-4 h-4 text-green-600 dark:text-green-400 opacity-0 group-[.active]:opacity-100 transition-opacity check-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<!-- Notifications -->
|
|
77
|
-
<button class="w-9 h-9 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-all duration-200 rounded-xl hover:bg-blue-50/50 dark:hover:bg-blue-500/10 active:scale-95">
|
|
78
|
-
<div class="relative">
|
|
79
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"></path></svg>
|
|
80
|
-
<span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full border border-white"></span>
|
|
81
|
-
</div>
|
|
82
|
-
</button>
|
|
83
|
-
|
|
84
|
-
<!-- User Profile -->
|
|
85
|
-
<div class="relative group" tabindex="0">
|
|
86
|
-
<div class="flex items-center gap-3 pl-2 pr-1 py-1 rounded-full hover:bg-gray-100/50 transition-all duration-200 cursor-pointer border border-transparent hover:border-white/50">
|
|
87
|
-
<div class="hidden md:block text-right">
|
|
88
|
-
<div class="text-[10px] uppercase tracking-wider text-gray-400 font-bold">Admin</div>
|
|
89
|
-
<div class="text-sm font-bold text-gray-800 dark:text-gray-200 leading-none">{{user.name}}</div>
|
|
90
|
-
</div>
|
|
91
|
-
<img src="{{user.avatar}}" class="w-9 h-9 rounded-full shadow-md ring-2 ring-white object-cover" />
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<!-- Glass Dropdown Menu -->
|
|
95
|
-
<div class="absolute right-0 top-full mt-2 w-64 bg-white/70 dark:bg-gray-800/80 backdrop-blur-3xl border border-white/50 dark:border-white/10 rounded-2xl shadow-[0_20px_50px_rgba(0,0,0,0.15)] opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-300 transform origin-top-right z-50 scale-95 group-hover:scale-100 translate-y-2 group-hover:translate-y-0 filter backdrop-brightness-110 dark:backdrop-brightness-90">
|
|
96
|
-
<div class="p-2">
|
|
97
|
-
<div class="p-3 bg-gradient-to-br from-gray-50 to-white dark:from-gray-700 dark:to-gray-800 rounded-xl border border-white/50 dark:border-white/10 mb-1">
|
|
98
|
-
<p class="text-sm font-bold text-gray-900 dark:text-white">{{user.name}}</p>
|
|
99
|
-
<p class="text-xs text-gray-500 truncate mt-0.5">admin@example.com</p>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div class="space-y-1">
|
|
103
|
-
<a href="#profile" class="flex items-center px-3 py-2.5 text-sm font-medium text-gray-600 dark:text-gray-300 rounded-xl hover:bg-blue-50/80 dark:hover:bg-blue-500/20 hover:text-blue-600 dark:hover:text-blue-400 transition-all duration-200 group/item">
|
|
104
|
-
<div class="w-8 h-8 rounded-lg bg-blue-100/50 text-blue-600 flex items-center justify-center mr-3 group-hover/item:bg-blue-500 group-hover/item:text-white transition-colors duration-200">
|
|
105
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
|
|
106
|
-
</div>
|
|
107
|
-
Profile
|
|
108
|
-
</a>
|
|
109
|
-
<a href="#settings" class="flex items-center px-3 py-2.5 text-sm font-medium text-gray-600 dark:text-gray-300 rounded-xl hover:bg-indigo-50/80 dark:hover:bg-indigo-500/20 hover:text-indigo-600 dark:hover:text-indigo-400 transition-all duration-200 group/item">
|
|
110
|
-
<div class="w-8 h-8 rounded-lg bg-indigo-100/50 text-indigo-600 flex items-center justify-center mr-3 group-hover/item:bg-indigo-500 group-hover/item:text-white transition-colors duration-200">
|
|
111
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
|
|
112
|
-
</div>
|
|
113
|
-
Settings
|
|
114
|
-
</a>
|
|
115
|
-
<div class="h-px bg-gray-100 dark:bg-gray-700 my-1"></div>
|
|
116
|
-
<div class="flex items-center px-3 py-2.5 text-sm font-medium text-red-600 rounded-xl hover:bg-red-50/80 transition-all duration-200 cursor-pointer btn-logout group/item">
|
|
117
|
-
<div class="w-8 h-8 rounded-lg bg-red-100/50 text-red-500 flex items-center justify-center mr-3 group-hover/item:bg-red-500 group-hover/item:text-white transition-colors duration-200">
|
|
118
|
-
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>
|
|
119
|
-
</div>
|
|
120
|
-
Logout
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
`
|
|
130
|
-
|
|
131
|
-
export default class extends HTMLElement {
|
|
132
|
-
|
|
133
|
-
user = {
|
|
134
|
-
name: 'Admin',
|
|
135
|
-
avatar: 'https://ui-avatars.com/api/?name=Admin&background=0D8ABC&color=fff'
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
constructor() {
|
|
139
|
-
|
|
140
|
-
super()
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
ready() {
|
|
144
|
-
this.updateThemeUI()
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
setTheme(e) {
|
|
148
|
-
const target = e.currentTarget
|
|
149
|
-
const theme = target.dataset.theme
|
|
150
|
-
|
|
151
|
-
localStorage.theme = theme
|
|
152
|
-
|
|
153
|
-
if (theme === 'dark') {
|
|
154
|
-
document.documentElement.classList.add('dark')
|
|
155
|
-
document.documentElement.classList.remove('eye-protection')
|
|
156
|
-
} else if (theme === 'eye-protection') {
|
|
157
|
-
document.documentElement.classList.add('eye-protection')
|
|
158
|
-
document.documentElement.classList.remove('dark')
|
|
159
|
-
} else {
|
|
160
|
-
document.documentElement.classList.remove('dark')
|
|
161
|
-
document.documentElement.classList.remove('eye-protection')
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
this.updateThemeUI()
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
updateThemeUI() {
|
|
168
|
-
const currentTheme = localStorage.theme || 'light'
|
|
169
|
-
const options = this.querySelectorAll('.theme-option')
|
|
170
|
-
|
|
171
|
-
options.forEach(option => {
|
|
172
|
-
if (option.dataset.theme === currentTheme) {
|
|
173
|
-
option.classList.add('active', 'bg-gray-100', 'dark:bg-white/10')
|
|
174
|
-
} else {
|
|
175
|
-
option.classList.remove('active', 'bg-gray-100', 'dark:bg-white/10')
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
}
|
|
179
|
-
}
|
|
@@ -44,12 +44,64 @@ export default class extends HTMLElement {
|
|
|
44
44
|
},
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
|
+
{
|
|
48
|
+
title: '组件示例',
|
|
49
|
+
icon: 'tools',
|
|
50
|
+
path: '/demo',
|
|
51
|
+
children: [
|
|
52
|
+
{
|
|
53
|
+
title: '按钮',
|
|
54
|
+
icon: 'button',
|
|
55
|
+
path: '/button',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: '单元格',
|
|
59
|
+
icon: 'menu',
|
|
60
|
+
path: '/cell',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: '输入框',
|
|
64
|
+
icon: 'menu',
|
|
65
|
+
path: '/field',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: '图标',
|
|
69
|
+
icon: 'search',
|
|
70
|
+
path: '/icon',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: '图片',
|
|
74
|
+
icon: 'view',
|
|
75
|
+
path: '/image',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: '布局',
|
|
79
|
+
icon: 'menu',
|
|
80
|
+
path: '/layout',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: '弹出层',
|
|
84
|
+
icon: 'role',
|
|
85
|
+
path: '/popup',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: '间距',
|
|
89
|
+
icon: 'menu',
|
|
90
|
+
path: '/space',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: '轻提示',
|
|
94
|
+
icon: 'menu',
|
|
95
|
+
path: '/toast',
|
|
96
|
+
},
|
|
97
|
+
]
|
|
98
|
+
},
|
|
47
99
|
]
|
|
48
100
|
|
|
49
101
|
constructor() {
|
|
50
102
|
super()
|
|
51
103
|
this.template = bind(`
|
|
52
|
-
<div class="group h-full flex flex-col p-4 bg-white/30 dark:bg-gray-900/40 backdrop-blur-3xl border-r border-white/20 dark:border-white/5 transition-all duration-300 group-[.collapsed]:w-20 shadow-[20px_0_40px_rgba(0,0,0,0.02)]">
|
|
104
|
+
<div class="group min-h-full flex flex-col p-4 bg-white/30 dark:bg-gray-900/40 backdrop-blur-3xl border-r border-white/20 dark:border-white/5 transition-all duration-300 group-[.collapsed]:w-20 shadow-[20px_0_40px_rgba(0,0,0,0.02)]">
|
|
53
105
|
<!-- Menu Control Bar -->
|
|
54
106
|
<div class="mb-4 flex items-center gap-2 group-[.collapsed]:justify-center group-[.collapsed]:px-0">
|
|
55
107
|
<!-- Toggle Button -->
|
|
@@ -134,6 +186,51 @@ export default class extends HTMLElement {
|
|
|
134
186
|
dir: './console/pages',
|
|
135
187
|
component: 'system-menu'
|
|
136
188
|
},
|
|
189
|
+
{
|
|
190
|
+
path: '/demo/button',
|
|
191
|
+
dir: './console/pages',
|
|
192
|
+
component: 'demo-button'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
path: '/demo/cell',
|
|
196
|
+
dir: './console/pages',
|
|
197
|
+
component: 'demo-cell'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
path: '/demo/field',
|
|
201
|
+
dir: './console/pages',
|
|
202
|
+
component: 'demo-field'
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
path: '/demo/icon',
|
|
206
|
+
dir: './console/pages',
|
|
207
|
+
component: 'demo-icon'
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
path: '/demo/image',
|
|
211
|
+
dir: './console/pages',
|
|
212
|
+
component: 'demo-image'
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
path: '/demo/layout',
|
|
216
|
+
dir: './console/pages',
|
|
217
|
+
component: 'demo-layout'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
path: '/demo/popup',
|
|
221
|
+
dir: './console/pages',
|
|
222
|
+
component: 'demo-popup'
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
path: '/demo/space',
|
|
226
|
+
dir: './console/pages',
|
|
227
|
+
component: 'demo-space'
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
path: '/demo/toast',
|
|
231
|
+
dir: './console/pages',
|
|
232
|
+
component: 'demo-toast'
|
|
233
|
+
},
|
|
137
234
|
])
|
|
138
235
|
}
|
|
139
236
|
|
package/console/index.html
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport"
|
|
6
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
|
|
7
|
+
<title>Console Management</title>
|
|
8
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
9
|
+
<style>
|
|
10
|
+
.eye-protection {
|
|
11
|
+
filter: sepia(0.3) contrast(0.9) brightness(0.95);
|
|
12
|
+
-webkit-filter: sepia(0.3) contrast(0.9) brightness(0.95);
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
<script>
|
|
16
|
+
tailwind.config = {
|
|
17
|
+
darkMode: 'class',
|
|
18
|
+
}
|
|
19
|
+
// Initialize Theme
|
|
20
|
+
const theme = localStorage.theme || 'light'
|
|
21
|
+
if (theme === 'dark') {
|
|
22
|
+
document.documentElement.classList.add('dark')
|
|
23
|
+
document.documentElement.classList.remove('eye-protection')
|
|
24
|
+
} else if (theme === 'eye-protection') {
|
|
25
|
+
document.documentElement.classList.add('eye-protection')
|
|
26
|
+
document.documentElement.classList.remove('dark')
|
|
27
|
+
} else {
|
|
28
|
+
document.documentElement.classList.remove('dark')
|
|
29
|
+
document.documentElement.classList.remove('eye-protection')
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
<script type="module">
|
|
33
|
+
import { config } from '../index.mjs'
|
|
34
|
+
|
|
35
|
+
config({
|
|
36
|
+
dir: './console/components',
|
|
37
|
+
ext: 'mjs'
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
40
|
+
</head>
|
|
41
|
+
|
|
42
|
+
<body class="bg-gradient-to-br from-indigo-50 via-purple-50 to-pink-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900 min-h-screen text-gray-800 dark:text-gray-100 transition-colors duration-300">
|
|
43
|
+
<div-test></div-test>
|
|
44
|
+
</body>
|
|
45
|
+
|
|
46
|
+
</html>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export const innerHTML = `
|
|
2
|
+
<div class="h-full flex flex-col p-6 gap-6 overflow-y-auto custom-scrollbar">
|
|
3
|
+
<common-header title="按钮展示区" description="展示 g-button 的各种类型和状态"></common-header>
|
|
4
|
+
|
|
5
|
+
<div class="space-y-8">
|
|
6
|
+
<!-- 基础用法 -->
|
|
7
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
8
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">基础用法</h3>
|
|
9
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
10
|
+
<g-button>默认按钮</g-button>
|
|
11
|
+
<g-button type="primary">主要按钮</g-button>
|
|
12
|
+
<g-button type="success">成功按钮</g-button>
|
|
13
|
+
<g-button type="warning">警告按钮</g-button>
|
|
14
|
+
<g-button type="danger">危险按钮</g-button>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<!-- 朴素按钮 -->
|
|
19
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
20
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">朴素按钮 (plain)</h3>
|
|
21
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
22
|
+
<g-button plain>朴素默认</g-button>
|
|
23
|
+
<g-button plain type="primary">朴素主要</g-button>
|
|
24
|
+
<g-button plain type="success">朴素成功</g-button>
|
|
25
|
+
<g-button plain type="warning">朴素警告</g-button>
|
|
26
|
+
<g-button plain type="danger">朴素危险</g-button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<!-- 禁用状态 -->
|
|
31
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
32
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">禁用状态 (disabled)</h3>
|
|
33
|
+
<div class="flex flex-wrap items-center gap-4 mb-4">
|
|
34
|
+
<g-button disabled>禁用默认</g-button>
|
|
35
|
+
<g-button disabled type="primary">禁用主要</g-button>
|
|
36
|
+
<g-button disabled type="success">禁用成功</g-button>
|
|
37
|
+
<g-button disabled type="warning">禁用警告</g-button>
|
|
38
|
+
<g-button disabled type="danger">禁用危险</g-button>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
41
|
+
<g-button disabled plain>禁用朴素默认</g-button>
|
|
42
|
+
<g-button disabled plain type="primary">禁用朴素主要</g-button>
|
|
43
|
+
<g-button disabled plain type="success">禁用朴素成功</g-button>
|
|
44
|
+
<g-button disabled plain type="warning">禁用朴素警告</g-button>
|
|
45
|
+
<g-button disabled plain type="danger">禁用朴素危险</g-button>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- 加载状态 -->
|
|
50
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
51
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">
|
|
52
|
+
加载状态 (loading)
|
|
53
|
+
<g-button onclick="{{loaded}}" qwe>加载完成</g-button>
|
|
54
|
+
</h3>
|
|
55
|
+
<div class="flex flex-wrap items-center gap-4 mb-4">
|
|
56
|
+
<g-button loading="{{loading}}">加载默认</g-button>
|
|
57
|
+
<g-button loading="{{loading}}" type="primary">加载主要</g-button>
|
|
58
|
+
<g-button loading="{{loading}}" type="success" loading-text="处理中...">加载成功</g-button>
|
|
59
|
+
<g-button loading="{{loading}}" type="warning" loading-text="正在提交">加载警告</g-button>
|
|
60
|
+
<g-button loading="{{loading}}" type="danger" loading-text="删除中">加载危险</g-button>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
63
|
+
<g-button loading="{{loading}}" plain>朴素加载</g-button>
|
|
64
|
+
<g-button loading="{{loading}}" plain type="primary" loading-text="请稍候...">朴素加载</g-button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<!-- 图标按钮 -->
|
|
69
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
70
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">图标按钮 (icon)</h3>
|
|
71
|
+
<div class="flex flex-wrap items-center gap-4 mb-4">
|
|
72
|
+
<!-- 使用内置 common-icon 的名称 -->
|
|
73
|
+
<g-button icon="system">系统管理</g-button>
|
|
74
|
+
<g-button type="primary" icon="user">用户中心</g-button>
|
|
75
|
+
<g-button type="success" icon="role">角色配置</g-button>
|
|
76
|
+
<g-button type="warning" icon="menu">菜单设置</g-button>
|
|
77
|
+
<g-button type="danger" icon="tools">系统工具</g-button>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
80
|
+
<!-- 纯图标按钮 (不带文字) -->
|
|
81
|
+
<g-button icon="system" class="!!p-3 !rounded-full"></g-button>
|
|
82
|
+
<g-button type="primary" icon="user" class="!px-3 !py-3 !rounded-full"></g-button>
|
|
83
|
+
|
|
84
|
+
<!-- 使用 URL 作为图标 -->
|
|
85
|
+
<g-button type="success" icon="https://www.google.com/favicon.ico">外部链接(URL 图标)</g-button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
<!-- 尺寸大小 -->
|
|
89
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
90
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">尺寸大小 (size)</h3>
|
|
91
|
+
<div class="flex flex-wrap items-end gap-4 mb-4">
|
|
92
|
+
<g-button size="large">大型按钮</g-button>
|
|
93
|
+
<g-button size="normal">默认按钮</g-button>
|
|
94
|
+
<g-button size="small">小型按钮</g-button>
|
|
95
|
+
<g-button size="mini">迷你按钮</g-button>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="flex flex-wrap items-end gap-4">
|
|
98
|
+
<g-button size="large" type="primary" plain>大型朴素</g-button>
|
|
99
|
+
<g-button size="normal" type="primary" plain>默认朴素</g-button>
|
|
100
|
+
<g-button size="small" type="primary" plain>小型朴素</g-button>
|
|
101
|
+
<g-button size="mini" type="primary" plain>迷你朴素</g-button>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
`
|
|
107
|
+
|
|
108
|
+
export default class extends HTMLElement {
|
|
109
|
+
loading = true
|
|
110
|
+
ready() {
|
|
111
|
+
console.log('demo-button ready')
|
|
112
|
+
}
|
|
113
|
+
loaded() {
|
|
114
|
+
this.loading = false
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const innerHTML = `
|
|
2
|
+
<div class="h-full flex flex-col p-6 gap-6 overflow-y-auto custom-scrollbar">
|
|
3
|
+
<common-header title="单元格展示区" description="展示 g-cell 的各种类型和状态"></common-header>
|
|
4
|
+
|
|
5
|
+
<div class="space-y-8">
|
|
6
|
+
<!-- 基础用法 -->
|
|
7
|
+
<div>
|
|
8
|
+
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-2 px-4">基础用法</h3>
|
|
9
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 overflow-hidden text-gray-800 dark:text-gray-100">
|
|
10
|
+
<!-- Group of cells -->
|
|
11
|
+
<g-cell title="单元格" value="内容"></g-cell>
|
|
12
|
+
<g-cell title="单元格" value="内容" label="描述信息" border="false"></g-cell>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<!-- 卡片风格 -->
|
|
17
|
+
<div>
|
|
18
|
+
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-2 px-4">卡片风格</h3>
|
|
19
|
+
<div class="space-y-4">
|
|
20
|
+
<g-cell title="独立卡片单元格" value="内容" round="true"></g-cell>
|
|
21
|
+
<g-cell title="带描述的独立卡片" value="详细信息" label="底部辅助描述" round="true"></g-cell>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<!-- 展示图标 -->
|
|
26
|
+
<div>
|
|
27
|
+
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-2 px-4">展示图标</h3>
|
|
28
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 overflow-hidden text-gray-800 dark:text-gray-100">
|
|
29
|
+
<g-cell title="系统管理" icon="system" value="内容"></g-cell>
|
|
30
|
+
<g-cell title="用户中心" icon="user" value="内容"></g-cell>
|
|
31
|
+
<g-cell title="URL图标" icon="https://www.google.com/favicon.ico" value="内容" border="false"></g-cell>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- 展示箭头 -->
|
|
36
|
+
<div>
|
|
37
|
+
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-2 px-4">展示箭头与交互</h3>
|
|
38
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 overflow-hidden text-gray-800 dark:text-gray-100">
|
|
39
|
+
<g-cell title="可点击的单元格" is-link="true" clickable="true" onclick="{{click}}"></g-cell>
|
|
40
|
+
<g-cell title="带内容的跳转" value="前往设置" is-link="true"></g-cell>
|
|
41
|
+
<g-cell title="向下箭头" value="展开详情" is-link="true" arrow-direction="down"></g-cell>
|
|
42
|
+
<g-cell title="自定义插槽" border="false">
|
|
43
|
+
<g-button slot="right-icon" size="mini" type="primary" class="!ml-2">操作按钮</g-button>
|
|
44
|
+
</g-cell>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
export default class extends HTMLElement {
|
|
52
|
+
ready() {
|
|
53
|
+
console.log('demo-cell ready')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
click() {
|
|
57
|
+
alert('点击了单元格')
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const innerHTML = `
|
|
2
|
+
<div class="h-full flex flex-col p-6 gap-6 overflow-y-auto custom-scrollbar">
|
|
3
|
+
<common-header title="输入框 (Field)" description="表单中的单行输入域,支持带标签、清空、图标和各类状态限制。"></common-header>
|
|
4
|
+
|
|
5
|
+
<div class="space-y-8 pb-10">
|
|
6
|
+
<!-- 基础用法 -->
|
|
7
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
8
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">基础用法</h3>
|
|
9
|
+
<g-form data="{{data}}" onsubmit="{{onsubmit}}" class="space-y-4 max-w-md">
|
|
10
|
+
<g-field placeholder="请输入文本..." name="text"></g-field>
|
|
11
|
+
<g-field label="用户名" placeholder="请输入用户名" name="username"></g-field>
|
|
12
|
+
<g-field label="密码" type="password" placeholder="请输入密码" name="password"></g-field>
|
|
13
|
+
<g-button type="button" onclick={{onsubmit}}>提交</g-button>
|
|
14
|
+
</g-form>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<!-- 带有清空按钮 -->
|
|
18
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
19
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">可清空 (clearable)</h3>
|
|
20
|
+
<div class="space-y-4 max-w-md">
|
|
21
|
+
<g-field value="一旦输入内容就可以清空" clearable label="搜索词" placeholder="输入搜索词"></g-field>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<!-- 自定义图标 -->
|
|
26
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
27
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">前后缀图标 (left-icon / right-icon)</h3>
|
|
28
|
+
<div class="space-y-4 max-w-md">
|
|
29
|
+
<g-field left-icon="search" placeholder="全局搜索"></g-field>
|
|
30
|
+
<g-field left-icon="user" label="账号" placeholder="请输入账号"></g-field>
|
|
31
|
+
<g-field right-icon="menu" placeholder="更多设置 (点击图标)" onrightclick="{{handleRightClick}}"></g-field>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- 禁用与只读 -->
|
|
36
|
+
<div class="bg-white/60 dark:bg-gray-800/60 backdrop-blur-2xl rounded-2xl shadow-lg shadow-gray-200/20 dark:shadow-black/20 border border-white/40 dark:border-white/10 p-6">
|
|
37
|
+
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-6">只读与禁用状态 (readonly / disabled)</h3>
|
|
38
|
+
<div class="space-y-4 max-w-md">
|
|
39
|
+
<g-field label="只读属性" value="我是只读的内容,无法修改" readonly clearable></g-field>
|
|
40
|
+
<g-field label="禁用状态" placeholder="该输入框被禁用" disabled clearable></g-field>
|
|
41
|
+
<g-field label="禁用状态" value="带固定值的禁用" disabled></g-field>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
`
|
|
47
|
+
|
|
48
|
+
export default class extends HTMLElement {
|
|
49
|
+
|
|
50
|
+
data = {}
|
|
51
|
+
|
|
52
|
+
ready() {
|
|
53
|
+
console.log('demo-field ready')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onsubmit() {
|
|
57
|
+
console.log(this.data)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
handleRightClick() {
|
|
61
|
+
if (window.$toast) {
|
|
62
|
+
window.$toast.show('由右侧图标触发的点击事件');
|
|
63
|
+
} else {
|
|
64
|
+
console.log('Right icon clicked');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|