@composy/keyboard-core 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -37
- package/dist/index.js +1540 -1395
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2981 -1
- package/dist/index.min.js.map +1 -0
- package/es/.dts-output-manifest.json +1 -0
- package/es/.dts.tsbuildinfo +1 -0
- package/es/icons.d.ts +0 -1
- package/es/icons.js +1 -1
- package/es/icons.js.map +1 -1
- package/es/index.d.ts +3 -4
- package/es/index.js +15 -15
- package/es/layouts/amount.d.ts +0 -1
- package/es/layouts/amount.js +1 -1
- package/es/layouts/amount.js.map +1 -1
- package/es/layouts/bankcard.d.ts +0 -1
- package/es/layouts/bankcard.js +1 -1
- package/es/layouts/bankcard.js.map +1 -1
- package/es/layouts/email.d.ts +0 -1
- package/es/layouts/email.js +1 -1
- package/es/layouts/email.js.map +1 -1
- package/es/layouts/idcard.d.ts +0 -1
- package/es/layouts/idcard.js +1 -1
- package/es/layouts/idcard.js.map +1 -1
- package/es/layouts/index.d.ts +11 -12
- package/es/layouts/index.js +23 -23
- package/es/layouts/index.js.map +1 -1
- package/es/layouts/license-plate.d.ts +0 -1
- package/es/layouts/license-plate.js +1 -1
- package/es/layouts/license-plate.js.map +1 -1
- package/es/layouts/number.d.ts +0 -1
- package/es/layouts/number.js +1 -1
- package/es/layouts/number.js.map +1 -1
- package/es/layouts/phone.d.ts +0 -1
- package/es/layouts/phone.js +1 -1
- package/es/layouts/phone.js.map +1 -1
- package/es/layouts/punct.d.ts +0 -1
- package/es/layouts/punct.js +1 -1
- package/es/layouts/punct.js.map +1 -1
- package/es/layouts/qwerty.d.ts +0 -1
- package/es/layouts/qwerty.js +1 -1
- package/es/layouts/qwerty.js.map +1 -1
- package/es/layouts/search.d.ts +0 -1
- package/es/layouts/search.js +1 -1
- package/es/layouts/search.js.map +1 -1
- package/es/layouts/symbol.d.ts +0 -1
- package/es/layouts/symbol.js +1 -1
- package/es/layouts/symbol.js.map +1 -1
- package/es/layouts/url.d.ts +0 -1
- package/es/layouts/url.js +1 -1
- package/es/layouts/url.js.map +1 -1
- package/es/layouts/verifycode.d.ts +0 -1
- package/es/layouts/verifycode.js +1 -1
- package/es/layouts/verifycode.js.map +1 -1
- package/es/managers/index.d.ts +1 -2
- package/es/managers/index.js +1 -1
- package/es/managers/keyboard-manager.d.ts +2 -1
- package/es/managers/keyboard-manager.js +79 -22
- package/es/managers/keyboard-manager.js.map +1 -1
- package/es/managers/keyboard-renderer.d.ts +3 -2
- package/es/managers/keyboard-renderer.js +81 -39
- package/es/managers/keyboard-renderer.js.map +1 -1
- package/es/managers/position-manager.d.ts +4 -3
- package/es/managers/position-manager.js +42 -21
- package/es/managers/position-manager.js.map +1 -1
- package/es/themes/index.d.ts +1 -2
- package/es/themes/index.js +2 -1
- package/es/themes/index.js.map +1 -1
- package/es/themes/presets.d.ts +0 -1
- package/es/themes/presets.js +1 -1
- package/es/themes/presets.js.map +1 -1
- package/es/themes/types.d.ts +1 -1
- package/es/themes/types.js +1 -1
- package/es/types/index.d.ts +0 -1
- package/es/types/index.js +1 -1
- package/es/types/keyboard.d.ts +0 -1
- package/es/types/keyboard.js +1 -1
- package/es/types/position.d.ts +0 -1
- package/es/types/position.js +1 -1
- package/es/utils/device.d.ts +0 -1
- package/es/utils/device.js +11 -7
- package/es/utils/device.js.map +1 -1
- package/es/utils/dom.d.ts +4 -1
- package/es/utils/dom.js +25 -7
- package/es/utils/dom.js.map +1 -1
- package/es/utils/event-emitter.d.ts +0 -1
- package/es/utils/event-emitter.js +2 -1
- package/es/utils/event-emitter.js.map +1 -1
- package/es/utils/formatters.d.ts +0 -1
- package/es/utils/formatters.js +4 -4
- package/es/utils/formatters.js.map +1 -1
- package/es/utils/index.d.ts +2 -3
- package/es/utils/index.js +5 -5
- package/es/utils/random.d.ts +4 -1
- package/es/utils/random.js +2 -2
- package/es/utils/random.js.map +1 -1
- package/esm/icons.js +1 -1
- package/esm/icons.js.map +1 -1
- package/esm/index.js +15 -15
- package/esm/layouts/amount.js +1 -1
- package/esm/layouts/amount.js.map +1 -1
- package/esm/layouts/bankcard.js +1 -1
- package/esm/layouts/bankcard.js.map +1 -1
- package/esm/layouts/email.js +1 -1
- package/esm/layouts/email.js.map +1 -1
- package/esm/layouts/idcard.js +1 -1
- package/esm/layouts/idcard.js.map +1 -1
- package/esm/layouts/index.js +23 -23
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/license-plate.js +1 -1
- package/esm/layouts/license-plate.js.map +1 -1
- package/esm/layouts/number.js +1 -1
- package/esm/layouts/number.js.map +1 -1
- package/esm/layouts/phone.js +1 -1
- package/esm/layouts/phone.js.map +1 -1
- package/esm/layouts/punct.js +1 -1
- package/esm/layouts/punct.js.map +1 -1
- package/esm/layouts/qwerty.js +1 -1
- package/esm/layouts/qwerty.js.map +1 -1
- package/esm/layouts/search.js +1 -1
- package/esm/layouts/search.js.map +1 -1
- package/esm/layouts/symbol.js +1 -1
- package/esm/layouts/symbol.js.map +1 -1
- package/esm/layouts/url.js +1 -1
- package/esm/layouts/url.js.map +1 -1
- package/esm/layouts/verifycode.js +1 -1
- package/esm/layouts/verifycode.js.map +1 -1
- package/esm/managers/index.js +1 -1
- package/esm/managers/keyboard-manager.js +79 -22
- package/esm/managers/keyboard-manager.js.map +1 -1
- package/esm/managers/keyboard-renderer.js +81 -39
- package/esm/managers/keyboard-renderer.js.map +1 -1
- package/esm/managers/position-manager.js +42 -21
- package/esm/managers/position-manager.js.map +1 -1
- package/esm/themes/index.js +2 -1
- package/esm/themes/index.js.map +1 -1
- package/esm/themes/presets.js +1 -1
- package/esm/themes/presets.js.map +1 -1
- package/esm/utils/device.js +11 -7
- package/esm/utils/device.js.map +1 -1
- package/esm/utils/dom.js +25 -7
- package/esm/utils/dom.js.map +1 -1
- package/esm/utils/event-emitter.js +2 -1
- package/esm/utils/event-emitter.js.map +1 -1
- package/esm/utils/formatters.js +4 -4
- package/esm/utils/formatters.js.map +1 -1
- package/esm/utils/random.js +2 -2
- package/esm/utils/random.js.map +1 -1
- package/lib/icons.cjs +1 -1
- package/lib/icons.cjs.map +1 -1
- package/{esm/icons.d.ts → lib/icons.d.cts} +0 -1
- package/lib/index.cjs +14 -13
- package/{esm/index.d.ts → lib/index.d.cts} +3 -4
- package/lib/layouts/amount.cjs +1 -1
- package/lib/layouts/amount.cjs.map +1 -1
- package/{esm/layouts/amount.d.ts → lib/layouts/amount.d.cts} +0 -1
- package/lib/layouts/bankcard.cjs +1 -1
- package/lib/layouts/bankcard.cjs.map +1 -1
- package/{esm/layouts/bankcard.d.ts → lib/layouts/bankcard.d.cts} +0 -1
- package/lib/layouts/email.cjs +1 -1
- package/lib/layouts/email.cjs.map +1 -1
- package/lib/layouts/{email.d.ts → email.d.cts} +0 -1
- package/lib/layouts/idcard.cjs +1 -1
- package/lib/layouts/idcard.cjs.map +1 -1
- package/{esm/layouts/idcard.d.ts → lib/layouts/idcard.d.cts} +0 -1
- package/lib/layouts/index.cjs +23 -23
- package/lib/layouts/index.cjs.map +1 -1
- package/{esm/layouts/index.d.ts → lib/layouts/index.d.cts} +11 -12
- package/lib/layouts/license-plate.cjs +1 -1
- package/lib/layouts/license-plate.cjs.map +1 -1
- package/{esm/layouts/license-plate.d.ts → lib/layouts/license-plate.d.cts} +0 -1
- package/lib/layouts/number.cjs +1 -1
- package/lib/layouts/number.cjs.map +1 -1
- package/{esm/layouts/number.d.ts → lib/layouts/number.d.cts} +0 -1
- package/lib/layouts/phone.cjs +1 -1
- package/lib/layouts/phone.cjs.map +1 -1
- package/lib/layouts/{phone.d.ts → phone.d.cts} +0 -1
- package/lib/layouts/punct.cjs +1 -1
- package/lib/layouts/punct.cjs.map +1 -1
- package/lib/layouts/{punct.d.ts → punct.d.cts} +0 -1
- package/lib/layouts/qwerty.cjs +1 -1
- package/lib/layouts/qwerty.cjs.map +1 -1
- package/{esm/layouts/qwerty.d.ts → lib/layouts/qwerty.d.cts} +0 -1
- package/lib/layouts/search.cjs +1 -1
- package/lib/layouts/search.cjs.map +1 -1
- package/{esm/layouts/search.d.ts → lib/layouts/search.d.cts} +0 -1
- package/lib/layouts/symbol.cjs +1 -1
- package/lib/layouts/symbol.cjs.map +1 -1
- package/{esm/layouts/symbol.d.ts → lib/layouts/symbol.d.cts} +0 -1
- package/lib/layouts/url.cjs +1 -1
- package/lib/layouts/url.cjs.map +1 -1
- package/{esm/layouts/url.d.ts → lib/layouts/url.d.cts} +0 -1
- package/lib/layouts/verifycode.cjs +1 -1
- package/lib/layouts/verifycode.cjs.map +1 -1
- package/lib/layouts/{verifycode.d.ts → verifycode.d.cts} +0 -1
- package/lib/managers/index.cjs +1 -1
- package/lib/managers/{index.d.ts → index.d.cts} +1 -2
- package/lib/managers/keyboard-manager.cjs +79 -22
- package/lib/managers/keyboard-manager.cjs.map +1 -1
- package/lib/managers/{keyboard-manager.d.ts → keyboard-manager.d.cts} +2 -1
- package/lib/managers/keyboard-renderer.cjs +80 -38
- package/lib/managers/keyboard-renderer.cjs.map +1 -1
- package/lib/managers/{keyboard-renderer.d.ts → keyboard-renderer.d.cts} +3 -2
- package/lib/managers/position-manager.cjs +42 -21
- package/lib/managers/position-manager.cjs.map +1 -1
- package/lib/managers/{position-manager.d.ts → position-manager.d.cts} +4 -3
- package/lib/themes/index.cjs +2 -1
- package/lib/themes/index.cjs.map +1 -1
- package/lib/themes/{index.d.ts → index.d.cts} +1 -2
- package/lib/themes/presets.cjs +1 -1
- package/lib/themes/presets.cjs.map +1 -1
- package/lib/themes/{presets.d.ts → presets.d.cts} +0 -1
- package/lib/themes/types.cjs +1 -1
- package/{esm/themes/types.d.ts → lib/themes/types.d.cts} +1 -1
- package/lib/types/index.cjs +1 -1
- package/{esm/types/index.d.ts → lib/types/index.d.cts} +0 -1
- package/lib/types/keyboard.cjs +1 -1
- package/{esm/types/keyboard.d.ts → lib/types/keyboard.d.cts} +0 -1
- package/lib/types/position.cjs +1 -1
- package/lib/types/{position.d.ts → position.d.cts} +0 -1
- package/lib/utils/device.cjs +11 -7
- package/lib/utils/device.cjs.map +1 -1
- package/{esm/utils/device.d.ts → lib/utils/device.d.cts} +0 -1
- package/lib/utils/dom.cjs +25 -6
- package/lib/utils/dom.cjs.map +1 -1
- package/{esm/utils/dom.d.ts → lib/utils/dom.d.cts} +4 -1
- package/lib/utils/event-emitter.cjs +2 -1
- package/lib/utils/event-emitter.cjs.map +1 -1
- package/{esm/utils/event-emitter.d.ts → lib/utils/event-emitter.d.cts} +0 -1
- package/lib/utils/formatters.cjs +4 -4
- package/lib/utils/formatters.cjs.map +1 -1
- package/{esm/utils/formatters.d.ts → lib/utils/formatters.d.cts} +0 -1
- package/lib/utils/index.cjs +4 -3
- package/{esm/utils/index.d.ts → lib/utils/index.d.cts} +2 -3
- package/lib/utils/random.cjs +2 -2
- package/lib/utils/random.cjs.map +1 -1
- package/{esm/utils/random.d.ts → lib/utils/random.d.cts} +4 -1
- package/package.json +28 -14
- package/es/icons.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/layouts/amount.d.ts.map +0 -1
- package/es/layouts/bankcard.d.ts.map +0 -1
- package/es/layouts/email.d.ts.map +0 -1
- package/es/layouts/idcard.d.ts.map +0 -1
- package/es/layouts/index.d.ts.map +0 -1
- package/es/layouts/license-plate.d.ts.map +0 -1
- package/es/layouts/number.d.ts.map +0 -1
- package/es/layouts/phone.d.ts.map +0 -1
- package/es/layouts/punct.d.ts.map +0 -1
- package/es/layouts/qwerty.d.ts.map +0 -1
- package/es/layouts/search.d.ts.map +0 -1
- package/es/layouts/symbol.d.ts.map +0 -1
- package/es/layouts/url.d.ts.map +0 -1
- package/es/layouts/verifycode.d.ts.map +0 -1
- package/es/managers/index.d.ts.map +0 -1
- package/es/managers/keyboard-manager.d.ts.map +0 -1
- package/es/managers/keyboard-renderer.d.ts.map +0 -1
- package/es/managers/position-manager.d.ts.map +0 -1
- package/es/themes/index.d.ts.map +0 -1
- package/es/themes/presets.d.ts.map +0 -1
- package/es/themes/types.d.ts.map +0 -1
- package/es/types/index.d.ts.map +0 -1
- package/es/types/keyboard.d.ts.map +0 -1
- package/es/types/position.d.ts.map +0 -1
- package/es/utils/device.d.ts.map +0 -1
- package/es/utils/dom.d.ts.map +0 -1
- package/es/utils/event-emitter.d.ts.map +0 -1
- package/es/utils/formatters.d.ts.map +0 -1
- package/es/utils/index.d.ts.map +0 -1
- package/es/utils/random.d.ts.map +0 -1
- package/esm/icons.d.ts.map +0 -1
- package/esm/index.d.ts.map +0 -1
- package/esm/layouts/amount.d.ts.map +0 -1
- package/esm/layouts/bankcard.d.ts.map +0 -1
- package/esm/layouts/email.d.ts +0 -11
- package/esm/layouts/email.d.ts.map +0 -1
- package/esm/layouts/idcard.d.ts.map +0 -1
- package/esm/layouts/index.d.ts.map +0 -1
- package/esm/layouts/license-plate.d.ts.map +0 -1
- package/esm/layouts/number.d.ts.map +0 -1
- package/esm/layouts/phone.d.ts +0 -15
- package/esm/layouts/phone.d.ts.map +0 -1
- package/esm/layouts/punct.d.ts +0 -7
- package/esm/layouts/punct.d.ts.map +0 -1
- package/esm/layouts/qwerty.d.ts.map +0 -1
- package/esm/layouts/search.d.ts.map +0 -1
- package/esm/layouts/symbol.d.ts.map +0 -1
- package/esm/layouts/url.d.ts.map +0 -1
- package/esm/layouts/verifycode.d.ts +0 -15
- package/esm/layouts/verifycode.d.ts.map +0 -1
- package/esm/managers/index.d.ts +0 -8
- package/esm/managers/index.d.ts.map +0 -1
- package/esm/managers/keyboard-manager.d.ts +0 -130
- package/esm/managers/keyboard-manager.d.ts.map +0 -1
- package/esm/managers/keyboard-renderer.d.ts +0 -115
- package/esm/managers/keyboard-renderer.d.ts.map +0 -1
- package/esm/managers/position-manager.d.ts +0 -72
- package/esm/managers/position-manager.d.ts.map +0 -1
- package/esm/themes/index.d.ts +0 -70
- package/esm/themes/index.d.ts.map +0 -1
- package/esm/themes/presets.d.ts +0 -39
- package/esm/themes/presets.d.ts.map +0 -1
- package/esm/themes/types.d.ts.map +0 -1
- package/esm/themes/types.js +0 -10
- package/esm/types/index.d.ts.map +0 -1
- package/esm/types/index.js +0 -10
- package/esm/types/keyboard.d.ts.map +0 -1
- package/esm/types/keyboard.js +0 -10
- package/esm/types/position.d.ts +0 -139
- package/esm/types/position.d.ts.map +0 -1
- package/esm/types/position.js +0 -10
- package/esm/utils/device.d.ts.map +0 -1
- package/esm/utils/dom.d.ts.map +0 -1
- package/esm/utils/event-emitter.d.ts.map +0 -1
- package/esm/utils/formatters.d.ts.map +0 -1
- package/esm/utils/index.d.ts.map +0 -1
- package/esm/utils/index.js +0 -16
- package/esm/utils/random.d.ts.map +0 -1
- package/lib/icons.d.ts +0 -58
- package/lib/index.d.ts +0 -12
- package/lib/layouts/amount.d.ts +0 -14
- package/lib/layouts/bankcard.d.ts +0 -15
- package/lib/layouts/idcard.d.ts +0 -16
- package/lib/layouts/index.d.ts +0 -54
- package/lib/layouts/license-plate.d.ts +0 -35
- package/lib/layouts/number.d.ts +0 -14
- package/lib/layouts/qwerty.d.ts +0 -10
- package/lib/layouts/search.d.ts +0 -7
- package/lib/layouts/symbol.d.ts +0 -14
- package/lib/layouts/url.d.ts +0 -7
- package/lib/themes/types.d.ts +0 -118
- package/lib/types/index.d.ts +0 -7
- package/lib/types/keyboard.d.ts +0 -253
- package/lib/utils/device.d.ts +0 -45
- package/lib/utils/dom.d.ts +0 -69
- package/lib/utils/event-emitter.d.ts +0 -52
- package/lib/utils/formatters.d.ts +0 -51
- package/lib/utils/index.d.ts +0 -10
- package/lib/utils/random.d.ts +0 -71
package/dist/index.min.js
CHANGED
|
@@ -1 +1,2981 @@
|
|
|
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;});
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-10-12 17:29:15 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
(function(e, t) {
|
|
11
|
+
"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).LDesignKeyboardCore = {});
|
|
12
|
+
})(this, function(exports) {
|
|
13
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
const e = "<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>", t = "<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>", a = "<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>", s = "<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 = "<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>", i = "<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>", o = "<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>", r = "<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>", l = "<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>", c = {
|
|
15
|
+
delete: e,
|
|
16
|
+
clear: t,
|
|
17
|
+
close: a,
|
|
18
|
+
check: s,
|
|
19
|
+
enter: n,
|
|
20
|
+
shift: i,
|
|
21
|
+
space: o,
|
|
22
|
+
keyboard: r,
|
|
23
|
+
voice: l
|
|
24
|
+
};
|
|
25
|
+
function d(e) {
|
|
26
|
+
return {
|
|
27
|
+
id: `amount-${e}`,
|
|
28
|
+
type: "char",
|
|
29
|
+
label: e,
|
|
30
|
+
value: e,
|
|
31
|
+
className: "key-num"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const p = {
|
|
35
|
+
type: "amount",
|
|
36
|
+
name: "金额键盘",
|
|
37
|
+
supportShift: !1,
|
|
38
|
+
rows: [
|
|
39
|
+
{
|
|
40
|
+
className: "numpad-row",
|
|
41
|
+
keys: [
|
|
42
|
+
d("1"),
|
|
43
|
+
d("2"),
|
|
44
|
+
d("3"),
|
|
45
|
+
{
|
|
46
|
+
id: "backspace",
|
|
47
|
+
type: "backspace",
|
|
48
|
+
icon: e,
|
|
49
|
+
label: "",
|
|
50
|
+
className: "key-numpad-fn"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
className: "numpad-row",
|
|
56
|
+
keys: [
|
|
57
|
+
d("4"),
|
|
58
|
+
d("5"),
|
|
59
|
+
d("6"),
|
|
60
|
+
{
|
|
61
|
+
id: "clear",
|
|
62
|
+
type: "clear",
|
|
63
|
+
icon: t,
|
|
64
|
+
label: "",
|
|
65
|
+
className: "key-numpad-fn"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
className: "numpad-row",
|
|
71
|
+
keys: [
|
|
72
|
+
d("7"),
|
|
73
|
+
d("8"),
|
|
74
|
+
d("9"),
|
|
75
|
+
{
|
|
76
|
+
id: "double-zero",
|
|
77
|
+
type: "char",
|
|
78
|
+
label: "00",
|
|
79
|
+
value: "00",
|
|
80
|
+
className: "key-num"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
className: "numpad-row",
|
|
86
|
+
keys: [
|
|
87
|
+
{
|
|
88
|
+
id: "decimal",
|
|
89
|
+
type: "char",
|
|
90
|
+
label: ".",
|
|
91
|
+
value: ".",
|
|
92
|
+
className: "key-num"
|
|
93
|
+
},
|
|
94
|
+
d("0"),
|
|
95
|
+
{
|
|
96
|
+
id: "done",
|
|
97
|
+
type: "done",
|
|
98
|
+
label: "确定",
|
|
99
|
+
width: 2,
|
|
100
|
+
className: "key-numpad-done"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
data: {
|
|
106
|
+
inputType: "amount",
|
|
107
|
+
decimalPlaces: 2
|
|
108
|
+
}
|
|
109
|
+
}, u = {
|
|
110
|
+
type: "amount-simple",
|
|
111
|
+
name: "金额键盘",
|
|
112
|
+
supportShift: !1,
|
|
113
|
+
rows: [
|
|
114
|
+
{
|
|
115
|
+
className: "numpad-row",
|
|
116
|
+
keys: [
|
|
117
|
+
d("1"),
|
|
118
|
+
d("2"),
|
|
119
|
+
d("3"),
|
|
120
|
+
{
|
|
121
|
+
id: "backspace",
|
|
122
|
+
type: "backspace",
|
|
123
|
+
icon: e,
|
|
124
|
+
label: "",
|
|
125
|
+
className: "key-numpad-fn"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
className: "numpad-row",
|
|
131
|
+
keys: [
|
|
132
|
+
d("4"),
|
|
133
|
+
d("5"),
|
|
134
|
+
d("6"),
|
|
135
|
+
{
|
|
136
|
+
id: "clear",
|
|
137
|
+
type: "clear",
|
|
138
|
+
icon: t,
|
|
139
|
+
label: "",
|
|
140
|
+
className: "key-numpad-fn"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
className: "numpad-row",
|
|
146
|
+
keys: [
|
|
147
|
+
d("7"),
|
|
148
|
+
d("8"),
|
|
149
|
+
d("9"),
|
|
150
|
+
{
|
|
151
|
+
id: "close",
|
|
152
|
+
type: "close",
|
|
153
|
+
label: "关闭",
|
|
154
|
+
className: "key-numpad-fn"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
className: "numpad-row",
|
|
160
|
+
keys: [
|
|
161
|
+
{
|
|
162
|
+
id: "decimal",
|
|
163
|
+
type: "char",
|
|
164
|
+
label: ".",
|
|
165
|
+
value: ".",
|
|
166
|
+
className: "key-num"
|
|
167
|
+
},
|
|
168
|
+
d("0"),
|
|
169
|
+
{
|
|
170
|
+
id: "done",
|
|
171
|
+
type: "done",
|
|
172
|
+
label: "确定",
|
|
173
|
+
width: 2,
|
|
174
|
+
className: "key-numpad-done"
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
data: {
|
|
180
|
+
inputType: "amount",
|
|
181
|
+
decimalPlaces: 2
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
function h(e) {
|
|
185
|
+
return {
|
|
186
|
+
id: `bankcard-${e}`,
|
|
187
|
+
type: "char",
|
|
188
|
+
label: e,
|
|
189
|
+
value: e,
|
|
190
|
+
className: "key-num"
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const y = {
|
|
194
|
+
type: "bankcard",
|
|
195
|
+
name: "银行卡键盘",
|
|
196
|
+
supportShift: !1,
|
|
197
|
+
rows: [
|
|
198
|
+
{
|
|
199
|
+
className: "numpad-row",
|
|
200
|
+
keys: [
|
|
201
|
+
h("1"),
|
|
202
|
+
h("2"),
|
|
203
|
+
h("3"),
|
|
204
|
+
{
|
|
205
|
+
id: "backspace",
|
|
206
|
+
type: "backspace",
|
|
207
|
+
icon: e,
|
|
208
|
+
label: "",
|
|
209
|
+
className: "key-numpad-fn"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
className: "numpad-row",
|
|
215
|
+
keys: [
|
|
216
|
+
h("4"),
|
|
217
|
+
h("5"),
|
|
218
|
+
h("6"),
|
|
219
|
+
{
|
|
220
|
+
id: "clear",
|
|
221
|
+
type: "clear",
|
|
222
|
+
icon: t,
|
|
223
|
+
label: "",
|
|
224
|
+
className: "key-numpad-fn"
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
className: "numpad-row",
|
|
230
|
+
keys: [
|
|
231
|
+
h("7"),
|
|
232
|
+
h("8"),
|
|
233
|
+
h("9"),
|
|
234
|
+
{
|
|
235
|
+
id: "close",
|
|
236
|
+
type: "close",
|
|
237
|
+
label: "关闭",
|
|
238
|
+
className: "key-numpad-fn"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
className: "numpad-row",
|
|
244
|
+
keys: [
|
|
245
|
+
{
|
|
246
|
+
id: "switch-qwerty",
|
|
247
|
+
type: "tab",
|
|
248
|
+
label: "ABC",
|
|
249
|
+
className: "key-numpad-fn",
|
|
250
|
+
data: { targetType: "qwerty" }
|
|
251
|
+
},
|
|
252
|
+
h("0"),
|
|
253
|
+
{
|
|
254
|
+
id: "done",
|
|
255
|
+
type: "done",
|
|
256
|
+
label: "确定",
|
|
257
|
+
width: 2,
|
|
258
|
+
className: "key-numpad-done"
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
data: {
|
|
264
|
+
maxLength: 19,
|
|
265
|
+
inputType: "bankcard"
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
function m(e) {
|
|
269
|
+
return {
|
|
270
|
+
id: `email-char-${e.toLowerCase()}`,
|
|
271
|
+
type: "char",
|
|
272
|
+
label: {
|
|
273
|
+
lower: e.toLowerCase(),
|
|
274
|
+
upper: e.toUpperCase()
|
|
275
|
+
},
|
|
276
|
+
value: {
|
|
277
|
+
lower: e.toLowerCase(),
|
|
278
|
+
upper: e.toUpperCase()
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function k(e, t) {
|
|
283
|
+
return {
|
|
284
|
+
id: t || `email-snippet-${e.replace(/[^a-z0-9]/gi, "")}`,
|
|
285
|
+
type: "char",
|
|
286
|
+
label: e,
|
|
287
|
+
value: e,
|
|
288
|
+
className: "key-snippet"
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const f = [
|
|
292
|
+
"@qq.com",
|
|
293
|
+
"@163.com",
|
|
294
|
+
"@126.com",
|
|
295
|
+
"@gmail.com",
|
|
296
|
+
"@outlook.com",
|
|
297
|
+
"@hotmail.com",
|
|
298
|
+
"@sina.com",
|
|
299
|
+
"@sohu.com",
|
|
300
|
+
"@icloud.com",
|
|
301
|
+
"@foxmail.com",
|
|
302
|
+
"@yeah.net",
|
|
303
|
+
"@139.com"
|
|
304
|
+
], b = {
|
|
305
|
+
type: "email",
|
|
306
|
+
name: "邮箱键盘",
|
|
307
|
+
supportShift: !0,
|
|
308
|
+
defaultUpperCase: !1,
|
|
309
|
+
switchable: ["symbol", "number"],
|
|
310
|
+
rows: [
|
|
311
|
+
{ keys: "qwertyuiop".split("").map(m) },
|
|
312
|
+
{ keys: "asdfghjkl".split("").map(m) },
|
|
313
|
+
{ keys: [
|
|
314
|
+
{
|
|
315
|
+
id: "shift",
|
|
316
|
+
type: "shift",
|
|
317
|
+
icon: i,
|
|
318
|
+
label: "",
|
|
319
|
+
width: 1.5,
|
|
320
|
+
className: "key-shift"
|
|
321
|
+
},
|
|
322
|
+
..."zxcvbnm".split("").map(m),
|
|
323
|
+
{
|
|
324
|
+
id: "backspace",
|
|
325
|
+
type: "backspace",
|
|
326
|
+
icon: e,
|
|
327
|
+
label: "",
|
|
328
|
+
width: 1.5,
|
|
329
|
+
className: "key-backspace"
|
|
330
|
+
}
|
|
331
|
+
] },
|
|
332
|
+
{ keys: [
|
|
333
|
+
{
|
|
334
|
+
id: "switch-number",
|
|
335
|
+
type: "tab",
|
|
336
|
+
label: "123",
|
|
337
|
+
width: 1.25,
|
|
338
|
+
className: "key-switch",
|
|
339
|
+
data: { targetType: "number" }
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: "email-at",
|
|
343
|
+
type: "char",
|
|
344
|
+
label: "@",
|
|
345
|
+
value: "@",
|
|
346
|
+
className: "key-at"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
id: "email-suffix",
|
|
350
|
+
type: "char",
|
|
351
|
+
label: ".com",
|
|
352
|
+
value: "",
|
|
353
|
+
width: 1.5,
|
|
354
|
+
className: "key-suffix",
|
|
355
|
+
options: f
|
|
356
|
+
},
|
|
357
|
+
k(".", "email-dot"),
|
|
358
|
+
k("-", "email-dash"),
|
|
359
|
+
k("_", "email-underscore"),
|
|
360
|
+
{
|
|
361
|
+
id: "space",
|
|
362
|
+
type: "space",
|
|
363
|
+
label: "",
|
|
364
|
+
value: " ",
|
|
365
|
+
width: 2,
|
|
366
|
+
className: "key-space"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
id: "email-done",
|
|
370
|
+
type: "done",
|
|
371
|
+
label: "确定",
|
|
372
|
+
width: 1.5,
|
|
373
|
+
className: "key-done"
|
|
374
|
+
}
|
|
375
|
+
] }
|
|
376
|
+
]
|
|
377
|
+
};
|
|
378
|
+
function g(e) {
|
|
379
|
+
return {
|
|
380
|
+
id: `idcard-${e}`,
|
|
381
|
+
type: "char",
|
|
382
|
+
label: e,
|
|
383
|
+
value: e,
|
|
384
|
+
className: "key-num"
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
const w = {
|
|
388
|
+
type: "idcard",
|
|
389
|
+
name: "身份证键盘",
|
|
390
|
+
supportShift: !1,
|
|
391
|
+
rows: [
|
|
392
|
+
{
|
|
393
|
+
className: "numpad-row",
|
|
394
|
+
keys: [
|
|
395
|
+
g("1"),
|
|
396
|
+
g("2"),
|
|
397
|
+
g("3"),
|
|
398
|
+
{
|
|
399
|
+
id: "backspace",
|
|
400
|
+
type: "backspace",
|
|
401
|
+
icon: e,
|
|
402
|
+
label: "",
|
|
403
|
+
className: "key-numpad-fn"
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
className: "numpad-row",
|
|
409
|
+
keys: [
|
|
410
|
+
g("4"),
|
|
411
|
+
g("5"),
|
|
412
|
+
g("6"),
|
|
413
|
+
{
|
|
414
|
+
id: "clear",
|
|
415
|
+
type: "clear",
|
|
416
|
+
icon: t,
|
|
417
|
+
label: "",
|
|
418
|
+
className: "key-numpad-fn"
|
|
419
|
+
}
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
className: "numpad-row",
|
|
424
|
+
keys: [
|
|
425
|
+
g("7"),
|
|
426
|
+
g("8"),
|
|
427
|
+
g("9"),
|
|
428
|
+
{
|
|
429
|
+
id: "idcard-x",
|
|
430
|
+
type: "char",
|
|
431
|
+
label: "X",
|
|
432
|
+
value: "X",
|
|
433
|
+
className: "key-num"
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
className: "numpad-row",
|
|
439
|
+
keys: [
|
|
440
|
+
{
|
|
441
|
+
id: "close",
|
|
442
|
+
type: "close",
|
|
443
|
+
label: "关闭",
|
|
444
|
+
className: "key-numpad-fn"
|
|
445
|
+
},
|
|
446
|
+
g("0"),
|
|
447
|
+
{
|
|
448
|
+
id: "done",
|
|
449
|
+
type: "done",
|
|
450
|
+
label: "确定",
|
|
451
|
+
width: 2,
|
|
452
|
+
className: "key-numpad-done"
|
|
453
|
+
}
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
data: {
|
|
458
|
+
maxLength: 18,
|
|
459
|
+
inputType: "idcard"
|
|
460
|
+
}
|
|
461
|
+
}, v = [
|
|
462
|
+
"京",
|
|
463
|
+
"津",
|
|
464
|
+
"沪",
|
|
465
|
+
"渝",
|
|
466
|
+
"冀",
|
|
467
|
+
"豫",
|
|
468
|
+
"云",
|
|
469
|
+
"辽",
|
|
470
|
+
"黑",
|
|
471
|
+
"湘",
|
|
472
|
+
"皖",
|
|
473
|
+
"鲁",
|
|
474
|
+
"新",
|
|
475
|
+
"苏",
|
|
476
|
+
"浙",
|
|
477
|
+
"赣",
|
|
478
|
+
"鄂",
|
|
479
|
+
"桂",
|
|
480
|
+
"甘",
|
|
481
|
+
"晋",
|
|
482
|
+
"蒙",
|
|
483
|
+
"陕",
|
|
484
|
+
"吉",
|
|
485
|
+
"闽",
|
|
486
|
+
"贵",
|
|
487
|
+
"粤",
|
|
488
|
+
"青",
|
|
489
|
+
"藏",
|
|
490
|
+
"川",
|
|
491
|
+
"宁",
|
|
492
|
+
"琼",
|
|
493
|
+
"港",
|
|
494
|
+
"澳"
|
|
495
|
+
], N = [
|
|
496
|
+
"A",
|
|
497
|
+
"B",
|
|
498
|
+
"C",
|
|
499
|
+
"D",
|
|
500
|
+
"E",
|
|
501
|
+
"F",
|
|
502
|
+
"G",
|
|
503
|
+
"H",
|
|
504
|
+
"J",
|
|
505
|
+
"K",
|
|
506
|
+
"L",
|
|
507
|
+
"M",
|
|
508
|
+
"N",
|
|
509
|
+
"P",
|
|
510
|
+
"Q",
|
|
511
|
+
"R",
|
|
512
|
+
"S",
|
|
513
|
+
"T",
|
|
514
|
+
"U",
|
|
515
|
+
"V",
|
|
516
|
+
"W",
|
|
517
|
+
"X",
|
|
518
|
+
"Y",
|
|
519
|
+
"Z"
|
|
520
|
+
];
|
|
521
|
+
function C(e) {
|
|
522
|
+
return {
|
|
523
|
+
id: `province-${e}`,
|
|
524
|
+
type: "char",
|
|
525
|
+
label: e,
|
|
526
|
+
value: e,
|
|
527
|
+
className: "key-plate-province",
|
|
528
|
+
data: { switchAfterInput: "license-plate-alphanumeric" }
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function E(e) {
|
|
532
|
+
return {
|
|
533
|
+
id: `letter-${e}`,
|
|
534
|
+
type: "char",
|
|
535
|
+
label: e,
|
|
536
|
+
value: e,
|
|
537
|
+
className: "key-plate-letter"
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
const x = {
|
|
541
|
+
type: "license-plate-province",
|
|
542
|
+
name: "省份简称",
|
|
543
|
+
supportShift: !1,
|
|
544
|
+
rows: [
|
|
545
|
+
{
|
|
546
|
+
className: "plate-keyboard-row",
|
|
547
|
+
keys: v.slice(0, 10).map(C)
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
className: "plate-keyboard-row",
|
|
551
|
+
keys: v.slice(10, 20).map(C)
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
className: "plate-keyboard-row",
|
|
555
|
+
keys: v.slice(20, 30).map(C)
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
className: "plate-keyboard-row",
|
|
559
|
+
keys: [
|
|
560
|
+
...v.slice(30, 33).map(C),
|
|
561
|
+
{
|
|
562
|
+
id: "plate-xue",
|
|
563
|
+
type: "char",
|
|
564
|
+
label: "学",
|
|
565
|
+
value: "学",
|
|
566
|
+
className: "key-plate-special",
|
|
567
|
+
data: { switchAfterInput: "license-plate-alphanumeric" }
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
id: "plate-jing",
|
|
571
|
+
type: "char",
|
|
572
|
+
label: "警",
|
|
573
|
+
value: "警",
|
|
574
|
+
className: "key-plate-special",
|
|
575
|
+
data: { switchAfterInput: "license-plate-alphanumeric" }
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
id: "backspace",
|
|
579
|
+
type: "backspace",
|
|
580
|
+
icon: e,
|
|
581
|
+
label: "",
|
|
582
|
+
width: 1.5,
|
|
583
|
+
className: "key-plate-fn"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
id: "done",
|
|
587
|
+
type: "done",
|
|
588
|
+
label: "确定",
|
|
589
|
+
width: 2.5,
|
|
590
|
+
className: "key-plate-done"
|
|
591
|
+
}
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
data: {
|
|
596
|
+
maxLength: 8,
|
|
597
|
+
inputType: "license-plate"
|
|
598
|
+
}
|
|
599
|
+
}, S = {
|
|
600
|
+
type: "license-plate-alphanumeric",
|
|
601
|
+
name: "字母数字",
|
|
602
|
+
supportShift: !1,
|
|
603
|
+
rows: [
|
|
604
|
+
{
|
|
605
|
+
className: "plate-keyboard-row",
|
|
606
|
+
keys: "1234567890".split("").map(function(e) {
|
|
607
|
+
return {
|
|
608
|
+
id: `num-${e}`,
|
|
609
|
+
type: "char",
|
|
610
|
+
label: e,
|
|
611
|
+
value: e,
|
|
612
|
+
className: "key-plate-number"
|
|
613
|
+
};
|
|
614
|
+
})
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
className: "plate-keyboard-row",
|
|
618
|
+
keys: N.slice(0, 10).map(E)
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
className: "plate-keyboard-row",
|
|
622
|
+
keys: [...N.slice(10, 19).map(E), {
|
|
623
|
+
id: "backspace",
|
|
624
|
+
type: "backspace",
|
|
625
|
+
icon: e,
|
|
626
|
+
label: "",
|
|
627
|
+
className: "key-plate-fn"
|
|
628
|
+
}]
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
className: "plate-keyboard-row",
|
|
632
|
+
keys: [
|
|
633
|
+
{
|
|
634
|
+
id: "switch-province",
|
|
635
|
+
type: "tab",
|
|
636
|
+
label: "省份",
|
|
637
|
+
width: 1.5,
|
|
638
|
+
className: "key-plate-switch",
|
|
639
|
+
data: { targetType: "license-plate-province" }
|
|
640
|
+
},
|
|
641
|
+
...N.slice(19, 24).map(E),
|
|
642
|
+
{
|
|
643
|
+
id: "plate-xue",
|
|
644
|
+
type: "char",
|
|
645
|
+
label: "学",
|
|
646
|
+
value: "学",
|
|
647
|
+
className: "key-plate-special"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
id: "plate-jing",
|
|
651
|
+
type: "char",
|
|
652
|
+
label: "警",
|
|
653
|
+
value: "警",
|
|
654
|
+
className: "key-plate-special"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
id: "done",
|
|
658
|
+
type: "done",
|
|
659
|
+
label: "确定",
|
|
660
|
+
width: 1.5,
|
|
661
|
+
className: "key-plate-done"
|
|
662
|
+
}
|
|
663
|
+
]
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
data: {
|
|
667
|
+
maxLength: 8,
|
|
668
|
+
inputType: "license-plate"
|
|
669
|
+
}
|
|
670
|
+
}, L = {
|
|
671
|
+
type: "license-plate-letter",
|
|
672
|
+
name: "字母",
|
|
673
|
+
supportShift: !1,
|
|
674
|
+
rows: [
|
|
675
|
+
{
|
|
676
|
+
className: "plate-keyboard-row",
|
|
677
|
+
keys: N.slice(0, 8).map(E)
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
className: "plate-keyboard-row",
|
|
681
|
+
keys: N.slice(8, 16).map(E)
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
className: "plate-keyboard-row",
|
|
685
|
+
keys: [...N.slice(16, 24).map(E)]
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
className: "plate-keyboard-row",
|
|
689
|
+
keys: [
|
|
690
|
+
{
|
|
691
|
+
id: "switch-province",
|
|
692
|
+
type: "tab",
|
|
693
|
+
label: "省份",
|
|
694
|
+
width: 2,
|
|
695
|
+
className: "key-plate-switch",
|
|
696
|
+
data: { targetType: "license-plate-province" }
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
id: "backspace",
|
|
700
|
+
type: "backspace",
|
|
701
|
+
icon: e,
|
|
702
|
+
label: "",
|
|
703
|
+
width: 2,
|
|
704
|
+
className: "key-plate-fn"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
id: "done",
|
|
708
|
+
type: "done",
|
|
709
|
+
label: "确定",
|
|
710
|
+
width: 2,
|
|
711
|
+
className: "key-plate-done"
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
],
|
|
716
|
+
data: {
|
|
717
|
+
maxLength: 8,
|
|
718
|
+
inputType: "license-plate"
|
|
719
|
+
}
|
|
720
|
+
}, T = {
|
|
721
|
+
type: "license-plate",
|
|
722
|
+
name: "车牌号键盘",
|
|
723
|
+
supportShift: !1,
|
|
724
|
+
data: {
|
|
725
|
+
autoSwitch: !0,
|
|
726
|
+
maxLength: 8,
|
|
727
|
+
inputType: "license-plate"
|
|
728
|
+
},
|
|
729
|
+
rows: x.rows
|
|
730
|
+
};
|
|
731
|
+
function A(e) {
|
|
732
|
+
return {
|
|
733
|
+
id: `num-${e}`,
|
|
734
|
+
type: "char",
|
|
735
|
+
label: e,
|
|
736
|
+
value: e,
|
|
737
|
+
className: "key-num"
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
const P = {
|
|
741
|
+
type: "number",
|
|
742
|
+
name: "数字键盘",
|
|
743
|
+
supportShift: !1,
|
|
744
|
+
switchable: ["qwerty", "symbol"],
|
|
745
|
+
rows: [
|
|
746
|
+
{
|
|
747
|
+
className: "numpad-row",
|
|
748
|
+
keys: [
|
|
749
|
+
A("1"),
|
|
750
|
+
A("2"),
|
|
751
|
+
A("3"),
|
|
752
|
+
{
|
|
753
|
+
id: "backspace",
|
|
754
|
+
type: "backspace",
|
|
755
|
+
icon: e,
|
|
756
|
+
label: "",
|
|
757
|
+
className: "key-numpad-fn"
|
|
758
|
+
}
|
|
759
|
+
]
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
className: "numpad-row",
|
|
763
|
+
keys: [
|
|
764
|
+
A("4"),
|
|
765
|
+
A("5"),
|
|
766
|
+
A("6"),
|
|
767
|
+
{
|
|
768
|
+
id: "clear",
|
|
769
|
+
type: "clear",
|
|
770
|
+
icon: t,
|
|
771
|
+
label: "",
|
|
772
|
+
className: "key-numpad-fn"
|
|
773
|
+
}
|
|
774
|
+
]
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
className: "numpad-row",
|
|
778
|
+
keys: [
|
|
779
|
+
A("7"),
|
|
780
|
+
A("8"),
|
|
781
|
+
A("9"),
|
|
782
|
+
{
|
|
783
|
+
id: "close",
|
|
784
|
+
type: "close",
|
|
785
|
+
label: "关闭",
|
|
786
|
+
className: "key-numpad-fn"
|
|
787
|
+
}
|
|
788
|
+
]
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
className: "numpad-row",
|
|
792
|
+
keys: [
|
|
793
|
+
{
|
|
794
|
+
id: "decimal",
|
|
795
|
+
type: "char",
|
|
796
|
+
label: ".",
|
|
797
|
+
value: ".",
|
|
798
|
+
className: "key-num"
|
|
799
|
+
},
|
|
800
|
+
A("0"),
|
|
801
|
+
{
|
|
802
|
+
id: "done",
|
|
803
|
+
type: "done",
|
|
804
|
+
label: "确定",
|
|
805
|
+
width: 2,
|
|
806
|
+
className: "key-numpad-done"
|
|
807
|
+
}
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
]
|
|
811
|
+
}, M = {
|
|
812
|
+
type: "integer",
|
|
813
|
+
name: "整数键盘",
|
|
814
|
+
supportShift: !1,
|
|
815
|
+
switchable: ["qwerty"],
|
|
816
|
+
rows: [
|
|
817
|
+
{
|
|
818
|
+
className: "numpad-row",
|
|
819
|
+
keys: [
|
|
820
|
+
A("1"),
|
|
821
|
+
A("2"),
|
|
822
|
+
A("3"),
|
|
823
|
+
{
|
|
824
|
+
id: "backspace",
|
|
825
|
+
type: "backspace",
|
|
826
|
+
icon: e,
|
|
827
|
+
label: "",
|
|
828
|
+
className: "key-numpad-fn"
|
|
829
|
+
}
|
|
830
|
+
]
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
className: "numpad-row",
|
|
834
|
+
keys: [
|
|
835
|
+
A("4"),
|
|
836
|
+
A("5"),
|
|
837
|
+
A("6"),
|
|
838
|
+
{
|
|
839
|
+
id: "clear",
|
|
840
|
+
type: "clear",
|
|
841
|
+
icon: t,
|
|
842
|
+
label: "",
|
|
843
|
+
className: "key-numpad-fn"
|
|
844
|
+
}
|
|
845
|
+
]
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
className: "numpad-row",
|
|
849
|
+
keys: [
|
|
850
|
+
A("7"),
|
|
851
|
+
A("8"),
|
|
852
|
+
A("9"),
|
|
853
|
+
{
|
|
854
|
+
id: "close",
|
|
855
|
+
type: "close",
|
|
856
|
+
label: "关闭",
|
|
857
|
+
className: "key-numpad-fn"
|
|
858
|
+
}
|
|
859
|
+
]
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
className: "numpad-row",
|
|
863
|
+
keys: [
|
|
864
|
+
{
|
|
865
|
+
id: "switch-qwerty",
|
|
866
|
+
type: "tab",
|
|
867
|
+
label: "ABC",
|
|
868
|
+
className: "key-numpad-fn",
|
|
869
|
+
data: { targetType: "qwerty" }
|
|
870
|
+
},
|
|
871
|
+
A("0"),
|
|
872
|
+
{
|
|
873
|
+
id: "done",
|
|
874
|
+
type: "done",
|
|
875
|
+
label: "确定",
|
|
876
|
+
width: 2,
|
|
877
|
+
className: "key-numpad-done"
|
|
878
|
+
}
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
]
|
|
882
|
+
};
|
|
883
|
+
function B(e) {
|
|
884
|
+
return {
|
|
885
|
+
id: `phone-${e}`,
|
|
886
|
+
type: "char",
|
|
887
|
+
label: e,
|
|
888
|
+
value: e,
|
|
889
|
+
className: "key-num"
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
const z = {
|
|
893
|
+
type: "phone",
|
|
894
|
+
name: "手机号键盘",
|
|
895
|
+
supportShift: !1,
|
|
896
|
+
rows: [
|
|
897
|
+
{
|
|
898
|
+
className: "numpad-row",
|
|
899
|
+
keys: [
|
|
900
|
+
B("1"),
|
|
901
|
+
B("2"),
|
|
902
|
+
B("3"),
|
|
903
|
+
{
|
|
904
|
+
id: "backspace",
|
|
905
|
+
type: "backspace",
|
|
906
|
+
icon: e,
|
|
907
|
+
label: "",
|
|
908
|
+
className: "key-numpad-fn"
|
|
909
|
+
}
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
className: "numpad-row",
|
|
914
|
+
keys: [
|
|
915
|
+
B("4"),
|
|
916
|
+
B("5"),
|
|
917
|
+
B("6"),
|
|
918
|
+
{
|
|
919
|
+
id: "clear",
|
|
920
|
+
type: "clear",
|
|
921
|
+
icon: t,
|
|
922
|
+
label: "",
|
|
923
|
+
className: "key-numpad-fn"
|
|
924
|
+
}
|
|
925
|
+
]
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
className: "numpad-row",
|
|
929
|
+
keys: [
|
|
930
|
+
B("7"),
|
|
931
|
+
B("8"),
|
|
932
|
+
B("9"),
|
|
933
|
+
{
|
|
934
|
+
id: "close",
|
|
935
|
+
type: "close",
|
|
936
|
+
label: "关闭",
|
|
937
|
+
className: "key-numpad-fn"
|
|
938
|
+
}
|
|
939
|
+
]
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
className: "numpad-row",
|
|
943
|
+
keys: [
|
|
944
|
+
{
|
|
945
|
+
id: "phone-plus",
|
|
946
|
+
type: "char",
|
|
947
|
+
label: "+",
|
|
948
|
+
value: "+",
|
|
949
|
+
className: "key-num"
|
|
950
|
+
},
|
|
951
|
+
B("0"),
|
|
952
|
+
{
|
|
953
|
+
id: "done",
|
|
954
|
+
type: "done",
|
|
955
|
+
label: "确定",
|
|
956
|
+
width: 2,
|
|
957
|
+
className: "key-numpad-done"
|
|
958
|
+
}
|
|
959
|
+
]
|
|
960
|
+
}
|
|
961
|
+
],
|
|
962
|
+
data: {
|
|
963
|
+
maxLength: 11,
|
|
964
|
+
inputType: "phone"
|
|
965
|
+
}
|
|
966
|
+
}, I = {
|
|
967
|
+
type: "phone-simple",
|
|
968
|
+
name: "拨号键盘",
|
|
969
|
+
supportShift: !1,
|
|
970
|
+
rows: [
|
|
971
|
+
{
|
|
972
|
+
className: "numpad-row",
|
|
973
|
+
keys: [
|
|
974
|
+
B("1"),
|
|
975
|
+
B("2"),
|
|
976
|
+
B("3"),
|
|
977
|
+
{
|
|
978
|
+
id: "backspace",
|
|
979
|
+
type: "backspace",
|
|
980
|
+
icon: e,
|
|
981
|
+
label: "",
|
|
982
|
+
className: "key-numpad-fn"
|
|
983
|
+
}
|
|
984
|
+
]
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
className: "numpad-row",
|
|
988
|
+
keys: [
|
|
989
|
+
B("4"),
|
|
990
|
+
B("5"),
|
|
991
|
+
B("6"),
|
|
992
|
+
{
|
|
993
|
+
id: "clear",
|
|
994
|
+
type: "clear",
|
|
995
|
+
icon: t,
|
|
996
|
+
label: "",
|
|
997
|
+
className: "key-numpad-fn"
|
|
998
|
+
}
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
className: "numpad-row",
|
|
1003
|
+
keys: [
|
|
1004
|
+
B("7"),
|
|
1005
|
+
B("8"),
|
|
1006
|
+
B("9"),
|
|
1007
|
+
{
|
|
1008
|
+
id: "phone-hash",
|
|
1009
|
+
type: "char",
|
|
1010
|
+
label: "#",
|
|
1011
|
+
value: "#",
|
|
1012
|
+
className: "key-num"
|
|
1013
|
+
}
|
|
1014
|
+
]
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
className: "numpad-row",
|
|
1018
|
+
keys: [
|
|
1019
|
+
{
|
|
1020
|
+
id: "phone-star",
|
|
1021
|
+
type: "char",
|
|
1022
|
+
label: "*",
|
|
1023
|
+
value: "*",
|
|
1024
|
+
className: "key-num"
|
|
1025
|
+
},
|
|
1026
|
+
B("0"),
|
|
1027
|
+
{
|
|
1028
|
+
id: "done",
|
|
1029
|
+
type: "done",
|
|
1030
|
+
label: "拨打",
|
|
1031
|
+
width: 2,
|
|
1032
|
+
className: "key-numpad-done"
|
|
1033
|
+
}
|
|
1034
|
+
]
|
|
1035
|
+
}
|
|
1036
|
+
],
|
|
1037
|
+
data: {
|
|
1038
|
+
maxLength: 13,
|
|
1039
|
+
inputType: "phone"
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
function $(e, t) {
|
|
1043
|
+
return {
|
|
1044
|
+
id: `punct-${e}`,
|
|
1045
|
+
type: "char",
|
|
1046
|
+
label: e,
|
|
1047
|
+
value: t ?? e,
|
|
1048
|
+
className: "key-num"
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
const D = {
|
|
1052
|
+
type: "punct",
|
|
1053
|
+
name: "中文标点",
|
|
1054
|
+
supportShift: !1,
|
|
1055
|
+
switchable: ["qwerty", "punct-en"],
|
|
1056
|
+
rows: [
|
|
1057
|
+
{
|
|
1058
|
+
className: "virtual-keyboard__row",
|
|
1059
|
+
keys: [
|
|
1060
|
+
",",
|
|
1061
|
+
"。",
|
|
1062
|
+
"?",
|
|
1063
|
+
"!",
|
|
1064
|
+
":",
|
|
1065
|
+
";",
|
|
1066
|
+
"\"",
|
|
1067
|
+
"\""
|
|
1068
|
+
].map((e) => $(e))
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
className: "virtual-keyboard__row",
|
|
1072
|
+
keys: [
|
|
1073
|
+
"(",
|
|
1074
|
+
")",
|
|
1075
|
+
"【",
|
|
1076
|
+
"】",
|
|
1077
|
+
"《",
|
|
1078
|
+
"》",
|
|
1079
|
+
"……",
|
|
1080
|
+
"——"
|
|
1081
|
+
].map((e) => $(e))
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
className: "virtual-keyboard__row",
|
|
1085
|
+
keys: [
|
|
1086
|
+
$("·"),
|
|
1087
|
+
$("、"),
|
|
1088
|
+
$("「"),
|
|
1089
|
+
$("」"),
|
|
1090
|
+
$("『"),
|
|
1091
|
+
$("』"),
|
|
1092
|
+
$("~"),
|
|
1093
|
+
{
|
|
1094
|
+
id: "backspace",
|
|
1095
|
+
type: "backspace",
|
|
1096
|
+
icon: e,
|
|
1097
|
+
label: "",
|
|
1098
|
+
className: "key-numpad-fn"
|
|
1099
|
+
}
|
|
1100
|
+
]
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
className: "virtual-keyboard__row",
|
|
1104
|
+
keys: [
|
|
1105
|
+
{
|
|
1106
|
+
id: "switch-punct-en",
|
|
1107
|
+
type: "tab",
|
|
1108
|
+
label: "英",
|
|
1109
|
+
data: { targetType: "punct-en" },
|
|
1110
|
+
className: "key-numpad-fn"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
id: "switch-qwerty",
|
|
1114
|
+
type: "tab",
|
|
1115
|
+
label: "ABC",
|
|
1116
|
+
data: { targetType: "qwerty" },
|
|
1117
|
+
className: "key-numpad-fn"
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
id: "space",
|
|
1121
|
+
type: "space",
|
|
1122
|
+
label: "空格",
|
|
1123
|
+
value: " ",
|
|
1124
|
+
width: 4,
|
|
1125
|
+
className: "key-num"
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
id: "done",
|
|
1129
|
+
type: "done",
|
|
1130
|
+
icon: s,
|
|
1131
|
+
label: "",
|
|
1132
|
+
width: 2,
|
|
1133
|
+
className: "key-numpad-done"
|
|
1134
|
+
}
|
|
1135
|
+
]
|
|
1136
|
+
}
|
|
1137
|
+
]
|
|
1138
|
+
};
|
|
1139
|
+
function O(e) {
|
|
1140
|
+
return {
|
|
1141
|
+
id: `char-${e.toLowerCase()}`,
|
|
1142
|
+
type: "char",
|
|
1143
|
+
label: {
|
|
1144
|
+
lower: e.toLowerCase(),
|
|
1145
|
+
upper: e.toUpperCase()
|
|
1146
|
+
},
|
|
1147
|
+
value: {
|
|
1148
|
+
lower: e.toLowerCase(),
|
|
1149
|
+
upper: e.toUpperCase()
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
const R = {
|
|
1154
|
+
type: "qwerty",
|
|
1155
|
+
name: "字母键盘",
|
|
1156
|
+
supportShift: !0,
|
|
1157
|
+
defaultUpperCase: !1,
|
|
1158
|
+
switchable: ["number", "symbol"],
|
|
1159
|
+
rows: [
|
|
1160
|
+
{ keys: [
|
|
1161
|
+
O("Q"),
|
|
1162
|
+
O("W"),
|
|
1163
|
+
O("E"),
|
|
1164
|
+
O("R"),
|
|
1165
|
+
O("T"),
|
|
1166
|
+
O("Y"),
|
|
1167
|
+
O("U"),
|
|
1168
|
+
O("I"),
|
|
1169
|
+
O("O"),
|
|
1170
|
+
O("P")
|
|
1171
|
+
] },
|
|
1172
|
+
{ keys: [
|
|
1173
|
+
O("A"),
|
|
1174
|
+
O("S"),
|
|
1175
|
+
O("D"),
|
|
1176
|
+
O("F"),
|
|
1177
|
+
O("G"),
|
|
1178
|
+
O("H"),
|
|
1179
|
+
O("J"),
|
|
1180
|
+
O("K"),
|
|
1181
|
+
O("L")
|
|
1182
|
+
] },
|
|
1183
|
+
{ keys: [
|
|
1184
|
+
{
|
|
1185
|
+
id: "shift",
|
|
1186
|
+
type: "shift",
|
|
1187
|
+
label: "⇧",
|
|
1188
|
+
width: 1.5,
|
|
1189
|
+
className: "key-shift"
|
|
1190
|
+
},
|
|
1191
|
+
O("Z"),
|
|
1192
|
+
O("X"),
|
|
1193
|
+
O("C"),
|
|
1194
|
+
O("V"),
|
|
1195
|
+
O("B"),
|
|
1196
|
+
O("N"),
|
|
1197
|
+
O("M"),
|
|
1198
|
+
{
|
|
1199
|
+
id: "backspace",
|
|
1200
|
+
type: "backspace",
|
|
1201
|
+
label: "⌫",
|
|
1202
|
+
width: 1.5,
|
|
1203
|
+
className: "key-backspace"
|
|
1204
|
+
}
|
|
1205
|
+
] },
|
|
1206
|
+
{ keys: [
|
|
1207
|
+
{
|
|
1208
|
+
id: "switch-number",
|
|
1209
|
+
type: "tab",
|
|
1210
|
+
label: "123",
|
|
1211
|
+
width: 1.5,
|
|
1212
|
+
className: "key-switch",
|
|
1213
|
+
data: { targetType: "number" }
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
id: "switch-symbol",
|
|
1217
|
+
type: "tab",
|
|
1218
|
+
label: "#+=",
|
|
1219
|
+
width: 1.25,
|
|
1220
|
+
className: "key-switch",
|
|
1221
|
+
data: { targetType: "symbol" }
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
id: "space",
|
|
1225
|
+
type: "space",
|
|
1226
|
+
label: "空格",
|
|
1227
|
+
value: " ",
|
|
1228
|
+
width: 4,
|
|
1229
|
+
className: "key-space"
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
id: "done",
|
|
1233
|
+
type: "done",
|
|
1234
|
+
label: "完成",
|
|
1235
|
+
width: 2,
|
|
1236
|
+
className: "key-done"
|
|
1237
|
+
}
|
|
1238
|
+
] }
|
|
1239
|
+
]
|
|
1240
|
+
};
|
|
1241
|
+
function K(e) {
|
|
1242
|
+
return {
|
|
1243
|
+
id: `search-char-${e.toLowerCase()}`,
|
|
1244
|
+
type: "char",
|
|
1245
|
+
label: {
|
|
1246
|
+
lower: e.toLowerCase(),
|
|
1247
|
+
upper: e.toUpperCase()
|
|
1248
|
+
},
|
|
1249
|
+
value: {
|
|
1250
|
+
lower: e.toLowerCase(),
|
|
1251
|
+
upper: e.toUpperCase()
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
const j = {
|
|
1256
|
+
type: "search",
|
|
1257
|
+
name: "搜索键盘",
|
|
1258
|
+
supportShift: !0,
|
|
1259
|
+
defaultUpperCase: !1,
|
|
1260
|
+
switchable: ["symbol", "number"],
|
|
1261
|
+
rows: [
|
|
1262
|
+
{ keys: "qwertyuiop".split("").map(K) },
|
|
1263
|
+
{ keys: "asdfghjkl".split("").map(K) },
|
|
1264
|
+
{ keys: [
|
|
1265
|
+
{
|
|
1266
|
+
id: "shift",
|
|
1267
|
+
type: "shift",
|
|
1268
|
+
icon: i,
|
|
1269
|
+
label: "",
|
|
1270
|
+
width: 1.5,
|
|
1271
|
+
className: "key-shift"
|
|
1272
|
+
},
|
|
1273
|
+
..."zxcvbnm".split("").map(K),
|
|
1274
|
+
{
|
|
1275
|
+
id: "backspace",
|
|
1276
|
+
type: "backspace",
|
|
1277
|
+
icon: e,
|
|
1278
|
+
label: "",
|
|
1279
|
+
width: 1.5,
|
|
1280
|
+
className: "key-backspace"
|
|
1281
|
+
}
|
|
1282
|
+
] },
|
|
1283
|
+
{ keys: [
|
|
1284
|
+
{
|
|
1285
|
+
id: "switch-number",
|
|
1286
|
+
type: "tab",
|
|
1287
|
+
label: "123",
|
|
1288
|
+
width: 1.25,
|
|
1289
|
+
className: "key-switch",
|
|
1290
|
+
data: { targetType: "number" }
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
id: "switch-symbol",
|
|
1294
|
+
type: "tab",
|
|
1295
|
+
label: "#+=",
|
|
1296
|
+
width: 1.25,
|
|
1297
|
+
className: "key-switch",
|
|
1298
|
+
data: { targetType: "symbol" }
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
id: "space",
|
|
1302
|
+
type: "space",
|
|
1303
|
+
label: "",
|
|
1304
|
+
value: " ",
|
|
1305
|
+
width: 4,
|
|
1306
|
+
className: "key-space"
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
id: "voice",
|
|
1310
|
+
type: "custom",
|
|
1311
|
+
icon: l,
|
|
1312
|
+
label: "",
|
|
1313
|
+
width: 1,
|
|
1314
|
+
className: "key-voice",
|
|
1315
|
+
data: { action: "voice" }
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
id: "search-done",
|
|
1319
|
+
type: "done",
|
|
1320
|
+
label: "搜索",
|
|
1321
|
+
width: 2,
|
|
1322
|
+
className: "key-done"
|
|
1323
|
+
}
|
|
1324
|
+
] }
|
|
1325
|
+
]
|
|
1326
|
+
};
|
|
1327
|
+
function U(e, t) {
|
|
1328
|
+
return {
|
|
1329
|
+
id: t || `symbol-${e.charCodeAt(0)}`,
|
|
1330
|
+
type: "char",
|
|
1331
|
+
label: e,
|
|
1332
|
+
value: e
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
const F = {
|
|
1336
|
+
type: "symbol",
|
|
1337
|
+
name: "符号键盘",
|
|
1338
|
+
supportShift: !1,
|
|
1339
|
+
switchable: ["qwerty", "number"],
|
|
1340
|
+
rows: [
|
|
1341
|
+
{ keys: [
|
|
1342
|
+
U("1"),
|
|
1343
|
+
U("2"),
|
|
1344
|
+
U("3"),
|
|
1345
|
+
U("4"),
|
|
1346
|
+
U("5"),
|
|
1347
|
+
U("6"),
|
|
1348
|
+
U("7"),
|
|
1349
|
+
U("8"),
|
|
1350
|
+
U("9"),
|
|
1351
|
+
U("0")
|
|
1352
|
+
] },
|
|
1353
|
+
{ keys: [
|
|
1354
|
+
U("-"),
|
|
1355
|
+
U("/"),
|
|
1356
|
+
U(":"),
|
|
1357
|
+
U(";"),
|
|
1358
|
+
U("("),
|
|
1359
|
+
U(")"),
|
|
1360
|
+
U("¥", "yen"),
|
|
1361
|
+
U("@"),
|
|
1362
|
+
U("\"", "quote")
|
|
1363
|
+
] },
|
|
1364
|
+
{ keys: [
|
|
1365
|
+
{
|
|
1366
|
+
id: "switch-symbol-2",
|
|
1367
|
+
type: "tab",
|
|
1368
|
+
label: "#+= ",
|
|
1369
|
+
width: 1.5,
|
|
1370
|
+
className: "key-switch",
|
|
1371
|
+
data: { targetType: "symbol-2" }
|
|
1372
|
+
},
|
|
1373
|
+
U("."),
|
|
1374
|
+
U(","),
|
|
1375
|
+
U("?"),
|
|
1376
|
+
U("!"),
|
|
1377
|
+
U("'", "apostrophe"),
|
|
1378
|
+
{
|
|
1379
|
+
id: "backspace",
|
|
1380
|
+
type: "backspace",
|
|
1381
|
+
label: "⌫",
|
|
1382
|
+
width: 1.5,
|
|
1383
|
+
className: "key-backspace"
|
|
1384
|
+
}
|
|
1385
|
+
] },
|
|
1386
|
+
{ keys: [
|
|
1387
|
+
{
|
|
1388
|
+
id: "switch-qwerty",
|
|
1389
|
+
type: "tab",
|
|
1390
|
+
label: "ABC",
|
|
1391
|
+
width: 1.5,
|
|
1392
|
+
className: "key-switch",
|
|
1393
|
+
data: { targetType: "qwerty" }
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
id: "switch-number",
|
|
1397
|
+
type: "tab",
|
|
1398
|
+
label: "123",
|
|
1399
|
+
width: 1.25,
|
|
1400
|
+
className: "key-switch",
|
|
1401
|
+
data: { targetType: "number" }
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
id: "space",
|
|
1405
|
+
type: "space",
|
|
1406
|
+
label: "空格",
|
|
1407
|
+
value: " ",
|
|
1408
|
+
width: 4,
|
|
1409
|
+
className: "key-space"
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
id: "done",
|
|
1413
|
+
type: "done",
|
|
1414
|
+
label: "完成",
|
|
1415
|
+
width: 2,
|
|
1416
|
+
className: "key-done"
|
|
1417
|
+
}
|
|
1418
|
+
] }
|
|
1419
|
+
]
|
|
1420
|
+
}, q = {
|
|
1421
|
+
type: "symbol",
|
|
1422
|
+
name: "符号键盘2",
|
|
1423
|
+
supportShift: !1,
|
|
1424
|
+
switchable: ["qwerty", "number"],
|
|
1425
|
+
rows: [
|
|
1426
|
+
{ keys: [
|
|
1427
|
+
U("["),
|
|
1428
|
+
U("]"),
|
|
1429
|
+
U("{"),
|
|
1430
|
+
U("}"),
|
|
1431
|
+
U("#"),
|
|
1432
|
+
U("%"),
|
|
1433
|
+
U("^"),
|
|
1434
|
+
U("*"),
|
|
1435
|
+
U("+"),
|
|
1436
|
+
U("=")
|
|
1437
|
+
] },
|
|
1438
|
+
{ keys: [
|
|
1439
|
+
U("_"),
|
|
1440
|
+
U("\\"),
|
|
1441
|
+
U("|"),
|
|
1442
|
+
U("~"),
|
|
1443
|
+
U("<"),
|
|
1444
|
+
U(">"),
|
|
1445
|
+
U("€", "euro"),
|
|
1446
|
+
U("$"),
|
|
1447
|
+
U("&")
|
|
1448
|
+
] },
|
|
1449
|
+
{ keys: [
|
|
1450
|
+
{
|
|
1451
|
+
id: "switch-symbol-1",
|
|
1452
|
+
type: "tab",
|
|
1453
|
+
label: "123",
|
|
1454
|
+
width: 1.5,
|
|
1455
|
+
className: "key-switch",
|
|
1456
|
+
data: { targetType: "symbol" }
|
|
1457
|
+
},
|
|
1458
|
+
U("`", "backtick"),
|
|
1459
|
+
U("·", "middle-dot"),
|
|
1460
|
+
U("…", "ellipsis"),
|
|
1461
|
+
U("°", "degree"),
|
|
1462
|
+
U("•", "bullet"),
|
|
1463
|
+
{
|
|
1464
|
+
id: "backspace",
|
|
1465
|
+
type: "backspace",
|
|
1466
|
+
label: "⌫",
|
|
1467
|
+
width: 1.5,
|
|
1468
|
+
className: "key-backspace"
|
|
1469
|
+
}
|
|
1470
|
+
] },
|
|
1471
|
+
{ keys: [
|
|
1472
|
+
{
|
|
1473
|
+
id: "switch-qwerty",
|
|
1474
|
+
type: "tab",
|
|
1475
|
+
label: "ABC",
|
|
1476
|
+
width: 1.5,
|
|
1477
|
+
className: "key-switch",
|
|
1478
|
+
data: { targetType: "qwerty" }
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
id: "switch-number",
|
|
1482
|
+
type: "tab",
|
|
1483
|
+
label: "123",
|
|
1484
|
+
width: 1.25,
|
|
1485
|
+
className: "key-switch",
|
|
1486
|
+
data: { targetType: "number" }
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
id: "space",
|
|
1490
|
+
type: "space",
|
|
1491
|
+
label: "空格",
|
|
1492
|
+
value: " ",
|
|
1493
|
+
width: 4,
|
|
1494
|
+
className: "key-space"
|
|
1495
|
+
},
|
|
1496
|
+
{
|
|
1497
|
+
id: "done",
|
|
1498
|
+
type: "done",
|
|
1499
|
+
label: "完成",
|
|
1500
|
+
width: 2,
|
|
1501
|
+
className: "key-done"
|
|
1502
|
+
}
|
|
1503
|
+
] }
|
|
1504
|
+
]
|
|
1505
|
+
};
|
|
1506
|
+
function V(e) {
|
|
1507
|
+
return {
|
|
1508
|
+
id: `url-char-${e.toLowerCase()}`,
|
|
1509
|
+
type: "char",
|
|
1510
|
+
label: {
|
|
1511
|
+
lower: e.toLowerCase(),
|
|
1512
|
+
upper: e.toUpperCase()
|
|
1513
|
+
},
|
|
1514
|
+
value: {
|
|
1515
|
+
lower: e.toLowerCase(),
|
|
1516
|
+
upper: e.toUpperCase()
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
function H(e, t) {
|
|
1521
|
+
return {
|
|
1522
|
+
id: `url-snippet-${e.replace(/[^a-z0-9]/gi, "") || e.split("").map((e) => e.charCodeAt(0)).join("")}`,
|
|
1523
|
+
type: "char",
|
|
1524
|
+
label: e,
|
|
1525
|
+
value: e,
|
|
1526
|
+
width: t,
|
|
1527
|
+
className: "key-snippet"
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
const _ = {
|
|
1531
|
+
type: "url",
|
|
1532
|
+
name: "网址键盘",
|
|
1533
|
+
supportShift: !0,
|
|
1534
|
+
defaultUpperCase: !1,
|
|
1535
|
+
switchable: ["symbol", "number"],
|
|
1536
|
+
rows: [
|
|
1537
|
+
{ keys: "qwertyuiop".split("").map(V) },
|
|
1538
|
+
{ keys: "asdfghjkl".split("").map(V) },
|
|
1539
|
+
{ keys: [
|
|
1540
|
+
{
|
|
1541
|
+
id: "shift",
|
|
1542
|
+
type: "shift",
|
|
1543
|
+
icon: i,
|
|
1544
|
+
label: "",
|
|
1545
|
+
width: 1.5,
|
|
1546
|
+
className: "key-shift"
|
|
1547
|
+
},
|
|
1548
|
+
..."zxcvbnm".split("").map(V),
|
|
1549
|
+
{
|
|
1550
|
+
id: "backspace",
|
|
1551
|
+
type: "backspace",
|
|
1552
|
+
icon: e,
|
|
1553
|
+
label: "",
|
|
1554
|
+
width: 1.5,
|
|
1555
|
+
className: "key-backspace"
|
|
1556
|
+
}
|
|
1557
|
+
] },
|
|
1558
|
+
{ keys: [
|
|
1559
|
+
{
|
|
1560
|
+
id: "switch-number",
|
|
1561
|
+
type: "tab",
|
|
1562
|
+
label: "123",
|
|
1563
|
+
width: 1.2,
|
|
1564
|
+
className: "key-switch",
|
|
1565
|
+
data: { targetType: "number" }
|
|
1566
|
+
},
|
|
1567
|
+
H("/", .8),
|
|
1568
|
+
H(".", .8),
|
|
1569
|
+
H("-", .8),
|
|
1570
|
+
H(".com", 1.5),
|
|
1571
|
+
H(".cn", 1.2),
|
|
1572
|
+
{
|
|
1573
|
+
id: "space",
|
|
1574
|
+
type: "space",
|
|
1575
|
+
label: "",
|
|
1576
|
+
value: " ",
|
|
1577
|
+
width: 1.5,
|
|
1578
|
+
className: "key-space"
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
id: "url-go",
|
|
1582
|
+
type: "done",
|
|
1583
|
+
label: "前往",
|
|
1584
|
+
width: 1.5,
|
|
1585
|
+
className: "key-done"
|
|
1586
|
+
}
|
|
1587
|
+
] }
|
|
1588
|
+
]
|
|
1589
|
+
};
|
|
1590
|
+
function W(e) {
|
|
1591
|
+
return {
|
|
1592
|
+
id: `verify-${e}`,
|
|
1593
|
+
type: "char",
|
|
1594
|
+
label: e,
|
|
1595
|
+
value: e,
|
|
1596
|
+
className: "key-num"
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
const Y = {
|
|
1600
|
+
type: "verifycode",
|
|
1601
|
+
name: "验证码键盘",
|
|
1602
|
+
supportShift: !1,
|
|
1603
|
+
rows: [
|
|
1604
|
+
{
|
|
1605
|
+
className: "numpad-row",
|
|
1606
|
+
keys: [
|
|
1607
|
+
W("1"),
|
|
1608
|
+
W("2"),
|
|
1609
|
+
W("3"),
|
|
1610
|
+
{
|
|
1611
|
+
id: "backspace",
|
|
1612
|
+
type: "backspace",
|
|
1613
|
+
icon: e,
|
|
1614
|
+
label: "",
|
|
1615
|
+
className: "key-numpad-fn"
|
|
1616
|
+
}
|
|
1617
|
+
]
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
className: "numpad-row",
|
|
1621
|
+
keys: [
|
|
1622
|
+
W("4"),
|
|
1623
|
+
W("5"),
|
|
1624
|
+
W("6"),
|
|
1625
|
+
{
|
|
1626
|
+
id: "clear",
|
|
1627
|
+
type: "clear",
|
|
1628
|
+
icon: t,
|
|
1629
|
+
label: "",
|
|
1630
|
+
className: "key-numpad-fn"
|
|
1631
|
+
}
|
|
1632
|
+
]
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
className: "numpad-row",
|
|
1636
|
+
keys: [
|
|
1637
|
+
W("7"),
|
|
1638
|
+
W("8"),
|
|
1639
|
+
W("9"),
|
|
1640
|
+
{
|
|
1641
|
+
id: "close",
|
|
1642
|
+
type: "close",
|
|
1643
|
+
label: "关闭",
|
|
1644
|
+
className: "key-numpad-fn"
|
|
1645
|
+
}
|
|
1646
|
+
]
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
className: "numpad-row",
|
|
1650
|
+
keys: [
|
|
1651
|
+
{
|
|
1652
|
+
id: "empty",
|
|
1653
|
+
type: "char",
|
|
1654
|
+
label: "",
|
|
1655
|
+
value: "",
|
|
1656
|
+
disabled: !0,
|
|
1657
|
+
className: "key-numpad-empty"
|
|
1658
|
+
},
|
|
1659
|
+
W("0"),
|
|
1660
|
+
{
|
|
1661
|
+
id: "done",
|
|
1662
|
+
type: "done",
|
|
1663
|
+
label: "确定",
|
|
1664
|
+
width: 2,
|
|
1665
|
+
className: "key-numpad-done"
|
|
1666
|
+
}
|
|
1667
|
+
]
|
|
1668
|
+
}
|
|
1669
|
+
],
|
|
1670
|
+
data: {
|
|
1671
|
+
maxLength: 6,
|
|
1672
|
+
inputType: "verifycode"
|
|
1673
|
+
}
|
|
1674
|
+
}, X = {
|
|
1675
|
+
qwerty: R,
|
|
1676
|
+
number: P,
|
|
1677
|
+
integer: M,
|
|
1678
|
+
symbol: F,
|
|
1679
|
+
"symbol-2": q,
|
|
1680
|
+
"license-plate": T,
|
|
1681
|
+
"license-plate-province": x,
|
|
1682
|
+
"license-plate-letter": L,
|
|
1683
|
+
"license-plate-alphanumeric": S,
|
|
1684
|
+
idcard: w,
|
|
1685
|
+
phone: z,
|
|
1686
|
+
"phone-simple": I,
|
|
1687
|
+
amount: p,
|
|
1688
|
+
"amount-simple": u,
|
|
1689
|
+
bankcard: y,
|
|
1690
|
+
verifycode: Y,
|
|
1691
|
+
email: b,
|
|
1692
|
+
url: _,
|
|
1693
|
+
search: j,
|
|
1694
|
+
punct: D
|
|
1695
|
+
}, G = {};
|
|
1696
|
+
function Z(e, t) {
|
|
1697
|
+
X[e] ? console.warn(`[Keyboard] Cannot override builtin layout "${e}"`) : G[e] = t;
|
|
1698
|
+
}
|
|
1699
|
+
function J(e) {
|
|
1700
|
+
return G[e] || X[e];
|
|
1701
|
+
}
|
|
1702
|
+
const Q = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
|
|
1703
|
+
let ee = null;
|
|
1704
|
+
function te() {
|
|
1705
|
+
return null !== ee ? ee : "undefined" != typeof window && (ee = "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0, ee);
|
|
1706
|
+
}
|
|
1707
|
+
function ae() {
|
|
1708
|
+
return "undefined" != typeof navigator && Q.test(navigator.userAgent);
|
|
1709
|
+
}
|
|
1710
|
+
function se() {
|
|
1711
|
+
return "undefined" != typeof window && (!!ae() || (window.innerWidth || document.documentElement.clientWidth) <= 768 || te());
|
|
1712
|
+
}
|
|
1713
|
+
function ne() {
|
|
1714
|
+
if ("undefined" == typeof window) return {
|
|
1715
|
+
width: 0,
|
|
1716
|
+
height: 0,
|
|
1717
|
+
scrollX: 0,
|
|
1718
|
+
scrollY: 0,
|
|
1719
|
+
isMobile: !1
|
|
1720
|
+
};
|
|
1721
|
+
const e = window.innerWidth || document.documentElement.clientWidth, t = window.innerHeight || document.documentElement.clientHeight, a = ie();
|
|
1722
|
+
return {
|
|
1723
|
+
width: e,
|
|
1724
|
+
height: t,
|
|
1725
|
+
scrollX: window.scrollX || window.pageXOffset,
|
|
1726
|
+
scrollY: window.scrollY || window.pageYOffset,
|
|
1727
|
+
isMobile: se(),
|
|
1728
|
+
safeArea: a
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
function ie() {
|
|
1732
|
+
if ("undefined" == typeof window || "undefined" == typeof CSS || !CSS.supports) return {
|
|
1733
|
+
top: 0,
|
|
1734
|
+
right: 0,
|
|
1735
|
+
bottom: 0,
|
|
1736
|
+
left: 0
|
|
1737
|
+
};
|
|
1738
|
+
if (!CSS.supports("padding-top", "env(safe-area-inset-top)")) return {
|
|
1739
|
+
top: 0,
|
|
1740
|
+
right: 0,
|
|
1741
|
+
bottom: 0,
|
|
1742
|
+
left: 0
|
|
1743
|
+
};
|
|
1744
|
+
const e = document.createElement("div");
|
|
1745
|
+
e.style.cssText = "\n position: fixed;\n top: env(safe-area-inset-top);\n right: env(safe-area-inset-right);\n bottom: env(safe-area-inset-bottom);\n left: env(safe-area-inset-left);\n pointer-events: none;\n visibility: hidden;\n ";
|
|
1746
|
+
const t = document.body;
|
|
1747
|
+
if (!t) return {
|
|
1748
|
+
top: 0,
|
|
1749
|
+
right: 0,
|
|
1750
|
+
bottom: 0,
|
|
1751
|
+
left: 0
|
|
1752
|
+
};
|
|
1753
|
+
t.appendChild(e);
|
|
1754
|
+
const a = getComputedStyle(e), s = {
|
|
1755
|
+
top: Number.parseFloat(a.top) || 0,
|
|
1756
|
+
right: Number.parseFloat(a.right) || 0,
|
|
1757
|
+
bottom: Number.parseFloat(a.bottom) || 0,
|
|
1758
|
+
left: Number.parseFloat(a.left) || 0
|
|
1759
|
+
};
|
|
1760
|
+
return t.removeChild(e), s;
|
|
1761
|
+
}
|
|
1762
|
+
function oe() {
|
|
1763
|
+
return "undefined" != typeof navigator && "vibrate" in navigator;
|
|
1764
|
+
}
|
|
1765
|
+
function re(e = 10) {
|
|
1766
|
+
return !!oe() && navigator.vibrate(e);
|
|
1767
|
+
}
|
|
1768
|
+
function le(e) {
|
|
1769
|
+
const t = e.getBoundingClientRect();
|
|
1770
|
+
return {
|
|
1771
|
+
x: t.left,
|
|
1772
|
+
y: t.top,
|
|
1773
|
+
width: t.width,
|
|
1774
|
+
height: t.height
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
function ce(e, t) {
|
|
1778
|
+
const a = e.target;
|
|
1779
|
+
return !t.contains(a);
|
|
1780
|
+
}
|
|
1781
|
+
function de(e, t) {
|
|
1782
|
+
const a = (a) => {
|
|
1783
|
+
ce(a, e) && t(a);
|
|
1784
|
+
};
|
|
1785
|
+
return document.addEventListener("mousedown", a), document.addEventListener("touchstart", a), () => {
|
|
1786
|
+
document.removeEventListener("mousedown", a), document.removeEventListener("touchstart", a);
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
function pe(e) {
|
|
1790
|
+
return e.selectionStart ?? e.value.length;
|
|
1791
|
+
}
|
|
1792
|
+
function ue(e, t) {
|
|
1793
|
+
e.setSelectionRange(t, t);
|
|
1794
|
+
}
|
|
1795
|
+
function he(e, t, a) {
|
|
1796
|
+
const s = e.selectionStart ?? e.value.length, n = e.selectionEnd ?? e.value.length, i = e.value, o = void 0 !== a && Number.isFinite(a) ? Math.max(0, Math.floor(a)) : void 0;
|
|
1797
|
+
let r = t, l = i.substring(0, s) + r + i.substring(n);
|
|
1798
|
+
if (void 0 !== o && l.length > o) {
|
|
1799
|
+
const e = o - (i.length - (n - s));
|
|
1800
|
+
if (e <= 0) return {
|
|
1801
|
+
value: i,
|
|
1802
|
+
cursorPosition: s
|
|
1803
|
+
};
|
|
1804
|
+
r = t.substring(0, e), l = i.substring(0, s) + r + i.substring(n);
|
|
1805
|
+
}
|
|
1806
|
+
const c = s + r.length;
|
|
1807
|
+
return {
|
|
1808
|
+
value: l,
|
|
1809
|
+
cursorPosition: Math.min(c, l.length)
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
function ye(e) {
|
|
1813
|
+
const t = e.selectionStart ?? e.value.length, a = e.selectionEnd ?? e.value.length, s = e.value;
|
|
1814
|
+
if (t !== a) {
|
|
1815
|
+
const e = s.substring(t, a);
|
|
1816
|
+
return {
|
|
1817
|
+
value: s.substring(0, t) + s.substring(a),
|
|
1818
|
+
deletedChar: e,
|
|
1819
|
+
cursorPosition: t
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
if (0 === t) return {
|
|
1823
|
+
value: s,
|
|
1824
|
+
deletedChar: "",
|
|
1825
|
+
cursorPosition: 0
|
|
1826
|
+
};
|
|
1827
|
+
const n = s.charAt(t - 1);
|
|
1828
|
+
return {
|
|
1829
|
+
value: s.substring(0, t - 1) + s.substring(t),
|
|
1830
|
+
deletedChar: n,
|
|
1831
|
+
cursorPosition: t - 1
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
function me(e) {
|
|
1835
|
+
if ("undefined" == typeof DOMParser || "undefined" == typeof XMLSerializer) return "";
|
|
1836
|
+
const t = new DOMParser().parseFromString(e, "image/svg+xml"), a = t.documentElement;
|
|
1837
|
+
return "svg" !== a.tagName.toLowerCase() || t.querySelector("parsererror") ? "" : (a.querySelectorAll("script, style, foreignObject").forEach((e) => e.remove()), a.querySelectorAll("*").forEach((e) => {
|
|
1838
|
+
Array.from(e.attributes).forEach((t) => {
|
|
1839
|
+
const a = t.name.toLowerCase(), s = t.value.trim();
|
|
1840
|
+
!a.startsWith("on") && ("href" !== a && "xlink:href" !== a || s.startsWith("#")) || e.removeAttribute(t.name);
|
|
1841
|
+
});
|
|
1842
|
+
}), new XMLSerializer().serializeToString(a));
|
|
1843
|
+
}
|
|
1844
|
+
var ke = class {
|
|
1845
|
+
constructor() {
|
|
1846
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
1847
|
+
}
|
|
1848
|
+
on(e, t, a = {}) {
|
|
1849
|
+
this.handlers.has(e) || this.handlers.set(e, /* @__PURE__ */ new Set());
|
|
1850
|
+
const s = this.handlers.get(e);
|
|
1851
|
+
if (!s) return () => {};
|
|
1852
|
+
const n = {
|
|
1853
|
+
handler: t,
|
|
1854
|
+
options: a
|
|
1855
|
+
};
|
|
1856
|
+
return s.add(n), () => {
|
|
1857
|
+
s.delete(n), 0 === s.size && this.handlers.delete(e);
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
once(e, t, a = {}) {
|
|
1861
|
+
return this.on(e, t, {
|
|
1862
|
+
...a,
|
|
1863
|
+
once: !0
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
off(e, t) {
|
|
1867
|
+
if (!t) return void this.handlers.delete(e);
|
|
1868
|
+
const a = this.handlers.get(e);
|
|
1869
|
+
a && (a.forEach((e) => {
|
|
1870
|
+
e.handler === t && a.delete(e);
|
|
1871
|
+
}), 0 === a.size && this.handlers.delete(e));
|
|
1872
|
+
}
|
|
1873
|
+
emit(e, t) {
|
|
1874
|
+
const a = this.handlers.get(e);
|
|
1875
|
+
if (!a || 0 === a.size) return;
|
|
1876
|
+
const s = Array.from(a).sort((e, t) => {
|
|
1877
|
+
const a = e.options.priority ?? 0;
|
|
1878
|
+
return (t.options.priority ?? 0) - a;
|
|
1879
|
+
}), n = [];
|
|
1880
|
+
s.forEach((a) => {
|
|
1881
|
+
try {
|
|
1882
|
+
a.handler(t), a.options.once && n.push(a);
|
|
1883
|
+
} catch (t) {
|
|
1884
|
+
console.error(`[KeyboardEventEmitter] Error in event handler for "${String(e)}":`, t);
|
|
1885
|
+
}
|
|
1886
|
+
}), n.forEach((e) => a.delete(e)), 0 === a.size && this.handlers.delete(e);
|
|
1887
|
+
}
|
|
1888
|
+
clear() {
|
|
1889
|
+
this.handlers.clear();
|
|
1890
|
+
}
|
|
1891
|
+
listenerCount(e) {
|
|
1892
|
+
if (void 0 !== e) return this.handlers.get(e)?.size ?? 0;
|
|
1893
|
+
let t = 0;
|
|
1894
|
+
return this.handlers.forEach((e) => {
|
|
1895
|
+
t += e.size;
|
|
1896
|
+
}), t;
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
const fe = {
|
|
1900
|
+
type: "qwerty",
|
|
1901
|
+
value: "",
|
|
1902
|
+
maxLength: void 0,
|
|
1903
|
+
defaultUpperCase: !1,
|
|
1904
|
+
closeOnClickOutside: !0,
|
|
1905
|
+
enableSound: !1,
|
|
1906
|
+
enableVibrate: !0,
|
|
1907
|
+
customLayouts: {}
|
|
1908
|
+
};
|
|
1909
|
+
function be(e) {
|
|
1910
|
+
if (void 0 !== e && Number.isFinite(e)) return Math.max(0, Math.floor(e));
|
|
1911
|
+
}
|
|
1912
|
+
function ge(e, t) {
|
|
1913
|
+
return void 0 === t ? e : e.slice(0, t);
|
|
1914
|
+
}
|
|
1915
|
+
var we = class extends ke {
|
|
1916
|
+
constructor(e = {}) {
|
|
1917
|
+
super(), this.currentLayout = null, this.destroyed = !1;
|
|
1918
|
+
const t = be(e.maxLength);
|
|
1919
|
+
this.options = {
|
|
1920
|
+
...fe,
|
|
1921
|
+
...e,
|
|
1922
|
+
maxLength: t,
|
|
1923
|
+
customLayouts: {
|
|
1924
|
+
...fe.customLayouts,
|
|
1925
|
+
...e.customLayouts ?? {}
|
|
1926
|
+
}
|
|
1927
|
+
}, e.customLayouts && Object.entries(e.customLayouts).forEach(([e, t]) => {
|
|
1928
|
+
this.options.customLayouts[e] = t;
|
|
1929
|
+
}), this.state = {
|
|
1930
|
+
visible: !1,
|
|
1931
|
+
type: this.options.type,
|
|
1932
|
+
isUpperCase: this.options.defaultUpperCase,
|
|
1933
|
+
value: ge(this.options.value, this.options.maxLength),
|
|
1934
|
+
cursorPosition: ge(this.options.value, this.options.maxLength).length,
|
|
1935
|
+
maxLength: this.options.maxLength,
|
|
1936
|
+
inputElement: null
|
|
1937
|
+
}, this.loadLayout(this.options.type);
|
|
1938
|
+
}
|
|
1939
|
+
getState() {
|
|
1940
|
+
return { ...this.state };
|
|
1941
|
+
}
|
|
1942
|
+
getLayout() {
|
|
1943
|
+
return this.currentLayout;
|
|
1944
|
+
}
|
|
1945
|
+
getOptions() {
|
|
1946
|
+
return {
|
|
1947
|
+
...this.options,
|
|
1948
|
+
customLayouts: { ...this.options.customLayouts }
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
loadLayout(e) {
|
|
1952
|
+
let t = this.options.customLayouts[e];
|
|
1953
|
+
return t || (t = J(e)), t ? (this.currentLayout = t, t.supportShift && (this.state.isUpperCase = t.defaultUpperCase ?? this.options.defaultUpperCase), !0) : (console.error(`[KeyboardManager] Layout "${e}" not found`), !1);
|
|
1954
|
+
}
|
|
1955
|
+
show(e) {
|
|
1956
|
+
this.destroyed || (this.state.visible ? e && this.state.inputElement !== e && this.bindInput(e) : (this.state.visible = !0, this.state.inputElement = e ?? null, e && (this.state.value = e.value, this.state.cursorPosition = pe(e)), this.emitStateChange(), this.emit("show", { type: this.state.type })));
|
|
1957
|
+
}
|
|
1958
|
+
hide() {
|
|
1959
|
+
if (this.destroyed) return;
|
|
1960
|
+
if (!this.state.visible) return;
|
|
1961
|
+
const e = this.state.type;
|
|
1962
|
+
this.state.visible = !1, this.state.inputElement = null, this.emitStateChange(), this.emit("hide", { type: e });
|
|
1963
|
+
}
|
|
1964
|
+
toggle(e) {
|
|
1965
|
+
this.destroyed || (this.state.visible ? this.hide() : this.show(e));
|
|
1966
|
+
}
|
|
1967
|
+
switchType(e) {
|
|
1968
|
+
if (this.destroyed) return;
|
|
1969
|
+
if (this.state.type === e) return;
|
|
1970
|
+
const t = this.state.type;
|
|
1971
|
+
this.loadLayout(e) && (this.state.type = e, this.emitStateChange(), this.emit("switch", {
|
|
1972
|
+
from: t,
|
|
1973
|
+
to: e
|
|
1974
|
+
}));
|
|
1975
|
+
}
|
|
1976
|
+
toggleShift() {
|
|
1977
|
+
this.destroyed || this.currentLayout?.supportShift && (this.state.isUpperCase = !this.state.isUpperCase, this.emitStateChange(), this.emit("shift", { isUpperCase: this.state.isUpperCase }));
|
|
1978
|
+
}
|
|
1979
|
+
setShift(e) {
|
|
1980
|
+
this.destroyed || this.currentLayout?.supportShift && this.state.isUpperCase !== e && (this.state.isUpperCase = e, this.emitStateChange(), this.emit("shift", { isUpperCase: e }));
|
|
1981
|
+
}
|
|
1982
|
+
handleKey(e) {
|
|
1983
|
+
if (!this.destroyed) switch (this.options.enableVibrate && se() && re(10), this.emit("keypress", {
|
|
1984
|
+
key: e,
|
|
1985
|
+
value: this.state.value
|
|
1986
|
+
}), e.type) {
|
|
1987
|
+
case "char":
|
|
1988
|
+
case "space":
|
|
1989
|
+
this.handleCharKey(e);
|
|
1990
|
+
break;
|
|
1991
|
+
case "backspace":
|
|
1992
|
+
this.handleBackspace();
|
|
1993
|
+
break;
|
|
1994
|
+
case "shift":
|
|
1995
|
+
this.toggleShift();
|
|
1996
|
+
break;
|
|
1997
|
+
case "clear":
|
|
1998
|
+
this.handleClear();
|
|
1999
|
+
break;
|
|
2000
|
+
case "enter":
|
|
2001
|
+
case "done":
|
|
2002
|
+
this.handleConfirm();
|
|
2003
|
+
break;
|
|
2004
|
+
case "close":
|
|
2005
|
+
this.hide();
|
|
2006
|
+
break;
|
|
2007
|
+
case "tab": this.handleTab(e);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
handleCharKey(e) {
|
|
2011
|
+
const t = this.getKeyValue(e);
|
|
2012
|
+
if (!t) return;
|
|
2013
|
+
const a = this.state.inputElement;
|
|
2014
|
+
if (a) {
|
|
2015
|
+
const e = he(a, t, this.state.maxLength);
|
|
2016
|
+
a.value = e.value, ue(a, e.cursorPosition), this.state.value = e.value, this.state.cursorPosition = e.cursorPosition, this.dispatchInputEvent(a);
|
|
2017
|
+
} else {
|
|
2018
|
+
if (void 0 !== this.state.maxLength && this.state.value.length >= this.state.maxLength) return;
|
|
2019
|
+
const e = void 0 === this.state.maxLength ? t.length : this.state.maxLength - this.state.value.length, a = t.slice(0, Math.max(0, e));
|
|
2020
|
+
if (!a) return;
|
|
2021
|
+
const s = this.state.value.slice(0, this.state.cursorPosition) + a + this.state.value.slice(this.state.cursorPosition);
|
|
2022
|
+
this.state.value = s, this.state.cursorPosition += a.length;
|
|
2023
|
+
}
|
|
2024
|
+
this.emitStateChange(), this.emit("input", {
|
|
2025
|
+
value: this.state.value,
|
|
2026
|
+
key: e
|
|
2027
|
+
}), this.autoSwitchLicensePlate();
|
|
2028
|
+
}
|
|
2029
|
+
handleBackspace() {
|
|
2030
|
+
const e = this.state.inputElement;
|
|
2031
|
+
if (e) {
|
|
2032
|
+
const t = ye(e);
|
|
2033
|
+
e.value = t.value, ue(e, t.cursorPosition), this.state.value = t.value, this.state.cursorPosition = t.cursorPosition, this.dispatchInputEvent(e), this.emitStateChange(), this.emit("backspace", {
|
|
2034
|
+
deletedChar: t.deletedChar,
|
|
2035
|
+
value: this.state.value
|
|
2036
|
+
});
|
|
2037
|
+
} else {
|
|
2038
|
+
if (0 === this.state.cursorPosition) return;
|
|
2039
|
+
const e = this.state.value.charAt(this.state.cursorPosition - 1);
|
|
2040
|
+
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", {
|
|
2041
|
+
deletedChar: e,
|
|
2042
|
+
value: this.state.value
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
this.autoSwitchLicensePlate();
|
|
2046
|
+
}
|
|
2047
|
+
autoSwitchLicensePlate() {
|
|
2048
|
+
if (!this.state.type.startsWith("license-plate")) return;
|
|
2049
|
+
let e = null;
|
|
2050
|
+
e = 0 === this.state.value.length ? "license-plate-province" : "license-plate-alphanumeric", e && this.state.type !== e && this.switchType(e);
|
|
2051
|
+
}
|
|
2052
|
+
handleClear() {
|
|
2053
|
+
const e = this.state.value;
|
|
2054
|
+
this.state.inputElement && (this.state.inputElement.value = "", this.dispatchInputEvent(this.state.inputElement)), this.state.value = "", this.state.cursorPosition = 0, this.emitStateChange(), this.emit("clear", { previousValue: e }), this.autoSwitchLicensePlate();
|
|
2055
|
+
}
|
|
2056
|
+
handleConfirm() {
|
|
2057
|
+
this.emit("confirm", { value: this.state.value }), this.hide();
|
|
2058
|
+
}
|
|
2059
|
+
handleTab(e) {
|
|
2060
|
+
const t = e.data?.targetType;
|
|
2061
|
+
t && this.switchType(t);
|
|
2062
|
+
}
|
|
2063
|
+
getKeyValue(e) {
|
|
2064
|
+
const t = e.value ?? e.label;
|
|
2065
|
+
return "string" == typeof t ? t : this.state.isUpperCase ? t.upper : t.lower;
|
|
2066
|
+
}
|
|
2067
|
+
getKeyLabel(e) {
|
|
2068
|
+
const t = e.label;
|
|
2069
|
+
return "string" == typeof t ? t : this.state.isUpperCase ? t.upper : t.lower;
|
|
2070
|
+
}
|
|
2071
|
+
setValue(e) {
|
|
2072
|
+
if (this.destroyed) return;
|
|
2073
|
+
const t = ge(e, this.state.maxLength);
|
|
2074
|
+
this.state.value = t, this.state.cursorPosition = t.length, this.state.inputElement && (this.state.inputElement.value = t, ue(this.state.inputElement, t.length), this.dispatchInputEvent(this.state.inputElement)), this.emitStateChange(), this.autoSwitchLicensePlate();
|
|
2075
|
+
}
|
|
2076
|
+
appendValue(e) {
|
|
2077
|
+
if (this.destroyed) return;
|
|
2078
|
+
if (!e) return;
|
|
2079
|
+
const t = this.state.inputElement;
|
|
2080
|
+
if (t) {
|
|
2081
|
+
const a = he(t, e, this.state.maxLength);
|
|
2082
|
+
t.value = a.value, ue(t, a.cursorPosition), this.state.value = a.value, this.state.cursorPosition = a.cursorPosition, this.dispatchInputEvent(t);
|
|
2083
|
+
} else {
|
|
2084
|
+
if (void 0 !== this.state.maxLength && (e = e.slice(0, Math.max(0, this.state.maxLength - this.state.value.length))), !e) return;
|
|
2085
|
+
const t = this.state.value.slice(0, this.state.cursorPosition) + e + this.state.value.slice(this.state.cursorPosition);
|
|
2086
|
+
this.state.value = t, this.state.cursorPosition += e.length;
|
|
2087
|
+
}
|
|
2088
|
+
this.emitStateChange();
|
|
2089
|
+
}
|
|
2090
|
+
setMaxLength(e) {
|
|
2091
|
+
if (this.destroyed) return;
|
|
2092
|
+
const t = be(e);
|
|
2093
|
+
this.state.maxLength = t;
|
|
2094
|
+
const a = ge(this.state.value, t), s = a !== this.state.value;
|
|
2095
|
+
this.state.value = a, this.state.cursorPosition = Math.min(this.state.cursorPosition, a.length), this.state.inputElement && this.state.inputElement.value !== a && (this.state.inputElement.value = a, ue(this.state.inputElement, this.state.cursorPosition), this.dispatchInputEvent(this.state.inputElement)), this.emitStateChange(), s && this.autoSwitchLicensePlate();
|
|
2096
|
+
}
|
|
2097
|
+
bindInput(e) {
|
|
2098
|
+
if (this.destroyed) return;
|
|
2099
|
+
this.state.inputElement = e;
|
|
2100
|
+
const t = ge(e.value, this.state.maxLength);
|
|
2101
|
+
e.value !== t && (e.value = t), this.state.value = t, this.state.cursorPosition = Math.min(pe(e), t.length), this.emitStateChange();
|
|
2102
|
+
}
|
|
2103
|
+
unbindInput() {
|
|
2104
|
+
this.destroyed || (this.state.inputElement = null, this.emitStateChange());
|
|
2105
|
+
}
|
|
2106
|
+
emitStateChange() {
|
|
2107
|
+
this.emit("stateChange", { ...this.state });
|
|
2108
|
+
}
|
|
2109
|
+
dispatchInputEvent(e) {
|
|
2110
|
+
const t = e.ownerDocument.defaultView?.Event ?? Event;
|
|
2111
|
+
e.dispatchEvent(new t("input", { bubbles: !0 }));
|
|
2112
|
+
}
|
|
2113
|
+
destroy() {
|
|
2114
|
+
this.destroyed || (this.hide(), this.clear(), this.state.inputElement = null, this.destroyed = !0);
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
const ve = {
|
|
2118
|
+
name: "miui",
|
|
2119
|
+
displayName: "MIUI",
|
|
2120
|
+
description: "小米风格 - 纯净简洁",
|
|
2121
|
+
isDark: !1,
|
|
2122
|
+
colors: {
|
|
2123
|
+
background: "#f5f5f5",
|
|
2124
|
+
keyBackground: "#ffffff",
|
|
2125
|
+
keyColor: "#1a1a1a",
|
|
2126
|
+
keyActiveBackground: "#e8e8e8",
|
|
2127
|
+
fnKeyBackground: "#e0e0e0",
|
|
2128
|
+
fnKeyColor: "#666666",
|
|
2129
|
+
fnKeyActiveBackground: "#d0d0d0",
|
|
2130
|
+
primaryBackground: "#ff6700",
|
|
2131
|
+
primaryActiveBackground: "#e55d00",
|
|
2132
|
+
primaryColor: "#ffffff",
|
|
2133
|
+
borderColor: "transparent",
|
|
2134
|
+
dividerColor: "#eeeeee"
|
|
2135
|
+
},
|
|
2136
|
+
sizes: {
|
|
2137
|
+
keyHeight: 46,
|
|
2138
|
+
keyRadius: 8,
|
|
2139
|
+
keyGap: 6,
|
|
2140
|
+
fontSize: 18,
|
|
2141
|
+
fnFontSize: 14,
|
|
2142
|
+
padding: 8
|
|
2143
|
+
},
|
|
2144
|
+
effects: {
|
|
2145
|
+
keyShadow: "none",
|
|
2146
|
+
keyActiveShadow: "none",
|
|
2147
|
+
keyActiveScale: .96,
|
|
2148
|
+
transitionDuration: 100,
|
|
2149
|
+
enableBlur: !1,
|
|
2150
|
+
blurAmount: 0,
|
|
2151
|
+
enableRipple: !1
|
|
2152
|
+
}
|
|
2153
|
+
}, Ne = {
|
|
2154
|
+
name: "ios",
|
|
2155
|
+
displayName: "iOS",
|
|
2156
|
+
description: "Apple 风格 - 精致优雅",
|
|
2157
|
+
isDark: !1,
|
|
2158
|
+
colors: {
|
|
2159
|
+
background: "#d1d3d9",
|
|
2160
|
+
keyBackground: "#ffffff",
|
|
2161
|
+
keyColor: "#000000",
|
|
2162
|
+
keyActiveBackground: "#b8bac2",
|
|
2163
|
+
fnKeyBackground: "#a8aab4",
|
|
2164
|
+
fnKeyColor: "#000000",
|
|
2165
|
+
fnKeyActiveBackground: "#9699a3",
|
|
2166
|
+
primaryBackground: "#007aff",
|
|
2167
|
+
primaryActiveBackground: "#0062cc",
|
|
2168
|
+
primaryColor: "#ffffff",
|
|
2169
|
+
borderColor: "transparent",
|
|
2170
|
+
dividerColor: "#c8cad0"
|
|
2171
|
+
},
|
|
2172
|
+
sizes: {
|
|
2173
|
+
keyHeight: 43,
|
|
2174
|
+
keyRadius: 5,
|
|
2175
|
+
keyGap: 6,
|
|
2176
|
+
fontSize: 22,
|
|
2177
|
+
fnFontSize: 15,
|
|
2178
|
+
padding: 4
|
|
2179
|
+
},
|
|
2180
|
+
effects: {
|
|
2181
|
+
keyShadow: "0 1px 0 rgba(0,0,0,0.35)",
|
|
2182
|
+
keyActiveShadow: "0 0 0 rgba(0,0,0,0)",
|
|
2183
|
+
keyActiveScale: 1,
|
|
2184
|
+
transitionDuration: 80,
|
|
2185
|
+
enableBlur: !0,
|
|
2186
|
+
blurAmount: 20,
|
|
2187
|
+
enableRipple: !1
|
|
2188
|
+
}
|
|
2189
|
+
}, Ce = {
|
|
2190
|
+
name: "material",
|
|
2191
|
+
displayName: "Material",
|
|
2192
|
+
description: "Google 风格 - 深邃现代",
|
|
2193
|
+
isDark: !0,
|
|
2194
|
+
colors: {
|
|
2195
|
+
background: "#263238",
|
|
2196
|
+
keyBackground: "#37474f",
|
|
2197
|
+
keyColor: "#ffffff",
|
|
2198
|
+
keyActiveBackground: "#455a64",
|
|
2199
|
+
fnKeyBackground: "#455a64",
|
|
2200
|
+
fnKeyColor: "#b0bec5",
|
|
2201
|
+
fnKeyActiveBackground: "#546e7a",
|
|
2202
|
+
primaryBackground: "#4caf50",
|
|
2203
|
+
primaryActiveBackground: "#43a047",
|
|
2204
|
+
primaryColor: "#ffffff",
|
|
2205
|
+
borderColor: "transparent",
|
|
2206
|
+
dividerColor: "#37474f"
|
|
2207
|
+
},
|
|
2208
|
+
sizes: {
|
|
2209
|
+
keyHeight: 48,
|
|
2210
|
+
keyRadius: 4,
|
|
2211
|
+
keyGap: 4,
|
|
2212
|
+
fontSize: 20,
|
|
2213
|
+
fnFontSize: 14,
|
|
2214
|
+
padding: 6
|
|
2215
|
+
},
|
|
2216
|
+
effects: {
|
|
2217
|
+
keyShadow: "0 1px 3px rgba(0,0,0,0.2)",
|
|
2218
|
+
keyActiveShadow: "0 2px 6px rgba(0,0,0,0.3)",
|
|
2219
|
+
keyActiveScale: 1,
|
|
2220
|
+
transitionDuration: 150,
|
|
2221
|
+
enableBlur: !1,
|
|
2222
|
+
blurAmount: 0,
|
|
2223
|
+
enableRipple: !0
|
|
2224
|
+
}
|
|
2225
|
+
}, Ee = {
|
|
2226
|
+
name: "minimal",
|
|
2227
|
+
displayName: "Minimal",
|
|
2228
|
+
description: "极简风格 - 轻盈透明",
|
|
2229
|
+
isDark: !1,
|
|
2230
|
+
colors: {
|
|
2231
|
+
background: "rgba(250, 250, 250, 0.95)",
|
|
2232
|
+
keyBackground: "transparent",
|
|
2233
|
+
keyColor: "#333333",
|
|
2234
|
+
keyActiveBackground: "rgba(0, 0, 0, 0.08)",
|
|
2235
|
+
fnKeyBackground: "transparent",
|
|
2236
|
+
fnKeyColor: "#888888",
|
|
2237
|
+
fnKeyActiveBackground: "rgba(0, 0, 0, 0.08)",
|
|
2238
|
+
primaryBackground: "#333333",
|
|
2239
|
+
primaryActiveBackground: "#000000",
|
|
2240
|
+
primaryColor: "#ffffff",
|
|
2241
|
+
borderColor: "#eeeeee",
|
|
2242
|
+
dividerColor: "#eeeeee"
|
|
2243
|
+
},
|
|
2244
|
+
sizes: {
|
|
2245
|
+
keyHeight: 44,
|
|
2246
|
+
keyRadius: 12,
|
|
2247
|
+
keyGap: 8,
|
|
2248
|
+
fontSize: 17,
|
|
2249
|
+
fnFontSize: 13,
|
|
2250
|
+
padding: 12
|
|
2251
|
+
},
|
|
2252
|
+
effects: {
|
|
2253
|
+
keyShadow: "none",
|
|
2254
|
+
keyActiveShadow: "none",
|
|
2255
|
+
keyActiveScale: .92,
|
|
2256
|
+
transitionDuration: 120,
|
|
2257
|
+
enableBlur: !0,
|
|
2258
|
+
blurAmount: 30,
|
|
2259
|
+
enableRipple: !1
|
|
2260
|
+
}
|
|
2261
|
+
}, xe = {
|
|
2262
|
+
name: "dark",
|
|
2263
|
+
displayName: "Dark",
|
|
2264
|
+
description: "深色模式 - 护眼舒适",
|
|
2265
|
+
isDark: !0,
|
|
2266
|
+
colors: {
|
|
2267
|
+
background: "#1c1c1e",
|
|
2268
|
+
keyBackground: "#3a3a3c",
|
|
2269
|
+
keyColor: "#ffffff",
|
|
2270
|
+
keyActiveBackground: "#4a4a4c",
|
|
2271
|
+
fnKeyBackground: "#2c2c2e",
|
|
2272
|
+
fnKeyColor: "#ebebf5",
|
|
2273
|
+
fnKeyActiveBackground: "#3c3c3e",
|
|
2274
|
+
primaryBackground: "#0a84ff",
|
|
2275
|
+
primaryActiveBackground: "#0070e0",
|
|
2276
|
+
primaryColor: "#ffffff",
|
|
2277
|
+
borderColor: "#3a3a3c",
|
|
2278
|
+
dividerColor: "#3a3a3c"
|
|
2279
|
+
},
|
|
2280
|
+
sizes: {
|
|
2281
|
+
keyHeight: 45,
|
|
2282
|
+
keyRadius: 8,
|
|
2283
|
+
keyGap: 6,
|
|
2284
|
+
fontSize: 18,
|
|
2285
|
+
fnFontSize: 14,
|
|
2286
|
+
padding: 8
|
|
2287
|
+
},
|
|
2288
|
+
effects: {
|
|
2289
|
+
keyShadow: "0 1px 2px rgba(0,0,0,0.4)",
|
|
2290
|
+
keyActiveShadow: "0 0 8px rgba(10,132,255,0.3)",
|
|
2291
|
+
keyActiveScale: .97,
|
|
2292
|
+
transitionDuration: 100,
|
|
2293
|
+
enableBlur: !0,
|
|
2294
|
+
blurAmount: 20,
|
|
2295
|
+
enableRipple: !1
|
|
2296
|
+
}
|
|
2297
|
+
}, Se = {
|
|
2298
|
+
miui: ve,
|
|
2299
|
+
ios: Ne,
|
|
2300
|
+
material: Ce,
|
|
2301
|
+
minimal: Ee,
|
|
2302
|
+
dark: xe
|
|
2303
|
+
}, Le = ve, Te = /* @__PURE__ */ new Map();
|
|
2304
|
+
let Ae = Le;
|
|
2305
|
+
function Pe(e) {
|
|
2306
|
+
return Te.get(e) || Se[e] || Le;
|
|
2307
|
+
}
|
|
2308
|
+
function Me(e) {
|
|
2309
|
+
Te.set(e.name, e);
|
|
2310
|
+
}
|
|
2311
|
+
function Be(e) {
|
|
2312
|
+
return {
|
|
2313
|
+
"--keyboard-bg": e.colors.background,
|
|
2314
|
+
"--keyboard-key-bg": e.colors.keyBackground,
|
|
2315
|
+
"--keyboard-key-color": e.colors.keyColor,
|
|
2316
|
+
"--keyboard-key-active-bg": e.colors.keyActiveBackground,
|
|
2317
|
+
"--keyboard-fn-key-bg": e.colors.fnKeyBackground,
|
|
2318
|
+
"--keyboard-fn-key-color": e.colors.fnKeyColor,
|
|
2319
|
+
"--keyboard-fn-key-active-bg": e.colors.fnKeyActiveBackground,
|
|
2320
|
+
"--keyboard-primary-bg": e.colors.primaryBackground,
|
|
2321
|
+
"--keyboard-primary-active-bg": e.colors.primaryActiveBackground,
|
|
2322
|
+
"--keyboard-primary-color": e.colors.primaryColor,
|
|
2323
|
+
"--keyboard-key-height": `${e.sizes.keyHeight}px`,
|
|
2324
|
+
"--keyboard-key-radius": `${e.sizes.keyRadius}px`,
|
|
2325
|
+
"--keyboard-key-gap": `${e.sizes.keyGap}px`,
|
|
2326
|
+
"--keyboard-font-size": `${e.sizes.fontSize}px`,
|
|
2327
|
+
"--keyboard-fn-font-size": `${e.sizes.fnFontSize}px`,
|
|
2328
|
+
"--keyboard-padding": `${e.sizes.padding}px`,
|
|
2329
|
+
"--keyboard-key-shadow": e.effects.keyShadow,
|
|
2330
|
+
"--keyboard-mask-bg": "color-mix(in srgb, var(--ld-black) 40%, var(--ld-transparent))",
|
|
2331
|
+
"--keyboard-transition-duration": `${e.effects.transitionDuration}ms`,
|
|
2332
|
+
"--keyboard-border-color": e.colors.borderColor,
|
|
2333
|
+
"--keyboard-divider-color": e.colors.dividerColor
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
function ze(e, t) {
|
|
2337
|
+
return {
|
|
2338
|
+
...e,
|
|
2339
|
+
...t,
|
|
2340
|
+
colors: {
|
|
2341
|
+
...e.colors,
|
|
2342
|
+
...t.colors
|
|
2343
|
+
},
|
|
2344
|
+
sizes: {
|
|
2345
|
+
...e.sizes,
|
|
2346
|
+
...t.sizes
|
|
2347
|
+
},
|
|
2348
|
+
effects: {
|
|
2349
|
+
...e.effects,
|
|
2350
|
+
...t.effects
|
|
2351
|
+
}
|
|
2352
|
+
};
|
|
2353
|
+
}
|
|
2354
|
+
const Ie = {
|
|
2355
|
+
offset: {
|
|
2356
|
+
x: 0,
|
|
2357
|
+
y: 8
|
|
2358
|
+
},
|
|
2359
|
+
autoAdjust: !0,
|
|
2360
|
+
viewportPadding: 8,
|
|
2361
|
+
desktopPlacement: "bottom",
|
|
2362
|
+
mobilePlacement: "bottom-sheet",
|
|
2363
|
+
showMask: !0,
|
|
2364
|
+
maskClosable: !0,
|
|
2365
|
+
animationDuration: 300
|
|
2366
|
+
};
|
|
2367
|
+
function $e(e = {}) {
|
|
2368
|
+
return {
|
|
2369
|
+
...Ie,
|
|
2370
|
+
...e,
|
|
2371
|
+
offset: {
|
|
2372
|
+
...Ie.offset,
|
|
2373
|
+
...e.offset
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
var De = class {
|
|
2378
|
+
constructor(e = {}) {
|
|
2379
|
+
this.config = $e(e);
|
|
2380
|
+
}
|
|
2381
|
+
updateConfig(e) {
|
|
2382
|
+
this.config = $e({
|
|
2383
|
+
...this.config,
|
|
2384
|
+
...e,
|
|
2385
|
+
offset: {
|
|
2386
|
+
...this.config.offset,
|
|
2387
|
+
...e.offset
|
|
2388
|
+
}
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
getConfig() {
|
|
2392
|
+
return {
|
|
2393
|
+
...this.config,
|
|
2394
|
+
offset: { ...this.config.offset }
|
|
2395
|
+
};
|
|
2396
|
+
}
|
|
2397
|
+
calculate(e, t) {
|
|
2398
|
+
const a = ne(), s = se();
|
|
2399
|
+
if (s && "bottom-sheet" === this.config.mobilePlacement) return this.calculateBottomSheet(a, t);
|
|
2400
|
+
if (!e) return this.calculateCentered(a, t);
|
|
2401
|
+
const n = le(e), i = s ? this.config.mobilePlacement : this.config.desktopPlacement, o = "bottom-sheet" === i ? "bottom" : i;
|
|
2402
|
+
return this.calculateRelativeToTarget(n, t, a, o);
|
|
2403
|
+
}
|
|
2404
|
+
calculateBottomSheet(e, t) {
|
|
2405
|
+
const a = e.safeArea?.bottom ?? 0, s = Math.max(0, .6 * e.height - a), n = Math.min(Math.max(0, t.height), s);
|
|
2406
|
+
return {
|
|
2407
|
+
position: {
|
|
2408
|
+
x: 0,
|
|
2409
|
+
y: Math.max(0, e.height - n - a)
|
|
2410
|
+
},
|
|
2411
|
+
placement: "bottom-sheet",
|
|
2412
|
+
flipped: !1,
|
|
2413
|
+
maxHeight: s,
|
|
2414
|
+
maxWidth: Math.max(0, e.width),
|
|
2415
|
+
transform: "translateY(0)"
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
calculateCentered(e, t) {
|
|
2419
|
+
return {
|
|
2420
|
+
position: {
|
|
2421
|
+
x: Math.max(0, (e.width - t.width) / 2),
|
|
2422
|
+
y: Math.max(0, (e.height - t.height) / 2)
|
|
2423
|
+
},
|
|
2424
|
+
placement: "bottom",
|
|
2425
|
+
flipped: !1
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
calculateRelativeToTarget(e, t, a, s) {
|
|
2429
|
+
const { offset: n, viewportPadding: i, autoAdjust: o } = this.config;
|
|
2430
|
+
let r, l = s, c = !1;
|
|
2431
|
+
const d = {
|
|
2432
|
+
x: e.x + (n.x ?? 0),
|
|
2433
|
+
y: e.y + e.height + (n.y ?? 8)
|
|
2434
|
+
}, p = {
|
|
2435
|
+
x: e.x + (n.x ?? 0),
|
|
2436
|
+
y: e.y - t.height - (n.y ?? 8)
|
|
2437
|
+
};
|
|
2438
|
+
if ("bottom" === s ? (r = d, o && r.y + t.height > a.height - i && p.y >= i && (r = p, l = "top", c = !0)) : (r = p, o && r.y < i && d.y + t.height <= a.height - i && (r = d, l = "bottom", c = !0)), o) {
|
|
2439
|
+
const e = Math.max(i, a.width - t.width - i);
|
|
2440
|
+
r.x = Math.min(Math.max(r.x, i), e);
|
|
2441
|
+
}
|
|
2442
|
+
const u = "bottom" === l ? a.height - r.y - i : e.y - i;
|
|
2443
|
+
return {
|
|
2444
|
+
position: r,
|
|
2445
|
+
placement: l,
|
|
2446
|
+
flipped: c,
|
|
2447
|
+
maxHeight: Math.max(0, u),
|
|
2448
|
+
maxWidth: Math.max(0, a.width - 2 * i)
|
|
2449
|
+
};
|
|
2450
|
+
}
|
|
2451
|
+
getInitialStyles(e) {
|
|
2452
|
+
switch (e) {
|
|
2453
|
+
case "bottom-sheet": return {
|
|
2454
|
+
transform: "translateY(100%)",
|
|
2455
|
+
opacity: "1"
|
|
2456
|
+
};
|
|
2457
|
+
case "bottom": return {
|
|
2458
|
+
transform: "translateY(calc(-1 * var(--ld-px-10)))",
|
|
2459
|
+
opacity: "0"
|
|
2460
|
+
};
|
|
2461
|
+
case "top": return {
|
|
2462
|
+
transform: "translateY(var(--ld-px-10))",
|
|
2463
|
+
opacity: "0"
|
|
2464
|
+
};
|
|
2465
|
+
default: return { opacity: "0" };
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
getFinalStyles(e) {
|
|
2469
|
+
return {
|
|
2470
|
+
transform: "translateY(0)",
|
|
2471
|
+
opacity: "1"
|
|
2472
|
+
};
|
|
2473
|
+
}
|
|
2474
|
+
getExitStyles(e) {
|
|
2475
|
+
return this.getInitialStyles(e);
|
|
2476
|
+
}
|
|
2477
|
+
getAnimationDuration() {
|
|
2478
|
+
return this.config.animationDuration;
|
|
2479
|
+
}
|
|
2480
|
+
shouldShowMask() {
|
|
2481
|
+
return se() && this.config.showMask;
|
|
2482
|
+
}
|
|
2483
|
+
isMaskClosable() {
|
|
2484
|
+
return this.config.maskClosable;
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
const Oe = /* @__PURE__ */ new WeakMap();
|
|
2488
|
+
var Re = class {
|
|
2489
|
+
constructor(e = {}) {
|
|
2490
|
+
this.rootEl = null, this.maskEl = null, this.keyboardEl = null, this.targetEl = null, this.cleanupFns = [], this.inputCleanupFns = /* @__PURE__ */ new Set(), this.styleDocument = null, this.destroyed = !1, this.options = e;
|
|
2491
|
+
const t = e.container ?? ("undefined" != typeof document ? document.body : null);
|
|
2492
|
+
if (!t) throw new Error("[KeyboardRenderer] A DOM container is required in non-browser environments");
|
|
2493
|
+
this.container = t, this.manager = new we(e), this.positionManager = new De(e.position), "string" == typeof e.theme ? this.theme = Pe(e.theme) : e.theme ? this.theme = e.theme : this.theme = Le, this.setupEvents();
|
|
2494
|
+
}
|
|
2495
|
+
setupEvents() {
|
|
2496
|
+
this.manager.on("stateChange", (e) => {
|
|
2497
|
+
e.visible ? this.render() : this.unmount();
|
|
2498
|
+
}), this.manager.on("input", ({ value: e }) => {
|
|
2499
|
+
this.options.onInput?.(e);
|
|
2500
|
+
}), this.manager.on("confirm", ({ value: e }) => {
|
|
2501
|
+
this.options.onConfirm?.(e);
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
open(e) {
|
|
2505
|
+
this.destroyed || (this.targetEl = e ?? null, this.manager.show(e));
|
|
2506
|
+
}
|
|
2507
|
+
close() {
|
|
2508
|
+
if (this.destroyed) return;
|
|
2509
|
+
const e = this.manager.getState().visible;
|
|
2510
|
+
this.manager.hide(), e && this.options.onClose?.();
|
|
2511
|
+
}
|
|
2512
|
+
switchType(e) {
|
|
2513
|
+
this.destroyed || this.manager.switchType(e);
|
|
2514
|
+
}
|
|
2515
|
+
setTheme(e) {
|
|
2516
|
+
this.destroyed || (this.theme = "string" == typeof e ? Pe(e) : e, this.manager.getState().visible && this.render());
|
|
2517
|
+
}
|
|
2518
|
+
getValue() {
|
|
2519
|
+
return this.manager.getState().value;
|
|
2520
|
+
}
|
|
2521
|
+
setValue(e) {
|
|
2522
|
+
this.destroyed || this.manager.setValue(e);
|
|
2523
|
+
}
|
|
2524
|
+
render() {
|
|
2525
|
+
if (this.destroyed) return;
|
|
2526
|
+
const e = this.manager.getLayout();
|
|
2527
|
+
if (!e) return;
|
|
2528
|
+
this.unmount(), this.rootEl = document.createElement("div"), this.rootEl.className = "lk-renderer-root";
|
|
2529
|
+
const t = se();
|
|
2530
|
+
t && (this.maskEl = document.createElement("div"), this.maskEl.className = "lk-mask", this.maskEl.addEventListener("click", () => {
|
|
2531
|
+
this.positionManager.isMaskClosable() && this.close();
|
|
2532
|
+
}), this.rootEl.appendChild(this.maskEl)), this.keyboardEl = document.createElement("div"), this.keyboardEl.className = "lk-popup lk-popup--" + (t ? "mobile" : "desktop");
|
|
2533
|
+
const a = Be(this.theme), s = this.keyboardEl;
|
|
2534
|
+
if (!s) return;
|
|
2535
|
+
Object.entries(a).forEach(([e, t]) => {
|
|
2536
|
+
t && s.style.setProperty(e, t);
|
|
2537
|
+
});
|
|
2538
|
+
const n = this.renderKeyboard(e);
|
|
2539
|
+
if (this.keyboardEl.appendChild(n), this.rootEl.appendChild(this.keyboardEl), this.container.appendChild(this.rootEl), !t && this.targetEl) {
|
|
2540
|
+
const e = this.keyboardEl.getBoundingClientRect(), t = this.positionManager.calculate(this.targetEl, {
|
|
2541
|
+
width: e.width,
|
|
2542
|
+
height: e.height
|
|
2543
|
+
});
|
|
2544
|
+
this.keyboardEl.style.position = "fixed", this.keyboardEl.style.left = `${t.position.x}px`, this.keyboardEl.style.top = `${t.position.y}px`, this.keyboardEl.style.zIndex = "10000";
|
|
2545
|
+
} else t && (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");
|
|
2546
|
+
if (requestAnimationFrame(() => {
|
|
2547
|
+
this.keyboardEl?.classList.add("lk-popup--visible"), this.maskEl?.classList.add("lk-mask--visible");
|
|
2548
|
+
}), !1 !== this.options.closeOnClickOutside && this.keyboardEl) {
|
|
2549
|
+
const e = de(this.keyboardEl, (e) => {
|
|
2550
|
+
this.targetEl && e.target instanceof Node && this.targetEl.contains(e.target) || this.close();
|
|
2551
|
+
});
|
|
2552
|
+
this.cleanupFns.push(e);
|
|
2553
|
+
}
|
|
2554
|
+
this.injectStyles();
|
|
2555
|
+
}
|
|
2556
|
+
renderKeyboard(e) {
|
|
2557
|
+
const t = document.createElement("div");
|
|
2558
|
+
t.className = "lk-keyboard";
|
|
2559
|
+
const a = this.manager.getState();
|
|
2560
|
+
return e.rows.forEach((e) => {
|
|
2561
|
+
const s = document.createElement("div");
|
|
2562
|
+
s.className = `lk-row ${e.className || ""}`;
|
|
2563
|
+
const n = "numpad-row" === e.className;
|
|
2564
|
+
e.keys.forEach((e) => {
|
|
2565
|
+
const t = document.createElement("div");
|
|
2566
|
+
if (t.className = "lk-key-wrapper", n) t.style.flex = String(e.width ?? 1);
|
|
2567
|
+
else if (e.width) {
|
|
2568
|
+
const a = 36, s = this.theme.sizes?.keyGap ?? 6, n = a * e.width + (e.width - 1) * s;
|
|
2569
|
+
t.style.width = `${n}px`;
|
|
2570
|
+
}
|
|
2571
|
+
const i = document.createElement("button");
|
|
2572
|
+
if (i.type = "button", i.className = this.getKeyClass(e, a.isUpperCase), e.disabled && (i.disabled = !0), e.icon) {
|
|
2573
|
+
const t = me(e.icon);
|
|
2574
|
+
t ? i.innerHTML = t : i.textContent = e.icon;
|
|
2575
|
+
} else i.textContent = "string" == typeof e.label ? e.label : a.isUpperCase ? e.label.upper : e.label.lower;
|
|
2576
|
+
const o = (t) => {
|
|
2577
|
+
t.preventDefault(), t.stopPropagation(), e.disabled || this.manager.handleKey(e);
|
|
2578
|
+
};
|
|
2579
|
+
i.addEventListener("mousedown", o), i.addEventListener("touchstart", o, { passive: !1 }), t.appendChild(i), s.appendChild(t);
|
|
2580
|
+
}), t.appendChild(s);
|
|
2581
|
+
}), t;
|
|
2582
|
+
}
|
|
2583
|
+
getKeyClass(e, t) {
|
|
2584
|
+
const a = ["lk-key", `lk-key--${e.type}`];
|
|
2585
|
+
return e.className && a.push(e.className), e.disabled && a.push("lk-key--disabled"), "shift" === e.type && t && a.push("lk-key--active"), a.join(" ");
|
|
2586
|
+
}
|
|
2587
|
+
unmount() {
|
|
2588
|
+
this.cleanupFns.forEach((e) => e()), this.cleanupFns = [], this.rootEl && this.rootEl.parentNode && this.rootEl.parentNode.removeChild(this.rootEl), this.rootEl = null, this.maskEl = null, this.keyboardEl = null;
|
|
2589
|
+
}
|
|
2590
|
+
injectStyles() {
|
|
2591
|
+
const e = this.container.ownerDocument;
|
|
2592
|
+
if (this.styleDocument === e) return;
|
|
2593
|
+
const t = Oe.get(e);
|
|
2594
|
+
if (t) return t.users += 1, void (this.styleDocument = e);
|
|
2595
|
+
const a = e.createElement("style");
|
|
2596
|
+
a.textContent = "\n .lk-renderer-root { font-family: var(--ld-font-family); }\n .lk-mask { position: fixed; inset: 0; z-index: 9999; background: var(--keyboard-mask-bg); opacity: 0; transition: opacity var(--ld-duration-fast); }\n .lk-mask--visible { opacity: 1; }\n .lk-popup { overflow: hidden; background: var(--keyboard-bg); box-shadow: var(--ld-shadow-md, none); transform: translateY(var(--ld-px-20)); opacity: 0; transition: transform var(--ld-duration-fast), opacity var(--ld-duration-fast); }\n .lk-popup--visible { transform: translateY(0); opacity: 1; }\n .lk-popup--desktop { min-width: var(--ld-px-280); border-radius: var(--ld-radius-lg); box-shadow: var(--ld-shadow-lg, none); }\n .lk-popup--mobile { border-top-left-radius: var(--ld-radius-lg); border-top-right-radius: var(--ld-radius-lg); padding-bottom: env(safe-area-inset-bottom, var(--ld-px-0)); }\n .lk-keyboard { display: flex; flex-direction: column; gap: var(--keyboard-key-gap); padding: var(--keyboard-padding); user-select: none; -webkit-user-select: none; font-family: var(--ld-font-family); }\n .lk-row { display: flex; justify-content: center; gap: var(--keyboard-key-gap); padding: 0 var(--ld-px-2); }\n .lk-row.numpad-row { justify-content: stretch; }\n .lk-row.numpad-row .lk-key-wrapper { flex: 1; }\n .lk-key-wrapper { position: relative; display: inline-flex; }\n .lk-key { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-width: var(--ld-px-32); height: var(--keyboard-key-height); padding: 0 var(--ld-spacing-xs); border: 0; border-radius: var(--keyboard-key-radius); background: var(--keyboard-key-bg); color: var(--keyboard-key-color); font-size: var(--keyboard-font-size); font-weight: 500; cursor: pointer; touch-action: manipulation; box-shadow: var(--keyboard-key-shadow); transition: background-color var(--ld-duration-fast), transform var(--ld-duration-fast); }\n .lk-key:active { background: var(--keyboard-key-active-bg); transform: scale(0.95); }\n .lk-key--disabled { opacity: 0.4; cursor: not-allowed; }\n .lk-key--disabled:active { transform: none; background: var(--keyboard-key-bg); }\n .lk-key--backspace, .lk-key--shift, .lk-key--tab, .lk-key--clear, .lk-key--close { background: var(--keyboard-fn-key-bg); color: var(--keyboard-fn-key-color); font-size: var(--keyboard-fn-font-size); }\n .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); }\n .lk-key--active { background: var(--keyboard-key-active-bg) !important; color: var(--ld-text-inverse) !important; }\n .lk-key--done, .lk-key--enter { background: var(--keyboard-primary-bg); color: var(--keyboard-primary-color); font-size: var(--keyboard-fn-font-size); }\n .lk-key--done:active, .lk-key--enter:active { background: var(--keyboard-primary-active-bg); }\n .lk-key--space { background: var(--keyboard-key-bg); }\n .lk-key svg { pointer-events: none; }\n ", a.id = "lk-renderer-styles", e.head?.appendChild(a), Oe.set(e, {
|
|
2597
|
+
element: a,
|
|
2598
|
+
users: 1
|
|
2599
|
+
}), this.styleDocument = e;
|
|
2600
|
+
}
|
|
2601
|
+
bindInput(e) {
|
|
2602
|
+
if (this.destroyed) return () => {};
|
|
2603
|
+
const t = () => this.open(e);
|
|
2604
|
+
e.addEventListener("focus", t), e.setAttribute("readonly", "readonly"), e.style.caretColor = "transparent";
|
|
2605
|
+
let a = !1;
|
|
2606
|
+
const s = () => {
|
|
2607
|
+
a || (a = !0, e.removeEventListener("focus", t), e.removeAttribute("readonly"), e.style.caretColor = "");
|
|
2608
|
+
};
|
|
2609
|
+
return this.inputCleanupFns.add(s), s;
|
|
2610
|
+
}
|
|
2611
|
+
destroy() {
|
|
2612
|
+
if (!this.destroyed && (this.destroyed = !0, this.unmount(), this.inputCleanupFns.forEach((e) => e()), this.inputCleanupFns.clear(), this.manager.destroy(), this.styleDocument)) {
|
|
2613
|
+
const e = Oe.get(this.styleDocument);
|
|
2614
|
+
e && (e.users -= 1, e.users <= 0 && (e.element.remove(), Oe.delete(this.styleDocument))), this.styleDocument = null;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
function Ke(e) {
|
|
2619
|
+
const t = e.replace(/\D/g, "").slice(0, 11);
|
|
2620
|
+
return t.length <= 3 ? t : t.length <= 7 ? `${t.slice(0, 3)} ${t.slice(3)}` : `${t.slice(0, 3)} ${t.slice(3, 7)} ${t.slice(7)}`;
|
|
2621
|
+
}
|
|
2622
|
+
function je(e) {
|
|
2623
|
+
return e.replace(/\D/g, "").slice(0, 19).replace(/(\d{4})(?=\d)/g, "$1 ");
|
|
2624
|
+
}
|
|
2625
|
+
function Ue(e) {
|
|
2626
|
+
return e.replace(/[^\dX]/gi, "").slice(0, 18).toUpperCase();
|
|
2627
|
+
}
|
|
2628
|
+
function Fe(e) {
|
|
2629
|
+
return e.toUpperCase().slice(0, 8);
|
|
2630
|
+
}
|
|
2631
|
+
function qe(e, t = 6) {
|
|
2632
|
+
return e.replace(/\D/g, "").slice(0, t);
|
|
2633
|
+
}
|
|
2634
|
+
const Ve = /* @__PURE__ */ new Map([
|
|
2635
|
+
["phone", Ke],
|
|
2636
|
+
["bankcard", je],
|
|
2637
|
+
["idcard", Ue],
|
|
2638
|
+
["license-plate", Fe],
|
|
2639
|
+
["verifycode", qe]
|
|
2640
|
+
]);
|
|
2641
|
+
function He(e) {
|
|
2642
|
+
const t = [...e];
|
|
2643
|
+
for (let e = t.length - 1; e > 0; e--) {
|
|
2644
|
+
const a = Math.floor(Math.random() * (e + 1));
|
|
2645
|
+
[t[e], t[a]] = [t[a], t[e]];
|
|
2646
|
+
}
|
|
2647
|
+
return t;
|
|
2648
|
+
}
|
|
2649
|
+
function _e() {
|
|
2650
|
+
return He([
|
|
2651
|
+
"0",
|
|
2652
|
+
"1",
|
|
2653
|
+
"2",
|
|
2654
|
+
"3",
|
|
2655
|
+
"4",
|
|
2656
|
+
"5",
|
|
2657
|
+
"6",
|
|
2658
|
+
"7",
|
|
2659
|
+
"8",
|
|
2660
|
+
"9"
|
|
2661
|
+
]);
|
|
2662
|
+
}
|
|
2663
|
+
function We() {
|
|
2664
|
+
return He(Array.from({ length: 26 }, (e, t) => String.fromCharCode(65 + t)));
|
|
2665
|
+
}
|
|
2666
|
+
function Ye() {
|
|
2667
|
+
return He([
|
|
2668
|
+
"0",
|
|
2669
|
+
"1",
|
|
2670
|
+
"2",
|
|
2671
|
+
"3",
|
|
2672
|
+
"4",
|
|
2673
|
+
"5",
|
|
2674
|
+
"6",
|
|
2675
|
+
"7",
|
|
2676
|
+
"8",
|
|
2677
|
+
"9",
|
|
2678
|
+
...Array.from({ length: 26 }, (e, t) => String.fromCharCode(65 + t))
|
|
2679
|
+
]);
|
|
2680
|
+
}
|
|
2681
|
+
function Xe(e, t) {
|
|
2682
|
+
return {
|
|
2683
|
+
id: `random-${e}-${t}`,
|
|
2684
|
+
type: "char",
|
|
2685
|
+
label: e,
|
|
2686
|
+
value: e,
|
|
2687
|
+
className: "key-random"
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
function Ge(e) {
|
|
2691
|
+
const { keysPerRow: t = 3, includeBackspace: a = !0, includeDone: s = !0, includeClear: n = !1 } = e || {}, i = function(e, t) {
|
|
2692
|
+
const a = [];
|
|
2693
|
+
for (let s = 0; s < e.length; s += t) a.push(e.slice(s, s + t));
|
|
2694
|
+
return a;
|
|
2695
|
+
}(_e().map((e, t) => Xe(e, t)), t).map((e) => ({
|
|
2696
|
+
className: "numpad-row",
|
|
2697
|
+
keys: e
|
|
2698
|
+
})), o = [];
|
|
2699
|
+
return n && o.push({
|
|
2700
|
+
id: "clear",
|
|
2701
|
+
type: "clear",
|
|
2702
|
+
label: "清空",
|
|
2703
|
+
className: "key-clear key-fn"
|
|
2704
|
+
}), a && o.push({
|
|
2705
|
+
id: "backspace",
|
|
2706
|
+
type: "backspace",
|
|
2707
|
+
label: "⌫",
|
|
2708
|
+
className: "key-backspace key-fn"
|
|
2709
|
+
}), s && o.push({
|
|
2710
|
+
id: "done",
|
|
2711
|
+
type: "done",
|
|
2712
|
+
label: "确定",
|
|
2713
|
+
className: "key-done key-fn"
|
|
2714
|
+
}), o.length > 0 && i.push({
|
|
2715
|
+
className: "numpad-row",
|
|
2716
|
+
keys: o
|
|
2717
|
+
}), {
|
|
2718
|
+
type: "custom",
|
|
2719
|
+
name: "随机数字键盘",
|
|
2720
|
+
supportShift: !1,
|
|
2721
|
+
rows: i,
|
|
2722
|
+
data: {
|
|
2723
|
+
isRandom: !0,
|
|
2724
|
+
randomType: "number"
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
}
|
|
2728
|
+
function Ze(e) {
|
|
2729
|
+
const { includeBackspace: t = !0, includeDone: a = !0 } = e || {}, s = _e(), n = [
|
|
2730
|
+
{
|
|
2731
|
+
className: "numpad-row",
|
|
2732
|
+
keys: s.slice(0, 3).map((e, t) => Xe(e, t))
|
|
2733
|
+
},
|
|
2734
|
+
{
|
|
2735
|
+
className: "numpad-row",
|
|
2736
|
+
keys: s.slice(3, 6).map((e, t) => Xe(e, t + 3))
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
className: "numpad-row",
|
|
2740
|
+
keys: s.slice(6, 9).map((e, t) => Xe(e, t + 6))
|
|
2741
|
+
}
|
|
2742
|
+
], i = [];
|
|
2743
|
+
return t ? i.push({
|
|
2744
|
+
id: "backspace",
|
|
2745
|
+
type: "backspace",
|
|
2746
|
+
label: "⌫",
|
|
2747
|
+
className: "key-backspace key-fn"
|
|
2748
|
+
}) : i.push({
|
|
2749
|
+
id: "empty-1",
|
|
2750
|
+
type: "char",
|
|
2751
|
+
label: "",
|
|
2752
|
+
value: "",
|
|
2753
|
+
disabled: !0,
|
|
2754
|
+
className: "key-placeholder"
|
|
2755
|
+
}), i.push(Xe(s[9], 9)), a ? i.push({
|
|
2756
|
+
id: "done",
|
|
2757
|
+
type: "done",
|
|
2758
|
+
label: "确定",
|
|
2759
|
+
className: "key-done key-fn"
|
|
2760
|
+
}) : i.push({
|
|
2761
|
+
id: "empty-2",
|
|
2762
|
+
type: "char",
|
|
2763
|
+
label: "",
|
|
2764
|
+
value: "",
|
|
2765
|
+
disabled: !0,
|
|
2766
|
+
className: "key-placeholder"
|
|
2767
|
+
}), n.push({
|
|
2768
|
+
className: "numpad-row",
|
|
2769
|
+
keys: i
|
|
2770
|
+
}), {
|
|
2771
|
+
type: "custom",
|
|
2772
|
+
name: "随机PIN键盘",
|
|
2773
|
+
supportShift: !1,
|
|
2774
|
+
rows: n,
|
|
2775
|
+
data: {
|
|
2776
|
+
isRandom: !0,
|
|
2777
|
+
randomType: "pin"
|
|
2778
|
+
}
|
|
2779
|
+
};
|
|
2780
|
+
}
|
|
2781
|
+
function Je(e) {
|
|
2782
|
+
const { uppercase: t = !0, rowDistribution: a = [
|
|
2783
|
+
10,
|
|
2784
|
+
9,
|
|
2785
|
+
7
|
|
2786
|
+
] } = e || {};
|
|
2787
|
+
let s = We();
|
|
2788
|
+
t || (s = s.map((e) => e.toLowerCase()));
|
|
2789
|
+
const n = s.map((e, t) => Xe(e, t)), i = [];
|
|
2790
|
+
let o = 0;
|
|
2791
|
+
for (const e of a) i.push({
|
|
2792
|
+
className: "numpad-row",
|
|
2793
|
+
keys: n.slice(o, o + e)
|
|
2794
|
+
}), o += e;
|
|
2795
|
+
return o < n.length && i.push({
|
|
2796
|
+
className: "numpad-row",
|
|
2797
|
+
keys: n.slice(o)
|
|
2798
|
+
}), i.push({
|
|
2799
|
+
className: "numpad-row",
|
|
2800
|
+
keys: [
|
|
2801
|
+
{
|
|
2802
|
+
id: "clear",
|
|
2803
|
+
type: "clear",
|
|
2804
|
+
label: "清空",
|
|
2805
|
+
className: "key-clear key-fn"
|
|
2806
|
+
},
|
|
2807
|
+
{
|
|
2808
|
+
id: "backspace",
|
|
2809
|
+
type: "backspace",
|
|
2810
|
+
label: "⌫",
|
|
2811
|
+
className: "key-backspace key-fn"
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
id: "done",
|
|
2815
|
+
type: "done",
|
|
2816
|
+
label: "确定",
|
|
2817
|
+
className: "key-done key-fn"
|
|
2818
|
+
}
|
|
2819
|
+
]
|
|
2820
|
+
}), {
|
|
2821
|
+
type: "custom",
|
|
2822
|
+
name: "随机字母键盘",
|
|
2823
|
+
supportShift: !1,
|
|
2824
|
+
rows: i,
|
|
2825
|
+
data: {
|
|
2826
|
+
isRandom: !0,
|
|
2827
|
+
randomType: "letter"
|
|
2828
|
+
}
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
function Qe(e) {
|
|
2832
|
+
const { rowDistribution: t = [
|
|
2833
|
+
10,
|
|
2834
|
+
10,
|
|
2835
|
+
9,
|
|
2836
|
+
7
|
|
2837
|
+
] } = e || {}, a = Ye().map((e, t) => Xe(e, t)), s = [];
|
|
2838
|
+
let n = 0;
|
|
2839
|
+
for (const e of t) {
|
|
2840
|
+
if (n >= a.length) break;
|
|
2841
|
+
s.push({
|
|
2842
|
+
className: "numpad-row",
|
|
2843
|
+
keys: a.slice(n, n + e)
|
|
2844
|
+
}), n += e;
|
|
2845
|
+
}
|
|
2846
|
+
return n < a.length && s.push({
|
|
2847
|
+
className: "numpad-row",
|
|
2848
|
+
keys: a.slice(n)
|
|
2849
|
+
}), s.push({
|
|
2850
|
+
className: "numpad-row",
|
|
2851
|
+
keys: [
|
|
2852
|
+
{
|
|
2853
|
+
id: "clear",
|
|
2854
|
+
type: "clear",
|
|
2855
|
+
label: "清空",
|
|
2856
|
+
className: "key-clear key-fn"
|
|
2857
|
+
},
|
|
2858
|
+
{
|
|
2859
|
+
id: "backspace",
|
|
2860
|
+
type: "backspace",
|
|
2861
|
+
label: "⌫",
|
|
2862
|
+
className: "key-backspace key-fn"
|
|
2863
|
+
},
|
|
2864
|
+
{
|
|
2865
|
+
id: "done",
|
|
2866
|
+
type: "done",
|
|
2867
|
+
label: "确定",
|
|
2868
|
+
className: "key-done key-fn"
|
|
2869
|
+
}
|
|
2870
|
+
]
|
|
2871
|
+
}), {
|
|
2872
|
+
type: "custom",
|
|
2873
|
+
name: "随机混合键盘",
|
|
2874
|
+
supportShift: !1,
|
|
2875
|
+
rows: s,
|
|
2876
|
+
data: {
|
|
2877
|
+
isRandom: !0,
|
|
2878
|
+
randomType: "mixed"
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
exports.EMAIL_SUFFIXES = f, exports.EventEmitter = ke, exports.ICONS = c, exports.ICON_CHECK = s, exports.ICON_CLEAR = t, exports.ICON_CLOSE = a, exports.ICON_DELETE = e, exports.ICON_ENTER = n, exports.ICON_KEYBOARD = r, exports.ICON_SHIFT = i, exports.ICON_SPACE = o, exports.ICON_VOICE = l, exports.KeyboardManager = we, exports.KeyboardRenderer = Re, exports.PLATE_LETTERS = N, exports.PROVINCES = v, exports.PositionManager = De, exports.amountLayout = p, exports.amountSimpleLayout = u, exports.applyFormatter = function(e, t) {
|
|
2883
|
+
const a = Ve.get(e);
|
|
2884
|
+
return a ? a(t) : t;
|
|
2885
|
+
}, exports.applyTheme = function(e, t) {
|
|
2886
|
+
const a = Be(t);
|
|
2887
|
+
Object.entries(a).forEach(([t, a]) => {
|
|
2888
|
+
a && e.style.setProperty(t, a);
|
|
2889
|
+
}), e.classList.remove("keyboard-theme-light", "keyboard-theme-dark"), e.classList.add(t.isDark ? "keyboard-theme-dark" : "keyboard-theme-light"), e.dataset.theme = t.name;
|
|
2890
|
+
}, exports.bankcardLayout = y, exports.createElement = function(e, t, a) {
|
|
2891
|
+
const s = document.createElement(e);
|
|
2892
|
+
return t && Object.entries(t).forEach(([e, t]) => {
|
|
2893
|
+
s.setAttribute(e, t);
|
|
2894
|
+
}), a && a.forEach((e) => {
|
|
2895
|
+
"string" == typeof e ? s.appendChild(document.createTextNode(e)) : s.appendChild(e);
|
|
2896
|
+
}), s;
|
|
2897
|
+
}, exports.createKeyboardManager = function(e) {
|
|
2898
|
+
return new we(e);
|
|
2899
|
+
}, exports.createKeyboardRenderer = function(e) {
|
|
2900
|
+
return new Re(e);
|
|
2901
|
+
}, exports.createPositionManager = function(e) {
|
|
2902
|
+
return new De(e);
|
|
2903
|
+
}, exports.createRandomLetterLayout = Je, exports.createRandomMixedLayout = Qe, exports.createRandomNumberLayout = Ge, exports.createRandomPinLayout = Ze, exports.createTheme = function(e, t, a) {
|
|
2904
|
+
const s = ze(Pe(t), {
|
|
2905
|
+
...a,
|
|
2906
|
+
name: e
|
|
2907
|
+
});
|
|
2908
|
+
return Me(s), s;
|
|
2909
|
+
}, exports.darkTheme = xe, exports.defaultTheme = Le, exports.deleteCharBeforeCursor = ye, exports.emailLayout = b, exports.formatAmount = function(e, t = 2) {
|
|
2910
|
+
let a = e.replace(/[^\d.]/g, "");
|
|
2911
|
+
const s = a.split(".");
|
|
2912
|
+
return s.length > 2 && (a = `${s[0]}.${s.slice(1).join("")}`), 2 === s.length && s[1].length > t && (a = `${s[0]}.${s[1].slice(0, t)}`), a.length > 1 && a.startsWith("0") && "." !== a[1] && (a = a.replace(/^0+/, "") || "0"), a;
|
|
2913
|
+
}, exports.formatBankCard = je, exports.formatIdCard = Ue, exports.formatLicensePlate = Fe, exports.formatPhone = Ke, exports.formatVerifyCode = qe, exports.generateThemeStyle = function(e) {
|
|
2914
|
+
const t = Be(e);
|
|
2915
|
+
return Object.entries(t).filter(([, e]) => e).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
2916
|
+
}, exports.getAllThemes = function() {
|
|
2917
|
+
return [...Object.values(Se), ...Te.values()];
|
|
2918
|
+
}, exports.getAvailableLayouts = function() {
|
|
2919
|
+
return [...Object.keys(X), ...Object.keys(G)];
|
|
2920
|
+
}, exports.getAvailableThemes = function() {
|
|
2921
|
+
return [...Object.keys(Se), ...Te.keys()];
|
|
2922
|
+
}, exports.getBoundingRect = le, exports.getCurrentTheme = function() {
|
|
2923
|
+
return Ae;
|
|
2924
|
+
}, exports.getDeviceType = function() {
|
|
2925
|
+
return se() ? "mobile" : "desktop";
|
|
2926
|
+
}, exports.getElementOffset = function(e) {
|
|
2927
|
+
const t = e.getBoundingClientRect(), a = window.pageXOffset || document.documentElement.scrollLeft, s = window.pageYOffset || document.documentElement.scrollTop;
|
|
2928
|
+
return {
|
|
2929
|
+
x: t.left + a,
|
|
2930
|
+
y: t.top + s
|
|
2931
|
+
};
|
|
2932
|
+
}, exports.getFormatter = function(e) {
|
|
2933
|
+
return Ve.get(e);
|
|
2934
|
+
}, exports.getInputCursorPosition = pe, exports.getLayout = J, exports.getRandomAlphanumeric = Ye, exports.getRandomLetters = We, exports.getRandomNumbers = _e, exports.getSafeAreaInsets = ie, exports.getTheme = Pe, exports.getViewportInfo = ne, exports.hasLayout = function(e) {
|
|
2935
|
+
return e in X || e in G;
|
|
2936
|
+
}, exports.idcardLayout = w, exports.insertTextAtCursor = he, exports.integerLayout = M, exports.iosTheme = Ne, exports.isClickOutside = ce, exports.isElementInViewport = function(e) {
|
|
2937
|
+
const t = e.getBoundingClientRect();
|
|
2938
|
+
return t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
2939
|
+
}, exports.isMobile = se, exports.isMobileUA = ae, exports.isTouchDevice = te, exports.licensePlateAlphanumericLayout = S, exports.licensePlateLayout = T, exports.licensePlateLetterLayout = L, exports.licensePlateProvinceLayout = x, exports.materialTheme = Ce, exports.mergeTheme = ze, exports.minimalTheme = Ee, exports.miuiTheme = ve, exports.numberLayout = P, exports.onClickOutside = de, exports.onViewportChange = function(e) {
|
|
2940
|
+
if ("undefined" == typeof window) return () => {};
|
|
2941
|
+
const t = () => {
|
|
2942
|
+
e(ne());
|
|
2943
|
+
};
|
|
2944
|
+
return window.addEventListener("resize", t), window.addEventListener("orientationchange", t), () => {
|
|
2945
|
+
window.removeEventListener("resize", t), window.removeEventListener("orientationchange", t);
|
|
2946
|
+
};
|
|
2947
|
+
}, exports.phoneLayout = z, exports.phoneSimpleLayout = I, exports.presetThemes = Se, exports.preventDefaultAndStopPropagation = function(e) {
|
|
2948
|
+
e.preventDefault(), e.stopPropagation();
|
|
2949
|
+
}, exports.punctLayout = D, exports.qwertyLayout = R, exports.refreshRandomLayout = function(e) {
|
|
2950
|
+
switch (e.data?.randomType) {
|
|
2951
|
+
case "number": return Ge();
|
|
2952
|
+
case "pin": return Ze();
|
|
2953
|
+
case "letter": return Je();
|
|
2954
|
+
case "mixed": return Qe();
|
|
2955
|
+
default: return e;
|
|
2956
|
+
}
|
|
2957
|
+
}, exports.registerFormatter = function(e, t) {
|
|
2958
|
+
Ve.set(e, t);
|
|
2959
|
+
}, exports.registerLayout = Z, exports.registerLayouts = function(e) {
|
|
2960
|
+
Object.entries(e).forEach(([e, t]) => {
|
|
2961
|
+
Z(e, t);
|
|
2962
|
+
});
|
|
2963
|
+
}, exports.registerTheme = Me, exports.sanitizeSvgIcon = me, exports.scrollIntoViewIfNeeded = function(e, t) {
|
|
2964
|
+
if (!t) return void e.scrollIntoView({
|
|
2965
|
+
behavior: "smooth",
|
|
2966
|
+
block: "nearest"
|
|
2967
|
+
});
|
|
2968
|
+
const a = e.getBoundingClientRect(), s = t.getBoundingClientRect();
|
|
2969
|
+
a.bottom > s.bottom ? t.scrollTop += a.bottom - s.bottom : a.top < s.top && (t.scrollTop -= s.top - a.top);
|
|
2970
|
+
}, exports.searchLayout = j, exports.setCurrentTheme = function(e) {
|
|
2971
|
+
return Ae = Pe(e), Ae;
|
|
2972
|
+
}, exports.setInputCursorPosition = ue, exports.setStyles = function(e, t) {
|
|
2973
|
+
Object.assign(e.style, t);
|
|
2974
|
+
}, exports.shuffleArray = He, exports.supportsVibrate = oe, exports.symbolLayout = F, exports.symbolLayout2 = q, exports.themeToCSS = Be, exports.toggleClass = function(e, t, a) {
|
|
2975
|
+
e.classList.toggle(t, a);
|
|
2976
|
+
}, exports.unregisterLayout = function(e) {
|
|
2977
|
+
return e in G && (delete G[e], !0);
|
|
2978
|
+
}, exports.urlLayout = _, exports.verifycodeLayout = Y, exports.vibrate = re;
|
|
2979
|
+
});
|
|
2980
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
|
2981
|
+
//# sourceMappingURL=index.min.js.map
|