@quillmark/svelte 0.37.1 → 0.38.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/dist/core/codec/field.d.ts +3 -3
- package/dist/core/codec/field.js +14 -20
- package/dist/core/codec/review.d.ts +2 -1
- package/dist/core/codec/review.js +64 -15
- package/dist/core/codec/value-diff.d.ts +4 -3
- package/dist/core/codec/value-diff.js +12 -7
- package/dist/core/codec/value-plan.d.ts +9 -0
- package/dist/core/codec/value-plan.js +110 -0
- package/dist/visual/ArrayField.svelte +77 -24
- package/dist/visual/Card.svelte +4 -3
- package/dist/visual/Card.svelte.d.ts +3 -2
- package/dist/visual/Field.svelte +12 -10
- package/dist/visual/Field.svelte.d.ts +3 -3
- package/dist/visual/ObjectField.svelte +24 -12
- package/dist/visual/ObjectField.svelte.d.ts +5 -0
- package/dist/visual/ProseField.svelte +16 -8
- package/dist/visual/ProseField.svelte.d.ts +3 -2
- package/dist/visual/ProseValue.svelte +22 -22
- package/dist/visual/ProseValue.svelte.d.ts +3 -2
- package/dist/visual/VisualEditorInner.svelte +37 -9
- package/dist/visual/proposals.d.ts +14 -11
- package/dist/visual/proposals.js +72 -29
- package/dist/visual/props.d.ts +6 -4
- package/dist/visual/review-order.d.ts +1 -0
- package/dist/visual/review-order.js +4 -3
- package/dist/visual/review.d.ts +25 -3
- package/dist/visual/review.js +46 -2
- package/dist/visual/review.svelte.d.ts +8 -1
- package/dist/visual/review.svelte.js +64 -11
- package/dist/visual/structure.d.ts +17 -9
- package/dist/visual/structure.js +20 -17
- package/package.json +1 -1
package/dist/visual/Card.svelte
CHANGED
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
retype: (kind: string) => void;
|
|
39
39
|
rename: (title: string) => void;
|
|
40
40
|
diagFor: (field?: string) => Diagnostic[] | undefined;
|
|
41
|
-
/** Consumer enum-option policy for a field
|
|
42
|
-
|
|
41
|
+
/** Consumer enum-option policy for a field, or for an enum `steps` down inside it;
|
|
42
|
+
* true when no hook set. */
|
|
43
|
+
enumAllowed: (field: string, value: string, steps?: readonly PathStep[]) => boolean;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
interface Props {
|
|
@@ -400,7 +401,7 @@
|
|
|
400
401
|
leafKey={ops.leafKey(f.name)}
|
|
401
402
|
domIds={ops.domIds(f.name)}
|
|
402
403
|
onCommitScalar={(v) => ops.commit(f.name, v)}
|
|
403
|
-
optionAllowed={(v) => ops.enumAllowed(f.name, v)}
|
|
404
|
+
optionAllowed={(v, steps) => ops.enumAllowed(f.name, v, steps)}
|
|
404
405
|
{enumDisallowed}
|
|
405
406
|
{onFocus}
|
|
406
407
|
{onCaretMove}
|
|
@@ -15,8 +15,9 @@ interface CardOps {
|
|
|
15
15
|
retype: (kind: string) => void;
|
|
16
16
|
rename: (title: string) => void;
|
|
17
17
|
diagFor: (field?: string) => Diagnostic[] | undefined;
|
|
18
|
-
/** Consumer enum-option policy for a field
|
|
19
|
-
|
|
18
|
+
/** Consumer enum-option policy for a field, or for an enum `steps` down inside it;
|
|
19
|
+
* true when no hook set. */
|
|
20
|
+
enumAllowed: (field: string, value: string, steps?: readonly PathStep[]) => boolean;
|
|
20
21
|
}
|
|
21
22
|
interface Props {
|
|
22
23
|
card: CardModel;
|
package/dist/visual/Field.svelte
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
import ReviewProposal from './ReviewProposal.svelte';
|
|
61
61
|
import ReviewRows from './ReviewRows.svelte';
|
|
62
62
|
import { review } from './review.svelte.js';
|
|
63
|
-
import { numberProposal, shownValue,
|
|
63
|
+
import { numberProposal, shownValue, textsOf } from './review.js';
|
|
64
64
|
|
|
65
65
|
interface Props {
|
|
66
66
|
field: FieldModel;
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
* the label and the control find each other. */
|
|
84
84
|
domIds: FieldDomIds;
|
|
85
85
|
onCommitScalar: (value: unknown) => void;
|
|
86
|
-
/** Enum-option policy: `false` marks that option unavailable
|
|
87
|
-
* control
|
|
88
|
-
optionAllowed?: (value: string) => boolean;
|
|
86
|
+
/** Enum-option policy: `false` marks that option unavailable, on the field's own
|
|
87
|
+
* enum control (`steps` absent) or on an enum `steps` down its object subform. */
|
|
88
|
+
optionAllowed?: (value: string, steps?: readonly PathStep[]) => boolean;
|
|
89
89
|
/** How a refused option draws: greyed (default) or left out. */
|
|
90
90
|
enumDisallowed?: 'hide' | 'disable';
|
|
91
91
|
/** A focus inside the field: its address, and the steps down to the cell holding
|
|
@@ -323,16 +323,16 @@
|
|
|
323
323
|
* rather than counted twice.
|
|
324
324
|
*/
|
|
325
325
|
// ── Review: this field's own items (`review.svelte.ts`) ──────────────────────
|
|
326
|
-
/** A
|
|
327
|
-
*
|
|
328
|
-
* and the proposed figures. */
|
|
326
|
+
/** A proposed value drawn as words over the control's own: a text field's as a word diff,
|
|
327
|
+
* whatever its kind, a whole value or each run of one answer, carried onto what the reader
|
|
328
|
+
* wrote since its writer read it; a number's as the struck and the proposed figures. */
|
|
329
329
|
const texted = $derived(
|
|
330
|
-
field.control === 'prose' &&
|
|
331
|
-
?
|
|
330
|
+
field.control === 'prose' && proposed
|
|
331
|
+
? textsOf([proposed, ...(reviewed.more ?? [])], printed ? (ghost as Content) : undefined)
|
|
332
332
|
: undefined
|
|
333
333
|
);
|
|
334
334
|
const numbered = $derived(field.control === 'number' ? numberProposal(proposed) : undefined);
|
|
335
|
-
const worded = $derived(texted ?? numbered);
|
|
335
|
+
const worded = $derived(texted?.[0] ?? numbered);
|
|
336
336
|
/** What a control that cannot draw a proposal as words shows while one stands: the value
|
|
337
337
|
* Accept would write, tinted (`ReviewProposal`), or its default or empty face where Accept
|
|
338
338
|
* clears it. */
|
|
@@ -495,6 +495,8 @@
|
|
|
495
495
|
bind:this={objectEl}
|
|
496
496
|
value={value as Record<string, unknown> | undefined}
|
|
497
497
|
properties={field.schema.properties}
|
|
498
|
+
{optionAllowed}
|
|
499
|
+
{enumDisallowed}
|
|
498
500
|
{flat}
|
|
499
501
|
placed
|
|
500
502
|
label={field.label}
|
|
@@ -24,9 +24,9 @@ interface Props {
|
|
|
24
24
|
* the label and the control find each other. */
|
|
25
25
|
domIds: FieldDomIds;
|
|
26
26
|
onCommitScalar: (value: unknown) => void;
|
|
27
|
-
/** Enum-option policy: `false` marks that option unavailable
|
|
28
|
-
* control
|
|
29
|
-
optionAllowed?: (value: string) => boolean;
|
|
27
|
+
/** Enum-option policy: `false` marks that option unavailable, on the field's own
|
|
28
|
+
* enum control (`steps` absent) or on an enum `steps` down its object subform. */
|
|
29
|
+
optionAllowed?: (value: string, steps?: readonly PathStep[]) => boolean;
|
|
30
30
|
/** How a refused option draws: greyed (default) or left out. */
|
|
31
31
|
enumDisallowed?: 'hide' | 'disable';
|
|
32
32
|
/** A focus inside the field: its address, and the steps down to the cell holding
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
fieldModels,
|
|
44
44
|
fieldTitle,
|
|
45
45
|
isContainer,
|
|
46
|
-
|
|
47
|
-
literalText,
|
|
46
|
+
leafFlags,
|
|
48
47
|
mountKey,
|
|
49
48
|
optionalCell,
|
|
50
49
|
own,
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
numberProposal,
|
|
60
59
|
shownValue,
|
|
61
60
|
splitReview,
|
|
62
|
-
|
|
61
|
+
textsOf,
|
|
63
62
|
type DeepReview,
|
|
64
63
|
type FieldProposal
|
|
65
64
|
} from './review.js';
|
|
@@ -130,6 +129,11 @@
|
|
|
130
129
|
* one naming a property draws under that property's control, and one naming
|
|
131
130
|
* nothing this subform holds draws at its foot (`diagnostics.ts`). */
|
|
132
131
|
diagnostics?: readonly DeepDiagnostic[];
|
|
132
|
+
/** Enum-option policy for an enum property at any depth of this subform, `steps` the
|
|
133
|
+
* properties from here down to it. */
|
|
134
|
+
optionAllowed?: (value: string, steps: readonly PathStep[]) => boolean;
|
|
135
|
+
/** How a refused option draws: greyed (default) or left out. */
|
|
136
|
+
enumDisallowed?: 'hide' | 'disable';
|
|
133
137
|
/** The review items naming a place inside this subform, each with its steps still to
|
|
134
138
|
* walk: one naming a cell draws under the cell's control, one naming a place inside a
|
|
135
139
|
* record or a list cell is handed to it, and the rest draw under the cell they are in
|
|
@@ -150,6 +154,8 @@
|
|
|
150
154
|
placed = false,
|
|
151
155
|
onCellKey,
|
|
152
156
|
diagnostics,
|
|
157
|
+
optionAllowed,
|
|
158
|
+
enumDisallowed,
|
|
153
159
|
review
|
|
154
160
|
}: Props = $props();
|
|
155
161
|
|
|
@@ -316,13 +322,13 @@
|
|
|
316
322
|
{@const deep = routed.below.get(key)}
|
|
317
323
|
{@const reviewHere = reviewed.below.get(key)}
|
|
318
324
|
{@const handsDown = isContainer(kind)}
|
|
319
|
-
{@const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
325
|
+
{@const ownItems = handsDown
|
|
326
|
+
? []
|
|
327
|
+
: (reviewHere ?? []).filter((e) => !e.steps.length).map((e) => e.item)}
|
|
328
|
+
{@const ownItem = ownItems[0]}
|
|
329
|
+
{@const textOwn = kind === 'prose' ? textsOf(ownItems, contentDefault(sub)) : undefined}
|
|
324
330
|
{@const numberOwn = kind === 'number' ? numberProposal(ownItem) : undefined}
|
|
325
|
-
{@const worded = textOwn ?? numberOwn}
|
|
331
|
+
{@const worded = textOwn?.[0] ?? numberOwn}
|
|
326
332
|
{@const shownItem = worded ? undefined : ownItem}
|
|
327
333
|
{@const shown = shownValue(shownItem, obj[key])}
|
|
328
334
|
{@const commitCell = (v: unknown) => answerOrCommit(shownItem, key, v)}
|
|
@@ -385,6 +391,8 @@
|
|
|
385
391
|
optional={optionalCell(sub)}
|
|
386
392
|
onCommit={commitCell}
|
|
387
393
|
proposing={!!shownItem}
|
|
394
|
+
optionAllowed={optionAllowed && ((v) => optionAllowed(v, [key]))}
|
|
395
|
+
{enumDisallowed}
|
|
388
396
|
/>
|
|
389
397
|
{:else if kind === 'number'}
|
|
390
398
|
<NumberField
|
|
@@ -442,8 +450,8 @@
|
|
|
442
450
|
: contentAt([key])}
|
|
443
451
|
value={shown}
|
|
444
452
|
fallback={contentDefault(sub)}
|
|
445
|
-
plaintext={
|
|
446
|
-
paragraphs={
|
|
453
|
+
plaintext={leafFlags(sub).plaintext}
|
|
454
|
+
paragraphs={leafFlags(sub).paragraphs}
|
|
447
455
|
placeholder={ownItem ? undefined : noneOf(key, sub)}
|
|
448
456
|
{block}
|
|
449
457
|
label={named}
|
|
@@ -483,6 +491,8 @@
|
|
|
483
491
|
value={obj[key] as Record<string, unknown> | undefined}
|
|
484
492
|
properties={sub.properties}
|
|
485
493
|
{placed}
|
|
494
|
+
optionAllowed={optionAllowed && ((v, steps) => optionAllowed(v, [key, ...steps]))}
|
|
495
|
+
{enumDisallowed}
|
|
486
496
|
label={ids ? undefined : fallbackName(key, sub)}
|
|
487
497
|
idBase={ids?.control}
|
|
488
498
|
labelledBy={ids?.label}
|
|
@@ -513,6 +523,8 @@
|
|
|
513
523
|
value={obj[key] as Record<string, unknown> | undefined}
|
|
514
524
|
schema={sub}
|
|
515
525
|
ghostMember={sub.default as string | undefined}
|
|
526
|
+
optionAllowed={optionAllowed && ((v) => optionAllowed(v, [key]))}
|
|
527
|
+
{enumDisallowed}
|
|
516
528
|
label={fieldTitle(key, sub)}
|
|
517
529
|
id={ids?.control}
|
|
518
530
|
labelledBy={ids?.label}
|
|
@@ -534,7 +546,7 @@
|
|
|
534
546
|
<DiagnosticList diagnostics={own} />
|
|
535
547
|
{#if !handsDown}
|
|
536
548
|
<ReviewRows
|
|
537
|
-
entries={worded ? reviewHere?.filter((e) => e.item
|
|
549
|
+
entries={worded ? reviewHere?.filter((e) => !ownItems.includes(e.item)) : reviewHere}
|
|
538
550
|
/>
|
|
539
551
|
{/if}
|
|
540
552
|
</div>
|
|
@@ -49,6 +49,11 @@ interface Props {
|
|
|
49
49
|
* one naming a property draws under that property's control, and one naming
|
|
50
50
|
* nothing this subform holds draws at its foot (`diagnostics.ts`). */
|
|
51
51
|
diagnostics?: readonly DeepDiagnostic[];
|
|
52
|
+
/** Enum-option policy for an enum property at any depth of this subform, `steps` the
|
|
53
|
+
* properties from here down to it. */
|
|
54
|
+
optionAllowed?: (value: string, steps: readonly PathStep[]) => boolean;
|
|
55
|
+
/** How a refused option draws: greyed (default) or left out. */
|
|
56
|
+
enumDisallowed?: 'hide' | 'disable';
|
|
52
57
|
/** The review items naming a place inside this subform, each with its steps still to
|
|
53
58
|
* walk: one naming a cell draws under the cell's control, one naming a place inside a
|
|
54
59
|
* record or a list cell is handed to it, and the rest draw under the cell they are in
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
this leaf's commits with the caret riding the untouched view.
|
|
6
6
|
-->
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import { untrack } from 'svelte';
|
|
8
|
+
import { onDestroy, untrack } from 'svelte';
|
|
9
9
|
import {
|
|
10
10
|
createField,
|
|
11
11
|
type FieldController,
|
|
@@ -63,8 +63,9 @@
|
|
|
63
63
|
cap?: TextCap;
|
|
64
64
|
/** Registry identity, stamped on the DOM node so a remount is visible as one. */
|
|
65
65
|
leafKey: string;
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/** Proposed values over the leaf's words, a whole one or each run of one answer, drawn
|
|
67
|
+
* over its text as a word diff. */
|
|
68
|
+
proposed?: readonly TextProposal[];
|
|
68
69
|
onFocus?: (addr: Addr) => void;
|
|
69
70
|
onCaretMove?: (addr: Addr, pos: number) => void;
|
|
70
71
|
/** A commit landed on this leaf: the prose change lane. */
|
|
@@ -197,13 +198,20 @@
|
|
|
197
198
|
controller?.setReview(reviewing.textAt(leafKey), reviewing.lit);
|
|
198
199
|
});
|
|
199
200
|
$effect(() => {
|
|
200
|
-
controller?.
|
|
201
|
+
controller?.setValueProposals(
|
|
202
|
+
(proposed ?? []).map((p) => ({ ...p, lit: reviewing.lit === p.id }))
|
|
203
|
+
);
|
|
201
204
|
});
|
|
205
|
+
/** A proposal's plan goes when it leaves the list or the leaf goes, not when another in the
|
|
206
|
+
* list is answered, which would leave its own Accept writing its value whole. */
|
|
207
|
+
let plannedIds: readonly string[] = [];
|
|
202
208
|
$effect(() => {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
const ids = (proposed ?? []).map((p) => p.id);
|
|
210
|
+
for (const id of plannedIds) if (!ids.includes(id)) reviewing.planned(id, undefined);
|
|
211
|
+
plannedIds = ids;
|
|
212
|
+
});
|
|
213
|
+
onDestroy(() => {
|
|
214
|
+
for (const id of plannedIds) reviewing.planned(id, undefined);
|
|
207
215
|
});
|
|
208
216
|
|
|
209
217
|
// Only a narrowed or a plain leaf holds by what a re-validation says, so only one of them asks.
|
|
@@ -45,8 +45,9 @@ interface Props {
|
|
|
45
45
|
cap?: TextCap;
|
|
46
46
|
/** Registry identity, stamped on the DOM node so a remount is visible as one. */
|
|
47
47
|
leafKey: string;
|
|
48
|
-
/**
|
|
49
|
-
|
|
48
|
+
/** Proposed values over the leaf's words, a whole one or each run of one answer, drawn
|
|
49
|
+
* over its text as a word diff. */
|
|
50
|
+
proposed?: readonly TextProposal[];
|
|
50
51
|
onFocus?: (addr: Addr) => void;
|
|
51
52
|
onCaretMove?: (addr: Addr, pos: number) => void;
|
|
52
53
|
/** A commit landed on this leaf: the prose change lane. */
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
replacement reads, so a write moving the value takes it or releases it.
|
|
46
46
|
-->
|
|
47
47
|
<script lang="ts">
|
|
48
|
-
import { untrack } from 'svelte';
|
|
48
|
+
import { onDestroy, untrack } from 'svelte';
|
|
49
49
|
import { Fragment, Slice, type Node as PMNode } from 'prosemirror-model';
|
|
50
50
|
import { EditorState, Selection } from 'prosemirror-state';
|
|
51
51
|
import { EditorView } from 'prosemirror-view';
|
|
@@ -137,8 +137,9 @@
|
|
|
137
137
|
* array repeater's Enter/Backspace (`ArrayField`). Fires before the view's own
|
|
138
138
|
* keymap, so the state it reads is the one this keystroke has yet to change. */
|
|
139
139
|
onKey?: (e: KeyboardEvent) => void;
|
|
140
|
-
/**
|
|
141
|
-
|
|
140
|
+
/** Proposed values over the leaf's words, a whole one or each run of one answer, drawn
|
|
141
|
+
* over its text as a word diff. */
|
|
142
|
+
proposed?: readonly TextProposal[];
|
|
142
143
|
}
|
|
143
144
|
let {
|
|
144
145
|
content,
|
|
@@ -159,21 +160,23 @@
|
|
|
159
160
|
}: Props = $props();
|
|
160
161
|
|
|
161
162
|
const reviewing = review();
|
|
162
|
-
/** The
|
|
163
|
-
let
|
|
163
|
+
/** The proposals the value-diff plugin reads, and the view it redraws. */
|
|
164
|
+
let drawnProposals: readonly ValueProposal[] = [];
|
|
164
165
|
let redraw: (() => void) | undefined;
|
|
165
166
|
$effect(() => {
|
|
166
|
-
|
|
167
|
-
proposed && (!block || plaintext)
|
|
168
|
-
? { ...proposed, lit: reviewing.lit === proposed.id }
|
|
169
|
-
: undefined;
|
|
167
|
+
drawnProposals = (proposed ?? []).map((p) => ({ ...p, lit: reviewing.lit === p.id }));
|
|
170
168
|
redraw?.();
|
|
171
169
|
});
|
|
170
|
+
/** A proposal's plan goes when it leaves the list or the leaf goes, not when another in the
|
|
171
|
+
* list is answered, which would leave its own Accept writing its value whole. */
|
|
172
|
+
let plannedIds: readonly string[] = [];
|
|
172
173
|
$effect(() => {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
const ids = (proposed ?? []).map((p) => p.id);
|
|
175
|
+
for (const id of plannedIds) if (!ids.includes(id)) reviewing.planned(id, undefined);
|
|
176
|
+
plannedIds = ids;
|
|
177
|
+
});
|
|
178
|
+
onDestroy(() => {
|
|
179
|
+
for (const id of plannedIds) reviewing.planned(id, undefined);
|
|
177
180
|
});
|
|
178
181
|
|
|
179
182
|
const t = wording();
|
|
@@ -296,15 +299,12 @@
|
|
|
296
299
|
placeholder: () => drawn.placeholder,
|
|
297
300
|
leaveStrings: () => t.strings,
|
|
298
301
|
cap,
|
|
299
|
-
afterHistory:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
)
|
|
306
|
-
]
|
|
307
|
-
: []
|
|
302
|
+
afterHistory: [
|
|
303
|
+
valueDiffPlugin(
|
|
304
|
+
() => drawnProposals,
|
|
305
|
+
(id, state) => reviewing.planned(id, state)
|
|
306
|
+
)
|
|
307
|
+
]
|
|
308
308
|
})
|
|
309
309
|
});
|
|
310
310
|
};
|
|
@@ -58,8 +58,9 @@ interface Props {
|
|
|
58
58
|
* array repeater's Enter/Backspace (`ArrayField`). Fires before the view's own
|
|
59
59
|
* keymap, so the state it reads is the one this keystroke has yet to change. */
|
|
60
60
|
onKey?: (e: KeyboardEvent) => void;
|
|
61
|
-
/**
|
|
62
|
-
|
|
61
|
+
/** Proposed values over the leaf's words, a whole one or each run of one answer, drawn
|
|
62
|
+
* over its text as a word diff. */
|
|
63
|
+
proposed?: readonly TextProposal[];
|
|
63
64
|
}
|
|
64
65
|
declare const ProseValue: import("svelte").Component<Props, {
|
|
65
66
|
focus: () => void;
|
|
@@ -67,9 +67,12 @@
|
|
|
67
67
|
byBlocks,
|
|
68
68
|
byCard,
|
|
69
69
|
locate,
|
|
70
|
+
putsIn,
|
|
71
|
+
membersOf,
|
|
70
72
|
onField,
|
|
71
73
|
reviewText,
|
|
72
74
|
valueIn,
|
|
75
|
+
valueInserting,
|
|
73
76
|
valueWith,
|
|
74
77
|
NO_PROJECTION,
|
|
75
78
|
type CardProposal,
|
|
@@ -234,6 +237,7 @@
|
|
|
234
237
|
function report(source: ChangeSource, cardId?: CardId, at?: Addr | number, op?: CardOp): void {
|
|
235
238
|
const path =
|
|
236
239
|
at == null ? undefined : typeof at === 'number' ? cardPath(at, liveKinds()) : pathFor(at);
|
|
240
|
+
if (source !== 'structure' && cardId !== undefined) reviewing.edited(cardId);
|
|
237
241
|
reviewing.settled();
|
|
238
242
|
onChange?.({ source, cardId, path, ...(op ? { op } : {}) });
|
|
239
243
|
}
|
|
@@ -416,6 +420,8 @@
|
|
|
416
420
|
if (write && item && onField(item)) {
|
|
417
421
|
back = takeField(item, write);
|
|
418
422
|
if (!back) return false;
|
|
423
|
+
const card = reviewed(item.field)?.card;
|
|
424
|
+
if (typeof card === 'string') reviewing.edited(card);
|
|
419
425
|
} else if (action === 'accept' && item && (onField(item) || byCard(item))) {
|
|
420
426
|
back = onField(item) ? takeField(item) : takeCard(item);
|
|
421
427
|
if (!back) return false;
|
|
@@ -467,7 +473,9 @@
|
|
|
467
473
|
const steps = reviewing.at(leaf).nested?.find((e) => e.item.id === item.id)?.steps;
|
|
468
474
|
if (!steps) return undefined;
|
|
469
475
|
const value = current();
|
|
470
|
-
after =
|
|
476
|
+
after = putsIn(item, steps)
|
|
477
|
+
? valueInserting(value, steps, membersOf(item))
|
|
478
|
+
: valueWith(value, steps, to(valueIn(value, steps)));
|
|
471
479
|
} else after = to(current());
|
|
472
480
|
if (!write(after)) return undefined;
|
|
473
481
|
return () => void write(before);
|
|
@@ -852,6 +860,7 @@
|
|
|
852
860
|
const cardId = cardIdOf(plain);
|
|
853
861
|
if (cardId == null) return;
|
|
854
862
|
refreshTitle(plain, cardId);
|
|
863
|
+
reviewing.edited(cardId);
|
|
855
864
|
reviewing.settled();
|
|
856
865
|
onChange?.({ source: 'prose', cardId, path: pathFor(plain) });
|
|
857
866
|
}
|
|
@@ -1255,8 +1264,8 @@
|
|
|
1255
1264
|
retype: (kind: string) => retypeCardById(id, kind),
|
|
1256
1265
|
rename: (title: string) => renameCardById(id, title),
|
|
1257
1266
|
diagFor: (field?: string) => diagByKey.get(leafKey(field)),
|
|
1258
|
-
enumAllowed: (field: string, value: string) =>
|
|
1259
|
-
enumOptionAllowed?.(makeAddr(id, isMain, field), value) ?? true
|
|
1267
|
+
enumAllowed: (field: string, value: string, steps?: readonly PathStep[]) =>
|
|
1268
|
+
enumOptionAllowed?.(makeAddr(id, isMain, field), value, steps) ?? true
|
|
1260
1269
|
};
|
|
1261
1270
|
}
|
|
1262
1271
|
|
|
@@ -1841,18 +1850,22 @@
|
|
|
1841
1850
|
const path =
|
|
1842
1851
|
other === item ? steps : leafTargetFor((other as FieldProposal).field)?.steps;
|
|
1843
1852
|
if (!otherKey || fieldKeyToString(otherKey) !== leaf || !path) continue;
|
|
1844
|
-
const located = locate(
|
|
1853
|
+
const located = locate(
|
|
1854
|
+
held.value,
|
|
1855
|
+
path,
|
|
1856
|
+
other as FieldProposal,
|
|
1857
|
+
claimed,
|
|
1858
|
+
reviewing.later(other.id)
|
|
1859
|
+
);
|
|
1845
1860
|
if (other === item) {
|
|
1846
1861
|
found = located.steps;
|
|
1847
1862
|
break;
|
|
1848
1863
|
}
|
|
1849
1864
|
}
|
|
1850
1865
|
if (!found) continue;
|
|
1851
|
-
held.value =
|
|
1852
|
-
held.value,
|
|
1853
|
-
found,
|
|
1854
|
-
reviewing.writes(item, valueIn(held.value, found))
|
|
1855
|
-
);
|
|
1866
|
+
held.value = putsIn(item as FieldProposal, found)
|
|
1867
|
+
? valueInserting(held.value, found, membersOf(item as FieldProposal))
|
|
1868
|
+
: valueWith(held.value, found, reviewing.writes(item, valueIn(held.value, found)));
|
|
1856
1869
|
}
|
|
1857
1870
|
held.ids.push(id);
|
|
1858
1871
|
}
|
|
@@ -2461,6 +2474,21 @@
|
|
|
2461
2474
|
:is(.qm-control-box:not(.qm-element-summary), .qm-input, .qm-prose, .qm-element-preview)
|
|
2462
2475
|
) {
|
|
2463
2476
|
color: var(--_qm-ink-label);
|
|
2477
|
+
}
|
|
2478
|
+
/* The strike falls on a value alone, never on the box holding it, which would carry it onto
|
|
2479
|
+
an empty field's hint and a button's label: a strike drawn on a box reaches every word
|
|
2480
|
+
in it. A date's segments are a value only once none of them is a hint. */
|
|
2481
|
+
:global(
|
|
2482
|
+
:is([data-qm-removed], .qm-review-card-remove.qm-review-on)
|
|
2483
|
+
:is(
|
|
2484
|
+
.qm-input:not(:placeholder-shown),
|
|
2485
|
+
.ProseMirror > :not(.qm-prose-placeholder),
|
|
2486
|
+
.qm-select:not([data-ghosted='']) .qm-select-shown,
|
|
2487
|
+
.qm-date:not(:has([data-ghosted='hint'])) .qm-date-segment,
|
|
2488
|
+
.qm-date-unread,
|
|
2489
|
+
.qm-element-preview
|
|
2490
|
+
)
|
|
2491
|
+
) {
|
|
2464
2492
|
text-decoration: line-through;
|
|
2465
2493
|
text-decoration-color: var(--_qm-review-line);
|
|
2466
2494
|
}
|
|
@@ -11,17 +11,20 @@ export interface Proposed {
|
|
|
11
11
|
* block ids. Each item carries `before`, what the writer read, so the editor keeps what the
|
|
12
12
|
* reader has written since and reports a place both changed as outdated.
|
|
13
13
|
*
|
|
14
|
-
* Cards pair by id. Each paired card's body and
|
|
15
|
-
* per block the answer rewrote or took out, and one `insert` item per run of blocks
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
14
|
+
* Cards pair by id. Each paired card's body and its rich text fields of `blocks` take one
|
|
15
|
+
* `replace` item per block the answer rewrote or took out, and one `insert` item per run of blocks
|
|
16
|
+
* it added. A text field of one line or of lines, at the top of a card or inside a record or a
|
|
17
|
+
* list, takes one item per run of lines the answer changed, lines paired by their words: each the
|
|
18
|
+
* value read with that run alone written, runs at most two unchanged lines apart one item, and a
|
|
19
|
+
* value that changes one run proposed whole. Every other field takes an item per place that
|
|
20
|
+
* changed: a record's cell, and a list's member, changed, taken out, or appended past the end, two
|
|
21
|
+
* appends to one list at successive indices. Members a list gains anywhere but its end are one
|
|
22
|
+
* item per run, `ahead` naming the member that follows them. A record or a list written where none
|
|
23
|
+
* was is compared with an empty one. A choice with variants is compared as a record, its
|
|
24
|
+
* discriminant a cell of it, and a checklist member by member: one ticked or unticked is proposed
|
|
25
|
+
* whole, and one held on both sides cell by cell. A value of a type nothing nests in, a field the
|
|
26
|
+
* answer clears, and a rich text value of `blocks` inside a record or a list are proposed whole.
|
|
27
|
+
* Values are in the form the editor's controls are handed, a text cell as its `Content`.
|
|
25
28
|
*
|
|
26
29
|
* A card the answer adds is an `add` item after the nearest card before it that the answer
|
|
27
30
|
* keeps, so cards it adds in a run stand in list order; one it takes out is a `remove` item.
|