@quillmark/svelte 0.36.0 → 0.37.1
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.
- package/README.md +18 -14
- package/THEMING.md +1 -1
- package/dist/core/codec/decode.d.ts +4 -2
- package/dist/core/codec/decode.js +5 -2
- package/dist/core/codec/field.d.ts +14 -10
- package/dist/core/codec/field.js +34 -24
- package/dist/core/codec/index.d.ts +3 -3
- package/dist/core/codec/index.js +2 -2
- package/dist/core/codec/prose.css +20 -4
- package/dist/core/codec/review.d.ts +4 -5
- package/dist/core/codec/review.js +6 -21
- package/dist/core/codec/schema.d.ts +12 -2
- package/dist/core/codec/schema.js +27 -5
- package/dist/core/codec/shortcuts.d.ts +3 -2
- package/dist/core/codec/shortcuts.js +3 -2
- package/dist/core/codec/table-view.js +15 -3
- package/dist/core/theme.css +44 -17
- package/dist/core/tooltip.css +49 -0
- package/dist/core/tooltip.d.ts +6 -0
- package/dist/core/tooltip.js +176 -0
- package/dist/preview/Preview.svelte +22 -1
- package/dist/preview/controller.js +38 -0
- package/dist/preview/strings.d.ts +2 -0
- package/dist/preview/strings.js +1 -0
- package/dist/visual/ArrayField.svelte +262 -145
- package/dist/visual/Card.svelte +21 -11
- package/dist/visual/CardControls.svelte +3 -3
- package/dist/visual/DateField.svelte +47 -5
- package/dist/visual/DiagnosticList.svelte +3 -2
- package/dist/visual/EnumField.svelte +6 -1
- package/dist/visual/EnumField.svelte.d.ts +2 -0
- package/dist/visual/Field.svelte +3 -3
- package/dist/visual/FieldHint.svelte +22 -13
- package/dist/visual/FieldLabel.svelte +6 -42
- package/dist/visual/FieldLabel.svelte.d.ts +0 -3
- package/dist/visual/FormatPopover.svelte +53 -20
- package/dist/visual/MatrixAdd.svelte +9 -10
- package/dist/visual/MatrixField.svelte +114 -18
- package/dist/visual/NumberField.svelte +21 -5
- package/dist/visual/ObjectField.svelte +6 -2
- package/dist/visual/ProseField.svelte +6 -3
- package/dist/visual/ProseField.svelte.d.ts +2 -1
- package/dist/visual/ProseValue.svelte +13 -6
- package/dist/visual/ProseValue.svelte.d.ts +4 -1
- package/dist/visual/ReviewCard.svelte +93 -33
- package/dist/visual/ReviewCard.svelte.d.ts +2 -1
- package/dist/visual/ReviewProposal.svelte +0 -6
- package/dist/visual/TipsCard.svelte +1 -1
- package/dist/visual/VariantField.svelte +1 -0
- package/dist/visual/VisualEditor.svelte +12 -6
- package/dist/visual/VisualEditor.svelte.d.ts +5 -1
- package/dist/visual/VisualEditorInner.svelte +218 -302
- package/dist/visual/VisualEditorInner.svelte.d.ts +5 -1
- package/dist/visual/controls.css +2 -2
- package/dist/visual/guidance.d.ts +0 -2
- package/dist/visual/guidance.js +0 -10
- package/dist/visual/index.d.ts +2 -2
- package/dist/visual/proposals.d.ts +14 -4
- package/dist/visual/proposals.js +28 -5
- package/dist/visual/props.d.ts +1 -1
- package/dist/visual/review-order.d.ts +51 -0
- package/dist/visual/review-order.js +87 -0
- package/dist/visual/review.d.ts +27 -1
- package/dist/visual/review.js +1 -1
- package/dist/visual/review.svelte.d.ts +34 -17
- package/dist/visual/review.svelte.js +187 -44
- package/dist/visual/strings.d.ts +38 -19
- package/dist/visual/strings.js +81 -24
- package/dist/visual/structure.d.ts +17 -3
- package/dist/visual/structure.js +71 -5
- package/package.json +2 -2
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
import { bloom } from '../core/bloom.js';
|
|
45
45
|
import { createLifespan } from '../core/teardown.js';
|
|
46
46
|
import { spacePx } from '../core/rungs.js';
|
|
47
|
+
import { tooltips } from '../core/tooltip.js';
|
|
47
48
|
import type {
|
|
48
49
|
Addr,
|
|
49
50
|
CardAddr,
|
|
@@ -57,8 +58,8 @@
|
|
|
57
58
|
} from '@quillmark/wasm';
|
|
58
59
|
import type { VisualEditorProps } from './props.js';
|
|
59
60
|
import type { Delta } from '../core/codec/positions.js';
|
|
60
|
-
import { mergeStrings, setWording } from './strings.js';
|
|
61
|
-
import { createStructuralUndo, setStructuralUndo
|
|
61
|
+
import { diagnosticText, mergeStrings, setWording } from './strings.js';
|
|
62
|
+
import { createStructuralUndo, setStructuralUndo } from './undo.svelte.js';
|
|
62
63
|
import { undoChord } from './listhistory.js';
|
|
63
64
|
import { removedCards, type RemovedCard } from './removed.js';
|
|
64
65
|
import { createReview, setReview, type CardAdd } from './review.svelte.js';
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
type ReviewProjection
|
|
79
80
|
} from './review.js';
|
|
80
81
|
import ReviewCard from './ReviewCard.svelte';
|
|
82
|
+
import { cardLayout, nextOpen, stepIn } from './review-order.js';
|
|
81
83
|
import type { CardId, CardOp, ChangeSource } from './signals.js';
|
|
82
84
|
import {
|
|
83
85
|
REVIEW_KEYS,
|
|
@@ -97,6 +99,7 @@
|
|
|
97
99
|
fieldValues,
|
|
98
100
|
fieldTitle,
|
|
99
101
|
humanize,
|
|
102
|
+
placeCardInto,
|
|
100
103
|
bodyEnabled,
|
|
101
104
|
provenanceMap,
|
|
102
105
|
resolvedByCardIndex,
|
|
@@ -231,7 +234,7 @@
|
|
|
231
234
|
function report(source: ChangeSource, cardId?: CardId, at?: Addr | number, op?: CardOp): void {
|
|
232
235
|
const path =
|
|
233
236
|
at == null ? undefined : typeof at === 'number' ? cardPath(at, liveKinds()) : pathFor(at);
|
|
234
|
-
settled();
|
|
237
|
+
reviewing.settled();
|
|
235
238
|
onChange?.({ source, cardId, path, ...(op ? { op } : {}) });
|
|
236
239
|
}
|
|
237
240
|
function rederive(): void {
|
|
@@ -355,13 +358,26 @@
|
|
|
355
358
|
reviewing.heard(id, 'reopen', leaf);
|
|
356
359
|
void reveal(id, false, true);
|
|
357
360
|
};
|
|
358
|
-
/** The
|
|
361
|
+
/** The session key of the card holding `$id` `id`. */
|
|
362
|
+
function cardKeyFor(id: string): string | undefined {
|
|
363
|
+
return cardIds.find((_, k) => doc.card(k).id === id);
|
|
364
|
+
}
|
|
365
|
+
/** The host's list with each card a path names moved to where that card stands now: the card
|
|
366
|
+
* holding the item's `card`, else the one at the path's index when the list was set. */
|
|
359
367
|
const reviewItems = $derived.by(() => {
|
|
360
368
|
const was = cardsListed();
|
|
361
|
-
|
|
369
|
+
const now = cardIds;
|
|
370
|
+
if (!review?.length) return review;
|
|
371
|
+
if (was === now && !review.some((item) => 'card' in item && item.card !== undefined))
|
|
372
|
+
return review;
|
|
362
373
|
return review.map((item) => {
|
|
363
374
|
if (byCard(item)) return item;
|
|
364
|
-
|
|
375
|
+
let field: DocPath;
|
|
376
|
+
if (item.card === undefined) field = cardMoved(item.field, was, now);
|
|
377
|
+
else {
|
|
378
|
+
const key = cardKeyFor(item.card);
|
|
379
|
+
field = pathOnCard(item.field, key === undefined ? now.length : now.indexOf(key));
|
|
380
|
+
}
|
|
365
381
|
return field === item.field ? item : { ...item, field };
|
|
366
382
|
});
|
|
367
383
|
});
|
|
@@ -388,16 +404,13 @@
|
|
|
388
404
|
return card?.values[key.field];
|
|
389
405
|
},
|
|
390
406
|
leafFor: proseKeyFor,
|
|
407
|
+
layout: () => [cardLayout(model.main), ...model.cards.map(cardLayout)],
|
|
391
408
|
listedCards: () => cardsListed(),
|
|
392
409
|
liveCards: () => cardIds,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
},
|
|
398
|
-
writing(on) {
|
|
399
|
-
writing += on ? 1 : -1;
|
|
400
|
-
},
|
|
410
|
+
cardFor: cardKeyFor,
|
|
411
|
+
undo,
|
|
412
|
+
answered: (id, order) => advanceFrom(id, order ?? drewOrder),
|
|
413
|
+
answerProse: (key, id, action) => !!leaves.prose(key)?.answerReview(id, action),
|
|
401
414
|
answer(id, item, action, key, write) {
|
|
402
415
|
let back: (() => void) | undefined;
|
|
403
416
|
if (write && item && onField(item)) {
|
|
@@ -409,73 +422,19 @@
|
|
|
409
422
|
}
|
|
410
423
|
onReview?.({ id, action });
|
|
411
424
|
if (action !== 'accept' && action !== 'dismiss') return true;
|
|
412
|
-
if (item && byCard(item))
|
|
413
|
-
record(id, () => giveBack(id, '', back));
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
425
|
+
if (item && byCard(item)) return () => giveBack(id, '', back);
|
|
416
426
|
const field = item && onField(item) ? reviewed(item.field) : undefined;
|
|
417
427
|
const leaf = key ?? (field && fieldKeyToString(field));
|
|
418
428
|
if (leaf === undefined) return true;
|
|
419
429
|
const prose = key !== undefined && !field;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
: () => void leaves.prose(leaf)?.reopenReview(id)
|
|
426
|
-
: () => giveBack(id, leaf, back)
|
|
427
|
-
);
|
|
428
|
-
return true;
|
|
430
|
+
return prose
|
|
431
|
+
? action === 'accept'
|
|
432
|
+
? () => void leaves.prose(leaf)?.undoReview()
|
|
433
|
+
: () => void leaves.prose(leaf)?.reopenReview(id)
|
|
434
|
+
: () => giveBack(id, leaf, back);
|
|
429
435
|
}
|
|
430
436
|
});
|
|
431
437
|
|
|
432
|
-
// ── The answer journal: the review answers since the reader's last edit, each undone by
|
|
433
|
-
// ⌘Z from anywhere in the editor, newest first, its item reopened with it. An edit that is
|
|
434
|
-
// not an answer empties it: an inverse is good against the document it was recorded over. An answer's own writes, and an inverse's, go down the
|
|
435
|
-
// lanes an edit does, so they are flagged while they are made.
|
|
436
|
-
interface Answered {
|
|
437
|
-
ids: string[];
|
|
438
|
-
inverses: (() => void)[];
|
|
439
|
-
}
|
|
440
|
-
let journal: Answered[] = [];
|
|
441
|
-
/** The entry a batch of answers records into. */
|
|
442
|
-
let batching: Answered | undefined;
|
|
443
|
-
let journalOffer: UndoOffer | undefined;
|
|
444
|
-
let writing = 0;
|
|
445
|
-
function settled(): void {
|
|
446
|
-
if (writing) return;
|
|
447
|
-
journal = [];
|
|
448
|
-
journalOffer = undefined;
|
|
449
|
-
undo.settle();
|
|
450
|
-
}
|
|
451
|
-
function offerJournal(): void {
|
|
452
|
-
const top = journal.at(-1);
|
|
453
|
-
journalOffer = top && undo.offer('', unanswer, { standing: true, quiet: true, answer: true });
|
|
454
|
-
}
|
|
455
|
-
function unanswer(): void {
|
|
456
|
-
const top = journal.pop();
|
|
457
|
-
if (!top) return;
|
|
458
|
-
writing++;
|
|
459
|
-
try {
|
|
460
|
-
for (const inverse of [...top.inverses].reverse()) inverse();
|
|
461
|
-
} finally {
|
|
462
|
-
writing--;
|
|
463
|
-
}
|
|
464
|
-
offerJournal();
|
|
465
|
-
}
|
|
466
|
-
function record(id: string, inverse: () => void): void {
|
|
467
|
-
if (batching) {
|
|
468
|
-
batching.ids.push(id);
|
|
469
|
-
batching.inverses.push(inverse);
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
// Another step took the key since: the answers before it are no longer the last thing
|
|
473
|
-
// that happened.
|
|
474
|
-
if (!journalOffer || !undo.holds(journalOffer)) journal = [];
|
|
475
|
-
journal.push({ ids: [id], inverses: [inverse] });
|
|
476
|
-
offerJournal();
|
|
477
|
-
}
|
|
478
|
-
|
|
479
438
|
/**
|
|
480
439
|
* Take a field's proposal: its value down the lane the field's own control commits by, so
|
|
481
440
|
* the writer checks it and `onChange` reports it, or `edit`, the value a reader's own commit
|
|
@@ -499,7 +458,7 @@
|
|
|
499
458
|
leaves.prose(leaf)?.applyExternal();
|
|
500
459
|
return true;
|
|
501
460
|
};
|
|
502
|
-
writing
|
|
461
|
+
reviewing.writing(true);
|
|
503
462
|
try {
|
|
504
463
|
const before = doc.getStored(addr);
|
|
505
464
|
const to = (place: unknown): unknown => (edit ? edit.value : reviewing.writes(item, place));
|
|
@@ -513,7 +472,7 @@
|
|
|
513
472
|
if (!write(after)) return undefined;
|
|
514
473
|
return () => void write(before);
|
|
515
474
|
} finally {
|
|
516
|
-
writing
|
|
475
|
+
reviewing.writing(false);
|
|
517
476
|
}
|
|
518
477
|
|
|
519
478
|
/** The field's value as its control is handed it, read anew. */
|
|
@@ -532,9 +491,9 @@
|
|
|
532
491
|
*/
|
|
533
492
|
function takeCard(item: CardProposal): (() => void) | undefined {
|
|
534
493
|
if ('remove' in item) {
|
|
535
|
-
const key = cardsListed()[item.remove];
|
|
494
|
+
const key = item.card === undefined ? cardsListed()[item.remove] : cardKeyFor(item.card);
|
|
536
495
|
const at = key === undefined ? -1 : cardIndexOf(key);
|
|
537
|
-
if (at < 0) return undefined;
|
|
496
|
+
if (key === undefined || at < 0) return undefined;
|
|
538
497
|
const card = doc.card(at);
|
|
539
498
|
doc.removeCard(at);
|
|
540
499
|
undo.withdraw();
|
|
@@ -576,15 +535,8 @@
|
|
|
576
535
|
}
|
|
577
536
|
/** Write `card` into the document at `at`, with its `$id` where no card holds that one. */
|
|
578
537
|
function placeCard(card: CardAdd['add'], at: number): boolean {
|
|
579
|
-
const { id, ...bare } = card;
|
|
580
|
-
const free = id !== undefined && !cardIds.some((_, k) => doc.card(k).id === id);
|
|
581
538
|
try {
|
|
582
|
-
|
|
583
|
-
doc.unchecked.insertCard(free ? card : bare, at);
|
|
584
|
-
} catch (e) {
|
|
585
|
-
if (!free) throw e;
|
|
586
|
-
doc.unchecked.insertCard(bare, at);
|
|
587
|
-
}
|
|
539
|
+
placeCardInto(doc, card, at);
|
|
588
540
|
return true;
|
|
589
541
|
} catch (e) {
|
|
590
542
|
reportError(onError, {
|
|
@@ -622,7 +574,6 @@
|
|
|
622
574
|
return { title, fields, text: add.body?.text?.trim() ?? '' };
|
|
623
575
|
}
|
|
624
576
|
setReview(reviewing);
|
|
625
|
-
span.onEnd(reviewing.dispose);
|
|
626
577
|
// The current change, to a host counting its place: each change, and not the nothing a
|
|
627
578
|
// mount starts from.
|
|
628
579
|
let reported: string | undefined;
|
|
@@ -633,56 +584,6 @@
|
|
|
633
584
|
typing = false;
|
|
634
585
|
onReviewFocus?.(id);
|
|
635
586
|
});
|
|
636
|
-
/** The open items drawn, in document order: each id's first element under the root, then
|
|
637
|
-
* any drawn one not yet in the DOM, in list order. */
|
|
638
|
-
function reviewOrder(): string[] {
|
|
639
|
-
const fieldUndrawn = new Set(reviewing.fieldUndrawn.map((u) => u.id));
|
|
640
|
-
const drawn = new Set<string>();
|
|
641
|
-
for (const report of reviewing.reports.values()) for (const id of report.ids) drawn.add(id);
|
|
642
|
-
for (const item of reviewing.items)
|
|
643
|
-
if (onField(item) && !fieldUndrawn.has(item.id)) drawn.add(item.id);
|
|
644
|
-
for (const list of reviewing.cards.adds.values()) for (const item of list) drawn.add(item.id);
|
|
645
|
-
for (const item of reviewing.cards.removes.values()) drawn.add(item.id);
|
|
646
|
-
const order: string[] = [];
|
|
647
|
-
const seen = new Set<string>();
|
|
648
|
-
const take = (id: string | null): void => {
|
|
649
|
-
if (id === null || !drawn.has(id) || seen.has(id)) return;
|
|
650
|
-
seen.add(id);
|
|
651
|
-
order.push(id);
|
|
652
|
-
};
|
|
653
|
-
for (const el of rootEl?.querySelectorAll('[data-qm-review]') ?? [])
|
|
654
|
-
for (const id of reviewIds(el)) take(id);
|
|
655
|
-
for (const item of reviewing.items) take(item.id);
|
|
656
|
-
return order;
|
|
657
|
-
}
|
|
658
|
-
/** What the editor draws of the host's list, and why it draws what it does not. */
|
|
659
|
-
function reviewReport(): ReviewDrawn {
|
|
660
|
-
const reported = new Set<string>();
|
|
661
|
-
const outdated = new Set(reviewing.fieldOutdated);
|
|
662
|
-
const why = new Map<string, ReviewDrawn['undrawn'][number]['reason']>();
|
|
663
|
-
for (const report of reviewing.reports.values()) {
|
|
664
|
-
for (const id of report.ids) reported.add(id);
|
|
665
|
-
for (const id of report.outdated) outdated.add(id);
|
|
666
|
-
for (const { id, reason } of report.undrawn) {
|
|
667
|
-
reported.add(id);
|
|
668
|
-
why.set(id, reason);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
for (const { id, reason } of reviewing.fieldUndrawn) why.set(id, reason);
|
|
672
|
-
for (const item of reviewing.items)
|
|
673
|
-
if (!reported.has(item.id) && !why.has(item.id)) {
|
|
674
|
-
if (byBlocks(item)) why.set(item.id, 'block');
|
|
675
|
-
}
|
|
676
|
-
const open = reviewOrder();
|
|
677
|
-
return {
|
|
678
|
-
open,
|
|
679
|
-
outdated: open.filter((id) => outdated.has(id)),
|
|
680
|
-
undrawn: reviewing.items.flatMap((item) => {
|
|
681
|
-
const reason = why.get(item.id);
|
|
682
|
-
return reason ? [{ id: item.id, reason }] : [];
|
|
683
|
-
})
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
587
|
// The report, to a host counting its own list: each change, read once the leaves the change
|
|
687
588
|
// mounted have drawn, so a list just handed over is not reported as anchored nowhere. A
|
|
688
589
|
// review starts on its first change, and goes on to the first open one wherever the current
|
|
@@ -692,15 +593,11 @@
|
|
|
692
593
|
let drewOrder = $state.raw<readonly string[]>([]);
|
|
693
594
|
let drewOutdated = $state.raw<readonly string[]>([]);
|
|
694
595
|
$effect(() => {
|
|
695
|
-
void reviewing.
|
|
696
|
-
void reviewing.fieldUndrawn;
|
|
697
|
-
void reviewing.cards;
|
|
698
|
-
for (const id of reviewing.fieldOutdated) void id;
|
|
699
|
-
for (const report of reviewing.reports.values()) void report;
|
|
596
|
+
void reviewing.report;
|
|
700
597
|
let live = true;
|
|
701
598
|
void tick().then(() => {
|
|
702
599
|
if (!live || !span.alive) return;
|
|
703
|
-
const report =
|
|
600
|
+
const report = reviewing.report;
|
|
704
601
|
drewOrder = report.open;
|
|
705
602
|
drewOutdated = report.outdated;
|
|
706
603
|
if (reviewing.lit === undefined && report.open.length) reviewing.reveal(report.open[0]);
|
|
@@ -713,19 +610,13 @@
|
|
|
713
610
|
live = false;
|
|
714
611
|
};
|
|
715
612
|
});
|
|
716
|
-
/** The current change answered by a host's batch, to move on from once the batch is done. */
|
|
717
|
-
let advancing: string | undefined;
|
|
718
613
|
/**
|
|
719
614
|
* Make the next open change current after `id`'s answer, in `order` as it stood before the
|
|
720
615
|
* answer, round from the end. The pane scrolls only where that change is out of comfortable
|
|
721
616
|
* view, and neither the focus nor the caret moves.
|
|
722
617
|
*/
|
|
723
618
|
function advanceFrom(id: string, order: readonly string[]): void {
|
|
724
|
-
const
|
|
725
|
-
const at = order.indexOf(id);
|
|
726
|
-
const next = [...order.slice(at + 1), ...order.slice(0, Math.max(at, 0))].find((n) =>
|
|
727
|
-
open.has(n)
|
|
728
|
-
);
|
|
619
|
+
const next = nextOpen(order, id, new Set(reviewing.items.map((item) => item.id)));
|
|
729
620
|
if (next === undefined) return;
|
|
730
621
|
typing = false;
|
|
731
622
|
reviewing.reveal(next);
|
|
@@ -734,22 +625,17 @@
|
|
|
734
625
|
/** The item a step last went to, and where it stood in the order then, so a step from an
|
|
735
626
|
* item since answered goes on from its place. */
|
|
736
627
|
let stepped: { id: string; index: number } | undefined;
|
|
737
|
-
async function step(dir: 1 | -1, focus: boolean): Promise<string | undefined> {
|
|
628
|
+
async function step(dir: 1 | -1, focus: boolean, group?: string): Promise<string | undefined> {
|
|
738
629
|
if (!span.alive) return undefined;
|
|
739
|
-
const order =
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
: stepped.index - 1
|
|
749
|
-
: dir > 0
|
|
750
|
-
? 0
|
|
751
|
-
: -1;
|
|
752
|
-
const index = ((next % order.length) + order.length) % order.length;
|
|
630
|
+
const order = reviewing.order;
|
|
631
|
+
const index = stepIn(
|
|
632
|
+
order,
|
|
633
|
+
dir,
|
|
634
|
+
reviewing.lit ?? stepped?.id,
|
|
635
|
+
stepped?.index,
|
|
636
|
+
group === undefined ? undefined : inGroup(group)
|
|
637
|
+
);
|
|
638
|
+
if (index === undefined) return undefined;
|
|
753
639
|
const id = order[index];
|
|
754
640
|
stepped = { id, index };
|
|
755
641
|
typing = false;
|
|
@@ -763,6 +649,17 @@
|
|
|
763
649
|
const id = reviewing.lit;
|
|
764
650
|
return id !== undefined && answerReview([id], action).length > 0;
|
|
765
651
|
}
|
|
652
|
+
/** An answer key: the card's, so it answers only a change the card stands on in view. A
|
|
653
|
+
* press while the reader types in the editor is the leaf's own key, and any other press
|
|
654
|
+
* with the change out of view or the card out of the way brings both back. */
|
|
655
|
+
function answerByKey(action: 'accept' | 'dismiss'): boolean {
|
|
656
|
+
const id = reviewing.lit;
|
|
657
|
+
if (id === undefined || (typing && inside)) return false;
|
|
658
|
+
if (!typing && inView(id)) return answerCurrent(action);
|
|
659
|
+
typing = false;
|
|
660
|
+
void reveal(id, false, true);
|
|
661
|
+
return true;
|
|
662
|
+
}
|
|
766
663
|
/** Whether a key at `target` is the review's: anywhere but a text control outside the editor,
|
|
767
664
|
* which keeps its own keys, or another editor. */
|
|
768
665
|
function reviewHears(target: EventTarget | null): boolean {
|
|
@@ -773,8 +670,8 @@
|
|
|
773
670
|
}
|
|
774
671
|
let answerCard = $state<ReviewCard | undefined>();
|
|
775
672
|
const reviewKeys = keydownHandler({
|
|
776
|
-
[REVIEW_KEYS.accept]: () =>
|
|
777
|
-
[REVIEW_KEYS.dismiss]: () =>
|
|
673
|
+
[REVIEW_KEYS.accept]: () => answerByKey('accept'),
|
|
674
|
+
[REVIEW_KEYS.dismiss]: () => answerByKey('dismiss'),
|
|
778
675
|
[REVIEW_KEYS.next]: () => {
|
|
779
676
|
void step(1, inside);
|
|
780
677
|
return true;
|
|
@@ -955,7 +852,7 @@
|
|
|
955
852
|
const cardId = cardIdOf(plain);
|
|
956
853
|
if (cardId == null) return;
|
|
957
854
|
refreshTitle(plain, cardId);
|
|
958
|
-
settled();
|
|
855
|
+
reviewing.settled();
|
|
959
856
|
onChange?.({ source: 'prose', cardId, path: pathFor(plain) });
|
|
960
857
|
}
|
|
961
858
|
|
|
@@ -1209,10 +1106,7 @@
|
|
|
1209
1106
|
const { card } = gone;
|
|
1210
1107
|
const i = removed.place(gone, cardIds);
|
|
1211
1108
|
try {
|
|
1212
|
-
|
|
1213
|
-
const back = { ...card };
|
|
1214
|
-
if (taken) delete back.id;
|
|
1215
|
-
doc.unchecked.insertCard(back, i);
|
|
1109
|
+
placeCardInto(doc, card, i);
|
|
1216
1110
|
} catch (e) {
|
|
1217
1111
|
reportError(onError, {
|
|
1218
1112
|
code: 'card-op-failed',
|
|
@@ -1458,6 +1352,38 @@
|
|
|
1458
1352
|
cards: tree.cards.map((c) => patched[c.id] ?? c)
|
|
1459
1353
|
});
|
|
1460
1354
|
|
|
1355
|
+
// ── What a screen reader hears of the diagnostics (INVARIANTS §Diagnostics) ──
|
|
1356
|
+
/** How long the drawn errors hold before they are spoken, so an edit's validation and
|
|
1357
|
+
* the diagnostics a host raises for it are one announcement, and a set that returns
|
|
1358
|
+
* to what was last said meanwhile says nothing. */
|
|
1359
|
+
const SPOKEN_MS = 500;
|
|
1360
|
+
/** Every error a leaf of the page draws, in the page's order, under its field's label. */
|
|
1361
|
+
const issues = $derived(
|
|
1362
|
+
[model.main, ...model.cards].flatMap((card) =>
|
|
1363
|
+
cardLayout(card).leaves.flatMap(({ key, name, schema }) => {
|
|
1364
|
+
const field = name !== undefined && schema ? fieldTitle(name, schema) : merged.bodyLabel;
|
|
1365
|
+
return (diagByKey.get(key) ?? []).map((d) => ({
|
|
1366
|
+
field,
|
|
1367
|
+
message: diagnosticText(d, formatDiagnostic, merged)
|
|
1368
|
+
}));
|
|
1369
|
+
})
|
|
1370
|
+
)
|
|
1371
|
+
);
|
|
1372
|
+
const issuesKey = $derived(JSON.stringify(issues));
|
|
1373
|
+
// What a mount starts from is not a change, so the first set is held as said.
|
|
1374
|
+
let spokenKey: string | undefined;
|
|
1375
|
+
let spoken = $state('');
|
|
1376
|
+
$effect(() => {
|
|
1377
|
+
const key = issuesKey;
|
|
1378
|
+
spokenKey ??= key;
|
|
1379
|
+
if (key === spokenKey) return;
|
|
1380
|
+
const timer = setTimeout(() => {
|
|
1381
|
+
spokenKey = issuesKey;
|
|
1382
|
+
spoken = merged.diagAnnounced(issues);
|
|
1383
|
+
}, SPOKEN_MS);
|
|
1384
|
+
return () => clearTimeout(timer);
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1461
1387
|
// ── Public entry points ─────────────────────────────────────────────────────
|
|
1462
1388
|
/**
|
|
1463
1389
|
* Resolve a preview {@link Landing} to a mounted leaf and land in it.
|
|
@@ -1574,6 +1500,16 @@
|
|
|
1574
1500
|
const box = await land(found, undefined);
|
|
1575
1501
|
if (span.alive) bloom(box);
|
|
1576
1502
|
}
|
|
1503
|
+
/** Reveal the field at `field`, scroll it into the fold and wash it, taking no focus:
|
|
1504
|
+
* the landing a host makes on a touch screen, where a focus raises the keyboard. A
|
|
1505
|
+
* nested address reveals and washes its field, a row being something only a focus
|
|
1506
|
+
* opens. */
|
|
1507
|
+
export async function revealField(field: DocPath): Promise<void> {
|
|
1508
|
+
const found = await revealLeaf(field);
|
|
1509
|
+
if (!found) return missed(`no mounted field at ${field}`, field);
|
|
1510
|
+
found.control.el.scrollIntoView({ block: 'nearest', behavior: 'instant' });
|
|
1511
|
+
bloom(found.control.el);
|
|
1512
|
+
}
|
|
1577
1513
|
/** Play the arrival wash over the field at `field` and touch nothing else: no focus,
|
|
1578
1514
|
* no reveal, no scroll. A field in a closed panel is skipped, its box clipped to
|
|
1579
1515
|
* nothing; a nested address washes its field's box, a row being something only a
|
|
@@ -1644,7 +1580,8 @@
|
|
|
1644
1580
|
* Bring the review item `id` to the reader as the current change: open the panel holding
|
|
1645
1581
|
* it and scroll it to the middle of the view. The focus stays where it is, the reader having
|
|
1646
1582
|
* asked to look, unless `focus` asks for it: the caret then goes into the item, or the focus
|
|
1647
|
-
* to
|
|
1583
|
+
* to the control drawing it, a property inside a field included. False for an item the
|
|
1584
|
+
* editor does not draw.
|
|
1648
1585
|
*/
|
|
1649
1586
|
export function revealReview(id: string, opts: { focus?: boolean } = {}): Promise<boolean> {
|
|
1650
1587
|
return reveal(id, opts.focus ?? false, false);
|
|
@@ -1663,13 +1600,15 @@
|
|
|
1663
1600
|
}
|
|
1664
1601
|
if (!(await span.resumes(tick()))) return false;
|
|
1665
1602
|
reviewing.reveal(id);
|
|
1666
|
-
if (focus && key !== undefined && !leaves.prose(key)?.enterReview(id))
|
|
1667
|
-
leaves.control(key)
|
|
1603
|
+
if (focus && key !== undefined && !leaves.prose(key)?.enterReview(id)) {
|
|
1604
|
+
const control = leaves.control(key);
|
|
1605
|
+
const steps = reviewing.at(key).nested?.find((e) => e.item.id === id)?.steps;
|
|
1606
|
+
if (steps && control?.focusPath) control.focusPath(steps);
|
|
1607
|
+
else control?.focus();
|
|
1608
|
+
}
|
|
1668
1609
|
// The current item is drawn again, so its element is read once it has been.
|
|
1669
1610
|
if (!(await span.resumes(tick()))) return false;
|
|
1670
|
-
const els =
|
|
1671
|
-
(el) => reviewIds(el).includes(id)
|
|
1672
|
-
);
|
|
1611
|
+
const els = reviewEls(id);
|
|
1673
1612
|
const at =
|
|
1674
1613
|
(key !== undefined ? leaves.prose(key)?.reviewElements(id)[0] : undefined) ??
|
|
1675
1614
|
els[0] ??
|
|
@@ -1686,78 +1625,72 @@
|
|
|
1686
1625
|
for (const item of reviewing.cards.removes.values()) if (item.id === id) return true;
|
|
1687
1626
|
return false;
|
|
1688
1627
|
}
|
|
1689
|
-
/**
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1628
|
+
/** The elements that draw the item `id`. */
|
|
1629
|
+
function reviewEls(id: string): HTMLElement[] {
|
|
1630
|
+
return [...(rootEl?.querySelectorAll<HTMLElement>('[data-qm-review]') ?? [])].filter((el) =>
|
|
1631
|
+
reviewIds(el).includes(id)
|
|
1632
|
+
);
|
|
1633
|
+
}
|
|
1634
|
+
/** The band of the window the editor shows through: its nearest scroller's. */
|
|
1635
|
+
function pane(): { top: number; bottom: number } {
|
|
1696
1636
|
for (let at = rootEl ?? null; at; at = at.parentElement) {
|
|
1697
1637
|
const { overflowY } = getComputedStyle(at);
|
|
1698
1638
|
if (overflowY !== 'auto' && overflowY !== 'scroll') continue;
|
|
1699
1639
|
const box = at.getBoundingClientRect();
|
|
1700
|
-
top
|
|
1701
|
-
bottom = Math.min(box.bottom, window.innerHeight);
|
|
1702
|
-
break;
|
|
1640
|
+
return { top: Math.max(box.top, 0), bottom: Math.min(box.bottom, window.innerHeight) };
|
|
1703
1641
|
}
|
|
1642
|
+
return { top: 0, bottom: window.innerHeight };
|
|
1643
|
+
}
|
|
1644
|
+
const boxes = (els: readonly HTMLElement[]): DOMRect[] =>
|
|
1645
|
+
els.map((el) => el.getBoundingClientRect()).filter((r) => r.width || r.height);
|
|
1646
|
+
/** Whether `els` stand in the view the editor scrolls in, clear of the host's chrome at its
|
|
1647
|
+
* foot, with the answer card's room under them. */
|
|
1648
|
+
function comfortable(els: readonly HTMLElement[]): boolean {
|
|
1649
|
+
const rects = boxes(els);
|
|
1650
|
+
if (!rects.length) return false;
|
|
1651
|
+
const { top, bottom } = pane();
|
|
1704
1652
|
const room = (spacePx(rootEl, 1) ?? 0) * CARD_ROOM;
|
|
1705
1653
|
return (
|
|
1706
1654
|
Math.min(...rects.map((r) => r.top)) >= top &&
|
|
1707
1655
|
Math.max(...rects.map((r) => r.bottom)) <= bottom - reviewInset - room
|
|
1708
1656
|
);
|
|
1709
1657
|
}
|
|
1658
|
+
/** Whether any of the item `id` shows in that view, which is where its answer card stands.
|
|
1659
|
+
* An editor with no box of its own measures nothing, and every item counts as shown. */
|
|
1660
|
+
function inView(id: string): boolean {
|
|
1661
|
+
if (!rootEl || !boxes([rootEl]).length) return true;
|
|
1662
|
+
const { top, bottom } = pane();
|
|
1663
|
+
return boxes(reviewEls(id)).some((r) => r.bottom > top && r.top < bottom - reviewInset);
|
|
1664
|
+
}
|
|
1710
1665
|
/** The room the answer card takes under a change, in `--_qm-space` rungs. */
|
|
1711
1666
|
const CARD_ROOM = 7;
|
|
1712
1667
|
|
|
1668
|
+
/** Whether the item `id` is listed in `group`. */
|
|
1669
|
+
function inGroup(group: string): (id: string) => boolean {
|
|
1670
|
+
const ids = new Set(reviewing.items.filter((i) => i.group === group).map((i) => i.id));
|
|
1671
|
+
return (id) => ids.has(id);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1713
1674
|
/**
|
|
1714
|
-
* Answer items as the answer card would, in document order: `'all'` is every item drawn
|
|
1675
|
+
* Answer items as the answer card would, in document order: `'all'` is every item drawn, and
|
|
1676
|
+
* `{ group }` every item drawn in that group, which as `'all'` does accepts none outdated. An
|
|
1715
1677
|
* item that cannot be answered (a proposal that no longer writes, a value the field's writer
|
|
1716
1678
|
* refuses) stands. `onReview` hears each answer, and neither the focus nor the caret moves;
|
|
1717
1679
|
* where the current change is answered, the next open one is current. ⌘Z takes the call
|
|
1718
1680
|
* back whole. Returns the ids answered.
|
|
1719
1681
|
*/
|
|
1720
1682
|
export function answerReview(
|
|
1721
|
-
ids: readonly string[] | 'all',
|
|
1683
|
+
ids: readonly string[] | 'all' | { group: string },
|
|
1722
1684
|
action: 'accept' | 'dismiss'
|
|
1723
1685
|
): string[] {
|
|
1724
1686
|
if (!span.alive) return [];
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
const out: string[] = [];
|
|
1733
|
-
const entry: Answered = { ids: [], inverses: [] };
|
|
1734
|
-
batching = entry;
|
|
1735
|
-
writing++;
|
|
1736
|
-
try {
|
|
1737
|
-
for (const id of asked) {
|
|
1738
|
-
const item = reviewing.items.find((it) => it.id === id);
|
|
1739
|
-
if (!item) continue;
|
|
1740
|
-
const key = reviewing.keyOf(id);
|
|
1741
|
-
// Each one is planned against the document the one before it left.
|
|
1742
|
-
const answered =
|
|
1743
|
-
onField(item) || byCard(item)
|
|
1744
|
-
? reviewing.act(id, action)
|
|
1745
|
-
: key !== undefined && !!leaves.prose(key)?.answerReview(id, action);
|
|
1746
|
-
if (answered) out.push(id);
|
|
1747
|
-
}
|
|
1748
|
-
} finally {
|
|
1749
|
-
writing--;
|
|
1750
|
-
batching = undefined;
|
|
1751
|
-
}
|
|
1752
|
-
if (entry.ids.length) {
|
|
1753
|
-
if (!journalOffer || !undo.holds(journalOffer)) journal = [];
|
|
1754
|
-
journal.push(entry);
|
|
1755
|
-
offerJournal();
|
|
1756
|
-
}
|
|
1757
|
-
const from = advancing;
|
|
1758
|
-
advancing = undefined;
|
|
1759
|
-
if (from !== undefined) advanceFrom(from, order);
|
|
1760
|
-
return out;
|
|
1687
|
+
if (ids === 'all' || Array.isArray(ids)) return reviewing.answer(ids, action);
|
|
1688
|
+
const has = inGroup((ids as { group: string }).group);
|
|
1689
|
+
const stale = new Set(action === 'accept' ? drewOutdated : []);
|
|
1690
|
+
return reviewing.answer(
|
|
1691
|
+
reviewing.order.filter((id) => has(id) && !stale.has(id)),
|
|
1692
|
+
action
|
|
1693
|
+
);
|
|
1761
1694
|
}
|
|
1762
1695
|
|
|
1763
1696
|
/**
|
|
@@ -1770,7 +1703,7 @@
|
|
|
1770
1703
|
*/
|
|
1771
1704
|
export function projectReview(target: Document): ReviewProjection {
|
|
1772
1705
|
if (!span.alive) return NO_PROJECTION;
|
|
1773
|
-
const order =
|
|
1706
|
+
const order = reviewing.order;
|
|
1774
1707
|
if (!order.length) return NO_PROJECTION;
|
|
1775
1708
|
const open = new Set(order);
|
|
1776
1709
|
const byId = new Map(reviewing.items.map((item) => [item.id, item]));
|
|
@@ -1928,17 +1861,8 @@
|
|
|
1928
1861
|
/** Write `card` into `target` at `at`, with its `$id` where no card there holds that one,
|
|
1929
1862
|
* as {@link placeCard} writes it into the document. */
|
|
1930
1863
|
function placeCardIn(target: Document, card: CardAdd['add'], at: number): boolean {
|
|
1931
|
-
const { id, ...bare } = card;
|
|
1932
|
-
const free =
|
|
1933
|
-
id !== undefined &&
|
|
1934
|
-
!Array.from({ length: target.cardCount }, (_, k) => target.card(k).id).includes(id);
|
|
1935
1864
|
try {
|
|
1936
|
-
|
|
1937
|
-
target.unchecked.insertCard(free ? card : bare, at);
|
|
1938
|
-
} catch (e) {
|
|
1939
|
-
if (!free) throw e;
|
|
1940
|
-
target.unchecked.insertCard(bare, at);
|
|
1941
|
-
}
|
|
1865
|
+
placeCardInto(target, card, at);
|
|
1942
1866
|
return true;
|
|
1943
1867
|
} catch {
|
|
1944
1868
|
return false;
|
|
@@ -1947,12 +1871,13 @@
|
|
|
1947
1871
|
|
|
1948
1872
|
/** Make the next or previous open item current, in document order and round from either
|
|
1949
1873
|
* end, from the current item or the one last stepped to: the caret in it, or the focus in
|
|
1950
|
-
*
|
|
1874
|
+
* the control drawing it, unless `focus` is false. With `group`, only that group's items
|
|
1875
|
+
* are stepped to. Resolves its id, `undefined` when none is drawn. */
|
|
1951
1876
|
export function stepReview(
|
|
1952
1877
|
dir: 1 | -1,
|
|
1953
|
-
opts: { focus?: boolean } = {}
|
|
1878
|
+
opts: { focus?: boolean; group?: string } = {}
|
|
1954
1879
|
): Promise<string | undefined> {
|
|
1955
|
-
return step(dir, opts.focus ?? true);
|
|
1880
|
+
return step(dir, opts.focus ?? true, opts.group);
|
|
1956
1881
|
}
|
|
1957
1882
|
|
|
1958
1883
|
function holds(cardId: CardId): boolean {
|
|
@@ -2038,6 +1963,7 @@
|
|
|
2038
1963
|
{style}
|
|
2039
1964
|
data-qm-root
|
|
2040
1965
|
bind:this={rootEl}
|
|
1966
|
+
{@attach tooltips}
|
|
2041
1967
|
onkeydowncapture={onTyped}
|
|
2042
1968
|
onpointerdowncapture={onPick}
|
|
2043
1969
|
onkeydown={raiseGuidance}
|
|
@@ -2092,8 +2018,6 @@
|
|
|
2092
2018
|
data-qm-review={removal?.id}
|
|
2093
2019
|
role={removal ? 'group' : undefined}
|
|
2094
2020
|
aria-label={removal ? merged.reviewRemoveCard : undefined}
|
|
2095
|
-
onpointerenter={removal && (() => reviewing.point(removal.id, 'pointer'))}
|
|
2096
|
-
onpointerleave={removal && (() => reviewing.point(undefined, 'pointer'))}
|
|
2097
2021
|
>
|
|
2098
2022
|
<Card
|
|
2099
2023
|
bind:this={cardRefs[i]}
|
|
@@ -2125,10 +2049,15 @@
|
|
|
2125
2049
|
inset={reviewInset}
|
|
2126
2050
|
hidden={typing}
|
|
2127
2051
|
outdated={reviewing.lit !== undefined && drewOutdated.includes(reviewing.lit)}
|
|
2052
|
+
note={reviewing.lit === undefined
|
|
2053
|
+
? undefined
|
|
2054
|
+
: reviewing.items.find((i) => i.id === reviewing.lit)?.note}
|
|
2128
2055
|
onAnswer={answerCurrent}
|
|
2129
|
-
onHover={(on) => reviewing.hoverCard(on)}
|
|
2130
2056
|
/>
|
|
2131
2057
|
<div class="qm-visually-hidden" role="status">{reviewPlace}</div>
|
|
2058
|
+
<!-- Beside the review's region rather than in it or in the toast's: a status is read whole,
|
|
2059
|
+
so a shared one would repeat what the other said. -->
|
|
2060
|
+
<div class="qm-visually-hidden qm-diag-live" role="status">{spoken}</div>
|
|
2132
2061
|
<!-- The way back to a removed card once its toast has gone: the newest kept step, by
|
|
2133
2062
|
name, at the stack's foot, where the control that adds a card is looked for. -->
|
|
2134
2063
|
{#if undo.kept}
|
|
@@ -2156,7 +2085,7 @@
|
|
|
2156
2085
|
<span class="qm-toast-notice">{undo.current.notice}</span>
|
|
2157
2086
|
<button
|
|
2158
2087
|
type="button"
|
|
2159
|
-
class="qm-toast-action qm-focus-ring"
|
|
2088
|
+
class="qm-toast-action qm-chip qm-focus-ring"
|
|
2160
2089
|
aria-keyshortcuts="Meta+Z Control+Z"
|
|
2161
2090
|
onclick={() => undo.take()}>{merged.undoAction}</button
|
|
2162
2091
|
>
|
|
@@ -2186,9 +2115,7 @@
|
|
|
2186
2115
|
class={['qm-review-card-add', { 'qm-review-lit': reviewing.lit === item.id }]}
|
|
2187
2116
|
data-qm-review={item.id}
|
|
2188
2117
|
role="group"
|
|
2189
|
-
aria-label={merged.reviewNewCard}
|
|
2190
|
-
onpointerenter={() => reviewing.point(item.id, 'pointer')}
|
|
2191
|
-
onpointerleave={() => reviewing.point(undefined, 'pointer')}
|
|
2118
|
+
aria-label={`${merged.reviewNewCard}, ${preview.title}`}
|
|
2192
2119
|
>
|
|
2193
2120
|
<div class="qm-review-card-add-head">
|
|
2194
2121
|
<span class="qm-review-card-add-title">{preview.title}</span>
|
|
@@ -2217,14 +2144,14 @@
|
|
|
2217
2144
|
on hover is the space the new card takes. -->
|
|
2218
2145
|
{@const marked = atIndex === model.cards.length}
|
|
2219
2146
|
<div class={['qm-add-card', { 'qm-add-card-marked': marked }]}>
|
|
2220
|
-
<!--
|
|
2221
|
-
|
|
2222
|
-
content to carry them. -->
|
|
2147
|
+
<!-- The string is the name on every strip: marked, the strip draws a `+` ahead
|
|
2148
|
+
of the words, which is the template's glyph and no part of the name; bare,
|
|
2149
|
+
it has no content to carry them. -->
|
|
2223
2150
|
{#if kinds.length === 1}
|
|
2224
2151
|
<button
|
|
2225
2152
|
type="button"
|
|
2226
2153
|
class="qm-add-btn qm-add-affordance qm-tap-floor qm-focus-ring"
|
|
2227
|
-
aria-label={
|
|
2154
|
+
aria-label={merged.addCard}
|
|
2228
2155
|
onclick={() => addCard(atIndex, kinds[0], true)}
|
|
2229
2156
|
>{#if marked}{`+ ${merged.addCard}`}{/if}</button
|
|
2230
2157
|
>
|
|
@@ -2237,7 +2164,7 @@
|
|
|
2237
2164
|
<DropdownMenu.Root>
|
|
2238
2165
|
<DropdownMenu.Trigger
|
|
2239
2166
|
class="qm-add-btn qm-add-affordance qm-tap-floor qm-focus-ring"
|
|
2240
|
-
aria-label={
|
|
2167
|
+
aria-label={merged.addCard}
|
|
2241
2168
|
>{#if marked}{`+ ${merged.addCard}`}{/if}</DropdownMenu.Trigger
|
|
2242
2169
|
>
|
|
2243
2170
|
<DropdownMenu.Portal to={rootEl}>
|
|
@@ -2298,19 +2225,14 @@
|
|
|
2298
2225
|
color: var(--_qm-ink);
|
|
2299
2226
|
pointer-events: auto;
|
|
2300
2227
|
}
|
|
2228
|
+
/* A chip (controls.css), in the toast's own corner. It stands at the ink and the chrome's
|
|
2229
|
+
weight where a chip rests at the label rung: it is the one action here, and the notice
|
|
2230
|
+
beside it is at the ink, so a rung under that would set the action quieter than the
|
|
2231
|
+
sentence it acts on. */
|
|
2301
2232
|
.qm-toast-action {
|
|
2302
|
-
min-height: var(--_qm-tap-min);
|
|
2303
|
-
padding-inline: var(--_qm-space-2);
|
|
2304
|
-
border: 0;
|
|
2305
2233
|
border-radius: var(--_qm-radius-pill);
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
font-weight: var(--_qm-weight-strong);
|
|
2309
|
-
color: var(--_qm-accent);
|
|
2310
|
-
cursor: pointer;
|
|
2311
|
-
}
|
|
2312
|
-
.qm-toast-action:hover {
|
|
2313
|
-
background: var(--_qm-accent-tint);
|
|
2234
|
+
font-weight: var(--_qm-weight-mid);
|
|
2235
|
+
color: var(--_qm-ink);
|
|
2314
2236
|
}
|
|
2315
2237
|
/* Words at the label ink, unboxed: the stack's foot already holds one outlined pill, and
|
|
2316
2238
|
a second would stand as its equal. */
|
|
@@ -2430,21 +2352,20 @@
|
|
|
2430
2352
|
}
|
|
2431
2353
|
/* A card proposed new and a card proposed taken out, in the review's one hue: a preview
|
|
2432
2354
|
where the new card would stand, the card's own ground under the tint, and a mark round
|
|
2433
|
-
the whole of a card that would go, its
|
|
2434
|
-
|
|
2355
|
+
the whole of a card that would go, its values struck as a removed row's are. An edge
|
|
2356
|
+
is dashed at rest and solid and a step heavier on the current one, so the one the
|
|
2357
|
+
answer card is for is told from the open ones round it by more than strength. */
|
|
2435
2358
|
.qm-review-card-remove {
|
|
2436
2359
|
display: contents;
|
|
2437
2360
|
}
|
|
2438
2361
|
.qm-review-card-remove.qm-review-on {
|
|
2439
2362
|
display: block;
|
|
2440
2363
|
border-radius: var(--_qm-radius);
|
|
2441
|
-
|
|
2442
|
-
}
|
|
2443
|
-
.qm-review-card-remove.qm-review-on > :global(.qm-card) {
|
|
2444
|
-
opacity: var(--_qm-opacity-muted);
|
|
2364
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2445
2365
|
}
|
|
2446
2366
|
.qm-review-card-remove.qm-review-lit {
|
|
2447
|
-
|
|
2367
|
+
outline-style: solid;
|
|
2368
|
+
outline-width: var(--_qm-vertical-width);
|
|
2448
2369
|
}
|
|
2449
2370
|
.qm-review-head {
|
|
2450
2371
|
display: flex;
|
|
@@ -2478,7 +2399,8 @@
|
|
|
2478
2399
|
transform: none;
|
|
2479
2400
|
border-radius: var(--_qm-radius-inner);
|
|
2480
2401
|
background: var(--_qm-review-tint);
|
|
2481
|
-
|
|
2402
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2403
|
+
outline-offset: calc(-1 * var(--_qm-border-width));
|
|
2482
2404
|
opacity: 1;
|
|
2483
2405
|
pointer-events: none;
|
|
2484
2406
|
transition: background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
@@ -2488,11 +2410,13 @@
|
|
|
2488
2410
|
:global(.qm-review-added-box .qm-toggle)::after {
|
|
2489
2411
|
border-radius: inherit;
|
|
2490
2412
|
}
|
|
2491
|
-
/* The current one's edge is a step
|
|
2413
|
+
/* The current one's edge is solid and a step heavier, as a removed card's ring is. */
|
|
2492
2414
|
:global([data-qm-proposed-lit])::after,
|
|
2493
2415
|
:global(.qm-review-lit > .qm-review-added-box :is(.qm-toggle, .qm-tick))::after {
|
|
2494
2416
|
background: var(--_qm-review-lit);
|
|
2495
|
-
|
|
2417
|
+
outline-style: solid;
|
|
2418
|
+
outline-width: var(--_qm-vertical-width);
|
|
2419
|
+
outline-offset: calc(-1 * var(--_qm-vertical-width));
|
|
2496
2420
|
}
|
|
2497
2421
|
:global([data-qm-removes]) {
|
|
2498
2422
|
text-decoration: line-through;
|
|
@@ -2508,52 +2432,44 @@
|
|
|
2508
2432
|
}
|
|
2509
2433
|
:global(.qm-review-added-box :is(.qm-control-box, .qm-input)) {
|
|
2510
2434
|
background-image: linear-gradient(var(--_qm-review-tint), var(--_qm-review-tint));
|
|
2511
|
-
|
|
2435
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2436
|
+
outline-offset: calc(-1 * var(--_qm-border-width));
|
|
2512
2437
|
}
|
|
2513
2438
|
:global(.qm-review-lit > .qm-review-added-box :is(.qm-control-box, .qm-input)) {
|
|
2514
2439
|
background-image: linear-gradient(var(--_qm-review-lit), var(--_qm-review-lit));
|
|
2515
|
-
|
|
2440
|
+
outline-style: solid;
|
|
2441
|
+
outline-width: var(--_qm-vertical-width);
|
|
2442
|
+
outline-offset: calc(-1 * var(--_qm-vertical-width));
|
|
2516
2443
|
}
|
|
2517
2444
|
/* A row a proposal would take out: no tint, which only ever means "would come", but a ring
|
|
2518
|
-
in the review line laid outside the row so it takes no room, its values
|
|
2519
|
-
|
|
2445
|
+
in the review line laid outside the row so it takes no room, its values struck and its
|
|
2446
|
+
labels left alone. The current one's ring is a step stronger, as a removed card's. */
|
|
2520
2447
|
:global([data-qm-removed]) {
|
|
2521
2448
|
border-radius: var(--_qm-radius-inner);
|
|
2522
|
-
|
|
2449
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2523
2450
|
}
|
|
2524
2451
|
:global([data-qm-removed-lit]) {
|
|
2525
|
-
|
|
2452
|
+
outline-style: solid;
|
|
2453
|
+
outline-width: var(--_qm-vertical-width);
|
|
2526
2454
|
}
|
|
2455
|
+
/* What a removed row or card holds is what the reader reads to answer it, so its words
|
|
2456
|
+
step back to the label ink under the strike, as a struck word does in a paragraph
|
|
2457
|
+
(`codec/prose.css`), and no further: the ring, the strike and the tag say removed. A
|
|
2458
|
+
switch and a tick have no word to strike and keep their state as drawn. */
|
|
2527
2459
|
:global(
|
|
2528
|
-
[data-qm-removed]
|
|
2529
|
-
:is(
|
|
2530
|
-
.qm-control-box:not(.qm-element-summary),
|
|
2531
|
-
.qm-toggle,
|
|
2532
|
-
.qm-tick,
|
|
2533
|
-
.qm-input,
|
|
2534
|
-
.qm-element-preview
|
|
2535
|
-
)
|
|
2460
|
+
:is([data-qm-removed], .qm-review-card-remove.qm-review-on)
|
|
2461
|
+
:is(.qm-control-box:not(.qm-element-summary), .qm-input, .qm-prose, .qm-element-preview)
|
|
2536
2462
|
) {
|
|
2537
|
-
|
|
2463
|
+
color: var(--_qm-ink-label);
|
|
2538
2464
|
text-decoration: line-through;
|
|
2539
2465
|
text-decoration-color: var(--_qm-review-line);
|
|
2540
2466
|
}
|
|
2541
2467
|
@media (forced-colors: active) {
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
:global([data-qm-proposed-lit])::after {
|
|
2546
|
-
border-style: solid;
|
|
2547
|
-
}
|
|
2548
|
-
:global([data-qm-removed]) {
|
|
2549
|
-
outline: var(--_qm-border-width) dashed Highlight;
|
|
2550
|
-
}
|
|
2551
|
-
:global([data-qm-removed-lit]) {
|
|
2552
|
-
outline-style: solid;
|
|
2553
|
-
}
|
|
2468
|
+
.qm-review-card-remove.qm-review-on,
|
|
2469
|
+
:global([data-qm-proposed])::after,
|
|
2470
|
+
:global([data-qm-removed]),
|
|
2554
2471
|
:global(.qm-review-added-box :is(.qm-control-box, .qm-toggle, .qm-tick, .qm-input)) {
|
|
2555
|
-
outline:
|
|
2556
|
-
outline-offset: calc(-1 * var(--_qm-border-width));
|
|
2472
|
+
outline-color: Highlight;
|
|
2557
2473
|
}
|
|
2558
2474
|
}
|
|
2559
2475
|
.qm-review-card-add.qm-review-lit {
|