@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 @@
1
+ (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.LDesignKeyboardCore={}));})(this,function(exports){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function createCharKey$4(char){return{id:`char-${char.toLowerCase()}`,type:"char",label:{lower:char.toLowerCase(),upper:char.toUpperCase()},value:{lower:char.toLowerCase(),upper:char.toUpperCase()}};}const qwertyLayout={type:"qwerty",name:"字母键盘",supportShift:true,defaultUpperCase:false,switchable:["number","symbol"],rows:[{keys:[createCharKey$4("Q"),createCharKey$4("W"),createCharKey$4("E"),createCharKey$4("R"),createCharKey$4("T"),createCharKey$4("Y"),createCharKey$4("U"),createCharKey$4("I"),createCharKey$4("O"),createCharKey$4("P")]},{keys:[createCharKey$4("A"),createCharKey$4("S"),createCharKey$4("D"),createCharKey$4("F"),createCharKey$4("G"),createCharKey$4("H"),createCharKey$4("J"),createCharKey$4("K"),createCharKey$4("L")]},{keys:[{id:"shift",type:"shift",label:"⇧",width:1.5,className:"key-shift"},createCharKey$4("Z"),createCharKey$4("X"),createCharKey$4("C"),createCharKey$4("V"),createCharKey$4("B"),createCharKey$4("N"),createCharKey$4("M"),{id:"backspace",type:"backspace",label:"⌫",width:1.5,className:"key-backspace"}]},{keys:[{id:"switch-number",type:"tab",label:"123",width:1.5,className:"key-switch",data:{targetType:"number"}},{id:"switch-symbol",type:"tab",label:"#+=",width:1.25,className:"key-switch",data:{targetType:"symbol"}},{id:"space",type:"space",label:"空格",value:" ",width:4,className:"key-space"},{id:"done",type:"done",label:"完成",width:2,className:"key-done"}]}]};const ICON_DELETE=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z"/><path d="m12 9 6 6"/><path d="m18 9-6 6"/></svg>`;const ICON_CLEAR=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`;const ICON_CLOSE=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;const ICON_CHECK=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>`;const ICON_ENTER=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 10 4 15 9 20"/><path d="M20 4v7a4 4 0 0 1-4 4H4"/></svg>`;const ICON_SHIFT=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18v-6H5l7-7 7 7h-4v6H9z"/></svg>`;const ICON_SPACE=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1"/></svg>`;const ICON_KEYBOARD=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="M6 8h.001"/><path d="M10 8h.001"/><path d="M14 8h.001"/><path d="M18 8h.001"/><path d="M8 12h.001"/><path d="M12 12h.001"/><path d="M16 12h.001"/><path d="M7 16h10"/></svg>`;const ICON_VOICE=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`;const ICONS={delete:ICON_DELETE,clear:ICON_CLEAR,close:ICON_CLOSE,check:ICON_CHECK,enter:ICON_ENTER,shift:ICON_SHIFT,space:ICON_SPACE,keyboard:ICON_KEYBOARD,voice:ICON_VOICE};function createNumberKey$6(num){return{id:`num-${num}`,type:"char",label:num,value:num,className:"key-num"};}const numberLayout={type:"number",name:"数字键盘",supportShift:false,switchable:["qwerty","symbol"],rows:[{className:"numpad-row",keys:[createNumberKey$6("1"),createNumberKey$6("2"),createNumberKey$6("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$6("4"),createNumberKey$6("5"),createNumberKey$6("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$6("7"),createNumberKey$6("8"),createNumberKey$6("9"),{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[{id:"decimal",type:"char",label:".",value:".",className:"key-num"},createNumberKey$6("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}]};const integerLayout={type:"integer",name:"整数键盘",supportShift:false,switchable:["qwerty"],rows:[{className:"numpad-row",keys:[createNumberKey$6("1"),createNumberKey$6("2"),createNumberKey$6("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$6("4"),createNumberKey$6("5"),createNumberKey$6("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$6("7"),createNumberKey$6("8"),createNumberKey$6("9"),{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[{id:"switch-qwerty",type:"tab",label:"ABC",className:"key-numpad-fn",data:{targetType:"qwerty"}},createNumberKey$6("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}]};function createSymbolKey(symbol,id){return{id:id||`symbol-${symbol.charCodeAt(0)}`,type:"char",label:symbol,value:symbol};}const symbolLayout={type:"symbol",name:"符号键盘",supportShift:false,switchable:["qwerty","number"],rows:[{keys:[createSymbolKey("1"),createSymbolKey("2"),createSymbolKey("3"),createSymbolKey("4"),createSymbolKey("5"),createSymbolKey("6"),createSymbolKey("7"),createSymbolKey("8"),createSymbolKey("9"),createSymbolKey("0")]},{keys:[createSymbolKey("-"),createSymbolKey("/"),createSymbolKey(":"),createSymbolKey(";"),createSymbolKey("("),createSymbolKey(")"),createSymbolKey("¥","yen"),createSymbolKey("@"),createSymbolKey("\"","quote")]},{keys:[{id:"switch-symbol-2",type:"tab",label:"#+=",width:1.5,className:"key-switch",data:{targetType:"symbol-2"}},createSymbolKey("."),createSymbolKey(","),createSymbolKey("?"),createSymbolKey("!"),createSymbolKey("'","apostrophe"),{id:"backspace",type:"backspace",label:"⌫",width:1.5,className:"key-backspace"}]},{keys:[{id:"switch-qwerty",type:"tab",label:"ABC",width:1.5,className:"key-switch",data:{targetType:"qwerty"}},{id:"switch-number",type:"tab",label:"123",width:1.25,className:"key-switch",data:{targetType:"number"}},{id:"space",type:"space",label:"空格",value:" ",width:4,className:"key-space"},{id:"done",type:"done",label:"完成",width:2,className:"key-done"}]}]};const symbolLayout2={type:"symbol",name:"符号键盘2",supportShift:false,switchable:["qwerty","number"],rows:[{keys:[createSymbolKey("["),createSymbolKey("]"),createSymbolKey("{"),createSymbolKey("}"),createSymbolKey("#"),createSymbolKey("%"),createSymbolKey("^"),createSymbolKey("*"),createSymbolKey("+"),createSymbolKey("=")]},{keys:[createSymbolKey("_"),createSymbolKey("\\"),createSymbolKey("|"),createSymbolKey("~"),createSymbolKey("<"),createSymbolKey(">"),createSymbolKey("€","euro"),createSymbolKey("$"),createSymbolKey("&")]},{keys:[{id:"switch-symbol-1",type:"tab",label:"123",width:1.5,className:"key-switch",data:{targetType:"symbol"}},createSymbolKey("`","backtick"),createSymbolKey("·","middle-dot"),createSymbolKey("…","ellipsis"),createSymbolKey("°","degree"),createSymbolKey("•","bullet"),{id:"backspace",type:"backspace",label:"⌫",width:1.5,className:"key-backspace"}]},{keys:[{id:"switch-qwerty",type:"tab",label:"ABC",width:1.5,className:"key-switch",data:{targetType:"qwerty"}},{id:"switch-number",type:"tab",label:"123",width:1.25,className:"key-switch",data:{targetType:"number"}},{id:"space",type:"space",label:"空格",value:" ",width:4,className:"key-space"},{id:"done",type:"done",label:"完成",width:2,className:"key-done"}]}]};const PROVINCES=["京","津","沪","渝","冀","豫","云","辽","黑","湘","皖","鲁","新","苏","浙","赣","鄂","桂","甘","晋","蒙","陕","吉","闽","贵","粤","青","藏","川","宁","琼","港","澳"];const PLATE_LETTERS=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z"];function createProvinceKey(province){return{id:`province-${province}`,type:"char",label:province,value:province,className:"key-plate-province",data:{switchAfterInput:"license-plate-alphanumeric"}};}function createLetterKey(letter){return{id:`letter-${letter}`,type:"char",label:letter,value:letter,className:"key-plate-letter"};}function createNumberKey$5(num){return{id:`num-${num}`,type:"char",label:num,value:num,className:"key-plate-number"};}const licensePlateProvinceLayout={type:"license-plate-province",name:"省份简称",supportShift:false,rows:[{className:"plate-keyboard-row",keys:PROVINCES.slice(0,10).map(createProvinceKey)},{className:"plate-keyboard-row",keys:PROVINCES.slice(10,20).map(createProvinceKey)},{className:"plate-keyboard-row",keys:PROVINCES.slice(20,30).map(createProvinceKey)},{className:"plate-keyboard-row",keys:[...PROVINCES.slice(30,33).map(createProvinceKey),{id:"plate-xue",type:"char",label:"学",value:"学",className:"key-plate-special",data:{switchAfterInput:"license-plate-alphanumeric"}},{id:"plate-jing",type:"char",label:"警",value:"警",className:"key-plate-special",data:{switchAfterInput:"license-plate-alphanumeric"}},{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",width:1.5,className:"key-plate-fn"},{id:"done",type:"done",label:"确定",width:2.5,className:"key-plate-done"}]}],data:{maxLength:8,inputType:"license-plate"}};const licensePlateAlphanumericLayout={type:"license-plate-alphanumeric",name:"字母数字",supportShift:false,rows:[{className:"plate-keyboard-row",keys:"1234567890".split("").map(createNumberKey$5)},{className:"plate-keyboard-row",keys:PLATE_LETTERS.slice(0,10).map(createLetterKey)},{className:"plate-keyboard-row",keys:[...PLATE_LETTERS.slice(10,19).map(createLetterKey),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-plate-fn"}]},{className:"plate-keyboard-row",keys:[{id:"switch-province",type:"tab",label:"省份",width:1.5,className:"key-plate-switch",data:{targetType:"license-plate-province"}},...PLATE_LETTERS.slice(19,24).map(createLetterKey),{id:"plate-xue",type:"char",label:"学",value:"学",className:"key-plate-special"},{id:"plate-jing",type:"char",label:"警",value:"警",className:"key-plate-special"},{id:"done",type:"done",label:"确定",width:1.5,className:"key-plate-done"}]}],data:{maxLength:8,inputType:"license-plate"}};const licensePlateLetterLayout={type:"license-plate-letter",name:"字母",supportShift:false,rows:[{className:"plate-keyboard-row",keys:PLATE_LETTERS.slice(0,8).map(createLetterKey)},{className:"plate-keyboard-row",keys:PLATE_LETTERS.slice(8,16).map(createLetterKey)},{className:"plate-keyboard-row",keys:[...PLATE_LETTERS.slice(16,24).map(createLetterKey)]},{className:"plate-keyboard-row",keys:[{id:"switch-province",type:"tab",label:"省份",width:2,className:"key-plate-switch",data:{targetType:"license-plate-province"}},{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",width:2,className:"key-plate-fn"},{id:"done",type:"done",label:"确定",width:2,className:"key-plate-done"}]}],data:{maxLength:8,inputType:"license-plate"}};const licensePlateLayout={type:"license-plate",name:"车牌号键盘",supportShift:false,data:{autoSwitch:true,maxLength:8,inputType:"license-plate"},rows:licensePlateProvinceLayout.rows};function createNumberKey$4(num){return{id:`idcard-${num}`,type:"char",label:num,value:num,className:"key-num"};}const idcardLayout={type:"idcard",name:"身份证键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey$4("1"),createNumberKey$4("2"),createNumberKey$4("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$4("4"),createNumberKey$4("5"),createNumberKey$4("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$4("7"),createNumberKey$4("8"),createNumberKey$4("9"),{id:"idcard-x",type:"char",label:"X",value:"X",className:"key-num"}]},{className:"numpad-row",keys:[{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"},createNumberKey$4("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}],data:{maxLength:18,inputType:"idcard"}};function createNumberKey$3(num){return{id:`phone-${num}`,type:"char",label:num,value:num,className:"key-num"};}const phoneLayout={type:"phone",name:"手机号键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey$3("1"),createNumberKey$3("2"),createNumberKey$3("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$3("4"),createNumberKey$3("5"),createNumberKey$3("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$3("7"),createNumberKey$3("8"),createNumberKey$3("9"),{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[{id:"phone-plus",type:"char",label:"+",value:"+",className:"key-num"},createNumberKey$3("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}],data:{maxLength:11,inputType:"phone"}};const phoneSimpleLayout={type:"phone-simple",name:"拨号键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey$3("1"),createNumberKey$3("2"),createNumberKey$3("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$3("4"),createNumberKey$3("5"),createNumberKey$3("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$3("7"),createNumberKey$3("8"),createNumberKey$3("9"),{id:"phone-hash",type:"char",label:"#",value:"#",className:"key-num"}]},{className:"numpad-row",keys:[{id:"phone-star",type:"char",label:"*",value:"*",className:"key-num"},createNumberKey$3("0"),{id:"done",type:"done",label:"拨打",width:2,className:"key-numpad-done"}]}],data:{maxLength:13,inputType:"phone"}};function createNumberKey$2(num){return{id:`amount-${num}`,type:"char",label:num,value:num,className:"key-num"};}const amountLayout={type:"amount",name:"金额键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey$2("1"),createNumberKey$2("2"),createNumberKey$2("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$2("4"),createNumberKey$2("5"),createNumberKey$2("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$2("7"),createNumberKey$2("8"),createNumberKey$2("9"),{id:"double-zero",type:"char",label:"00",value:"00",className:"key-num"}]},{className:"numpad-row",keys:[{id:"decimal",type:"char",label:".",value:".",className:"key-num"},createNumberKey$2("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}],data:{inputType:"amount",decimalPlaces:2}};const amountSimpleLayout={type:"amount-simple",name:"金额键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey$2("1"),createNumberKey$2("2"),createNumberKey$2("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$2("4"),createNumberKey$2("5"),createNumberKey$2("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$2("7"),createNumberKey$2("8"),createNumberKey$2("9"),{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[{id:"decimal",type:"char",label:".",value:".",className:"key-num"},createNumberKey$2("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}],data:{inputType:"amount",decimalPlaces:2}};function createNumberKey$1(num){return{id:`bankcard-${num}`,type:"char",label:num,value:num,className:"key-num"};}const bankcardLayout={type:"bankcard",name:"银行卡键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey$1("1"),createNumberKey$1("2"),createNumberKey$1("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$1("4"),createNumberKey$1("5"),createNumberKey$1("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey$1("7"),createNumberKey$1("8"),createNumberKey$1("9"),{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[{id:"switch-qwerty",type:"tab",label:"ABC",className:"key-numpad-fn",data:{targetType:"qwerty"}},createNumberKey$1("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}],data:{maxLength:19,inputType:"bankcard"}};function createNumberKey(num){return{id:`verify-${num}`,type:"char",label:num,value:num,className:"key-num"};}const verifycodeLayout={type:"verifycode",name:"验证码键盘",supportShift:false,rows:[{className:"numpad-row",keys:[createNumberKey("1"),createNumberKey("2"),createNumberKey("3"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey("4"),createNumberKey("5"),createNumberKey("6"),{id:"clear",type:"clear",icon:ICON_CLEAR,label:"",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[createNumberKey("7"),createNumberKey("8"),createNumberKey("9"),{id:"close",type:"close",label:"关闭",className:"key-numpad-fn"}]},{className:"numpad-row",keys:[{id:"empty",type:"char",label:"",value:"",disabled:true,className:"key-numpad-empty"},createNumberKey("0"),{id:"done",type:"done",label:"确定",width:2,className:"key-numpad-done"}]}],data:{maxLength:6,inputType:"verifycode"}};function createCharKey$3(char){return{id:`email-char-${char.toLowerCase()}`,type:"char",label:{lower:char.toLowerCase(),upper:char.toUpperCase()},value:{lower:char.toLowerCase(),upper:char.toUpperCase()}};}function snippet$1(label,id){return{id:id||`email-snippet-${label.replace(/[^a-z0-9]/gi,"")}`,type:"char",label,value:label,className:"key-snippet"};}const EMAIL_SUFFIXES=["@qq.com","@163.com","@126.com","@gmail.com","@outlook.com","@hotmail.com","@sina.com","@sohu.com","@icloud.com","@foxmail.com","@yeah.net","@139.com"];const emailLayout={type:"email",name:"邮箱键盘",supportShift:true,defaultUpperCase:false,switchable:["symbol","number"],rows:[{keys:"qwertyuiop".split("").map(createCharKey$3)},{keys:"asdfghjkl".split("").map(createCharKey$3)},{keys:[{id:"shift",type:"shift",icon:ICON_SHIFT,label:"",width:1.5,className:"key-shift"},..."zxcvbnm".split("").map(createCharKey$3),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",width:1.5,className:"key-backspace"}]},{keys:[{id:"switch-number",type:"tab",label:"123",width:1.25,className:"key-switch",data:{targetType:"number"}},{id:"email-at",type:"char",label:"@",value:"@",className:"key-at"},{id:"email-suffix",type:"char",label:".com",value:"",width:1.5,className:"key-suffix",options:EMAIL_SUFFIXES},snippet$1(".","email-dot"),snippet$1("-","email-dash"),snippet$1("_","email-underscore"),{id:"space",type:"space",label:"",value:" ",width:2,className:"key-space"},{id:"email-done",type:"done",label:"确定",width:1.5,className:"key-done"}]}]};function createCharKey$2(char){return{id:`url-char-${char.toLowerCase()}`,type:"char",label:{lower:char.toLowerCase(),upper:char.toUpperCase()},value:{lower:char.toLowerCase(),upper:char.toUpperCase()}};}function snippet(label,width){return{id:`url-snippet-${label.replace(/[^a-z0-9]/gi,"")||label.split("").map((c)=>c.charCodeAt(0)).join("")}`,type:"char",label,value:label,width,className:"key-snippet"};}const urlLayout={type:"url",name:"网址键盘",supportShift:true,defaultUpperCase:false,switchable:["symbol","number"],rows:[{keys:"qwertyuiop".split("").map(createCharKey$2)},{keys:"asdfghjkl".split("").map(createCharKey$2)},{keys:[{id:"shift",type:"shift",icon:ICON_SHIFT,label:"",width:1.5,className:"key-shift"},..."zxcvbnm".split("").map(createCharKey$2),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",width:1.5,className:"key-backspace"}]},{keys:[{id:"switch-number",type:"tab",label:"123",width:1.2,className:"key-switch",data:{targetType:"number"}},snippet("/",.8),snippet(".",.8),snippet("-",.8),snippet(".com",1.5),snippet(".cn",1.2),{id:"space",type:"space",label:"",value:" ",width:1.5,className:"key-space"},{id:"url-go",type:"done",label:"前往",width:1.5,className:"key-done"}]}]};function createCharKey$1(char){return{id:`search-char-${char.toLowerCase()}`,type:"char",label:{lower:char.toLowerCase(),upper:char.toUpperCase()},value:{lower:char.toLowerCase(),upper:char.toUpperCase()}};}const searchLayout={type:"search",name:"搜索键盘",supportShift:true,defaultUpperCase:false,switchable:["symbol","number"],rows:[{keys:"qwertyuiop".split("").map(createCharKey$1)},{keys:"asdfghjkl".split("").map(createCharKey$1)},{keys:[{id:"shift",type:"shift",icon:ICON_SHIFT,label:"",width:1.5,className:"key-shift"},..."zxcvbnm".split("").map(createCharKey$1),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",width:1.5,className:"key-backspace"}]},{keys:[{id:"switch-number",type:"tab",label:"123",width:1.25,className:"key-switch",data:{targetType:"number"}},{id:"switch-symbol",type:"tab",label:"#+=",width:1.25,className:"key-switch",data:{targetType:"symbol"}},{id:"space",type:"space",label:"",value:" ",width:4,className:"key-space"},{id:"voice",type:"custom",icon:ICON_VOICE,label:"",width:1,className:"key-voice",data:{action:"voice"}},{id:"search-done",type:"done",label:"搜索",width:2,className:"key-done"}]}]};function p(label,value){return{id:`punct-${label}`,type:"char",label,value:value??label,className:"key-num"};}const punctLayout={type:"punct",name:"中文标点",supportShift:false,switchable:["qwerty","punct-en"],rows:[{className:"virtual-keyboard__row",keys:[",","。","?","!",":",";","\"","\""].map((s)=>p(s))},{className:"virtual-keyboard__row",keys:["(",")","【","】","《","》","……","——"].map((s)=>p(s))},{className:"virtual-keyboard__row",keys:[p("·"),p("、"),p("「"),p("」"),p("『"),p("』"),p("~"),{id:"backspace",type:"backspace",icon:ICON_DELETE,label:"",className:"key-numpad-fn"}]},{className:"virtual-keyboard__row",keys:[{id:"switch-punct-en",type:"tab",label:"英",data:{targetType:"punct-en"},className:"key-numpad-fn"},{id:"switch-qwerty",type:"tab",label:"ABC",data:{targetType:"qwerty"},className:"key-numpad-fn"},{id:"space",type:"space",label:"空格",value:" ",width:4,className:"key-num"},{id:"done",type:"done",icon:ICON_CHECK,label:"",width:2,className:"key-numpad-done"}]}]};const builtinLayouts={"qwerty":qwertyLayout,"number":numberLayout,"integer":integerLayout,"symbol":symbolLayout,"symbol-2":symbolLayout2,"license-plate":licensePlateLayout,"license-plate-province":licensePlateProvinceLayout,"license-plate-letter":licensePlateLetterLayout,"license-plate-alphanumeric":licensePlateAlphanumericLayout,"idcard":idcardLayout,"phone":phoneLayout,"phone-simple":phoneSimpleLayout,"amount":amountLayout,"amount-simple":amountSimpleLayout,"bankcard":bankcardLayout,"verifycode":verifycodeLayout,"email":emailLayout,"url":urlLayout,"search":searchLayout,"punct":punctLayout};const customLayouts={};function registerLayout(name,layout){if(builtinLayouts[name]){console.warn(`[Keyboard]Cannot override builtin layout "${name}"`);return;}customLayouts[name]=layout;}function getLayout(type){return customLayouts[type]||builtinLayouts[type];}function getAvailableLayouts(){return[...Object.keys(builtinLayouts),...Object.keys(customLayouts)];}function hasLayout(name){return name in builtinLayouts||name in customLayouts;}function unregisterLayout(name){if(name in customLayouts){delete customLayouts[name];return true;}return false;}function registerLayouts(layouts){Object.entries(layouts).forEach(([name,layout])=>{registerLayout(name,layout);});}var EventEmitter=class{constructor(){this.handlers=new Map();}on(event,handler,options={}){if(!this.handlers.has(event))this.handlers.set(event,new Set());const handlers=this.handlers.get(event);const wrapper={handler,options};handlers.add(wrapper);return()=>{handlers.delete(wrapper);if(handlers.size===0)this.handlers.delete(event);};}once(event,handler,options={}){return this.on(event,handler,{...options,once:true});}off(event,handler){if(!handler){this.handlers.delete(event);return;}const handlers=this.handlers.get(event);if(handlers){handlers.forEach((wrapper)=>{if(wrapper.handler===handler)handlers.delete(wrapper);});if(handlers.size===0)this.handlers.delete(event);}}emit(event,data){const handlers=this.handlers.get(event);if(!handlers||handlers.size===0)return;const sortedHandlers=Array.from(handlers).sort((a,b)=>{const priorityA=a.options.priority??0;return(b.options.priority??0)-priorityA;});const toRemove=[];sortedHandlers.forEach((wrapper)=>{try{wrapper.handler(data);if(wrapper.options.once)toRemove.push(wrapper);}catch(error){console.error(`[KeyboardEventEmitter]Error in event handler for "${String(event)}":`,error);}});toRemove.forEach((wrapper)=>handlers.delete(wrapper));if(handlers.size===0)this.handlers.delete(event);}clear(){this.handlers.clear();}listenerCount(event){if(event!==void 0)return this.handlers.get(event)?.size??0;let count=0;this.handlers.forEach((handlers)=>{count+=handlers.size;});return count;}};const MOBILE_UA_REGEX=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;let cachedIsTouchDevice=null;function isTouchDevice(){if(cachedIsTouchDevice!==null)return cachedIsTouchDevice;if(typeof window==="undefined"){cachedIsTouchDevice=false;return false;}cachedIsTouchDevice="ontouchstart" in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;return cachedIsTouchDevice;}function isMobileUA(){if(typeof navigator==="undefined")return false;return MOBILE_UA_REGEX.test(navigator.userAgent);}function isMobile(){if(typeof window==="undefined")return false;if(isMobileUA())return true;if((window.innerWidth||document.documentElement.clientWidth)<=768)return true;return isTouchDevice();}function getDeviceType(){return isMobile()?"mobile":"desktop";}function getViewportInfo(){if(typeof window==="undefined")return{width:0,height:0,scrollX:0,scrollY:0,isMobile:false};const width=window.innerWidth||document.documentElement.clientWidth;const height=window.innerHeight||document.documentElement.clientHeight;const safeArea=getSafeAreaInsets();return{width,height,scrollX:window.scrollX||window.pageXOffset,scrollY:window.scrollY||window.pageYOffset,isMobile:isMobile(),safeArea};}function getSafeAreaInsets(){if(typeof window==="undefined"||typeof CSS==="undefined"||!CSS.supports)return{top:0,right:0,bottom:0,left:0};if(!CSS.supports("padding-top","env(safe-area-inset-top)"))return{top:0,right:0,bottom:0,left:0};const div=document.createElement("div");div.style.cssText=` position:fixed;top:env(safe-area-inset-top);right:env(safe-area-inset-right);bottom:env(safe-area-inset-bottom);left:env(safe-area-inset-left);pointer-events:none;visibility:hidden;`;document.body.appendChild(div);const computed=getComputedStyle(div);const safeArea={top:Number.parseFloat(computed.top)||0,right:Number.parseFloat(computed.right)||0,bottom:Number.parseFloat(computed.bottom)||0,left:Number.parseFloat(computed.left)||0};document.body.removeChild(div);return safeArea;}function supportsVibrate(){return typeof navigator!=="undefined"&&"vibrate" in navigator;}function vibrate(pattern=10){if(supportsVibrate())return navigator.vibrate(pattern);return false;}function onViewportChange(callback){if(typeof window==="undefined")return()=>{};const handler=()=>{callback(getViewportInfo());};window.addEventListener("resize",handler);window.addEventListener("orientationchange",handler);return()=>{window.removeEventListener("resize",handler);window.removeEventListener("orientationchange",handler);};}function getBoundingRect(element){const rect=element.getBoundingClientRect();return{x:rect.left,y:rect.top,width:rect.width,height:rect.height};}function getElementOffset(element){const rect=element.getBoundingClientRect();const scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;const scrollTop=window.pageYOffset||document.documentElement.scrollTop;return{x:rect.left+scrollLeft,y:rect.top+scrollTop};}function isElementInViewport(element){const rect=element.getBoundingClientRect();return rect.top>=0&&rect.left>=0&&rect.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&rect.right<=(window.innerWidth||document.documentElement.clientWidth);}function isClickOutside(event,element){const target=event.target;return!element.contains(target);}function preventDefaultAndStopPropagation(event){event.preventDefault();event.stopPropagation();}function onClickOutside(element,callback){const handler=(event)=>{if(isClickOutside(event,element))callback(event);};document.addEventListener("mousedown",handler);document.addEventListener("touchstart",handler);return()=>{document.removeEventListener("mousedown",handler);document.removeEventListener("touchstart",handler);};}function scrollIntoViewIfNeeded(element,container){if(!container){element.scrollIntoView({behavior:"smooth",block:"nearest"});return;}const elementRect=element.getBoundingClientRect();const containerRect=container.getBoundingClientRect();if(elementRect.bottom>containerRect.bottom)container.scrollTop+=elementRect.bottom-containerRect.bottom;else if(elementRect.top<containerRect.top)container.scrollTop-=containerRect.top-elementRect.top;}function getInputCursorPosition(input){return input.selectionStart??input.value.length;}function setInputCursorPosition(input,position){input.setSelectionRange(position,position);}function insertTextAtCursor(input,text,maxLength){const start=input.selectionStart??input.value.length;const end=input.selectionEnd??input.value.length;const currentValue=input.value;let newValue=currentValue.substring(0,start)+text+currentValue.substring(end);if(maxLength!==void 0&&newValue.length>maxLength){const allowedLength=maxLength-(currentValue.length-(end-start));if(allowedLength<=0)return{value:currentValue,cursorPosition:start};newValue=currentValue.substring(0,start)+text.substring(0,allowedLength)+currentValue.substring(end);}const newCursorPosition=start+text.length;return{value:newValue,cursorPosition:Math.min(newCursorPosition,newValue.length)};}function deleteCharBeforeCursor(input){const start=input.selectionStart??input.value.length;const end=input.selectionEnd??input.value.length;const currentValue=input.value;if(start!==end){const deletedChar2=currentValue.substring(start,end);return{value:currentValue.substring(0,start)+currentValue.substring(end),deletedChar:deletedChar2,cursorPosition:start};}if(start===0)return{value:currentValue,deletedChar:"",cursorPosition:0};const deletedChar=currentValue.charAt(start-1);return{value:currentValue.substring(0,start-1)+currentValue.substring(start),deletedChar,cursorPosition:start-1};}function createElement(tag,attrs,children){const element=document.createElement(tag);if(attrs)Object.entries(attrs).forEach(([key,value])=>{element.setAttribute(key,value);});if(children)children.forEach((child)=>{if(typeof child==="string")element.appendChild(document.createTextNode(child));else element.appendChild(child);});return element;}function toggleClass(element,className,force){element.classList.toggle(className,force);}function setStyles(element,styles){Object.assign(element.style,styles);}const DEFAULT_OPTIONS={type:"qwerty",value:"",maxLength:void 0,defaultUpperCase:false,closeOnClickOutside:true,enableSound:false,enableVibrate:true,customLayouts:{}};var KeyboardManager=class extends EventEmitter{constructor(options={}){super();this.currentLayout=null;this.options={...DEFAULT_OPTIONS,...options};if(options.customLayouts)Object.entries(options.customLayouts).forEach(([name,layout])=>{this.options.customLayouts[name]=layout;});this.state={visible:false,type:this.options.type,isUpperCase:this.options.defaultUpperCase,value:this.options.value,cursorPosition:this.options.value.length,maxLength:this.options.maxLength,inputElement:null};this.loadLayout(this.options.type);}getState(){return{...this.state};}getLayout(){return this.currentLayout;}getOptions(){return{...this.options};}loadLayout(type){let layout=this.options.customLayouts[type];if(!layout)layout=getLayout(type);if(!layout){console.error(`[KeyboardManager]Layout "${type}" not found`);return false;}this.currentLayout=layout;if(layout.supportShift)this.state.isUpperCase=layout.defaultUpperCase??this.options.defaultUpperCase;return true;}show(inputElement){if(this.state.visible)return;this.state.visible=true;this.state.inputElement=inputElement??null;if(inputElement){this.state.value=inputElement.value;this.state.cursorPosition=getInputCursorPosition(inputElement);}this.emitStateChange();this.emit("show",{type:this.state.type});}hide(){if(!this.state.visible)return;const prevType=this.state.type;this.state.visible=false;this.state.inputElement=null;this.emitStateChange();this.emit("hide",{type:prevType});}toggle(inputElement){if(this.state.visible)this.hide();else this.show(inputElement);}switchType(type){if(this.state.type===type)return;const fromType=this.state.type;if(!this.loadLayout(type))return;this.state.type=type;this.emitStateChange();this.emit("switch",{from:fromType,to:type});}toggleShift(){if(!this.currentLayout?.supportShift)return;this.state.isUpperCase=!this.state.isUpperCase;this.emitStateChange();this.emit("shift",{isUpperCase:this.state.isUpperCase});}setShift(isUpperCase){if(!this.currentLayout?.supportShift)return;if(this.state.isUpperCase===isUpperCase)return;this.state.isUpperCase=isUpperCase;this.emitStateChange();this.emit("shift",{isUpperCase});}handleKey(key){if(this.options.enableVibrate&&isMobile())vibrate(10);this.emit("keypress",{key,value:this.state.value});switch(key.type){case "char":case "space":this.handleCharKey(key);break;case "backspace":this.handleBackspace();break;case "shift":this.toggleShift();break;case "clear":this.handleClear();break;case "enter":case "done":this.handleConfirm();break;case "close":this.hide();break;case "tab":this.handleTab(key);break;case "custom":break;}}handleCharKey(key){const keyValue=this.getKeyValue(key);if(!keyValue)return;const input=this.state.inputElement;if(input){const result=insertTextAtCursor(input,keyValue,this.state.maxLength);input.value=result.value;setInputCursorPosition(input,result.cursorPosition);this.state.value=result.value;this.state.cursorPosition=result.cursorPosition;input.dispatchEvent(new Event("input",{bubbles:true}));}else{if(this.state.maxLength&&this.state.value.length>=this.state.maxLength)return;const newValue=this.state.value.slice(0,this.state.cursorPosition)+keyValue+this.state.value.slice(this.state.cursorPosition);this.state.value=newValue;this.state.cursorPosition+=keyValue.length;}this.emitStateChange();this.emit("input",{value:this.state.value,key});this.autoSwitchLicensePlate();}handleBackspace(){const input=this.state.inputElement;if(input){const result=deleteCharBeforeCursor(input);input.value=result.value;setInputCursorPosition(input,result.cursorPosition);this.state.value=result.value;this.state.cursorPosition=result.cursorPosition;input.dispatchEvent(new Event("input",{bubbles:true}));this.emitStateChange();this.emit("backspace",{deletedChar:result.deletedChar,value:this.state.value});}else{if(this.state.cursorPosition===0)return;const deletedChar=this.state.value.charAt(this.state.cursorPosition-1);this.state.value=this.state.value.slice(0,this.state.cursorPosition-1)+this.state.value.slice(this.state.cursorPosition);this.state.cursorPosition--;this.emitStateChange();this.emit("backspace",{deletedChar,value:this.state.value});}this.autoSwitchLicensePlate();}autoSwitchLicensePlate(){if(!this.state.type.startsWith("license-plate"))return;const len=this.state.value.length;let targetType=null;if(len===0)targetType="license-plate-province";else targetType="license-plate-alphanumeric";if(targetType&&this.state.type!==targetType)this.switchType(targetType);}handleClear(){const previousValue=this.state.value;if(this.state.inputElement){this.state.inputElement.value="";this.state.inputElement.dispatchEvent(new Event("input",{bubbles:true}));}this.state.value="";this.state.cursorPosition=0;this.emitStateChange();this.emit("clear",{previousValue});this.autoSwitchLicensePlate();}handleConfirm(){this.emit("confirm",{value:this.state.value});this.hide();}handleTab(key){const targetType=key.data?.targetType;if(targetType)this.switchType(targetType);}getKeyValue(key){const value=key.value??key.label;if(typeof value==="string")return value;return this.state.isUpperCase?value.upper:value.lower;}getKeyLabel(key){const label=key.label;if(typeof label==="string")return label;return this.state.isUpperCase?label.upper:label.lower;}setValue(value){this.state.value=value;this.state.cursorPosition=value.length;if(this.state.inputElement){this.state.inputElement.value=value;setInputCursorPosition(this.state.inputElement,value.length);}this.emitStateChange();this.autoSwitchLicensePlate();}appendValue(text){if(!text)return;const input=this.state.inputElement;if(input){const result=insertTextAtCursor(input,text,this.state.maxLength);input.value=result.value;setInputCursorPosition(input,result.cursorPosition);this.state.value=result.value;this.state.cursorPosition=result.cursorPosition;input.dispatchEvent(new Event("input",{bubbles:true}));}else{if(this.state.maxLength&&this.state.value.length+text.length>this.state.maxLength)text=text.slice(0,this.state.maxLength-this.state.value.length);const newValue=this.state.value.slice(0,this.state.cursorPosition)+text+this.state.value.slice(this.state.cursorPosition);this.state.value=newValue;this.state.cursorPosition+=text.length;}this.emitStateChange();}setMaxLength(maxLength){this.state.maxLength=maxLength;this.emitStateChange();}bindInput(input){this.state.inputElement=input;this.state.value=input.value;this.state.cursorPosition=getInputCursorPosition(input);this.emitStateChange();}unbindInput(){this.state.inputElement=null;this.emitStateChange();}emitStateChange(){this.emit("stateChange",{...this.state});}destroy(){this.hide();this.clear();this.state.inputElement=null;}};function createKeyboardManager(options){return new KeyboardManager(options);}const DEFAULT_CONFIG={offset:{x:0,y:8},autoAdjust:true,viewportPadding:8,desktopPlacement:"bottom",mobilePlacement:"bottom-sheet",showMask:true,maskClosable:true,animationDuration:300};var PositionManager=class{constructor(config={}){this.config={...DEFAULT_CONFIG,...config};}updateConfig(config){Object.assign(this.config,config);}getConfig(){return{...this.config};}calculate(targetElement,popupSize){const viewport=getViewportInfo();const isMobileDevice=isMobile();if(isMobileDevice&&this.config.mobilePlacement==="bottom-sheet")return this.calculateBottomSheet(viewport,popupSize);if(!targetElement)return this.calculateCentered(viewport,popupSize);const targetRect=getBoundingRect(targetElement);const placement=isMobileDevice?this.config.mobilePlacement:this.config.desktopPlacement;const relativePlace=placement==="bottom-sheet"?"bottom":placement;return this.calculateRelativeToTarget(targetRect,popupSize,viewport,relativePlace);}calculateBottomSheet(viewport,popupSize){const safeAreaBottom=viewport.safeArea?.bottom??0;return{position:{x:0,y:viewport.height-popupSize.height-safeAreaBottom},placement:"bottom-sheet",flipped:false,maxHeight:viewport.height*.6,maxWidth:viewport.width,transform:"translateY(0)"};}calculateCentered(viewport,popupSize){return{position:{x:(viewport.width-popupSize.width)/2,y:(viewport.height-popupSize.height)/2},placement:"bottom",flipped:false};}calculateRelativeToTarget(targetRect,popupSize,viewport,preferredPlacement){const{offset,viewportPadding,autoAdjust}=this.config;let position;let placement=preferredPlacement;let flipped=false;const bottomPosition={x:targetRect.x+(offset.x??0),y:targetRect.y+targetRect.height+(offset.y??8)};const topPosition={x:targetRect.x+(offset.x??0),y:targetRect.y-popupSize.height-(offset.y??8)};if(preferredPlacement==="bottom"){position=bottomPosition;if(autoAdjust&&position.y+popupSize.height>viewport.height-viewportPadding){if(topPosition.y>=viewportPadding){position=topPosition;placement="top";flipped=true;}}}else{position=topPosition;if(autoAdjust&&position.y<viewportPadding){if(bottomPosition.y+popupSize.height<=viewport.height-viewportPadding){position=bottomPosition;placement="bottom";flipped=true;}}}if(autoAdjust){if(position.x<viewportPadding)position.x=viewportPadding;if(position.x+popupSize.width>viewport.width-viewportPadding)position.x=viewport.width-popupSize.width-viewportPadding;}const maxHeight=placement==="bottom"?viewport.height-position.y-viewportPadding:targetRect.y-viewportPadding;return{position,placement,flipped,maxHeight:Math.max(200,maxHeight),maxWidth:viewport.width-viewportPadding*2};}getInitialStyles(placement){switch(placement){case "bottom-sheet":return{transform:"translateY(100%)",opacity:"1"};case "bottom":return{transform:"translateY(-10px)",opacity:"0"};case "top":return{transform:"translateY(10px)",opacity:"0"};default:return{opacity:"0"};}}getFinalStyles(placement){return{transform:"translateY(0)",opacity:"1"};}getExitStyles(placement){return this.getInitialStyles(placement);}getAnimationDuration(){return this.config.animationDuration;}shouldShowMask(){return isMobile()&&this.config.showMask;}isMaskClosable(){return this.config.maskClosable;}};function createPositionManager(config){return new PositionManager(config);}const miuiTheme={name:"miui",displayName:"MIUI",description:"小米风格-纯净简洁",isDark:false,colors:{background:"#f5f5f5",keyBackground:"#ffffff",keyColor:"#1a1a1a",keyActiveBackground:"#e8e8e8",fnKeyBackground:"#e0e0e0",fnKeyColor:"#666666",fnKeyActiveBackground:"#d0d0d0",primaryBackground:"#ff6700",primaryActiveBackground:"#e55d00",primaryColor:"#ffffff",borderColor:"transparent",dividerColor:"#eeeeee"},sizes:{keyHeight:46,keyRadius:8,keyGap:6,fontSize:18,fnFontSize:14,padding:8},effects:{keyShadow:"none",keyActiveShadow:"none",keyActiveScale:.96,transitionDuration:100,enableBlur:false,blurAmount:0,enableRipple:false}};const iosTheme={name:"ios",displayName:"iOS",description:"Apple 风格-精致优雅",isDark:false,colors:{background:"#d1d3d9",keyBackground:"#ffffff",keyColor:"#000000",keyActiveBackground:"#b8bac2",fnKeyBackground:"#a8aab4",fnKeyColor:"#000000",fnKeyActiveBackground:"#9699a3",primaryBackground:"#007aff",primaryActiveBackground:"#0062cc",primaryColor:"#ffffff",borderColor:"transparent",dividerColor:"#c8cad0"},sizes:{keyHeight:43,keyRadius:5,keyGap:6,fontSize:22,fnFontSize:15,padding:4},effects:{keyShadow:"0 1px 0 rgba(0,0,0,0.35)",keyActiveShadow:"0 0 0 rgba(0,0,0,0)",keyActiveScale:1,transitionDuration:80,enableBlur:true,blurAmount:20,enableRipple:false}};const materialTheme={name:"material",displayName:"Material",description:"Google 风格-深邃现代",isDark:true,colors:{background:"#263238",keyBackground:"#37474f",keyColor:"#ffffff",keyActiveBackground:"#455a64",fnKeyBackground:"#455a64",fnKeyColor:"#b0bec5",fnKeyActiveBackground:"#546e7a",primaryBackground:"#4caf50",primaryActiveBackground:"#43a047",primaryColor:"#ffffff",borderColor:"transparent",dividerColor:"#37474f"},sizes:{keyHeight:48,keyRadius:4,keyGap:4,fontSize:20,fnFontSize:14,padding:6},effects:{keyShadow:"0 1px 3px rgba(0,0,0,0.2)",keyActiveShadow:"0 2px 6px rgba(0,0,0,0.3)",keyActiveScale:1,transitionDuration:150,enableBlur:false,blurAmount:0,enableRipple:true}};const minimalTheme={name:"minimal",displayName:"Minimal",description:"极简风格-轻盈透明",isDark:false,colors:{background:"rgba(250,250,250,0.95)",keyBackground:"transparent",keyColor:"#333333",keyActiveBackground:"rgba(0,0,0,0.08)",fnKeyBackground:"transparent",fnKeyColor:"#888888",fnKeyActiveBackground:"rgba(0,0,0,0.08)",primaryBackground:"#333333",primaryActiveBackground:"#000000",primaryColor:"#ffffff",borderColor:"#eeeeee",dividerColor:"#eeeeee"},sizes:{keyHeight:44,keyRadius:12,keyGap:8,fontSize:17,fnFontSize:13,padding:12},effects:{keyShadow:"none",keyActiveShadow:"none",keyActiveScale:.92,transitionDuration:120,enableBlur:true,blurAmount:30,enableRipple:false}};const darkTheme={name:"dark",displayName:"Dark",description:"深色模式-护眼舒适",isDark:true,colors:{background:"#1c1c1e",keyBackground:"#3a3a3c",keyColor:"#ffffff",keyActiveBackground:"#4a4a4c",fnKeyBackground:"#2c2c2e",fnKeyColor:"#ebebf5",fnKeyActiveBackground:"#3c3c3e",primaryBackground:"#0a84ff",primaryActiveBackground:"#0070e0",primaryColor:"#ffffff",borderColor:"#3a3a3c",dividerColor:"#3a3a3c"},sizes:{keyHeight:45,keyRadius:8,keyGap:6,fontSize:18,fnFontSize:14,padding:8},effects:{keyShadow:"0 1px 2px rgba(0,0,0,0.4)",keyActiveShadow:"0 0 8px rgba(10,132,255,0.3)",keyActiveScale:.97,transitionDuration:100,enableBlur:true,blurAmount:20,enableRipple:false}};const presetThemes={miui:miuiTheme,ios:iosTheme,material:materialTheme,minimal:minimalTheme,dark:darkTheme};const defaultTheme=miuiTheme;const customThemes=new Map();let currentTheme=defaultTheme;function getTheme(name){return customThemes.get(name)||presetThemes[name]||defaultTheme;}function registerTheme(theme){customThemes.set(theme.name,theme);}function getAvailableThemes(){return[...Object.keys(presetThemes),...customThemes.keys()];}function getAllThemes(){return[...Object.values(presetThemes),...customThemes.values()];}function setCurrentTheme(name){currentTheme=getTheme(name);return currentTheme;}function getCurrentTheme(){return currentTheme;}function themeToCSS(theme){return{"--keyboard-bg":theme.colors.background,"--keyboard-key-bg":theme.colors.keyBackground,"--keyboard-key-color":theme.colors.keyColor,"--keyboard-key-active-bg":theme.colors.keyActiveBackground,"--keyboard-fn-key-bg":theme.colors.fnKeyBackground,"--keyboard-fn-key-color":theme.colors.fnKeyColor,"--keyboard-fn-key-active-bg":theme.colors.fnKeyActiveBackground,"--keyboard-primary-bg":theme.colors.primaryBackground,"--keyboard-primary-active-bg":theme.colors.primaryActiveBackground,"--keyboard-primary-color":theme.colors.primaryColor,"--keyboard-key-height":`${theme.sizes.keyHeight}px`,"--keyboard-key-radius":`${theme.sizes.keyRadius}px`,"--keyboard-key-gap":`${theme.sizes.keyGap}px`,"--keyboard-font-size":`${theme.sizes.fontSize}px`,"--keyboard-fn-font-size":`${theme.sizes.fnFontSize}px`,"--keyboard-padding":`${theme.sizes.padding}px`,"--keyboard-key-shadow":theme.effects.keyShadow,"--keyboard-transition-duration":`${theme.effects.transitionDuration}ms`,"--keyboard-border-color":theme.colors.borderColor,"--keyboard-divider-color":theme.colors.dividerColor};}function applyTheme(element,theme){const cssVars=themeToCSS(theme);Object.entries(cssVars).forEach(([key,value])=>{if(value)element.style.setProperty(key,value);});element.classList.remove("keyboard-theme-light","keyboard-theme-dark");element.classList.add(theme.isDark?"keyboard-theme-dark":"keyboard-theme-light");element.dataset.theme=theme.name;}function generateThemeStyle(theme){const cssVars=themeToCSS(theme);return Object.entries(cssVars).filter(([,value])=>value).map(([key,value])=>`${key}:${value}`).join(";");}function mergeTheme(base,overrides){return{...base,...overrides,colors:{...base.colors,...overrides.colors},sizes:{...base.sizes,...overrides.sizes},effects:{...base.effects,...overrides.effects}};}function createTheme(name,baseTheme,customization){const theme=mergeTheme(getTheme(baseTheme),{...customization,name});registerTheme(theme);return theme;}var KeyboardRenderer=class{constructor(options={}){this.rootEl=null;this.maskEl=null;this.keyboardEl=null;this.targetEl=null;this.cleanupFns=[];this.destroyed=false;this.options=options;this.container=options.container||document.body;this.manager=new KeyboardManager(options);this.positionManager=new PositionManager(options.position);if(typeof options.theme==="string")this.theme=getTheme(options.theme);else if(options.theme)this.theme=options.theme;else this.theme=defaultTheme;this.setupEvents();}setupEvents(){this.manager.on("stateChange",(state)=>{if(state.visible)this.render();else this.unmount();});this.manager.on("input",({value})=>{this.options.onInput?.(value);});this.manager.on("confirm",({value})=>{this.options.onConfirm?.(value);});this.manager.on("switch",()=>{if(this.manager.getState().visible)this.render();});this.manager.on("shift",()=>{if(this.manager.getState().visible)this.render();});}open(target){this.targetEl=target??null;this.manager.show(target);}close(){this.manager.hide();this.options.onClose?.();}switchType(type){this.manager.switchType(type);}setTheme(theme){if(typeof theme==="string")this.theme=getTheme(theme);else this.theme=theme;if(this.manager.getState().visible)this.render();}getValue(){return this.manager.getState().value;}setValue(value){this.manager.setValue(value);}render(){const layout=this.manager.getLayout();if(!layout)return;this.unmount();this.rootEl=document.createElement("div");this.rootEl.className="lk-renderer-root";const isMobileDevice=isMobile();if(isMobileDevice){this.maskEl=document.createElement("div");this.maskEl.className="lk-mask";this.maskEl.addEventListener("click",()=>this.close());this.rootEl.appendChild(this.maskEl);}this.keyboardEl=document.createElement("div");this.keyboardEl.className=`lk-popup lk-popup--${isMobileDevice?"mobile":"desktop"}`;const cssVars=themeToCSS(this.theme);Object.entries(cssVars).forEach(([key,value])=>{if(value)this.keyboardEl.style.setProperty(key,value);});const contentEl=this.renderKeyboard(layout);this.keyboardEl.appendChild(contentEl);this.rootEl.appendChild(this.keyboardEl);this.container.appendChild(this.rootEl);if(!isMobileDevice&&this.targetEl){const rect=this.keyboardEl.getBoundingClientRect();const result=this.positionManager.calculate(this.targetEl,{width:rect.width,height:rect.height});this.keyboardEl.style.position="fixed";this.keyboardEl.style.left=`${result.position.x}px`;this.keyboardEl.style.top=`${result.position.y}px`;this.keyboardEl.style.zIndex="10000";}else if(isMobileDevice){this.keyboardEl.style.position="fixed";this.keyboardEl.style.left="0";this.keyboardEl.style.right="0";this.keyboardEl.style.bottom="0";this.keyboardEl.style.zIndex="10000";}requestAnimationFrame(()=>{this.keyboardEl?.classList.add("lk-popup--visible");this.maskEl?.classList.add("lk-mask--visible");});if(this.options.closeOnClickOutside!==false&&this.keyboardEl){const cleanup=onClickOutside(this.keyboardEl,(event)=>{if(this.targetEl&&this.targetEl.contains(event.target))return;this.close();});this.cleanupFns.push(cleanup);}this.injectStyles();}renderKeyboard(layout){const el=document.createElement("div");el.className="lk-keyboard";const state=this.manager.getState();layout.rows.forEach((row)=>{const rowEl=document.createElement("div");rowEl.className=`lk-row ${row.className||""}`;const isNumpad=row.className==="numpad-row";row.keys.forEach((key)=>{const wrapperEl=document.createElement("div");wrapperEl.className="lk-key-wrapper";if(isNumpad)wrapperEl.style.flex=String(key.width??1);else if(key.width){const baseW=36;const gap=this.theme.sizes?.keyGap??6;const w=baseW*key.width+(key.width-1)*gap;wrapperEl.style.width=`${w}px`;}const btnEl=document.createElement("button");btnEl.type="button";btnEl.className=this.getKeyClass(key,state.isUpperCase);if(key.disabled)btnEl.disabled=true;if(key.icon)btnEl.innerHTML=key.icon;else btnEl.textContent=typeof key.label==="string"?key.label:state.isUpperCase?key.label.upper:key.label.lower;const handler=(e)=>{e.preventDefault();e.stopPropagation();if(!key.disabled)this.manager.handleKey(key);};btnEl.addEventListener("mousedown",handler);btnEl.addEventListener("touchstart",handler,{passive:false});wrapperEl.appendChild(btnEl);rowEl.appendChild(wrapperEl);});el.appendChild(rowEl);});return el;}getKeyClass(key,isUpperCase){const classes=["lk-key",`lk-key--${key.type}`];if(key.className)classes.push(key.className);if(key.disabled)classes.push("lk-key--disabled");if(key.type==="shift"&&isUpperCase)classes.push("lk-key--active");return classes.join(" ");}unmount(){this.cleanupFns.forEach((fn)=>fn());this.cleanupFns=[];if(this.rootEl&&this.rootEl.parentNode)this.rootEl.parentNode.removeChild(this.rootEl);this.rootEl=null;this.maskEl=null;this.keyboardEl=null;}injectStyles(){if(document.getElementById("lk-renderer-styles"))return;const style=document.createElement("style");style.id="lk-renderer-styles";style.textContent=` .lk-renderer-root{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;}.lk-mask{position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:9999;opacity:0;transition:opacity 0.3s ease;}.lk-mask--visible{opacity:1;}.lk-popup{background:var(--keyboard-bg,#d1d5db);box-shadow:0-2px 16px rgba(0,0,0,0.15);overflow:hidden;transform:translateY(20px);opacity:0;transition:transform 0.3s cubic-bezier(0.4,0,0.2,1),opacity 0.2s ease;}.lk-popup--visible{transform:translateY(0);opacity:1;}.lk-popup--desktop{border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,0.18),0 2px 8px rgba(0,0,0,0.1);min-width:320px;}.lk-popup--mobile{border-top-left-radius:16px;border-top-right-radius:16px;padding-bottom:env(safe-area-inset-bottom,0);}.lk-keyboard{display:flex;flex-direction:column;gap:var(--keyboard-key-gap,6px);padding:var(--keyboard-padding,6px);user-select:none;-webkit-user-select:none;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;}.lk-row{display:flex;justify-content:center;gap:var(--keyboard-key-gap,6px);padding:0 2px;}.lk-row.numpad-row{justify-content:stretch;}.lk-row.numpad-row .lk-key-wrapper{flex:1;}.lk-key-wrapper{position:relative;display:inline-flex;}.lk-key{display:inline-flex;align-items:center;justify-content:center;height:var(--keyboard-key-height,42px);min-width:32px;width:100%;padding:0 6px;border:none;border-radius:var(--keyboard-key-radius,6px);background:var(--keyboard-key-bg,#fff);color:var(--keyboard-key-color,#333);font-size:var(--keyboard-font-size,16px);font-weight:500;cursor:pointer;touch-action:manipulation;box-shadow:var(--keyboard-key-shadow,0 1px 3px rgba(0,0,0,0.1));transition:background-color 0.1s,transform 0.1s;}.lk-key:active{background:var(--keyboard-key-active-bg,#e0e0e0);transform:scale(0.95);}.lk-key--disabled{opacity:0.4;cursor:not-allowed;}.lk-key--disabled:active{transform:none;background:var(--keyboard-key-bg,#fff);}.lk-key--backspace,.lk-key--shift,.lk-key--tab,.lk-key--clear,.lk-key--close{background:var(--keyboard-fn-key-bg,#d4d6dc);color:var(--keyboard-fn-key-color,#333);font-size:var(--keyboard-fn-font-size,14px);}.lk-key--backspace:active,.lk-key--shift:active,.lk-key--tab:active,.lk-key--clear:active,.lk-key--close:active{background:var(--keyboard-fn-key-active-bg,#b8bac0);}.lk-key--active{background:var(--keyboard-key-active-bg,#007aff)!important;color:#fff!important;}.lk-key--done,.lk-key--enter{background:var(--keyboard-primary-bg,#007aff);color:var(--keyboard-primary-color,#fff);font-size:var(--keyboard-fn-font-size,14px);}.lk-key--done:active,.lk-key--enter:active{background:var(--keyboard-primary-active-bg,#0062cc);}.lk-key--space{background:var(--keyboard-key-bg,#fff);}.lk-key svg{pointer-events:none;}`;document.head.appendChild(style);}bindInput(input){const handleFocus=()=>this.open(input);input.addEventListener("focus",handleFocus);input.setAttribute("readonly","readonly");input.style.caretColor="transparent";return()=>{input.removeEventListener("focus",handleFocus);input.removeAttribute("readonly");input.style.caretColor="";};}destroy(){if(this.destroyed)return;this.destroyed=true;this.unmount();this.manager.destroy();const styleEl=document.getElementById("lk-renderer-styles");if(styleEl)styleEl.remove();}};function createKeyboardRenderer(options){return new KeyboardRenderer(options);}function shuffleArray(array){const result=[...array];for(let i=result.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[result[i],result[j]]=[result[j],result[i]];}return result;}function getRandomNumbers(){return shuffleArray(["0","1","2","3","4","5","6","7","8","9"]);}function getRandomLetters(){return shuffleArray(Array.from({length:26},(_,i)=>String.fromCharCode(65+i)));}function getRandomAlphanumeric(){const numbers=["0","1","2","3","4","5","6","7","8","9"];const letters=Array.from({length:26},(_,i)=>String.fromCharCode(65+i));return shuffleArray([...numbers,...letters]);}function createCharKey(char,index){return{id:`random-${char}-${index}`,type:"char",label:char,value:char,className:"key-random"};}function chunkArray(array,chunkSize){const chunks=[];for(let i=0;i<array.length;i+=chunkSize)chunks.push(array.slice(i,i+chunkSize));return chunks;}function createRandomNumberLayout(options){const{keysPerRow=3,includeBackspace=true,includeDone=true,includeClear=false}=options||{};const rows=chunkArray(getRandomNumbers().map((n,i)=>createCharKey(n,i)),keysPerRow).map((keys,index)=>({className:"numpad-row",keys}));const fnKeys=[];if(includeClear)fnKeys.push({id:"clear",type:"clear",label:"清空",className:"key-clear key-fn"});if(includeBackspace)fnKeys.push({id:"backspace",type:"backspace",label:"⌫",className:"key-backspace key-fn"});if(includeDone)fnKeys.push({id:"done",type:"done",label:"确定",className:"key-done key-fn"});if(fnKeys.length>0)rows.push({className:"numpad-row",keys:fnKeys});return{type:"custom",name:"随机数字键盘",supportShift:false,rows,data:{isRandom:true,randomType:"number"}};}function createRandomPinLayout(options){const{includeBackspace=true,includeDone=true}=options||{};const randomNumbers=getRandomNumbers();const rows=[{className:"numpad-row",keys:randomNumbers.slice(0,3).map((n,i)=>createCharKey(n,i))},{className:"numpad-row",keys:randomNumbers.slice(3,6).map((n,i)=>createCharKey(n,i+3))},{className:"numpad-row",keys:randomNumbers.slice(6,9).map((n,i)=>createCharKey(n,i+6))}];const lastRow=[];if(includeBackspace)lastRow.push({id:"backspace",type:"backspace",label:"⌫",className:"key-backspace key-fn"});else lastRow.push({id:"empty-1",type:"char",label:"",value:"",disabled:true,className:"key-placeholder"});lastRow.push(createCharKey(randomNumbers[9],9));if(includeDone)lastRow.push({id:"done",type:"done",label:"确定",className:"key-done key-fn"});else lastRow.push({id:"empty-2",type:"char",label:"",value:"",disabled:true,className:"key-placeholder"});rows.push({className:"numpad-row",keys:lastRow});return{type:"custom",name:"随机PIN键盘",supportShift:false,rows,data:{isRandom:true,randomType:"pin"}};}function createRandomLetterLayout(options){const{uppercase=true,rowDistribution=[10,9,7]}=options||{};let randomLetters=getRandomLetters();if(!uppercase)randomLetters=randomLetters.map((l)=>l.toLowerCase());const letterKeys=randomLetters.map((l,i)=>createCharKey(l,i));const rows=[];let offset=0;for(const count of rowDistribution){rows.push({className:"numpad-row",keys:letterKeys.slice(offset,offset+count)});offset+=count;}if(offset<letterKeys.length)rows.push({className:"numpad-row",keys:letterKeys.slice(offset)});rows.push({className:"numpad-row",keys:[{id:"clear",type:"clear",label:"清空",className:"key-clear key-fn"},{id:"backspace",type:"backspace",label:"⌫",className:"key-backspace key-fn"},{id:"done",type:"done",label:"确定",className:"key-done key-fn"}]});return{type:"custom",name:"随机字母键盘",supportShift:false,rows,data:{isRandom:true,randomType:"letter"}};}function createRandomMixedLayout(options){const{rowDistribution=[10,10,9,7]}=options||{};const charKeys=getRandomAlphanumeric().map((c,i)=>createCharKey(c,i));const rows=[];let offset=0;for(const count of rowDistribution){if(offset>=charKeys.length)break;rows.push({className:"numpad-row",keys:charKeys.slice(offset,offset+count)});offset+=count;}if(offset<charKeys.length)rows.push({className:"numpad-row",keys:charKeys.slice(offset)});rows.push({className:"numpad-row",keys:[{id:"clear",type:"clear",label:"清空",className:"key-clear key-fn"},{id:"backspace",type:"backspace",label:"⌫",className:"key-backspace key-fn"},{id:"done",type:"done",label:"确定",className:"key-done key-fn"}]});return{type:"custom",name:"随机混合键盘",supportShift:false,rows,data:{isRandom:true,randomType:"mixed"}};}function refreshRandomLayout(layout){switch(layout.data?.randomType){case "number":return createRandomNumberLayout();case "pin":return createRandomPinLayout();case "letter":return createRandomLetterLayout();case "mixed":return createRandomMixedLayout();default:return layout;}}function formatPhone(value){const digits=value.replace(/\D/g,"").slice(0,11);if(digits.length<=3)return digits;if(digits.length<=7)return `${digits.slice(0,3)}${digits.slice(3)}`;return `${digits.slice(0,3)}${digits.slice(3,7)}${digits.slice(7)}`;}function formatBankCard(value){return value.replace(/\D/g,"").slice(0,19).replace(/(\d{4})(?=\d)/g,"$1 ");}function formatAmount(value,decimalPlaces=2){let result=value.replace(/[^\d.]/g,"");const parts=result.split(".");if(parts.length>2)result=parts[0]+"."+parts.slice(1).join("");if(parts.length===2&&parts[1].length>decimalPlaces)result=parts[0]+"."+parts[1].slice(0,decimalPlaces);if(result.length>1&&result.startsWith("0")&&result[1]!==".")result=result.replace(/^0+/,"")||"0";return result;}function formatIdCard(value){return value.replace(/[^\dXx]/g,"").slice(0,18).toUpperCase();}function formatLicensePlate(value){return value.toUpperCase().slice(0,8);}function formatVerifyCode(value,length=6){return value.replace(/\D/g,"").slice(0,length);}const formatters=new Map([["phone",formatPhone],["bankcard",formatBankCard],["idcard",formatIdCard],["license-plate",formatLicensePlate],["verifycode",formatVerifyCode]]);function registerFormatter(name,formatter){formatters.set(name,formatter);}function getFormatter(name){return formatters.get(name);}function applyFormatter(name,value){const formatter=formatters.get(name);return formatter?formatter(value):value;}exports.EMAIL_SUFFIXES=EMAIL_SUFFIXES;exports.EventEmitter=EventEmitter;exports.ICONS=ICONS;exports.ICON_CHECK=ICON_CHECK;exports.ICON_CLEAR=ICON_CLEAR;exports.ICON_CLOSE=ICON_CLOSE;exports.ICON_DELETE=ICON_DELETE;exports.ICON_ENTER=ICON_ENTER;exports.ICON_KEYBOARD=ICON_KEYBOARD;exports.ICON_SHIFT=ICON_SHIFT;exports.ICON_SPACE=ICON_SPACE;exports.ICON_VOICE=ICON_VOICE;exports.KeyboardManager=KeyboardManager;exports.KeyboardRenderer=KeyboardRenderer;exports.PLATE_LETTERS=PLATE_LETTERS;exports.PROVINCES=PROVINCES;exports.PositionManager=PositionManager;exports.amountLayout=amountLayout;exports.amountSimpleLayout=amountSimpleLayout;exports.applyFormatter=applyFormatter;exports.applyTheme=applyTheme;exports.bankcardLayout=bankcardLayout;exports.createElement=createElement;exports.createKeyboardManager=createKeyboardManager;exports.createKeyboardRenderer=createKeyboardRenderer;exports.createPositionManager=createPositionManager;exports.createRandomLetterLayout=createRandomLetterLayout;exports.createRandomMixedLayout=createRandomMixedLayout;exports.createRandomNumberLayout=createRandomNumberLayout;exports.createRandomPinLayout=createRandomPinLayout;exports.createTheme=createTheme;exports.darkTheme=darkTheme;exports.defaultTheme=defaultTheme;exports.deleteCharBeforeCursor=deleteCharBeforeCursor;exports.emailLayout=emailLayout;exports.formatAmount=formatAmount;exports.formatBankCard=formatBankCard;exports.formatIdCard=formatIdCard;exports.formatLicensePlate=formatLicensePlate;exports.formatPhone=formatPhone;exports.formatVerifyCode=formatVerifyCode;exports.generateThemeStyle=generateThemeStyle;exports.getAllThemes=getAllThemes;exports.getAvailableLayouts=getAvailableLayouts;exports.getAvailableThemes=getAvailableThemes;exports.getBoundingRect=getBoundingRect;exports.getCurrentTheme=getCurrentTheme;exports.getDeviceType=getDeviceType;exports.getElementOffset=getElementOffset;exports.getFormatter=getFormatter;exports.getInputCursorPosition=getInputCursorPosition;exports.getLayout=getLayout;exports.getRandomAlphanumeric=getRandomAlphanumeric;exports.getRandomLetters=getRandomLetters;exports.getRandomNumbers=getRandomNumbers;exports.getSafeAreaInsets=getSafeAreaInsets;exports.getTheme=getTheme;exports.getViewportInfo=getViewportInfo;exports.hasLayout=hasLayout;exports.idcardLayout=idcardLayout;exports.insertTextAtCursor=insertTextAtCursor;exports.integerLayout=integerLayout;exports.iosTheme=iosTheme;exports.isClickOutside=isClickOutside;exports.isElementInViewport=isElementInViewport;exports.isMobile=isMobile;exports.isMobileUA=isMobileUA;exports.isTouchDevice=isTouchDevice;exports.licensePlateAlphanumericLayout=licensePlateAlphanumericLayout;exports.licensePlateLayout=licensePlateLayout;exports.licensePlateLetterLayout=licensePlateLetterLayout;exports.licensePlateProvinceLayout=licensePlateProvinceLayout;exports.materialTheme=materialTheme;exports.mergeTheme=mergeTheme;exports.minimalTheme=minimalTheme;exports.miuiTheme=miuiTheme;exports.numberLayout=numberLayout;exports.onClickOutside=onClickOutside;exports.onViewportChange=onViewportChange;exports.phoneLayout=phoneLayout;exports.phoneSimpleLayout=phoneSimpleLayout;exports.presetThemes=presetThemes;exports.preventDefaultAndStopPropagation=preventDefaultAndStopPropagation;exports.punctLayout=punctLayout;exports.qwertyLayout=qwertyLayout;exports.refreshRandomLayout=refreshRandomLayout;exports.registerFormatter=registerFormatter;exports.registerLayout=registerLayout;exports.registerLayouts=registerLayouts;exports.registerTheme=registerTheme;exports.scrollIntoViewIfNeeded=scrollIntoViewIfNeeded;exports.searchLayout=searchLayout;exports.setCurrentTheme=setCurrentTheme;exports.setInputCursorPosition=setInputCursorPosition;exports.setStyles=setStyles;exports.shuffleArray=shuffleArray;exports.supportsVibrate=supportsVibrate;exports.symbolLayout=symbolLayout;exports.symbolLayout2=symbolLayout2;exports.themeToCSS=themeToCSS;exports.toggleClass=toggleClass;exports.unregisterLayout=unregisterLayout;exports.urlLayout=urlLayout;exports.verifycodeLayout=verifycodeLayout;exports.vibrate=vibrate;});
package/es/icons.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * 键盘图标 SVG
3
+ * 使用 Lucide 图标的 SVG 路径
4
+ * @module icons
5
+ */
6
+ /**
7
+ * 删除图标 (Delete/Backspace)
8
+ */
9
+ export declare const ICON_DELETE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>";
10
+ /**
11
+ * 清空图标 (X Circle)
12
+ */
13
+ export declare const ICON_CLEAR = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>";
14
+ /**
15
+ * 关闭图标 (X)
16
+ */
17
+ export declare const ICON_CLOSE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
18
+ /**
19
+ * 确认图标 (Check)
20
+ */
21
+ export declare const ICON_CHECK = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>";
22
+ /**
23
+ * 换行图标 (Corner Down Left)
24
+ */
25
+ export declare const ICON_ENTER = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>";
26
+ /**
27
+ * Shift 图标 (Arrow Big Up)
28
+ */
29
+ export declare const ICON_SHIFT = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>";
30
+ /**
31
+ * 空格图标 (Space)
32
+ */
33
+ export declare const ICON_SPACE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>";
34
+ /**
35
+ * 键盘图标 (Keyboard)
36
+ */
37
+ export declare const ICON_KEYBOARD = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>";
38
+ /**
39
+ * 语音图标 (Mic)
40
+ */
41
+ export declare const ICON_VOICE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>";
42
+ /**
43
+ * 所有图标映射
44
+ */
45
+ export declare const ICONS: {
46
+ readonly delete: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>";
47
+ readonly clear: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>";
48
+ readonly close: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
49
+ readonly check: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>";
50
+ readonly enter: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>";
51
+ readonly shift: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>";
52
+ readonly space: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>";
53
+ readonly keyboard: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>";
54
+ readonly voice: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>";
55
+ };
56
+ /** IconName - 图标名称类型 */
57
+ export type IconName = keyof typeof ICONS;
58
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,mYAA2W,CAAA;AAEnY;;GAEG;AACH,eAAO,MAAM,UAAU,qSAAyQ,CAAA;AAEhS;;GAEG;AACH,eAAO,MAAM,UAAU,kQAA4O,CAAA;AAEnQ;;GAEG;AACH,eAAO,MAAM,UAAU,+OAA2N,CAAA;AAElP;;GAEG;AACH,eAAO,MAAM,UAAU,4RAAsQ,CAAA;AAE7R;;GAEG;AACH,eAAO,MAAM,UAAU,0PAAsO,CAAA;AAE7P;;GAEG;AACH,eAAO,MAAM,UAAU,0QAAsP,CAAA;AAE7Q;;GAEG;AACH,eAAO,MAAM,aAAa,4cAAga,CAAA;AAE1b;;GAEG;AACH,eAAO,MAAM,UAAU,2WAA6U,CAAA;AAEpW;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;CAUR,CAAA;AAEV,wBAAwB;AACxB,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAA"}
package/es/icons.js ADDED
@@ -0,0 +1,34 @@
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
+ //#region src/icons.ts
11
+ const ICON_DELETE = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z"/><path d="m12 9 6 6"/><path d="m18 9-6 6"/></svg>`;
12
+ const ICON_CLEAR = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`;
13
+ const ICON_CLOSE = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;
14
+ const ICON_CHECK = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>`;
15
+ const ICON_ENTER = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 10 4 15 9 20"/><path d="M20 4v7a4 4 0 0 1-4 4H4"/></svg>`;
16
+ const ICON_SHIFT = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18v-6H5l7-7 7 7h-4v6H9z"/></svg>`;
17
+ const ICON_SPACE = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1"/></svg>`;
18
+ const ICON_KEYBOARD = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="M6 8h.001"/><path d="M10 8h.001"/><path d="M14 8h.001"/><path d="M18 8h.001"/><path d="M8 12h.001"/><path d="M12 12h.001"/><path d="M16 12h.001"/><path d="M7 16h10"/></svg>`;
19
+ const ICON_VOICE = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`;
20
+ const ICONS = {
21
+ delete: ICON_DELETE,
22
+ clear: ICON_CLEAR,
23
+ close: ICON_CLOSE,
24
+ check: ICON_CHECK,
25
+ enter: ICON_ENTER,
26
+ shift: ICON_SHIFT,
27
+ space: ICON_SPACE,
28
+ keyboard: ICON_KEYBOARD,
29
+ voice: ICON_VOICE
30
+ };
31
+ //#endregion
32
+ export { ICONS, ICON_CHECK, ICON_CLEAR, ICON_CLOSE, ICON_DELETE, ICON_ENTER, ICON_KEYBOARD, ICON_SHIFT, ICON_SPACE, ICON_VOICE };
33
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
34
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","names":[],"sources":["../src/icons.ts"],"sourcesContent":["/**\n * 键盘图标 SVG\n * 使用 Lucide 图标的 SVG 路径\n * @module icons\n */\n\n/**\n * 删除图标 (Delete/Backspace)\n */\nexport const ICON_DELETE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>`\n\n/**\n * 清空图标 (X Circle)\n */\nexport const ICON_CLEAR = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>`\n\n/**\n * 关闭图标 (X)\n */\nexport const ICON_CLOSE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>`\n\n/**\n * 确认图标 (Check)\n */\nexport const ICON_CHECK = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>`\n\n/**\n * 换行图标 (Corner Down Left)\n */\nexport const ICON_ENTER = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>`\n\n/**\n * Shift 图标 (Arrow Big Up)\n */\nexport const ICON_SHIFT = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>`\n\n/**\n * 空格图标 (Space)\n */\nexport const ICON_SPACE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>`\n\n/**\n * 键盘图标 (Keyboard)\n */\nexport const ICON_KEYBOARD = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>`\n\n/**\n * 语音图标 (Mic)\n */\nexport const ICON_VOICE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>`\n\n/**\n * 所有图标映射\n */\nexport const ICONS = {\n delete: ICON_DELETE,\n clear: ICON_CLEAR,\n close: ICON_CLOSE,\n check: ICON_CHECK,\n enter: ICON_ENTER,\n shift: ICON_SHIFT,\n space: ICON_SPACE,\n keyboard: ICON_KEYBOARD,\n voice: ICON_VOICE,\n} as const\n\n/** IconName - 图标名称类型 */\nexport type IconName = keyof typeof ICONS\n"],"mappings":";;;;;;;;;;AASO,MAAM,cAAc;AAKpB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,gBAAgB;AAKtB,MAAM,aAAa;AAKnB,MAAM,QAAQ;CACnB,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,OAAO;AACT"}
package/es/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @composy/keyboard-core
3
+ * LDesign 虚拟键盘 - 框架无关的核心模块
4
+ * @packageDocumentation
5
+ */
6
+ export * from './managers';
7
+ export * from './layouts';
8
+ export * from './types';
9
+ export * from './utils';
10
+ export * from './themes';
11
+ export * from './icons';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,YAAY,CAAA;AAG1B,cAAc,WAAW,CAAA;AAGzB,cAAc,SAAS,CAAA;AAGvB,cAAc,SAAS,CAAA;AAGvB,cAAc,UAAU,CAAA;AAGxB,cAAc,SAAS,CAAA"}
package/es/index.js ADDED
@@ -0,0 +1,36 @@
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 { ICONS, ICON_CHECK, ICON_CLEAR, ICON_CLOSE, ICON_DELETE, ICON_ENTER, ICON_KEYBOARD, ICON_SHIFT, ICON_SPACE, ICON_VOICE } from "./icons.js";
11
+ import { qwertyLayout } from "./layouts/qwerty.js";
12
+ import { integerLayout, numberLayout } from "./layouts/number.js";
13
+ import { symbolLayout, symbolLayout2 } from "./layouts/symbol.js";
14
+ import { PLATE_LETTERS, PROVINCES, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout } from "./layouts/license-plate.js";
15
+ import { idcardLayout } from "./layouts/idcard.js";
16
+ import { phoneLayout, phoneSimpleLayout } from "./layouts/phone.js";
17
+ import { amountLayout, amountSimpleLayout } from "./layouts/amount.js";
18
+ import { bankcardLayout } from "./layouts/bankcard.js";
19
+ import { verifycodeLayout } from "./layouts/verifycode.js";
20
+ import { EMAIL_SUFFIXES, emailLayout } from "./layouts/email.js";
21
+ import { urlLayout } from "./layouts/url.js";
22
+ import { searchLayout } from "./layouts/search.js";
23
+ import { punctLayout } from "./layouts/punct.js";
24
+ import { getAvailableLayouts, getLayout, hasLayout, registerLayout, registerLayouts, unregisterLayout } from "./layouts/index.js";
25
+ import { EventEmitter } from "./utils/event-emitter.js";
26
+ import { getDeviceType, getSafeAreaInsets, getViewportInfo, isMobile, isMobileUA, isTouchDevice, onViewportChange, supportsVibrate, vibrate } from "./utils/device.js";
27
+ import { createElement, deleteCharBeforeCursor, getBoundingRect, getElementOffset, getInputCursorPosition, insertTextAtCursor, isClickOutside, isElementInViewport, onClickOutside, preventDefaultAndStopPropagation, scrollIntoViewIfNeeded, setInputCursorPosition, setStyles, toggleClass } from "./utils/dom.js";
28
+ import { KeyboardManager, createKeyboardManager } from "./managers/keyboard-manager.js";
29
+ import { PositionManager, createPositionManager } from "./managers/position-manager.js";
30
+ import { darkTheme, defaultTheme, iosTheme, materialTheme, minimalTheme, miuiTheme, presetThemes } from "./themes/presets.js";
31
+ import { applyTheme, createTheme, generateThemeStyle, getAllThemes, getAvailableThemes, getCurrentTheme, getTheme, mergeTheme, registerTheme, setCurrentTheme, themeToCSS } from "./themes/index.js";
32
+ import { KeyboardRenderer, createKeyboardRenderer } from "./managers/keyboard-renderer.js";
33
+ import { createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, refreshRandomLayout, shuffleArray } from "./utils/random.js";
34
+ import { applyFormatter, formatAmount, formatBankCard, formatIdCard, formatLicensePlate, formatPhone, formatVerifyCode, getFormatter, registerFormatter } from "./utils/formatters.js";
35
+ export { EMAIL_SUFFIXES, EventEmitter, ICONS, ICON_CHECK, ICON_CLEAR, ICON_CLOSE, ICON_DELETE, ICON_ENTER, ICON_KEYBOARD, ICON_SHIFT, ICON_SPACE, ICON_VOICE, KeyboardManager, KeyboardRenderer, PLATE_LETTERS, PROVINCES, PositionManager, amountLayout, amountSimpleLayout, applyFormatter, applyTheme, bankcardLayout, createElement, createKeyboardManager, createKeyboardRenderer, createPositionManager, createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, createTheme, darkTheme, defaultTheme, deleteCharBeforeCursor, emailLayout, formatAmount, formatBankCard, formatIdCard, formatLicensePlate, formatPhone, formatVerifyCode, generateThemeStyle, getAllThemes, getAvailableLayouts, getAvailableThemes, getBoundingRect, getCurrentTheme, getDeviceType, getElementOffset, getFormatter, getInputCursorPosition, getLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, getSafeAreaInsets, getTheme, getViewportInfo, hasLayout, idcardLayout, insertTextAtCursor, integerLayout, iosTheme, isClickOutside, isElementInViewport, isMobile, isMobileUA, isTouchDevice, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, materialTheme, mergeTheme, minimalTheme, miuiTheme, numberLayout, onClickOutside, onViewportChange, phoneLayout, phoneSimpleLayout, presetThemes, preventDefaultAndStopPropagation, punctLayout, qwertyLayout, refreshRandomLayout, registerFormatter, registerLayout, registerLayouts, registerTheme, scrollIntoViewIfNeeded, searchLayout, setCurrentTheme, setInputCursorPosition, setStyles, shuffleArray, supportsVibrate, symbolLayout, symbolLayout2, themeToCSS, toggleClass, unregisterLayout, urlLayout, verifycodeLayout, vibrate };
36
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 金额键盘布局
3
+ * @module layouts/amount
4
+ */
5
+ import type { KeyboardConfig } from '../types';
6
+ /**
7
+ * 金额键盘配置 - 紧凑4x4布局
8
+ */
9
+ export declare const amountLayout: KeyboardConfig;
10
+ /**
11
+ * 简洁金额键盘 - 紧凑4x4布局
12
+ */
13
+ export declare const amountSimpleLayout: KeyboardConfig;
14
+ //# sourceMappingURL=amount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/layouts/amount.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAA;AAgB7D;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cA2E1B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cA0EhC,CAAA"}
@@ -0,0 +1,175 @@
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/amount.ts
12
+ function createNumberKey(num) {
13
+ return {
14
+ id: `amount-${num}`,
15
+ type: "char",
16
+ label: num,
17
+ value: num,
18
+ className: "key-num"
19
+ };
20
+ }
21
+ const amountLayout = {
22
+ type: "amount",
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: "double-zero",
64
+ type: "char",
65
+ label: "00",
66
+ value: "00",
67
+ className: "key-num"
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ className: "numpad-row",
73
+ keys: [
74
+ {
75
+ id: "decimal",
76
+ type: "char",
77
+ label: ".",
78
+ value: ".",
79
+ className: "key-num"
80
+ },
81
+ createNumberKey("0"),
82
+ {
83
+ id: "done",
84
+ type: "done",
85
+ label: "确定",
86
+ width: 2,
87
+ className: "key-numpad-done"
88
+ }
89
+ ]
90
+ }
91
+ ],
92
+ data: {
93
+ inputType: "amount",
94
+ decimalPlaces: 2
95
+ }
96
+ };
97
+ const amountSimpleLayout = {
98
+ type: "amount-simple",
99
+ name: "金额键盘",
100
+ supportShift: false,
101
+ rows: [
102
+ {
103
+ className: "numpad-row",
104
+ keys: [
105
+ createNumberKey("1"),
106
+ createNumberKey("2"),
107
+ createNumberKey("3"),
108
+ {
109
+ id: "backspace",
110
+ type: "backspace",
111
+ icon: ICON_DELETE,
112
+ label: "",
113
+ className: "key-numpad-fn"
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ className: "numpad-row",
119
+ keys: [
120
+ createNumberKey("4"),
121
+ createNumberKey("5"),
122
+ createNumberKey("6"),
123
+ {
124
+ id: "clear",
125
+ type: "clear",
126
+ icon: ICON_CLEAR,
127
+ label: "",
128
+ className: "key-numpad-fn"
129
+ }
130
+ ]
131
+ },
132
+ {
133
+ className: "numpad-row",
134
+ keys: [
135
+ createNumberKey("7"),
136
+ createNumberKey("8"),
137
+ createNumberKey("9"),
138
+ {
139
+ id: "close",
140
+ type: "close",
141
+ label: "关闭",
142
+ className: "key-numpad-fn"
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ className: "numpad-row",
148
+ keys: [
149
+ {
150
+ id: "decimal",
151
+ type: "char",
152
+ label: ".",
153
+ value: ".",
154
+ className: "key-num"
155
+ },
156
+ createNumberKey("0"),
157
+ {
158
+ id: "done",
159
+ type: "done",
160
+ label: "确定",
161
+ width: 2,
162
+ className: "key-numpad-done"
163
+ }
164
+ ]
165
+ }
166
+ ],
167
+ data: {
168
+ inputType: "amount",
169
+ decimalPlaces: 2
170
+ }
171
+ };
172
+ //#endregion
173
+ export { amountLayout, amountSimpleLayout };
174
+ /*! End of @composy/keyboard-core | Powered by @composy/builder */
175
+ //# sourceMappingURL=amount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amount.js","names":[],"sources":["../../src/layouts/amount.ts"],"sourcesContent":["/**\n * 金额键盘布局\n * @module layouts/amount\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport { ICON_DELETE, ICON_CLEAR } from '../icons'\n\n/**\n * 创建数字按键\n */\nfunction createNumberKey(num: string): KeyDefinition {\n return {\n id: `amount-${num}`,\n type: 'char',\n label: num,\n value: num,\n className: 'key-num',\n }\n}\n\n/**\n * 金额键盘配置 - 紧凑4x4布局\n */\nexport const amountLayout: KeyboardConfig = {\n type: 'amount',\n name: '金额键盘',\n supportShift: false,\n rows: [\n {\n className: 'numpad-row',\n keys: [\n createNumberKey('1'),\n createNumberKey('2'),\n createNumberKey('3'),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n className: 'key-numpad-fn',\n },\n ],\n },\n {\n className: 'numpad-row',\n keys: [\n createNumberKey('4'),\n createNumberKey('5'),\n createNumberKey('6'),\n {\n id: 'clear',\n type: 'clear',\n icon: ICON_CLEAR,\n label: '',\n className: 'key-numpad-fn',\n },\n ],\n },\n {\n className: 'numpad-row',\n keys: [\n createNumberKey('7'),\n createNumberKey('8'),\n createNumberKey('9'),\n {\n id: 'double-zero',\n type: 'char',\n label: '00',\n value: '00',\n className: 'key-num',\n },\n ],\n },\n {\n className: 'numpad-row',\n keys: [\n {\n id: 'decimal',\n type: 'char',\n label: '.',\n value: '.',\n className: 'key-num',\n },\n createNumberKey('0'),\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 2,\n className: 'key-numpad-done',\n },\n ],\n },\n ],\n data: {\n inputType: 'amount',\n decimalPlaces: 2,\n },\n}\n\n/**\n * 简洁金额键盘 - 紧凑4x4布局\n */\nexport const amountSimpleLayout: KeyboardConfig = {\n type: 'amount-simple',\n name: '金额键盘',\n supportShift: false,\n rows: [\n {\n className: 'numpad-row',\n keys: [\n createNumberKey('1'),\n createNumberKey('2'),\n createNumberKey('3'),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n className: 'key-numpad-fn',\n },\n ],\n },\n {\n className: 'numpad-row',\n keys: [\n createNumberKey('4'),\n createNumberKey('5'),\n createNumberKey('6'),\n {\n id: 'clear',\n type: 'clear',\n icon: ICON_CLEAR,\n label: '',\n className: 'key-numpad-fn',\n },\n ],\n },\n {\n className: 'numpad-row',\n keys: [\n createNumberKey('7'),\n createNumberKey('8'),\n createNumberKey('9'),\n {\n id: 'close',\n type: 'close',\n label: '关闭',\n className: 'key-numpad-fn',\n },\n ],\n },\n {\n className: 'numpad-row',\n keys: [\n {\n id: 'decimal',\n type: 'char',\n label: '.',\n value: '.',\n className: 'key-num',\n },\n createNumberKey('0'),\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 2,\n className: 'key-numpad-done',\n },\n ],\n },\n ],\n data: {\n inputType: 'amount',\n decimalPlaces: 2,\n },\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAKO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ;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;EACA;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;EACA;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;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,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,eAAe;CACjB;AACF;AAKO,MAAM,qBAAqC;CAChD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ;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;EACA;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;EACA;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;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,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,eAAe;CACjB;AACF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 银行卡键盘布局
3
+ * @module layouts/bankcard
4
+ */
5
+ import type { KeyboardConfig } from '../types';
6
+ /**
7
+ * 银行卡键盘配置 - 紧凑4x4布局
8
+ * 布局结构:
9
+ * 第1行: 1 2 3 [退格]
10
+ * 第2行: 4 5 6 [清除]
11
+ * 第3行: 7 8 9 [关闭]
12
+ * 第4行: [ABC] 0 [确定(占2格)]
13
+ */
14
+ export declare const bankcardLayout: KeyboardConfig;
15
+ //# sourceMappingURL=bankcard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bankcard.d.ts","sourceRoot":"","sources":["../../src/layouts/bankcard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAA;AAmB7D;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,cA8E5B,CAAA"}