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.
Files changed (143) hide show
  1. package/.nyc_output/out.json +8980 -1849
  2. package/CHANGES.md +15 -1
  3. package/README.md +6 -11
  4. package/_locales/en-US/messages.json +153 -6
  5. package/_locales/hu-HU/messages.json +153 -6
  6. package/_locales/pt-BR/messages.json +153 -6
  7. package/_locales/sv-SE/messages.json +153 -6
  8. package/babel.config.json +0 -1
  9. package/browser_action/characterSelection.js +18 -11
  10. package/browser_action/charrefConverters.js +286 -79
  11. package/browser_action/chartBuild.js +97 -27
  12. package/browser_action/encodingBehaviors.js +10 -7
  13. package/browser_action/entityBehaviors.js +42 -16
  14. package/browser_action/index-es.html +13 -1
  15. package/browser_action/index-instrumented.html +13 -1
  16. package/browser_action/index-pages.html +13 -1
  17. package/browser_action/index.html +13 -1
  18. package/browser_action/index.iife.min.js +9 -1
  19. package/browser_action/index.iife.min.js.map +1 -1
  20. package/browser_action/index.instrumented.iife.min.js +1 -1
  21. package/browser_action/index.instrumented.iife.min.js.map +1 -1
  22. package/browser_action/index.js +5 -5
  23. package/browser_action/preferences/prefDefaults.js +12 -3
  24. package/browser_action/service-worker/sw-activateCallback.js +1 -2
  25. package/browser_action/service-worker/sw-resources.json +6 -4
  26. package/browser_action/templateUtils/elements.js +12 -1
  27. package/browser_action/templateUtils/fill.js +6 -0
  28. package/browser_action/templateUtils/validation.js +4 -1
  29. package/browser_action/templates/chartBuild.js +167 -102
  30. package/browser_action/templates/index.js +227 -53
  31. package/browser_action/templatesElementCustomization/widgets.js +40 -15
  32. package/browser_action/unicode/UnicodeConverter.js +99 -73
  33. package/browser_action/unicode/charrefunicodeDb.js +100 -50
  34. package/browser_action/unicode/getScriptInfoForCodePoint.js +13 -4
  35. package/browser_action/unicode/hangul.js +27 -20
  36. package/browser_action/unicode/lastScriptNames.json +1 -1
  37. package/browser_action/unicode/parseUnihanFromTextFileStrings.js +44 -25
  38. package/browser_action/unicode/unicodeFieldInfo.js +112 -90
  39. package/browser_action/unicode/unicodeScripts.js +409 -35
  40. package/browser_action/unicode/unihan.js +4 -3
  41. package/browser_action/unicode/unihanDbPopulate.js +7 -2
  42. package/browser_action/unicode/unihanFields.js +34 -0
  43. package/browser_action/unicodecharref.js +353 -190
  44. package/browser_action/utils/DOMUtils.js +95 -34
  45. package/browser_action/utils/FetchUtils.js +7 -6
  46. package/browser_action/utils/TextUtils.js +4 -4
  47. package/browser_action/utils/TypedArrayUtils.js +9 -5
  48. package/browser_action/utils/semicolonSeparatedToArray.js +3 -3
  49. package/browser_action/utils/setupServiceWorker.js +2 -2
  50. package/eslint.config.js +11 -0
  51. package/icons/openWindow16.png +0 -0
  52. package/icons/openWindow24.png +0 -0
  53. package/lib/background.html +7 -0
  54. package/lib/background.js +2 -2
  55. package/package.json +80 -70
  56. package/pnpm-workspace.yaml +8 -0
  57. package/server.js +66 -51
  58. package/sw.js +97 -56
  59. package/tools/entities-import.js +4 -1
  60. package/tools/findEsResources.js +33 -10
  61. package/tools/fix-sw-resources-vendor-paths.js +60 -0
  62. package/tools/list-locales.js +2 -2
  63. package/tools/parseUnicodeCharts.js +126 -60
  64. package/tools/ucd-import.js +1 -10
  65. package/tools/unicode-charts.html +49 -20
  66. package/tools/unihan-import.js +45 -15
  67. package/tools/write-sw-version.js +16 -0
  68. package/tsconfig.json +23 -0
  69. package/typings/__coverage__.d.ts +5 -0
  70. package/typings/apple-system-profiler.d.ts +17 -0
  71. package/typings/commands.d.ts +19 -0
  72. package/typings/json-6.d.ts +4 -0
  73. package/typings/rollup-plugin-istanbul.d.ts +3 -0
  74. package/vendor/camelcase/index.d.ts +154 -0
  75. package/vendor/camelcase/index.js +137 -23
  76. package/vendor/fflate/esm/browser.d.ts +1539 -0
  77. package/vendor/fflate/esm/browser.js +82 -55
  78. package/vendor/intl-dom/dist/Formatter.d.ts +120 -0
  79. package/vendor/intl-dom/dist/Formatter.d.ts.map +1 -0
  80. package/vendor/intl-dom/dist/collation.d.ts +42 -0
  81. package/vendor/intl-dom/dist/collation.d.ts.map +1 -0
  82. package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts +52 -0
  83. package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts.map +1 -0
  84. package/vendor/intl-dom/dist/defaultInsertNodes.d.ts +96 -0
  85. package/vendor/intl-dom/dist/defaultInsertNodes.d.ts.map +1 -0
  86. package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts +17 -0
  87. package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts.map +1 -0
  88. package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts +285 -0
  89. package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts.map +1 -0
  90. package/vendor/intl-dom/dist/findLocaleStrings.d.ts +88 -0
  91. package/vendor/intl-dom/dist/findLocaleStrings.d.ts.map +1 -0
  92. package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts +67 -0
  93. package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts.map +1 -0
  94. package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts +73 -0
  95. package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts.map +1 -0
  96. package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts +26 -0
  97. package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts.map +1 -0
  98. package/vendor/intl-dom/dist/i18n.d.ts +113 -0
  99. package/vendor/intl-dom/dist/i18n.d.ts.map +1 -0
  100. package/vendor/intl-dom/dist/index.d.ts +92 -0
  101. package/vendor/intl-dom/dist/index.d.ts.map +1 -0
  102. package/vendor/intl-dom/dist/index.esm.d.ts +34 -0
  103. package/vendor/intl-dom/dist/index.esm.js +854 -896
  104. package/vendor/intl-dom/dist/index.esm.min.js +4 -0
  105. package/vendor/intl-dom/dist/index.esm.min.js.map +1 -0
  106. package/vendor/intl-dom/dist/index.umd.js +2953 -0
  107. package/vendor/intl-dom/dist/index.umd.min.js +4 -0
  108. package/vendor/intl-dom/dist/index.umd.min.js.map +1 -0
  109. package/vendor/intl-dom/dist/promiseChainForValues.d.ts +34 -0
  110. package/vendor/intl-dom/dist/promiseChainForValues.d.ts.map +1 -0
  111. package/vendor/intl-dom/dist/shared.d.ts +20 -0
  112. package/vendor/intl-dom/dist/shared.d.ts.map +1 -0
  113. package/vendor/intl-dom/dist/utils.d.ts +53 -0
  114. package/vendor/intl-dom/dist/utils.d.ts.map +1 -0
  115. package/vendor/jamilih/dist/jml.d.mts +468 -0
  116. package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +1489 -343
  117. package/vendor/jquery/dist/jquery.js +1677 -2713
  118. package/vendor/json-6/dist/index.mjs +2 -0
  119. package/vendor/miller-columns/CHANGES.md +185 -0
  120. package/vendor/miller-columns/LICENSE-MIT.txt +21 -0
  121. package/vendor/miller-columns/README.md +249 -0
  122. package/vendor/miller-columns/demos/index.html +69 -0
  123. package/vendor/miller-columns/demos/index.js +72 -0
  124. package/vendor/miller-columns/dist/index-es.js +748 -0
  125. package/vendor/miller-columns/dist/index-es.min.d.ts +25 -0
  126. package/vendor/miller-columns/dist/index-es.min.js +7 -1
  127. package/vendor/miller-columns/dist/index-umd.js +757 -0
  128. package/vendor/miller-columns/dist/index-umd.min.js +7 -0
  129. package/vendor/miller-columns/dist/index.d.ts +25 -0
  130. package/vendor/miller-columns/dist/millerColumns.d.ts +10 -0
  131. package/vendor/miller-columns/eslint.config.js +46 -0
  132. package/vendor/miller-columns/fix-declarations.js +18 -0
  133. package/vendor/miller-columns/miller-columns.css +24 -1
  134. package/vendor/miller-columns/package.json +73 -0
  135. package/vendor/miller-columns/pnpm-workspace.yaml +2 -0
  136. package/vendor/miller-columns/src/index.js +642 -0
  137. package/vendor/miller-columns/src/millerColumns.ts +12 -0
  138. package/vendor/miller-columns/tsconfig-prod.json +23 -0
  139. package/vendor/miller-columns/tsconfig.json +21 -0
  140. package/vendor/simple-prefs/dist/index.esm.d.ts +1 -0
  141. package/vendor/simple-prefs/dist/index.esm.js +164 -216
  142. package/vendor/simple-prefs/dist/simple-prefs.d.ts +117 -0
  143. package/lgtm.yml +0 -5
@@ -1,6 +1,6 @@
1
- import {i18n, setJSONExtra} from '../vendor/intl-dom/dist/index.esm.js';
1
+ import {i18n, setJSONExtra} from 'intl-dom';
2
2
  // Currently not bundling json-6
3
- import jsonExtra from '../vendor/json-6/dist/index.mjs';
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 '../../vendor/simple-prefs/dist/index.esm.js';
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: _('startCharCode').codePointAt() - 1, // 'a'
49
- currentStartCharCode: _('startCharCode').codePointAt() - 1, // 'a'
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 {PlainObject} cfg
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-es.js",
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 '../../vendor/jamilih/dist/jml-es.js';
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,5 +1,8 @@
1
+ /**
2
+ * @param {string} link
3
+ */
1
4
  export const safeLink = function (link) {
2
- return (/https?:/u).test(link)
5
+ return (/https?:/v).test(link)
3
6
  ? link
4
7
  /* istanbul ignore next -- All links should be safe */
5
8
  : '';
@@ -1,17 +1,50 @@
1
- import {jml, nbsp, $} from '../../vendor/jamilih/dist/jml-es.js';
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 ['tr', fill(cols).map((_col, i) => {
32
- // If more rows/cols. specified than match
33
- if (j === rowceil && i >= colsOverRemainder) {
34
- return '';
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
- // Todo: Document what's going on here
38
- if (arr) {
39
- q++;
40
- if (q >= arr.length) {
41
- q = 0;
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
- current.startCharCode = arr[q];
44
- } else {
45
- current.startCharCode++;
46
- }
47
- resetCurrentStartCharCodeIfOutOfBounds();
81
+ resetCurrentStartCharCodeIfOutOfBounds();
48
82
 
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
- : '';
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
- 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
- );
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
- ...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});
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
- // 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});
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
- entity
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([