unicode-input-toolconverter 0.2.0 → 0.2.3
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/.nyc_output/out.json +8980 -1849
- package/CHANGES.md +15 -1
- package/README.md +6 -11
- package/_locales/en-US/messages.json +153 -6
- package/_locales/hu-HU/messages.json +153 -6
- package/_locales/pt-BR/messages.json +153 -6
- package/_locales/sv-SE/messages.json +153 -6
- package/babel.config.json +0 -1
- package/browser_action/characterSelection.js +18 -11
- package/browser_action/charrefConverters.js +286 -79
- package/browser_action/chartBuild.js +97 -27
- package/browser_action/encodingBehaviors.js +10 -7
- package/browser_action/entityBehaviors.js +42 -16
- package/browser_action/index-es.html +13 -1
- package/browser_action/index-instrumented.html +13 -1
- package/browser_action/index-pages.html +13 -1
- package/browser_action/index.html +13 -1
- package/browser_action/index.iife.min.js +9 -1
- package/browser_action/index.iife.min.js.map +1 -1
- package/browser_action/index.instrumented.iife.min.js +1 -1
- package/browser_action/index.instrumented.iife.min.js.map +1 -1
- package/browser_action/index.js +5 -5
- package/browser_action/preferences/prefDefaults.js +12 -3
- package/browser_action/service-worker/sw-activateCallback.js +1 -2
- package/browser_action/service-worker/sw-resources.json +6 -4
- package/browser_action/templateUtils/elements.js +12 -1
- package/browser_action/templateUtils/fill.js +6 -0
- package/browser_action/templateUtils/validation.js +4 -1
- package/browser_action/templates/chartBuild.js +167 -102
- package/browser_action/templates/index.js +227 -53
- package/browser_action/templatesElementCustomization/widgets.js +40 -15
- package/browser_action/unicode/UnicodeConverter.js +99 -73
- package/browser_action/unicode/charrefunicodeDb.js +100 -50
- package/browser_action/unicode/getScriptInfoForCodePoint.js +13 -4
- package/browser_action/unicode/hangul.js +27 -20
- package/browser_action/unicode/lastScriptNames.json +1 -1
- package/browser_action/unicode/parseUnihanFromTextFileStrings.js +44 -25
- package/browser_action/unicode/unicodeFieldInfo.js +112 -90
- package/browser_action/unicode/unicodeScripts.js +409 -35
- package/browser_action/unicode/unihan.js +4 -3
- package/browser_action/unicode/unihanDbPopulate.js +7 -2
- package/browser_action/unicode/unihanFields.js +34 -0
- package/browser_action/unicodecharref.js +353 -190
- package/browser_action/utils/DOMUtils.js +95 -34
- package/browser_action/utils/FetchUtils.js +7 -6
- package/browser_action/utils/TextUtils.js +4 -4
- package/browser_action/utils/TypedArrayUtils.js +9 -5
- package/browser_action/utils/semicolonSeparatedToArray.js +3 -3
- package/browser_action/utils/setupServiceWorker.js +2 -2
- package/eslint.config.js +11 -0
- package/icons/openWindow16.png +0 -0
- package/icons/openWindow24.png +0 -0
- package/lib/background.html +7 -0
- package/lib/background.js +2 -2
- package/package.json +80 -70
- package/pnpm-workspace.yaml +8 -0
- package/server.js +66 -51
- package/sw.js +97 -56
- package/tools/entities-import.js +4 -1
- package/tools/findEsResources.js +33 -10
- package/tools/fix-sw-resources-vendor-paths.js +60 -0
- package/tools/list-locales.js +2 -2
- package/tools/parseUnicodeCharts.js +126 -60
- package/tools/ucd-import.js +1 -10
- package/tools/unicode-charts.html +49 -20
- package/tools/unihan-import.js +45 -15
- package/tools/write-sw-version.js +16 -0
- package/tsconfig.json +23 -0
- package/typings/__coverage__.d.ts +5 -0
- package/typings/apple-system-profiler.d.ts +17 -0
- package/typings/commands.d.ts +19 -0
- package/typings/json-6.d.ts +4 -0
- package/typings/rollup-plugin-istanbul.d.ts +3 -0
- package/vendor/camelcase/index.d.ts +154 -0
- package/vendor/camelcase/index.js +137 -23
- package/vendor/fflate/esm/browser.d.ts +1539 -0
- package/vendor/fflate/esm/browser.js +82 -55
- package/vendor/intl-dom/dist/Formatter.d.ts +120 -0
- package/vendor/intl-dom/dist/Formatter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/collation.d.ts +42 -0
- package/vendor/intl-dom/dist/collation.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts +52 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts +96 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts +17 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts +285 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts.map +1 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts +88 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts +67 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts +73 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts +26 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts.map +1 -0
- package/vendor/intl-dom/dist/i18n.d.ts +113 -0
- package/vendor/intl-dom/dist/i18n.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.d.ts +92 -0
- package/vendor/intl-dom/dist/index.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.esm.d.ts +34 -0
- package/vendor/intl-dom/dist/index.esm.js +854 -896
- package/vendor/intl-dom/dist/index.esm.min.js +4 -0
- package/vendor/intl-dom/dist/index.esm.min.js.map +1 -0
- package/vendor/intl-dom/dist/index.umd.js +2953 -0
- package/vendor/intl-dom/dist/index.umd.min.js +4 -0
- package/vendor/intl-dom/dist/index.umd.min.js.map +1 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts +34 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts.map +1 -0
- package/vendor/intl-dom/dist/shared.d.ts +20 -0
- package/vendor/intl-dom/dist/shared.d.ts.map +1 -0
- package/vendor/intl-dom/dist/utils.d.ts +53 -0
- package/vendor/intl-dom/dist/utils.d.ts.map +1 -0
- package/vendor/jamilih/dist/jml.d.mts +468 -0
- package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +1489 -343
- package/vendor/jquery/dist/jquery.js +1677 -2713
- package/vendor/json-6/dist/index.mjs +2 -0
- package/vendor/miller-columns/CHANGES.md +185 -0
- package/vendor/miller-columns/LICENSE-MIT.txt +21 -0
- package/vendor/miller-columns/README.md +249 -0
- package/vendor/miller-columns/demos/index.html +69 -0
- package/vendor/miller-columns/demos/index.js +72 -0
- package/vendor/miller-columns/dist/index-es.js +748 -0
- package/vendor/miller-columns/dist/index-es.min.d.ts +25 -0
- package/vendor/miller-columns/dist/index-es.min.js +7 -1
- package/vendor/miller-columns/dist/index-umd.js +757 -0
- package/vendor/miller-columns/dist/index-umd.min.js +7 -0
- package/vendor/miller-columns/dist/index.d.ts +25 -0
- package/vendor/miller-columns/dist/millerColumns.d.ts +10 -0
- package/vendor/miller-columns/eslint.config.js +46 -0
- package/vendor/miller-columns/fix-declarations.js +18 -0
- package/vendor/miller-columns/miller-columns.css +24 -1
- package/vendor/miller-columns/package.json +73 -0
- package/vendor/miller-columns/pnpm-workspace.yaml +2 -0
- package/vendor/miller-columns/src/index.js +642 -0
- package/vendor/miller-columns/src/millerColumns.ts +12 -0
- package/vendor/miller-columns/tsconfig-prod.json +23 -0
- package/vendor/miller-columns/tsconfig.json +21 -0
- package/vendor/simple-prefs/dist/index.esm.d.ts +1 -0
- package/vendor/simple-prefs/dist/index.esm.js +164 -216
- package/vendor/simple-prefs/dist/simple-prefs.d.ts +117 -0
- package/lgtm.yml +0 -5
|
@@ -1,18 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} sel
|
|
3
|
+
*/
|
|
4
|
+
export const $ = (sel) => {
|
|
5
|
+
return /** @type {HTMLElement} */ (document.querySelector(sel));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} sel
|
|
10
|
+
*/
|
|
11
|
+
export const $s = (sel) => {
|
|
12
|
+
return /** @type {HTMLSelectElement} */ ($(sel));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} sel
|
|
17
|
+
*/
|
|
18
|
+
export const $i = (sel) => {
|
|
19
|
+
return /** @type {HTMLInputElement} */ ($(sel));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} sel
|
|
24
|
+
*/
|
|
25
|
+
export const $o = (sel) => {
|
|
26
|
+
return /** @type {HTMLOptionElement} */ ($(sel));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} sel
|
|
31
|
+
*/
|
|
32
|
+
export const $t = (sel) => {
|
|
33
|
+
return /** @type {HTMLTextAreaElement} */ ($(sel));
|
|
34
|
+
};
|
|
2
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} sel
|
|
38
|
+
*/
|
|
39
|
+
export const $tabbox = (sel) => {
|
|
40
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
41
|
+
return /** @type {import('../templatesElementCustomization/widgets.js').TabBox} */ (
|
|
42
|
+
$(sel)
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} sel
|
|
48
|
+
*/
|
|
49
|
+
export const $tabpanel = (sel) => {
|
|
50
|
+
return /** @type {HTMLDivElement} */ ($(sel));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {number} Integer
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {number} Float
|
|
58
|
+
*/
|
|
3
59
|
/**
|
|
4
60
|
* @param {Integer} i
|
|
5
61
|
* @returns {void}
|
|
6
62
|
*/
|
|
7
63
|
function removeViewChildren (i) {
|
|
8
64
|
const view = $('#_detailedView' + i);
|
|
9
|
-
|
|
10
|
-
view.firstChild.remove();
|
|
11
|
-
}
|
|
65
|
+
view.replaceChildren();
|
|
12
66
|
}
|
|
13
67
|
/**
|
|
14
68
|
* @param {string} sel
|
|
15
|
-
* @param {Element} item
|
|
69
|
+
* @param {Element|string} item
|
|
16
70
|
* @returns {void}
|
|
17
71
|
*/
|
|
18
72
|
function placeItem (sel, item) {
|
|
@@ -28,18 +82,18 @@ const // xulns = 'https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul
|
|
|
28
82
|
htmlns = 'https://www.w3.org/1999/xhtml';
|
|
29
83
|
|
|
30
84
|
/**
|
|
31
|
-
* @param {string} el
|
|
32
|
-
* @returns {
|
|
33
|
-
*/
|
|
85
|
+
* @param {string} el
|
|
86
|
+
* @returns {HTMLAnchorElement}
|
|
87
|
+
*/
|
|
34
88
|
function createHTMLElement (el) {
|
|
35
89
|
// return document.createElementNS(htmlns, el);
|
|
36
|
-
return document.createElement(el);
|
|
90
|
+
return /** @type {HTMLAnchorElement} */ (document.createElement(el));
|
|
37
91
|
}
|
|
38
92
|
|
|
39
93
|
/**
|
|
40
|
-
* @param {string} el
|
|
41
|
-
* @returns {Element}
|
|
42
|
-
*/
|
|
94
|
+
* @param {string} el
|
|
95
|
+
* @returns {Element}
|
|
96
|
+
*/
|
|
43
97
|
|
|
44
98
|
/*
|
|
45
99
|
function createXULElement (el) {
|
|
@@ -48,21 +102,21 @@ function createXULElement (el) {
|
|
|
48
102
|
*/
|
|
49
103
|
|
|
50
104
|
/**
|
|
51
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
52
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator
|
|
53
|
-
*/
|
|
105
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
106
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator
|
|
107
|
+
*/
|
|
54
108
|
class AsyncStreamIterable {
|
|
55
109
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
110
|
+
* @param {ReadableStream} stream
|
|
111
|
+
*/
|
|
58
112
|
constructor (stream) {
|
|
59
113
|
this._stream = stream;
|
|
60
114
|
}
|
|
61
115
|
|
|
62
116
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
117
|
+
* @returns {AsyncGenerator}
|
|
118
|
+
* @yields {Integer}
|
|
119
|
+
*/
|
|
66
120
|
async *[Symbol.asyncIterator] () {
|
|
67
121
|
const reader = this._stream.getReader();
|
|
68
122
|
try {
|
|
@@ -81,36 +135,43 @@ class AsyncStreamIterable {
|
|
|
81
135
|
}
|
|
82
136
|
|
|
83
137
|
/**
|
|
84
|
-
* @callback ProgressCallback
|
|
85
|
-
* @param {Float} percentComplete
|
|
86
|
-
* @returns {string}
|
|
87
|
-
*/
|
|
138
|
+
* @callback ProgressCallback
|
|
139
|
+
* @param {Float} percentComplete
|
|
140
|
+
* @returns {string}
|
|
141
|
+
*/
|
|
88
142
|
|
|
89
143
|
/**
|
|
90
|
-
* @param {
|
|
144
|
+
* @param {object} cfg
|
|
91
145
|
* @param {string} cfg.url
|
|
92
|
-
* @param {
|
|
146
|
+
* @param {HTMLProgressElement} cfg.progressElement
|
|
93
147
|
* @param {ProgressCallback} cfg.progress
|
|
94
148
|
* @returns {Promise<{
|
|
95
|
-
* receivedLength: Integer, totalBytes: Integer, chunks:
|
|
149
|
+
* receivedLength: Integer, totalBytes: Integer, chunks: Uint8Array[]
|
|
96
150
|
* }>}
|
|
97
151
|
*/
|
|
98
152
|
async function showProgress ({url, progressElement, progress}) {
|
|
99
153
|
const response = await fetch(url);
|
|
100
|
-
|
|
101
|
-
|
|
154
|
+
// May be unavailable, e.g., when the server compresses the response
|
|
155
|
+
// (some CDNs omit `content-length` for compressed bodies), leaving
|
|
156
|
+
// the total size unknown until the download completes.
|
|
157
|
+
const totalBytes = Number(response.headers.get('content-length')) || 0;
|
|
158
|
+
progressElement.max = totalBytes || 1;
|
|
102
159
|
|
|
160
|
+
/** @type {Uint8Array[]} */
|
|
103
161
|
const chunks = [];
|
|
104
162
|
let receivedLength = 0;
|
|
105
|
-
for await (const value of new AsyncStreamIterable(
|
|
163
|
+
for await (const value of new AsyncStreamIterable(
|
|
164
|
+
/** @type {ReadableStream<Uint8Array<ArrayBuffer>>} */
|
|
165
|
+
(response.body)
|
|
166
|
+
)) {
|
|
106
167
|
chunks.push(value);
|
|
107
168
|
receivedLength += value.length;
|
|
108
169
|
|
|
109
|
-
const percentComplete =
|
|
110
|
-
receivedLength / totalBytes
|
|
111
|
-
|
|
170
|
+
const percentComplete = totalBytes
|
|
171
|
+
? (receivedLength / totalBytes) * 100
|
|
172
|
+
: 0;
|
|
112
173
|
|
|
113
|
-
progressElement.value =
|
|
174
|
+
progressElement.value = totalBytes ? receivedLength : 0;
|
|
114
175
|
progressElement.textContent = progress(percentComplete);
|
|
115
176
|
}
|
|
116
177
|
return {receivedLength, totalBytes, chunks};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/ts-no-empty-object-type -- Ok */
|
|
1
2
|
/**
|
|
2
|
-
* @param {string} path
|
|
3
|
-
* @returns {
|
|
4
|
-
*/
|
|
3
|
+
* @param {string} path
|
|
4
|
+
* @returns {Promise<{}>}
|
|
5
|
+
*/
|
|
5
6
|
const getJSON = async (path) => {
|
|
6
7
|
const response = await fetch(path);
|
|
7
8
|
return await response.json();
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
* @param {string} path
|
|
12
|
-
* @returns {
|
|
13
|
-
*/
|
|
12
|
+
* @param {string} path
|
|
13
|
+
* @returns {Promise<string>}
|
|
14
|
+
*/
|
|
14
15
|
const getText = async (path) => {
|
|
15
16
|
const response = await fetch(path);
|
|
16
17
|
return await response.text();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Todo: Move to own library
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {object}
|
|
4
|
+
* @param {object} cfg
|
|
5
5
|
* @param {HTMLTextAreaElement|HTMLInputElement} cfg.textReceptacle
|
|
6
6
|
* @param {string} cfg.value
|
|
7
7
|
* @param {boolean} [cfg.focusIn]
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
function insertIntoOrOverExisting ({
|
|
11
11
|
textReceptacle, value, focusIn = true
|
|
12
|
-
}
|
|
12
|
+
}) {
|
|
13
13
|
const {length: len} = textReceptacle.value;
|
|
14
14
|
const start = textReceptacle.selectionStart;
|
|
15
15
|
const end = textReceptacle.selectionEnd;
|
|
@@ -17,8 +17,8 @@ function insertIntoOrOverExisting ({
|
|
|
17
17
|
if (focusIn) {
|
|
18
18
|
textReceptacle.focus();
|
|
19
19
|
}
|
|
20
|
-
const pre = textReceptacle.value.slice(0, Math.max(0, start));
|
|
21
|
-
const post = textReceptacle.value.slice(end, len);
|
|
20
|
+
const pre = textReceptacle.value.slice(0, Math.max(0, start ?? 0));
|
|
21
|
+
const post = textReceptacle.value.slice(end ?? 0, len);
|
|
22
22
|
textReceptacle.value = pre + value + post;
|
|
23
23
|
|
|
24
24
|
textReceptacle.selectionStart = pre.length + value.length;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
* @typedef {number} Integer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {object} cfg
|
|
7
|
+
* @param {Integer} cfg.receivedLength
|
|
8
|
+
* @param {Uint8Array[]} cfg.chunks
|
|
9
|
+
* @returns {Uint8Array}
|
|
10
|
+
*/
|
|
7
11
|
function joinChunks ({
|
|
8
12
|
chunks,
|
|
9
13
|
receivedLength
|
|
@@ -47,7 +47,7 @@ async function setupServiceWorker (
|
|
|
47
47
|
|
|
48
48
|
// statechange won't catch this installing event as already installing
|
|
49
49
|
|
|
50
|
-
newWorker
|
|
50
|
+
newWorker?.addEventListener('statechange', async () => {
|
|
51
51
|
const {state} = newWorker;
|
|
52
52
|
switch (state) {
|
|
53
53
|
case 'installing':
|
|
@@ -146,7 +146,7 @@ async function setupServiceWorker (
|
|
|
146
146
|
|
|
147
147
|
const worker = registration.installing || registration.waiting ||
|
|
148
148
|
registration.active;
|
|
149
|
-
switch (worker
|
|
149
|
+
switch (worker?.state) {
|
|
150
150
|
case 'installing':
|
|
151
151
|
// If it fails, will instead be `redundant`; but will try again:
|
|
152
152
|
// 1. automatically (?) per https://developers.google.com/web/fundamentals/primers/service-workers/#the_service_worker_life_cycle
|
package/eslint.config.js
CHANGED
|
@@ -58,6 +58,17 @@ export default [
|
|
|
58
58
|
// Disable for now
|
|
59
59
|
'no-alert': 0,
|
|
60
60
|
'prefer-named-capture-group': 0,
|
|
61
|
+
'unicorn/no-top-level-assignment-in-function': 0,
|
|
62
|
+
'sonarjs/assertions-in-tests': 0,
|
|
63
|
+
'sonarjs/no-fixed-wait-in-tests': 0,
|
|
64
|
+
'sonarjs/no-empty-test-file': 0,
|
|
65
|
+
'mocha/no-sibling-hooks': 0,
|
|
66
|
+
'unicorn/no-this-outside-of-class': 0,
|
|
67
|
+
'unicorn/no-break-in-nested-loop': 0,
|
|
68
|
+
'unicorn/prefer-number-coercion': 0,
|
|
69
|
+
'unicorn/no-undeclared-class-members': 0,
|
|
70
|
+
// Remove from ash-nazg
|
|
71
|
+
'unicorn/no-unreadable-for-of-expression': 0,
|
|
61
72
|
|
|
62
73
|
// May need in some though perhaps not all instances (for surrogates)
|
|
63
74
|
'unicorn/prefer-code-point': 0
|
package/icons/openWindow16.png
CHANGED
|
File without changes
|
package/icons/openWindow24.png
CHANGED
|
File without changes
|
package/lib/background.html
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<title>-</title>
|
|
6
|
+
<script type="importmap">
|
|
7
|
+
{
|
|
8
|
+
"imports": {
|
|
9
|
+
"json-6": "../vendor/json-6/dist/index.mjs"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
6
13
|
<!-- <script src="/polyfills/browser-polyfill.min.js"></script> -->
|
|
7
14
|
<script type="module" src="/lib/background.js"></script>
|
|
8
15
|
</head>
|
package/lib/background.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {i18n, setJSONExtra} from '
|
|
1
|
+
import {i18n, setJSONExtra} from 'intl-dom';
|
|
2
2
|
|
|
3
3
|
// Currently not bundling json-6
|
|
4
|
-
import jsonExtra from '
|
|
4
|
+
import jsonExtra from 'json-6';
|
|
5
5
|
|
|
6
6
|
setJSONExtra(jsonExtra);
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unicode-input-toolconverter",
|
|
3
3
|
"description": "Add-on for selecting Unicode characters by variety of means and converting between various representations",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": "./browser_action/index.js"
|
|
7
7
|
},
|
|
@@ -20,68 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"type": "module",
|
|
22
22
|
"browserslist": [
|
|
23
|
-
"
|
|
23
|
+
"last 2 chrome versions"
|
|
24
24
|
],
|
|
25
|
-
"homepage": "https://github.com/brettz9/unicode-input-toolconverter",
|
|
26
|
-
"bugs": "https://github.com/brettz9/unicode-input-toolconverter/issues",
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "https://github.com/brettz9/unicode-input-toolconverter"
|
|
30
|
-
},
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">=18.0.0"
|
|
33
|
-
},
|
|
34
|
-
"keywords": [
|
|
35
|
-
"unicode",
|
|
36
|
-
"input",
|
|
37
|
-
"converter"
|
|
38
|
-
],
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@brettz9/node-static": "^0.1.1",
|
|
41
|
-
"apple-system-profiler": "^1.1.0",
|
|
42
|
-
"cheerio": "1.0.0-rc.12",
|
|
43
|
-
"download": "^8.0.0",
|
|
44
|
-
"extract-zip": "^2.0.1",
|
|
45
|
-
"file-fetch": "^2.0.0",
|
|
46
|
-
"intl-dom": "^0.19.0",
|
|
47
|
-
"jsdom": "^24.1.1",
|
|
48
|
-
"json-6": "^1.1.4",
|
|
49
|
-
"node-fetch": "^3.3.2"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@babel/core": "^7.25.2",
|
|
53
|
-
"@babel/eslint-parser": "^7.25.1",
|
|
54
|
-
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
|
55
|
-
"@babel/preset-env": "^7.25.3",
|
|
56
|
-
"@cypress/code-coverage": "^3.12.44",
|
|
57
|
-
"@cypress/webpack-preprocessor": "^6.0.2",
|
|
58
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
59
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
60
|
-
"axe-core": "^4.10.0",
|
|
61
|
-
"babel-loader": "^9.1.3",
|
|
62
|
-
"babel-plugin-istanbul": "^7.0.0",
|
|
63
|
-
"c8": "^10.1.2",
|
|
64
|
-
"camelcase": "^8.0.0",
|
|
65
|
-
"cypress": "^13.13.2",
|
|
66
|
-
"cypress-axe": "1.5.0",
|
|
67
|
-
"eslint": "^9.8.0",
|
|
68
|
-
"eslint-config-ash-nazg": "36.11.1",
|
|
69
|
-
"fflate": "^0.8.2",
|
|
70
|
-
"find-es-resources": "^3.0.2",
|
|
71
|
-
"find-resources": "^0.0.1",
|
|
72
|
-
"globals": "^15.9.0",
|
|
73
|
-
"jamilih": "0.59.2",
|
|
74
|
-
"jquery": "^3.7.1",
|
|
75
|
-
"miller-columns": "^0.9.0",
|
|
76
|
-
"nyc": "^17.0.0",
|
|
77
|
-
"open-cli": "^8.0.0",
|
|
78
|
-
"rollup": "^4.20.0",
|
|
79
|
-
"rollup-plugin-istanbul": "^5.0.0",
|
|
80
|
-
"simple-prefs": "^0.10.1",
|
|
81
|
-
"webextension-polyfill": "^0.12.0",
|
|
82
|
-
"webpack": "^5.93.0"
|
|
83
|
-
},
|
|
84
25
|
"scripts": {
|
|
26
|
+
"prepublishOnly": "pnpm tsc && pnpm rollup",
|
|
27
|
+
"tsc": "tsc",
|
|
85
28
|
"cypress:run": "cypress run && npm run report",
|
|
86
29
|
"cypress:open": "cypress open",
|
|
87
30
|
"test": "npm run cypress:run",
|
|
@@ -89,7 +32,7 @@
|
|
|
89
32
|
"open:coverage": "open-cli http://localhost:8000/coverage/ && npm start",
|
|
90
33
|
"report": "nyc report",
|
|
91
34
|
"rollup": "rollup -c",
|
|
92
|
-
"service-worker": "node ./tools/list-locales && find-es-resources --queryModule=\"./tools/findEsResources.js\" --htmlInput=\"./browser_action/index.html\" -o browser_action/service-worker/sw-resources.json --removeBasePath=\"/
|
|
35
|
+
"service-worker": "node ./tools/list-locales && node ./tools/write-sw-version && find-es-resources --queryModule=\"./tools/findEsResources.js\" --htmlInput=\"./browser_action/index.html\" -o browser_action/service-worker/sw-resources.json --removeBasePath=\"$(pwd)\" && node ./tools/fix-sw-resources-vendor-paths",
|
|
93
36
|
"open": "open-cli http://localhost:8000/browser_action/ && npm start",
|
|
94
37
|
"start": "echo 'Starting on http://localhost:8000/browser_action/' && node server",
|
|
95
38
|
"entities-download": "node --trace-uncaught tools/entities-import.js download",
|
|
@@ -108,14 +51,81 @@
|
|
|
108
51
|
"eslint": "eslint .",
|
|
109
52
|
"lint": "npm run eslint",
|
|
110
53
|
"copy": "npm run copy-jquery && npm run copy-miller-columns && npm run copy-jamilih && npm run copy-polyfill && npm run copy-simple-prefs && npm run copy-intl-dom && npm run copy-json-6 && npm run copy-fflate && npm run copy-camelcase",
|
|
111
|
-
"copy-camelcase": "cp node_modules/camelcase/index.js vendor/camelcase/index.js",
|
|
112
|
-
"copy-fflate": "cp node_modules/fflate/esm/browser.js vendor/fflate/esm/browser.js",
|
|
113
|
-
"copy-intl-dom": "cp node_modules/intl-dom/dist
|
|
114
|
-
"copy-json-6": "
|
|
54
|
+
"copy-camelcase": "cp node_modules/camelcase/index.js vendor/camelcase/index.js && cp node_modules/camelcase/index.d.ts vendor/camelcase/index.d.ts",
|
|
55
|
+
"copy-fflate": "cp node_modules/fflate/esm/browser.js vendor/fflate/esm/browser.js && cp node_modules/fflate/esm/browser.d.ts vendor/fflate/esm/browser.d.ts",
|
|
56
|
+
"copy-intl-dom": "cp -Rf node_modules/intl-dom/dist vendor/intl-dom",
|
|
57
|
+
"copy-json-6": "echo \"// @ts-nocheck\n\" | cat - node_modules/json-6/dist/index.mjs > vendor/json-6/dist/index.mjs",
|
|
115
58
|
"copy-jquery": "cp node_modules/jquery/dist/jquery.js vendor/jquery/dist/jquery.js",
|
|
116
|
-
"copy-miller-
|
|
117
|
-
"copy-
|
|
59
|
+
"copy-miller-columns2": "echo \"\" | cat - node_modules/miller-columns/src/index.js > vendor/miller-columns/src/index.js",
|
|
60
|
+
"copy-miller-columns": "cp -Rf node_modules/miller-columns/* vendor/miller-columns && cp vendor/miller-columns/dist/index.d.ts vendor/miller-columns/dist/index-es.min.d.ts && pnpm copy-miller-columns2",
|
|
61
|
+
"copy-jamilih": "cp node_modules/jamilih/dist/jml.mjs vendor/jamilih/dist/jml.mjs && cp node_modules/jamilih/dist/src/jml.d.ts vendor/jamilih/dist/jml.d.mts",
|
|
118
62
|
"copy-polyfill": "cp node_modules/webextension-polyfill/dist/browser-polyfill.min.js polyfills/browser-polyfill.min.js && cp node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map polyfills/browser-polyfill.min.js.map",
|
|
119
|
-
"copy-simple-prefs": "cp node_modules/simple-prefs/dist/index.esm.js vendor/simple-prefs/dist/index.esm.js"
|
|
63
|
+
"copy-simple-prefs": "cp node_modules/simple-prefs/dist/index.esm.js vendor/simple-prefs/dist/index.esm.js && cp node_modules/simple-prefs/dist/index.esm.d.ts vendor/simple-prefs/dist/index.esm.d.ts && cp node_modules/simple-prefs/dist/simple-prefs.d.ts vendor/simple-prefs/dist/simple-prefs.d.ts"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://github.com/brettz9/unicode-input-toolconverter",
|
|
66
|
+
"bugs": "https://github.com/brettz9/unicode-input-toolconverter/issues",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "git",
|
|
69
|
+
"url": "https://github.com/brettz9/unicode-input-toolconverter"
|
|
70
|
+
},
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=20.0.0"
|
|
73
|
+
},
|
|
74
|
+
"keywords": [
|
|
75
|
+
"unicode",
|
|
76
|
+
"input",
|
|
77
|
+
"converter"
|
|
78
|
+
],
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@node-static/node-static": "^0.10.0",
|
|
81
|
+
"apple-system-profiler": "^1.1.0",
|
|
82
|
+
"cheerio": "1.2.0",
|
|
83
|
+
"download": "^8.0.0",
|
|
84
|
+
"file-fetch": "^2.0.1",
|
|
85
|
+
"intl-dom": "^0.22.0",
|
|
86
|
+
"jsdom": "^30.1.0",
|
|
87
|
+
"json-6": "^1.1.4",
|
|
88
|
+
"node-fetch": "^3.3.2"
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@babel/core": "^8.0.5",
|
|
92
|
+
"@babel/eslint-parser": "^8.0.5",
|
|
93
|
+
"@babel/preset-env": "^8.0.5",
|
|
94
|
+
"@cypress/code-coverage": "^4.0.3",
|
|
95
|
+
"@cypress/webpack-preprocessor": "^8.0.0",
|
|
96
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
97
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
98
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
99
|
+
"@types/download": "^8.0.5",
|
|
100
|
+
"@types/estree": "^1.0.9",
|
|
101
|
+
"@types/file-fetch": "^1.6.6",
|
|
102
|
+
"@types/jsdom": "^30.0.0",
|
|
103
|
+
"@types/node": "^22.20.3",
|
|
104
|
+
"@types/plist": "^3.0.5",
|
|
105
|
+
"@types/serviceworker": "^0.0.201",
|
|
106
|
+
"axe-core": "^4.13.0",
|
|
107
|
+
"babel-loader": "^10.1.1",
|
|
108
|
+
"babel-plugin-istanbul": "^8.0.0",
|
|
109
|
+
"c8": "^12.0.0",
|
|
110
|
+
"camelcase": "^9.0.0",
|
|
111
|
+
"cypress": "^16.1.0",
|
|
112
|
+
"cypress-axe": "1.7.0",
|
|
113
|
+
"eslint": "^10.10.0",
|
|
114
|
+
"eslint-config-ash-nazg": "43.1.10",
|
|
115
|
+
"fflate": "^0.8.3",
|
|
116
|
+
"find-es-resources": "^5.0.0",
|
|
117
|
+
"globals": "^17.12.0",
|
|
118
|
+
"jamilih": "0.70.2",
|
|
119
|
+
"jquery": "^4.0.0",
|
|
120
|
+
"load-stylesheets": "^0.13.0",
|
|
121
|
+
"miller-columns": "^0.17.0",
|
|
122
|
+
"nyc": "^18.0.0",
|
|
123
|
+
"open-cli": "^9.0.0",
|
|
124
|
+
"rollup": "^4.63.3",
|
|
125
|
+
"rollup-plugin-istanbul": "^5.0.0",
|
|
126
|
+
"simple-prefs": "^0.12.1",
|
|
127
|
+
"typescript": "^7.0.2",
|
|
128
|
+
"webextension-polyfill": "^0.12.0",
|
|
129
|
+
"webpack": "^5.111.0"
|
|
120
130
|
}
|
|
121
|
-
}
|
|
131
|
+
}
|
package/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import http from 'http';
|
|
2
|
-
import statik from '@
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import * as statik from '@node-static/node-static';
|
|
3
3
|
import {systemProfiler} from 'apple-system-profiler';
|
|
4
4
|
|
|
5
5
|
const file = new statik.Server({
|
|
@@ -8,54 +8,69 @@ const file = new statik.Server({
|
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
http.createServer(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
http.createServer(
|
|
12
|
+
/**
|
|
13
|
+
* @param {http.IncomingMessage} req
|
|
14
|
+
* @param {http.ServerResponse} res
|
|
15
|
+
* @returns {void}
|
|
16
|
+
*/
|
|
17
|
+
function (req, res) {
|
|
18
|
+
/* istanbul ignore next -- Coverage */
|
|
19
|
+
if (globalThis.__coverage__ &&
|
|
20
|
+
req.url?.startsWith('/__coverage__')) {
|
|
21
|
+
res.setHeader('Content-Type', 'application/json');
|
|
22
|
+
res.end(JSON.stringify({
|
|
23
|
+
coverage: globalThis.__coverage__
|
|
24
|
+
}));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
20
27
|
|
|
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
|
-
|
|
28
|
+
if (req.url?.startsWith('/.')) {
|
|
29
|
+
res.writeHead(404, {
|
|
30
|
+
'Content-Type': 'text/html'
|
|
31
|
+
});
|
|
32
|
+
res.end('<b>Bad request</b>');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (req.url === '/fonts') {
|
|
36
|
+
res.writeHead(200, {
|
|
37
|
+
'Cache-Control': 'no-cache, must-revalidate',
|
|
38
|
+
'Content-Type': 'application/json'
|
|
39
|
+
});
|
|
40
|
+
(async () => {
|
|
41
|
+
try {
|
|
42
|
+
const fontInfo = await systemProfiler({
|
|
43
|
+
normalize: false,
|
|
44
|
+
detailLevel: 'full',
|
|
45
|
+
dataTypes: [
|
|
46
|
+
'SPFontsDataType'
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
const out =
|
|
50
|
+
/**
|
|
51
|
+
* @type {{
|
|
52
|
+
* _items: {typefaces: {family: string}[]}[]
|
|
53
|
+
* }[]}
|
|
54
|
+
*/ (fontInfo)[0]._items.flatMap(({typefaces}) => {
|
|
55
|
+
return typefaces.map((typeface) => typeface.family);
|
|
56
|
+
});
|
|
57
|
+
res.end(JSON.stringify([...new Set(out)].toSorted(
|
|
58
|
+
(a, b) => a.localeCompare(b)
|
|
59
|
+
)));
|
|
60
|
+
// istanbul ignore next -- Shouldn't err
|
|
61
|
+
} catch (err) {
|
|
62
|
+
/* eslint-disable no-console -- CLI */
|
|
63
|
+
// istanbul ignore next -- Shouldn't err
|
|
64
|
+
console.error('Error', err);
|
|
65
|
+
// istanbul ignore next -- Shouldn't err
|
|
66
|
+
}
|
|
67
|
+
/* eslint-enable no-console -- CLI */
|
|
68
|
+
})();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
57
71
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
72
|
+
req.addListener('end', function () {
|
|
73
|
+
file.serve(req, res);
|
|
74
|
+
}).resume();
|
|
75
|
+
}
|
|
76
|
+
).listen(8000);
|