@uiwwsw/virtual-keyboard 0.3.2 → 0.3.3

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.
@@ -0,0 +1,2 @@
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
2
+ export default App;
@@ -0,0 +1 @@
1
+ export declare function BlinkingCaret(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { type Dispatch, type SetStateAction, type RefObject } from "react";
2
+ import type { VirtualInputHandle } from "./Input";
3
+ interface VirtualInputContextValue {
4
+ inputRef: RefObject<VirtualInputHandle | null>;
5
+ isCompositionRef: RefObject<boolean | undefined>;
6
+ onFocus: (id: string) => void;
7
+ onBlur: () => void;
8
+ focusId: string | undefined;
9
+ setHangulMode: Dispatch<SetStateAction<boolean>>;
10
+ hangulMode: boolean;
11
+ shift: boolean;
12
+ toggleShift: () => void;
13
+ toggleKorean: () => void;
14
+ }
15
+ export declare const VirtualInputContext: import("react").Context<VirtualInputContextValue>;
16
+ export declare function useVirtualInputContext(): VirtualInputContextValue;
17
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface VirtualInputHandle {
2
+ handleKeyDown: (e: KeyboardEvent | React.KeyboardEvent) => void;
3
+ }
4
+ export interface VirtualInputProps {
5
+ value?: string;
6
+ defaultValue?: string;
7
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ }
9
+ export declare function VirtualInput({ value: controlledValue, defaultValue, onChange, ...props }: VirtualInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ declare module 'react' {
2
+ interface CSSProperties {
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
+ };
20
+ export declare function VirtualKeypad({ layout, viewport, }: {
21
+ layout: KeypadLayout;
22
+ viewport: Viewport;
23
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ import { type KeypadLayout } from "./Keypad";
3
+ export declare function VirtualInputProvider({ children, layout, defaultHangulMode, }: {
4
+ layout?: KeypadLayout;
5
+ children: ReactNode;
6
+ defaultHangulMode?: boolean;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @description 자식 요소를 Shadow DOM에 렌더링하는 최적화된 컴포넌트
3
+ * @param children 렌더링할 React 노드
4
+ * @param css 스타일을 문자열로 받아서 <style>로 삽입
5
+ * @returns Shadow DOM 안에 children과 style을 렌더링
6
+ */
7
+ export declare const ShadowWrapper: import("react").MemoExoticComponent<({ children, css, tagName, }: {
8
+ children: React.ReactNode;
9
+ css?: string;
10
+ tagName: "input" | "div";
11
+ }) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @description Shadow DOM이 붙은 container를 반환하는 React hook
3
+ * @returns containerRef: ShadowRoot가 붙은 div
4
+ * @returns shadowRoot: 생성된 ShadowRoot 인스턴스
5
+ */
6
+ export declare function useShadowDom<T extends HTMLElement>(): {
7
+ containerRef: import("react").Dispatch<import("react").SetStateAction<T>>;
8
+ shadowRoot: ShadowRoot;
9
+ };
@@ -0,0 +1,11 @@
1
+ import type { Dispatch, SetStateAction } from "react";
2
+ /**
3
+ * 로컬 스토리지와 React 상태를 안전하고 효율적으로 동기화하는 커스텀 훅입니다.
4
+ * SSR을 지원하며, 탭 간의 실시간 동기화 기능을 포함합니다.
5
+ *
6
+ * @template T - 동기화할 데이터의 타입
7
+ * @param {string} key - 로컬 스토리지 키
8
+ * @param {T | (() => T)} initialValue - 스토리지에 값이 없을 때 사용할 초기값 (값 또는 함수 형태)
9
+ * @returns {[T, Dispatch<SetStateAction<T>>]} React의 useState와 동일한 형태의 튜플
10
+ */
11
+ export declare function useStorage<T>(key: string, initialValue: T | (() => T)): [T, Dispatch<SetStateAction<T>>];
@@ -0,0 +1,7 @@
1
+ export declare const useVisualViewport: () => {
2
+ width: number;
3
+ height: number;
4
+ scale: number;
5
+ offsetLeft: number;
6
+ offsetTop: number;
7
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./components/Input";
2
+ export * from "./components/Provider";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function isHangul(char: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function isMobileAgent(userAgent?: string): boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 키 입력 이벤트를 해석해서 실제 삽입할 문자열을 반환함
3
+ * - 한글 모드 토글 감지 (Windows만)
4
+ * - 조합 여부 판단 (macOS는 키 값 기반)
5
+ */
6
+ export declare function parseKeyInput(e: React.KeyboardEvent | KeyboardEvent, hangulMode: boolean): {
7
+ handled: boolean;
8
+ toggleHangulMode?: boolean;
9
+ text?: string;
10
+ composing?: boolean;
11
+ };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@uiwwsw/virtual-keyboard",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
+ "types": "dist/types/index.d.ts",
5
6
  "main": "dist/index.js",
6
7
  "module": "dist/index.js",
7
8
  "files": [
@@ -40,7 +41,7 @@
40
41
  "scripts": {
41
42
  "dev": "vite",
42
43
  "build": "tsc -b && vite build",
43
- "build-package": "bun build src/index.ts --outdir dist --target browser --format esm --external react --external react-dom",
44
+ "build-package": "bun build src/index.ts --outdir dist --target browser --format esm --external react --external react-dom && tsc -p tsconfig.build.json",
44
45
  "lint": "eslint .",
45
46
  "preview": "vite preview"
46
47
  },