@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
|
@@ -61,6 +61,13 @@
|
|
|
61
61
|
focus. Leaving with a segment filled puts the stored date back; a field storing no
|
|
62
62
|
date puts its segments back by remounting the primitive, which re-reads an unchanged
|
|
63
63
|
empty value as nothing to sync.
|
|
64
|
+
|
|
65
|
+
The field is one Tab stop (INVARIANTS §"A date field is one Tab stop"). The primitive
|
|
66
|
+
makes every segment a stop, so each is drawn through its `child` snippet, which is where
|
|
67
|
+
a `tabindex` outranks the primitive's own: the stop is the segment the focus is on, the
|
|
68
|
+
first while the focus is elsewhere, and Tab from any of them leaves the field. The
|
|
69
|
+
arrows walk the segments, the primitive's own keys, and one step past the last onto the
|
|
70
|
+
Today toggle and back, so the toggle is out of the tab order and still under the keys.
|
|
64
71
|
-->
|
|
65
72
|
<script lang="ts">
|
|
66
73
|
import { flushSync } from 'svelte';
|
|
@@ -110,13 +117,21 @@
|
|
|
110
117
|
let { value, fallback, label, labelledBy, describedBy, datetime, onCommit }: Props = $props();
|
|
111
118
|
|
|
112
119
|
let wrapEl: HTMLElement | undefined = $state();
|
|
120
|
+
let todayEl: HTMLButtonElement | undefined = $state();
|
|
121
|
+
/** The segments that take the focus. `literal` is the separator between them: present,
|
|
122
|
+
* never focusable. */
|
|
123
|
+
const segmentEls = (): HTMLElement[] => [
|
|
124
|
+
...(wrapEl?.querySelectorAll<HTMLElement>('[data-segment]:not([data-segment="literal"])') ?? [])
|
|
125
|
+
];
|
|
113
126
|
/** Take the caret: what the label click, and a parent placing focus here, calls.
|
|
114
127
|
* The first segment, not the field: focus lives on a segment (which is why the
|
|
115
|
-
* ring is `.qm-focus-ring-within`), and the container holds none.
|
|
116
|
-
* separator between segments: present, never focusable. */
|
|
128
|
+
* ring is `.qm-focus-ring-within`), and the container holds none. */
|
|
117
129
|
export function focus(): void {
|
|
118
|
-
|
|
130
|
+
segmentEls()[0]?.focus();
|
|
119
131
|
}
|
|
132
|
+
/** The field's one Tab stop while the focus is inside: a segment by its part, or the
|
|
133
|
+
* toggle as {@link TODAY}. Unset, the stop is the first segment. */
|
|
134
|
+
let stop = $state<string | undefined>(undefined);
|
|
120
135
|
|
|
121
136
|
/** The part of a stored string this control edits: all of a `datetime`, and the date
|
|
122
137
|
* half of a `date`, anything past `YYYY-MM-DD` being no part of its type. */
|
|
@@ -196,8 +211,23 @@
|
|
|
196
211
|
/** Focus moving between segments is neither an entry nor a leaving. */
|
|
197
212
|
const within = (e: FocusEvent): boolean => !!wrapEl?.contains(e.relatedTarget as Node | null);
|
|
198
213
|
function enter(e: FocusEvent): void {
|
|
214
|
+
stop = (e.target as HTMLElement).dataset.segment ?? TODAY;
|
|
199
215
|
if (!within(e) && value == null && fallbackDate) seat = true;
|
|
200
216
|
}
|
|
217
|
+
/** One step past the last segment is the toggle, and one step back returns. */
|
|
218
|
+
function step(e: KeyboardEvent): void {
|
|
219
|
+
if (!todayEl || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return;
|
|
220
|
+
const last = segmentEls().at(-1);
|
|
221
|
+
const to =
|
|
222
|
+
e.key === 'ArrowRight' && e.target === last
|
|
223
|
+
? todayEl
|
|
224
|
+
: e.key === 'ArrowLeft' && e.target === todayEl
|
|
225
|
+
? last
|
|
226
|
+
: undefined;
|
|
227
|
+
if (!to) return;
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
to.focus();
|
|
230
|
+
}
|
|
201
231
|
const filled = (): boolean =>
|
|
202
232
|
[...(wrapEl?.querySelectorAll('[data-segment]') ?? [])].some(
|
|
203
233
|
(s) => s.getAttribute('data-segment') !== 'literal' && !s.hasAttribute('data-ghosted')
|
|
@@ -209,6 +239,7 @@
|
|
|
209
239
|
}
|
|
210
240
|
function leave(e: FocusEvent): void {
|
|
211
241
|
if (within(e)) return;
|
|
242
|
+
stop = undefined;
|
|
212
243
|
const seated = seat;
|
|
213
244
|
seat = false;
|
|
214
245
|
const emptied = held;
|
|
@@ -314,13 +345,17 @@
|
|
|
314
345
|
aria-describedby={describedBy}
|
|
315
346
|
data-ghosted={ghost ? '' : undefined}
|
|
316
347
|
data-default={seated || follows ? '' : undefined}
|
|
317
|
-
onkeydown={
|
|
348
|
+
onkeydown={(e: KeyboardEvent) => {
|
|
349
|
+
settle();
|
|
350
|
+
step(e);
|
|
351
|
+
}}
|
|
318
352
|
>
|
|
319
353
|
{#snippet children({ segments })}
|
|
320
354
|
<!-- Keyed by index: `part` repeats (the `literal` separators between
|
|
321
355
|
segments all carry it) so a part-keyed block collides. -->
|
|
322
356
|
{@const hour = segments.find((seg) => seg.part === 'hour')?.value}
|
|
323
357
|
{@const twelve = segments.some((seg) => seg.part === 'dayPeriod')}
|
|
358
|
+
{@const first = segments.find((seg) => seg.part !== 'literal')?.part}
|
|
324
359
|
{#each segments as seg, i (i)}
|
|
325
360
|
{@const shown = segmentText(seg.part, seg.value, hour, twelve)}
|
|
326
361
|
<BitsDateField.Segment
|
|
@@ -328,7 +363,11 @@
|
|
|
328
363
|
part={seg.part}
|
|
329
364
|
data-ghosted={shown.ghosted}
|
|
330
365
|
>
|
|
331
|
-
{
|
|
366
|
+
{#snippet child({ props })}
|
|
367
|
+
{@const roving =
|
|
368
|
+
seg.part === 'literal' ? {} : { tabindex: seg.part === (stop ?? first) ? 0 : -1 }}
|
|
369
|
+
<span {...props} {...roving}>{shown.text}</span>
|
|
370
|
+
{/snippet}
|
|
332
371
|
</BitsDateField.Segment>
|
|
333
372
|
{/each}
|
|
334
373
|
{#if unread}
|
|
@@ -338,7 +377,10 @@
|
|
|
338
377
|
<button
|
|
339
378
|
type="button"
|
|
340
379
|
class="qm-chip qm-tap-floor qm-focus-ring qm-date-today"
|
|
380
|
+
bind:this={todayEl}
|
|
381
|
+
tabindex={stop === TODAY ? 0 : -1}
|
|
341
382
|
aria-pressed={!!follows}
|
|
383
|
+
aria-keyshortcuts="T"
|
|
342
384
|
data-default={follows === 'default' ? '' : undefined}
|
|
343
385
|
onclick={toggle}
|
|
344
386
|
>
|
|
@@ -56,8 +56,9 @@
|
|
|
56
56
|
</script>
|
|
57
57
|
|
|
58
58
|
{#if diagnostics && diagnostics.length}
|
|
59
|
-
<!--
|
|
60
|
-
|
|
59
|
+
<!-- Not a live region: the list arrives with its text in it, so the editor's standing
|
|
60
|
+
region says it (INVARIANTS §Diagnostics). -->
|
|
61
|
+
<div class="qm-diag-list" id={listId} {@attach markInvalid}>
|
|
61
62
|
{#each diagnostics as d, i (i)}
|
|
62
63
|
<span class="qm-diag-line">{diagnosticText(d, t.formatDiagnostic, t.strings)}</span>
|
|
63
64
|
{/each}
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
/** `<label for>` target. Set → the label names this trigger, so `aria-label`
|
|
38
38
|
* comes off: two names is where implementations disagree about which wins. */
|
|
39
39
|
id?: string;
|
|
40
|
+
/** The field's label element, which names the list as `label` does where it is unset. */
|
|
41
|
+
labelledBy?: string;
|
|
40
42
|
/** The parked `description` (FieldLabel): announced after the name. */
|
|
41
43
|
describedBy?: string;
|
|
42
44
|
onCommit: (v: string | undefined) => void;
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
optional = false,
|
|
58
60
|
label,
|
|
59
61
|
id,
|
|
62
|
+
labelledBy,
|
|
60
63
|
describedBy,
|
|
61
64
|
onCommit,
|
|
62
65
|
optionAllowed,
|
|
@@ -129,6 +132,8 @@
|
|
|
129
132
|
collisionBoundary={portalTarget ?? []}
|
|
130
133
|
strategy="absolute"
|
|
131
134
|
sideOffset={spacePx(wrapEl)}
|
|
135
|
+
aria-labelledby={labelledBy}
|
|
136
|
+
aria-label={labelledBy ? undefined : label}
|
|
132
137
|
>
|
|
133
138
|
<!-- The list portals out of the trigger's DOM but into the nearest
|
|
134
139
|
`[data-qm-root]`, and carries the marker itself, like FormatPopover.
|
|
@@ -170,7 +175,7 @@
|
|
|
170
175
|
<!-- The reset is the sentinel, offered once there is something to reset:
|
|
171
176
|
unset, the list's check already stands where a reset would land. -->
|
|
172
177
|
{#if !unset}
|
|
173
|
-
<div class="qm-select-divider"
|
|
178
|
+
<div class="qm-select-divider" aria-hidden="true"></div>
|
|
174
179
|
<Select.Item
|
|
175
180
|
class="qm-menu-item qm-select-item qm-select-unset"
|
|
176
181
|
value={UNSET}
|
|
@@ -16,6 +16,8 @@ interface Props {
|
|
|
16
16
|
/** `<label for>` target. Set → the label names this trigger, so `aria-label`
|
|
17
17
|
* comes off: two names is where implementations disagree about which wins. */
|
|
18
18
|
id?: string;
|
|
19
|
+
/** The field's label element, which names the list as `label` does where it is unset. */
|
|
20
|
+
labelledBy?: string;
|
|
19
21
|
/** The parked `description` (FieldLabel): announced after the name. */
|
|
20
22
|
describedBy?: string;
|
|
21
23
|
onCommit: (v: string | undefined) => void;
|
package/dist/visual/Field.svelte
CHANGED
|
@@ -382,10 +382,8 @@
|
|
|
382
382
|
{@attach registerControl}
|
|
383
383
|
onfocusin={(e) => {
|
|
384
384
|
reportFocus?.(e);
|
|
385
|
-
if (proposed) reviewing.point(proposed.id
|
|
385
|
+
if (proposed) reviewing.point(proposed.id);
|
|
386
386
|
}}
|
|
387
|
-
onpointerenter={() => worded && reviewing.point(worded.id, 'pointer')}
|
|
388
|
-
onpointerleave={() => worded && reviewing.point(undefined, 'pointer')}
|
|
389
387
|
>
|
|
390
388
|
{#if field.control === 'prose'}
|
|
391
389
|
<ProseField
|
|
@@ -395,6 +393,7 @@
|
|
|
395
393
|
{addr}
|
|
396
394
|
inline={field.inline}
|
|
397
395
|
plaintext={field.plaintext}
|
|
396
|
+
paragraphs={field.paragraphs}
|
|
398
397
|
fallback={printed ? (ghost as Content) : undefined}
|
|
399
398
|
placeholder={proposed ? undefined : none}
|
|
400
399
|
emptyUnsets={optional}
|
|
@@ -419,6 +418,7 @@
|
|
|
419
418
|
blankTitle={field.schema.ui?.blank_title}
|
|
420
419
|
{optional}
|
|
421
420
|
id={domIds.control}
|
|
421
|
+
labelledBy={domIds.label}
|
|
422
422
|
{describedBy}
|
|
423
423
|
onCommit={answerOrCommit}
|
|
424
424
|
proposing={!!proposed}
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import Icon from './icons/Icon.svelte';
|
|
34
34
|
import { spacePx } from '../core/rungs.js';
|
|
35
35
|
import { renderGuidance } from './guidance.js';
|
|
36
|
+
import { wording } from './strings.js';
|
|
36
37
|
import './controls.css';
|
|
37
38
|
|
|
38
39
|
interface Props {
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
describedBy?: string;
|
|
46
47
|
}
|
|
47
48
|
let { description, label, describedBy }: Props = $props();
|
|
49
|
+
const t = wording();
|
|
48
50
|
|
|
49
51
|
let open = $state(false);
|
|
50
52
|
let triggerEl = $state<HTMLButtonElement | undefined>(undefined);
|
|
@@ -149,7 +151,7 @@
|
|
|
149
151
|
type="button"
|
|
150
152
|
class="qm-field-hint qm-icon-btn qm-focus-ring qm-tap-floor"
|
|
151
153
|
tabindex="-1"
|
|
152
|
-
aria-label=
|
|
154
|
+
aria-label={t.strings.fieldGuidance(label)}
|
|
153
155
|
aria-expanded={open}
|
|
154
156
|
aria-describedby={describedBy}
|
|
155
157
|
onpointerenter={(e) => {
|
|
@@ -258,12 +260,14 @@
|
|
|
258
260
|
|
|
259
261
|
It takes no fill either: the surface itself opens on hover.
|
|
260
262
|
|
|
261
|
-
At rest it
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
At rest it is absent: a card describing every field otherwise stands a glyph beside
|
|
264
|
+
each label, against the labels a reader is scanning
|
|
265
|
+
(INVARIANTS §"A field's own chrome waits for the field"). It keeps its box and arrives
|
|
266
|
+
by opacity alone, with the scope that owns its row (the field, the property, the array
|
|
267
|
+
or matrix, the table its column heads, the section a lone field is named by), each
|
|
268
|
+
reached by child steps so a nested field's marker stays absent under its container's
|
|
269
|
+
hover, and it stays while its surface is open, so the keyboard's `Mod-/` never raises
|
|
270
|
+
a surface off a glyph that is not drawn. The parked description does not depend on
|
|
267
271
|
the lift. */
|
|
268
272
|
.qm-field-hint {
|
|
269
273
|
/* The marker recedes to the label rung; the surface carries the text. */
|
|
@@ -272,7 +276,7 @@
|
|
|
272
276
|
cursor: help;
|
|
273
277
|
padding: 0;
|
|
274
278
|
background: none;
|
|
275
|
-
opacity:
|
|
279
|
+
opacity: 0;
|
|
276
280
|
transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
277
281
|
}
|
|
278
282
|
:global(:is(.qm-field, .qm-object-prop):is(:hover, :focus-within) > .qm-field-label-row)
|
|
@@ -287,6 +291,13 @@
|
|
|
287
291
|
.qm-field-hint[aria-expanded='true'] {
|
|
288
292
|
opacity: 1;
|
|
289
293
|
}
|
|
294
|
+
/* Without a hover there is no lift to wait for, and a tap is the glyph's only door, so
|
|
295
|
+
it rests drawn at the rung a live glyph control rests at. */
|
|
296
|
+
@media (hover: none) {
|
|
297
|
+
.qm-field-hint {
|
|
298
|
+
opacity: var(--_qm-opacity-rest);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
290
301
|
/* The lift, the translucency, the blur and the scale-in come from
|
|
291
302
|
`.qm-popover-surface` (controls.css). This surface's own is a measure: guidance
|
|
292
303
|
is prose, and prose past ~40 characters a line stops being scannable; plus the
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
-->
|
|
75
75
|
<script lang="ts">
|
|
76
76
|
import { onDestroy } from 'svelte';
|
|
77
|
-
import { wording } from './strings.js';
|
|
77
|
+
import { keycap, keyshortcut, wording } from './strings.js';
|
|
78
78
|
|
|
79
79
|
// The surface's words, ambient from the editor root; the package's English
|
|
80
80
|
// off-tree, so this component renders standalone too.
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
import type { IconName } from './icons/nodes.js';
|
|
90
90
|
import {
|
|
91
91
|
FIELD_KEYS,
|
|
92
|
+
LIST_KEYS,
|
|
92
93
|
hasMarks,
|
|
93
94
|
rangeAnchor,
|
|
94
95
|
toggleList,
|
|
@@ -113,19 +114,41 @@
|
|
|
113
114
|
|
|
114
115
|
const SETTLE_MS = 450;
|
|
115
116
|
/** The six content formatting marks. `anchor` is withheld: it draws nothing until
|
|
116
|
-
* comments do.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{ name: '
|
|
121
|
-
{ name: '
|
|
122
|
-
{
|
|
123
|
-
|
|
117
|
+
* comments do. A mark's string is its name, to assistive tech and in its tip
|
|
118
|
+
* (`core/tooltip.ts`); its shortcut is read off the binding, drawn in the tip and
|
|
119
|
+
* stated as `aria-keyshortcuts`, so the name is never the chord too. */
|
|
120
|
+
const MARKS: { name: string; icon: IconName; label: string; keys: string }[] = $derived([
|
|
121
|
+
{ name: 'strong', icon: 'bold', label: t.strings.formatBold, keys: FIELD_KEYS.bold },
|
|
122
|
+
{ name: 'em', icon: 'italic', label: t.strings.formatEmphasis, keys: FIELD_KEYS.italic },
|
|
123
|
+
{
|
|
124
|
+
name: 'underline',
|
|
125
|
+
icon: 'underline',
|
|
126
|
+
label: t.strings.formatUnderline,
|
|
127
|
+
keys: FIELD_KEYS.underline
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'strike',
|
|
131
|
+
icon: 'strikethrough',
|
|
132
|
+
label: t.strings.formatStrikethrough,
|
|
133
|
+
keys: FIELD_KEYS.strike
|
|
134
|
+
},
|
|
135
|
+
{ name: 'code', icon: 'code', label: t.strings.formatCode, keys: FIELD_KEYS.code },
|
|
136
|
+
{ name: 'link', icon: 'link', label: t.strings.formatLink, keys: FIELD_KEYS.link }
|
|
124
137
|
]);
|
|
125
138
|
|
|
126
|
-
const LISTS: { ordered: boolean; icon: IconName;
|
|
127
|
-
{
|
|
128
|
-
|
|
139
|
+
const LISTS: { ordered: boolean; icon: IconName; label: string; keys: string }[] = $derived([
|
|
140
|
+
{
|
|
141
|
+
ordered: true,
|
|
142
|
+
icon: 'list-ordered',
|
|
143
|
+
label: t.strings.formatNumberedList,
|
|
144
|
+
keys: LIST_KEYS.numbered
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
ordered: false,
|
|
148
|
+
icon: 'list',
|
|
149
|
+
label: t.strings.formatBulletedList,
|
|
150
|
+
keys: LIST_KEYS.bulleted
|
|
151
|
+
}
|
|
129
152
|
]);
|
|
130
153
|
|
|
131
154
|
let open = $state(false);
|
|
@@ -519,7 +542,9 @@
|
|
|
519
542
|
floating-ui's positioning box: spread, never styled. `inert` is the half
|
|
520
543
|
of the dismissal the recipe cannot carry: the surface is still on screen
|
|
521
544
|
for the length of the fade, and a surface on its way out is not a thing
|
|
522
|
-
to click, tab into, or read.
|
|
545
|
+
to click, tab into, or read. `data-qm-tip-side` is the side the surface
|
|
546
|
+
landed on, so a button's tip (`core/tooltip.ts`) clears the whole surface
|
|
547
|
+
on the side away from the selection. -->
|
|
523
548
|
{#snippet child({ props, wrapperProps, open: raised })}
|
|
524
549
|
<div {...wrapperProps}>
|
|
525
550
|
<div
|
|
@@ -527,6 +552,7 @@
|
|
|
527
552
|
{...props}
|
|
528
553
|
class="qm-format-popover qm-popover-surface"
|
|
529
554
|
data-qm-root
|
|
555
|
+
data-qm-tip-side={props['data-side']}
|
|
530
556
|
inert={!raised}
|
|
531
557
|
onkeydown={onBarKeyDown}
|
|
532
558
|
onfocusout={onBarFocusOut}
|
|
@@ -545,7 +571,7 @@
|
|
|
545
571
|
class="qm-link-input qm-focus-ring"
|
|
546
572
|
type="text"
|
|
547
573
|
placeholder={t.strings.linkPlaceholder}
|
|
548
|
-
aria-label={t.strings.
|
|
574
|
+
aria-label={t.strings.linkAddress}
|
|
549
575
|
bind:value={linkValue}
|
|
550
576
|
/>
|
|
551
577
|
<button type="submit" class="qm-icon-btn qm-mark-btn qm-focus-ring"
|
|
@@ -577,14 +603,16 @@
|
|
|
577
603
|
class="qm-format-buttons"
|
|
578
604
|
role="group"
|
|
579
605
|
aria-label={t.strings.formatGroup}
|
|
580
|
-
aria-keyshortcuts={FIELD_KEYS.formatBar
|
|
606
|
+
aria-keyshortcuts={keyshortcut(FIELD_KEYS.formatBar)}
|
|
581
607
|
>
|
|
582
608
|
{#each MARKS as m (m.name)}
|
|
583
609
|
<button
|
|
584
610
|
type="button"
|
|
585
611
|
class="qm-icon-btn qm-mark-btn qm-focus-ring"
|
|
586
|
-
|
|
587
|
-
|
|
612
|
+
data-qm-tip={m.label}
|
|
613
|
+
data-qm-tip-keys={keycap(m.keys)}
|
|
614
|
+
aria-label={m.label}
|
|
615
|
+
aria-keyshortcuts={keyshortcut(m.keys)}
|
|
588
616
|
onmousedown={keepFocus}
|
|
589
617
|
onclick={() => toggle(m.name)}><Icon name={m.icon} /></button
|
|
590
618
|
>
|
|
@@ -593,7 +621,6 @@
|
|
|
593
621
|
<span class="qm-format-divider" aria-hidden="true"></span>
|
|
594
622
|
<select
|
|
595
623
|
class="qm-font-select qm-focus-ring"
|
|
596
|
-
title={t.strings.formatFont}
|
|
597
624
|
aria-label={t.strings.formatFont}
|
|
598
625
|
value={family ?? MIXED}
|
|
599
626
|
onchange={(e) => pickFamily(e.currentTarget.value)}
|
|
@@ -613,8 +640,10 @@
|
|
|
613
640
|
<button
|
|
614
641
|
type="button"
|
|
615
642
|
class="qm-icon-btn qm-mark-btn qm-focus-ring"
|
|
616
|
-
|
|
617
|
-
|
|
643
|
+
data-qm-tip={l.label}
|
|
644
|
+
data-qm-tip-keys={keycap(l.keys)}
|
|
645
|
+
aria-label={l.label}
|
|
646
|
+
aria-keyshortcuts={keyshortcut(l.keys)}
|
|
618
647
|
onmousedown={keepFocus}
|
|
619
648
|
onclick={() => toggleLines(l.ordered)}><Icon name={l.icon} /></button
|
|
620
649
|
>
|
|
@@ -689,6 +718,10 @@
|
|
|
689
718
|
border: none;
|
|
690
719
|
border-radius: var(--_qm-radius-inner);
|
|
691
720
|
background: var(--_qm-surface-well);
|
|
721
|
+
color: var(--_qm-ink);
|
|
692
722
|
min-width: 12rem;
|
|
693
723
|
}
|
|
724
|
+
.qm-link-input::placeholder {
|
|
725
|
+
color: var(--_qm-ink-label);
|
|
726
|
+
}
|
|
694
727
|
</style>
|
|
@@ -132,10 +132,11 @@
|
|
|
132
132
|
const reviewed = $derived(splitReview(review));
|
|
133
133
|
/** A member's own proposal: it ticks or unticks the member whole. */
|
|
134
134
|
const proposal = (id: string) => reviewed.below.get(id)?.find((e) => !e.steps.length)?.item;
|
|
135
|
-
/** Whether a member shows as held: as its proposal would leave it, else as stored
|
|
135
|
+
/** Whether a member shows as held: as its proposal would leave it, else as stored, an
|
|
136
|
+
* unheld one under a proposal for a cell of it held, as taking that proposal writes it. */
|
|
136
137
|
const shownHeld = (id: string): boolean => {
|
|
137
138
|
const item = proposal(id);
|
|
138
|
-
return item ? matrixHeld(item.after) : held(id);
|
|
139
|
+
return item ? matrixHeld(item.after) : held(id) || cellReview(id).length > 0;
|
|
139
140
|
};
|
|
140
141
|
/** The member's columns as shown: its proposal's where one ticks it, else the stored. */
|
|
141
142
|
const shownColumns = (id: string): Record<string, unknown> => {
|
|
@@ -213,7 +214,10 @@
|
|
|
213
214
|
* their local, a `$derived` of the value: the document is what the face reads. */
|
|
214
215
|
async function tick(id: string, on: boolean, el: HTMLInputElement): Promise<void> {
|
|
215
216
|
const item = proposal(id);
|
|
217
|
+
const cells = cellReview(id);
|
|
216
218
|
if (item && on === matrixHeld(item.after)) reviewing.act(item.id, 'accept');
|
|
219
|
+
else if (!item && !on && !held(id) && cells.length)
|
|
220
|
+
for (const { item: cell } of cells) reviewing.act(cell.id, 'dismiss');
|
|
217
221
|
else if (!item || !reviewing.answerWith(item.id, on ? ticked(id) : undefined))
|
|
218
222
|
commit(on ? commitMember(map, id, ticked(id)) : unticked(id));
|
|
219
223
|
await flush();
|
|
@@ -391,7 +395,7 @@
|
|
|
391
395
|
<button
|
|
392
396
|
type="button"
|
|
393
397
|
class="qm-icon-btn qm-focus-ring qm-member-remove"
|
|
394
|
-
|
|
398
|
+
data-qm-tip={t.strings.matrixRemove(name)}
|
|
395
399
|
aria-label={t.strings.matrixRemove(name)}
|
|
396
400
|
onclick={() => removeItem(item.id, name)}><Icon name="x" /></button
|
|
397
401
|
>
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Commits at `change` (blur/Enter), not per keystroke: a partial numeric entry
|
|
4
4
|
(`-`, `1.`) is never a document state worth a boundary round-trip, and
|
|
5
5
|
committing it live flashes a coercion diagnostic + `console.error` on every
|
|
6
|
-
intermediate prefix
|
|
7
|
-
region. Where the parent moves on at Enter (`onEnter`), Enter commits at once and
|
|
6
|
+
intermediate prefix. Where the parent moves on at Enter (`onEnter`), Enter commits at once and
|
|
8
7
|
the move follows a number, never a blank or a refused entry. Escape takes a pending
|
|
9
8
|
entry back to what the field holds, as it takes a card rename back, and the focus
|
|
10
9
|
stays; with nothing pending the key is not claimed.
|
|
@@ -13,7 +12,9 @@
|
|
|
13
12
|
(theme.css), and an edit that settles writes it as authored, as `TextField` takes
|
|
14
13
|
its default. A number has no empty answer (quillmark/INVARIANTS §"A blank is a property of the field"),
|
|
15
14
|
so a blank entry commits `undefined`, the unset rung: the parent removes the field,
|
|
16
|
-
the engine renders the default, and the input holds it again.
|
|
15
|
+
the engine renders the default, and the input holds it again. The input's own undo
|
|
16
|
+
back to the default it held unwritten settles as `undefined` too, so taking every edit
|
|
17
|
+
back leaves the field unset, as a text leaf's undo does.
|
|
17
18
|
|
|
18
19
|
The entry grammar is plain decimal: an optional sign and digits, and for a `number`
|
|
19
20
|
a `.` and an exponent, the form `String()` gives a value too small or large for
|
|
@@ -101,6 +102,16 @@
|
|
|
101
102
|
const defaulted = $derived(value == null && !!fallback && local === fallback);
|
|
102
103
|
const drawn = $derived(proposed && proposed.after !== resting ? proposed : undefined);
|
|
103
104
|
|
|
105
|
+
// The default the input held while the field was unwritten, kept across the field's own
|
|
106
|
+
// commits and dropped by anyone else's write: what an undo can return the field to.
|
|
107
|
+
let unwrittenText: string | undefined;
|
|
108
|
+
let committed: number | undefined;
|
|
109
|
+
let undone = false;
|
|
110
|
+
$effect(() => {
|
|
111
|
+
if (value == null) [unwrittenText, committed] = [fallback, undefined];
|
|
112
|
+
else if (value !== committed) unwrittenText = undefined;
|
|
113
|
+
});
|
|
114
|
+
|
|
104
115
|
const partial = $derived(
|
|
105
116
|
integer ? /^\s*[+-]?\d*\s*$/ : /^\s*[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?\s*$/
|
|
106
117
|
);
|
|
@@ -164,6 +175,11 @@
|
|
|
164
175
|
const raw = el.value;
|
|
165
176
|
const entry = raw.trim();
|
|
166
177
|
offered = false;
|
|
178
|
+
if (undone && unwrittenText != null && raw === unwrittenText) {
|
|
179
|
+
undone = false;
|
|
180
|
+
if (value != null) onCommit(undefined);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
167
183
|
if (entry === '') {
|
|
168
184
|
onCommit(undefined);
|
|
169
185
|
local = el.value = fallback ?? '';
|
|
@@ -172,6 +188,7 @@
|
|
|
172
188
|
// Finite as well: a digit run past `Number.MAX_VALUE` reads as `Infinity`.
|
|
173
189
|
const n = whole.test(entry) ? Number(entry) : NaN;
|
|
174
190
|
offered = !Number.isFinite(n);
|
|
191
|
+
if (!offered) committed = n;
|
|
175
192
|
onCommit(offered ? raw : n);
|
|
176
193
|
}
|
|
177
194
|
</script>
|
|
@@ -185,8 +202,6 @@
|
|
|
185
202
|
{placeholder}
|
|
186
203
|
data-default={defaulted ? '' : undefined}
|
|
187
204
|
data-proposed-over={drawn && local === resting ? '' : undefined}
|
|
188
|
-
onpointerenter={() => drawn && reviewing.point(drawn.id, 'pointer')}
|
|
189
|
-
onpointerleave={() => drawn && reviewing.point(undefined, 'pointer')}
|
|
190
205
|
aria-label={id ? undefined : label}
|
|
191
206
|
aria-describedby={describedBy}
|
|
192
207
|
onbeforeinput={filter}
|
|
@@ -194,6 +209,7 @@
|
|
|
194
209
|
local = (e.currentTarget as HTMLInputElement).value;
|
|
195
210
|
reverted = false;
|
|
196
211
|
settled = undefined;
|
|
212
|
+
undone = e instanceof InputEvent && e.inputType === 'historyUndo';
|
|
197
213
|
}}
|
|
198
214
|
onkeydown={onKey}
|
|
199
215
|
onchange={(e) => {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
fieldModels,
|
|
44
44
|
fieldTitle,
|
|
45
45
|
isContainer,
|
|
46
|
+
linesOnly,
|
|
46
47
|
literalText,
|
|
47
48
|
mountKey,
|
|
48
49
|
optionalCell,
|
|
@@ -375,6 +376,7 @@
|
|
|
375
376
|
<EnumField
|
|
376
377
|
label={named}
|
|
377
378
|
id={ids?.control}
|
|
379
|
+
labelledBy={ids?.label}
|
|
378
380
|
describedBy={describes}
|
|
379
381
|
value={shown as string | undefined}
|
|
380
382
|
values={sub.values ?? []}
|
|
@@ -441,6 +443,7 @@
|
|
|
441
443
|
value={shown}
|
|
442
444
|
fallback={contentDefault(sub)}
|
|
443
445
|
plaintext={literalText(sub)}
|
|
446
|
+
paragraphs={linesOnly(sub)}
|
|
444
447
|
placeholder={ownItem ? undefined : noneOf(key, sub)}
|
|
445
448
|
{block}
|
|
446
449
|
label={named}
|
|
@@ -645,11 +648,12 @@
|
|
|
645
648
|
subgrid onto the row that holds them, so a cell's edge is the column's. No
|
|
646
649
|
vertical, no inset, no capacity of its own, and one row per cell, the label having
|
|
647
650
|
moved up to the header. `.qm-array-row` is the row (`ArrayField`), which spends
|
|
648
|
-
the
|
|
651
|
+
the first track on the row's handle and the last on its remove; this box takes the
|
|
652
|
+
rest. */
|
|
649
653
|
.qm-object-bare {
|
|
650
654
|
display: grid;
|
|
651
655
|
grid-template-columns: subgrid;
|
|
652
|
-
grid-column:
|
|
656
|
+
grid-column: 2 / -2;
|
|
653
657
|
}
|
|
654
658
|
.qm-object-bare > .qm-object-grid {
|
|
655
659
|
grid-template-columns: subgrid;
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
addr: Addr;
|
|
30
30
|
inline?: boolean;
|
|
31
31
|
plaintext?: boolean;
|
|
32
|
+
paragraphs?: boolean;
|
|
32
33
|
/**
|
|
33
34
|
* Draw no box: the card body's leaf, and nothing else. Not `block`, which is a
|
|
34
|
-
* different predicate: a `richtext` field declaring `
|
|
35
|
+
* different predicate: a `richtext` field declaring `shape: blocks` is block
|
|
35
36
|
* prose and still a control in a row of controls, so only the caller knows what
|
|
36
37
|
* is paper.
|
|
37
38
|
*/
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
addr,
|
|
84
85
|
inline,
|
|
85
86
|
plaintext,
|
|
87
|
+
paragraphs,
|
|
86
88
|
unframed,
|
|
87
89
|
label,
|
|
88
90
|
labelledBy,
|
|
@@ -141,6 +143,7 @@
|
|
|
141
143
|
container,
|
|
142
144
|
inline,
|
|
143
145
|
plaintext,
|
|
146
|
+
paragraphs,
|
|
144
147
|
label,
|
|
145
148
|
labelledBy,
|
|
146
149
|
describedBy,
|
|
@@ -157,7 +160,7 @@
|
|
|
157
160
|
slash = next;
|
|
158
161
|
},
|
|
159
162
|
onReview: (id, action) => reviewing.heard(id, action, leafKey),
|
|
160
|
-
onReviewPoint: (id
|
|
163
|
+
onReviewPoint: (id) => reviewing.point(id),
|
|
161
164
|
onReviewWriting: (on) => reviewing.writing(on),
|
|
162
165
|
onReviewDrawn: (report) => reviewing.drew(leafKey, report),
|
|
163
166
|
onValuePlanned: (id, state) => reviewing.planned(id, state),
|
|
@@ -241,7 +244,7 @@
|
|
|
241
244
|
.qm-prose-block :global(.ProseMirror) {
|
|
242
245
|
min-height: calc(1em * var(--_qm-leading-body));
|
|
243
246
|
}
|
|
244
|
-
/* Paper, and the withheld box is what says so. Not `block` alone: `
|
|
247
|
+
/* Paper, and the withheld box is what says so. Not `block` alone: `shape` is the
|
|
245
248
|
quill's to declare, so a schema spelling it on a richtext field puts a block leaf in
|
|
246
249
|
a field row, where this rung would break the height agreement above. */
|
|
247
250
|
.qm-prose-block:not(.qm-control-box) {
|
|
@@ -11,9 +11,10 @@ interface Props {
|
|
|
11
11
|
addr: Addr;
|
|
12
12
|
inline?: boolean;
|
|
13
13
|
plaintext?: boolean;
|
|
14
|
+
paragraphs?: boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Draw no box: the card body's leaf, and nothing else. Not `block`, which is a
|
|
16
|
-
* different predicate: a `richtext` field declaring `
|
|
17
|
+
* different predicate: a `richtext` field declaring `shape: blocks` is block
|
|
17
18
|
* prose and still a control in a row of controls, so only the caller knows what
|
|
18
19
|
* is paper.
|
|
19
20
|
*/
|