@composy/keyboard-core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/index.js +3605 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/es/icons.d.ts +58 -0
- package/es/icons.d.ts.map +1 -0
- package/es/icons.js +34 -0
- package/es/icons.js.map +1 -0
- package/es/index.d.ts +12 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +36 -0
- package/es/layouts/amount.d.ts +14 -0
- package/es/layouts/amount.d.ts.map +1 -0
- package/es/layouts/amount.js +175 -0
- package/es/layouts/amount.js.map +1 -0
- package/es/layouts/bankcard.d.ts +15 -0
- package/es/layouts/bankcard.d.ts.map +1 -0
- package/es/layouts/bankcard.js +99 -0
- package/es/layouts/bankcard.js.map +1 -0
- package/es/layouts/email.d.ts +11 -0
- package/es/layouts/email.d.ts.map +1 -0
- package/es/layouts/email.js +126 -0
- package/es/layouts/email.js.map +1 -0
- package/es/layouts/idcard.d.ts +16 -0
- package/es/layouts/idcard.d.ts.map +1 -0
- package/es/layouts/idcard.js +99 -0
- package/es/layouts/idcard.js.map +1 -0
- package/es/layouts/index.d.ts +54 -0
- package/es/layouts/index.d.ts.map +1 -0
- package/es/layouts/index.js +78 -0
- package/es/layouts/index.js.map +1 -0
- package/es/layouts/license-plate.d.ts +35 -0
- package/es/layouts/license-plate.d.ts.map +1 -0
- package/es/layouts/license-plate.js +290 -0
- package/es/layouts/license-plate.js.map +1 -0
- package/es/layouts/number.d.ts +14 -0
- package/es/layouts/number.d.ts.map +1 -0
- package/es/layouts/number.js +168 -0
- package/es/layouts/number.js.map +1 -0
- package/es/layouts/phone.d.ts +15 -0
- package/es/layouts/phone.d.ts.map +1 -0
- package/es/layouts/phone.js +175 -0
- package/es/layouts/phone.js.map +1 -0
- package/es/layouts/punct.d.ts +7 -0
- package/es/layouts/punct.d.ts.map +1 -0
- package/es/layouts/punct.js +112 -0
- package/es/layouts/punct.js.map +1 -0
- package/es/layouts/qwerty.d.ts +10 -0
- package/es/layouts/qwerty.d.ts.map +1 -0
- package/es/layouts/qwerty.js +116 -0
- package/es/layouts/qwerty.js.map +1 -0
- package/es/layouts/search.d.ts +7 -0
- package/es/layouts/search.d.ts.map +1 -0
- package/es/layouts/search.js +101 -0
- package/es/layouts/search.js.map +1 -0
- package/es/layouts/symbol.d.ts +14 -0
- package/es/layouts/symbol.d.ts.map +1 -0
- package/es/layouts/symbol.js +194 -0
- package/es/layouts/symbol.js.map +1 -0
- package/es/layouts/url.d.ts +7 -0
- package/es/layouts/url.d.ts.map +1 -0
- package/es/layouts/url.js +99 -0
- package/es/layouts/url.js.map +1 -0
- package/es/layouts/verifycode.d.ts +15 -0
- package/es/layouts/verifycode.d.ts.map +1 -0
- package/es/layouts/verifycode.js +100 -0
- package/es/layouts/verifycode.js.map +1 -0
- package/es/managers/index.d.ts +8 -0
- package/es/managers/index.d.ts.map +1 -0
- package/es/managers/index.js +14 -0
- package/es/managers/keyboard-manager.d.ts +130 -0
- package/es/managers/keyboard-manager.d.ts.map +1 -0
- package/es/managers/keyboard-manager.js +374 -0
- package/es/managers/keyboard-manager.js.map +1 -0
- package/es/managers/keyboard-renderer.d.ts +115 -0
- package/es/managers/keyboard-renderer.d.ts.map +1 -0
- package/es/managers/keyboard-renderer.js +283 -0
- package/es/managers/keyboard-renderer.js.map +1 -0
- package/es/managers/position-manager.d.ts +72 -0
- package/es/managers/position-manager.d.ts.map +1 -0
- package/es/managers/position-manager.js +199 -0
- package/es/managers/position-manager.js.map +1 -0
- package/es/themes/index.d.ts +70 -0
- package/es/themes/index.d.ts.map +1 -0
- package/es/themes/index.js +99 -0
- package/es/themes/index.js.map +1 -0
- package/es/themes/presets.d.ts +39 -0
- package/es/themes/presets.d.ts.map +1 -0
- package/es/themes/presets.js +207 -0
- package/es/themes/presets.js.map +1 -0
- package/es/themes/types.d.ts +118 -0
- package/es/themes/types.d.ts.map +1 -0
- package/es/themes/types.js +10 -0
- package/es/types/index.d.ts +7 -0
- package/es/types/index.d.ts.map +1 -0
- package/es/types/index.js +10 -0
- package/es/types/keyboard.d.ts +253 -0
- package/es/types/keyboard.d.ts.map +1 -0
- package/es/types/keyboard.js +10 -0
- package/es/types/position.d.ts +139 -0
- package/es/types/position.d.ts.map +1 -0
- package/es/types/position.js +10 -0
- package/es/utils/device.d.ts +45 -0
- package/es/utils/device.d.ts.map +1 -0
- package/es/utils/device.js +111 -0
- package/es/utils/device.js.map +1 -0
- package/es/utils/dom.d.ts +69 -0
- package/es/utils/dom.d.ts.map +1 -0
- package/es/utils/dom.js +134 -0
- package/es/utils/dom.js.map +1 -0
- package/es/utils/event-emitter.d.ts +52 -0
- package/es/utils/event-emitter.d.ts.map +1 -0
- package/es/utils/event-emitter.js +99 -0
- package/es/utils/event-emitter.js.map +1 -0
- package/es/utils/formatters.d.ts +51 -0
- package/es/utils/formatters.d.ts.map +1 -0
- package/es/utils/formatters.js +57 -0
- package/es/utils/formatters.js.map +1 -0
- package/es/utils/index.d.ts +10 -0
- package/es/utils/index.d.ts.map +1 -0
- package/es/utils/index.js +16 -0
- package/es/utils/random.d.ts +71 -0
- package/es/utils/random.d.ts.map +1 -0
- package/es/utils/random.js +292 -0
- package/es/utils/random.js.map +1 -0
- package/esm/icons.d.ts +58 -0
- package/esm/icons.d.ts.map +1 -0
- package/esm/icons.js +34 -0
- package/esm/icons.js.map +1 -0
- package/esm/index.d.ts +12 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +37 -0
- package/esm/layouts/amount.d.ts +14 -0
- package/esm/layouts/amount.d.ts.map +1 -0
- package/esm/layouts/amount.js +175 -0
- package/esm/layouts/amount.js.map +1 -0
- package/esm/layouts/bankcard.d.ts +15 -0
- package/esm/layouts/bankcard.d.ts.map +1 -0
- package/esm/layouts/bankcard.js +99 -0
- package/esm/layouts/bankcard.js.map +1 -0
- package/esm/layouts/email.d.ts +11 -0
- package/esm/layouts/email.d.ts.map +1 -0
- package/esm/layouts/email.js +126 -0
- package/esm/layouts/email.js.map +1 -0
- package/esm/layouts/idcard.d.ts +16 -0
- package/esm/layouts/idcard.d.ts.map +1 -0
- package/esm/layouts/idcard.js +99 -0
- package/esm/layouts/idcard.js.map +1 -0
- package/esm/layouts/index.d.ts +54 -0
- package/esm/layouts/index.d.ts.map +1 -0
- package/esm/layouts/index.js +78 -0
- package/esm/layouts/index.js.map +1 -0
- package/esm/layouts/license-plate.d.ts +35 -0
- package/esm/layouts/license-plate.d.ts.map +1 -0
- package/esm/layouts/license-plate.js +290 -0
- package/esm/layouts/license-plate.js.map +1 -0
- package/esm/layouts/number.d.ts +14 -0
- package/esm/layouts/number.d.ts.map +1 -0
- package/esm/layouts/number.js +168 -0
- package/esm/layouts/number.js.map +1 -0
- package/esm/layouts/phone.d.ts +15 -0
- package/esm/layouts/phone.d.ts.map +1 -0
- package/esm/layouts/phone.js +175 -0
- package/esm/layouts/phone.js.map +1 -0
- package/esm/layouts/punct.d.ts +7 -0
- package/esm/layouts/punct.d.ts.map +1 -0
- package/esm/layouts/punct.js +112 -0
- package/esm/layouts/punct.js.map +1 -0
- package/esm/layouts/qwerty.d.ts +10 -0
- package/esm/layouts/qwerty.d.ts.map +1 -0
- package/esm/layouts/qwerty.js +116 -0
- package/esm/layouts/qwerty.js.map +1 -0
- package/esm/layouts/search.d.ts +7 -0
- package/esm/layouts/search.d.ts.map +1 -0
- package/esm/layouts/search.js +101 -0
- package/esm/layouts/search.js.map +1 -0
- package/esm/layouts/symbol.d.ts +14 -0
- package/esm/layouts/symbol.d.ts.map +1 -0
- package/esm/layouts/symbol.js +194 -0
- package/esm/layouts/symbol.js.map +1 -0
- package/esm/layouts/url.d.ts +7 -0
- package/esm/layouts/url.d.ts.map +1 -0
- package/esm/layouts/url.js +99 -0
- package/esm/layouts/url.js.map +1 -0
- package/esm/layouts/verifycode.d.ts +15 -0
- package/esm/layouts/verifycode.d.ts.map +1 -0
- package/esm/layouts/verifycode.js +100 -0
- package/esm/layouts/verifycode.js.map +1 -0
- package/esm/managers/index.d.ts +8 -0
- package/esm/managers/index.d.ts.map +1 -0
- package/esm/managers/index.js +14 -0
- package/esm/managers/keyboard-manager.d.ts +130 -0
- package/esm/managers/keyboard-manager.d.ts.map +1 -0
- package/esm/managers/keyboard-manager.js +374 -0
- package/esm/managers/keyboard-manager.js.map +1 -0
- package/esm/managers/keyboard-renderer.d.ts +115 -0
- package/esm/managers/keyboard-renderer.d.ts.map +1 -0
- package/esm/managers/keyboard-renderer.js +283 -0
- package/esm/managers/keyboard-renderer.js.map +1 -0
- package/esm/managers/position-manager.d.ts +72 -0
- package/esm/managers/position-manager.d.ts.map +1 -0
- package/esm/managers/position-manager.js +199 -0
- package/esm/managers/position-manager.js.map +1 -0
- package/esm/themes/index.d.ts +70 -0
- package/esm/themes/index.d.ts.map +1 -0
- package/esm/themes/index.js +99 -0
- package/esm/themes/index.js.map +1 -0
- package/esm/themes/presets.d.ts +39 -0
- package/esm/themes/presets.d.ts.map +1 -0
- package/esm/themes/presets.js +207 -0
- package/esm/themes/presets.js.map +1 -0
- package/esm/themes/types.d.ts +118 -0
- package/esm/themes/types.d.ts.map +1 -0
- package/esm/themes/types.js +10 -0
- package/esm/types/index.d.ts +7 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +10 -0
- package/esm/types/keyboard.d.ts +253 -0
- package/esm/types/keyboard.d.ts.map +1 -0
- package/esm/types/keyboard.js +10 -0
- package/esm/types/position.d.ts +139 -0
- package/esm/types/position.d.ts.map +1 -0
- package/esm/types/position.js +10 -0
- package/esm/utils/device.d.ts +45 -0
- package/esm/utils/device.d.ts.map +1 -0
- package/esm/utils/device.js +111 -0
- package/esm/utils/device.js.map +1 -0
- package/esm/utils/dom.d.ts +69 -0
- package/esm/utils/dom.d.ts.map +1 -0
- package/esm/utils/dom.js +134 -0
- package/esm/utils/dom.js.map +1 -0
- package/esm/utils/event-emitter.d.ts +52 -0
- package/esm/utils/event-emitter.d.ts.map +1 -0
- package/esm/utils/event-emitter.js +99 -0
- package/esm/utils/event-emitter.js.map +1 -0
- package/esm/utils/formatters.d.ts +51 -0
- package/esm/utils/formatters.d.ts.map +1 -0
- package/esm/utils/formatters.js +57 -0
- package/esm/utils/formatters.js.map +1 -0
- package/esm/utils/index.d.ts +10 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +16 -0
- package/esm/utils/random.d.ts +71 -0
- package/esm/utils/random.d.ts.map +1 -0
- package/esm/utils/random.js +292 -0
- package/esm/utils/random.js.map +1 -0
- package/lib/icons.cjs +44 -0
- package/lib/icons.cjs.map +1 -0
- package/lib/icons.d.ts +58 -0
- package/lib/index.cjs +141 -0
- package/lib/index.d.ts +12 -0
- package/lib/layouts/amount.cjs +177 -0
- package/lib/layouts/amount.cjs.map +1 -0
- package/lib/layouts/amount.d.ts +14 -0
- package/lib/layouts/bankcard.cjs +100 -0
- package/lib/layouts/bankcard.cjs.map +1 -0
- package/lib/layouts/bankcard.d.ts +15 -0
- package/lib/layouts/email.cjs +128 -0
- package/lib/layouts/email.cjs.map +1 -0
- package/lib/layouts/email.d.ts +11 -0
- package/lib/layouts/idcard.cjs +100 -0
- package/lib/layouts/idcard.cjs.map +1 -0
- package/lib/layouts/idcard.d.ts +16 -0
- package/lib/layouts/index.cjs +107 -0
- package/lib/layouts/index.cjs.map +1 -0
- package/lib/layouts/index.d.ts +54 -0
- package/lib/layouts/license-plate.cjs +296 -0
- package/lib/layouts/license-plate.cjs.map +1 -0
- package/lib/layouts/license-plate.d.ts +35 -0
- package/lib/layouts/number.cjs +170 -0
- package/lib/layouts/number.cjs.map +1 -0
- package/lib/layouts/number.d.ts +14 -0
- package/lib/layouts/phone.cjs +177 -0
- package/lib/layouts/phone.cjs.map +1 -0
- package/lib/layouts/phone.d.ts +15 -0
- package/lib/layouts/punct.cjs +113 -0
- package/lib/layouts/punct.cjs.map +1 -0
- package/lib/layouts/punct.d.ts +7 -0
- package/lib/layouts/qwerty.cjs +117 -0
- package/lib/layouts/qwerty.cjs.map +1 -0
- package/lib/layouts/qwerty.d.ts +10 -0
- package/lib/layouts/search.cjs +102 -0
- package/lib/layouts/search.cjs.map +1 -0
- package/lib/layouts/search.d.ts +7 -0
- package/lib/layouts/symbol.cjs +196 -0
- package/lib/layouts/symbol.cjs.map +1 -0
- package/lib/layouts/symbol.d.ts +14 -0
- package/lib/layouts/url.cjs +100 -0
- package/lib/layouts/url.cjs.map +1 -0
- package/lib/layouts/url.d.ts +7 -0
- package/lib/layouts/verifycode.cjs +101 -0
- package/lib/layouts/verifycode.cjs.map +1 -0
- package/lib/layouts/verifycode.d.ts +15 -0
- package/lib/managers/index.cjs +20 -0
- package/lib/managers/index.d.ts +8 -0
- package/lib/managers/keyboard-manager.cjs +376 -0
- package/lib/managers/keyboard-manager.cjs.map +1 -0
- package/lib/managers/keyboard-manager.d.ts +130 -0
- package/lib/managers/keyboard-renderer.cjs +285 -0
- package/lib/managers/keyboard-renderer.cjs.map +1 -0
- package/lib/managers/keyboard-renderer.d.ts +115 -0
- package/lib/managers/position-manager.cjs +201 -0
- package/lib/managers/position-manager.cjs.map +1 -0
- package/lib/managers/position-manager.d.ts +72 -0
- package/lib/package.json +3 -0
- package/lib/themes/index.cjs +117 -0
- package/lib/themes/index.cjs.map +1 -0
- package/lib/themes/index.d.ts +70 -0
- package/lib/themes/presets.cjs +214 -0
- package/lib/themes/presets.cjs.map +1 -0
- package/lib/themes/presets.d.ts +39 -0
- package/lib/themes/types.cjs +11 -0
- package/lib/themes/types.d.ts +118 -0
- package/lib/types/index.cjs +11 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/keyboard.cjs +11 -0
- package/lib/types/keyboard.d.ts +253 -0
- package/lib/types/position.cjs +11 -0
- package/lib/types/position.d.ts +139 -0
- package/lib/utils/device.cjs +120 -0
- package/lib/utils/device.cjs.map +1 -0
- package/lib/utils/device.d.ts +45 -0
- package/lib/utils/dom.cjs +148 -0
- package/lib/utils/dom.cjs.map +1 -0
- package/lib/utils/dom.d.ts +69 -0
- package/lib/utils/event-emitter.cjs +100 -0
- package/lib/utils/event-emitter.cjs.map +1 -0
- package/lib/utils/event-emitter.d.ts +52 -0
- package/lib/utils/formatters.cjs +66 -0
- package/lib/utils/formatters.cjs.map +1 -0
- package/lib/utils/formatters.d.ts +51 -0
- package/lib/utils/index.cjs +58 -0
- package/lib/utils/index.d.ts +10 -0
- package/lib/utils/random.cjs +301 -0
- package/lib/utils/random.cjs.map +1 -0
- package/lib/utils/random.d.ts +71 -0
- package/package.json +121 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:29 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
const require_qwerty = require("./qwerty.cjs");
|
|
12
|
+
const require_number = require("./number.cjs");
|
|
13
|
+
const require_symbol = require("./symbol.cjs");
|
|
14
|
+
const require_license_plate = require("./license-plate.cjs");
|
|
15
|
+
const require_idcard = require("./idcard.cjs");
|
|
16
|
+
const require_phone = require("./phone.cjs");
|
|
17
|
+
const require_amount = require("./amount.cjs");
|
|
18
|
+
const require_bankcard = require("./bankcard.cjs");
|
|
19
|
+
const require_verifycode = require("./verifycode.cjs");
|
|
20
|
+
const require_email = require("./email.cjs");
|
|
21
|
+
const require_url = require("./url.cjs");
|
|
22
|
+
const require_search = require("./search.cjs");
|
|
23
|
+
const require_punct = require("./punct.cjs");
|
|
24
|
+
//#region src/layouts/index.ts
|
|
25
|
+
const builtinLayouts = {
|
|
26
|
+
"qwerty": require_qwerty.qwertyLayout,
|
|
27
|
+
"number": require_number.numberLayout,
|
|
28
|
+
"integer": require_number.integerLayout,
|
|
29
|
+
"symbol": require_symbol.symbolLayout,
|
|
30
|
+
"symbol-2": require_symbol.symbolLayout2,
|
|
31
|
+
"license-plate": require_license_plate.licensePlateLayout,
|
|
32
|
+
"license-plate-province": require_license_plate.licensePlateProvinceLayout,
|
|
33
|
+
"license-plate-letter": require_license_plate.licensePlateLetterLayout,
|
|
34
|
+
"license-plate-alphanumeric": require_license_plate.licensePlateAlphanumericLayout,
|
|
35
|
+
"idcard": require_idcard.idcardLayout,
|
|
36
|
+
"phone": require_phone.phoneLayout,
|
|
37
|
+
"phone-simple": require_phone.phoneSimpleLayout,
|
|
38
|
+
"amount": require_amount.amountLayout,
|
|
39
|
+
"amount-simple": require_amount.amountSimpleLayout,
|
|
40
|
+
"bankcard": require_bankcard.bankcardLayout,
|
|
41
|
+
"verifycode": require_verifycode.verifycodeLayout,
|
|
42
|
+
"email": require_email.emailLayout,
|
|
43
|
+
"url": require_url.urlLayout,
|
|
44
|
+
"search": require_search.searchLayout,
|
|
45
|
+
"punct": require_punct.punctLayout
|
|
46
|
+
};
|
|
47
|
+
const customLayouts = {};
|
|
48
|
+
function registerLayout(name, layout) {
|
|
49
|
+
if (builtinLayouts[name]) {
|
|
50
|
+
console.warn(`[Keyboard] Cannot override builtin layout "${name}"`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
customLayouts[name] = layout;
|
|
54
|
+
}
|
|
55
|
+
function getLayout(type) {
|
|
56
|
+
return customLayouts[type] || builtinLayouts[type];
|
|
57
|
+
}
|
|
58
|
+
function getAvailableLayouts() {
|
|
59
|
+
return [...Object.keys(builtinLayouts), ...Object.keys(customLayouts)];
|
|
60
|
+
}
|
|
61
|
+
function hasLayout(name) {
|
|
62
|
+
return name in builtinLayouts || name in customLayouts;
|
|
63
|
+
}
|
|
64
|
+
function unregisterLayout(name) {
|
|
65
|
+
if (name in customLayouts) {
|
|
66
|
+
delete customLayouts[name];
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
function registerLayouts(layouts) {
|
|
72
|
+
Object.entries(layouts).forEach(([name, layout]) => {
|
|
73
|
+
registerLayout(name, layout);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
exports.EMAIL_SUFFIXES = require_email.EMAIL_SUFFIXES;
|
|
78
|
+
exports.PLATE_LETTERS = require_license_plate.PLATE_LETTERS;
|
|
79
|
+
exports.PROVINCES = require_license_plate.PROVINCES;
|
|
80
|
+
exports.amountLayout = require_amount.amountLayout;
|
|
81
|
+
exports.amountSimpleLayout = require_amount.amountSimpleLayout;
|
|
82
|
+
exports.bankcardLayout = require_bankcard.bankcardLayout;
|
|
83
|
+
exports.emailLayout = require_email.emailLayout;
|
|
84
|
+
exports.getAvailableLayouts = getAvailableLayouts;
|
|
85
|
+
exports.getLayout = getLayout;
|
|
86
|
+
exports.hasLayout = hasLayout;
|
|
87
|
+
exports.idcardLayout = require_idcard.idcardLayout;
|
|
88
|
+
exports.integerLayout = require_number.integerLayout;
|
|
89
|
+
exports.licensePlateAlphanumericLayout = require_license_plate.licensePlateAlphanumericLayout;
|
|
90
|
+
exports.licensePlateLayout = require_license_plate.licensePlateLayout;
|
|
91
|
+
exports.licensePlateLetterLayout = require_license_plate.licensePlateLetterLayout;
|
|
92
|
+
exports.licensePlateProvinceLayout = require_license_plate.licensePlateProvinceLayout;
|
|
93
|
+
exports.numberLayout = require_number.numberLayout;
|
|
94
|
+
exports.phoneLayout = require_phone.phoneLayout;
|
|
95
|
+
exports.phoneSimpleLayout = require_phone.phoneSimpleLayout;
|
|
96
|
+
exports.punctLayout = require_punct.punctLayout;
|
|
97
|
+
exports.qwertyLayout = require_qwerty.qwertyLayout;
|
|
98
|
+
exports.registerLayout = registerLayout;
|
|
99
|
+
exports.registerLayouts = registerLayouts;
|
|
100
|
+
exports.searchLayout = require_search.searchLayout;
|
|
101
|
+
exports.symbolLayout = require_symbol.symbolLayout;
|
|
102
|
+
exports.symbolLayout2 = require_symbol.symbolLayout2;
|
|
103
|
+
exports.unregisterLayout = unregisterLayout;
|
|
104
|
+
exports.urlLayout = require_url.urlLayout;
|
|
105
|
+
exports.verifycodeLayout = require_verifycode.verifycodeLayout;
|
|
106
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
|
107
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/layouts/index.ts"],"sourcesContent":["/**\n * 键盘布局管理\n * @module layouts\n */\n\nimport type { KeyboardConfig, KeyboardType } from '../types'\nimport { qwertyLayout } from './qwerty'\nimport { integerLayout, numberLayout } from './number'\nimport { symbolLayout, symbolLayout2 } from './symbol'\nimport {\n licensePlateAlphanumericLayout,\n licensePlateLayout,\n licensePlateLetterLayout,\n licensePlateProvinceLayout,\n PLATE_LETTERS,\n PROVINCES,\n} from './license-plate'\nimport { idcardLayout } from './idcard'\nimport { phoneLayout, phoneSimpleLayout } from './phone'\nimport { amountLayout, amountSimpleLayout } from './amount'\nimport { bankcardLayout } from './bankcard'\nimport { verifycodeLayout } from './verifycode'\nimport { emailLayout, EMAIL_SUFFIXES } from './email'\nimport { urlLayout } from './url'\nimport { searchLayout } from './search'\nimport { punctLayout } from './punct'\n\n// 导出所有布局\nexport {\n qwertyLayout,\n numberLayout,\n integerLayout,\n symbolLayout,\n symbolLayout2,\n licensePlateLayout,\n licensePlateProvinceLayout,\n licensePlateLetterLayout,\n licensePlateAlphanumericLayout,\n PROVINCES,\n PLATE_LETTERS,\n // 场景化键盘\n idcardLayout,\n phoneLayout,\n phoneSimpleLayout,\n amountLayout,\n amountSimpleLayout,\n bankcardLayout,\n verifycodeLayout,\n // 输入场景键盘\n emailLayout,\n urlLayout,\n searchLayout,\n EMAIL_SUFFIXES,\n // 标点键盘\n punctLayout,\n}\n\n/**\n * 内置布局映射\n */\nconst builtinLayouts: Record<string, KeyboardConfig> = {\n 'qwerty': qwertyLayout,\n 'number': numberLayout,\n 'integer': integerLayout,\n 'symbol': symbolLayout,\n 'symbol-2': symbolLayout2,\n 'license-plate': licensePlateLayout,\n 'license-plate-province': licensePlateProvinceLayout,\n 'license-plate-letter': licensePlateLetterLayout,\n 'license-plate-alphanumeric': licensePlateAlphanumericLayout,\n // 场景化键盘\n 'idcard': idcardLayout,\n 'phone': phoneLayout,\n 'phone-simple': phoneSimpleLayout,\n 'amount': amountLayout,\n 'amount-simple': amountSimpleLayout,\n 'bankcard': bankcardLayout,\n 'verifycode': verifycodeLayout,\n // 输入场景键盘\n 'email': emailLayout,\n 'url': urlLayout,\n 'search': searchLayout,\n // 标点键盘\n 'punct': punctLayout,\n}\n\n/**\n * 自定义布局存储\n */\nconst customLayouts: Record<string, KeyboardConfig> = {}\n\n/**\n * 注册自定义布局\n * @param name - 布局名称\n * @param layout - 布局配置\n */\nexport function registerLayout(name: string, layout: KeyboardConfig): void {\n if (builtinLayouts[name]) {\n console.warn(`[Keyboard] Cannot override builtin layout \"${name}\"`)\n return\n }\n customLayouts[name] = layout\n}\n\n/**\n * 获取布局配置\n * @param type - 键盘类型或布局名称\n * @returns 布局配置,如果不存在则返回 undefined\n */\nexport function getLayout(type: KeyboardType | string): KeyboardConfig | undefined {\n return customLayouts[type] || builtinLayouts[type]\n}\n\n/**\n * 获取所有可用布局名称\n * @returns 布局名称数组\n */\nexport function getAvailableLayouts(): string[] {\n return [...Object.keys(builtinLayouts), ...Object.keys(customLayouts)]\n}\n\n/**\n * 检查布局是否存在\n * @param name - 布局名称\n * @returns 是否存在\n */\nexport function hasLayout(name: string): boolean {\n return name in builtinLayouts || name in customLayouts\n}\n\n/**\n * 移除自定义布局\n * @param name - 布局名称\n * @returns 是否成功移除\n */\nexport function unregisterLayout(name: string): boolean {\n if (name in customLayouts) {\n delete customLayouts[name]\n return true\n }\n return false\n}\n\n/**\n * 批量注册布局\n * @param layouts - 布局映射对象\n */\nexport function registerLayouts(layouts: Record<string, KeyboardConfig>): void {\n Object.entries(layouts).forEach(([name, layout]) => {\n registerLayout(name, layout)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,iBAAiD;CACrD,UAAU,eAAA;CACV,UAAU,eAAA;CACV,WAAW,eAAA;CACX,UAAU,eAAA;CACV,YAAY,eAAA;CACZ,iBAAiB,sBAAA;CACjB,0BAA0B,sBAAA;CAC1B,wBAAwB,sBAAA;CACxB,8BAA8B,sBAAA;CAE9B,UAAU,eAAA;CACV,SAAS,cAAA;CACT,gBAAgB,cAAA;CAChB,UAAU,eAAA;CACV,iBAAiB,eAAA;CACjB,YAAY,iBAAA;CACZ,cAAc,mBAAA;CAEd,SAAS,cAAA;CACT,OAAO,YAAA;CACP,UAAU,eAAA;CAEV,SAAS,cAAA;AACX;AAKA,MAAM,gBAAgD,CAAC;AAOhD,SAAS,eAAe,MAAc,QAA8B;CACzE,IAAI,eAAe,OAAO;EACxB,QAAQ,KAAK,8CAA8C,KAAI,EAAG;EAClE;CACF;CACA,cAAc,QAAQ;AACxB;AAOO,SAAS,UAAU,MAAyD;CACjF,OAAO,cAAc,SAAS,eAAe;AAC/C;AAMO,SAAS,sBAAgC;CAC9C,OAAO,CAAC,GAAG,OAAO,KAAK,cAAc,GAAG,GAAG,OAAO,KAAK,aAAa,CAAC;AACvE;AAOO,SAAS,UAAU,MAAuB;CAC/C,OAAO,QAAQ,kBAAkB,QAAQ;AAC3C;AAOO,SAAS,iBAAiB,MAAuB;CACtD,IAAI,QAAQ,eAAe;EACzB,OAAO,cAAc;EACrB,OAAO;CACT;CACA,OAAO;AACT;AAMO,SAAS,gBAAgB,SAA+C;CAC7E,OAAO,QAAQ,OAAO,CAAA,CAAE,SAAS,CAAC,MAAM,YAAY;EAClD,eAAe,MAAM,MAAM;CAC7B,CAAC;AACH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 键盘布局管理
|
|
3
|
+
* @module layouts
|
|
4
|
+
*/
|
|
5
|
+
import type { KeyboardConfig, KeyboardType } from '../types';
|
|
6
|
+
import { qwertyLayout } from './qwerty';
|
|
7
|
+
import { integerLayout, numberLayout } from './number';
|
|
8
|
+
import { symbolLayout, symbolLayout2 } from './symbol';
|
|
9
|
+
import { licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, PLATE_LETTERS, PROVINCES } from './license-plate';
|
|
10
|
+
import { idcardLayout } from './idcard';
|
|
11
|
+
import { phoneLayout, phoneSimpleLayout } from './phone';
|
|
12
|
+
import { amountLayout, amountSimpleLayout } from './amount';
|
|
13
|
+
import { bankcardLayout } from './bankcard';
|
|
14
|
+
import { verifycodeLayout } from './verifycode';
|
|
15
|
+
import { emailLayout, EMAIL_SUFFIXES } from './email';
|
|
16
|
+
import { urlLayout } from './url';
|
|
17
|
+
import { searchLayout } from './search';
|
|
18
|
+
import { punctLayout } from './punct';
|
|
19
|
+
export { qwertyLayout, numberLayout, integerLayout, symbolLayout, symbolLayout2, licensePlateLayout, licensePlateProvinceLayout, licensePlateLetterLayout, licensePlateAlphanumericLayout, PROVINCES, PLATE_LETTERS, idcardLayout, phoneLayout, phoneSimpleLayout, amountLayout, amountSimpleLayout, bankcardLayout, verifycodeLayout, emailLayout, urlLayout, searchLayout, EMAIL_SUFFIXES, punctLayout, };
|
|
20
|
+
/**
|
|
21
|
+
* 注册自定义布局
|
|
22
|
+
* @param name - 布局名称
|
|
23
|
+
* @param layout - 布局配置
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerLayout(name: string, layout: KeyboardConfig): void;
|
|
26
|
+
/**
|
|
27
|
+
* 获取布局配置
|
|
28
|
+
* @param type - 键盘类型或布局名称
|
|
29
|
+
* @returns 布局配置,如果不存在则返回 undefined
|
|
30
|
+
*/
|
|
31
|
+
export declare function getLayout(type: KeyboardType | string): KeyboardConfig | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* 获取所有可用布局名称
|
|
34
|
+
* @returns 布局名称数组
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAvailableLayouts(): string[];
|
|
37
|
+
/**
|
|
38
|
+
* 检查布局是否存在
|
|
39
|
+
* @param name - 布局名称
|
|
40
|
+
* @returns 是否存在
|
|
41
|
+
*/
|
|
42
|
+
export declare function hasLayout(name: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 移除自定义布局
|
|
45
|
+
* @param name - 布局名称
|
|
46
|
+
* @returns 是否成功移除
|
|
47
|
+
*/
|
|
48
|
+
export declare function unregisterLayout(name: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 批量注册布局
|
|
51
|
+
* @param layouts - 布局映射对象
|
|
52
|
+
*/
|
|
53
|
+
export declare function registerLayouts(layouts: Record<string, KeyboardConfig>): void;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:29 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
const require_icons = require("../icons.cjs");
|
|
12
|
+
//#region src/layouts/license-plate.ts
|
|
13
|
+
const PROVINCES = [
|
|
14
|
+
"京",
|
|
15
|
+
"津",
|
|
16
|
+
"沪",
|
|
17
|
+
"渝",
|
|
18
|
+
"冀",
|
|
19
|
+
"豫",
|
|
20
|
+
"云",
|
|
21
|
+
"辽",
|
|
22
|
+
"黑",
|
|
23
|
+
"湘",
|
|
24
|
+
"皖",
|
|
25
|
+
"鲁",
|
|
26
|
+
"新",
|
|
27
|
+
"苏",
|
|
28
|
+
"浙",
|
|
29
|
+
"赣",
|
|
30
|
+
"鄂",
|
|
31
|
+
"桂",
|
|
32
|
+
"甘",
|
|
33
|
+
"晋",
|
|
34
|
+
"蒙",
|
|
35
|
+
"陕",
|
|
36
|
+
"吉",
|
|
37
|
+
"闽",
|
|
38
|
+
"贵",
|
|
39
|
+
"粤",
|
|
40
|
+
"青",
|
|
41
|
+
"藏",
|
|
42
|
+
"川",
|
|
43
|
+
"宁",
|
|
44
|
+
"琼",
|
|
45
|
+
"港",
|
|
46
|
+
"澳"
|
|
47
|
+
];
|
|
48
|
+
const PLATE_LETTERS = [
|
|
49
|
+
"A",
|
|
50
|
+
"B",
|
|
51
|
+
"C",
|
|
52
|
+
"D",
|
|
53
|
+
"E",
|
|
54
|
+
"F",
|
|
55
|
+
"G",
|
|
56
|
+
"H",
|
|
57
|
+
"J",
|
|
58
|
+
"K",
|
|
59
|
+
"L",
|
|
60
|
+
"M",
|
|
61
|
+
"N",
|
|
62
|
+
"P",
|
|
63
|
+
"Q",
|
|
64
|
+
"R",
|
|
65
|
+
"S",
|
|
66
|
+
"T",
|
|
67
|
+
"U",
|
|
68
|
+
"V",
|
|
69
|
+
"W",
|
|
70
|
+
"X",
|
|
71
|
+
"Y",
|
|
72
|
+
"Z"
|
|
73
|
+
];
|
|
74
|
+
function createProvinceKey(province) {
|
|
75
|
+
return {
|
|
76
|
+
id: `province-${province}`,
|
|
77
|
+
type: "char",
|
|
78
|
+
label: province,
|
|
79
|
+
value: province,
|
|
80
|
+
className: "key-plate-province",
|
|
81
|
+
data: { switchAfterInput: "license-plate-alphanumeric" }
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function createLetterKey(letter) {
|
|
85
|
+
return {
|
|
86
|
+
id: `letter-${letter}`,
|
|
87
|
+
type: "char",
|
|
88
|
+
label: letter,
|
|
89
|
+
value: letter,
|
|
90
|
+
className: "key-plate-letter"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function createNumberKey(num) {
|
|
94
|
+
return {
|
|
95
|
+
id: `num-${num}`,
|
|
96
|
+
type: "char",
|
|
97
|
+
label: num,
|
|
98
|
+
value: num,
|
|
99
|
+
className: "key-plate-number"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const licensePlateProvinceLayout = {
|
|
103
|
+
type: "license-plate-province",
|
|
104
|
+
name: "省份简称",
|
|
105
|
+
supportShift: false,
|
|
106
|
+
rows: [
|
|
107
|
+
{
|
|
108
|
+
className: "plate-keyboard-row",
|
|
109
|
+
keys: PROVINCES.slice(0, 10).map(createProvinceKey)
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
className: "plate-keyboard-row",
|
|
113
|
+
keys: PROVINCES.slice(10, 20).map(createProvinceKey)
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
className: "plate-keyboard-row",
|
|
117
|
+
keys: PROVINCES.slice(20, 30).map(createProvinceKey)
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
className: "plate-keyboard-row",
|
|
121
|
+
keys: [
|
|
122
|
+
...PROVINCES.slice(30, 33).map(createProvinceKey),
|
|
123
|
+
{
|
|
124
|
+
id: "plate-xue",
|
|
125
|
+
type: "char",
|
|
126
|
+
label: "学",
|
|
127
|
+
value: "学",
|
|
128
|
+
className: "key-plate-special",
|
|
129
|
+
data: { switchAfterInput: "license-plate-alphanumeric" }
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "plate-jing",
|
|
133
|
+
type: "char",
|
|
134
|
+
label: "警",
|
|
135
|
+
value: "警",
|
|
136
|
+
className: "key-plate-special",
|
|
137
|
+
data: { switchAfterInput: "license-plate-alphanumeric" }
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "backspace",
|
|
141
|
+
type: "backspace",
|
|
142
|
+
icon: require_icons.ICON_DELETE,
|
|
143
|
+
label: "",
|
|
144
|
+
width: 1.5,
|
|
145
|
+
className: "key-plate-fn"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "done",
|
|
149
|
+
type: "done",
|
|
150
|
+
label: "确定",
|
|
151
|
+
width: 2.5,
|
|
152
|
+
className: "key-plate-done"
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
data: {
|
|
158
|
+
maxLength: 8,
|
|
159
|
+
inputType: "license-plate"
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const licensePlateAlphanumericLayout = {
|
|
163
|
+
type: "license-plate-alphanumeric",
|
|
164
|
+
name: "字母数字",
|
|
165
|
+
supportShift: false,
|
|
166
|
+
rows: [
|
|
167
|
+
{
|
|
168
|
+
className: "plate-keyboard-row",
|
|
169
|
+
keys: "1234567890".split("").map(createNumberKey)
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
className: "plate-keyboard-row",
|
|
173
|
+
keys: PLATE_LETTERS.slice(0, 10).map(createLetterKey)
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
className: "plate-keyboard-row",
|
|
177
|
+
keys: [...PLATE_LETTERS.slice(10, 19).map(createLetterKey), {
|
|
178
|
+
id: "backspace",
|
|
179
|
+
type: "backspace",
|
|
180
|
+
icon: require_icons.ICON_DELETE,
|
|
181
|
+
label: "",
|
|
182
|
+
className: "key-plate-fn"
|
|
183
|
+
}]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
className: "plate-keyboard-row",
|
|
187
|
+
keys: [
|
|
188
|
+
{
|
|
189
|
+
id: "switch-province",
|
|
190
|
+
type: "tab",
|
|
191
|
+
label: "省份",
|
|
192
|
+
width: 1.5,
|
|
193
|
+
className: "key-plate-switch",
|
|
194
|
+
data: { targetType: "license-plate-province" }
|
|
195
|
+
},
|
|
196
|
+
...PLATE_LETTERS.slice(19, 24).map(createLetterKey),
|
|
197
|
+
{
|
|
198
|
+
id: "plate-xue",
|
|
199
|
+
type: "char",
|
|
200
|
+
label: "学",
|
|
201
|
+
value: "学",
|
|
202
|
+
className: "key-plate-special"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "plate-jing",
|
|
206
|
+
type: "char",
|
|
207
|
+
label: "警",
|
|
208
|
+
value: "警",
|
|
209
|
+
className: "key-plate-special"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: "done",
|
|
213
|
+
type: "done",
|
|
214
|
+
label: "确定",
|
|
215
|
+
width: 1.5,
|
|
216
|
+
className: "key-plate-done"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
data: {
|
|
222
|
+
maxLength: 8,
|
|
223
|
+
inputType: "license-plate"
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const licensePlateLetterLayout = {
|
|
227
|
+
type: "license-plate-letter",
|
|
228
|
+
name: "字母",
|
|
229
|
+
supportShift: false,
|
|
230
|
+
rows: [
|
|
231
|
+
{
|
|
232
|
+
className: "plate-keyboard-row",
|
|
233
|
+
keys: PLATE_LETTERS.slice(0, 8).map(createLetterKey)
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
className: "plate-keyboard-row",
|
|
237
|
+
keys: PLATE_LETTERS.slice(8, 16).map(createLetterKey)
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
className: "plate-keyboard-row",
|
|
241
|
+
keys: [...PLATE_LETTERS.slice(16, 24).map(createLetterKey)]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
className: "plate-keyboard-row",
|
|
245
|
+
keys: [
|
|
246
|
+
{
|
|
247
|
+
id: "switch-province",
|
|
248
|
+
type: "tab",
|
|
249
|
+
label: "省份",
|
|
250
|
+
width: 2,
|
|
251
|
+
className: "key-plate-switch",
|
|
252
|
+
data: { targetType: "license-plate-province" }
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: "backspace",
|
|
256
|
+
type: "backspace",
|
|
257
|
+
icon: require_icons.ICON_DELETE,
|
|
258
|
+
label: "",
|
|
259
|
+
width: 2,
|
|
260
|
+
className: "key-plate-fn"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "done",
|
|
264
|
+
type: "done",
|
|
265
|
+
label: "确定",
|
|
266
|
+
width: 2,
|
|
267
|
+
className: "key-plate-done"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
data: {
|
|
273
|
+
maxLength: 8,
|
|
274
|
+
inputType: "license-plate"
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
const licensePlateLayout = {
|
|
278
|
+
type: "license-plate",
|
|
279
|
+
name: "车牌号键盘",
|
|
280
|
+
supportShift: false,
|
|
281
|
+
data: {
|
|
282
|
+
autoSwitch: true,
|
|
283
|
+
maxLength: 8,
|
|
284
|
+
inputType: "license-plate"
|
|
285
|
+
},
|
|
286
|
+
rows: licensePlateProvinceLayout.rows
|
|
287
|
+
};
|
|
288
|
+
//#endregion
|
|
289
|
+
exports.PLATE_LETTERS = PLATE_LETTERS;
|
|
290
|
+
exports.PROVINCES = PROVINCES;
|
|
291
|
+
exports.licensePlateAlphanumericLayout = licensePlateAlphanumericLayout;
|
|
292
|
+
exports.licensePlateLayout = licensePlateLayout;
|
|
293
|
+
exports.licensePlateLetterLayout = licensePlateLetterLayout;
|
|
294
|
+
exports.licensePlateProvinceLayout = licensePlateProvinceLayout;
|
|
295
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
|
296
|
+
//# sourceMappingURL=license-plate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-plate.cjs","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":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 车牌号键盘布局
|
|
3
|
+
* @module layouts/license-plate
|
|
4
|
+
* 省份键盘类似26键布局,点击省份后自动切换到字母数字键盘
|
|
5
|
+
*/
|
|
6
|
+
import type { KeyboardConfig } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* 省份简称列表(按地理区域排列,10列布局)
|
|
9
|
+
*/
|
|
10
|
+
export declare const PROVINCES: string[];
|
|
11
|
+
/**
|
|
12
|
+
* 车牌字母(排除 I 和 O,避免与数字混淆)
|
|
13
|
+
*/
|
|
14
|
+
export declare const PLATE_LETTERS: string[];
|
|
15
|
+
/**
|
|
16
|
+
* 省份键盘配置 - 类似26键布局
|
|
17
|
+
* 10列布局,更紧凑美观
|
|
18
|
+
*/
|
|
19
|
+
export declare const licensePlateProvinceLayout: KeyboardConfig;
|
|
20
|
+
/**
|
|
21
|
+
* 字母数字键盘配置(车牌第2-8位)
|
|
22
|
+
* 10列布局
|
|
23
|
+
*/
|
|
24
|
+
export declare const licensePlateAlphanumericLayout: KeyboardConfig;
|
|
25
|
+
/**
|
|
26
|
+
* 纯字母键盘配置(车牌第2位,只能输入字母)
|
|
27
|
+
* 6列布局,排除 I 和 O
|
|
28
|
+
*/
|
|
29
|
+
export declare const licensePlateLetterLayout: KeyboardConfig;
|
|
30
|
+
/**
|
|
31
|
+
* 完整车牌号键盘(自动切换模式)
|
|
32
|
+
* 默认显示省份键盘,点击省份后自动切换到字母数字键盘
|
|
33
|
+
*/
|
|
34
|
+
export declare const licensePlateLayout: KeyboardConfig;
|
|
35
|
+
//# sourceMappingURL=license-plate.d.ts.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:29 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
const require_icons = require("../icons.cjs");
|
|
12
|
+
//#region src/layouts/number.ts
|
|
13
|
+
function createNumberKey(num) {
|
|
14
|
+
return {
|
|
15
|
+
id: `num-${num}`,
|
|
16
|
+
type: "char",
|
|
17
|
+
label: num,
|
|
18
|
+
value: num,
|
|
19
|
+
className: "key-num"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const numberLayout = {
|
|
23
|
+
type: "number",
|
|
24
|
+
name: "数字键盘",
|
|
25
|
+
supportShift: false,
|
|
26
|
+
switchable: ["qwerty", "symbol"],
|
|
27
|
+
rows: [
|
|
28
|
+
{
|
|
29
|
+
className: "numpad-row",
|
|
30
|
+
keys: [
|
|
31
|
+
createNumberKey("1"),
|
|
32
|
+
createNumberKey("2"),
|
|
33
|
+
createNumberKey("3"),
|
|
34
|
+
{
|
|
35
|
+
id: "backspace",
|
|
36
|
+
type: "backspace",
|
|
37
|
+
icon: require_icons.ICON_DELETE,
|
|
38
|
+
label: "",
|
|
39
|
+
className: "key-numpad-fn"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
className: "numpad-row",
|
|
45
|
+
keys: [
|
|
46
|
+
createNumberKey("4"),
|
|
47
|
+
createNumberKey("5"),
|
|
48
|
+
createNumberKey("6"),
|
|
49
|
+
{
|
|
50
|
+
id: "clear",
|
|
51
|
+
type: "clear",
|
|
52
|
+
icon: require_icons.ICON_CLEAR,
|
|
53
|
+
label: "",
|
|
54
|
+
className: "key-numpad-fn"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
className: "numpad-row",
|
|
60
|
+
keys: [
|
|
61
|
+
createNumberKey("7"),
|
|
62
|
+
createNumberKey("8"),
|
|
63
|
+
createNumberKey("9"),
|
|
64
|
+
{
|
|
65
|
+
id: "close",
|
|
66
|
+
type: "close",
|
|
67
|
+
label: "关闭",
|
|
68
|
+
className: "key-numpad-fn"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
className: "numpad-row",
|
|
74
|
+
keys: [
|
|
75
|
+
{
|
|
76
|
+
id: "decimal",
|
|
77
|
+
type: "char",
|
|
78
|
+
label: ".",
|
|
79
|
+
value: ".",
|
|
80
|
+
className: "key-num"
|
|
81
|
+
},
|
|
82
|
+
createNumberKey("0"),
|
|
83
|
+
{
|
|
84
|
+
id: "done",
|
|
85
|
+
type: "done",
|
|
86
|
+
label: "确定",
|
|
87
|
+
width: 2,
|
|
88
|
+
className: "key-numpad-done"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
const integerLayout = {
|
|
95
|
+
type: "integer",
|
|
96
|
+
name: "整数键盘",
|
|
97
|
+
supportShift: false,
|
|
98
|
+
switchable: ["qwerty"],
|
|
99
|
+
rows: [
|
|
100
|
+
{
|
|
101
|
+
className: "numpad-row",
|
|
102
|
+
keys: [
|
|
103
|
+
createNumberKey("1"),
|
|
104
|
+
createNumberKey("2"),
|
|
105
|
+
createNumberKey("3"),
|
|
106
|
+
{
|
|
107
|
+
id: "backspace",
|
|
108
|
+
type: "backspace",
|
|
109
|
+
icon: require_icons.ICON_DELETE,
|
|
110
|
+
label: "",
|
|
111
|
+
className: "key-numpad-fn"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
className: "numpad-row",
|
|
117
|
+
keys: [
|
|
118
|
+
createNumberKey("4"),
|
|
119
|
+
createNumberKey("5"),
|
|
120
|
+
createNumberKey("6"),
|
|
121
|
+
{
|
|
122
|
+
id: "clear",
|
|
123
|
+
type: "clear",
|
|
124
|
+
icon: require_icons.ICON_CLEAR,
|
|
125
|
+
label: "",
|
|
126
|
+
className: "key-numpad-fn"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
className: "numpad-row",
|
|
132
|
+
keys: [
|
|
133
|
+
createNumberKey("7"),
|
|
134
|
+
createNumberKey("8"),
|
|
135
|
+
createNumberKey("9"),
|
|
136
|
+
{
|
|
137
|
+
id: "close",
|
|
138
|
+
type: "close",
|
|
139
|
+
label: "关闭",
|
|
140
|
+
className: "key-numpad-fn"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
className: "numpad-row",
|
|
146
|
+
keys: [
|
|
147
|
+
{
|
|
148
|
+
id: "switch-qwerty",
|
|
149
|
+
type: "tab",
|
|
150
|
+
label: "ABC",
|
|
151
|
+
className: "key-numpad-fn",
|
|
152
|
+
data: { targetType: "qwerty" }
|
|
153
|
+
},
|
|
154
|
+
createNumberKey("0"),
|
|
155
|
+
{
|
|
156
|
+
id: "done",
|
|
157
|
+
type: "done",
|
|
158
|
+
label: "确定",
|
|
159
|
+
width: 2,
|
|
160
|
+
className: "key-numpad-done"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
167
|
+
exports.integerLayout = integerLayout;
|
|
168
|
+
exports.numberLayout = numberLayout;
|
|
169
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
|
170
|
+
//# sourceMappingURL=number.cjs.map
|