unicode-input-toolconverter 0.2.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.
Files changed (123) hide show
  1. package/.babelrc.json +3 -0
  2. package/.editorconfig +16 -0
  3. package/.nojekyll +0 -0
  4. package/.nyc_output/out.json +173804 -0
  5. package/.nyc_output/processinfo/index.json +1 -0
  6. package/CHANGES.md +11 -0
  7. package/COPYING.LESSER.txt +180 -0
  8. package/COPYING.txt +687 -0
  9. package/README.md +65 -0
  10. package/_locales/en-US/messages.json +3126 -0
  11. package/_locales/hu-HU/messages.json +3126 -0
  12. package/_locales/pt-BR/messages.json +3126 -0
  13. package/_locales/sv-SE/messages.json +3126 -0
  14. package/babel.config.json +5 -0
  15. package/browser_action/characterSelection.js +91 -0
  16. package/browser_action/charrefConverters.js +389 -0
  17. package/browser_action/chartBuild.js +155 -0
  18. package/browser_action/encodingBehaviors.js +72 -0
  19. package/browser_action/encodings.js +97 -0
  20. package/browser_action/entities.js +12 -0
  21. package/browser_action/entityBehaviors.js +96 -0
  22. package/browser_action/index-es.html +15 -0
  23. package/browser_action/index-instrumented.html +16 -0
  24. package/browser_action/index-pages.html +16 -0
  25. package/browser_action/index.html +16 -0
  26. package/browser_action/index.iife.min.js +2 -0
  27. package/browser_action/index.iife.min.js.map +1 -0
  28. package/browser_action/index.instrumented.iife.min.js +2 -0
  29. package/browser_action/index.instrumented.iife.min.js.map +1 -0
  30. package/browser_action/index.js +95 -0
  31. package/browser_action/preferences/prefDefaults.js +52 -0
  32. package/browser_action/service-worker/sw-activateCallback.js +53 -0
  33. package/browser_action/service-worker/sw-locales.json +6 -0
  34. package/browser_action/service-worker/sw-resources.json +73 -0
  35. package/browser_action/service-worker/sw-unicode-data.json +3 -0
  36. package/browser_action/styles/unicode-dialog.css +391 -0
  37. package/browser_action/templateUtils/elements.js +12 -0
  38. package/browser_action/templateUtils/fill.js +3 -0
  39. package/browser_action/templateUtils/validation.js +6 -0
  40. package/browser_action/templates/chartBuild.js +185 -0
  41. package/browser_action/templates/index.js +1304 -0
  42. package/browser_action/templatesElementCustomization/widgets.js +56 -0
  43. package/browser_action/unicode/UnicodeConverter.js +793 -0
  44. package/browser_action/unicode/charrefunicodeDb.js +258 -0
  45. package/browser_action/unicode/getScriptInfoForCodePoint.js +646 -0
  46. package/browser_action/unicode/hangul.js +253 -0
  47. package/browser_action/unicode/lastScriptNames.json +5 -0
  48. package/browser_action/unicode/parseUnihanFromTextFileStrings.js +56 -0
  49. package/browser_action/unicode/unicodeFieldInfo.js +120 -0
  50. package/browser_action/unicode/unicodeScripts.js +4912 -0
  51. package/browser_action/unicode/unihan.js +129 -0
  52. package/browser_action/unicode/unihanDbPopulate.js +26 -0
  53. package/browser_action/unicodecharref.js +1480 -0
  54. package/browser_action/utils/DOMUtils.js +122 -0
  55. package/browser_action/utils/FetchUtils.js +19 -0
  56. package/browser_action/utils/TextUtils.js +28 -0
  57. package/browser_action/utils/TypedArrayUtils.js +21 -0
  58. package/browser_action/utils/semicolonSeparatedToArray.js +12 -0
  59. package/browser_action/utils/setupServiceWorker.js +193 -0
  60. package/cypress.config.js +21 -0
  61. package/download/entities/copyright-software-20021231.html +70 -0
  62. package/download/entities/html5-uppercase.ent +54 -0
  63. package/download/entities/htmlmathml-f.ent +2164 -0
  64. package/download/entities/isoamsa.ent +201 -0
  65. package/download/entities/isoamsb.ent +177 -0
  66. package/download/entities/isoamsc.ent +77 -0
  67. package/download/entities/isoamsn.ent +148 -0
  68. package/download/entities/isoamso.ent +107 -0
  69. package/download/entities/isoamsr.ent +238 -0
  70. package/download/entities/isobox.ent +95 -0
  71. package/download/entities/isocyr1.ent +122 -0
  72. package/download/entities/isocyr2.ent +81 -0
  73. package/download/entities/isodia.ent +69 -0
  74. package/download/entities/isogrk1.ent +104 -0
  75. package/download/entities/isogrk2.ent +75 -0
  76. package/download/entities/isogrk3.ent +98 -0
  77. package/download/entities/isogrk4.ent +98 -0
  78. package/download/entities/isolat1.ent +117 -0
  79. package/download/entities/isolat2.ent +176 -0
  80. package/download/entities/isomfrk.ent +107 -0
  81. package/download/entities/isomopf.ent +81 -0
  82. package/download/entities/isomscr.ent +107 -0
  83. package/download/entities/isonum.ent +131 -0
  84. package/download/entities/isopub.ent +140 -0
  85. package/download/entities/isotech.ent +216 -0
  86. package/download/entities/mmlalias.ent +598 -0
  87. package/download/entities/mmlextra.ent +154 -0
  88. package/download/entities/predefined.ent +52 -0
  89. package/download/entities/w3centities-f.ent +2276 -0
  90. package/download/entities/xhtml1-lat1.ent +143 -0
  91. package/download/entities/xhtml1-special.ent +78 -0
  92. package/download/entities/xhtml1-symbol.ent +171 -0
  93. package/eslint.config.js +66 -0
  94. package/icons/openWindow16.png +0 -0
  95. package/icons/openWindow24.png +0 -0
  96. package/lgtm.yml +5 -0
  97. package/lib/background.html +11 -0
  98. package/lib/background.js +13 -0
  99. package/lib/overlay.css +6 -0
  100. package/manifest.json +37 -0
  101. package/package.json +121 -0
  102. package/polyfills/browser-polyfill.min.js +8 -0
  103. package/polyfills/browser-polyfill.min.js.map +1 -0
  104. package/server.js +61 -0
  105. package/sw.js +259 -0
  106. package/tools/entities-import.js +62 -0
  107. package/tools/findEsResources.js +30 -0
  108. package/tools/list-locales.js +17 -0
  109. package/tools/parseUnicodeCharts.js +428 -0
  110. package/tools/ucd-import.js +24 -0
  111. package/tools/unicode-charts.html +596 -0
  112. package/tools/unihan-import.js +72 -0
  113. package/unicode_copyright.txt +46 -0
  114. package/vendor/camelcase/index.js +110 -0
  115. package/vendor/fflate/esm/browser.js +2665 -0
  116. package/vendor/intl-dom/dist/index.esm.js +2962 -0
  117. package/vendor/jamilih/dist/jml-es.js +2359 -0
  118. package/vendor/jquery/dist/jquery.js +10716 -0
  119. package/vendor/json-6/dist/index.mjs +1783 -0
  120. package/vendor/miller-columns/dist/index-es.min.js +1 -0
  121. package/vendor/miller-columns/miller-columns.css +75 -0
  122. package/vendor/simple-prefs/dist/index.esm.js +286 -0
  123. package/web-ext-config.cjs +13 -0
@@ -0,0 +1,253 @@
1
+ /* eslint-disable unicorn/prefer-string-slice -- Easier */
2
+ // Function can also be used standalone
3
+ /**
4
+ * @namespace This contains methods for translating Korean Hangul/Jamo,
5
+ * since these are obtained programmatically and not through the Unicode (or
6
+ * Unihan) database
7
+ */
8
+
9
+ // Private static
10
+ const JAMO_L_TABLE = [
11
+ 'G', 'GG', 'N', 'D', 'DD', 'R', 'M', 'B', 'BB',
12
+ 'S', 'SS', '', 'J', 'JJ', 'C', 'K', 'T', 'P', 'H'
13
+ ],
14
+ JAMO_V_TABLE = [
15
+ 'A', 'AE', 'YA', 'YAE', 'EO', 'E', 'YEO', 'YE', 'O',
16
+ 'WA', 'WAE', 'OE', 'YO', 'U', 'WEO', 'WE', 'WI',
17
+ 'YU', 'EU', 'YI', 'I'
18
+ ],
19
+ JAMO_T_TABLE = [
20
+ '', 'G', 'GG', 'GS', 'N', 'NJ', 'NH', 'D', 'L', 'LG', 'LM',
21
+ 'LB', 'LS', 'LT', 'LP', 'LH', 'M', 'B', 'BS',
22
+ 'S', 'SS', 'NG', 'J', 'C', 'K', 'T', 'P', 'H'
23
+ ];
24
+ const sBase = 0xAC00,
25
+ lBase = 0x1100,
26
+ vBase = 0x1161,
27
+ tBase = 0x11A7,
28
+ sCount = 11172,
29
+ lCount = 19, // Not in use for decomposition
30
+ vCount = 21,
31
+ tCount = 28,
32
+ nCount = vCount * tCount;
33
+
34
+ /**
35
+ * Break up a Hangul syllable into its Jamo components.
36
+ * Currently unused.
37
+ * @param {Integer} syllableCode Decimal code point for Hangul syllable
38
+ * to decompose
39
+ * @returns {Integer[]|string} An array of the numeric value of each
40
+ * component or string if unchanged
41
+ */
42
+ function decomposeHangul (syllableCode) {
43
+ const sIndex = syllableCode - sBase;
44
+ if (sIndex < 0 || sIndex >= sCount) {
45
+ // Return as single-item array instead or change "result" to String?
46
+ return String.fromCodePoint(syllableCode);
47
+ }
48
+ const result = [];
49
+ const l = lBase + Math.floor(sIndex / nCount);
50
+ const v = vBase + Math.floor((sIndex % nCount) / tCount);
51
+ const t = tBase + (sIndex % tCount);
52
+ result.push(String.fromCodePoint(l), String.fromCodePoint(v));
53
+ if (t !== tBase) {
54
+ result.push(String.fromCodePoint(t));
55
+ }
56
+ return result;
57
+ }
58
+ /**
59
+ *
60
+ * @param {string[]} source
61
+ * @returns {string[]}
62
+ */
63
+ function composeHangul (source) {
64
+ const len = source.length;
65
+ if (len === 0) {
66
+ return '';
67
+ }
68
+ const result = [];
69
+ const chars = [...source];
70
+
71
+ let last = chars[0];
72
+
73
+ // copy first char
74
+ result.push(last);
75
+
76
+ chars.slice(1).forEach((ch) => {
77
+ // 1. check to see if two current characters are L and V
78
+ const lIndex = last.codePointAt() - lBase;
79
+ if (lIndex > 0 && lIndex < lCount) {
80
+ const vIndex = ch.codePointAt() - vBase;
81
+ if (vIndex > 0 && vIndex < vCount) {
82
+ // make syllable of form LV
83
+ last = String.fromCodePoint(
84
+ sBase + (((lIndex * vCount) + vIndex) * tCount)
85
+ );
86
+ result[result.length - 1] = last; // reset last
87
+ return; // discard ch
88
+ }
89
+ }
90
+
91
+ // 2. check to see if two current characters are LV and T
92
+ const sIndex = last.codePointAt() - sBase;
93
+ if (sIndex > 0 && sIndex < sCount && (sIndex % tCount) === 0) {
94
+ const tIndex = ch.codePointAt() - tBase;
95
+ if (tIndex >= 0 && tIndex < tCount) {
96
+ // make syllable of form LVT
97
+ last = String.fromCodePoint(last.codePointAt() + tIndex);
98
+ result[result.length - 1] = last; // reset last
99
+ return; // discard ch
100
+ }
101
+ }
102
+ // if neither case was true, just add the character
103
+ last = ch;
104
+ result.push(ch);
105
+ });
106
+ return result;
107
+ }
108
+
109
+ /**
110
+ * Gets a Unicode character for the passed-in Hangul syllable name.
111
+ * @param {string} name The name of the syllable to find
112
+ * @author Brett Zamir (others adapted directly from Unicode)
113
+ * @returns {string|boolean} False if invalid, or otherwise the Hangul
114
+ * character represented by the supplied name
115
+ */
116
+ function getHangulFromName (name) {
117
+ // Turn indices into individual Jamo characters
118
+ let t, lIndex, vIndex, tIndex;
119
+ let ptr = 1;
120
+
121
+ // L (can be 1-2 in name length)
122
+ if (name.charAt(0) === name.charAt(1)) { // All two-letter names are doubles
123
+ lIndex = JAMO_L_TABLE.indexOf(name.slice(0, 2));
124
+ ptr++;
125
+ } else {
126
+ lIndex = JAMO_L_TABLE.indexOf(name.slice(0, 1));
127
+ }
128
+
129
+ // V (can be 1-3 in name length)
130
+ vIndex = JAMO_V_TABLE.indexOf(name.substr(ptr, 3));
131
+ if (vIndex !== -1) {
132
+ ptr += 3;
133
+ } else {
134
+ vIndex = JAMO_V_TABLE.indexOf(name.substr(ptr, 2));
135
+ if (vIndex !== -1) {
136
+ ptr += 2;
137
+ } else {
138
+ vIndex = JAMO_V_TABLE.indexOf(name.substr(ptr, 1));
139
+ ptr++;
140
+ }
141
+ }
142
+
143
+ // T (can be 1-2 in name length)
144
+ tIndex = JAMO_T_TABLE.indexOf(name.substr(ptr, 2).padStart(2, '0'));
145
+ if (tIndex !== -1) {
146
+ ptr += 2;
147
+ } else {
148
+ tIndex = JAMO_T_TABLE.indexOf(name.substr(ptr, 1));
149
+ ptr++;
150
+ }
151
+ if (
152
+ lIndex === -1 || vIndex === -1 ||
153
+ (tIndex && ptr < name.length)
154
+ ) { // If an invalid Hangul syllable name was passed in
155
+ return false;
156
+ }
157
+
158
+ const l = getJamoForIndex(lIndex, 'l');
159
+ const v = getJamoForIndex(vIndex, 'v');
160
+
161
+ // May only be LV
162
+ t = '';
163
+ if (tIndex) {
164
+ t = getJamoForIndex(tIndex, 't');
165
+ }
166
+
167
+ // Join Jamo characters together
168
+ const jamo = l + v + t;
169
+ // Convert Jamo into composite Hangul syllable
170
+ return composeHangul(jamo).join('');
171
+ }
172
+
173
+ /**
174
+ * Utility (could be adapted to accept the letter(s)).
175
+ * @param {string} index
176
+ * @param {'l'|'v'|'t'} type
177
+ * @throws {TypeError}
178
+ * @returns {string}
179
+ */
180
+ function getJamoForIndex (index, type) {
181
+ switch (type) {
182
+ case 'l':
183
+ return String.fromCodePoint(lBase + index);
184
+ case 'v':
185
+ return String.fromCodePoint(vBase + index);
186
+ case 't':
187
+ return String.fromCodePoint(tBase + index);
188
+ default:
189
+ throw new TypeError('Unexpected type passed to getJamoCodePointForName');
190
+ }
191
+ }
192
+
193
+ /**
194
+ * @param {PositiveInteger} syllableCode
195
+ * @throws {Error}
196
+ * @returns {string}
197
+ */
198
+ function getHangulName (syllableCode) {
199
+ // Adapted from Hangul Character Names:
200
+ // https://unicode.org/reports/tr15/#Hangul
201
+
202
+ // Following numbered items, with minor changes are from
203
+ // https://unicode.org/versions/Unicode5.0.0/ch03.pdf
204
+ // now:
205
+ // https://unicode.org/versions/Unicode13.0.0/ch03.pdf
206
+ // 1. Compute the index of the syllable:
207
+ // SIndex = S - SBase
208
+ const sIndex = syllableCode - sBase;
209
+ // 2. If SIndex is in the range (0 ? SIndex < SCount), then compute the
210
+ // components as follows:
211
+ // The operators /” and “%” are as defined in Table A-3 in Appendix A,
212
+ // Notational Conventions.
213
+ if (sIndex < 0 || sIndex >= sCount) {
214
+ throw new Error('Not a hangul syllable ' + syllableCode);
215
+ }
216
+ /*
217
+ const l = lBase + Math.floor(sIndex / nCount);
218
+ const v = vBase + Math.floor((sIndex % nCount) / tCount);
219
+ const t = tBase + sIndex % tCount;
220
+ */
221
+ const l = Math.floor(sIndex / nCount);
222
+ const v = Math.floor((sIndex % nCount) / tCount);
223
+ const t = sIndex % tCount;
224
+ return JAMO_L_TABLE[l] + JAMO_V_TABLE[v] + JAMO_T_TABLE[t];
225
+
226
+ // 3. If T = TBase, then there is no trailing character, so replace S by the
227
+ // sequence L V. Otherwise, there is a trailing character, so replace S
228
+ // by the sequence L V T.
229
+ // Example. Compute the components:
230
+ // L = LBase + 17
231
+ // V = VBase + 16
232
+ // T = TBase + 15
233
+ // and replace the syllable by the sequence of components:
234
+ // 0xD4DB => 0x1111, 0x1171, 0x11B6
235
+ /*
236
+ const arr = [l, v];
237
+ if (t !== tBase) {
238
+ arr.push(t);
239
+ }
240
+ // The character names for Hangul syllables are derived from the
241
+ // decomposition by starting with the string hangul syllable, and
242
+ // appending the short name of each decomposition component in order.
243
+ for (let c = 0; c < arr.length; c++) {
244
+ const jamoComponent = getJamo(arr[c]);
245
+ cjkText += jamoComponent;
246
+ }
247
+ */
248
+ }
249
+
250
+ export {
251
+ decomposeHangul, composeHangul, getHangulFromName,
252
+ getJamoForIndex, getHangulName
253
+ };
@@ -0,0 +1,5 @@
1
+
2
+ {
3
+ "$comment": "Do not edit this file; this is an auto-generated file used to track script names, some of which may end up needing to be deleted from locale files if no longer in use",
4
+ "lastScriptNames": ["European_Scripts","Armenian","Armenian_Ligatures","Carian","Caucasian_Albanian","Cypriot_Syllabary","Cypro_Minoan","Cyrillic","Cyrillic_Supplement","Cyrillic_Extended_A","Cyrillic_Extended_B","Cyrillic_Extended_C","Cyrillic_Extended_D","Elbasan","Georgian","Georgian_Extended","Georgian_Supplement","Glagolitic","Glagolitic_Supplement","Gothic","Greek","Greek_Extended","Ancient_Greek_Numbers","Latin","Basic_Latin","Latin_1_Supplement","Latin_Extended_A","Latin_Extended_B","Latin_Extended_C","Latin_Extended_D","Latin_Extended_E","Latin_Extended_F","Latin_Extended_G","Latin_Extended_Additional","Latin_Ligatures","Fullwidth_Latin_Letters","IPA_Extensions","Phonetic_Extensions","Phonetic_Extensions_Supplement","Linear_A","Linear_B","Linear_B_Syllabary","Linear_B_Ideograms","Aegean_Numbers","Lycian","Lydian","Ogham","Old_Hungarian","Old_Italic","Old_Permic","Phaistos_Disc","Runic","Shavian","Vithkuqi","Modifier_Letters","Modifier_Tone_Letters","Spacing_Modifier_Letters","Superscripts_and_Subscripts","Combining_Marks","Combining_Diacritical_Marks","Combining_Diacritical_Marks_Extended","Combining_Diacritical_Marks_Supplement","Combining_Diacritical_Marks_for_Symbols","Combining_Half_Marks","Miscellaneous","Alphabetic_Presentation_Forms","ASCII_Characters","Halfwidth_and_Fullwidth_Forms","African_Scripts","Adlam","Bamum","Bamum_Supplement","Bassa_Vah","Coptic","Coptic_in_Greek_block","Coptic_Epact_Numbers","Egyptian_Hieroglyphs","Egyptian_Hieroglyph_Format_Controls","Ethiopic","Ethiopic_Supplement","Ethiopic_Extended","Ethiopic_Extended_A","Ethiopic_Extended_B","Medefaidrin","Mende_Kikakui","Meroitic","Meroitic_Cursive","Meroitic_Hieroglyphs","N_Ko","Osmanya","Tifinagh","Vai","Middle_Eastern_Scripts","Anatolian_Hieroglyphs","Arabic","Arabic_Supplement","Arabic_Extended_A","Arabic_Extended_B","Arabic_Extended_C","Arabic_Presentation_Forms_A","Arabic_Presentation_Forms_B","Aramaic__Imperial","Avestan","Chorasmian","Cuneiform","Cuneiform_Numbers_and_Punctuation","Early_Dynastic_Cuneiform","Old_Persian","Ugaritic","Elymaic","Hatran","Hebrew","Hebrew_Presentation_Forms","Mandaic","Nabataean","Old_North_Arabian","Old_South_Arabian","Pahlavi__Inscriptional","Pahlavi__Psalter","Palmyrene","Parthian__Inscriptional","Phoenician","Samaritan","Syriac","Syriac_Supplement","Yezidi","Central_Asian_Scripts","Manichaean","Marchen","Mongolian","Mongolian_Supplement","Old_Sogdian","Old_Turkic","Old_Uyghur","Phags_Pa","Sogdian","Soyombo","Tibetan","Zanabazar_Square","South_Asian_Scripts","Ahom","Bengali_and_Assamese","Bhaiksuki","Brahmi","Chakma","Devanagari","Devanagari_Extended","Devanagari_Extended_A","Dives_Akuru","Dogra","Grantha","Gujarati","Gunjala_Gondi","Gurmukhi","Kaithi","Kannada","Kharoshthi","Khojki","Khudawadi","Lepcha","Limbu","Mahajani","Malayalam","Masaram_Gondi","Meetei_Mayek","Meetei_Mayek_Extensions","Modi","Mro","Multani","Nag_Mundari","Nandinagari","Newa","Ol_Chiki","Oriya","Saurashtra","Sharada","Siddham","Sinhala","Sinhala_Archaic_Numbers","Sora_Sompeng","Syloti_Nagri","Takri","Tamil","Tamil_Supplement","Telugu","Thaana","Tirhuta","Toto","Vedic_Extensions","Wancho","Warang_Citi","Southeast_Asian_Scripts","Cham","Hanifi_Rohingya","Kayah_Li","Khmer","Khmer_Symbols","Lao","Myanmar","Myanmar_Extended_A","Myanmar_Extended_B","New_Tai_Lue","Nyiakeng_Puachue_Hmong","Pahawh_Hmong","Pau_Cin_Hau","Tai_Le","Tai_Tham","Tai_Viet","Tangsa","Thai","Indonesian___Philippine_Scripts","Balinese","Batak","Buginese","Buhid","Hanunoo","Javanese","Kawi","Makasar","Rejang","Sundanese","Sundanese_Supplement","Tagalog","Tagbanwa","East_Asian_Scripts","Bopomofo","Bopomofo_Extended","CJK_Unified_Ideographs__Han_","CJK_Extension_A","CJK_Extension_B","CJK_Extension_C","CJK_Extension_D","CJK_Extension_E","CJK_Extension_F","CJK_Extension_G","CJK_Extension_H","CJK_Extension_I","_see_also_Unihan_Database_","CJK_Compatibility_Ideographs","CJK_Compatibility_Ideographs_Supplement","CJK_Radicals___Kangxi_Radicals","CJK_Radicals_Supplement","CJK_Strokes","Ideographic_Description_Characters","Hangul_Jamo","Hangul_Jamo_Extended_A","Hangul_Jamo_Extended_B","Hangul_Compatibility_Jamo","Halfwidth_Jamo","Hangul_Syllables","Hiragana","Kana_Extended_A","Kana_Extended_B","Kana_Supplement","Small_Kana_Extension","Kanbun","Katakana","Katakana_Phonetic_Extensions","Halfwidth_Katakana","Khitan_Small_Script","Lisu","Lisu_Supplement","Miao","Nushu","Tangut","Tangut_Components","Tangut_Supplement","Yi","Yi_Syllables","Yi_Radicals","American_Scripts","Cherokee","Cherokee_Supplement","Deseret","Osage","Unified_Canadian_Aboriginal_Syllabics","UCAS_Extended","UCAS_Extended_A","Notational_Systems","Braille_Patterns","Musical_Symbols","Ancient_Greek_Musical_Notation","Byzantine_Musical_Symbols","Znamenny_Musical_Notation","Duployan","Shorthand_Format_Controls","Sutton_SignWriting","Punctuation","General_Punctuation","ASCII_Punctuation","Latin_1_Punctuation","Supplemental_Punctuation","CJK_Symbols_and_Punctuation","Ideographic_Symbols_and_Punctuation","CJK_Compatibility_Forms","Halfwidth_and_Fullwidth_Forms","Small_Form_Variants","Vertical_Forms","Alphanumeric_Symbols","Letterlike_Symbols","Roman_Symbols","Mathematical_Alphanumeric_Symbols","Arabic_Mathematical_Alphabetic_Symbols","Enclosed_Alphanumerics","Enclosed_Alphanumeric_Supplement","Enclosed_CJK_Letters_and_Months","Enclosed_Ideographic_Supplement","CJK_Compatibility","Additional_Squared_Symbols","Technical_Symbols","APL_symbols","Control_Pictures","Miscellaneous_Technical","Optical_Character_Recognition__OCR_","Numbers___Digits","_see_also_specific_scripts_","ASCII_Digits","Fullwidth_ASCII_Digits","Common_Indic_Number_Forms","Coptic_Epact_Numbers","Counting_Rod_Numerals","Cuneiform_Numbers_and_Punctuation","Indic_Siyaq_Numbers","Kaktovik_Numerals","Mayan_Numerals","Number_Forms","Ottoman_Siyaq_Numbers","Rumi_Numeral_Symbols","Sinhala_Archaic_Numbers","Super_and_Subscripts","Mathematical_Symbols","Arrows","Supplemental_Arrows_A","Supplemental_Arrows_B","Supplemental_Arrows_C","Additional_Arrows","Miscellaneous_Symbols_and_Arrows","Mathematical_Alphanumeric_Symbols","Arabic_Mathematical_Alphabetic_Symbols","Letterlike_Symbols","Mathematical_Operators","Basic_operators__Plus__Factorial__Division__Multiplication","Supplemental_Mathematical_Operators","Miscellaneous_Mathematical_Symbols_A","Miscellaneous_Mathematical_Symbols_B","Floors_and_Ceilings","Invisible_Operators","Geometric_Shapes","Additional_Shapes","Box_Drawing","Block_Elements","Geometric_Shapes_Extended","Emoji___Pictographs","Dingbats","Ornamental_Dingbats","Emoticons","Miscellaneous_Symbols","Miscellaneous_Symbols_And_Pictographs","Supplemental_Symbols_and_Pictographs","Symbols_and_Pictographs_Extended_A","Transport_and_Map_Symbols","Other_Symbols","Alchemical_Symbols","Ancient_Symbols","Currency_Symbols","_see_also_specific_scripts_","Dollar_Sign__Euro_Sign","Yen__Pound_and_Cent","Fullwidth_Currency_Symbols","Rial_Sign","Game_Symbols","Chess__Checkers_Draughts","Chess_Symbols","Domino_Tiles","Japanese_Chess","Mahjong_Tiles","Playing_Cards","Card_suits","Miscellaneous_Symbols_and_Arrows","Symbols_for_Legacy_Computing","Yijing_Symbols","Yijing_Mono___Di__and_Trigrams","Yijing_Hexagram_Symbols","Tai_Xuan_Jing_Symbols","Specials","Controls__tC0__tC1","Layout_Controls","Invisible_Operators","Specials","Tags","Variation_Selectors","Variation_Selectors_Supplement","Private_Use","Private_Use_Area","Supplementary_Private_Use_Area_A","Supplementary_Private_Use_Area_B","Surrogates","High_Surrogates","Low_Surrogates","Noncharacters_in_Charts","Noncharacters_in_blocks","Range_in_Arabic_Presentation_Forms_A","Range_in_Specials","Noncharacters_at_end_of____","BMP__Plane_1__Plane_2__Plane_3__Plane_4__Plane_5__Plane_6__Plane_7__Plane_8__Plane_9__Plane_10__Plane_11__Plane_12__Plane_13__Plane_14__Plane_15__Plane_16"]
5
+ }
@@ -0,0 +1,56 @@
1
+ // Todo: We might consider auto-building these fields in another file and/or
2
+ // merging with `unicodeFieldInfo.js`.
3
+ /* eslint-disable @stylistic/max-len -- Long */
4
+ const fields = ['code_pt', 'kAccountingNumeric', 'kAlternateTotalStrokes', 'kBigFive', 'kCCCII', 'kCNS1986', 'kCNS1992', 'kCangjie', 'kCantonese',
5
+ 'kCheungBauer', 'kCheungBauerIndex', 'kCihaiT', 'kCompatibilityVariant', 'kCowles', 'kDaeJaweon',
6
+ 'kDefinition', 'kEACC', 'kFenn', 'kFennIndex', 'kFourCornerCode', 'kFrequency', 'kGB0', 'kGB1', 'kGB3',
7
+ 'kGB5', 'kGB7', 'kGB8', 'kGSR', 'kGradeLevel', 'kHDZRadBreak', 'kHKGlyph', 'kHKSCS', 'kHanYu', 'kHangul',
8
+ 'kHanyuPinlu', 'kHanyuPinyin', 'kIBMJapan', 'kIICore', 'kIRGDaeJaweon', 'kIRGDaiKanwaZiten',
9
+ 'kIRGHanyuDaZidian', 'kIRGKangXi', 'kIRG_GSource', 'kIRG_HSource', 'kIRG_JSource', 'kIRG_KPSource',
10
+ 'kIRG_KSource', 'kIRG_MSource', 'kIRG_TSource', 'kIRG_USource', 'kIRG_VSource', 'kJIS0213', 'kJapaneseKun',
11
+ 'kJapaneseOn', 'kJis0', 'kJis1', 'kKPS0', 'kKPS1', 'kKSC0', 'kKSC1', 'kKangXi', 'kKarlgren', 'kKorean', 'kLau',
12
+ 'kMainlandTelegraph', 'kMandarin', 'kMatthews', 'kMeyerWempe', 'kMorohashi', 'kNelson', 'kOtherNumeric',
13
+ 'kPhonetic', 'kPrimaryNumeric', 'kPseudoGB1', 'kRSAdobe_Japan1_6', 'kRSJapanese', 'kRSKanWa', 'kRSKangXi',
14
+ 'kRSKorean', 'kRSUnicode', 'kSBGY', 'kSemanticVariant', 'kSimplifiedVariant', 'kSpecializedSemanticVariant',
15
+ 'kTaiwanTelegraph', 'kTang', 'kTotalStrokes', 'kTraditionalVariant', 'kVietnamese', 'kXHC1983', 'kXerox', 'kZVariant',
16
+ 'kUnihanCore2020', 'kIRG_UKSource', 'kIRG_SSource', 'kTGH', 'kKoreanName', 'kJa', 'kJoyoKanji', 'kKoreanEducationHanja',
17
+ 'kJinmeiyoKanji', 'kTGHZ2013', 'kSpoofingVariant', 'kStrange'];
18
+ /* eslint-enable @stylistic/max-len -- Long */
19
+
20
+ /**
21
+ * @param {string[]} scriptFileAsStrings
22
+ * @returns {Object<string,string[]>}
23
+ */
24
+ function parseUnihanFromTextFileStrings (scriptFileAsStrings) {
25
+ const scriptFileAsStr = scriptFileAsStrings.join('');
26
+ const notPresent = {};
27
+ let line;
28
+ const obj = {};
29
+ const lineRegex = /^U\+(?<cdpt>[\da-fA-F]{4,6})\t(?<col>\w+?)\t(?<value>.*)$/gum;
30
+ while ((line = (lineRegex).exec(scriptFileAsStr)) !== null) {
31
+ const {cdpt, col, value} = line.groups;
32
+ if (!obj[cdpt]) {
33
+ obj[cdpt] = [];
34
+ fields.forEach(function (val, idx) {
35
+ obj[cdpt][idx] = '';
36
+ });
37
+ obj[cdpt][0] = cdpt;
38
+ }
39
+ const pos = fields.indexOf(col);
40
+ if (pos === -1) {
41
+ // Todo: Even if not inserting, should auto-add locales as in
42
+ // parseUnicodeCharts.js
43
+ if (!notPresent[col]) {
44
+ // eslint-disable-next-line no-console -- CLI
45
+ console.error(`Not present: ${col}\n`);
46
+ notPresent[col] = 1;
47
+ }
48
+ continue;
49
+ }
50
+ obj[cdpt][pos] = value;
51
+ }
52
+
53
+ return Object.values(obj);
54
+ }
55
+
56
+ export default parseUnihanFromTextFileStrings;
@@ -0,0 +1,120 @@
1
+ export const unihanFieldInfo = [
2
+ ['kCangjie', 6],
3
+ ['kCantonese', 7],
4
+ // ['kDefinition', 3],
5
+ ['kHanYu', 31],
6
+ ['kHanyuPinyin', 34],
7
+ ['kIRGHanyuDaZidian', 39],
8
+ ['kIRGKangXi', 40],
9
+ ['kIRG_GSource', 41],
10
+ ['kIRG_HSource', 42],
11
+ ['kIRG_JSource', 43],
12
+ ['kIRG_KSource', 45],
13
+ ['kIRG_MSource', 46],
14
+ ['kIRG_TSource', 47],
15
+ ['kIRG_USource', 48],
16
+ ['kMandarin', 64],
17
+ ['kRSUnicode', 78],
18
+ ['kAccountingNumeric', 1],
19
+ ['kCompatibilityVariant', 11],
20
+ ['kSemanticVariant', 80],
21
+ ['kTotalStrokes', 85],
22
+ ['kCihaiT', 10],
23
+ ['kSBGY', 79],
24
+ ['kJIS0213', 50],
25
+ ['kNelson', 68],
26
+ ['kRSAdobe_Japan1_6', 73],
27
+ ['kCowles', 12],
28
+ ['kMatthews', 65],
29
+ ['kOtherNumeric', 69],
30
+ ['kPhonetic', 70],
31
+ ['kGSR', 26],
32
+ ['kIRG_KPSource', 44],
33
+ ['kIRG_VSource', 49],
34
+ ['kKPS1', 56],
35
+ ['kFenn', 16],
36
+ ['kFennIndex', 17],
37
+ ['kKarlgren', 60],
38
+ ['kHKSCS', 30],
39
+ ['kXHC1983', 88],
40
+ ['kMeyerWempe', 66],
41
+ ['kTraditionalVariant', 86],
42
+ ['kVietnamese', 87],
43
+ ['kSpecializedSemanticVariant', 82],
44
+ ['kLau', 62],
45
+ ['kCheungBauer', 8],
46
+ ['kCheungBauerIndex', 9],
47
+ ['kIICore', 36],
48
+ ['kTang', 84],
49
+ ['kZVariant', 90],
50
+ ['kRSKangXi', 76],
51
+ ['kJapaneseKun', 51],
52
+ ['kJapaneseOn', 52],
53
+ ['kSimplifiedVariant', 81],
54
+ ['kKangXi', 59],
55
+ ['kKPS0', 55],
56
+ ['kBigFive', 2],
57
+ ['kCCCII', 3],
58
+ ['kCNS1986', 4],
59
+ ['kCNS1992', 5],
60
+ ['kDaeJaweon', 13],
61
+ ['kEACC', 15],
62
+ ['kFourCornerCode', 18],
63
+ ['kFrequency', 19],
64
+ ['kGB0', 20],
65
+ ['kGB1', 21],
66
+ ['kGradeLevel', 27],
67
+ ['kHDZRadBreak', 28],
68
+ ['kHKGlyph', 29],
69
+ ['kHangul', 32],
70
+ ['kHanyuPinlu', 33],
71
+ ['kIRGDaeJaweon', 37],
72
+ ['kIRGDaiKanwaZiten', 38],
73
+ ['kJis0', 53],
74
+ ['kKSC0', 57],
75
+ ['kKorean', 61],
76
+ ['kMainlandTelegraph', 63],
77
+ ['kMorohashi', 67],
78
+ ['kPrimaryNumeric', 71],
79
+ ['kTaiwanTelegraph', 83],
80
+ ['kXerox', 89],
81
+ ['kGB5', 23],
82
+ ['kJis1', 54],
83
+ ['kPseudoGB1', 72],
84
+ ['kGB3', 22],
85
+ ['kGB7', 24],
86
+ ['kGB8', 25],
87
+ ['kKSC1', 58],
88
+ ['kIBMJapan', 35],
89
+ ['kRSKanWa', 75],
90
+ ['kRSKorean', 77],
91
+ ['kRSJapanese', 74],
92
+ ['kStrange', 91]
93
+ ];
94
+
95
+ export const unicodeFieldInfo = [
96
+ 'General_Category',
97
+ 'Canonical_Combining_Class',
98
+ 'Bidi_Class',
99
+
100
+ // We broke it up into two parts for easier viewing
101
+ // 'Decomposition_Type_and_Mapping',
102
+ 'decompositionMapping',
103
+ 'decompositionType',
104
+
105
+ // We broke this up for more convenient querying/display
106
+ /*
107
+ 'Decimal',
108
+ 'Digit',
109
+ 'Numeric',
110
+ */
111
+ 'numericType',
112
+ 'numericValue',
113
+
114
+ 'Bidi_Mirrored',
115
+ 'Unicode_1_Name',
116
+ 'ISO_Comment',
117
+ 'Simple_Uppercase_Mapping',
118
+ 'Simple_Lowercase_Mapping',
119
+ 'Simple_Titlecase_Mapping'
120
+ ];