geez-input 1.0.8 → 1.0.10
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 +133 -28
- package/dist/core/index.d.ts +18 -0
- package/dist/core/index.js +512 -0
- package/dist/{main.d.ts → core/main.d.ts} +7 -2
- package/dist/{mapping.d.ts → core/mapping.d.ts} +3 -3
- package/dist/{types.d.ts → core/types.d.ts} +2 -9
- package/dist/geez-textarea-DnZ5mnbm.js +113 -0
- package/dist/main.js +5 -624
- package/dist/react/index.d.ts +27 -0
- package/dist/react/index.js +6 -0
- package/dist/{use-geez.d.ts → react/use-geez.d.ts} +1 -1
- package/package.json +21 -4
- package/dist/components/index.d.ts +0 -12
- package/dist/components/utils.d.ts +0 -5
- package/dist/test/engine.test.d.ts +0 -1
- package/dist/test/romanizations.test.d.ts +0 -1
- package/dist/test/setup.d.ts +0 -0
- package/dist/vite-env.d.d.ts +0 -1
- /package/dist/{engine.d.ts → core/engine.d.ts} +0 -0
- /package/dist/{components → react}/geez-input.d.ts +0 -0
- /package/dist/{components → react}/geez-textarea.d.ts +0 -0
package/README.md
CHANGED
|
@@ -20,14 +20,76 @@ Geez script (ግዕዝ), also known as Ethiopic script, is an ancient writing sy
|
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
|
+
### React
|
|
24
|
+
|
|
23
25
|
```bash
|
|
24
26
|
npm install geez-input
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
Then import from the React subpath:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { GeezInput, GeezTextArea } from "geez-input/react";
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or use the default export (backward compatible):
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { GeezInput, GeezTextArea } from "geez-input";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Dependencies:** Only requires `react` and `react-dom` as peer dependencies.
|
|
42
|
+
|
|
43
|
+
### Vue
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install geez-input-vue geez-input
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<script setup>
|
|
51
|
+
import { GeezInput, GeezTextArea } from 'geez-input-vue'
|
|
52
|
+
</script>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Dependencies:** Requires `geez-input` and `vue` (^3.0.0) as peer dependencies.
|
|
56
|
+
|
|
57
|
+
### Svelte
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install geez-input-svelte geez-input
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```svelte
|
|
64
|
+
<script>
|
|
65
|
+
import { GeezInput, GeezTextArea } from 'geez-input-svelte'
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Dependencies:** Requires `geez-input` and `svelte` (^4.0.0 || ^5.0.0) as peer dependencies.
|
|
70
|
+
|
|
71
|
+
### Angular
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install geez-input-angular geez-input
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { GeezInputComponent, GeezTextAreaComponent } from 'geez-input-angular';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Dependencies:** Requires `geez-input`, `@angular/core` (^17.0.0 || ^18.0.0 || ^19.0.0), and `@angular/forms` (^17.0.0 || ^18.0.0 || ^19.0.0) as peer dependencies.
|
|
82
|
+
|
|
83
|
+
> 📖 **For detailed usage examples, see [USAGE.md](./USAGE.md)**
|
|
84
|
+
> 📦 **For dependency details, see [DEPENDENCIES.md](./DEPENDENCIES.md)**
|
|
85
|
+
> 🚀 **For publishing instructions, see [PUBLISHING.md](./PUBLISHING.md)**
|
|
86
|
+
|
|
27
87
|
## Quick Start
|
|
28
88
|
|
|
89
|
+
### React
|
|
90
|
+
|
|
29
91
|
```tsx
|
|
30
|
-
import { GeezInput, GeezTextArea } from
|
|
92
|
+
import { GeezInput, GeezTextArea } from "geez-input/react";
|
|
31
93
|
|
|
32
94
|
function App() {
|
|
33
95
|
return (
|
|
@@ -35,17 +97,22 @@ function App() {
|
|
|
35
97
|
<GeezInput placeholder="Type in Geez..." />
|
|
36
98
|
<GeezTextArea placeholder="Write longer text..." />
|
|
37
99
|
</div>
|
|
38
|
-
)
|
|
100
|
+
);
|
|
39
101
|
}
|
|
40
102
|
```
|
|
41
103
|
|
|
104
|
+
**Note:** You can also use the default export for backward compatibility:
|
|
105
|
+
```tsx
|
|
106
|
+
import { GeezInput, GeezTextArea } from "geez-input";
|
|
107
|
+
```
|
|
108
|
+
|
|
42
109
|
## TypeScript Autocomplete
|
|
43
110
|
|
|
44
111
|
The components provide full TypeScript autocomplete for all HTML input/textarea attributes:
|
|
45
112
|
|
|
46
113
|
```tsx
|
|
47
|
-
import { GeezInput, GeezTextArea } from
|
|
48
|
-
import type { GeezInputProps, GeezTextAreaProps } from
|
|
114
|
+
import { GeezInput, GeezTextArea } from "geez-input/react";
|
|
115
|
+
import type { GeezInputProps, GeezTextAreaProps } from "geez-input/react";
|
|
49
116
|
|
|
50
117
|
function MyForm() {
|
|
51
118
|
return (
|
|
@@ -64,8 +131,8 @@ function MyForm() {
|
|
|
64
131
|
id="name-input"
|
|
65
132
|
aria-label="Full name input"
|
|
66
133
|
aria-required="true"
|
|
67
|
-
onFocus={(e) => console.log(
|
|
68
|
-
onBlur={(e) => console.log(
|
|
134
|
+
onFocus={(e) => console.log("Focused")}
|
|
135
|
+
onBlur={(e) => console.log("Blurred")}
|
|
69
136
|
onChange={(e) => console.log(e.target.value)}
|
|
70
137
|
/>
|
|
71
138
|
|
|
@@ -81,12 +148,12 @@ function MyForm() {
|
|
|
81
148
|
name="story"
|
|
82
149
|
id="story-textarea"
|
|
83
150
|
aria-label="Story textarea"
|
|
84
|
-
onFocus={(e) => console.log(
|
|
85
|
-
onBlur={(e) => console.log(
|
|
151
|
+
onFocus={(e) => console.log("Focused")}
|
|
152
|
+
onBlur={(e) => console.log("Blurred")}
|
|
86
153
|
onChange={(e) => console.log(e.target.value)}
|
|
87
154
|
/>
|
|
88
155
|
</>
|
|
89
|
-
)
|
|
156
|
+
);
|
|
90
157
|
}
|
|
91
158
|
```
|
|
92
159
|
|
|
@@ -97,15 +164,16 @@ function MyForm() {
|
|
|
97
164
|
A styled input component with built-in Geez phonetic keyboard support.
|
|
98
165
|
|
|
99
166
|
**Props:**
|
|
167
|
+
|
|
100
168
|
- All standard HTML input attributes (`type`, `placeholder`, `value`, `onChange`, `onFocus`, `onBlur`, `required`, `disabled`, `readOnly`, `maxLength`, `minLength`, `pattern`, `autoComplete`, `autoFocus`, `name`, `id`, `aria-*`, `className`, etc.)
|
|
101
169
|
- `mode?: "geez" | "latin"` - Input mode: "geez" for phonetic transformation, "latin" for standard input (default: `"geez"`)
|
|
102
170
|
|
|
103
171
|
```tsx
|
|
104
|
-
import { GeezInput } from
|
|
105
|
-
import { useState } from
|
|
172
|
+
import { GeezInput } from "geez-input/react";
|
|
173
|
+
import { useState } from "react";
|
|
106
174
|
|
|
107
175
|
function MyForm() {
|
|
108
|
-
const [name, setName] = useState(
|
|
176
|
+
const [name, setName] = useState("");
|
|
109
177
|
|
|
110
178
|
return (
|
|
111
179
|
<GeezInput
|
|
@@ -116,7 +184,7 @@ function MyForm() {
|
|
|
116
184
|
maxLength={50}
|
|
117
185
|
autoComplete="name"
|
|
118
186
|
/>
|
|
119
|
-
)
|
|
187
|
+
);
|
|
120
188
|
}
|
|
121
189
|
```
|
|
122
190
|
|
|
@@ -125,11 +193,12 @@ function MyForm() {
|
|
|
125
193
|
A styled textarea component for longer text input.
|
|
126
194
|
|
|
127
195
|
**Props:**
|
|
196
|
+
|
|
128
197
|
- All standard HTML textarea attributes (`rows`, `cols`, `placeholder`, `value`, `onChange`, `onFocus`, `onBlur`, `required`, `disabled`, `readOnly`, `maxLength`, `minLength`, `wrap`, `spellCheck`, `name`, `id`, `aria-*`, `className`, etc.)
|
|
129
198
|
- `mode?: "geez" | "latin"` - Input mode: "geez" for phonetic transformation, "latin" for standard input (default: `"geez"`)
|
|
130
199
|
|
|
131
200
|
```tsx
|
|
132
|
-
import { GeezTextArea } from
|
|
201
|
+
import { GeezTextArea } from "geez-input/react";
|
|
133
202
|
|
|
134
203
|
function MyForm() {
|
|
135
204
|
return (
|
|
@@ -139,7 +208,7 @@ function MyForm() {
|
|
|
139
208
|
required
|
|
140
209
|
maxLength={500}
|
|
141
210
|
/>
|
|
142
|
-
)
|
|
211
|
+
);
|
|
143
212
|
}
|
|
144
213
|
```
|
|
145
214
|
|
|
@@ -148,6 +217,7 @@ function MyForm() {
|
|
|
148
217
|
The library uses intuitive phonetic mappings:
|
|
149
218
|
|
|
150
219
|
### Consonants
|
|
220
|
+
|
|
151
221
|
- `h` → ህ
|
|
152
222
|
- `l` → ል
|
|
153
223
|
- `m` → ም
|
|
@@ -155,18 +225,23 @@ The library uses intuitive phonetic mappings:
|
|
|
155
225
|
- `ch` → ች
|
|
156
226
|
|
|
157
227
|
### Syllables
|
|
228
|
+
|
|
158
229
|
Type a consonant followed by a vowel:
|
|
230
|
+
|
|
159
231
|
- `he` → ሀ
|
|
160
232
|
- `lu` → ሉ
|
|
161
233
|
- `mi` → ሚ
|
|
162
234
|
- `sha` → ሻ
|
|
163
235
|
|
|
164
236
|
### Double Vowels
|
|
237
|
+
|
|
165
238
|
Type the same vowel twice for alternate forms:
|
|
239
|
+
|
|
166
240
|
- `ha` → ሃ
|
|
167
241
|
- `lee` → ሌ
|
|
168
242
|
|
|
169
243
|
### Punctuation
|
|
244
|
+
|
|
170
245
|
- `:` → ፡ (word separator)
|
|
171
246
|
- `::` → ። (sentence ending)
|
|
172
247
|
- `,` → ፣
|
|
@@ -186,27 +261,26 @@ Type phonetically to get Geez text:
|
|
|
186
261
|
#### GeezInput
|
|
187
262
|
|
|
188
263
|
Props:
|
|
264
|
+
|
|
189
265
|
- `mode?: "geez" | "latin"` - Input mode: "geez" for phonetic transformation, "latin" for standard input (default: `"geez"`)
|
|
190
266
|
- `...InputHTMLAttributes` - All standard HTML input attributes (including `className`) with full TypeScript support
|
|
191
267
|
|
|
192
268
|
#### GeezTextArea
|
|
193
269
|
|
|
194
270
|
Props:
|
|
271
|
+
|
|
195
272
|
- `mode?: "geez" | "latin"` - Input mode: "geez" for phonetic transformation, "latin" for standard input (default: `"geez"`)
|
|
196
273
|
- `...TextareaHTMLAttributes` - All standard HTML textarea attributes (including `className`) with full TypeScript support
|
|
197
274
|
|
|
198
275
|
### Type Exports
|
|
199
276
|
|
|
200
277
|
```tsx
|
|
201
|
-
import type {
|
|
202
|
-
GeezInputProps,
|
|
203
|
-
GeezTextAreaProps
|
|
204
|
-
} from 'geez-input'
|
|
278
|
+
import type { GeezInputProps, GeezTextAreaProps } from "geez-input/react";
|
|
205
279
|
|
|
206
280
|
// Use in your own components
|
|
207
281
|
type MyInputProps = GeezInputProps & {
|
|
208
|
-
label: string
|
|
209
|
-
}
|
|
282
|
+
label: string;
|
|
283
|
+
};
|
|
210
284
|
|
|
211
285
|
function MyCustomInput({ label, ...props }: MyInputProps) {
|
|
212
286
|
return (
|
|
@@ -214,10 +288,42 @@ function MyCustomInput({ label, ...props }: MyInputProps) {
|
|
|
214
288
|
<label>{label}</label>
|
|
215
289
|
<GeezInput {...props} />
|
|
216
290
|
</div>
|
|
217
|
-
)
|
|
291
|
+
);
|
|
218
292
|
}
|
|
219
293
|
```
|
|
220
294
|
|
|
295
|
+
## Core Engine
|
|
296
|
+
|
|
297
|
+
The core transformation engine is exported and can be used independently or integrated with other frameworks:
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
import { GeezEngine } from "geez-input/core";
|
|
301
|
+
import type { EngineResult } from "geez-input/core";
|
|
302
|
+
|
|
303
|
+
// Transform text manually
|
|
304
|
+
const result: EngineResult = GeezEngine.transform(
|
|
305
|
+
"ህ", // text before cursor
|
|
306
|
+
"", // text after cursor
|
|
307
|
+
"a" // key pressed
|
|
308
|
+
);
|
|
309
|
+
// result.transformedValue === "ሀ"
|
|
310
|
+
// result.newCursorPosition === 1
|
|
311
|
+
// result.isReplacement === true
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
This allows you to integrate the Geez transformation engine with any framework or library of your choice.
|
|
315
|
+
|
|
316
|
+
## Framework-Specific Libraries
|
|
317
|
+
|
|
318
|
+
This monorepo provides libraries for multiple frameworks:
|
|
319
|
+
|
|
320
|
+
- **React**: `geez-input` (this package)
|
|
321
|
+
- **Vue**: `geez-input-vue` - See [packages/vue/README.md](packages/vue/README.md)
|
|
322
|
+
- **Svelte**: `geez-input-svelte` - See [packages/svelte/README.md](packages/svelte/README.md)
|
|
323
|
+
- **Angular**: `geez-input-angular` - See [packages/angular/README.md](packages/angular/README.md)
|
|
324
|
+
|
|
325
|
+
Each library provides framework-specific components while using the same core engine.
|
|
326
|
+
|
|
221
327
|
## TypeScript Support
|
|
222
328
|
|
|
223
329
|
The library is written in TypeScript and provides comprehensive type definitions for all component props.
|
|
@@ -230,11 +336,11 @@ The library is written in TypeScript and provides comprehensive type definitions
|
|
|
230
336
|
|
|
231
337
|
## Issues & Support
|
|
232
338
|
|
|
233
|
-
We welcome your feedback and contributions!
|
|
339
|
+
We welcome your feedback and contributions!
|
|
234
340
|
|
|
235
|
-
- **Found a bug?** [Open an issue](https://github.com/
|
|
236
|
-
- **Have a feature request?** [Create an issue](https://github.com/
|
|
237
|
-
- **Questions or suggestions?** Feel free to [start a discussion](https://github.com/
|
|
341
|
+
- **Found a bug?** [Open an issue](https://github.com/onesamket/geez-input/issues)
|
|
342
|
+
- **Have a feature request?** [Create an issue](https://github.com/onesamket/geez-input/issues) and let's discuss it
|
|
343
|
+
- **Questions or suggestions?** Feel free to [start a discussion](https://github.com/onesamket/geez-input/issues)
|
|
238
344
|
|
|
239
345
|
This repository is actively maintained and **open for issues**. We appreciate all contributions, bug reports, and feature requests from the community!
|
|
240
346
|
|
|
@@ -244,5 +350,4 @@ Contributions are welcome! Whether you're fixing bugs, adding features, improvin
|
|
|
244
350
|
|
|
245
351
|
## License
|
|
246
352
|
|
|
247
|
-
MIT
|
|
248
|
-
|
|
353
|
+
MIT [LICENSE](LICENSE)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Geez Input Core Engine - Phonetic keyboard support for Geez/Ethiopic script
|
|
4
|
+
*
|
|
5
|
+
* This is the core transformation engine that can be used with any framework.
|
|
6
|
+
* It provides the GeezEngine class and related types.
|
|
7
|
+
*
|
|
8
|
+
* ## Quick Start
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { GeezEngine } from 'geez-input/core'
|
|
12
|
+
*
|
|
13
|
+
* const result = GeezEngine.transform('ህ', '', 'a')
|
|
14
|
+
* // result.transformedValue === 'ሀ'
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export { GeezEngine } from './engine';
|
|
18
|
+
export type { EngineResult, GeezOptions, TransformStats } from './types';
|