@quillmark/svelte 0.37.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/dist/core/codec/field.d.ts +3 -2
- package/dist/core/codec/field.js +8 -4
- package/dist/core/codec/index.d.ts +1 -1
- package/dist/core/codec/index.js +1 -1
- package/dist/core/codec/prose.css +6 -0
- package/dist/core/theme.css +5 -4
- package/dist/visual/ArrayField.svelte +75 -62
- package/dist/visual/FieldHint.svelte +3 -5
- package/dist/visual/FieldLabel.svelte +6 -42
- package/dist/visual/FieldLabel.svelte.d.ts +0 -3
- package/dist/visual/MatrixAdd.svelte +9 -10
- package/dist/visual/MatrixField.svelte +107 -15
- package/dist/visual/ProseValue.svelte +3 -1
- package/dist/visual/ReviewCard.svelte +11 -4
- package/dist/visual/VisualEditorInner.svelte +34 -30
- package/dist/visual/guidance.d.ts +0 -2
- package/dist/visual/guidance.js +0 -10
- package/dist/visual/strings.d.ts +2 -0
- package/dist/visual/strings.js +1 -0
- package/package.json +1 -1
|
@@ -230,13 +230,14 @@ export declare function isEmptyContent(rt: Content): boolean;
|
|
|
230
230
|
/**
|
|
231
231
|
* The `contenteditable`'s role and naming attributes, shared with `ProseValue`. A `div` takes no
|
|
232
232
|
* name without a role, so every leaf states itself a textbox, one-line or not by `multiline`.
|
|
233
|
-
* `aria-labelledby` supersedes `aria-label`.
|
|
233
|
+
* `aria-labelledby` supersedes `aria-label`. A leaf on a schema of paragraphs and hard breaks
|
|
234
|
+
* alone carries `data-qm-lines`, which sets its paragraphs single spaced (`prose.css`).
|
|
234
235
|
*/
|
|
235
236
|
export declare function proseAttributes(opts: {
|
|
236
237
|
label?: string;
|
|
237
238
|
labelledBy?: string;
|
|
238
239
|
describedBy?: string;
|
|
239
|
-
}, multiline: boolean): Record<string, string>;
|
|
240
|
+
}, multiline: boolean, lines?: boolean): Record<string, string>;
|
|
240
241
|
/** A held leaf's attributes, described by its note as well. A held leaf draws its structure
|
|
241
242
|
* in the block schema, and a non-editable view is no tab stop, so it states both itself. */
|
|
242
243
|
export declare function heldAttributes(opts: {
|
package/dist/core/codec/field.js
CHANGED
|
@@ -199,10 +199,13 @@ function changeCommittable(doc, addr) {
|
|
|
199
199
|
/**
|
|
200
200
|
* The `contenteditable`'s role and naming attributes, shared with `ProseValue`. A `div` takes no
|
|
201
201
|
* name without a role, so every leaf states itself a textbox, one-line or not by `multiline`.
|
|
202
|
-
* `aria-labelledby` supersedes `aria-label`.
|
|
202
|
+
* `aria-labelledby` supersedes `aria-label`. A leaf on a schema of paragraphs and hard breaks
|
|
203
|
+
* alone carries `data-qm-lines`, which sets its paragraphs single spaced (`prose.css`).
|
|
203
204
|
*/
|
|
204
|
-
export function proseAttributes(opts, multiline) {
|
|
205
|
+
export function proseAttributes(opts, multiline, lines = false) {
|
|
205
206
|
const attrs = { role: 'textbox', 'aria-multiline': String(multiline) };
|
|
207
|
+
if (lines)
|
|
208
|
+
attrs['data-qm-lines'] = '';
|
|
206
209
|
if (opts.labelledBy)
|
|
207
210
|
attrs['aria-labelledby'] = opts.labelledBy;
|
|
208
211
|
else if (opts.label)
|
|
@@ -295,12 +298,13 @@ export function createField(opts) {
|
|
|
295
298
|
// `not_single_line` on a one-line `text` field.
|
|
296
299
|
const holds = (rt) => !fitsLeaf(rt, { inline, plaintext, paragraphs, islands: true });
|
|
297
300
|
let held = holds(reconciler.last);
|
|
298
|
-
const
|
|
301
|
+
const lines = isParagraphsSchema(schema);
|
|
302
|
+
const named = proseAttributes(opts, !inline, lines);
|
|
299
303
|
const defaultNamed = {
|
|
300
304
|
...proseAttributes({
|
|
301
305
|
...opts,
|
|
302
306
|
describedBy: [opts.describedBy, opts.defaultNoteId].filter(Boolean).join(' ') || undefined
|
|
303
|
-
}, !inline),
|
|
307
|
+
}, !inline, lines),
|
|
304
308
|
'data-default': ''
|
|
305
309
|
};
|
|
306
310
|
const heldNamed = heldAttributes(opts, opts.heldNoteId);
|
|
@@ -20,7 +20,7 @@ export type { ValuePlan, ValueChange } from './value-plan.js';
|
|
|
20
20
|
export type { DiffHunk } from './review-diff.js';
|
|
21
21
|
export { DEFAULT_SHORTCUT_STRINGS, FIELD_KEYS, LIST_KEYS, REVIEW_KEYS, editorShortcuts } from './shortcuts.js';
|
|
22
22
|
export type { EditorShortcut, ShortcutScope, ShortcutStrings } from './shortcuts.js';
|
|
23
|
-
export { blockSchema, inlineSchema, plaintextSchema, plainSchema, linesSchema, leafSchema, hasMarks } from './schema.js';
|
|
23
|
+
export { blockSchema, inlineSchema, plaintextSchema, plainSchema, linesSchema, leafSchema, isParagraphsSchema, hasMarks } from './schema.js';
|
|
24
24
|
export { rendersHref, storableUrl } from './urls.js';
|
|
25
25
|
export { decode, fitsInline, fitsLeaf, fitsPlain, renderContent, usvLength } from './decode.js';
|
|
26
26
|
export { pmToContent, lower } from './encode.js';
|
package/dist/core/codec/index.js
CHANGED
|
@@ -34,7 +34,7 @@ export { asContent, planValue, valueChanges } from './value-plan.js';
|
|
|
34
34
|
export { DEFAULT_SHORTCUT_STRINGS, FIELD_KEYS, LIST_KEYS, REVIEW_KEYS, editorShortcuts } from './shortcuts.js';
|
|
35
35
|
// Schemas (the decode/encode target; the VisualEditor mounts them). `hasMarks` is
|
|
36
36
|
// what a mark surface asks before offering itself over a leaf.
|
|
37
|
-
export { blockSchema, inlineSchema, plaintextSchema, plainSchema, linesSchema, leafSchema, hasMarks } from './schema.js';
|
|
37
|
+
export { blockSchema, inlineSchema, plaintextSchema, plainSchema, linesSchema, leafSchema, isParagraphsSchema, hasMarks } from './schema.js';
|
|
38
38
|
// The url edge: `rendersHref` is the link gate the prompt re-asks on submit, and
|
|
39
39
|
// `storableUrl` the encode the store's own refusal requires of the value it takes
|
|
40
40
|
// (`visual/links.ts`).
|
|
@@ -72,6 +72,12 @@ li.ProseMirror-selectednode::after {
|
|
|
72
72
|
margin-top: var(--_qm-space-3);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/* A leaf of lines sets its paragraphs single spaced, as the page does: in that shape a
|
|
76
|
+
paragraph break and a hard break are one line break. */
|
|
77
|
+
.ProseMirror[data-qm-lines] > * + * {
|
|
78
|
+
margin-top: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
/* A blockquote's UA indent was its only mark, and the reset above takes it. The rule
|
|
76
82
|
and the inset carry it instead: the same hairline every surface reads, so a quote
|
|
77
83
|
reads as set apart without a fill or a second box. */
|
package/dist/core/theme.css
CHANGED
|
@@ -227,13 +227,14 @@
|
|
|
227
227
|
thumb and the check, holds 3:1 at both poles, at 3.3:1 and 4.2:1. */
|
|
228
228
|
--_qm-accent-default: color-mix(in oklab, var(--_qm-accent), var(--_qm-bg) 20%);
|
|
229
229
|
/* The review hue, three ways. `tint` is held under the words a proposal would add, at
|
|
230
|
-
the strength the accent's own tint is held under body text
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
the strength the accent's own tint is held under body text, so the open items a
|
|
231
|
+
review leaves at rest stand back from the one it is on. `lit` is that tint under
|
|
232
|
+
attention, near three times as strong: the caret in the item, a step to it, a host
|
|
233
|
+
revealing it. `line` is the stroke through the words a
|
|
233
234
|
proposal would take, held back so it reads under the ink rather than as it, yet at 3:1 over
|
|
234
235
|
the card and a well at both poles, being the one mark a struck word or a tinted control's
|
|
235
236
|
edge has that is not colour alone: 75% of the light pole's hue, 60% of the dark's. */
|
|
236
|
-
--_qm-review-tint: color-mix(in oklab, var(--_qm-review)
|
|
237
|
+
--_qm-review-tint: color-mix(in oklab, var(--_qm-review) 12%, transparent);
|
|
237
238
|
--_qm-review-lit: color-mix(in oklab, var(--_qm-review) 34%, transparent);
|
|
238
239
|
--_qm-review-line: light-dark(
|
|
239
240
|
color-mix(in oklab, var(--_qm-review) 75%, transparent),
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
draws the count beside it: a disabled button takes no focus, so a `title` reaches
|
|
13
13
|
neither a screen reader nor a touch user, and the count is the carrier.
|
|
14
14
|
|
|
15
|
-
An `object` element collapses: the row is its own summary
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Open, the summary keeps its
|
|
15
|
+
An `object` element collapses: the row is its own summary, a box that opens onto
|
|
16
|
+
{@link ObjectField}. Collapsed, the summary draws the words of the record's first
|
|
17
|
+
one-line text cell, what tells one closed row from the next; a record with none, and
|
|
18
|
+
every open one, is titled `Item` and its 1-based number. The words are no part of the
|
|
19
|
+
row's name, which keeps the number.
|
|
20
|
+
Open, the summary keeps its chevron and its remove where they stood, and
|
|
21
21
|
lets its box go: a line at the tap rung over the subform, so the one thing a press
|
|
22
22
|
on it moves is the chevron. Each row opens and closes on its own: a
|
|
23
23
|
press on a summary toggles that row, and opening one leaves every other where it
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
The row's controls are inside the element: a slab over the end of the element's own
|
|
40
40
|
box, taking its two end-side corners: the remove. Every element's drag handle hangs
|
|
41
|
-
off its start edge instead, as a table grip does
|
|
41
|
+
off its start edge instead, as a table grip does, once the list holds a second element
|
|
42
|
+
to move it past; a lone element's handle is an empty track. So a row's box is the element's box, and an array's rows end where
|
|
42
43
|
every other field's control does. On an object element that box is the summary rather
|
|
43
44
|
than the open row: a destructive control belongs to the line it sits on, not to
|
|
44
45
|
everything that line has unfolded. A table's row carries the handle in its first track
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
caret there, and short of a prose line's end splits the line there, as a bulleted list
|
|
51
52
|
does; a paste of several lines into a prose row opens a row per line; Backspace at a
|
|
52
53
|
prose line's start joins it onto the line above and Delete at its end joins the next
|
|
53
|
-
onto it, each one commit
|
|
54
|
+
onto it, each one commit. A prose element whose `items` declares a `shape` holds lines of its own, so Enter breaks a line inside it and ⌘/Ctrl+Enter inserts the sibling, and a paste stays in the element. Backspace on an empty element removes it and hands focus back up the list, Alt+↑/↓
|
|
54
55
|
anywhere in a row of the list moves it, the nearest row answering and never
|
|
55
56
|
the record around a nested one: the twin of the handle's drag. A move is one splice of the ids
|
|
56
57
|
and of the values together, the mechanism insert and remove use, so an element keeps
|
|
@@ -107,7 +108,9 @@
|
|
|
107
108
|
firstShortText,
|
|
108
109
|
declaredContent,
|
|
109
110
|
fieldTitle,
|
|
111
|
+
linesOnly,
|
|
110
112
|
literalText,
|
|
113
|
+
oneLine,
|
|
111
114
|
renderedBoolean,
|
|
112
115
|
schemaAt,
|
|
113
116
|
textCap,
|
|
@@ -219,6 +222,9 @@
|
|
|
219
222
|
// `contentAt` whatever the element rests as. An array declaring no `items`
|
|
220
223
|
// has text elements.
|
|
221
224
|
const control = $derived(items ? controlKind(items) : 'text');
|
|
225
|
+
/** A prose element whose `items` declares a `shape`: its own lines, which Enter breaks and
|
|
226
|
+
* ⌘/Ctrl+Enter leaves for a sibling. */
|
|
227
|
+
const multiline = $derived(control === 'prose' && items != null && !oneLine(items));
|
|
222
228
|
const table = $derived(layout === 'table' && control === 'object');
|
|
223
229
|
const columns = $derived(Object.entries(items?.properties ?? {}));
|
|
224
230
|
/** A column's track. A cell that fills its width takes a share of what the field has
|
|
@@ -895,6 +901,7 @@
|
|
|
895
901
|
return;
|
|
896
902
|
}
|
|
897
903
|
if (e.key === 'Enter') {
|
|
904
|
+
if (multiline && !(e.ctrlKey || e.metaKey)) return;
|
|
898
905
|
e.preventDefault();
|
|
899
906
|
insertAfter(k, column);
|
|
900
907
|
} else if (e.key === 'Backspace' && !e.repeat && elementEmpty(k, e.target, column)) {
|
|
@@ -1036,7 +1043,6 @@
|
|
|
1036
1043
|
label={fieldTitle(key, sub)}
|
|
1037
1044
|
descriptionId={idBase != null ? propertyDomIds(idBase, key).description : undefined}
|
|
1038
1045
|
description={sub.description}
|
|
1039
|
-
brief={false}
|
|
1040
1046
|
/>
|
|
1041
1047
|
</div>
|
|
1042
1048
|
{/each}
|
|
@@ -1113,9 +1119,10 @@
|
|
|
1113
1119
|
screen, where this unfolds in place. Same glyph, same rotation and
|
|
1114
1120
|
same rung as a panel header's, so the surface has one disclosure. -->
|
|
1115
1121
|
<Icon name="chevron-right" class="qm-el-chevron" size={CHEVRON} />
|
|
1116
|
-
<span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
|
|
1117
1122
|
{#if !open.has(id) && preview(k)}
|
|
1118
1123
|
<span class="qm-element-preview">{preview(k)}</span>
|
|
1124
|
+
{:else}
|
|
1125
|
+
<span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
|
|
1119
1126
|
{/if}
|
|
1120
1127
|
{#if removal(k)}
|
|
1121
1128
|
<span class="qm-review-tag">{t.strings.reviewRemoveCard}</span>
|
|
@@ -1172,15 +1179,19 @@
|
|
|
1172
1179
|
value={arr[k]}
|
|
1173
1180
|
proposed={rowText(k)}
|
|
1174
1181
|
plaintext={items != null && literalText(items)}
|
|
1182
|
+
block={multiline}
|
|
1183
|
+
paragraphs={items != null && linesOnly(items)}
|
|
1175
1184
|
cap={textCap(items)}
|
|
1176
1185
|
label={rowName(k)}
|
|
1177
1186
|
placeholder={id === standingId ? t.strings.arrayStanding : undefined}
|
|
1178
1187
|
onChange={(rt) => commitElement(k, rt)}
|
|
1179
|
-
lines={
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1188
|
+
lines={multiline
|
|
1189
|
+
? undefined
|
|
1190
|
+
: {
|
|
1191
|
+
room: () => (max == null ? Infinity : max - Math.max(arr.length, 1)),
|
|
1192
|
+
onLines: (rt, below, caret) => spill(k, rt, below, caret),
|
|
1193
|
+
onJoin: (dir) => join(dir < 0 ? k - 1 : k)
|
|
1194
|
+
}}
|
|
1184
1195
|
onKey={(e) => onElementKey(e, k)}
|
|
1185
1196
|
/>
|
|
1186
1197
|
{:else if control === 'number'}
|
|
@@ -1278,11 +1289,12 @@
|
|
|
1278
1289
|
<span class="qm-row-handle" aria-hidden="true"></span>
|
|
1279
1290
|
<span class="qm-control-box qm-element-summary">
|
|
1280
1291
|
<Icon name="chevron-right" class="qm-el-chevron" size={CHEVRON} />
|
|
1281
|
-
<span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
|
|
1282
1292
|
{#if firstShortText(items?.properties, (after ?? {}) as Record<string, unknown>)}
|
|
1283
1293
|
<span class="qm-element-preview"
|
|
1284
1294
|
>{firstShortText(items?.properties, (after ?? {}) as Record<string, unknown>)}</span
|
|
1285
1295
|
>
|
|
1296
|
+
{:else}
|
|
1297
|
+
<span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
|
|
1286
1298
|
{/if}
|
|
1287
1299
|
</span>
|
|
1288
1300
|
</div>
|
|
@@ -1291,6 +1303,8 @@
|
|
|
1291
1303
|
content={() => asContent(after)}
|
|
1292
1304
|
value={after}
|
|
1293
1305
|
plaintext={items != null && literalText(items)}
|
|
1306
|
+
block={multiline}
|
|
1307
|
+
paragraphs={items != null && linesOnly(items)}
|
|
1294
1308
|
label={rowName(k)}
|
|
1295
1309
|
onChange={() => {}}
|
|
1296
1310
|
/>
|
|
@@ -1348,18 +1362,22 @@
|
|
|
1348
1362
|
effect. Its twin is Alt+↑/↓ from anywhere in the row, which a record's summary
|
|
1349
1363
|
announces, as a table's or a line's remove does for its own row. -->
|
|
1350
1364
|
{#snippet handle(k: number)}
|
|
1351
|
-
<
|
|
1352
|
-
class="qm-row-handle"
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1365
|
+
{#if ids.length < 2}
|
|
1366
|
+
<span class="qm-row-handle" aria-hidden="true"></span>
|
|
1367
|
+
{:else}
|
|
1368
|
+
<span
|
|
1369
|
+
class="qm-row-handle"
|
|
1370
|
+
aria-hidden="true"
|
|
1371
|
+
data-qm-tip={t.strings.arrayDrag}
|
|
1372
|
+
data-qm-tip-keys={keycap('Alt-↑/↓')}
|
|
1373
|
+
onpointerdown={(e) => drag.down(e, k)}
|
|
1374
|
+
onpointermove={drag.move}
|
|
1375
|
+
onpointerup={drag.up}
|
|
1376
|
+
onpointercancel={drag.up}
|
|
1377
|
+
onlostpointercapture={drag.up}
|
|
1378
|
+
><span class="qm-row-handle-bar"><Icon name="grip-vertical" /></span></span
|
|
1379
|
+
>
|
|
1380
|
+
{/if}
|
|
1363
1381
|
{/snippet}
|
|
1364
1382
|
|
|
1365
1383
|
<style>
|
|
@@ -1378,11 +1396,6 @@
|
|
|
1378
1396
|
justify-content: space-between;
|
|
1379
1397
|
gap: var(--_qm-space-2);
|
|
1380
1398
|
}
|
|
1381
|
-
/* Under a label that carries its description in flow, the chip keeps the label's
|
|
1382
|
-
line rather than centring on the two. */
|
|
1383
|
-
.qm-array-header:has(> :global(.qm-field-label-row.briefed)) {
|
|
1384
|
-
align-items: baseline;
|
|
1385
|
-
}
|
|
1386
1399
|
.qm-array-add-slot {
|
|
1387
1400
|
display: inline-flex;
|
|
1388
1401
|
align-items: center;
|
|
@@ -1470,16 +1483,18 @@
|
|
|
1470
1483
|
`.qm-icon-btn`'s radius, which is the same rung the box draws; a slab standing before
|
|
1471
1484
|
another gives up its corners on both sides.
|
|
1472
1485
|
|
|
1473
|
-
It
|
|
1474
|
-
|
|
1475
|
-
|
|
1486
|
+
It waits for its row as the handle does (INVARIANTS §"A field's own chrome waits for
|
|
1487
|
+
the field"): a destructive control is offered by the row the pointer is on or the
|
|
1488
|
+
focus is in, not by every row at once, holding its box meanwhile and arriving by
|
|
1489
|
+
opacity, and resting drawn where nothing hovers. Hover is where the remove says
|
|
1490
|
+
destructive, ink with fill, a tint alone being a wash under a label-toned glyph. */
|
|
1476
1491
|
.qm-row-actions {
|
|
1477
1492
|
position: absolute;
|
|
1478
1493
|
inset-block: 0;
|
|
1479
1494
|
inset-inline-end: 0;
|
|
1480
1495
|
display: flex;
|
|
1481
1496
|
color: var(--_qm-ink-label);
|
|
1482
|
-
opacity:
|
|
1497
|
+
opacity: 0;
|
|
1483
1498
|
transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
1484
1499
|
}
|
|
1485
1500
|
.qm-row-btn {
|
|
@@ -1503,6 +1518,11 @@
|
|
|
1503
1518
|
.qm-array-row:focus-within > .qm-element-head > .qm-row-actions {
|
|
1504
1519
|
opacity: 1;
|
|
1505
1520
|
}
|
|
1521
|
+
@media (hover: none) {
|
|
1522
|
+
.qm-row-actions {
|
|
1523
|
+
opacity: 1;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1506
1526
|
.qm-remove:hover:not(:disabled) {
|
|
1507
1527
|
background: var(--_qm-danger-tint);
|
|
1508
1528
|
color: var(--_qm-danger);
|
|
@@ -1510,8 +1530,8 @@
|
|
|
1510
1530
|
/* The handle is a table grip's twin (prose.css §"One grip per line"): a pill carrying
|
|
1511
1531
|
the grip's marks, hung off the row's start edge in the `--_qm-nest` every row stands
|
|
1512
1532
|
in from the stroke outside it, which a group's panel clips at. The pill rests
|
|
1513
|
-
at nothing,
|
|
1514
|
-
on, staying up through the drag it carries; a band flush with the row keeps the
|
|
1533
|
+
at nothing, as the remove does, and comes up with the row the pointer is
|
|
1534
|
+
on or the focus is in, staying up through the drag it carries; with no hover, the row the focus is in alone; a band flush with the row keeps the
|
|
1515
1535
|
pointer on the row all the way to it. The pointer owns the gesture, not the page's
|
|
1516
1536
|
scroll. A record's pill centres on its summary; a line's and a table row's stand on
|
|
1517
1537
|
the first line, which a wrapping cell grows away from. */
|
|
@@ -1527,6 +1547,9 @@
|
|
|
1527
1547
|
cursor: grab;
|
|
1528
1548
|
touch-action: none;
|
|
1529
1549
|
}
|
|
1550
|
+
.qm-row-handle:empty {
|
|
1551
|
+
cursor: auto;
|
|
1552
|
+
}
|
|
1530
1553
|
.qm-row-handle-bar {
|
|
1531
1554
|
display: flex;
|
|
1532
1555
|
align-items: center;
|
|
@@ -1549,7 +1572,9 @@
|
|
|
1549
1572
|
height: var(--_qm-space-3);
|
|
1550
1573
|
}
|
|
1551
1574
|
.qm-array-row:hover > .qm-row-handle > .qm-row-handle-bar,
|
|
1575
|
+
.qm-array-row:focus-within > .qm-row-handle > .qm-row-handle-bar,
|
|
1552
1576
|
.qm-array-row:hover > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
|
|
1577
|
+
.qm-array-row:focus-within > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
|
|
1553
1578
|
.qm-array-row.lifted > .qm-row-handle > .qm-row-handle-bar,
|
|
1554
1579
|
.qm-element.lifted > .qm-element-head > .qm-row-handle > .qm-row-handle-bar {
|
|
1555
1580
|
opacity: 1;
|
|
@@ -1654,17 +1679,23 @@
|
|
|
1654
1679
|
.qm-element.open > .qm-element-head :global(.qm-el-chevron) {
|
|
1655
1680
|
transform: rotate(90deg);
|
|
1656
1681
|
}
|
|
1657
|
-
/* The title is the row's name,
|
|
1658
|
-
the
|
|
1659
|
-
.qm-element-title
|
|
1682
|
+
/* The title is the row's name, and the words a closed record shows in its place, at
|
|
1683
|
+
the ink as a card's is, on one line however long they run. */
|
|
1684
|
+
.qm-element-title,
|
|
1685
|
+
.qm-element-preview {
|
|
1660
1686
|
overflow: hidden;
|
|
1661
1687
|
text-overflow: ellipsis;
|
|
1662
1688
|
white-space: nowrap;
|
|
1663
1689
|
color: var(--_qm-ink);
|
|
1690
|
+
}
|
|
1691
|
+
.qm-element-title {
|
|
1664
1692
|
font-variant-numeric: tabular-nums;
|
|
1665
1693
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1694
|
+
.qm-element-preview {
|
|
1695
|
+
flex: 1 1 0;
|
|
1696
|
+
min-width: 0;
|
|
1697
|
+
text-align: start;
|
|
1698
|
+
}
|
|
1668
1699
|
.qm-review-tag {
|
|
1669
1700
|
flex: none;
|
|
1670
1701
|
margin-inline-start: auto;
|
|
@@ -1672,18 +1703,6 @@
|
|
|
1672
1703
|
font-weight: var(--_qm-weight-mid);
|
|
1673
1704
|
color: var(--_qm-ink-label);
|
|
1674
1705
|
}
|
|
1675
|
-
.qm-element-preview {
|
|
1676
|
-
flex: 1 1 0;
|
|
1677
|
-
min-width: 0;
|
|
1678
|
-
overflow: hidden;
|
|
1679
|
-
text-overflow: ellipsis;
|
|
1680
|
-
white-space: nowrap;
|
|
1681
|
-
text-align: start;
|
|
1682
|
-
color: var(--_qm-ink-label);
|
|
1683
|
-
}
|
|
1684
|
-
.qm-element-summary:has(.qm-element-preview) > .qm-element-title {
|
|
1685
|
-
flex-shrink: 0;
|
|
1686
|
-
}
|
|
1687
1706
|
/* ── A table ────────────────────────────────────────────────────────────────
|
|
1688
1707
|
Every row of it is open, so it stands where an open row's subform stands: a rung
|
|
1689
1708
|
inside the field, behind the subform's vertical and between its caps (`ObjectField`,
|
|
@@ -1919,10 +1938,4 @@
|
|
|
1919
1938
|
.qm-add-el:disabled {
|
|
1920
1939
|
opacity: var(--_qm-opacity-idle);
|
|
1921
1940
|
}
|
|
1922
|
-
/* No hover to come up on: the handle stands with the controls, already at rest. */
|
|
1923
|
-
@media (hover: none) {
|
|
1924
|
-
.qm-row-handle-bar {
|
|
1925
|
-
opacity: 1;
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
1928
1941
|
</style>
|
|
@@ -9,11 +9,9 @@
|
|
|
9
9
|
on touch, which leaves guidance the reference quill puts on nearly every field
|
|
10
10
|
reachable on a tablet only through a screen reader.
|
|
11
11
|
|
|
12
|
-
Floating, for
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
density the card is built to avoid. A short one stands under its label instead
|
|
16
|
-
({@link FieldLabel}) and raises no marker.
|
|
12
|
+
Floating, for every description: the reference quill's descriptions run to a median
|
|
13
|
+
of ~110 characters and past 250 at the tail, and permanently in flow that is several
|
|
14
|
+
wrapped lines under every field, which is the density the card is built to avoid.
|
|
17
15
|
|
|
18
16
|
The popover is chrome, not the announcement. Its content is `aria-hidden`: the
|
|
19
17
|
description reaches assistive tech through the always-present parked node
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
hands the click to `onActivate`. Both halves are needed: `for` on a non-labelable
|
|
11
11
|
element is inert and invalid.
|
|
12
12
|
|
|
13
|
-
One non-gating label decoration: the `description
|
|
14
|
-
|
|
15
|
-
control. A longer one is an info marker raising a themed popover ({@link FieldHint}).
|
|
13
|
+
One non-gating label decoration: the `description`, an info marker raising a themed
|
|
14
|
+
popover ({@link FieldHint}), whatever its length.
|
|
16
15
|
|
|
17
16
|
The row's end says where the field stands against its `default:` (INVARIANTS §"The
|
|
18
17
|
commitment ladder"). While the default is what prints, a tag says so in words, and the
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
holds the way back: one button for every control, arriving with the field's hover or
|
|
21
20
|
focus as the guidance marker does, and named for its field.
|
|
22
21
|
|
|
23
|
-
The description describes, it does not name.
|
|
22
|
+
The description describes, it does not name. It is parked in an
|
|
24
23
|
always-present visually-hidden node here and the control carries `aria-describedby`: name then
|
|
25
24
|
role then description, which is the announcement the markup visually implies. In
|
|
26
25
|
the name it would instead prepend ~110 characters of guidance (the reference
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
-->
|
|
34
33
|
<script lang="ts">
|
|
35
34
|
import FieldHint from './FieldHint.svelte';
|
|
36
|
-
import { guidanceText
|
|
35
|
+
import { guidanceText } from './guidance.js';
|
|
37
36
|
import { wording } from './strings.js';
|
|
38
37
|
import './controls.css';
|
|
39
38
|
|
|
@@ -52,9 +51,6 @@
|
|
|
52
51
|
onActivate?: () => void;
|
|
53
52
|
/** Schema `description`, or undefined: the affordance renders only when set. */
|
|
54
53
|
description?: string;
|
|
55
|
-
/** A short description stands under the label ({@link isBrief}). Off where the
|
|
56
|
-
* row has no second line to give, a table column's head. */
|
|
57
|
-
brief?: boolean;
|
|
58
54
|
/** A capped field's character count, drawn at the row's end. */
|
|
59
55
|
count?: string;
|
|
60
56
|
/** The count's own id, for the control's `aria-describedby`. */
|
|
@@ -73,7 +69,6 @@
|
|
|
73
69
|
descriptionId,
|
|
74
70
|
onActivate,
|
|
75
71
|
description,
|
|
76
|
-
brief = true,
|
|
77
72
|
count,
|
|
78
73
|
countId,
|
|
79
74
|
defaulted = false,
|
|
@@ -82,14 +77,9 @@
|
|
|
82
77
|
}: Props = $props();
|
|
83
78
|
|
|
84
79
|
const resetId = $props.id();
|
|
85
|
-
const inFlow = $derived(brief && description != null && isBrief(description));
|
|
86
|
-
/** The description is DOM, not text (`renderGuidance`), so it is written in. */
|
|
87
|
-
function paint(line: HTMLElement): void {
|
|
88
|
-
line.replaceChildren(renderGuidance(description ?? ''));
|
|
89
|
-
}
|
|
90
80
|
</script>
|
|
91
81
|
|
|
92
|
-
<div class=
|
|
82
|
+
<div class="qm-field-label-row">
|
|
93
83
|
<!-- svelte-ignore a11y_no_noninteractive_element_interactions, a11y_click_events_have_key_events -->
|
|
94
84
|
<!-- The handler stands in for exactly what `for` would have done, on the controls
|
|
95
85
|
where `for` is inert. It adds no keyboard surface because it needs none: a
|
|
@@ -103,10 +93,7 @@
|
|
|
103
93
|
>
|
|
104
94
|
<span>{label}</span>
|
|
105
95
|
</label>
|
|
106
|
-
{#if
|
|
107
|
-
<!-- The node that describes the control is the line a reader sees. -->
|
|
108
|
-
<div class="qm-field-brief" id={descriptionId} {@attach paint}></div>
|
|
109
|
-
{:else if description}
|
|
96
|
+
{#if description}
|
|
110
97
|
<!-- Outside the `<label>`, both of them: a trigger inside it would put its own
|
|
111
98
|
name in the control's, and the parked copy would put all ~110 characters
|
|
112
99
|
there. A `<button>` in a label is at least safe from the other hazard:
|
|
@@ -154,29 +141,6 @@
|
|
|
154
141
|
color: var(--_qm-ink-label);
|
|
155
142
|
min-width: 0;
|
|
156
143
|
}
|
|
157
|
-
/* A short description, in flow: the row's own second line, so the field's grid still
|
|
158
|
-
counts one label track and a row-sharing neighbour's control starts level. Last
|
|
159
|
-
whatever stands at the first line's end. One weight under the label, which names
|
|
160
|
-
where this only describes. */
|
|
161
|
-
.qm-field-label-row.briefed {
|
|
162
|
-
flex-wrap: wrap;
|
|
163
|
-
row-gap: 0;
|
|
164
|
-
}
|
|
165
|
-
.qm-field-brief {
|
|
166
|
-
order: 1;
|
|
167
|
-
flex: 0 0 100%;
|
|
168
|
-
min-width: 0;
|
|
169
|
-
font-size: var(--_qm-text-label);
|
|
170
|
-
line-height: var(--_qm-leading-body);
|
|
171
|
-
color: var(--_qm-ink-label);
|
|
172
|
-
}
|
|
173
|
-
.qm-field-brief :global(p) {
|
|
174
|
-
margin: 0;
|
|
175
|
-
}
|
|
176
|
-
.qm-field-brief :global(code) {
|
|
177
|
-
font-family: var(--_qm-font-mono);
|
|
178
|
-
font-size: inherit;
|
|
179
|
-
}
|
|
180
144
|
.qm-field-count {
|
|
181
145
|
margin-inline-start: auto;
|
|
182
146
|
font-size: var(--_qm-text-label);
|
|
@@ -11,9 +11,6 @@ interface Props {
|
|
|
11
11
|
onActivate?: () => void;
|
|
12
12
|
/** Schema `description`, or undefined: the affordance renders only when set. */
|
|
13
13
|
description?: string;
|
|
14
|
-
/** A short description stands under the label ({@link isBrief}). Off where the
|
|
15
|
-
* row has no second line to give, a table column's head. */
|
|
16
|
-
brief?: boolean;
|
|
17
14
|
/** A capped field's character count, drawn at the row's end. */
|
|
18
15
|
count?: string;
|
|
19
16
|
/** The count's own id, for the control's `aria-describedby`. */
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
An open matrix's add box (INVARIANTS §"The matrix"): a plain text input. Enter adds
|
|
3
3
|
what was typed, trimmed, and clears the box, and so does the focus leaving it: words
|
|
4
4
|
typed there are an item, not a draft a click elsewhere discards. Escape clears it
|
|
5
|
-
unadded. It is
|
|
6
|
-
it adds, unwritten: the plus in the tick's column and the words in the title's.
|
|
5
|
+
unadded. It is a box the width of the list, the plus inside it at its start.
|
|
7
6
|
-->
|
|
8
7
|
<script lang="ts">
|
|
9
8
|
import Icon from './icons/Icon.svelte';
|
|
@@ -66,21 +65,22 @@
|
|
|
66
65
|
.qm-matrix-add {
|
|
67
66
|
min-width: 0;
|
|
68
67
|
}
|
|
69
|
-
/*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
so a press on the glyph lands in the box. */
|
|
68
|
+
/* The glyph stands inside the box, at its start inset, as a list's standing row draws
|
|
69
|
+
its words inside its own: the box is the whole row, and the input's words start a
|
|
70
|
+
gap past the glyph. A `<label>`, so a press on the glyph lands in the box. */
|
|
73
71
|
.qm-matrix-add-field {
|
|
72
|
+
position: relative;
|
|
74
73
|
display: flex;
|
|
75
74
|
align-items: center;
|
|
76
|
-
gap: var(--_qm-space-2);
|
|
77
75
|
min-width: 0;
|
|
78
76
|
}
|
|
79
77
|
.qm-matrix-add :global(.qm-matrix-add-glyph) {
|
|
80
|
-
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset-inline-start: var(--_qm-space-3);
|
|
81
80
|
width: var(--_qm-glyph-control);
|
|
82
81
|
height: var(--_qm-glyph-control);
|
|
83
82
|
color: var(--_qm-ink-label);
|
|
83
|
+
pointer-events: none;
|
|
84
84
|
}
|
|
85
85
|
/* At rest the box is the add chip it stands in for: no well, and its words at the
|
|
86
86
|
label ink in full, as the add chip's are: words take the text floor, not the rest rung
|
|
@@ -88,8 +88,7 @@
|
|
|
88
88
|
.qm-matrix-add-field .qm-input {
|
|
89
89
|
flex: 1;
|
|
90
90
|
min-width: 0;
|
|
91
|
-
|
|
92
|
-
padding-inline-start: var(--_qm-space-2);
|
|
91
|
+
padding-inline-start: calc(var(--_qm-space-3) + var(--_qm-glyph-control) + var(--_qm-space-2));
|
|
93
92
|
transition: background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
94
93
|
}
|
|
95
94
|
.qm-matrix-add-field .qm-input:placeholder-shown:not(:focus) {
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
list, one member to a row, or abreast on the section's track ladder under
|
|
5
5
|
`ui.compact`; each member is a real checkbox whose checked state is the member's
|
|
6
6
|
presence, with its title as the `<label for>`, an unheld member reading at the label
|
|
7
|
-
ink and a held one at the value ink. A held member
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
ink and a held one at the value ink. A held member rests as one line, its title then
|
|
8
|
+
the words of its first one-line text column at the label ink, and a disclosure there
|
|
9
|
+
unfolds its columns beneath it, drawn by {@link ObjectField} over the matrix's
|
|
10
|
+
`properties` at the member's key, in the member's own track, so opening one moves no
|
|
11
|
+
other. A tick, an add and a landing unfold the member, as does a proposal or a
|
|
12
|
+
diagnostic on one of its columns; zero columns is a checklist and unfolds nothing.
|
|
10
13
|
|
|
11
14
|
An open matrix's added items follow the roster in id order, as the plate prints them:
|
|
12
15
|
held by being present, so each draws a fixed tick, its `title` as an input, a remove,
|
|
@@ -27,6 +30,7 @@
|
|
|
27
30
|
-->
|
|
28
31
|
<script lang="ts">
|
|
29
32
|
import { onDestroy, tick as flush } from 'svelte';
|
|
33
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
30
34
|
import { wording } from './strings.js';
|
|
31
35
|
import { structuralUndo } from './undo.svelte.js';
|
|
32
36
|
|
|
@@ -45,6 +49,7 @@
|
|
|
45
49
|
baseType,
|
|
46
50
|
commitMember,
|
|
47
51
|
declaredContent,
|
|
52
|
+
firstShortText,
|
|
48
53
|
matrixColumns,
|
|
49
54
|
matrixDeclares,
|
|
50
55
|
matrixEmpty,
|
|
@@ -165,6 +170,25 @@
|
|
|
165
170
|
/** An added item's title input: the `title` cell's own control id. */
|
|
166
171
|
const itemTitleId = (id: string): string => propertyDomIds(memberBase(id), MATRIX_TITLE).control;
|
|
167
172
|
|
|
173
|
+
/** The disclosure glyph, at the size an array row's takes. */
|
|
174
|
+
const CHEVRON = 16;
|
|
175
|
+
/** The held items whose details are unfolded, for this mount: a held item rests as one
|
|
176
|
+
* line, and a tick or an add opens it, its details being what the author came to fill. */
|
|
177
|
+
const expanded = new SvelteSet<string>();
|
|
178
|
+
/** Whether a held item's details are drawn: unfolded by the reader, or holding a
|
|
179
|
+
* proposal or a diagnostic for one of its cells, each drawn on its cell. */
|
|
180
|
+
const isOpen = (id: string): boolean =>
|
|
181
|
+
hasColumns &&
|
|
182
|
+
(expanded.has(id) ||
|
|
183
|
+
cellReview(id).length > 0 ||
|
|
184
|
+
(routed.below.get(id)?.some((d) => d.steps[0] !== MATRIX_TITLE) ?? false));
|
|
185
|
+
/** What a folded item shows of its details: the words an array row's summary reads. */
|
|
186
|
+
const tail = (id: string): string | undefined =>
|
|
187
|
+
firstShortText(schema.properties, shownColumns(id));
|
|
188
|
+
function toggle(id: string): void {
|
|
189
|
+
if (expanded.has(id)) expanded.delete(id);
|
|
190
|
+
else expanded.add(id);
|
|
191
|
+
}
|
|
168
192
|
/** The columns an untick took, by member id, for a retick in this mount to restore. */
|
|
169
193
|
const stash = new Map<string, Record<string, unknown>>();
|
|
170
194
|
/** Commit the map; one holding nothing is the field's empty answer (`matrixEmpty`). */
|
|
@@ -215,6 +239,8 @@
|
|
|
215
239
|
async function tick(id: string, on: boolean, el: HTMLInputElement): Promise<void> {
|
|
216
240
|
const item = proposal(id);
|
|
217
241
|
const cells = cellReview(id);
|
|
242
|
+
if (on) expanded.add(id);
|
|
243
|
+
else expanded.delete(id);
|
|
218
244
|
if (item && on === matrixHeld(item.after)) reviewing.act(item.id, 'accept');
|
|
219
245
|
else if (!item && !on && !held(id) && cells.length)
|
|
220
246
|
for (const { item: cell } of cells) reviewing.act(cell.id, 'dismiss');
|
|
@@ -268,6 +294,7 @@
|
|
|
268
294
|
undo.withdraw();
|
|
269
295
|
const id = addedId(title, taken);
|
|
270
296
|
commit(commitMember(map, id, memberWrite({}, title)));
|
|
297
|
+
expanded.add(id);
|
|
271
298
|
await flush();
|
|
272
299
|
const box = own(memberEls, id);
|
|
273
300
|
// The item's columns are what the author came to fill; a checklist has none, and
|
|
@@ -307,11 +334,16 @@
|
|
|
307
334
|
return undefined;
|
|
308
335
|
}
|
|
309
336
|
const column = rest[0];
|
|
310
|
-
const cells = own(colEls, id);
|
|
311
337
|
const member = own(memberEls, id);
|
|
312
|
-
if (column !== undefined && column !== MATRIX_TITLE &&
|
|
313
|
-
const
|
|
314
|
-
|
|
338
|
+
if (column !== undefined && column !== MATRIX_TITLE && hasColumns && shownHeld(id)) {
|
|
339
|
+
const into = (cells: Subform | undefined): LandingBox => {
|
|
340
|
+
if (!cells) return member;
|
|
341
|
+
const inner = cells.focusPath(rest, pos);
|
|
342
|
+
return inner instanceof Promise ? inner.then((box) => box ?? member) : (inner ?? member);
|
|
343
|
+
};
|
|
344
|
+
if (own(colEls, id)) return into(own(colEls, id));
|
|
345
|
+
expanded.add(id);
|
|
346
|
+
return flush().then(() => into(own(colEls, id)));
|
|
315
347
|
}
|
|
316
348
|
(own(tickEls, id) ?? own(titleEls, id))?.focus();
|
|
317
349
|
return member;
|
|
@@ -342,7 +374,7 @@
|
|
|
342
374
|
{#each members as m (m.id)}
|
|
343
375
|
{@const on = shownHeld(m.id)}
|
|
344
376
|
<div
|
|
345
|
-
class={['qm-member qm-wash', { held: on, open: on &&
|
|
377
|
+
class={['qm-member qm-wash', { held: on, open: on && isOpen(m.id) }]}
|
|
346
378
|
data-qm-prop={m.id}
|
|
347
379
|
bind:this={memberEls[m.id]}
|
|
348
380
|
>
|
|
@@ -364,6 +396,9 @@
|
|
|
364
396
|
</span>
|
|
365
397
|
<ReviewRows entries={reviewed.below.get(m.id)?.filter((e) => !e.steps.length)} />
|
|
366
398
|
<label class="qm-member-title" id={titleId(m.id)} for={tickId(m.id)}>{m.title}</label>
|
|
399
|
+
{#if on && hasColumns}
|
|
400
|
+
{@render disclosure(m.id, m.title)}
|
|
401
|
+
{/if}
|
|
367
402
|
</div>
|
|
368
403
|
{@render columns(m.id, m.title, on)}
|
|
369
404
|
</div>
|
|
@@ -371,7 +406,7 @@
|
|
|
371
406
|
{#each added as item, k (item.id)}
|
|
372
407
|
{@const name = item.title || t.strings.matrixItemTitle(label ?? '', k + 1)}
|
|
373
408
|
<div
|
|
374
|
-
class={['qm-member qm-wash held added', { open:
|
|
409
|
+
class={['qm-member qm-wash held added', { open: isOpen(item.id) }]}
|
|
375
410
|
data-qm-prop={item.id}
|
|
376
411
|
bind:this={memberEls[item.id]}
|
|
377
412
|
>
|
|
@@ -392,6 +427,9 @@
|
|
|
392
427
|
oninput={(e) => retitle(item.id, e.currentTarget.value)}
|
|
393
428
|
/>
|
|
394
429
|
<span class="qm-member-title" id={titleId(item.id)} hidden>{name}</span>
|
|
430
|
+
{#if hasColumns}
|
|
431
|
+
{@render disclosure(item.id, name)}
|
|
432
|
+
{/if}
|
|
395
433
|
<button
|
|
396
434
|
type="button"
|
|
397
435
|
class="qm-icon-btn qm-focus-ring qm-member-remove"
|
|
@@ -421,7 +459,7 @@
|
|
|
421
459
|
a tick elsewhere leaves this subform mounted and the caret in it. -->
|
|
422
460
|
{#snippet columns(id: string, title: string, on: boolean)}
|
|
423
461
|
{@const deep = routed.below.get(id)}
|
|
424
|
-
{#if on &&
|
|
462
|
+
{#if on && isOpen(id)}
|
|
425
463
|
<ObjectField
|
|
426
464
|
bind:this={colEls[id]}
|
|
427
465
|
value={shownColumns(id)}
|
|
@@ -442,6 +480,22 @@
|
|
|
442
480
|
{/if}
|
|
443
481
|
{/snippet}
|
|
444
482
|
|
|
483
|
+
<!-- A held item's disclosure: its details' first line of words, muted after the name,
|
|
484
|
+
and the chevron that unfolds them, the way a record row opens. -->
|
|
485
|
+
{#snippet disclosure(id: string, title: string)}
|
|
486
|
+
{@const words = isOpen(id) ? undefined : tail(id)}
|
|
487
|
+
<button
|
|
488
|
+
type="button"
|
|
489
|
+
class="qm-focus-ring qm-member-summary"
|
|
490
|
+
aria-expanded={isOpen(id)}
|
|
491
|
+
aria-label={t.strings.matrixDetails(title)}
|
|
492
|
+
onclick={() => toggle(id)}
|
|
493
|
+
>
|
|
494
|
+
<span class="qm-member-tail">{words ?? ''}</span>
|
|
495
|
+
<Icon name="chevron-right" class="qm-member-chevron" size={CHEVRON} />
|
|
496
|
+
</button>
|
|
497
|
+
{/snippet}
|
|
498
|
+
|
|
445
499
|
<style>
|
|
446
500
|
.qm-matrix {
|
|
447
501
|
display: flex;
|
|
@@ -456,11 +510,6 @@
|
|
|
456
510
|
justify-content: space-between;
|
|
457
511
|
gap: var(--_qm-space-2);
|
|
458
512
|
}
|
|
459
|
-
/* Under a label that carries its description in flow, the count keeps the label's
|
|
460
|
-
line rather than centring on the two. */
|
|
461
|
-
.qm-matrix-header:has(> :global(.qm-field-label-row.briefed)) {
|
|
462
|
-
align-items: baseline;
|
|
463
|
-
}
|
|
464
513
|
/* The count reads at the label rung: a fact about the field, never a value. */
|
|
465
514
|
.qm-matrix-count {
|
|
466
515
|
font-size: var(--_qm-text-label);
|
|
@@ -500,6 +549,49 @@
|
|
|
500
549
|
.qm-matrix-roster:not(.compact) > .qm-member.open {
|
|
501
550
|
margin-block: var(--_qm-space);
|
|
502
551
|
}
|
|
552
|
+
/* The rest of the line is the disclosure: the details' words at the label ink, cut
|
|
553
|
+
to the line, then the chevron, which turns down as the details open. */
|
|
554
|
+
.qm-member-summary {
|
|
555
|
+
flex: 1;
|
|
556
|
+
min-width: 0;
|
|
557
|
+
align-self: stretch;
|
|
558
|
+
display: flex;
|
|
559
|
+
align-items: center;
|
|
560
|
+
gap: var(--_qm-space);
|
|
561
|
+
padding: 0;
|
|
562
|
+
margin: 0;
|
|
563
|
+
border: none;
|
|
564
|
+
border-radius: var(--_qm-radius-inner);
|
|
565
|
+
background: transparent;
|
|
566
|
+
font: inherit;
|
|
567
|
+
color: var(--_qm-ink-label);
|
|
568
|
+
text-align: start;
|
|
569
|
+
cursor: pointer;
|
|
570
|
+
}
|
|
571
|
+
.qm-member-tail {
|
|
572
|
+
flex: 1;
|
|
573
|
+
min-width: 0;
|
|
574
|
+
overflow: hidden;
|
|
575
|
+
white-space: nowrap;
|
|
576
|
+
text-overflow: ellipsis;
|
|
577
|
+
font-size: var(--_qm-text-body);
|
|
578
|
+
line-height: var(--_qm-leading-tight);
|
|
579
|
+
}
|
|
580
|
+
.qm-member-summary :global(.qm-member-chevron) {
|
|
581
|
+
flex-shrink: 0;
|
|
582
|
+
stroke-width: var(--_qm-glyph-stroke);
|
|
583
|
+
opacity: var(--_qm-opacity-rest);
|
|
584
|
+
transition:
|
|
585
|
+
transform var(--_qm-duration-slow) var(--_qm-ease-reverse),
|
|
586
|
+
opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
587
|
+
}
|
|
588
|
+
.qm-member-summary:hover :global(.qm-member-chevron),
|
|
589
|
+
.qm-member-summary:focus-visible :global(.qm-member-chevron) {
|
|
590
|
+
opacity: 1;
|
|
591
|
+
}
|
|
592
|
+
.qm-member-summary[aria-expanded='true'] :global(.qm-member-chevron) {
|
|
593
|
+
transform: rotate(90deg);
|
|
594
|
+
}
|
|
503
595
|
/* The tick and its title on one line, the line holding the tap floor a tick alone
|
|
504
596
|
would not reach: the title is the target, the `for` carrying its press to the input. */
|
|
505
597
|
.qm-member-head {
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
heldAttributes,
|
|
59
59
|
joinLines,
|
|
60
60
|
leafSchema,
|
|
61
|
+
isParagraphsSchema,
|
|
61
62
|
pastedLines,
|
|
62
63
|
pmToContent,
|
|
63
64
|
proseAttributes,
|
|
@@ -278,7 +279,8 @@
|
|
|
278
279
|
// Which of `aria-label` / `aria-labelledby` wins is the codec's one answer
|
|
279
280
|
// (`proseAttributes`), so a cell carrying a label element and a row carrying
|
|
280
281
|
// none cannot name their regions by different rules.
|
|
281
|
-
const
|
|
282
|
+
const lineLeaf = isParagraphsSchema(leafSchema({ plaintext, inline, paragraphs }));
|
|
283
|
+
const plainNamed = () => proseAttributes(names(), !inline, lineLeaf);
|
|
282
284
|
const heldNamed = () => heldAttributes(names(), heldId);
|
|
283
285
|
const build = (rt: Content): EditorState => {
|
|
284
286
|
// The same keymap and plugin stack a `createField` leaf mounts (shared
|
|
@@ -8,9 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
It sits under the block the change flows in, so it covers no line of its paragraph, or beside
|
|
10
10
|
that block's last line where the line ends short of it, centred on a block of one line such as a
|
|
11
|
-
one-line field's, right-aligned to the
|
|
11
|
+
one-line field's, right-aligned to the column the
|
|
12
12
|
change stands in, and flips above that block where there is no room below, keeping clear of the
|
|
13
|
-
host's chrome at the pane's foot (`inset`).
|
|
13
|
+
host's chrome at the pane's foot (`inset`). The column is the card's body or its form whole,
|
|
14
|
+
never the one field, so Accept stands at one edge from change to change and a pointer answering
|
|
15
|
+
a run of them does not hunt for it. A field or a property sharing its row with others takes the
|
|
16
|
+
card beside its line only where the card stands within its own slot, and under the row
|
|
17
|
+
otherwise: beside the line of one that ends short of the column's edge the card covers the
|
|
18
|
+
value of the next. Over a change taller than the pane it stays pinned
|
|
14
19
|
at the foot while any of the change shows. A change out of the pane keeps its card where it
|
|
15
20
|
would stand beside it, so the card scrolls out with the text and the pane's edge clips it as it
|
|
16
21
|
clips the text.
|
|
@@ -110,13 +115,15 @@
|
|
|
110
115
|
const h = el.offsetHeight;
|
|
111
116
|
const w = el.offsetWidth;
|
|
112
117
|
const column = (els[0].closest(
|
|
113
|
-
'.qm-
|
|
118
|
+
'.qm-fields, .qm-card, .qm-review-card-add, .qm-review-card-remove'
|
|
114
119
|
) ?? root)!;
|
|
115
120
|
left = Math.max(view.left + gap, column.getBoundingClientRect().right - w);
|
|
116
121
|
const at = (root ?? el).getBoundingClientRect();
|
|
117
122
|
const last = blocks.find((b, i) => b !== els[i] && b.getBoundingClientRect().bottom === lower);
|
|
118
123
|
const tuck = last && lastLine(last, h);
|
|
119
|
-
const
|
|
124
|
+
const slot = last?.closest('.qm-object-prop, .qm-field')?.getBoundingClientRect();
|
|
125
|
+
const beside = tuck && tuck.right + gap <= left && (!slot || left + w <= slot.right + 1);
|
|
126
|
+
const below = beside ? tuck.top : lower + gap;
|
|
120
127
|
const above = upper - gap - h;
|
|
121
128
|
const fits = below + h <= floor || above >= ceil;
|
|
122
129
|
const y =
|
|
@@ -1580,7 +1580,8 @@
|
|
|
1580
1580
|
* Bring the review item `id` to the reader as the current change: open the panel holding
|
|
1581
1581
|
* it and scroll it to the middle of the view. The focus stays where it is, the reader having
|
|
1582
1582
|
* asked to look, unless `focus` asks for it: the caret then goes into the item, or the focus
|
|
1583
|
-
* to
|
|
1583
|
+
* to the control drawing it, a property inside a field included. False for an item the
|
|
1584
|
+
* editor does not draw.
|
|
1584
1585
|
*/
|
|
1585
1586
|
export function revealReview(id: string, opts: { focus?: boolean } = {}): Promise<boolean> {
|
|
1586
1587
|
return reveal(id, opts.focus ?? false, false);
|
|
@@ -1599,8 +1600,12 @@
|
|
|
1599
1600
|
}
|
|
1600
1601
|
if (!(await span.resumes(tick()))) return false;
|
|
1601
1602
|
reviewing.reveal(id);
|
|
1602
|
-
if (focus && key !== undefined && !leaves.prose(key)?.enterReview(id))
|
|
1603
|
-
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
|
+
}
|
|
1604
1609
|
// The current item is drawn again, so its element is read once it has been.
|
|
1605
1610
|
if (!(await span.resumes(tick()))) return false;
|
|
1606
1611
|
const els = reviewEls(id);
|
|
@@ -1866,8 +1871,8 @@
|
|
|
1866
1871
|
|
|
1867
1872
|
/** Make the next or previous open item current, in document order and round from either
|
|
1868
1873
|
* end, from the current item or the one last stepped to: the caret in it, or the focus in
|
|
1869
|
-
*
|
|
1870
|
-
* Resolves its id, `undefined` when none is drawn. */
|
|
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. */
|
|
1871
1876
|
export function stepReview(
|
|
1872
1877
|
dir: 1 | -1,
|
|
1873
1878
|
opts: { focus?: boolean; group?: string } = {}
|
|
@@ -2347,18 +2352,20 @@
|
|
|
2347
2352
|
}
|
|
2348
2353
|
/* A card proposed new and a card proposed taken out, in the review's one hue: a preview
|
|
2349
2354
|
where the new card would stand, the card's own ground under the tint, and a mark round
|
|
2350
|
-
the whole of a card that would go, its values struck as a removed row's are.
|
|
2351
|
-
|
|
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. */
|
|
2352
2358
|
.qm-review-card-remove {
|
|
2353
2359
|
display: contents;
|
|
2354
2360
|
}
|
|
2355
2361
|
.qm-review-card-remove.qm-review-on {
|
|
2356
2362
|
display: block;
|
|
2357
2363
|
border-radius: var(--_qm-radius);
|
|
2358
|
-
|
|
2364
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2359
2365
|
}
|
|
2360
2366
|
.qm-review-card-remove.qm-review-lit {
|
|
2361
|
-
|
|
2367
|
+
outline-style: solid;
|
|
2368
|
+
outline-width: var(--_qm-vertical-width);
|
|
2362
2369
|
}
|
|
2363
2370
|
.qm-review-head {
|
|
2364
2371
|
display: flex;
|
|
@@ -2392,7 +2399,8 @@
|
|
|
2392
2399
|
transform: none;
|
|
2393
2400
|
border-radius: var(--_qm-radius-inner);
|
|
2394
2401
|
background: var(--_qm-review-tint);
|
|
2395
|
-
|
|
2402
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2403
|
+
outline-offset: calc(-1 * var(--_qm-border-width));
|
|
2396
2404
|
opacity: 1;
|
|
2397
2405
|
pointer-events: none;
|
|
2398
2406
|
transition: background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
@@ -2402,11 +2410,13 @@
|
|
|
2402
2410
|
:global(.qm-review-added-box .qm-toggle)::after {
|
|
2403
2411
|
border-radius: inherit;
|
|
2404
2412
|
}
|
|
2405
|
-
/* 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. */
|
|
2406
2414
|
:global([data-qm-proposed-lit])::after,
|
|
2407
2415
|
:global(.qm-review-lit > .qm-review-added-box :is(.qm-toggle, .qm-tick))::after {
|
|
2408
2416
|
background: var(--_qm-review-lit);
|
|
2409
|
-
|
|
2417
|
+
outline-style: solid;
|
|
2418
|
+
outline-width: var(--_qm-vertical-width);
|
|
2419
|
+
outline-offset: calc(-1 * var(--_qm-vertical-width));
|
|
2410
2420
|
}
|
|
2411
2421
|
:global([data-qm-removes]) {
|
|
2412
2422
|
text-decoration: line-through;
|
|
@@ -2422,21 +2432,25 @@
|
|
|
2422
2432
|
}
|
|
2423
2433
|
:global(.qm-review-added-box :is(.qm-control-box, .qm-input)) {
|
|
2424
2434
|
background-image: linear-gradient(var(--_qm-review-tint), var(--_qm-review-tint));
|
|
2425
|
-
|
|
2435
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2436
|
+
outline-offset: calc(-1 * var(--_qm-border-width));
|
|
2426
2437
|
}
|
|
2427
2438
|
:global(.qm-review-lit > .qm-review-added-box :is(.qm-control-box, .qm-input)) {
|
|
2428
2439
|
background-image: linear-gradient(var(--_qm-review-lit), var(--_qm-review-lit));
|
|
2429
|
-
|
|
2440
|
+
outline-style: solid;
|
|
2441
|
+
outline-width: var(--_qm-vertical-width);
|
|
2442
|
+
outline-offset: calc(-1 * var(--_qm-vertical-width));
|
|
2430
2443
|
}
|
|
2431
2444
|
/* A row a proposal would take out: no tint, which only ever means "would come", but a ring
|
|
2432
2445
|
in the review line laid outside the row so it takes no room, its values struck and its
|
|
2433
2446
|
labels left alone. The current one's ring is a step stronger, as a removed card's. */
|
|
2434
2447
|
:global([data-qm-removed]) {
|
|
2435
2448
|
border-radius: var(--_qm-radius-inner);
|
|
2436
|
-
|
|
2449
|
+
outline: var(--_qm-border-width) dashed var(--_qm-review-line);
|
|
2437
2450
|
}
|
|
2438
2451
|
:global([data-qm-removed-lit]) {
|
|
2439
|
-
|
|
2452
|
+
outline-style: solid;
|
|
2453
|
+
outline-width: var(--_qm-vertical-width);
|
|
2440
2454
|
}
|
|
2441
2455
|
/* What a removed row or card holds is what the reader reads to answer it, so its words
|
|
2442
2456
|
step back to the label ink under the strike, as a struck word does in a paragraph
|
|
@@ -2451,21 +2465,11 @@
|
|
|
2451
2465
|
text-decoration-color: var(--_qm-review-line);
|
|
2452
2466
|
}
|
|
2453
2467
|
@media (forced-colors: active) {
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
:global([data-qm-proposed-lit])::after {
|
|
2458
|
-
border-style: solid;
|
|
2459
|
-
}
|
|
2460
|
-
:global([data-qm-removed]) {
|
|
2461
|
-
outline: var(--_qm-border-width) dashed Highlight;
|
|
2462
|
-
}
|
|
2463
|
-
:global([data-qm-removed-lit]) {
|
|
2464
|
-
outline-style: solid;
|
|
2465
|
-
}
|
|
2468
|
+
.qm-review-card-remove.qm-review-on,
|
|
2469
|
+
:global([data-qm-proposed])::after,
|
|
2470
|
+
:global([data-qm-removed]),
|
|
2466
2471
|
:global(.qm-review-added-box :is(.qm-control-box, .qm-toggle, .qm-tick, .qm-input)) {
|
|
2467
|
-
outline:
|
|
2468
|
-
outline-offset: calc(-1 * var(--_qm-border-width));
|
|
2472
|
+
outline-color: Highlight;
|
|
2469
2473
|
}
|
|
2470
2474
|
}
|
|
2471
2475
|
.qm-review-card-add.qm-review-lit {
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* the literal text.
|
|
7
7
|
*/
|
|
8
8
|
export declare function renderGuidance(markdown: string): Node;
|
|
9
|
-
/** Whether a description stands in flow under its label, with no marker to raise. */
|
|
10
|
-
export declare const isBrief: (description: string) => boolean;
|
|
11
9
|
/** A description as the words alone, for the node that describes its control. */
|
|
12
10
|
export declare const guidanceText: (markdown: string) => string;
|
|
13
11
|
/** Root keydown: the key raises (or lowers) the nearest guidance. A trigger's `click()`
|
package/dist/visual/guidance.js
CHANGED
|
@@ -23,12 +23,6 @@ export function renderGuidance(markdown) {
|
|
|
23
23
|
return document.createTextNode(markdown);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
/** The longest description that stands under its label: about a line at the label rung
|
|
27
|
-
* across a card, two in a half-width field. Past it the text goes behind the marker,
|
|
28
|
-
* in flow under every field being the density a card avoids (`FieldHint`). */
|
|
29
|
-
const BRIEF_MAX = 72;
|
|
30
|
-
/** Whether a description stands in flow under its label, with no marker to raise. */
|
|
31
|
-
export const isBrief = (description) => description.length <= BRIEF_MAX;
|
|
32
26
|
/** A description as the words alone, for the node that describes its control. */
|
|
33
27
|
export const guidanceText = (markdown) => renderGuidance(markdown).textContent ?? markdown;
|
|
34
28
|
/** `Mod-/`, read off `key` so a layout that shifts to reach `/` still matches; either
|
|
@@ -50,10 +44,6 @@ function guidanceTrigger(from, root) {
|
|
|
50
44
|
const trigger = root.querySelector(`.qm-field-hint[aria-describedby="${id}"]`);
|
|
51
45
|
if (trigger)
|
|
52
46
|
return trigger;
|
|
53
|
-
// A description under its label is on screen already, and the key is not the
|
|
54
|
-
// container's to answer for it.
|
|
55
|
-
if (document.getElementById(id)?.matches('.qm-field-brief'))
|
|
56
|
-
return undefined;
|
|
57
47
|
}
|
|
58
48
|
el = el.parentElement?.closest('[aria-describedby]') ?? null;
|
|
59
49
|
}
|
package/dist/visual/strings.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings, Shortcu
|
|
|
131
131
|
matrixItemTitle: (list: string, index: number) => string;
|
|
132
132
|
/** An added item's remove control, named for the item. */
|
|
133
133
|
matrixRemove: (title: string) => string;
|
|
134
|
+
/** A held item's disclosure, named for the item: it opens and closes its details. */
|
|
135
|
+
matrixDetails: (title: string) => string;
|
|
134
136
|
/** The date field's toggle, pressed while the field holds `today`: the render
|
|
135
137
|
* date rather than a written one. */
|
|
136
138
|
dateToday: string;
|
package/dist/visual/strings.js
CHANGED
|
@@ -150,6 +150,7 @@ export const DEFAULT_VISUAL_STRINGS = {
|
|
|
150
150
|
matrixAdd: (list) => (list ? `Add to ${list}…` : 'Add…'),
|
|
151
151
|
matrixItemTitle: (list, index) => `${list ? `${list} item` : 'Item'} ${index}`,
|
|
152
152
|
matrixRemove: (title) => `Remove ${title}`,
|
|
153
|
+
matrixDetails: (title) => `${title} details`,
|
|
153
154
|
dateToday: 'Today',
|
|
154
155
|
optionalGhost: 'None',
|
|
155
156
|
proseHeld: "This field has formatting it can't edit here. It is kept as it is.",
|