@quillmark/svelte 0.11.0 → 0.13.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/dist/core/address.d.ts +17 -10
- package/dist/core/address.js +26 -12
- package/dist/core/bloom.js +4 -3
- package/dist/core/codec/decode.d.ts +17 -0
- package/dist/core/codec/decode.js +78 -19
- package/dist/core/codec/encode.js +1 -1
- package/dist/core/codec/field.d.ts +64 -15
- package/dist/core/codec/field.js +201 -65
- package/dist/core/codec/index.d.ts +3 -3
- package/dist/core/codec/index.js +3 -3
- package/dist/core/codec/islands.d.ts +5 -4
- package/dist/core/codec/islands.js +23 -38
- package/dist/core/codec/keymap.d.ts +5 -4
- package/dist/core/codec/keymap.js +5 -4
- package/dist/core/codec/prose.css +42 -0
- package/dist/core/codec/schema.d.ts +24 -5
- package/dist/core/codec/schema.js +40 -9
- package/dist/core/codec/slash.js +0 -0
- package/dist/core/errors.d.ts +3 -2
- package/dist/core/rungs.d.ts +8 -0
- package/dist/core/rungs.js +24 -0
- package/dist/core/theme.css +19 -6
- package/dist/preview/paint.js +21 -17
- package/dist/visual/ArrayField.svelte +649 -176
- package/dist/visual/ArrayField.svelte.d.ts +16 -1
- package/dist/visual/BooleanField.svelte +36 -11
- package/dist/visual/BooleanField.svelte.d.ts +2 -0
- package/dist/visual/Card.svelte +6 -25
- package/dist/visual/DateField.svelte +66 -31
- package/dist/visual/EnumField.svelte +27 -9
- package/dist/visual/EnumField.svelte.d.ts +5 -0
- package/dist/visual/Field.svelte +113 -38
- package/dist/visual/FormatPopover.svelte +4 -3
- package/dist/visual/MatrixField.svelte +353 -0
- package/dist/visual/MatrixField.svelte.d.ts +36 -0
- package/dist/visual/NumberField.svelte +31 -14
- package/dist/visual/NumberField.svelte.d.ts +5 -1
- package/dist/visual/ObjectField.svelte +404 -139
- package/dist/visual/ObjectField.svelte.d.ts +17 -2
- package/dist/visual/ProseField.svelte +53 -23
- package/dist/visual/ProseField.svelte.d.ts +15 -3
- package/dist/visual/ProseValue.svelte +102 -46
- package/dist/visual/ProseValue.svelte.d.ts +17 -5
- package/dist/visual/TextField.svelte +35 -18
- package/dist/visual/TextField.svelte.d.ts +7 -0
- package/dist/visual/VariantField.svelte +56 -2
- package/dist/visual/VariantField.svelte.d.ts +10 -1
- package/dist/visual/VisualEditorInner.svelte +77 -73
- package/dist/visual/controls.css +47 -5
- package/dist/visual/diagnostics.d.ts +26 -2
- package/dist/visual/diagnostics.js +52 -5
- package/dist/visual/hold.js +2 -2
- package/dist/visual/icons/nodes.d.ts +3 -0
- package/dist/visual/icons/nodes.js +2 -1
- package/dist/visual/leaves.d.ts +25 -12
- package/dist/visual/motion.d.ts +14 -5
- package/dist/visual/motion.js +13 -11
- package/dist/visual/strings.d.ts +27 -10
- package/dist/visual/strings.js +8 -2
- package/dist/visual/structure.d.ts +159 -40
- package/dist/visual/structure.js +337 -45
- package/package.json +2 -2
package/dist/visual/leaves.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import type { PathStep } from '@quillmark/wasm';
|
|
1
2
|
import type { FieldController } from '../core/codec/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a landing at depth hands back: the box the arrival wash blooms in, now or once
|
|
5
|
+
* the row it had to open has rendered. A row two closed boxes down does not exist
|
|
6
|
+
* until the row above it opens and flushes, so the innermost box is a promise wherever
|
|
7
|
+
* the walk had to open something on the way.
|
|
8
|
+
*/
|
|
9
|
+
export type LandingBox = HTMLElement | undefined | Promise<HTMLElement | undefined>;
|
|
2
10
|
/**
|
|
3
11
|
* A mounted field's landing handle: focus it, and the element the arrival wash blooms
|
|
4
12
|
* inside ({@link import('../core/bloom.js').bloomInside}).
|
|
@@ -10,22 +18,27 @@ import type { FieldController } from '../core/codec/index.js';
|
|
|
10
18
|
export interface FieldControl {
|
|
11
19
|
focus(): void;
|
|
12
20
|
/**
|
|
13
|
-
* Land
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
21
|
+
* Land at `steps` inside a control that has an inside — an array's element, an
|
|
22
|
+
* object's property, a variant's cell, a matrix's member, and any of them under any
|
|
23
|
+
* other — at USV `pos` where the leaf the walk ends in can take one. Each rung
|
|
24
|
+
* resolves its own step at the call (an index to a session id, a key to a mounted
|
|
25
|
+
* cell) and hands the rest to the control it opened, so nothing positional is
|
|
26
|
+
* carried. A step the tree does not hold falls back to that rung's own
|
|
27
|
+
* {@link focus}: the field is right and the row is gone. Absent on every control
|
|
28
|
+
* with no inside.
|
|
17
29
|
*
|
|
18
30
|
* A landing, not a focus: an absent `pos` is the placement rung, exactly as on
|
|
19
|
-
* `Landing`, and what a `pos` means is the
|
|
20
|
-
*
|
|
21
|
-
*
|
|
31
|
+
* `Landing`, and what a `pos` means is the leaf's, the same way focusing is. The
|
|
32
|
+
* place rides the call because the registry stays parent-keyed: a per-element key is
|
|
33
|
+
* positional, in a registry whose doctrine is dodging positional churn.
|
|
22
34
|
*
|
|
23
|
-
* Returns the
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* reads as
|
|
35
|
+
* Returns the innermost row the address named, which is what the wash blooms in: a
|
|
36
|
+
* box wider than the one the click resolved says the field where the pick said the
|
|
37
|
+
* row. `undefined` is a landing that named no row — a property under a field-level
|
|
38
|
+
* subform, or the fallback an index past the live list took — and reads as
|
|
39
|
+
* {@link el}.
|
|
27
40
|
*/
|
|
28
|
-
|
|
41
|
+
focusPath?(steps: readonly PathStep[], pos?: number): LandingBox;
|
|
29
42
|
readonly el: HTMLElement;
|
|
30
43
|
}
|
|
31
44
|
/**
|
package/dist/visual/motion.d.ts
CHANGED
|
@@ -3,11 +3,20 @@ import type { AnimationConfig } from 'svelte/animate';
|
|
|
3
3
|
* position for its whole length, so anything that measures the node's box waits on
|
|
4
4
|
* these rather than reading the one a transform is holding. */
|
|
5
5
|
export declare function reorderTrips(node: HTMLElement): Animation[];
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The reorder gesture's arming window, for a keyed list that takes the trip. The
|
|
8
|
+
* reconcile that moves a slot is the trip, and every other reconcile that happens to
|
|
9
|
+
* move one is not; so the command arms the gesture and the frame it lands in disarms
|
|
10
|
+
* it, `animate:` asking at apply time, a microtask after the mutation and well inside
|
|
11
|
+
* that frame. `armed` is a getter rather than a value, so the flag stays out of the
|
|
12
|
+
* template and needs no reactivity for it. `cancel` is for the surface's teardown.
|
|
13
|
+
*/
|
|
14
|
+
export interface ReorderArm {
|
|
15
|
+
arm(): void;
|
|
16
|
+
armed(): boolean;
|
|
17
|
+
cancel(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function reorderArm(): ReorderArm;
|
|
11
20
|
/**
|
|
12
21
|
* Slide a keyed slot from where it was to where it now is.
|
|
13
22
|
*
|
package/dist/visual/motion.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// cannot see (the rects either side of the reconciliation) and WAAPI paints the trip,
|
|
5
5
|
// the same seam `core/bloom.ts` takes to keep a duration in the derivation while a
|
|
6
6
|
// script runs the animation.
|
|
7
|
+
import { rungMs, rungStyle } from '../core/rungs.js';
|
|
7
8
|
/** Marks this module's runs, so a second reorder cancels the first rather than layering
|
|
8
9
|
* a second transform over it. */
|
|
9
10
|
const RUN_ID = 'qm-reorder';
|
|
@@ -15,16 +16,17 @@ export function reorderTrips(node) {
|
|
|
15
16
|
return [];
|
|
16
17
|
return node.getAnimations().filter((run) => run.id === RUN_ID);
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
export function reorderArm() {
|
|
20
|
+
let reordering = false;
|
|
21
|
+
let frame = 0;
|
|
22
|
+
return {
|
|
23
|
+
arm() {
|
|
24
|
+
reordering = true;
|
|
25
|
+
frame = requestAnimationFrame(() => (reordering = false));
|
|
26
|
+
},
|
|
27
|
+
armed: () => reordering,
|
|
28
|
+
cancel: () => cancelAnimationFrame(frame)
|
|
29
|
+
};
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Slide a keyed slot from where it was to where it now is.
|
|
@@ -45,7 +47,7 @@ export function reorder(node, { from, to }, armed) {
|
|
|
45
47
|
// rung the derivation mints.
|
|
46
48
|
if (!armed() || typeof node.animate !== 'function')
|
|
47
49
|
return {};
|
|
48
|
-
const style =
|
|
50
|
+
const style = rungStyle(node);
|
|
49
51
|
const duration = rungMs(style, '--_qm-duration-slow');
|
|
50
52
|
const easing = style.getPropertyValue('--_qm-ease-reverse').trim();
|
|
51
53
|
if (duration === undefined || !easing)
|
package/dist/visual/strings.d.ts
CHANGED
|
@@ -21,24 +21,40 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings {
|
|
|
21
21
|
addCard: string;
|
|
22
22
|
arrayAdd: string;
|
|
23
23
|
arrayRemove: string;
|
|
24
|
-
/** The
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
/** The reorder pair on an `object` row, accessible names: the buttons are glyphs. */
|
|
25
|
+
arrayMoveUp: string;
|
|
26
|
+
arrayMoveDown: string;
|
|
27
|
+
/**
|
|
28
|
+
* A row control's accessible name, the action and the row it acts on: `Remove
|
|
29
|
+
* Authors 2`. The action alone stays the tooltip. Parametric, so word order stays
|
|
30
|
+
* the translator's.
|
|
31
|
+
*/
|
|
32
|
+
arrayRowAction: (action: string, row: string) => string;
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* orders the kind within it.
|
|
34
|
+
* The count beside the add chip on an array declaring `max:`, the carrier a
|
|
35
|
+
* disabled chip has no other way to state: `2 / 3`. Parametric, so a translator
|
|
36
|
+
* spells the separator.
|
|
32
37
|
*/
|
|
33
|
-
|
|
38
|
+
arrayCount: (count: number, max: number) => string;
|
|
34
39
|
/**
|
|
35
|
-
* A collapsed array element
|
|
40
|
+
* A collapsed array element with nothing to summarize itself by: the label and the
|
|
36
41
|
* 1-based index, which is what its accessible name already says. Parametric, so
|
|
37
42
|
* word order stays the translator's.
|
|
38
43
|
*/
|
|
39
44
|
elementUntitled: (label: string, index: number) => string;
|
|
45
|
+
/** The tag on the unset sentinel's row, which is what tells it from the member it
|
|
46
|
+
* ghosts ({@link EnumField}). */
|
|
47
|
+
enumUnsetTag: string;
|
|
48
|
+
/** The count in the matrix's label row: how many of the roster are held. */
|
|
49
|
+
matrixHeld: (held: number, total: number) => string;
|
|
40
50
|
/** The required marker's accessible name; the glyph itself is a `*`. */
|
|
41
51
|
fieldRequired: string;
|
|
52
|
+
/** What an unset optional cell (`t?`) ghosts at rest: the `none` it prints
|
|
53
|
+
* unanswered, in the product's words. */
|
|
54
|
+
optionalGhost: string;
|
|
55
|
+
/** Under a prose leaf holding more structure than it can edit (paragraphs, a list,
|
|
56
|
+
* an island in a one-line cell), which it draws read-only rather than flatten. */
|
|
57
|
+
proseHeld: string;
|
|
42
58
|
formatGroup: string;
|
|
43
59
|
formatBold: string;
|
|
44
60
|
formatEmphasis: string;
|
|
@@ -74,7 +90,8 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings {
|
|
|
74
90
|
bodyGhost: string;
|
|
75
91
|
/**
|
|
76
92
|
* Per-CARD wording, in place of {@link VisualStrings.bodyGhost}; `undefined`
|
|
77
|
-
* takes it.
|
|
93
|
+
* takes it. A body `default:` and the kind's `body.example` both outrank it
|
|
94
|
+
* (`resolveBodyGhost`). Pure and uncached ({@link BodyPlaceholder}).
|
|
78
95
|
*/
|
|
79
96
|
bodyPlaceholder: BodyPlaceholder;
|
|
80
97
|
}
|
package/dist/visual/strings.js
CHANGED
|
@@ -30,10 +30,16 @@ export const DEFAULT_VISUAL_STRINGS = {
|
|
|
30
30
|
addCard: '+ Add Card',
|
|
31
31
|
arrayAdd: '+ Add',
|
|
32
32
|
arrayRemove: 'Remove',
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
arrayMoveUp: 'Move up',
|
|
34
|
+
arrayMoveDown: 'Move down',
|
|
35
|
+
arrayRowAction: (action, row) => `${action} ${row}`,
|
|
36
|
+
arrayCount: (count, max) => `${count} / ${max}`,
|
|
35
37
|
elementUntitled: (label, index) => `${label} ${index}`,
|
|
38
|
+
enumUnsetTag: 'default',
|
|
39
|
+
matrixHeld: (held, total) => `${held} of ${total} held`,
|
|
36
40
|
fieldRequired: 'required',
|
|
41
|
+
optionalGhost: 'None',
|
|
42
|
+
proseHeld: 'Holds more than this field can edit here.',
|
|
37
43
|
formatGroup: 'Formatting',
|
|
38
44
|
formatBold: 'Bold (Mod-B)',
|
|
39
45
|
formatEmphasis: 'Emphasis (Mod-I)',
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Content, type PathStep, type PayloadItem, type QuillCardSchema, type QuillFieldSchema, type QuillFieldType, type ResolvedField, type Resolved } from '@quillmark/wasm';
|
|
2
2
|
/** The control a field type maps to (VISUAL_EDITOR §"Structure mirrors the schema"). */
|
|
3
|
-
export type ControlKind = 'prose' | 'text' | 'enum' | 'variant' | 'number' | 'boolean' | 'date' | 'array' | 'object';
|
|
3
|
+
export type ControlKind = 'prose' | 'text' | 'enum' | 'variant' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'matrix';
|
|
4
|
+
/** The container controls: the ones a nested address walks into and a deep
|
|
5
|
+
* diagnostic routes through. */
|
|
6
|
+
export declare function isContainer(kind: ControlKind): boolean;
|
|
4
7
|
/** One field, projected: its schema, the control it renders as, and its layout hints. */
|
|
5
8
|
export interface FieldModel {
|
|
6
9
|
name: string;
|
|
@@ -11,7 +14,7 @@ export interface FieldModel {
|
|
|
11
14
|
/** `ui.compact`: asks to share a row with adjacent compacts. A request, not a
|
|
12
15
|
* guarantee: `placeFields` declines it for the shapes that grow (see `packable`). */
|
|
13
16
|
compact: boolean;
|
|
14
|
-
/** Display label: `
|
|
17
|
+
/** Display label: `title` when set, else the humanized field name. */
|
|
15
18
|
label: string;
|
|
16
19
|
/** Schema `description`: authoring help rendered beside the label,
|
|
17
20
|
* undefined when the field declares none. Chrome-only; never gates. */
|
|
@@ -53,7 +56,8 @@ export interface CardModel {
|
|
|
53
56
|
unschemable: boolean;
|
|
54
57
|
/** Raw `$ext.editor.title` override (composable cards). */
|
|
55
58
|
titleOverride: string;
|
|
56
|
-
/**
|
|
59
|
+
/** The header an unrenamed card shows ({@link cardTitle} below its rename rung),
|
|
60
|
+
* which the rename input ghosts (composable cards). */
|
|
57
61
|
titlePlaceholder: string;
|
|
58
62
|
/** Field name → current stored value (absent fields missing). */
|
|
59
63
|
values: Record<string, unknown>;
|
|
@@ -67,12 +71,11 @@ export interface CardModel {
|
|
|
67
71
|
sections: GroupSection[];
|
|
68
72
|
hasBody: boolean;
|
|
69
73
|
/**
|
|
70
|
-
* The empty-body ghost, or undefined when the card renders no body. Never
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* the resolved default, and an invented one would read as a value.
|
|
74
|
+
* The empty-body ghost, or undefined when the card renders no body. Never empty
|
|
75
|
+
* for a card that does ({@link resolveBodyGhost}), so a body leaf always has
|
|
76
|
+
* something in it to write into, which a field at rest deliberately does not: it
|
|
77
|
+
* draws what prints or what its quill declares, and an invented ghost would read as
|
|
78
|
+
* a value.
|
|
76
79
|
*/
|
|
77
80
|
bodyGhost?: string;
|
|
78
81
|
}
|
|
@@ -101,15 +104,14 @@ export declare const NO_RESOLVED_ROWS: ResolvedCardRows;
|
|
|
101
104
|
* form).
|
|
102
105
|
*/
|
|
103
106
|
export declare function resolvedByCardIndex(resolved: Resolved | undefined): Map<number, ResolvedCardRows>;
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
+
/** What an unset field shows of its `default:`: the resolved value the render would
|
|
108
|
+
* use (`source === 'default'`), else undefined: an `authored` field shows its value,
|
|
109
|
+
* a `blank` field has no default to show. */
|
|
107
110
|
export declare function ghostDefault(row: ResolvedField | undefined): unknown;
|
|
108
111
|
/** A ghost value's string form, or undefined for null/object (only text ghosts
|
|
109
|
-
* render a placeholder).
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* thing to display as a placeholder (FIELD_PROVENANCE). */
|
|
112
|
+
* render a placeholder). A scalar's resolved default reads through it; a content
|
|
113
|
+
* field's resolves as `Content`, which a prose leaf reads by its text instead
|
|
114
|
+
* ({@link titleText}). */
|
|
113
115
|
export declare function stringifyGhost(ghost: unknown): string | undefined;
|
|
114
116
|
/** What a {@link BodyPlaceholder} is told about the body it words. The card's
|
|
115
117
|
* identity, not its chrome: `cardId` is what per-card wording keys off, `kind` keys
|
|
@@ -136,21 +138,137 @@ export interface BodyPlaceholderContext {
|
|
|
136
138
|
*/
|
|
137
139
|
export type BodyPlaceholder = (ctx: BodyPlaceholderContext) => string | undefined;
|
|
138
140
|
/**
|
|
139
|
-
* The empty body's ghost: the resolved body `default:`, else the
|
|
140
|
-
* wording, else the flat built-in. The
|
|
141
|
-
*
|
|
142
|
-
* written, and wording placed over it would make that
|
|
143
|
-
*
|
|
144
|
-
* promise
|
|
141
|
+
* The empty body's ghost: the resolved body `default:`, else the kind's
|
|
142
|
+
* `body.example`, else the consumer's wording, else the flat built-in. The
|
|
143
|
+
* `default:` wins because it is the only one that describes the render: it promises
|
|
144
|
+
* what prints if nothing is written, and wording placed over it would make that
|
|
145
|
+
* promise unreadable. The rest are invitations, and an invitation belongs only where
|
|
146
|
+
* there is no promise; the quill's own comes first, being the one an agent working
|
|
147
|
+
* from the blueprint sees too.
|
|
145
148
|
*/
|
|
146
|
-
export declare function resolveBodyGhost(resolvedDefault: string | undefined, custom: string | undefined, builtIn: string): string;
|
|
149
|
+
export declare function resolveBodyGhost(resolvedDefault: string | undefined, example: string | undefined, custom: string | undefined, builtIn: string): string;
|
|
150
|
+
/** Whether a cell is optional: a `t?` type, which renders `none` unanswered and so
|
|
151
|
+
* never declares a `default:` (canon `SCHEMAS.md` §"Optional cells"). */
|
|
152
|
+
export declare function optionalCell(f: QuillFieldSchema): boolean;
|
|
153
|
+
/** The type a cell's control reads: the declared one, an optional cell's `?` stripped.
|
|
154
|
+
* The `?` moves the render floor and nothing else, so every read of a type is this. */
|
|
155
|
+
export declare function baseType(f: QuillFieldSchema): QuillFieldType;
|
|
156
|
+
/**
|
|
157
|
+
* A value the schema declares, as ghost text: a `default:`, an `example:` or a
|
|
158
|
+
* `body.example`. Markdown — a `richtext` value — ghosts as the text it renders, one
|
|
159
|
+
* block to a line, as a resolved default does ({@link titleText}); anything else as
|
|
160
|
+
* itself. `undefined` for a blank or a non-scalar.
|
|
161
|
+
*/
|
|
162
|
+
export declare function declaredGhost(v: unknown, markdown: boolean): string | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* A scalar `default:` as the text an unset control holds, where it prints: as
|
|
165
|
+
* declared, `undefined` for none, a blank or a non-scalar. A default of spaces prints
|
|
166
|
+
* nothing a reader sees, so a control holds none and draws its example instead.
|
|
167
|
+
*/
|
|
168
|
+
export declare function printedText(v: unknown): string | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* A declared content literal as the `Content` it holds: a `richtext` one's markdown
|
|
171
|
+
* imported, a `plaintext` one's text taken literally, one paragraph whose later lines
|
|
172
|
+
* continue it, as the literal codec reads a stored one. What a cell's static
|
|
173
|
+
* `default:` stands in its leaf as, where no resolved row reaches it. `undefined` for
|
|
174
|
+
* a blank or a non-scalar.
|
|
175
|
+
*/
|
|
176
|
+
export declare function declaredContent(v: unknown, markdown: boolean): Content | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* The `example:` an unset free-text cell ghosts: a `string`, `plaintext` or `richtext`
|
|
179
|
+
* whose `default:` prints nothing. Every other type takes none. A default that prints
|
|
180
|
+
* dominates, standing in the control as the value it is; a type-empty one, the
|
|
181
|
+
* skippable marker, prints nothing and leaves the example the only thing to draw.
|
|
182
|
+
*/
|
|
183
|
+
export declare function exampleGhost(f: QuillFieldSchema): string | undefined;
|
|
184
|
+
/** A field's `{#each}` key: its name and what a mounted leaf reads once, its type and
|
|
185
|
+
* `inline` and its elements'. A retype or a quill swap that changes any of them under a
|
|
186
|
+
* name remounts the field, where a kept leaf would commit on the old schema. */
|
|
187
|
+
export declare function mountKey(name: string, f: QuillFieldSchema): string;
|
|
147
188
|
/** Map a field schema to its control (precedence: prose › enum › text › …).
|
|
148
189
|
* An array's element control is this over `items`: a missing `items` is a text
|
|
149
190
|
* element. */
|
|
150
191
|
export declare function controlKind(f: QuillFieldSchema): ControlKind;
|
|
151
|
-
/** The discriminant cell of a variant container
|
|
152
|
-
*
|
|
153
|
-
|
|
192
|
+
/** The discriminant cell of a variant container, off the boundary's own constant: it
|
|
193
|
+
* crosses inside untyped container data with no type to read it off, so a literal here
|
|
194
|
+
* would be a second spelling of a reserved key. No variant may declare it. */
|
|
195
|
+
export declare const VARIANT_DISCRIMINANT: "value";
|
|
196
|
+
/** The tick cell of a matrix member, the second reserved key beside the discriminant.
|
|
197
|
+
* The boundary synthesizes it on every member and exports no constant for it, so this
|
|
198
|
+
* is where the package spells it once (canon `SCHEMAS.md` §Matrix). */
|
|
199
|
+
export declare const MATRIX_HELD = "held";
|
|
200
|
+
/** One member of the roster: its id and its title. */
|
|
201
|
+
export interface MatrixMember {
|
|
202
|
+
id: string;
|
|
203
|
+
title: string;
|
|
204
|
+
}
|
|
205
|
+
/** The roster's members, in declaration order. Own keys only: a schema map is indexed
|
|
206
|
+
* by a document-supplied id, and `'toString' in members` is true of every roster. */
|
|
207
|
+
export declare function matrixMembers(roster: Record<string, string> | undefined): MatrixMember[];
|
|
208
|
+
/** A member's stored payload, off the sparse map by own key: a document key can be
|
|
209
|
+
* spelled `constructor`. */
|
|
210
|
+
export declare function memberValue(map: Record<string, unknown> | undefined, id: string): unknown;
|
|
211
|
+
/**
|
|
212
|
+
* Whether a stored member is held. A bare scalar is the tick and a mapping is the member
|
|
213
|
+
* object, whose `held` cell resolves as every absent cell does, to its `default:` of
|
|
214
|
+
* `false` (canon `SCHEMAS.md` §Matrix): an absent key is unheld, a bare `true` is held,
|
|
215
|
+
* and a member object is held only where its `held` cell says so. The spellings the
|
|
216
|
+
* engine coerces to false — `false`, `0`, `"false"`, `null` — read false here; every other
|
|
217
|
+
* present scalar reads held, so a document the engine would refuse still draws the tick
|
|
218
|
+
* its spelling claims.
|
|
219
|
+
*/
|
|
220
|
+
export declare function matrixHeld(stored: unknown): boolean;
|
|
221
|
+
/** A member's columns: the member object with its `held` cell taken out, `{}` for the
|
|
222
|
+
* bare and absent spellings. What the columns subform takes as its value. */
|
|
223
|
+
export declare function matrixColumns(stored: unknown): Record<string, unknown>;
|
|
224
|
+
/**
|
|
225
|
+
* The map after one member moves: `next` written under `id`, or the key dropped where
|
|
226
|
+
* `next` is `undefined`; a map left holding nothing is an unset field. Every other
|
|
227
|
+
* member rides through in the spelling the document had, so a stored `cyber_200: true`
|
|
228
|
+
* stays `true` while its neighbour is edited.
|
|
229
|
+
*/
|
|
230
|
+
export declare function commitMember(map: Record<string, unknown> | undefined, id: string, next: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* The member a tick or an edit writes. Held with columns is the member object with an
|
|
233
|
+
* explicit `held: true`; unheld keeps the columns under `held: false`, so tick, type,
|
|
234
|
+
* untick, retick loses nothing; unheld with no columns is `undefined`, the key dropped.
|
|
235
|
+
* Which columns are blank is the engine's rule and not restated here: a column control
|
|
236
|
+
* that clears drops its key (`ObjectField`), so a member emptied by hand arrives with no
|
|
237
|
+
* columns and only then leaves the map.
|
|
238
|
+
*/
|
|
239
|
+
export declare function memberWrite(held: boolean, columns: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
240
|
+
/** The `object` a matrix member desugars to, for the schema walk: `held` beside the
|
|
241
|
+
* declared columns. Composed here because the boundary serializes the roster alone. */
|
|
242
|
+
export declare function matrixMemberSchema(matrix: QuillFieldSchema): QuillFieldSchema;
|
|
243
|
+
/** Whether `id` is on the roster. */
|
|
244
|
+
export declare function matrixDeclares(matrix: QuillFieldSchema, id: string): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* The schema at `steps` under `field`, or `undefined` where the schema declares no such
|
|
247
|
+
* place: an index under an `array`, a key under an `object`'s properties, a member id
|
|
248
|
+
* under a `matrix` and a key under that member, a cell of any world (or the
|
|
249
|
+
* discriminant) under a variant-bearing `enum`. The editor's copy of the boundary's
|
|
250
|
+
* `schema_at`, held here because the landing lane checks an address against the schema
|
|
251
|
+
* before it asks the mounted tree for it (VISUAL_EDITOR §Surface).
|
|
252
|
+
*/
|
|
253
|
+
export declare function schemaAt(field: QuillFieldSchema, steps: readonly PathStep[]): QuillFieldSchema | undefined;
|
|
254
|
+
/** Whether a cell is one line tall by declaration: the shape a table column and a row
|
|
255
|
+
* summary can hold. A prose cell is one where it declares `inline`, `richtext` or
|
|
256
|
+
* `plaintext` alike. */
|
|
257
|
+
export declare function shortCell(sub: QuillFieldSchema): boolean;
|
|
258
|
+
/** A collapsed row's own words ({@link firstShortText}); `undefined` while the row has
|
|
259
|
+
* nothing to say for itself. */
|
|
260
|
+
export declare function rowSummary(items: QuillFieldSchema | undefined, row: unknown): string | undefined;
|
|
261
|
+
/** How an `array` draws its elements. */
|
|
262
|
+
export type ArrayLayout = 'list' | 'table';
|
|
263
|
+
/**
|
|
264
|
+
* The layout an array takes: `'table'` where the array's own `ui.layout` asks for it
|
|
265
|
+
* and every cell of the row is short (a block prose cell declines it, at load width and
|
|
266
|
+
* every width after), else `'list'`. That every column is a leaf is the loader's
|
|
267
|
+
* contract (`quill::table_column_not_flat`); whether a leaf fits a cell is the surface's
|
|
268
|
+
* answer (canon `SCHEMAS.md`): a table composes by position, so a row that would stack
|
|
269
|
+
* inside a cell is not one.
|
|
270
|
+
*/
|
|
271
|
+
export declare function arrayLayout(field: QuillFieldSchema): ArrayLayout;
|
|
154
272
|
/**
|
|
155
273
|
* Which world's cells to draw: the authored discriminant when the container carries
|
|
156
274
|
* one, else the ghosted default's member — an unset field renders its `default:`, so a
|
|
@@ -170,12 +288,13 @@ export declare function variantCells(schema: QuillFieldSchema, member: string |
|
|
|
170
288
|
export declare function commitDiscriminant(value: Record<string, unknown> | undefined, member: string | undefined): Record<string, unknown> | undefined;
|
|
171
289
|
/**
|
|
172
290
|
* Whether the schema obliges a cell: `default:`'s absence, which is the whole of the
|
|
173
|
-
* obligation (DOCUMENT_MODEL).
|
|
174
|
-
*
|
|
175
|
-
*
|
|
291
|
+
* obligation (DOCUMENT_MODEL). Exempt are the cells whose absence of one says nothing:
|
|
292
|
+
* a typed dictionary and a matrix, since a namespace declares no `default:` at all and
|
|
293
|
+
* `validate` anchors obligation on the leaves under it; and an optional cell, which can
|
|
294
|
+
* declare none, its unanswered render being `none`.
|
|
176
295
|
*/
|
|
177
296
|
export declare function obliged(schema: QuillFieldSchema): boolean;
|
|
178
|
-
/** `foo_bar` → `Foo bar`: the label fallback when a field declares no `
|
|
297
|
+
/** `foo_bar` → `Foo bar`: the label fallback when a field declares no `title`. */
|
|
179
298
|
export declare function humanize(name: string): string;
|
|
180
299
|
/** Project a card schema's `fields` map (declaration = key order) into models. */
|
|
181
300
|
export declare function fieldModels(cardSchema: QuillCardSchema): FieldModel[];
|
|
@@ -235,19 +354,19 @@ export interface PlacedField {
|
|
|
235
354
|
export declare function placeFields(fields: FieldModel[]): PlacedField[];
|
|
236
355
|
/** A card's field values by key, off its payload items. */
|
|
237
356
|
export declare function fieldValues(items: readonly PayloadItem[]): Record<string, unknown>;
|
|
238
|
-
/** Interpolate a `{field}` card-title template against live field values. */
|
|
239
|
-
export declare function interpolateTitle(template: string, values: Record<string, unknown>): string;
|
|
240
357
|
/** A field value as title text. A parsed field rests as the authored string and a
|
|
241
358
|
* committed one as `Content`, whose `text` is the same words; a scalar reads as
|
|
242
|
-
* itself
|
|
359
|
+
* itself; a variant container reads as its discriminant member, the one cell of it
|
|
360
|
+
* that names the world; any other container as nothing. */
|
|
243
361
|
export declare function titleText(v: unknown): string;
|
|
244
|
-
/**
|
|
245
|
-
|
|
362
|
+
/** A card kind's name: its schema `title`, else the humanized kind. What names a kind
|
|
363
|
+
* before there is an instance of it: the add menu, the retype select. */
|
|
364
|
+
export declare function kindTitle(cardSchema: QuillCardSchema | undefined, kind: string): string;
|
|
246
365
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* cleared rename reverts to the schema
|
|
366
|
+
* A card instance's header: the per-instance `$ext.editor.title` rename; else the
|
|
367
|
+
* kind's schema `title`, which names every instance alike; else the instance's own
|
|
368
|
+
* first short text cell ({@link firstShortText}); else the humanized kind. Empty
|
|
369
|
+
* renames fall through, so a cleared rename reverts to what the schema says.
|
|
251
370
|
*/
|
|
252
371
|
export declare function cardTitle(cardSchema: QuillCardSchema | undefined, kind: string, values: Record<string, unknown>, extTitle: string | undefined): string;
|
|
253
372
|
/** Whether a card kind renders a body leaf: gated by `body.enabled !== false`. */
|