foldkit-mixins-richtext 0.3.1 → 0.4.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 +167 -10
- package/dist/index.d.mts +252 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +561 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ your application every piece of state the chrome shows, and where it is
|
|
|
12
12
|
foldkit-mixins-richtext nothing: each view is a function of what it is given (this package)
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
The editor renders its host and nothing else
|
|
15
|
+
The editor renders its host and nothing else; the chrome beside
|
|
16
16
|
it is the application's. `foldkit-richtext-dom/toolbar` ships plain versions of some of it,
|
|
17
17
|
such as `marksToolbar`. This package draws the same chrome as slot views. It cannot wrap the
|
|
18
18
|
plain ones, because a slot's contributions resolve at the element the view creates, so a slot
|
|
@@ -105,6 +105,23 @@ quotes are not styles here: leaving one is a lift, not a retype.
|
|
|
105
105
|
| `toolbar` | Collection | the row, `role="toolbar"` |
|
|
106
106
|
| `button` | Interactive | one style, `data-style` (the entry's id) and `aria-pressed` |
|
|
107
107
|
|
|
108
|
+
`blockStyleMenu<Message>()` offers the same styles in the space of one button, for a toolbar
|
|
109
|
+
with other things to hold. Its input adds `open` and `toggled`, since whether a menu is open is
|
|
110
|
+
the caller's. The trigger shows the current style's icon and label ("Text style" where none
|
|
111
|
+
applies) and opens a `role="menu"` of every style, each a `menuitemradio`, the current one
|
|
112
|
+
checked. A choice sends its `RetypedBlock` through `wrap`, which is where the caller closes the
|
|
113
|
+
menu. The trigger is disabled without a text selection, and the menu draws nothing then.
|
|
114
|
+
|
|
115
|
+
| Slot | Capability | Renders |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| `root` | Container | the wrapper, to anchor the menu to |
|
|
118
|
+
| `trigger` | Interactive | the button naming the style, `aria-haspopup="menu"`, `aria-expanded` |
|
|
119
|
+
| `menu` | Collection | the open menu |
|
|
120
|
+
| `item` | Interactive | one style, `data-style`, `aria-checked` |
|
|
121
|
+
| `icon` | Container | a style's icon |
|
|
122
|
+
| `label` | Container | a style's label |
|
|
123
|
+
| `check` | Container | the check beside the current style |
|
|
124
|
+
|
|
108
125
|
## The link editor
|
|
109
126
|
|
|
110
127
|
An address field with two buttons: link the selection (or change the link around the caret),
|
|
@@ -136,13 +153,21 @@ What it sends is `RichText.safeUrl(draft)`, so the address is cleaned and a `jav
|
|
|
136
153
|
`data:` one is never sent. Applying needs such an address and something to link: a range of
|
|
137
154
|
text, or a caret inside a link. Otherwise the apply button is disabled and Enter in the field
|
|
138
155
|
falls through. The remove button is drawn only inside a link. Where the editor appears, and
|
|
139
|
-
when it opens or closes, is the application's
|
|
156
|
+
when it opens or closes, is the application's; give it `closed` and Escape in the field sends
|
|
157
|
+
it. Focusing the field as the editor opens, so a link can be pasted at once, is a Command the
|
|
158
|
+
application runs (`Dom.focus('[data-link="address"]')`).
|
|
159
|
+
|
|
160
|
+
The view decides what its button sends from the draft it was drawn with, which is a frame behind
|
|
161
|
+
keys typed fast: Enter straight after the last character would apply the draft before it. Give
|
|
162
|
+
it `submitted`, and Enter sends that instead, for `update` to apply
|
|
163
|
+
`linkEdit(document, selection, draft)` to the draft the Model holds; `linkEdit` is the same
|
|
164
|
+
decision the button makes, as an `Option` of the editor's Message.
|
|
140
165
|
|
|
141
166
|
| Slot | Capability | Renders |
|
|
142
167
|
| --- | --- | --- |
|
|
143
168
|
| `root` | Container | the editor's wrapper, `role="group"` |
|
|
144
|
-
| `input` | TextInput | the address field, `data-link="address"
|
|
145
|
-
| `apply` | Interactive | the apply button, `data-link="apply"`, labelled
|
|
169
|
+
| `input` | TextInput | the address field, `data-link="address"`, "Paste or type a link" |
|
|
170
|
+
| `apply` | Interactive | the apply button, `data-link="apply"`, labelled Apply or Update |
|
|
146
171
|
| `remove` | Interactive | the remove button, `data-link="remove"`, inside a link only |
|
|
147
172
|
|
|
148
173
|
## The slash menu
|
|
@@ -154,6 +179,7 @@ the two things the editor cannot: the keys that move the highlight, and the view
|
|
|
154
179
|
|
|
155
180
|
```ts
|
|
156
181
|
import { slashEntries, slashMenuView, slashMove } from 'foldkit-mixins-richtext'
|
|
182
|
+
import { menuTextOf } from 'foldkit-richtext-dom/editor-bundle'
|
|
157
183
|
|
|
158
184
|
// The catalogue as the caller's Messages.
|
|
159
185
|
const entries = slashEntries(message => edited(message))
|
|
@@ -163,7 +189,7 @@ const next = slashMove(entries, 'see /head', model.editor.menuIndex, 'ArrowDown'
|
|
|
163
189
|
|
|
164
190
|
// The view, placed only while `slashMenu` says a query is open.
|
|
165
191
|
slashMenuView<Message>()(
|
|
166
|
-
{ entries, textBefore:
|
|
192
|
+
{ entries, textBefore: menuTextOf({ document, ...model.editor }), index: model.editor.menuIndex },
|
|
167
193
|
h,
|
|
168
194
|
)
|
|
169
195
|
```
|
|
@@ -171,19 +197,41 @@ slashMenuView<Message>()(
|
|
|
171
197
|
`slashMove` returns the index a key moves the highlight to, or `undefined` for a key that moves
|
|
172
198
|
nothing, and it starts from what the menu highlights now rather than a remembered index, so a
|
|
173
199
|
query that narrowed past the old one does not move from a position no one can see. The keys
|
|
174
|
-
are the application's to handle, because only it knows the caret: ArrowUp/Down
|
|
175
|
-
|
|
176
|
-
`
|
|
200
|
+
are the application's to handle, because only it knows the caret: ArrowUp/Down and Home/End in
|
|
201
|
+
`OnKeyDownPreventDefault` while a query is open, writing the index to `editor.menuIndex`, and
|
|
202
|
+
Escape, sending the editor's `DismissedSlash`. Enter is not: the editor's `update` resolves it
|
|
203
|
+
against that index, unless Escape closed the menu. Reading the menu's text through
|
|
204
|
+
`menuTextOf` (from `foldkit-richtext-dom/editor-bundle`) is what keeps a view shut while Enter
|
|
205
|
+
splits.
|
|
177
206
|
|
|
178
207
|
Each item carries `data-entry` (its id), `role="menuitem"`, `aria-current="true"` on the
|
|
179
|
-
highlighted one, and its entry's Message on click
|
|
180
|
-
|
|
208
|
+
highlighted one, and its entry's Message on click, and draws the entry's icon (when the set
|
|
209
|
+
below has it), label and description. Under `/` alone the entries sit under their groups'
|
|
210
|
+
headings; a query lists the best matches first, without headings, and one that matches nothing
|
|
211
|
+
says "No matches". Outside a query the view draws nothing.
|
|
181
212
|
|
|
182
213
|
| Slot | Capability | Renders |
|
|
183
214
|
| --- | --- | --- |
|
|
184
215
|
| `root` | Container | the menu's wrapper |
|
|
185
216
|
| `list` | Collection | the list of matches |
|
|
217
|
+
| `heading` | Container | a group's name, before its first entry |
|
|
186
218
|
| `item` | Interactive | one entry, per match |
|
|
219
|
+
| `icon` | Container | the entry's icon |
|
|
220
|
+
| `label` | Container | the entry's label |
|
|
221
|
+
| `description` | Container | the line under the label |
|
|
222
|
+
| `empty` | Container | "No matches" |
|
|
223
|
+
|
|
224
|
+
## Icons
|
|
225
|
+
|
|
226
|
+
`richTextIcon(h, name, { size })` draws one of the chrome's icons as inline SVG, stroked in the
|
|
227
|
+
text's color and hidden from assistive technology, so the control it sits in names it.
|
|
228
|
+
`richTextIconUrl(name)` is the same drawing as a CSS `url(…)` for a stylesheet to mask, where a
|
|
229
|
+
rendering's adornment cannot hold an element. The set covers the editor's slash entries (by
|
|
230
|
+
their `icon`), the marks, the blocks an application inserts (table, image, video, audio, file,
|
|
231
|
+
callout, toggle, divider, footnote), and the actions around them (undo, redo, search, replace,
|
|
232
|
+
match-case, download, copy, trash, plus, more, grip, close, check, chevrons, back, contents,
|
|
233
|
+
reset). `isRichTextIcon(name)` says whether a name has a drawing. The drawings are Lucide's,
|
|
234
|
+
under its ISC license, whose notice is in `src/icons.ts`.
|
|
187
235
|
|
|
188
236
|
## The block handle
|
|
189
237
|
|
|
@@ -228,6 +276,115 @@ outermost === undefined
|
|
|
228
276
|
| `up` | Interactive | `data-handle="up"` |
|
|
229
277
|
| `down` | Interactive | `data-handle="down"` |
|
|
230
278
|
|
|
279
|
+
## The table and code toolbars
|
|
280
|
+
|
|
281
|
+
Toolbars for a block, drawn above it in an element `blockAnchor({ side: 'above' })` places. The
|
|
282
|
+
table toolbar edits the table around the caret's cell; the code toolbar picks a code block's
|
|
283
|
+
language and copies it.
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
import * as RichText from 'foldkit-richtext'
|
|
287
|
+
import { blockAnchor } from 'foldkit-richtext-dom/toolbar'
|
|
288
|
+
import { codeToolbar, tableToolbar } from 'foldkit-mixins-richtext'
|
|
289
|
+
|
|
290
|
+
const table = RichText.tableAt(model.document, model.editor.selection)
|
|
291
|
+
|
|
292
|
+
table === undefined
|
|
293
|
+
? h.empty
|
|
294
|
+
: h.div(
|
|
295
|
+
[
|
|
296
|
+
h.Key(table.table.id),
|
|
297
|
+
h.OnMount(blockAnchor({ hostId: 'body', node: table.table.id, gap: 6, side: 'above' })),
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
tableToolbar<Message>()(
|
|
301
|
+
{ document: model.document, selection: model.editor.selection, wrap: edited },
|
|
302
|
+
h,
|
|
303
|
+
),
|
|
304
|
+
],
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
codeToolbar<Message>()(
|
|
308
|
+
{
|
|
309
|
+
document: model.document,
|
|
310
|
+
node: code.id,
|
|
311
|
+
languages: [{ id: 'typescript', label: 'TypeScript' }, { id: '', label: 'Plain text' }],
|
|
312
|
+
wrap: edited,
|
|
313
|
+
copied: Message.CopiedCode({ node: code.id }),
|
|
314
|
+
},
|
|
315
|
+
h,
|
|
316
|
+
)
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
- **The table toolbar** sends the editor's `InsertedRow` and `InsertedColumn` (`before`,
|
|
320
|
+
`after`), `DeletedRow`, `DeletedColumn`, `DeletedBlock` for the whole table, and `ChangedProps`
|
|
321
|
+
on the first row's `header`, which its button shows pressed. Every button is disabled outside a
|
|
322
|
+
table (`RichText.tableAt` finds none), so it can be drawn always or only there. The editor
|
|
323
|
+
takes Tab and Shift+Tab in a cell to move between cells, and Tab in the last adds a row.
|
|
324
|
+
- **The code toolbar** shows the block's `language` in a picker and sets it with
|
|
325
|
+
`ChangedProps`, so it is saved and undone with the text; a language the list does not name is
|
|
326
|
+
offered as itself. Copy sends the caller's Message, since the clipboard is a Command: copy
|
|
327
|
+
`RichText.toText([block])`.
|
|
328
|
+
|
|
329
|
+
| Slot | Capability | Renders |
|
|
330
|
+
| --- | --- | --- |
|
|
331
|
+
| `TableToolbarSlots.root` | Container | the wrapper |
|
|
332
|
+
| `TableToolbarSlots.toolbar` | Collection | `role="toolbar"` |
|
|
333
|
+
| `TableToolbarSlots.button` | Interactive | one per change, `data-table` (`row-above`, …) |
|
|
334
|
+
| `CodeToolbarSlots.root` | Container | `role="toolbar"` |
|
|
335
|
+
| `CodeToolbarSlots.language` | Interactive | the `select` |
|
|
336
|
+
| `CodeToolbarSlots.copy` | Interactive | `data-code="copy"` |
|
|
337
|
+
|
|
338
|
+
## Find and replace
|
|
339
|
+
|
|
340
|
+
`findReplace<Message>()` is the find bar. The query, the replacement, which match is current
|
|
341
|
+
and whether case counts are the caller's Model; the matches are `RichText.findMatches` of the
|
|
342
|
+
document, and replacing is the editor's `ReplacedText`, an edit with its undo step.
|
|
343
|
+
|
|
344
|
+
- Enter in the find field goes to the next match and Shift+Enter to the previous, wrapping at
|
|
345
|
+
either end. The bar sends `stepped(1)` or `stepped(-1)`, and the caller's `update` moves its
|
|
346
|
+
current match with `stepMatch(current, count, step)`: two keys can arrive before the bar is
|
|
347
|
+
drawn again, so the step is applied to the Model, not to the index the bar last showed. Escape in either
|
|
348
|
+
field sends `closed`.
|
|
349
|
+
- The count reads `2 of 5`, or `No matches`; Replace and Replace all are disabled without one.
|
|
350
|
+
- To show the matches, overlay `RichText.searchDecorations(document, query, { current })` on the
|
|
351
|
+
editor (`overlay(hostId, decorations)`), and set it again when the document changes.
|
|
352
|
+
|
|
353
|
+
| Slot | Capability | Renders |
|
|
354
|
+
| --- | --- | --- |
|
|
355
|
+
| `root` | Container | `role="search"` |
|
|
356
|
+
| `field` | TextInput | the find and replacement fields, `data-find="query"` and `"replacement"` |
|
|
357
|
+
| `count` | Container | the count, `aria-live` |
|
|
358
|
+
| `button` | Interactive | `data-find`: `previous`, `next`, `case`, `replace`, `replace-all`, `close`; the first three and `close` draw an icon, named by `aria-label` and `title` |
|
|
359
|
+
|
|
360
|
+
## The table of contents
|
|
361
|
+
|
|
362
|
+
`tableOfContents<Message>()` draws `RichText.outlineOf(document)` as a `nav` of buttons, the
|
|
363
|
+
section the selection is in (`RichText.sectionAt`) marked `aria-current="location"`. Choosing an
|
|
364
|
+
entry sends `chosen(node)`; going there is the caller's, usually the editor's `focus(hostId,
|
|
365
|
+
selection)` Command with a caret at the heading's start. Nothing is drawn without headings.
|
|
366
|
+
|
|
367
|
+
| Slot | Capability | Renders |
|
|
368
|
+
| --- | --- | --- |
|
|
369
|
+
| `root` | Container | the `nav`, labelled Contents |
|
|
370
|
+
| `list` | Container | the `ul` |
|
|
371
|
+
| `entry` | Interactive | a heading's button, its depth as `--fk-toc-level` (1 for the shallowest level used) |
|
|
372
|
+
|
|
373
|
+
## The footnote preview
|
|
374
|
+
|
|
375
|
+
`footnotePreview<Message>()` is drawn while the caret is in a footnote reference
|
|
376
|
+
(`RichText.footnoteAt`), and is empty everywhere else, so a caller can anchor it at the selection
|
|
377
|
+
and draw it always. It shows the note's text ("No note yet" when there is none), Go to note, which
|
|
378
|
+
sends `opened(definition)` (the caller usually gives the editor the focus there with `focus`), and
|
|
379
|
+
the label as a field that sends the editor's `RenamedFootnote` when it changes.
|
|
380
|
+
|
|
381
|
+
| Slot | Capability | Renders |
|
|
382
|
+
| --- | --- | --- |
|
|
383
|
+
| `root` | Container | `role="group"`, labelled with the footnote |
|
|
384
|
+
| `label` | TextInput | the label field |
|
|
385
|
+
| `text` | Container | the note's text |
|
|
386
|
+
| `button` | Interactive | Go to note, disabled with no definition |
|
|
387
|
+
|
|
231
388
|
## The command palette
|
|
232
389
|
|
|
233
390
|
The slash menu's catalogue, searched from a field of its own instead of typed into the
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
2
|
import * as RichText from "foldkit-richtext";
|
|
3
3
|
import { ToolbarState } from "foldkit-richtext-dom/toolbar";
|
|
4
|
+
import { Option } from "effect";
|
|
4
5
|
import { EditorEvent, SlashEntry, SlashEntry as SlashEntry$1, SlashMenu, matchingEntries, slashMenu, slashQuery } from "foldkit-richtext-dom/editor";
|
|
5
6
|
import "foldkit/mount";
|
|
6
7
|
import { SourceSession } from "foldkit-richtext-markdown";
|
|
7
|
-
import { KeyboardModifiers } from "foldkit/html";
|
|
8
|
+
import { Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
|
|
8
9
|
//#region src/style.d.ts
|
|
9
10
|
/** The elements the picker publishes: its wrapper, its row, and one button per style. */
|
|
10
11
|
export declare const BlockStyleSlots: Slots.Contract<{
|
|
@@ -25,6 +26,122 @@ interface BlockStyleInput<Message> {
|
|
|
25
26
|
* there is refused.
|
|
26
27
|
*/
|
|
27
28
|
export declare const blockStyles: <Message>() => SlotView.SlotView<typeof BlockStyleSlots, BlockStyleInput<Message>, Message>;
|
|
29
|
+
/**
|
|
30
|
+
* The elements the style menu publishes: its wrapper, the trigger that names the current style,
|
|
31
|
+
* the menu, and one item per style with its icon, label and the check on the current one.
|
|
32
|
+
*/
|
|
33
|
+
export declare const BlockStyleMenuSlots: Slots.Contract<{
|
|
34
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
35
|
+
readonly trigger: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
36
|
+
readonly menu: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
37
|
+
readonly item: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
38
|
+
readonly icon: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
39
|
+
readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
40
|
+
readonly check: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
41
|
+
}>;
|
|
42
|
+
interface BlockStyleMenuInput<Message> extends BlockStyleInput<Message> {
|
|
43
|
+
/** Whether the menu is open: the caller's, as every menu's is. */
|
|
44
|
+
readonly open: boolean;
|
|
45
|
+
/** The trigger's Message, which opens the menu or closes it. */
|
|
46
|
+
readonly toggled: Message;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The same styles as `blockStyles`, in the space of one button: the trigger names the style the
|
|
50
|
+
* selection's block has ("Text style" where none applies, as in a code block) and opens a menu of
|
|
51
|
+
* every style, the current one checked. Choosing one sends its `RetypedBlock` through `wrap`, which
|
|
52
|
+
* is where a caller also closes the menu. The trigger is disabled without a text selection.
|
|
53
|
+
*/
|
|
54
|
+
export declare const blockStyleMenu: <Message>() => SlotView.SlotView<typeof BlockStyleMenuSlots, BlockStyleMenuInput<Message>, Message>;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/find.d.ts
|
|
57
|
+
/** The elements the bar publishes: its wrapper, its two fields, the count, and its buttons. */
|
|
58
|
+
export declare const FindReplaceSlots: Slots.Contract<{
|
|
59
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
60
|
+
readonly field: Slot.UnnamedSlot<Capability.Capability<"TextInput", readonly [Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
61
|
+
readonly count: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
62
|
+
readonly button: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
63
|
+
}>;
|
|
64
|
+
interface FindReplaceInput<Message> {
|
|
65
|
+
readonly document: RichText.Document;
|
|
66
|
+
readonly query: string;
|
|
67
|
+
readonly replacement: string;
|
|
68
|
+
/** The match the bar is on, by its index in `RichText.findMatches`. */
|
|
69
|
+
readonly current: number;
|
|
70
|
+
readonly caseSensitive: boolean;
|
|
71
|
+
readonly queried: (query: string) => Message;
|
|
72
|
+
readonly replacementDrafted: (replacement: string) => Message;
|
|
73
|
+
/**
|
|
74
|
+
* Go to the next match (1) or the previous one (-1). The caller moves its current match with
|
|
75
|
+
* `stepMatch` against its Model as it is then, since keys can come faster than the bar is drawn.
|
|
76
|
+
*/
|
|
77
|
+
readonly stepped: (step: 1 | -1) => Message;
|
|
78
|
+
readonly caseToggled: Message;
|
|
79
|
+
readonly closed: Message;
|
|
80
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
81
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The index a step from `current` lands on among `count` matches, wrapping at either end, so
|
|
85
|
+
* Enter keeps cycling through them as a browser's find does.
|
|
86
|
+
*/
|
|
87
|
+
export declare const stepMatch: (current: number, count: number, step: 1 | -1) => number;
|
|
88
|
+
/**
|
|
89
|
+
* The bar as a slot view. Enter in the find field goes to the next match and Shift+Enter to the
|
|
90
|
+
* previous one; Escape in either field closes it. Replace replaces the current match and Replace
|
|
91
|
+
* all every one; both are disabled with no match. Each button carries `data-find`.
|
|
92
|
+
*/
|
|
93
|
+
export declare const findReplace: <Message>() => SlotView.SlotView<typeof FindReplaceSlots, FindReplaceInput<Message>, Message>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/table.d.ts
|
|
96
|
+
/** The elements the toolbar publishes: its wrapper, its row, and one button per change. */
|
|
97
|
+
export declare const TableToolbarSlots: Slots.Contract<{
|
|
98
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
99
|
+
readonly toolbar: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
100
|
+
readonly button: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
101
|
+
}>;
|
|
102
|
+
interface TableToolbarInput<Message> {
|
|
103
|
+
readonly document: RichText.Document;
|
|
104
|
+
readonly selection: RichText.Selection | null;
|
|
105
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
106
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The table toolbar as a slot view. Every button is disabled outside a table, so a caller can
|
|
110
|
+
* draw it always or only while `RichText.tableAt` finds the caret in one. Each button carries its
|
|
111
|
+
* change as `data-table` and as the slot item's `id`, so a Style or Behavior can single one out;
|
|
112
|
+
* the header button is pressed while the table's first row is its header.
|
|
113
|
+
*/
|
|
114
|
+
export declare const tableToolbar: <Message>() => SlotView.SlotView<typeof TableToolbarSlots, TableToolbarInput<Message>, Message>;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/code.d.ts
|
|
117
|
+
/** The elements the toolbar publishes: its wrapper, the language picker, and the Copy button. */
|
|
118
|
+
export declare const CodeToolbarSlots: Slots.Contract<{
|
|
119
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
120
|
+
readonly language: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
121
|
+
readonly copy: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
122
|
+
}>;
|
|
123
|
+
/** A language the picker offers: the `language` prop's value, and what the picker shows. */
|
|
124
|
+
interface CodeLanguage {
|
|
125
|
+
readonly id: string;
|
|
126
|
+
readonly label: string;
|
|
127
|
+
}
|
|
128
|
+
interface CodeToolbarInput<Message> {
|
|
129
|
+
readonly document: RichText.Document;
|
|
130
|
+
/** The code block the toolbar is for. */
|
|
131
|
+
readonly node: RichText.NodeId;
|
|
132
|
+
/** What the picker offers, in order; `''` is code with no language. */
|
|
133
|
+
readonly languages: ReadonlyArray<CodeLanguage>;
|
|
134
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
135
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
136
|
+
/** What Copy sends: the caller copies the block's text (`RichText.toText([block])`). */
|
|
137
|
+
readonly copied: Message;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The code block toolbar as a slot view. The picker shows the block's language, and a language
|
|
141
|
+
* the list does not name is offered as itself, so choosing nothing never changes it. Nothing is
|
|
142
|
+
* drawn for a block that is not there.
|
|
143
|
+
*/
|
|
144
|
+
export declare const codeToolbar: <Message>() => SlotView.SlotView<typeof CodeToolbarSlots, CodeToolbarInput<Message>, Message>;
|
|
28
145
|
//#endregion
|
|
29
146
|
//#region src/handle.d.ts
|
|
30
147
|
/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */
|
|
@@ -179,21 +296,44 @@ interface LinkEditorInput<Message> {
|
|
|
179
296
|
readonly drafted: (href: string) => Message;
|
|
180
297
|
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
181
298
|
readonly wrap: (message: EditorEvent) => Message;
|
|
299
|
+
/** What Escape in the field sends: usually closing the editor. Without it, Escape does nothing. */
|
|
300
|
+
readonly closed?: Message | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* What Enter in the field sends, for the caller's `update` to apply `linkEdit` to its own
|
|
303
|
+
* draft. Without it, Enter sends the edit the view last drew, which is a frame behind keys
|
|
304
|
+
* typed fast: Enter right after the last character would apply the draft before it.
|
|
305
|
+
*/
|
|
306
|
+
readonly submitted?: Message | undefined;
|
|
182
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* The edit applying a draft makes: the selection linked, or the link around the caret changed, to
|
|
310
|
+
* `RichText.safeUrl(draft)`. None when the policy refuses the address, or when there is neither
|
|
311
|
+
* a range nor a caret inside a link to put it on. The view's button sends it; a caller handling
|
|
312
|
+
* `submitted` sends it from its own draft.
|
|
313
|
+
*/
|
|
314
|
+
export declare const linkEdit: (document: RichText.Document, selection: RichText.Selection | null, draft: string) => Option.Option<EditorEvent>;
|
|
183
315
|
/**
|
|
184
316
|
* The link editor as a slot view. Applying needs an address the URL policy accepts
|
|
185
317
|
* (`RichText.safeUrl`), which is what it sends, and something to link: a range, or a caret
|
|
186
318
|
* inside a link. Otherwise the apply button is disabled and Enter in the field does nothing.
|
|
187
|
-
* The remove button is drawn only inside a link.
|
|
319
|
+
* The remove button is drawn only inside a link. Escape in the field sends `closed`.
|
|
188
320
|
*/
|
|
189
321
|
export declare const linkEditor: <Message>() => SlotView.SlotView<typeof LinkEditorSlots, LinkEditorInput<Message>, Message>;
|
|
190
322
|
//#endregion
|
|
191
323
|
//#region src/menu.d.ts
|
|
192
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* The elements the menu publishes: its wrapper, its list, a heading over each group, one item per
|
|
326
|
+
* match with its icon, label and description, and what shows when nothing matches.
|
|
327
|
+
*/
|
|
193
328
|
export declare const SlashMenuSlots: Slots.Contract<{
|
|
194
329
|
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
195
330
|
readonly list: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
331
|
+
readonly heading: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
196
332
|
readonly item: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
333
|
+
readonly icon: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
334
|
+
readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
335
|
+
readonly description: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
336
|
+
readonly empty: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
197
337
|
}>;
|
|
198
338
|
interface SlashMenuInput<Message> {
|
|
199
339
|
/** `slashEntries` for this package's catalogue, or an application's own. */
|
|
@@ -205,6 +345,114 @@ interface SlashMenuInput<Message> {
|
|
|
205
345
|
}
|
|
206
346
|
export declare const slashMenuView: <Message>() => SlotView.SlotView<typeof SlashMenuSlots, SlashMenuInput<Message>, Message>;
|
|
207
347
|
//#endregion
|
|
348
|
+
//#region src/icons.d.ts
|
|
349
|
+
declare const paths: {
|
|
350
|
+
readonly paragraph: readonly ["M13 4v16", "M17 4v16", "M19 4H9.5a4.5 4.5 0 0 0 0 9H13"];
|
|
351
|
+
readonly 'heading-1': readonly ["M4 12h8", "M4 18V6", "M12 18V6", "m17 12 3-2v8"];
|
|
352
|
+
readonly 'heading-2': readonly ["M4 12h8", "M4 18V6", "M12 18V6", "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"];
|
|
353
|
+
readonly 'heading-3': readonly ["M4 12h8", "M4 18V6", "M12 18V6", "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"];
|
|
354
|
+
readonly quote: readonly ["M17 6H3", "M21 12H8", "M21 18H8", "M3 12v6"];
|
|
355
|
+
readonly 'bulleted-list': readonly ["M8 6h13", "M8 12h13", "M8 18h13", "M3 6h.01", "M3 12h.01", "M3 18h.01"];
|
|
356
|
+
readonly 'numbered-list': readonly ["M10 6h11", "M10 12h11", "M10 18h11", "M4 6h1v4", "M4 10h2", "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"];
|
|
357
|
+
readonly checklist: readonly ["m3 17 2 2 4-4", "m3 7 2 2 4-4", "M13 6h8", "M13 12h8", "M13 18h8"];
|
|
358
|
+
readonly 'code-block': readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "m10 9-3 3 3 3", "m14 15 3-3-3-3"];
|
|
359
|
+
readonly bold: readonly ["M14 12a4 4 0 0 0 0-8H6v8", "M15 20a4 4 0 0 0 0-8H6v8Z"];
|
|
360
|
+
readonly italic: readonly ["M19 4h-9", "M14 20H5", "M15 4 9 20"];
|
|
361
|
+
readonly underline: readonly ["M6 4v6a6 6 0 0 0 12 0V4", "M4 20h16"];
|
|
362
|
+
readonly strikethrough: readonly ["M16 4H9a3 3 0 0 0-2.83 4", "M14 12a4 4 0 0 1 0 8H6", "M4 12h16"];
|
|
363
|
+
readonly code: readonly ["m16 18 6-6-6-6", "m8 6-6 6 6 6"];
|
|
364
|
+
readonly highlight: readonly ["m9 11-6 6v3h9l3-3", "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"];
|
|
365
|
+
readonly kbd: readonly ["M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z", "M6 8h.01", "M10 8h.01", "M14 8h.01", "M18 8h.01", "M8 12h.01", "M12 12h.01", "M16 12h.01", "M7 16h10"];
|
|
366
|
+
readonly link: readonly ["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"];
|
|
367
|
+
readonly comment: readonly ["M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"];
|
|
368
|
+
readonly table: readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M3 9h18", "M3 15h18", "M12 3v18"];
|
|
369
|
+
readonly image: readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M9 11a2 2 0 1 0 0-4 2 2 0 0 0 0 4z", "M21 15l-5-5L5 21"];
|
|
370
|
+
readonly video: readonly ["m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5", "M4 6h10a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"];
|
|
371
|
+
readonly audio: readonly ["M9 18V5l12-2v13", "M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z", "M18 19a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"];
|
|
372
|
+
readonly file: readonly ["m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"];
|
|
373
|
+
readonly callout: readonly ["M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5", "M9 18h6", "M10 22h4"];
|
|
374
|
+
readonly toggle: readonly ["m3 10 2.5-2.5L3 5", "m3 19 2.5-2.5L3 14", "M10 6h11", "M10 12h11", "M10 18h11"];
|
|
375
|
+
readonly divider: readonly ["M5 12h14"];
|
|
376
|
+
readonly footnote: readonly ["m4 19 8-8", "m12 19-8-8", "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"];
|
|
377
|
+
readonly undo: readonly ["M9 14 4 9l5-5", "M4 9h11a5 5 0 0 1 0 10h-3"];
|
|
378
|
+
readonly redo: readonly ["M15 14l5-5-5-5", "M20 9H9a5 5 0 0 0 0 10h3"];
|
|
379
|
+
readonly search: readonly ["M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z", "M21 21l-4.35-4.35"];
|
|
380
|
+
readonly replace: readonly ["M14 4a1 1 0 0 1 1-1", "M15 10a1 1 0 0 1-1-1", "M21 4a1 1 0 0 0-1-1", "M21 9a1 1 0 0 1-1 1", "m3 7 3 3 3-3", "M6 10V5a2 2 0 0 1 2-2h2", "M4 14h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1z"];
|
|
381
|
+
readonly 'match-case': readonly ["m3 15 4-8 4 8", "M4 13h6", "M18 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z", "M21 9v6"];
|
|
382
|
+
readonly download: readonly ["M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", "M7 10l5 5 5-5", "M12 15V3"];
|
|
383
|
+
readonly copy: readonly ["M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z", "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"];
|
|
384
|
+
readonly trash: readonly ["M3 6h18", "M8 6V4h8v2", "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"];
|
|
385
|
+
readonly plus: readonly ["M12 5v14", "M5 12h14"];
|
|
386
|
+
readonly more: readonly [string, string, string];
|
|
387
|
+
readonly grip: readonly [string, string, string, string, string, string];
|
|
388
|
+
readonly close: readonly ["M18 6 6 18", "m6 6 12 12"];
|
|
389
|
+
readonly check: readonly ["M20 6 9 17l-5-5"];
|
|
390
|
+
readonly 'chevron-down': readonly ["m6 9 6 6 6-6"];
|
|
391
|
+
readonly 'chevron-up': readonly ["m18 15-6-6-6 6"];
|
|
392
|
+
readonly 'chevron-right': readonly ["m9 18 6-6-6-6"];
|
|
393
|
+
readonly back: readonly ["m12 19-7-7 7-7", "M19 12H5"];
|
|
394
|
+
readonly contents: readonly ["M21 12h-8", "M21 6H8", "M21 18h-8", "M3 6v4c0 1.1.9 2 2 2h3", "M3 10v6c0 1.1.9 2 2 2h3"];
|
|
395
|
+
readonly reset: readonly ["M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", "M3 3v5h5"];
|
|
396
|
+
};
|
|
397
|
+
/** The names of the drawings in the set. */
|
|
398
|
+
type RichTextIconName = keyof typeof paths;
|
|
399
|
+
/** Whether a name, such as a slash entry's id, has a drawing in the set. */
|
|
400
|
+
export declare const isRichTextIcon: (name: string) => name is RichTextIconName;
|
|
401
|
+
/** An icon as inline SVG, `size` CSS pixels square, in the text's color. */
|
|
402
|
+
export declare const richTextIcon: <Message>(h: HtmlBuilder<Message>, name: RichTextIconName, { size }?: {
|
|
403
|
+
readonly size?: number;
|
|
404
|
+
}) => Html;
|
|
405
|
+
/**
|
|
406
|
+
* An icon as a CSS `url(…)`, for markup that cannot hold an element of its own, such as a
|
|
407
|
+
* rendering's adornment: a stylesheet masks it over the text's color.
|
|
408
|
+
*/
|
|
409
|
+
export declare const richTextIconUrl: (name: RichTextIconName) => string;
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/contents.d.ts
|
|
412
|
+
/**
|
|
413
|
+
* The elements the contents publish: the `nav`, its list, and one entry per heading. An entry
|
|
414
|
+
* carries its depth as `--fk-toc-level` (1 for the shallowest level the document uses) and
|
|
415
|
+
* `aria-current="location"` for the section the selection is in.
|
|
416
|
+
*/
|
|
417
|
+
export declare const TableOfContentsSlots: Slots.Contract<{
|
|
418
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
419
|
+
readonly list: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
420
|
+
readonly entry: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
421
|
+
}>;
|
|
422
|
+
interface TableOfContentsInput<Message> {
|
|
423
|
+
readonly document: RichText.Document;
|
|
424
|
+
/** Where the caret is, whose section is marked current. */
|
|
425
|
+
readonly selection: RichText.Selection | null;
|
|
426
|
+
/** A heading was chosen. */
|
|
427
|
+
readonly chosen: (node: RichText.NodeId) => Message;
|
|
428
|
+
}
|
|
429
|
+
/** The contents as a slot view; nothing is drawn for a document with no headings. */
|
|
430
|
+
export declare const tableOfContents: <Message>() => SlotView.SlotView<typeof TableOfContentsSlots, TableOfContentsInput<Message>, Message>;
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/footnote.d.ts
|
|
433
|
+
/** The elements the preview publishes: its card, the label field, the note's text, and the button. */
|
|
434
|
+
export declare const FootnotePreviewSlots: Slots.Contract<{
|
|
435
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
436
|
+
readonly label: Slot.UnnamedSlot<Capability.Capability<"TextInput", readonly [Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
437
|
+
readonly text: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
438
|
+
readonly button: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
439
|
+
}>;
|
|
440
|
+
interface FootnotePreviewInput<Message> {
|
|
441
|
+
readonly document: RichText.Document;
|
|
442
|
+
readonly selection: RichText.Selection | null;
|
|
443
|
+
/** Go to the note: the caller puts the caret at the definition's start (`focus`). */
|
|
444
|
+
readonly opened: (definition: RichText.NodeId) => Message;
|
|
445
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
446
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* The preview as a slot view, drawn while the caret is in a footnote reference and nothing
|
|
450
|
+
* otherwise. The label field renames the footnote when it changes (`RenamedFootnote`, which the
|
|
451
|
+
* editor refuses for a label in use). A note with no text reads "No note yet"; with no definition
|
|
452
|
+
* at all, Go to note is disabled.
|
|
453
|
+
*/
|
|
454
|
+
export declare const footnotePreview: <Message>() => SlotView.SlotView<typeof FootnotePreviewSlots, FootnotePreviewInput<Message>, Message>;
|
|
455
|
+
//#endregion
|
|
208
456
|
//#region src/index.d.ts
|
|
209
457
|
/** The elements the toolbar publishes: its wrapper, its row, and one button per mark. */
|
|
210
458
|
export declare const MarkToolbarSlots: Slots.Contract<{
|
|
@@ -231,5 +479,5 @@ export interface MarkToolbarInput<Message> {
|
|
|
231
479
|
*/
|
|
232
480
|
export declare const markToolbar: <Message>() => SlotView.SlotView<typeof MarkToolbarSlots, MarkToolbarInput<Message>, Message>;
|
|
233
481
|
//#endregion
|
|
234
|
-
export { type BlockHandleInput, type BlockStyleInput, type CommandPaletteInput, type EditorStatusInput, type LinkEditorInput, type SlashEntry, type SlashMenu, type SlashMenuInput, type SourceEditorInput, type SourcePreviewInput, matchingEntries, slashMenu, slashQuery };
|
|
482
|
+
export { type BlockHandleInput, type BlockStyleInput, type BlockStyleMenuInput, type CodeLanguage, type CodeToolbarInput, type CommandPaletteInput, type EditorStatusInput, type FindReplaceInput, type FootnotePreviewInput, type LinkEditorInput, type RichTextIconName, type SlashEntry, type SlashMenu, type SlashMenuInput, type SourceEditorInput, type SourcePreviewInput, type TableOfContentsInput, type TableToolbarInput, matchingEntries, slashMenu, slashQuery };
|
|
235
483
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["SlashEntry"],"sources":["../src/style.ts","../src/handle.ts","../src/slash.ts","../src/palette.ts","../src/status.ts","../src/source.ts","../src/link.ts","../src/menu.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["SlashEntry"],"sources":["../src/style.ts","../src/find.ts","../src/table.ts","../src/code.ts","../src/handle.ts","../src/slash.ts","../src/palette.ts","../src/status.ts","../src/source.ts","../src/link.ts","../src/menu.ts","../src/icons.ts","../src/contents.ts","../src/footnote.ts","../src/index.ts"],"mappings":";;;;;;;;;;qBAyBa,iBAAe,MAA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