@composy/keyboard-core 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.
Files changed (337) hide show
  1. package/README.md +37 -0
  2. package/dist/index.js +3605 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.min.js +1 -0
  5. package/es/icons.d.ts +58 -0
  6. package/es/icons.d.ts.map +1 -0
  7. package/es/icons.js +34 -0
  8. package/es/icons.js.map +1 -0
  9. package/es/index.d.ts +12 -0
  10. package/es/index.d.ts.map +1 -0
  11. package/es/index.js +36 -0
  12. package/es/layouts/amount.d.ts +14 -0
  13. package/es/layouts/amount.d.ts.map +1 -0
  14. package/es/layouts/amount.js +175 -0
  15. package/es/layouts/amount.js.map +1 -0
  16. package/es/layouts/bankcard.d.ts +15 -0
  17. package/es/layouts/bankcard.d.ts.map +1 -0
  18. package/es/layouts/bankcard.js +99 -0
  19. package/es/layouts/bankcard.js.map +1 -0
  20. package/es/layouts/email.d.ts +11 -0
  21. package/es/layouts/email.d.ts.map +1 -0
  22. package/es/layouts/email.js +126 -0
  23. package/es/layouts/email.js.map +1 -0
  24. package/es/layouts/idcard.d.ts +16 -0
  25. package/es/layouts/idcard.d.ts.map +1 -0
  26. package/es/layouts/idcard.js +99 -0
  27. package/es/layouts/idcard.js.map +1 -0
  28. package/es/layouts/index.d.ts +54 -0
  29. package/es/layouts/index.d.ts.map +1 -0
  30. package/es/layouts/index.js +78 -0
  31. package/es/layouts/index.js.map +1 -0
  32. package/es/layouts/license-plate.d.ts +35 -0
  33. package/es/layouts/license-plate.d.ts.map +1 -0
  34. package/es/layouts/license-plate.js +290 -0
  35. package/es/layouts/license-plate.js.map +1 -0
  36. package/es/layouts/number.d.ts +14 -0
  37. package/es/layouts/number.d.ts.map +1 -0
  38. package/es/layouts/number.js +168 -0
  39. package/es/layouts/number.js.map +1 -0
  40. package/es/layouts/phone.d.ts +15 -0
  41. package/es/layouts/phone.d.ts.map +1 -0
  42. package/es/layouts/phone.js +175 -0
  43. package/es/layouts/phone.js.map +1 -0
  44. package/es/layouts/punct.d.ts +7 -0
  45. package/es/layouts/punct.d.ts.map +1 -0
  46. package/es/layouts/punct.js +112 -0
  47. package/es/layouts/punct.js.map +1 -0
  48. package/es/layouts/qwerty.d.ts +10 -0
  49. package/es/layouts/qwerty.d.ts.map +1 -0
  50. package/es/layouts/qwerty.js +116 -0
  51. package/es/layouts/qwerty.js.map +1 -0
  52. package/es/layouts/search.d.ts +7 -0
  53. package/es/layouts/search.d.ts.map +1 -0
  54. package/es/layouts/search.js +101 -0
  55. package/es/layouts/search.js.map +1 -0
  56. package/es/layouts/symbol.d.ts +14 -0
  57. package/es/layouts/symbol.d.ts.map +1 -0
  58. package/es/layouts/symbol.js +194 -0
  59. package/es/layouts/symbol.js.map +1 -0
  60. package/es/layouts/url.d.ts +7 -0
  61. package/es/layouts/url.d.ts.map +1 -0
  62. package/es/layouts/url.js +99 -0
  63. package/es/layouts/url.js.map +1 -0
  64. package/es/layouts/verifycode.d.ts +15 -0
  65. package/es/layouts/verifycode.d.ts.map +1 -0
  66. package/es/layouts/verifycode.js +100 -0
  67. package/es/layouts/verifycode.js.map +1 -0
  68. package/es/managers/index.d.ts +8 -0
  69. package/es/managers/index.d.ts.map +1 -0
  70. package/es/managers/index.js +14 -0
  71. package/es/managers/keyboard-manager.d.ts +130 -0
  72. package/es/managers/keyboard-manager.d.ts.map +1 -0
  73. package/es/managers/keyboard-manager.js +374 -0
  74. package/es/managers/keyboard-manager.js.map +1 -0
  75. package/es/managers/keyboard-renderer.d.ts +115 -0
  76. package/es/managers/keyboard-renderer.d.ts.map +1 -0
  77. package/es/managers/keyboard-renderer.js +283 -0
  78. package/es/managers/keyboard-renderer.js.map +1 -0
  79. package/es/managers/position-manager.d.ts +72 -0
  80. package/es/managers/position-manager.d.ts.map +1 -0
  81. package/es/managers/position-manager.js +199 -0
  82. package/es/managers/position-manager.js.map +1 -0
  83. package/es/themes/index.d.ts +70 -0
  84. package/es/themes/index.d.ts.map +1 -0
  85. package/es/themes/index.js +99 -0
  86. package/es/themes/index.js.map +1 -0
  87. package/es/themes/presets.d.ts +39 -0
  88. package/es/themes/presets.d.ts.map +1 -0
  89. package/es/themes/presets.js +207 -0
  90. package/es/themes/presets.js.map +1 -0
  91. package/es/themes/types.d.ts +118 -0
  92. package/es/themes/types.d.ts.map +1 -0
  93. package/es/themes/types.js +10 -0
  94. package/es/types/index.d.ts +7 -0
  95. package/es/types/index.d.ts.map +1 -0
  96. package/es/types/index.js +10 -0
  97. package/es/types/keyboard.d.ts +253 -0
  98. package/es/types/keyboard.d.ts.map +1 -0
  99. package/es/types/keyboard.js +10 -0
  100. package/es/types/position.d.ts +139 -0
  101. package/es/types/position.d.ts.map +1 -0
  102. package/es/types/position.js +10 -0
  103. package/es/utils/device.d.ts +45 -0
  104. package/es/utils/device.d.ts.map +1 -0
  105. package/es/utils/device.js +111 -0
  106. package/es/utils/device.js.map +1 -0
  107. package/es/utils/dom.d.ts +69 -0
  108. package/es/utils/dom.d.ts.map +1 -0
  109. package/es/utils/dom.js +134 -0
  110. package/es/utils/dom.js.map +1 -0
  111. package/es/utils/event-emitter.d.ts +52 -0
  112. package/es/utils/event-emitter.d.ts.map +1 -0
  113. package/es/utils/event-emitter.js +99 -0
  114. package/es/utils/event-emitter.js.map +1 -0
  115. package/es/utils/formatters.d.ts +51 -0
  116. package/es/utils/formatters.d.ts.map +1 -0
  117. package/es/utils/formatters.js +57 -0
  118. package/es/utils/formatters.js.map +1 -0
  119. package/es/utils/index.d.ts +10 -0
  120. package/es/utils/index.d.ts.map +1 -0
  121. package/es/utils/index.js +16 -0
  122. package/es/utils/random.d.ts +71 -0
  123. package/es/utils/random.d.ts.map +1 -0
  124. package/es/utils/random.js +292 -0
  125. package/es/utils/random.js.map +1 -0
  126. package/esm/icons.d.ts +58 -0
  127. package/esm/icons.d.ts.map +1 -0
  128. package/esm/icons.js +34 -0
  129. package/esm/icons.js.map +1 -0
  130. package/esm/index.d.ts +12 -0
  131. package/esm/index.d.ts.map +1 -0
  132. package/esm/index.js +37 -0
  133. package/esm/layouts/amount.d.ts +14 -0
  134. package/esm/layouts/amount.d.ts.map +1 -0
  135. package/esm/layouts/amount.js +175 -0
  136. package/esm/layouts/amount.js.map +1 -0
  137. package/esm/layouts/bankcard.d.ts +15 -0
  138. package/esm/layouts/bankcard.d.ts.map +1 -0
  139. package/esm/layouts/bankcard.js +99 -0
  140. package/esm/layouts/bankcard.js.map +1 -0
  141. package/esm/layouts/email.d.ts +11 -0
  142. package/esm/layouts/email.d.ts.map +1 -0
  143. package/esm/layouts/email.js +126 -0
  144. package/esm/layouts/email.js.map +1 -0
  145. package/esm/layouts/idcard.d.ts +16 -0
  146. package/esm/layouts/idcard.d.ts.map +1 -0
  147. package/esm/layouts/idcard.js +99 -0
  148. package/esm/layouts/idcard.js.map +1 -0
  149. package/esm/layouts/index.d.ts +54 -0
  150. package/esm/layouts/index.d.ts.map +1 -0
  151. package/esm/layouts/index.js +78 -0
  152. package/esm/layouts/index.js.map +1 -0
  153. package/esm/layouts/license-plate.d.ts +35 -0
  154. package/esm/layouts/license-plate.d.ts.map +1 -0
  155. package/esm/layouts/license-plate.js +290 -0
  156. package/esm/layouts/license-plate.js.map +1 -0
  157. package/esm/layouts/number.d.ts +14 -0
  158. package/esm/layouts/number.d.ts.map +1 -0
  159. package/esm/layouts/number.js +168 -0
  160. package/esm/layouts/number.js.map +1 -0
  161. package/esm/layouts/phone.d.ts +15 -0
  162. package/esm/layouts/phone.d.ts.map +1 -0
  163. package/esm/layouts/phone.js +175 -0
  164. package/esm/layouts/phone.js.map +1 -0
  165. package/esm/layouts/punct.d.ts +7 -0
  166. package/esm/layouts/punct.d.ts.map +1 -0
  167. package/esm/layouts/punct.js +112 -0
  168. package/esm/layouts/punct.js.map +1 -0
  169. package/esm/layouts/qwerty.d.ts +10 -0
  170. package/esm/layouts/qwerty.d.ts.map +1 -0
  171. package/esm/layouts/qwerty.js +116 -0
  172. package/esm/layouts/qwerty.js.map +1 -0
  173. package/esm/layouts/search.d.ts +7 -0
  174. package/esm/layouts/search.d.ts.map +1 -0
  175. package/esm/layouts/search.js +101 -0
  176. package/esm/layouts/search.js.map +1 -0
  177. package/esm/layouts/symbol.d.ts +14 -0
  178. package/esm/layouts/symbol.d.ts.map +1 -0
  179. package/esm/layouts/symbol.js +194 -0
  180. package/esm/layouts/symbol.js.map +1 -0
  181. package/esm/layouts/url.d.ts +7 -0
  182. package/esm/layouts/url.d.ts.map +1 -0
  183. package/esm/layouts/url.js +99 -0
  184. package/esm/layouts/url.js.map +1 -0
  185. package/esm/layouts/verifycode.d.ts +15 -0
  186. package/esm/layouts/verifycode.d.ts.map +1 -0
  187. package/esm/layouts/verifycode.js +100 -0
  188. package/esm/layouts/verifycode.js.map +1 -0
  189. package/esm/managers/index.d.ts +8 -0
  190. package/esm/managers/index.d.ts.map +1 -0
  191. package/esm/managers/index.js +14 -0
  192. package/esm/managers/keyboard-manager.d.ts +130 -0
  193. package/esm/managers/keyboard-manager.d.ts.map +1 -0
  194. package/esm/managers/keyboard-manager.js +374 -0
  195. package/esm/managers/keyboard-manager.js.map +1 -0
  196. package/esm/managers/keyboard-renderer.d.ts +115 -0
  197. package/esm/managers/keyboard-renderer.d.ts.map +1 -0
  198. package/esm/managers/keyboard-renderer.js +283 -0
  199. package/esm/managers/keyboard-renderer.js.map +1 -0
  200. package/esm/managers/position-manager.d.ts +72 -0
  201. package/esm/managers/position-manager.d.ts.map +1 -0
  202. package/esm/managers/position-manager.js +199 -0
  203. package/esm/managers/position-manager.js.map +1 -0
  204. package/esm/themes/index.d.ts +70 -0
  205. package/esm/themes/index.d.ts.map +1 -0
  206. package/esm/themes/index.js +99 -0
  207. package/esm/themes/index.js.map +1 -0
  208. package/esm/themes/presets.d.ts +39 -0
  209. package/esm/themes/presets.d.ts.map +1 -0
  210. package/esm/themes/presets.js +207 -0
  211. package/esm/themes/presets.js.map +1 -0
  212. package/esm/themes/types.d.ts +118 -0
  213. package/esm/themes/types.d.ts.map +1 -0
  214. package/esm/themes/types.js +10 -0
  215. package/esm/types/index.d.ts +7 -0
  216. package/esm/types/index.d.ts.map +1 -0
  217. package/esm/types/index.js +10 -0
  218. package/esm/types/keyboard.d.ts +253 -0
  219. package/esm/types/keyboard.d.ts.map +1 -0
  220. package/esm/types/keyboard.js +10 -0
  221. package/esm/types/position.d.ts +139 -0
  222. package/esm/types/position.d.ts.map +1 -0
  223. package/esm/types/position.js +10 -0
  224. package/esm/utils/device.d.ts +45 -0
  225. package/esm/utils/device.d.ts.map +1 -0
  226. package/esm/utils/device.js +111 -0
  227. package/esm/utils/device.js.map +1 -0
  228. package/esm/utils/dom.d.ts +69 -0
  229. package/esm/utils/dom.d.ts.map +1 -0
  230. package/esm/utils/dom.js +134 -0
  231. package/esm/utils/dom.js.map +1 -0
  232. package/esm/utils/event-emitter.d.ts +52 -0
  233. package/esm/utils/event-emitter.d.ts.map +1 -0
  234. package/esm/utils/event-emitter.js +99 -0
  235. package/esm/utils/event-emitter.js.map +1 -0
  236. package/esm/utils/formatters.d.ts +51 -0
  237. package/esm/utils/formatters.d.ts.map +1 -0
  238. package/esm/utils/formatters.js +57 -0
  239. package/esm/utils/formatters.js.map +1 -0
  240. package/esm/utils/index.d.ts +10 -0
  241. package/esm/utils/index.d.ts.map +1 -0
  242. package/esm/utils/index.js +16 -0
  243. package/esm/utils/random.d.ts +71 -0
  244. package/esm/utils/random.d.ts.map +1 -0
  245. package/esm/utils/random.js +292 -0
  246. package/esm/utils/random.js.map +1 -0
  247. package/lib/icons.cjs +44 -0
  248. package/lib/icons.cjs.map +1 -0
  249. package/lib/icons.d.ts +58 -0
  250. package/lib/index.cjs +141 -0
  251. package/lib/index.d.ts +12 -0
  252. package/lib/layouts/amount.cjs +177 -0
  253. package/lib/layouts/amount.cjs.map +1 -0
  254. package/lib/layouts/amount.d.ts +14 -0
  255. package/lib/layouts/bankcard.cjs +100 -0
  256. package/lib/layouts/bankcard.cjs.map +1 -0
  257. package/lib/layouts/bankcard.d.ts +15 -0
  258. package/lib/layouts/email.cjs +128 -0
  259. package/lib/layouts/email.cjs.map +1 -0
  260. package/lib/layouts/email.d.ts +11 -0
  261. package/lib/layouts/idcard.cjs +100 -0
  262. package/lib/layouts/idcard.cjs.map +1 -0
  263. package/lib/layouts/idcard.d.ts +16 -0
  264. package/lib/layouts/index.cjs +107 -0
  265. package/lib/layouts/index.cjs.map +1 -0
  266. package/lib/layouts/index.d.ts +54 -0
  267. package/lib/layouts/license-plate.cjs +296 -0
  268. package/lib/layouts/license-plate.cjs.map +1 -0
  269. package/lib/layouts/license-plate.d.ts +35 -0
  270. package/lib/layouts/number.cjs +170 -0
  271. package/lib/layouts/number.cjs.map +1 -0
  272. package/lib/layouts/number.d.ts +14 -0
  273. package/lib/layouts/phone.cjs +177 -0
  274. package/lib/layouts/phone.cjs.map +1 -0
  275. package/lib/layouts/phone.d.ts +15 -0
  276. package/lib/layouts/punct.cjs +113 -0
  277. package/lib/layouts/punct.cjs.map +1 -0
  278. package/lib/layouts/punct.d.ts +7 -0
  279. package/lib/layouts/qwerty.cjs +117 -0
  280. package/lib/layouts/qwerty.cjs.map +1 -0
  281. package/lib/layouts/qwerty.d.ts +10 -0
  282. package/lib/layouts/search.cjs +102 -0
  283. package/lib/layouts/search.cjs.map +1 -0
  284. package/lib/layouts/search.d.ts +7 -0
  285. package/lib/layouts/symbol.cjs +196 -0
  286. package/lib/layouts/symbol.cjs.map +1 -0
  287. package/lib/layouts/symbol.d.ts +14 -0
  288. package/lib/layouts/url.cjs +100 -0
  289. package/lib/layouts/url.cjs.map +1 -0
  290. package/lib/layouts/url.d.ts +7 -0
  291. package/lib/layouts/verifycode.cjs +101 -0
  292. package/lib/layouts/verifycode.cjs.map +1 -0
  293. package/lib/layouts/verifycode.d.ts +15 -0
  294. package/lib/managers/index.cjs +20 -0
  295. package/lib/managers/index.d.ts +8 -0
  296. package/lib/managers/keyboard-manager.cjs +376 -0
  297. package/lib/managers/keyboard-manager.cjs.map +1 -0
  298. package/lib/managers/keyboard-manager.d.ts +130 -0
  299. package/lib/managers/keyboard-renderer.cjs +285 -0
  300. package/lib/managers/keyboard-renderer.cjs.map +1 -0
  301. package/lib/managers/keyboard-renderer.d.ts +115 -0
  302. package/lib/managers/position-manager.cjs +201 -0
  303. package/lib/managers/position-manager.cjs.map +1 -0
  304. package/lib/managers/position-manager.d.ts +72 -0
  305. package/lib/package.json +3 -0
  306. package/lib/themes/index.cjs +117 -0
  307. package/lib/themes/index.cjs.map +1 -0
  308. package/lib/themes/index.d.ts +70 -0
  309. package/lib/themes/presets.cjs +214 -0
  310. package/lib/themes/presets.cjs.map +1 -0
  311. package/lib/themes/presets.d.ts +39 -0
  312. package/lib/themes/types.cjs +11 -0
  313. package/lib/themes/types.d.ts +118 -0
  314. package/lib/types/index.cjs +11 -0
  315. package/lib/types/index.d.ts +7 -0
  316. package/lib/types/keyboard.cjs +11 -0
  317. package/lib/types/keyboard.d.ts +253 -0
  318. package/lib/types/position.cjs +11 -0
  319. package/lib/types/position.d.ts +139 -0
  320. package/lib/utils/device.cjs +120 -0
  321. package/lib/utils/device.cjs.map +1 -0
  322. package/lib/utils/device.d.ts +45 -0
  323. package/lib/utils/dom.cjs +148 -0
  324. package/lib/utils/dom.cjs.map +1 -0
  325. package/lib/utils/dom.d.ts +69 -0
  326. package/lib/utils/event-emitter.cjs +100 -0
  327. package/lib/utils/event-emitter.cjs.map +1 -0
  328. package/lib/utils/event-emitter.d.ts +52 -0
  329. package/lib/utils/formatters.cjs +66 -0
  330. package/lib/utils/formatters.cjs.map +1 -0
  331. package/lib/utils/formatters.d.ts +51 -0
  332. package/lib/utils/index.cjs +58 -0
  333. package/lib/utils/index.d.ts +10 -0
  334. package/lib/utils/random.cjs +301 -0
  335. package/lib/utils/random.cjs.map +1 -0
  336. package/lib/utils/random.d.ts +71 -0
  337. package/package.json +121 -0
@@ -0,0 +1,99 @@
1
+ /*!
2
+ * ***********************************
3
+ * @composy/keyboard-core v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-08-17 11:33:29 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ import { ICON_CLEAR, ICON_DELETE } from "../icons.js";
11
+ //#region src/layouts/bankcard.ts
12
+ function createNumberKey(num) {
13
+ return {
14
+ id: `bankcard-${num}`,
15
+ type: "char",
16
+ label: num,
17
+ value: num,
18
+ className: "key-num"
19
+ };
20
+ }
21
+ const bankcardLayout = {
22
+ type: "bankcard",
23
+ name: "银行卡键盘",
24
+ supportShift: false,
25
+ rows: [
26
+ {
27
+ className: "numpad-row",
28
+ keys: [
29
+ createNumberKey("1"),
30
+ createNumberKey("2"),
31
+ createNumberKey("3"),
32
+ {
33
+ id: "backspace",
34
+ type: "backspace",
35
+ icon: ICON_DELETE,
36
+ label: "",
37
+ className: "key-numpad-fn"
38
+ }
39
+ ]
40
+ },
41
+ {
42
+ className: "numpad-row",
43
+ keys: [
44
+ createNumberKey("4"),
45
+ createNumberKey("5"),
46
+ createNumberKey("6"),
47
+ {
48
+ id: "clear",
49
+ type: "clear",
50
+ icon: ICON_CLEAR,
51
+ label: "",
52
+ className: "key-numpad-fn"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ className: "numpad-row",
58
+ keys: [
59
+ createNumberKey("7"),
60
+ createNumberKey("8"),
61
+ createNumberKey("9"),
62
+ {
63
+ id: "close",
64
+ type: "close",
65
+ label: "关闭",
66
+ className: "key-numpad-fn"
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ className: "numpad-row",
72
+ keys: [
73
+ {
74
+ id: "switch-qwerty",
75
+ type: "tab",
76
+ label: "ABC",
77
+ className: "key-numpad-fn",
78
+ data: { targetType: "qwerty" }
79
+ },
80
+ createNumberKey("0"),
81
+ {
82
+ id: "done",
83
+ type: "done",
84
+ label: "确定",
85
+ width: 2,
86
+ className: "key-numpad-done"
87
+ }
88
+ ]
89
+ }
90
+ ],
91
+ data: {
92
+ maxLength: 19,
93
+ inputType: "bankcard"
94
+ }
95
+ };
96
+ //#endregion
97
+ export { bankcardLayout };
98
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
99
+ //# sourceMappingURL=bankcard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bankcard.js","names":[],"sources":["../../src/layouts/bankcard.ts"],"sourcesContent":["/**\n * 银行卡键盘布局\n * @module layouts/bankcard\n */\n\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 从图标模块中导入删除键图标和清除键图标\nimport { ICON_DELETE, ICON_CLEAR } from '../icons'\n\n/**\n * 创建数字按键\n * @param num - 数字字符串(如 '0'-'9')\n * @returns 返回一个按键定义对象\n */\nfunction createNumberKey(num: string): KeyDefinition {\n return {\n id: `bankcard-${num}`, // 按键唯一标识符,格式为 bankcard-数字\n type: 'char', // 按键类型为字符键\n label: num, // 按键上显示的文本\n value: num, // 按键按下后输出的值\n className: 'key-num', // 按键的 CSS 类名,用于样式定制\n }\n}\n\n/**\n * 银行卡键盘配置 - 紧凑4x4布局\n * 布局结构:\n * 第1行: 1 2 3 [退格]\n * 第2行: 4 5 6 [清除]\n * 第3行: 7 8 9 [关闭]\n * 第4行: [ABC] 0 [确定(占2格)]\n */\nexport const bankcardLayout: KeyboardConfig = {\n type: 'bankcard', // 键盘类型标识\n name: '银行卡键盘', // 键盘的显示名称\n supportShift: false, // 不支持 Shift 切换(纯数字键盘无需切换)\n rows: [ // 键盘的行数组\n // ---- 第1行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [ // 该行包含的按键数组\n createNumberKey('1'), // 数字键 1\n createNumberKey('2'), // 数字键 2\n createNumberKey('3'), // 数字键 3\n {\n id: 'backspace', // 退格键的唯一标识\n type: 'backspace', // 按键类型为退格,删除最后一个字符\n icon: ICON_DELETE, // 使用删除图标作为显示内容\n label: '', // 无文本标签(由图标替代)\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n },\n ],\n },\n // ---- 第2行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [\n createNumberKey('4'), // 数字键 4\n createNumberKey('5'), // 数字键 5\n createNumberKey('6'), // 数字键 6\n {\n id: 'clear', // 清除键的唯一标识\n type: 'clear', // 按键类型为清除,清空所有输入\n icon: ICON_CLEAR, // 使用清除图标作为显示内容\n label: '', // 无文本标签\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n },\n ],\n },\n // ---- 第3行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [\n createNumberKey('7'), // 数字键 7\n createNumberKey('8'), // 数字键 8\n createNumberKey('9'), // 数字键 9\n {\n id: 'close', // 关闭键的唯一标识\n type: 'close', // 按键类型为关闭,收起键盘\n label: '关闭', // 按钮上显示的文本\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n },\n ],\n },\n // ---- 第4行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [\n {\n id: 'switch-qwerty', // 切换到全键盘的按键唯一标识\n type: 'tab', // 按键类型为标签页切换\n label: 'ABC', // 按钮上显示的文本,提示可切换到字母键盘\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n data: { targetType: 'qwerty' }, // 附加数据,指定切换目标为 QWERTY 全键盘\n },\n createNumberKey('0'), // 数字键 0\n {\n id: 'done', // 确定键的唯一标识\n type: 'done', // 按键类型为确定,完成输入\n label: '确定', // 按钮上显示的文本\n width: 2, // 占据 2 个键的宽度\n className: 'key-numpad-done', // 确定键的 CSS 类名\n },\n ],\n },\n ],\n data: { // 键盘的附加数据\n maxLength: 19, // 银行卡号最大输入长度为 19 位\n inputType: 'bankcard', // 输入类型标识,用于外部判断\n },\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAUO,MAAM,iBAAiC;CAC5C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EAEJ;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,SAAS;IAC/B;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 邮箱键盘布局
3
+ * @module layouts/email
4
+ */
5
+ import type { KeyboardConfig } from '../types';
6
+ /**
7
+ * 常见邮箱后缀列表
8
+ */
9
+ export declare const EMAIL_SUFFIXES: string[];
10
+ export declare const emailLayout: KeyboardConfig;
11
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/layouts/email.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAA;AA4B7D;;GAEG;AACH,eAAO,MAAM,cAAc,UAa1B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,cAiEzB,CAAA"}
@@ -0,0 +1,126 @@
1
+ /*!
2
+ * ***********************************
3
+ * @composy/keyboard-core v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-08-17 11:33:29 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ import { ICON_DELETE, ICON_SHIFT } from "../icons.js";
11
+ //#region src/layouts/email.ts
12
+ function createCharKey(char) {
13
+ return {
14
+ id: `email-char-${char.toLowerCase()}`,
15
+ type: "char",
16
+ label: {
17
+ lower: char.toLowerCase(),
18
+ upper: char.toUpperCase()
19
+ },
20
+ value: {
21
+ lower: char.toLowerCase(),
22
+ upper: char.toUpperCase()
23
+ }
24
+ };
25
+ }
26
+ function snippet(label, id) {
27
+ return {
28
+ id: id || `email-snippet-${label.replace(/[^a-z0-9]/gi, "")}`,
29
+ type: "char",
30
+ label,
31
+ value: label,
32
+ className: "key-snippet"
33
+ };
34
+ }
35
+ const EMAIL_SUFFIXES = [
36
+ "@qq.com",
37
+ "@163.com",
38
+ "@126.com",
39
+ "@gmail.com",
40
+ "@outlook.com",
41
+ "@hotmail.com",
42
+ "@sina.com",
43
+ "@sohu.com",
44
+ "@icloud.com",
45
+ "@foxmail.com",
46
+ "@yeah.net",
47
+ "@139.com"
48
+ ];
49
+ const emailLayout = {
50
+ type: "email",
51
+ name: "邮箱键盘",
52
+ supportShift: true,
53
+ defaultUpperCase: false,
54
+ switchable: ["symbol", "number"],
55
+ rows: [
56
+ { keys: "qwertyuiop".split("").map(createCharKey) },
57
+ { keys: "asdfghjkl".split("").map(createCharKey) },
58
+ { keys: [
59
+ {
60
+ id: "shift",
61
+ type: "shift",
62
+ icon: ICON_SHIFT,
63
+ label: "",
64
+ width: 1.5,
65
+ className: "key-shift"
66
+ },
67
+ ..."zxcvbnm".split("").map(createCharKey),
68
+ {
69
+ id: "backspace",
70
+ type: "backspace",
71
+ icon: ICON_DELETE,
72
+ label: "",
73
+ width: 1.5,
74
+ className: "key-backspace"
75
+ }
76
+ ] },
77
+ { keys: [
78
+ {
79
+ id: "switch-number",
80
+ type: "tab",
81
+ label: "123",
82
+ width: 1.25,
83
+ className: "key-switch",
84
+ data: { targetType: "number" }
85
+ },
86
+ {
87
+ id: "email-at",
88
+ type: "char",
89
+ label: "@",
90
+ value: "@",
91
+ className: "key-at"
92
+ },
93
+ {
94
+ id: "email-suffix",
95
+ type: "char",
96
+ label: ".com",
97
+ value: "",
98
+ width: 1.5,
99
+ className: "key-suffix",
100
+ options: EMAIL_SUFFIXES
101
+ },
102
+ snippet(".", "email-dot"),
103
+ snippet("-", "email-dash"),
104
+ snippet("_", "email-underscore"),
105
+ {
106
+ id: "space",
107
+ type: "space",
108
+ label: "",
109
+ value: " ",
110
+ width: 2,
111
+ className: "key-space"
112
+ },
113
+ {
114
+ id: "email-done",
115
+ type: "done",
116
+ label: "确定",
117
+ width: 1.5,
118
+ className: "key-done"
119
+ }
120
+ ] }
121
+ ]
122
+ };
123
+ //#endregion
124
+ export { EMAIL_SUFFIXES, emailLayout };
125
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
126
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","names":[],"sources":["../../src/layouts/email.ts"],"sourcesContent":["/**\n * 邮箱键盘布局\n * @module layouts/email\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport { ICON_DELETE, ICON_SHIFT } from '../icons'\n\n/**\n * 创建字符按键(支持大小写)\n */\nfunction createCharKey(char: string): KeyDefinition {\n return {\n id: `email-char-${char.toLowerCase()}`,\n type: 'char',\n label: { lower: char.toLowerCase(), upper: char.toUpperCase() },\n value: { lower: char.toLowerCase(), upper: char.toUpperCase() },\n }\n}\n\n/**\n * 创建快捷片段按键\n */\nfunction snippet(label: string, id?: string): KeyDefinition {\n return {\n id: id || `email-snippet-${label.replace(/[^a-z0-9]/gi, '')}`,\n type: 'char',\n label,\n value: label,\n className: 'key-snippet',\n }\n}\n\n/**\n * 常见邮箱后缀列表\n */\nexport const EMAIL_SUFFIXES = [\n '@qq.com',\n '@163.com',\n '@126.com',\n '@gmail.com',\n '@outlook.com',\n '@hotmail.com',\n '@sina.com',\n '@sohu.com',\n '@icloud.com',\n '@foxmail.com',\n '@yeah.net',\n '@139.com',\n]\n\nexport const emailLayout: KeyboardConfig = {\n type: 'email',\n name: '邮箱键盘',\n supportShift: true,\n defaultUpperCase: false,\n switchable: ['symbol', 'number'],\n rows: [\n // QWERTY 第一行\n {\n keys: 'qwertyuiop'.split('').map(createCharKey),\n },\n // QWERTY 第二行\n {\n keys: 'asdfghjkl'.split('').map(createCharKey),\n },\n // QWERTY 第三行 + Shift + 退格\n {\n keys: [\n {\n id: 'shift',\n type: 'shift',\n icon: ICON_SHIFT,\n label: '',\n width: 1.5,\n className: 'key-shift',\n },\n ...'zxcvbnm'.split('').map(createCharKey),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 1.5,\n className: 'key-backspace',\n },\n ],\n },\n // 底部行:切换 + @ + 常用邮箱 + 符号 + 空格 + 完成\n {\n keys: [\n { id: 'switch-number', type: 'tab', label: '123', width: 1.25, className: 'key-switch', data: { targetType: 'number' } },\n {\n id: 'email-at',\n type: 'char',\n label: '@',\n value: '@',\n className: 'key-at',\n },\n {\n id: 'email-suffix',\n type: 'char',\n label: '.com',\n value: '',\n width: 1.5,\n className: 'key-suffix',\n options: EMAIL_SUFFIXES,\n },\n snippet('.', 'email-dot'),\n snippet('-', 'email-dash'),\n snippet('_', 'email-underscore'),\n { id: 'space', type: 'space', label: '', value: ' ', width: 2, className: 'key-space' },\n { id: 'email-done', type: 'done', label: '确定', width: 1.5, className: 'key-done' },\n ],\n },\n ],\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,cAAc,MAA6B;CAClD,OAAO;EACL,IAAI,cAAc,KAAK,YAAY;EACnC,MAAM;EACN,OAAO;GAAE,OAAO,KAAK,YAAY;GAAG,OAAO,KAAK,YAAY;EAAE;EAC9D,OAAO;GAAE,OAAO,KAAK,YAAY;GAAG,OAAO,KAAK,YAAY;EAAE;CAChE;AACF;AAKA,SAAS,QAAQ,OAAe,IAA4B;CAC1D,OAAO;EACL,IAAI,MAAM,iBAAiB,MAAM,QAAQ,eAAe,EAAE;EAC1D,MAAM;EACN;EACA,OAAO;EACP,WAAW;CACb;AACF;AAKO,MAAM,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEO,MAAM,cAA8B;CACzC,MAAM;CACN,MAAM;CACN,cAAc;CACd,kBAAkB;CAClB,YAAY,CAAC,UAAU,QAAQ;CAC/B,MAAM;EAEJ,EACE,MAAM,aAAa,MAAM,EAAE,CAAA,CAAE,IAAI,aAAa,EAChD;EAEA,EACE,MAAM,YAAY,MAAM,EAAE,CAAA,CAAE,IAAI,aAAa,EAC/C;EAEA,EACE,MAAM;GACJ;IACE,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,WAAW;GACb;GACA,GAAG,UAAU,MAAM,EAAE,CAAA,CAAE,IAAI,aAAa;GACxC;IACE,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,WAAW;GACb;EACF,EACF;EAEA,EACE,MAAM;GACJ;IAAE,IAAI;IAAiB,MAAM;IAAO,OAAO;IAAO,OAAO;IAAM,WAAW;IAAc,MAAM,EAAE,YAAY,SAAS;GAAE;GACvH;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,OAAO;IACP,WAAW;GACb;GACA;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,WAAW;IACX,SAAS;GACX;GACA,QAAQ,KAAK,WAAW;GACxB,QAAQ,KAAK,YAAY;GACzB,QAAQ,KAAK,kBAAkB;GAC/B;IAAE,IAAI;IAAS,MAAM;IAAS,OAAO;IAAI,OAAO;IAAK,OAAO;IAAG,WAAW;GAAY;GACtF;IAAE,IAAI;IAAc,MAAM;IAAQ,OAAO;IAAM,OAAO;IAAK,WAAW;GAAW;EACnF,EACF;CACF;AACF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 身份证号键盘布局
3
+ * @module layouts/idcard
4
+ */
5
+ import type { KeyboardConfig } from '../types';
6
+ /**
7
+ * 身份证号键盘配置
8
+ * 紧凑3x4布局,无空白位置
9
+ * 布局结构:
10
+ * 第1行: 1 2 3 [退格]
11
+ * 第2行: 4 5 6 [清除]
12
+ * 第3行: 7 8 9 X
13
+ * 第4行: [关闭] 0 [确定(占2格)]
14
+ */
15
+ export declare const idcardLayout: KeyboardConfig;
16
+ //# sourceMappingURL=idcard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idcard.d.ts","sourceRoot":"","sources":["../../src/layouts/idcard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAA;AAmB7D;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,cA8E1B,CAAA"}
@@ -0,0 +1,99 @@
1
+ /*!
2
+ * ***********************************
3
+ * @composy/keyboard-core v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-08-17 11:33:29 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ import { ICON_CLEAR, ICON_DELETE } from "../icons.js";
11
+ //#region src/layouts/idcard.ts
12
+ function createNumberKey(num) {
13
+ return {
14
+ id: `idcard-${num}`,
15
+ type: "char",
16
+ label: num,
17
+ value: num,
18
+ className: "key-num"
19
+ };
20
+ }
21
+ const idcardLayout = {
22
+ type: "idcard",
23
+ name: "身份证键盘",
24
+ supportShift: false,
25
+ rows: [
26
+ {
27
+ className: "numpad-row",
28
+ keys: [
29
+ createNumberKey("1"),
30
+ createNumberKey("2"),
31
+ createNumberKey("3"),
32
+ {
33
+ id: "backspace",
34
+ type: "backspace",
35
+ icon: ICON_DELETE,
36
+ label: "",
37
+ className: "key-numpad-fn"
38
+ }
39
+ ]
40
+ },
41
+ {
42
+ className: "numpad-row",
43
+ keys: [
44
+ createNumberKey("4"),
45
+ createNumberKey("5"),
46
+ createNumberKey("6"),
47
+ {
48
+ id: "clear",
49
+ type: "clear",
50
+ icon: ICON_CLEAR,
51
+ label: "",
52
+ className: "key-numpad-fn"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ className: "numpad-row",
58
+ keys: [
59
+ createNumberKey("7"),
60
+ createNumberKey("8"),
61
+ createNumberKey("9"),
62
+ {
63
+ id: "idcard-x",
64
+ type: "char",
65
+ label: "X",
66
+ value: "X",
67
+ className: "key-num"
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ className: "numpad-row",
73
+ keys: [
74
+ {
75
+ id: "close",
76
+ type: "close",
77
+ label: "关闭",
78
+ className: "key-numpad-fn"
79
+ },
80
+ createNumberKey("0"),
81
+ {
82
+ id: "done",
83
+ type: "done",
84
+ label: "确定",
85
+ width: 2,
86
+ className: "key-numpad-done"
87
+ }
88
+ ]
89
+ }
90
+ ],
91
+ data: {
92
+ maxLength: 18,
93
+ inputType: "idcard"
94
+ }
95
+ };
96
+ //#endregion
97
+ export { idcardLayout };
98
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
99
+ //# sourceMappingURL=idcard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idcard.js","names":[],"sources":["../../src/layouts/idcard.ts"],"sourcesContent":["/**\n * 身份证号键盘布局\n * @module layouts/idcard\n */\n\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 从图标模块中导入删除键图标和清除键图标\nimport { ICON_DELETE, ICON_CLEAR } from '../icons'\n\n/**\n * 创建数字按键\n * @param num - 数字字符串(如 '0'-'9')\n * @returns 返回一个按键定义对象\n */\nfunction createNumberKey(num: string): KeyDefinition {\n return {\n id: `idcard-${num}`, // 按键唯一标识符,格式为 idcard-数字\n type: 'char', // 按键类型为字符键\n label: num, // 按键上显示的文本\n value: num, // 按键按下后输出的值\n className: 'key-num', // 按键的 CSS 类名,用于样式定制\n }\n}\n\n/**\n * 身份证号键盘配置\n * 紧凑3x4布局,无空白位置\n * 布局结构:\n * 第1行: 1 2 3 [退格]\n * 第2行: 4 5 6 [清除]\n * 第3行: 7 8 9 X\n * 第4行: [关闭] 0 [确定(占2格)]\n */\nexport const idcardLayout: KeyboardConfig = {\n type: 'idcard', // 键盘类型标识\n name: '身份证键盘', // 键盘的显示名称\n supportShift: false, // 不支持 Shift 切换(纯数字+X键盘无需切换)\n rows: [ // 键盘的行数组\n // ---- 第1行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [ // 该行包含的按键数组\n createNumberKey('1'), // 数字键 1\n createNumberKey('2'), // 数字键 2\n createNumberKey('3'), // 数字键 3\n {\n id: 'backspace', // 退格键的唯一标识\n type: 'backspace', // 按键类型为退格,删除最后一个字符\n icon: ICON_DELETE, // 使用删除图标作为显示内容\n label: '', // 无文本标签(由图标替代)\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n },\n ],\n },\n // ---- 第2行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [\n createNumberKey('4'), // 数字键 4\n createNumberKey('5'), // 数字键 5\n createNumberKey('6'), // 数字键 6\n {\n id: 'clear', // 清除键的唯一标识\n type: 'clear', // 按键类型为清除,清空所有输入\n icon: ICON_CLEAR, // 使用清除图标作为显示内容\n label: '', // 无文本标签\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n },\n ],\n },\n // ---- 第3行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [\n createNumberKey('7'), // 数字键 7\n createNumberKey('8'), // 数字键 8\n createNumberKey('9'), // 数字键 9\n {\n id: 'idcard-x', // X 键的唯一标识\n type: 'char', // 按键类型为字符\n label: 'X', // 按钮上显示的文本(身份证尾号可能是X)\n value: 'X', // 按下后输出的值\n className: 'key-num', // 使用数字键的 CSS 类名,保持外观一致\n },\n ],\n },\n // ---- 第4行 ----\n {\n className: 'numpad-row', // 行的 CSS 类名\n keys: [\n {\n id: 'close', // 关闭键的唯一标识\n type: 'close', // 按键类型为关闭,收起键盘\n label: '关闭', // 按钮上显示的文本\n className: 'key-numpad-fn', // 功能键的 CSS 类名\n },\n createNumberKey('0'), // 数字键 0\n {\n id: 'done', // 确定键的唯一标识\n type: 'done', // 按键类型为确定,完成输入\n label: '确定', // 按钮上显示的文本\n width: 2, // 占据 2 个键的宽度\n className: 'key-numpad-done', // 确定键的 CSS 类名\n },\n ],\n },\n ],\n data: { // 键盘的附加数据\n maxLength: 18, // 身份证号最大输入长度为 18 位\n inputType: 'idcard', // 输入类型标识,用于外部判断\n },\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAWO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EAEJ;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * 键盘布局管理
3
+ * @module layouts
4
+ */
5
+ import type { KeyboardConfig, KeyboardType } from '../types';
6
+ import { qwertyLayout } from './qwerty';
7
+ import { integerLayout, numberLayout } from './number';
8
+ import { symbolLayout, symbolLayout2 } from './symbol';
9
+ import { licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, PLATE_LETTERS, PROVINCES } from './license-plate';
10
+ import { idcardLayout } from './idcard';
11
+ import { phoneLayout, phoneSimpleLayout } from './phone';
12
+ import { amountLayout, amountSimpleLayout } from './amount';
13
+ import { bankcardLayout } from './bankcard';
14
+ import { verifycodeLayout } from './verifycode';
15
+ import { emailLayout, EMAIL_SUFFIXES } from './email';
16
+ import { urlLayout } from './url';
17
+ import { searchLayout } from './search';
18
+ import { punctLayout } from './punct';
19
+ export { qwertyLayout, numberLayout, integerLayout, symbolLayout, symbolLayout2, licensePlateLayout, licensePlateProvinceLayout, licensePlateLetterLayout, licensePlateAlphanumericLayout, PROVINCES, PLATE_LETTERS, idcardLayout, phoneLayout, phoneSimpleLayout, amountLayout, amountSimpleLayout, bankcardLayout, verifycodeLayout, emailLayout, urlLayout, searchLayout, EMAIL_SUFFIXES, punctLayout, };
20
+ /**
21
+ * 注册自定义布局
22
+ * @param name - 布局名称
23
+ * @param layout - 布局配置
24
+ */
25
+ export declare function registerLayout(name: string, layout: KeyboardConfig): void;
26
+ /**
27
+ * 获取布局配置
28
+ * @param type - 键盘类型或布局名称
29
+ * @returns 布局配置,如果不存在则返回 undefined
30
+ */
31
+ export declare function getLayout(type: KeyboardType | string): KeyboardConfig | undefined;
32
+ /**
33
+ * 获取所有可用布局名称
34
+ * @returns 布局名称数组
35
+ */
36
+ export declare function getAvailableLayouts(): string[];
37
+ /**
38
+ * 检查布局是否存在
39
+ * @param name - 布局名称
40
+ * @returns 是否存在
41
+ */
42
+ export declare function hasLayout(name: string): boolean;
43
+ /**
44
+ * 移除自定义布局
45
+ * @param name - 布局名称
46
+ * @returns 是否成功移除
47
+ */
48
+ export declare function unregisterLayout(name: string): boolean;
49
+ /**
50
+ * 批量注册布局
51
+ * @param layouts - 布局映射对象
52
+ */
53
+ export declare function registerLayouts(layouts: Record<string, KeyboardConfig>): void;
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layouts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EACL,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,aAAa,EACb,SAAS,EACV,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,SAAS,EACT,aAAa,EAEb,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAEhB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,cAAc,EAEd,WAAW,GACZ,CAAA;AAoCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,CAEjF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMtD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI,CAI7E"}
@@ -0,0 +1,78 @@
1
+ /*!
2
+ * ***********************************
3
+ * @composy/keyboard-core v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-08-17 11:33:29 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ import { qwertyLayout } from "./qwerty.js";
11
+ import { integerLayout, numberLayout } from "./number.js";
12
+ import { symbolLayout, symbolLayout2 } from "./symbol.js";
13
+ import { PLATE_LETTERS, PROVINCES, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout } from "./license-plate.js";
14
+ import { idcardLayout } from "./idcard.js";
15
+ import { phoneLayout, phoneSimpleLayout } from "./phone.js";
16
+ import { amountLayout, amountSimpleLayout } from "./amount.js";
17
+ import { bankcardLayout } from "./bankcard.js";
18
+ import { verifycodeLayout } from "./verifycode.js";
19
+ import { EMAIL_SUFFIXES, emailLayout } from "./email.js";
20
+ import { urlLayout } from "./url.js";
21
+ import { searchLayout } from "./search.js";
22
+ import { punctLayout } from "./punct.js";
23
+ //#region src/layouts/index.ts
24
+ const builtinLayouts = {
25
+ "qwerty": qwertyLayout,
26
+ "number": numberLayout,
27
+ "integer": integerLayout,
28
+ "symbol": symbolLayout,
29
+ "symbol-2": symbolLayout2,
30
+ "license-plate": licensePlateLayout,
31
+ "license-plate-province": licensePlateProvinceLayout,
32
+ "license-plate-letter": licensePlateLetterLayout,
33
+ "license-plate-alphanumeric": licensePlateAlphanumericLayout,
34
+ "idcard": idcardLayout,
35
+ "phone": phoneLayout,
36
+ "phone-simple": phoneSimpleLayout,
37
+ "amount": amountLayout,
38
+ "amount-simple": amountSimpleLayout,
39
+ "bankcard": bankcardLayout,
40
+ "verifycode": verifycodeLayout,
41
+ "email": emailLayout,
42
+ "url": urlLayout,
43
+ "search": searchLayout,
44
+ "punct": punctLayout
45
+ };
46
+ const customLayouts = {};
47
+ function registerLayout(name, layout) {
48
+ if (builtinLayouts[name]) {
49
+ console.warn(`[Keyboard] Cannot override builtin layout "${name}"`);
50
+ return;
51
+ }
52
+ customLayouts[name] = layout;
53
+ }
54
+ function getLayout(type) {
55
+ return customLayouts[type] || builtinLayouts[type];
56
+ }
57
+ function getAvailableLayouts() {
58
+ return [...Object.keys(builtinLayouts), ...Object.keys(customLayouts)];
59
+ }
60
+ function hasLayout(name) {
61
+ return name in builtinLayouts || name in customLayouts;
62
+ }
63
+ function unregisterLayout(name) {
64
+ if (name in customLayouts) {
65
+ delete customLayouts[name];
66
+ return true;
67
+ }
68
+ return false;
69
+ }
70
+ function registerLayouts(layouts) {
71
+ Object.entries(layouts).forEach(([name, layout]) => {
72
+ registerLayout(name, layout);
73
+ });
74
+ }
75
+ //#endregion
76
+ export { EMAIL_SUFFIXES, PLATE_LETTERS, PROVINCES, amountLayout, amountSimpleLayout, bankcardLayout, emailLayout, getAvailableLayouts, getLayout, hasLayout, idcardLayout, integerLayout, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, numberLayout, phoneLayout, phoneSimpleLayout, punctLayout, qwertyLayout, registerLayout, registerLayouts, searchLayout, symbolLayout, symbolLayout2, unregisterLayout, urlLayout, verifycodeLayout };
77
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/layouts/index.ts"],"sourcesContent":["/**\n * 键盘布局管理\n * @module layouts\n */\n\nimport type { KeyboardConfig, KeyboardType } from '../types'\nimport { qwertyLayout } from './qwerty'\nimport { integerLayout, numberLayout } from './number'\nimport { symbolLayout, symbolLayout2 } from './symbol'\nimport {\n licensePlateAlphanumericLayout,\n licensePlateLayout,\n licensePlateLetterLayout,\n licensePlateProvinceLayout,\n PLATE_LETTERS,\n PROVINCES,\n} from './license-plate'\nimport { idcardLayout } from './idcard'\nimport { phoneLayout, phoneSimpleLayout } from './phone'\nimport { amountLayout, amountSimpleLayout } from './amount'\nimport { bankcardLayout } from './bankcard'\nimport { verifycodeLayout } from './verifycode'\nimport { emailLayout, EMAIL_SUFFIXES } from './email'\nimport { urlLayout } from './url'\nimport { searchLayout } from './search'\nimport { punctLayout } from './punct'\n\n// 导出所有布局\nexport {\n qwertyLayout,\n numberLayout,\n integerLayout,\n symbolLayout,\n symbolLayout2,\n licensePlateLayout,\n licensePlateProvinceLayout,\n licensePlateLetterLayout,\n licensePlateAlphanumericLayout,\n PROVINCES,\n PLATE_LETTERS,\n // 场景化键盘\n idcardLayout,\n phoneLayout,\n phoneSimpleLayout,\n amountLayout,\n amountSimpleLayout,\n bankcardLayout,\n verifycodeLayout,\n // 输入场景键盘\n emailLayout,\n urlLayout,\n searchLayout,\n EMAIL_SUFFIXES,\n // 标点键盘\n punctLayout,\n}\n\n/**\n * 内置布局映射\n */\nconst builtinLayouts: Record<string, KeyboardConfig> = {\n 'qwerty': qwertyLayout,\n 'number': numberLayout,\n 'integer': integerLayout,\n 'symbol': symbolLayout,\n 'symbol-2': symbolLayout2,\n 'license-plate': licensePlateLayout,\n 'license-plate-province': licensePlateProvinceLayout,\n 'license-plate-letter': licensePlateLetterLayout,\n 'license-plate-alphanumeric': licensePlateAlphanumericLayout,\n // 场景化键盘\n 'idcard': idcardLayout,\n 'phone': phoneLayout,\n 'phone-simple': phoneSimpleLayout,\n 'amount': amountLayout,\n 'amount-simple': amountSimpleLayout,\n 'bankcard': bankcardLayout,\n 'verifycode': verifycodeLayout,\n // 输入场景键盘\n 'email': emailLayout,\n 'url': urlLayout,\n 'search': searchLayout,\n // 标点键盘\n 'punct': punctLayout,\n}\n\n/**\n * 自定义布局存储\n */\nconst customLayouts: Record<string, KeyboardConfig> = {}\n\n/**\n * 注册自定义布局\n * @param name - 布局名称\n * @param layout - 布局配置\n */\nexport function registerLayout(name: string, layout: KeyboardConfig): void {\n if (builtinLayouts[name]) {\n console.warn(`[Keyboard] Cannot override builtin layout \"${name}\"`)\n return\n }\n customLayouts[name] = layout\n}\n\n/**\n * 获取布局配置\n * @param type - 键盘类型或布局名称\n * @returns 布局配置,如果不存在则返回 undefined\n */\nexport function getLayout(type: KeyboardType | string): KeyboardConfig | undefined {\n return customLayouts[type] || builtinLayouts[type]\n}\n\n/**\n * 获取所有可用布局名称\n * @returns 布局名称数组\n */\nexport function getAvailableLayouts(): string[] {\n return [...Object.keys(builtinLayouts), ...Object.keys(customLayouts)]\n}\n\n/**\n * 检查布局是否存在\n * @param name - 布局名称\n * @returns 是否存在\n */\nexport function hasLayout(name: string): boolean {\n return name in builtinLayouts || name in customLayouts\n}\n\n/**\n * 移除自定义布局\n * @param name - 布局名称\n * @returns 是否成功移除\n */\nexport function unregisterLayout(name: string): boolean {\n if (name in customLayouts) {\n delete customLayouts[name]\n return true\n }\n return false\n}\n\n/**\n * 批量注册布局\n * @param layouts - 布局映射对象\n */\nexport function registerLayouts(layouts: Record<string, KeyboardConfig>): void {\n Object.entries(layouts).forEach(([name, layout]) => {\n registerLayout(name, layout)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,iBAAiD;CACrD,UAAU;CACV,UAAU;CACV,WAAW;CACX,UAAU;CACV,YAAY;CACZ,iBAAiB;CACjB,0BAA0B;CAC1B,wBAAwB;CACxB,8BAA8B;CAE9B,UAAU;CACV,SAAS;CACT,gBAAgB;CAChB,UAAU;CACV,iBAAiB;CACjB,YAAY;CACZ,cAAc;CAEd,SAAS;CACT,OAAO;CACP,UAAU;CAEV,SAAS;AACX;AAKA,MAAM,gBAAgD,CAAC;AAOhD,SAAS,eAAe,MAAc,QAA8B;CACzE,IAAI,eAAe,OAAO;EACxB,QAAQ,KAAK,8CAA8C,KAAI,EAAG;EAClE;CACF;CACA,cAAc,QAAQ;AACxB;AAOO,SAAS,UAAU,MAAyD;CACjF,OAAO,cAAc,SAAS,eAAe;AAC/C;AAMO,SAAS,sBAAgC;CAC9C,OAAO,CAAC,GAAG,OAAO,KAAK,cAAc,GAAG,GAAG,OAAO,KAAK,aAAa,CAAC;AACvE;AAOO,SAAS,UAAU,MAAuB;CAC/C,OAAO,QAAQ,kBAAkB,QAAQ;AAC3C;AAOO,SAAS,iBAAiB,MAAuB;CACtD,IAAI,QAAQ,eAAe;EACzB,OAAO,cAAc;EACrB,OAAO;CACT;CACA,OAAO;AACT;AAMO,SAAS,gBAAgB,SAA+C;CAC7E,OAAO,QAAQ,OAAO,CAAA,CAAE,SAAS,CAAC,MAAM,YAAY;EAClD,eAAe,MAAM,MAAM;CAC7B,CAAC;AACH"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 车牌号键盘布局
3
+ * @module layouts/license-plate
4
+ * 省份键盘类似26键布局,点击省份后自动切换到字母数字键盘
5
+ */
6
+ import type { KeyboardConfig } from '../types';
7
+ /**
8
+ * 省份简称列表(按地理区域排列,10列布局)
9
+ */
10
+ export declare const PROVINCES: string[];
11
+ /**
12
+ * 车牌字母(排除 I 和 O,避免与数字混淆)
13
+ */
14
+ export declare const PLATE_LETTERS: string[];
15
+ /**
16
+ * 省份键盘配置 - 类似26键布局
17
+ * 10列布局,更紧凑美观
18
+ */
19
+ export declare const licensePlateProvinceLayout: KeyboardConfig;
20
+ /**
21
+ * 字母数字键盘配置(车牌第2-8位)
22
+ * 10列布局
23
+ */
24
+ export declare const licensePlateAlphanumericLayout: KeyboardConfig;
25
+ /**
26
+ * 纯字母键盘配置(车牌第2位,只能输入字母)
27
+ * 6列布局,排除 I 和 O
28
+ */
29
+ export declare const licensePlateLetterLayout: KeyboardConfig;
30
+ /**
31
+ * 完整车牌号键盘(自动切换模式)
32
+ * 默认显示省份键盘,点击省份后自动切换到字母数字键盘
33
+ */
34
+ export declare const licensePlateLayout: KeyboardConfig;
35
+ //# sourceMappingURL=license-plate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"license-plate.d.ts","sourceRoot":"","sources":["../../src/layouts/license-plate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAA;AAG7D;;GAEG;AACH,eAAO,MAAM,SAAS,UAKrB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,UAIzB,CAAA;AA0CD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,cA2DxC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,cAkE5C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,cAoDtC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAUhC,CAAA"}