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.
- package/.babelrc.json +3 -0
- package/.editorconfig +16 -0
- package/.nojekyll +0 -0
- package/.nyc_output/out.json +173804 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/CHANGES.md +11 -0
- package/COPYING.LESSER.txt +180 -0
- package/COPYING.txt +687 -0
- package/README.md +65 -0
- package/_locales/en-US/messages.json +3126 -0
- package/_locales/hu-HU/messages.json +3126 -0
- package/_locales/pt-BR/messages.json +3126 -0
- package/_locales/sv-SE/messages.json +3126 -0
- package/babel.config.json +5 -0
- package/browser_action/characterSelection.js +91 -0
- package/browser_action/charrefConverters.js +389 -0
- package/browser_action/chartBuild.js +155 -0
- package/browser_action/encodingBehaviors.js +72 -0
- package/browser_action/encodings.js +97 -0
- package/browser_action/entities.js +12 -0
- package/browser_action/entityBehaviors.js +96 -0
- package/browser_action/index-es.html +15 -0
- package/browser_action/index-instrumented.html +16 -0
- package/browser_action/index-pages.html +16 -0
- package/browser_action/index.html +16 -0
- package/browser_action/index.iife.min.js +2 -0
- package/browser_action/index.iife.min.js.map +1 -0
- package/browser_action/index.instrumented.iife.min.js +2 -0
- package/browser_action/index.instrumented.iife.min.js.map +1 -0
- package/browser_action/index.js +95 -0
- package/browser_action/preferences/prefDefaults.js +52 -0
- package/browser_action/service-worker/sw-activateCallback.js +53 -0
- package/browser_action/service-worker/sw-locales.json +6 -0
- package/browser_action/service-worker/sw-resources.json +73 -0
- package/browser_action/service-worker/sw-unicode-data.json +3 -0
- package/browser_action/styles/unicode-dialog.css +391 -0
- package/browser_action/templateUtils/elements.js +12 -0
- package/browser_action/templateUtils/fill.js +3 -0
- package/browser_action/templateUtils/validation.js +6 -0
- package/browser_action/templates/chartBuild.js +185 -0
- package/browser_action/templates/index.js +1304 -0
- package/browser_action/templatesElementCustomization/widgets.js +56 -0
- package/browser_action/unicode/UnicodeConverter.js +793 -0
- package/browser_action/unicode/charrefunicodeDb.js +258 -0
- package/browser_action/unicode/getScriptInfoForCodePoint.js +646 -0
- package/browser_action/unicode/hangul.js +253 -0
- package/browser_action/unicode/lastScriptNames.json +5 -0
- package/browser_action/unicode/parseUnihanFromTextFileStrings.js +56 -0
- package/browser_action/unicode/unicodeFieldInfo.js +120 -0
- package/browser_action/unicode/unicodeScripts.js +4912 -0
- package/browser_action/unicode/unihan.js +129 -0
- package/browser_action/unicode/unihanDbPopulate.js +26 -0
- package/browser_action/unicodecharref.js +1480 -0
- package/browser_action/utils/DOMUtils.js +122 -0
- package/browser_action/utils/FetchUtils.js +19 -0
- package/browser_action/utils/TextUtils.js +28 -0
- package/browser_action/utils/TypedArrayUtils.js +21 -0
- package/browser_action/utils/semicolonSeparatedToArray.js +12 -0
- package/browser_action/utils/setupServiceWorker.js +193 -0
- package/cypress.config.js +21 -0
- package/download/entities/copyright-software-20021231.html +70 -0
- package/download/entities/html5-uppercase.ent +54 -0
- package/download/entities/htmlmathml-f.ent +2164 -0
- package/download/entities/isoamsa.ent +201 -0
- package/download/entities/isoamsb.ent +177 -0
- package/download/entities/isoamsc.ent +77 -0
- package/download/entities/isoamsn.ent +148 -0
- package/download/entities/isoamso.ent +107 -0
- package/download/entities/isoamsr.ent +238 -0
- package/download/entities/isobox.ent +95 -0
- package/download/entities/isocyr1.ent +122 -0
- package/download/entities/isocyr2.ent +81 -0
- package/download/entities/isodia.ent +69 -0
- package/download/entities/isogrk1.ent +104 -0
- package/download/entities/isogrk2.ent +75 -0
- package/download/entities/isogrk3.ent +98 -0
- package/download/entities/isogrk4.ent +98 -0
- package/download/entities/isolat1.ent +117 -0
- package/download/entities/isolat2.ent +176 -0
- package/download/entities/isomfrk.ent +107 -0
- package/download/entities/isomopf.ent +81 -0
- package/download/entities/isomscr.ent +107 -0
- package/download/entities/isonum.ent +131 -0
- package/download/entities/isopub.ent +140 -0
- package/download/entities/isotech.ent +216 -0
- package/download/entities/mmlalias.ent +598 -0
- package/download/entities/mmlextra.ent +154 -0
- package/download/entities/predefined.ent +52 -0
- package/download/entities/w3centities-f.ent +2276 -0
- package/download/entities/xhtml1-lat1.ent +143 -0
- package/download/entities/xhtml1-special.ent +78 -0
- package/download/entities/xhtml1-symbol.ent +171 -0
- package/eslint.config.js +66 -0
- package/icons/openWindow16.png +0 -0
- package/icons/openWindow24.png +0 -0
- package/lgtm.yml +5 -0
- package/lib/background.html +11 -0
- package/lib/background.js +13 -0
- package/lib/overlay.css +6 -0
- package/manifest.json +37 -0
- package/package.json +121 -0
- package/polyfills/browser-polyfill.min.js +8 -0
- package/polyfills/browser-polyfill.min.js.map +1 -0
- package/server.js +61 -0
- package/sw.js +259 -0
- package/tools/entities-import.js +62 -0
- package/tools/findEsResources.js +30 -0
- package/tools/list-locales.js +17 -0
- package/tools/parseUnicodeCharts.js +428 -0
- package/tools/ucd-import.js +24 -0
- package/tools/unicode-charts.html +596 -0
- package/tools/unihan-import.js +72 -0
- package/unicode_copyright.txt +46 -0
- package/vendor/camelcase/index.js +110 -0
- package/vendor/fflate/esm/browser.js +2665 -0
- package/vendor/intl-dom/dist/index.esm.js +2962 -0
- package/vendor/jamilih/dist/jml-es.js +2359 -0
- package/vendor/jquery/dist/jquery.js +10716 -0
- package/vendor/json-6/dist/index.mjs +1783 -0
- package/vendor/miller-columns/dist/index-es.min.js +1 -0
- package/vendor/miller-columns/miller-columns.css +75 -0
- package/vendor/simple-prefs/dist/index.esm.js +286 -0
- package/web-ext-config.cjs +13 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {jml, nbsp, $} from '../../vendor/jamilih/dist/jml-es.js';
|
|
2
|
+
import {fill} from '../templateUtils/fill.js';
|
|
3
|
+
import unicodecharref from '../unicodecharref.js';
|
|
4
|
+
|
|
5
|
+
let idgen = 0;
|
|
6
|
+
const chartBuildTemplate = function ({
|
|
7
|
+
_, rows, cols, charrefunicodeConverter, current,
|
|
8
|
+
resetCurrentStartCharCodeIfOutOfBounds, // descriptsOrOnlyEnts,
|
|
9
|
+
q, textReceptacle, entyes, chartBuild, descripts,
|
|
10
|
+
chartContainer, arr,
|
|
11
|
+
setPref, insertText, buttonyes, font, lang, prev,
|
|
12
|
+
rowceil, colsOverRemainder, appliedFormats, displayTypes,
|
|
13
|
+
captionContent
|
|
14
|
+
}) {
|
|
15
|
+
jml('table', {
|
|
16
|
+
id: 'chart_table',
|
|
17
|
+
class: 'unicodetablecell',
|
|
18
|
+
style: {
|
|
19
|
+
'font-family': font
|
|
20
|
+
},
|
|
21
|
+
// Todo: Not sure if this (or the `lang_tooltiptext` locale message) requires fixing with xml:lang bug fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=234485
|
|
22
|
+
lang
|
|
23
|
+
}, [
|
|
24
|
+
['caption', {
|
|
25
|
+
class: 'dialogheader',
|
|
26
|
+
title: _('Unicode_table_caption_title')
|
|
27
|
+
}, [
|
|
28
|
+
captionContent
|
|
29
|
+
]],
|
|
30
|
+
...fill(rows).map((_row, j) => {
|
|
31
|
+
return ['tr', fill(cols).map((_col, i) => {
|
|
32
|
+
// If more rows/cols. specified than match
|
|
33
|
+
if (j === rowceil && i >= colsOverRemainder) {
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Todo: Document what's going on here
|
|
38
|
+
if (arr) {
|
|
39
|
+
q++;
|
|
40
|
+
if (q >= arr.length) {
|
|
41
|
+
q = 0;
|
|
42
|
+
}
|
|
43
|
+
current.startCharCode = arr[q];
|
|
44
|
+
} else {
|
|
45
|
+
current.startCharCode++;
|
|
46
|
+
}
|
|
47
|
+
resetCurrentStartCharCodeIfOutOfBounds();
|
|
48
|
+
|
|
49
|
+
const charRefIdx = charrefunicodeConverter.
|
|
50
|
+
numericCharacterReferences.indexOf(
|
|
51
|
+
// We've now had to add 1 here for some reason
|
|
52
|
+
current.startCharCode
|
|
53
|
+
);
|
|
54
|
+
const hasEntity = charRefIdx > -1;
|
|
55
|
+
const entity = hasEntity
|
|
56
|
+
// If recognized multiple char ent. (won't convert these to decimal)
|
|
57
|
+
? '&' + charrefunicodeConverter.entities[charRefIdx] + ';'
|
|
58
|
+
: '';
|
|
59
|
+
|
|
60
|
+
return ['td', {
|
|
61
|
+
class: (hasEntity ? 'entity ' : '') + 'unicodetablecell',
|
|
62
|
+
$on: {
|
|
63
|
+
mouseover: (function (_entity, startCharCode) {
|
|
64
|
+
return function (/* e */) {
|
|
65
|
+
if (!$('#chart_table').$noGetDescripts) {
|
|
66
|
+
unicodecharref.getUnicodeDescription(
|
|
67
|
+
_entity,
|
|
68
|
+
// Needed to convert this for some reason
|
|
69
|
+
startCharCode.toString(16).toUpperCase().padStart(4, '0')
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}(entity, current.startCharCode)),
|
|
74
|
+
// trying dblclick worked but might not be obvious to
|
|
75
|
+
// user and single clicks still activated; relying on
|
|
76
|
+
// right button doesn't work
|
|
77
|
+
click (e) {
|
|
78
|
+
if (e.altKey) {
|
|
79
|
+
$('#chart_table').$noGetDescripts =
|
|
80
|
+
!$('#chart_table').$noGetDescripts;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [
|
|
85
|
+
...appliedFormats.flatMap((type, idx, array) => {
|
|
86
|
+
const name = type.replace('yes', '');
|
|
87
|
+
const isMiddle = idx === 1 && array.length === 2;
|
|
88
|
+
const isFinal = idx === 2;
|
|
89
|
+
const button = [(buttonyes ? 'button' : 'div'), {
|
|
90
|
+
class: buttonyes ? 'buttonyes' : null,
|
|
91
|
+
name,
|
|
92
|
+
id: '_' + idgen++,
|
|
93
|
+
dataset: {
|
|
94
|
+
value: displayTypes[type](current.startCharCode)
|
|
95
|
+
},
|
|
96
|
+
$on: {
|
|
97
|
+
click ({altKey, target: {dataset: {value}}}) {
|
|
98
|
+
if (!altKey) {
|
|
99
|
+
insertText({textReceptacle, value});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, [
|
|
104
|
+
// Todo: Add substitute character if detect is an invisible?
|
|
105
|
+
displayTypes[type](current.startCharCode)
|
|
106
|
+
]];
|
|
107
|
+
const container = isFinal
|
|
108
|
+
? jml('div', {
|
|
109
|
+
class: 'centered'
|
|
110
|
+
}, [button])
|
|
111
|
+
: button;
|
|
112
|
+
return [
|
|
113
|
+
isMiddle
|
|
114
|
+
? nbsp.repeat(3)
|
|
115
|
+
: isFinal
|
|
116
|
+
? ['br']
|
|
117
|
+
: '',
|
|
118
|
+
container
|
|
119
|
+
];
|
|
120
|
+
}),
|
|
121
|
+
...(entyes && hasEntity
|
|
122
|
+
? [
|
|
123
|
+
['a', {
|
|
124
|
+
href: '#',
|
|
125
|
+
$on: {
|
|
126
|
+
click (e) {
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
if (!e.altKey) {
|
|
129
|
+
insertText({textReceptacle, value: entity});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, [
|
|
134
|
+
entity
|
|
135
|
+
]],
|
|
136
|
+
' '
|
|
137
|
+
]
|
|
138
|
+
: [''])
|
|
139
|
+
]];
|
|
140
|
+
})];
|
|
141
|
+
}),
|
|
142
|
+
['tr', [
|
|
143
|
+
['td', {
|
|
144
|
+
class: 'centered',
|
|
145
|
+
colspan: cols
|
|
146
|
+
}, [
|
|
147
|
+
['a', {
|
|
148
|
+
href: '#',
|
|
149
|
+
$on: {
|
|
150
|
+
async click (e) {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
await Promise.all([
|
|
153
|
+
setPref('currentStartCharCode', prev),
|
|
154
|
+
setPref('startCharInMiddleOfChart', false)
|
|
155
|
+
]);
|
|
156
|
+
await chartBuild({descripts});
|
|
157
|
+
await unicodecharref.resizecells();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, [
|
|
161
|
+
_('Prev_set')
|
|
162
|
+
]],
|
|
163
|
+
' ' + nbsp + ' ',
|
|
164
|
+
['a', {
|
|
165
|
+
href: '#',
|
|
166
|
+
$on: {
|
|
167
|
+
async click (e) {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
await Promise.all([
|
|
170
|
+
setPref('currentStartCharCode', current.startCharCode),
|
|
171
|
+
setPref('startCharInMiddleOfChart', false)
|
|
172
|
+
]);
|
|
173
|
+
await chartBuild({descripts});
|
|
174
|
+
await unicodecharref.resizecells();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}, [
|
|
178
|
+
_('Next_set')
|
|
179
|
+
]]
|
|
180
|
+
]]
|
|
181
|
+
]]
|
|
182
|
+
], chartContainer);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default chartBuildTemplate;
|