@composy/keyboard-vue 0.0.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/README.md +46 -0
- package/dist/index.css +797 -0
- package/dist/index.js +1250 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/es/components/KeyboardKey.js +17 -0
- package/es/components/KeyboardKey.js.map +1 -0
- package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js +131 -0
- package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/KeyboardPopup.js +17 -0
- package/es/components/KeyboardPopup.js.map +1 -0
- package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js +164 -0
- package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/LicensePlateKeyboard.js +17 -0
- package/es/components/LicensePlateKeyboard.js.map +1 -0
- package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js +97 -0
- package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/VirtualKeyboard.js +17 -0
- package/es/components/VirtualKeyboard.js.map +1 -0
- package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js +127 -0
- package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/index.d.ts +9 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +15 -0
- package/es/composables/index.d.ts +7 -0
- package/es/composables/index.d.ts.map +1 -0
- package/es/composables/index.js +13 -0
- package/es/composables/useKeyboard.d.ts +113 -0
- package/es/composables/useKeyboard.d.ts.map +1 -0
- package/es/composables/useKeyboard.js +75 -0
- package/es/composables/useKeyboard.js.map +1 -0
- package/es/composables/useKeyboardPopup.d.ts +73 -0
- package/es/composables/useKeyboardPopup.d.ts.map +1 -0
- package/es/composables/useKeyboardPopup.js +119 -0
- package/es/composables/useKeyboardPopup.js.map +1 -0
- package/es/directives/index.d.ts +6 -0
- package/es/directives/index.d.ts.map +1 -0
- package/es/directives/index.js +12 -0
- package/es/directives/v-keyboard.d.ts +36 -0
- package/es/directives/v-keyboard.d.ts.map +1 -0
- package/es/directives/v-keyboard.js +65 -0
- package/es/directives/v-keyboard.js.map +1 -0
- package/es/index.d.ts +42 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +34 -0
- package/es/index.js.map +1 -0
- package/es/plugins/engine-plugin.d.ts +37 -0
- package/es/plugins/engine-plugin.d.ts.map +1 -0
- package/es/plugins/engine-plugin.js +37 -0
- package/es/plugins/engine-plugin.js.map +1 -0
- package/es/plugins/index.d.ts +6 -0
- package/es/plugins/index.d.ts.map +1 -0
- package/es/plugins/index.js +12 -0
- package/es/style/css.js +1 -0
- package/es/style/index.js +1 -0
- package/es/style/index.less +1 -0
- package/es/styles/index.less +267 -0
- package/es/styles/keyboard.less +399 -0
- package/es/styles/themes.less +233 -0
- package/lib/components/KeyboardKey.cjs +21 -0
- package/lib/components/KeyboardKey.cjs.map +1 -0
- package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs +131 -0
- package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/KeyboardPopup.cjs +21 -0
- package/lib/components/KeyboardPopup.cjs.map +1 -0
- package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs +164 -0
- package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/LicensePlateKeyboard.cjs +21 -0
- package/lib/components/LicensePlateKeyboard.cjs.map +1 -0
- package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs +97 -0
- package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/VirtualKeyboard.cjs +21 -0
- package/lib/components/VirtualKeyboard.cjs.map +1 -0
- package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs +127 -0
- package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/index.cjs +19 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/composables/index.cjs +15 -0
- package/lib/composables/index.d.ts +7 -0
- package/lib/composables/useKeyboard.cjs +76 -0
- package/lib/composables/useKeyboard.cjs.map +1 -0
- package/lib/composables/useKeyboard.d.ts +113 -0
- package/lib/composables/useKeyboardPopup.cjs +120 -0
- package/lib/composables/useKeyboardPopup.cjs.map +1 -0
- package/lib/composables/useKeyboardPopup.d.ts +73 -0
- package/lib/directives/index.cjs +13 -0
- package/lib/directives/index.d.ts +6 -0
- package/lib/directives/v-keyboard.cjs +66 -0
- package/lib/directives/v-keyboard.cjs.map +1 -0
- package/lib/directives/v-keyboard.d.ts +36 -0
- package/lib/index.cjs +537 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.ts +42 -0
- package/lib/package.json +3 -0
- package/lib/plugins/engine-plugin.cjs +37 -0
- package/lib/plugins/engine-plugin.cjs.map +1 -0
- package/lib/plugins/engine-plugin.d.ts +37 -0
- package/lib/plugins/index.cjs +13 -0
- package/lib/plugins/index.d.ts +6 -0
- package/lib/style/css.js +1 -0
- package/lib/style/index.css +2 -0
- package/lib/style/index.js +1 -0
- package/lib/styles/index.css +229 -0
- package/lib/styles/keyboard.css +346 -0
- package/lib/styles/themes.css +213 -0
- package/package.json +141 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LDesign Keyboard - 核心样式
|
|
3
|
+
* 简洁现代的默认主题
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* ====================
|
|
7
|
+
CSS 变量 - 简洁主题
|
|
8
|
+
==================== */
|
|
9
|
+
:root {
|
|
10
|
+
/* 键盘背景 */
|
|
11
|
+
--keyboard-bg: #f7f7f7;
|
|
12
|
+
|
|
13
|
+
/* 普通按键 */
|
|
14
|
+
--keyboard-key-bg: #ffffff;
|
|
15
|
+
--keyboard-key-color: #333333;
|
|
16
|
+
--keyboard-key-active-bg: #e5e5e5;
|
|
17
|
+
--keyboard-key-border: #e0e0e0;
|
|
18
|
+
|
|
19
|
+
/* 功能键 */
|
|
20
|
+
--keyboard-fn-bg: #e8e8e8;
|
|
21
|
+
--keyboard-fn-color: #666666;
|
|
22
|
+
--keyboard-fn-active-bg: #d8d8d8;
|
|
23
|
+
|
|
24
|
+
/* 主色调按键 */
|
|
25
|
+
--keyboard-primary-bg: #2563eb;
|
|
26
|
+
--keyboard-primary-active-bg: #1d4ed8;
|
|
27
|
+
--keyboard-primary-color: #ffffff;
|
|
28
|
+
|
|
29
|
+
/* 按键尺寸 */
|
|
30
|
+
--keyboard-key-height: 48px;
|
|
31
|
+
--keyboard-key-radius: 8px;
|
|
32
|
+
--keyboard-key-gap: 6px;
|
|
33
|
+
|
|
34
|
+
/* 字体 */
|
|
35
|
+
--keyboard-font-size: 20px;
|
|
36
|
+
--keyboard-fn-font-size: 14px;
|
|
37
|
+
|
|
38
|
+
/* 动画 */
|
|
39
|
+
--keyboard-transition: 80ms ease-out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* ====================
|
|
43
|
+
基础重置
|
|
44
|
+
==================== */
|
|
45
|
+
.virtual-keyboard,
|
|
46
|
+
.virtual-keyboard *,
|
|
47
|
+
.keyboard-popup,
|
|
48
|
+
.keyboard-popup * {
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.virtual-keyboard {
|
|
55
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
56
|
+
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
|
57
|
+
-webkit-font-smoothing: antialiased;
|
|
58
|
+
-moz-osx-font-smoothing: grayscale;
|
|
59
|
+
-webkit-touch-callout: none;
|
|
60
|
+
-webkit-user-select: none;
|
|
61
|
+
user-select: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* ====================
|
|
65
|
+
键盘容器
|
|
66
|
+
==================== */
|
|
67
|
+
.virtual-keyboard {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
padding: 8px;
|
|
71
|
+
background-color: var(--keyboard-bg);
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.virtual-keyboard__row {
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
width: 100%;
|
|
79
|
+
gap: var(--keyboard-key-gap);
|
|
80
|
+
margin-bottom: var(--keyboard-key-gap);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.virtual-keyboard__row:last-child {
|
|
84
|
+
margin-bottom: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* ====================
|
|
88
|
+
按键基础样式
|
|
89
|
+
==================== */
|
|
90
|
+
.keyboard-key {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
flex: 1;
|
|
95
|
+
height: var(--keyboard-key-height);
|
|
96
|
+
min-width: 0;
|
|
97
|
+
padding: 0 4px;
|
|
98
|
+
border: none;
|
|
99
|
+
border-radius: var(--keyboard-key-radius);
|
|
100
|
+
background-color: var(--keyboard-key-bg);
|
|
101
|
+
color: var(--keyboard-key-color);
|
|
102
|
+
font-size: var(--keyboard-font-size);
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
touch-action: manipulation;
|
|
106
|
+
transition: background-color var(--keyboard-transition),
|
|
107
|
+
transform var(--keyboard-transition);
|
|
108
|
+
-webkit-tap-highlight-color: transparent;
|
|
109
|
+
box-shadow: 0 1px 0 var(--keyboard-key-border);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.keyboard-key:active {
|
|
113
|
+
background-color: var(--keyboard-key-active-bg);
|
|
114
|
+
transform: scale(0.98);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.keyboard-key--disabled {
|
|
118
|
+
opacity: 0;
|
|
119
|
+
cursor: default;
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* ====================
|
|
124
|
+
功能键样式
|
|
125
|
+
==================== */
|
|
126
|
+
.keyboard-key--backspace,
|
|
127
|
+
.keyboard-key--shift,
|
|
128
|
+
.keyboard-key--tab,
|
|
129
|
+
.keyboard-key--clear,
|
|
130
|
+
.keyboard-key--close {
|
|
131
|
+
background-color: var(--keyboard-fn-bg);
|
|
132
|
+
color: var(--keyboard-fn-color);
|
|
133
|
+
font-size: var(--keyboard-fn-font-size);
|
|
134
|
+
font-weight: 400;
|
|
135
|
+
box-shadow: 0 1px 0 var(--keyboard-key-border);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.keyboard-key--backspace:active,
|
|
139
|
+
.keyboard-key--shift:active,
|
|
140
|
+
.keyboard-key--tab:active,
|
|
141
|
+
.keyboard-key--clear:active,
|
|
142
|
+
.keyboard-key--close:active {
|
|
143
|
+
background-color: var(--keyboard-fn-active-bg);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Shift 激活状态 */
|
|
147
|
+
.keyboard-key--shift.keyboard-key--active {
|
|
148
|
+
background-color: var(--keyboard-primary-bg);
|
|
149
|
+
color: var(--keyboard-primary-color);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* ====================
|
|
153
|
+
主色按键(完成/确认)
|
|
154
|
+
==================== */
|
|
155
|
+
.keyboard-key--done,
|
|
156
|
+
.keyboard-key--enter {
|
|
157
|
+
background-color: var(--keyboard-primary-bg);
|
|
158
|
+
color: var(--keyboard-primary-color);
|
|
159
|
+
font-size: var(--keyboard-fn-font-size);
|
|
160
|
+
font-weight: 500;
|
|
161
|
+
box-shadow: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.keyboard-key--done:active,
|
|
165
|
+
.keyboard-key--enter:active {
|
|
166
|
+
background-color: var(--keyboard-primary-active-bg);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* ====================
|
|
170
|
+
空格键
|
|
171
|
+
==================== */
|
|
172
|
+
.keyboard-key--space {
|
|
173
|
+
flex: 4;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* ====================
|
|
177
|
+
占位键(透明)
|
|
178
|
+
==================== */
|
|
179
|
+
.key-placeholder {
|
|
180
|
+
background-color: transparent !important;
|
|
181
|
+
box-shadow: none !important;
|
|
182
|
+
cursor: default;
|
|
183
|
+
pointer-events: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* ====================
|
|
187
|
+
数字键盘通用样式
|
|
188
|
+
==================== */
|
|
189
|
+
.numpad-row {
|
|
190
|
+
display: flex;
|
|
191
|
+
gap: var(--keyboard-key-gap);
|
|
192
|
+
width: 100%;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.numpad-row .keyboard-key {
|
|
196
|
+
flex: 1;
|
|
197
|
+
height: 54px;
|
|
198
|
+
font-size: 24px;
|
|
199
|
+
font-weight: 500;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* 数字键 */
|
|
203
|
+
.key-num {
|
|
204
|
+
background-color: var(--keyboard-key-bg);
|
|
205
|
+
color: var(--keyboard-key-color);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* 功能键 */
|
|
209
|
+
.key-numpad-fn {
|
|
210
|
+
background-color: var(--keyboard-fn-bg);
|
|
211
|
+
color: var(--keyboard-fn-color);
|
|
212
|
+
font-size: 14px;
|
|
213
|
+
font-weight: 400;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* 完成键 */
|
|
217
|
+
.key-numpad-done {
|
|
218
|
+
background-color: var(--keyboard-primary-bg);
|
|
219
|
+
color: var(--keyboard-primary-color);
|
|
220
|
+
font-size: 16px;
|
|
221
|
+
font-weight: 500;
|
|
222
|
+
box-shadow: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.key-numpad-done:active {
|
|
226
|
+
background-color: var(--keyboard-primary-active-bg);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* ====================
|
|
230
|
+
车牌键盘样式
|
|
231
|
+
==================== */
|
|
232
|
+
.virtual-keyboard:has(.plate-keyboard-row) {
|
|
233
|
+
min-width: 340px;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.plate-keyboard-row {
|
|
237
|
+
display: flex;
|
|
238
|
+
gap: 3px;
|
|
239
|
+
width: 100%;
|
|
240
|
+
flex-wrap: nowrap;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.plate-keyboard-row .keyboard-key {
|
|
244
|
+
flex: 1 1 0;
|
|
245
|
+
height: 42px;
|
|
246
|
+
min-width: 28px;
|
|
247
|
+
max-width: none;
|
|
248
|
+
padding: 0 2px;
|
|
249
|
+
font-size: 15px;
|
|
250
|
+
font-weight: 500;
|
|
251
|
+
border-radius: 5px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.key-plate-province,
|
|
255
|
+
.key-plate-letter,
|
|
256
|
+
.key-plate-number {
|
|
257
|
+
background-color: var(--keyboard-key-bg);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.key-plate-fn {
|
|
261
|
+
background-color: var(--keyboard-fn-bg);
|
|
262
|
+
font-size: 12px;
|
|
263
|
+
flex: 1.2 1 0 !important;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.key-plate-done {
|
|
267
|
+
background-color: var(--keyboard-primary-bg);
|
|
268
|
+
color: var(--keyboard-primary-color);
|
|
269
|
+
font-size: 13px;
|
|
270
|
+
box-shadow: none;
|
|
271
|
+
flex: 1.5 1 0 !important;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.key-plate-switch {
|
|
275
|
+
background-color: var(--keyboard-fn-bg);
|
|
276
|
+
font-size: 12px;
|
|
277
|
+
flex: 1.3 1 0 !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.key-plate-special {
|
|
281
|
+
background-color: #fef3c7;
|
|
282
|
+
color: #92400e;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* ====================
|
|
286
|
+
弹出层样式
|
|
287
|
+
==================== */
|
|
288
|
+
.keyboard-popup {
|
|
289
|
+
position: fixed;
|
|
290
|
+
z-index: 1000;
|
|
291
|
+
background-color: var(--keyboard-bg);
|
|
292
|
+
overflow: hidden;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.keyboard-popup--desktop {
|
|
296
|
+
border-radius: 12px;
|
|
297
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
|
|
298
|
+
min-width: 300px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.keyboard-popup--mobile {
|
|
302
|
+
position: fixed;
|
|
303
|
+
left: 0;
|
|
304
|
+
right: 0;
|
|
305
|
+
bottom: 0;
|
|
306
|
+
border-radius: 0;
|
|
307
|
+
border-top-left-radius: 12px;
|
|
308
|
+
border-top-right-radius: 12px;
|
|
309
|
+
box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* 安全区域 */
|
|
313
|
+
@supports (padding-bottom: env(safe-area-inset-bottom)) {
|
|
314
|
+
.keyboard-popup--mobile {
|
|
315
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* ====================
|
|
320
|
+
遮罩层
|
|
321
|
+
==================== */
|
|
322
|
+
.keyboard-mask {
|
|
323
|
+
position: fixed;
|
|
324
|
+
inset: 0;
|
|
325
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
326
|
+
z-index: 999;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* ====================
|
|
330
|
+
动画
|
|
331
|
+
==================== */
|
|
332
|
+
.keyboard-mask-enter-active,
|
|
333
|
+
.keyboard-mask-leave-active {
|
|
334
|
+
transition: opacity 0.2s ease;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.keyboard-mask-enter-from,
|
|
338
|
+
.keyboard-mask-leave-to {
|
|
339
|
+
opacity: 0;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.keyboard-fade-enter-active,
|
|
343
|
+
.keyboard-fade-leave-active {
|
|
344
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.keyboard-fade-enter-from,
|
|
348
|
+
.keyboard-fade-leave-to {
|
|
349
|
+
opacity: 0;
|
|
350
|
+
transform: translateY(-4px) scale(0.98);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.keyboard-slide-enter-active,
|
|
354
|
+
.keyboard-slide-leave-active {
|
|
355
|
+
transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.keyboard-slide-enter-from,
|
|
359
|
+
.keyboard-slide-leave-to {
|
|
360
|
+
transform: translateY(100%);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* ====================
|
|
364
|
+
移动端适配
|
|
365
|
+
==================== */
|
|
366
|
+
@media (max-width: 768px) {
|
|
367
|
+
.virtual-keyboard {
|
|
368
|
+
padding: 6px;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.keyboard-key {
|
|
372
|
+
height: 44px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.numpad-row .keyboard-key {
|
|
376
|
+
height: 52px;
|
|
377
|
+
font-size: 22px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.plate-keyboard-row .keyboard-key {
|
|
381
|
+
height: 40px;
|
|
382
|
+
font-size: 15px;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/* ====================
|
|
387
|
+
横屏适配
|
|
388
|
+
==================== */
|
|
389
|
+
@media (orientation: landscape) and (max-height: 500px) {
|
|
390
|
+
.keyboard-key {
|
|
391
|
+
height: 36px;
|
|
392
|
+
font-size: 16px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.numpad-row .keyboard-key {
|
|
396
|
+
height: 42px;
|
|
397
|
+
font-size: 18px;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LDesign Keyboard - 主题预设
|
|
3
|
+
* 简洁 · 现代 · 优雅
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* ====================
|
|
7
|
+
MIUI 主题 - 小米风格(默认)
|
|
8
|
+
==================== */
|
|
9
|
+
[data-theme="miui"],
|
|
10
|
+
.keyboard-theme-miui {
|
|
11
|
+
--keyboard-bg: #f5f5f5;
|
|
12
|
+
--keyboard-key-bg: #ffffff;
|
|
13
|
+
--keyboard-key-color: #1a1a1a;
|
|
14
|
+
--keyboard-key-active-bg: #e8e8e8;
|
|
15
|
+
--keyboard-fn-key-bg: #e0e0e0;
|
|
16
|
+
--keyboard-fn-key-color: #666666;
|
|
17
|
+
--keyboard-fn-key-active-bg: #d0d0d0;
|
|
18
|
+
--keyboard-primary-bg: #ff6700;
|
|
19
|
+
--keyboard-primary-active-bg: #e55d00;
|
|
20
|
+
--keyboard-primary-color: #ffffff;
|
|
21
|
+
--keyboard-key-radius: 8px;
|
|
22
|
+
--keyboard-key-gap: 6px;
|
|
23
|
+
--keyboard-key-height: 46px;
|
|
24
|
+
--keyboard-font-size: 18px;
|
|
25
|
+
--keyboard-fn-font-size: 14px;
|
|
26
|
+
--keyboard-padding: 8px;
|
|
27
|
+
--keyboard-key-shadow: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-theme="miui"] .keyboard-key,
|
|
31
|
+
.keyboard-theme-miui .keyboard-key {
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ====================
|
|
36
|
+
iOS 主题 - 苹果风格
|
|
37
|
+
==================== */
|
|
38
|
+
[data-theme="ios"],
|
|
39
|
+
.keyboard-theme-ios {
|
|
40
|
+
--keyboard-bg: #d1d3d9;
|
|
41
|
+
--keyboard-key-bg: #ffffff;
|
|
42
|
+
--keyboard-key-color: #000000;
|
|
43
|
+
--keyboard-key-active-bg: #c8cad0;
|
|
44
|
+
--keyboard-key-border: #a8aab4;
|
|
45
|
+
--keyboard-fn-key-bg: #adb0b8;
|
|
46
|
+
--keyboard-fn-key-color: #000000;
|
|
47
|
+
--keyboard-fn-key-active-bg: #9ea1a9;
|
|
48
|
+
--keyboard-primary-bg: #007aff;
|
|
49
|
+
--keyboard-primary-active-bg: #0066d6;
|
|
50
|
+
--keyboard-primary-color: #ffffff;
|
|
51
|
+
--keyboard-key-radius: 5px;
|
|
52
|
+
--keyboard-key-gap: 6px;
|
|
53
|
+
--keyboard-key-height: 43px;
|
|
54
|
+
--keyboard-font-size: 23px;
|
|
55
|
+
--keyboard-fn-font-size: 15px;
|
|
56
|
+
--keyboard-padding: 4px;
|
|
57
|
+
--keyboard-key-shadow: 0 1px 0 #a8aab4;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[data-theme="ios"] .keyboard-key,
|
|
61
|
+
.keyboard-theme-ios .keyboard-key {
|
|
62
|
+
font-weight: 400;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-theme="ios"] .keyboard-key:active,
|
|
66
|
+
.keyboard-theme-ios .keyboard-key:active {
|
|
67
|
+
transform: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ====================
|
|
71
|
+
Material 主题 - 质感设计
|
|
72
|
+
==================== */
|
|
73
|
+
[data-theme="material"],
|
|
74
|
+
.keyboard-theme-material {
|
|
75
|
+
--keyboard-bg: #263238;
|
|
76
|
+
--keyboard-key-bg: #37474f;
|
|
77
|
+
--keyboard-key-color: #ffffff;
|
|
78
|
+
--keyboard-key-active-bg: #455a64;
|
|
79
|
+
--keyboard-fn-key-bg: #455a64;
|
|
80
|
+
--keyboard-fn-key-color: #b0bec5;
|
|
81
|
+
--keyboard-fn-key-active-bg: #546e7a;
|
|
82
|
+
--keyboard-primary-bg: #4caf50;
|
|
83
|
+
--keyboard-primary-active-bg: #43a047;
|
|
84
|
+
--keyboard-primary-color: #ffffff;
|
|
85
|
+
--keyboard-key-radius: 4px;
|
|
86
|
+
--keyboard-key-gap: 4px;
|
|
87
|
+
--keyboard-key-height: 48px;
|
|
88
|
+
--keyboard-font-size: 20px;
|
|
89
|
+
--keyboard-fn-font-size: 14px;
|
|
90
|
+
--keyboard-padding: 6px;
|
|
91
|
+
--keyboard-key-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[data-theme="material"] .keyboard-key,
|
|
95
|
+
.keyboard-theme-material .keyboard-key {
|
|
96
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[data-theme="material"] .keyboard-key:active,
|
|
100
|
+
.keyboard-theme-material .keyboard-key:active {
|
|
101
|
+
transform: none;
|
|
102
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ====================
|
|
106
|
+
Minimal 极简主题 - 无边框
|
|
107
|
+
==================== */
|
|
108
|
+
[data-theme="minimal"],
|
|
109
|
+
.keyboard-theme-minimal {
|
|
110
|
+
--keyboard-bg: rgba(250, 250, 250, 0.95);
|
|
111
|
+
--keyboard-key-bg: transparent;
|
|
112
|
+
--keyboard-key-color: #333333;
|
|
113
|
+
--keyboard-key-active-bg: rgba(0, 0, 0, 0.08);
|
|
114
|
+
--keyboard-fn-key-bg: transparent;
|
|
115
|
+
--keyboard-fn-key-color: #888888;
|
|
116
|
+
--keyboard-fn-key-active-bg: rgba(0, 0, 0, 0.08);
|
|
117
|
+
--keyboard-primary-bg: #333333;
|
|
118
|
+
--keyboard-primary-active-bg: #1a1a1a;
|
|
119
|
+
--keyboard-primary-color: #ffffff;
|
|
120
|
+
--keyboard-key-radius: 12px;
|
|
121
|
+
--keyboard-key-gap: 8px;
|
|
122
|
+
--keyboard-key-height: 44px;
|
|
123
|
+
--keyboard-font-size: 17px;
|
|
124
|
+
--keyboard-fn-font-size: 13px;
|
|
125
|
+
--keyboard-padding: 12px;
|
|
126
|
+
--keyboard-key-shadow: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[data-theme="minimal"] .keyboard-key,
|
|
130
|
+
.keyboard-theme-minimal .keyboard-key {
|
|
131
|
+
box-shadow: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[data-theme="minimal"] .keyboard-key:active,
|
|
135
|
+
.keyboard-theme-minimal .keyboard-key:active {
|
|
136
|
+
transform: scale(0.95);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* ====================
|
|
140
|
+
Dark 深色主题
|
|
141
|
+
==================== */
|
|
142
|
+
[data-theme="dark"],
|
|
143
|
+
.keyboard-theme-dark {
|
|
144
|
+
--keyboard-bg: #1c1c1e;
|
|
145
|
+
--keyboard-key-bg: #3a3a3c;
|
|
146
|
+
--keyboard-key-color: #ffffff;
|
|
147
|
+
--keyboard-key-active-bg: #4a4a4c;
|
|
148
|
+
--keyboard-fn-key-bg: #2c2c2e;
|
|
149
|
+
--keyboard-fn-key-color: #ebebf5;
|
|
150
|
+
--keyboard-fn-key-active-bg: #3c3c3e;
|
|
151
|
+
--keyboard-primary-bg: #0a84ff;
|
|
152
|
+
--keyboard-primary-active-bg: #0070e0;
|
|
153
|
+
--keyboard-primary-color: #ffffff;
|
|
154
|
+
--keyboard-key-radius: 8px;
|
|
155
|
+
--keyboard-key-gap: 6px;
|
|
156
|
+
--keyboard-key-height: 45px;
|
|
157
|
+
--keyboard-font-size: 18px;
|
|
158
|
+
--keyboard-fn-font-size: 14px;
|
|
159
|
+
--keyboard-padding: 8px;
|
|
160
|
+
--keyboard-key-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-theme="dark"] .keyboard-key,
|
|
164
|
+
.keyboard-theme-dark .keyboard-key {
|
|
165
|
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* 深色车牌键盘特殊样式 */
|
|
169
|
+
[data-theme="dark"] .key-plate-special,
|
|
170
|
+
.keyboard-theme-dark .key-plate-special {
|
|
171
|
+
background-color: #4a3728;
|
|
172
|
+
color: #fcd34d;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* ====================
|
|
176
|
+
Green 护眼主题
|
|
177
|
+
==================== */
|
|
178
|
+
[data-theme="green"],
|
|
179
|
+
.keyboard-theme-green {
|
|
180
|
+
--keyboard-bg: #e8f5e9;
|
|
181
|
+
--keyboard-key-bg: #ffffff;
|
|
182
|
+
--keyboard-key-color: #2e7d32;
|
|
183
|
+
--keyboard-key-active-bg: #c8e6c9;
|
|
184
|
+
--keyboard-key-border: #a5d6a7;
|
|
185
|
+
--keyboard-fn-bg: #c8e6c9;
|
|
186
|
+
--keyboard-fn-color: #388e3c;
|
|
187
|
+
--keyboard-fn-active-bg: #a5d6a7;
|
|
188
|
+
--keyboard-primary-bg: #43a047;
|
|
189
|
+
--keyboard-primary-active-bg: #388e3c;
|
|
190
|
+
--keyboard-primary-color: #ffffff;
|
|
191
|
+
--keyboard-key-radius: 8px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ====================
|
|
195
|
+
Blue 蓝色主题
|
|
196
|
+
==================== */
|
|
197
|
+
[data-theme="blue"],
|
|
198
|
+
.keyboard-theme-blue {
|
|
199
|
+
--keyboard-bg: #e3f2fd;
|
|
200
|
+
--keyboard-key-bg: #ffffff;
|
|
201
|
+
--keyboard-key-color: #1565c0;
|
|
202
|
+
--keyboard-key-active-bg: #bbdefb;
|
|
203
|
+
--keyboard-key-border: #90caf9;
|
|
204
|
+
--keyboard-fn-bg: #bbdefb;
|
|
205
|
+
--keyboard-fn-color: #1976d2;
|
|
206
|
+
--keyboard-fn-active-bg: #90caf9;
|
|
207
|
+
--keyboard-primary-bg: #1976d2;
|
|
208
|
+
--keyboard-primary-active-bg: #1565c0;
|
|
209
|
+
--keyboard-primary-color: #ffffff;
|
|
210
|
+
--keyboard-key-radius: 8px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* ====================
|
|
214
|
+
主题工具类
|
|
215
|
+
==================== */
|
|
216
|
+
.keyboard-theme-light {
|
|
217
|
+
color-scheme: light;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.keyboard-theme-dark {
|
|
221
|
+
color-scheme: dark;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* 平滑主题切换 */
|
|
225
|
+
.keyboard-popup,
|
|
226
|
+
.virtual-keyboard {
|
|
227
|
+
transition: background-color 0.2s ease;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.keyboard-key {
|
|
231
|
+
transition: background-color var(--keyboard-transition) ease,
|
|
232
|
+
transform var(--keyboard-transition) ease;
|
|
233
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperties(exports, {
|
|
11
|
+
__esModule: { value: true },
|
|
12
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
13
|
+
});
|
|
14
|
+
const require_KeyboardKey_vue_vue_type_script_setup_true_lang = require("./KeyboardKey.vue_vue_type_script_setup_true_lang.cjs");
|
|
15
|
+
//#region src/components/KeyboardKey.vue
|
|
16
|
+
require_KeyboardKey_vue_vue_type_script_setup_true_lang.default.__file = "src/components/KeyboardKey.vue";
|
|
17
|
+
var KeyboardKey_default = require_KeyboardKey_vue_vue_type_script_setup_true_lang.default;
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.default = KeyboardKey_default;
|
|
20
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
21
|
+
//# sourceMappingURL=KeyboardKey.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardKey.cjs","names":[],"sources":["../../src/components/KeyboardKey.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport type { KeyDefinition } from '@composy/keyboard-core'\n\nconst props = defineProps<{\n /**\n * 按键定义\n */\n keyDef: KeyDefinition\n /**\n * 是否大写状态\n */\n isUpperCase?: boolean\n /**\n * 基础宽度(px)\n */\n baseWidth?: number\n /**\n * 是否使用 flex 布局(用于 numpad 等需要均分宽度的键盘)\n */\n useFlex?: boolean\n}>()\n\nconst emit = defineEmits<{\n press: [key: KeyDefinition]\n showOptions: [options: string[]]\n}>()\n\n/**\n * 获取显示文本\n */\nconst label = computed(() => {\n const keyLabel = props.keyDef.label\n if (typeof keyLabel === 'string') {\n return keyLabel\n }\n return props.isUpperCase ? keyLabel.upper : keyLabel.lower\n})\n\n/**\n * 计算按键宽度\n */\nconst keyWidth = computed(() => {\n // 使用 flex 布局时,不设置固定宽度\n if (props.useFlex) {\n return undefined\n }\n const base = props.baseWidth ?? 36\n const width = props.keyDef.width ?? 1\n const gap = 6\n return `${base * width + (width - 1) * gap}px`\n})\n\n/**\n * 计算按键的 flex 值(用于 numpad 布局)\n */\nconst keyFlex = computed(() => {\n if (!props.useFlex) {\n return undefined\n }\n // width 属性决定占几份\n return props.keyDef.width ?? 1\n})\n\n/**\n * 计算 CSS 类\n */\nconst keyClass = computed(() => {\n const classes = ['keyboard-key', `keyboard-key--${props.keyDef.type}`]\n\n if (props.keyDef.className) {\n classes.push(props.keyDef.className)\n }\n\n if (props.keyDef.disabled) {\n classes.push('keyboard-key--disabled')\n }\n\n // Shift 键激活状态\n if (props.keyDef.type === 'shift' && props.isUpperCase) {\n classes.push('keyboard-key--active')\n }\n\n return classes\n})\n\n/**\n * 是否有下拉选项\n */\nconst hasOptions = computed(() => {\n return props.keyDef.options && props.keyDef.options.length > 0\n})\n\n/**\n * 是否是纯选项按钮(有options但无value,点击只显示选项面板)\n */\nconst isOptionsOnly = computed(() => {\n return hasOptions.value && !props.keyDef.value\n})\n\n/**\n * 处理按键点击\n */\nconst handlePress = (event: MouseEvent | TouchEvent) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (props.keyDef.disabled) {\n return\n }\n\n // 纯选项按钮:点击直接显示选项面板\n if (isOptionsOnly.value) {\n emit('showOptions', props.keyDef.options!)\n return\n }\n\n // 正常按键:触发按键事件\n emit('press', props.keyDef)\n}\n\n/**\n * 处理下拉箭头点击(显示选项面板)\n */\nconst handleArrowClick = (event: MouseEvent | TouchEvent) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (props.keyDef.disabled) {\n return\n }\n\n if (hasOptions.value) {\n emit('showOptions', props.keyDef.options!)\n }\n}\n</script>\n\n<template>\n <div class=\"keyboard-key-wrapper\" :style=\"{ width: keyWidth, flex: keyFlex }\">\n <button\n :class=\"[keyClass, { 'has-options': hasOptions && !isOptionsOnly, 'is-options-only': isOptionsOnly }]\"\n :disabled=\"keyDef.disabled\"\n type=\"button\"\n @mousedown.prevent=\"handlePress\"\n @touchstart.prevent=\"handlePress\"\n >\n <!-- SVG 图标支持 -->\n <span v-if=\"keyDef.icon\" class=\"keyboard-key__icon\" v-html=\"keyDef.icon\"></span>\n <span v-else class=\"keyboard-key__label\">{{ label }}</span>\n <!-- 纯选项按钮内嵌下拉箭头 -->\n <span v-if=\"isOptionsOnly\" class=\"keyboard-key__arrow-inline\">▼</span>\n </button>\n <!-- 有value又有options的按钮:单独可点击的下拉箭头 -->\n <span\n v-if=\"hasOptions && !isOptionsOnly\"\n class=\"keyboard-key__arrow\"\n @mousedown.prevent=\"handleArrowClick\"\n @touchstart.prevent=\"handleArrowClick\"\n >▼</span>\n </div>\n</template>\n\n<style>\n.keyboard-key-wrapper {\n position: relative;\n display: inline-flex;\n}\n\n.keyboard-key {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: var(--keyboard-key-height, 42px);\n min-width: 32px;\n width: 100%;\n padding: 0 6px;\n border: none;\n border-radius: var(--keyboard-key-radius, 6px);\n background-color: var(--keyboard-key-bg, #fff);\n color: var(--keyboard-key-color, #333);\n font-size: var(--keyboard-font-size, 16px);\n font-weight: 500;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n box-shadow: var(--keyboard-key-shadow, 0 1px 3px rgba(0, 0, 0, 0.1));\n transition: background-color 0.1s, transform 0.1s;\n}\n\n.keyboard-key.has-options {\n padding-right: 16px;\n}\n\n.keyboard-key:active {\n background-color: var(--keyboard-key-active-bg, #e0e0e0);\n transform: scale(0.95);\n}\n\n.keyboard-key--disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.keyboard-key--disabled:active {\n transform: none;\n background-color: var(--keyboard-key-bg, #fff);\n}\n\n/* 功能键样式 */\n.keyboard-key--backspace,\n.keyboard-key--shift,\n.keyboard-key--tab,\n.keyboard-key--clear,\n.keyboard-key--close {\n background-color: var(--keyboard-fn-key-bg, #d4d6dc);\n color: var(--keyboard-fn-key-color, #333);\n font-size: var(--keyboard-fn-font-size, 14px);\n}\n\n.keyboard-key--backspace:active,\n.keyboard-key--shift:active,\n.keyboard-key--tab:active,\n.keyboard-key--clear:active,\n.keyboard-key--close:active {\n background-color: var(--keyboard-fn-key-active-bg, #b8bac0);\n}\n\n/* Shift 激活状态 */\n.keyboard-key--active {\n background-color: var(--keyboard-key-active-bg, #007aff) !important;\n color: #fff !important;\n}\n\n/* 完成/确认键 */\n.keyboard-key--done,\n.keyboard-key--enter {\n background-color: var(--keyboard-primary-bg, #007aff);\n color: var(--keyboard-primary-color, #fff);\n font-size: var(--keyboard-fn-font-size, 14px);\n font-weight: 600;\n}\n\n.keyboard-key--done:active,\n.keyboard-key--enter:active {\n background-color: var(--keyboard-primary-active-bg, #0062cc);\n}\n\n/* 空格键 */\n.keyboard-key--space {\n background-color: var(--keyboard-key-bg, #fff);\n}\n\n.keyboard-key__icon {\n pointer-events: none;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.keyboard-key__icon svg {\n width: 1em;\n height: 1em;\n}\n\n.keyboard-key__label {\n pointer-events: none;\n line-height: 1;\n}\n\n.keyboard-key__arrow {\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n width: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 8px;\n opacity: 0.5;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n border-radius: 0 6px 6px 0;\n}\n\n.keyboard-key__arrow:active {\n background-color: rgba(0, 0, 0, 0.1);\n opacity: 1;\n}\n\n/* 纯选项按钮内嵌箭头 */\n.keyboard-key__arrow-inline {\n margin-left: 4px;\n font-size: 8px;\n opacity: 0.6;\n pointer-events: none;\n}\n\n/* 纯选项按钮样式 */\n.keyboard-key.is-options-only {\n font-size: 13px;\n background-color: var(--keyboard-fn-key-bg, #d4d6dc);\n}\n</style>\n"],"mappings":""}
|