@quillmark/svelte 0.3.0 → 0.3.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.
@@ -1,9 +1,8 @@
1
1
  <!--
2
- One content prose leaf: a Svelte mount of the codec's `createField`
3
- (VISUAL_EDITOR §Surface), which owns the PM state, the history and the
4
- per-keystroke commit, so this wrapper is wiring and registration. `addr` is a
5
- live object the parent builds, so a card reorder re-targets this leaf's commits
6
- with the caret riding the untouched view.
2
+ A Svelte mount of the codec's `createField` (VISUAL_EDITOR §Surface), which owns the
3
+ PM state, the history and the per-keystroke commit, leaving this wrapper wiring and
4
+ registration. `addr` is a live object the parent builds, so a card reorder re-targets
5
+ this leaf's commits with the caret riding the untouched view.
7
6
  -->
8
7
  <script lang="ts">
9
8
  import { onMount } from 'svelte';
@@ -41,8 +40,7 @@
41
40
  /** Ghost shown on the empty leaf: an inline leaf's resolved `default:` or
42
41
  * nothing, a body's always text (`resolveBodyGhost`). */
43
42
  placeholder?: string;
44
- /** Stable identity for the registry, stamped on the DOM node so a remount is
45
- * visible as one. */
43
+ /** Registry identity, stamped on the DOM node so a remount is visible as one. */
46
44
  leafKey: string;
47
45
  onFocus?: (addr: Addr) => void;
48
46
  onCaretMove?: (addr: Addr, pos: number) => void;
@@ -79,9 +77,9 @@
79
77
  // locale swap reaches a mounted table without remounting the leaf and losing the caret.
80
78
  const t = wording();
81
79
 
82
- /** The insert menu's live state, pushed by the leaf's trigger plugin: the menu is
83
- * the leaf's surface rather than the shell's (VISUAL_EDITOR §Chrome). A constrained
84
- * leaf never receives one, the trigger mounting on the block schema alone. */
80
+ /** Pushed by the leaf's trigger plugin: the menu is the leaf's surface rather than
81
+ * the shell's (VISUAL_EDITOR §Chrome). A constrained leaf never receives one, the
82
+ * trigger mounting on the block schema alone. */
85
83
  let slash: SlashState | undefined = $state();
86
84
 
87
85
  // The codec's own schema predicate (`createField`: `plaintext` implies `inline`), so
@@ -91,8 +89,8 @@
91
89
 
92
90
  let controller: FieldController | undefined;
93
91
 
94
- /** Take the caret: what the label's click calls. The controller's focus, not the
95
- * container's, which leaves the PM selection unplaced. */
92
+ /** What the label's click calls. The controller's focus, not the container's, which
93
+ * leaves the PM selection unplaced. */
96
94
  export function focus(): void {
97
95
  controller?.focus();
98
96
  }
@@ -153,16 +151,15 @@
153
151
  /* Containing block for the arrival wash's inset child (`core/bloom.ts`). */
154
152
  position: relative;
155
153
  }
156
- /* A leaf the inline schema does not constrain is prose rather than a cell in a row of
157
- controls, so it opens at three line boxes and grows: the ghost takes the first,
158
- leaving room under it. `1em`, not a size rung, which is the rule below's to name.
154
+ /* A leaf the inline schema does not constrain grows, and opens at one line box: the
155
+ empty leaf is the height its first line will take, so the first keystroke displaces
156
+ nothing below it. `1em`, not a size rung, which is the rule below's to name.
159
157
 
160
- On the editable rather than on the wrapper, which is what makes those lines part of
161
- the body: height the wrapper holds is height outside the `contenteditable`, where a
162
- press lands no caret. Inside it, the browser answers a press past the last line at
163
- the end of it. */
158
+ On the editable rather than on the wrapper, which is what makes that line part of the
159
+ body: height the wrapper holds is height outside the `contenteditable`, where a press
160
+ lands no caret. */
164
161
  .qm-prose-block :global(.ProseMirror) {
165
- min-height: calc(1em * var(--_qm-leading-body) * 3);
162
+ min-height: calc(1em * var(--_qm-leading-body));
166
163
  }
167
164
  /* Paper, and the withheld box is what says so. Not `block` alone: `inline` is the
168
165
  quill's to declare, so a schema omitting it on a richtext field puts a block leaf in
@@ -170,6 +167,11 @@
170
167
  .qm-prose-block:not(.qm-control-box) {
171
168
  font-size: var(--_qm-text-paper);
172
169
  }
170
+ /* Paper's margin, which a field has none of. On the editable, so a press in the strip
171
+ lands a caret; carried by the card's inset it would be dead width. */
172
+ .qm-prose-block:not(.qm-control-box) :global(.ProseMirror) {
173
+ padding-inline: var(--_qm-space-2);
174
+ }
173
175
  /* The caret is the body's focus indicator: a ring around the one surface in a card
174
176
  that is paper reads as form chrome. So the contenteditable's own outline is dropped
175
177
  everywhere, and a boxed leaf takes the shared ring on its wrapper instead
@@ -28,8 +28,7 @@ interface Props {
28
28
  /** Ghost shown on the empty leaf: an inline leaf's resolved `default:` or
29
29
  * nothing, a body's always text (`resolveBodyGhost`). */
30
30
  placeholder?: string;
31
- /** Stable identity for the registry, stamped on the DOM node so a remount is
32
- * visible as one. */
31
+ /** Registry identity, stamped on the DOM node so a remount is visible as one. */
33
32
  leafKey: string;
34
33
  onFocus?: (addr: Addr) => void;
35
34
  onCaretMove?: (addr: Addr, pos: number) => void;
@@ -81,13 +81,11 @@
81
81
  {/each}
82
82
  </div>
83
83
  {/if}
84
- <!-- One button, and its action is where the cursor stands: the set is walked,
85
- and its end is the exit. -->
86
84
  <button type="button" class="qm-icon-btn qm-tips-action" onclick={advance}>
87
85
  {#if isLast}
88
- {t.strings.tipsDismiss} <Icon name="x" size={GLYPH} />
86
+ {t.strings.tipsDismiss} <Icon name="trash-2" size={GLYPH} />
89
87
  {:else}
90
- {t.strings.tipsNext} <Icon name="chevron-right" size={GLYPH} />
88
+ {t.strings.tipsNext} <Icon name="arrow-right" size={GLYPH} />
91
89
  {/if}
92
90
  </button>
93
91
  </div>
@@ -97,44 +95,45 @@
97
95
  /* Attached to `main`, not a block beside it: a square top pulled up by the radius,
98
96
  so its background fills the notches `main`'s rounded bottom corners cut and `main`
99
97
  paints over the rest. The two read as one block, which is what document-level
100
- guidance is: the main card's, not a card of its own. Still in-flow, no edge, no
101
- lift.
98
+ guidance is: the main card's, not a card of its own. Still in-flow, no lift.
102
99
 
103
- A typewritten slip, and that is the whole of the treatment: the monospace face and
104
- a warmth over the card's own surface, which together say draft rather than
105
- document. Both come off the tips rungs (`core/theme.css`), which are mixes over
106
- the surface and the ink the consumer already tuned, so the card cannot end up less
107
- legible than the editor around it.
100
+ It takes the card's hairline, and the tuck makes the two outlines one: the slip's top
101
+ stroke and the tops of its sides run under `main`, so what shows starts at the card's
102
+ bottom corners.
108
103
 
109
- The top inset takes the tuck back, so the space above the tip is the space below
110
- the foot.
104
+ The bottom corners take the inner rung where the card above takes the outer: a slip
105
+ is cut crisper than the thing it is tucked under, at every setting of the dial.
111
106
 
112
- The reading rungs, size and leading both: a tip is a passage that wraps, so it
113
- takes the size a field's value is read at rather than the label rung a line of
114
- chrome would take. */
107
+ The insets are asymmetric so the ink is not: the top takes the tuck back, and the
108
+ bottom gives up a rung to the foot's control, whose box stands on the tap floor
109
+ rather than on its own one-line label. The horizontal is the card's inset plus the
110
+ body's margin (ProseField), so the tip starts under the prose rather than under the
111
+ fields. */
115
112
  .qm-tips {
116
113
  margin-top: calc(var(--_qm-radius) * -1);
117
- border-radius: 0 0 var(--_qm-radius) var(--_qm-radius);
118
- padding: calc(var(--_qm-space-3) + var(--_qm-radius)) var(--_qm-space-3) var(--_qm-space-3);
114
+ border: var(--_qm-border-width) solid var(--_qm-border);
115
+ border-radius: 0 0 var(--_qm-radius-inner) var(--_qm-radius-inner);
116
+ padding: calc(var(--_qm-space-3) + var(--_qm-radius)) var(--_qm-space-5) var(--_qm-space-2);
119
117
  background: var(--_qm-tips-surface);
120
118
  display: flex;
121
119
  flex-direction: column;
122
120
  gap: var(--_qm-space-2);
123
- font-family: var(--_qm-font-mono);
121
+ font-family: var(--_qm-tips-font);
124
122
  font-size: var(--_qm-text-body);
125
123
  line-height: var(--_qm-leading-body);
126
124
  color: var(--_qm-tips-ink);
127
125
  }
126
+ /* One line held open, so the foot does not step up under a shorter tip. */
127
+ .qm-tips-body {
128
+ min-height: calc(var(--_qm-leading-body) * 1em);
129
+ }
128
130
  /* The rendered tip is injected DOM (the codec's `toDOM` output), so its element
129
131
  styles are `:global`: the compiler never sees these tags in the markup. Restated
130
132
  from `core/codec/prose.css`, which is where they are argued and which cannot reach
131
- here: its selectors are scoped to `.ProseMirror` and a tip is not a view. Two
132
- deliberate divergences, and both follow from the card being read rather than
133
- edited: the link takes no underline, since a hidden `href` costs its reader
134
- nothing; and `code` takes a chip where a leaf gives it a face, since the face is
135
- already the card's own and a token like `- ` has nothing else to set it apart.
136
- `pre-wrap` is what keeps the significant space inside such a token: collapsed, the
137
- chip closes on the word after it. */
133
+ here: its selectors are scoped to `.ProseMirror` and a tip is not a view. The one
134
+ divergence: `code` takes a chip and a warmer ink where a leaf gives it a face, the
135
+ face here being the card's own already. `pre-wrap` keeps the significant space
136
+ inside a token like `- `; collapsed, the chip closes on the word after it. */
138
137
  .qm-tips-body :global(p) {
139
138
  margin: 0;
140
139
  }
@@ -142,12 +141,14 @@
142
141
  font-family: inherit;
143
142
  font-size: inherit;
144
143
  white-space: pre-wrap;
145
- padding: 0 var(--_qm-space-half);
144
+ padding: 0 var(--_qm-space);
146
145
  border-radius: var(--_qm-radius-inner);
147
- background: var(--_qm-tips-chip);
146
+ background: var(--_qm-tips-fill);
147
+ color: var(--_qm-tips-ink-warm);
148
148
  }
149
149
  .qm-tips-body :global(a) {
150
150
  color: inherit;
151
+ text-decoration: underline;
151
152
  }
152
153
  .qm-tips-foot {
153
154
  display: flex;
@@ -158,49 +159,51 @@
158
159
  .qm-tips-dots {
159
160
  display: flex;
160
161
  align-items: center;
162
+ gap: var(--_qm-space-half);
161
163
  margin-right: auto;
162
164
  }
163
- /* Random access to the set, and the pitch is the tap floor: 2.5.8's spacing
164
- exception measures centre distance, which is the number the floor already fixes,
165
- so a tighter row of dots buys nothing it does not immediately owe back. Target and
166
- mark are therefore not one rectangle (the floor is the button, the dot is drawn
167
- inside it), which is also why the hover reads on the mark rather than filling the
168
- box a `.qm-icon-btn` would. */
165
+ /* Random access to the set, drawn as one cluster: a row of marks spaced to the tap
166
+ floor reads as a row of controls. So the target is the mark plus its padding, under
167
+ the floor, which 2.5.8 allows on the equivalent-control exception rather than on
168
+ the spacing one — the foot's button clears the floor and walks the whole set from
169
+ the tip the card opens on, so no tip is reachable only by a dot. State is three
170
+ steps of one ink on the recede ladder, never a second hue and never a size: a dot
171
+ that grew would move the row it sits in. */
169
172
  .qm-tips-dot {
170
- display: flex;
171
- align-items: center;
172
- justify-content: center;
173
- box-sizing: border-box;
174
- min-width: var(--_qm-tap-min);
175
- min-height: var(--_qm-tap-min);
176
- border: none;
177
- background: transparent;
178
- cursor: pointer;
179
- }
180
- /* Three steps of one ink on the recede ladder (rest, hover, current), never a
181
- second hue and never a size: a dot that grew would move the row it sits in. */
182
- .qm-tips-dot::before {
183
- content: '';
173
+ box-sizing: content-box;
184
174
  width: 5px;
185
175
  height: 5px;
176
+ padding: var(--_qm-space-half);
177
+ border: none;
186
178
  border-radius: var(--_qm-radius-pill);
187
179
  background: currentColor;
180
+ background-clip: content-box;
188
181
  opacity: var(--_qm-opacity-idle);
182
+ cursor: pointer;
189
183
  transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
190
184
  }
191
- .qm-tips-dot:hover::before {
185
+ .qm-tips-dot:hover {
192
186
  opacity: var(--_qm-opacity-muted);
193
187
  }
194
- .qm-tips-dot[aria-current='true']::before {
188
+ .qm-tips-dot[aria-current='true'] {
195
189
  opacity: 1;
196
190
  }
197
- /* Box and disabled state come from `.qm-icon-btn` (controls.css); the foot's
198
- button carries a label, so it widens its inset and stays on the card's own type
199
- and ink rather than the family's body rung and the callers' own colours. */
191
+ /* Box and disabled state come from `.qm-icon-btn` (controls.css); what this
192
+ overrides is everything the family sets for a glyph among callers of its own
193
+ colour, a labelled control on a warm card wanting none of it. The hover included:
194
+ the family's neutral step would read as lent from the document above. Unlayered,
195
+ so it beats the base rule without out-specifying it. */
200
196
  .qm-tips-action {
201
197
  padding: var(--_qm-space-half) var(--_qm-space-2);
202
198
  font-family: inherit;
203
199
  font-size: inherit;
204
200
  color: inherit;
201
+ transition:
202
+ color var(--_qm-duration-fast) var(--_qm-ease-reverse),
203
+ background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
204
+ }
205
+ .qm-tips-action:hover {
206
+ color: var(--_qm-tips-ink-warm);
207
+ background: var(--_qm-tips-fill);
205
208
  }
206
209
  </style>