@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,292 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:29 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
//#region src/utils/random.ts
|
|
11
|
+
function shuffleArray(array) {
|
|
12
|
+
const result = [...array];
|
|
13
|
+
for (let i = result.length - 1; i > 0; i--) {
|
|
14
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
15
|
+
[result[i], result[j]] = [result[j], result[i]];
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
function getRandomNumbers() {
|
|
20
|
+
return shuffleArray([
|
|
21
|
+
"0",
|
|
22
|
+
"1",
|
|
23
|
+
"2",
|
|
24
|
+
"3",
|
|
25
|
+
"4",
|
|
26
|
+
"5",
|
|
27
|
+
"6",
|
|
28
|
+
"7",
|
|
29
|
+
"8",
|
|
30
|
+
"9"
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
function getRandomLetters() {
|
|
34
|
+
return shuffleArray(Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i)));
|
|
35
|
+
}
|
|
36
|
+
function getRandomAlphanumeric() {
|
|
37
|
+
const numbers = [
|
|
38
|
+
"0",
|
|
39
|
+
"1",
|
|
40
|
+
"2",
|
|
41
|
+
"3",
|
|
42
|
+
"4",
|
|
43
|
+
"5",
|
|
44
|
+
"6",
|
|
45
|
+
"7",
|
|
46
|
+
"8",
|
|
47
|
+
"9"
|
|
48
|
+
];
|
|
49
|
+
const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i));
|
|
50
|
+
return shuffleArray([...numbers, ...letters]);
|
|
51
|
+
}
|
|
52
|
+
function createCharKey(char, index) {
|
|
53
|
+
return {
|
|
54
|
+
id: `random-${char}-${index}`,
|
|
55
|
+
type: "char",
|
|
56
|
+
label: char,
|
|
57
|
+
value: char,
|
|
58
|
+
className: "key-random"
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function chunkArray(array, chunkSize) {
|
|
62
|
+
const chunks = [];
|
|
63
|
+
for (let i = 0; i < array.length; i += chunkSize) chunks.push(array.slice(i, i + chunkSize));
|
|
64
|
+
return chunks;
|
|
65
|
+
}
|
|
66
|
+
function createRandomNumberLayout(options) {
|
|
67
|
+
const { keysPerRow = 3, includeBackspace = true, includeDone = true, includeClear = false } = options || {};
|
|
68
|
+
const rows = chunkArray(getRandomNumbers().map((n, i) => createCharKey(n, i)), keysPerRow).map((keys, index) => ({
|
|
69
|
+
className: "numpad-row",
|
|
70
|
+
keys
|
|
71
|
+
}));
|
|
72
|
+
const fnKeys = [];
|
|
73
|
+
if (includeClear) fnKeys.push({
|
|
74
|
+
id: "clear",
|
|
75
|
+
type: "clear",
|
|
76
|
+
label: "清空",
|
|
77
|
+
className: "key-clear key-fn"
|
|
78
|
+
});
|
|
79
|
+
if (includeBackspace) fnKeys.push({
|
|
80
|
+
id: "backspace",
|
|
81
|
+
type: "backspace",
|
|
82
|
+
label: "⌫",
|
|
83
|
+
className: "key-backspace key-fn"
|
|
84
|
+
});
|
|
85
|
+
if (includeDone) fnKeys.push({
|
|
86
|
+
id: "done",
|
|
87
|
+
type: "done",
|
|
88
|
+
label: "确定",
|
|
89
|
+
className: "key-done key-fn"
|
|
90
|
+
});
|
|
91
|
+
if (fnKeys.length > 0) rows.push({
|
|
92
|
+
className: "numpad-row",
|
|
93
|
+
keys: fnKeys
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
type: "custom",
|
|
97
|
+
name: "随机数字键盘",
|
|
98
|
+
supportShift: false,
|
|
99
|
+
rows,
|
|
100
|
+
data: {
|
|
101
|
+
isRandom: true,
|
|
102
|
+
randomType: "number"
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function createRandomPinLayout(options) {
|
|
107
|
+
const { includeBackspace = true, includeDone = true } = options || {};
|
|
108
|
+
const randomNumbers = getRandomNumbers();
|
|
109
|
+
const rows = [
|
|
110
|
+
{
|
|
111
|
+
className: "numpad-row",
|
|
112
|
+
keys: randomNumbers.slice(0, 3).map((n, i) => createCharKey(n, i))
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
className: "numpad-row",
|
|
116
|
+
keys: randomNumbers.slice(3, 6).map((n, i) => createCharKey(n, i + 3))
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
className: "numpad-row",
|
|
120
|
+
keys: randomNumbers.slice(6, 9).map((n, i) => createCharKey(n, i + 6))
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
const lastRow = [];
|
|
124
|
+
if (includeBackspace) lastRow.push({
|
|
125
|
+
id: "backspace",
|
|
126
|
+
type: "backspace",
|
|
127
|
+
label: "⌫",
|
|
128
|
+
className: "key-backspace key-fn"
|
|
129
|
+
});
|
|
130
|
+
else lastRow.push({
|
|
131
|
+
id: "empty-1",
|
|
132
|
+
type: "char",
|
|
133
|
+
label: "",
|
|
134
|
+
value: "",
|
|
135
|
+
disabled: true,
|
|
136
|
+
className: "key-placeholder"
|
|
137
|
+
});
|
|
138
|
+
lastRow.push(createCharKey(randomNumbers[9], 9));
|
|
139
|
+
if (includeDone) lastRow.push({
|
|
140
|
+
id: "done",
|
|
141
|
+
type: "done",
|
|
142
|
+
label: "确定",
|
|
143
|
+
className: "key-done key-fn"
|
|
144
|
+
});
|
|
145
|
+
else lastRow.push({
|
|
146
|
+
id: "empty-2",
|
|
147
|
+
type: "char",
|
|
148
|
+
label: "",
|
|
149
|
+
value: "",
|
|
150
|
+
disabled: true,
|
|
151
|
+
className: "key-placeholder"
|
|
152
|
+
});
|
|
153
|
+
rows.push({
|
|
154
|
+
className: "numpad-row",
|
|
155
|
+
keys: lastRow
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
type: "custom",
|
|
159
|
+
name: "随机PIN键盘",
|
|
160
|
+
supportShift: false,
|
|
161
|
+
rows,
|
|
162
|
+
data: {
|
|
163
|
+
isRandom: true,
|
|
164
|
+
randomType: "pin"
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function createRandomLetterLayout(options) {
|
|
169
|
+
const { uppercase = true, rowDistribution = [
|
|
170
|
+
10,
|
|
171
|
+
9,
|
|
172
|
+
7
|
|
173
|
+
] } = options || {};
|
|
174
|
+
let randomLetters = getRandomLetters();
|
|
175
|
+
if (!uppercase) randomLetters = randomLetters.map((l) => l.toLowerCase());
|
|
176
|
+
const letterKeys = randomLetters.map((l, i) => createCharKey(l, i));
|
|
177
|
+
const rows = [];
|
|
178
|
+
let offset = 0;
|
|
179
|
+
for (const count of rowDistribution) {
|
|
180
|
+
rows.push({
|
|
181
|
+
className: "numpad-row",
|
|
182
|
+
keys: letterKeys.slice(offset, offset + count)
|
|
183
|
+
});
|
|
184
|
+
offset += count;
|
|
185
|
+
}
|
|
186
|
+
if (offset < letterKeys.length) rows.push({
|
|
187
|
+
className: "numpad-row",
|
|
188
|
+
keys: letterKeys.slice(offset)
|
|
189
|
+
});
|
|
190
|
+
rows.push({
|
|
191
|
+
className: "numpad-row",
|
|
192
|
+
keys: [
|
|
193
|
+
{
|
|
194
|
+
id: "clear",
|
|
195
|
+
type: "clear",
|
|
196
|
+
label: "清空",
|
|
197
|
+
className: "key-clear key-fn"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "backspace",
|
|
201
|
+
type: "backspace",
|
|
202
|
+
label: "⌫",
|
|
203
|
+
className: "key-backspace key-fn"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: "done",
|
|
207
|
+
type: "done",
|
|
208
|
+
label: "确定",
|
|
209
|
+
className: "key-done key-fn"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
});
|
|
213
|
+
return {
|
|
214
|
+
type: "custom",
|
|
215
|
+
name: "随机字母键盘",
|
|
216
|
+
supportShift: false,
|
|
217
|
+
rows,
|
|
218
|
+
data: {
|
|
219
|
+
isRandom: true,
|
|
220
|
+
randomType: "letter"
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function createRandomMixedLayout(options) {
|
|
225
|
+
const { rowDistribution = [
|
|
226
|
+
10,
|
|
227
|
+
10,
|
|
228
|
+
9,
|
|
229
|
+
7
|
|
230
|
+
] } = options || {};
|
|
231
|
+
const charKeys = getRandomAlphanumeric().map((c, i) => createCharKey(c, i));
|
|
232
|
+
const rows = [];
|
|
233
|
+
let offset = 0;
|
|
234
|
+
for (const count of rowDistribution) {
|
|
235
|
+
if (offset >= charKeys.length) break;
|
|
236
|
+
rows.push({
|
|
237
|
+
className: "numpad-row",
|
|
238
|
+
keys: charKeys.slice(offset, offset + count)
|
|
239
|
+
});
|
|
240
|
+
offset += count;
|
|
241
|
+
}
|
|
242
|
+
if (offset < charKeys.length) rows.push({
|
|
243
|
+
className: "numpad-row",
|
|
244
|
+
keys: charKeys.slice(offset)
|
|
245
|
+
});
|
|
246
|
+
rows.push({
|
|
247
|
+
className: "numpad-row",
|
|
248
|
+
keys: [
|
|
249
|
+
{
|
|
250
|
+
id: "clear",
|
|
251
|
+
type: "clear",
|
|
252
|
+
label: "清空",
|
|
253
|
+
className: "key-clear key-fn"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "backspace",
|
|
257
|
+
type: "backspace",
|
|
258
|
+
label: "⌫",
|
|
259
|
+
className: "key-backspace key-fn"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: "done",
|
|
263
|
+
type: "done",
|
|
264
|
+
label: "确定",
|
|
265
|
+
className: "key-done key-fn"
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
});
|
|
269
|
+
return {
|
|
270
|
+
type: "custom",
|
|
271
|
+
name: "随机混合键盘",
|
|
272
|
+
supportShift: false,
|
|
273
|
+
rows,
|
|
274
|
+
data: {
|
|
275
|
+
isRandom: true,
|
|
276
|
+
randomType: "mixed"
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function refreshRandomLayout(layout) {
|
|
281
|
+
switch (layout.data?.randomType) {
|
|
282
|
+
case "number": return createRandomNumberLayout();
|
|
283
|
+
case "pin": return createRandomPinLayout();
|
|
284
|
+
case "letter": return createRandomLetterLayout();
|
|
285
|
+
case "mixed": return createRandomMixedLayout();
|
|
286
|
+
default: return layout;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
export { createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, refreshRandomLayout, shuffleArray };
|
|
291
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
|
292
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.js","names":[],"sources":["../../src/utils/random.ts"],"sourcesContent":["/**\n * 随机工具函数\n * @module utils/random\n */\n\nimport type { KeyboardConfig, KeyboardRow, KeyDefinition } from '../types'\n\n/**\n * Fisher-Yates 洗牌算法\n * @param array - 要洗牌的数组\n * @returns 洗牌后的新数组\n */\nexport function shuffleArray<T>(array: T[]): T[] {\n const result = [...array]\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1))\n ;[result[i], result[j]] = [result[j], result[i]]\n }\n return result\n}\n\n/**\n * 生成随机数字数组 (0-9)\n */\nexport function getRandomNumbers(): string[] {\n return shuffleArray(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])\n}\n\n/**\n * 生成随机字母数组 (A-Z)\n */\nexport function getRandomLetters(): string[] {\n const letters = Array.from({ length: 26 }, (_, i) =>\n String.fromCharCode(65 + i),\n )\n return shuffleArray(letters)\n}\n\n/**\n * 生成随机数字+字母数组\n */\nexport function getRandomAlphanumeric(): string[] {\n const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n const letters = Array.from({ length: 26 }, (_, i) =>\n String.fromCharCode(65 + i),\n )\n return shuffleArray([...numbers, ...letters])\n}\n\n/**\n * 创建字符按键\n */\nfunction createCharKey(char: string, index: number): KeyDefinition {\n return {\n id: `random-${char}-${index}`,\n type: 'char',\n label: char,\n value: char,\n className: 'key-random',\n }\n}\n\n/**\n * 将字符数组分成行\n */\nfunction chunkArray<T>(array: T[], chunkSize: number): T[][] {\n const chunks: T[][] = []\n for (let i = 0; i < array.length; i += chunkSize) {\n chunks.push(array.slice(i, i + chunkSize))\n }\n return chunks\n}\n\n/**\n * 生成随机数字键盘布局\n * @param options - 配置选项\n */\nexport function createRandomNumberLayout(options?: {\n /** 每行按键数 */\n keysPerRow?: number\n /** 是否包含退格键 */\n includeBackspace?: boolean\n /** 是否包含完成键 */\n includeDone?: boolean\n /** 是否包含清空键 */\n includeClear?: boolean\n}): KeyboardConfig {\n const {\n keysPerRow = 3,\n includeBackspace = true,\n includeDone = true,\n includeClear = false,\n } = options || {}\n\n const randomNumbers = getRandomNumbers()\n const numberKeys = randomNumbers.map((n, i) => createCharKey(n, i))\n const chunks = chunkArray(numberKeys, keysPerRow)\n\n const rows: KeyboardRow[] = chunks.map((keys, index) => ({\n className: 'numpad-row',\n keys,\n }))\n\n // 添加功能键行\n const fnKeys: KeyDefinition[] = []\n\n if (includeClear) {\n fnKeys.push({\n id: 'clear',\n type: 'clear',\n label: '清空',\n className: 'key-clear key-fn',\n })\n }\n\n if (includeBackspace) {\n fnKeys.push({\n id: 'backspace',\n type: 'backspace',\n label: '⌫',\n className: 'key-backspace key-fn',\n })\n }\n\n if (includeDone) {\n fnKeys.push({\n id: 'done',\n type: 'done',\n label: '确定',\n className: 'key-done key-fn',\n })\n }\n\n if (fnKeys.length > 0) {\n rows.push({\n className: 'numpad-row',\n keys: fnKeys,\n })\n }\n\n return {\n type: 'custom',\n name: '随机数字键盘',\n supportShift: false,\n rows,\n data: {\n isRandom: true,\n randomType: 'number',\n },\n }\n}\n\n/**\n * 生成4x3随机数字键盘(密码输入常用)\n */\nexport function createRandomPinLayout(options?: {\n /** 是否包含退格键 */\n includeBackspace?: boolean\n /** 是否包含完成键 */\n includeDone?: boolean\n}): KeyboardConfig {\n const { includeBackspace = true, includeDone = true } = options || {}\n\n const randomNumbers = getRandomNumbers()\n\n // 前9个数字 (3x3)\n const rows: KeyboardRow[] = [\n {\n className: 'numpad-row',\n keys: randomNumbers.slice(0, 3).map((n, i) => createCharKey(n, i)),\n },\n {\n className: 'numpad-row',\n keys: randomNumbers.slice(3, 6).map((n, i) => createCharKey(n, i + 3)),\n },\n {\n className: 'numpad-row',\n keys: randomNumbers.slice(6, 9).map((n, i) => createCharKey(n, i + 6)),\n },\n ]\n\n // 最后一行:功能键 + 0 + 功能键\n const lastRow: KeyDefinition[] = []\n\n if (includeBackspace) {\n lastRow.push({\n id: 'backspace',\n type: 'backspace',\n label: '⌫',\n className: 'key-backspace key-fn',\n })\n } else {\n lastRow.push({\n id: 'empty-1',\n type: 'char',\n label: '',\n value: '',\n disabled: true,\n className: 'key-placeholder',\n })\n }\n\n lastRow.push(createCharKey(randomNumbers[9], 9))\n\n if (includeDone) {\n lastRow.push({\n id: 'done',\n type: 'done',\n label: '确定',\n className: 'key-done key-fn',\n })\n } else {\n lastRow.push({\n id: 'empty-2',\n type: 'char',\n label: '',\n value: '',\n disabled: true,\n className: 'key-placeholder',\n })\n }\n\n rows.push({\n className: 'numpad-row',\n keys: lastRow,\n })\n\n return {\n type: 'custom',\n name: '随机PIN键盘',\n supportShift: false,\n rows,\n data: {\n isRandom: true,\n randomType: 'pin',\n },\n }\n}\n\n/**\n * 生成随机字母键盘布局\n * 默认使用 QWERTY 风格行分布 (10/9/7),看起来像真实键盘\n */\nexport function createRandomLetterLayout(options?: {\n /** 是否大写 */\n uppercase?: boolean\n /** 行分布,默认 [10, 9, 7] 模拟 QWERTY 布局 */\n rowDistribution?: number[]\n}): KeyboardConfig {\n const { uppercase = true, rowDistribution = [10, 9, 7] } = options || {}\n\n let randomLetters = getRandomLetters()\n if (!uppercase) {\n randomLetters = randomLetters.map((l) => l.toLowerCase())\n }\n\n const letterKeys = randomLetters.map((l, i) => createCharKey(l, i))\n\n // 按行分布切割\n const rows: KeyboardRow[] = []\n let offset = 0\n for (const count of rowDistribution) {\n rows.push({\n className: 'numpad-row',\n keys: letterKeys.slice(offset, offset + count),\n })\n offset += count\n }\n // 剩余字母放最后一行\n if (offset < letterKeys.length) {\n rows.push({\n className: 'numpad-row',\n keys: letterKeys.slice(offset),\n })\n }\n\n // 功能键行\n rows.push({\n className: 'numpad-row',\n keys: [\n {\n id: 'clear',\n type: 'clear',\n label: '清空',\n className: 'key-clear key-fn',\n },\n {\n id: 'backspace',\n type: 'backspace',\n label: '⌫',\n className: 'key-backspace key-fn',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n className: 'key-done key-fn',\n },\n ],\n })\n\n return {\n type: 'custom',\n name: '随机字母键盘',\n supportShift: false,\n rows,\n data: {\n isRandom: true,\n randomType: 'letter',\n },\n }\n}\n\n/**\n * 生成混合随机键盘(数字+字母)\n * 默认使用 QWERTY 风格行分布 (10/10/9/7),看起来像真实键盘\n */\nexport function createRandomMixedLayout(options?: {\n /** 行分布,默认 [10, 10, 9, 7] */\n rowDistribution?: number[]\n}): KeyboardConfig {\n const { rowDistribution = [10, 10, 9, 7] } = options || {}\n\n const randomChars = getRandomAlphanumeric()\n const charKeys = randomChars.map((c, i) => createCharKey(c, i))\n\n // 按行分布切割\n const rows: KeyboardRow[] = []\n let offset = 0\n for (const count of rowDistribution) {\n if (offset >= charKeys.length) break\n rows.push({\n className: 'numpad-row',\n keys: charKeys.slice(offset, offset + count),\n })\n offset += count\n }\n // 剩余字符放最后一行\n if (offset < charKeys.length) {\n rows.push({\n className: 'numpad-row',\n keys: charKeys.slice(offset),\n })\n }\n\n // 功能键行\n rows.push({\n className: 'numpad-row',\n keys: [\n {\n id: 'clear',\n type: 'clear',\n label: '清空',\n className: 'key-clear key-fn',\n },\n {\n id: 'backspace',\n type: 'backspace',\n label: '⌫',\n className: 'key-backspace key-fn',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n className: 'key-done key-fn',\n },\n ],\n })\n\n return {\n type: 'custom',\n name: '随机混合键盘',\n supportShift: false,\n rows,\n data: {\n isRandom: true,\n randomType: 'mixed',\n },\n }\n}\n\n/**\n * 刷新随机键盘布局\n * @param layout - 现有布局\n * @returns 新的随机布局\n */\nexport function refreshRandomLayout(layout: KeyboardConfig): KeyboardConfig {\n const randomType = layout.data?.randomType as string | undefined\n\n switch (randomType) {\n case 'number':\n return createRandomNumberLayout()\n case 'pin':\n return createRandomPinLayout()\n case 'letter':\n return createRandomLetterLayout()\n case 'mixed':\n return createRandomMixedLayout()\n default:\n return layout\n }\n}\n"],"mappings":"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"}
|
package/lib/icons.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
//#region src/icons.ts
|
|
12
|
+
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>`;
|
|
13
|
+
const ICON_CLEAR = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`;
|
|
14
|
+
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>`;
|
|
15
|
+
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>`;
|
|
16
|
+
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>`;
|
|
17
|
+
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>`;
|
|
18
|
+
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>`;
|
|
19
|
+
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>`;
|
|
20
|
+
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>`;
|
|
21
|
+
const ICONS = {
|
|
22
|
+
delete: ICON_DELETE,
|
|
23
|
+
clear: ICON_CLEAR,
|
|
24
|
+
close: ICON_CLOSE,
|
|
25
|
+
check: ICON_CHECK,
|
|
26
|
+
enter: ICON_ENTER,
|
|
27
|
+
shift: ICON_SHIFT,
|
|
28
|
+
space: ICON_SPACE,
|
|
29
|
+
keyboard: ICON_KEYBOARD,
|
|
30
|
+
voice: ICON_VOICE
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.ICONS = ICONS;
|
|
34
|
+
exports.ICON_CHECK = ICON_CHECK;
|
|
35
|
+
exports.ICON_CLEAR = ICON_CLEAR;
|
|
36
|
+
exports.ICON_CLOSE = ICON_CLOSE;
|
|
37
|
+
exports.ICON_DELETE = ICON_DELETE;
|
|
38
|
+
exports.ICON_ENTER = ICON_ENTER;
|
|
39
|
+
exports.ICON_KEYBOARD = ICON_KEYBOARD;
|
|
40
|
+
exports.ICON_SHIFT = ICON_SHIFT;
|
|
41
|
+
exports.ICON_SPACE = ICON_SPACE;
|
|
42
|
+
exports.ICON_VOICE = ICON_VOICE;
|
|
43
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
|
44
|
+
//# sourceMappingURL=icons.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.cjs","names":[],"sources":["../src/icons.ts"],"sourcesContent":["/**\n * 键盘图标 SVG\n * 使用 Lucide 图标的 SVG 路径\n * @module icons\n */\n\n/**\n * 删除图标 (Delete/Backspace)\n */\nexport const ICON_DELETE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>`\n\n/**\n * 清空图标 (X Circle)\n */\nexport const ICON_CLEAR = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>`\n\n/**\n * 关闭图标 (X)\n */\nexport const ICON_CLOSE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>`\n\n/**\n * 确认图标 (Check)\n */\nexport const ICON_CHECK = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>`\n\n/**\n * 换行图标 (Corner Down Left)\n */\nexport const ICON_ENTER = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>`\n\n/**\n * Shift 图标 (Arrow Big Up)\n */\nexport const ICON_SHIFT = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>`\n\n/**\n * 空格图标 (Space)\n */\nexport const ICON_SPACE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>`\n\n/**\n * 键盘图标 (Keyboard)\n */\nexport const ICON_KEYBOARD = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>`\n\n/**\n * 语音图标 (Mic)\n */\nexport const ICON_VOICE = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>`\n\n/**\n * 所有图标映射\n */\nexport const ICONS = {\n delete: ICON_DELETE,\n clear: ICON_CLEAR,\n close: ICON_CLOSE,\n check: ICON_CHECK,\n enter: ICON_ENTER,\n shift: ICON_SHIFT,\n space: ICON_SPACE,\n keyboard: ICON_KEYBOARD,\n voice: ICON_VOICE,\n} as const\n\n/** IconName - 图标名称类型 */\nexport type IconName = keyof typeof ICONS\n"],"mappings":";;;;;;;;;;;AASO,MAAM,cAAc;AAKpB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,aAAa;AAKnB,MAAM,gBAAgB;AAKtB,MAAM,aAAa;AAKnB,MAAM,QAAQ;CACnB,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,OAAO;AACT"}
|
package/lib/icons.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 键盘图标 SVG
|
|
3
|
+
* 使用 Lucide 图标的 SVG 路径
|
|
4
|
+
* @module icons
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 删除图标 (Delete/Backspace)
|
|
8
|
+
*/
|
|
9
|
+
export declare const ICON_DELETE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>";
|
|
10
|
+
/**
|
|
11
|
+
* 清空图标 (X Circle)
|
|
12
|
+
*/
|
|
13
|
+
export declare const ICON_CLEAR = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>";
|
|
14
|
+
/**
|
|
15
|
+
* 关闭图标 (X)
|
|
16
|
+
*/
|
|
17
|
+
export declare const ICON_CLOSE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
|
|
18
|
+
/**
|
|
19
|
+
* 确认图标 (Check)
|
|
20
|
+
*/
|
|
21
|
+
export declare const ICON_CHECK = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>";
|
|
22
|
+
/**
|
|
23
|
+
* 换行图标 (Corner Down Left)
|
|
24
|
+
*/
|
|
25
|
+
export declare const ICON_ENTER = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>";
|
|
26
|
+
/**
|
|
27
|
+
* Shift 图标 (Arrow Big Up)
|
|
28
|
+
*/
|
|
29
|
+
export declare const ICON_SHIFT = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>";
|
|
30
|
+
/**
|
|
31
|
+
* 空格图标 (Space)
|
|
32
|
+
*/
|
|
33
|
+
export declare const ICON_SPACE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>";
|
|
34
|
+
/**
|
|
35
|
+
* 键盘图标 (Keyboard)
|
|
36
|
+
*/
|
|
37
|
+
export declare const ICON_KEYBOARD = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>";
|
|
38
|
+
/**
|
|
39
|
+
* 语音图标 (Mic)
|
|
40
|
+
*/
|
|
41
|
+
export declare const ICON_VOICE = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>";
|
|
42
|
+
/**
|
|
43
|
+
* 所有图标映射
|
|
44
|
+
*/
|
|
45
|
+
export declare const ICONS: {
|
|
46
|
+
readonly delete: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z\"/><path d=\"m12 9 6 6\"/><path d=\"m18 9-6 6\"/></svg>";
|
|
47
|
+
readonly clear: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></svg>";
|
|
48
|
+
readonly close: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
|
|
49
|
+
readonly check: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>";
|
|
50
|
+
readonly enter: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 10 4 15 9 20\"/><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/></svg>";
|
|
51
|
+
readonly shift: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\"/></svg>";
|
|
52
|
+
readonly space: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\"/></svg>";
|
|
53
|
+
readonly keyboard: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"/><path d=\"M6 8h.001\"/><path d=\"M10 8h.001\"/><path d=\"M14 8h.001\"/><path d=\"M18 8h.001\"/><path d=\"M8 12h.001\"/><path d=\"M12 12h.001\"/><path d=\"M16 12h.001\"/><path d=\"M7 16h10\"/></svg>";
|
|
54
|
+
readonly voice: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" x2=\"12\" y1=\"19\" y2=\"22\"/></svg>";
|
|
55
|
+
};
|
|
56
|
+
/** IconName - 图标名称类型 */
|
|
57
|
+
export type IconName = keyof typeof ICONS;
|
|
58
|
+
//# sourceMappingURL=icons.d.ts.map
|
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
const require_qwerty = require("./layouts/qwerty.cjs");
|
|
13
|
+
const require_number = require("./layouts/number.cjs");
|
|
14
|
+
const require_symbol = require("./layouts/symbol.cjs");
|
|
15
|
+
const require_license_plate = require("./layouts/license-plate.cjs");
|
|
16
|
+
const require_idcard = require("./layouts/idcard.cjs");
|
|
17
|
+
const require_phone = require("./layouts/phone.cjs");
|
|
18
|
+
const require_amount = require("./layouts/amount.cjs");
|
|
19
|
+
const require_bankcard = require("./layouts/bankcard.cjs");
|
|
20
|
+
const require_verifycode = require("./layouts/verifycode.cjs");
|
|
21
|
+
const require_email = require("./layouts/email.cjs");
|
|
22
|
+
const require_url = require("./layouts/url.cjs");
|
|
23
|
+
const require_search = require("./layouts/search.cjs");
|
|
24
|
+
const require_punct = require("./layouts/punct.cjs");
|
|
25
|
+
const require_index = require("./layouts/index.cjs");
|
|
26
|
+
const require_event_emitter = require("./utils/event-emitter.cjs");
|
|
27
|
+
const require_device = require("./utils/device.cjs");
|
|
28
|
+
const require_dom = require("./utils/dom.cjs");
|
|
29
|
+
const require_keyboard_manager = require("./managers/keyboard-manager.cjs");
|
|
30
|
+
const require_position_manager = require("./managers/position-manager.cjs");
|
|
31
|
+
const require_presets = require("./themes/presets.cjs");
|
|
32
|
+
const require_index$1 = require("./themes/index.cjs");
|
|
33
|
+
const require_keyboard_renderer = require("./managers/keyboard-renderer.cjs");
|
|
34
|
+
const require_random = require("./utils/random.cjs");
|
|
35
|
+
const require_formatters = require("./utils/formatters.cjs");
|
|
36
|
+
exports.EMAIL_SUFFIXES = require_email.EMAIL_SUFFIXES;
|
|
37
|
+
exports.EventEmitter = require_event_emitter.EventEmitter;
|
|
38
|
+
exports.ICONS = require_icons.ICONS;
|
|
39
|
+
exports.ICON_CHECK = require_icons.ICON_CHECK;
|
|
40
|
+
exports.ICON_CLEAR = require_icons.ICON_CLEAR;
|
|
41
|
+
exports.ICON_CLOSE = require_icons.ICON_CLOSE;
|
|
42
|
+
exports.ICON_DELETE = require_icons.ICON_DELETE;
|
|
43
|
+
exports.ICON_ENTER = require_icons.ICON_ENTER;
|
|
44
|
+
exports.ICON_KEYBOARD = require_icons.ICON_KEYBOARD;
|
|
45
|
+
exports.ICON_SHIFT = require_icons.ICON_SHIFT;
|
|
46
|
+
exports.ICON_SPACE = require_icons.ICON_SPACE;
|
|
47
|
+
exports.ICON_VOICE = require_icons.ICON_VOICE;
|
|
48
|
+
exports.KeyboardManager = require_keyboard_manager.KeyboardManager;
|
|
49
|
+
exports.KeyboardRenderer = require_keyboard_renderer.KeyboardRenderer;
|
|
50
|
+
exports.PLATE_LETTERS = require_license_plate.PLATE_LETTERS;
|
|
51
|
+
exports.PROVINCES = require_license_plate.PROVINCES;
|
|
52
|
+
exports.PositionManager = require_position_manager.PositionManager;
|
|
53
|
+
exports.amountLayout = require_amount.amountLayout;
|
|
54
|
+
exports.amountSimpleLayout = require_amount.amountSimpleLayout;
|
|
55
|
+
exports.applyFormatter = require_formatters.applyFormatter;
|
|
56
|
+
exports.applyTheme = require_index$1.applyTheme;
|
|
57
|
+
exports.bankcardLayout = require_bankcard.bankcardLayout;
|
|
58
|
+
exports.createElement = require_dom.createElement;
|
|
59
|
+
exports.createKeyboardManager = require_keyboard_manager.createKeyboardManager;
|
|
60
|
+
exports.createKeyboardRenderer = require_keyboard_renderer.createKeyboardRenderer;
|
|
61
|
+
exports.createPositionManager = require_position_manager.createPositionManager;
|
|
62
|
+
exports.createRandomLetterLayout = require_random.createRandomLetterLayout;
|
|
63
|
+
exports.createRandomMixedLayout = require_random.createRandomMixedLayout;
|
|
64
|
+
exports.createRandomNumberLayout = require_random.createRandomNumberLayout;
|
|
65
|
+
exports.createRandomPinLayout = require_random.createRandomPinLayout;
|
|
66
|
+
exports.createTheme = require_index$1.createTheme;
|
|
67
|
+
exports.darkTheme = require_presets.darkTheme;
|
|
68
|
+
exports.defaultTheme = require_presets.defaultTheme;
|
|
69
|
+
exports.deleteCharBeforeCursor = require_dom.deleteCharBeforeCursor;
|
|
70
|
+
exports.emailLayout = require_email.emailLayout;
|
|
71
|
+
exports.formatAmount = require_formatters.formatAmount;
|
|
72
|
+
exports.formatBankCard = require_formatters.formatBankCard;
|
|
73
|
+
exports.formatIdCard = require_formatters.formatIdCard;
|
|
74
|
+
exports.formatLicensePlate = require_formatters.formatLicensePlate;
|
|
75
|
+
exports.formatPhone = require_formatters.formatPhone;
|
|
76
|
+
exports.formatVerifyCode = require_formatters.formatVerifyCode;
|
|
77
|
+
exports.generateThemeStyle = require_index$1.generateThemeStyle;
|
|
78
|
+
exports.getAllThemes = require_index$1.getAllThemes;
|
|
79
|
+
exports.getAvailableLayouts = require_index.getAvailableLayouts;
|
|
80
|
+
exports.getAvailableThemes = require_index$1.getAvailableThemes;
|
|
81
|
+
exports.getBoundingRect = require_dom.getBoundingRect;
|
|
82
|
+
exports.getCurrentTheme = require_index$1.getCurrentTheme;
|
|
83
|
+
exports.getDeviceType = require_device.getDeviceType;
|
|
84
|
+
exports.getElementOffset = require_dom.getElementOffset;
|
|
85
|
+
exports.getFormatter = require_formatters.getFormatter;
|
|
86
|
+
exports.getInputCursorPosition = require_dom.getInputCursorPosition;
|
|
87
|
+
exports.getLayout = require_index.getLayout;
|
|
88
|
+
exports.getRandomAlphanumeric = require_random.getRandomAlphanumeric;
|
|
89
|
+
exports.getRandomLetters = require_random.getRandomLetters;
|
|
90
|
+
exports.getRandomNumbers = require_random.getRandomNumbers;
|
|
91
|
+
exports.getSafeAreaInsets = require_device.getSafeAreaInsets;
|
|
92
|
+
exports.getTheme = require_index$1.getTheme;
|
|
93
|
+
exports.getViewportInfo = require_device.getViewportInfo;
|
|
94
|
+
exports.hasLayout = require_index.hasLayout;
|
|
95
|
+
exports.idcardLayout = require_idcard.idcardLayout;
|
|
96
|
+
exports.insertTextAtCursor = require_dom.insertTextAtCursor;
|
|
97
|
+
exports.integerLayout = require_number.integerLayout;
|
|
98
|
+
exports.iosTheme = require_presets.iosTheme;
|
|
99
|
+
exports.isClickOutside = require_dom.isClickOutside;
|
|
100
|
+
exports.isElementInViewport = require_dom.isElementInViewport;
|
|
101
|
+
exports.isMobile = require_device.isMobile;
|
|
102
|
+
exports.isMobileUA = require_device.isMobileUA;
|
|
103
|
+
exports.isTouchDevice = require_device.isTouchDevice;
|
|
104
|
+
exports.licensePlateAlphanumericLayout = require_license_plate.licensePlateAlphanumericLayout;
|
|
105
|
+
exports.licensePlateLayout = require_license_plate.licensePlateLayout;
|
|
106
|
+
exports.licensePlateLetterLayout = require_license_plate.licensePlateLetterLayout;
|
|
107
|
+
exports.licensePlateProvinceLayout = require_license_plate.licensePlateProvinceLayout;
|
|
108
|
+
exports.materialTheme = require_presets.materialTheme;
|
|
109
|
+
exports.mergeTheme = require_index$1.mergeTheme;
|
|
110
|
+
exports.minimalTheme = require_presets.minimalTheme;
|
|
111
|
+
exports.miuiTheme = require_presets.miuiTheme;
|
|
112
|
+
exports.numberLayout = require_number.numberLayout;
|
|
113
|
+
exports.onClickOutside = require_dom.onClickOutside;
|
|
114
|
+
exports.onViewportChange = require_device.onViewportChange;
|
|
115
|
+
exports.phoneLayout = require_phone.phoneLayout;
|
|
116
|
+
exports.phoneSimpleLayout = require_phone.phoneSimpleLayout;
|
|
117
|
+
exports.presetThemes = require_presets.presetThemes;
|
|
118
|
+
exports.preventDefaultAndStopPropagation = require_dom.preventDefaultAndStopPropagation;
|
|
119
|
+
exports.punctLayout = require_punct.punctLayout;
|
|
120
|
+
exports.qwertyLayout = require_qwerty.qwertyLayout;
|
|
121
|
+
exports.refreshRandomLayout = require_random.refreshRandomLayout;
|
|
122
|
+
exports.registerFormatter = require_formatters.registerFormatter;
|
|
123
|
+
exports.registerLayout = require_index.registerLayout;
|
|
124
|
+
exports.registerLayouts = require_index.registerLayouts;
|
|
125
|
+
exports.registerTheme = require_index$1.registerTheme;
|
|
126
|
+
exports.scrollIntoViewIfNeeded = require_dom.scrollIntoViewIfNeeded;
|
|
127
|
+
exports.searchLayout = require_search.searchLayout;
|
|
128
|
+
exports.setCurrentTheme = require_index$1.setCurrentTheme;
|
|
129
|
+
exports.setInputCursorPosition = require_dom.setInputCursorPosition;
|
|
130
|
+
exports.setStyles = require_dom.setStyles;
|
|
131
|
+
exports.shuffleArray = require_random.shuffleArray;
|
|
132
|
+
exports.supportsVibrate = require_device.supportsVibrate;
|
|
133
|
+
exports.symbolLayout = require_symbol.symbolLayout;
|
|
134
|
+
exports.symbolLayout2 = require_symbol.symbolLayout2;
|
|
135
|
+
exports.themeToCSS = require_index$1.themeToCSS;
|
|
136
|
+
exports.toggleClass = require_dom.toggleClass;
|
|
137
|
+
exports.unregisterLayout = require_index.unregisterLayout;
|
|
138
|
+
exports.urlLayout = require_url.urlLayout;
|
|
139
|
+
exports.verifycodeLayout = require_verifycode.verifycodeLayout;
|
|
140
|
+
exports.vibrate = require_device.vibrate;
|
|
141
|
+
/*! End of @composy/keyboard-core | Powered by @composy/builder */
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @composy/keyboard-core
|
|
3
|
+
* LDesign 虚拟键盘 - 框架无关的核心模块
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export * from './managers';
|
|
7
|
+
export * from './layouts';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export * from './utils';
|
|
10
|
+
export * from './themes';
|
|
11
|
+
export * from './icons';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|