mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 01:12:59 +00:00
feat: enable stricter type checking options
feat: make the app more fault tolerant
This commit is contained in:
@@ -23,16 +23,6 @@
|
||||
powerDialog = false;
|
||||
}
|
||||
|
||||
async function updateFirmware() {
|
||||
const { usbVendorId: vendorId, usbProductId: productId } =
|
||||
$serialPort!.portInfo;
|
||||
$serialPort!.bootloader();
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
console.log(
|
||||
await navigator.usb.requestDevice({ filters: [{ vendorId, productId }] }),
|
||||
);
|
||||
}
|
||||
|
||||
let rebootInfo = false;
|
||||
let terminal = false;
|
||||
let powerDialog = false;
|
||||
|
||||
@@ -32,12 +32,13 @@
|
||||
}
|
||||
|
||||
function redo() {
|
||||
const [change, ...queue] = redoQueue;
|
||||
changes.update((it) => {
|
||||
it.push(change);
|
||||
return it;
|
||||
});
|
||||
redoQueue = queue;
|
||||
const change = redoQueue.shift();
|
||||
if (change) {
|
||||
changes.update((it) => {
|
||||
it.push(change);
|
||||
return it;
|
||||
});
|
||||
}
|
||||
}
|
||||
let redoQueue: Change[] = [];
|
||||
|
||||
@@ -57,7 +58,7 @@
|
||||
$LL.configure.chords.conflict.TITLE(),
|
||||
$LL.configure.chords.conflict.DESCRIPTION(
|
||||
actions
|
||||
.map((it) => `<kbd>${KEYMAP_CODES[it].id}</kbd>`)
|
||||
.map((it) => `<kbd>${KEYMAP_CODES.get(it)?.id}</kbd>`)
|
||||
.join(" "),
|
||||
),
|
||||
$LL.configure.chords.conflict.CONFIRM(),
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
{/if}
|
||||
<SyncOverlay />
|
||||
</div>
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
|
||||
<ul>
|
||||
<li class="hide-forced-colors">
|
||||
<input
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
index.add(
|
||||
i,
|
||||
chord.phrase
|
||||
.map((it) => KEYMAP_CODES[it]?.id)
|
||||
.map((it) => KEYMAP_CODES.get(it)?.id)
|
||||
.filter((it) => !!it)
|
||||
.join(""),
|
||||
);
|
||||
@@ -51,7 +51,9 @@
|
||||
function search(event: Event) {
|
||||
const query = (event.target as HTMLInputElement).value;
|
||||
searchFilter.set(
|
||||
query && searchIndex ? searchIndex.search(query) : undefined,
|
||||
query && searchIndex
|
||||
? (searchIndex.search(query) as number[])
|
||||
: undefined,
|
||||
);
|
||||
page = 0;
|
||||
}
|
||||
@@ -131,10 +133,12 @@
|
||||
>
|
||||
{/if}
|
||||
{#if $lastPage !== -1}
|
||||
{#each $items.slice(page * $pageSize - (page === 0 ? 0 : 1), (page + 1) * $pageSize - 1) as [chord] (JSON.stringify(chord.id))}
|
||||
<tr>
|
||||
<ChordEdit {chord} />
|
||||
</tr>
|
||||
{#each $items.slice(page * $pageSize - (page === 0 ? 0 : 1), (page + 1) * $pageSize - 1) as [chord] (JSON.stringify(chord?.id))}
|
||||
{#if chord}
|
||||
<tr>
|
||||
<ChordEdit {chord} />
|
||||
</tr>
|
||||
{/if}
|
||||
{/each}
|
||||
{:else}
|
||||
<caption>{$LL.configure.chords.search.NO_RESULTS()}</caption>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
});
|
||||
return changes;
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function addSpecial(event: MouseEvent) {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
onHidden(instance) {
|
||||
instance.destroy();
|
||||
},
|
||||
onDestroy(instance) {
|
||||
onDestroy(_instance) {
|
||||
shareComponent.$destroy();
|
||||
},
|
||||
}).show();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
/*******************************
|
||||
* HOLD UP AND READ THIS FIRST *
|
||||
*******************************
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script>
|
||||
// @ts-nocheck
|
||||
let ongoingRequest;
|
||||
let resolveRequest;
|
||||
let source;
|
||||
|
||||
@@ -48,18 +48,18 @@
|
||||
if (next.length === 0) {
|
||||
next = Array.from(
|
||||
{ length: 5 },
|
||||
() => $chords[Math.floor(Math.random() * $chords.length)],
|
||||
() => $chords[Math.floor(Math.random() * $chords.length)]!,
|
||||
);
|
||||
} else {
|
||||
next.shift();
|
||||
next.push($chords[Math.floor(Math.random() * $chords.length)]);
|
||||
next.push($chords[Math.floor(Math.random() * $chords.length)]!);
|
||||
next = next;
|
||||
}
|
||||
}
|
||||
if (
|
||||
userInput ===
|
||||
next[0].phrase
|
||||
.map((it) => (it === 32 ? " " : KEYMAP_CODES[it]!.id))
|
||||
next[0]!.phrase
|
||||
.map((it) => (it === 32 ? " " : KEYMAP_CODES.get(it)!.id))
|
||||
.join("") +
|
||||
" "
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user