@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.
- package/README.md +16 -12
- package/THEMING.md +48 -25
- package/dist/core/address.d.ts +42 -7
- package/dist/core/address.js +49 -21
- package/dist/core/bloom.d.ts +5 -5
- package/dist/core/bloom.js +8 -8
- package/dist/core/codec/anchor.d.ts +1 -1
- package/dist/core/codec/anchor.js +1 -1
- package/dist/core/codec/atoms.d.ts +10 -0
- package/dist/core/codec/atoms.js +78 -0
- package/dist/core/codec/clipboard.d.ts +59 -0
- package/dist/core/codec/clipboard.js +202 -0
- package/dist/core/codec/code.d.ts +1 -1
- package/dist/core/codec/code.js +4 -4
- package/dist/core/codec/decode.d.ts +1 -1
- package/dist/core/codec/decode.js +8 -8
- package/dist/core/codec/encode.d.ts +4 -4
- package/dist/core/codec/encode.js +14 -11
- package/dist/core/codec/field.d.ts +22 -27
- package/dist/core/codec/field.js +33 -32
- package/dist/core/codec/index.js +5 -8
- package/dist/core/codec/inputrules.js +56 -18
- package/dist/core/codec/islands.d.ts +11 -7
- package/dist/core/codec/islands.js +16 -10
- package/dist/core/codec/keymap.d.ts +5 -6
- package/dist/core/codec/keymap.js +8 -7
- package/dist/core/codec/lists.d.ts +3 -3
- package/dist/core/codec/lists.js +32 -13
- package/dist/core/codec/marks.d.ts +1 -1
- package/dist/core/codec/marks.js +1 -1
- package/dist/core/codec/positions.js +1 -1
- package/dist/core/codec/prose.css +266 -228
- package/dist/core/codec/schema.js +4 -4
- package/dist/core/codec/slash.d.ts +39 -41
- package/dist/core/codec/slash.js +0 -0
- package/dist/core/codec/table-view.d.ts +12 -16
- package/dist/core/codec/table-view.js +488 -292
- package/dist/core/codec/table.d.ts +42 -15
- package/dist/core/codec/table.js +73 -27
- package/dist/core/errors.d.ts +17 -7
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +6 -5
- package/dist/core/lifecycle.d.ts +21 -5
- package/dist/core/lifecycle.js +34 -8
- package/dist/core/rebind.svelte.d.ts +18 -4
- package/dist/core/rebind.svelte.js +30 -12
- package/dist/core/teardown.d.ts +1 -1
- package/dist/core/teardown.js +1 -1
- package/dist/core/theme.css +173 -58
- package/dist/preset/index.css +1 -1
- package/dist/preset/recipes.css +79 -30
- package/dist/preset/scale.css +40 -28
- package/dist/preview/Preview.svelte +22 -19
- package/dist/preview/Preview.svelte.d.ts +8 -8
- package/dist/preview/bridge.d.ts +6 -4
- package/dist/preview/bridge.js +19 -9
- package/dist/preview/controller.d.ts +13 -6
- package/dist/preview/controller.js +8 -5
- package/dist/preview/geometry.d.ts +17 -2
- package/dist/preview/geometry.js +21 -1
- package/dist/preview/index.d.ts +1 -0
- package/dist/preview/index.js +9 -2
- package/dist/preview/overlay.d.ts +2 -1
- package/dist/preview/overlay.js +26 -11
- package/dist/preview/paint.js +19 -17
- package/dist/visual/ArrayField.svelte +103 -83
- package/dist/visual/ArrayField.svelte.d.ts +5 -4
- package/dist/visual/BooleanField.svelte +8 -6
- package/dist/visual/BooleanField.svelte.d.ts +2 -2
- package/dist/visual/Card.svelte +161 -333
- package/dist/visual/Card.svelte.d.ts +5 -4
- package/dist/visual/CardControls.svelte +1 -1
- package/dist/visual/DateField.svelte +19 -19
- package/dist/visual/DateField.svelte.d.ts +3 -3
- package/dist/visual/DiagnosticList.svelte +2 -2
- package/dist/visual/EnumField.svelte +48 -28
- package/dist/visual/EnumField.svelte.d.ts +5 -4
- package/dist/visual/Field.svelte +207 -132
- package/dist/visual/Field.svelte.d.ts +11 -7
- package/dist/visual/FieldHint.svelte +79 -48
- package/dist/visual/FieldHint.svelte.d.ts +1 -1
- package/dist/visual/FieldLabel.svelte +8 -8
- package/dist/visual/FormatPopover.svelte +82 -35
- package/dist/visual/NumberField.svelte +5 -5
- package/dist/visual/NumberField.svelte.d.ts +1 -1
- package/dist/visual/ObjectField.svelte +28 -9
- package/dist/visual/ObjectField.svelte.d.ts +4 -2
- package/dist/visual/ProseArrayElement.svelte +12 -19
- package/dist/visual/ProseArrayElement.svelte.d.ts +1 -2
- package/dist/visual/ProseField.svelte +62 -85
- package/dist/visual/ProseField.svelte.d.ts +14 -17
- package/dist/visual/SlashMenu.svelte +42 -16
- package/dist/visual/TextField.svelte +5 -5
- package/dist/visual/TextField.svelte.d.ts +1 -1
- package/dist/visual/TipsCard.svelte +43 -28
- package/dist/visual/VisualEditor.svelte +18 -19
- package/dist/visual/VisualEditor.svelte.d.ts +2 -3
- package/dist/visual/VisualEditorInner.svelte +251 -184
- package/dist/visual/VisualEditorInner.svelte.d.ts +2 -3
- package/dist/visual/controls.css +85 -38
- package/dist/visual/diagnostics.d.ts +13 -21
- package/dist/visual/diagnostics.js +7 -19
- package/dist/visual/domid.js +3 -3
- package/dist/visual/ext.d.ts +1 -1
- package/dist/visual/ext.js +1 -1
- package/dist/visual/icons/nodes.d.ts +3 -0
- package/dist/visual/icons/nodes.js +2 -1
- package/dist/visual/index.d.ts +1 -0
- package/dist/visual/index.js +10 -3
- package/dist/visual/leaves.d.ts +47 -0
- package/dist/visual/leaves.js +31 -0
- package/dist/visual/links.d.ts +24 -0
- package/dist/visual/links.js +67 -0
- package/dist/visual/props.d.ts +33 -12
- package/dist/visual/signals.d.ts +6 -6
- package/dist/visual/strings.d.ts +14 -19
- package/dist/visual/strings.js +5 -7
- package/dist/visual/structure.d.ts +24 -17
- package/dist/visual/structure.js +8 -8
- package/dist/visual/synced.svelte.d.ts +1 -1
- package/dist/visual/synced.svelte.js +4 -4
- package/dist/visual/tips.d.ts +4 -2
- package/dist/visual/tips.js +7 -4
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The PM schema: the codec
|
|
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
|
|
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
|
|
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
|
|
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
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* the
|
|
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:
|
|
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
|
|
20
|
-
*
|
|
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
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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(
|
|
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
|
|
60
|
-
* declines
|
|
61
|
-
*
|
|
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(
|
|
68
|
-
/** Move the keyboard cursor onto `
|
|
69
|
-
* highlight has
|
|
70
|
-
export declare function focusSlashItem(view: EditorView,
|
|
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
|
|
73
|
-
* own edit. One rather than two because two would be two commits, two undo
|
|
74
|
-
* two recompiles for one gesture; the
|
|
75
|
-
* state and its steps are replayed onto the same transaction, which is
|
|
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,
|
|
76
|
+
export declare function runSlashItem(view: EditorView, name: string): void;
|
|
79
77
|
export {};
|
package/dist/core/codec/slash.js
CHANGED
|
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:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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
|
|
15
|
-
* (Backspace, Alt+arrows), so the name is the gesture
|
|
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
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
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
|