Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Casheeew committed Jan 28, 2024
2 parents b1398ed + 1b9422d commit 30874e9
Show file tree
Hide file tree
Showing 27 changed files with 229 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"extends": [
"eslint:recommended",
"plugin:jsonc/recommended-with-json",
"plugin:eslint-comments/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
Expand Down Expand Up @@ -378,6 +379,7 @@
"allowAllPropertiesOnSameLine": true
}
],
"eslint-comments/no-unused-disable": "error",
"@typescript-eslint/ban-ts-comment": [
"error",
{
Expand Down
48 changes: 24 additions & 24 deletions ext/data/deinflect.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,28 +324,28 @@
{"kanaIn": "", "kanaOut": "", "rulesIn": [], "rulesOut": ["v1", "v5", "vk", "vs", "vz"]}
],
"masu stem": [
{"kanaIn": "", "kanaOut": "いる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "える", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "きる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "ぎる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "ける", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "げる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "じる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "せる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "ぜる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "ちる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "てる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "でる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "にる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "ねる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "ひる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "びる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "へる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "べる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "みる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "める", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "りる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "れる", "rulesIn": [], "rulesOut": ["v1"]},
{"kanaIn": "", "kanaOut": "いる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "える", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "きる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "ぎる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "ける", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "げる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "じる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "せる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "ぜる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "ちる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "てる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "でる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "にる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "ねる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "ひる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "びる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "へる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "べる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "みる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "める", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "りる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "れる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "", "kanaOut": "", "rulesIn": [], "rulesOut": ["v5"]},
{"kanaIn": "", "kanaOut": "", "rulesIn": [], "rulesOut": ["v5"]},
{"kanaIn": "", "kanaOut": "", "rulesIn": [], "rulesOut": ["v5"]},
Expand Down Expand Up @@ -603,10 +603,10 @@
"progressive or perfect": [
{"kanaIn": "ている", "kanaOut": "", "rulesIn": ["v1"], "rulesOut": ["iru"]},
{"kanaIn": "ておる", "kanaOut": "", "rulesIn": ["v5"], "rulesOut": ["iru"]},
{"kanaIn": "てる", "kanaOut": "", "rulesIn": ["v1"], "rulesOut": ["iru"]},
{"kanaIn": "てる", "kanaOut": "", "rulesIn": ["v1p"], "rulesOut": ["iru"]},
{"kanaIn": "でいる", "kanaOut": "", "rulesIn": ["v1"], "rulesOut": ["iru"]},
{"kanaIn": "でおる", "kanaOut": "", "rulesIn": ["v5"], "rulesOut": ["iru"]},
{"kanaIn": "でる", "kanaOut": "", "rulesIn": ["v1"], "rulesOut": ["iru"]},
{"kanaIn": "でる", "kanaOut": "", "rulesIn": ["v1p"], "rulesOut": ["iru"]},
{"kanaIn": "とる", "kanaOut": "", "rulesIn": ["v5"], "rulesOut": ["iru"]},
{"kanaIn": "ないでいる", "kanaOut": "ない", "rulesIn": ["v1"], "rulesOut": ["adj-i"]}
],
Expand Down
14 changes: 12 additions & 2 deletions ext/data/schemas/dictionary-term-bank-v3-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
},
"height": {
"type": "number",
"description": "Preferred width of the image.",
"description": "Preferred height of the image.",
"minimum": 0
},
"title": {
Expand Down Expand Up @@ -204,6 +204,14 @@
"description": "The vertical alignment of the image.",
"enum": ["baseline", "sub", "super", "text-top", "text-bottom", "middle", "top", "bottom"]
},
"border": {
"type": "string",
"description": "Shorthand for border width, style, and color."
},
"borderRadius": {
"type": "string",
"description": "Roundness of the corners of the image's outer border edge."
},
"sizeUnits": {
"type": "string",
"description": "The units for the width and height.",
Expand Down Expand Up @@ -485,7 +493,7 @@
},
"height": {
"type": "integer",
"description": "Preferred width of the image.",
"description": "Preferred height of the image.",
"minimum": 1
},
"title": {
Expand Down Expand Up @@ -539,6 +547,8 @@
{
"type": "array",
"description": "Deinflection of the term to an uninflected term.",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "string",
Expand Down
4 changes: 4 additions & 0 deletions ext/data/templates/default-anki-field-templates.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@
{{#*inline "pitch-accent-positions"}}
{{~> pitch-accent-list format='position'~}}
{{/inline}}

{{~#*inline "pitch-accent-categories"~}}
{{~#each (pitchCategories @root)~}}{{~.~}}{{~#unless @last~}},{{~/unless~}}{{~/each~}}
{{~/inline~}}
{{! End Pitch Accents }}

{{#*inline "phonetic-transcriptions"}}
Expand Down
2 changes: 0 additions & 2 deletions ext/js/core/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,12 @@ export function promiseAnimationFrame(timeout) {
const onTimeout = () => {
timer = null;
if (frameRequest !== null) {
// eslint-disable-next-line no-undef
cancelAnimationFrame(frameRequest);
frameRequest = null;
}
resolve({time: performance.now(), timeout: true});
};

// eslint-disable-next-line no-undef
frameRequest = requestAnimationFrame(onFrame);
if (typeof timeout === 'number') {
timer = setTimeout(onTimeout, timeout);
Expand Down
2 changes: 1 addition & 1 deletion ext/js/dictionary/dictionary-data-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class DictionaryDataUtil {
case 'vs':
isVerbOrAdjective = true;
isSuruVerb = true;
break;
// falls through
case 'n':
isNoun = true;
break;
Expand Down
9 changes: 8 additions & 1 deletion ext/js/dictionary/dictionary-importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,16 @@ export class DictionaryImporter {
* @param {import('dictionary-database').DatabaseTermEntry} entry
*/
async _resolveStructuredContentImage(context, target, source, entry) {
const {verticalAlign, sizeUnits} = source;
const {
verticalAlign,
border,
borderRadius,
sizeUnits
} = source;
await this._createImageData(context, target, source, entry);
if (typeof verticalAlign === 'string') { target.verticalAlign = verticalAlign; }
if (typeof border === 'string') { target.border = border; }
if (typeof borderRadius === 'string') { target.borderRadius = borderRadius; }
if (typeof sizeUnits === 'string') { target.sizeUnits = sizeUnits; }
}

Expand Down
6 changes: 3 additions & 3 deletions ext/js/display/display-profile-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DisplayProfileSelection {
/** @type {import('./display.js').Display} */
this._display = display;
/** @type {HTMLElement} */
this._profielList = querySelectorNotNull(document, '#profile-list');
this._profileList = querySelectorNotNull(document, '#profile-list');
/** @type {HTMLButtonElement} */
this._profileButton = querySelectorNotNull(document, '#profile-button');
/** @type {HTMLElement} */
Expand Down Expand Up @@ -111,8 +111,8 @@ export class DisplayProfileSelection {
fragment.appendChild(entry);
this._eventListeners.addEventListener(radio, 'change', this._onProfileRadioChange.bind(this, i), false);
}
this._profielList.textContent = '';
this._profielList.appendChild(fragment);
this._profileList.textContent = '';
this._profileList.appendChild(fragment);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions ext/js/display/sandbox/structured-content-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export class StructuredContentGenerator {
collapsed,
collapsible,
verticalAlign,
border,
borderRadius,
sizeUnits
} = data;

Expand Down Expand Up @@ -130,6 +132,8 @@ export class StructuredContentGenerator {
}

imageContainer.style.width = `${usedWidth}em`;
if (typeof border === 'string') { imageContainer.style.border = border; }
if (typeof borderRadius === 'string') { imageContainer.style.borderRadius = borderRadius; }
if (typeof title === 'string') {
imageContainer.title = title;
}
Expand Down
1 change: 0 additions & 1 deletion ext/js/dom/sandbox/css-style-applier.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export class CssStyleApplier {
/** @type {RegExp} */
this._patternClassNameCharacter = /[0-9a-zA-Z-_]/;
}
/* eslint-enable jsdoc/check-line-alignment */

/**
* Loads the data file for use.
Expand Down
16 changes: 9 additions & 7 deletions ext/js/language/deinflector.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ export class Deinflector {
/* eslint-disable no-multi-spaces */
/** @type {Map<string, import('translation-internal').DeinflectionRuleFlags>} @readonly */
static _ruleTypes = new Map([
['v1', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00000001)], // Verb ichidan
['v5', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00000010)], // Verb godan
['vs', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00000100)], // Verb suru
['vk', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00001000)], // Verb kuru
['vz', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00010000)], // Verb zuru
['adj-i', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00100000)], // Adjective i
['iru', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b01000000)] // Intermediate -iru endings for progressive or perfect tense
['v1', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000011)], // Verb ichidan
['v1d', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000010)], // Verb ichidan dictionary form
['v1p', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000001)], // Verb ichidan progressive or perfect
['v5', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000100)], // Verb godan
['vs', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000001000)], // Verb suru
['vk', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000010000)], // Verb kuru
['vz', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000100000)], // Verb zuru
['adj-i', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b001000000)], // Adjective i
['iru', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b010000000)] // Intermediate -iru endings for progressive or perfect tense
]);
/* eslint-enable no-multi-spaces */

Expand Down
3 changes: 0 additions & 3 deletions ext/js/language/sandbox/japanese-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ for (let i = 0, ii = kana.length; i < ii; i += 3) {
* @param {import('japanese-util').CodepointRange} range
* @returns {boolean}
*/
// eslint-disable-next-line no-implicit-globals
function isCodePointInRange(codePoint, [min, max]) {
return (codePoint >= min && codePoint <= max);
}
Expand All @@ -200,7 +199,6 @@ function isCodePointInRange(codePoint, [min, max]) {
* @param {import('japanese-util').CodepointRange[]} ranges
* @returns {boolean}
*/
// eslint-disable-next-line no-implicit-globals
function isCodePointInRanges(codePoint, ranges) {
for (const [min, max] of ranges) {
if (codePoint >= min && codePoint <= max) {
Expand All @@ -214,7 +212,6 @@ function isCodePointInRanges(codePoint, ranges) {
* @param {string} previousCharacter
* @returns {?string}
*/
// eslint-disable-next-line no-implicit-globals
function getProlongedHiragana(previousCharacter) {
switch (KANA_TO_VOWEL_MAPPING.get(previousCharacter)) {
case 'a': return 'あ';
Expand Down
1 change: 1 addition & 0 deletions ext/js/pages/settings/anki-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class AnkiController {
'pitch-accents',
'pitch-accent-graphs',
'pitch-accent-positions',
'pitch-accent-categories',
'phonetic-transcriptions',
'reading',
'screenshot',
Expand Down
47 changes: 47 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"dotenv": "^16.3.1",
"esbuild": "^0.19.11",
"eslint": "^8.56.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-jsdoc": "^47.0.1",
"eslint-plugin-jsonc": "^2.11.2",
Expand Down
Loading

0 comments on commit 30874e9

Please sign in to comment.