@quillmark/svelte 0.42.0 → 0.44.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/CUSTOMIZING.md +78 -0
- package/README.md +96 -17
- package/THEMING.md +2 -0
- package/dist/core/codec/anchor.d.ts +0 -7
- package/dist/core/codec/anchor.js +0 -19
- package/dist/core/codec/field.js +1 -1
- package/dist/core/codec/index.d.ts +4 -7
- package/dist/core/codec/index.js +3 -4
- package/dist/core/codec/table-view.js +1 -1
- package/dist/core/index.js +1 -5
- package/dist/core/lifecycle.js +1 -1
- package/dist/core/schema.d.ts +6 -0
- package/dist/core/schema.js +9 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -3
- package/dist/preview/index.d.ts +3 -0
- package/dist/preview/index.js +4 -2
- package/dist/preview/strings.js +1 -1
- package/dist/visual/ArrayField.svelte +1 -6
- package/dist/visual/Card.svelte +2 -1
- package/dist/visual/MatrixField.svelte +1 -6
- package/dist/visual/ProseField.svelte +3 -13
- package/dist/visual/ProseValue.svelte +3 -13
- package/dist/visual/VariantField.svelte +1 -6
- package/dist/visual/VisualEditorInner.svelte +25 -14
- package/dist/visual/diagnostics.d.ts +1 -1
- package/dist/visual/index.js +4 -5
- package/dist/visual/leaves.d.ts +6 -0
- package/dist/visual/proposals.js +12 -8
- package/dist/visual/review.d.ts +0 -13
- package/dist/visual/review.js +1 -105
- package/dist/visual/review.svelte.d.ts +6 -0
- package/dist/visual/review.svelte.js +18 -1
- package/dist/visual/structure.js +1 -1
- package/dist/workspace/index.d.ts +5 -0
- package/dist/workspace/index.js +7 -0
- package/dist/workspace/print.d.ts +13 -0
- package/dist/workspace/print.js +67 -0
- package/dist/workspace/trap.d.ts +8 -0
- package/dist/workspace/trap.js +20 -0
- package/dist/workspace/workspace.d.ts +107 -0
- package/dist/workspace/workspace.js +346 -0
- package/package.json +3 -12
package/CUSTOMIZING.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Customizing
|
|
2
|
+
|
|
3
|
+
What you can change about Quillmark's editor, preview and the quillkit app without forking any of it, and what is closed on purpose. The CSS detail is [THEMING.md](THEMING.md); this page says which depth a change belongs to and where each depth stops.
|
|
4
|
+
|
|
5
|
+
## The three depths
|
|
6
|
+
|
|
7
|
+
Start at the shallowest one that holds your change.
|
|
8
|
+
|
|
9
|
+
| | You write | You can change |
|
|
10
|
+
| ------------------------------- | ---------------------------------- | ----------------------------------------------------------------------- |
|
|
11
|
+
| **Configure the quillkit app** | files beside your quiver, no code | the app's name, icon and look |
|
|
12
|
+
| **Theme and word the surfaces** | props and CSS in your own page | how `<VisualEditor>` and `<Preview>` look and what they say |
|
|
13
|
+
| **Write your own shell** | a Svelte file on `createWorkspace` | what the page does: its actions, its storage, where documents come from |
|
|
14
|
+
|
|
15
|
+
### Configure the quillkit app
|
|
16
|
+
|
|
17
|
+
`quillkit build app` turns a quiver into a standalone app for the people filling its forms in. You configure it with files found by name beside `Quiver.yaml`, all optional ([quillkit's README](../quillkit/README.md#the-app)):
|
|
18
|
+
|
|
19
|
+
| File | What it sets |
|
|
20
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `App.yaml` | `title` and `description` |
|
|
22
|
+
| `icon.svg` or `icon.png` | the icon in the header and on the tab |
|
|
23
|
+
| `app.css` | the look: the `--qm-*` dials, the surface roots, the app chrome classes and `[data-qm-card="<kind>"]`, linked after the app's own styles |
|
|
24
|
+
|
|
25
|
+
Which forms appear is whatever the quiver holds: every quill in it, at its latest version, drafts only under `--drafts`. A different set of forms is a different quiver.
|
|
26
|
+
|
|
27
|
+
`check` and `build app` refuse an `App.yaml` key the app does not have and warn on an `app.css` selector the theming contract does not promise, so a key or a selector a release moves fails or warns where you build rather than going quiet.
|
|
28
|
+
|
|
29
|
+
### Theme and word the surfaces
|
|
30
|
+
|
|
31
|
+
In a page of your own you mount `<VisualEditor>` and `<Preview>` yourself and reach everything below.
|
|
32
|
+
|
|
33
|
+
| Handle | What it changes |
|
|
34
|
+
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| the ten `--qm-*` dials | colour, type, corner and spacing across both surfaces ([THEMING §"The dials"](THEMING.md#the-dials)) |
|
|
36
|
+
| `color-scheme` | light or dark, read off your page or set on one mount with `style` ([THEMING §"The surface follows your colour scheme"](THEMING.md#the-surface-follows-your-colour-scheme)) |
|
|
37
|
+
| `.qm-editor`, `.qm-preview`, `.qm-pane` | placing and sizing each surface from your own stylesheet; `class` and `style` props land on the same root |
|
|
38
|
+
| `[data-qm-card="<kind>"]` | the cards of one kind, `main` for the main card ([THEMING §"What a stylesheet may aim at"](THEMING.md#what-a-stylesheet-may-aim-at)) |
|
|
39
|
+
| `strings`, on each surface | every word it says, keyed and partial, the value-inserting ones included ([README §Wording](README.md#wording)) |
|
|
40
|
+
| `formatDiagnostic` | the text of a validation or edit diagnostic under its field |
|
|
41
|
+
| `enumOptionAllowed`, `enumDisallowed` | which options of an enum a deployment offers, and whether a refused one is hidden or greyed |
|
|
42
|
+
| `fonts`, `fontLabels` | the font families the format popover offers, and the names it shows them by ([README §Fonts](README.md#fonts)) |
|
|
43
|
+
| the quill's `ui` hints | layout from the schema: `ui.compact` to share a row, `ui.layout: table` for an array, `ui.blank_title` for an enum's blank |
|
|
44
|
+
| `review` | another writer's proposals, drawn where each sits and answered on the page ([README §Review](README.md#review)) |
|
|
45
|
+
|
|
46
|
+
### Write your own shell
|
|
47
|
+
|
|
48
|
+
Any change of behaviour, rather than of look or wording, is a shell of your own: a submit button, saving to your server, sign-in, a document opened prefilled. `createWorkspace` is the glue between the two surfaces packaged, so the shell is a short file of your wiring that takes each npm release as it comes rather than a copy of ours that drifts ([README §"A shell on the workspace"](README.md#a-shell-on-the-workspace)). The quillkit app is one such shell.
|
|
49
|
+
|
|
50
|
+
The shell holds the `Document`, so where it comes from and where it goes is yours: parse it from markdown your server sends, seed it from the quill, write it back on every `onChange` or on a press. Storage, choosing the quill, switching documents, the review list and collaboration are the shell's.
|
|
51
|
+
|
|
52
|
+
## What is closed, and why
|
|
53
|
+
|
|
54
|
+
Closed means no prop, promised class or file reaches it. Each is closed for the reason beside it.
|
|
55
|
+
|
|
56
|
+
| Closed | Why |
|
|
57
|
+
| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| the DOM and classes inside a surface | a class contract over the interior would freeze the DOM the surfaces are free to re-cut; the dials and the root classes already reach what a restyle wants |
|
|
59
|
+
| the control drawn for each field type | per-control render slots are declined: they would hand reconciliation to your code |
|
|
60
|
+
| what the slash menu and the format popover offer | the slash menu offers the constructs the caret can make, each asked whether it would fire there, and its pointer door is declined; the format popover's buttons are fixed and the fonts it offers are yours (`fonts`) |
|
|
61
|
+
| the icons | a closed set drawn against one frame, so no glyph strokes differently from its neighbours; a glyph takes its control's colour, which the dials reach |
|
|
62
|
+
| keyboard shortcuts | each binding and the shortcut list are read off one table, so a list and a key cannot drift; `editorShortcuts()` and `REVIEW_KEYS` read them, and nothing rebinds them |
|
|
63
|
+
| the undo model | undo is per prose field and per list, never one stack for the document, and a removed card has its own step back |
|
|
64
|
+
| image authoring | declined: there is no asset story |
|
|
65
|
+
| touch-first editing | declined: touch is not a target, and neither is an accessory bar |
|
|
66
|
+
| in the quillkit app: where documents are stored | in this browser only, one database per app, and the app says so; a server is a shell's |
|
|
67
|
+
| in the quillkit app: the actions offered | `App.yaml` holds what the app says, not what it does: keys that compose into behaviour are a program, and a program belongs in a real language, the custom shell |
|
|
68
|
+
| in the quillkit app: the layout | where the app puts its parts is its client's; `app.css` restyles the chrome through the promised classes, and anything past them is warned, since a release may re-cut it |
|
|
69
|
+
| in the quillkit app: the version a new document opens on | the latest the quiver holds, at `0.1.0` or above unless built with `--drafts`; a document reopens on the version it was made on and offers an update, so a release never moves a half-filled form under its reader |
|
|
70
|
+
| in the quillkit app: the wording and the language | English and fixed: plain text in `App.yaml` cannot set a string that inserts a value, so a translation there stays part English; a shell sets every string through `strings` |
|
|
71
|
+
|
|
72
|
+
The reasons are recorded with the designs they rejected in [this package's INVARIANTS](prose/INVARIANTS.md) and [quillkit's](../quillkit/prose/INVARIANTS.md). Each package's exported names are held against a committed snapshot, `api.json`, which `check:api` compares on every build of this repository, so nothing becomes open or closed by an export appearing, vanishing or moving between entries without a reviewed diff.
|
|
73
|
+
|
|
74
|
+
## When something you need is missing
|
|
75
|
+
|
|
76
|
+
A dial appears when a real consumer needs one, and every dial is one more thing a reader has to hold. So before forking, [open an issue](https://github.com/birdorbs/quillmark-js/issues) describing what you are building and what stopped you: the need, not the patch.
|
|
77
|
+
|
|
78
|
+
Meanwhile the supported escape route is a custom shell on the published packages, not a fork: a shell takes each release as an npm update, where a fork takes one only by a merge.
|
package/README.md
CHANGED
|
@@ -12,17 +12,17 @@ npm install @quillmark/svelte
|
|
|
12
12
|
|
|
13
13
|
`svelte@^5.33` and `@quillmark/wasm` are peer dependencies: the session's handles cross the package boundary, so the consumer supplies the one copy both sides mint them from.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Entries
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
A page imports from the root. `/preview` imports less where less is the point, and the preset is a stylesheet.
|
|
18
18
|
|
|
19
|
-
| Import |
|
|
20
|
-
| --------------------------- |
|
|
21
|
-
| `@quillmark/svelte
|
|
22
|
-
| `@quillmark/svelte/preview` |
|
|
23
|
-
| `@quillmark/svelte/
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
| Import | What it is |
|
|
20
|
+
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `@quillmark/svelte` | Everything a page mounts: `<VisualEditor>`, `<Preview>` and `createPreview`, review and wording, `init`, the `DocPath`/`Place` address vocabulary and `EditorError` channel the surfaces share, and `createWorkspace` with `beginPrint` for a shell. |
|
|
22
|
+
| `@quillmark/svelte/preview` | `createPreview` and `<Preview>`, with `init` and the shared address and error types, for a page that only displays a document. It reaches nothing editor-side, so the page ships no ProseMirror. |
|
|
23
|
+
| `@quillmark/svelte/preset` | The opt-in stylesheet for the page around a surface ([THEMING.md](THEMING.md)). |
|
|
24
|
+
|
|
25
|
+
Code with no page, a worker or a plain Node server, mounts no surface, so it imports `init` from `@quillmark/wasm` directly: this package's entries reach the surfaces' stylesheets. Tree-shaking the root is no substitute for `/preview`: the package is `sideEffects: true`, since its components import stylesheets, so a bundler keeps what the root reaches.
|
|
26
26
|
|
|
27
27
|
## Open a session
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ The **consumer** owns the session and the handles, and drives every edit; the su
|
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
import { Engine } from '@quillmark/wasm';
|
|
33
|
-
import { init } from '@quillmark/svelte
|
|
33
|
+
import { init } from '@quillmark/svelte';
|
|
34
34
|
|
|
35
35
|
// Quill and Document are exported only through init().
|
|
36
36
|
const { Quill, Document } = await init();
|
|
@@ -50,6 +50,81 @@ const session = await new Engine().open(quill, doc);
|
|
|
50
50
|
|
|
51
51
|
`<VisualEditor>` needs no session, and the first `open` loads the render build, so a host that mounts the editor over `doc` and `quill` first shows it without waiting on that load. The session opens behind it: `await engine.load(quill)`, then `engine.open(quill, doc)`, so its first compile reads what was typed meanwhile ([INVARIANTS.md](prose/INVARIANTS.md#hosting)).
|
|
52
52
|
|
|
53
|
+
## A shell on the workspace
|
|
54
|
+
|
|
55
|
+
`createWorkspace` is the glue a shell over the two surfaces writes, packaged as one opt-in policy: it opens the session behind the editor, compiles each edit (a structure op at once, prose and field edits once 120 ms pass without another), merges the diagnostics for the editor, compiles an open review's projection for the preview ([Review](#review)), bridges the caret both ways, latches a backend trap, and tears down in order. The surfaces keep their own contracts under it, and a shell that wants another policy wires them itself ([Recompiling](#recompiling), [The caret bridge](#the-caret-bridge)). One workspace is one document, and it frees only the session it opened. This is the whole of a shell:
|
|
56
|
+
|
|
57
|
+
```svelte
|
|
58
|
+
<script lang="ts">
|
|
59
|
+
import { onDestroy, tick, untrack } from 'svelte';
|
|
60
|
+
import type { Document, Engine, Quill } from '@quillmark/wasm';
|
|
61
|
+
import { createWorkspace, Preview, VisualEditor } from '@quillmark/svelte';
|
|
62
|
+
|
|
63
|
+
interface Props {
|
|
64
|
+
engine: Engine | Promise<Engine>;
|
|
65
|
+
quill: Quill;
|
|
66
|
+
/** Handed over: the shell frees it once the workspace has freed its session. */
|
|
67
|
+
doc: Document;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const { engine, quill, doc }: Props = $props();
|
|
71
|
+
|
|
72
|
+
let editor = $state.raw<ReturnType<typeof VisualEditor>>();
|
|
73
|
+
let preview = $state.raw<ReturnType<typeof Preview>>();
|
|
74
|
+
|
|
75
|
+
// One workspace per document: a parent swaps documents with `{#key doc}`.
|
|
76
|
+
const ws = untrack(() =>
|
|
77
|
+
createWorkspace({
|
|
78
|
+
engine,
|
|
79
|
+
quill,
|
|
80
|
+
doc,
|
|
81
|
+
editor: () => editor,
|
|
82
|
+
preview: () => preview,
|
|
83
|
+
onState: (next) => (now = next)
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
let now = $state.raw(ws.state);
|
|
87
|
+
|
|
88
|
+
onDestroy(() => void ws.dispose(tick).then(() => doc.free()));
|
|
89
|
+
|
|
90
|
+
async function download(): Promise<void> {
|
|
91
|
+
const file = await ws.render('pdf');
|
|
92
|
+
if (!file) return;
|
|
93
|
+
const a = document.createElement('a');
|
|
94
|
+
a.href = URL.createObjectURL(new Blob([file.bytes as BlobPart], { type: file.mimeType }));
|
|
95
|
+
a.download = 'document.pdf';
|
|
96
|
+
a.click();
|
|
97
|
+
URL.revokeObjectURL(a.href);
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<button type="button" onclick={download}>Download PDF</button>
|
|
102
|
+
{#if now.status === 'refused'}
|
|
103
|
+
<p role="alert">{now.refused[0]?.message}</p>
|
|
104
|
+
{/if}
|
|
105
|
+
<VisualEditor bind:this={editor} {doc} {quill} diagnostics={now.diagnostics} {...ws.editor} />
|
|
106
|
+
{#if now.session}
|
|
107
|
+
<Preview bind:this={preview} session={now.session} {...ws.preview} />
|
|
108
|
+
{/if}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
A host that opens several documents keys this shell on the document and guards its own open with a counter, so a load that lands after a later one frees its document rather than mounting it.
|
|
112
|
+
|
|
113
|
+
`ws.editor` and `ws.preview` are handler objects: spread them, or call one from a handler of the shell's own, as one that also saves each edit does with `onChange={(change) => { save(); ws.editor.onChange(change); }}`. The surfaces are read through getters because a preview mounts only once a session stands, so its ref arrives late. `onState` hands over a new `state` on every change: the `session` to mount the preview over, `diagnostics` for the editor, `formats` the backend emits, `review`, which is `none`, `shown` (the preview compiles the open review's projection) or `failed` (the projection did not compile, so the preview shows the document), and `status`, which is `opening`, `ready`, `refused` (the engine refused the last open or compile with `refused`; a session that stands still paints its last good compile, and the next edit after a refused open opens again), `paint-failed` (until the next edit) or `trapped`. `diagnostics` takes the shell's own as a getter, merged once each at every compile.
|
|
114
|
+
|
|
115
|
+
`trapped` is terminal: the render build trapped (`runtime::backend_trapped`), so its state is undefined, the session is dropped for the preview to unmount and then freed, and nothing compiles or opens again until the page reloads; editing continues, on the core build. The render build is one per process, so a workspace created after a trap starts `trapped`, and `backendTrapped()` says whether one has happened.
|
|
116
|
+
|
|
117
|
+
`ws.wrote(structural)` is the door for a write the shell made to the document itself: `true` compiles at once, as a card operation does, and otherwise the compile debounces as a keystroke's. `ws.flush()` runs a pending compile now and resolves once the page is current, for a shell that marks the page. `ws.render(format)` compiles a pending edit, waits on the open, and resolves `undefined` where the document does not compile, so a download is the document in hand, never a proposal the reader has not accepted, even while the preview shows one. `ws.doc` and `ws.quill` are the handles the editor mounts over. `ws.dispose(unmounted)` hands `onState` a state with no session, awaits `unmounted` so the surfaces go first, then frees the session. `beginPrint()`, called on the press itself so a fallback tab is not a blocked popup, prints the PDF once it is rendered:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const printing = beginPrint();
|
|
121
|
+
const pdf = await ws.render('pdf');
|
|
122
|
+
if (!pdf) printing.cancel();
|
|
123
|
+
else if (!printing.print(pdf.bytes)) refusal = 'This browser blocked printing.';
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Storage, choosing the quill, switching documents, the review list and collaboration stay the shell's.
|
|
127
|
+
|
|
53
128
|
## The quill resolves from the document
|
|
54
129
|
|
|
55
130
|
A stored document carries none of its quill's bytes, only a reference: `doc.quillRef` is `name@version`, persisted in the markdown itself. Resolution is **host code**: read the ref, map it to a `Quill`, open. No surface resolves, so one resolution per document holds by construction.
|
|
@@ -75,7 +150,7 @@ What stays yours is the text edge and the ref. The markdown is the host's at bot
|
|
|
75
150
|
`createPreview` supplies the layer the session omits: viewport, DOM, DPR, click mapping. It is a pure view: it never calls `session.apply`; you drive the edit and hand it the resulting `ChangeSet`.
|
|
76
151
|
|
|
77
152
|
```ts
|
|
78
|
-
import { createPreview } from '@quillmark/svelte
|
|
153
|
+
import { createPreview } from '@quillmark/svelte';
|
|
79
154
|
|
|
80
155
|
const preview = createPreview(session, {
|
|
81
156
|
container: document.querySelector('#preview')!,
|
|
@@ -101,7 +176,7 @@ In Svelte, `<Preview {session} onPick={…} />` exposes the same verbs (`refresh
|
|
|
101
176
|
|
|
102
177
|
```svelte
|
|
103
178
|
<script lang="ts">
|
|
104
|
-
import { VisualEditor } from '@quillmark/svelte
|
|
179
|
+
import { VisualEditor } from '@quillmark/svelte';
|
|
105
180
|
</script>
|
|
106
181
|
|
|
107
182
|
<VisualEditor
|
|
@@ -198,7 +273,7 @@ type ReviewItem =
|
|
|
198
273
|
- **A proposal for a place inside a field** names it by its path, `main.contact.email` or `main.signature_block[2]`, and is drawn in the control of that place as a field's is: a record's cell, a list's row, ringed and struck where the member goes, or for a member past the last, a row after the list's last in the controls it would have, holding the proposed value under the review tint and taking no input. A choice with variants takes its discriminant at `main.distribution.value` and each cell of its world beside it, and a checklist each member at `main.checks.figures`, drawn on its tick, and each cell inside one. Where no control of its own is drawn, inside a closed row, it marks the nearest one. Accept writes the field's whole value with that place alone changed, down the lane an edit of the place takes. In a list, `after` absent takes the member out, and an index past the last appends one. A member's `before` finds it: where the member at the index no longer holds it, the nearest that does and that no other open proposal of the list has found, so taking one member out does not move the next proposal onto the wrong row. One whose `before` nothing holds is outdated. An item in a closed group marks the group's header, and stepping to it opens the group.
|
|
199
274
|
- **A proposed card** is drawn where it would stand: `add` as a preview of the card, its title, each field it fills by name and the start of its body, after the card at index `after` (before the first card without one), and `remove` as a ring round the card at that index, its values struck and _Proposed removal_ in its header. Accept writes it as the reader's own card operation, the added card under the `$id` it carries, and `onChange` reports it as a `structure` change; ⌘Z takes it back. Cards added after the same card stand in the list's order.
|
|
200
275
|
|
|
201
|
-
`proposalsBetween(quill, base, answer)`, from `@quillmark/svelte
|
|
276
|
+
`proposalsBetween(quill, base, answer)`, from `@quillmark/svelte`, makes the list from an assistant's answer. `base` is the document as the assistant read it, a snapshot taken when it was asked, and `answer` a copy of it the assistant edited; neither is the live document, which the editor compares each item with as it draws, so what the reader typed meanwhile is theirs and a place both changed is `outdated`. It returns `{ items }`, with `before` filled in: one `replace` per block the answer rewrote or took out and one `insert` per run of blocks it added, an item per record cell and list member that changed elsewhere, at the paths of `base`, and an item per card it added, after the card of `base` it follows, and per card it took out. An item names its card one of two ways. `card` beside a `field`, `card` on a removal and `afterCard` on an added card name it by its `$id`, wherever it stands when the item is drawn, and `proposalsBetween` fills them in for every card of `base` that has one: the list holds over a live document whose cards were added, removed or moved since the snapshot. Without one, the path's index, `remove` and `after` name the card by index, read against the cards as they stood when the list was set, and a card added, removed or moved between the snapshot and then is not carried. Either way the editor keeps each item on its card through every card added, removed or moved while the list stands, by `applyCardOps`, by the reader or by an accepted card item. An item whose card is gone goes `undrawn` as `field`, a removal whose card is gone as `applied`, and a card added after one that is gone stands last.
|
|
202
277
|
|
|
203
278
|
```ts
|
|
204
279
|
const base = doc.clone(); // when the assistant is asked
|
|
@@ -229,6 +304,8 @@ The host sets the list once and clears it once. It sets it when an answer arrive
|
|
|
229
304
|
|
|
230
305
|
The verbs complete it. `answerReview(ids | 'all' | { group }, 'accept' | 'dismiss')` answers items as the answer card would, in document order, and returns the ids answered: `onReview` hears each, an item that cannot be answered stands, `'all'` or `{ group }` with `'accept'` leaves every outdated item open, and neither the focus nor the caret moves; answering the current item moves on as the card does. `stepReview(1 | -1)` brings the next or previous drawn item to the reader, round from either end, with the caret in it or the focus in its field (`{ focus: false }` only lights it, and `{ group }` passes over every item of another group), and resolves its id; it scrolls the item's own scroller only as far as it must to show it, so an editor in a pane that scrolls on its own steps within that pane. `revealReview(id)` brings one item to the reader: it opens the group holding the item, scrolls it to the middle of the pane and lights it, and resolves `false` for an item the editor does not draw; `{ focus: true }` also puts the caret in it.
|
|
231
306
|
|
|
307
|
+
While items are open, a preview shows the page as it would read with every open proposal taken, compiled from a copy and never from the document: `projectReview(copy)` writes each one into a clone the host hands in, as its Accept would, and returns `{ ids, toProjection, toLive }`, the proposals written and the map between the document's places and the copy's. The host compiles the copy for its preview alone and frees it, falls back to the document where the copy does not compile, compiles again on each `onReviewDrawn` whose `open` changed, and routes both bridge hops through the map, a pick on a card or paragraph only the copy holds naming the item that adds it for `revealReview`. Everything that saves, shares or prints reads the document. [The workspace](#a-shell-on-the-workspace) does all of this for a shell built on it.
|
|
308
|
+
|
|
232
309
|
The **answer card** floats on the current item, below the paragraph or block it stands in, beside that paragraph's last line where the line ends short of it, centred on the line of a one-line field so it stands inside the field rather than over the next field's label, or above it where there is no room, so it covers none of the item's own paragraph, with **Dismiss** and **Accept** and their keys, and the item's `note` above them on one line. It scrolls with the item and is clipped at the pane's edge as the text is. It keeps clear of `reviewInset`, the px the host's chrome takes at the foot of the pane, while the item shows, steps aside while the reader types, and never takes the focus: a press on it leaves the focus where it was, and Alt+F10 puts the keyboard on it, Escape handing the focus back. Under a finger, or on a screen with no hover, it drops the key hints and its buttons are tap-sized.
|
|
233
310
|
|
|
234
311
|
While a review is open, `REVIEW_KEYS` answer the current item from anywhere on the page but another editor or a text box outside this one: ⌘/Ctrl+Enter accepts it, ⌘/Ctrl+⌥/Alt+Backspace dismisses it, and ⌘/Ctrl+⌥/Alt+↓ and ↑ step to the next and previous item, moving the caret along when pressed in the editor. The two answer keys are the card's, so they answer an item the card stands on in view: with the item scrolled out of the pane, or the card aside while the reader types, the first press brings it back and the next answers it. No leaf binds a review key: ⌘/Ctrl+Enter is the review's alone, and Alt+Enter ticks a task item, takes a sibling from a list element of several lines and leaves a code block. A proposal that only adds blocks is current from anywhere in the paragraph it adds after; where a proposal also rewrites that paragraph, the caret names the rewrite, and `revealReview(id, { focus: true })` puts it in the one asked for. Every word the review draws is a `strings` key, and its one hue is `--qm-review` ([THEMING.md](THEMING.md)).
|
|
@@ -274,7 +351,7 @@ const engine = new Engine({ fonts: [carlito] });
|
|
|
274
351
|
|
|
275
352
|
### Recompiling
|
|
276
353
|
|
|
277
|
-
`onChange` is the signal to recompile, and it covers **all three lanes**: a prose keystroke, a scalar write, a card operation. `onCaretMove` is a _selection_ signal, not a change signal: it fires on a bare arrow key, so a recompile hung off it recompiles on every one.
|
|
354
|
+
`createWorkspace` is the packaged form of what follows ([A shell on the workspace](#a-shell-on-the-workspace)). `onChange` is the signal to recompile, and it covers **all three lanes**: a prose keystroke, a scalar write, a card operation. `onCaretMove` is a _selection_ signal, not a change signal: it fires on a bare arrow key, so a recompile hung off it recompiles on every one.
|
|
278
355
|
|
|
279
356
|
```ts
|
|
280
357
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -300,11 +377,11 @@ function recompileNow() {
|
|
|
300
377
|
|
|
301
378
|
`session.warnings` is a **getter on a handle Svelte does not track**: pull it per apply, or the editor shows the previous compile's errors.
|
|
302
379
|
|
|
303
|
-
The schedule is host policy,
|
|
380
|
+
The surfaces ship no scheduler: the schedule is host policy, and [the workspace](#a-shell-on-the-workspace) is one such policy, packaged. A host wiring the surfaces itself keeps three obligations: an edit of your own (an import, an undo, a direct `doc` write) recompiles by the same calls, since nothing polls the document; a compile re-reads the diagnostics; and teardown clears the timer **before** freeing the handles.
|
|
304
381
|
|
|
305
382
|
## The caret bridge
|
|
306
383
|
|
|
307
|
-
The bridge lives at the **consumer** layer and is opt-in; the editor is unaware of the preview, the preview unaware of the editor.
|
|
384
|
+
`createWorkspace` wires both directions as `ws.editor` and `ws.preview`, through the review projection's map while one is shown ([A shell on the workspace](#a-shell-on-the-workspace), [Review](#review)). The bridge lives at the **consumer** layer and is opt-in; the editor is unaware of the preview, the preview unaware of the editor. With no review projection shown, both hops are pass-throughs: the two surfaces already speak one address grammar, the canonical `DocPath`.
|
|
308
385
|
|
|
309
386
|
```ts
|
|
310
387
|
// preview → editor: a click resolved to an address lands in the field it names.
|
|
@@ -320,7 +397,7 @@ Both editor→preview hops or neither. A control reports its focus and no caret
|
|
|
320
397
|
|
|
321
398
|
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
399
|
|
|
323
|
-
A consumer holding an `Addr` of its own maps it with the Document's `pathFor`. The playground
|
|
400
|
+
A consumer holding an `Addr` of its own maps it with the Document's `pathFor`. The playground's split-pane route takes both directions from the workspace, through a review projection and under a collaboration room; its landing page mounts the surfaces on their own verbs, with no workspace under them.
|
|
324
401
|
|
|
325
402
|
## Errors
|
|
326
403
|
|
|
@@ -349,6 +426,8 @@ el.textContent = doc.toMarkdown();
|
|
|
349
426
|
|
|
350
427
|
The surfaces carry the behavior against a neutral, overridable visual baseline: a set of `--qm-*` CSS custom properties you override on any ancestor. See [`THEMING.md`](THEMING.md).
|
|
351
428
|
|
|
429
|
+
What you can change without forking, at each depth from configuring the quillkit app to a shell of your own, and what is closed and why: [`CUSTOMIZING.md`](CUSTOMIZING.md).
|
|
430
|
+
|
|
352
431
|
## Development
|
|
353
432
|
|
|
354
433
|
This package is one workspace of [`quillmark-js`](../..); the gates are the root's, and the rules a change must keep live in [`prose/INVARIANTS.md`](prose/INVARIANTS.md).
|
package/THEMING.md
CHANGED
|
@@ -10,6 +10,8 @@ There are three depths to that. An app mounting into an unstyled page stops at t
|
|
|
10
10
|
| **Make it yours** | ten custom properties | the whole surface rescaled and recolored to your brand |
|
|
11
11
|
| **Match ours** | one CSS import | the page around the surface, drawn the way we draw ours |
|
|
12
12
|
|
|
13
|
+
Theming is one part of what you can change without forking: [CUSTOMIZING.md](CUSTOMIZING.md) maps the rest, and what is closed.
|
|
14
|
+
|
|
13
15
|
## Drop it in
|
|
14
16
|
|
|
15
17
|
```svelte
|
|
@@ -22,10 +22,3 @@ export declare function rangeAnchor(view: EditorView, from: number, to: number):
|
|
|
22
22
|
* clears every one, as a surface over a selection in a table cell clears the cell's row.
|
|
23
23
|
*/
|
|
24
24
|
export declare function across(anchor: RangeAnchor, boxes: readonly Element[]): RangeAnchor;
|
|
25
|
-
/**
|
|
26
|
-
* A virtual anchor over the first line box of the element `find` returns when asked: a mark a
|
|
27
|
-
* view redraws under every edit, so no element outlives the surface hung off it. `context` is
|
|
28
|
-
* the view's own element, which does. Total as {@link rangeAnchor} is: with nothing to measure
|
|
29
|
-
* it returns the last rect that measured.
|
|
30
|
-
*/
|
|
31
|
-
export declare function markAnchor(context: Element, find: () => Element | undefined): RangeAnchor;
|
|
@@ -78,22 +78,3 @@ export function across(anchor, boxes) {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
/**
|
|
82
|
-
* A virtual anchor over the first line box of the element `find` returns when asked: a mark a
|
|
83
|
-
* view redraws under every edit, so no element outlives the surface hung off it. `context` is
|
|
84
|
-
* the view's own element, which does. Total as {@link rangeAnchor} is: with nothing to measure
|
|
85
|
-
* it returns the last rect that measured.
|
|
86
|
-
*/
|
|
87
|
-
export function markAnchor(context, find) {
|
|
88
|
-
let last;
|
|
89
|
-
return {
|
|
90
|
-
contextElement: context,
|
|
91
|
-
getBoundingClientRect: () => {
|
|
92
|
-
const el = find();
|
|
93
|
-
const rect = el?.getClientRects()[0] ?? el?.getBoundingClientRect();
|
|
94
|
-
if (rect)
|
|
95
|
-
last = rect;
|
|
96
|
-
return last ?? new DOMRect();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
package/dist/core/codec/field.js
CHANGED
|
@@ -177,7 +177,7 @@ function readLeaf(reader, addr) {
|
|
|
177
177
|
function writeAddr(doc, addr) {
|
|
178
178
|
if (typeof addr.card !== 'number')
|
|
179
179
|
return addr;
|
|
180
|
-
return { ...addr, card: doc.
|
|
180
|
+
return { ...addr, card: doc.cardId(addr.card) };
|
|
181
181
|
}
|
|
182
182
|
/** The canonical empty `Content`: one empty `para` block. */
|
|
183
183
|
export function emptyContent() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { rangeAnchor } from './anchor.js';
|
|
2
2
|
export type { RangeAnchor } from './anchor.js';
|
|
3
3
|
export { createField, emptyContent, heldAttributes, isEmptyContent, proseAttributes, proseLeafPlugins } from './field.js';
|
|
4
4
|
export type { CreateFieldOpts, FieldController, LeafProjection, LeafViews } from './field.js';
|
|
@@ -11,19 +11,16 @@ export { DEFAULT_SLASH_STRINGS } from './slash.js';
|
|
|
11
11
|
export type { SlashState, SlashStrings } from './slash.js';
|
|
12
12
|
export { DEFAULT_LEAVE_STRINGS } from './leave.js';
|
|
13
13
|
export type { LeaveStrings } from './leave.js';
|
|
14
|
-
export type { BlockPlace,
|
|
15
|
-
export { wordDiff } from './review-diff.js';
|
|
14
|
+
export type { BlockPlace, ReviewAction, ReviewReport, TextReview } from './review.js';
|
|
16
15
|
export { valueDiffPlugin, valueSpans } from './value-diff.js';
|
|
17
16
|
export { reviewCaretPlugin } from './review-caret.js';
|
|
18
17
|
export type { ValueProposal, ValueState } from './value-diff.js';
|
|
19
18
|
export { asContent, planValue, valueChanges } from './value-plan.js';
|
|
20
|
-
export type { ValuePlan, ValueChange } from './value-plan.js';
|
|
21
|
-
export type { DiffHunk } from './review-diff.js';
|
|
22
19
|
export { DEFAULT_SHORTCUT_STRINGS, FIELD_KEYS, LIST_KEYS, REVIEW_KEYS, editorShortcuts } from './shortcuts.js';
|
|
23
20
|
export type { EditorShortcut, ShortcutScope, ShortcutStrings } from './shortcuts.js';
|
|
24
|
-
export { blockSchema, inlineSchema, plaintextSchema, plainSchema,
|
|
21
|
+
export { blockSchema, inlineSchema, plaintextSchema, plainSchema, leafSchema, isParagraphsSchema, hasMarks } from './schema.js';
|
|
25
22
|
export { rendersHref, storableUrl } from './urls.js';
|
|
26
|
-
export { decode, fitsInline, fitsLeaf, fitsPlain, renderContent
|
|
23
|
+
export { decode, fitsInline, fitsLeaf, fitsPlain, renderContent } from './decode.js';
|
|
27
24
|
export { pmToContent, lower } from './encode.js';
|
|
28
25
|
export { offsetToPM, pmToOffset, buildLineIndex } from './positions.js';
|
|
29
26
|
export { createReconciler, contentEqual, valueEqual } from './reconcile.js';
|
package/dist/core/codec/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import 'prosemirror-gapcursor/style/gapcursor.css';
|
|
|
11
11
|
import './prose.css';
|
|
12
12
|
// What a floating surface anchors to. The visual tier's own surfaces mint one over a
|
|
13
13
|
// selection (`visual/FormatPopover.svelte`), so it is reached off-barrel.
|
|
14
|
-
export {
|
|
14
|
+
export { rangeAnchor } from './anchor.js';
|
|
15
15
|
// The prose leaf.
|
|
16
16
|
export { createField, emptyContent, heldAttributes, isEmptyContent, proseAttributes, proseLeafPlugins } from './field.js';
|
|
17
17
|
export { capCount } from './cap.js';
|
|
@@ -25,7 +25,6 @@ export { DEFAULT_SLASH_STRINGS } from './slash.js';
|
|
|
25
25
|
// The body's way out by the keyboard: the codec owns the keys and the hint's element,
|
|
26
26
|
// the visual tier's `strings` set its wording.
|
|
27
27
|
export { DEFAULT_LEAVE_STRINGS } from './leave.js';
|
|
28
|
-
export { wordDiff } from './review-diff.js';
|
|
29
28
|
export { valueDiffPlugin, valueSpans } from './value-diff.js';
|
|
30
29
|
export { reviewCaretPlugin } from './review-caret.js';
|
|
31
30
|
export { asContent, planValue, valueChanges } from './value-plan.js';
|
|
@@ -35,7 +34,7 @@ export { asContent, planValue, valueChanges } from './value-plan.js';
|
|
|
35
34
|
export { DEFAULT_SHORTCUT_STRINGS, FIELD_KEYS, LIST_KEYS, REVIEW_KEYS, editorShortcuts } from './shortcuts.js';
|
|
36
35
|
// Schemas (the decode/encode target; the VisualEditor mounts them). `hasMarks` is
|
|
37
36
|
// what a mark surface asks before offering itself over a leaf.
|
|
38
|
-
export { blockSchema, inlineSchema, plaintextSchema, plainSchema,
|
|
37
|
+
export { blockSchema, inlineSchema, plaintextSchema, plainSchema, leafSchema, isParagraphsSchema, hasMarks } from './schema.js';
|
|
39
38
|
// The url edge: `rendersHref` is the link gate the prompt re-asks on submit, and
|
|
40
39
|
// `storableUrl` the encode the store's own refusal requires of the value it takes
|
|
41
40
|
// (`visual/links.ts`).
|
|
@@ -45,7 +44,7 @@ export { rendersHref, storableUrl } from './urls.js';
|
|
|
45
44
|
// The barrel carries what has an off-barrel caller, and nothing else. A symbol
|
|
46
45
|
// reached only by relative import within `codec/` stays off it: an export nothing
|
|
47
46
|
// imports is surface that still has to stay honest.
|
|
48
|
-
export { decode, fitsInline, fitsLeaf, fitsPlain, renderContent
|
|
47
|
+
export { decode, fitsInline, fitsLeaf, fitsPlain, renderContent } from './decode.js';
|
|
49
48
|
export { pmToContent, lower } from './encode.js';
|
|
50
49
|
export { offsetToPM, pmToOffset, buildLineIndex } from './positions.js';
|
|
51
50
|
// Reconciliation gate.
|
|
@@ -51,7 +51,7 @@ export const DEFAULT_TABLE_STRINGS = {
|
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* The grip's glyph as path data: this chrome's own set, since it is built without Svelte and
|
|
54
|
-
*
|
|
54
|
+
* `core/` reaches no surface module. Same 24×24 frame as `visual/icons/nodes.ts`, off an earlier
|
|
55
55
|
* release; `NOTICE` carries both notices. The dots are zero-length strokes under a round cap.
|
|
56
56
|
*/
|
|
57
57
|
const GRIP = {
|
package/dist/core/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// What this package owns at the substrate seam, which the root re-exports.
|
|
2
2
|
//
|
|
3
3
|
// The `@quillmark/wasm` API is not re-exported: import it from the peer dependency. What earns a
|
|
4
4
|
// line here is what more than one surface speaks and no other package declares: the address
|
|
5
5
|
// vocabulary, the error channel, and the WASM init gate.
|
|
6
|
-
//
|
|
7
|
-
// No stylesheet: a host reaches this entry where there is no document (a worker, a server), and a
|
|
8
|
-
// dev server serves a side-effect sheet as a module that writes a `<style>` into one. The surface
|
|
9
|
-
// barrels carry the theme; `check:deps` holds it.
|
|
10
6
|
export { init } from './lifecycle.js';
|
package/dist/core/lifecycle.js
CHANGED
|
@@ -30,7 +30,7 @@ export function init() {
|
|
|
30
30
|
*/
|
|
31
31
|
export function core() {
|
|
32
32
|
if (!latched) {
|
|
33
|
-
throw new Error('@quillmark/svelte: the WASM core is not initialized. Await `init()` from `@quillmark/svelte
|
|
33
|
+
throw new Error('@quillmark/svelte: the WASM core is not initialized. Await `init()` from `@quillmark/svelte` before mounting a surface or calling a boundary verb.');
|
|
34
34
|
}
|
|
35
35
|
return latched;
|
|
36
36
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Quill } from '@quillmark/wasm';
|
|
2
|
+
type QuillSchema = Quill['schema'];
|
|
3
|
+
/** `quill.schema`, built once per handle: the getter rebuilds and serializes the whole schema on
|
|
4
|
+
* every read, and a handle's schema never changes. Shared, so read-only. */
|
|
5
|
+
export declare function schemaOf(quill: Quill): QuillSchema;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const schemas = new WeakMap();
|
|
2
|
+
/** `quill.schema`, built once per handle: the getter rebuilds and serializes the whole schema on
|
|
3
|
+
* every read, and a handle's schema never changes. Shared, so read-only. */
|
|
4
|
+
export function schemaOf(quill) {
|
|
5
|
+
let schema = schemas.get(quill);
|
|
6
|
+
if (!schema)
|
|
7
|
+
schemas.set(quill, (schema = quill.schema));
|
|
8
|
+
return schema;
|
|
9
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
// `@quillmark/svelte
|
|
2
|
-
//
|
|
3
|
-
// wants one import for the substrate.
|
|
1
|
+
// `@quillmark/svelte`: everything a page mounts. `init` here latches the surface for the
|
|
2
|
+
// package's synchronous internals; code that mounts no surface calls `@quillmark/wasm`'s directly.
|
|
4
3
|
export * from './core/index.js';
|
|
4
|
+
export * from './visual/index.js';
|
|
5
|
+
export * from './preview/index.js';
|
|
6
|
+
export * from './workspace/index.js';
|
package/dist/preview/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { init } from '../core/lifecycle.js';
|
|
2
|
+
export type { DocPath, Landing, Place } from '../core/address.js';
|
|
3
|
+
export type { EditorError, EditorErrorCode, EditorErrorHandler } from '../core/errors.js';
|
|
1
4
|
export { createPreview } from './controller.js';
|
|
2
5
|
export type { PreviewOptions, PreviewController } from './controller.js';
|
|
3
6
|
export { default as Preview } from './Preview.svelte';
|
package/dist/preview/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// `@quillmark/svelte/preview`: the live-preview surface. Imports no editor-side code; it may reach
|
|
2
|
-
//
|
|
2
|
+
// modules in `core/` and nothing else (`check:deps`).
|
|
3
3
|
// The theme derivation the page slots read through `var()`; a subpath import reaches `core/`
|
|
4
|
-
// modules, never its
|
|
4
|
+
// modules, never its barrel, which carries no sheet.
|
|
5
5
|
import '../core/theme.css';
|
|
6
|
+
// What a preview-only page needs beside the surface, so it opens a session without the root.
|
|
7
|
+
export { init } from '../core/lifecycle.js';
|
|
6
8
|
export { createPreview } from './controller.js';
|
|
7
9
|
export { default as Preview } from './Preview.svelte';
|
package/dist/preview/strings.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Separate from the visual surface's strings: `/preview` reaches
|
|
1
|
+
// Separate from the visual surface's strings: `/preview` reaches `core/` and nothing editor-side.
|
|
2
2
|
/** The package's English. */
|
|
3
3
|
export const DEFAULT_PREVIEW_STRINGS = {
|
|
4
4
|
renderFailed: 'Preview failed to render.',
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
import ReviewRows from './ReviewRows.svelte';
|
|
131
131
|
import { splitDeep, unrouted, type DeepDiagnostic } from './diagnostics.js';
|
|
132
132
|
import { propertyDomIds } from './domid.js';
|
|
133
|
-
import type { LandingBox } from './leaves.js';
|
|
133
|
+
import type { LandingBox, Subform } from './leaves.js';
|
|
134
134
|
import { reorder, reorderArm } from './motion.js';
|
|
135
135
|
import { rowDrag } from './rowdrag.svelte.js';
|
|
136
136
|
import {
|
|
@@ -444,11 +444,6 @@
|
|
|
444
444
|
// A table row's cells, on the same key: the subform a landing and the column-keeping
|
|
445
445
|
// Enter hop reach into. Every table row is open, so there is one per row where the
|
|
446
446
|
// list holds one per open row.
|
|
447
|
-
type Subform = {
|
|
448
|
-
focus: () => void;
|
|
449
|
-
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
450
|
-
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
451
|
-
};
|
|
452
447
|
const cellEls: Record<string, Subform | undefined> = $state({});
|
|
453
448
|
let addEl: HTMLButtonElement | undefined = $state();
|
|
454
449
|
let rowsEl: HTMLElement | undefined = $state();
|
package/dist/visual/Card.svelte
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import Icon from './icons/Icon.svelte';
|
|
14
14
|
import type { Document, Quill, Addr, Diagnostic, PathStep } from '@quillmark/wasm';
|
|
15
15
|
import type { EditorErrorHandler } from '../core/errors.js';
|
|
16
|
+
import { schemaOf } from '../core/schema.js';
|
|
16
17
|
import type { LeafRegistry } from './leaves.js';
|
|
17
18
|
import type { CardModel, FieldModel } from './structure.js';
|
|
18
19
|
import { placeFields, humanize, initialExpandedGroup, kindTitle, mountKey } from './structure.js';
|
|
@@ -462,7 +463,7 @@
|
|
|
462
463
|
|
|
463
464
|
{#snippet kindOptions()}
|
|
464
465
|
{#each kinds as k (k)}
|
|
465
|
-
<option value={k}>{kindTitle(quill
|
|
466
|
+
<option value={k}>{kindTitle(schemaOf(quill)[k], k)}</option>
|
|
466
467
|
{/each}
|
|
467
468
|
{/snippet}
|
|
468
469
|
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
schemaAt
|
|
63
63
|
} from './structure.js';
|
|
64
64
|
import { splitDeep, unrouted, type DeepDiagnostic } from './diagnostics.js';
|
|
65
|
-
import type { LandingBox } from './leaves.js';
|
|
65
|
+
import type { LandingBox, Subform } from './leaves.js';
|
|
66
66
|
import { propertyDomIds } from './domid.js';
|
|
67
67
|
import { bloom } from '../core/bloom.js';
|
|
68
68
|
import Icon from './icons/Icon.svelte';
|
|
@@ -198,11 +198,6 @@
|
|
|
198
198
|
// The item boxes, the ticks, the title inputs and the column subforms, keyed by
|
|
199
199
|
// member id — stable for the item's life. `$state` for the binding's sake
|
|
200
200
|
// (`ArrayField` keeps its element refs the same way).
|
|
201
|
-
type Subform = {
|
|
202
|
-
focus: () => void;
|
|
203
|
-
focusPath: (steps: readonly PathStep[], pos?: number) => LandingBox;
|
|
204
|
-
openPath: (steps: readonly PathStep[]) => Promise<void>;
|
|
205
|
-
};
|
|
206
201
|
const memberEls: Record<string, HTMLElement | undefined> = $state({});
|
|
207
202
|
const tickEls: Record<string, HTMLInputElement | undefined> = $state({});
|
|
208
203
|
const titleEls: Record<string, HTMLInputElement | undefined> = $state({});
|