@uiwwsw/virtual-keyboard 0.4.1 → 0.5.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.
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
[key: `--${string}`]: string | number;
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
export type KeypadLayout = {
|
|
7
|
-
label: string;
|
|
8
|
-
value: string;
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
type?: string;
|
|
12
|
-
}[][];
|
|
13
|
-
export type Viewport = {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
scale: number;
|
|
17
|
-
offsetLeft: number;
|
|
18
|
-
offsetTop: number;
|
|
19
|
-
};
|
|
1
|
+
import { type KeypadLayout, type Viewport } from "../hooks/useKeypadLayout";
|
|
2
|
+
export type { KeypadLayout, Viewport };
|
|
20
3
|
export declare function VirtualKeypad({ layout, viewport, }: {
|
|
21
4
|
layout: KeypadLayout;
|
|
22
5
|
viewport: Viewport;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { KeyBounds } from "./useKeypadLayout";
|
|
2
|
+
import type { VirtualInputHandle } from "../components/Input";
|
|
3
|
+
type ActivePress = {
|
|
4
|
+
pointerId: number;
|
|
5
|
+
value: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
repeatTimeout?: number;
|
|
8
|
+
keyIndex: number;
|
|
9
|
+
};
|
|
10
|
+
type VirtualInputContextType = {
|
|
11
|
+
inputRef: React.RefObject<VirtualInputHandle | null>;
|
|
12
|
+
toggleShift: () => void;
|
|
13
|
+
toggleKorean: () => void;
|
|
14
|
+
shift: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function useKeypadInteraction({ inputRef, toggleShift, toggleKorean, shift, getTransformedValue, keyBoundsRef }: VirtualInputContextType & {
|
|
17
|
+
getTransformedValue: (cell: {
|
|
18
|
+
label?: string;
|
|
19
|
+
value: string;
|
|
20
|
+
type?: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
keyBoundsRef: React.MutableRefObject<KeyBounds[]>;
|
|
23
|
+
}): {
|
|
24
|
+
activePresses: import("react").RefObject<Map<number, ActivePress>>;
|
|
25
|
+
handlePointerDown: (e: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
26
|
+
handlePointerMove: (e: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
27
|
+
handlePointerUp: (e: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type KeypadLayout = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
type?: string;
|
|
7
|
+
}[][];
|
|
8
|
+
export type Viewport = {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
scale: number;
|
|
12
|
+
offsetLeft: number;
|
|
13
|
+
offsetTop: number;
|
|
14
|
+
};
|
|
15
|
+
export type KeyBounds = {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
w: number;
|
|
19
|
+
h: number;
|
|
20
|
+
value: string;
|
|
21
|
+
type?: string;
|
|
22
|
+
label: string;
|
|
23
|
+
rowIndex: number;
|
|
24
|
+
colIndex: number;
|
|
25
|
+
isAction: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare function useKeypadLayout({ layout, viewport, hangulMode, shift }: {
|
|
28
|
+
layout: KeypadLayout;
|
|
29
|
+
viewport: Viewport;
|
|
30
|
+
hangulMode: boolean;
|
|
31
|
+
shift: boolean;
|
|
32
|
+
}): {
|
|
33
|
+
keyBoundsRef: import("react").RefObject<KeyBounds[]>;
|
|
34
|
+
calculateLayout: () => KeyBounds[];
|
|
35
|
+
getTransformedValue: (cell: {
|
|
36
|
+
label?: string;
|
|
37
|
+
value: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
}) => string;
|
|
40
|
+
};
|
package/package.json
CHANGED