simple-ime 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/demo.png +0 -0
- package/dist/simple-ime.cjs +15 -0
- package/dist/simple-ime.es.js +878 -0
- package/dist/simple-ime.global.js +15 -0
- package/dist/simple-ime.umd.js +15 -0
- package/dist/src/engine/index.d.ts +1 -0
- package/dist/src/handlers/backspace.d.ts +4 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/simple-ime.d.ts +63 -0
- package/dist/src/types.d.ts +12 -0
- package/dist/src/utils/cursor.d.ts +13 -0
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/event.d.ts +3 -0
- package/dist/src/utils/pinyin.d.ts +8 -0
- package/dist/src/views/create-input-view.d.ts +3 -0
- package/dist/src/views/create-toolbar.d.ts +5 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 nieyuyao0826@hotmail.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Simple Ime
|
|
2
|
+
An simple browser tool to use Chinese Pinyin Input Method (IME).
|
|
3
|
+
|
|
4
|
+
<img src="./public/demo.png" width="240" />
|
|
5
|
+
|
|
6
|
+
# Install
|
|
7
|
+
|
|
8
|
+
> npm install simple-ime
|
|
9
|
+
|
|
10
|
+
# Usage
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import { createSimpleIme } from 'simple-ime'
|
|
14
|
+
|
|
15
|
+
const ime = createSimpleIme()
|
|
16
|
+
|
|
17
|
+
// turn on ime
|
|
18
|
+
ime.turnOn()
|
|
19
|
+
|
|
20
|
+
// turn off ime
|
|
21
|
+
ime.turnOff()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
# APIs
|
|
25
|
+
|
|
26
|
+
## createSimpleIme
|
|
27
|
+
|
|
28
|
+
Create ime instance.
|
|
29
|
+
|
|
30
|
+
`function createSimpleIme(): SimpleImeInstance`
|
|
31
|
+
|
|
32
|
+
## SimpleImeInstance
|
|
33
|
+
|
|
34
|
+
### Properties:
|
|
35
|
+
|
|
36
|
+
#### version
|
|
37
|
+
|
|
38
|
+
Version of ime.
|
|
39
|
+
|
|
40
|
+
`version: string`
|
|
41
|
+
|
|
42
|
+
### Methods:
|
|
43
|
+
|
|
44
|
+
#### turnOn
|
|
45
|
+
|
|
46
|
+
Turn on the ime.
|
|
47
|
+
|
|
48
|
+
`function turnOn(): void`
|
|
49
|
+
|
|
50
|
+
#### turnOff
|
|
51
|
+
|
|
52
|
+
Turn off the ime.
|
|
53
|
+
|
|
54
|
+
`function turnOff(): void`
|
|
55
|
+
|
|
56
|
+
#### toggleOnOff
|
|
57
|
+
|
|
58
|
+
Toggle the ime.
|
|
59
|
+
|
|
60
|
+
`function toggleOnOff(): void`
|
|
61
|
+
|
|
62
|
+
#### dispose
|
|
63
|
+
|
|
64
|
+
Destroy the ime instance.
|
|
65
|
+
|
|
66
|
+
`function dispose(): void`
|
|
67
|
+
|
|
68
|
+
# Development
|
|
69
|
+
|
|
70
|
+
Run `npm run dev` and then open browser.
|
|
71
|
+
|
|
72
|
+
# Build
|
|
73
|
+
|
|
74
|
+
```shell
|
|
75
|
+
npm run build
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
# Credits
|
|
79
|
+
|
|
80
|
+
- The frontend part of the implementation is heavily inspired by [CloudInput](https://github.com/mzhangdev/CloudInput).
|
|
81
|
+
- Thanks to [web-pinyin-ime](https://github.com/dongyuwei/web-pinyin-ime) for algorithm of generating candidate words.
|
package/dist/demo.png
ADDED
|
Binary file
|