@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.
Files changed (68) hide show
  1. package/README.md +7 -8
  2. package/THEMING.md +1 -1
  3. package/dist/core/codec/blocks.d.ts +23 -6
  4. package/dist/core/codec/blocks.js +163 -38
  5. package/dist/core/codec/code.js +3 -8
  6. package/dist/core/codec/decode.d.ts +2 -1
  7. package/dist/core/codec/decode.js +19 -11
  8. package/dist/core/codec/field.d.ts +6 -3
  9. package/dist/core/codec/field.js +12 -4
  10. package/dist/core/codec/index.d.ts +2 -0
  11. package/dist/core/codec/index.js +4 -0
  12. package/dist/core/codec/inputrules.js +40 -10
  13. package/dist/core/codec/islands.d.ts +4 -1
  14. package/dist/core/codec/islands.js +43 -16
  15. package/dist/core/codec/keymap.js +19 -1
  16. package/dist/core/codec/line-paste.d.ts +7 -0
  17. package/dist/core/codec/line-paste.js +36 -0
  18. package/dist/core/codec/list-move.d.ts +6 -0
  19. package/dist/core/codec/list-move.js +30 -0
  20. package/dist/core/codec/list-paste.d.ts +2 -0
  21. package/dist/core/codec/list-paste.js +142 -0
  22. package/dist/core/codec/list-toggle.d.ts +4 -0
  23. package/dist/core/codec/list-toggle.js +170 -0
  24. package/dist/core/codec/lists.d.ts +22 -15
  25. package/dist/core/codec/lists.js +404 -97
  26. package/dist/core/codec/markdown-paste.d.ts +13 -3
  27. package/dist/core/codec/markdown-paste.js +70 -6
  28. package/dist/core/codec/nesting.d.ts +5 -1
  29. package/dist/core/codec/nesting.js +1 -1
  30. package/dist/core/codec/prose.css +36 -20
  31. package/dist/core/codec/slash.d.ts +2 -1
  32. package/dist/core/codec/slash.js +0 -0
  33. package/dist/core/codec/touching.d.ts +12 -0
  34. package/dist/core/codec/touching.js +33 -0
  35. package/dist/core/codec/undo.d.ts +5 -0
  36. package/dist/core/codec/undo.js +21 -0
  37. package/dist/index.js +1 -1
  38. package/dist/preview/Preview.svelte +88 -13
  39. package/dist/preview/Preview.svelte.d.ts +2 -2
  40. package/dist/preview/bridge.js +8 -2
  41. package/dist/preview/controller.d.ts +8 -4
  42. package/dist/preview/controller.js +10 -2
  43. package/dist/preview/index.js +1 -1
  44. package/dist/preview/paint.d.ts +6 -2
  45. package/dist/preview/paint.js +67 -56
  46. package/dist/preview/strings.d.ts +2 -0
  47. package/dist/preview/strings.js +4 -2
  48. package/dist/preview/viewport.d.ts +10 -0
  49. package/dist/preview/viewport.js +271 -0
  50. package/dist/preview/zoom.d.ts +41 -0
  51. package/dist/preview/zoom.js +52 -0
  52. package/dist/visual/ArrayField.svelte +24 -4
  53. package/dist/visual/Card.svelte +5 -4
  54. package/dist/visual/DateField.svelte +26 -13
  55. package/dist/visual/Field.svelte +2 -2
  56. package/dist/visual/FormatPopover.svelte +41 -2
  57. package/dist/visual/ObjectField.svelte +4 -7
  58. package/dist/visual/ObjectField.svelte.d.ts +2 -2
  59. package/dist/visual/ProseValue.svelte +35 -3
  60. package/dist/visual/ProseValue.svelte.d.ts +7 -0
  61. package/dist/visual/VisualEditorInner.svelte +5 -11
  62. package/dist/visual/icons/nodes.d.ts +26 -0
  63. package/dist/visual/icons/nodes.js +16 -0
  64. package/dist/visual/strings.d.ts +6 -4
  65. package/dist/visual/strings.js +9 -3
  66. package/dist/visual/structure.d.ts +22 -10
  67. package/dist/visual/structure.js +35 -11
  68. package/package.json +2 -2
@@ -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. The engine's coercion, restated, so the suite holds it to `reader.resolve()`. */
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 the engine's
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 the engine would refuse still draws the tick it claims.
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 the engine's false spellings unheld, the rest held. */
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 the engine's refusal, drawn nowhere and
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 && flatObject(fs[0].schema) ? fs[0] : undefined;
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.23.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.126.0-0",
72
+ "@quillmark/wasm": ">=0.129.0-0",
73
73
  "svelte": "^5.33.0"
74
74
  },
75
75
  "dependencies": {