@quillmark/svelte 0.1.1 → 0.3.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 (124) hide show
  1. package/README.md +16 -12
  2. package/THEMING.md +48 -25
  3. package/dist/core/address.d.ts +42 -7
  4. package/dist/core/address.js +49 -21
  5. package/dist/core/bloom.d.ts +5 -5
  6. package/dist/core/bloom.js +8 -8
  7. package/dist/core/codec/anchor.d.ts +1 -1
  8. package/dist/core/codec/anchor.js +1 -1
  9. package/dist/core/codec/atoms.d.ts +10 -0
  10. package/dist/core/codec/atoms.js +78 -0
  11. package/dist/core/codec/clipboard.d.ts +59 -0
  12. package/dist/core/codec/clipboard.js +202 -0
  13. package/dist/core/codec/code.d.ts +1 -1
  14. package/dist/core/codec/code.js +4 -4
  15. package/dist/core/codec/decode.d.ts +1 -1
  16. package/dist/core/codec/decode.js +8 -8
  17. package/dist/core/codec/encode.d.ts +4 -4
  18. package/dist/core/codec/encode.js +14 -11
  19. package/dist/core/codec/field.d.ts +22 -27
  20. package/dist/core/codec/field.js +33 -32
  21. package/dist/core/codec/index.js +5 -8
  22. package/dist/core/codec/inputrules.js +56 -18
  23. package/dist/core/codec/islands.d.ts +11 -7
  24. package/dist/core/codec/islands.js +16 -10
  25. package/dist/core/codec/keymap.d.ts +5 -6
  26. package/dist/core/codec/keymap.js +8 -7
  27. package/dist/core/codec/lists.d.ts +3 -3
  28. package/dist/core/codec/lists.js +32 -13
  29. package/dist/core/codec/marks.d.ts +1 -1
  30. package/dist/core/codec/marks.js +1 -1
  31. package/dist/core/codec/positions.js +1 -1
  32. package/dist/core/codec/prose.css +266 -228
  33. package/dist/core/codec/schema.js +4 -4
  34. package/dist/core/codec/slash.d.ts +39 -41
  35. package/dist/core/codec/slash.js +0 -0
  36. package/dist/core/codec/table-view.d.ts +12 -16
  37. package/dist/core/codec/table-view.js +488 -292
  38. package/dist/core/codec/table.d.ts +42 -15
  39. package/dist/core/codec/table.js +73 -27
  40. package/dist/core/errors.d.ts +17 -7
  41. package/dist/core/index.d.ts +1 -1
  42. package/dist/core/index.js +6 -5
  43. package/dist/core/lifecycle.d.ts +21 -5
  44. package/dist/core/lifecycle.js +34 -8
  45. package/dist/core/rebind.svelte.d.ts +18 -4
  46. package/dist/core/rebind.svelte.js +30 -12
  47. package/dist/core/teardown.d.ts +1 -1
  48. package/dist/core/teardown.js +1 -1
  49. package/dist/core/theme.css +173 -58
  50. package/dist/preset/index.css +1 -1
  51. package/dist/preset/recipes.css +79 -30
  52. package/dist/preset/scale.css +40 -28
  53. package/dist/preview/Preview.svelte +22 -19
  54. package/dist/preview/Preview.svelte.d.ts +8 -8
  55. package/dist/preview/bridge.d.ts +6 -4
  56. package/dist/preview/bridge.js +19 -9
  57. package/dist/preview/controller.d.ts +13 -6
  58. package/dist/preview/controller.js +8 -5
  59. package/dist/preview/geometry.d.ts +17 -2
  60. package/dist/preview/geometry.js +21 -1
  61. package/dist/preview/index.d.ts +1 -0
  62. package/dist/preview/index.js +9 -2
  63. package/dist/preview/overlay.d.ts +2 -1
  64. package/dist/preview/overlay.js +26 -11
  65. package/dist/preview/paint.js +19 -17
  66. package/dist/visual/ArrayField.svelte +103 -83
  67. package/dist/visual/ArrayField.svelte.d.ts +5 -4
  68. package/dist/visual/BooleanField.svelte +8 -6
  69. package/dist/visual/BooleanField.svelte.d.ts +2 -2
  70. package/dist/visual/Card.svelte +161 -333
  71. package/dist/visual/Card.svelte.d.ts +5 -4
  72. package/dist/visual/CardControls.svelte +1 -1
  73. package/dist/visual/DateField.svelte +19 -19
  74. package/dist/visual/DateField.svelte.d.ts +3 -3
  75. package/dist/visual/DiagnosticList.svelte +2 -2
  76. package/dist/visual/EnumField.svelte +48 -28
  77. package/dist/visual/EnumField.svelte.d.ts +5 -4
  78. package/dist/visual/Field.svelte +207 -132
  79. package/dist/visual/Field.svelte.d.ts +11 -7
  80. package/dist/visual/FieldHint.svelte +79 -48
  81. package/dist/visual/FieldHint.svelte.d.ts +1 -1
  82. package/dist/visual/FieldLabel.svelte +8 -8
  83. package/dist/visual/FormatPopover.svelte +82 -35
  84. package/dist/visual/NumberField.svelte +5 -5
  85. package/dist/visual/NumberField.svelte.d.ts +1 -1
  86. package/dist/visual/ObjectField.svelte +28 -9
  87. package/dist/visual/ObjectField.svelte.d.ts +4 -2
  88. package/dist/visual/ProseArrayElement.svelte +12 -19
  89. package/dist/visual/ProseArrayElement.svelte.d.ts +1 -2
  90. package/dist/visual/ProseField.svelte +62 -85
  91. package/dist/visual/ProseField.svelte.d.ts +14 -17
  92. package/dist/visual/SlashMenu.svelte +42 -16
  93. package/dist/visual/TextField.svelte +5 -5
  94. package/dist/visual/TextField.svelte.d.ts +1 -1
  95. package/dist/visual/TipsCard.svelte +43 -28
  96. package/dist/visual/VisualEditor.svelte +18 -19
  97. package/dist/visual/VisualEditor.svelte.d.ts +2 -3
  98. package/dist/visual/VisualEditorInner.svelte +251 -184
  99. package/dist/visual/VisualEditorInner.svelte.d.ts +2 -3
  100. package/dist/visual/controls.css +85 -38
  101. package/dist/visual/diagnostics.d.ts +13 -21
  102. package/dist/visual/diagnostics.js +7 -19
  103. package/dist/visual/domid.js +3 -3
  104. package/dist/visual/ext.d.ts +1 -1
  105. package/dist/visual/ext.js +1 -1
  106. package/dist/visual/icons/nodes.d.ts +3 -0
  107. package/dist/visual/icons/nodes.js +2 -1
  108. package/dist/visual/index.d.ts +1 -0
  109. package/dist/visual/index.js +10 -3
  110. package/dist/visual/leaves.d.ts +47 -0
  111. package/dist/visual/leaves.js +31 -0
  112. package/dist/visual/links.d.ts +24 -0
  113. package/dist/visual/links.js +67 -0
  114. package/dist/visual/props.d.ts +33 -12
  115. package/dist/visual/signals.d.ts +6 -6
  116. package/dist/visual/strings.d.ts +14 -19
  117. package/dist/visual/strings.js +5 -7
  118. package/dist/visual/structure.d.ts +24 -17
  119. package/dist/visual/structure.js +8 -8
  120. package/dist/visual/synced.svelte.d.ts +1 -1
  121. package/dist/visual/synced.svelte.js +4 -4
  122. package/dist/visual/tips.d.ts +4 -2
  123. package/dist/visual/tips.js +7 -4
  124. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- // The PM schema: the codec OWNS it; decode/encode target it. Nodes mirror the
1
+ // The PM schema: the codec owns it; decode/encode target it. Nodes mirror the
2
2
  // content block kinds (para/heading/code/rule/island) and its container nesting
3
3
  // (list_item/quote → lists/blockquote); marks mirror the content formatting set.
4
4
  // Each of the three open sets gets an inert carrier so an unrecognized value
@@ -6,7 +6,7 @@
6
6
  // and the `unknown_container` node. `blockSchema` is the full field; `inlineSchema`
7
7
  // is the constrained single-textblock form for `richtext(inline)` / `plaintext`
8
8
  // (one paragraph, no block split, no containers, no islands): same decode/lower/
9
- // position machinery, narrower shape. Anchors are NOT marks here (decorations).
9
+ // position machinery, narrower shape. Anchors are not marks here (decorations).
10
10
  import { Schema } from 'prosemirror-model';
11
11
  import { islandBlockSpec, islandInlineSpec } from './islands.js';
12
12
  // ── Marks (shared by both schemas; plaintext mounts none) ───────────────────
@@ -40,10 +40,10 @@ const marks = {
40
40
  const blockNodes = {
41
41
  doc: { content: 'block+' },
42
42
  // `unknown` carries a line `kind` this build does not know (`{ kind, attrs }`,
43
- // else null). A paragraph IS how such a line renders, so the carrier is an
43
+ // else null). A paragraph is how such a line renders, so the carrier is an
44
44
  // attribute rather than a node type: every paragraph command already reaches it,
45
45
  // and retyping it to a heading or a list drops the attribute: an explicit
46
- // conversion, which is the one place the unknown kind SHOULD be lost.
46
+ // conversion, which is the one place the unknown kind should be lost.
47
47
  paragraph: {
48
48
  content: 'inline*',
49
49
  group: 'block',
@@ -1,43 +1,43 @@
1
1
  import { Plugin, type Command } from 'prosemirror-state';
2
2
  import type { EditorView } from 'prosemirror-view';
3
3
  import { type RangeAnchor } from './anchor.js';
4
- /** One offer in the menu: what the chrome draws, and what a pick names. */
5
- export interface SlashItem {
6
- id: string;
7
- label: string;
8
- }
9
- /** The menu as the chrome sees it: the filtered offers, the keyboard's cursor, and
10
- * the trigger's anchor to hang off. `undefined` is a closed menu. */
4
+ /** The menu as the chrome sees it: the command names the query matched, the keyboard's
5
+ * cursor, and the trigger's anchor to hang off. `undefined` is a closed menu.
6
+ *
7
+ * An empty `items` is a live trigger with nothing to offer, and nothing is drawn over
8
+ * it. The run is the shape of the text (a `/` at a boundary, no whitespace since) and
9
+ * the menu the shape of the match; splitting the two is what lets a query typed past
10
+ * the last match narrow back into one. */
11
11
  export interface SlashState {
12
- items: SlashItem[];
12
+ items: string[];
13
13
  index: number;
14
14
  query: string;
15
15
  /** The trigger's caret to hang off, live rather than measured (`anchor.ts`): an
16
16
  * open menu outlives any one scroll position of the leaf. */
17
17
  anchor: RangeAnchor;
18
18
  }
19
- /** The menu's wording. Each label is also its own search key (§`filterItems`), so a
20
- * translated menu filters in the language it is displayed in. */
19
+ /** The menu's wording, which is its accessible name and nothing else: the offers are
20
+ * command names, and a name is not translated. */
21
21
  export interface SlashStrings {
22
22
  slashLabel: string;
23
- slashTable: string;
24
- slashBulletList: string;
25
- slashOrderedList: string;
26
23
  }
27
24
  /** The package's English, beside the surface that draws it: the same rule the island
28
25
  * chrome's wording follows, and the visual `strings` set extends both. */
29
26
  export declare const DEFAULT_SLASH_STRINGS: SlashStrings;
30
- /** The menu's offers, in order, from a wording. The set is the CONTAINERS: a construct
31
- * that opens a place the caret then lives in. A construct that retypes the block the
32
- * caret is already in (a heading, a quote, a code block, a divider) is the
33
- * shorthand's, not the menu's. The island is first, being the one with no
34
- * shorthand at all. */
35
- export declare function slashItems(s: SlashStrings): SlashItem[];
36
- /** The query filter: a substring of the LABEL, or a prefix of the id. The label is
37
- * what the user reads, so it is the primary key; the id catches the shorthands a
38
- * label does not carry (`/h1`, `/ul` never having been words). Both
39
- * case-insensitive; an empty query offers everything. */
40
- export declare function filterItems(items: SlashItem[], query: string): SlashItem[];
27
+ /**
28
+ * The vocabulary, in menu order: the names `SLASH_COMMANDS` is keyed by, read off the
29
+ * table itself so an offer and its pick cannot disagree.
30
+ *
31
+ * The set is what no shorthand reaches. A list is `- ` / `1. `, a heading `# `, a quote
32
+ * `> `, a rule `---`, a code block a fence: a shorthand fires where the caret already
33
+ * is, and a second door onto the same construct is a second thing to keep true. A table
34
+ * has no prefix a rule can fire on (a pipe row is not one), so it is the menu's alone.
35
+ */
36
+ export declare function slashItems(): string[];
37
+ /** The query filter: a case-insensitive prefix of the name, which is how a command line
38
+ * completes. An empty query offers everything, and the vocabulary's order survives, so
39
+ * the menu never reorders under a keystroke. */
40
+ export declare function filterItems(items: string[], query: string): string[];
41
41
  /** The live trigger: where the `/` sits, what has been typed after it, and which
42
42
  * offer the keyboard is on. */
43
43
  interface SlashRun {
@@ -51,29 +51,27 @@ interface SlashRun {
51
51
  * below and close the menu without a listener of their own. A dismissal edits no
52
52
  * text; only a pick does, and it consumes exactly the run.
53
53
  */
54
- export declare function slashPlugin(opts: {
55
- items: () => SlashItem[];
56
- onState: (state: SlashState | undefined) => void;
57
- }): Plugin<SlashRun | null>;
54
+ export declare function slashPlugin(onState: (state: SlashState | undefined) => void): Plugin<SlashRun | null>;
58
55
  /**
59
- * The menu's keys, the INNERMOST link of the leaf's chain (`keymap.ts`). Every one
60
- * declines when no run is live, so a body with no menu open keeps Enter, Escape and
61
- * the arrows exactly as it had them.
56
+ * The menu's keys, the innermost link of the leaf's chain (`keymap.ts`). Every one
57
+ * declines on an empty offer list rather than on a dead run (§`SlashState`): a key an
58
+ * undrawn run claimed would be a key lost to a surface nobody can see. So a body with
59
+ * no menu on screen keeps Enter, Escape and the arrows exactly as it had them.
62
60
  *
63
61
  * Escape is the contended key: a table gives it three claimants (this menu, the
64
62
  * format popover, an island selection). Innermost first, and this is the innermost
65
63
  * of the three that can be open over a caret in text.
66
64
  */
67
- export declare function slashKeymap(items: () => SlashItem[]): Record<string, Command>;
68
- /** Move the keyboard cursor onto `id`: what a pointer entering an item calls, so the
69
- * highlight has ONE lane rather than a hover painting a second one. */
70
- export declare function focusSlashItem(view: EditorView, id: string, items: SlashItem[]): void;
65
+ export declare function slashKeymap(): Record<string, Command>;
66
+ /** Move the keyboard cursor onto `name`: what a pointer entering an item calls, so the
67
+ * highlight has one lane rather than a hover painting a second one. */
68
+ export declare function focusSlashItem(view: EditorView, name: string): void;
71
69
  /**
72
- * Run an offer: ONE transaction that deletes the trigger run and applies the item's
73
- * own edit. One rather than two because two would be two commits, two undo steps and
74
- * two recompiles for one gesture; the item's command is built against the post-delete
75
- * state and its steps are replayed onto the same transaction, which is exactly what
76
- * they were computed for.
70
+ * Run a command: one transaction that deletes the trigger run and applies the
71
+ * command's own edit. One rather than two because two would be two commits, two undo
72
+ * steps and two recompiles for one gesture; the command is built against the
73
+ * post-delete state and its steps are replayed onto the same transaction, which is
74
+ * exactly what they were computed for.
77
75
  */
78
- export declare function runSlashItem(view: EditorView, id: string): void;
76
+ export declare function runSlashItem(view: EditorView, name: string): void;
79
77
  export {};
Binary file
@@ -1,7 +1,7 @@
1
1
  import { EditorView, type NodeViewConstructor } from 'prosemirror-view';
2
- /** Everything the island's chrome says. Accessible names, not decoration: a handle
3
- * is a bar and a seam is a glyph, so an untranslated one reads the wrong language
4
- * rather than merely inconsistent (VISUAL_EDITOR §"What the surface says"). */
2
+ /** Everything the island's chrome says. Accessible names, not decoration: every
3
+ * control here is a bar, so an untranslated one reads the wrong language rather than
4
+ * merely inconsistent (VISUAL_EDITOR §"What the surface says"). */
5
5
  export interface TableChromeStrings {
6
6
  /** The island's own name, on the wrapper. */
7
7
  tableLabel: string;
@@ -11,23 +11,19 @@ export interface TableChromeStrings {
11
11
  tableColumn: (index: number) => string;
12
12
  /** A cell's accessible name: nothing else names a nested leaf. */
13
13
  tableCell: (row: string, column: string) => string;
14
- /** A handle's name. It SELECTS its line, and the verbs are then the selection's
15
- * (Backspace, Alt+arrows), so the name is the gesture and not a menu's. */
14
+ /** A grip's name. It selects its line, and the verbs are then the selection's
15
+ * (Backspace, Alt+arrows) or the drag's, so the name is the gesture. Row 0 takes a
16
+ * name of its own for the reason it takes one above: the gesture is every other
17
+ * row's, but the line it names is still the header and not "row 0". */
18
+ tableSelectHeaderRow: string;
16
19
  tableSelectRow: (index: number) => string;
17
20
  tableSelectColumn: (index: number) => string;
18
- /** The corner's, whose line is the whole table. */
19
- tableSelectTable: string;
20
- /** A seam's, named by the line it would open rather than by a neighbour and a
21
- * side: "insert row 3" is one fact where "insert below row 2" is two. */
22
- tableInsertRow: (index: number) => string;
23
- tableInsertColumn: (index: number) => string;
24
- tableAlignDefault: string;
25
- tableAlignLeft: string;
26
- tableAlignCenter: string;
27
- tableAlignRight: string;
21
+ /** The two trailing bars, each of which grows the table along its own axis. */
22
+ tableAddRow: string;
23
+ tableAddColumn: string;
28
24
  }
29
25
  /**
30
- * The package's English for the island chrome. It lives HERE, beside the surface
26
+ * The package's English for the island chrome. It lives here, beside the surface
31
27
  * that draws it, rather than in the visual tier's table: the codec mounts this
32
28
  * chrome and a consumer reaching `createField` directly gets wording with it. The
33
29
  * visual `strings` set extends this one, so a consumer overrides these keys beside