@quillmark/svelte 0.18.0 → 0.20.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 (56) hide show
  1. package/NOTICE +4 -2
  2. package/dist/core/codec/blocks.d.ts +11 -2
  3. package/dist/core/codec/blocks.js +45 -14
  4. package/dist/core/codec/breaks.d.ts +3 -2
  5. package/dist/core/codec/breaks.js +3 -2
  6. package/dist/core/codec/decode.d.ts +7 -3
  7. package/dist/core/codec/decode.js +34 -8
  8. package/dist/core/codec/field.d.ts +11 -5
  9. package/dist/core/codec/field.js +11 -8
  10. package/dist/core/codec/index.d.ts +1 -1
  11. package/dist/core/codec/index.js +1 -1
  12. package/dist/core/codec/islands.d.ts +3 -1
  13. package/dist/core/codec/islands.js +8 -5
  14. package/dist/core/codec/markdown-paste.d.ts +9 -0
  15. package/dist/core/codec/markdown-paste.js +49 -0
  16. package/dist/core/codec/prose.css +109 -1
  17. package/dist/core/codec/schema.d.ts +8 -2
  18. package/dist/core/codec/schema.js +16 -5
  19. package/dist/core/codec/slash.d.ts +9 -6
  20. package/dist/core/codec/slash.js +0 -0
  21. package/dist/core/codec/table-paste.d.ts +7 -0
  22. package/dist/core/codec/table-paste.js +132 -0
  23. package/dist/core/codec/table-view.d.ts +12 -0
  24. package/dist/core/codec/table-view.js +401 -57
  25. package/dist/core/codec/table.d.ts +38 -16
  26. package/dist/core/codec/table.js +106 -35
  27. package/dist/core/theme.css +1 -1
  28. package/dist/visual/ArrayField.svelte +17 -6
  29. package/dist/visual/ArrayField.svelte.d.ts +1 -1
  30. package/dist/visual/Field.svelte +9 -3
  31. package/dist/visual/Field.svelte.d.ts +1 -1
  32. package/dist/visual/FieldHint.svelte +62 -10
  33. package/dist/visual/FormatPopover.svelte +27 -31
  34. package/dist/visual/FormatPopover.svelte.d.ts +2 -2
  35. package/dist/visual/MatrixAdd.svelte +13 -132
  36. package/dist/visual/MatrixAdd.svelte.d.ts +2 -5
  37. package/dist/visual/MatrixField.svelte +5 -63
  38. package/dist/visual/MatrixField.svelte.d.ts +0 -3
  39. package/dist/visual/ObjectField.svelte +8 -4
  40. package/dist/visual/ObjectField.svelte.d.ts +4 -2
  41. package/dist/visual/ProseField.svelte +2 -1
  42. package/dist/visual/ProseValue.svelte +113 -40
  43. package/dist/visual/ProseValue.svelte.d.ts +8 -4
  44. package/dist/visual/VisualEditorInner.svelte +22 -22
  45. package/dist/visual/VisualEditorInner.svelte.d.ts +2 -2
  46. package/dist/visual/checklists.d.ts +0 -79
  47. package/dist/visual/checklists.js +0 -164
  48. package/dist/visual/guidance.d.ts +15 -0
  49. package/dist/visual/guidance.js +37 -0
  50. package/dist/visual/leaves.d.ts +27 -1
  51. package/dist/visual/leaves.js +46 -0
  52. package/dist/visual/strings.d.ts +3 -8
  53. package/dist/visual/strings.js +0 -3
  54. package/dist/visual/structure.js +1 -1
  55. package/dist/visual/tips.js +1 -1
  56. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import type { PathStep } from '@quillmark/wasm';
2
- import type { FieldController } from '../core/codec/index.js';
2
+ import type { FieldController, LeafViews } from '../core/codec/index.js';
3
3
  /**
4
4
  * What a landing at depth hands back: the box the arrival wash blooms in, now or once
5
5
  * the row it had to open has rendered. A row two closed boxes down does not exist
@@ -60,8 +60,34 @@ export interface LeafRegistry {
60
60
  control(key: string): FieldControl | undefined;
61
61
  /** The codec seam at `key`, `undefined` for a form control. */
62
62
  prose(key: string): FieldController | undefined;
63
+ /** A by-value prose leaf under the field at `key`, by its views, on its focus. */
64
+ focusValue(key: string, leaf: LeafViews): void;
65
+ /** Dropped only by the leaf it names, so a leaf leaving takes no sibling's entry. */
66
+ releaseValue(key: string, leaf: LeafViews): void;
67
+ /** The by-value leaf focused last under `key`. */
68
+ value(key: string): LeafViews | undefined;
63
69
  /** Drop everything: the surface going away as a whole, where a leaf's cleanup
64
70
  * order relative to the parent's is Svelte's business. */
65
71
  clear(): void;
66
72
  }
67
73
  export declare function createLeafRegistry(): LeafRegistry;
74
+ /**
75
+ * The active prose leaf as the formatting popover reaches it: the views a selection is
76
+ * read from and a mark toggled at, and the controller where the leaf is a field's. A
77
+ * by-value leaf has none, its anchors being dropped on the parent's value write, so the
78
+ * anchor verbs the controller carries have nothing to act on there.
79
+ */
80
+ export interface ActiveProse {
81
+ views: LeafViews;
82
+ controller?: FieldController;
83
+ }
84
+ /** The by-value lane with a field's key bound: what a leaf under that field announces
85
+ * itself through, knowing no key of its own. */
86
+ export interface ValueLeafSeat {
87
+ focus(leaf: LeafViews): void;
88
+ release(leaf: LeafViews): void;
89
+ }
90
+ /** Seat every by-value leaf under the calling field, at any depth of its containers. */
91
+ export declare function seatValueLeaves(seat: ValueLeafSeat): void;
92
+ /** The seat under a mounted field; `undefined` off-tree. */
93
+ export declare function valueLeafSeat(): ValueLeafSeat | undefined;
@@ -1,6 +1,32 @@
1
+ // The leaf registry: what a landing verb resolves a `DocPath` to, and the seam the
2
+ // mounted tree registers itself into (VISUAL_EDITOR §"Focus and the preview bridge").
3
+ //
4
+ // Two lanes behind one lookup. Every mounted field registers a {@link FieldControl} —
5
+ // take the caret, and a box to bloom — which is the whole of what a reveal and a
6
+ // focus need, and the whole of what a form control has. A prose leaf registers its
7
+ // `FieldController` instead: a superset, carrying the codec seam (a caret at a USV
8
+ // offset, the formatting popover's observation) that no `<input>` answers. So
9
+ // `control` covers every field and `prose` covers the leaves that have one, and the
10
+ // verbs ask for the half they use: `focusField` never needs the codec, and
11
+ // `getActiveLeaf` returns nothing for a focused text input rather than raising a
12
+ // formatting toolbar over one.
13
+ //
14
+ // A by-value prose leaf (`ProseValue`) is in neither lane: it is not addressable, and
15
+ // every element of an array and every cell of a row shares its field's key. It
16
+ // announces its views on focus into a third lane under that key, which holds the one
17
+ // focused last and is the popover's alone: `getActiveLeaf` falls back to it where the
18
+ // active field registered no controller, and a landing never reads it.
19
+ //
20
+ // A registry rather than a DOM query, for the reason `Card.revealLeaf` is a call: a
21
+ // control's focus is its own (a PM view restores a selection, a date field lands on
22
+ // its first segment, an array lands on its first element or its add affordance), so
23
+ // the surface holds the answers it already gives a label click instead of re-deriving
24
+ // them from markup.
25
+ import { getContext, setContext } from 'svelte';
1
26
  export function createLeafRegistry() {
2
27
  const controls = new Map();
3
28
  const proses = new Map();
29
+ const values = new Map();
4
30
  return {
5
31
  registerProse(key, controller) {
6
32
  proses.set(key, controller);
@@ -23,9 +49,29 @@ export function createLeafRegistry() {
23
49
  prose(key) {
24
50
  return proses.get(key);
25
51
  },
52
+ focusValue(key, leaf) {
53
+ values.set(key, leaf);
54
+ },
55
+ releaseValue(key, leaf) {
56
+ if (values.get(key) === leaf)
57
+ values.delete(key);
58
+ },
59
+ value(key) {
60
+ return values.get(key);
61
+ },
26
62
  clear() {
27
63
  controls.clear();
28
64
  proses.clear();
65
+ values.clear();
29
66
  }
30
67
  };
31
68
  }
69
+ const SEAT = Symbol('qm-value-leaf');
70
+ /** Seat every by-value leaf under the calling field, at any depth of its containers. */
71
+ export function seatValueLeaves(seat) {
72
+ setContext(SEAT, seat);
73
+ }
74
+ /** The seat under a mounted field; `undefined` off-tree. */
75
+ export function valueLeafSeat() {
76
+ return getContext(SEAT);
77
+ }
@@ -50,12 +50,6 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings {
50
50
  /** An open matrix's add box at rest, naming the list it adds to: `Add to Staff…`. The box
51
51
  * draws its own `+`. `list` is empty for a matrix mounted with no label. */
52
52
  matrixAdd: (list: string) => string;
53
- /** The add box's last option, which adds what was typed as an item of this list. */
54
- matrixAddNew: (title: string) => string;
55
- /** Beside a result from another list: the list it would be ticked in. */
56
- matrixIn: (list: string) => string;
57
- /** Beside a result already held: picking it lands on it and ticks nothing. */
58
- matrixHeldTag: string;
59
53
  /** An added item's title input, named for the list it stands in and its 1-based
60
54
  * place among the added items; also what an untitled item is called. */
61
55
  matrixItemTitle: (list: string, index: number) => string;
@@ -69,8 +63,9 @@ export interface VisualStrings extends TableChromeStrings, SlashStrings {
69
63
  /** What an unset optional cell (`t?`) ghosts at rest: the `none` it prints
70
64
  * unanswered, in the product's words. */
71
65
  optionalGhost: string;
72
- /** Under a prose leaf holding more structure than it can edit (paragraphs, a list,
73
- * an island in a one-line cell), which it draws read-only rather than flatten. */
66
+ /** Under a prose leaf holding more structure than it can edit (paragraphs, a list or
67
+ * an island in a one-line leaf, an island in any subform cell), which it draws
68
+ * read-only rather than lose. */
74
69
  proseHeld: string;
75
70
  formatGroup: string;
76
71
  formatBold: string;
@@ -38,9 +38,6 @@ export const DEFAULT_VISUAL_STRINGS = {
38
38
  enumUnsetTag: 'default',
39
39
  matrixHeld: (held, total) => `${held} of ${total} held`,
40
40
  matrixAdd: (list) => (list ? `Add to ${list}…` : 'Add…'),
41
- matrixAddNew: (title) => `Add “${title}”`,
42
- matrixIn: (list) => `in ${list}`,
43
- matrixHeldTag: 'held',
44
41
  matrixItemTitle: (list, index) => `${list ? `${list} item` : 'Item'} ${index}`,
45
42
  matrixRemove: (title) => `Remove ${title}`,
46
43
  dateToday: 'Today',
@@ -105,7 +105,7 @@ export function declaredContent(v, markdown) {
105
105
  if (text === undefined)
106
106
  return undefined;
107
107
  if (markdown)
108
- return core().importMarkdown(text);
108
+ return core().importMarkdown(text).content;
109
109
  return {
110
110
  text,
111
111
  lines: text
@@ -39,7 +39,7 @@ export function tipsChannel(raw) {
39
39
  export function renderTip(markdown, onError) {
40
40
  const { importMarkdown } = core();
41
41
  try {
42
- return renderContent(importMarkdown(markdown), inlineSchema);
42
+ return renderContent(importMarkdown(markdown).content, inlineSchema);
43
43
  }
44
44
  catch (e) {
45
45
  reportError(onError, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/svelte",
3
- "version": "0.18.0",
3
+ "version": "0.20.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.122.0-0",
72
+ "@quillmark/wasm": ">=0.124.0-0",
73
73
  "svelte": "^5.33.0"
74
74
  },
75
75
  "dependencies": {