@quillmark/svelte 0.29.0 → 0.29.2

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 CHANGED
@@ -144,7 +144,7 @@ Hand it a different `doc` and the editor **re-keys itself**: every leaf remounts
144
144
  <button onclick={() => editor?.focusField('main.subject')}>Jump to subject</button>
145
145
  ```
146
146
 
147
- `insertCard` hands back the new card's `cardId`; `removeCard`, `moveCard` and `setKind` take one. `focusField` reaches any mounted field: a prose leaf takes its view's focus, a form control the same handoff a click on its label takes, and either way the group holding it is revealed first. A card key or a path the surface does not hold is a no-op that reports `target-unknown` through `onError` at `dev` severity.
147
+ `insertCard` hands back the new card's `cardId`; `removeCard`, `moveCard` and `setKind` take one. `focusField` reaches any mounted field: a prose leaf takes its view's focus, a form control the same handoff a click on its label takes, and either way the group holding it is revealed first. `washField` plays the same arrival wash over a field and nothing else, for a change the host wrote: focus, scroll and closed groups stay as they are, and a field in a closed group washes nothing. A card key or a path the surface does not hold is a no-op that reports `target-unknown` through `onError` at `dev` severity.
148
148
 
149
149
  ### Wording
150
150
 
@@ -352,6 +352,11 @@
352
352
  `check:style`'s rhythm axis sees each of them read a rung, never that they read
353
353
  the same one — the case `--_qm-inset-control` above is cut for. */
354
354
  --_qm-nest: var(--_qm-space-3);
355
+ /* A card's inline inset: its edge to the line its section strokes stand on, and the
356
+ text column's base at both ends. A step tighter than the nest, since the edge
357
+ closes a block rather than nesting one. A rung because the card and the tip
358
+ tucked under `main` are two components holding it. */
359
+ --_qm-card-inset: var(--_qm-space-2);
355
360
  /* The numerals a list marker is given room for: two digits, so a tenth item's number
356
361
  stands inside the leaf as the first's does. In `ch`, so it tracks the face the
357
362
  numbers are set in. */
@@ -437,12 +437,13 @@
437
437
  than the nesting rung the verticals inside keep: this edge closes the block rather
438
438
  than nesting one, and the rules it holds run that much further for it.
439
439
 
440
- Inside that inset is the card's one text column (`--_qm-column`): the title, a
441
- top-level field, the body's lines, the recovery note and the delete glyph's far edge
442
- all stand on it, so the card reads as one measure at both ends. */
440
+ Inside that inset is the card's one text column (`--_qm-column`), at both ends: the
441
+ title, a field, a heading, the body's lines and the recovery note start on it, and a
442
+ field's well, a line of the body and the delete glyph end on it, so the card reads
443
+ as one measure centred in its own edge. A section's nesting indents the start alone. */
443
444
  .qm-card {
444
445
  border-radius: var(--_qm-radius);
445
- padding: var(--_qm-space-3) var(--_qm-space-2);
446
+ padding: var(--_qm-space-3) var(--_qm-card-inset);
446
447
  background: var(--_qm-surface);
447
448
  display: flex;
448
449
  flex-direction: column;
@@ -454,13 +455,13 @@
454
455
  opens on its body keeps the full inset — prose is neither a heading nor a
455
456
  field row. */
456
457
  .qm-card.qm-main:has(> .qm-card-body > .qm-card-meta:first-child) {
457
- padding-top: var(--_qm-space);
458
+ padding-top: calc(var(--_qm-card-inset) - var(--_qm-space));
458
459
  }
459
460
  /* A section heading leading it: the vertical starts at the content's
460
461
  top-left, so the top inset is the inline one and the tip is a square
461
462
  corner of the card. */
462
463
  .qm-card.qm-main:has(> .qm-card-body > .qm-card-meta:first-child > .qm-groups:first-child) {
463
- padding-top: var(--_qm-space-2);
464
+ padding-top: var(--_qm-card-inset);
464
465
  }
465
466
  .qm-card-header {
466
467
  display: flex;
@@ -587,11 +588,12 @@
587
588
  accordion spends the same rung from its header and its panel, where it also caps the
588
589
  vertical those two edges hold.
589
590
 
590
- No stroke: a vertical would mark a section a reader has no name for. The start
591
- inset is the column, so a top-level field and a section heading share it. */
591
+ No stroke: a vertical would mark a section a reader has no name for. The inset is
592
+ the column at both ends, so a top-level field and a section heading share its start
593
+ and every well in the card shares its end. */
592
594
  .qm-section {
593
595
  padding-block: var(--_qm-space);
594
- padding-inline-start: var(--_qm-column);
596
+ padding-inline: var(--_qm-column);
595
597
  }
596
598
  /* Where it faces a rule, the rung a heading already stands off one. The fields
597
599
  sit on the heading column, not the card's edge. */
@@ -616,8 +618,9 @@
616
618
  --row-gap: var(--_qm-space-3);
617
619
  row-gap: var(--row-gap);
618
620
  }
619
- /* The nesting vertical, one `--_qm-nest` in from the card's edge with the panel's
620
- fields the same rung off it (ARCHITECTURE §"A plane is a tone"). `--_qm-border` and
621
+ /* The nesting vertical, on the card's inset with the panel's fields one `--_qm-nest`
622
+ off it (ARCHITECTURE §"A plane is a tone"). The end inset is the column's, so the
623
+ panel's wells end where a top-level field's do. `--_qm-border` and
621
624
  not `--_qm-accent`: the verticals and the rules beside them are one stroke at every
622
625
  depth, and a tone that changed as it went in would read as unrelated lines rather
623
626
  than one figure. A named section is what earns it, which is why the ungrouped block
@@ -637,6 +640,7 @@
637
640
  display: flex;
638
641
  flex-direction: column;
639
642
  border-left: var(--_qm-vertical-width) solid transparent;
643
+ padding-inline-end: var(--_qm-column);
640
644
  padding-bottom: var(--_qm-space);
641
645
  margin-bottom: calc(-1 * var(--_qm-space));
642
646
  transition:
@@ -117,7 +117,7 @@
117
117
  margin-top: calc(var(--_qm-radius) * -1);
118
118
  border-radius: 0 0 var(--_qm-radius) var(--_qm-radius);
119
119
  padding: calc(var(--_qm-space-3) + var(--_qm-radius))
120
- calc(var(--_qm-space-2) + var(--_qm-column)) var(--_qm-space-3);
120
+ calc(var(--_qm-card-inset) + var(--_qm-column)) var(--_qm-space-3);
121
121
  background: var(--_qm-tips-surface);
122
122
  display: flex;
123
123
  flex-direction: column;
@@ -75,6 +75,10 @@
75
75
  export async function focusField(field: DocPath): Promise<void> {
76
76
  await inner?.focusField(field);
77
77
  }
78
+ /** Wash the field at `field` where it is on show, without focusing or revealing it. */
79
+ export function washField(field: DocPath): void {
80
+ inner?.washField(field);
81
+ }
78
82
  /** Seed a card of `kind` at `at` (default: the end); the new card's session key. */
79
83
  export function insertCard(kind: string, at?: number): CardId | undefined {
80
84
  return inner?.insertCard(kind, at);
@@ -5,6 +5,7 @@ import type { VisualEditorProps } from './props.js';
5
5
  declare const VisualEditor: import("svelte").Component<VisualEditorProps, {
6
6
  setCaret: (at: Landing) => Promise<void>;
7
7
  focusField: (field: DocPath) => Promise<void>;
8
+ washField: (field: DocPath) => void;
8
9
  insertCard: (kind: string, at?: number) => CardId | undefined;
9
10
  removeCard: (cardId: CardId) => void;
10
11
  moveCard: (cardId: CardId, dir: -1 | 1) => void;
@@ -85,7 +85,6 @@
85
85
  import { raiseGuidance } from './guidance.js';
86
86
  import { familiesOf, registerFaces } from './fonts.js';
87
87
  import Card from './Card.svelte';
88
- import Icon from './icons/Icon.svelte';
89
88
  import TipsCard from './TipsCard.svelte';
90
89
  import FormatPopover from './FormatPopover.svelte';
91
90
  // The add trigger and the kind menu draw shared recipes; a component carrying a
@@ -837,6 +836,18 @@
837
836
  const box = await land(found, undefined);
838
837
  if (span.alive) bloom(box);
839
838
  }
839
+ /** Play the arrival wash over the field at `field` and touch nothing else: no focus,
840
+ * no reveal, no scroll. A field in a closed panel is skipped, its box clipped to
841
+ * nothing; a nested address washes its field's box, a row being something only a
842
+ * landing opens. */
843
+ export function washField(field: DocPath): void {
844
+ if (!span.alive) return;
845
+ const target = leafTargetFor(field);
846
+ const control = target && leaves.control(target.key);
847
+ if (!control) return missed(`no mounted field at ${field}`, field);
848
+ for (let n: HTMLElement | null = control.el; n; n = n.parentElement) if (n.inert) return;
849
+ bloom(control.el);
850
+ }
840
851
  /** Seed a card of `kind` and insert it at `at` (default: the end). Returns the new
841
852
  * card's session key, or `undefined` when the quill seeds no card of that kind. */
842
853
  export function insertCard(kind: string, at: number = cardIds.length): CardId | undefined {
@@ -1025,21 +1036,20 @@
1025
1036
  {#if kinds.length}
1026
1037
  <!-- The strip past the last card is the append point, the one a reader looks for
1027
1038
  rather than finds by position, so it alone states itself in words at rest. A gap
1028
- between cards carries a plus where the words would be: the strip is the gap, the
1029
- pill it fills on hover is the space the new card takes, and the plus says what a
1030
- press there does. -->
1039
+ between cards draws nothing inside it: the strip is the gap, and the pill it fills
1040
+ on hover is the space the new card takes. -->
1031
1041
  {@const marked = atIndex === model.cards.length}
1032
1042
  <div class={['qm-add-card', { 'qm-add-card-marked': marked }]}>
1033
1043
  <!-- Marked, the words are the accessible name and no `aria-label` doubles
1034
1044
  them; bare, the same words land as the label, the strip having no
1035
- geometry to carry them. -->
1045
+ content to carry them. -->
1036
1046
  {#if kinds.length === 1}
1037
1047
  <button
1038
1048
  type="button"
1039
1049
  class="qm-add-btn qm-add-affordance qm-tap-floor qm-focus-ring"
1040
1050
  aria-label={marked ? undefined : merged.addCard}
1041
1051
  onclick={() => addCard(atIndex, kinds[0], true)}
1042
- >{#if marked}{merged.addCard}{:else}<Icon name="plus" class="qm-add-glyph" />{/if}</button
1052
+ >{#if marked}{`+ ${merged.addCard}`}{/if}</button
1043
1053
  >
1044
1054
  {:else}
1045
1055
  <!-- Multi-kind add: pick the kind, then seed + insert. A menu rather than a
@@ -1051,10 +1061,7 @@
1051
1061
  <DropdownMenu.Trigger
1052
1062
  class="qm-add-btn qm-add-affordance qm-tap-floor qm-focus-ring"
1053
1063
  aria-label={marked ? undefined : merged.addCard}
1054
- >{#if marked}{merged.addCard}{:else}<Icon
1055
- name="plus"
1056
- class="qm-add-glyph"
1057
- />{/if}</DropdownMenu.Trigger
1064
+ >{#if marked}{`+ ${merged.addCard}`}{/if}</DropdownMenu.Trigger
1058
1065
  >
1059
1066
  <DropdownMenu.Portal to={rootEl}>
1060
1067
  <DropdownMenu.Content
@@ -1191,8 +1198,8 @@
1191
1198
  /* Unboxed, like every button, and not dashed: a dashed edge is the placeholder idiom
1192
1199
  ("nothing is here yet"), which on a button reads as disabled or as a drop target. It
1193
1200
  stays honest in one place, the un-schemable card (`Card.svelte`), which is a state
1194
- rather than a control. A gap's trigger rests invisible, so the fill and the plus are
1195
- the whole of what it shows: the pill fills the strip because the strip is what was
1201
+ rather than a control. A gap's trigger rests invisible, so the fill is the whole of
1202
+ what it shows: the pill fills the strip because the strip is what was
1196
1203
  pressed, and the strip is the gap, so the fill is the card-to-be drawn where it will
1197
1204
  land.
1198
1205
 
@@ -1220,13 +1227,6 @@
1220
1227
  opacity var(--_qm-duration-fast) var(--_qm-ease-reverse),
1221
1228
  background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
1222
1229
  }
1223
- /* The pill's own height, so a turned-down `--qm-space` shrinks the glyph with the
1224
- strip rather than spilling it past the pill. */
1225
- .qm-add-card :global(.qm-add-glyph) {
1226
- height: 100%;
1227
- width: auto;
1228
- aspect-ratio: 1;
1229
- }
1230
1230
  /* The strip that holds words at rest takes the height that centres them, and rests dim
1231
1231
  rather than absent, having something to be seen. */
1232
1232
  .qm-add-card-marked :global(.qm-add-btn) {
@@ -7,6 +7,7 @@ declare const VisualEditorInner: import("svelte").Component<VisualEditorProps, {
7
7
  setCaret: (at: Landing) => Promise<void>;
8
8
  getActiveLeaf: () => ActiveProse | undefined;
9
9
  focusField: (field: DocPath) => Promise<void>;
10
+ washField: (field: DocPath) => void;
10
11
  insertCard: (kind: string, at?: number) => CardId | undefined;
11
12
  removeCard: (cardId: CardId) => void;
12
13
  moveCard: (cardId: CardId, dir: -1 | 1) => void;
@@ -14,8 +14,8 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings {
14
14
  cardDelete: string;
15
15
  /** The card-title input's accessible name. */
16
16
  cardTitle: string;
17
- /** The trailing strip's visible words, which are also every strip's accessible
18
- * name. One string over
17
+ /** The trailing strip's visible words, drawn after a `+`, and every
18
+ * strip's accessible name. One string over
19
19
  * one kind and many: the trigger seeds a card, and which kind is the menu's word
20
20
  * to say or the schema's to have already settled. */
21
21
  addCard: string;
@@ -39,7 +39,7 @@ export const DEFAULT_VISUAL_STRINGS = {
39
39
  cardMoveDown: 'Move down',
40
40
  cardDelete: 'Delete card',
41
41
  cardTitle: 'Card title',
42
- addCard: 'Add card',
42
+ addCard: 'Add Card',
43
43
  arrayAdd: '+ Add',
44
44
  arrayRemove: 'Remove',
45
45
  arrayDrag: 'Drag to move',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/svelte",
3
- "version": "0.29.0",
3
+ "version": "0.29.2",
4
4
  "description": "Editor, live-preview and source surfaces over a Quillmark WASM session.",
5
5
  "repository": {
6
6
  "type": "git",