@zh-keyboard/vue 0.5.1 → 1.1.0

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 CHANGED
@@ -1,205 +1,235 @@
1
- # 中文键盘组件库
2
-
3
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
4
-
5
- 这是一个Vue 3的中文键盘组件库,支持拼音输入和手写输入。
6
-
7
- ## 功能特点
8
-
9
- - 🔌 即插即用,自动绑定输入框
10
- - ✨ 支持拼音输入,带候选词选择功能
11
- - ✏️ 支持手写输入识别,支持连笔和简写
12
- - 🔧 可自定义手写识别算法
13
- - 📏 键盘大小可自定义缩放,灵活适配各种界面布局
14
- - 🌐 纯前端实现,可作为静态网页部署,无需服务端支持
15
-
16
- ## 安装
17
-
18
- ```bash
19
- npm install @zh-keyboard/vue
20
- # 或者
21
- yarn add @zh-keyboard/vue
22
- # 或者
23
- pnpm add @zh-keyboard/vue
24
- ```
25
-
26
- ## 属性
27
-
28
- ### Props
29
-
30
- | 属性名 | 类型 | 默认值 | 说明 |
31
- | --------------- | --------------------------------- | -------- | ---------------------------------- |
32
- | defaultMode | 'en' \| 'zh' \| 'hand' \| 'num' | 'en' | 默认的键盘模式 |
33
- | enableHandwriting| boolean | false | 是否启用手写输入 |
34
- | position | 'static' \| 'float' \| 'bottom' | 'static' | 键盘定位模式 |
35
- | numKeys | string[][] | - | 数字键盘的行配置 |
36
-
37
- ### 事件
38
-
39
- | 事件名 | 参数类型 | 说明 |
40
- | ------ | -------- | ---- |
41
- | key | KeyEvent | 当用户在键盘上点击按键时触发 |
42
-
43
- ## 基本使用
44
-
45
- ### 全局配置
46
-
47
- 可以在项目入口文件中设置全局配置:
48
-
49
- ```typescript
50
- import { setKeyboardConfig } from '@zh-keyboard/vue'
51
-
52
- setKeyboardConfig({
53
- enableHandwriting: true
54
- })
55
- ```
56
-
57
- ### 基础用法
58
-
59
- - 为了防止移动端设备弹出系统默认的键盘,建议在输入框上设置 `inputmode="none"` 属性。
60
- - 此外,可以通过在输入框上设置 `data-inputmode` 属性来指定组件默认打开的键盘类型 (可选值为 `'en'`, `'zh'`, `'hand'`, `'num'`),具体键盘模式的说明请参考 `defaultMode` 属性。
61
-
62
- ```vue
63
- <script setup>
64
- import { ZhKeyboard } from '@zh-keyboard/vue'
65
- import { ref } from 'vue'
66
- import '@zh-keyboard/vue/style.css'
67
-
68
- const inputText = ref('')
69
- </script>
70
-
71
- <template>
72
- <div>
73
- <input v-model="inputText" data-inputmode="en" inputmode="none" placeholder="点击使用键盘输入" />
74
- <!-- 静态定位的键盘 -->
75
- <ZhKeyboard v-model="inputText" />
76
-
77
- <!-- 浮动定位的键盘(跟随输入框) -->
78
- <ZhKeyboard v-model="inputText" position="float" />
79
-
80
- <!-- 底部固定的键盘 -->
81
- <ZhKeyboard v-model="inputText" position="bottom" />
82
-
83
- <!-- 启用手写输入的键盘 -->
84
- <ZhKeyboard v-model="inputText" :enable-handwriting="true" />
85
-
86
- <!-- 数字键盘 -->
87
- <ZhKeyboard v-model="inputText" default-mode="num" />
88
- </div>
89
- </template>
90
- ```
91
-
92
- ## 输入模式
93
-
94
- ### 拼音输入模式 (zh)
95
-
96
- 拼音输入模式支持单字拼音输入,具有以下特性:
97
-
98
- - 支持单字模糊拼音匹配
99
- - 使用内置词库进行单字匹配
100
- - 支持中英文快速切换
101
-
102
- > 注:目前仅支持单个汉字的拼音输入,连续词组输入功能正在开发中
103
-
104
- ### 英文输入模式 (en)
105
-
106
- 标准的英文键盘布局,支持英文字母、数字和常用符号的输入。
107
-
108
- ### 手写输入模式 (hand)
109
-
110
- 手写输入模式允许用户通过手写输入汉字,启用此模式需要设置 `enableHandwriting` 为 `true`。
111
-
112
- ### 数字输入模式 (num)
113
-
114
- 数字输入模式提供一个数字和小数点键盘,方便用户输入数字、金额等。
115
-
116
- ## 手写识别
117
-
118
- 组件库支持自定义手写识别服务。您可以注册自己的手写识别服务来处理用户的手写输入。
119
-
120
- ### 手写识别接口
121
-
122
- 手写识别服务需要实现以下接口:
123
-
124
- ```typescript
125
- interface HandwritingRecognizer {
126
- /**
127
- * 初始化手写识别服务
128
- * @returns 返回是否初始化成功
129
- */
130
- initialize(): Promise<boolean>
131
-
132
- /**
133
- * 识别手写笔迹
134
- * @param strokeData 笔迹数据,格式为 x y c x y c ...,其中x和y是坐标,c表示是否为笔画的最后一点(1表示是,0表示否)
135
- * @returns 识别结果列表
136
- */
137
- recognize(strokeData: number[]): Promise<string[]>
138
-
139
- /**
140
- * 关闭手写识别服务
141
- */
142
- close(): Promise<void>
143
- }
144
- ```
145
-
146
- ### 笔迹数据格式
147
-
148
- 笔迹数据以数组形式存储,格式为 `[x1, y1, c1, x2, y2, c2, ...]`,其中:
149
- - `x`、`y` 是坐标点
150
- - `c` 表示是否为笔画的最后一点:1表示是最后一点,0表示不是
151
-
152
- 例如,一个简单的笔画可能是:`[100, 150, 0, 101, 151, 0, 102, 152, 1]`,表示三个点的笔画,最后一个点是笔画的结束点。
153
-
154
- ### 注册手写识别服务
155
-
156
- ```typescript
157
- import { registerHandwritingRecognizer } from 'zh-keyboard'
158
- import { MyHandwritingRecognizer } from './MyHandwritingRecognizer'
159
-
160
- // 创建并注册您的手写识别服务
161
- const recognizer = new MyHandwritingRecognizer()
162
- registerHandwritingRecognizer(recognizer)
163
- ```
164
-
165
- ### 示例实现
166
-
167
- 以下是一个简单的手写识别服务示例实现:
168
-
169
- ```typescript
170
- import type { HandwritingRecognizer } from 'zh-keyboard'
171
-
172
- export class MyHandwritingRecognizer implements HandwritingRecognizer {
173
- private initialized = false
174
-
175
- async initialize(): Promise<boolean> {
176
- console.log('初始化手写识别服务...')
177
- // 在实际应用中,这里可能需要加载模型或连接到服务器
178
- this.initialized = true
179
- return true
180
- }
181
-
182
- async recognize(strokeData: number[]): Promise<string[]> {
183
- if (!this.initialized) {
184
- throw new Error('手写识别服务未初始化')
185
- }
186
-
187
- console.log('识别笔迹数据:', strokeData)
188
-
189
- // 这里调用您的手写识别API
190
- // 返回识别结果
191
- return ['你', '我', '他', '好', '的']
192
- }
193
-
194
- async close(): Promise<void> {
195
- console.log('关闭手写识别服务')
196
- this.initialized = false
197
- }
198
- }
199
- ```
200
-
201
- ## 生命周期
202
-
203
- 1. 当手写输入组件挂载时,会自动调用手写识别服务的 `initialize()` 方法
204
- 2. 当用户完成一个笔画时,会调用 `recognize()` 方法进行识别
205
- 3. 当手写输入组件卸载时,会调用 `close()` 方法关闭手写识别服务
1
+ # 中文键盘组件库
2
+
3
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
4
+
5
+ 这是一个Vue 3的中文键盘组件库,支持拼音输入和手写输入。
6
+
7
+ ## 功能特点
8
+
9
+ - 🔌 即插即用,自动绑定输入框
10
+ - ✨ 支持拼音输入,带候选词选择功能
11
+ - ✏️ 支持手写输入识别,支持连笔和简写
12
+ - 🔧 可自定义手写识别算法
13
+ - 📏 键盘大小可自定义缩放,灵活适配各种界面布局
14
+ - 🌐 纯前端实现,可作为静态网页部署,无需服务端支持
15
+
16
+ ## 安装
17
+
18
+ ```bash
19
+ npm install @zh-keyboard/vue
20
+ # 或者
21
+ yarn add @zh-keyboard/vue
22
+ # 或者
23
+ pnpm add @zh-keyboard/vue
24
+ ```
25
+
26
+ ## 属性
27
+
28
+ ### Props
29
+
30
+ | 属性名 | 类型 | 默认值 | 说明 |
31
+ | --------------- | --------------------------------- | -------- | ---------------------------------- |
32
+ | defaultMode | 'en' \| 'zh' \| 'hand' \| 'num' | 'en' | 默认的键盘模式 |
33
+ | enableHandwriting| boolean | false | 是否启用手写输入 |
34
+ | position | 'static' \| 'float' \| 'bottom' | 'static' | 键盘定位模式 |
35
+ | numKeys | string[][] | - | 数字键盘的行配置 |
36
+
37
+ ### 事件
38
+
39
+ | 事件名 | 参数类型 | 说明 |
40
+ | ------ | -------- | ---- |
41
+ | key | KeyEvent | 当用户在键盘上点击按键时触发 |
42
+
43
+ ## 基本使用
44
+
45
+ ### 全局配置
46
+
47
+ 可以在项目入口文件中设置全局配置:
48
+
49
+ ```typescript
50
+ import { setKeyboardConfig } from '@zh-keyboard/vue'
51
+
52
+ setKeyboardConfig({
53
+ enableHandwriting: true
54
+ })
55
+ ```
56
+
57
+ ### 基础用法
58
+
59
+ - 为了防止移动端设备弹出系统默认的键盘,建议在输入框上设置 `inputmode="none"` 属性。
60
+ - 此外,可以通过在输入框上设置 `data-inputmode` 属性来指定组件默认打开的键盘类型 (可选值为 `'en'`, `'zh'`, `'hand'`, `'num'`),具体键盘模式的说明请参考 `defaultMode` 属性。
61
+
62
+ ```vue
63
+ <script setup>
64
+ import { ZhKeyboard } from '@zh-keyboard/vue'
65
+ import { ref } from 'vue'
66
+ import '@zh-keyboard/vue/style.css'
67
+
68
+ const inputText = ref('')
69
+ </script>
70
+
71
+ <template>
72
+ <div>
73
+ <input v-model="inputText" data-inputmode="en" inputmode="none" placeholder="点击使用键盘输入" />
74
+ <!-- 静态定位的键盘 -->
75
+ <ZhKeyboard v-model="inputText" />
76
+
77
+ <!-- 浮动定位的键盘(跟随输入框) -->
78
+ <ZhKeyboard v-model="inputText" position="float" />
79
+
80
+ <!-- 底部固定的键盘 -->
81
+ <ZhKeyboard v-model="inputText" position="bottom" />
82
+
83
+ <!-- 启用手写输入的键盘 -->
84
+ <ZhKeyboard v-model="inputText" :enable-handwriting="true" />
85
+
86
+ <!-- 数字键盘 -->
87
+ <ZhKeyboard v-model="inputText" default-mode="num" />
88
+ </div>
89
+ </template>
90
+ ```
91
+
92
+ ## 拼音引擎初始化
93
+
94
+ ### 使用 RIME WASM 拼音引擎
95
+
96
+ 拼音输入功能需要初始化拼音引擎。推荐使用基于 RIME WASM 的拼音引擎:
97
+
98
+ ```typescript
99
+ import { createRimePinyinEngine } from '@zh-keyboard/pinyin'
100
+ import { registerPinyinEngine } from '@zh-keyboard/vue'
101
+
102
+ // 注册 RIME 拼音引擎
103
+ registerPinyinEngine(new RimePinyinEngine({
104
+ wasmDir: '/data',
105
+ }))
106
+ ```
107
+
108
+ worker写法参考 `examples`。
109
+
110
+ ### WASM 文件部署
111
+
112
+ 需要将以下文件发布到 `public/data/` 目录:
113
+
114
+ - `rime-api.wasm` - RIME 引擎本体
115
+ - `default.yaml` - 默认配置
116
+ - `luna_pinyin.schema.yaml` - 拼音方案
117
+ - `luna_pinyin.table.bin` 、`luna_pinyin.prism.bin` 、`luna_pinyin.reverse.bin` - 词典文件
118
+
119
+ 这些文件来自 `@zh-keyboard/pinyin` 包的 `data/` 目录。
120
+ ```
121
+
122
+ ## 输入模式
123
+
124
+ ### 拼音输入模式 (zh)
125
+
126
+ 拼音输入模式支持单字拼音输入,具有以下特性:
127
+
128
+ - 支持单字模糊拼音匹配
129
+ - 使用内置词库进行单字匹配
130
+ - 支持中英文快速切换
131
+
132
+ > 注:目前仅支持单个汉字的拼音输入,连续词组输入功能正在开发中
133
+
134
+ ### 英文输入模式 (en)
135
+
136
+ 标准的英文键盘布局,支持英文字母、数字和常用符号的输入。
137
+
138
+ ### 手写输入模式 (hand)
139
+
140
+ 手写输入模式允许用户通过手写输入汉字,启用此模式需要设置 `enableHandwriting` 为 `true`。
141
+
142
+ ### 数字输入模式 (num)
143
+
144
+ 数字输入模式提供一个数字和小数点键盘,方便用户输入数字、金额等。
145
+
146
+ ## 手写识别
147
+
148
+ 组件库支持自定义手写识别服务。您可以注册自己的手写识别服务来处理用户的手写输入。
149
+
150
+ ### 手写识别接口
151
+
152
+ 手写识别服务需要实现以下接口:
153
+
154
+ ```typescript
155
+ interface HandwritingRecognizer {
156
+ /**
157
+ * 初始化手写识别服务
158
+ * @returns 返回是否初始化成功
159
+ */
160
+ initialize(): Promise<boolean>
161
+
162
+ /**
163
+ * 识别手写笔迹
164
+ * @param strokeData 笔迹数据,格式为 x y c x y c ...,其中x和y是坐标,c表示是否为笔画的最后一点(1表示是,0表示否)
165
+ * @returns 识别结果列表
166
+ */
167
+ recognize(strokeData: number[]): Promise<string[]>
168
+
169
+ /**
170
+ * 关闭手写识别服务
171
+ */
172
+ close(): Promise<void>
173
+ }
174
+ ```
175
+
176
+ ### 笔迹数据格式
177
+
178
+ 笔迹数据以数组形式存储,格式为 `[x1, y1, c1, x2, y2, c2, ...]`,其中:
179
+ - `x`、`y` 是坐标点
180
+ - `c` 表示是否为笔画的最后一点:1表示是最后一点,0表示不是
181
+
182
+ 例如,一个简单的笔画可能是:`[100, 150, 0, 101, 151, 0, 102, 152, 1]`,表示三个点的笔画,最后一个点是笔画的结束点。
183
+
184
+ ### 注册手写识别服务
185
+
186
+ ```typescript
187
+ import { registerHandwritingRecognizer } from 'zh-keyboard'
188
+ import { MyHandwritingRecognizer } from './MyHandwritingRecognizer'
189
+
190
+ // 创建并注册您的手写识别服务
191
+ const recognizer = new MyHandwritingRecognizer()
192
+ registerHandwritingRecognizer(recognizer)
193
+ ```
194
+
195
+ ### 示例实现
196
+
197
+ 以下是一个简单的手写识别服务示例实现:
198
+
199
+ ```typescript
200
+ import type { HandwritingRecognizer } from 'zh-keyboard'
201
+
202
+ export class MyHandwritingRecognizer implements HandwritingRecognizer {
203
+ private initialized = false
204
+
205
+ async initialize(): Promise<boolean> {
206
+ console.log('初始化手写识别服务...')
207
+ // 在实际应用中,这里可能需要加载模型或连接到服务器
208
+ this.initialized = true
209
+ return true
210
+ }
211
+
212
+ async recognize(strokeData: number[]): Promise<string[]> {
213
+ if (!this.initialized) {
214
+ throw new Error('手写识别服务未初始化')
215
+ }
216
+
217
+ console.log('识别笔迹数据:', strokeData)
218
+
219
+ // 这里调用您的手写识别API
220
+ // 返回识别结果
221
+ return ['你', '我', '他', '好', '的']
222
+ }
223
+
224
+ async close(): Promise<void> {
225
+ console.log('关闭手写识别服务')
226
+ this.initialized = false
227
+ }
228
+ }
229
+ ```
230
+
231
+ ## 生命周期
232
+
233
+ 1. 当手写输入组件挂载时,会自动调用手写识别服务的 `initialize()` 方法
234
+ 2. 当用户完成一个笔画时,会调用 `recognize()` 方法进行识别
235
+ 3. 当手写输入组件卸载时,会调用 `close()` 方法关闭手写识别服务
@@ -1,8 +1,11 @@
1
1
  import { KeyEvent } from '../types';
2
+ declare function handleSelection(globalIndex: number): Promise<void>;
2
3
  type __VLS_PublicProps = {
3
4
  modelValue: string;
4
5
  };
5
- declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
7
+ handleSelection: typeof handleSelection;
8
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
9
  "update:modelValue": (value: string) => any;
7
10
  } & {
8
11
  input: (text: string) => any;
@@ -2,8 +2,8 @@ type __VLS_Props = {
2
2
  candidates: string[];
3
3
  };
4
4
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
5
- select: (candidate: string) => any;
5
+ select: (index: number) => any;
6
6
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
7
- onSelect?: ((candidate: string) => any) | undefined;
7
+ onSelect?: ((index: number) => any) | undefined;
8
8
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
9
9
  export default _default;
@@ -2,10 +2,10 @@ type __VLS_Props = {
2
2
  candidates: string[];
3
3
  };
4
4
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
5
- select: (candidate: string) => any;
5
+ select: (index: number) => any;
6
6
  close: () => any;
7
7
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
8
- onSelect?: ((candidate: string) => any) | undefined;
8
+ onSelect?: ((index: number) => any) | undefined;
9
9
  onClose?: (() => any) | undefined;
10
10
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
11
11
  export default _default;
@@ -12,5 +12,35 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
12
12
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
13
  onKey?: ((payload: KeyEvent) => any) | undefined;
14
14
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
15
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
15
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
16
+ candidateBarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
17
+ modelValue: string;
18
+ }> & Readonly<{
19
+ onInput?: ((text: string) => any) | undefined;
20
+ onKey?: ((payload: KeyEvent) => any) | undefined;
21
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
22
+ }>, {
23
+ handleSelection: (globalIndex: number) => Promise<void>;
24
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
25
+ "update:modelValue": (value: string) => any;
26
+ } & {
27
+ input: (text: string) => any;
28
+ key: (payload: KeyEvent) => any;
29
+ }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
30
+ P: {};
31
+ B: {};
32
+ D: {};
33
+ C: {};
34
+ M: {};
35
+ Defaults: {};
36
+ }, Readonly<{
37
+ modelValue: string;
38
+ }> & Readonly<{
39
+ onInput?: ((text: string) => any) | undefined;
40
+ onKey?: ((payload: KeyEvent) => any) | undefined;
41
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
42
+ }>, {
43
+ handleSelection: (globalIndex: number) => Promise<void>;
44
+ }, {}, {}, {}, {}> | null;
45
+ }, HTMLDivElement>;
16
46
  export default _default;
@@ -1,38 +1,105 @@
1
1
  import { KeyBoardMode, KeyEvent } from '../types';
2
- type __VLS_Props = {
2
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
3
3
  /**
4
4
  * 默认的键盘模式
5
5
  */
6
- defaultMode?: KeyBoardMode;
6
+ defaultMode: {
7
+ type: () => KeyBoardMode;
8
+ default: () => "symbol" | "zh" | "en" | "hand" | "num";
9
+ };
7
10
  /**
8
11
  * 是否启用手写输入
9
12
  */
10
- enableHandwriting?: boolean;
13
+ enableHandwriting: {
14
+ type: BooleanConstructor;
15
+ default: () => boolean;
16
+ };
11
17
  /**
12
18
  * 键盘定位模式
13
19
  * @default 'static'
14
20
  */
15
- position?: 'static' | 'float' | 'bottom';
21
+ position: {
22
+ type: () => "static" | "float" | "bottom";
23
+ default: () => "static" | "float" | "bottom";
24
+ };
25
+ /**
26
+ * 浮动模式下键盘与输入框的距离
27
+ * @default 10
28
+ */
29
+ floatMarginTop: {
30
+ type: NumberConstructor;
31
+ default: () => number;
32
+ };
16
33
  /**
17
34
  * 当没有input获得焦点时是否禁用键盘
18
35
  * @default true
19
36
  */
20
- disableWhenNoFocus?: boolean;
37
+ disableWhenNoFocus: {
38
+ type: BooleanConstructor;
39
+ default: () => boolean;
40
+ };
21
41
  /**
22
42
  * 数字键盘的行配置
23
43
  */
24
- numKeys?: string[][];
25
- };
26
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
44
+ numKeys: {
45
+ type: () => string[][];
46
+ };
47
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
27
48
  key: (payload: KeyEvent) => any;
28
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
49
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
50
+ /**
51
+ * 默认的键盘模式
52
+ */
53
+ defaultMode: {
54
+ type: () => KeyBoardMode;
55
+ default: () => "symbol" | "zh" | "en" | "hand" | "num";
56
+ };
57
+ /**
58
+ * 是否启用手写输入
59
+ */
60
+ enableHandwriting: {
61
+ type: BooleanConstructor;
62
+ default: () => boolean;
63
+ };
64
+ /**
65
+ * 键盘定位模式
66
+ * @default 'static'
67
+ */
68
+ position: {
69
+ type: () => "static" | "float" | "bottom";
70
+ default: () => "static" | "float" | "bottom";
71
+ };
72
+ /**
73
+ * 浮动模式下键盘与输入框的距离
74
+ * @default 10
75
+ */
76
+ floatMarginTop: {
77
+ type: NumberConstructor;
78
+ default: () => number;
79
+ };
80
+ /**
81
+ * 当没有input获得焦点时是否禁用键盘
82
+ * @default true
83
+ */
84
+ disableWhenNoFocus: {
85
+ type: BooleanConstructor;
86
+ default: () => boolean;
87
+ };
88
+ /**
89
+ * 数字键盘的行配置
90
+ */
91
+ numKeys: {
92
+ type: () => string[][];
93
+ };
94
+ }>> & Readonly<{
29
95
  onKey?: ((payload: KeyEvent) => any) | undefined;
30
96
  }>, {
31
97
  enableHandwriting: boolean;
32
98
  defaultMode: KeyBoardMode;
33
99
  position: "static" | "float" | "bottom";
100
+ floatMarginTop: number;
34
101
  disableWhenNoFocus: boolean;
35
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
102
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
36
103
  keyboardRef: HTMLDivElement;
37
104
  }, HTMLDivElement>;
38
105
  export default _default;
package/dist/lib.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { App } from 'vue';
2
2
  import { default as ZhKeyboard } from './components/ZhKeyboard.vue';
3
- export { getHandwritingRecognizer, getKeyboardConfig, registerHandwritingRecognizer, setKeyboardConfig, } from '@zh-keyboard/core';
3
+ export * from '@zh-keyboard/core';
4
4
  export { ZhKeyboard };
5
5
  declare const _default: {
6
6
  install: (app: App) => void;