@nldd/design-system 0.8.86 → 0.8.87
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/custom-elements.json +660 -142
- package/dist/components/actions/icon-button/icon-button.d.ts +2 -2
- package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.js +3 -3
- package/dist/components/actions/icon-button/icon-button.js.map +1 -1
- package/dist/components/components.js +1140 -243
- package/dist/components/content/avatar/avatar.d.ts +6 -6
- package/dist/components/content/avatar/avatar.d.ts.map +1 -1
- package/dist/components/content/avatar/avatar.js +9 -9
- package/dist/components/content/avatar/avatar.js.map +1 -1
- package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +4 -0
- package/dist/components/content/icon/icon-aliases.js.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.js +3 -26
- package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
- package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
- package/dist/components/content/icon/icon-registry.js +2 -0
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/icon/icon.d.ts +2 -2
- package/dist/components/content/icon/icon.d.ts.map +1 -1
- package/dist/components/content/icon/icon.js +3 -3
- package/dist/components/content/icon/icon.js.map +1 -1
- package/dist/components/content/icon/icon.styles.d.ts.map +1 -1
- package/dist/components/content/icon/icon.styles.js +8 -2
- package/dist/components/content/icon/icon.styles.js.map +1 -1
- package/dist/components/content/rich-text/rich-text.d.ts +7 -6
- package/dist/components/content/rich-text/rich-text.d.ts.map +1 -1
- package/dist/components/content/rich-text/rich-text.js +8 -7
- package/dist/components/content/rich-text/rich-text.js.map +1 -1
- package/dist/components/content/text/text.d.ts +2 -2
- package/dist/components/content/text/text.js +3 -3
- package/dist/components/content/title/title.d.ts +5 -5
- package/dist/components/content/title/title.d.ts.map +1 -1
- package/dist/components/content/title/title.js +6 -6
- package/dist/components/content/title/title.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.d.ts +2 -2
- package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.js +4 -4
- package/dist/components/content/tooltip/tooltip.js.map +1 -1
- package/dist/components/{dist-C09E9-dJ.js → dist-B_Mnmrj4.js} +1 -1
- package/dist/components/{dist-CjaG8dOI.js → dist-ByH8hQze.js} +2 -2
- package/dist/components/{dist-BB7TxeMK.js → dist-CRwuSgMM.js} +2 -2
- package/dist/components/{dist-la_b3ZSq.js → dist-CSrO_mYe.js} +1 -1
- package/dist/components/{dist-762GHPyH.js → dist-CX3DK4i7.js} +3 -3
- package/dist/components/{dist-DZoFKUO-.js → dist-CbCO0WCd.js} +1 -1
- package/dist/components/{dist-B_3OW7pC.js → dist-CgDuh26K.js} +1 -1
- package/dist/components/{dist-DaavuU6W.js → dist-DXZ-cFAl.js} +2 -2
- package/dist/components/{dist-CRsR6ckU.js → dist-LX8LuMac.js} +1 -1
- package/dist/components/{dist-BJI4-6iQ.js → dist-eVFegyjM.js} +1 -1
- package/dist/components/{dist-C6gnorjP.js → dist-fIxe0l7k.js} +9 -1
- package/dist/components/{icon-Cd4BloIM.js → icon-C_zwJZ_g.js} +14 -4
- package/dist/components/{icon-button-CXN0yaVx.js → icon-button-CEz4MB9H.js} +10 -10
- package/dist/components/inputs/code-editor/code-editor.styles.js +2 -2
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts +3 -5
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js +30 -44
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotations.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotations.js +31 -5
- package/dist/components/inputs/text-editor/text-editor.annotations.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts +14 -2
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.commands.js +115 -36
- package/dist/components/inputs/text-editor/text-editor.commands.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.cursor.d.ts +7 -0
- package/dist/components/inputs/text-editor/text-editor.cursor.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.cursor.js +207 -0
- package/dist/components/inputs/text-editor/text-editor.cursor.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.d.ts +65 -13
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.emphasis.d.ts +32 -0
- package/dist/components/inputs/text-editor/text-editor.emphasis.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.emphasis.js +229 -0
- package/dist/components/inputs/text-editor/text-editor.emphasis.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.js +177 -18
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.links.d.ts +8 -0
- package/dist/components/inputs/text-editor/text-editor.links.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.links.js +30 -4
- package/dist/components/inputs/text-editor/text-editor.links.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.js +52 -18
- package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts +78 -11
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.js +190 -41
- package/dist/components/inputs/text-editor/text-editor.mentions.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts +0 -2
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js +21 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.js +11 -10
- package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.syntax.d.ts +9 -0
- package/dist/components/inputs/text-editor/text-editor.syntax.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.syntax.js +20 -0
- package/dist/components/inputs/text-editor/text-editor.syntax.js.map +1 -0
- package/dist/components/layout/page-sections/page-section-controls.d.ts +0 -70
- package/dist/components/layout/page-sections/page-section-controls.d.ts.map +1 -1
- package/dist/components/layout/page-sections/page-section-controls.js +0 -3
- package/dist/components/layout/page-sections/page-section-controls.js.map +1 -1
- package/dist/components/layout/sheet/sheet.d.ts +3 -7
- package/dist/components/layout/sheet/sheet.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.js +4 -18
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.js +0 -4
- package/dist/components/layout/sheet/sheet.styles.js.map +1 -1
- package/dist/components/layout/sheet/sheet.template.js +2 -2
- package/dist/components/layout/sheet/sheet.template.js.map +1 -1
- package/dist/components/layout/window/window.d.ts +2 -4
- package/dist/components/layout/window/window.d.ts.map +1 -1
- package/dist/components/layout/window/window.js +4 -14
- package/dist/components/layout/window/window.js.map +1 -1
- package/dist/components/layout/window/window.template.d.ts.map +1 -1
- package/dist/components/layout/window/window.template.js +2 -2
- package/dist/components/layout/window/window.template.js.map +1 -1
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.d.ts +2 -2
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.js +3 -3
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.d.ts +2 -2
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.js +3 -3
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.d.ts +2 -2
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.js +3 -3
- package/dist/components/lists-and-tables/list/list.d.ts +4 -2
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +23 -5
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js.map +1 -1
- package/dist/components/navigation/link/link.d.ts +2 -2
- package/dist/components/navigation/link/link.d.ts.map +1 -1
- package/dist/components/navigation/link/link.js +3 -2
- package/dist/components/navigation/link/link.js.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.d.ts +3 -3
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.d.ts.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js +4 -4
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.d.ts +8 -0
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.js +14 -0
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.styles.js +22 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.styles.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.template.js +6 -2
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.template.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts +3 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js +5 -0
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.js +1 -0
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.js.map +1 -1
- package/dist/favicon.svg +8 -2
- package/dist/nldd.min.js +525 -496
- package/dist/types/vue.d.ts +31 -23
- package/package.json +1 -1
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
import { autocompletion, completionStatus, startCompletion, } from '@codemirror/autocomplete';
|
|
2
2
|
import { EditorView } from '@codemirror/view';
|
|
3
|
-
|
|
3
|
+
import { enclosingNamed } from './text-editor.syntax.js';
|
|
4
|
+
import '../../content/avatar/avatar.js';
|
|
5
|
+
import '../../content/icon/icon.js';
|
|
6
|
+
/* Typeaheads: a trigger character opens a list of candidates the consumer
|
|
7
|
+
* supplies, and choosing one writes something in place of the trigger and the
|
|
8
|
+
* query. The editor is headless and knows no users, channels or emoji; it owns
|
|
9
|
+
* the interaction (the popup, the keys, the accessibility) and the consumer
|
|
10
|
+
* owns the data and, if it wants, what gets inserted (#200, #204).
|
|
11
|
+
*
|
|
12
|
+
* The @-mention is the built-in one: it inserts a markdown-compatible token
|
|
13
|
+
* that degrades to a plain link outside the editor, and the token rendering
|
|
14
|
+
* lives in the markdown decoration layer. */
|
|
15
|
+
/** The query being typed: a trigger at the start of the line or after
|
|
16
|
+
* whitespace, followed by name characters, up to the caret. Anchored that way
|
|
17
|
+
* so a trigger inside a word (an e-mail address, `piet@sam`) stays a plain
|
|
18
|
+
* character. The name class is ASCII for now; widening it changes what a
|
|
19
|
+
* source receives and is its own change. */
|
|
20
|
+
const queryPatterns = new Map();
|
|
21
|
+
function queryPattern(triggers) {
|
|
22
|
+
const chars = Array.from(new Set(triggers.filter((t) => t.length === 1 && !/[\s\w]/.test(t)))).sort().join('');
|
|
23
|
+
if (!chars)
|
|
24
|
+
return null;
|
|
25
|
+
let pattern = queryPatterns.get(chars);
|
|
26
|
+
if (!pattern) {
|
|
27
|
+
pattern = new RegExp(`(^|\\s)([${chars.replace(/[\\\]^-]/g, '\\$&')}])([\\w.-]*)$`);
|
|
28
|
+
queryPatterns.set(chars, pattern);
|
|
29
|
+
}
|
|
30
|
+
return pattern;
|
|
31
|
+
}
|
|
32
|
+
/** Code is quoted verbatim, so a trigger in a fenced block, an indented block
|
|
33
|
+
* or a backtick span is not a typeahead and must not open the list. */
|
|
34
|
+
const CODE_NODES = new Set(['FencedCode', 'CodeBlock', 'InlineCode']);
|
|
35
|
+
function inCode(state, pos) {
|
|
36
|
+
return enclosingNamed(state, pos, 1, CODE_NODES) !== null;
|
|
37
|
+
}
|
|
38
|
+
/** The typeahead query at `pos` for one of `triggers`, or null when the text
|
|
39
|
+
* before the caret is not one. `from` is the trigger, `query` the typed text
|
|
40
|
+
* without it. Both the completion source and the reopen-on-delete path go
|
|
41
|
+
* through this, so they cannot disagree about what counts as a query. */
|
|
42
|
+
export function typeaheadQueryAt(state, pos, triggers) {
|
|
43
|
+
const pattern = queryPattern(triggers);
|
|
44
|
+
if (!pattern)
|
|
45
|
+
return null;
|
|
46
|
+
const line = state.doc.lineAt(pos);
|
|
47
|
+
const match = pattern.exec(state.sliceDoc(line.from, pos));
|
|
48
|
+
if (!match)
|
|
49
|
+
return null;
|
|
50
|
+
const from = line.from + match.index + match[1].length;
|
|
51
|
+
if (inCode(state, from))
|
|
52
|
+
return null;
|
|
53
|
+
return { from, to: pos, query: match[3], trigger: match[2] };
|
|
54
|
+
}
|
|
4
55
|
/** Href prefix that marks a markdown link as a mention. */
|
|
5
56
|
export const MENTION_HREF_PREFIX = 'user:';
|
|
6
57
|
/** The markdown-compatible token stored for a mention (degrades to a plain link).
|
|
@@ -10,13 +61,17 @@ export const MENTION_HREF_PREFIX = 'user:';
|
|
|
10
61
|
* `]` or `)` would otherwise start a second, attacker-shaped link. The render
|
|
11
62
|
* layer reverses both via `unescapeMentionLabel` / `decodeMentionId`. */
|
|
12
63
|
export function mentionToken(candidate) {
|
|
13
|
-
const label = candidate.
|
|
64
|
+
const label = candidate.text.replace(/[[\]\\]/g, (c) => '\\' + c);
|
|
14
65
|
// encodeURIComponent leaves ( ) < > ! * ' . - _ ~ intact, but ")" closes a
|
|
15
66
|
// markdown link destination — encode the parens and angle brackets on top of it
|
|
16
67
|
// (decodeURIComponent reverses all of it).
|
|
17
68
|
const id = encodeURIComponent(candidate.id).replace(/[()<>]/g, (c) => '%' + c.charCodeAt(0).toString(16).toUpperCase());
|
|
18
69
|
return `[@${label}](${MENTION_HREF_PREFIX}${id})`;
|
|
19
70
|
}
|
|
71
|
+
/** What the built-in mention writes: the token and a space to go on typing. */
|
|
72
|
+
export function mentionInsert(candidate) {
|
|
73
|
+
return `${mentionToken(candidate)} `;
|
|
74
|
+
}
|
|
20
75
|
/** Reverse `mentionToken`'s label escaping for display. */
|
|
21
76
|
export function unescapeMentionLabel(label) {
|
|
22
77
|
return label.replace(/\\([[\]\\])/g, '$1');
|
|
@@ -31,33 +86,84 @@ export function decodeMentionId(id) {
|
|
|
31
86
|
return id;
|
|
32
87
|
}
|
|
33
88
|
}
|
|
34
|
-
function
|
|
89
|
+
function defaultInsert(trigger) {
|
|
90
|
+
return (candidate) => `${trigger}${candidate.text} `;
|
|
91
|
+
}
|
|
92
|
+
/** The avatar, icon or symbol in front of a row, or nothing. A decorative
|
|
93
|
+
* avatar: the name stands beside it as the row's text. The icon is the size of
|
|
94
|
+
* a menu item's, and the symbol takes the same box, so a list that mixes them
|
|
95
|
+
* lines up. */
|
|
96
|
+
function renderLead(completion) {
|
|
97
|
+
const { candidate } = completion;
|
|
98
|
+
if (candidate.avatar) {
|
|
99
|
+
const avatar = document.createElement('nldd-avatar');
|
|
100
|
+
avatar.setAttribute('name', candidate.text);
|
|
101
|
+
avatar.setAttribute('size', '32');
|
|
102
|
+
avatar.setAttribute('decorative', '');
|
|
103
|
+
if (candidate.avatar.src)
|
|
104
|
+
avatar.setAttribute('src', candidate.avatar.src);
|
|
105
|
+
if (candidate.avatar.type)
|
|
106
|
+
avatar.setAttribute('type', candidate.avatar.type);
|
|
107
|
+
return avatar;
|
|
108
|
+
}
|
|
109
|
+
if (candidate.icon) {
|
|
110
|
+
const icon = document.createElement('nldd-icon');
|
|
111
|
+
icon.setAttribute('name', candidate.icon);
|
|
112
|
+
icon.setAttribute('size', '20');
|
|
113
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
114
|
+
return icon;
|
|
115
|
+
}
|
|
116
|
+
if (candidate.symbol) {
|
|
117
|
+
const symbol = document.createElement('span');
|
|
118
|
+
symbol.className = 'cm-nldd-symbol';
|
|
119
|
+
symbol.textContent = candidate.symbol;
|
|
120
|
+
symbol.setAttribute('aria-hidden', 'true');
|
|
121
|
+
return symbol;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
/** A row with an avatar takes two lines: the text above, the supporting text
|
|
126
|
+
* under it, like a title cell. */
|
|
127
|
+
function rowClass(completion) {
|
|
128
|
+
return completion.candidate.avatar ? 'cm-nldd-row-avatar' : '';
|
|
129
|
+
}
|
|
130
|
+
function completionSource(getTypeaheads, onChoose) {
|
|
35
131
|
return async (context) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const source = getSource();
|
|
40
|
-
if (!source)
|
|
132
|
+
const lists = getTypeaheads();
|
|
133
|
+
const match = typeaheadQueryAt(context.state, context.pos, lists.map((t) => t.trigger));
|
|
134
|
+
if (!match)
|
|
41
135
|
return null;
|
|
42
|
-
|
|
43
|
-
|
|
136
|
+
// Every list on this trigger contributes, in the order they were given.
|
|
137
|
+
const onTrigger = lists.filter((t) => t.trigger === match.trigger);
|
|
138
|
+
const results = await Promise.all(onTrigger.map((t) => t.source(match.query)));
|
|
139
|
+
const options = [];
|
|
140
|
+
results.forEach((candidates, index) => {
|
|
141
|
+
const typeahead = onTrigger[index];
|
|
142
|
+
const insert = typeahead.insert ?? defaultInsert(match.trigger);
|
|
143
|
+
for (const candidate of candidates ?? []) {
|
|
144
|
+
options.push({
|
|
145
|
+
label: `${match.trigger}${candidate.text}`,
|
|
146
|
+
detail: candidate.supportingText,
|
|
147
|
+
candidate,
|
|
148
|
+
apply: (view, _completion, from, to) => {
|
|
149
|
+
const text = insert(candidate);
|
|
150
|
+
view.dispatch({
|
|
151
|
+
changes: { from, to, insert: text },
|
|
152
|
+
selection: { anchor: from + text.length },
|
|
153
|
+
userEvent: 'input.complete',
|
|
154
|
+
});
|
|
155
|
+
onChoose({ typeahead, trigger: match.trigger, candidate, from, to: from + text.length });
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
if (!options.length)
|
|
44
161
|
return null;
|
|
45
162
|
return {
|
|
46
163
|
from: match.from,
|
|
47
|
-
// The
|
|
164
|
+
// The sources already filtered against the query.
|
|
48
165
|
filter: false,
|
|
49
|
-
options
|
|
50
|
-
label: `@${candidate.label}`,
|
|
51
|
-
detail: candidate.detail,
|
|
52
|
-
apply: (view, _completion, from, to) => {
|
|
53
|
-
const token = mentionToken(candidate);
|
|
54
|
-
view.dispatch({
|
|
55
|
-
changes: { from, to, insert: `${token} ` },
|
|
56
|
-
selection: { anchor: from + token.length + 1 },
|
|
57
|
-
});
|
|
58
|
-
onInsert({ id: candidate.id, label: candidate.label, from, to: from + token.length });
|
|
59
|
-
},
|
|
60
|
-
})),
|
|
166
|
+
options,
|
|
61
167
|
};
|
|
62
168
|
};
|
|
63
169
|
}
|
|
@@ -76,6 +182,10 @@ const popupTheme = EditorView.theme({
|
|
|
76
182
|
fontFamily: 'var(--primitives-font-family-body)',
|
|
77
183
|
// Match the editor body (and the inserted token), not a smaller popup size.
|
|
78
184
|
fontSize: 'var(--primitives-font-size-100)',
|
|
185
|
+
// The minimum of nldd-menu, so a short list of names is not a narrow strip
|
|
186
|
+
// that changes width as you type.
|
|
187
|
+
minWidth: 'var(--primitives-area-280)',
|
|
188
|
+
boxSizing: 'border-box',
|
|
79
189
|
maxHeight: '14em',
|
|
80
190
|
// A small inset around the items, like nldd-menu.
|
|
81
191
|
margin: '0',
|
|
@@ -96,6 +206,40 @@ const popupTheme = EditorView.theme({
|
|
|
96
206
|
color: 'var(--semantics-content-color)',
|
|
97
207
|
cursor: 'default',
|
|
98
208
|
},
|
|
209
|
+
'.cm-tooltip.cm-tooltip-autocomplete > ul > li > :is(nldd-avatar, nldd-icon, .cm-nldd-symbol)': {
|
|
210
|
+
flex: 'none',
|
|
211
|
+
},
|
|
212
|
+
// The symbol takes the icon's box, so a list that mixes them lines up.
|
|
213
|
+
'.cm-nldd-symbol': {
|
|
214
|
+
display: 'inline-flex',
|
|
215
|
+
justifyContent: 'center',
|
|
216
|
+
inlineSize: '20px',
|
|
217
|
+
},
|
|
218
|
+
// Two lines next to the avatar: the text, and the supporting text under it.
|
|
219
|
+
// The avatar spans both and sits centered on them.
|
|
220
|
+
'.cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar': {
|
|
221
|
+
display: 'grid',
|
|
222
|
+
gridTemplateColumns: 'auto minmax(0, 1fr)',
|
|
223
|
+
alignContent: 'center',
|
|
224
|
+
// The row's gap is for the columns; the two lines sit right on each other.
|
|
225
|
+
rowGap: '0',
|
|
226
|
+
minHeight: 'var(--semantics-controls-md-min-size)',
|
|
227
|
+
},
|
|
228
|
+
'.cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar > nldd-avatar': {
|
|
229
|
+
gridRow: 'span 2',
|
|
230
|
+
alignSelf: 'center',
|
|
231
|
+
},
|
|
232
|
+
// Tight line heights on both lines, like a title cell: with the editor's own
|
|
233
|
+
// loose line height the row grows well past a list row.
|
|
234
|
+
'.cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar > .cm-completionLabel': {
|
|
235
|
+
gridColumn: '2',
|
|
236
|
+
font: 'var(--primitives-font-body-md-regular-tight)',
|
|
237
|
+
},
|
|
238
|
+
'.cm-tooltip.cm-tooltip-autocomplete > ul > li.cm-nldd-row-avatar > .cm-completionDetail': {
|
|
239
|
+
gridColumn: '2',
|
|
240
|
+
marginLeft: '0',
|
|
241
|
+
font: 'var(--primitives-font-body-sm-regular-tight)',
|
|
242
|
+
},
|
|
99
243
|
'.cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]': {
|
|
100
244
|
backgroundColor: 'var(--components-menu-item-is-highlighted-background-color)',
|
|
101
245
|
color: 'var(--components-menu-item-is-highlighted-content-color)',
|
|
@@ -126,26 +270,31 @@ const popupTheme = EditorView.theme({
|
|
|
126
270
|
},
|
|
127
271
|
});
|
|
128
272
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* `
|
|
273
|
+
* The typeaheads. `getTypeaheads` is read on every keystroke, so the editor can
|
|
274
|
+
* hand over its current lists; choosing a candidate writes what the list's
|
|
275
|
+
* `insert` says and calls `onChoose`. Without lists it is inert.
|
|
132
276
|
*/
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
146
|
-
export function mentions(getSource, onInsert) {
|
|
277
|
+
export function typeaheads(getTypeaheads, onChoose) {
|
|
278
|
+
// CodeMirror only opens completion while typing, not on deletion. When a
|
|
279
|
+
// backspace brings the query back into a matching state ("@anb" → "@an"),
|
|
280
|
+
// re-open the popup right away instead of waiting for the next character.
|
|
281
|
+
const reopenOnDelete = EditorView.updateListener.of((update) => {
|
|
282
|
+
if (!update.docChanged || completionStatus(update.state) !== null)
|
|
283
|
+
return;
|
|
284
|
+
if (!update.transactions.some((tr) => tr.isUserEvent('delete')))
|
|
285
|
+
return;
|
|
286
|
+
const triggers = getTypeaheads().map((t) => t.trigger);
|
|
287
|
+
if (typeaheadQueryAt(update.state, update.state.selection.main.head, triggers))
|
|
288
|
+
startCompletion(update.view);
|
|
289
|
+
});
|
|
147
290
|
return [
|
|
148
|
-
autocompletion({
|
|
291
|
+
autocompletion({
|
|
292
|
+
override: [completionSource(getTypeaheads, onChoose)],
|
|
293
|
+
icons: false,
|
|
294
|
+
// Before the row's text (50): its avatar, icon or symbol.
|
|
295
|
+
addToOptions: [{ position: 20, render: renderLead }],
|
|
296
|
+
optionClass: rowClass,
|
|
297
|
+
}),
|
|
149
298
|
reopenOnDelete,
|
|
150
299
|
popupTheme,
|
|
151
300
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.mentions.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.mentions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,eAAe,GAIf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"text-editor.mentions.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.mentions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,eAAe,GAIf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,gCAAgC,CAAC;AACxC,OAAO,4BAA4B,CAAC;AAEpC;;;;;;;;6CAQ6C;AAE7C;;;;6CAI6C;AAC7C,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAChD,SAAS,YAAY,CAAC,QAA2B;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KA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,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvD,IAAI,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;YAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9G,CAAC,CAAC,CAAC;IACH,OAAO;QACN,cAAc,CAAC;YACd,QAAQ,EAAE,CAAC,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;YACrD,KAAK,EAAE,KAAK;YACZ,0DAA0D;YAC1D,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;YACpD,WAAW,EAAE,QAAQ;SACrB,CAAC;QACF,cAAc;QACd,UAAU;KACV,CAAC;AACH,CAAC"}
|
|
@@ -6,7 +6,5 @@ export interface RenumberChange {
|
|
|
6
6
|
/** Minimal digit-only changes that renumber every ordered list in `doc` so its
|
|
7
7
|
* items run in sequence. Empty when everything is already in order. */
|
|
8
8
|
export declare function renumberOrderedLists(doc: string): RenumberChange[];
|
|
9
|
-
/** Renumbers ordered lists in the same transaction as the edit that disturbed them,
|
|
10
|
-
* so it's one atomic (single-undo) step and the caret/selection maps through it. */
|
|
11
9
|
export declare const orderedListRenumber: import("@codemirror/state").Extension;
|
|
12
10
|
//# sourceMappingURL=text-editor.ordered-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.ordered-list.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.ordered-list.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CACf;AAED;wEACwE;AACxE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,EAAE,CAoElE;
|
|
1
|
+
{"version":3,"file":"text-editor.ordered-list.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.ordered-list.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CACf;AAED;wEACwE;AACxE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,EAAE,CAoElE;AAuBD,eAAO,MAAM,mBAAmB,uCAK9B,CAAC"}
|
|
@@ -95,8 +95,28 @@ export function renumberOrderedLists(doc) {
|
|
|
95
95
|
}
|
|
96
96
|
/** Renumbers ordered lists in the same transaction as the edit that disturbed them,
|
|
97
97
|
* so it's one atomic (single-undo) step and the caret/selection maps through it. */
|
|
98
|
+
/** Whether this change can have disturbed any numbering. It can when it adds or
|
|
99
|
+
* removes a line break, or when a line it touches is (or was) an ordered item.
|
|
100
|
+
* Typing inside a paragraph cannot, and that is the common case: without this
|
|
101
|
+
* test every keystroke read the whole document out and walked every line. */
|
|
102
|
+
function mayRenumber(tr) {
|
|
103
|
+
let may = false;
|
|
104
|
+
tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
|
|
105
|
+
if (may)
|
|
106
|
+
return;
|
|
107
|
+
const before = tr.startState.doc;
|
|
108
|
+
if (inserted.lines > 1 || before.lineAt(fromA).number !== before.lineAt(toA).number) {
|
|
109
|
+
may = true; // a line break came or went, so items may have moved between lists
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const ordered = (text) => ORDERED_RE.test(text.slice(BQ_PREFIX_RE.exec(text)[0].length));
|
|
113
|
+
if (ordered(before.lineAt(fromA).text) || ordered(tr.newDoc.lineAt(fromB).text) || ordered(tr.newDoc.lineAt(toB).text))
|
|
114
|
+
may = true;
|
|
115
|
+
});
|
|
116
|
+
return may;
|
|
117
|
+
}
|
|
98
118
|
export const orderedListRenumber = EditorState.transactionFilter.of((tr) => {
|
|
99
|
-
if (!tr.docChanged)
|
|
119
|
+
if (!tr.docChanged || !mayRenumber(tr))
|
|
100
120
|
return tr;
|
|
101
121
|
const changes = renumberOrderedLists(tr.newDoc.toString());
|
|
102
122
|
if (changes.length === 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.ordered-list.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.ordered-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"text-editor.ordered-list.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.ordered-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAElE;;;;;;;;;;;;+DAY+D;AAE/D,mFAAmF;AACnF,mFAAmF;AACnF,qFAAqF;AACrF,8DAA8D;AAC9D,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAC7C,sFAAsF;AACtF,sFAAsF;AACtF,sEAAsE;AACtE,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAC3C,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AACnC,kFAAkF;AAClF,uFAAuF;AACvF,MAAM,OAAO,GAAG,IAAI,CAAC;AAQrB;wEACwE;AACxE,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC/C,MAAM,OAAO,GAAqB,EAAE,CAAC;IACrC,oFAAoF;IACpF,mFAAmF;IACnF,kFAAkF;IAClF,MAAM,MAAM,GAAuC,EAAE,CAAC;IACtD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,yDAAyD;IAEzE,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,MAAM,SAAS,GAAG,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MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,OAAO,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"text-editor.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,yBAglB5B,CAAC"}
|
|
@@ -6,13 +6,16 @@ export const textEditorStyles = css `
|
|
|
6
6
|
/* # Host */
|
|
7
7
|
|
|
8
8
|
:host {
|
|
9
|
-
--
|
|
9
|
+
--_caret-width: var(--primitives-border-width-regular);
|
|
10
|
+
--_caret-ring-width: var(--primitives-border-width-thin);
|
|
10
11
|
--_corner-radius: 0;
|
|
11
12
|
--_background-color: transparent;
|
|
12
13
|
--_highlight-border-color: transparent;
|
|
13
14
|
--_highlight-border-shadow: none;
|
|
14
15
|
--_padding-block: 0px;
|
|
15
|
-
|
|
16
|
+
/* Room for the caret's own ink at the first and last position of a line:
|
|
17
|
+
its width plus its ring. Without it the edge carets are clipped. */
|
|
18
|
+
--_padding-inline: calc(var(--_caret-width) + var(--_caret-ring-width));
|
|
16
19
|
--_content-color: var(--semantics-content-color);
|
|
17
20
|
--_text-font: var(--primitives-font-body-md-regular-snug);
|
|
18
21
|
--_code-font: var(--primitives-font-monospace-md-regular-snug);
|
|
@@ -149,16 +152,14 @@ export const textEditorStyles = css `
|
|
|
149
152
|
surfaces in light and dark (accent-600 fell just short on white), so the
|
|
150
153
|
caret stays clearly visible without washing out. */
|
|
151
154
|
border-left-color: var(--primitives-color-accent-700);
|
|
152
|
-
border-left-width: var(--
|
|
153
|
-
/*
|
|
155
|
+
border-left-width: var(--_caret-width);
|
|
156
|
+
/* CodeMirror centers its own 1.2px caret with a -0.6px margin. Ours is wider,
|
|
157
|
+
so recenter it on the insertion point from its own width. */
|
|
158
|
+
margin-left: calc(var(--_caret-width) / -2);
|
|
159
|
+
/* A thin surface-colored ring, like the drop cursor, so the caret stays legible
|
|
154
160
|
even over a tinted token (annotation, inline code) where the accent alone can
|
|
155
161
|
blend in. Blinks with the caret (opacity covers the shadow too). */
|
|
156
|
-
box-shadow: 0 0 0 var(--
|
|
157
|
-
/* CodeMirror draws the caret ~0.6px left of the text position. At a line start
|
|
158
|
-
with no inline padding (the simple variant) that overhangs the scroller's
|
|
159
|
-
overflow edge, so the left of the 2px gets clipped and the caret looks thinner
|
|
160
|
-
there than mid-line. Nudge it right so the full width stays inside the content. */
|
|
161
|
-
transform: translateX(0.6px);
|
|
162
|
+
box-shadow: 0 0 0 var(--_caret-ring-width) var(--semantics-surfaces-base-background-color);
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
:host .cm-scroller {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.styles.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"text-editor.styles.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsE/B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0gBrB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorState } from '@codemirror/state';
|
|
2
|
+
import type { SyntaxNode } from '@lezer/common';
|
|
3
|
+
/** The innermost node at `pos` that `match` accepts, looking outward from there.
|
|
4
|
+
* `side` decides which node a position between two of them belongs to: -1 the
|
|
5
|
+
* one that ends there, 1 the one that starts there. Null when none matches. */
|
|
6
|
+
export declare function enclosingNode(state: EditorState, pos: number, side: -1 | 0 | 1, match: (node: SyntaxNode) => boolean): SyntaxNode | null;
|
|
7
|
+
/** `enclosingNode` for the common case: a node that goes by one of these names. */
|
|
8
|
+
export declare function enclosingNamed(state: EditorState, pos: number, side: -1 | 0 | 1, names: string | ReadonlySet<string>): SyntaxNode | null;
|
|
9
|
+
//# sourceMappingURL=text-editor.syntax.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-editor.syntax.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.syntax.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD;;gFAEgF;AAChF,wBAAgB,aAAa,CAC5B,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAChB,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,GAClC,UAAU,GAAG,IAAI,CAKnB;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAC7B,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAChB,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GACjC,UAAU,GAAG,IAAI,CAEnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { syntaxTree } from '@codemirror/language';
|
|
2
|
+
/* One question the editor asks the markdown tree everywhere: what is the caret
|
|
3
|
+
* standing in? Is it a link, a code block, an emphasis, a mention. The answer is
|
|
4
|
+
* always the same walk, from the innermost node at the position outward to the
|
|
5
|
+
* root, and it used to be written out at every call site. */
|
|
6
|
+
/** The innermost node at `pos` that `match` accepts, looking outward from there.
|
|
7
|
+
* `side` decides which node a position between two of them belongs to: -1 the
|
|
8
|
+
* one that ends there, 1 the one that starts there. Null when none matches. */
|
|
9
|
+
export function enclosingNode(state, pos, side, match) {
|
|
10
|
+
for (let node = syntaxTree(state).resolveInner(pos, side); node; node = node.parent) {
|
|
11
|
+
if (match(node))
|
|
12
|
+
return node;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
/** `enclosingNode` for the common case: a node that goes by one of these names. */
|
|
17
|
+
export function enclosingNamed(state, pos, side, names) {
|
|
18
|
+
return enclosingNode(state, pos, side, typeof names === 'string' ? (node) => node.name === names : (node) => names.has(node.name));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=text-editor.syntax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-editor.syntax.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.syntax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD;;;6DAG6D;AAE7D;;gFAEgF;AAChF,MAAM,UAAU,aAAa,CAC5B,KAAkB,EAClB,GAAW,EACX,IAAgB,EAChB,KAAoC;IAEpC,KAAK,IAAI,IAAI,GAAsB,UAAU,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACxG,IAAI,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,cAAc,CAC7B,KAAkB,EAClB,GAAW,EACX,IAAgB,EAChB,KAAmC;IAEnC,OAAO,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACpI,CAAC"}
|
|
@@ -33,20 +33,10 @@ export declare const pageSectionArgTypes: {
|
|
|
33
33
|
width: {
|
|
34
34
|
control: string;
|
|
35
35
|
description: string;
|
|
36
|
-
table: {
|
|
37
|
-
defaultValue: {
|
|
38
|
-
summary: string;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
36
|
};
|
|
42
37
|
height: {
|
|
43
38
|
control: string;
|
|
44
39
|
description: string;
|
|
45
|
-
table: {
|
|
46
|
-
defaultValue: {
|
|
47
|
-
summary: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
40
|
};
|
|
51
41
|
'padding-block': {
|
|
52
42
|
control: {
|
|
@@ -54,11 +44,6 @@ export declare const pageSectionArgTypes: {
|
|
|
54
44
|
};
|
|
55
45
|
options: string[];
|
|
56
46
|
description: string;
|
|
57
|
-
table: {
|
|
58
|
-
defaultValue: {
|
|
59
|
-
summary: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
47
|
};
|
|
63
48
|
'padding-top': {
|
|
64
49
|
control: {
|
|
@@ -66,11 +51,6 @@ export declare const pageSectionArgTypes: {
|
|
|
66
51
|
};
|
|
67
52
|
options: string[];
|
|
68
53
|
description: string;
|
|
69
|
-
table: {
|
|
70
|
-
defaultValue: {
|
|
71
|
-
summary: string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
54
|
};
|
|
75
55
|
'padding-bottom': {
|
|
76
56
|
control: {
|
|
@@ -78,11 +58,6 @@ export declare const pageSectionArgTypes: {
|
|
|
78
58
|
};
|
|
79
59
|
options: string[];
|
|
80
60
|
description: string;
|
|
81
|
-
table: {
|
|
82
|
-
defaultValue: {
|
|
83
|
-
summary: string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
61
|
};
|
|
87
62
|
'sm-padding-block': {
|
|
88
63
|
control: {
|
|
@@ -90,11 +65,6 @@ export declare const pageSectionArgTypes: {
|
|
|
90
65
|
};
|
|
91
66
|
options: string[];
|
|
92
67
|
description: string;
|
|
93
|
-
table: {
|
|
94
|
-
defaultValue: {
|
|
95
|
-
summary: string;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
68
|
};
|
|
99
69
|
'sm-padding-top': {
|
|
100
70
|
control: {
|
|
@@ -102,11 +72,6 @@ export declare const pageSectionArgTypes: {
|
|
|
102
72
|
};
|
|
103
73
|
options: string[];
|
|
104
74
|
description: string;
|
|
105
|
-
table: {
|
|
106
|
-
defaultValue: {
|
|
107
|
-
summary: string;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
75
|
};
|
|
111
76
|
'sm-padding-bottom': {
|
|
112
77
|
control: {
|
|
@@ -114,11 +79,6 @@ export declare const pageSectionArgTypes: {
|
|
|
114
79
|
};
|
|
115
80
|
options: string[];
|
|
116
81
|
description: string;
|
|
117
|
-
table: {
|
|
118
|
-
defaultValue: {
|
|
119
|
-
summary: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
82
|
};
|
|
123
83
|
'md-padding-block': {
|
|
124
84
|
control: {
|
|
@@ -126,11 +86,6 @@ export declare const pageSectionArgTypes: {
|
|
|
126
86
|
};
|
|
127
87
|
options: string[];
|
|
128
88
|
description: string;
|
|
129
|
-
table: {
|
|
130
|
-
defaultValue: {
|
|
131
|
-
summary: string;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
89
|
};
|
|
135
90
|
'md-padding-top': {
|
|
136
91
|
control: {
|
|
@@ -138,11 +93,6 @@ export declare const pageSectionArgTypes: {
|
|
|
138
93
|
};
|
|
139
94
|
options: string[];
|
|
140
95
|
description: string;
|
|
141
|
-
table: {
|
|
142
|
-
defaultValue: {
|
|
143
|
-
summary: string;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
96
|
};
|
|
147
97
|
'md-padding-bottom': {
|
|
148
98
|
control: {
|
|
@@ -150,11 +100,6 @@ export declare const pageSectionArgTypes: {
|
|
|
150
100
|
};
|
|
151
101
|
options: string[];
|
|
152
102
|
description: string;
|
|
153
|
-
table: {
|
|
154
|
-
defaultValue: {
|
|
155
|
-
summary: string;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
103
|
};
|
|
159
104
|
'lg-padding-block': {
|
|
160
105
|
control: {
|
|
@@ -162,11 +107,6 @@ export declare const pageSectionArgTypes: {
|
|
|
162
107
|
};
|
|
163
108
|
options: string[];
|
|
164
109
|
description: string;
|
|
165
|
-
table: {
|
|
166
|
-
defaultValue: {
|
|
167
|
-
summary: string;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
110
|
};
|
|
171
111
|
'lg-padding-top': {
|
|
172
112
|
control: {
|
|
@@ -174,11 +114,6 @@ export declare const pageSectionArgTypes: {
|
|
|
174
114
|
};
|
|
175
115
|
options: string[];
|
|
176
116
|
description: string;
|
|
177
|
-
table: {
|
|
178
|
-
defaultValue: {
|
|
179
|
-
summary: string;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
117
|
};
|
|
183
118
|
'lg-padding-bottom': {
|
|
184
119
|
control: {
|
|
@@ -186,11 +121,6 @@ export declare const pageSectionArgTypes: {
|
|
|
186
121
|
};
|
|
187
122
|
options: string[];
|
|
188
123
|
description: string;
|
|
189
|
-
table: {
|
|
190
|
-
defaultValue: {
|
|
191
|
-
summary: string;
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
124
|
};
|
|
195
125
|
};
|
|
196
126
|
export declare const pageSectionArgs: {
|