geez-input 1.0.8 → 1.0.9

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/dist/main.js CHANGED
@@ -40,7 +40,7 @@ const f = {
40
40
  A: "ኣ",
41
41
  E: "ኤ",
42
42
  O: "ዖ"
43
- }, r = {
43
+ }, w = {
44
44
  አ: {
45
45
  e: "አ",
46
46
  u: "ኡ",
@@ -59,7 +59,6 @@ const f = {
59
59
  a: "ሃ",
60
60
  ee: "ሄ",
61
61
  o: "ሆ",
62
- ua: "ኋ",
63
62
  wa: "ኋ",
64
63
  wi: "ኊ",
65
64
  we: "ኈ",
@@ -82,8 +81,7 @@ const f = {
82
81
  a: "ላ",
83
82
  ee: "ሌ",
84
83
  o: "ሎ",
85
- wa: "ሏ",
86
- ua: "ሏ"
84
+ wa: "ሏ"
87
85
  },
88
86
  ም: {
89
87
  e: "መ",
@@ -92,7 +90,6 @@ const f = {
92
90
  a: "ማ",
93
91
  ee: "ሜ",
94
92
  o: "ሞ",
95
- ua: "ሟ",
96
93
  wa: "ሟ"
97
94
  },
98
95
  ር: {
@@ -102,7 +99,6 @@ const f = {
102
99
  a: "ራ",
103
100
  ee: "ሬ",
104
101
  o: "ሮ",
105
- ua: "ሯ",
106
102
  wa: "ሯ"
107
103
  },
108
104
  ስ: {
@@ -112,7 +108,6 @@ const f = {
112
108
  a: "ሳ",
113
109
  ee: "ሴ",
114
110
  o: "ሶ",
115
- ua: "ሷ",
116
111
  wa: "ሷ"
117
112
  },
118
113
  ሽ: {
@@ -122,7 +117,6 @@ const f = {
122
117
  a: "ሻ",
123
118
  ee: "ሼ",
124
119
  o: "ሾ",
125
- ua: "ሿ",
126
120
  wa: "ሿ"
127
121
  },
128
122
  ቅ: {
@@ -132,7 +126,6 @@ const f = {
132
126
  a: "ቃ",
133
127
  ee: "ቄ",
134
128
  o: "ቆ",
135
- ua: "ቋ",
136
129
  wa: "ቋ",
137
130
  wi: "ቊ",
138
131
  waa: "ቋ",
@@ -148,7 +141,6 @@ const f = {
148
141
  a: "ባ",
149
142
  ee: "ቤ",
150
143
  o: "ቦ",
151
- ua: "ቧ",
152
144
  wa: "ቧ"
153
145
  },
154
146
  ት: {
@@ -158,7 +150,6 @@ const f = {
158
150
  a: "ታ",
159
151
  ee: "ቴ",
160
152
  o: "ቶ",
161
- ua: "ቷ",
162
153
  wa: "ቷ"
163
154
  },
164
155
  ች: {
@@ -168,7 +159,6 @@ const f = {
168
159
  a: "ቻ",
169
160
  ee: "ቼ",
170
161
  o: "ቾ",
171
- ua: "ቿ",
172
162
  wa: "ቿ"
173
163
  },
174
164
  ን: {
@@ -178,7 +168,6 @@ const f = {
178
168
  a: "ና",
179
169
  ee: "ኔ",
180
170
  o: "ኖ",
181
- ua: "ኗ",
182
171
  wa: "ኗ"
183
172
  },
184
173
  ኝ: {
@@ -188,7 +177,6 @@ const f = {
188
177
  a: "ኛ",
189
178
  ee: "ኜ",
190
179
  o: "ኞ",
191
- ua: "ኟ",
192
180
  wa: "ኟ"
193
181
  },
194
182
  ክ: {
@@ -198,7 +186,6 @@ const f = {
198
186
  a: "ካ",
199
187
  ee: "ኬ",
200
188
  o: "ኮ",
201
- ua: "ኳ",
202
189
  wa: "ኳ",
203
190
  wi: "ኲ",
204
191
  waa: "ኳ",
@@ -213,8 +200,7 @@ const f = {
213
200
  i: "ዊ",
214
201
  a: "ዋ",
215
202
  ee: "ዌ",
216
- o: "ዎ",
217
- ua: ""
203
+ o: "ዎ"
218
204
  },
219
205
  ዝ: {
220
206
  e: "ዘ",
@@ -223,7 +209,6 @@ const f = {
223
209
  a: "ዛ",
224
210
  ee: "ዜ",
225
211
  o: "ዞ",
226
- ua: "ዟ",
227
212
  wa: "ዟ"
228
213
  },
229
214
  ዥ: {
@@ -233,7 +218,6 @@ const f = {
233
218
  a: "ዣ",
234
219
  ee: "ዤ",
235
220
  o: "ዦ",
236
- ua: "ዧ",
237
221
  wa: "ዧ"
238
222
  },
239
223
  ይ: {
@@ -251,7 +235,6 @@ const f = {
251
235
  a: "ጃ",
252
236
  ee: "ጄ",
253
237
  o: "ጆ",
254
- ua: "ጇ",
255
238
  wa: "ጇ"
256
239
  },
257
240
  ድ: {
@@ -261,7 +244,6 @@ const f = {
261
244
  a: "ዳ",
262
245
  ee: "ዴ",
263
246
  o: "ዶ",
264
- ua: "ዷ",
265
247
  wa: "ዷ"
266
248
  },
267
249
  ግ: {
@@ -271,7 +253,6 @@ const f = {
271
253
  a: "ጋ",
272
254
  ee: "ጌ",
273
255
  o: "ጎ",
274
- ua: "ጓ",
275
256
  wa: "ጓ",
276
257
  wi: "ጒ",
277
258
  waa: "ጓ",
@@ -287,7 +268,6 @@ const f = {
287
268
  a: "ጣ",
288
269
  ee: "ጤ",
289
270
  o: "ጦ",
290
- ua: "ጧ",
291
271
  wa: "ጧ"
292
272
  },
293
273
  ጭ: {
@@ -297,7 +277,6 @@ const f = {
297
277
  a: "ጫ",
298
278
  ee: "ጬ",
299
279
  o: "ጮ",
300
- ua: "ጯ",
301
280
  wa: "ጯ"
302
281
  },
303
282
  ጵ: {
@@ -307,7 +286,6 @@ const f = {
307
286
  a: "ጳ",
308
287
  ee: "ጴ",
309
288
  o: "ጶ",
310
- ua: "ጷ",
311
289
  wa: "ጷ"
312
290
  },
313
291
  ጽ: {
@@ -317,7 +295,6 @@ const f = {
317
295
  a: "ጻ",
318
296
  ee: "ጼ",
319
297
  o: "ጾ",
320
- ua: "ጿ",
321
298
  wa: "ጿ"
322
299
  },
323
300
  ፍ: {
@@ -327,7 +304,6 @@ const f = {
327
304
  a: "ፋ",
328
305
  ee: "ፌ",
329
306
  o: "ፎ",
330
- ua: "ፏ",
331
307
  wa: "ፏ"
332
308
  },
333
309
  ፕ: {
@@ -337,7 +313,6 @@ const f = {
337
313
  a: "ፓ",
338
314
  ee: "ፔ",
339
315
  o: "ፖ",
340
- ua: "ፗ",
341
316
  wa: "ፗ"
342
317
  },
343
318
  ቭ: {
@@ -347,7 +322,6 @@ const f = {
347
322
  a: "ቫ",
348
323
  ee: "ቬ",
349
324
  o: "ቮ",
350
- ua: "ቯ",
351
325
  wa: "ቯ"
352
326
  }
353
327
  }, g = {
@@ -364,7 +338,7 @@ const f = {
364
338
  "፣,": "፤",
365
339
  ";": "፤"
366
340
  };
367
- class E {
341
+ class z {
368
342
  /**
369
343
  * Transform input text based on a new key press
370
344
  *
@@ -396,97 +370,97 @@ class E {
396
370
  * // → { transformedValue: 'ሽ', newCursorPosition: 1, isReplacement: true }
397
371
  * \`\`\`
398
372
  */
399
- static transform(e, n, a) {
400
- const i = e.slice(-1), l = i + a;
401
- if (h[l])
373
+ static transform(n, a, e) {
374
+ const t = n.slice(-1), i = t + e;
375
+ if (h[i])
402
376
  return {
403
- transformedValue: e.slice(0, -1) + h[l] + n,
404
- newCursorPosition: e.length,
377
+ transformedValue: n.slice(0, -1) + h[i] + a,
378
+ newCursorPosition: n.length,
405
379
  isReplacement: !0
406
380
  };
407
- if (h[a])
381
+ if (h[e])
408
382
  return {
409
- transformedValue: e + h[a] + n,
410
- newCursorPosition: e.length + 1,
383
+ transformedValue: n + h[e] + a,
384
+ newCursorPosition: n.length + 1,
411
385
  isReplacement: !1
412
386
  };
413
- if (g[l])
387
+ if (g[i])
414
388
  return {
415
- transformedValue: e.slice(0, -1) + g[l] + n,
416
- newCursorPosition: e.length,
389
+ transformedValue: n.slice(0, -1) + g[i] + a,
390
+ newCursorPosition: n.length,
417
391
  isReplacement: !0
418
392
  };
419
- if (f[l] && i.length === 1 && /^[a-zA-Z]$/.test(i) && /^[a-zA-Z]$/.test(a))
393
+ if (f[i] && t.length === 1 && /^[a-zA-Z]$/.test(t) && /^[a-zA-Z]$/.test(e))
420
394
  return {
421
- transformedValue: e.slice(0, -1) + f[l] + n,
422
- newCursorPosition: e.length,
395
+ transformedValue: n.slice(0, -1) + f[i] + a,
396
+ newCursorPosition: n.length,
423
397
  isReplacement: !0
424
398
  };
425
- if (i === "ው" && ["a", "i", "e", "u"].includes(a)) {
426
- const t = e.slice(-2, -1), s = r[t];
399
+ if (t === "ው" && ["a", "i", "e", "u"].includes(e)) {
400
+ const o = n.slice(-2, -1), s = w[o];
427
401
  if (s) {
428
- const c = a === "a" ? "wa" : a === "i" ? "wi" : a === "e" ? "we" : a === "u" ? "wu" : null;
429
- if (c && s[c])
402
+ const u = e === "a" ? "wa" : e === "i" ? "wi" : e === "e" ? "we" : e === "u" ? "wu" : null;
403
+ if (u && s[u])
430
404
  return {
431
- transformedValue: e.slice(0, -2) + s[c] + n,
432
- newCursorPosition: e.length - 1,
405
+ transformedValue: n.slice(0, -2) + s[u] + a,
406
+ newCursorPosition: n.length - 1,
433
407
  isReplacement: !0
434
408
  };
435
409
  }
436
410
  }
437
- if (a === "e") {
438
- const t = this.findCharBeforeWaSeries(i);
439
- if (t) {
440
- const s = r[t];
411
+ if (e === "e") {
412
+ const o = this.findCharBeforeWaSeries(t);
413
+ if (o) {
414
+ const s = w[o];
441
415
  if (s && s.wee)
442
416
  return {
443
- transformedValue: e.slice(0, -1) + s.wee + n,
444
- newCursorPosition: e.length,
417
+ transformedValue: n.slice(0, -1) + s.wee + a,
418
+ newCursorPosition: n.length,
445
419
  isReplacement: !0
446
420
  };
447
421
  }
448
422
  }
449
- const o = r[i];
450
- if (o && o[a])
423
+ const c = w[t];
424
+ if (c && c[e])
451
425
  return {
452
- transformedValue: e.slice(0, -1) + o[a] + n,
453
- newCursorPosition: e.length,
426
+ transformedValue: n.slice(0, -1) + c[e] + a,
427
+ newCursorPosition: n.length,
454
428
  isReplacement: !0
455
429
  };
456
- if (a === "e" && i) {
457
- const t = this.findSadisBase(i);
458
- if (t && t !== i) {
459
- const s = r[t];
430
+ if (e === "e" && t) {
431
+ const o = this.findSadisBase(t);
432
+ if (o && o !== t) {
433
+ const s = w[o];
460
434
  if (s && s.ee)
461
435
  return {
462
- transformedValue: e.slice(0, -1) + s.ee + n,
463
- newCursorPosition: e.length,
436
+ transformedValue: n.slice(0, -1) + s.ee + a,
437
+ newCursorPosition: n.length,
464
438
  isReplacement: !0
465
439
  };
466
440
  }
467
441
  }
468
- if (["a", "i"].includes(a)) {
469
- const t = this.findSadisBase(i);
470
- if (t) {
471
- const s = r[t];
442
+ if (["a", "i"].includes(e)) {
443
+ const o = this.findSadisBase(t);
444
+ if (o) {
445
+ const s = w[o];
472
446
  if (s) {
473
- const c = a + a, u = s[c];
474
- if (u)
447
+ const u = e + e, l = s[u];
448
+ if (l)
475
449
  return {
476
- transformedValue: e.slice(0, -1) + u + n,
477
- newCursorPosition: e.length,
450
+ transformedValue: n.slice(0, -1) + l + a,
451
+ newCursorPosition: n.length,
478
452
  isReplacement: !0
479
453
  };
480
454
  }
481
455
  }
482
456
  }
483
- return f[a] ? {
484
- transformedValue: e + f[a] + n,
485
- newCursorPosition: e.length + 1,
457
+ return f[e] ? {
458
+ transformedValue: n + f[e] + a,
459
+ newCursorPosition: n.length + 1,
486
460
  isReplacement: !1
487
461
  } : {
488
- transformedValue: e + a + n,
489
- newCursorPosition: e.length + 1,
462
+ transformedValue: n + e + a,
463
+ newCursorPosition: n.length + 1,
490
464
  isReplacement: !1
491
465
  };
492
466
  }
@@ -507,9 +481,9 @@ class E {
507
481
  * GeezEngine.findSadisBase('x') // returns null (not a Geez character)
508
482
  * \`\`\`
509
483
  */
510
- static findSadisBase(e) {
511
- for (const [n, a] of Object.entries(r))
512
- if (n === e || Object.values(a).includes(e)) return n;
484
+ static findSadisBase(n) {
485
+ for (const [a, e] of Object.entries(w))
486
+ if (a === n || Object.values(e).includes(n)) return a;
513
487
  return null;
514
488
  }
515
489
  /**
@@ -529,17 +503,17 @@ class E {
529
503
  * GeezEngine.findCharBeforeWaSeries('ላ') // returns null
530
504
  * \`\`\`
531
505
  */
532
- static findCharBeforeWaSeries(e) {
533
- for (const [n, a] of Object.entries(r))
534
- if (a.we === e) return n;
506
+ static findCharBeforeWaSeries(n) {
507
+ for (const [a, e] of Object.entries(w))
508
+ if (e.we === n) return a;
535
509
  return null;
536
510
  }
537
511
  }
538
- const y = (w = {}) => {
539
- const { enabled: e = !0, onTransform: n } = w;
512
+ const y = (r = {}) => {
513
+ const { onTransform: n } = r;
540
514
  return { onKeyDown: v(
541
- (i) => {
542
- if (!e || [
515
+ (e) => {
516
+ if ([
543
517
  "Backspace",
544
518
  "Delete",
545
519
  "ArrowLeft",
@@ -553,74 +527,74 @@ const y = (w = {}) => {
553
527
  "Escape",
554
528
  "PageUp",
555
529
  "PageDown"
556
- ].includes(i.key) || i.ctrlKey || i.metaKey || i.key.length !== 1 || i.altKey) return;
557
- i.preventDefault();
558
- const o = i.currentTarget, { selectionStart: t, selectionEnd: s, value: c } = o, u = c.substring(0, t || 0), K = c.substring(s || 0), d = E.transform(u, K, i.key), m = Object.getOwnPropertyDescriptor(o.constructor.prototype, "value");
559
- m && m.set ? m.set.bind(o)(d.transformedValue) : o.value = d.transformedValue;
530
+ ].includes(e.key) || e.ctrlKey || e.metaKey || e.key.length !== 1 || e.altKey) return;
531
+ e.preventDefault();
532
+ const i = e.currentTarget, { selectionStart: c, selectionEnd: o, value: s } = i, u = s.substring(0, c || 0), l = s.substring(o || 0), d = z.transform(u, l, e.key), m = Object.getOwnPropertyDescriptor(i.constructor.prototype, "value");
533
+ m && m.set ? m.set.bind(i)(d.transformedValue) : i.value = d.transformedValue;
560
534
  let p;
561
535
  typeof InputEvent < "u" ? p = new InputEvent("input", {
562
536
  bubbles: !0,
563
537
  cancelable: !0,
564
538
  inputType: "insertText",
565
- data: i.key
566
- }) : p = new Event("input", { bubbles: !0, cancelable: !0 }), o.dispatchEvent(p);
567
- const z = new Event("change", {
539
+ data: e.key
540
+ }) : p = new Event("input", { bubbles: !0, cancelable: !0 }), i.dispatchEvent(p);
541
+ const K = new Event("change", {
568
542
  bubbles: !0,
569
543
  cancelable: !0
570
544
  });
571
- o.dispatchEvent(z), requestAnimationFrame(() => {
572
- if (document.activeElement === o)
545
+ i.dispatchEvent(K), requestAnimationFrame(() => {
546
+ if (document.activeElement === i)
573
547
  try {
574
- o.setSelectionRange(d.newCursorPosition, d.newCursorPosition);
548
+ i.setSelectionRange(d.newCursorPosition, d.newCursorPosition);
575
549
  } catch {
576
550
  }
577
551
  }), n && n(d);
578
552
  },
579
- [e, n]
553
+ [n]
580
554
  ) };
581
- }, P = S(
582
- ({ mode: w = "geez", className: e, onChange: n, onKeyDown: a, value: i, ...l }, o) => {
583
- const { onKeyDown: t } = y({ enabled: w === "geez" });
555
+ }, E = S(
556
+ ({ mode: r = "geez", className: n, onChange: a, onKeyDown: e, value: t, ...i }, c) => {
557
+ const { onKeyDown: o } = y();
584
558
  return /* @__PURE__ */ b(
585
559
  "input",
586
560
  {
587
- ...l,
588
- ...i !== void 0 && { value: i },
589
- ref: o,
590
- onKeyDown: (u) => {
591
- w === "geez" && t(u), a && a(u);
561
+ ...i,
562
+ ...t !== void 0 && { value: t },
563
+ ref: c,
564
+ onKeyDown: (l) => {
565
+ r === "geez" && o(l), e && e(l);
592
566
  },
593
- onChange: (u) => {
594
- n && n(u);
567
+ onChange: (l) => {
568
+ a && a(l);
595
569
  },
596
- className: e
570
+ className: n
597
571
  }
598
572
  );
599
573
  }
600
574
  );
601
- P.displayName = "GeezInput";
602
- const R = S(
603
- ({ mode: w = "geez", className: e, onChange: n, onKeyDown: a, value: i, ...l }, o) => {
604
- const { onKeyDown: t } = y({ enabled: w === "geez" });
575
+ E.displayName = "GeezInput";
576
+ const P = S(
577
+ ({ mode: r = "geez", className: n, onChange: a, onKeyDown: e, value: t, ...i }, c) => {
578
+ const { onKeyDown: o } = y();
605
579
  return /* @__PURE__ */ b(
606
580
  "textarea",
607
581
  {
608
- ...l,
609
- ...i !== void 0 && { value: i },
610
- ref: o,
611
- onKeyDown: (u) => {
612
- w === "geez" && t(u), a && a(u);
582
+ ...i,
583
+ ...t !== void 0 && { value: t },
584
+ ref: c,
585
+ onKeyDown: (l) => {
586
+ r === "geez" && o(l), e && e(l);
613
587
  },
614
- onChange: (u) => {
615
- n && n(u);
588
+ onChange: (l) => {
589
+ a && a(l);
616
590
  },
617
- className: e
591
+ className: n
618
592
  }
619
593
  );
620
594
  }
621
595
  );
622
- R.displayName = "GeezTextArea";
596
+ P.displayName = "GeezTextArea";
623
597
  export {
624
- P as GeezInput,
625
- R as GeezTextArea
598
+ E as GeezInput,
599
+ P as GeezTextArea
626
600
  };
package/dist/mapping.d.ts CHANGED
@@ -19,13 +19,13 @@ export declare const CONSONANTS: Record<string, string>;
19
19
  * - i (ሳልስ/Salis) - i modification
20
20
  * - aa/A (ራብዕ/Rabee) - aa modification
21
21
  * - ee/E (ኃምስ/Hamis) - ee modification
22
- * - o (ሳድስ/Sadis) - o modification
23
- * - ua (ሳብዕ/Sabe) - ua modification (not available for all)
22
+ * - o (ሳብዕ/Sabei) - o modification
23
+ * - wa (ዲቃላ/Dikaala) - wa modification
24
24
  *
25
25
  * @example
26
26
  * \`\`\`ts
27
27
  * SYLLABLES['ህ']['a'] // returns 'ሀ'
28
- * SYLLABLES['ል']['ua'] // returns 'ሏ'
28
+ * SYLLABLES['ል']['wa'] // returns 'ሏ'
29
29
  * \`\`\`
30
30
  */
31
31
  export declare const SYLLABLES: Record<string, Record<string, string>>;
package/dist/types.d.ts CHANGED
@@ -29,13 +29,11 @@ export interface EngineResult {
29
29
  }
30
30
  /**
31
31
  * Keyboard configuration settings
32
- * @deprecated Not currently used in the library
32
+ * @deprecated Not currently used in the library but will be used in the future
33
33
  */
34
34
  export interface KeyboardConfig {
35
- /** Whether the Geez keyboard is enabled */
36
- enabled: boolean;
37
35
  /** The phonetic standard to use */
38
- standard: "GFF" | "Custom";
36
+ mode: "geez" | "latin";
39
37
  }
40
38
  /**
41
39
  * Configuration options for the useGeez hook
@@ -46,11 +44,6 @@ export interface GeezOptions {
46
44
  * @param result - The result of the transformation
47
45
  */
48
46
  onTransform?: (result: EngineResult) => void;
49
- /**
50
- * Whether Geez transformation is enabled
51
- * @default true
52
- */
53
- enabled?: boolean;
54
47
  }
55
48
  /**
56
49
  * Geez transformation statistics for a single operation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geez-input",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Type-safe React library for Geez (Ethiopic) script input with phonetic keyboard support",
5
5
  "keywords": [
6
6
  "geez",