@quillmark/svelte 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +13 -10
- package/dist/core/codec/field.js +30 -24
- package/dist/core/codec/index.d.ts +3 -3
- package/dist/core/codec/index.js +2 -2
- package/dist/core/codec/prose.css +14 -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 +39 -13
- 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 +190 -86
- 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 +19 -8
- package/dist/visual/FormatPopover.svelte +53 -20
- package/dist/visual/MatrixField.svelte +7 -3
- 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 +11 -6
- package/dist/visual/ProseValue.svelte.d.ts +4 -1
- package/dist/visual/ReviewCard.svelte +85 -32
- 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 +187 -275
- package/dist/visual/VisualEditorInner.svelte.d.ts +5 -1
- package/dist/visual/controls.css +2 -2
- 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 +36 -19
- package/dist/visual/strings.js +80 -24
- package/dist/visual/structure.d.ts +17 -3
- package/dist/visual/structure.js +71 -5
- package/package.json +2 -2
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
container or a block prose cell.
|
|
38
38
|
|
|
39
39
|
The row's controls are inside the element: a slab over the end of the element's own
|
|
40
|
-
box, taking its two end-side corners: the remove.
|
|
40
|
+
box, taking its two end-side corners: the remove. Every element's drag handle hangs
|
|
41
41
|
off its start edge instead, as a table grip does. So a row's box is the element's box, and an array's rows end where
|
|
42
42
|
every other field's control does. On an object element that box is the summary rather
|
|
43
43
|
than the open row: a destructive control belongs to the line it sits on, not to
|
|
44
|
-
everything that line has unfolded. A table's row carries the
|
|
45
|
-
|
|
46
|
-
the row draws
|
|
47
|
-
|
|
44
|
+
everything that line has unfolded. A table's row carries the handle in its first track
|
|
45
|
+
and the remove in its last, each pinned to its edge of the box the table scrolls in, so
|
|
46
|
+
neither control the row draws ever needs a scroll to reach. The standing row is no
|
|
47
|
+
element and carries no handle.
|
|
48
48
|
|
|
49
49
|
Keys carry the list without the mouse: Enter inserts a sibling below and takes the
|
|
50
50
|
caret there, and short of a prose line's end splits the line there, as a bulleted list
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
prose line's start joins it onto the line above and Delete at its end joins the next
|
|
53
53
|
onto it, each one commit; Backspace on an empty element removes it and hands focus back up the list, Alt+↑/↓
|
|
54
54
|
anywhere in a row of the list moves it, the nearest row answering and never
|
|
55
|
-
the record around a nested one
|
|
55
|
+
the record around a nested one: the twin of the handle's drag. A move is one splice of the ids
|
|
56
56
|
and of the values together, the mechanism insert and remove use, so an element keeps
|
|
57
57
|
its id for life and no prose leaf inside it remounts; the open row stays open across
|
|
58
58
|
its own move, and `animate:reorder` holds the moving row as it holds a card.
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
-->
|
|
90
90
|
<script lang="ts">
|
|
91
91
|
import { SvelteSet } from 'svelte/reactivity';
|
|
92
|
-
import { wording } from './strings.js';
|
|
92
|
+
import { keycap, wording } from './strings.js';
|
|
93
93
|
import { structuralUndo } from './undo.svelte.js';
|
|
94
94
|
|
|
95
95
|
// The surface's words, ambient from the editor root; the package's English
|
|
@@ -221,6 +221,20 @@
|
|
|
221
221
|
const control = $derived(items ? controlKind(items) : 'text');
|
|
222
222
|
const table = $derived(layout === 'table' && control === 'object');
|
|
223
223
|
const columns = $derived(Object.entries(items?.properties ?? {}));
|
|
224
|
+
/** A column's track. A cell that fills its width takes a share of what the field has
|
|
225
|
+
* spare, a control of one width (an enum, a date, a number) rests at its content,
|
|
226
|
+
* and a switch at its mark; every track's base is what its cells cannot shrink
|
|
227
|
+
* below, so a field too narrow for the floors scrolls sideways. */
|
|
228
|
+
const tracks = $derived(
|
|
229
|
+
columns
|
|
230
|
+
.map(([, sub]) => {
|
|
231
|
+
const kind = controlKind(sub);
|
|
232
|
+
if (kind === 'boolean') return 'auto';
|
|
233
|
+
if (kind === 'prose' || kind === 'text') return 'minmax(min-content, 1fr)';
|
|
234
|
+
return 'minmax(min-content, max-content)';
|
|
235
|
+
})
|
|
236
|
+
.join(' ')
|
|
237
|
+
);
|
|
224
238
|
const defaulted = $derived(value == null && (fallback?.length ?? 0) > 0);
|
|
225
239
|
// A bare value is the one-element list the render floor wraps it into (quillmark/INVARIANTS
|
|
226
240
|
// §"Coercion is the type predicate"), and the reader answers no element of it.
|
|
@@ -285,17 +299,15 @@
|
|
|
285
299
|
const text = rowWorded(k);
|
|
286
300
|
return text ? rowKept(k).filter((e) => e.item.id !== text.id) : rowKept(k);
|
|
287
301
|
};
|
|
288
|
-
/** What a row taken out carries: its item's id
|
|
289
|
-
*
|
|
302
|
+
/** What a row taken out carries: its item's id and the current one lit, so the row is where
|
|
303
|
+
* the answer card stands. */
|
|
290
304
|
const removedRow = (k: number) => {
|
|
291
305
|
const gone = removal(k);
|
|
292
306
|
return gone
|
|
293
307
|
? {
|
|
294
308
|
'data-qm-review': gone.id,
|
|
295
309
|
'data-qm-removed': '',
|
|
296
|
-
'data-qm-removed-lit': reviewing.lit === gone.id ? '' : undefined
|
|
297
|
-
onpointerenter: () => reviewing.point(gone.id, 'pointer'),
|
|
298
|
-
onpointerleave: () => reviewing.point(undefined, 'pointer')
|
|
310
|
+
'data-qm-removed-lit': reviewing.lit === gone.id ? '' : undefined
|
|
299
311
|
}
|
|
300
312
|
: {};
|
|
301
313
|
};
|
|
@@ -921,26 +933,31 @@
|
|
|
921
933
|
move: (k, to) => {
|
|
922
934
|
const id = ids[k];
|
|
923
935
|
move(k, to);
|
|
924
|
-
// The row
|
|
925
|
-
// back act on the row the pointer just moved.
|
|
936
|
+
// The row takes the focus, its summary or else its first control, so the keys
|
|
937
|
+
// that move it or take the move back act on the row the pointer just moved.
|
|
926
938
|
void (async () => {
|
|
927
939
|
if (!(await span.resumes(tick()))) return;
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
|
|
940
|
+
const row = rowEls[id];
|
|
941
|
+
if (!row || row.contains(document.activeElement)) return;
|
|
942
|
+
const summary = row.querySelector<HTMLElement>('.qm-element-summary');
|
|
943
|
+
if (summary) summary.focus({ preventScroll: true });
|
|
944
|
+
else if (table) cellEls[id]?.focus();
|
|
945
|
+
else focusRow(id);
|
|
931
946
|
})();
|
|
932
947
|
}
|
|
933
948
|
});
|
|
934
949
|
onDestroy(drag.release);
|
|
935
950
|
|
|
936
951
|
/** Whether cells stand past the table scroller's end edge, under the pinned remove,
|
|
937
|
-
*
|
|
952
|
+
* and past its start edge, under the pinned handle: what the fade beside each draws on. */
|
|
938
953
|
let tableOverflow = $state(false);
|
|
954
|
+
let tableScrolled = $state(false);
|
|
939
955
|
/** The head row spans every track, so its box is the content width a new row or a
|
|
940
956
|
* longer cell changes. */
|
|
941
957
|
function trackOverflow(el: HTMLElement): () => void {
|
|
942
958
|
const measure = () => {
|
|
943
959
|
tableOverflow = el.scrollWidth - el.clientWidth - Math.abs(el.scrollLeft) > 1;
|
|
960
|
+
tableScrolled = Math.abs(el.scrollLeft) > 1;
|
|
944
961
|
};
|
|
945
962
|
measure();
|
|
946
963
|
el.addEventListener('scroll', measure, { passive: true });
|
|
@@ -979,9 +996,10 @@
|
|
|
979
996
|
type="button"
|
|
980
997
|
class="qm-add-el qm-chip qm-focus-ring qm-tap-floor"
|
|
981
998
|
bind:this={addEl}
|
|
999
|
+
aria-label={t.strings.arrayAdd}
|
|
982
1000
|
aria-describedby={max != null ? countId : undefined}
|
|
983
1001
|
disabled={atCap}
|
|
984
|
-
onclick={add}>{t.strings.arrayAdd}</button
|
|
1002
|
+
onclick={add}>{`+ ${t.strings.arrayAdd}`}</button
|
|
985
1003
|
>
|
|
986
1004
|
</span>
|
|
987
1005
|
</div>
|
|
@@ -996,7 +1014,9 @@
|
|
|
996
1014
|
<div
|
|
997
1015
|
class="qm-array-table-scroller"
|
|
998
1016
|
data-overflow={tableOverflow ? '' : undefined}
|
|
1017
|
+
data-scrolled={tableScrolled ? '' : undefined}
|
|
999
1018
|
style:--table-cols={columns.length}
|
|
1019
|
+
style:--table-tracks={tracks}
|
|
1000
1020
|
{@attach trackOverflow}
|
|
1001
1021
|
>
|
|
1002
1022
|
<!-- The header names the columns, so a cell carries no label of its own: its
|
|
@@ -1004,6 +1024,7 @@
|
|
|
1004
1024
|
guidance affordance rides the header, being the column's rather than any
|
|
1005
1025
|
one cell's. -->
|
|
1006
1026
|
<div class="qm-array-table-head">
|
|
1027
|
+
<span class="qm-array-table-head-start"></span>
|
|
1007
1028
|
{#each columns as [key, sub] (key)}
|
|
1008
1029
|
<div
|
|
1009
1030
|
class={[
|
|
@@ -1024,12 +1045,14 @@
|
|
|
1024
1045
|
{#each ids as id, k (id)}
|
|
1025
1046
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1026
1047
|
<div
|
|
1027
|
-
class=
|
|
1048
|
+
class={['qm-array-row qm-array-table-row qm-wash', { lifted: drag.lifted(k) }]}
|
|
1049
|
+
data-drop={drag.dropSide(k)}
|
|
1028
1050
|
data-qm-index={k}
|
|
1029
1051
|
bind:this={rowEls[id]}
|
|
1030
1052
|
onkeydown={(e) => onRowKey(e, k)}
|
|
1031
1053
|
{...removedRow(k)}
|
|
1032
1054
|
>
|
|
1055
|
+
{@render handle(k)}
|
|
1033
1056
|
<ObjectField
|
|
1034
1057
|
bare
|
|
1035
1058
|
bind:this={cellEls[id]}
|
|
@@ -1134,12 +1157,14 @@
|
|
|
1134
1157
|
{#each rowIds as id, k (id)}
|
|
1135
1158
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1136
1159
|
<div
|
|
1137
|
-
class={['qm-array-row qm-wash', { standing: id === standingId }]}
|
|
1160
|
+
class={['qm-array-row qm-wash', { standing: id === standingId, lifted: drag.lifted(k) }]}
|
|
1161
|
+
data-drop={drag.dropSide(k)}
|
|
1138
1162
|
data-qm-index={k}
|
|
1139
1163
|
{...removedRow(k)}
|
|
1140
1164
|
bind:this={rowEls[id]}
|
|
1141
1165
|
onkeydown={(e) => onRowKey(e, k)}
|
|
1142
1166
|
>
|
|
1167
|
+
{#if id !== standingId}{@render handle(k)}{/if}
|
|
1143
1168
|
{#if control === 'prose'}
|
|
1144
1169
|
<ProseValue
|
|
1145
1170
|
bind:this={els[id]}
|
|
@@ -1237,8 +1262,6 @@
|
|
|
1237
1262
|
data-qm-review={item.id}
|
|
1238
1263
|
role="group"
|
|
1239
1264
|
aria-label={t.strings.reviewNewItem}
|
|
1240
|
-
onpointerenter={() => reviewing.point(item.id, 'pointer')}
|
|
1241
|
-
onpointerleave={() => reviewing.point(undefined, 'pointer')}
|
|
1242
1265
|
>
|
|
1243
1266
|
<div class="qm-review-added-box" inert>
|
|
1244
1267
|
{#if table}
|
|
@@ -1311,7 +1334,7 @@
|
|
|
1311
1334
|
<button
|
|
1312
1335
|
type="button"
|
|
1313
1336
|
class="qm-icon-btn qm-row-btn qm-remove qm-focus-ring"
|
|
1314
|
-
|
|
1337
|
+
data-qm-tip={t.strings.arrayRemove}
|
|
1315
1338
|
aria-label={rowAction(t.strings.arrayRemove, k)}
|
|
1316
1339
|
aria-keyshortcuts={control === 'object' && !table ? undefined : 'Alt+ArrowUp Alt+ArrowDown'}
|
|
1317
1340
|
tabindex={stop ? undefined : -1}
|
|
@@ -1319,16 +1342,17 @@
|
|
|
1319
1342
|
>
|
|
1320
1343
|
{/snippet}
|
|
1321
1344
|
|
|
1322
|
-
<!-- An
|
|
1323
|
-
Pointer-only and out of the accessibility tree: a press
|
|
1324
|
-
button there would be one a screen reader activates to no
|
|
1325
|
-
Alt+↑/↓ from anywhere in the row, which
|
|
1326
|
-
line's remove does for its own row. -->
|
|
1345
|
+
<!-- An element's drag handle, a table grip's twin hung off the row's start edge, or in a
|
|
1346
|
+
table's row its first track. Pointer-only and out of the accessibility tree: a press
|
|
1347
|
+
on it does nothing, so a button there would be one a screen reader activates to no
|
|
1348
|
+
effect. Its twin is Alt+↑/↓ from anywhere in the row, which a record's summary
|
|
1349
|
+
announces, as a table's or a line's remove does for its own row. -->
|
|
1327
1350
|
{#snippet handle(k: number)}
|
|
1328
1351
|
<span
|
|
1329
1352
|
class="qm-row-handle"
|
|
1330
1353
|
aria-hidden="true"
|
|
1331
|
-
|
|
1354
|
+
data-qm-tip={t.strings.arrayDrag}
|
|
1355
|
+
data-qm-tip-keys={keycap('Alt-↑/↓')}
|
|
1332
1356
|
onpointerdown={(e) => drag.down(e, k)}
|
|
1333
1357
|
onpointermove={drag.move}
|
|
1334
1358
|
onpointerup={drag.up}
|
|
@@ -1485,11 +1509,12 @@
|
|
|
1485
1509
|
}
|
|
1486
1510
|
/* The handle is a table grip's twin (prose.css §"One grip per line"): a pill carrying
|
|
1487
1511
|
the grip's marks, hung off the row's start edge in the `--_qm-nest` every row stands
|
|
1488
|
-
in from the stroke outside it, which a group's panel clips at.
|
|
1512
|
+
in from the stroke outside it, which a group's panel clips at. The pill rests
|
|
1489
1513
|
at nothing, where the remove rests faint, and comes up with the row the pointer is
|
|
1490
1514
|
on, staying up through the drag it carries; a band flush with the row keeps the
|
|
1491
1515
|
pointer on the row all the way to it. The pointer owns the gesture, not the page's
|
|
1492
|
-
scroll.
|
|
1516
|
+
scroll. A record's pill centres on its summary; a line's and a table row's stand on
|
|
1517
|
+
the first line, which a wrapping cell grows away from. */
|
|
1493
1518
|
.qm-row-handle {
|
|
1494
1519
|
position: absolute;
|
|
1495
1520
|
inset-block: 0;
|
|
@@ -1501,8 +1526,6 @@
|
|
|
1501
1526
|
color: var(--_qm-ink-label);
|
|
1502
1527
|
cursor: grab;
|
|
1503
1528
|
touch-action: none;
|
|
1504
|
-
opacity: 0;
|
|
1505
|
-
transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
1506
1529
|
}
|
|
1507
1530
|
.qm-row-handle-bar {
|
|
1508
1531
|
display: flex;
|
|
@@ -1512,25 +1535,37 @@
|
|
|
1512
1535
|
height: var(--_qm-tap-min);
|
|
1513
1536
|
border-radius: var(--_qm-radius-pill);
|
|
1514
1537
|
background: var(--_qm-surface-band);
|
|
1538
|
+
opacity: 0;
|
|
1539
|
+
transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
1540
|
+
}
|
|
1541
|
+
.qm-array-row > .qm-row-handle {
|
|
1542
|
+
align-items: start;
|
|
1543
|
+
}
|
|
1544
|
+
.qm-array-row > .qm-row-handle > .qm-row-handle-bar {
|
|
1545
|
+
margin-block-start: calc((var(--_qm-box-line) - var(--_qm-tap-min)) / 2);
|
|
1515
1546
|
}
|
|
1516
1547
|
.qm-row-handle-bar :global(svg) {
|
|
1517
1548
|
width: var(--_qm-space-3);
|
|
1518
1549
|
height: var(--_qm-space-3);
|
|
1519
1550
|
}
|
|
1520
|
-
.qm-array-row:hover > .qm-
|
|
1521
|
-
.qm-
|
|
1551
|
+
.qm-array-row:hover > .qm-row-handle > .qm-row-handle-bar,
|
|
1552
|
+
.qm-array-row:hover > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
|
|
1553
|
+
.qm-array-row.lifted > .qm-row-handle > .qm-row-handle-bar,
|
|
1554
|
+
.qm-element.lifted > .qm-element-head > .qm-row-handle > .qm-row-handle-bar {
|
|
1522
1555
|
opacity: 1;
|
|
1523
1556
|
}
|
|
1557
|
+
.qm-array-row.lifted > .qm-row-handle,
|
|
1524
1558
|
.qm-element.lifted > .qm-element-head > .qm-row-handle {
|
|
1525
1559
|
cursor: grabbing;
|
|
1526
1560
|
}
|
|
1527
1561
|
/* The lifted row is a tone, and the drop is one rule on the edge it would land
|
|
1528
1562
|
against, drawn out of flow so nothing reflows under the drag: the table island's
|
|
1529
1563
|
own pair. */
|
|
1530
|
-
.qm-element.lifted > .qm-element-head > .qm-element-summary
|
|
1564
|
+
.qm-element.lifted > .qm-element-head > .qm-element-summary,
|
|
1565
|
+
.qm-array-row.lifted:not(.qm-element) > :global(:not(.qm-row-handle, .qm-remove)) {
|
|
1531
1566
|
opacity: var(--_qm-opacity-muted);
|
|
1532
1567
|
}
|
|
1533
|
-
.qm-
|
|
1568
|
+
.qm-array-row[data-drop]::before {
|
|
1534
1569
|
content: '';
|
|
1535
1570
|
position: absolute;
|
|
1536
1571
|
inset-inline: 0;
|
|
@@ -1539,10 +1574,10 @@
|
|
|
1539
1574
|
border-radius: var(--_qm-radius-pill);
|
|
1540
1575
|
pointer-events: none;
|
|
1541
1576
|
}
|
|
1542
|
-
.qm-
|
|
1577
|
+
.qm-array-row[data-drop='before']::before {
|
|
1543
1578
|
top: calc(-0.5 * (var(--_qm-space) + var(--_qm-ring-width)));
|
|
1544
1579
|
}
|
|
1545
|
-
.qm-
|
|
1580
|
+
.qm-array-row[data-drop='after']::before {
|
|
1546
1581
|
bottom: calc(-0.5 * (var(--_qm-space) + var(--_qm-ring-width)));
|
|
1547
1582
|
}
|
|
1548
1583
|
/* ── An object element ──────────────────────────────────────────────────────
|
|
@@ -1657,45 +1692,59 @@
|
|
|
1657
1692
|
over boxes are the figure a row of compact fields draws. A corner reads square at a
|
|
1658
1693
|
stroke, so the wash takes none here.
|
|
1659
1694
|
|
|
1660
|
-
The grid is a box inside the stroke, and the one that scrolls: the stroke
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1695
|
+
The grid is a box inside the stroke, and the one that scrolls: the stroke holds still
|
|
1696
|
+
while the columns move, and the clip is the grid's edge rather than the stroke's.
|
|
1697
|
+
The stroke is drawn over the grid, whose pad reaches back across it, so the plane
|
|
1698
|
+
the pinned handle stands on never paints it out. One
|
|
1699
|
+
grid over the header and every row: a track for the row's handle, a column per
|
|
1700
|
+
property, then a track for the row's remove. The header and each row subgrid onto
|
|
1701
|
+
it, so a cell's edge is its column's whatever the row above it holds. The handle's
|
|
1702
|
+
track is the nest the stroke keeps from the cells less the gutter after it, so the
|
|
1703
|
+
cells stand a nest in from the stroke as an open row's do.
|
|
1668
1704
|
|
|
1669
|
-
A track
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1705
|
+
A column's track is the component's (`tracks`): a cell that fills its width shares
|
|
1706
|
+
what the field has spare with every other such column, so a table of text fills the
|
|
1707
|
+
field as one text field does, while a control of one width rests at its content and
|
|
1708
|
+
a short cell never stands a field's width from its neighbour. Every track's base is
|
|
1709
|
+
what its cells cannot shrink below, so a field too narrow for them all overflows the
|
|
1710
|
+
grid's box and scrolls sideways. A fixed floor as the track's base would instead hand
|
|
1711
|
+
each column a share of the width and leave a control that does not shrink — a date's
|
|
1712
|
+
segments — painting over the column beside it; the floor rides the header cell, which
|
|
1713
|
+
every column has.
|
|
1674
1714
|
|
|
1675
1715
|
The pad is the clip box's, the ring on a cell at that box's own edge reaching past
|
|
1676
|
-
its content; the margin takes the same distance back
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1716
|
+
its content; the margin takes the same distance back. The box keeps the pinned
|
|
1717
|
+
tracks clear of the scrolls it makes itself, so a cell scrolled into view lands
|
|
1718
|
+
beside a pinned button rather than under it. The box is a container, so a header
|
|
1719
|
+
cell can state its floor as a share of the width the columns have.
|
|
1680
1720
|
|
|
1681
1721
|
The names are the array's own: `.qm-table` is the codec's island (`prose.css`), an
|
|
1682
1722
|
unscoped stylesheet in this package, and a box wearing that name takes the island's
|
|
1683
1723
|
hairline whatever this block says. */
|
|
1684
1724
|
.qm-array-rows.qm-array-table {
|
|
1685
|
-
|
|
1686
|
-
padding-inline-start: var(--_qm-nest);
|
|
1725
|
+
padding-inline-start: var(--_qm-vertical-width);
|
|
1687
1726
|
padding-block: var(--_qm-space);
|
|
1688
1727
|
border-radius: 0;
|
|
1689
1728
|
}
|
|
1729
|
+
.qm-array-rows.qm-array-table::before {
|
|
1730
|
+
content: '';
|
|
1731
|
+
position: absolute;
|
|
1732
|
+
inset-block: 0;
|
|
1733
|
+
inset-inline-start: 0;
|
|
1734
|
+
width: var(--_qm-vertical-width);
|
|
1735
|
+
background: var(--_qm-border);
|
|
1736
|
+
z-index: 2;
|
|
1737
|
+
}
|
|
1690
1738
|
.qm-array-table-scroller {
|
|
1739
|
+
--_grip-track: calc(var(--_qm-nest) - var(--_qm-space));
|
|
1691
1740
|
display: grid;
|
|
1692
|
-
grid-template-columns:
|
|
1693
|
-
repeat(var(--table-cols), minmax(min-content, max-content))
|
|
1694
|
-
auto;
|
|
1741
|
+
grid-template-columns: var(--_grip-track) var(--table-tracks) auto;
|
|
1695
1742
|
justify-content: start;
|
|
1696
1743
|
gap: var(--_qm-space);
|
|
1697
1744
|
overflow-x: auto;
|
|
1698
|
-
|
|
1745
|
+
container-type: inline-size;
|
|
1746
|
+
scroll-padding-inline: calc(var(--_qm-nest) + var(--_qm-ring-reach))
|
|
1747
|
+
calc(var(--_qm-tap-min) + var(--_qm-space));
|
|
1699
1748
|
padding: var(--_qm-ring-reach);
|
|
1700
1749
|
margin: calc(-1 * var(--_qm-ring-reach));
|
|
1701
1750
|
}
|
|
@@ -1719,7 +1768,11 @@
|
|
|
1719
1768
|
sooner. Without it the column rests at its header's own width, its cells still
|
|
1720
1769
|
clearing the mark, which no track can shrink below. It is the table's to state
|
|
1721
1770
|
because the table is where a column is a width of its own; in a section's grid and
|
|
1722
|
-
in a subform's, a boolean stands in a track its neighbours share.
|
|
1771
|
+
in a subform's, a boolean stands in a track its neighbours share.
|
|
1772
|
+
|
|
1773
|
+
A prose column's floor is its share of the width the columns have, between the two
|
|
1774
|
+
floors: the wide one while the field holds every column at it, so a cell wraps no
|
|
1775
|
+
sooner than it must, then down to the narrow one before the table scrolls. */
|
|
1723
1776
|
.qm-array-table-col {
|
|
1724
1777
|
min-width: var(--_qm-track-min);
|
|
1725
1778
|
}
|
|
@@ -1727,50 +1780,92 @@
|
|
|
1727
1780
|
min-width: 0;
|
|
1728
1781
|
}
|
|
1729
1782
|
.qm-array-table-col.prose {
|
|
1730
|
-
min-width:
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1783
|
+
min-width: clamp(
|
|
1784
|
+
var(--_qm-track-min),
|
|
1785
|
+
(100cqi - var(--_qm-nest) - var(--_qm-tap-min)) / var(--table-cols) - var(--_qm-space),
|
|
1786
|
+
var(--_qm-track-prose)
|
|
1787
|
+
);
|
|
1788
|
+
}
|
|
1789
|
+
/* The handle is the row's first track and the remove its last, each pinned to its
|
|
1790
|
+
edge of the box the table scrolls in: sticky, so it rests in its track while the
|
|
1791
|
+
table fits and rides over the cells once the box scrolls, on the card's plane so what
|
|
1792
|
+
passes under it is hidden rather than overprinted, and stretched to the row so no cell
|
|
1793
|
+
shows above or below it. The remove is always drawn: a table's rows are many and the
|
|
1794
|
+
eye finds the control by its column. The header's end cells pin with them, or the
|
|
1795
|
+
labels would scroll under nothing while the cells scroll under a plane.
|
|
1739
1796
|
|
|
1740
1797
|
The inset is the content box's, so the ring's reach fits inside the clip; the plane
|
|
1741
1798
|
spread over that same reach hides the sliver of cell the pad would show past the
|
|
1742
|
-
button, and the ring paints over it.
|
|
1799
|
+
button, and the ring paints over it. The handle's pill reaches over the gutter after
|
|
1800
|
+
its track, where the plane stops short of the cell beside it.
|
|
1743
1801
|
|
|
1744
1802
|
The slab's grammar goes with the slab: a button on the row's own plane takes the
|
|
1745
1803
|
icon family's radius at all four corners, where one cut into a box takes that box's
|
|
1746
1804
|
end-side pair and squares the rest. */
|
|
1747
1805
|
.qm-array-table-row > .qm-remove,
|
|
1748
|
-
.qm-array-table-head-end
|
|
1806
|
+
.qm-array-table-head-end,
|
|
1807
|
+
.qm-array-table-row > .qm-row-handle,
|
|
1808
|
+
.qm-array-table-head-start {
|
|
1749
1809
|
position: sticky;
|
|
1750
|
-
|
|
1810
|
+
z-index: 1;
|
|
1751
1811
|
background: var(--_qm-surface);
|
|
1752
1812
|
box-shadow: 0 0 0 var(--_qm-ring-reach) var(--_qm-surface);
|
|
1753
1813
|
}
|
|
1754
|
-
|
|
1755
|
-
|
|
1814
|
+
.qm-array-table-row > .qm-remove,
|
|
1815
|
+
.qm-array-table-head-end {
|
|
1816
|
+
inset-inline-end: 0;
|
|
1817
|
+
}
|
|
1818
|
+
.qm-array-table-row > .qm-row-handle,
|
|
1819
|
+
.qm-array-table-head-start {
|
|
1820
|
+
inset-inline-start: 0;
|
|
1821
|
+
}
|
|
1822
|
+
.qm-array-table-row > .qm-row-handle {
|
|
1823
|
+
inset-block: auto;
|
|
1824
|
+
inset-inline-end: auto;
|
|
1825
|
+
width: auto;
|
|
1826
|
+
align-self: stretch;
|
|
1827
|
+
justify-content: start;
|
|
1828
|
+
}
|
|
1829
|
+
.qm-array-table-row > .qm-row-handle > .qm-row-handle-bar {
|
|
1830
|
+
flex: none;
|
|
1831
|
+
width: var(--_qm-nest);
|
|
1832
|
+
}
|
|
1833
|
+
/* While cells stand past an edge, the slab beside it fades them in over a step rather
|
|
1834
|
+
than cutting them at its edge: the column the cut hides is still there. */
|
|
1756
1835
|
.qm-array-table-row > .qm-remove::before,
|
|
1757
|
-
.qm-array-table-head-end::before
|
|
1836
|
+
.qm-array-table-head-end::before,
|
|
1837
|
+
.qm-array-table-row > .qm-row-handle::before,
|
|
1838
|
+
.qm-array-table-head-start::before {
|
|
1758
1839
|
content: '';
|
|
1759
1840
|
position: absolute;
|
|
1760
1841
|
inset-block: calc(-1 * var(--_qm-ring-reach));
|
|
1761
|
-
inset-inline-end: calc(100% + var(--_qm-ring-reach));
|
|
1762
1842
|
width: var(--_qm-space-3);
|
|
1763
|
-
background: linear-gradient(to right, transparent, var(--_qm-surface));
|
|
1764
1843
|
pointer-events: none;
|
|
1765
1844
|
opacity: 0;
|
|
1766
1845
|
transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
1767
1846
|
}
|
|
1847
|
+
.qm-array-table-row > .qm-remove::before,
|
|
1848
|
+
.qm-array-table-head-end::before {
|
|
1849
|
+
inset-inline-end: calc(100% + var(--_qm-ring-reach));
|
|
1850
|
+
background: linear-gradient(to right, transparent, var(--_qm-surface));
|
|
1851
|
+
}
|
|
1852
|
+
.qm-array-table-row > .qm-row-handle::before,
|
|
1853
|
+
.qm-array-table-head-start::before {
|
|
1854
|
+
inset-inline-start: calc(100% + var(--_qm-ring-reach));
|
|
1855
|
+
background: linear-gradient(to left, transparent, var(--_qm-surface));
|
|
1856
|
+
}
|
|
1768
1857
|
.qm-array-table-row > .qm-remove:dir(rtl)::before,
|
|
1769
1858
|
.qm-array-table-head-end:dir(rtl)::before {
|
|
1770
1859
|
background: linear-gradient(to left, transparent, var(--_qm-surface));
|
|
1771
1860
|
}
|
|
1861
|
+
.qm-array-table-row > .qm-row-handle:dir(rtl)::before,
|
|
1862
|
+
.qm-array-table-head-start:dir(rtl)::before {
|
|
1863
|
+
background: linear-gradient(to right, transparent, var(--_qm-surface));
|
|
1864
|
+
}
|
|
1772
1865
|
.qm-array-table-scroller[data-overflow] > .qm-array-table-row > .qm-remove::before,
|
|
1773
|
-
.qm-array-table-scroller[data-overflow] .qm-array-table-head-end::before
|
|
1866
|
+
.qm-array-table-scroller[data-overflow] .qm-array-table-head-end::before,
|
|
1867
|
+
.qm-array-table-scroller[data-scrolled] > .qm-array-table-row > .qm-row-handle::before,
|
|
1868
|
+
.qm-array-table-scroller[data-scrolled] .qm-array-table-head-start::before {
|
|
1774
1869
|
opacity: 1;
|
|
1775
1870
|
}
|
|
1776
1871
|
/* The glyph stands on the row's first line with the cells, however far the slab
|
|
@@ -1783,17 +1878,26 @@
|
|
|
1783
1878
|
border-radius: var(--_qm-radius-inner);
|
|
1784
1879
|
color: var(--_qm-ink-label);
|
|
1785
1880
|
}
|
|
1786
|
-
/* The pad past
|
|
1881
|
+
/* The pad past each slab, flat: the plane's spread above rounds with the slab's
|
|
1787
1882
|
corners, and a cell scrolled under them shows through at the clip. */
|
|
1788
1883
|
.qm-array-table-row > .qm-remove::after,
|
|
1789
|
-
.qm-array-table-head-end::after
|
|
1884
|
+
.qm-array-table-head-end::after,
|
|
1885
|
+
.qm-array-table-row > .qm-row-handle::after,
|
|
1886
|
+
.qm-array-table-head-start::after {
|
|
1790
1887
|
content: '';
|
|
1791
1888
|
position: absolute;
|
|
1792
1889
|
inset-block: calc(-1 * var(--_qm-ring-reach));
|
|
1793
|
-
inset-inline-start: 100%;
|
|
1794
1890
|
width: var(--_qm-ring-reach);
|
|
1795
1891
|
background: var(--_qm-surface);
|
|
1796
1892
|
}
|
|
1893
|
+
.qm-array-table-row > .qm-remove::after,
|
|
1894
|
+
.qm-array-table-head-end::after {
|
|
1895
|
+
inset-inline-start: 100%;
|
|
1896
|
+
}
|
|
1897
|
+
.qm-array-table-row > .qm-row-handle::after,
|
|
1898
|
+
.qm-array-table-head-start::after {
|
|
1899
|
+
inset-inline-end: 100%;
|
|
1900
|
+
}
|
|
1797
1901
|
/* The label line's own type: size, weight and leading are `.qm-field-label`'s, so
|
|
1798
1902
|
the two read as one register. Inner radius: the chip family is the card's, and this
|
|
1799
1903
|
box is a line of type. The chip's tap floor is given back (`.qm-tap-floor`),
|
|
@@ -1817,7 +1921,7 @@
|
|
|
1817
1921
|
}
|
|
1818
1922
|
/* No hover to come up on: the handle stands with the controls, already at rest. */
|
|
1819
1923
|
@media (hover: none) {
|
|
1820
|
-
.qm-row-handle {
|
|
1924
|
+
.qm-row-handle-bar {
|
|
1821
1925
|
opacity: 1;
|
|
1822
1926
|
}
|
|
1823
1927
|
}
|
package/dist/visual/Card.svelte
CHANGED
|
@@ -85,6 +85,12 @@
|
|
|
85
85
|
// title because a re-derive mid-edit hands `card` back with the title it stored.
|
|
86
86
|
let draft = $state<string | undefined>(undefined);
|
|
87
87
|
const shownTitle = $derived(draft ?? card.titleOverride);
|
|
88
|
+
/** What names the card to assistive tech: its section, and its title input after the
|
|
89
|
+
* input's own word. The stored title, never the rename in flight, so no name changes
|
|
90
|
+
* under the reader typing it. */
|
|
91
|
+
const named = $derived(
|
|
92
|
+
card.unschemable ? humanize(card.kind) : card.titleOverride.trim() || card.titlePlaceholder
|
|
93
|
+
);
|
|
88
94
|
|
|
89
95
|
// A focus the shell hands over (`focusHeader`) is not armed for replacement: the key
|
|
90
96
|
// that pressed a delete, pressed again, would retitle the card it landed on.
|
|
@@ -221,11 +227,14 @@
|
|
|
221
227
|
({@link FieldHint}): a surface portals to `[data-qm-root]`, so the card is not its
|
|
222
228
|
ancestor and nothing else marks the box its guidance belongs in. Its value is the card's
|
|
223
229
|
kind, `main` for the main card, which is the one schema-named hook a host's stylesheet
|
|
224
|
-
is promised (THEMING §"What a stylesheet may aim at").
|
|
230
|
+
is promised (THEMING §"What a stylesheet may aim at"). Named, the section is a region,
|
|
231
|
+
so a reader moving by landmark hears each card by the title its header shows; `main`
|
|
232
|
+
shows none and stays the unnamed form the regions follow. -->
|
|
225
233
|
<section
|
|
226
234
|
bind:this={el}
|
|
227
235
|
class={['qm-card', { 'qm-main': card.isMain, 'qm-unschemable': card.unschemable }]}
|
|
228
236
|
data-qm-card={card.kind}
|
|
237
|
+
aria-label={card.isMain ? undefined : named}
|
|
229
238
|
>
|
|
230
239
|
{#if card.unschemable}
|
|
231
240
|
{@render recoveryShell()}
|
|
@@ -239,7 +248,7 @@
|
|
|
239
248
|
class="qm-card-title qm-focus-ring"
|
|
240
249
|
value={shownTitle}
|
|
241
250
|
placeholder={card.titlePlaceholder}
|
|
242
|
-
aria-label={t.strings.cardTitle}
|
|
251
|
+
aria-label={t.strings.cardAction(t.strings.cardTitle, named)}
|
|
243
252
|
size="1"
|
|
244
253
|
onmousedown={onTitleMousedown}
|
|
245
254
|
onfocus={onTitleFocus}
|
|
@@ -432,6 +441,7 @@
|
|
|
432
441
|
<label class="qm-recovery-retype">
|
|
433
442
|
{t.strings.retypeLabel}
|
|
434
443
|
<select
|
|
444
|
+
class="qm-control-box qm-focus-ring"
|
|
435
445
|
onchange={(e) => {
|
|
436
446
|
const el = e.currentTarget as HTMLSelectElement;
|
|
437
447
|
if (el.value) ops.retype(el.value);
|
|
@@ -877,14 +887,14 @@
|
|
|
877
887
|
font-size: var(--_qm-text-label);
|
|
878
888
|
color: var(--_qm-ink-label);
|
|
879
889
|
}
|
|
880
|
-
/*
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
890
|
+
/* Forced colours drop a plane's tone, so a card draws its edge, and the placeholder's
|
|
891
|
+
GrayText would read the automatic title as disabled. */
|
|
892
|
+
@media (forced-colors: active) {
|
|
893
|
+
.qm-card {
|
|
894
|
+
border: var(--_qm-border-width) solid CanvasText;
|
|
895
|
+
}
|
|
896
|
+
.qm-card-title::placeholder {
|
|
897
|
+
color: CanvasText;
|
|
898
|
+
}
|
|
889
899
|
}
|
|
890
900
|
</style>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<button
|
|
37
37
|
type="button"
|
|
38
38
|
class="qm-chip qm-focus-ring"
|
|
39
|
-
|
|
39
|
+
data-qm-tip={t.strings.cardMoveUp}
|
|
40
40
|
aria-label={t.strings.cardAction(t.strings.cardMoveUp, name)}
|
|
41
41
|
aria-disabled={isFirst || undefined}
|
|
42
42
|
tabindex={isFirst ? -1 : undefined}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<button
|
|
46
46
|
type="button"
|
|
47
47
|
class="qm-chip qm-focus-ring"
|
|
48
|
-
|
|
48
|
+
data-qm-tip={t.strings.cardMoveDown}
|
|
49
49
|
aria-label={t.strings.cardAction(t.strings.cardMoveDown, name)}
|
|
50
50
|
aria-disabled={isLast || undefined}
|
|
51
51
|
tabindex={isLast ? -1 : undefined}
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
<button
|
|
56
56
|
type="button"
|
|
57
57
|
class="qm-chip qm-card-delete qm-focus-ring"
|
|
58
|
-
|
|
58
|
+
data-qm-tip={t.strings.cardDelete}
|
|
59
59
|
aria-label={t.strings.cardAction(t.strings.cardDelete, name)}
|
|
60
60
|
onclick={onDelete}><Icon name="trash-2" /></button
|
|
61
61
|
>
|