sykj 0.1.9 → 0.2.0

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.
Files changed (34) hide show
  1. package/README.md +10 -10
  2. package/lib/common.ts +29 -12
  3. package/main/index.ts +1 -1
  4. package/main/utils/withInstall.ts +10 -0
  5. package/package.json +67 -54
  6. package/packages/button/index.ts +5 -0
  7. package/packages/button/src/index.vue +138 -0
  8. package/packages/dialog/index.ts +5 -0
  9. package/packages/dialog/src/index.vue +142 -0
  10. package/packages/keyboard/index.ts +11 -6
  11. package/packages/keyboard/src/Keyboardcon.vue +464 -401
  12. package/packages/keyboard/src/theme.scss +2 -2
  13. package/packages/keyboard/src/utils/focus.ts +34 -0
  14. package/packages/keyboard/src/utils/store.ts +19 -0
  15. package/packages/loading/index.ts +5 -12
  16. package/packages/loading/{Loading1.vue → src/Loading1.vue} +2 -2
  17. package/packages/loading/{Loading2.vue → src/Loading2.vue} +6 -6
  18. package/packages/loading/src/index.vue +38 -0
  19. package/packages/message/index.ts +128 -0
  20. package/packages/message/src/index.vue +177 -0
  21. package/packages/message-box/index.ts +59 -0
  22. package/packages/message-box/src/assets/error.png +0 -0
  23. package/packages/message-box/src/assets/error.svg +3 -0
  24. package/packages/message-box/src/assets/tip.png +0 -0
  25. package/packages/message-box/src/assets/tip.svg +3 -0
  26. package/packages/message-box/src/assets/warning.png +0 -0
  27. package/packages/message-box/src/assets/warning.svg +3 -0
  28. package/packages/message-box/src/index.vue +195 -0
  29. package/types/component.d.ts +9 -3
  30. package/types/global.d.ts +3 -3
  31. package/types/index.d.ts +1 -1
  32. package/lib/focus.ts +0 -36
  33. package/lib/store.ts +0 -5
  34. package/packages/loading/index.vue +0 -39
@@ -2,12 +2,11 @@
2
2
  <div
3
3
  @pointerdown.prevent
4
4
  @click="makeFocus"
5
- class="keyboardcon defaultCss"
5
+ class="sy-keyboard keyboardcon defaultCss"
6
6
  :class="[
7
7
  keyStore.keyboardcon ? 'show' : '',
8
- toUpKeyCase ? 'upKeyCase' : '',
8
+ toUpKeyCase ? 'upKeyCase' : ''
9
9
  ]"
10
- @contextmenu.prevent="makeFocus"
11
10
  >
12
11
  <!-- 中文拼音列表 -->
13
12
  <div class="chinese">
@@ -30,8 +29,9 @@
30
29
  @click="chineseCli(item)"
31
30
  v-for="(item, index) in cn_list_str"
32
31
  :key="index"
33
- >{{ item }}</span
34
32
  >
33
+ {{ item }}
34
+ </span>
35
35
  </div>
36
36
  <div class="moreText" @click="moreTextCli">
37
37
  <el-icon
@@ -48,26 +48,22 @@
48
48
  @touchmove.stop.prevent
49
49
  v-show="keyStore.inputType == 'number'"
50
50
  >
51
- <div class="key_item" v-for="(item, index) in lists" :key="item">
51
+ <div class="key_item" v-for="(item, index) in lists" :key="index">
52
52
  <div
53
53
  class="key"
54
- @click.stop="choosekey(item, index)"
54
+ @click.stop="choosekey(item)"
55
55
  v-if="!Array.isArray(item) && index < 11"
56
56
  >
57
57
  <span>{{ item }}</span>
58
58
  </div>
59
59
  <div class="keys" v-else-if="index < 11">
60
- <span @click.stop="choosekey(item[0], index)">{{
61
- item[0]
62
- }}</span>
63
- <span @click.stop="choosekey(item[1], index)">{{
64
- item[1]
65
- }}</span>
60
+ <span @click.stop="choosekey(item[0])">{{ item[0] }}</span>
61
+ <span @click.stop="choosekey(item[1])">{{ item[1] }}</span>
66
62
  </div>
67
63
  <div
68
64
  class="key del"
69
- @click.stop="choosekey(item, index)"
70
- v-if="index == '11'"
65
+ @click.stop="choosekey(item[0])"
66
+ v-if="index == 11"
71
67
  >
72
68
  <img src="./static/key/del.svg" alt="" />
73
69
  </div>
@@ -77,7 +73,8 @@
77
73
  <div
78
74
  class="text_list"
79
75
  :class="[isSymbol ? 'isSymbol' : '']"
80
- @touchmove.stop.prevent
76
+ @touchmove="handleTouchMove"
77
+ @touchend="handleTouchEnd"
81
78
  v-show="keyStore.inputType != 'number'"
82
79
  ref="pressArea"
83
80
  >
@@ -92,10 +89,10 @@
92
89
  @touchend="endPress"
93
90
  @touchcancel="cancelPress"
94
91
  v-for="(item1, index1) in item"
95
- @click.stop="choosekey(item1, index1)"
92
+ @click.stop="choosekey(item1)"
96
93
  :key="item1"
97
94
  >
98
- <div class="key" v-if="item1.length == 1">
95
+ <div class="key" v-if="String(item1).length == 1">
99
96
  <span>{{ item1 }}</span>
100
97
  </div>
101
98
  <div
@@ -128,9 +125,11 @@
128
125
  src="./static/key/enter.svg"
129
126
  alt=""
130
127
  />
131
- <span v-else-if="item1.length > 1" :class="item1">{{
132
- item1
133
- }}</span>
128
+ <span
129
+ v-else-if="String(item1).length > 1"
130
+ :class="item1"
131
+ >{{ item1 }}</span
132
+ >
134
133
  <span v-else :class="item1">{{ item1 }}</span>
135
134
  </div>
136
135
  </div>
@@ -139,632 +138,680 @@
139
138
  <!-- 中英文切换 -->
140
139
  <div class="btns" @touchmove.stop.prevent>
141
140
  <div v-show="keyStore.showCheckChinese" @click="checkChinese">
142
- <!-- <el-icon><Switch /></el-icon -->
143
141
  <span :class="keyStore.isChinese ? 'ch' : ''">中</span>/<span
144
142
  :class="keyStore.isChinese ? '' : 'ch'"
145
- >英</span
146
143
  >
144
+ 英
145
+ </span>
147
146
  </div>
148
147
  <span @click.stop>确认</span>
149
148
  </div>
150
- <!-- <div class="symbol_list" v-show="keyStore.inputType == 'symbol'"></div> -->
151
149
  </div>
152
150
  </template>
153
151
 
154
- <script>
155
- export default {
156
- name: "SyKeyboard",
157
- };
158
- </script>
159
-
160
- <script setup>
161
- import { onMounted, reactive, ref, onBeforeUnmount, watchEffect } from "vue";
152
+ <script setup lang="ts">
153
+ import { reactive, ref, watchEffect } from 'vue'
154
+ import keyboard from './utils/store'
162
155
 
163
156
  //#region init ------------------------------------------------------------
164
- const globalKey = window.globalThis.$sy.key;
157
+ const globalKey = keyboard
165
158
  const keyStore = reactive({
166
159
  keyboardcon: false,
167
160
  currentElement: null,
168
- inputType: true ? "text" : "number",
161
+ inputType: true ? 'text' : 'number',
169
162
  showCheckChinese: !false, //是否展示中文输入切换
170
- isChinese: false,
171
- });
172
- const isSymbol = ref(false);
173
- //#endregion -----------------------------------------------------------
174
-
175
- //#region old ------------------------------------------------------------
163
+ isChinese: !false
164
+ })
165
+ const isSymbol = ref(false)
166
+ const showMore = ref(false)
167
+ const huanhang = ref(false)
168
+ let lists = ref<(string | number)[][]>([])
169
+ // let active = ref(1)
170
+ let toUpKeyCase = ref(false)
171
+ const cn_input = ref<string>('')
172
+ const cn_list_str = ref([])
173
+ const l_min = ref(0)
174
+ const l_max = ref(10)
175
+ const cursorPosition = ref<number>(-1)
176
+ const pressTimer = ref<ReturnType<typeof setTimeout>>()
177
+ const pressArea = ref(null)
178
+ const longpressSt = ref<ReturnType<typeof setTimeout>>()
179
+ const lastElement = ref<HTMLElement | null>(null)
180
+
181
+ // const numberKeyBoradMap = [1, 2, 3, 4, 5, 6, 7, 8, 9, ['.', ':'], 0, 'del']
182
+ const textKeyMap = [
183
+ ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],
184
+ ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'],
185
+ ['shift', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'del'],
186
+ ['&123', 'space', 'enter']
187
+ ]
188
+ const symbolMap1 = [
189
+ [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
190
+ ['-', '/', ':', ';', '(', ')', '$', '&', '@', '"'],
191
+ ['#+=', '.', ',', '?', '!', "'", 'del'],
192
+ ['ABC', 'space', 'enter']
193
+ ]
194
+ const symbolMap2 = [
195
+ ['[', ']', '{', '}', '#', '%', '^', '*', '+', '='],
196
+ ['_', '\\', '|', '~', '<', '>', '€', '£', '¥', '·'],
197
+ ['123', '.', ',', '?', '!', "'", 'del'],
198
+ ['ABC', 'space', 'enter']
199
+ ]
200
+ let st: ReturnType<typeof setTimeout>
201
+ let promiseList: Promise<any>[] = []
202
+ let dict: any = {}
203
+ let doubleSpell: any = {}
176
204
 
177
- // const keyStore = useKeyStore()
205
+ //#endregion -----------------------------------------------------------
178
206
 
179
- let st = null;
207
+ // 键盘弹起时,body的padding-bottom设置为30vh
180
208
  watchEffect(() => {
181
209
  if (keyStore.keyboardcon) {
182
- clearTimeout(st);
210
+ clearTimeout(st)
183
211
  // document.body.style = "padding-bottom:30vh;";
184
- document.body.style.paddingBottom = "30vh";
212
+ document.body.style.paddingBottom = '30vh'
185
213
  } else {
186
214
  st = setTimeout(() => {
187
215
  // document.body.style = "padding:0;";
188
- document.body.style.paddingBottom = "0vh";
189
- }, 0);
216
+ document.body.style.paddingBottom = '0vh'
217
+ }, 0)
190
218
  }
191
- });
219
+ })
192
220
 
193
- const numberKeyBoradMap = [1, 2, 3, 4, 5, 6, 7, 8, 9, [".", ":"], 0, "del"];
194
- const textKeyMap = [
195
- ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
196
- ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
197
- ["shift", "z", "x", "c", "v", "b", "n", "m", "del"],
198
- ["&123", "space", "enter"],
199
- ];
221
+ // 滑动输入
222
+ const handleTouchMove = (e: TouchEvent) => {
223
+ e.preventDefault()
224
+ const touch = e.touches[0]
200
225
 
201
- const symbolMap1 = [
202
- [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
203
- ["-", "/", ":", ";", "(", ")", "$", "&", "@", '"'],
204
- ["#+=", ".", ",", "?", "!", "'", "del"],
205
- ["ABC", "space", "enter"],
206
- ];
226
+ if (!touch) return
207
227
 
208
- const symbolMap2 = [
209
- ["[", "]", "{", "}", "#", "%", "^", "*", "+", "="],
210
- ["_", "\\", "|", "~", "<", ">", "€", "£", "¥", "·"],
211
- ["123", ".", ",", "?", "!", "'", "del"],
212
- ["ABC", "space", "enter"],
213
- ];
214
-
215
- const showMore = ref(false);
216
- const huanhang = ref(false);
228
+ const el = document.elementFromPoint(touch.clientX, touch.clientY)
229
+ if (!(el instanceof HTMLElement)) return
230
+
231
+ if (el.classList.contains('key')) {
232
+ if (lastElement.value !== el) {
233
+ // 移除上一次元素的 active
234
+ if (lastElement.value) lastElement.value.classList.remove('active')
235
+
236
+ // 添加当前元素的 active
237
+ el.classList.add('active')
238
+
239
+ // 更新 lastElement
240
+ lastElement.value = el
241
+
242
+ // setInputValue(el.innerText)
243
+ if (keyStore.isChinese && !toUpKeyCase.value) {
244
+ // todo: 滑动查找最匹配的拼音
245
+ chinese(String(el.innerText))
246
+ } else {
247
+ setInputValue(el.innerText)
248
+ }
249
+ }
250
+ } else {
251
+ // 如果滑到空白或非 key 元素,移除上一个 active
252
+ if (lastElement.value) {
253
+ lastElement.value.classList.remove('active')
254
+ lastElement.value = null
255
+ }
256
+ }
257
+ }
258
+
259
+ // 滑动输入去掉最后一个active
260
+ const handleTouchEnd = () => {
261
+ if (lastElement.value) {
262
+ lastElement.value.classList.remove('active')
263
+ lastElement.value = null
264
+ }
265
+ }
266
+ // 更多(中文)
217
267
  const moreTextCli = () => {
218
268
  // keyStore.currentElement.focus();
219
- globalKey.currentElement.focus();
269
+ if (globalKey.currentElement) {
270
+ focusInput()
271
+ }
220
272
 
221
- showMore.value = !showMore.value;
273
+ showMore.value = !showMore.value
222
274
  if (showMore.value) {
223
- huanhang.value = true;
275
+ huanhang.value = true
224
276
  } else {
225
277
  setTimeout(() => {
226
- huanhang.value = false;
227
- }, 500);
278
+ huanhang.value = false
279
+ }, 500)
228
280
  }
229
- };
230
- const chineseCli = (item) => {
231
- // keyStore.currentElement.focus();
232
- globalKey.currentElement.focus();
233
- setInputValue(item);
234
- selectCN(item);
235
- console.log(cn_input.value);
281
+ }
282
+
283
+ // 输入框获取焦点
284
+ const focusInput = () => {
285
+ try {
286
+ ;(globalKey.currentElement as HTMLInputElement)?.focus()
287
+ } catch {}
288
+ }
289
+
290
+ // 选择文字
291
+ const chineseCli = (item: string) => {
292
+ focusInput()
293
+ setInputValue(item)
294
+ selectCN(item)
236
295
  if (!cn_input.value) {
237
- showMore.value = false;
296
+ showMore.value = false
238
297
  }
239
- };
298
+ }
240
299
 
241
- //选择中文
242
- const selectCN = (text) => {
243
- let strList = cn_input.value.split("'");
300
+ //选择文字
301
+ const selectCN = (text: string) => {
302
+ let strList = cn_input.value.split("'")
244
303
  if (strList.length === 1 || text.length >= strList.length) {
245
- cn_input.value = "";
246
- cn_list_str.value = [];
247
- // l_min.value = 0;
248
- // l_max.value = 10;
249
- return;
304
+ cn_input.value = ''
305
+ cn_list_str.value = []
306
+ return
250
307
  }
251
- setCn_input(text);
252
- };
308
+ setCn_input(text)
309
+ }
310
+
253
311
  //设置中文输入
254
- const setCn_input = (text) => {
255
- const singleDict = dict;
256
- let itemList = [];
312
+ const setCn_input = (text: string) => {
313
+ const singleDict: any = dict
314
+ let itemList = []
257
315
  for (let key in singleDict) {
258
- let value = singleDict[key];
259
- if (typeof value === "string") {
260
- let valueList = value.split("");
261
- let item = valueList.find((item) => item === text);
316
+ let value = singleDict[key]
317
+ if (typeof value === 'string') {
318
+ let valueList = value.split('')
319
+ let item = valueList.find((item) => item === text)
262
320
  if (item) {
263
- itemList.push(key);
321
+ itemList.push(key)
264
322
  }
265
323
  }
266
324
  }
267
- let str = "";
268
- const cn_inputList = cn_input.value.split("'");
325
+ let str = ''
326
+ const cn_inputList = cn_input.value.split("'")
269
327
  for (let i = 0; i < cn_inputList.length; i++) {
270
- let item = cn_inputList[i];
328
+ let item = cn_inputList[i]
271
329
  for (let key of itemList) {
272
- let list = key.split("");
273
- let count = 0;
330
+ let list = key.split('')
331
+ let count = 0
274
332
  for (let k = 0; k < list.length; k++) {
275
333
  if (key.charAt(k) === item.charAt(k)) {
276
- count += 1;
334
+ count += 1
277
335
  if (
278
336
  k === 0 &&
279
337
  item.length != key.length &&
280
338
  key.length > item.length
281
339
  ) {
282
340
  // 用于处理首单词缩写法
283
- str = item;
341
+ str = item
284
342
  }
285
343
  }
286
344
  if (count === list.length) {
287
- str = item;
345
+ str = item
288
346
  }
289
347
  }
290
348
  }
291
349
  }
292
- cn_input.value = cn_inputList.filter((item) => item != str).join("'");
293
- findChinese();
294
- };
295
-
296
- let lists = ref([]);
297
- let active = ref(1);
298
-
299
- let toUpKeyCase = ref(false);
350
+ cn_input.value = cn_inputList.filter((item) => item != str).join("'")
351
+ findChinese()
352
+ }
300
353
 
301
- const choosekey = (item) => {
302
- try {
303
- // keyStore.currentElement.focus();
304
- globalKey.currentElement.focus();
305
- } catch (error) {}
354
+ // 键盘点击
355
+ const choosekey = (item: string | number) => {
356
+ focusInput()
306
357
 
307
358
  switch (item) {
308
- case "del":
359
+ case 'del':
309
360
  if (keyStore.isChinese && cn_input.value?.length) {
310
361
  // 处理拼音删除
311
- delPinyin();
362
+ delPinyin()
312
363
  } else {
313
364
  // 普通删除
314
- delInputText();
365
+ delInputText()
315
366
  }
316
-
317
- break;
318
- case "shift":
319
- toUpKeyCase.value = !toUpKeyCase.value;
367
+ break
368
+ case 'shift':
369
+ toUpKeyCase.value = !toUpKeyCase.value
320
370
  lists.value = lists.value.map((i) => {
321
371
  i = i.map((j) => {
322
- if (j.length == 1) {
323
- if (toUpKeyCase.value) return j.toUpperCase();
324
- else return j.toLowerCase();
372
+ if (typeof j === 'string' && j.length == 1) {
373
+ if (toUpKeyCase.value) return j.toUpperCase()
374
+ else return j.toLowerCase()
325
375
  } else {
326
- return j;
376
+ return j
327
377
  }
328
- });
329
- return i;
330
- });
331
- break;
332
- case "space":
378
+ })
379
+ return i
380
+ })
381
+ break
382
+ case 'space':
333
383
  // keyStore.currentElement.value += " ";
334
- setInputValue(" ");
335
- break;
336
- case "&123":
337
- lists.value = symbolMap1;
338
- toUpKeyCase.value = false;
339
- isSymbol.value = true;
340
-
341
- break;
342
- case "ABC":
343
- lists.value = textKeyMap;
344
- isSymbol.value = false;
345
- break;
346
- case "#+=":
347
- lists.value = symbolMap2;
348
- break;
349
- case "123":
350
- lists.value = symbolMap1;
351
-
352
- break;
353
- case "enter":
384
+ setInputValue(' ')
385
+ break
386
+ case '&123':
387
+ lists.value = symbolMap1
388
+ toUpKeyCase.value = false
389
+ isSymbol.value = true
390
+
391
+ break
392
+ case 'ABC':
393
+ lists.value = textKeyMap
394
+ isSymbol.value = false
395
+ break
396
+ case '#+=':
397
+ lists.value = symbolMap2
398
+ break
399
+ case '123':
400
+ lists.value = symbolMap1
401
+
402
+ break
403
+ case 'enter':
354
404
  // keyStore.currentElement.value += "\n";
355
- globalKey.currentElement.value += "\n";
356
- if (globalKey.currentElement.getAttribute("enter") !== null) {
357
- globalKey.currentElement.blur();
405
+ // globalKey.currentElement.value += '\n'
406
+ setInputValue('\n')
407
+
408
+ if (
409
+ (globalKey.currentElement as HTMLInputElement)?.getAttribute(
410
+ 'enter'
411
+ ) !== null
412
+ ) {
413
+ ;(globalKey.currentElement as HTMLInputElement)?.blur()
358
414
  }
359
415
 
360
416
  // triggerKeyPress("Enter");
361
- break;
417
+ break
362
418
  default:
363
419
  if (keyStore.isChinese && !toUpKeyCase.value) {
364
- chinese(item);
420
+ chinese(String(item))
365
421
  } else {
366
- setInputValue(item);
422
+ setInputValue(item)
367
423
  }
368
424
 
369
- break;
425
+ break
370
426
  }
371
- };
427
+ }
372
428
 
373
429
  /**删除字符串的某个字符*/
374
- const delStringLast = (text, index) => {
375
- if (index < 0) return;
376
- let arrText = text.split("");
430
+ const delStringLast = (text: string, index: number) => {
431
+ if (index < 0) return ''
432
+ let arrText = text.split('')
377
433
  if (index > 0) {
378
- arrText[index - 1] = "";
434
+ arrText[index - 1] = ''
379
435
  } else {
380
- arrText[index] = "";
436
+ arrText[index] = ''
381
437
  }
382
438
 
383
- arrText = arrText.filter((item) => item);
384
- const endIndex = arrText.length - 1;
439
+ arrText = arrText.filter((item) => item)
440
+ const endIndex = arrText.length - 1
385
441
  if (arrText[endIndex] === "'") {
386
- arrText[endIndex] = "";
442
+ arrText[endIndex] = ''
387
443
  }
388
- let result = arrText.join("");
444
+ let result = arrText.join('') || ''
389
445
 
390
- return result;
391
- };
446
+ return result
447
+ }
392
448
  // 拼音删除
393
449
  const delPinyin = () => {
394
- cn_input.value = delStringLast(cn_input.value, cn_input.value.length);
395
- if (cn_input.value === "") {
396
- cn_list_str.value = [];
397
- return;
450
+ cn_input.value = delStringLast(cn_input.value, cn_input.value.length)
451
+ if (cn_input.value === '') {
452
+ cn_list_str.value = []
453
+ return
398
454
  }
399
- const specialPinYin = ["u", "v", "i"].includes(cn_input.value.split("")[0]);
455
+ const specialPinYin = ['u', 'v', 'i'].includes(cn_input.value.split('')[0])
400
456
  if (cn_list_str.value && cn_list_str.value.length === 1 && specialPinYin) {
401
457
  //@ts-ignore
402
- cn_list_str.value = [cn_input.value];
403
- return;
458
+ cn_list_str.value = [cn_input.value]
459
+ return
404
460
  }
405
- let re = new RegExp(`^${cn_input.value}\\w*`);
461
+ let re = new RegExp(`^${cn_input.value}\\w*`)
406
462
  let keys = Object.keys(dict)
407
463
  .filter((key) => {
408
- const result = re.test(key);
409
- return result;
464
+ const result = re.test(key)
465
+ return result
410
466
  })
411
- .sort();
467
+ .sort()
412
468
 
413
469
  cn_list_str.value =
414
470
  (keys.length > 1
415
- ? keys.reduce((a, b) => a + dict[b], "")
416
- : dict[keys[0]]) || "".split("");
471
+ ? keys.reduce((a, b) => a + dict[b], '')
472
+ : dict[keys[0]]) || ''.split('')
417
473
 
418
- findChinese("del");
419
- };
474
+ findChinese('del')
475
+ }
420
476
 
421
477
  // 普通删除字符
422
478
  const delInputText = () => {
423
479
  // let carePos = getCaretPosition(keyStore.currentElement);
424
- let carePos = getCaretPosition(globalKey.currentElement);
425
- // let text = keyStore.currentElement.value;
426
- let text = globalKey.currentElement.value;
480
+ let carePos = 0
481
+ let text = ''
482
+ if (
483
+ globalKey.currentElement &&
484
+ (globalKey.currentElement instanceof HTMLInputElement ||
485
+ globalKey.currentElement instanceof HTMLTextAreaElement)
486
+ ) {
487
+ carePos = getCaretPosition(globalKey.currentElement)
488
+ text = globalKey.currentElement.value
489
+ }
427
490
  if (carePos <= 0 || carePos > text.length) {
428
491
  // keyStore.currentElement.value = text;
429
- globalKey.currentElement.value = text;
492
+ ;(globalKey.currentElement as HTMLInputElement).value = text
430
493
  } else {
431
494
  // keyStore.currentElement.value =
432
495
  // text.slice(0, carePos - 1) + text.slice(carePos);
433
- globalKey.currentElement.value =
434
- text.slice(0, carePos - 1) + text.slice(carePos);
496
+ ;(globalKey.currentElement as HTMLInputElement).value =
497
+ text.slice(0, carePos - 1) + text.slice(carePos)
435
498
  }
436
499
  // keyStore.currentElement.setSelectionRange(carePos - 1, carePos - 1);
437
- globalKey.currentElement.setSelectionRange(carePos - 1, carePos - 1);
438
- triggerModel();
439
- };
500
+ ;(globalKey.currentElement as HTMLInputElement).setSelectionRange(
501
+ carePos - 1,
502
+ carePos - 1
503
+ )
504
+ triggerModel()
505
+ }
440
506
 
441
507
  // 输入内容
442
- const setInputValue = (item) => {
443
- item = `${item}`;
444
- // let carePos = getCaretPosition(keyStore.currentElement);
445
- let carePos = getCaretPosition(globalKey.currentElement);
446
-
447
- // let text = keyStore.currentElement.value;
448
- let text = globalKey.currentElement.value;
449
-
508
+ const setInputValue = (item: string | number) => {
509
+ // item = `${item}`
510
+ let carePos = 0
511
+ let text = ''
512
+ if (
513
+ globalKey.currentElement &&
514
+ (globalKey.currentElement instanceof HTMLInputElement ||
515
+ globalKey.currentElement instanceof HTMLTextAreaElement)
516
+ ) {
517
+ carePos = getCaretPosition(globalKey.currentElement)
518
+ text = globalKey.currentElement.value
519
+ }
450
520
  if (carePos <= 0) {
451
- text = item + text;
521
+ text = item + text
452
522
  } else if (carePos > text.length) {
453
- text = text + item;
523
+ text = text + item
454
524
  } else {
455
- text = text.slice(0, carePos) + item + text.slice(carePos);
525
+ text = text.slice(0, carePos) + item + text.slice(carePos)
456
526
  }
527
+ ;(globalKey.currentElement as HTMLInputElement).value = text
528
+ carePos += String(item).length + 1
529
+ ;(globalKey.currentElement as HTMLInputElement).setSelectionRange(
530
+ carePos - 1,
531
+ carePos - 1
532
+ )
533
+ triggerModel()
534
+ }
457
535
 
458
- // if (toUpKeyCase.value) {
459
- // // keyStore.currentElement.value = `${text}`.toUpperCase();
460
- // globalKey.currentElement.value = `${text}`.toUpperCase();
461
- // } else {
462
- // // keyStore.currentElement.value = text;
463
- // globalKey.currentElement.value = text;
464
- // }
465
- globalKey.currentElement.value = text;
466
- carePos += item.length + 1;
467
-
468
- // keyStore.currentElement.setSelectionRange(carePos - 1, carePos - 1);
469
- globalKey.currentElement.setSelectionRange(carePos - 1, carePos - 1);
470
- triggerModel();
471
- // const reg = /^[a-zA-Z]$/;
472
- // if (toUpKeyCase.value && reg.test(item)) {
473
- // keyStore.currentElement.value += item.toUpperCase();
474
- // } else {
475
- // keyStore.currentElement.value += item;
476
- // }
477
- };
478
-
479
- const cn_input = ref("");
480
- const cn_list_str = ref([]);
481
- const l_min = ref(0);
482
- const l_max = ref(10);
483
- const cursorPosition = ref(-1);
484
- let promiseList = [];
485
- let dict = {};
486
- let doubleSpell = {};
487
-
488
- // 获取词库
489
- const getChinese = () => {
490
- const promise = import("./static/dict/baseDict.json").then((res) => {
491
- dict = res;
492
- });
493
-
494
- const promise1 = import("./static/dict/chowder.json").then((res) => {
495
- doubleSpell = res;
496
- });
497
- promiseList.push(promise1);
536
+ // 获取词库, 直接执行
537
+ ;(() => {
538
+ const promise = import('./static/dict/baseDict.json').then((res) => {
539
+ dict = res
540
+ })
541
+ promiseList.push(promise)
542
+
543
+ const promise1 = import('./static/dict/chowder.json').then((res) => {
544
+ doubleSpell = res
545
+ })
546
+ promiseList.push(promise1)
498
547
  Promise.all(promiseList)
499
548
  .then(() => {
500
- console.log("加载完成");
549
+ console.log('词库加载完成')
501
550
  })
502
551
  .catch((err) => {
503
- console.error("词库错误", err);
504
- });
505
- };
506
- getChinese();
552
+ console.error('词库加载错误', err)
553
+ })
554
+ })()
507
555
 
508
556
  // 中文输入
509
- const chinese = (key) => {
510
- const reg = /^[a-zA-Z]$/;
557
+ const chinese = (key: string) => {
558
+ const reg = /^[a-zA-Z]$/
511
559
  if (!reg.test(key)) {
512
- setInputValue(key);
513
- return;
560
+ setInputValue(key)
561
+ return
514
562
  }
515
- cn_input.value += key; //拼音输入框添加拼音
563
+ cn_input.value += key //拼音输入框添加拼音
516
564
  if (cn_input.value[0] == "'") {
517
- cn_input.value = cn_input.value.slice(1);
565
+ cn_input.value = cn_input.value.slice(1)
518
566
  }
519
- const specialPinYin = ["u", "v", "i"].includes(cn_input.value.split("")[0]); //判断是否是特殊拼音
567
+ const specialPinYin = ['u', 'v', 'i'].includes(cn_input.value.split('')[0]) //判断是否是特殊拼音
520
568
  if (specialPinYin) {
521
569
  //如果是特殊拼音
522
570
  if (!cn_list_str.value.length) {
523
571
  //如果没有拼音列表
524
572
  //@ts-ignore
525
- cn_list_str.value = [key]; //拼音列表添加拼音
573
+ cn_list_str.value = [key] //拼音列表添加拼音
526
574
  } else {
527
- const value = cn_list_str.value[0] + key; //拼音列表第一个拼音加上当前拼音
575
+ const value = cn_list_str.value[0] + key //拼音列表第一个拼音加上当前拼音
528
576
  //@ts-ignore
529
- cn_list_str.value[0] = value; //拼音列表第一个拼音替换为新的拼音
577
+ cn_list_str.value[0] = value //拼音列表第一个拼音替换为新的拼音
530
578
  }
531
- return;
579
+ return
532
580
  }
533
581
 
534
- findChinese("add", key); //查找中文
535
- };
582
+ findChinese('add', key) //查找中文
583
+ }
536
584
 
537
585
  // 查字典
538
- const findChinese = (type, key) => {
586
+ const findChinese = (type?: string, key?: string) => {
539
587
  // type = del key不需要传,type = add key必须要传
540
- l_min.value = 0; //最小值
541
- l_max.value = 10; //最大值
542
- const pinYinList = cn_input.value.split("'"); //拼音列表
543
- let pinYin = pinYinList[pinYinList.length - 1]; //当前拼音
588
+ l_min.value = 0 //最小值
589
+ l_max.value = 10 //最大值
590
+ const pinYinList = cn_input.value.split("'") //拼音列表
591
+ let pinYin = pinYinList[pinYinList.length - 1] //当前拼音
544
592
 
545
- let re = new RegExp(`^${pinYin}\\w*`); //正则,匹配当前拼音开头的拼音
593
+ let re = new RegExp(`^${pinYin}\\w*`) //正则,匹配当前拼音开头的拼音
546
594
  let keys = Object.keys(dict) //获取拼音字典的key
547
595
  .filter((item) => {
548
596
  //过滤
549
- let strList = pinYin.split(""); //当前拼音转数组
597
+ let strList = pinYin.split('') //当前拼音转数组
550
598
 
551
- const temp = ["h", "o", "n", "a", "e"].includes(
599
+ const temp = ['h', 'o', 'n', 'a', 'e'].includes(
552
600
  strList[strList.length - 1] //判断是否是特殊拼音
553
- );
601
+ )
554
602
  if (pinYin.length >= 2 && !temp) {
555
603
  //如果是特殊拼音
556
- if (item === pinYin) return true; //如果拼音字典的key等于当前拼音,返回true
604
+ if (item === pinYin) return true //如果拼音字典的key等于当前拼音,返回true
557
605
  } else {
558
- let result = re.test(item); //如果不是特殊拼音,返回正则匹配结果
559
- return result;
606
+ let result = re.test(item) //如果不是特殊拼音,返回正则匹配结果
607
+ return result
560
608
  }
561
609
  })
562
- .sort();
610
+ .sort()
563
611
  cn_list_str.value =
564
- keys.length > 1
565
- ? keys.reduce((a, b) => a + dict[b], "")
566
- : dict[keys[0]]; //如果拼音列表大于1,拼接拼音列表,否则直接赋值
612
+ keys.length > 1 ? keys.reduce((a, b) => a + dict[b], '') : dict[keys[0]] //如果拼音列表大于1,拼接拼音列表,否则直接赋值
567
613
  // cn_list_str.value = cn_list_str.value.replaceAll("[object Object]", "");
568
614
 
569
- if (!cn_list_str.value || (!cn_list_str.value.length && type === "del")) {
615
+ if (!cn_list_str.value || (!cn_list_str.value.length && type === 'del')) {
570
616
  //如果拼音列表不存在或者拼音列表长度为0并且type为del
571
617
  cn_input.value = cn_input.value.replace(
572
618
  new RegExp(`(.*)${key}`),
573
619
  `$1'${key}`
574
- );
620
+ )
575
621
  }
576
622
 
577
623
  if (!cn_list_str.value && !Array.isArray(cn_list_str.value)) {
578
- cn_list_str.value = [];
624
+ cn_list_str.value = []
579
625
  }
580
626
 
581
- keys = cn_input.value.split("'");
627
+ keys = cn_input.value.split("'")
582
628
 
583
629
  if (keys.length >= 2) {
584
- cn_list_str.value = [];
585
- findDoubleSpell();
630
+ cn_list_str.value = []
631
+ findDoubleSpell()
586
632
  }
587
- };
633
+ }
588
634
 
589
635
  // 连续输入
590
636
  const findDoubleSpell = () => {
591
- let keys = cn_input.value.split("'");
592
- const partDict = doubleSpell[cn_input.value.charAt(0)];
593
- if (!partDict) return;
594
- if (["an"].includes(keys[keys.length - 1])) {
595
- let tempStr = keys[keys.length - 2];
596
- if (["n"].includes(tempStr.charAt(tempStr.length - 1))) {
597
- let newTempStr = tempStr.slice(0, tempStr.length - 1);
637
+ let keys = cn_input.value.split("'")
638
+ const partDict = doubleSpell[cn_input.value.charAt(0)]
639
+ if (!partDict) return
640
+ if (['an'].includes(keys[keys.length - 1])) {
641
+ let tempStr = keys[keys.length - 2]
642
+ if (['n'].includes(tempStr.charAt(tempStr.length - 1))) {
643
+ let newTempStr = tempStr.slice(0, tempStr.length - 1)
598
644
  keys = [
599
645
  newTempStr,
600
- tempStr.slice(tempStr.length - 1) + keys[keys.length - 1],
601
- ];
602
- cn_input.value = keys.join("'");
646
+ tempStr.slice(tempStr.length - 1) + keys[keys.length - 1]
647
+ ]
648
+ cn_input.value = keys.join("'")
603
649
  }
604
650
  }
605
651
 
606
652
  let keyResult = Object.keys(partDict).filter((key) => {
607
- const keys = key.split("'");
608
- const cn_inputList = cn_input.value.split("'");
609
- const isLen = cn_inputList.length === keys.length;
610
- if (!isLen) return;
611
- let result = true;
653
+ const keys = key.split("'")
654
+ const cn_inputList = cn_input.value.split("'")
655
+ const isLen = cn_inputList.length === keys.length
656
+ if (!isLen) return
657
+ let result = true
612
658
  for (let i = 0; i < keys.length; i++) {
613
659
  if (keys[i].charAt(0) != cn_inputList[i].charAt(0)) {
614
- result = false;
660
+ result = false
615
661
  } else {
616
- const keyItemList = keys[i].split("");
617
- const strList = cn_inputList[i].split("");
662
+ const keyItemList = keys[i].split('')
663
+ const strList = cn_inputList[i].split('')
618
664
  for (let j = 0; j < strList.length; j++) {
619
- if (!strList[j]) break;
665
+ if (!strList[j]) break
620
666
  if (keyItemList[j] != strList[j]) {
621
- result = false;
667
+ result = false
622
668
  }
623
669
  }
624
670
  }
625
671
  }
626
672
  if (result && isLen) {
627
- return partDict[key];
673
+ return partDict[key]
628
674
  }
629
- });
675
+ })
630
676
 
631
- let strList = [];
632
- let singleDictList = [];
633
- const singleDict = dict;
677
+ let strList = []
678
+ let singleDictList = []
679
+ const singleDict = dict
634
680
  for (let key of keyResult) {
635
- let keyList = key.split("'");
636
- strList.push(partDict[key].split(","));
681
+ let keyList = key.split("'")
682
+ strList.push(partDict[key].split(','))
637
683
  for (let item of keyList) {
638
684
  if (singleDict[item]) {
639
- singleDictList.push(singleDict[item].split(""));
685
+ singleDictList.push(singleDict[item].split(''))
640
686
  }
641
687
  }
642
688
  }
643
689
  if (!keyResult.length && keys.length) {
644
690
  for (let item of keys) {
645
691
  if (singleDict[item]) {
646
- singleDictList.push(singleDict[item].split(""));
692
+ singleDictList.push(singleDict[item].split(''))
647
693
  }
648
694
  }
649
695
  }
650
696
 
651
- singleDictList = Array.from(new Set(singleDictList.flat(2)));
697
+ singleDictList = Array.from(new Set(singleDictList.flat(2)))
652
698
  strList = strList
653
699
  .flat(2)
654
700
  //@ts-ignore
655
701
  .sort((a, b) => {
656
- if (b.length > a.length) return -1;
702
+ if (b.length > a.length) return -1
657
703
  })
658
- .reverse();
704
+ .reverse()
659
705
  //@ts-ignore
660
- cn_list_str.value = strList.concat(singleDictList);
661
- };
706
+ cn_list_str.value = strList.concat(singleDictList)
707
+ }
662
708
 
663
709
  //获取光标位置
664
- const getCaretPosition = (element) => {
665
- let carePos = 0;
710
+ const getCaretPosition = (element: HTMLInputElement | HTMLTextAreaElement) => {
711
+ let carePos = 0
666
712
  try {
667
- carePos = element.selectionStart;
668
- } catch (error) {}
669
- cursorPosition.value = carePos;
670
- return carePos;
671
- };
713
+ carePos = element.selectionStart ?? 0
714
+ } catch {}
715
+ cursorPosition.value = carePos
716
+ return carePos
717
+ }
672
718
 
673
719
  // 符号切换
674
- const checkChinese = (item) => {
675
- console.log(cn_list_str.value);
676
- cn_input.value = "";
677
- cn_list_str.value = [];
678
- showMore.value = false;
679
- // keyStore.currentElement.focus();
680
- // keyStore.isChinese = !keyStore.isChinese;
681
- globalKey.currentElement.focus();
682
- keyStore.isChinese = !keyStore.isChinese;
683
- };
720
+ const checkChinese = () => {
721
+ console.log(cn_list_str.value)
722
+ cn_input.value = ''
723
+ cn_list_str.value = []
724
+ showMore.value = false
725
+ focusInput()
726
+ keyStore.isChinese = !keyStore.isChinese
727
+ }
684
728
 
685
729
  // 类型
686
730
  watchEffect(() => {
687
- if (keyStore.inputType == "number") {
688
- lists.value = numberKeyBoradMap;
731
+ if (keyStore.inputType == 'number') {
732
+ // lists.value = numberKeyBoradMap
689
733
  } else {
690
- lists.value = textKeyMap;
734
+ lists.value = textKeyMap
691
735
  }
692
- });
736
+ })
693
737
 
694
738
  //#endregion -----------------------------------------------------------
695
739
 
696
740
  //#region $sy global ------------------------------------------------------------
697
741
  const showKeyboard = () => {
698
- keyStore.keyboardcon = true;
699
- };
742
+ keyStore.keyboardcon = true
743
+ }
700
744
  const hideKeyboard = () => {
701
- keyStore.keyboardcon = false;
702
- };
703
- window.globalThis.$sy.key.open = showKeyboard;
704
- window.globalThis.$sy.key.close = hideKeyboard;
745
+ keyStore.keyboardcon = false
746
+ }
747
+
705
748
  //#endregion -----------------------------------------------------------
706
749
 
707
- //#region input ⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
708
750
  // 手动触发input事件
709
751
  const triggerModel = () => {
710
- globalKey.currentElement.dispatchEvent(new Event("input"));
711
- };
712
-
713
- const makeFocus = (e) => {
714
- globalKey.currentElement.focus();
715
- };
752
+ ;(globalKey.currentElement as HTMLInputElement).dispatchEvent(
753
+ new Event('input')
754
+ )
755
+ }
716
756
 
717
- //#endregion ⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
757
+ const makeFocus = () => {
758
+ focusInput()
759
+ }
718
760
 
719
761
  //#region 长按事件 ⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
720
- // 定义一个 ref 来保存计时器
721
- const pressTimer = ref(null);
722
-
723
- // 定义一个 ref 来引用 DOM 元素
724
- const pressArea = ref(null);
725
-
726
- const longpressSt = ref(false);
727
762
 
728
763
  // 定义长按事件逻辑
729
- const onLongPress = (t) => {
764
+ const onLongPress = (text: string) => {
730
765
  // alert("长按事件触发");
731
766
  longpressSt.value = setInterval(() => {
732
767
  // console.log("长按触发", t);
733
- choosekey(t);
734
- }, 50);
735
- };
768
+ choosekey(text)
769
+ }, 50)
770
+ }
736
771
 
737
772
  // 开始按压的处理函数
738
- const startPress = (e) => {
773
+ const startPress = (e: TouchEvent) => {
774
+ const target = e.target as HTMLElement
775
+ if (target.classList.contains('key')) {
776
+ target.classList.toggle('active', true)
777
+ }
739
778
  let value =
740
- e.target.children[0]?.innerText || e.target.children[0].className;
741
- if (value != "del") return;
779
+ (target.children[0] as HTMLElement)?.innerText ||
780
+ (target.children[0] as HTMLElement)?.className
781
+ if (value != 'del') return
742
782
  pressTimer.value = setTimeout(() => {
743
- onLongPress(value);
744
- }, 500); // 设置长按时间为500毫秒
745
- };
783
+ onLongPress(value)
784
+ }, 500) // 设置长按时间为500毫秒
785
+ }
746
786
 
747
787
  // 结束按压的处理函数
748
- const endPress = () => {
749
- clearTimeout(pressTimer.value);
750
- clearInterval(longpressSt.value);
751
- };
788
+ const endPress = (e: TouchEvent) => {
789
+ const target = e.target as HTMLElement
790
+ if (target.classList.contains('key')) {
791
+ target.classList.toggle('active', false)
792
+ }
793
+ clearTimeout(pressTimer.value)
794
+ clearInterval(longpressSt.value)
795
+ }
752
796
 
753
797
  // 取消按压的处理函数
754
798
  const cancelPress = () => {
755
- clearTimeout(pressTimer.value);
756
- clearInterval(longpressSt.value);
757
- };
799
+ clearTimeout(pressTimer.value)
800
+ clearInterval(longpressSt.value)
801
+ }
758
802
 
759
803
  // 添加和清理事件监听器
760
804
 
761
805
  //#endregion ⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
762
806
 
763
807
  //
808
+
809
+ keyboard.open = showKeyboard
810
+ keyboard.close = hideKeyboard
764
811
  </script>
765
812
 
766
813
  <style lang="scss">
767
- @import "./theme.scss";
814
+ @import './theme.scss';
768
815
 
769
816
  .defaultCss {
770
817
  --h: 4vh;
@@ -795,9 +842,11 @@ const cancelPress = () => {
795
842
  background: var(--keyboard_background);
796
843
  border-radius: 1.2vh 1.2vh 0 0;
797
844
  transition: all 0.2s;
845
+
798
846
  & * {
799
847
  box-sizing: border-box;
800
848
  }
849
+
801
850
  .btns {
802
851
  color: rgb(0, 123, 255);
803
852
  display: flex;
@@ -806,8 +855,10 @@ const cancelPress = () => {
806
855
  margin: 1.2vh 0;
807
856
  font-size: 1.2vh;
808
857
  cursor: pointer;
858
+
809
859
  > div {
810
860
  height: 1.2vh;
861
+
811
862
  span {
812
863
  color: gainsboro;
813
864
  transition: all 0.3s;
@@ -836,16 +887,21 @@ const cancelPress = () => {
836
887
  // border: 1px solid red;
837
888
  background: var(--keyboard_background);
838
889
  margin-bottom: 0.6vh;
890
+
839
891
  .wenzi_box {
840
892
  display: flex;
841
893
  // flex-wrap: wrap;
842
894
  gap: 10px;
843
895
  padding: 5px;
844
896
  overflow: auto;
897
+
845
898
  &::-webkit-scrollbar {
846
- display: none; /* 适用于 Chrome, Safari 和 Opera */
899
+ display: none;
900
+ /* 适用于 Chrome, Safari 和 Opera */
847
901
  }
848
- scrollbar-width: none; /* 适用于 Firefox */
902
+
903
+ scrollbar-width: none;
904
+ /* 适用于 Firefox */
849
905
  position: absolute;
850
906
  left: 0;
851
907
  top: 0;
@@ -927,6 +983,7 @@ const cancelPress = () => {
927
983
  user-select: none;
928
984
  // @include key_color("key_color");
929
985
  color: var(--key_color);
986
+
930
987
  .key {
931
988
  box-shadow: inset 0px 0px 2px 0px #8f9eae;
932
989
  // @include key_background("key_background");
@@ -994,9 +1051,11 @@ const cancelPress = () => {
994
1051
  .text_list {
995
1052
  --symbolP: 0 5%;
996
1053
  }
1054
+
997
1055
  .isSymbol {
998
1056
  --symbolP: 0;
999
1057
  }
1058
+
1000
1059
  .text_list {
1001
1060
  display: grid;
1002
1061
  grid-template-columns: repeat(1, 1fr);
@@ -1008,6 +1067,7 @@ const cancelPress = () => {
1008
1067
  display: flex;
1009
1068
  gap: var(--gap);
1010
1069
  width: 100%;
1070
+
1011
1071
  // border: 1px solid red;
1012
1072
  // 全部
1013
1073
  .key_item_column {
@@ -1021,10 +1081,12 @@ const cancelPress = () => {
1021
1081
  justify-content: center;
1022
1082
  align-items: center;
1023
1083
  height: var(--h);
1084
+
1024
1085
  & span,
1025
1086
  & img {
1026
1087
  pointer-events: none;
1027
1088
  }
1089
+
1028
1090
  .key {
1029
1091
  border-radius: var(--borra);
1030
1092
  display: flex;
@@ -1036,17 +1098,18 @@ const cancelPress = () => {
1036
1098
  box-shadow: inset 0px 0px 2px 0px #8f9eae;
1037
1099
 
1038
1100
  background: var(--key_background);
1101
+
1039
1102
  span {
1040
1103
  height: fit-content;
1041
1104
  line-height: 1.2vh;
1042
1105
  // border: 1px solid red;
1043
1106
  }
1107
+ }
1044
1108
 
1045
- &:active {
1046
- background: var(--key_active_background);
1047
- box-shadow: inset 0px 0px 2px 2px #65708220;
1048
- transform: scale(0.99);
1049
- }
1109
+ .active {
1110
+ background: var(--key_active_background);
1111
+ box-shadow: inset 0px 0px 2px 2px #65708220;
1112
+ transform: scale(0.99);
1050
1113
  }
1051
1114
  }
1052
1115
 
@@ -1057,10 +1120,12 @@ const cancelPress = () => {
1057
1120
  // border: 1px solid red;
1058
1121
  flex: 1;
1059
1122
  flex-shrink: 0;
1123
+
1060
1124
  .key {
1061
1125
  padding: 0;
1062
1126
  box-sizing: border-box;
1063
1127
  }
1128
+
1064
1129
  // flex: 1;
1065
1130
  }
1066
1131
  }
@@ -1070,9 +1135,11 @@ const cancelPress = () => {
1070
1135
  display: flex;
1071
1136
  justify-content: center;
1072
1137
  padding: var(--symbolP);
1138
+
1073
1139
  .key_item_column {
1074
1140
  flex-shrink: 0;
1075
1141
  flex: 1;
1142
+
1076
1143
  .key {
1077
1144
  padding: 0;
1078
1145
  box-sizing: border-box;
@@ -1084,6 +1151,7 @@ const cancelPress = () => {
1084
1151
 
1085
1152
  --flw: 10%; // 3 4 头尾
1086
1153
  --mflw: 60px;
1154
+
1087
1155
  // 单独第3行
1088
1156
  &:nth-child(3) {
1089
1157
  justify-self: center;
@@ -1093,12 +1161,14 @@ const cancelPress = () => {
1093
1161
  // flex: 1;
1094
1162
  &:nth-child(1) {
1095
1163
  padding: 0;
1164
+
1096
1165
  .key {
1097
1166
  box-sizing: border-box;
1098
1167
  display: flex;
1099
1168
  justify-content: center;
1100
1169
  align-items: center;
1101
1170
  font-size: 1.8vh;
1171
+
1102
1172
  // border: 1px solid red;
1103
1173
  img {
1104
1174
  transform: scale(0.7);
@@ -1106,14 +1176,6 @@ const cancelPress = () => {
1106
1176
  filter: var(--key_filter);
1107
1177
  }
1108
1178
  }
1109
-
1110
- .toUpKeyCase {
1111
- // box-shadow: none;
1112
- // border: 1px solid red; ´
1113
- img {
1114
- // filter: invert(100%);
1115
- }
1116
- }
1117
1179
  }
1118
1180
 
1119
1181
  &:first-child,
@@ -1149,6 +1211,7 @@ const cancelPress = () => {
1149
1211
 
1150
1212
  // flex: 1;
1151
1213
  font-weight: 400;
1214
+
1152
1215
  // border: 1px solid red;
1153
1216
  .key {
1154
1217
  padding: 0;