exclude openssl and i18n from npm run format; + npm run format (#183)

This commit is contained in:
Aleksandr Iushmanov
2025-04-27 14:43:16 +01:00
committed by GitHub
parent b841469505
commit ccfb09e261
12 changed files with 31 additions and 30 deletions

View File

@@ -7,6 +7,8 @@ node_modules
.env.*
!.env.example
/src-tauri/target
/openssl*
/src/i18n/i18n*
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml

View File

@@ -40,4 +40,4 @@ To generate the icons use the following command:
```shell
npm run minify-icons
```
```

View File

@@ -177,7 +177,6 @@
<style lang="scss">
$border-radius: 16px;
.input {
border: 1px solid var(--md-sys-color-outline);
flex-grow: 1;
@@ -220,7 +219,6 @@
width: 100%;
}
section {
display: flex;
flex-direction: column;

View File

@@ -84,7 +84,6 @@
border-right-width: 3px;
}
.inline-kbd {
margin-inline-end: 2px;
}

View File

@@ -73,8 +73,9 @@
font-stretch: 62.5% 100%;
src: url("@fontsource-variable/noto-sans-mono/files/noto-sans-mono-latin-ext-wght-normal.woff2")
format("woff2-variations");
unicode-range: U+0100-02AF, U+0300-0301, U+0303-0304, U+0308-0309, U+0323,
U+0329, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,
unicode-range:
U+0100-02AF, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,
U+A720-A7FF;
}
@@ -87,7 +88,8 @@
font-stretch: 62.5% 100%;
src: url("@fontsource-variable/noto-sans-mono/files/noto-sans-mono-latin-wght-normal.woff2")
format("woff2-variations");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+2000-206F,
U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
unicode-range:
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+2000-206F, U+2074,
U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@@ -5,23 +5,24 @@
*
* I could use _.debounce(), but bringing dependency on lodash didn't feel
* justified yet.
*
*
* @param func The function to debounce
* @param wait The number of milliseconds to delay execution
* @returns A debounced version of the provided function
*/
function debounce<T extends (...args: any[]) => void>(
func: T,
wait: number
wait: number,
): T & { cancel: () => void } {
let timeout: ReturnType<typeof setTimeout> | null = null;
const debounced = function(
this: ThisParameterType<T>, ...args: Parameters<T>
const debounced = function (
this: ThisParameterType<T>,
...args: Parameters<T>
): void {
const context = this;
const later = function() {
const later = function () {
timeout = null;
func.apply(context, args);
};
@@ -33,7 +34,7 @@ function debounce<T extends (...args: any[]) => void>(
timeout = setTimeout(later, wait);
};
debounced.cancel = function() {
debounced.cancel = function () {
if (timeout) {
clearTimeout(timeout);
timeout = null;
@@ -43,4 +44,4 @@ function debounce<T extends (...args: any[]) => void>(
return debounced as T & { cancel: () => void };
}
export default debounce;
export default debounce;

View File

@@ -173,7 +173,6 @@
</footer>
<style lang="scss">
.sync-box {
display: flex;
align-items: center;

View File

@@ -165,7 +165,6 @@
}
}
.timeline {
flex-grow: 1;
}

View File

@@ -45,7 +45,6 @@
padding-inline: 16px;
}
.icon {
cursor: pointer;

View File

@@ -131,7 +131,7 @@
codes: Map<number, KeyInfo>,
): Promise<FlexSearch.Index> {
if (chords.length === 0 || !browser) return index;
index = new FlexSearch.Index({
tokenize: "full",
encode(phrase: string) {
@@ -149,36 +149,36 @@
});
},
});
let abort = false;
abortIndexing = () => {
abort = true;
};
const batchSize = 200;
const batches = Math.ceil(chords.length / batchSize);
for (let b = 0; b < batches; b++) {
if (abort) return index;
const start = b * batchSize;
const end = Math.min((b + 1) * batchSize, chords.length);
const batch = chords.slice(start, end);
const promises = batch.map((chord, i) => {
const chordIndex = start + i;
progress = chordIndex + 1;
if ("phrase" in chord) {
const encodedChord = encodeChord(chord, osLayout, codes);
return index.addAsync(chordIndex, encodedChord);
}
return Promise.resolve();
});
await Promise.all(promises);
}
return index;
}

View File

@@ -114,7 +114,6 @@
font-size: 24px;
}
section {
display: flex;
flex-direction: column;

View File

@@ -10,7 +10,10 @@ export const SENTENCE_TRAINER_PAGE_PARAMS: {
showDevTools: PageParam<boolean>;
textAreaDebounceInMillis: PageParam<number>;
} = {
sentence: { key: "sentence", default: "This text has been typed at the speed of thought" },
sentence: {
key: "sentence",
default: "This text has been typed at the speed of thought",
},
wpm: {
key: "wpm",
default: 250,