@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/es/icons.d.ts
CHANGED
package/es/icons.js
CHANGED
package/es/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","names":[],"sources":["../src/icons.ts"],"sourcesContent":["/**\n * 键盘图标 SVG\n * 使用 Lucide 图标的 SVG 路径\n * @module icons\n */\n\n/**\n * 删除图标 (Delete/Backspace)\n */\nexport const ICON_DELETE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>`\n\n/**\n * 清空图标 (X Circle)\n */\nexport const ICON_CLEAR = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>`\n\n/**\n * 关闭图标 (X)\n */\nexport const ICON_CLOSE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>`\n\n/**\n * 确认图标 (Check)\n */\nexport const ICON_CHECK = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>`\n\n/**\n * 换行图标 (Corner Down Left)\n */\nexport const ICON_ENTER = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>`\n\n/**\n * Shift 图标 (Arrow Big Up)\n */\nexport const ICON_SHIFT = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>`\n\n/**\n * 空格图标 (Space)\n */\nexport const ICON_SPACE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>`\n\n/**\n * 键盘图标 (Keyboard)\n */\nexport const ICON_KEYBOARD = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>`\n\n/**\n * 语音图标 (Mic)\n */\nexport const ICON_VOICE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>`\n\n/**\n * 所有图标映射\n */\nexport const ICONS = {\n delete: ICON_DELETE,\n clear: ICON_CLEAR,\n close: ICON_CLOSE,\n check: ICON_CHECK,\n enter: ICON_ENTER,\n shift: ICON_SHIFT,\n space: ICON_SPACE,\n keyboard: ICON_KEYBOARD,\n voice: ICON_VOICE,\n} as const\n\n/** IconName - 图标名称类型 */\nexport type IconName = keyof typeof ICONS\n"],"mappings":";;;;;;;;;;AASO,MAAM,cAAc;AAKpB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,gBAAgB;AAKtB,MAAM,aAAa;AAKnB,MAAM,QAAQ;CACnB,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../src/icons.ts"],"sourcesContent":["/**\r\n * 键盘图标 SVG\r\n * 使用 Lucide 图标的 SVG 路径\r\n * @module icons\r\n */\r\n\r\n/**\r\n * 删除图标 (Delete/Backspace)\r\n */\r\nexport const ICON_DELETE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>`\r\n\r\n/**\r\n * 清空图标 (X Circle)\r\n */\r\nexport const ICON_CLEAR = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>`\r\n\r\n/**\r\n * 关闭图标 (X)\r\n */\r\nexport const ICON_CLOSE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>`\r\n\r\n/**\r\n * 确认图标 (Check)\r\n */\r\nexport const ICON_CHECK = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>`\r\n\r\n/**\r\n * 换行图标 (Corner Down Left)\r\n */\r\nexport const ICON_ENTER = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>`\r\n\r\n/**\r\n * Shift 图标 (Arrow Big Up)\r\n */\r\nexport const ICON_SHIFT = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>`\r\n\r\n/**\r\n * 空格图标 (Space)\r\n */\r\nexport const ICON_SPACE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>`\r\n\r\n/**\r\n * 键盘图标 (Keyboard)\r\n */\r\nexport const ICON_KEYBOARD = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>`\r\n\r\n/**\r\n * 语音图标 (Mic)\r\n */\r\nexport const ICON_VOICE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>`\r\n\r\n/**\r\n * 所有图标映射\r\n */\r\nexport const ICONS = {\r\n delete: ICON_DELETE,\r\n clear: ICON_CLEAR,\r\n close: ICON_CLOSE,\r\n check: ICON_CHECK,\r\n enter: ICON_ENTER,\r\n shift: ICON_SHIFT,\r\n space: ICON_SPACE,\r\n keyboard: ICON_KEYBOARD,\r\n voice: ICON_VOICE,\r\n} as const\r\n\r\n/** IconName - 图标名称类型 */\r\nexport type IconName = keyof typeof ICONS\r\n"],"mappings":";;;;;;;;;;AASO,MAAM,cAAc;AAKpB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,gBAAgB;AAKtB,MAAM,aAAa;AAKnB,MAAM,QAAQ;CACnB,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,OAAO;AACT"}
|
package/es/index.d.ts
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* LDesign 虚拟键盘 - 框架无关的核心模块
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './icons';
|
|
7
7
|
export * from './layouts';
|
|
8
|
+
export * from './managers';
|
|
9
|
+
export * from './themes';
|
|
8
10
|
export * from './types';
|
|
9
11
|
export * from './utils';
|
|
10
|
-
export * from './themes';
|
|
11
|
-
export * from './icons';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
package/es/index.js
CHANGED
|
@@ -2,35 +2,35 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-core v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:29:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
9
9
|
*/
|
|
10
10
|
import { ICONS, ICON_CHECK, ICON_CLEAR, ICON_CLOSE, ICON_DELETE, ICON_ENTER, ICON_KEYBOARD, ICON_SHIFT, ICON_SPACE, ICON_VOICE } from "./icons.js";
|
|
11
|
-
import { qwertyLayout } from "./layouts/qwerty.js";
|
|
12
|
-
import { integerLayout, numberLayout } from "./layouts/number.js";
|
|
13
|
-
import { symbolLayout, symbolLayout2 } from "./layouts/symbol.js";
|
|
14
|
-
import { PLATE_LETTERS, PROVINCES, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout } from "./layouts/license-plate.js";
|
|
15
|
-
import { idcardLayout } from "./layouts/idcard.js";
|
|
16
|
-
import { phoneLayout, phoneSimpleLayout } from "./layouts/phone.js";
|
|
17
11
|
import { amountLayout, amountSimpleLayout } from "./layouts/amount.js";
|
|
18
12
|
import { bankcardLayout } from "./layouts/bankcard.js";
|
|
19
|
-
import { verifycodeLayout } from "./layouts/verifycode.js";
|
|
20
13
|
import { EMAIL_SUFFIXES, emailLayout } from "./layouts/email.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
14
|
+
import { idcardLayout } from "./layouts/idcard.js";
|
|
15
|
+
import { PLATE_LETTERS, PROVINCES, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout } from "./layouts/license-plate.js";
|
|
16
|
+
import { integerLayout, numberLayout } from "./layouts/number.js";
|
|
17
|
+
import { phoneLayout, phoneSimpleLayout } from "./layouts/phone.js";
|
|
23
18
|
import { punctLayout } from "./layouts/punct.js";
|
|
19
|
+
import { qwertyLayout } from "./layouts/qwerty.js";
|
|
20
|
+
import { searchLayout } from "./layouts/search.js";
|
|
21
|
+
import { symbolLayout, symbolLayout2 } from "./layouts/symbol.js";
|
|
22
|
+
import { urlLayout } from "./layouts/url.js";
|
|
23
|
+
import { verifycodeLayout } from "./layouts/verifycode.js";
|
|
24
24
|
import { getAvailableLayouts, getLayout, hasLayout, registerLayout, registerLayouts, unregisterLayout } from "./layouts/index.js";
|
|
25
|
-
import { EventEmitter } from "./utils/event-emitter.js";
|
|
26
25
|
import { getDeviceType, getSafeAreaInsets, getViewportInfo, isMobile, isMobileUA, isTouchDevice, onViewportChange, supportsVibrate, vibrate } from "./utils/device.js";
|
|
27
|
-
import { createElement, deleteCharBeforeCursor, getBoundingRect, getElementOffset, getInputCursorPosition, insertTextAtCursor, isClickOutside, isElementInViewport, onClickOutside, preventDefaultAndStopPropagation, scrollIntoViewIfNeeded, setInputCursorPosition, setStyles, toggleClass } from "./utils/dom.js";
|
|
26
|
+
import { createElement, deleteCharBeforeCursor, getBoundingRect, getElementOffset, getInputCursorPosition, insertTextAtCursor, isClickOutside, isElementInViewport, onClickOutside, preventDefaultAndStopPropagation, sanitizeSvgIcon, scrollIntoViewIfNeeded, setInputCursorPosition, setStyles, toggleClass } from "./utils/dom.js";
|
|
27
|
+
import { EventEmitter } from "./utils/event-emitter.js";
|
|
28
28
|
import { KeyboardManager, createKeyboardManager } from "./managers/keyboard-manager.js";
|
|
29
|
-
import { PositionManager, createPositionManager } from "./managers/position-manager.js";
|
|
30
29
|
import { darkTheme, defaultTheme, iosTheme, materialTheme, minimalTheme, miuiTheme, presetThemes } from "./themes/presets.js";
|
|
31
30
|
import { applyTheme, createTheme, generateThemeStyle, getAllThemes, getAvailableThemes, getCurrentTheme, getTheme, mergeTheme, registerTheme, setCurrentTheme, themeToCSS } from "./themes/index.js";
|
|
31
|
+
import { PositionManager, createPositionManager } from "./managers/position-manager.js";
|
|
32
32
|
import { KeyboardRenderer, createKeyboardRenderer } from "./managers/keyboard-renderer.js";
|
|
33
|
-
import { createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, refreshRandomLayout, shuffleArray } from "./utils/random.js";
|
|
34
33
|
import { applyFormatter, formatAmount, formatBankCard, formatIdCard, formatLicensePlate, formatPhone, formatVerifyCode, getFormatter, registerFormatter } from "./utils/formatters.js";
|
|
35
|
-
|
|
34
|
+
import { createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, refreshRandomLayout, shuffleArray } from "./utils/random.js";
|
|
35
|
+
export { EMAIL_SUFFIXES, EventEmitter, ICONS, ICON_CHECK, ICON_CLEAR, ICON_CLOSE, ICON_DELETE, ICON_ENTER, ICON_KEYBOARD, ICON_SHIFT, ICON_SPACE, ICON_VOICE, KeyboardManager, KeyboardRenderer, PLATE_LETTERS, PROVINCES, PositionManager, amountLayout, amountSimpleLayout, applyFormatter, applyTheme, bankcardLayout, createElement, createKeyboardManager, createKeyboardRenderer, createPositionManager, createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, createTheme, darkTheme, defaultTheme, deleteCharBeforeCursor, emailLayout, formatAmount, formatBankCard, formatIdCard, formatLicensePlate, formatPhone, formatVerifyCode, generateThemeStyle, getAllThemes, getAvailableLayouts, getAvailableThemes, getBoundingRect, getCurrentTheme, getDeviceType, getElementOffset, getFormatter, getInputCursorPosition, getLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, getSafeAreaInsets, getTheme, getViewportInfo, hasLayout, idcardLayout, insertTextAtCursor, integerLayout, iosTheme, isClickOutside, isElementInViewport, isMobile, isMobileUA, isTouchDevice, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, materialTheme, mergeTheme, minimalTheme, miuiTheme, numberLayout, onClickOutside, onViewportChange, phoneLayout, phoneSimpleLayout, presetThemes, preventDefaultAndStopPropagation, punctLayout, qwertyLayout, refreshRandomLayout, registerFormatter, registerLayout, registerLayouts, registerTheme, sanitizeSvgIcon, scrollIntoViewIfNeeded, searchLayout, setCurrentTheme, setInputCursorPosition, setStyles, shuffleArray, supportsVibrate, symbolLayout, symbolLayout2, themeToCSS, toggleClass, unregisterLayout, urlLayout, verifycodeLayout, vibrate };
|
|
36
36
|
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
package/es/layouts/amount.d.ts
CHANGED
package/es/layouts/amount.js
CHANGED
package/es/layouts/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","names":[],"sources":["../../src/layouts/amount.ts"],"sourcesContent":["/**\n * 金额键盘布局\n * @module layouts/amount\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport {
|
|
1
|
+
{"version":3,"file":"amount.js","names":[],"sources":["../../src/layouts/amount.ts"],"sourcesContent":["/**\r\n * 金额键盘布局\r\n * @module layouts/amount\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `amount-${num}`,\r\n type: 'char',\r\n label: num,\r\n value: num,\r\n className: 'key-num',\r\n }\r\n}\r\n\r\n/**\r\n * 金额键盘配置 - 紧凑4x4布局\r\n */\r\nexport const amountLayout: KeyboardConfig = {\r\n type: 'amount',\r\n name: '金额键盘',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'double-zero',\r\n type: 'char',\r\n label: '00',\r\n value: '00',\r\n className: 'key-num',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'decimal',\r\n type: 'char',\r\n label: '.',\r\n value: '.',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n inputType: 'amount',\r\n decimalPlaces: 2,\r\n },\r\n}\r\n\r\n/**\r\n * 简洁金额键盘 - 紧凑4x4布局\r\n */\r\nexport const amountSimpleLayout: KeyboardConfig = {\r\n type: 'amount-simple',\r\n name: '金额键盘',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'close',\r\n type: 'close',\r\n label: '关闭',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'decimal',\r\n type: 'char',\r\n label: '.',\r\n value: '.',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n inputType: 'amount',\r\n decimalPlaces: 2,\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAKO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ;GACE,WAAW;G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KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,eAAe;CACjB;AACF"}
|
package/es/layouts/bankcard.d.ts
CHANGED
package/es/layouts/bankcard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bankcard.js","names":[],"sources":["../../src/layouts/bankcard.ts"],"sourcesContent":["/**\n * 银行卡键盘布局\n * @module layouts/bankcard\n */\n\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 从图标模块中导入删除键图标和清除键图标\nimport {
|
|
1
|
+
{"version":3,"file":"bankcard.js","names":[],"sources":["../../src/layouts/bankcard.ts"],"sourcesContent":["/**\r\n * 银行卡键盘布局\r\n * @module layouts/bankcard\r\n */\r\n\r\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\n// 从图标模块中导入删除键图标和清除键图标\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n * @param num - 数字字符串(如 '0'-'9')\r\n * @returns 返回一个按键定义对象\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `bankcard-${num}`, // 按键唯一标识符,格式为 bankcard-数字\r\n type: 'char', // 按键类型为字符键\r\n label: num, // 按键上显示的文本\r\n value: num, // 按键按下后输出的值\r\n className: 'key-num', // 按键的 CSS 类名,用于样式定制\r\n }\r\n}\r\n\r\n/**\r\n * 银行卡键盘配置 - 紧凑4x4布局\r\n * 布局结构:\r\n * 第1行: 1 2 3 [退格]\r\n * 第2行: 4 5 6 [清除]\r\n * 第3行: 7 8 9 [关闭]\r\n * 第4行: [ABC] 0 [确定(占2格)]\r\n */\r\nexport const bankcardLayout: KeyboardConfig = {\r\n type: 'bankcard', // 键盘类型标识\r\n name: '银行卡键盘', // 键盘的显示名称\r\n supportShift: false, // 不支持 Shift 切换(纯数字键盘无需切换)\r\n rows: [\r\n // 键盘的行数组\r\n // ---- 第1行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n // 该行包含的按键数组\r\n createNumberKey('1'), // 数字键 1\r\n createNumberKey('2'), // 数字键 2\r\n createNumberKey('3'), // 数字键 3\r\n {\r\n id: 'backspace', // 退格键的唯一标识\r\n type: 'backspace', // 按键类型为退格,删除最后一个字符\r\n icon: ICON_DELETE, // 使用删除图标作为显示内容\r\n label: '', // 无文本标签(由图标替代)\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第2行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('4'), // 数字键 4\r\n createNumberKey('5'), // 数字键 5\r\n createNumberKey('6'), // 数字键 6\r\n {\r\n id: 'clear', // 清除键的唯一标识\r\n type: 'clear', // 按键类型为清除,清空所有输入\r\n icon: ICON_CLEAR, // 使用清除图标作为显示内容\r\n label: '', // 无文本标签\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第3行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('7'), // 数字键 7\r\n createNumberKey('8'), // 数字键 8\r\n createNumberKey('9'), // 数字键 9\r\n {\r\n id: 'close', // 关闭键的唯一标识\r\n type: 'close', // 按键类型为关闭,收起键盘\r\n label: '关闭', // 按钮上显示的文本\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第4行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n {\r\n id: 'switch-qwerty', // 切换到全键盘的按键唯一标识\r\n type: 'tab', // 按键类型为标签页切换\r\n label: 'ABC', // 按钮上显示的文本,提示可切换到字母键盘\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n data: { targetType: 'qwerty' }, // 附加数据,指定切换目标为 QWERTY 全键盘\r\n },\r\n createNumberKey('0'), // 数字键 0\r\n {\r\n id: 'done', // 确定键的唯一标识\r\n type: 'done', // 按键类型为确定,完成输入\r\n label: '确定', // 按钮上显示的文本\r\n width: 2, // 占据 2 个键的宽度\r\n className: 'key-numpad-done', // 确定键的 CSS 类名\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n // 键盘的附加数据\r\n maxLength: 19, // 银行卡号最大输入长度为 19 位\r\n inputType: 'bankcard', // 输入类型标识,用于外部判断\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAUO,MAAM,iBAAiC;CAC5C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EAGJ;GACE,WAAW;GACX,MAAM;IAEJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,SAAS;IAC/B;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EAEJ,WAAW;EACX,WAAW;CACb;AACF"}
|
package/es/layouts/email.d.ts
CHANGED
package/es/layouts/email.js
CHANGED
package/es/layouts/email.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.js","names":[],"sources":["../../src/layouts/email.ts"],"sourcesContent":["/**\n * 邮箱键盘布局\n * @module layouts/email\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport { ICON_DELETE, ICON_SHIFT } from '../icons'\n\n/**\n * 创建字符按键(支持大小写)\n */\nfunction createCharKey(char: string): KeyDefinition {\n return {\n id: `email-char-${char.toLowerCase()}`,\n type: 'char',\n label: { lower: char.toLowerCase(), upper: char.toUpperCase() },\n value: { lower: char.toLowerCase(), upper: char.toUpperCase() },\n }\n}\n\n/**\n * 创建快捷片段按键\n */\nfunction snippet(label: string, id?: string): KeyDefinition {\n return {\n id: id || `email-snippet-${label.replace(/[^a-z0-9]/gi, '')}`,\n type: 'char',\n label,\n value: label,\n className: 'key-snippet',\n }\n}\n\n/**\n * 常见邮箱后缀列表\n */\nexport const EMAIL_SUFFIXES = [\n '@qq.com',\n '@163.com',\n '@126.com',\n '@gmail.com',\n '@outlook.com',\n '@hotmail.com',\n '@sina.com',\n '@sohu.com',\n '@icloud.com',\n '@foxmail.com',\n '@yeah.net',\n '@139.com',\n]\n\nexport const emailLayout: KeyboardConfig = {\n type: 'email',\n name: '邮箱键盘',\n supportShift: true,\n defaultUpperCase: false,\n switchable: ['symbol', 'number'],\n rows: [\n // QWERTY 第一行\n {\n keys: 'qwertyuiop'.split('').map(createCharKey),\n },\n // QWERTY 第二行\n {\n keys: 'asdfghjkl'.split('').map(createCharKey),\n },\n // QWERTY 第三行 + Shift + 退格\n {\n keys: [\n {\n id: 'shift',\n type: 'shift',\n icon: ICON_SHIFT,\n label: '',\n width: 1.5,\n className: 'key-shift',\n },\n ...'zxcvbnm'.split('').map(createCharKey),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 1.5,\n className: 'key-backspace',\n },\n ],\n },\n // 底部行:切换 + @ + 常用邮箱 + 符号 + 空格 + 完成\n {\n keys: [\n {
|
|
1
|
+
{"version":3,"file":"email.js","names":[],"sources":["../../src/layouts/email.ts"],"sourcesContent":["/**\r\n * 邮箱键盘布局\r\n * @module layouts/email\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_DELETE, ICON_SHIFT } from '../icons'\r\n\r\n/**\r\n * 创建字符按键(支持大小写)\r\n */\r\nfunction createCharKey(char: string): KeyDefinition {\r\n return {\r\n id: `email-char-${char.toLowerCase()}`,\r\n type: 'char',\r\n label: { lower: char.toLowerCase(), upper: char.toUpperCase() },\r\n value: { lower: char.toLowerCase(), upper: char.toUpperCase() },\r\n }\r\n}\r\n\r\n/**\r\n * 创建快捷片段按键\r\n */\r\nfunction snippet(label: string, id?: string): KeyDefinition {\r\n return {\r\n id: id || `email-snippet-${label.replace(/[^a-z0-9]/gi, '')}`,\r\n type: 'char',\r\n label,\r\n value: label,\r\n className: 'key-snippet',\r\n }\r\n}\r\n\r\n/**\r\n * 常见邮箱后缀列表\r\n */\r\nexport const EMAIL_SUFFIXES = [\r\n '@qq.com',\r\n '@163.com',\r\n '@126.com',\r\n '@gmail.com',\r\n '@outlook.com',\r\n '@hotmail.com',\r\n '@sina.com',\r\n '@sohu.com',\r\n '@icloud.com',\r\n '@foxmail.com',\r\n '@yeah.net',\r\n '@139.com',\r\n]\r\n\r\nexport const emailLayout: KeyboardConfig = {\r\n type: 'email',\r\n name: '邮箱键盘',\r\n supportShift: true,\r\n defaultUpperCase: false,\r\n switchable: ['symbol', 'number'],\r\n rows: [\r\n // QWERTY 第一行\r\n {\r\n keys: 'qwertyuiop'.split('').map(createCharKey),\r\n },\r\n // QWERTY 第二行\r\n {\r\n keys: 'asdfghjkl'.split('').map(createCharKey),\r\n },\r\n // QWERTY 第三行 + Shift + 退格\r\n {\r\n keys: [\r\n {\r\n id: 'shift',\r\n type: 'shift',\r\n icon: ICON_SHIFT,\r\n label: '',\r\n width: 1.5,\r\n className: 'key-shift',\r\n },\r\n ...'zxcvbnm'.split('').map(createCharKey),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n width: 1.5,\r\n className: 'key-backspace',\r\n },\r\n ],\r\n },\r\n // 底部行:切换 + @ + 常用邮箱 + 符号 + 空格 + 完成\r\n {\r\n keys: [\r\n {\r\n id: 'switch-number',\r\n type: 'tab',\r\n label: '123',\r\n width: 1.25,\r\n className: 'key-switch',\r\n data: { targetType: 'number' },\r\n },\r\n {\r\n id: 'email-at',\r\n type: 'char',\r\n label: '@',\r\n value: '@',\r\n className: 'key-at',\r\n },\r\n {\r\n id: 'email-suffix',\r\n type: 'char',\r\n label: '.com',\r\n value: '',\r\n width: 1.5,\r\n className: 'key-suffix',\r\n options: EMAIL_SUFFIXES,\r\n },\r\n snippet('.', 'email-dot'),\r\n snippet('-', 'email-dash'),\r\n snippet('_', 'email-underscore'),\r\n {\r\n id: 'space',\r\n type: 'space',\r\n label: '',\r\n value: ' ',\r\n width: 2,\r\n className: 'key-space',\r\n },\r\n {\r\n id: 'email-done',\r\n type: 'done',\r\n label: '确定',\r\n width: 1.5,\r\n className: 'key-done',\r\n },\r\n ],\r\n },\r\n ],\r\n}\r\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,cAAc,MAA6B;CAClD,OAAO;EACL,IAAI,cAAc,KAAK,YAAY;EACnC,MAAM;EACN,OAAO;GAAE,OAAO,KAAK,YAAY;GAAG,OAAO,KAAK,YA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IACJ,MAAM;IACN,OAAO;IACP,OAAO;IACP,WAAW;GACb;EACF,EACF;CACF;AACF"}
|
package/es/layouts/idcard.d.ts
CHANGED
package/es/layouts/idcard.js
CHANGED
package/es/layouts/idcard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idcard.js","names":[],"sources":["../../src/layouts/idcard.ts"],"sourcesContent":["/**\n * 身份证号键盘布局\n * @module layouts/idcard\n */\n\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 从图标模块中导入删除键图标和清除键图标\nimport {
|
|
1
|
+
{"version":3,"file":"idcard.js","names":[],"sources":["../../src/layouts/idcard.ts"],"sourcesContent":["/**\r\n * 身份证号键盘布局\r\n * @module layouts/idcard\r\n */\r\n\r\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\n// 从图标模块中导入删除键图标和清除键图标\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n * @param num - 数字字符串(如 '0'-'9')\r\n * @returns 返回一个按键定义对象\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `idcard-${num}`, // 按键唯一标识符,格式为 idcard-数字\r\n type: 'char', // 按键类型为字符键\r\n label: num, // 按键上显示的文本\r\n value: num, // 按键按下后输出的值\r\n className: 'key-num', // 按键的 CSS 类名,用于样式定制\r\n }\r\n}\r\n\r\n/**\r\n * 身份证号键盘配置\r\n * 紧凑3x4布局,无空白位置\r\n * 布局结构:\r\n * 第1行: 1 2 3 [退格]\r\n * 第2行: 4 5 6 [清除]\r\n * 第3行: 7 8 9 X\r\n * 第4行: [关闭] 0 [确定(占2格)]\r\n */\r\nexport const idcardLayout: KeyboardConfig = {\r\n type: 'idcard', // 键盘类型标识\r\n name: '身份证键盘', // 键盘的显示名称\r\n supportShift: false, // 不支持 Shift 切换(纯数字+X键盘无需切换)\r\n rows: [\r\n // 键盘的行数组\r\n // ---- 第1行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n // 该行包含的按键数组\r\n createNumberKey('1'), // 数字键 1\r\n createNumberKey('2'), // 数字键 2\r\n createNumberKey('3'), // 数字键 3\r\n {\r\n id: 'backspace', // 退格键的唯一标识\r\n type: 'backspace', // 按键类型为退格,删除最后一个字符\r\n icon: ICON_DELETE, // 使用删除图标作为显示内容\r\n label: '', // 无文本标签(由图标替代)\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第2行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('4'), // 数字键 4\r\n createNumberKey('5'), // 数字键 5\r\n createNumberKey('6'), // 数字键 6\r\n {\r\n id: 'clear', // 清除键的唯一标识\r\n type: 'clear', // 按键类型为清除,清空所有输入\r\n icon: ICON_CLEAR, // 使用清除图标作为显示内容\r\n label: '', // 无文本标签\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第3行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('7'), // 数字键 7\r\n createNumberKey('8'), // 数字键 8\r\n createNumberKey('9'), // 数字键 9\r\n {\r\n id: 'idcard-x', // X 键的唯一标识\r\n type: 'char', // 按键类型为字符\r\n label: 'X', // 按钮上显示的文本(身份证尾号可能是X)\r\n value: 'X', // 按下后输出的值\r\n className: 'key-num', // 使用数字键的 CSS 类名,保持外观一致\r\n },\r\n ],\r\n },\r\n // ---- 第4行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n {\r\n id: 'close', // 关闭键的唯一标识\r\n type: 'close', // 按键类型为关闭,收起键盘\r\n label: '关闭', // 按钮上显示的文本\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n createNumberKey('0'), // 数字键 0\r\n {\r\n id: 'done', // 确定键的唯一标识\r\n type: 'done', // 按键类型为确定,完成输入\r\n label: '确定', // 按钮上显示的文本\r\n width: 2, // 占据 2 个键的宽度\r\n className: 'key-numpad-done', // 确定键的 CSS 类名\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n // 键盘的附加数据\r\n maxLength: 18, // 身份证号最大输入长度为 18 位\r\n inputType: 'idcard', // 输入类型标识,用于外部判断\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAWO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EAGJ;GACE,WAAW;GACX,MAAM;IAEJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EAEJ,WAAW;EACX,WAAW;CACb;AACF"}
|
package/es/layouts/index.d.ts
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* @module layouts
|
|
4
4
|
*/
|
|
5
5
|
import type { KeyboardConfig, KeyboardType } from '../types';
|
|
6
|
-
import { qwertyLayout } from './qwerty';
|
|
7
|
-
import { integerLayout, numberLayout } from './number';
|
|
8
|
-
import { symbolLayout, symbolLayout2 } from './symbol';
|
|
9
|
-
import { licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, PLATE_LETTERS, PROVINCES } from './license-plate';
|
|
10
|
-
import { idcardLayout } from './idcard';
|
|
11
|
-
import { phoneLayout, phoneSimpleLayout } from './phone';
|
|
12
6
|
import { amountLayout, amountSimpleLayout } from './amount';
|
|
13
7
|
import { bankcardLayout } from './bankcard';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
8
|
+
import { EMAIL_SUFFIXES, emailLayout } from './email';
|
|
9
|
+
import { idcardLayout } from './idcard';
|
|
10
|
+
import { licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, PLATE_LETTERS, PROVINCES } from './license-plate';
|
|
11
|
+
import { integerLayout, numberLayout } from './number';
|
|
12
|
+
import { phoneLayout, phoneSimpleLayout } from './phone';
|
|
18
13
|
import { punctLayout } from './punct';
|
|
19
|
-
|
|
14
|
+
import { qwertyLayout } from './qwerty';
|
|
15
|
+
import { searchLayout } from './search';
|
|
16
|
+
import { symbolLayout, symbolLayout2 } from './symbol';
|
|
17
|
+
import { urlLayout } from './url';
|
|
18
|
+
import { verifycodeLayout } from './verifycode';
|
|
19
|
+
export { amountLayout, amountSimpleLayout, bankcardLayout, EMAIL_SUFFIXES, emailLayout, idcardLayout, integerLayout, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, numberLayout, phoneLayout, phoneSimpleLayout, PLATE_LETTERS, PROVINCES, punctLayout, qwertyLayout, searchLayout, symbolLayout, symbolLayout2, urlLayout, verifycodeLayout, };
|
|
20
20
|
/**
|
|
21
21
|
* 注册自定义布局
|
|
22
22
|
* @param name - 布局名称
|
|
@@ -51,4 +51,3 @@ export declare function unregisterLayout(name: string): boolean;
|
|
|
51
51
|
* @param layouts - 布局映射对象
|
|
52
52
|
*/
|
|
53
53
|
export declare function registerLayouts(layouts: Record<string, KeyboardConfig>): void;
|
|
54
|
-
//# sourceMappingURL=index.d.ts.map
|
package/es/layouts/index.js
CHANGED
|
@@ -2,46 +2,46 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-core v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:29:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
9
9
|
*/
|
|
10
|
-
import { qwertyLayout } from "./qwerty.js";
|
|
11
|
-
import { integerLayout, numberLayout } from "./number.js";
|
|
12
|
-
import { symbolLayout, symbolLayout2 } from "./symbol.js";
|
|
13
|
-
import { PLATE_LETTERS, PROVINCES, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout } from "./license-plate.js";
|
|
14
|
-
import { idcardLayout } from "./idcard.js";
|
|
15
|
-
import { phoneLayout, phoneSimpleLayout } from "./phone.js";
|
|
16
10
|
import { amountLayout, amountSimpleLayout } from "./amount.js";
|
|
17
11
|
import { bankcardLayout } from "./bankcard.js";
|
|
18
|
-
import { verifycodeLayout } from "./verifycode.js";
|
|
19
12
|
import { EMAIL_SUFFIXES, emailLayout } from "./email.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
13
|
+
import { idcardLayout } from "./idcard.js";
|
|
14
|
+
import { PLATE_LETTERS, PROVINCES, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout } from "./license-plate.js";
|
|
15
|
+
import { integerLayout, numberLayout } from "./number.js";
|
|
16
|
+
import { phoneLayout, phoneSimpleLayout } from "./phone.js";
|
|
22
17
|
import { punctLayout } from "./punct.js";
|
|
18
|
+
import { qwertyLayout } from "./qwerty.js";
|
|
19
|
+
import { searchLayout } from "./search.js";
|
|
20
|
+
import { symbolLayout, symbolLayout2 } from "./symbol.js";
|
|
21
|
+
import { urlLayout } from "./url.js";
|
|
22
|
+
import { verifycodeLayout } from "./verifycode.js";
|
|
23
23
|
//#region src/layouts/index.ts
|
|
24
24
|
const builtinLayouts = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
qwerty: qwertyLayout,
|
|
26
|
+
number: numberLayout,
|
|
27
|
+
integer: integerLayout,
|
|
28
|
+
symbol: symbolLayout,
|
|
29
29
|
"symbol-2": symbolLayout2,
|
|
30
30
|
"license-plate": licensePlateLayout,
|
|
31
31
|
"license-plate-province": licensePlateProvinceLayout,
|
|
32
32
|
"license-plate-letter": licensePlateLetterLayout,
|
|
33
33
|
"license-plate-alphanumeric": licensePlateAlphanumericLayout,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
idcard: idcardLayout,
|
|
35
|
+
phone: phoneLayout,
|
|
36
36
|
"phone-simple": phoneSimpleLayout,
|
|
37
|
-
|
|
37
|
+
amount: amountLayout,
|
|
38
38
|
"amount-simple": amountSimpleLayout,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
bankcard: bankcardLayout,
|
|
40
|
+
verifycode: verifycodeLayout,
|
|
41
|
+
email: emailLayout,
|
|
42
|
+
url: urlLayout,
|
|
43
|
+
search: searchLayout,
|
|
44
|
+
punct: punctLayout
|
|
45
45
|
};
|
|
46
46
|
const customLayouts = {};
|
|
47
47
|
function registerLayout(name, layout) {
|
package/es/layouts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/layouts/index.ts"],"sourcesContent":["/**\n * 键盘布局管理\n * @module layouts\n */\n\nimport type { KeyboardConfig, KeyboardType } from '../types'\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/layouts/index.ts"],"sourcesContent":["/**\r\n * 键盘布局管理\r\n * @module layouts\r\n */\r\n\r\nimport type { KeyboardConfig, KeyboardType } from '../types'\r\nimport { amountLayout, amountSimpleLayout } from './amount'\r\nimport { bankcardLayout } from './bankcard'\r\nimport { EMAIL_SUFFIXES, emailLayout } from './email'\r\nimport { idcardLayout } from './idcard'\r\nimport {\r\n licensePlateAlphanumericLayout,\r\n licensePlateLayout,\r\n licensePlateLetterLayout,\r\n licensePlateProvinceLayout,\r\n PLATE_LETTERS,\r\n PROVINCES,\r\n} from './license-plate'\r\nimport { integerLayout, numberLayout } from './number'\r\nimport { phoneLayout, phoneSimpleLayout } from './phone'\r\nimport { punctLayout } from './punct'\r\nimport { qwertyLayout } from './qwerty'\r\nimport { searchLayout } from './search'\r\nimport { symbolLayout, symbolLayout2 } from './symbol'\r\nimport { urlLayout } from './url'\r\nimport { verifycodeLayout } from './verifycode'\r\n\r\n// 导出所有布局\r\nexport {\r\n amountLayout,\r\n amountSimpleLayout,\r\n bankcardLayout,\r\n EMAIL_SUFFIXES,\r\n // 输入场景键盘\r\n emailLayout,\r\n // 场景化键盘\r\n idcardLayout,\r\n integerLayout,\r\n licensePlateAlphanumericLayout,\r\n licensePlateLayout,\r\n licensePlateLetterLayout,\r\n licensePlateProvinceLayout,\r\n numberLayout,\r\n phoneLayout,\r\n phoneSimpleLayout,\r\n PLATE_LETTERS,\r\n PROVINCES,\r\n // 标点键盘\r\n punctLayout,\r\n qwertyLayout,\r\n searchLayout,\r\n symbolLayout,\r\n symbolLayout2,\r\n urlLayout,\r\n verifycodeLayout,\r\n}\r\n\r\n/**\r\n * 内置布局映射\r\n */\r\nconst builtinLayouts: Record<string, KeyboardConfig> = {\r\n qwerty: qwertyLayout,\r\n number: numberLayout,\r\n integer: integerLayout,\r\n symbol: symbolLayout,\r\n 'symbol-2': symbolLayout2,\r\n 'license-plate': licensePlateLayout,\r\n 'license-plate-province': licensePlateProvinceLayout,\r\n 'license-plate-letter': licensePlateLetterLayout,\r\n 'license-plate-alphanumeric': licensePlateAlphanumericLayout,\r\n // 场景化键盘\r\n idcard: idcardLayout,\r\n phone: phoneLayout,\r\n 'phone-simple': phoneSimpleLayout,\r\n amount: amountLayout,\r\n 'amount-simple': amountSimpleLayout,\r\n bankcard: bankcardLayout,\r\n verifycode: verifycodeLayout,\r\n // 输入场景键盘\r\n email: emailLayout,\r\n url: urlLayout,\r\n search: searchLayout,\r\n // 标点键盘\r\n punct: punctLayout,\r\n}\r\n\r\n/**\r\n * 自定义布局存储\r\n */\r\nconst customLayouts: Record<string, KeyboardConfig> = {}\r\n\r\n/**\r\n * 注册自定义布局\r\n * @param name - 布局名称\r\n * @param layout - 布局配置\r\n */\r\nexport function registerLayout(name: string, layout: KeyboardConfig): void {\r\n if (builtinLayouts[name]) {\r\n console.warn(`[Keyboard] Cannot override builtin layout \"${name}\"`)\r\n return\r\n }\r\n customLayouts[name] = layout\r\n}\r\n\r\n/**\r\n * 获取布局配置\r\n * @param type - 键盘类型或布局名称\r\n * @returns 布局配置,如果不存在则返回 undefined\r\n */\r\nexport function getLayout(\r\n type: KeyboardType | string\r\n): KeyboardConfig | undefined {\r\n return customLayouts[type] || builtinLayouts[type]\r\n}\r\n\r\n/**\r\n * 获取所有可用布局名称\r\n * @returns 布局名称数组\r\n */\r\nexport function getAvailableLayouts(): string[] {\r\n return [...Object.keys(builtinLayouts), ...Object.keys(customLayouts)]\r\n}\r\n\r\n/**\r\n * 检查布局是否存在\r\n * @param name - 布局名称\r\n * @returns 是否存在\r\n */\r\nexport function hasLayout(name: string): boolean {\r\n return name in builtinLayouts || name in customLayouts\r\n}\r\n\r\n/**\r\n * 移除自定义布局\r\n * @param name - 布局名称\r\n * @returns 是否成功移除\r\n */\r\nexport function unregisterLayout(name: string): boolean {\r\n if (name in customLayouts) {\r\n delete customLayouts[name]\r\n return true\r\n }\r\n return false\r\n}\r\n\r\n/**\r\n * 批量注册布局\r\n * @param layouts - 布局映射对象\r\n */\r\nexport function registerLayouts(layouts: Record<string, KeyboardConfig>): void {\r\n Object.entries(layouts).forEach(([name, layout]) => {\r\n registerLayout(name, layout)\r\n })\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,iBAAiD;CACrD,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,YAAY;CACZ,iBAAiB;CACjB,0BAA0B;CAC1B,wBAAwB;CACxB,8BAA8B;CAE9B,QAAQ;CACR,OAAO;CACP,gBAAgB;CAChB,QAAQ;CACR,iBAAiB;CACjB,UAAU;CACV,YAAY;CAEZ,OAAO;CACP,KAAK;CACL,QAAQ;CAER,OAAO;AACT;AAKA,MAAM,gBAAgD,CAAC;AAOhD,SAAS,eAAe,MAAc,QAA8B;CACzE,IAAI,eAAe,OAAO;EACxB,QAAQ,KAAK,8CAA8C,KAAI,EAAG;EAClE;CACF;CACA,cAAc,QAAQ;AACxB;AAOO,SAAS,UACd,MAC4B;CAC5B,OAAO,cAAc,SAAS,eAAe;AAC/C;AAMO,SAAS,sBAAgC;CAC9C,OAAO,CAAC,GAAG,OAAO,KAAK,cAAc,GAAG,GAAG,OAAO,KAAK,aAAa,CAAC;AACvE;AAOO,SAAS,UAAU,MAAuB;CAC/C,OAAO,QAAQ,kBAAkB,QAAQ;AAC3C;AAOO,SAAS,iBAAiB,MAAuB;CACtD,IAAI,QAAQ,eAAe;EACzB,OAAO,cAAc;EACrB,OAAO;CACT;CACA,OAAO;AACT;AAMO,SAAS,gBAAgB,SAA+C;CAC7E,OAAO,QAAQ,OAAO,CAAA,CAAE,SAAS,CAAC,MAAM,YAAY;EAClD,eAAe,MAAM,MAAM;CAC7B,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license-plate.js","names":[],"sources":["../../src/layouts/license-plate.ts"],"sourcesContent":["/**\n * 车牌号键盘布局\n * @module layouts/license-plate\n * 省份键盘类似26键布局,点击省份后自动切换到字母数字键盘\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport { ICON_DELETE } from '../icons'\n\n/**\n * 省份简称列表(按地理区域排列,10列布局)\n */\nexport const PROVINCES = [\n '京', '津', '沪', '渝', '冀', '豫', '云', '辽', '黑', '湘',\n '皖', '鲁', '新', '苏', '浙', '赣', '鄂', '桂', '甘', '晋',\n '蒙', '陕', '吉', '闽', '贵', '粤', '青', '藏', '川', '宁',\n '琼', '港', '澳',\n]\n\n/**\n * 车牌字母(排除 I 和 O,避免与数字混淆)\n */\nexport const PLATE_LETTERS = [\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',\n 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',\n 'W', 'X', 'Y', 'Z',\n]\n\n/**\n * 创建省份按键(点击后自动切换到字母数字键盘)\n */\nfunction createProvinceKey(province: string): KeyDefinition {\n return {\n id: `province-${province}`,\n type: 'char',\n label: province,\n value: province,\n className: 'key-plate-province',\n data: { switchAfterInput: 'license-plate-alphanumeric' },\n }\n}\n\n/**\n * 创建字母按键\n */\nfunction createLetterKey(letter: string): KeyDefinition {\n return {\n id: `letter-${letter}`,\n type: 'char',\n label: letter,\n value: letter,\n className: 'key-plate-letter',\n }\n}\n\n/**\n * 创建数字按键\n */\nfunction createNumberKey(num: string): KeyDefinition {\n return {\n id: `num-${num}`,\n type: 'char',\n label: num,\n value: num,\n className: 'key-plate-number',\n }\n}\n\n/**\n * 省份键盘配置 - 类似26键布局\n * 10列布局,更紧凑美观\n */\nexport const licensePlateProvinceLayout: KeyboardConfig = {\n type: 'license-plate-province',\n name: '省份简称',\n supportShift: false,\n rows: [\n {\n className: 'plate-keyboard-row',\n keys: PROVINCES.slice(0, 10).map(createProvinceKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PROVINCES.slice(10, 20).map(createProvinceKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PROVINCES.slice(20, 30).map(createProvinceKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n ...PROVINCES.slice(30, 33).map(createProvinceKey),\n {\n id: 'plate-xue',\n type: 'char',\n label: '学',\n value: '学',\n className: 'key-plate-special',\n data: { switchAfterInput: 'license-plate-alphanumeric' },\n },\n {\n id: 'plate-jing',\n type: 'char',\n label: '警',\n value: '警',\n className: 'key-plate-special',\n data: { switchAfterInput: 'license-plate-alphanumeric' },\n },\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 1.5,\n className: 'key-plate-fn',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 2.5,\n className: 'key-plate-done',\n },\n ],\n },\n ],\n data: {\n maxLength: 8,\n inputType: 'license-plate',\n },\n}\n\n/**\n * 字母数字键盘配置(车牌第2-8位)\n * 10列布局\n */\nexport const licensePlateAlphanumericLayout: KeyboardConfig = {\n type: 'license-plate-alphanumeric',\n name: '字母数字',\n supportShift: false,\n rows: [\n {\n className: 'plate-keyboard-row',\n keys: '1234567890'.split('').map(createNumberKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PLATE_LETTERS.slice(0, 10).map(createLetterKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n ...PLATE_LETTERS.slice(10, 19).map(createLetterKey),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n className: 'key-plate-fn',\n },\n ],\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n {\n id: 'switch-province',\n type: 'tab',\n label: '省份',\n width: 1.5,\n className: 'key-plate-switch',\n data: { targetType: 'license-plate-province' },\n },\n ...PLATE_LETTERS.slice(19, 24).map(createLetterKey),\n {\n id: 'plate-xue',\n type: 'char',\n label: '学',\n value: '学',\n className: 'key-plate-special',\n },\n {\n id: 'plate-jing',\n type: 'char',\n label: '警',\n value: '警',\n className: 'key-plate-special',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 1.5,\n className: 'key-plate-done',\n },\n ],\n },\n ],\n data: {\n maxLength: 8,\n inputType: 'license-plate',\n },\n}\n\n/**\n * 纯字母键盘配置(车牌第2位,只能输入字母)\n * 6列布局,排除 I 和 O\n */\nexport const licensePlateLetterLayout: KeyboardConfig = {\n type: 'license-plate-letter',\n name: '字母',\n supportShift: false,\n rows: [\n {\n className: 'plate-keyboard-row',\n keys: PLATE_LETTERS.slice(0, 8).map(createLetterKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PLATE_LETTERS.slice(8, 16).map(createLetterKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n ...PLATE_LETTERS.slice(16, 24).map(createLetterKey),\n ],\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n {\n id: 'switch-province',\n type: 'tab',\n label: '省份',\n width: 2,\n className: 'key-plate-switch',\n data: { targetType: 'license-plate-province' },\n },\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 2,\n className: 'key-plate-fn',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 2,\n className: 'key-plate-done',\n },\n ],\n },\n ],\n data: {\n maxLength: 8,\n inputType: 'license-plate',\n },\n}\n\n/**\n * 完整车牌号键盘(自动切换模式)\n * 默认显示省份键盘,点击省份后自动切换到字母数字键盘\n */\nexport const licensePlateLayout: KeyboardConfig = {\n type: 'license-plate',\n name: '车牌号键盘',\n supportShift: false,\n data: {\n autoSwitch: true,\n maxLength: 8,\n inputType: 'license-plate',\n },\n rows: licensePlateProvinceLayout.rows,\n}\n"],"mappings":";;;;;;;;;;;AAYO,MAAM,YAAY;CACvB;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAC7C;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAA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E,IAAI,eAAe;EACtD;EACA;GACE,WAAW;GACX,MAAM,CACJ,GAAG,cAAc,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,eAAe,CACpD;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,yBAAyB;IAC/C;IACA;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF;AAMO,MAAM,qBAAqC;CAChD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,WAAW;CACb;CACA,MAAM,2BAA2B;AACnC"}
|
|
1
|
+
{"version":3,"file":"license-plate.js","names":[],"sources":["../../src/layouts/license-plate.ts"],"sourcesContent":["/**\r\n * 车牌号键盘布局\r\n * @module layouts/license-plate\r\n * 省份键盘类似26键布局,点击省份后自动切换到字母数字键盘\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 省份简称列表(按地理区域排列,10列布局)\r\n */\r\nexport const PROVINCES = [\r\n '京',\r\n '津',\r\n '沪',\r\n '渝',\r\n '冀',\r\n '豫',\r\n '云',\r\n '辽',\r\n '黑',\r\n '湘',\r\n '皖',\r\n '鲁',\r\n '新',\r\n '苏',\r\n '浙',\r\n '赣',\r\n '鄂',\r\n '桂',\r\n '甘',\r\n '晋',\r\n '蒙',\r\n '陕',\r\n '吉',\r\n '闽',\r\n '贵',\r\n '粤',\r\n '青',\r\n '藏',\r\n '川',\r\n '宁',\r\n '琼',\r\n '港',\r\n '澳',\r\n]\r\n\r\n/**\r\n * 车牌字母(排除 I 和 O,避免与数字混淆)\r\n */\r\nexport const PLATE_LETTERS = [\r\n 'A',\r\n 'B',\r\n 'C',\r\n 'D',\r\n 'E',\r\n 'F',\r\n 'G',\r\n 'H',\r\n 'J',\r\n 'K',\r\n 'L',\r\n 'M',\r\n 'N',\r\n 'P',\r\n 'Q',\r\n 'R',\r\n 'S',\r\n 'T',\r\n 'U',\r\n 'V',\r\n 'W',\r\n 'X',\r\n 'Y',\r\n 'Z',\r\n]\r\n\r\n/**\r\n * 创建省份按键(点击后自动切换到字母数字键盘)\r\n */\r\nfunction createProvinceKey(province: string): KeyDefinition {\r\n return {\r\n id: `province-${province}`,\r\n type: 'char',\r\n label: province,\r\n value: province,\r\n className: 'key-plate-province',\r\n data: { switchAfterInput: 'license-plate-alphanumeric' },\r\n }\r\n}\r\n\r\n/**\r\n * 创建字母按键\r\n */\r\nfunction createLetterKey(letter: string): KeyDefinition {\r\n return {\r\n id: `letter-${letter}`,\r\n type: 'char',\r\n label: letter,\r\n value: letter,\r\n className: 'key-plate-letter',\r\n }\r\n}\r\n\r\n/**\r\n * 创建数字按键\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `num-${num}`,\r\n type: 'char',\r\n label: num,\r\n value: num,\r\n className: 'key-plate-number',\r\n }\r\n}\r\n\r\n/**\r\n * 省份键盘配置 - 类似26键布局\r\n * 10列布局,更紧凑美观\r\n */\r\nexport const licensePlateProvinceLayout: KeyboardConfig = {\r\n type: 'license-plate-province',\r\n name: '省份简称',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PROVINCES.slice(0, 10).map(createProvinceKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PROVINCES.slice(10, 20).map(createProvinceKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PROVINCES.slice(20, 30).map(createProvinceKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n ...PROVINCES.slice(30, 33).map(createProvinceKey),\r\n {\r\n id: 'plate-xue',\r\n type: 'char',\r\n label: '学',\r\n value: '学',\r\n className: 'key-plate-special',\r\n data: { switchAfterInput: 'license-plate-alphanumeric' },\r\n },\r\n {\r\n id: 'plate-jing',\r\n type: 'char',\r\n label: '警',\r\n value: '警',\r\n className: 'key-plate-special',\r\n data: { switchAfterInput: 'license-plate-alphanumeric' },\r\n },\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n width: 1.5,\r\n className: 'key-plate-fn',\r\n },\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2.5,\r\n className: 'key-plate-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n}\r\n\r\n/**\r\n * 字母数字键盘配置(车牌第2-8位)\r\n * 10列布局\r\n */\r\nexport const licensePlateAlphanumericLayout: KeyboardConfig = {\r\n type: 'license-plate-alphanumeric',\r\n name: '字母数字',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: '1234567890'.split('').map(createNumberKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PLATE_LETTERS.slice(0, 10).map(createLetterKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n ...PLATE_LETTERS.slice(10, 19).map(createLetterKey),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-plate-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n {\r\n id: 'switch-province',\r\n type: 'tab',\r\n label: '省份',\r\n width: 1.5,\r\n className: 'key-plate-switch',\r\n data: { targetType: 'license-plate-province' },\r\n },\r\n ...PLATE_LETTERS.slice(19, 24).map(createLetterKey),\r\n {\r\n id: 'plate-xue',\r\n type: 'char',\r\n label: '学',\r\n value: '学',\r\n className: 'key-plate-special',\r\n },\r\n {\r\n id: 'plate-jing',\r\n type: 'char',\r\n label: '警',\r\n value: '警',\r\n className: 'key-plate-special',\r\n },\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 1.5,\r\n className: 'key-plate-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n}\r\n\r\n/**\r\n * 纯字母键盘配置(车牌第2位,只能输入字母)\r\n * 6列布局,排除 I 和 O\r\n */\r\nexport const licensePlateLetterLayout: KeyboardConfig = {\r\n type: 'license-plate-letter',\r\n name: '字母',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PLATE_LETTERS.slice(0, 8).map(createLetterKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PLATE_LETTERS.slice(8, 16).map(createLetterKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [...PLATE_LETTERS.slice(16, 24).map(createLetterKey)],\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n {\r\n id: 'switch-province',\r\n type: 'tab',\r\n label: '省份',\r\n width: 2,\r\n className: 'key-plate-switch',\r\n data: { targetType: 'license-plate-province' },\r\n },\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n width: 2,\r\n className: 'key-plate-fn',\r\n },\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-plate-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n}\r\n\r\n/**\r\n * 完整车牌号键盘(自动切换模式)\r\n * 默认显示省份键盘,点击省份后自动切换到字母数字键盘\r\n */\r\nexport const licensePlateLayout: KeyboardConfig = {\r\n type: 'license-plate',\r\n name: '车牌号键盘',\r\n supportShift: false,\r\n data: {\r\n autoSwitch: true,\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n rows: licensePlateProvinceLayout.rows,\r\n}\r\n"],"mappings":";;;;;;;;;;;AAYO,MAAM,YAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKO,MAAM,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,SAAS,kBAAkB,UAAiC;CAC1D,OAAO;EACL,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;EACX,MAAM,EAAE,kBAAkB,6BAA6B;CACzD;AACF;AAKA,SAAS,gBAAgB,QAA+B;CACtD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAKA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,OAAO;EACX,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAMO,MAAM,6BAA6C;CACxD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ;GACE,WAAW;GACX,MAAM,UAAU,MAAM,GAAG,EAAE,CAAA,CAAE,IAAI,iBAAiB;EACpD;EACA;GACE,WAAW;GACX,MAAM,UAAU,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,iBAAiB;EACrD;EACA;GACE,WAAW;GACX,MAAM,UAAU,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,iBAAiB;EACrD;EACA;GACE,WAAW;GACX,MAAM;IACJ,GAAG,UAAU,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,iBAAiB;IAChD;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP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c;CACd,MAAM;EACJ;GACE,WAAW;GACX,MAAM,cAAc,MAAM,GAAG,CAAC,CAAA,CAAE,IAAI,eAAe;EACrD;EACA;GACE,WAAW;GACX,MAAM,cAAc,MAAM,GAAG,EAAE,CAAA,CAAE,IAAI,eAAe;EACtD;EACA;GACE,WAAW;GACX,MAAM,CAAC,GAAG,cAAc,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,eAAe,CAAC;EAC5D;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,yBAAyB;IAC/C;IACA;KACE,IAAI;KACJ,MAAM;KACN,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF;AAMO,MAAM,qBAAqC;CAChD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,WAAW;CACb;CACA,MAAM,2BAA2B;AACnC"}
|
package/es/layouts/number.d.ts
CHANGED
package/es/layouts/number.js
CHANGED