@quillmark/svelte 0.40.0 → 0.42.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 +5 -5
- package/dist/core/codec/shortcuts.d.ts +1 -3
- package/dist/core/codec/shortcuts.js +2 -8
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -2
- package/dist/preview/index.d.ts +0 -1
- package/dist/preview/index.js +0 -1
- package/dist/visual/ArrayField.svelte +14 -0
- package/dist/visual/ArrayField.svelte.d.ts +1 -0
- package/dist/visual/Field.svelte +5 -0
- package/dist/visual/MatrixField.svelte +8 -0
- package/dist/visual/MatrixField.svelte.d.ts +1 -0
- package/dist/visual/ObjectField.svelte +12 -1
- package/dist/visual/ObjectField.svelte.d.ts +1 -0
- package/dist/visual/ReviewCard.svelte +13 -23
- package/dist/visual/ReviewCard.svelte.d.ts +0 -2
- package/dist/visual/VariantField.svelte +6 -0
- package/dist/visual/VariantField.svelte.d.ts +1 -0
- package/dist/visual/VisualEditorInner.svelte +9 -6
- package/dist/visual/index.d.ts +0 -3
- package/dist/visual/index.js +2 -10
- package/dist/visual/leaves.d.ts +6 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @quillmark/svelte
|
|
2
2
|
|
|
3
|
-
Editor + live-preview components for [Quillmark](https://github.com/
|
|
3
|
+
Editor + live-preview components for [Quillmark](https://github.com/birdorbs/quillmark) WASM consumers. A WYSIWYG **VisualEditor**, and a canvas **Preview** that paints the compiled document and round-trips clicks to the editor, over one `@quillmark/wasm` session. Vanilla-TS cores with thin Svelte 5 wrappers.
|
|
4
4
|
|
|
5
|
-
Quillmark is pre-1.0. Its [stability statement](https://github.com/
|
|
5
|
+
Quillmark is pre-1.0. Its [stability statement](https://github.com/birdorbs/quillmark#status) says what any release can change and what every release keeps.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ Each subpath is its own module root; a bundler pulls only what the entry you imp
|
|
|
20
20
|
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
21
21
|
| `@quillmark/svelte/core` | What the surfaces share: the `DocPath`/`Place` address vocabulary, the `EditorError` channel, `init`. No UI framework. |
|
|
22
22
|
| `@quillmark/svelte/preview` | The live preview: `createPreview` + `<Preview>`. Reaches nothing editor-side. |
|
|
23
|
-
| `@quillmark/svelte/visual` | The federated WYSIWYG: `<VisualEditor
|
|
23
|
+
| `@quillmark/svelte/visual` | The federated WYSIWYG: `<VisualEditor>`. |
|
|
24
24
|
| `@quillmark/svelte` | Re-exports `/core`. |
|
|
25
25
|
| `@quillmark/svelte/preset` | The opt-in stylesheet for the page around a surface ([THEMING.md](THEMING.md)). |
|
|
26
26
|
|
|
@@ -235,7 +235,7 @@ While a review is open, `REVIEW_KEYS` answer the current item from anywhere on t
|
|
|
235
235
|
|
|
236
236
|
### Wording
|
|
237
237
|
|
|
238
|
-
The package ships English and a seam to replace it. `strings` is keyed and **partial**: set what you have translations for, and the rest stay the package's. Several keys are **accessible names** rather than decoration (the card controls, the add trigger), so an untranslated surface reads the wrong language to a screen reader. A string is words alone: a glyph drawn beside it, the `+` on every add control, is the control's own.
|
|
238
|
+
The package ships English and a seam to replace it. `strings` is keyed and **partial**: set what you have translations for, and the rest stay the package's. Several keys are **accessible names** rather than decoration (the card controls, the add trigger), so an untranslated surface reads the wrong language to a screen reader. A string is words alone: a glyph drawn beside it, the `+` on every add control, is the control's own. A control's name is the name alone: where it has a shortcut the editor prints the keys beside the name in the control's tooltip and states them as `aria-keyshortcuts`, both read off the binding, so a translation carries no chord. `<Preview>` takes its own `strings`: the states it shows when there is nothing to paint, the zoom pill's action, and what a screen reader hears: the names of the pane and each page, and the pages standing again after a state it was told of.
|
|
239
239
|
|
|
240
240
|
```svelte
|
|
241
241
|
<VisualEditor
|
|
@@ -320,7 +320,7 @@ Both editor→preview hops or neither. A control reports its focus and no caret
|
|
|
320
320
|
|
|
321
321
|
A pick carries a caret where the compile tracks the content under the point, and the field alone where it tracks only the placement — a scalar the plate prints without tracking. `setCaret` takes both: an absent `pos` reveals and focuses the field, which is the whole of what a click on plate-placed ink can mean. The address may name an array element (`main.keywords[0]`), which lands on that row.
|
|
322
322
|
|
|
323
|
-
A consumer holding an `Addr` of its own maps it with
|
|
323
|
+
A consumer holding an `Addr` of its own maps it with the Document's `pathFor`. The playground app's split-pane route is the full reference shell: one session, both bridge directions, the preview following edits, and diagnostics routed inline.
|
|
324
324
|
|
|
325
325
|
## Errors
|
|
326
326
|
|
|
@@ -47,11 +47,9 @@ export declare const TABLE_KEYS: {
|
|
|
47
47
|
readonly eraseAlt: "Delete";
|
|
48
48
|
};
|
|
49
49
|
/** The review's keys, the editor's wherever the focus is while a review is open. No leaf binds
|
|
50
|
-
* one of them, `accept` included, so each answers alike in every field
|
|
51
|
-
* under the modifiers `dismiss` and the steps share. */
|
|
50
|
+
* one of them, `accept` included, so each answers alike in every field. */
|
|
52
51
|
export declare const REVIEW_KEYS: {
|
|
53
52
|
readonly accept: "Mod-Enter";
|
|
54
|
-
readonly acceptAlt: "Mod-Alt-Enter";
|
|
55
53
|
readonly dismiss: "Mod-Alt-Backspace";
|
|
56
54
|
readonly next: "Mod-Alt-ArrowDown";
|
|
57
55
|
readonly previous: "Mod-Alt-ArrowUp";
|
|
@@ -53,11 +53,9 @@ export const TABLE_KEYS = {
|
|
|
53
53
|
eraseAlt: 'Delete'
|
|
54
54
|
};
|
|
55
55
|
/** The review's keys, the editor's wherever the focus is while a review is open. No leaf binds
|
|
56
|
-
* one of them, `accept` included, so each answers alike in every field
|
|
57
|
-
* under the modifiers `dismiss` and the steps share. */
|
|
56
|
+
* one of them, `accept` included, so each answers alike in every field. */
|
|
58
57
|
export const REVIEW_KEYS = {
|
|
59
58
|
accept: 'Mod-Enter',
|
|
60
|
-
acceptAlt: 'Mod-Alt-Enter',
|
|
61
59
|
dismiss: 'Mod-Alt-Backspace',
|
|
62
60
|
next: 'Mod-Alt-ArrowDown',
|
|
63
61
|
previous: 'Mod-Alt-ArrowUp'
|
|
@@ -151,11 +149,7 @@ const SHORTCUTS = [
|
|
|
151
149
|
},
|
|
152
150
|
{ scope: 'table', label: 'shortcutAlignColumn', keys: [T.alignLeft, T.alignRight] },
|
|
153
151
|
{ scope: 'table', label: 'shortcutDeleteCells', keys: [T.erase, T.eraseAlt] },
|
|
154
|
-
{
|
|
155
|
-
scope: 'review',
|
|
156
|
-
label: 'shortcutReviewAccept',
|
|
157
|
-
keys: [REVIEW_KEYS.accept, REVIEW_KEYS.acceptAlt]
|
|
158
|
-
},
|
|
152
|
+
{ scope: 'review', label: 'shortcutReviewAccept', keys: [REVIEW_KEYS.accept] },
|
|
159
153
|
{ scope: 'review', label: 'shortcutReviewDismiss', keys: [REVIEW_KEYS.dismiss] },
|
|
160
154
|
{ scope: 'review', label: 'shortcutReviewNext', keys: [REVIEW_KEYS.next] },
|
|
161
155
|
{ scope: 'review', label: 'shortcutReviewPrevious', keys: [REVIEW_KEYS.previous] }
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { init } from './lifecycle.js';
|
|
2
2
|
export type { DocPath, Landing, Place } from './address.js';
|
|
3
|
-
export { fieldPathForAddr, addrForFieldPath } from './address.js';
|
|
4
3
|
export type { Delta } from './codec/positions.js';
|
|
5
4
|
export type { EditorError, EditorErrorCode, EditorErrorHandler } from './errors.js';
|
package/dist/core/index.js
CHANGED
|
@@ -8,5 +8,3 @@
|
|
|
8
8
|
// dev server serves a side-effect sheet as a module that writes a `<style>` into one. The surface
|
|
9
9
|
// barrels carry the theme; `check:deps` holds it.
|
|
10
10
|
export { init } from './lifecycle.js';
|
|
11
|
-
// The hop between that vocabulary and the `Addr` the document verbs take.
|
|
12
|
-
export { fieldPathForAddr, addrForFieldPath } from './address.js';
|
package/dist/preview/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { createPreview } from './controller.js';
|
|
2
2
|
export type { PreviewOptions, PreviewController } from './controller.js';
|
|
3
3
|
export { default as Preview } from './Preview.svelte';
|
|
4
|
-
export { DEFAULT_PREVIEW_STRINGS } from './strings.js';
|
|
5
4
|
export type { PreviewStrings, PreviewStringsInput } from './strings.js';
|
package/dist/preview/index.js
CHANGED
|
@@ -447,6 +447,7 @@
|
|
|
447
447
|
type Subform = {
|
|
448
448
|
focus: () => void;
|
|
449
449
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
450
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
450
451
|
};
|
|
451
452
|
const cellEls: Record<string, Subform | undefined> = $state({});
|
|
452
453
|
let addEl: HTMLButtonElement | undefined = $state();
|
|
@@ -840,6 +841,19 @@
|
|
|
840
841
|
else focusRow(id);
|
|
841
842
|
return rowEls[id];
|
|
842
843
|
}
|
|
844
|
+
/** Open the row `steps[0]` names where the walk goes on inside it, and the rows under it
|
|
845
|
+
* the rest names ({@link FieldControl.openPath}). A row's own address is drawn on its
|
|
846
|
+
* head, so it opens nothing. */
|
|
847
|
+
export async function openPath(steps: readonly PathStep[]): Promise<void> {
|
|
848
|
+
const [k, ...rest] = steps;
|
|
849
|
+
const id = typeof k === 'number' ? ids[k] : undefined;
|
|
850
|
+
if (id === undefined || !rest.length) return;
|
|
851
|
+
if (table) return cellEls[id]?.openPath(rest);
|
|
852
|
+
if (control !== 'object') return;
|
|
853
|
+
open.add(id);
|
|
854
|
+
if (!(await span.resumes(tick()))) return;
|
|
855
|
+
await objEls[id]?.openPath(rest);
|
|
856
|
+
}
|
|
843
857
|
/** Focus element `id` after the flush, never in the same tick: a mutation commits
|
|
844
858
|
* the array by value, so the parent re-derives and the row does not exist until
|
|
845
859
|
* then. `undefined` is the empty list: the add affordance. `column` is a table
|
|
@@ -50,6 +50,7 @@ declare const ArrayField: import("svelte").Component<Props, {
|
|
|
50
50
|
focus: () => void;
|
|
51
51
|
washBox: () => HTMLElement | undefined;
|
|
52
52
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
53
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
53
54
|
}, "">;
|
|
54
55
|
type ArrayField = ReturnType<typeof ArrayField>;
|
|
55
56
|
export default ArrayField;
|
package/dist/visual/Field.svelte
CHANGED
|
@@ -244,6 +244,7 @@
|
|
|
244
244
|
type Inside = {
|
|
245
245
|
focus: () => void;
|
|
246
246
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
247
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
247
248
|
washBox?: () => HTMLElement | undefined;
|
|
248
249
|
};
|
|
249
250
|
let proseEl = $state<{ focus: () => void } | undefined>();
|
|
@@ -264,6 +265,9 @@
|
|
|
264
265
|
function focusPath(steps: readonly PathStep[], pos?: number): LandingBox {
|
|
265
266
|
return inside()?.focusPath(steps, pos);
|
|
266
267
|
}
|
|
268
|
+
async function openPath(steps: readonly PathStep[]): Promise<void> {
|
|
269
|
+
await inside()?.openPath(steps);
|
|
270
|
+
}
|
|
267
271
|
// Only where `for` cannot reach; the labelable four are the browser's own, and a
|
|
268
272
|
// second handler over them would be a focus the label already placed.
|
|
269
273
|
const onActivate = $derived(labelable ? undefined : focusControl);
|
|
@@ -299,6 +303,7 @@
|
|
|
299
303
|
registry.registerControl(key, {
|
|
300
304
|
focus: focusControl,
|
|
301
305
|
focusPath: isContainer(field.control) ? focusPath : undefined,
|
|
306
|
+
openPath: isContainer(field.control) ? openPath : undefined,
|
|
302
307
|
get el() {
|
|
303
308
|
return inside()?.washBox?.() ?? wrapper;
|
|
304
309
|
}
|
|
@@ -201,6 +201,7 @@
|
|
|
201
201
|
type Subform = {
|
|
202
202
|
focus: () => void;
|
|
203
203
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
204
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
204
205
|
};
|
|
205
206
|
const memberEls: Record<string, HTMLElement | undefined> = $state({});
|
|
206
207
|
const tickEls: Record<string, HTMLInputElement | undefined> = $state({});
|
|
@@ -348,6 +349,13 @@
|
|
|
348
349
|
(own(tickEls, id) ?? own(titleEls, id))?.focus();
|
|
349
350
|
return member;
|
|
350
351
|
}
|
|
352
|
+
/** Open the collapsed rows under a held item's column ({@link FieldControl.openPath}):
|
|
353
|
+
* the item's details are drawn already while a proposal or a diagnostic names a cell. */
|
|
354
|
+
export async function openPath(steps: readonly PathStep[]): Promise<void> {
|
|
355
|
+
const [id, ...rest] = steps;
|
|
356
|
+
if (typeof id !== 'string' || !rest.length) return;
|
|
357
|
+
await own(colEls, id)?.openPath(rest);
|
|
358
|
+
}
|
|
351
359
|
</script>
|
|
352
360
|
|
|
353
361
|
<div
|
|
@@ -35,6 +35,7 @@ declare const MatrixField: import("svelte").Component<Props, {
|
|
|
35
35
|
focus: () => void;
|
|
36
36
|
washBox: () => HTMLElement | undefined;
|
|
37
37
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
38
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
38
39
|
}, "">;
|
|
39
40
|
type MatrixField = ReturnType<typeof MatrixField>;
|
|
40
41
|
export default MatrixField;
|
|
@@ -214,7 +214,11 @@
|
|
|
214
214
|
> = $state({});
|
|
215
215
|
const nestedEls: Record<
|
|
216
216
|
string,
|
|
217
|
-
| {
|
|
217
|
+
| {
|
|
218
|
+
focus: () => void;
|
|
219
|
+
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
220
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
221
|
+
}
|
|
218
222
|
| undefined
|
|
219
223
|
> = $state({});
|
|
220
224
|
let rootEl = $state<HTMLElement | undefined>();
|
|
@@ -250,6 +254,13 @@
|
|
|
250
254
|
focusProp(key);
|
|
251
255
|
return undefined;
|
|
252
256
|
}
|
|
257
|
+
/** Open the collapsed rows under the property `steps[0]` names ({@link
|
|
258
|
+
* FieldControl.openPath}). */
|
|
259
|
+
export async function openPath(steps: readonly PathStep[]): Promise<void> {
|
|
260
|
+
const [key, ...rest] = steps;
|
|
261
|
+
if (typeof key !== 'string' || !has(key)) return;
|
|
262
|
+
await own(nestedEls, key)?.openPath(rest);
|
|
263
|
+
}
|
|
253
264
|
/** A label click for the properties `for` cannot reach: the date control, whose
|
|
254
265
|
* focus lives on a segment, a prose cell, which is a `contenteditable`, and a
|
|
255
266
|
* nested subform. Scoped to that property's own cell, so the click lands where the
|
|
@@ -63,6 +63,7 @@ interface Props {
|
|
|
63
63
|
declare const ObjectField: import("svelte").Component<Props, {
|
|
64
64
|
focus: () => void;
|
|
65
65
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
66
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
66
67
|
}, "">;
|
|
67
68
|
type ObjectField = ReturnType<typeof ObjectField>;
|
|
68
69
|
export default ObjectField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
The answer card: one floating surface on the current change of a review, and the one place a
|
|
3
|
-
change is answered by pointer. A quiet Dismiss and a primary Accept
|
|
3
|
+
change is answered by pointer. A quiet Dismiss and a primary Accept with its key, a note
|
|
4
4
|
where the reader's own writing meets the change, and above them the line the proposal's writer
|
|
5
5
|
gave for it, cut to one line. The change itself is drawn where it
|
|
6
6
|
stands, so the card is the same two answers on every change. It carries no position: the count
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
anywhere, a resize of the editor.
|
|
31
31
|
|
|
32
32
|
It never takes the focus. A press on it keeps the focus where it is, and the keyboard reaches
|
|
33
|
-
it only by `enter`. There
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
it only by `enter`. There Enter presses a button as on any, and no other key answers or
|
|
34
|
+
steps but the review's own. The focus rides the card from change to change, and Escape or the
|
|
35
|
+
last answer hands it back.
|
|
36
36
|
-->
|
|
37
37
|
<script lang="ts">
|
|
38
38
|
import { tick } from 'svelte';
|
|
@@ -56,10 +56,8 @@
|
|
|
56
56
|
/** The answer key whose press only brought the card, whose hint says to press it again. */
|
|
57
57
|
asked?: 'accept' | 'dismiss';
|
|
58
58
|
onAnswer(action: 'accept' | 'dismiss'): void;
|
|
59
|
-
/** Go to the next change, or the previous. */
|
|
60
|
-
onStep(dir: 1 | -1): void;
|
|
61
59
|
}
|
|
62
|
-
let { id, root, inset, hidden, outdated, note, asked, onAnswer
|
|
60
|
+
let { id, root, inset, hidden, outdated, note, asked, onAnswer }: Props = $props();
|
|
63
61
|
const noteId = $props.id();
|
|
64
62
|
|
|
65
63
|
const t = wording();
|
|
@@ -293,16 +291,6 @@
|
|
|
293
291
|
leave();
|
|
294
292
|
return;
|
|
295
293
|
}
|
|
296
|
-
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
297
|
-
e.preventDefault();
|
|
298
|
-
if (!e.repeat) answer('dismiss');
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
302
|
-
e.preventDefault();
|
|
303
|
-
onStep(e.key === 'ArrowUp' ? -1 : 1);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
294
|
// A held Enter clicks its button on every repeat, and a held key answers once.
|
|
307
295
|
if (e.key === 'Enter' && e.repeat) {
|
|
308
296
|
e.preventDefault();
|
|
@@ -351,13 +339,14 @@
|
|
|
351
339
|
{#if outdated}<span class="qm-review-card-note">{t.strings.reviewOutdated}</span>{/if}
|
|
352
340
|
<button
|
|
353
341
|
type="button"
|
|
354
|
-
class=
|
|
342
|
+
class={[
|
|
343
|
+
'qm-review-card-dismiss qm-focus-ring',
|
|
344
|
+
{ 'qm-review-card-asked': asked === 'dismiss' }
|
|
345
|
+
]}
|
|
355
346
|
tabindex="-1"
|
|
347
|
+
title={keycap(REVIEW_KEYS.dismiss)}
|
|
356
348
|
aria-keyshortcuts={keyshortcut(REVIEW_KEYS.dismiss)}
|
|
357
|
-
onclick={() => answer('dismiss')}
|
|
358
|
-
>{t.strings.reviewDismiss}<kbd class={{ 'qm-review-card-asked': asked === 'dismiss' }}
|
|
359
|
-
>{keycap(REVIEW_KEYS.dismiss)}</kbd
|
|
360
|
-
></button
|
|
349
|
+
onclick={() => answer('dismiss')}>{t.strings.reviewDismiss}</button
|
|
361
350
|
>
|
|
362
351
|
<button
|
|
363
352
|
type="button"
|
|
@@ -440,7 +429,8 @@
|
|
|
440
429
|
font: inherit;
|
|
441
430
|
border-radius: var(--_qm-radius-inner);
|
|
442
431
|
}
|
|
443
|
-
/* The press that brought the card asks for another:
|
|
432
|
+
/* The press that brought the card asks for another: Accept's key hint rings once, and
|
|
433
|
+
Dismiss itself, which shows no key. */
|
|
444
434
|
.qm-review-card-asked {
|
|
445
435
|
outline: var(--_qm-border-width) solid currentColor;
|
|
446
436
|
outline-offset: 2px;
|
|
@@ -14,8 +14,6 @@ interface Props {
|
|
|
14
14
|
/** The answer key whose press only brought the card, whose hint says to press it again. */
|
|
15
15
|
asked?: 'accept' | 'dismiss';
|
|
16
16
|
onAnswer(action: 'accept' | 'dismiss'): void;
|
|
17
|
-
/** Go to the next change, or the previous. */
|
|
18
|
-
onStep(dir: 1 | -1): void;
|
|
19
17
|
}
|
|
20
18
|
declare const ReviewCard: import("svelte").Component<Props, {
|
|
21
19
|
standsInView: () => boolean;
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
type Subform = {
|
|
111
111
|
focus: () => void;
|
|
112
112
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
113
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
113
114
|
};
|
|
114
115
|
let cellsEl = $state<Subform | undefined>();
|
|
115
116
|
|
|
@@ -145,6 +146,11 @@
|
|
|
145
146
|
focus();
|
|
146
147
|
return undefined;
|
|
147
148
|
}
|
|
149
|
+
/** Open the collapsed rows under the live cell `steps[0]` names ({@link
|
|
150
|
+
* FieldControl.openPath}). */
|
|
151
|
+
export async function openPath(steps: readonly PathStep[]): Promise<void> {
|
|
152
|
+
if (live(steps[0])) await cellsEl?.openPath(steps);
|
|
153
|
+
}
|
|
148
154
|
</script>
|
|
149
155
|
|
|
150
156
|
<div class="qm-variant">
|
|
@@ -34,6 +34,7 @@ interface Props {
|
|
|
34
34
|
declare const VariantField: import("svelte").Component<Props, {
|
|
35
35
|
focus: () => void;
|
|
36
36
|
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
37
|
+
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
37
38
|
}, "">;
|
|
38
39
|
type VariantField = ReturnType<typeof VariantField>;
|
|
39
40
|
export default VariantField;
|
|
@@ -717,7 +717,6 @@
|
|
|
717
717
|
let answerCard = $state<ReviewCard | undefined>();
|
|
718
718
|
const reviewKeys = keydownHandler({
|
|
719
719
|
[REVIEW_KEYS.accept]: () => answerKey('accept'),
|
|
720
|
-
[REVIEW_KEYS.acceptAlt]: () => answerKey('accept'),
|
|
721
720
|
[REVIEW_KEYS.dismiss]: () => answerKey('dismiss'),
|
|
722
721
|
[REVIEW_KEYS.next]: () => {
|
|
723
722
|
void step(1, inside);
|
|
@@ -739,10 +738,10 @@
|
|
|
739
738
|
let named: ReviewKeyName | undefined;
|
|
740
739
|
const reviewKeyName = keydownHandler(
|
|
741
740
|
Object.fromEntries(
|
|
742
|
-
(['accept', '
|
|
741
|
+
(['accept', 'dismiss', 'next', 'previous'] as const).map((key) => [
|
|
743
742
|
REVIEW_KEYS[key],
|
|
744
743
|
() => {
|
|
745
|
-
named = key
|
|
744
|
+
named = key;
|
|
746
745
|
return true;
|
|
747
746
|
}
|
|
748
747
|
])
|
|
@@ -1753,7 +1752,7 @@
|
|
|
1753
1752
|
|
|
1754
1753
|
/**
|
|
1755
1754
|
* Bring the review item `id` to the reader as the current change: open the panel holding
|
|
1756
|
-
* it and scroll it to the middle of the view. The focus stays where it is, the reader having
|
|
1755
|
+
* it and every collapsed row it is under, and scroll it to the middle of the view. The focus stays where it is, the reader having
|
|
1757
1756
|
* asked to look, unless `focus` asks for it: the caret then goes into the item, or the focus
|
|
1758
1757
|
* to the control drawing it, a property inside a field included. False for an item the
|
|
1759
1758
|
* editor does not draw.
|
|
@@ -1774,12 +1773,17 @@
|
|
|
1774
1773
|
for (const ref of cardRefs) ref?.revealLeaf(key);
|
|
1775
1774
|
}
|
|
1776
1775
|
if (!(await span.resumes(tick()))) return false;
|
|
1776
|
+
const steps =
|
|
1777
|
+
key !== undefined
|
|
1778
|
+
? reviewing.at(key).nested?.find((e) => e.item.id === id)?.steps
|
|
1779
|
+
: undefined;
|
|
1780
|
+
if (steps) await leaves.control(key!)?.openPath?.(steps);
|
|
1781
|
+
if (!span.alive) return false;
|
|
1777
1782
|
reviewing.reveal(id);
|
|
1778
1783
|
const thing = focus ? reviewEls(id).find((el) => el.matches(THING)) : undefined;
|
|
1779
1784
|
if (thing) thing.focus({ preventScroll: true });
|
|
1780
1785
|
else if (focus && key !== undefined && !leaves.prose(key)?.enterReview(id)) {
|
|
1781
1786
|
const control = leaves.control(key);
|
|
1782
|
-
const steps = reviewing.at(key).nested?.find((e) => e.item.id === id)?.steps;
|
|
1783
1787
|
if (steps && control?.focusPath) await control.focusPath(steps);
|
|
1784
1788
|
else control?.focus();
|
|
1785
1789
|
if (!span.alive) return false;
|
|
@@ -2280,7 +2284,6 @@
|
|
|
2280
2284
|
? undefined
|
|
2281
2285
|
: reviewing.items.find((i) => i.id === reviewing.lit)?.note}
|
|
2282
2286
|
onAnswer={answerCurrent}
|
|
2283
|
-
onStep={(dir) => void step(dir, false)}
|
|
2284
2287
|
/>
|
|
2285
2288
|
<div class="qm-visually-hidden" role="status">{reviewPlace}</div>
|
|
2286
2289
|
<!-- Beside the review's region rather than in it or in the toast's: a status is read whole,
|
package/dist/visual/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { default as VisualEditor } from './VisualEditor.svelte';
|
|
2
2
|
export type { VisualEditorProps } from './props.js';
|
|
3
|
-
export { createField } from '../core/codec/index.js';
|
|
4
|
-
export type { CreateFieldOpts, FieldController } from '../core/codec/index.js';
|
|
5
|
-
export { DEFAULT_VISUAL_STRINGS } from './strings.js';
|
|
6
3
|
export type { VisualStrings, VisualStringsInput, FormatDiagnostic } from './strings.js';
|
|
7
4
|
export type { BodyPlaceholder, BodyPlaceholderContext } from './structure.js';
|
|
8
5
|
export { editorShortcuts } from '../core/codec/index.js';
|
package/dist/visual/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// `@quillmark/svelte/visual`: the WYSIWYG surface.
|
|
2
2
|
//
|
|
3
3
|
// The federated VisualEditor: a thin Svelte composition over many small editors.
|
|
4
|
-
// Each content leaf is the codec's
|
|
5
|
-
//
|
|
4
|
+
// Each content leaf is the codec's prose leaf; scalar fields are form controls;
|
|
5
|
+
// structure/cards are the editor's own. Depends on `/core` and the
|
|
6
6
|
// codec. Relative imports (not `$lib`): svelte-package ships this as-is.
|
|
7
7
|
//
|
|
8
8
|
// The barrel carries what a consumer story wants, and nothing else: a symbol
|
|
@@ -14,14 +14,6 @@
|
|
|
14
14
|
// `check:deps` holds the reach.
|
|
15
15
|
import '../core/theme.css';
|
|
16
16
|
export { default as VisualEditor } from './VisualEditor.svelte';
|
|
17
|
-
// The prose leaf: the vanilla mount API a non-Svelte consumer (or a custom
|
|
18
|
-
// surface) builds on.
|
|
19
|
-
export { createField } from '../core/codec/index.js';
|
|
20
|
-
// What the surface says, and how it words a diagnostic. `strings` is keyed and
|
|
21
|
-
// partial (unset keys take the package's English) and `DEFAULT_VISUAL_STRINGS` is
|
|
22
|
-
// that English, exported so a consumer can compose against it rather than restate
|
|
23
|
-
// it. The empty body's per-card hook is the `bodyPlaceholder` key inside it.
|
|
24
|
-
export { DEFAULT_VISUAL_STRINGS } from './strings.js';
|
|
25
17
|
// The prose leaf's shortcuts, for a host's shortcut list: read off the keymaps' own tables and
|
|
26
18
|
// worded by the same `strings` (pass the editor's, or none for the package's English).
|
|
27
19
|
export { editorShortcuts } from '../core/codec/index.js';
|
package/dist/visual/leaves.d.ts
CHANGED
|
@@ -39,6 +39,12 @@ export interface FieldControl {
|
|
|
39
39
|
* {@link el}.
|
|
40
40
|
*/
|
|
41
41
|
focusPath?(steps: readonly PathStep[], pos?: number): LandingBox;
|
|
42
|
+
/**
|
|
43
|
+
* Open every collapsed row `steps` walks through, taking no focus and no caret: the
|
|
44
|
+
* walk {@link focusPath} makes, short of the landing. Settles once the innermost row it
|
|
45
|
+
* opened has drawn. Absent where {@link focusPath} is.
|
|
46
|
+
*/
|
|
47
|
+
openPath?(steps: readonly PathStep[]): Promise<void>;
|
|
42
48
|
readonly el: HTMLElement;
|
|
43
49
|
}
|
|
44
50
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillmark/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Editor, live-preview and source surfaces over a Quillmark WASM session.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/birdorbs/quillmark-js.git",
|
|
8
8
|
"directory": "packages/svelte"
|
|
9
9
|
},
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/
|
|
11
|
+
"url": "https://github.com/birdorbs/quillmark-js/issues"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/birdorbs/quillmark-js/tree/main/packages/svelte#readme",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"quillmark",
|