@quillmark/svelte 0.23.0 → 0.25.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 +7 -8
- package/THEMING.md +1 -1
- package/dist/core/codec/blocks.d.ts +23 -6
- package/dist/core/codec/blocks.js +163 -38
- package/dist/core/codec/code.js +3 -8
- package/dist/core/codec/decode.d.ts +2 -1
- package/dist/core/codec/decode.js +19 -11
- package/dist/core/codec/field.d.ts +6 -3
- package/dist/core/codec/field.js +12 -4
- package/dist/core/codec/index.d.ts +2 -0
- package/dist/core/codec/index.js +4 -0
- package/dist/core/codec/inputrules.js +40 -10
- package/dist/core/codec/islands.d.ts +4 -1
- package/dist/core/codec/islands.js +43 -16
- package/dist/core/codec/keymap.js +19 -1
- package/dist/core/codec/line-paste.d.ts +7 -0
- package/dist/core/codec/line-paste.js +36 -0
- package/dist/core/codec/list-move.d.ts +6 -0
- package/dist/core/codec/list-move.js +30 -0
- package/dist/core/codec/list-paste.d.ts +2 -0
- package/dist/core/codec/list-paste.js +142 -0
- package/dist/core/codec/list-toggle.d.ts +4 -0
- package/dist/core/codec/list-toggle.js +170 -0
- package/dist/core/codec/lists.d.ts +22 -15
- package/dist/core/codec/lists.js +404 -97
- package/dist/core/codec/markdown-paste.d.ts +13 -3
- package/dist/core/codec/markdown-paste.js +70 -6
- package/dist/core/codec/nesting.d.ts +5 -1
- package/dist/core/codec/nesting.js +1 -1
- package/dist/core/codec/prose.css +36 -20
- package/dist/core/codec/slash.d.ts +2 -1
- package/dist/core/codec/slash.js +0 -0
- package/dist/core/codec/touching.d.ts +12 -0
- package/dist/core/codec/touching.js +33 -0
- package/dist/core/codec/undo.d.ts +5 -0
- package/dist/core/codec/undo.js +21 -0
- package/dist/index.js +1 -1
- package/dist/preview/Preview.svelte +88 -13
- package/dist/preview/Preview.svelte.d.ts +2 -2
- package/dist/preview/bridge.js +8 -2
- package/dist/preview/controller.d.ts +8 -4
- package/dist/preview/controller.js +10 -2
- package/dist/preview/index.js +1 -1
- package/dist/preview/paint.d.ts +6 -2
- package/dist/preview/paint.js +67 -56
- package/dist/preview/strings.d.ts +2 -0
- package/dist/preview/strings.js +4 -2
- package/dist/preview/viewport.d.ts +10 -0
- package/dist/preview/viewport.js +271 -0
- package/dist/preview/zoom.d.ts +41 -0
- package/dist/preview/zoom.js +52 -0
- package/dist/visual/ArrayField.svelte +24 -4
- package/dist/visual/Card.svelte +5 -4
- package/dist/visual/DateField.svelte +26 -13
- package/dist/visual/Field.svelte +2 -2
- package/dist/visual/FormatPopover.svelte +41 -2
- package/dist/visual/ObjectField.svelte +4 -7
- package/dist/visual/ObjectField.svelte.d.ts +2 -2
- package/dist/visual/ProseValue.svelte +35 -3
- package/dist/visual/ProseValue.svelte.d.ts +7 -0
- package/dist/visual/VisualEditorInner.svelte +5 -11
- package/dist/visual/icons/nodes.d.ts +26 -0
- package/dist/visual/icons/nodes.js +16 -0
- package/dist/visual/strings.d.ts +6 -4
- package/dist/visual/strings.js +9 -3
- package/dist/visual/structure.d.ts +22 -10
- package/dist/visual/structure.js +35 -11
- package/package.json +2 -2
package/dist/visual/structure.js
CHANGED
|
@@ -11,11 +11,6 @@ import { core } from '../core/lifecycle.js';
|
|
|
11
11
|
export function isContainer(kind) {
|
|
12
12
|
return kind === 'array' || kind === 'object' || kind === 'variant' || kind === 'matrix';
|
|
13
13
|
}
|
|
14
|
-
/** `ui.layout: flat` on a typed dictionary: no frame of its own, its properties
|
|
15
|
-
* standing at the depth of the fields around it rather than a rung in. */
|
|
16
|
-
export function flatObject(schema) {
|
|
17
|
-
return controlKind(schema) === 'object' && schema.ui?.layout === 'flat';
|
|
18
|
-
}
|
|
19
14
|
/**
|
|
20
15
|
* A card's resolved rows keyed by field name: the provenance channel parallel to
|
|
21
16
|
* {@link CardModel.values}. `resolve` returns rows in declaration order; the
|
|
@@ -47,7 +42,7 @@ export function ghostDefault(row) {
|
|
|
47
42
|
}
|
|
48
43
|
/** A stored `boolean` cell as the render reads it: a boolean, `true` or `false` in any
|
|
49
44
|
* case, or a number by whether it is non-zero; undefined where the render refuses the
|
|
50
|
-
* value.
|
|
45
|
+
* value. Quillmark's coercion, restated, so the suite holds it to `reader.resolve()`. */
|
|
51
46
|
export function renderedBoolean(value) {
|
|
52
47
|
if (typeof value === 'boolean')
|
|
53
48
|
return value;
|
|
@@ -197,16 +192,16 @@ export function memberValue(map, id) {
|
|
|
197
192
|
}
|
|
198
193
|
/**
|
|
199
194
|
* Whether a stored member is held: by being present. A mapping is held whatever it
|
|
200
|
-
* carries, `{}` included, and a bare scalar is the tick itself, read as
|
|
195
|
+
* carries, `{}` included, and a bare scalar is the tick itself, read as Quillmark's
|
|
201
196
|
* coercion reads it: `false`, `0`, `"false"` and `null` unheld, every other present
|
|
202
|
-
* scalar held, so a spelling
|
|
197
|
+
* scalar held, so a spelling Quillmark would refuse still draws the tick it claims.
|
|
203
198
|
*/
|
|
204
199
|
export function matrixHeld(stored) {
|
|
205
200
|
if (typeof stored === 'object' && stored !== null)
|
|
206
201
|
return true;
|
|
207
202
|
return tickOf(stored);
|
|
208
203
|
}
|
|
209
|
-
/** A tick's scalar reading: absent and
|
|
204
|
+
/** A tick's scalar reading: absent and Quillmark's false spellings unheld, the rest held. */
|
|
210
205
|
function tickOf(v) {
|
|
211
206
|
if (v === undefined || v === null)
|
|
212
207
|
return false;
|
|
@@ -280,7 +275,7 @@ export function matrixDeclares(matrix, id) {
|
|
|
280
275
|
/**
|
|
281
276
|
* The added items a stored map holds, sorted by id as the plate orders them: on an
|
|
282
277
|
* open matrix, each key off the roster spelled as an id whose mapping carries a
|
|
283
|
-
* `title`. Any other key off the roster is
|
|
278
|
+
* `title`. Any other key off the roster is Quillmark's refusal, drawn nowhere and
|
|
284
279
|
* ridden through.
|
|
285
280
|
*/
|
|
286
281
|
export function addedItems(matrix, map) {
|
|
@@ -526,7 +521,7 @@ export function groupSections(fields, order, labelFor) {
|
|
|
526
521
|
for (const g of order) {
|
|
527
522
|
const fs = fields.filter((f) => f.group === g);
|
|
528
523
|
if (fs.length) {
|
|
529
|
-
const head = fs.length === 1 &&
|
|
524
|
+
const head = fs.length === 1 && fs[0].control === 'object' ? fs[0] : undefined;
|
|
530
525
|
sections.push({ group: g, label: labelFor(g), fields: fs, head });
|
|
531
526
|
emitted.add(g);
|
|
532
527
|
}
|
|
@@ -543,6 +538,35 @@ export function groupSections(fields, order, labelFor) {
|
|
|
543
538
|
}
|
|
544
539
|
return sections;
|
|
545
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* Object-panel sections (VISUAL_EDITOR §"Structure mirrors the schema"): every
|
|
543
|
+
* top-level `object` is a panel of its own, headed by the object, in declaration
|
|
544
|
+
* order; everything else stands in one unframed section above them. The section id
|
|
545
|
+
* is the field name, which a card's keys hold unique.
|
|
546
|
+
*/
|
|
547
|
+
export function objectSections(fields) {
|
|
548
|
+
const panel = (f) => f.control === 'object';
|
|
549
|
+
const loose = fields.filter((f) => !panel(f));
|
|
550
|
+
const sections = loose.length
|
|
551
|
+
? [{ group: undefined, label: '', fields: loose }]
|
|
552
|
+
: [];
|
|
553
|
+
for (const f of fields)
|
|
554
|
+
if (panel(f))
|
|
555
|
+
sections.push({ group: f.name, label: f.label, fields: [f], head: f });
|
|
556
|
+
return sections;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* A card's sections: its ungrouped fields' {@link objectSections}, then each legacy
|
|
560
|
+
* `ui.group` a panel in registry order, the order the loader settles the fields in.
|
|
561
|
+
* A panel named as a group is keyed off the group's id space, which `.` never joins.
|
|
562
|
+
*/
|
|
563
|
+
export function cardSections(cardSchema) {
|
|
564
|
+
const fields = fieldModels(cardSchema);
|
|
565
|
+
const order = groupOrder(cardSchema);
|
|
566
|
+
const panels = objectSections(fields.filter((f) => f.group === undefined)).map((s) => s.head && order.includes(s.head.name) ? { ...s, group: `${s.head.name}.` } : s);
|
|
567
|
+
const grouped = fields.filter((f) => f.group !== undefined);
|
|
568
|
+
return [...panels, ...groupSections(grouped, order, (g) => groupLabel(cardSchema, g))];
|
|
569
|
+
}
|
|
546
570
|
/**
|
|
547
571
|
* The group section a card's accordion opens on first mount: the first in
|
|
548
572
|
* order, or `null` when the card declares none. Ungrouped fields render outside
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillmark/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Editor, live-preview and source surfaces over a Quillmark WASM session.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@quillmark/wasm": ">=0.
|
|
72
|
+
"@quillmark/wasm": ">=0.129.0-0",
|
|
73
73
|
"svelte": "^5.33.0"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|