@quillmark/svelte 0.29.2 → 0.30.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 +2 -1
- package/THEMING.md +8 -6
- package/dist/core/address.d.ts +3 -3
- package/dist/core/address.js +1 -1
- package/dist/core/bloom.d.ts +3 -2
- package/dist/core/bloom.js +6 -7
- package/dist/core/codec/decode.d.ts +1 -3
- package/dist/core/codec/decode.js +145 -206
- package/dist/core/codec/encode.d.ts +13 -35
- package/dist/core/codec/encode.js +127 -408
- package/dist/core/codec/field.d.ts +9 -9
- package/dist/core/codec/field.js +87 -80
- package/dist/core/codec/index.d.ts +2 -5
- package/dist/core/codec/index.js +4 -4
- package/dist/core/codec/inputrules.d.ts +0 -3
- package/dist/core/codec/inputrules.js +1 -1
- package/dist/core/codec/islands.d.ts +13 -19
- package/dist/core/codec/islands.js +55 -50
- package/dist/core/codec/list-move.d.ts +0 -3
- package/dist/core/codec/list-move.js +2 -2
- package/dist/core/codec/list-node.d.ts +2 -0
- package/dist/core/codec/list-node.js +1 -0
- package/dist/core/codec/list-paste.js +1 -1
- package/dist/core/codec/markdown-paste.d.ts +0 -9
- package/dist/core/codec/markdown-paste.js +1 -1
- package/dist/core/codec/marks.d.ts +12 -18
- package/dist/core/codec/marks.js +16 -26
- package/dist/core/codec/nesting.d.ts +0 -4
- package/dist/core/codec/nesting.js +1 -1
- package/dist/core/codec/positions.d.ts +14 -7
- package/dist/core/codec/positions.js +43 -50
- package/dist/core/codec/prose.css +1 -1
- package/dist/core/codec/reveal.d.ts +14 -0
- package/dist/core/codec/reveal.js +40 -0
- package/dist/core/codec/schema.d.ts +1 -1
- package/dist/core/codec/schema.js +26 -8
- package/dist/core/codec/slash.js +0 -0
- package/dist/core/codec/table-copy.d.ts +3 -3
- package/dist/core/codec/table-copy.js +6 -4
- package/dist/core/codec/table-paste.js +13 -9
- package/dist/core/codec/table-view.js +22 -15
- package/dist/core/codec/table.d.ts +77 -49
- package/dist/core/codec/table.js +158 -49
- package/dist/core/codec/touching.d.ts +0 -2
- package/dist/core/codec/touching.js +1 -11
- package/dist/preview/Preview.svelte +20 -1
- package/dist/preview/Preview.svelte.d.ts +1 -0
- package/dist/preview/controller.d.ts +5 -0
- package/dist/preview/controller.js +6 -0
- package/dist/preview/viewport.js +19 -1
- package/dist/preview/wash.d.ts +9 -0
- package/dist/preview/wash.js +38 -0
- package/dist/visual/ArrayField.svelte +18 -115
- package/dist/visual/FormatPopover.svelte +1 -1
- package/dist/visual/MatrixField.svelte +15 -19
- package/dist/visual/ObjectField.svelte +10 -13
- package/dist/visual/ProseValue.svelte +8 -8
- package/dist/visual/VisualEditorInner.svelte +17 -11
- package/dist/visual/guidance.d.ts +0 -12
- package/dist/visual/guidance.js +2 -2
- package/dist/visual/leaves.d.ts +1 -1
- package/dist/visual/leaves.js +1 -1
- package/dist/visual/props.d.ts +2 -2
- package/dist/visual/rowdrag.svelte.d.ts +21 -0
- package/dist/visual/rowdrag.svelte.js +118 -0
- package/dist/visual/structure.d.ts +6 -6
- package/dist/visual/structure.js +18 -21
- package/package.json +2 -2
- package/dist/visual/checklists.d.ts +0 -3
- package/dist/visual/checklists.js +0 -7
package/dist/visual/structure.js
CHANGED
|
@@ -105,16 +105,7 @@ export function declaredContent(v, markdown) {
|
|
|
105
105
|
return undefined;
|
|
106
106
|
if (markdown)
|
|
107
107
|
return core().importMarkdown(text).content;
|
|
108
|
-
return {
|
|
109
|
-
text,
|
|
110
|
-
lines: text
|
|
111
|
-
.split('\n')
|
|
112
|
-
.map((_, i) => i === 0
|
|
113
|
-
? { containers: [], kind: 'para' }
|
|
114
|
-
: { containers: [], kind: 'para', continues: true }),
|
|
115
|
-
marks: [],
|
|
116
|
-
islands: []
|
|
117
|
-
};
|
|
108
|
+
return { text: text.replaceAll('\n', '\u2028'), blocks: [{ id: 'b0', kind: 'para' }] };
|
|
118
109
|
}
|
|
119
110
|
/** A field's `{#each}` key: its name and what a mounted leaf reads once, its type,
|
|
120
111
|
* {@link oneLine} and `max:`, and its elements'. A retype or a quill swap that changes
|
|
@@ -173,10 +164,16 @@ export const MATRIX_TITLE = 'title';
|
|
|
173
164
|
export function matrixMembers(roster) {
|
|
174
165
|
return roster ? Object.keys(roster).map((id) => ({ id, title: roster[id] })) : [];
|
|
175
166
|
}
|
|
176
|
-
/** A
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
/** A value by own key: a document key or a declared id can be spelled `constructor`. */
|
|
168
|
+
export function own(map, key) {
|
|
169
|
+
return map && Object.hasOwn(map, key) ? map[key] : undefined;
|
|
170
|
+
}
|
|
171
|
+
/** The value a matrix prints: the stored map, else a mapping `default:`. */
|
|
172
|
+
export function matrixPrinted(value, schema) {
|
|
173
|
+
const map = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
174
|
+
? v
|
|
175
|
+
: undefined;
|
|
176
|
+
return value == null ? map(schema.default) : map(value);
|
|
180
177
|
}
|
|
181
178
|
/**
|
|
182
179
|
* Whether a stored member is held: by being present. A mapping is held whatever it
|
|
@@ -245,7 +242,7 @@ export function memberWrite(columns, title) {
|
|
|
245
242
|
}
|
|
246
243
|
/** Whether `id` is spelled as a matrix id: snake_case, the rule the roster's ids and
|
|
247
244
|
* an added item's key share. */
|
|
248
|
-
|
|
245
|
+
function matrixId(id) {
|
|
249
246
|
return /^[a-z][a-z0-9_]*$/.test(id);
|
|
250
247
|
}
|
|
251
248
|
export function onRoster(matrix, id) {
|
|
@@ -384,7 +381,7 @@ function firstShortText(cells, values) {
|
|
|
384
381
|
});
|
|
385
382
|
if (!named)
|
|
386
383
|
return undefined;
|
|
387
|
-
return titleText(
|
|
384
|
+
return titleText(own(values, named[0])).trim() || undefined;
|
|
388
385
|
}
|
|
389
386
|
/** A collapsed row's own words ({@link firstShortText}). */
|
|
390
387
|
export function rowSummary(items, row) {
|
|
@@ -440,6 +437,10 @@ export function humanize(name) {
|
|
|
440
437
|
const spaced = name.replace(/_/g, ' ').trim();
|
|
441
438
|
return spaced ? spaced[0].toUpperCase() + spaced.slice(1) : spaced;
|
|
442
439
|
}
|
|
440
|
+
/** What a field or property is called: its `title:`, else its key humanized. */
|
|
441
|
+
export function fieldTitle(key, schema) {
|
|
442
|
+
return schema.title ?? humanize(key);
|
|
443
|
+
}
|
|
443
444
|
/**
|
|
444
445
|
* Whether a field asks to share a row when its `ui.compact` is undeclared: a control
|
|
445
446
|
* whose type bounds its width. Text never does, its type saying nothing of whether a
|
|
@@ -459,7 +460,7 @@ export function fieldModels(cardSchema) {
|
|
|
459
460
|
control,
|
|
460
461
|
group: schema.ui?.group,
|
|
461
462
|
compact: schema.ui?.compact ?? packsByDefault(control),
|
|
462
|
-
label:
|
|
463
|
+
label: fieldTitle(name, schema),
|
|
463
464
|
description: schema.description,
|
|
464
465
|
inline: oneLine(schema),
|
|
465
466
|
plaintext: literalText(schema)
|
|
@@ -614,10 +615,6 @@ export function fieldValues(items) {
|
|
|
614
615
|
values[p.key] = p.value;
|
|
615
616
|
return values;
|
|
616
617
|
}
|
|
617
|
-
/** A value by own key: a declaration can name `constructor`. */
|
|
618
|
-
function ownValue(values, name) {
|
|
619
|
-
return Object.hasOwn(values, name) ? values[name] : undefined;
|
|
620
|
-
}
|
|
621
618
|
/** A field value as title text. A parsed field rests as the authored string and a
|
|
622
619
|
* committed one as `Content`, whose `text` is the same words; a scalar reads as
|
|
623
620
|
* itself; a variant container reads as its discriminant member, the one cell of it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillmark/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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.134.1-0 <0.135.0-0",
|
|
73
73
|
"svelte": "^5.33.0"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** The value a matrix prints: the stored map, else a mapping `default:`. */
|
|
2
|
-
export function matrixPrinted(value, schema) {
|
|
3
|
-
const map = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
4
|
-
? v
|
|
5
|
-
: undefined;
|
|
6
|
-
return value == null ? map(schema.default) : map(value);
|
|
7
|
-
}
|