@quillmark/svelte 0.40.0 → 0.41.0
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.
|
@@ -47,11 +47,9 @@ export declare const TABLE_KEYS: {
|
|
|
47
47
|
readonly eraseAlt: "Delete";
|
|
48
48
|
};
|
|
49
49
|
/** The review's keys, the editor's wherever the focus is while a review is open. No leaf binds
|
|
50
|
-
* one of them, `accept` included, so each answers alike in every field
|
|
51
|
-
* under the modifiers `dismiss` and the steps share. */
|
|
50
|
+
* one of them, `accept` included, so each answers alike in every field. */
|
|
52
51
|
export declare const REVIEW_KEYS: {
|
|
53
52
|
readonly accept: "Mod-Enter";
|
|
54
|
-
readonly acceptAlt: "Mod-Alt-Enter";
|
|
55
53
|
readonly dismiss: "Mod-Alt-Backspace";
|
|
56
54
|
readonly next: "Mod-Alt-ArrowDown";
|
|
57
55
|
readonly previous: "Mod-Alt-ArrowUp";
|
|
@@ -53,11 +53,9 @@ export const TABLE_KEYS = {
|
|
|
53
53
|
eraseAlt: 'Delete'
|
|
54
54
|
};
|
|
55
55
|
/** The review's keys, the editor's wherever the focus is while a review is open. No leaf binds
|
|
56
|
-
* one of them, `accept` included, so each answers alike in every field
|
|
57
|
-
* under the modifiers `dismiss` and the steps share. */
|
|
56
|
+
* one of them, `accept` included, so each answers alike in every field. */
|
|
58
57
|
export const REVIEW_KEYS = {
|
|
59
58
|
accept: 'Mod-Enter',
|
|
60
|
-
acceptAlt: 'Mod-Alt-Enter',
|
|
61
59
|
dismiss: 'Mod-Alt-Backspace',
|
|
62
60
|
next: 'Mod-Alt-ArrowDown',
|
|
63
61
|
previous: 'Mod-Alt-ArrowUp'
|
|
@@ -151,11 +149,7 @@ const SHORTCUTS = [
|
|
|
151
149
|
},
|
|
152
150
|
{ scope: 'table', label: 'shortcutAlignColumn', keys: [T.alignLeft, T.alignRight] },
|
|
153
151
|
{ scope: 'table', label: 'shortcutDeleteCells', keys: [T.erase, T.eraseAlt] },
|
|
154
|
-
{
|
|
155
|
-
scope: 'review',
|
|
156
|
-
label: 'shortcutReviewAccept',
|
|
157
|
-
keys: [REVIEW_KEYS.accept, REVIEW_KEYS.acceptAlt]
|
|
158
|
-
},
|
|
152
|
+
{ scope: 'review', label: 'shortcutReviewAccept', keys: [REVIEW_KEYS.accept] },
|
|
159
153
|
{ scope: 'review', label: 'shortcutReviewDismiss', keys: [REVIEW_KEYS.dismiss] },
|
|
160
154
|
{ scope: 'review', label: 'shortcutReviewNext', keys: [REVIEW_KEYS.next] },
|
|
161
155
|
{ scope: 'review', label: 'shortcutReviewPrevious', keys: [REVIEW_KEYS.previous] }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
The answer card: one floating surface on the current change of a review, and the one place a
|
|
3
|
-
change is answered by pointer. A quiet Dismiss and a primary Accept
|
|
3
|
+
change is answered by pointer. A quiet Dismiss and a primary Accept with its key, a note
|
|
4
4
|
where the reader's own writing meets the change, and above them the line the proposal's writer
|
|
5
5
|
gave for it, cut to one line. The change itself is drawn where it
|
|
6
6
|
stands, so the card is the same two answers on every change. It carries no position: the count
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
anywhere, a resize of the editor.
|
|
31
31
|
|
|
32
32
|
It never takes the focus. A press on it keeps the focus where it is, and the keyboard reaches
|
|
33
|
-
it only by `enter`. There
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
it only by `enter`. There Enter presses a button as on any, and no other key answers or
|
|
34
|
+
steps but the review's own. The focus rides the card from change to change, and Escape or the
|
|
35
|
+
last answer hands it back.
|
|
36
36
|
-->
|
|
37
37
|
<script lang="ts">
|
|
38
38
|
import { tick } from 'svelte';
|
|
@@ -56,10 +56,8 @@
|
|
|
56
56
|
/** The answer key whose press only brought the card, whose hint says to press it again. */
|
|
57
57
|
asked?: 'accept' | 'dismiss';
|
|
58
58
|
onAnswer(action: 'accept' | 'dismiss'): void;
|
|
59
|
-
/** Go to the next change, or the previous. */
|
|
60
|
-
onStep(dir: 1 | -1): void;
|
|
61
59
|
}
|
|
62
|
-
let { id, root, inset, hidden, outdated, note, asked, onAnswer
|
|
60
|
+
let { id, root, inset, hidden, outdated, note, asked, onAnswer }: Props = $props();
|
|
63
61
|
const noteId = $props.id();
|
|
64
62
|
|
|
65
63
|
const t = wording();
|
|
@@ -293,16 +291,6 @@
|
|
|
293
291
|
leave();
|
|
294
292
|
return;
|
|
295
293
|
}
|
|
296
|
-
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
297
|
-
e.preventDefault();
|
|
298
|
-
if (!e.repeat) answer('dismiss');
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
302
|
-
e.preventDefault();
|
|
303
|
-
onStep(e.key === 'ArrowUp' ? -1 : 1);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
294
|
// A held Enter clicks its button on every repeat, and a held key answers once.
|
|
307
295
|
if (e.key === 'Enter' && e.repeat) {
|
|
308
296
|
e.preventDefault();
|
|
@@ -351,13 +339,14 @@
|
|
|
351
339
|
{#if outdated}<span class="qm-review-card-note">{t.strings.reviewOutdated}</span>{/if}
|
|
352
340
|
<button
|
|
353
341
|
type="button"
|
|
354
|
-
class=
|
|
342
|
+
class={[
|
|
343
|
+
'qm-review-card-dismiss qm-focus-ring',
|
|
344
|
+
{ 'qm-review-card-asked': asked === 'dismiss' }
|
|
345
|
+
]}
|
|
355
346
|
tabindex="-1"
|
|
347
|
+
title={keycap(REVIEW_KEYS.dismiss)}
|
|
356
348
|
aria-keyshortcuts={keyshortcut(REVIEW_KEYS.dismiss)}
|
|
357
|
-
onclick={() => answer('dismiss')}
|
|
358
|
-
>{t.strings.reviewDismiss}<kbd class={{ 'qm-review-card-asked': asked === 'dismiss' }}
|
|
359
|
-
>{keycap(REVIEW_KEYS.dismiss)}</kbd
|
|
360
|
-
></button
|
|
349
|
+
onclick={() => answer('dismiss')}>{t.strings.reviewDismiss}</button
|
|
361
350
|
>
|
|
362
351
|
<button
|
|
363
352
|
type="button"
|
|
@@ -440,7 +429,8 @@
|
|
|
440
429
|
font: inherit;
|
|
441
430
|
border-radius: var(--_qm-radius-inner);
|
|
442
431
|
}
|
|
443
|
-
/* The press that brought the card asks for another:
|
|
432
|
+
/* The press that brought the card asks for another: Accept's key hint rings once, and
|
|
433
|
+
Dismiss itself, which shows no key. */
|
|
444
434
|
.qm-review-card-asked {
|
|
445
435
|
outline: var(--_qm-border-width) solid currentColor;
|
|
446
436
|
outline-offset: 2px;
|
|
@@ -14,8 +14,6 @@ interface Props {
|
|
|
14
14
|
/** The answer key whose press only brought the card, whose hint says to press it again. */
|
|
15
15
|
asked?: 'accept' | 'dismiss';
|
|
16
16
|
onAnswer(action: 'accept' | 'dismiss'): void;
|
|
17
|
-
/** Go to the next change, or the previous. */
|
|
18
|
-
onStep(dir: 1 | -1): void;
|
|
19
17
|
}
|
|
20
18
|
declare const ReviewCard: import("svelte").Component<Props, {
|
|
21
19
|
standsInView: () => boolean;
|
|
@@ -717,7 +717,6 @@
|
|
|
717
717
|
let answerCard = $state<ReviewCard | undefined>();
|
|
718
718
|
const reviewKeys = keydownHandler({
|
|
719
719
|
[REVIEW_KEYS.accept]: () => answerKey('accept'),
|
|
720
|
-
[REVIEW_KEYS.acceptAlt]: () => answerKey('accept'),
|
|
721
720
|
[REVIEW_KEYS.dismiss]: () => answerKey('dismiss'),
|
|
722
721
|
[REVIEW_KEYS.next]: () => {
|
|
723
722
|
void step(1, inside);
|
|
@@ -739,10 +738,10 @@
|
|
|
739
738
|
let named: ReviewKeyName | undefined;
|
|
740
739
|
const reviewKeyName = keydownHandler(
|
|
741
740
|
Object.fromEntries(
|
|
742
|
-
(['accept', '
|
|
741
|
+
(['accept', 'dismiss', 'next', 'previous'] as const).map((key) => [
|
|
743
742
|
REVIEW_KEYS[key],
|
|
744
743
|
() => {
|
|
745
|
-
named = key
|
|
744
|
+
named = key;
|
|
746
745
|
return true;
|
|
747
746
|
}
|
|
748
747
|
])
|
|
@@ -2280,7 +2279,6 @@
|
|
|
2280
2279
|
? undefined
|
|
2281
2280
|
: reviewing.items.find((i) => i.id === reviewing.lit)?.note}
|
|
2282
2281
|
onAnswer={answerCurrent}
|
|
2283
|
-
onStep={(dir) => void step(dir, false)}
|
|
2284
2282
|
/>
|
|
2285
2283
|
<div class="qm-visually-hidden" role="status">{reviewPlace}</div>
|
|
2286
2284
|
<!-- Beside the review's region rather than in it or in the toast's: a status is read whole,
|