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
package/browser_action/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {i18n, setJSONExtra} from '
|
|
1
|
+
import {i18n, setJSONExtra} from 'intl-dom';
|
|
2
2
|
// Currently not bundling json-6
|
|
3
|
-
import jsonExtra from '
|
|
3
|
+
import jsonExtra from 'json-6';
|
|
4
4
|
|
|
5
5
|
import {makeTabBox} from './templatesElementCustomization/widgets.js';
|
|
6
6
|
import {code, link} from './templateUtils/elements.js';
|
|
@@ -31,7 +31,7 @@ setJSONExtra(jsonExtra);
|
|
|
31
31
|
// SETUP
|
|
32
32
|
|
|
33
33
|
// Todo: Support hash searchParams / streamline with `pushState`
|
|
34
|
-
const {searchParams} = new URL(location);
|
|
34
|
+
const {searchParams} = new URL(location.href);
|
|
35
35
|
|
|
36
36
|
const lang = searchParams.get('lang');
|
|
37
37
|
|
|
@@ -44,10 +44,10 @@ const locales = [...new Set([
|
|
|
44
44
|
|
|
45
45
|
// eslint-disable-next-line unicorn/prefer-top-level-await -- No iife export
|
|
46
46
|
(async () => {
|
|
47
|
-
const _ = await i18n({
|
|
47
|
+
const _ = /** @type {import('intl-dom').I18NCallback<string>} */ (await i18n({
|
|
48
48
|
locales, defaults: false, localesBasePath: '../',
|
|
49
49
|
substitutions: {code, link}
|
|
50
|
-
});
|
|
50
|
+
}));
|
|
51
51
|
|
|
52
52
|
if (searchParams.get('serviceWorker')) {
|
|
53
53
|
// Doesn't work in FF as SW using ESM so putting behind switch for now
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
// hexstyleLwr: return true; // Could use but better not to
|
|
2
2
|
// change for XML-compatibility
|
|
3
3
|
|
|
4
|
-
import {SimplePrefs} from '
|
|
4
|
+
import {SimplePrefs} from 'simple-prefs';
|
|
5
5
|
|
|
6
|
+
/** @type {import('intl-dom').I18NCallback<string>} */
|
|
6
7
|
let _;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {{_: import('intl-dom').I18NCallback<string>}} cfg
|
|
11
|
+
*/
|
|
7
12
|
export const setPrefDefaultVars = ({_: __}) => {
|
|
8
13
|
_ = __;
|
|
9
14
|
};
|
|
@@ -45,8 +50,12 @@ export const getPrefDefaults = () => ({
|
|
|
45
50
|
font: '',
|
|
46
51
|
cssWhitespace: ' ',
|
|
47
52
|
initialTab: 'charts',
|
|
48
|
-
defaultStartCharCode:
|
|
49
|
-
|
|
53
|
+
defaultStartCharCode: /** @type {number} */ (
|
|
54
|
+
_('startCharCode').codePointAt(0)
|
|
55
|
+
) - 1, // 'a'
|
|
56
|
+
currentStartCharCode: /** @type {number} */ (
|
|
57
|
+
_('startCharCode').codePointAt(0)
|
|
58
|
+
) - 1, // 'a'
|
|
50
59
|
lang: _('langCode'), // 'en-US'
|
|
51
60
|
dropdownArr: []
|
|
52
61
|
});
|
|
@@ -31,14 +31,13 @@ function deleteDatabase (db) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @param {
|
|
34
|
+
* @param {object} cfg
|
|
35
35
|
* @param {string} cfg.namespace
|
|
36
36
|
* @returns {Promise<void>}
|
|
37
37
|
*/
|
|
38
38
|
async function activateCallback ({namespace /* , log */}) {
|
|
39
39
|
await deleteDatabase(namespace); // Chrome sometimes doesn't complete
|
|
40
40
|
const charrefunicodeDb = new UnicodeDatabase({
|
|
41
|
-
name: namespace,
|
|
42
41
|
// We don't peg to package major version as database version may vary
|
|
43
42
|
// independently
|
|
44
43
|
version: 1
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
"/browser_action/characterSelection.js",
|
|
3
3
|
"/browser_action/charrefConverters.js",
|
|
4
4
|
"/browser_action/chartBuild.js",
|
|
5
|
-
"/browser_action/encodingBehaviors.js",
|
|
6
|
-
"/browser_action/encodings.js",
|
|
7
5
|
"/browser_action/entities.js",
|
|
8
6
|
"/browser_action/entityBehaviors.js",
|
|
9
7
|
"/browser_action/index.html",
|
|
10
8
|
"/browser_action/index.iife.min.js",
|
|
11
9
|
"/browser_action/index.js",
|
|
12
10
|
"/browser_action/preferences/prefDefaults.js",
|
|
11
|
+
"/browser_action/service-worker/sw-activateCallback.js",
|
|
13
12
|
"/browser_action/styles/unicode-dialog.css",
|
|
14
13
|
"/browser_action/templateUtils/elements.js",
|
|
15
14
|
"/browser_action/templateUtils/fill.js",
|
|
@@ -21,14 +20,16 @@
|
|
|
21
20
|
"/browser_action/unicode/charrefunicodeDb.js",
|
|
22
21
|
"/browser_action/unicode/getScriptInfoForCodePoint.js",
|
|
23
22
|
"/browser_action/unicode/hangul.js",
|
|
24
|
-
"/browser_action/unicode/parseUnihanFromTextFileStrings.js",
|
|
25
23
|
"/browser_action/unicode/unicodeScripts.js",
|
|
26
24
|
"/browser_action/unicode/unihan.js",
|
|
27
25
|
"/browser_action/unicode/unihanDbPopulate.js",
|
|
26
|
+
"/browser_action/unicode/unihanFields.js",
|
|
28
27
|
"/browser_action/unicodecharref.js",
|
|
29
28
|
"/browser_action/utils/DOMUtils.js",
|
|
29
|
+
"/browser_action/utils/FetchUtils.js",
|
|
30
30
|
"/browser_action/utils/TextUtils.js",
|
|
31
31
|
"/browser_action/utils/TypedArrayUtils.js",
|
|
32
|
+
"/browser_action/utils/semicolonSeparatedToArray.js",
|
|
32
33
|
"/browser_action/utils/setupServiceWorker.js",
|
|
33
34
|
"/download/entities/html5-uppercase.ent",
|
|
34
35
|
"/download/entities/htmlmathml-f.ent",
|
|
@@ -62,9 +63,10 @@
|
|
|
62
63
|
"/download/entities/xhtml1-special.ent",
|
|
63
64
|
"/download/entities/xhtml1-symbol.ent",
|
|
64
65
|
"/icons/openWindow24.png",
|
|
66
|
+
"/vendor/camelcase/index.js",
|
|
65
67
|
"/vendor/fflate/esm/browser.js",
|
|
66
68
|
"/vendor/intl-dom/dist/index.esm.js",
|
|
67
|
-
"/vendor/jamilih/dist/jml
|
|
69
|
+
"/vendor/jamilih/dist/jml.mjs",
|
|
68
70
|
"/vendor/jquery/dist/jquery.js",
|
|
69
71
|
"/vendor/json-6/dist/index.mjs",
|
|
70
72
|
"/vendor/miller-columns/dist/index-es.min.js",
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {jml} from '
|
|
1
|
+
import {jml} from 'jamilih/dist/jml.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @param {{
|
|
5
|
+
* arg: string
|
|
6
|
+
* }} cfg
|
|
7
|
+
*/
|
|
3
8
|
export const code = function ({arg}) {
|
|
4
9
|
return jml('code', [arg]);
|
|
5
10
|
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {{
|
|
14
|
+
* arg: string
|
|
15
|
+
* }} cfg
|
|
16
|
+
*/
|
|
6
17
|
export const link = function ({arg}) {
|
|
7
18
|
// Todo: Could parse arg for link different from text
|
|
8
19
|
return jml('a', {
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/reject-any-type -- Arbitrary */
|
|
2
|
+
/**
|
|
3
|
+
* @param {number} items
|
|
4
|
+
* @param {null|(() => any)} [filler]
|
|
5
|
+
*/
|
|
1
6
|
export const fill = (items, filler = null) => {
|
|
7
|
+
// eslint-disable-next-line unicorn/no-array-from-fill -- Ok to try?
|
|
2
8
|
return Array.from({length: items}).fill(filler);
|
|
3
9
|
};
|
|
@@ -1,17 +1,50 @@
|
|
|
1
|
-
import {jml, nbsp, $} from '
|
|
1
|
+
import {jml, nbsp, $} from 'jamilih/dist/jml.js';
|
|
2
2
|
import {fill} from '../templateUtils/fill.js';
|
|
3
3
|
import unicodecharref from '../unicodecharref.js';
|
|
4
4
|
|
|
5
5
|
let idgen = 0;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {{
|
|
9
|
+
* descripts?: boolean,
|
|
10
|
+
* _: import('intl-dom').I18NCallback,
|
|
11
|
+
* buttonyes: boolean,
|
|
12
|
+
* entyes: boolean,
|
|
13
|
+
* colsOverRemainder?: number|false,
|
|
14
|
+
* captionContent: string,
|
|
15
|
+
* font: string,
|
|
16
|
+
* lang: string,
|
|
17
|
+
* rows: number,
|
|
18
|
+
* cols: number,
|
|
19
|
+
* rowceil?: number,
|
|
20
|
+
* appliedFormats: ("decyes" | "hexyes" | "unicodeyes")[],
|
|
21
|
+
* resetCurrentStartCharCodeIfOutOfBounds: () => void,
|
|
22
|
+
* current: {startCharCode: number},
|
|
23
|
+
* prev: number,
|
|
24
|
+
* q?: number,
|
|
25
|
+
* arr?: number[],
|
|
26
|
+
* displayTypes: import('../chartBuild.js').DisplayTypes,
|
|
27
|
+
* textReceptacle: HTMLTextAreaElement|HTMLInputElement,
|
|
28
|
+
* chartContainer: HTMLElement,
|
|
29
|
+
* setPref: ReturnType<
|
|
30
|
+
* typeof import('../preferences/prefDefaults.js').getUnicodeDefaults
|
|
31
|
+
* >['setPref'],
|
|
32
|
+
* insertText: import('../chartBuild.js').InsertText,
|
|
33
|
+
* chartBuild: typeof import('../chartBuild.js').chartBuild,
|
|
34
|
+
* charrefunicodeConverter: import('../chartBuild.js').CharrefUnicodeConverter
|
|
35
|
+
* }} cfg
|
|
36
|
+
*/
|
|
6
37
|
const chartBuildTemplate = function ({
|
|
7
38
|
_, rows, cols, charrefunicodeConverter, current,
|
|
8
39
|
resetCurrentStartCharCodeIfOutOfBounds, // descriptsOrOnlyEnts,
|
|
9
|
-
q, textReceptacle, entyes, chartBuild, descripts,
|
|
40
|
+
q: qq, textReceptacle, entyes, chartBuild, descripts,
|
|
10
41
|
chartContainer, arr,
|
|
11
42
|
setPref, insertText, buttonyes, font, lang, prev,
|
|
12
43
|
rowceil, colsOverRemainder, appliedFormats, displayTypes,
|
|
13
44
|
captionContent
|
|
14
45
|
}) {
|
|
46
|
+
let q = /** @type {number} */ (qq);
|
|
47
|
+
|
|
15
48
|
jml('table', {
|
|
16
49
|
id: 'chart_table',
|
|
17
50
|
class: 'unicodetablecell',
|
|
@@ -28,116 +61,142 @@ const chartBuildTemplate = function ({
|
|
|
28
61
|
captionContent
|
|
29
62
|
]],
|
|
30
63
|
...fill(rows).map((_row, j) => {
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
64
|
+
return /** @type {import('jamilih/dist/jml.js').JamilihArray} */ (
|
|
65
|
+
['tr', fill(cols).map((_col, i) => {
|
|
66
|
+
// If more rows/cols. specified than match
|
|
67
|
+
if (j === rowceil && i >= Number(colsOverRemainder)) {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
36
70
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
71
|
+
// Todo: Document what's going on here
|
|
72
|
+
if (arr) {
|
|
73
|
+
q++;
|
|
74
|
+
if (q >= arr.length) {
|
|
75
|
+
q = 0;
|
|
76
|
+
}
|
|
77
|
+
current.startCharCode = arr[q];
|
|
78
|
+
} else {
|
|
79
|
+
current.startCharCode++;
|
|
42
80
|
}
|
|
43
|
-
|
|
44
|
-
} else {
|
|
45
|
-
current.startCharCode++;
|
|
46
|
-
}
|
|
47
|
-
resetCurrentStartCharCodeIfOutOfBounds();
|
|
81
|
+
resetCurrentStartCharCodeIfOutOfBounds();
|
|
48
82
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
const charRefIdx = charrefunicodeConverter.
|
|
84
|
+
numericCharacterReferences.indexOf(
|
|
85
|
+
// We've now had to add 1 here for some reason
|
|
86
|
+
current.startCharCode
|
|
87
|
+
);
|
|
88
|
+
const hasEntity = charRefIdx !== -1;
|
|
89
|
+
const entity = hasEntity
|
|
90
|
+
// If recognized multiple char ent. (won't convert these to decimal)
|
|
91
|
+
? '&' + charrefunicodeConverter.entities[charRefIdx] + ';'
|
|
92
|
+
: '';
|
|
59
93
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
94
|
+
return ['td', {
|
|
95
|
+
class: (hasEntity ? 'entity ' : '') + 'unicodetablecell',
|
|
96
|
+
$on: {
|
|
97
|
+
mouseover: (function (_entity, startCharCode) {
|
|
98
|
+
return function (/* e */) {
|
|
99
|
+
if (
|
|
100
|
+
!(
|
|
101
|
+
/** @type {HTMLElement & {$noGetDescripts: boolean}} */ (
|
|
102
|
+
$('#chart_table')
|
|
103
|
+
)
|
|
104
|
+
).$noGetDescripts
|
|
105
|
+
) {
|
|
106
|
+
unicodecharref.getUnicodeDescription(
|
|
107
|
+
_entity,
|
|
108
|
+
// Needed to convert this for some reason
|
|
109
|
+
startCharCode.toString(16).toUpperCase().padStart(4, '0')
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}(entity, current.startCharCode)),
|
|
114
|
+
// trying dblclick worked but might not be obvious to
|
|
115
|
+
// user and single clicks still activated; relying on
|
|
116
|
+
// right button doesn't work
|
|
117
|
+
/**
|
|
118
|
+
* @param {Event} e
|
|
119
|
+
*/
|
|
120
|
+
click (e) {
|
|
121
|
+
if ('altKey' in e && e.altKey) {
|
|
122
|
+
/** @type {HTMLElement & {$noGetDescripts: boolean}} */
|
|
123
|
+
($('#chart_table')).$noGetDescripts =
|
|
124
|
+
!(
|
|
125
|
+
/** @type {HTMLElement & {$noGetDescripts: boolean}} */ (
|
|
126
|
+
$('#chart_table')
|
|
127
|
+
)
|
|
128
|
+
).$noGetDescripts;
|
|
71
129
|
}
|
|
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
130
|
}
|
|
82
131
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
132
|
+
}, [
|
|
133
|
+
...appliedFormats.flatMap((type, idx, array) => {
|
|
134
|
+
const name = type.replace('yes', '');
|
|
135
|
+
const isMiddle = idx === 1 && array.length === 2;
|
|
136
|
+
const isFinal = idx === 2;
|
|
137
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
138
|
+
const button = /** @type {import('jamilih/dist/jml.js').JamilihArray} */ (
|
|
139
|
+
[(buttonyes ? 'button' : 'div'), {
|
|
140
|
+
class: buttonyes ? 'buttonyes' : null,
|
|
141
|
+
name,
|
|
142
|
+
id: '_' + idgen++,
|
|
143
|
+
dataset: {
|
|
144
|
+
value: displayTypes[type](current.startCharCode)
|
|
145
|
+
},
|
|
146
|
+
$on: {
|
|
147
|
+
click (e) {
|
|
148
|
+
const {target: {dataset: {value}}} = e;
|
|
149
|
+
if (!('altKey' in e) || !e.altKey) {
|
|
150
|
+
insertText({
|
|
151
|
+
textReceptacle,
|
|
152
|
+
value: /** @type {string} */ (value)
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
100
156
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
157
|
+
}, [
|
|
158
|
+
// Todo: Add substitute character if detect is an invisible?
|
|
159
|
+
displayTypes[type](current.startCharCode)
|
|
160
|
+
]]
|
|
161
|
+
);
|
|
162
|
+
const container = isFinal
|
|
163
|
+
? jml('div', {
|
|
164
|
+
class: 'centered'
|
|
165
|
+
}, [button])
|
|
166
|
+
: button;
|
|
167
|
+
return [
|
|
168
|
+
isMiddle
|
|
169
|
+
? nbsp.repeat(3)
|
|
170
|
+
: isFinal
|
|
171
|
+
? ['br']
|
|
172
|
+
: '',
|
|
173
|
+
container
|
|
174
|
+
];
|
|
175
|
+
}),
|
|
176
|
+
...(entyes && hasEntity
|
|
177
|
+
? [
|
|
178
|
+
['a', {
|
|
179
|
+
href: '#',
|
|
180
|
+
$on: {
|
|
181
|
+
/**
|
|
182
|
+
* @param {MouseEvent} e
|
|
183
|
+
*/
|
|
184
|
+
click (e) {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
if (!e.altKey) {
|
|
187
|
+
insertText({textReceptacle, value: entity});
|
|
188
|
+
}
|
|
130
189
|
}
|
|
131
190
|
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
]
|
|
140
|
-
|
|
191
|
+
}, [
|
|
192
|
+
entity
|
|
193
|
+
]],
|
|
194
|
+
' '
|
|
195
|
+
]
|
|
196
|
+
: [''])
|
|
197
|
+
]];
|
|
198
|
+
})]
|
|
199
|
+
);
|
|
141
200
|
}),
|
|
142
201
|
['tr', [
|
|
143
202
|
['td', {
|
|
@@ -147,6 +206,9 @@ const chartBuildTemplate = function ({
|
|
|
147
206
|
['a', {
|
|
148
207
|
href: '#',
|
|
149
208
|
$on: {
|
|
209
|
+
/**
|
|
210
|
+
* @param {Event} e
|
|
211
|
+
*/
|
|
150
212
|
async click (e) {
|
|
151
213
|
e.preventDefault();
|
|
152
214
|
await Promise.all([
|
|
@@ -164,6 +226,9 @@ const chartBuildTemplate = function ({
|
|
|
164
226
|
['a', {
|
|
165
227
|
href: '#',
|
|
166
228
|
$on: {
|
|
229
|
+
/**
|
|
230
|
+
* @param {Event} e
|
|
231
|
+
*/
|
|
167
232
|
async click (e) {
|
|
168
233
|
e.preventDefault();
|
|
169
234
|
await Promise.all([
|