@quillmark/svelte 0.29.2 → 0.29.3

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.
Files changed (48) hide show
  1. package/README.md +1 -0
  2. package/THEMING.md +8 -6
  3. package/dist/core/bloom.d.ts +3 -2
  4. package/dist/core/bloom.js +6 -7
  5. package/dist/core/codec/field.js +2 -4
  6. package/dist/core/codec/index.d.ts +0 -3
  7. package/dist/core/codec/inputrules.d.ts +0 -3
  8. package/dist/core/codec/inputrules.js +1 -1
  9. package/dist/core/codec/islands.d.ts +0 -10
  10. package/dist/core/codec/islands.js +1 -1
  11. package/dist/core/codec/list-move.d.ts +0 -3
  12. package/dist/core/codec/list-move.js +2 -2
  13. package/dist/core/codec/list-node.d.ts +2 -0
  14. package/dist/core/codec/list-node.js +1 -0
  15. package/dist/core/codec/list-paste.js +1 -1
  16. package/dist/core/codec/markdown-paste.d.ts +0 -9
  17. package/dist/core/codec/markdown-paste.js +1 -1
  18. package/dist/core/codec/nesting.d.ts +0 -4
  19. package/dist/core/codec/nesting.js +1 -1
  20. package/dist/core/codec/prose.css +1 -1
  21. package/dist/core/codec/reveal.d.ts +14 -0
  22. package/dist/core/codec/reveal.js +40 -0
  23. package/dist/core/codec/slash.js +0 -0
  24. package/dist/core/codec/table-view.js +3 -3
  25. package/dist/core/codec/table.d.ts +0 -6
  26. package/dist/core/codec/table.js +1 -1
  27. package/dist/core/codec/touching.d.ts +0 -2
  28. package/dist/core/codec/touching.js +1 -11
  29. package/dist/preview/Preview.svelte +20 -1
  30. package/dist/preview/Preview.svelte.d.ts +1 -0
  31. package/dist/preview/controller.d.ts +5 -0
  32. package/dist/preview/controller.js +6 -0
  33. package/dist/preview/viewport.js +19 -1
  34. package/dist/preview/wash.d.ts +9 -0
  35. package/dist/preview/wash.js +38 -0
  36. package/dist/visual/ArrayField.svelte +17 -114
  37. package/dist/visual/MatrixField.svelte +15 -19
  38. package/dist/visual/ObjectField.svelte +10 -13
  39. package/dist/visual/guidance.d.ts +0 -12
  40. package/dist/visual/guidance.js +2 -2
  41. package/dist/visual/props.d.ts +2 -2
  42. package/dist/visual/rowdrag.svelte.d.ts +21 -0
  43. package/dist/visual/rowdrag.svelte.js +118 -0
  44. package/dist/visual/structure.d.ts +6 -6
  45. package/dist/visual/structure.js +17 -11
  46. package/package.json +2 -2
  47. package/dist/visual/checklists.d.ts +0 -3
  48. package/dist/visual/checklists.js +0 -7
@@ -173,10 +173,16 @@ export const MATRIX_TITLE = 'title';
173
173
  export function matrixMembers(roster) {
174
174
  return roster ? Object.keys(roster).map((id) => ({ id, title: roster[id] })) : [];
175
175
  }
176
- /** A member's stored payload, off the sparse map by own key: a document key can be
177
- * spelled `constructor`. */
178
- export function memberValue(map, id) {
179
- return map && Object.hasOwn(map, id) ? map[id] : undefined;
176
+ /** A value by own key: a document key or a declared id can be spelled `constructor`. */
177
+ export function own(map, key) {
178
+ return map && Object.hasOwn(map, key) ? map[key] : undefined;
179
+ }
180
+ /** The value a matrix prints: the stored map, else a mapping `default:`. */
181
+ export function matrixPrinted(value, schema) {
182
+ const map = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
183
+ ? v
184
+ : undefined;
185
+ return value == null ? map(schema.default) : map(value);
180
186
  }
181
187
  /**
182
188
  * Whether a stored member is held: by being present. A mapping is held whatever it
@@ -245,7 +251,7 @@ export function memberWrite(columns, title) {
245
251
  }
246
252
  /** Whether `id` is spelled as a matrix id: snake_case, the rule the roster's ids and
247
253
  * an added item's key share. */
248
- export function matrixId(id) {
254
+ function matrixId(id) {
249
255
  return /^[a-z][a-z0-9_]*$/.test(id);
250
256
  }
251
257
  export function onRoster(matrix, id) {
@@ -384,7 +390,7 @@ function firstShortText(cells, values) {
384
390
  });
385
391
  if (!named)
386
392
  return undefined;
387
- return titleText(ownValue(values, named[0])).trim() || undefined;
393
+ return titleText(own(values, named[0])).trim() || undefined;
388
394
  }
389
395
  /** A collapsed row's own words ({@link firstShortText}). */
390
396
  export function rowSummary(items, row) {
@@ -440,6 +446,10 @@ export function humanize(name) {
440
446
  const spaced = name.replace(/_/g, ' ').trim();
441
447
  return spaced ? spaced[0].toUpperCase() + spaced.slice(1) : spaced;
442
448
  }
449
+ /** What a field or property is called: its `title:`, else its key humanized. */
450
+ export function fieldTitle(key, schema) {
451
+ return schema.title ?? humanize(key);
452
+ }
443
453
  /**
444
454
  * Whether a field asks to share a row when its `ui.compact` is undeclared: a control
445
455
  * whose type bounds its width. Text never does, its type saying nothing of whether a
@@ -459,7 +469,7 @@ export function fieldModels(cardSchema) {
459
469
  control,
460
470
  group: schema.ui?.group,
461
471
  compact: schema.ui?.compact ?? packsByDefault(control),
462
- label: schema.title ?? humanize(name),
472
+ label: fieldTitle(name, schema),
463
473
  description: schema.description,
464
474
  inline: oneLine(schema),
465
475
  plaintext: literalText(schema)
@@ -614,10 +624,6 @@ export function fieldValues(items) {
614
624
  values[p.key] = p.value;
615
625
  return values;
616
626
  }
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
627
  /** A field value as title text. A parsed field rests as the authored string and a
622
628
  * committed one as `Content`, whose `text` is the same words; a scalar reads as
623
629
  * 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.29.2",
3
+ "version": "0.29.3",
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.133.0-0",
72
+ "@quillmark/wasm": ">=0.133.0-0 <0.134.0-0",
73
73
  "svelte": "^5.33.0"
74
74
  },
75
75
  "dependencies": {
@@ -1,3 +0,0 @@
1
- import type { QuillFieldSchema } from '@quillmark/wasm';
2
- /** The value a matrix prints: the stored map, else a mapping `default:`. */
3
- export declare function matrixPrinted(value: unknown, schema: QuillFieldSchema): Record<string, unknown> | undefined;
@@ -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
- }