@quillmark/svelte 0.30.0 → 0.31.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 +2 -2
- package/dist/core/codec/decode.d.ts +3 -2
- package/dist/core/codec/decode.js +15 -11
- package/dist/core/codec/field.d.ts +2 -1
- package/dist/core/codec/field.js +119 -30
- package/dist/core/codec/positions.d.ts +12 -1
- package/dist/core/codec/prose.css +0 -8
- package/dist/core/codec/schema.d.ts +2 -2
- package/dist/core/codec/schema.js +3 -3
- package/dist/core/codec/slash.d.ts +4 -2
- package/dist/core/codec/slash.js +11 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/theme.css +14 -6
- package/dist/visual/ArrayField.svelte +167 -82
- package/dist/visual/BooleanField.svelte +2 -2
- package/dist/visual/Card.svelte +65 -44
- package/dist/visual/DateField.svelte +16 -1
- package/dist/visual/DiagnosticList.svelte +34 -2
- package/dist/visual/EnumField.svelte +58 -44
- package/dist/visual/Field.svelte +13 -3
- package/dist/visual/Field.svelte.d.ts +3 -1
- package/dist/visual/FieldHint.svelte +10 -3
- package/dist/visual/MatrixAdd.svelte +3 -18
- package/dist/visual/MatrixField.svelte +20 -12
- package/dist/visual/ObjectField.svelte +164 -145
- package/dist/visual/ProseField.svelte +6 -1
- package/dist/visual/SlashMenu.svelte +24 -12
- package/dist/visual/SlashMenu.svelte.d.ts +2 -0
- package/dist/visual/VisualEditor.svelte +1 -1
- package/dist/visual/VisualEditor.svelte.d.ts +1 -1
- package/dist/visual/VisualEditorInner.svelte +144 -9
- package/dist/visual/VisualEditorInner.svelte.d.ts +1 -1
- package/dist/visual/controls.css +42 -4
- package/dist/visual/strings.d.ts +27 -10
- package/dist/visual/strings.js +40 -6
- package/dist/visual/structure.d.ts +17 -9
- package/dist/visual/structure.js +19 -16
- package/dist/visual/undo.svelte.d.ts +36 -0
- package/dist/visual/undo.svelte.js +119 -0
- package/package.json +2 -2
- package/dist/visual/hold.d.ts +0 -17
- package/dist/visual/hold.js +0 -39
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
MATRIX_TITLE,
|
|
37
37
|
addedId,
|
|
38
38
|
addedItems,
|
|
39
|
+
titleText,
|
|
39
40
|
baseType,
|
|
40
41
|
commitMember,
|
|
41
42
|
declaredContent,
|
|
@@ -185,7 +186,7 @@
|
|
|
185
186
|
}
|
|
186
187
|
function itemTitle(id: string): string {
|
|
187
188
|
const stored = own(map, id) as Record<string, unknown> | undefined;
|
|
188
|
-
return
|
|
189
|
+
return titleText(stored?.[MATRIX_TITLE]);
|
|
189
190
|
}
|
|
190
191
|
function retitle(id: string, title: string): void {
|
|
191
192
|
commit(commitMember(map, id, memberWrite(matrixColumns(own(map, id)), title)));
|
|
@@ -444,9 +445,11 @@
|
|
|
444
445
|
width: var(--_qm-glyph-control);
|
|
445
446
|
height: var(--_qm-glyph-control);
|
|
446
447
|
}
|
|
447
|
-
/*
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
/* Unticked is an outline, ticked a fill: a box drawn only as a tone over the card is
|
|
449
|
+
a step of about 1.3:1, under WCAG 1.4.11's 3:1 for a control's boundary, and an empty
|
|
450
|
+
box is the one figure every platform's checkbox shares. The edge is the label rung,
|
|
451
|
+
which clears 3:1 over the card in both themes; ticking fills the box with the accent
|
|
452
|
+
and the edge goes with the fill. */
|
|
450
453
|
.qm-tick-input {
|
|
451
454
|
appearance: none;
|
|
452
455
|
margin: 0;
|
|
@@ -454,17 +457,27 @@
|
|
|
454
457
|
height: 100%;
|
|
455
458
|
border: none;
|
|
456
459
|
border-radius: var(--_qm-radius-inner);
|
|
457
|
-
background:
|
|
460
|
+
background: transparent;
|
|
461
|
+
box-shadow: inset 0 0 0 calc(2 * var(--_qm-border-width)) var(--_qm-ink-label);
|
|
458
462
|
cursor: pointer;
|
|
459
|
-
transition:
|
|
463
|
+
transition:
|
|
464
|
+
background-color var(--_qm-duration-fast) var(--_qm-ease-reverse),
|
|
465
|
+
box-shadow var(--_qm-duration-fast) var(--_qm-ease-reverse);
|
|
460
466
|
}
|
|
461
467
|
.qm-tick-input:checked,
|
|
462
468
|
.qm-tick-fixed {
|
|
463
469
|
background: var(--_qm-accent);
|
|
470
|
+
box-shadow: none;
|
|
464
471
|
}
|
|
465
472
|
.qm-tick-fixed {
|
|
466
473
|
cursor: default;
|
|
467
474
|
}
|
|
475
|
+
/* Forced colours drop the inset shadow the outline is drawn with. */
|
|
476
|
+
@media (forced-colors: active) {
|
|
477
|
+
.qm-tick-input {
|
|
478
|
+
border: calc(2 * var(--_qm-border-width)) solid CanvasText;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
468
481
|
/* The mark rides over the input and takes no press of its own; it is drawn by the
|
|
469
482
|
input's state, in the ink the surface reads over the accent. */
|
|
470
483
|
.qm-tick :global(.qm-tick-mark) {
|
|
@@ -517,7 +530,7 @@
|
|
|
517
530
|
.qm-member-remove {
|
|
518
531
|
flex-shrink: 0;
|
|
519
532
|
color: var(--_qm-ink-label);
|
|
520
|
-
opacity: var(--_qm-opacity-
|
|
533
|
+
opacity: var(--_qm-opacity-rest);
|
|
521
534
|
transition:
|
|
522
535
|
opacity var(--_qm-duration-fast) var(--_qm-ease-reverse),
|
|
523
536
|
background-color var(--_qm-duration-fast) var(--_qm-ease-reverse),
|
|
@@ -531,11 +544,6 @@
|
|
|
531
544
|
background: var(--_qm-danger-tint);
|
|
532
545
|
color: var(--_qm-danger);
|
|
533
546
|
}
|
|
534
|
-
@media (hover: none) {
|
|
535
|
-
.qm-member-remove {
|
|
536
|
-
opacity: var(--_qm-opacity-muted);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
547
|
/* The default's set is what prints and nothing written: its titles, its ticks and
|
|
540
548
|
every value its columns draw take the default rung (theme.css), and the first
|
|
541
549
|
gesture, writing it, takes it off. */
|
|
@@ -141,10 +141,10 @@
|
|
|
141
141
|
const entries = $derived(Object.entries(properties ?? {}));
|
|
142
142
|
const obj = $derived((value ?? {}) as Record<string, unknown>);
|
|
143
143
|
const has = (key: string): boolean => Object.hasOwn(properties ?? {}, key);
|
|
144
|
-
const
|
|
144
|
+
const placements = $derived(
|
|
145
145
|
placed
|
|
146
146
|
? new Map(
|
|
147
|
-
placeFields(fieldModels({ fields: properties ?? {} })).map((p) => [p.field.name, p
|
|
147
|
+
placeFields(fieldModels({ fields: properties ?? {} })).map((p) => [p.field.name, p])
|
|
148
148
|
)
|
|
149
149
|
: undefined
|
|
150
150
|
);
|
|
@@ -303,10 +303,11 @@
|
|
|
303
303
|
'qm-object-prop',
|
|
304
304
|
{
|
|
305
305
|
'qm-prop-full': isContainer(kind),
|
|
306
|
-
'qm-prop-wide': block || (!isContainer(kind) &&
|
|
306
|
+
'qm-prop-wide': block || (!isContainer(kind) && placements?.get(key)?.span === 'full')
|
|
307
307
|
}
|
|
308
308
|
]}
|
|
309
309
|
data-qm-prop={key}
|
|
310
|
+
data-tail={placements?.get(key)?.tail}
|
|
310
311
|
>
|
|
311
312
|
{#if ids && kind !== 'array' && kind !== 'matrix'}
|
|
312
313
|
<FieldLabel
|
|
@@ -322,152 +323,157 @@
|
|
|
322
323
|
{countId}
|
|
323
324
|
/>
|
|
324
325
|
{/if}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
326
|
+
<!-- The control and its diagnostics share the control's track, as `Field`'s stack
|
|
327
|
+
does: the property's subgrid holds two tracks, so a third child would land on
|
|
328
|
+
the control. -->
|
|
329
|
+
<div class="qm-prop-stack">
|
|
330
|
+
{#if kind === 'enum'}
|
|
331
|
+
<EnumField
|
|
332
|
+
label={named}
|
|
333
|
+
id={ids?.control}
|
|
334
|
+
describedBy={describes}
|
|
335
|
+
value={obj[key] as string | undefined}
|
|
336
|
+
values={sub.values ?? []}
|
|
337
|
+
fallback={sub.default as string | undefined}
|
|
338
|
+
blankTitle={sub.ui?.blank_title}
|
|
339
|
+
optional={optionalCell(sub)}
|
|
340
|
+
onCommit={(v) => commitProp(key, v)}
|
|
341
|
+
/>
|
|
342
|
+
{:else if kind === 'number'}
|
|
343
|
+
<NumberField
|
|
344
|
+
label={named}
|
|
345
|
+
id={ids?.control}
|
|
346
|
+
describedBy={describes}
|
|
347
|
+
value={obj[key] as number | undefined}
|
|
348
|
+
integer={baseType(sub) === 'integer'}
|
|
349
|
+
fallback={textDefault(sub)}
|
|
350
|
+
placeholder={noneOf(key, sub)}
|
|
351
|
+
onCommit={(v) => commitProp(key, v)}
|
|
352
|
+
/>
|
|
353
|
+
{:else if kind === 'boolean'}
|
|
354
|
+
<BooleanField
|
|
355
|
+
label={named}
|
|
356
|
+
id={ids?.control}
|
|
357
|
+
describedBy={describes}
|
|
358
|
+
value={renderedBoolean(obj[key])}
|
|
359
|
+
fallback={sub.default as boolean | undefined}
|
|
360
|
+
optional={optionalCell(sub)}
|
|
361
|
+
onCommit={(v) => commitProp(key, v)}
|
|
362
|
+
/>
|
|
363
|
+
{:else if kind === 'date'}
|
|
364
|
+
<DateField
|
|
365
|
+
label={named}
|
|
366
|
+
labelledBy={ids?.label}
|
|
367
|
+
describedBy={describes}
|
|
368
|
+
value={obj[key] as string | undefined}
|
|
369
|
+
fallback={sub.default != null ? String(sub.default) : undefined}
|
|
370
|
+
datetime={baseType(sub) === 'datetime'}
|
|
371
|
+
onCommit={(v) => commitProp(key, v)}
|
|
372
|
+
/>
|
|
373
|
+
{:else if kind === 'text'}
|
|
374
|
+
<TextField
|
|
375
|
+
label={named}
|
|
376
|
+
id={ids?.control}
|
|
377
|
+
describedBy={describes}
|
|
378
|
+
value={obj[key] as string | undefined}
|
|
379
|
+
fallback={textDefault(sub)}
|
|
380
|
+
placeholder={noneOf(key, sub)}
|
|
381
|
+
onCommit={(v) => commitProp(key, v)}
|
|
382
|
+
onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
|
|
383
|
+
/>
|
|
384
|
+
{:else if kind === 'prose'}
|
|
385
|
+
<!-- Keyed by name, so a re-derive of the container this cell commits whole
|
|
381
386
|
leaves the leaf mounted and the caret in it. -->
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
387
|
+
<ProseValue
|
|
388
|
+
bind:this={proseEls[key]}
|
|
389
|
+
content={() => contentAt([key])}
|
|
390
|
+
value={obj[key]}
|
|
391
|
+
fallback={contentDefault(sub)}
|
|
392
|
+
plaintext={literalText(sub)}
|
|
393
|
+
placeholder={noneOf(key, sub)}
|
|
394
|
+
{block}
|
|
395
|
+
label={named}
|
|
396
|
+
labelledBy={ids?.label}
|
|
397
|
+
describedBy={countId ? [describes, countId].filter(Boolean).join(' ') : describes}
|
|
398
|
+
cap={cap && { ...cap, onCount: (n) => (counts[key] = n) }}
|
|
399
|
+
onChange={(rt) =>
|
|
400
|
+
commitProp(key, optionalCell(sub) && isEmptyContent(rt) ? undefined : rt)}
|
|
401
|
+
onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
|
|
402
|
+
/>
|
|
403
|
+
{:else if kind === 'array'}
|
|
404
|
+
<!-- The repeater owns its label row, the add chip sharing it (`Field` skips
|
|
400
405
|
its own label for one too), so the names are handed down rather than
|
|
401
406
|
drawn here. Its rows are collapsed rows again: the depth an open row
|
|
402
407
|
under an open row costs is two rungs of the ladder and one figure. -->
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
408
|
+
<ArrayField
|
|
409
|
+
bind:this={nestedEls[key]}
|
|
410
|
+
value={obj[key]}
|
|
411
|
+
fallback={Array.isArray(sub.default) ? sub.default : undefined}
|
|
412
|
+
items={sub.items}
|
|
413
|
+
layout={arrayLayout(sub)}
|
|
414
|
+
max={sub.max}
|
|
415
|
+
label={fieldTitle(key, sub)}
|
|
416
|
+
description={sub.description}
|
|
417
|
+
labelId={ids?.label}
|
|
418
|
+
descriptionId={describes}
|
|
419
|
+
idBase={ids?.control}
|
|
420
|
+
contentAt={(path) => contentAt([key, ...path])}
|
|
421
|
+
onCommit={(v) => commitProp(key, v)}
|
|
422
|
+
diagnostics={deep}
|
|
423
|
+
/>
|
|
424
|
+
{:else if kind === 'object'}
|
|
425
|
+
<ObjectField
|
|
426
|
+
bind:this={nestedEls[key]}
|
|
427
|
+
value={obj[key] as Record<string, unknown> | undefined}
|
|
428
|
+
properties={sub.properties}
|
|
429
|
+
{placed}
|
|
430
|
+
label={ids ? undefined : fallbackName(key, sub)}
|
|
431
|
+
idBase={ids?.control}
|
|
432
|
+
labelledBy={ids?.label}
|
|
433
|
+
describedBy={describes}
|
|
434
|
+
contentAt={(path) => contentAt([key, ...path])}
|
|
435
|
+
onCommit={(v) => commitProp(key, v)}
|
|
436
|
+
diagnostics={deep}
|
|
437
|
+
/>
|
|
438
|
+
{:else if kind === 'matrix'}
|
|
439
|
+
<MatrixField
|
|
440
|
+
bind:this={nestedEls[key]}
|
|
441
|
+
value={obj[key] as Record<string, unknown> | undefined}
|
|
442
|
+
schema={sub}
|
|
443
|
+
label={fieldTitle(key, sub)}
|
|
444
|
+
description={sub.description}
|
|
445
|
+
labelId={ids?.label}
|
|
446
|
+
descriptionId={describes}
|
|
447
|
+
idBase={ids?.control}
|
|
448
|
+
contentAt={(path) => contentAt([key, ...path])}
|
|
449
|
+
onCommit={(v) => commitProp(key, v)}
|
|
450
|
+
diagnostics={deep}
|
|
451
|
+
/>
|
|
452
|
+
{:else if kind === 'variant'}
|
|
453
|
+
<VariantField
|
|
454
|
+
bind:this={nestedEls[key]}
|
|
455
|
+
value={obj[key] as Record<string, unknown> | undefined}
|
|
456
|
+
schema={sub}
|
|
457
|
+
ghostMember={sub.default as string | undefined}
|
|
458
|
+
label={fieldTitle(key, sub)}
|
|
459
|
+
id={ids?.control}
|
|
460
|
+
labelledBy={ids?.label}
|
|
461
|
+
describedBy={describes}
|
|
462
|
+
contentAt={(path) => contentAt([key, ...path])}
|
|
463
|
+
onCommit={(v) => commitProp(key, v)}
|
|
464
|
+
diagnostics={deep}
|
|
465
|
+
/>
|
|
466
|
+
{:else}
|
|
467
|
+
<TextField
|
|
468
|
+
label={named}
|
|
469
|
+
id={ids?.control}
|
|
470
|
+
describedBy={describes}
|
|
471
|
+
value={obj[key] as string | undefined}
|
|
472
|
+
onCommit={(v) => commitProp(key, v)}
|
|
473
|
+
/>
|
|
474
|
+
{/if}
|
|
475
|
+
<DiagnosticList diagnostics={own} />
|
|
476
|
+
</div>
|
|
471
477
|
</div>
|
|
472
478
|
{/each}
|
|
473
479
|
</div>
|
|
@@ -535,6 +541,12 @@
|
|
|
535
541
|
align-items: start;
|
|
536
542
|
min-width: 0;
|
|
537
543
|
}
|
|
544
|
+
.qm-prop-stack {
|
|
545
|
+
display: flex;
|
|
546
|
+
flex-direction: column;
|
|
547
|
+
gap: var(--_qm-space);
|
|
548
|
+
min-width: 0;
|
|
549
|
+
}
|
|
538
550
|
/* A record of one cell takes half the capacity: at full capacity a single track reads
|
|
539
551
|
as truncated, and there are no sibling properties for it to line up with. A placed
|
|
540
552
|
property's span is `placeFields`', which strands a lone one to the whole row as it
|
|
@@ -545,6 +557,13 @@
|
|
|
545
557
|
/* A block prose property holds paragraphs, so a track beside it stands in whitespace
|
|
546
558
|
once it grows (`packable`); its label still rides the row above it. A placed
|
|
547
559
|
property `placeFields` gives the whole row spans it the same way. */
|
|
560
|
+
/* A placed run's last cell where its capacity would leave it alone (`RunTail`). */
|
|
561
|
+
.qm-object-prop[data-tail='odd'] {
|
|
562
|
+
grid-column: var(--tail-odd);
|
|
563
|
+
}
|
|
564
|
+
.qm-object-prop[data-tail='lone'] {
|
|
565
|
+
grid-column: var(--tail-lone);
|
|
566
|
+
}
|
|
548
567
|
.qm-object-prop.qm-prop-wide,
|
|
549
568
|
.qm-object-prop.qm-prop-wide:only-child {
|
|
550
569
|
grid-column: 1 / -1;
|
|
@@ -189,7 +189,12 @@
|
|
|
189
189
|
<span id={heldId} class="qm-prose-held-note">{t.strings.proseHeld}</span>
|
|
190
190
|
{/if}
|
|
191
191
|
</div>
|
|
192
|
-
<SlashMenu
|
|
192
|
+
<SlashMenu
|
|
193
|
+
menu={slash}
|
|
194
|
+
leaf={() => controller}
|
|
195
|
+
label={t.strings.slashLabel}
|
|
196
|
+
name={t.strings.slashName}
|
|
197
|
+
/>
|
|
193
198
|
|
|
194
199
|
<style>
|
|
195
200
|
/* A leaf the inline schema does not constrain grows, and opens at one line box: the
|
|
@@ -30,8 +30,10 @@
|
|
|
30
30
|
leaf: () => FieldController | undefined;
|
|
31
31
|
/** The menu's accessible name. */
|
|
32
32
|
label: string;
|
|
33
|
+
/** A command's row name, by its token. */
|
|
34
|
+
name: (command: string) => string;
|
|
33
35
|
}
|
|
34
|
-
let { menu, leaf, label }: Props = $props();
|
|
36
|
+
let { menu, leaf, label, name: nameOf }: Props = $props();
|
|
35
37
|
|
|
36
38
|
let open = $derived(!!menu && menu.items.length > 0);
|
|
37
39
|
|
|
@@ -95,9 +97,10 @@
|
|
|
95
97
|
aria-label={label}
|
|
96
98
|
inert={!raised}
|
|
97
99
|
>
|
|
98
|
-
<!-- The row is the command
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
<!-- The row is the command's name, and at its end the command as typed,
|
|
101
|
+
leading `/` and all: the menu is a completion of the run in the text,
|
|
102
|
+
so the token is what the run reads as, and the name is what a reader
|
|
103
|
+
who has not learned the tokens picks by. -->
|
|
101
104
|
{#each menu?.items ?? [] as name, i (name)}
|
|
102
105
|
<button
|
|
103
106
|
type="button"
|
|
@@ -107,7 +110,8 @@
|
|
|
107
110
|
onclick={() => leaf()?.slashPick(name)}
|
|
108
111
|
onpointerenter={() => leaf()?.slashFocus(name)}
|
|
109
112
|
>
|
|
110
|
-
|
|
113
|
+
<span class="qm-slash-name">{nameOf(name)}</span>
|
|
114
|
+
<span class="qm-slash-token" aria-hidden="true">/{name}</span>
|
|
111
115
|
</button>
|
|
112
116
|
{/each}
|
|
113
117
|
</div>
|
|
@@ -122,15 +126,11 @@
|
|
|
122
126
|
`.qm-menu-surface` / `.qm-menu-item` (controls.css): the same recipe the enum
|
|
123
127
|
listbox and the card stack's kind menu draw, because all three are lists picked
|
|
124
128
|
from. What is here is this menu's own: a measure, so a long label does not stretch
|
|
125
|
-
the surface across the card, a scroll for a filtered list that stays long
|
|
126
|
-
face. Monospace, where the sibling menus are not: they offer values of the document
|
|
127
|
-
and read as the prose around them, where these are commands, and the surface
|
|
128
|
-
already spells a literal in that face (the `code` mark, `codec/prose.css`). */
|
|
129
|
+
the surface across the card, and a scroll for a filtered list that stays long. */
|
|
129
130
|
.qm-slash-menu {
|
|
130
|
-
min-width:
|
|
131
|
+
min-width: 14rem;
|
|
131
132
|
max-height: 16rem;
|
|
132
133
|
overflow-y: auto;
|
|
133
|
-
font-family: var(--_qm-font-mono);
|
|
134
134
|
}
|
|
135
135
|
/* An item is a row of text, not a glyph: the whole row is the target, and the label
|
|
136
136
|
is the accessible name with nothing beside it. A button is a button, so the UA's
|
|
@@ -138,7 +138,10 @@
|
|
|
138
138
|
taken back here: a scoped block is unlayered, so a reset would outrank the recipe's
|
|
139
139
|
highlight; the resting transparent is the recipe's own (controls.css). */
|
|
140
140
|
.qm-slash-item {
|
|
141
|
-
display:
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: baseline;
|
|
143
|
+
justify-content: space-between;
|
|
144
|
+
gap: var(--_qm-space-3);
|
|
142
145
|
width: 100%;
|
|
143
146
|
border: none;
|
|
144
147
|
font: inherit;
|
|
@@ -146,4 +149,13 @@
|
|
|
146
149
|
text-align: left;
|
|
147
150
|
white-space: nowrap;
|
|
148
151
|
}
|
|
152
|
+
/* The token in the face the surface spells a literal in (the `code` mark,
|
|
153
|
+
`codec/prose.css`), at the label ink and rung: the name is the row, and the token is
|
|
154
|
+
the shortcut a menu row carries at its end. Hidden from the accessible name, which
|
|
155
|
+
would read the command twice. */
|
|
156
|
+
.qm-slash-token {
|
|
157
|
+
font-family: var(--_qm-font-mono);
|
|
158
|
+
font-size: var(--_qm-text-label);
|
|
159
|
+
color: var(--_qm-ink-label);
|
|
160
|
+
}
|
|
149
161
|
</style>
|
|
@@ -7,6 +7,8 @@ interface Props {
|
|
|
7
7
|
leaf: () => FieldController | undefined;
|
|
8
8
|
/** The menu's accessible name. */
|
|
9
9
|
label: string;
|
|
10
|
+
/** A command's row name, by its token. */
|
|
11
|
+
name: (command: string) => string;
|
|
10
12
|
}
|
|
11
13
|
declare const SlashMenu: import("svelte").Component<Props, {}, "">;
|
|
12
14
|
type SlashMenu = ReturnType<typeof SlashMenu>;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { untrack } from 'svelte';
|
|
27
27
|
import { reportRebindIgnored } from '../core/rebind.svelte.js';
|
|
28
28
|
import type { DocPath, Landing } from '../core/address.js';
|
|
29
|
-
import type { Delta } from '
|
|
29
|
+
import type { Delta } from '../core/codec/positions.js';
|
|
30
30
|
import type { CardId, CardOp } from './signals.js';
|
|
31
31
|
import type { VisualEditorProps } from './props.js';
|
|
32
32
|
import VisualEditorInner from './VisualEditorInner.svelte';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DocPath, Landing } from '../core/address.js';
|
|
2
|
-
import type { Delta } from '
|
|
2
|
+
import type { Delta } from '../core/codec/positions.js';
|
|
3
3
|
import type { CardId, CardOp } from './signals.js';
|
|
4
4
|
import type { VisualEditorProps } from './props.js';
|
|
5
5
|
declare const VisualEditor: import("svelte").Component<VisualEditorProps, {
|