@inshapardaz/likhari-react 0.1.21-dev.206 → 0.1.22

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.
Files changed (35) hide show
  1. package/dist/EditorRoot.d.ts +0 -9
  2. package/dist/EditorRoot.d.ts.map +1 -1
  3. package/dist/EditorRoot.js +11 -12
  4. package/dist/components/Toolbar.d.ts +1 -4
  5. package/dist/components/Toolbar.d.ts.map +1 -1
  6. package/dist/components/Toolbar.js +2 -3
  7. package/dist/i18n/strings.d.ts +0 -14
  8. package/dist/i18n/strings.d.ts.map +1 -1
  9. package/dist/i18n/strings.js +5 -47
  10. package/dist/index.d.ts +0 -5
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +0 -2
  13. package/dist/theme/editor.css +0 -58
  14. package/package.json +1 -1
  15. package/dist/autocorrect/AutoCorrectPlugin.d.ts +0 -27
  16. package/dist/autocorrect/AutoCorrectPlugin.d.ts.map +0 -1
  17. package/dist/autocorrect/AutoCorrectPlugin.js +0 -108
  18. package/dist/autocorrect/autoCorrectActions.d.ts +0 -35
  19. package/dist/autocorrect/autoCorrectActions.d.ts.map +0 -1
  20. package/dist/autocorrect/autoCorrectActions.js +0 -182
  21. package/dist/autocorrect/autoCorrectStores.d.ts +0 -52
  22. package/dist/autocorrect/autoCorrectStores.d.ts.map +0 -1
  23. package/dist/autocorrect/autoCorrectStores.js +0 -115
  24. package/dist/autocorrect/punctuationRules.d.ts +0 -26
  25. package/dist/autocorrect/punctuationRules.d.ts.map +0 -1
  26. package/dist/autocorrect/punctuationRules.js +0 -53
  27. package/dist/cleanup/textCleanupActions.d.ts +0 -8
  28. package/dist/cleanup/textCleanupActions.d.ts.map +0 -1
  29. package/dist/cleanup/textCleanupActions.js +0 -28
  30. package/dist/components/AutoCorrectPanel.d.ts +0 -15
  31. package/dist/components/AutoCorrectPanel.d.ts.map +0 -1
  32. package/dist/components/AutoCorrectPanel.js +0 -44
  33. package/dist/normalization/urduNormalize.d.ts +0 -24
  34. package/dist/normalization/urduNormalize.d.ts.map +0 -1
  35. package/dist/normalization/urduNormalize.js +0 -116
@@ -1,116 +0,0 @@
1
- /**
2
- * Urdu character normalisation, ported from urduhack's `normalization/character.py`
3
- * (MIT licence, https://github.com/urduhack/urduhack). The mapping replaces
4
- * Arabic and presentation-form letters with the standard Urdu letter, and
5
- * the tables below keep the same entries and order as the original, so the
6
- * output matches it character for character.
7
- */
8
- const CORRECT_URDU_CHARACTERS = {
9
- "آ": ["ﺁ", "ﺂ"],
10
- "أ": ["ﺃ"],
11
- "ا": ["ﺍ", "ﺎ"],
12
- "ب": ["ﺏ", "ﺐ", "ﺑ", "ﺒ"],
13
- "پ": ["ﭖ", "ﭘ", "ﭙ"],
14
- "ت": ["ﺕ", "ﺖ", "ﺗ", "ﺘ"],
15
- "ٹ": ["ﭦ", "ﭧ", "ﭨ", "ﭩ"],
16
- "ث": ["ﺛ", "ﺜ", "ﺚ"],
17
- "ج": ["ﺝ", "ﺞ", "ﺟ", "ﺠ"],
18
- "ح": ["ﺡ", "ﺣ", "ﺤ", "ﺢ"],
19
- "خ": ["ﺧ", "ﺨ", "ﺦ"],
20
- "د": ["ﺩ", "ﺪ"],
21
- "ذ": ["ﺬ", "ﺫ"],
22
- "ر": ["ﺭ", "ﺮ"],
23
- "ز": ["ﺯ", "ﺰ"],
24
- "س": ["ﺱ", "ﺲ", "ﺳ", "ﺴ"],
25
- "ش": ["ﺵ", "ﺶ", "ﺷ", "ﺸ"],
26
- "ص": ["ﺹ", "ﺺ", "ﺻ", "ﺼ"],
27
- "ض": ["ﺽ", "ﺾ", "ﺿ", "ﻀ"],
28
- "ط": ["ﻃ", "ﻄ"],
29
- "ظ": ["ﻅ", "ﻇ", "ﻈ"],
30
- "ع": ["ﻉ", "ﻊ", "ﻋ", "ﻌ"],
31
- "غ": ["ﻍ", "ﻏ", "ﻐ"],
32
- "ف": ["ﻑ", "ﻒ", "ﻓ", "ﻔ"],
33
- "ق": ["ﻕ", "ﻖ", "ﻗ", "ﻘ"],
34
- "ل": ["ﻝ", "ﻞ", "ﻟ", "ﻠ"],
35
- "م": ["ﻡ", "ﻢ", "ﻣ", "ﻤ"],
36
- "ن": ["ﻥ", "ﻦ", "ﻧ", "ﻨ"],
37
- "چ": ["ﭺ", "ﭻ", "ﭼ", "ﭽ"],
38
- "ڈ": ["ﮈ", "ﮉ"],
39
- "ڑ": ["ﮍ", "ﮌ"],
40
- "ژ": ["ﮋ"],
41
- "ک": ["ﮎ", "ﮏ", "ﮐ", "ﮑ", "ﻛ", "ك"],
42
- "گ": ["ﮒ", "ﮓ", "ﮔ", "ﮕ"],
43
- "ں": ["ﮞ", "ﮟ"],
44
- "و": ["ﻮ", "ﻭ", "ﻮ"],
45
- "ؤ": ["ﺅ"],
46
- "ھ": ["ﮪ", "ﮬ", "ﮭ", "ﻬ", "ﻫ", "ﮫ"],
47
- "ہ": ["ﻩ", "ﮦ", "ﻪ", "ﮧ", "ﮩ", "ﮨ", "ه"],
48
- "ۂ": [],
49
- "ۃ": ["ة"],
50
- "ء": ["ﺀ"],
51
- "ی": ["ﯼ", "ى", "ﯽ", "ﻰ", "ﻱ", "ﻲ", "ﯾ", "ﯿ", "ي"],
52
- "ئ": ["ﺋ", "ﺌ"],
53
- "ے": ["ﮮ", "ﮯ", "ﻳ", "ﻴ"],
54
- "ۓ": [],
55
- "۰": ["٠"],
56
- "۱": ["١"],
57
- "۲": ["٢"],
58
- "۳": ["٣"],
59
- "۴": ["٤"],
60
- "۵": ["٥"],
61
- "۶": ["٦"],
62
- "۷": ["٧"],
63
- "۸": ["٨"],
64
- "۹": ["٩"],
65
- "۔": [],
66
- "؟": [],
67
- "٫": [],
68
- "،": [],
69
- "لا": ["ﻻ", "ﻼ"],
70
- "": ["ـ"],
71
- };
72
- const TRANSLATOR = new Map();
73
- for (const [key, values] of Object.entries(CORRECT_URDU_CHARACTERS)) {
74
- for (const value of values)
75
- TRANSLATOR.set(value, key);
76
- }
77
- /** Combining diacritics (harakat and similar), as urduhack's URDU_DIACRITICS. */
78
- const DIACRITICS = new Set(['َ', 'ً', 'ٰ', 'ِ', 'ُ', 'ٍ']);
79
- const ENGLISH_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
80
- const URDU_DIGITS = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
81
- /** Replaces Arabic and presentation-form letters with standard Urdu letters, character by character. */
82
- export function normalizeUrduCharacters(text) {
83
- let out = '';
84
- for (const char of text)
85
- out += TRANSLATOR.get(char) ?? char;
86
- return out;
87
- }
88
- export function removeUrduDiacritics(text) {
89
- let out = '';
90
- for (const char of text)
91
- if (!DIACRITICS.has(char))
92
- out += char;
93
- return out;
94
- }
95
- /** Converts Urdu digits to English digits, or the reverse. */
96
- export function replaceUrduDigits(text, to) {
97
- const from = to === 'english' ? URDU_DIGITS : ENGLISH_DIGITS;
98
- const target = to === 'english' ? ENGLISH_DIGITS : URDU_DIGITS;
99
- let out = '';
100
- for (const char of text) {
101
- const index = from.indexOf(char);
102
- out += index === -1 ? char : target[index];
103
- }
104
- return out;
105
- }
106
- /**
107
- * The normalisation urduhack's `normalize` applies, with the diacritic and
108
- * digit steps made optional. Character mapping always runs.
109
- */
110
- export function normalizeUrdu(text, options = {}) {
111
- let out = options.removeDiacritics ? removeUrduDiacritics(text) : text;
112
- out = normalizeUrduCharacters(out);
113
- if (options.digits === 'english' || options.digits === 'urdu')
114
- out = replaceUrduDigits(out, options.digits);
115
- return out;
116
- }