@quillmark/svelte 0.31.0 → 0.32.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 +3 -3
- package/dist/core/address.d.ts +1 -1
- package/dist/core/address.js +1 -1
- package/dist/core/codec/atoms.js +1 -1
- package/dist/core/codec/breaks.js +3 -2
- package/dist/core/codec/decode.d.ts +1 -1
- package/dist/core/codec/decode.js +2 -2
- package/dist/core/codec/field.d.ts +3 -3
- package/dist/core/codec/field.js +21 -20
- package/dist/core/codec/index.d.ts +2 -0
- package/dist/core/codec/index.js +5 -1
- package/dist/core/codec/inputrules.js +3 -3
- package/dist/core/codec/islands.d.ts +1 -1
- package/dist/core/codec/islands.js +3 -3
- package/dist/core/codec/keymap.d.ts +1 -1
- package/dist/core/codec/keymap.js +3 -2
- package/dist/core/codec/list-move.js +2 -1
- package/dist/core/codec/list-paste.js +1 -1
- package/dist/core/codec/lists.d.ts +1 -1
- package/dist/core/codec/lists.js +7 -6
- package/dist/core/codec/markdown-paste.js +2 -2
- package/dist/core/codec/prose.css +3 -3
- package/dist/core/codec/schema.d.ts +1 -1
- package/dist/core/codec/schema.js +3 -3
- package/dist/core/codec/shortcuts.d.ts +91 -0
- package/dist/core/codec/shortcuts.js +135 -0
- package/dist/core/codec/table-paste.js +1 -1
- package/dist/core/codec/table-view.d.ts +1 -1
- package/dist/core/codec/table-view.js +27 -37
- package/dist/core/codec/tasks.js +1 -1
- package/dist/core/theme.css +2 -2
- package/dist/preset/scale.css +1 -1
- package/dist/preview/Preview.svelte +2 -3
- package/dist/preview/bridge.js +2 -2
- package/dist/preview/geometry.d.ts +2 -2
- package/dist/preview/geometry.js +2 -2
- package/dist/preview/paint.js +1 -1
- package/dist/visual/ArrayField.svelte +5 -5
- package/dist/visual/BooleanField.svelte +1 -1
- package/dist/visual/Card.svelte +4 -4
- package/dist/visual/CardControls.svelte +1 -1
- package/dist/visual/DateField.svelte +1 -1
- package/dist/visual/DiagnosticList.svelte +1 -1
- package/dist/visual/EnumField.svelte +1 -1
- package/dist/visual/Field.svelte +3 -3
- package/dist/visual/FormatPopover.svelte +9 -3
- package/dist/visual/MatrixAdd.svelte +1 -1
- package/dist/visual/MatrixField.svelte +1 -1
- package/dist/visual/NumberField.svelte +2 -3
- package/dist/visual/ObjectField.svelte +2 -2
- package/dist/visual/ProseField.svelte +2 -2
- package/dist/visual/TextField.svelte +1 -1
- package/dist/visual/VariantField.svelte +1 -1
- package/dist/visual/VisualEditorInner.svelte +15 -15
- package/dist/visual/controls.css +2 -2
- package/dist/visual/diagnostics.d.ts +2 -2
- package/dist/visual/diagnostics.js +2 -2
- package/dist/visual/index.d.ts +2 -0
- package/dist/visual/index.js +3 -0
- package/dist/visual/leaves.js +1 -1
- package/dist/visual/props.d.ts +2 -2
- package/dist/visual/strings.d.ts +6 -5
- package/dist/visual/strings.js +2 -1
- package/dist/visual/structure.d.ts +10 -9
- package/dist/visual/structure.js +13 -12
- package/dist/visual/tips.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
A Svelte mount of the codec's `createField` (
|
|
2
|
+
A Svelte mount of the codec's `createField` (INVARIANTS §Surface), which owns the
|
|
3
3
|
PM state, the history and the per-keystroke commit, leaving this wrapper wiring and
|
|
4
4
|
registration. `addr` is a live object the parent builds, so a card reorder re-targets
|
|
5
5
|
this leaf's commits with the caret riding the untouched view.
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
const t = wording();
|
|
104
104
|
|
|
105
105
|
/** Pushed by the leaf's trigger plugin: the menu is the leaf's surface rather than
|
|
106
|
-
* the shell's (
|
|
106
|
+
* the shell's (INVARIANTS §Chrome). A constrained leaf never receives one, the
|
|
107
107
|
* trigger mounting on the block schema alone. */
|
|
108
108
|
let slash: SlashState | undefined = $state();
|
|
109
109
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
default taken, whatever the edit left of it. Tabbing through writes nothing; a
|
|
10
10
|
keystroke typed and removed pins the default.
|
|
11
11
|
|
|
12
|
-
An emptied input writes what empty means for this field (
|
|
12
|
+
An emptied input writes what empty means for this field (INVARIANTS §"The
|
|
13
13
|
commitment ladder"): `""` over a default that prints, the only answer that prints empty there;
|
|
14
14
|
the unset rung elsewhere, where unset already prints nothing and the field stays
|
|
15
15
|
unanswered, and an optional cell returns to `none`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
An `enum` declaring `variants:` → the discriminant's select, and under it the cells
|
|
3
|
-
the chosen world brings into play (
|
|
3
|
+
the chosen world brings into play (INVARIANTS §Enums). The field rests as
|
|
4
4
|
a container, `{value: <member>, …that member's fields}`, and commits whole: it is one
|
|
5
5
|
cell to `Addr`, so there is no per-cell write address.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
The federated WYSIWYG surface (
|
|
3
|
-
small editors; not one PM document spanning the page.
|
|
2
|
+
The federated WYSIWYG surface (INVARIANTS §"Federated, not monolithic"). A thin
|
|
3
|
+
composition over many small editors; not one PM document spanning the page.
|
|
4
4
|
|
|
5
5
|
Mounted once per document. `VisualEditor` keys this component on `doc`, so
|
|
6
6
|
everything below seeds from a handle that cannot change under it: `cardIds`, the
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
// svelte-ignore state_referenced_locally
|
|
142
142
|
let cardIds = $state<string[]>(seq.take(doc.cardCount));
|
|
143
143
|
|
|
144
|
-
// Local commit-error diagnostics (
|
|
144
|
+
// Local commit-error diagnostics (INVARIANTS §Diagnostics, producer #2),
|
|
145
145
|
// id-keyed rather than positional so an error stays pinned to its field across a
|
|
146
146
|
// card reorder.
|
|
147
147
|
const commitErrors = new SvelteMap<string, RoutedDiagnostic>();
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
revision++;
|
|
169
169
|
liveTitles = {};
|
|
170
170
|
}
|
|
171
|
-
/** Read at the mutation boundary, never cached (
|
|
171
|
+
/** Read at the mutation boundary, never cached (INVARIANTS §"The address is the
|
|
172
172
|
* spine"). */
|
|
173
173
|
function cardIndexOf(id: string): number {
|
|
174
174
|
return cardIds.indexOf(id);
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
// the one it already followed is the one its recompile re-locates.
|
|
290
290
|
//
|
|
291
291
|
// A focus clears it, and must: a focus into a leaf with no caret to report ends a
|
|
292
|
-
// consumer's follow (
|
|
292
|
+
// consumer's follow (INVARIANTS §"Follow-the-caret scroll"), and the return to the
|
|
293
293
|
// offset the memo still names is the only thing that would restart it.
|
|
294
294
|
let lastCaretField: DocPath | undefined;
|
|
295
295
|
let lastCaretPos: number | undefined;
|
|
@@ -351,11 +351,11 @@
|
|
|
351
351
|
const keyStr = fieldKeyToString(key);
|
|
352
352
|
try {
|
|
353
353
|
if (value === undefined) {
|
|
354
|
-
// The unset rung (
|
|
354
|
+
// The unset rung (INVARIANTS §"The commitment ladder"): removing the field
|
|
355
355
|
// leaves Quillmark's authored › `default:` › blank-fill resolve to render the
|
|
356
|
-
// default, where writing one bakes a snapshot the schema cannot track
|
|
357
|
-
//
|
|
358
|
-
// as the edit that takes it). Removal writes no value, so there is
|
|
356
|
+
// default, where writing one bakes a snapshot the schema cannot track
|
|
357
|
+
// (quillmark/INVARIANTS §"The commitment ladder": Quillmark never writes a
|
|
358
|
+
// default; the editor writes one only as the edit that takes it). Removal writes no value, so there is
|
|
359
359
|
// nothing for a schema to conform and the lane is the quill-free one.
|
|
360
360
|
if (isMain) {
|
|
361
361
|
doc.removeField(name);
|
|
@@ -648,10 +648,10 @@
|
|
|
648
648
|
return cardAddr(id, field);
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
// ── Diagnostics routing (
|
|
651
|
+
// ── Diagnostics routing (INVARIANTS §Diagnostics) ────────────────────────
|
|
652
652
|
// Producer #1: quill.validate(doc), re-run every revision.
|
|
653
653
|
const validation = $derived.by(() => {
|
|
654
|
-
revision; // re-run on every mutation, per
|
|
654
|
+
revision; // re-run on every mutation, per INVARIANTS §Diagnostics
|
|
655
655
|
try {
|
|
656
656
|
return quill.validate(doc);
|
|
657
657
|
} catch (e) {
|
|
@@ -988,7 +988,7 @@
|
|
|
988
988
|
* row's cell as `main.vectors[0].tours[2].title`. The second rung reads the steps
|
|
989
989
|
* past the field against the schema, rung by rung — an index under a declared
|
|
990
990
|
* array, a key under a declared object, variant or matrix — which is why the ladder
|
|
991
|
-
* is the editor's (
|
|
991
|
+
* is the editor's (INVARIANTS §Surface): the preview carries no schema, and
|
|
992
992
|
* truncating the address there is worse than guessing, since `pos` is an offset
|
|
993
993
|
* into the leaf's own content.
|
|
994
994
|
*/
|
|
@@ -1054,7 +1054,7 @@
|
|
|
1054
1054
|
|
|
1055
1055
|
<!-- A fixed slot after `main`, ahead of the cards, so document-level guidance
|
|
1056
1056
|
reads as document-level and never displaces a field. Dismissal empties the
|
|
1057
|
-
channel, so the card leaves for good (
|
|
1057
|
+
channel, so the card leaves for good (INVARIANTS §"Card operations"). -->
|
|
1058
1058
|
{#if model.tips.length}
|
|
1059
1059
|
<TipsCard tips={model.tips} onDismiss={dismissTips} {onError} />
|
|
1060
1060
|
{/if}
|
|
@@ -1231,12 +1231,12 @@
|
|
|
1231
1231
|
|
|
1232
1232
|
`:global(:where(…))` puts a promised class at zero rank, and both halves are
|
|
1233
1233
|
load-bearing: `:global` drops the scoping class, `:where` drops the rest
|
|
1234
|
-
(
|
|
1234
|
+
(INVARIANTS §Styling). The class is the surface's root wherever it mounts, so
|
|
1235
1235
|
leaving the component's scope costs nothing.
|
|
1236
1236
|
|
|
1237
1237
|
The sunken rung, which is what makes a card an island: the cards are the base
|
|
1238
1238
|
plane and this is the one they float on, so the gutter reads as ground rather
|
|
1239
|
-
than as more card (
|
|
1239
|
+
than as more card (INVARIANTS §Styling). The inset is the widest rung on the
|
|
1240
1240
|
ramp, which is what gives the ground enough of itself to read as ground: at a
|
|
1241
1241
|
narrower one the stack meets whatever frames the surface and the islands are
|
|
1242
1242
|
back to being one block clipped at its edges. That is the page form; a pane's
|
package/dist/visual/controls.css
CHANGED
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
color: var(--_qm-ink);
|
|
91
91
|
caret-color: currentColor;
|
|
92
92
|
}
|
|
93
|
-
/* The box is the well rung with a hairline inside it (
|
|
93
|
+
/* The box is the well rung with a hairline inside it (INVARIANTS §Styling): a
|
|
94
94
|
field is a hole cut into the card, and the edge is what finds it at a glance, the
|
|
95
95
|
fill alone standing too close to the card to. Inset, so the edge costs no layout
|
|
96
96
|
and a focus ring draws outside it. */
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
|
|
357
357
|
A floating surface is the one place a hairline is still load-bearing: it hangs
|
|
358
358
|
over content the surface did not choose, so there is no plane under it for a
|
|
359
|
-
tone to step off (
|
|
359
|
+
tone to step off (INVARIANTS §Styling). The edge and `--_qm-lift` carry it
|
|
360
360
|
there, and the raised rung joins them in dark, where a tone still has somewhere
|
|
361
361
|
to go.
|
|
362
362
|
|
|
@@ -16,7 +16,7 @@ export declare function fieldKeyToString(k: FieldKey): string;
|
|
|
16
16
|
* Resolve a positional `FieldKey` (an absolute document-array index, straight off
|
|
17
17
|
* `addrForFieldPath`) to the editor's stable-id keying using the live `cardIds`
|
|
18
18
|
* array: re-resolved fresh on every call (never cached), the same "resolve only
|
|
19
|
-
* at the point of use" discipline `cardIndexOf` applies to writes (
|
|
19
|
+
* at the point of use" discipline `cardIndexOf` applies to writes (INVARIANTS
|
|
20
20
|
* §"The address is the spine"). A key already id-keyed (`card` a string) or main
|
|
21
21
|
* (`card` undefined) passes through unchanged. `undefined` when the index is out
|
|
22
22
|
* of the current card array: the diagnostic is dropped rather than mis-routed.
|
|
@@ -31,7 +31,7 @@ export interface RoutedDiagnostic {
|
|
|
31
31
|
* Route a path-keyed producer's raw `Diagnostic[]` (validate / external) to the
|
|
32
32
|
* editor's stable-id keying: the one door producers #1/#3 take,
|
|
33
33
|
* `nearestAddrForFieldPath` and `resolveCardKey` in a single pass. Warnings do not
|
|
34
|
-
* draw (
|
|
34
|
+
* draw (INVARIANTS §Diagnostics): obligation, completeness, a render note — none
|
|
35
35
|
* of them is a value the field cannot hold. An anchor deeper than a commit address
|
|
36
36
|
* (`main.contact.email`, `main.keywords[0]`) draws at the nearest field holding it,
|
|
37
37
|
* whose subform or repeater draws that leaf. An entry drops rather than mis-routes
|
|
@@ -7,7 +7,7 @@ export function fieldKeyToString(k) {
|
|
|
7
7
|
* Resolve a positional `FieldKey` (an absolute document-array index, straight off
|
|
8
8
|
* `addrForFieldPath`) to the editor's stable-id keying using the live `cardIds`
|
|
9
9
|
* array: re-resolved fresh on every call (never cached), the same "resolve only
|
|
10
|
-
* at the point of use" discipline `cardIndexOf` applies to writes (
|
|
10
|
+
* at the point of use" discipline `cardIndexOf` applies to writes (INVARIANTS
|
|
11
11
|
* §"The address is the spine"). A key already id-keyed (`card` a string) or main
|
|
12
12
|
* (`card` undefined) passes through unchanged. `undefined` when the index is out
|
|
13
13
|
* of the current card array: the diagnostic is dropped rather than mis-routed.
|
|
@@ -22,7 +22,7 @@ export function resolveCardKey(key, cardIds) {
|
|
|
22
22
|
* Route a path-keyed producer's raw `Diagnostic[]` (validate / external) to the
|
|
23
23
|
* editor's stable-id keying: the one door producers #1/#3 take,
|
|
24
24
|
* `nearestAddrForFieldPath` and `resolveCardKey` in a single pass. Warnings do not
|
|
25
|
-
* draw (
|
|
25
|
+
* draw (INVARIANTS §Diagnostics): obligation, completeness, a render note — none
|
|
26
26
|
* of them is a value the field cannot hold. An anchor deeper than a commit address
|
|
27
27
|
* (`main.contact.email`, `main.keywords[0]`) draws at the nearest field holding it,
|
|
28
28
|
* whose subform or repeater draws that leaf. An entry drops rather than mis-routes
|
package/dist/visual/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export type { CreateFieldOpts, FieldController } from '../core/codec/index.js';
|
|
|
5
5
|
export { DEFAULT_VISUAL_STRINGS } from './strings.js';
|
|
6
6
|
export type { VisualStrings, VisualStringsInput, FormatDiagnostic } from './strings.js';
|
|
7
7
|
export type { BodyPlaceholder, BodyPlaceholderContext } from './structure.js';
|
|
8
|
+
export { editorShortcuts } from '../core/codec/index.js';
|
|
9
|
+
export type { EditorShortcut, ShortcutScope } from '../core/codec/index.js';
|
|
8
10
|
export { patchEditorExt } from './ext.js';
|
|
9
11
|
export type { ActiveLeaf, CardId, CardOp, ChangeSource, EditorChange } from './signals.js';
|
package/dist/visual/index.js
CHANGED
|
@@ -22,6 +22,9 @@ export { createField } from '../core/codec/index.js';
|
|
|
22
22
|
// that English, exported so a consumer can compose against it rather than restate
|
|
23
23
|
// it. The empty body's per-card hook is the `bodyPlaceholder` key inside it.
|
|
24
24
|
export { DEFAULT_VISUAL_STRINGS } from './strings.js';
|
|
25
|
+
// The prose leaf's shortcuts, for a host's shortcut list: read off the keymaps' own tables and
|
|
26
|
+
// worded by the same `strings` (pass the editor's, or none for the package's English).
|
|
27
|
+
export { editorShortcuts } from '../core/codec/index.js';
|
|
25
28
|
// The `$ext.editor` write unit. A consumer seeding editor-side chrome
|
|
26
29
|
// state (a card title, the tips channel) goes through this rather than `storeExt`,
|
|
27
30
|
// which replaces the whole map and takes every sibling with it.
|
package/dist/visual/leaves.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The leaf registry: what a landing verb resolves a `DocPath` to, and the seam the
|
|
2
|
-
// mounted tree registers itself into (
|
|
2
|
+
// mounted tree registers itself into (INVARIANTS §"Focus and the preview bridge").
|
|
3
3
|
//
|
|
4
4
|
// Two lanes behind one lookup. Every mounted field registers a {@link FieldControl} —
|
|
5
5
|
// take the caret, and a box to bloom — which is the whole of what a reveal and a
|
package/dist/visual/props.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface VisualEditorProps {
|
|
|
61
61
|
onError?: EditorErrorHandler;
|
|
62
62
|
/**
|
|
63
63
|
* External diagnostics, routed by `.path` and merged with `quill.validate`
|
|
64
|
-
* and local commit errors (
|
|
64
|
+
* and local commit errors (INVARIANTS §Diagnostics). Warnings do not draw.
|
|
65
65
|
*/
|
|
66
66
|
diagnostics?: Diagnostic[];
|
|
67
67
|
/**
|
|
@@ -78,7 +78,7 @@ export interface VisualEditorProps {
|
|
|
78
78
|
* it in place, `'hide'` leaves it out of the list. One policy for the surface, not
|
|
79
79
|
* a per-option verdict, and the selected value is drawn under either (disabled
|
|
80
80
|
* when refused), so the control always shows what the document says
|
|
81
|
-
* (
|
|
81
|
+
* (INVARIANTS §Enums).
|
|
82
82
|
*/
|
|
83
83
|
enumDisallowed?: 'hide' | 'disable';
|
|
84
84
|
/**
|
package/dist/visual/strings.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Diagnostic } from '@quillmark/wasm';
|
|
2
|
-
import { type SlashStrings, type TableChromeStrings } from '../core/codec/index.js';
|
|
2
|
+
import { type ShortcutStrings, type SlashStrings, type TableChromeStrings } from '../core/codec/index.js';
|
|
3
3
|
import type { BodyPlaceholder } from './structure.js';
|
|
4
4
|
/**
|
|
5
|
-
* The island and the
|
|
6
|
-
* (a NodeView inside the leaf,
|
|
5
|
+
* The island, the insert menu and the shortcut list's keys come from the codec, which owns
|
|
6
|
+
* all three models (a NodeView inside the leaf, the trigger the leaf's keymap drives, and
|
|
7
|
+
* the keymaps' own tables). Extending
|
|
7
8
|
* rather than restating them is what keeps one English list: a consumer overrides an
|
|
8
9
|
* island handle's name beside the card controls' and the codec still has a default
|
|
9
10
|
* for a leaf mounted directly.
|
|
10
11
|
*/
|
|
11
|
-
export interface VisualStrings extends TableChromeStrings, SlashStrings {
|
|
12
|
+
export interface VisualStrings extends TableChromeStrings, SlashStrings, ShortcutStrings {
|
|
12
13
|
cardMoveUp: string;
|
|
13
14
|
cardMoveDown: string;
|
|
14
15
|
cardDelete: string;
|
|
@@ -143,7 +144,7 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings {
|
|
|
143
144
|
*
|
|
144
145
|
* A formatter reads the whole `Diagnostic`, including `args`: the facts `message`
|
|
145
146
|
* interpolates, keyed by name. What it can re-word tracks what that type carries per
|
|
146
|
-
* lane (
|
|
147
|
+
* lane (INVARIANTS §Diagnostics for why each lands where it does):
|
|
147
148
|
*
|
|
148
149
|
* - **`validation::enum_violation`, `type_mismatch`, `format_violation`**: the
|
|
149
150
|
* constraint re-words from the quill's schema at `path`, the offending value from
|
package/dist/visual/strings.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// would put a `strings` prop on every component between the root and each leaf,
|
|
19
19
|
// which is a prop that means nothing to any of them.
|
|
20
20
|
import { getContext, setContext } from 'svelte';
|
|
21
|
-
import { DEFAULT_SLASH_STRINGS, DEFAULT_TABLE_STRINGS } from '../core/codec/index.js';
|
|
21
|
+
import { DEFAULT_SHORTCUT_STRINGS, DEFAULT_SLASH_STRINGS, DEFAULT_TABLE_STRINGS } from '../core/codec/index.js';
|
|
22
22
|
/**
|
|
23
23
|
* A `Mod` chord as the writer's platform prints it: `⌘B` on Apple's, `Ctrl+B`
|
|
24
24
|
* elsewhere, and `Shift-7` as `⇧⌘7` or `Ctrl+Shift+7`. The platform test is the one
|
|
@@ -35,6 +35,7 @@ export function chord(key, platform = typeof navigator === 'undefined' ? '' : na
|
|
|
35
35
|
export const DEFAULT_VISUAL_STRINGS = {
|
|
36
36
|
...DEFAULT_TABLE_STRINGS,
|
|
37
37
|
...DEFAULT_SLASH_STRINGS,
|
|
38
|
+
...DEFAULT_SHORTCUT_STRINGS,
|
|
38
39
|
cardMoveUp: 'Move up',
|
|
39
40
|
cardMoveDown: 'Move down',
|
|
40
41
|
cardDelete: 'Delete card',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Content, type PathStep, type PayloadItem, type QuillCardSchema, type QuillFieldSchema, type QuillFieldType, type ResolvedField, type Resolved } from '@quillmark/wasm';
|
|
2
2
|
import type { TextCap } from '../core/codec/index.js';
|
|
3
|
-
/** The control a field type maps to (
|
|
3
|
+
/** The control a field type maps to (INVARIANTS §"Structure mirrors the schema"). */
|
|
4
4
|
export type ControlKind = 'prose' | 'text' | 'enum' | 'variant' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'matrix';
|
|
5
5
|
/** The container controls: the ones a nested address walks into and a deep
|
|
6
6
|
* diagnostic routes through. */
|
|
@@ -132,7 +132,8 @@ export type BodyPlaceholder = (ctx: BodyPlaceholderContext) => string | undefine
|
|
|
132
132
|
*/
|
|
133
133
|
export declare function resolveBodyGhost(resolvedDefault: string | undefined, custom: string | undefined, builtIn: string): string;
|
|
134
134
|
/** Whether a cell is optional: a `t?` type, which renders `none` unanswered and so
|
|
135
|
-
* never declares a `default:` (
|
|
135
|
+
* never declares a `default:` (quillmark `docs/quills/quill-yaml-reference.md`
|
|
136
|
+
* §"Optional fields"). */
|
|
136
137
|
export declare function optionalCell(f: QuillFieldSchema): boolean;
|
|
137
138
|
/**
|
|
138
139
|
* The declared type with an optional cell's `?` stripped; the `?` moves the render floor and
|
|
@@ -173,7 +174,7 @@ export declare function controlKind(f: QuillFieldSchema): ControlKind;
|
|
|
173
174
|
export declare const VARIANT_DISCRIMINANT: "value";
|
|
174
175
|
/** The label key of an open matrix's added item, the one cell a roster member never
|
|
175
176
|
* stores. The boundary exports no constant for it, so the package spells it once
|
|
176
|
-
* (
|
|
177
|
+
* (quillmark `docs/quills/quill-yaml-reference.md` §Matrix). */
|
|
177
178
|
export declare const MATRIX_TITLE = "title";
|
|
178
179
|
/** One item of a matrix: its id and its title. */
|
|
179
180
|
export interface MatrixMember {
|
|
@@ -244,7 +245,7 @@ export declare function matrixMemberSchema(matrix: QuillFieldSchema, id: string)
|
|
|
244
245
|
* under a `matrix` and a key under that member, a cell of any world (or the
|
|
245
246
|
* discriminant) under a variant-bearing `enum`. The editor's copy of the boundary's
|
|
246
247
|
* `schema_at`, held here because the landing lane checks an address against the schema
|
|
247
|
-
* before it asks the mounted tree for it (
|
|
248
|
+
* before it asks the mounted tree for it (INVARIANTS §Surface).
|
|
248
249
|
*/
|
|
249
250
|
export declare function schemaAt(field: QuillFieldSchema, steps: readonly PathStep[]): QuillFieldSchema | undefined;
|
|
250
251
|
/**
|
|
@@ -258,7 +259,7 @@ export type ArrayLayout = 'list' | 'table';
|
|
|
258
259
|
* and every cell of the row is short (a block prose cell declines it, at load width and
|
|
259
260
|
* every width after), else `'list'`. That every column is a leaf is the loader's
|
|
260
261
|
* contract (`quill::table_column_not_leaf`); whether a leaf fits a cell is the surface's
|
|
261
|
-
* answer (
|
|
262
|
+
* answer (quillmark `docs/quills/quill-yaml-reference.md` §layout): a table composes by position, so a row that would stack
|
|
262
263
|
* inside a cell is not one.
|
|
263
264
|
*/
|
|
264
265
|
export declare function arrayLayout(field: QuillFieldSchema): ArrayLayout;
|
|
@@ -274,8 +275,8 @@ export declare function variantCells(schema: QuillFieldSchema, member: string |
|
|
|
274
275
|
/**
|
|
275
276
|
* The container a discriminant pick commits, and the discriminant cell alone the unset
|
|
276
277
|
* sentinel clears: sibling cells are **kept** either way, since the boundary carries an
|
|
277
|
-
* answer its world does not select rather than dropping it (
|
|
278
|
-
*
|
|
278
|
+
* answer its world does not select rather than dropping it (INVARIANTS
|
|
279
|
+
* §Enums). A container left holding nothing is an unset field, which commits
|
|
279
280
|
* `undefined`.
|
|
280
281
|
*/
|
|
281
282
|
export declare function commitDiscriminant(value: Record<string, unknown> | undefined, member: string | undefined): Record<string, unknown> | undefined;
|
|
@@ -287,7 +288,7 @@ export declare function fieldTitle(key: string, schema: QuillFieldSchema): strin
|
|
|
287
288
|
* card-level object's `properties` project the same way. */
|
|
288
289
|
export declare function fieldModels(cardSchema: Pick<QuillCardSchema, 'fields'>): FieldModel[];
|
|
289
290
|
/**
|
|
290
|
-
* Group-section order (
|
|
291
|
+
* Group-section order (INVARIANTS §"Structure mirrors the schema"): the `ui.groups` key order,
|
|
291
292
|
* else first appearance of each field's `ui.group`.
|
|
292
293
|
*/
|
|
293
294
|
export declare function groupOrder(cardSchema: QuillCardSchema): string[];
|
|
@@ -299,7 +300,7 @@ export declare function groupLabel(cardSchema: QuillCardSchema, group: string):
|
|
|
299
300
|
*/
|
|
300
301
|
export declare function groupSections(fields: FieldModel[], order: string[], labelFor: (group: string) => string): GroupSection[];
|
|
301
302
|
/**
|
|
302
|
-
* Object-panel sections (
|
|
303
|
+
* Object-panel sections (INVARIANTS §"Structure mirrors the schema"): every
|
|
303
304
|
* top-level `object` is a panel of its own, headed by the object, in declaration
|
|
304
305
|
* order; everything else stands in one unframed section above them. The section id
|
|
305
306
|
* is the field name, which a card's keys hold unique.
|
package/dist/visual/structure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The schema × payload join, as pure functions (
|
|
1
|
+
// The schema × payload join, as pure functions (INVARIANTS §"Structure mirrors the schema"). The reactive
|
|
2
2
|
// orchestration lives in VisualEditor.svelte.
|
|
3
3
|
import { VARIANT_DISCRIMINANT_KEY } from '@quillmark/wasm';
|
|
4
4
|
import { core } from '../core/lifecycle.js';
|
|
@@ -57,7 +57,8 @@ export function resolveBodyGhost(resolvedDefault, custom, builtIn) {
|
|
|
57
57
|
return resolvedDefault || custom || builtIn;
|
|
58
58
|
}
|
|
59
59
|
/** Whether a cell is optional: a `t?` type, which renders `none` unanswered and so
|
|
60
|
-
* never declares a `default:` (
|
|
60
|
+
* never declares a `default:` (quillmark `docs/quills/quill-yaml-reference.md`
|
|
61
|
+
* §"Optional fields"). */
|
|
61
62
|
export function optionalCell(f) {
|
|
62
63
|
return f.type.endsWith('?');
|
|
63
64
|
}
|
|
@@ -130,8 +131,8 @@ export function controlKind(f) {
|
|
|
130
131
|
case 'text':
|
|
131
132
|
return 'prose';
|
|
132
133
|
case 'enum':
|
|
133
|
-
// `variants:` is the one key that changes a field's resting shape (
|
|
134
|
-
// `
|
|
134
|
+
// `variants:` is the one key that changes a field's resting shape (quillmark
|
|
135
|
+
// `docs/quills/quill-yaml-reference.md` §Variants): with it the field rests as a container, without it a bare string.
|
|
135
136
|
return f.variants ? 'variant' : 'enum';
|
|
136
137
|
case 'number':
|
|
137
138
|
case 'integer':
|
|
@@ -157,7 +158,7 @@ export function controlKind(f) {
|
|
|
157
158
|
export const VARIANT_DISCRIMINANT = VARIANT_DISCRIMINANT_KEY;
|
|
158
159
|
/** The label key of an open matrix's added item, the one cell a roster member never
|
|
159
160
|
* stores. The boundary exports no constant for it, so the package spells it once
|
|
160
|
-
* (
|
|
161
|
+
* (quillmark `docs/quills/quill-yaml-reference.md` §Matrix). */
|
|
161
162
|
export const MATRIX_TITLE = 'title';
|
|
162
163
|
/** The roster's members, in declaration order. Own keys only: a schema map is indexed
|
|
163
164
|
* by a document-supplied id, and `'toString' in members` is true of every roster. */
|
|
@@ -317,7 +318,7 @@ export function matrixMemberSchema(matrix, id) {
|
|
|
317
318
|
* under a `matrix` and a key under that member, a cell of any world (or the
|
|
318
319
|
* discriminant) under a variant-bearing `enum`. The editor's copy of the boundary's
|
|
319
320
|
* `schema_at`, held here because the landing lane checks an address against the schema
|
|
320
|
-
* before it asks the mounted tree for it (
|
|
321
|
+
* before it asks the mounted tree for it (INVARIANTS §Surface).
|
|
321
322
|
*/
|
|
322
323
|
export function schemaAt(field, steps) {
|
|
323
324
|
let cursor = field;
|
|
@@ -388,7 +389,7 @@ function firstShortText(cells, values) {
|
|
|
388
389
|
* and every cell of the row is short (a block prose cell declines it, at load width and
|
|
389
390
|
* every width after), else `'list'`. That every column is a leaf is the loader's
|
|
390
391
|
* contract (`quill::table_column_not_leaf`); whether a leaf fits a cell is the surface's
|
|
391
|
-
* answer (
|
|
392
|
+
* answer (quillmark `docs/quills/quill-yaml-reference.md` §layout): a table composes by position, so a row that would stack
|
|
392
393
|
* inside a cell is not one.
|
|
393
394
|
*/
|
|
394
395
|
export function arrayLayout(field) {
|
|
@@ -417,8 +418,8 @@ export function variantCells(schema, member) {
|
|
|
417
418
|
/**
|
|
418
419
|
* The container a discriminant pick commits, and the discriminant cell alone the unset
|
|
419
420
|
* sentinel clears: sibling cells are **kept** either way, since the boundary carries an
|
|
420
|
-
* answer its world does not select rather than dropping it (
|
|
421
|
-
*
|
|
421
|
+
* answer its world does not select rather than dropping it (INVARIANTS
|
|
422
|
+
* §Enums). A container left holding nothing is an unset field, which commits
|
|
422
423
|
* `undefined`.
|
|
423
424
|
*/
|
|
424
425
|
export function commitDiscriminant(value, member) {
|
|
@@ -464,7 +465,7 @@ export function fieldModels(cardSchema) {
|
|
|
464
465
|
});
|
|
465
466
|
}
|
|
466
467
|
/**
|
|
467
|
-
* Group-section order (
|
|
468
|
+
* Group-section order (INVARIANTS §"Structure mirrors the schema"): the `ui.groups` key order,
|
|
468
469
|
* else first appearance of each field's `ui.group`.
|
|
469
470
|
*/
|
|
470
471
|
export function groupOrder(cardSchema) {
|
|
@@ -511,7 +512,7 @@ export function groupSections(fields, order, labelFor) {
|
|
|
511
512
|
return sections;
|
|
512
513
|
}
|
|
513
514
|
/**
|
|
514
|
-
* Object-panel sections (
|
|
515
|
+
* Object-panel sections (INVARIANTS §"Structure mirrors the schema"): every
|
|
515
516
|
* top-level `object` is a panel of its own, headed by the object, in declaration
|
|
516
517
|
* order; everything else stands in one unframed section above them. The section id
|
|
517
518
|
* is the field name, which a card's keys hold unique.
|
|
@@ -656,7 +657,7 @@ export function cardTitle(cardSchema, kind, values, extTitle) {
|
|
|
656
657
|
export function bodyEnabled(cardSchema) {
|
|
657
658
|
return cardSchema?.body?.enabled !== false;
|
|
658
659
|
}
|
|
659
|
-
// ── Session identity (
|
|
660
|
+
// ── Session identity (INVARIANTS §"The address is the spine") ─────────────
|
|
660
661
|
// Cards are positional in the content and `doc.cards` re-allocates on each read,
|
|
661
662
|
// so a stable card-instance key cannot be the card object (a fresh object every
|
|
662
663
|
// derive): it is a session id held in a parallel array, reordered in lockstep
|
package/dist/visual/tips.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The tips channel: `$ext.editor.tips`, a list of authoring hints a
|
|
2
2
|
// quill or consumer seeds, which the editor only ever renders and clears.
|
|
3
3
|
// Editor-only chrome; never reaches the render backend, never gates, absent when
|
|
4
|
-
// the channel is empty (
|
|
4
|
+
// the channel is empty (INVARIANTS §"Card operations").
|
|
5
5
|
//
|
|
6
6
|
// The channel narrowing the derive reads and the render the card paints. The write
|
|
7
7
|
// is `patchEditorExt` (ext.ts), the one door into the namespace.
|