foldkit-mixins-richtext 0.1.0 → 0.2.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 +319 -26
- package/dist/index.d.mts +206 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +449 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -7
package/README.md
CHANGED
|
@@ -1,24 +1,49 @@
|
|
|
1
1
|
# foldkit-mixins-richtext
|
|
2
2
|
|
|
3
|
-
The rich-text editor's chrome,
|
|
3
|
+
The rich-text editor's chrome (toolbars, menus, a block handle, a status line, a Markdown
|
|
4
|
+
source mode) drawn as [Mixins](../mixins) slot views, so an application restyles or extends
|
|
5
|
+
every element the way it does any other view.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
Rich Text design): the toolbar beside it is the application's chrome. This package
|
|
7
|
-
draws that chrome as a `SlotView`, so every element it makes is a slot an
|
|
8
|
-
application styles or extends the way it does any other view.
|
|
7
|
+
## Who owns what
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
```text
|
|
10
|
+
foldkit-richtext-dom the editor: its host element, the editable subtree, every edit
|
|
11
|
+
your application every piece of state the chrome shows, and where it is drawn
|
|
12
|
+
foldkit-mixins-richtext nothing: each view is a function of what it is given (this package)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The editor renders its host and nothing else (§29 of the Rich Text design); the chrome beside
|
|
16
|
+
it is the application's. `foldkit-richtext-dom/toolbar` ships plain versions of some of it,
|
|
17
|
+
such as `marksToolbar`. This package draws the same chrome as slot views. It cannot wrap the
|
|
18
|
+
plain ones, because a slot's contributions resolve at the element the view creates, so a slot
|
|
19
|
+
view owns its elements; the two share the rules, such as `markActive`.
|
|
20
|
+
|
|
21
|
+
## The contract every view keeps
|
|
22
|
+
|
|
23
|
+
- **It holds no state.** Whether a palette is open, what is typed in a field, which entry is
|
|
24
|
+
highlighted: each is the application's, passed in and changed through a Message.
|
|
25
|
+
- **What it shows is a read of the document.** A pressed mark (`markActive`), the caret's
|
|
26
|
+
block style (`RichText.textBlockAt`), the link around the caret (`RichText.linkAt`), and the
|
|
27
|
+
slash menu (`RichText.textBefore`) are computed from the document and selection it is given.
|
|
28
|
+
- **Messages go out through what the caller passes.** An editor Message goes through `wrap` (or
|
|
29
|
+
`toggled`), because the caller usually dispatches a wrapper such as the editor Bundle's
|
|
30
|
+
`edited`; an application Message through a named callback, such as `changed` or `closed`.
|
|
31
|
+
- **Every element is a slot.** Each view names its slots and their capabilities in a table
|
|
32
|
+
below; `Style` and Behaviors reach them the way they reach any Mixins view.
|
|
14
33
|
|
|
15
|
-
|
|
34
|
+
In the snippets, `model`, `h`, `Message`, and `edited` are the application's, as in
|
|
35
|
+
`foldkit-richtext-dom`'s editor; a name such as `DraftedLink` is one of its own Message
|
|
36
|
+
constructors.
|
|
16
37
|
|
|
17
|
-
|
|
18
|
-
versions. The first slice is the mark toolbar; the rest of the design's editor chrome (floating toolbar,
|
|
19
|
-
link popover, block handle, placeholder, status) arrives when a view needs it.
|
|
38
|
+
## Install
|
|
20
39
|
|
|
21
|
-
|
|
40
|
+
The `foldkit-richtext` family is **early**: 0.x, and its API may change between minor versions.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pnpm add foldkit-mixins-richtext foldkit-mixins foldkit-richtext foldkit-richtext-dom
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Sixty seconds: the mark toolbar
|
|
22
47
|
|
|
23
48
|
```ts
|
|
24
49
|
import { Style } from 'foldkit-mixins'
|
|
@@ -28,7 +53,7 @@ const Toolbar = markToolbar<Message>().pipe(
|
|
|
28
53
|
Style.attach(Style.forSlots(MarkToolbarSlots)({ button: Style.class('mark-button') })),
|
|
29
54
|
)
|
|
30
55
|
|
|
31
|
-
// In a view:
|
|
56
|
+
// In a view:
|
|
32
57
|
Toolbar(
|
|
33
58
|
{
|
|
34
59
|
state: { document, selection, storedMarks },
|
|
@@ -38,11 +63,12 @@ Toolbar(
|
|
|
38
63
|
)
|
|
39
64
|
```
|
|
40
65
|
|
|
41
|
-
`state` is what the editor projects
|
|
42
|
-
defaults to the three `foldkit-richtext` ships
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
`state` is what the editor projects; `toggled` turns a mark into the caller's Message; `marks`
|
|
67
|
+
defaults to the three `foldkit-richtext` ships. The `Style.attach` line is the point of the
|
|
68
|
+
package: the buttons are a slot, and the application styled them without the view knowing.
|
|
69
|
+
Each button renders with its mark as the slot item's `id`, so a Behavior can single one out.
|
|
70
|
+
The view owns each button's click and pressed state, so neither is in a slot's contract, and a
|
|
71
|
+
mixin cannot take them over.
|
|
46
72
|
|
|
47
73
|
| Slot | Capability | Renders |
|
|
48
74
|
| --- | --- | --- |
|
|
@@ -50,8 +76,275 @@ can single one out.
|
|
|
50
76
|
| `toolbar` | Collection | the row of buttons |
|
|
51
77
|
| `button` | Interactive | one mark's button, per mark |
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
A floating toolbar is this one inside an element carrying `foldkit-richtext-dom/toolbar`'s
|
|
80
|
+
`selectionAnchor`, as that package's README shows.
|
|
81
|
+
|
|
82
|
+
## The block style picker
|
|
83
|
+
|
|
84
|
+
A button per text style the caret's block can take: Paragraph, Heading 1, 2, and 3, under the
|
|
85
|
+
slash menu's labels.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { blockStyles } from 'foldkit-mixins-richtext'
|
|
89
|
+
|
|
90
|
+
blockStyles<Message>()(
|
|
91
|
+
{ document: model.document, selection: model.editor.selection, wrap: edited },
|
|
92
|
+
h,
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
A click sends that style's `RetypedBlock` through `wrap`. At a heading level it does not list,
|
|
97
|
+
none is pressed. In a code block none is pressed either, and a button retypes the block out of
|
|
98
|
+
it, which the editor does given a vocabulary that says the kind holds text. With a node
|
|
99
|
+
selection or none, every button is disabled, because a retype there is refused. Lists and
|
|
100
|
+
quotes are not styles here: leaving one is a lift, not a retype.
|
|
101
|
+
|
|
102
|
+
| Slot | Capability | Renders |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| `root` | Container | the picker's wrapper |
|
|
105
|
+
| `toolbar` | Collection | the row, `role="toolbar"` |
|
|
106
|
+
| `button` | Interactive | one style, `data-style` (the entry's id) and `aria-pressed` |
|
|
107
|
+
|
|
108
|
+
## The link editor
|
|
109
|
+
|
|
110
|
+
An address field with two buttons: link the selection (or change the link around the caret),
|
|
111
|
+
and remove that link. The address being typed is the application's; what it sends is the
|
|
112
|
+
editor's `AppliedMark` or `ClearedMark` through `wrap`, so the editor applies either as one
|
|
113
|
+
transition and one undo step.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import * as RichText from 'foldkit-richtext'
|
|
117
|
+
import { linkEditor } from 'foldkit-mixins-richtext'
|
|
118
|
+
|
|
119
|
+
// Opening the editor: start the draft from the link the selection is in, if any.
|
|
120
|
+
const linkDraft = RichText.linkAt(model.document, model.editor.selection)?.href ?? ''
|
|
121
|
+
|
|
122
|
+
// In a view:
|
|
123
|
+
linkEditor<Message>()(
|
|
124
|
+
{
|
|
125
|
+
document: model.document,
|
|
126
|
+
selection: model.editor.selection,
|
|
127
|
+
draft: model.linkDraft,
|
|
128
|
+
drafted: href => DraftedLink({ href }),
|
|
129
|
+
wrap: edited,
|
|
130
|
+
},
|
|
131
|
+
h,
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
What it sends is `RichText.safeUrl(draft)`, so the address is cleaned and a `javascript:` or
|
|
136
|
+
`data:` one is never sent. Applying needs such an address and something to link: a range of
|
|
137
|
+
text, or a caret inside a link. Otherwise the apply button is disabled and Enter in the field
|
|
138
|
+
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.
|
|
140
|
+
|
|
141
|
+
| Slot | Capability | Renders |
|
|
142
|
+
| --- | --- | --- |
|
|
143
|
+
| `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 Link or Update |
|
|
146
|
+
| `remove` | Interactive | the remove button, `data-link="remove"`, inside a link only |
|
|
147
|
+
|
|
148
|
+
## The slash menu
|
|
149
|
+
|
|
150
|
+
What opens a menu, what it offers, and what Enter sends are the editor's
|
|
151
|
+
(`foldkit-richtext-dom`'s README explains `slashQuery`, `slashEntries`, and `slashMenu`), and
|
|
152
|
+
they are re-exported here so the chrome and the editor share one vocabulary. This package adds
|
|
153
|
+
the two things the editor cannot: the keys that move the highlight, and the view.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
import { slashEntries, slashMenuView, slashMove } from 'foldkit-mixins-richtext'
|
|
157
|
+
|
|
158
|
+
// The catalogue as the caller's Messages.
|
|
159
|
+
const entries = slashEntries(message => edited(message))
|
|
160
|
+
|
|
161
|
+
// Where ArrowDown moves the highlight: the primitive's rule, shared with any other list.
|
|
162
|
+
const next = slashMove(entries, 'see /head', model.editor.menuIndex, 'ArrowDown', modifiers)
|
|
163
|
+
|
|
164
|
+
// The view, placed only while `slashMenu` says a query is open.
|
|
165
|
+
slashMenuView<Message>()(
|
|
166
|
+
{ entries, textBefore: RichText.textBefore(document, caret), index: model.editor.menuIndex },
|
|
167
|
+
h,
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`slashMove` returns the index a key moves the highlight to, or `undefined` for a key that moves
|
|
172
|
+
nothing, and it starts from what the menu highlights now rather than a remembered index, so a
|
|
173
|
+
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, Home/End, and
|
|
175
|
+
Escape in `OnKeyDownPreventDefault` while a query is open, writing the index to
|
|
176
|
+
`editor.menuIndex`. Enter is not: the editor's `update` resolves it against that index (§123).
|
|
177
|
+
|
|
178
|
+
Each item carries `data-entry` (its id), `role="menuitem"`, `aria-current="true"` on the
|
|
179
|
+
highlighted one, and its entry's Message on click. Outside a query the view draws an empty
|
|
180
|
+
list.
|
|
181
|
+
|
|
182
|
+
| Slot | Capability | Renders |
|
|
183
|
+
| --- | --- | --- |
|
|
184
|
+
| `root` | Container | the menu's wrapper |
|
|
185
|
+
| `list` | Collection | the list of matches |
|
|
186
|
+
| `item` | Interactive | one entry, per match |
|
|
187
|
+
|
|
188
|
+
## The block handle
|
|
189
|
+
|
|
190
|
+
The moves one block can make as a whole: dragged by its grip, or up and down. Which block it
|
|
191
|
+
stands for is the caller's, usually one of `RichText.blocksAt(document, selection)`: the
|
|
192
|
+
outermost to move a whole list, an item to reorder a list.
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
import * as RichText from 'foldkit-richtext'
|
|
196
|
+
import { blockAnchor } from 'foldkit-richtext-dom/toolbar'
|
|
197
|
+
import { blockHandle } from 'foldkit-mixins-richtext'
|
|
198
|
+
|
|
199
|
+
const [outermost] = RichText.blocksAt(model.document, model.editor.selection)
|
|
200
|
+
|
|
201
|
+
// Drawn beside its block, in an element `blockAnchor` places and the block keys.
|
|
202
|
+
outermost === undefined
|
|
203
|
+
? h.empty
|
|
204
|
+
: h.div(
|
|
205
|
+
[h.Key(outermost.id), h.OnMount(blockAnchor({ hostId: 'body', node: outermost.id, gap: 8 }))],
|
|
206
|
+
[
|
|
207
|
+
blockHandle<Message>()(
|
|
208
|
+
{ document: model.document, hostId: 'body', node: outermost.id, wrap: edited },
|
|
209
|
+
h,
|
|
210
|
+
),
|
|
211
|
+
],
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
- **The grip** drags the block anywhere the vocabulary lets it stand (`blockDrag`). It is out of
|
|
216
|
+
the tab order, since a drag has no keyboard form.
|
|
217
|
+
- **Up and down** send `MovedBlock` to put the block before its previous sibling or after its
|
|
218
|
+
next. They move it only within its container, so moving it into another one has no keyboard
|
|
219
|
+
path yet. Each is disabled at its end of the container, and both when the block is not in
|
|
220
|
+
the document.
|
|
221
|
+
- **The key matters.** A Mount reads its args once, when its element is inserted, so without
|
|
222
|
+
it the handle would stay beside, and drag, the first block the caret visited.
|
|
223
|
+
|
|
224
|
+
| Slot | Capability | Renders |
|
|
225
|
+
| --- | --- | --- |
|
|
226
|
+
| `root` | Container | the handle, `role="group"` |
|
|
227
|
+
| `grip` | Interactive | what it is dragged by, `data-handle="grip"` |
|
|
228
|
+
| `up` | Interactive | `data-handle="up"` |
|
|
229
|
+
| `down` | Interactive | `data-handle="down"` |
|
|
230
|
+
|
|
231
|
+
## The command palette
|
|
232
|
+
|
|
233
|
+
The slash menu's catalogue, searched from a field of its own instead of typed into the
|
|
234
|
+
document. Whether it is open, its query, and its highlighted index are the application's, as
|
|
235
|
+
`{ query, index } | null` in its Model.
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
import { commandPalette, slashEntries } from 'foldkit-mixins-richtext'
|
|
239
|
+
|
|
240
|
+
const commands = slashEntries(event => Message.ChoseCommand({ event }))
|
|
241
|
+
|
|
242
|
+
model.palette === null
|
|
243
|
+
? h.empty
|
|
244
|
+
: commandPalette<Message>()(
|
|
245
|
+
{
|
|
246
|
+
id: 'commands',
|
|
247
|
+
entries: commands,
|
|
248
|
+
query: model.palette.query,
|
|
249
|
+
index: model.palette.index,
|
|
250
|
+
changed: (query, index) => Message.ChangedPalette({ query, index }),
|
|
251
|
+
closed: Message.ClosedPalette(),
|
|
252
|
+
},
|
|
253
|
+
h,
|
|
254
|
+
)
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Typing sends `changed(query, 0)`; ArrowUp and ArrowDown send `changed(query, next)`, wrapping;
|
|
258
|
+
Home and End stay the field's. Enter and a click send the entry's own Message, which is why the
|
|
259
|
+
entries are wrapped: the application's `ChoseCommand` closes the palette and hands `event` to
|
|
260
|
+
the editor. Enter with nothing matching sends nothing, and Escape sends `closed`. The field is
|
|
261
|
+
a `combobox` whose `aria-activedescendant` names the highlighted option, so `id` must be unique
|
|
262
|
+
on the page. Opening the palette on a chord and moving focus into it are the application's.
|
|
263
|
+
|
|
264
|
+
| Slot | Capability | Renders |
|
|
265
|
+
| --- | --- | --- |
|
|
266
|
+
| `root` | Container | the palette, `role="dialog"` |
|
|
267
|
+
| `input` | TextInput | the search field, `role="combobox"` |
|
|
268
|
+
| `list` | Collection | the matches, `role="listbox"` |
|
|
269
|
+
| `option` | Interactive | one entry, `data-entry` and `aria-selected` |
|
|
270
|
+
|
|
271
|
+
## The status line
|
|
272
|
+
|
|
273
|
+
How long the document is, and what the application found wrong with it. It sends nothing.
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
import * as RichText from 'foldkit-richtext'
|
|
277
|
+
import { editorStatus } from 'foldkit-mixins-richtext'
|
|
278
|
+
|
|
279
|
+
editorStatus<Message>()(
|
|
280
|
+
{ document: model.document, diagnostics: RichText.validate(model.document, ArticleKit) },
|
|
281
|
+
h,
|
|
282
|
+
)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The counts are `RichText.count`: words and characters as `Intl.Segmenter` splits them, kept per
|
|
286
|
+
document value so a caret move does not count again. The problems are whatever `diagnostics`
|
|
287
|
+
holds, one item each; the view does not validate, because which Kit a document answers to is
|
|
288
|
+
the application's. Leave `diagnostics` out and none is shown.
|
|
289
|
+
|
|
290
|
+
| Slot | Capability | Renders |
|
|
291
|
+
| --- | --- | --- |
|
|
292
|
+
| `root` | Container | the status line's wrapper |
|
|
293
|
+
| `counts` | Base | `2 words · 11 characters`, `data-status="counts"` |
|
|
294
|
+
| `problems` | Collection | the list, `data-status="problems"` |
|
|
295
|
+
| `problem` | Base | one diagnostic, `data-code`, and `data-node` when it has one |
|
|
296
|
+
|
|
297
|
+
## The Markdown source editor
|
|
298
|
+
|
|
299
|
+
Source mode is `SourceSession | null` in the application's Model: `foldkit-richtext-markdown`'s
|
|
300
|
+
`openSource` sets it, and `closeSource` ends it. While it is set, draw this instead of the rich
|
|
301
|
+
editor:
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
import { sourceEditor } from 'foldkit-mixins-richtext'
|
|
305
|
+
|
|
306
|
+
sourceEditor<Message>()(
|
|
307
|
+
{
|
|
308
|
+
session: model.source,
|
|
309
|
+
document: model.document,
|
|
310
|
+
drafted: draft => DraftedSource({ draft }),
|
|
311
|
+
moved: caret => MovedInSource({ caret }),
|
|
312
|
+
done: LeftSource(),
|
|
313
|
+
},
|
|
314
|
+
h,
|
|
315
|
+
)
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
- **The text area** holds the draft and sends `drafted` as it changes. When drawn it takes focus
|
|
319
|
+
with its caret at `session.caret`, where `openSource(document, { selection })` put the rich
|
|
320
|
+
editor's caret, then sends `moved` as the caret moves. The application keeps that in
|
|
321
|
+
`session.caret`, so `closeSource(...).selection` is the caret back in the rich editor. The
|
|
322
|
+
caret is placed when the text area appears, not on every render, since a Mount reads its args
|
|
323
|
+
once.
|
|
324
|
+
- **The warnings** under it name what switching back would lose or refuse, read from
|
|
325
|
+
`closeSource`, so there are none until the draft is edited. They are computed once per draft.
|
|
326
|
+
- **`done`** is the way back. The application's `update` decides whether to commit
|
|
327
|
+
`closeSource(...).document` at once or to ask first when there are warnings.
|
|
328
|
+
|
|
329
|
+
Split mode is the same session drawn twice: `sourcePreview<Message>()({ session, document,
|
|
330
|
+
rendering? })` beside the editor renders the document switching back would commit, through the
|
|
331
|
+
read-only renderer, so it dispatches nothing. It shares the editor's parse of the draft, and
|
|
332
|
+
while the draft is unedited it shows the document the application holds now.
|
|
333
|
+
|
|
334
|
+
| Slot | Capability | Renders |
|
|
335
|
+
| --- | --- | --- |
|
|
336
|
+
| `root` | Container | the editor's wrapper |
|
|
337
|
+
| `text` | TextInput | the Markdown, `data-source="text"` |
|
|
338
|
+
| `warnings` | Collection | the list, `data-source="warnings"` |
|
|
339
|
+
| `warning` | Base | one loss, with `data-code` and `data-detail` for a Style to key on |
|
|
340
|
+
| `done` | Interactive | the way back, `data-source="done"` |
|
|
341
|
+
|
|
342
|
+
## What it does not draw
|
|
343
|
+
|
|
344
|
+
- **The placeholder** is the editor's own, placed with `editorAt`, because it is drawn inside
|
|
345
|
+
the editable subtree this package stays out of.
|
|
346
|
+
- **Positioning** is `foldkit-richtext-dom/toolbar`'s: `selectionAnchor` for a floating
|
|
347
|
+
toolbar, `blockAnchor` and `blockDrag` for the handle.
|
|
55
348
|
|
|
56
349
|
## Checks
|
|
57
350
|
|
|
@@ -60,10 +353,10 @@ pnpm --filter foldkit-mixins-richtext typecheck
|
|
|
60
353
|
pnpm vitest run packages/mixins-richtext/test
|
|
61
354
|
```
|
|
62
355
|
|
|
63
|
-
`smoke/` checks the *built* richtext packages the way a consumer meets them
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
356
|
+
`smoke/` checks the *built* richtext packages the way a consumer meets them: through each
|
|
357
|
+
package's `exports` map, from `dist`. Everything inside this workspace resolves them from
|
|
358
|
+
source, so nothing else catches a wrong `exports` path, a missing file, or a wrong `types`
|
|
359
|
+
condition. Build first, then:
|
|
67
360
|
|
|
68
361
|
```bash
|
|
69
362
|
pnpm build
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,210 @@
|
|
|
1
1
|
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
2
3
|
import { ToolbarState } from "foldkit-richtext-dom/toolbar";
|
|
4
|
+
import { EditorEvent, SlashEntry, SlashEntry as SlashEntry$1, SlashMenu, matchingEntries, slashMenu, slashQuery } from "foldkit-richtext-dom/editor";
|
|
5
|
+
import "foldkit/mount";
|
|
6
|
+
import { SourceSession } from "foldkit-richtext-markdown";
|
|
7
|
+
import { KeyboardModifiers } from "foldkit/html";
|
|
8
|
+
//#region src/style.d.ts
|
|
9
|
+
/** The elements the picker publishes: its wrapper, its row, and one button per style. */
|
|
10
|
+
export declare const BlockStyleSlots: Slots.Contract<{
|
|
11
|
+
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>;
|
|
12
|
+
readonly toolbar: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
13
|
+
readonly button: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
14
|
+
}>;
|
|
15
|
+
interface BlockStyleInput<Message> {
|
|
16
|
+
readonly document: RichText.Document;
|
|
17
|
+
readonly selection: RichText.Selection | null;
|
|
18
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
19
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The block style picker as a slot view. The button for the style the selection's block has
|
|
23
|
+
* is pressed; none is in a code block, or at a heading level the list does not offer. Every
|
|
24
|
+
* button is disabled without a text selection — a node selection, or none — because a retype
|
|
25
|
+
* there is refused.
|
|
26
|
+
*/
|
|
27
|
+
export declare const blockStyles: <Message>() => SlotView.SlotView<typeof BlockStyleSlots, BlockStyleInput<Message>, Message>;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/handle.d.ts
|
|
30
|
+
/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */
|
|
31
|
+
export declare const BlockHandleSlots: Slots.Contract<{
|
|
32
|
+
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>;
|
|
33
|
+
readonly grip: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
34
|
+
readonly up: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
35
|
+
readonly down: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
36
|
+
}>;
|
|
37
|
+
interface BlockHandleInput<Message> {
|
|
38
|
+
readonly document: RichText.Document;
|
|
39
|
+
/** The editor host's id, whose blocks a drag measures. */
|
|
40
|
+
readonly hostId: string;
|
|
41
|
+
/** The block the handle stands for. */
|
|
42
|
+
readonly node: RichText.NodeId;
|
|
43
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
44
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The handle as a slot view. The grip drags the block wherever `RichText.moveTargets` allows
|
|
48
|
+
* (`blockDrag`), and is keyed by the block, since a Mount reads its args once. Up moves the
|
|
49
|
+
* block before its previous sibling and down after its next one, within its container; each is
|
|
50
|
+
* disabled at its end of the container, and both when the block is not there.
|
|
51
|
+
*/
|
|
52
|
+
export declare const blockHandle: <Message>() => SlotView.SlotView<typeof BlockHandleSlots, BlockHandleInput<Message>, Message>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/slash.d.ts
|
|
55
|
+
/**
|
|
56
|
+
* The entries this package offers: the editor's catalogue, each Message passed through
|
|
57
|
+
* `wrap` — the seam the toolbar takes too, because the caller usually dispatches a
|
|
58
|
+
* wrapper like `edited(...)`, which is a function.
|
|
59
|
+
*/
|
|
60
|
+
export declare const slashEntries: <Message>(wrap: (message: EditorEvent) => Message) => ReadonlyArray<SlashEntry$1<Message>>;
|
|
61
|
+
/**
|
|
62
|
+
* The index an arrow — or Home, or End — moves the highlight to among the current
|
|
63
|
+
* matches, or `undefined` when the key moves nothing. The rule is `foldkit-primitives`'
|
|
64
|
+
* `RovingTabindex.move`, so the menu and any other list agree on ArrowUp/ArrowDown,
|
|
65
|
+
* Home/End, wrapping, and on a modified key moving nothing; the menu adds only "over the
|
|
66
|
+
* entries the query currently matches".
|
|
67
|
+
*
|
|
68
|
+
* It moves from what `slashMenu` highlights rather than from the caller's remembered
|
|
69
|
+
* index, so a query that narrowed past it is not moved from a position the user cannot
|
|
70
|
+
* see.
|
|
71
|
+
*/
|
|
72
|
+
export declare const slashMove: <Message>(entries: ReadonlyArray<SlashEntry$1<Message>>, textBefore: string, index: number, key: string, modifiers: KeyboardModifiers) => number | undefined;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/palette.d.ts
|
|
75
|
+
/** The elements the palette publishes: its wrapper, the search field, the list, and its options. */
|
|
76
|
+
export declare const CommandPaletteSlots: Slots.Contract<{
|
|
77
|
+
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>;
|
|
78
|
+
readonly input: 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>;
|
|
79
|
+
readonly list: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
80
|
+
readonly option: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
81
|
+
}>;
|
|
82
|
+
interface CommandPaletteInput<Message> {
|
|
83
|
+
/** The element id the list and its options are named from; unique on the page. */
|
|
84
|
+
readonly id: string;
|
|
85
|
+
/** `slashEntries(wrap)`, and whatever the application adds. */
|
|
86
|
+
readonly entries: ReadonlyArray<SlashEntry<Message>>;
|
|
87
|
+
readonly query: string;
|
|
88
|
+
/** What the palette last highlighted among the matches. */
|
|
89
|
+
readonly index: number;
|
|
90
|
+
/** What the field sends as the query changes or an arrow moves: the next query and index. */
|
|
91
|
+
readonly changed: (query: string, index: number) => Message;
|
|
92
|
+
/** What Escape sends. */
|
|
93
|
+
readonly closed: Message;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The palette as a slot view: a combobox field over a listbox of the matches. ArrowUp and
|
|
97
|
+
* ArrowDown move the highlight, wrapping; Home and End stay the field's. Enter sends the
|
|
98
|
+
* highlighted entry, and does nothing when no entry matches. A stale index — one the matches
|
|
99
|
+
* do not hold — highlights the first match, as the slash menu does, so a query that narrows
|
|
100
|
+
* never leaves Enter choosing nothing.
|
|
101
|
+
*/
|
|
102
|
+
export declare const commandPalette: <Message>() => SlotView.SlotView<typeof CommandPaletteSlots, CommandPaletteInput<Message>, Message>;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/status.d.ts
|
|
105
|
+
/** The elements the status line publishes: its wrapper, the counts, and one item per problem. */
|
|
106
|
+
export declare const EditorStatusSlots: Slots.Contract<{
|
|
107
|
+
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>;
|
|
108
|
+
readonly counts: Slot.UnnamedSlot<Capability.Capability<"Base", readonly []>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
109
|
+
readonly problems: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
110
|
+
readonly problem: Slot.UnnamedSlot<Capability.Capability<"Base", readonly []>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
111
|
+
}>;
|
|
112
|
+
interface EditorStatusInput {
|
|
113
|
+
readonly document: RichText.Document;
|
|
114
|
+
/** What the application found wrong with the document. None is shown when absent. */
|
|
115
|
+
readonly diagnostics?: ReadonlyArray<RichText.Diagnostic> | undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The status line as a slot view. Each problem carries its code, and its node when it has
|
|
119
|
+
* one, as data attributes, so a Style can mark a kind and a Behavior can find the block.
|
|
120
|
+
*/
|
|
121
|
+
export declare const editorStatus: <Message>() => SlotView.SlotView<typeof EditorStatusSlots, EditorStatusInput, Message>;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/source.d.ts
|
|
124
|
+
/** The elements the editor publishes: its wrapper, the text, the warnings, and the way back. */
|
|
125
|
+
export declare const SourceEditorSlots: Slots.Contract<{
|
|
126
|
+
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>;
|
|
127
|
+
readonly text: 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>;
|
|
128
|
+
readonly warnings: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
129
|
+
readonly warning: Slot.UnnamedSlot<Capability.Capability<"Base", readonly []>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
130
|
+
readonly done: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
131
|
+
}>;
|
|
132
|
+
interface SourceEditorInput<Message> {
|
|
133
|
+
readonly session: SourceSession;
|
|
134
|
+
/** The document the session was opened on, which the application still holds. */
|
|
135
|
+
readonly document: RichText.Document;
|
|
136
|
+
/** What the text area sends as the Markdown changes: the next draft. */
|
|
137
|
+
readonly drafted: (draft: string) => Message;
|
|
138
|
+
/** What the text area sends as its caret moves: the session's next `caret` (§147). */
|
|
139
|
+
readonly moved: (caret: number) => Message;
|
|
140
|
+
/** What the way back sends. */
|
|
141
|
+
readonly done: Message;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The source editor as a slot view: a text area holding the draft, then — once the draft is
|
|
145
|
+
* edited — one warning per thing switching back would lose or refuse, then the way back.
|
|
146
|
+
*/
|
|
147
|
+
export declare const sourceEditor: <Message>() => SlotView.SlotView<typeof SourceEditorSlots, SourceEditorInput<Message>, Message>;
|
|
148
|
+
/** The preview publishes one element: the rendered draft. */
|
|
149
|
+
export declare const SourcePreviewSlots: Slots.Contract<{
|
|
150
|
+
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>;
|
|
151
|
+
}>;
|
|
152
|
+
interface SourcePreviewInput {
|
|
153
|
+
readonly session: SourceSession;
|
|
154
|
+
readonly document: RichText.Document;
|
|
155
|
+
/** How declared kinds and marks render, as in the rich editor. Defaults to `noRendering`. */
|
|
156
|
+
readonly rendering?: RichText.Rendering | undefined;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The draft as the document it would become, for split mode: drawn beside `sourceEditor`, it
|
|
160
|
+
* shows what switching back would commit. It is the read-only renderer's output, so it
|
|
161
|
+
* dispatches nothing, and it shares the editor's parse of the draft.
|
|
162
|
+
*/
|
|
163
|
+
export declare const sourcePreview: <Message>() => SlotView.SlotView<typeof SourcePreviewSlots, SourcePreviewInput, Message>;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/link.d.ts
|
|
166
|
+
/** The elements the editor publishes: its wrapper, the address field, and its two buttons. */
|
|
167
|
+
export declare const LinkEditorSlots: Slots.Contract<{
|
|
168
|
+
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>;
|
|
169
|
+
readonly input: 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>;
|
|
170
|
+
readonly apply: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
171
|
+
readonly remove: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
172
|
+
}>;
|
|
173
|
+
interface LinkEditorInput<Message> {
|
|
174
|
+
readonly document: RichText.Document;
|
|
175
|
+
readonly selection: RichText.Selection | null;
|
|
176
|
+
/** The address as typed so far; `RichText.linkAt(...)?.href` is what to start it from. */
|
|
177
|
+
readonly draft: string;
|
|
178
|
+
/** What the field sends as the address changes. */
|
|
179
|
+
readonly drafted: (href: string) => Message;
|
|
180
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
181
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The link editor as a slot view. Applying needs an address the URL policy accepts
|
|
185
|
+
* (`RichText.safeUrl`), which is what it sends, and something to link: a range, or a caret
|
|
186
|
+
* 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.
|
|
188
|
+
*/
|
|
189
|
+
export declare const linkEditor: <Message>() => SlotView.SlotView<typeof LinkEditorSlots, LinkEditorInput<Message>, Message>;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/menu.d.ts
|
|
192
|
+
/** The elements the menu publishes: its wrapper, its list, and one item per match. */
|
|
193
|
+
export declare const SlashMenuSlots: Slots.Contract<{
|
|
194
|
+
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
|
+
readonly list: Slot.UnnamedSlot<Capability.Capability<"Collection", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
196
|
+
readonly item: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
197
|
+
}>;
|
|
198
|
+
interface SlashMenuInput<Message> {
|
|
199
|
+
/** `slashEntries` for this package's catalogue, or an application's own. */
|
|
200
|
+
readonly entries: ReadonlyArray<SlashEntry<Message>>;
|
|
201
|
+
/** The caret's block text before it: `RichText.textBefore(document, position)`. */
|
|
202
|
+
readonly textBefore: string;
|
|
203
|
+
/** What the menu last highlighted; `slashMove` is what moves it. */
|
|
204
|
+
readonly index: number;
|
|
205
|
+
}
|
|
206
|
+
export declare const slashMenuView: <Message>() => SlotView.SlotView<typeof SlashMenuSlots, SlashMenuInput<Message>, Message>;
|
|
207
|
+
//#endregion
|
|
3
208
|
//#region src/index.d.ts
|
|
4
209
|
/** The elements the toolbar publishes: its wrapper, its row, and one button per mark. */
|
|
5
210
|
export declare const MarkToolbarSlots: Slots.Contract<{
|
|
@@ -26,4 +231,5 @@ export interface MarkToolbarInput<Message> {
|
|
|
26
231
|
*/
|
|
27
232
|
export declare const markToolbar: <Message>() => SlotView.SlotView<typeof MarkToolbarSlots, MarkToolbarInput<Message>, Message>;
|
|
28
233
|
//#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 };
|
|
29
235
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"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":";;;;;;;;;qBAwBa,iBAAe,MAAA;;;;;UAMX,gBAAgB;WACtB,UAAU,SAAS;WACnB,WAAW,SAAS;;WAEpB,OAAO,SAAS,gBAAgB;;;;;;;;qBAS9B,cAAe,cAAY,SAAS,gBACxC,iBACP,gBAAgB,UAChB;;;;qBC7BW,kBAAgB,MAAA;;;;;;UAOZ,iBAAiB;WACvB,UAAU,SAAS;;WAEnB;;WAEA,MAAM,SAAS;;WAEf,OAAO,SAAS,gBAAgB;;;;;;;;qBA2B9B,cAAe,cAAY,SAAS,gBACxC,kBACP,iBAA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OAAO;;WAEP,QAAQ;;;;;;WAMR,UAAU,iBAAiB;;;;;;;qBAQzB,cAAe,cAAY,SAAS,gBACxC,kBACP,iBAAiB,UACjB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,454 @@
|
|
|
1
1
|
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
2
|
import * as RichText from "foldkit-richtext";
|
|
3
|
-
import { markActive } from "foldkit-richtext-dom/toolbar";
|
|
3
|
+
import { blockDrag, markActive } from "foldkit-richtext-dom/toolbar";
|
|
4
|
+
import { Effect, Equal, Option, Queue, Schema, Stream } from "effect";
|
|
5
|
+
import { Message, matchingEntries, slashEntries as slashEntries$1, slashMenu, slashMenu as slashMenu$1, slashQuery } from "foldkit-richtext-dom/editor";
|
|
6
|
+
import * as Mount from "foldkit/mount";
|
|
7
|
+
import { RovingTabindex } from "foldkit-primitives/interaction";
|
|
8
|
+
import { renderDocument } from "foldkit-richtext-dom/view";
|
|
9
|
+
import { closeSource } from "foldkit-richtext-markdown";
|
|
10
|
+
//#region src/style.ts
|
|
11
|
+
/**
|
|
12
|
+
* The block style picker (§124 §11, §134): a button per text style the caret's block can take —
|
|
13
|
+
* a paragraph, or a heading — drawn through slots like the mark toolbar.
|
|
14
|
+
*
|
|
15
|
+
* The styles are the slash menu's retype entries, so the two offer the same list under the
|
|
16
|
+
* same labels. Which one is pressed is a read of the document (`RichText.textBlockAt`); what a
|
|
17
|
+
* button sends is its entry's `RetypedBlock`, wrapped for the caller. Lists and quotes are not
|
|
18
|
+
* styles here: leaving one is a lift, not a retype, so a picker that listed them would send a
|
|
19
|
+
* Message that does not undo what it shows. A code block is not a style either, but a retype
|
|
20
|
+
* leaves one (given a vocabulary that says it holds text), so the buttons stay live inside it.
|
|
21
|
+
*/
|
|
22
|
+
const styles = slashEntries$1.filter((entry) => entry.message._tag === "RetypedBlock");
|
|
23
|
+
/** The elements the picker publishes: its wrapper, its row, and one button per style. */
|
|
24
|
+
const BlockStyleSlots = Slots.define({
|
|
25
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
26
|
+
toolbar: Slot.make({ capability: Capability.Collection }),
|
|
27
|
+
button: Slot.make({ capability: Capability.Interactive })
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* The block style picker as a slot view. The button for the style the selection's block has
|
|
31
|
+
* is pressed; none is in a code block, or at a heading level the list does not offer. Every
|
|
32
|
+
* button is disabled without a text selection — a node selection, or none — because a retype
|
|
33
|
+
* there is refused.
|
|
34
|
+
*/
|
|
35
|
+
const blockStyles = () => SlotView.forMessages().define(BlockStyleSlots, (input, slots, h) => {
|
|
36
|
+
const current = RichText.textBlockAt(input.document, input.selection);
|
|
37
|
+
const live = input.selection?.type === "Range";
|
|
38
|
+
return h.div(slots.root.attrs(), [h.div(slots.toolbar.attrs([h.Role("toolbar"), h.AriaLabel("Text style")]), styles.map((style, index) => h.button(slots.button.attrs([
|
|
39
|
+
h.Type("button"),
|
|
40
|
+
h.DataAttribute("style", style.id),
|
|
41
|
+
h.AriaPressed(current !== void 0 && Equal.equals(style.message.block, current) ? "true" : "false"),
|
|
42
|
+
h.Disabled(!live),
|
|
43
|
+
...live ? [h.OnClick(input.wrap(style.message))] : []
|
|
44
|
+
], {
|
|
45
|
+
index,
|
|
46
|
+
id: style.id,
|
|
47
|
+
count: styles.length
|
|
48
|
+
}), [style.label])))]);
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/handle.ts
|
|
52
|
+
/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */
|
|
53
|
+
const BlockHandleSlots = Slots.define({
|
|
54
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
55
|
+
grip: Slot.make({ capability: Capability.Interactive }),
|
|
56
|
+
up: Slot.make({ capability: Capability.Interactive }),
|
|
57
|
+
down: Slot.make({ capability: Capability.Interactive })
|
|
58
|
+
});
|
|
59
|
+
/** The blocks either side of a block in its own container. */
|
|
60
|
+
const siblingsOf = (document, node) => {
|
|
61
|
+
const found = RichText.locateBlock(document, node);
|
|
62
|
+
if (found === void 0) return {};
|
|
63
|
+
const container = found.path.slice(0, -1);
|
|
64
|
+
const parent = container.length === 0 ? void 0 : RichText.blockAtPath(document, container);
|
|
65
|
+
const blocks = parent?.type === "Node" ? parent.blocks ?? [] : document.children;
|
|
66
|
+
const index = found.path[found.path.length - 1];
|
|
67
|
+
return {
|
|
68
|
+
previous: blocks[index - 1],
|
|
69
|
+
next: blocks[index + 1]
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** The drag Mount lifted into the caller's Messages, as the grip carries it. */
|
|
73
|
+
const dragMount = (hostId, node, wrap) => Mount.mapMessage(blockDrag({
|
|
74
|
+
hostId,
|
|
75
|
+
node
|
|
76
|
+
}), wrap);
|
|
77
|
+
/**
|
|
78
|
+
* The handle as a slot view. The grip drags the block wherever `RichText.moveTargets` allows
|
|
79
|
+
* (`blockDrag`), and is keyed by the block, since a Mount reads its args once. Up moves the
|
|
80
|
+
* block before its previous sibling and down after its next one, within its container; each is
|
|
81
|
+
* disabled at its end of the container, and both when the block is not there.
|
|
82
|
+
*/
|
|
83
|
+
const blockHandle = () => SlotView.forMessages().define(BlockHandleSlots, (input, slots, h) => {
|
|
84
|
+
const { previous, next } = siblingsOf(input.document, input.node);
|
|
85
|
+
const move = (to) => input.wrap(Message.MovedBlock({
|
|
86
|
+
node: input.node,
|
|
87
|
+
to
|
|
88
|
+
}));
|
|
89
|
+
return h.div(slots.root.attrs([h.Role("group"), h.AriaLabel("Block")]), [
|
|
90
|
+
h.button(slots.grip.attrs([
|
|
91
|
+
h.Key(input.node),
|
|
92
|
+
h.Type("button"),
|
|
93
|
+
h.DataAttribute("handle", "grip"),
|
|
94
|
+
h.AriaLabel("Drag to move"),
|
|
95
|
+
h.Tabindex(-1),
|
|
96
|
+
h.OnMount(dragMount(input.hostId, input.node, input.wrap))
|
|
97
|
+
]), ["⠿"]),
|
|
98
|
+
h.button(slots.up.attrs([
|
|
99
|
+
h.Type("button"),
|
|
100
|
+
h.DataAttribute("handle", "up"),
|
|
101
|
+
h.AriaLabel("Move up"),
|
|
102
|
+
h.Disabled(previous === void 0),
|
|
103
|
+
...previous === void 0 ? [] : [h.OnClick(move({ before: previous.id }))]
|
|
104
|
+
]), ["↑"]),
|
|
105
|
+
h.button(slots.down.attrs([
|
|
106
|
+
h.Type("button"),
|
|
107
|
+
h.DataAttribute("handle", "down"),
|
|
108
|
+
h.AriaLabel("Move down"),
|
|
109
|
+
h.Disabled(next === void 0),
|
|
110
|
+
...next === void 0 ? [] : [h.OnClick(move({ after: next.id }))]
|
|
111
|
+
]), ["↓"])
|
|
112
|
+
]);
|
|
113
|
+
});
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/slash.ts
|
|
116
|
+
/**
|
|
117
|
+
* The entries this package offers: the editor's catalogue, each Message passed through
|
|
118
|
+
* `wrap` — the seam the toolbar takes too, because the caller usually dispatches a
|
|
119
|
+
* wrapper like `edited(...)`, which is a function.
|
|
120
|
+
*/
|
|
121
|
+
const slashEntries = (wrap) => slashEntries$1.map((entry) => ({
|
|
122
|
+
...entry,
|
|
123
|
+
message: wrap(entry.message)
|
|
124
|
+
}));
|
|
125
|
+
/**
|
|
126
|
+
* The index an arrow — or Home, or End — moves the highlight to among the current
|
|
127
|
+
* matches, or `undefined` when the key moves nothing. The rule is `foldkit-primitives`'
|
|
128
|
+
* `RovingTabindex.move`, so the menu and any other list agree on ArrowUp/ArrowDown,
|
|
129
|
+
* Home/End, wrapping, and on a modified key moving nothing; the menu adds only "over the
|
|
130
|
+
* entries the query currently matches".
|
|
131
|
+
*
|
|
132
|
+
* It moves from what `slashMenu` highlights rather than from the caller's remembered
|
|
133
|
+
* index, so a query that narrowed past it is not moved from a position the user cannot
|
|
134
|
+
* see.
|
|
135
|
+
*/
|
|
136
|
+
const slashMove = (entries, textBefore, index, key, modifiers) => {
|
|
137
|
+
const menu = slashMenu$1(entries, textBefore, index);
|
|
138
|
+
if (menu === void 0 || menu.matches.length === 0) return void 0;
|
|
139
|
+
const from = menu.highlighted === void 0 ? -1 : menu.matches.indexOf(menu.highlighted);
|
|
140
|
+
return RovingTabindex.move([...menu.matches.keys()], from, key, modifiers, {
|
|
141
|
+
orientation: "vertical",
|
|
142
|
+
direction: "ltr",
|
|
143
|
+
loop: true
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/palette.ts
|
|
148
|
+
/**
|
|
149
|
+
* The command palette (§124 §11, §68, §142): the slash menu's catalogue, searched from a field of
|
|
150
|
+
* its own rather than typed into the document, drawn through slots like the rest of the chrome.
|
|
151
|
+
*
|
|
152
|
+
* It holds no state. Whether it is open, the query, and the highlighted index are the
|
|
153
|
+
* caller's, as `{ query, index } | null` in its Model; the view filters with the slash menu's
|
|
154
|
+
* `matchingEntries` and sends what the caller should store next. Choosing an entry sends the
|
|
155
|
+
* entry's own Message, so a caller that closes the palette on a choice wraps its entries to
|
|
156
|
+
* say so (`slashEntries(event => Message.Chose({ event }))`) — the palette cannot know which
|
|
157
|
+
* of the caller's Messages it is.
|
|
158
|
+
*/
|
|
159
|
+
/** The elements the palette publishes: its wrapper, the search field, the list, and its options. */
|
|
160
|
+
const CommandPaletteSlots = Slots.define({
|
|
161
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
162
|
+
input: Slot.make({ capability: Capability.TextInput }),
|
|
163
|
+
list: Slot.make({ capability: Capability.Collection }),
|
|
164
|
+
option: Slot.make({ capability: Capability.Interactive })
|
|
165
|
+
});
|
|
166
|
+
/**
|
|
167
|
+
* The palette as a slot view: a combobox field over a listbox of the matches. ArrowUp and
|
|
168
|
+
* ArrowDown move the highlight, wrapping; Home and End stay the field's. Enter sends the
|
|
169
|
+
* highlighted entry, and does nothing when no entry matches. A stale index — one the matches
|
|
170
|
+
* do not hold — highlights the first match, as the slash menu does, so a query that narrows
|
|
171
|
+
* never leaves Enter choosing nothing.
|
|
172
|
+
*/
|
|
173
|
+
const commandPalette = () => SlotView.forMessages().define(CommandPaletteSlots, (input, slots, h) => {
|
|
174
|
+
const matches = matchingEntries(input.entries, input.query);
|
|
175
|
+
const current = matches[input.index] === void 0 ? 0 : input.index;
|
|
176
|
+
const highlighted = matches[current];
|
|
177
|
+
const list = `${input.id}-list`;
|
|
178
|
+
const optionId = (entry) => `${input.id}-option-${entry.id}`;
|
|
179
|
+
const keyed = (key, modifiers) => {
|
|
180
|
+
if (key === "Escape") return Option.some(input.closed);
|
|
181
|
+
if (key === "Enter") return Option.fromUndefinedOr(highlighted?.message);
|
|
182
|
+
if (key !== "ArrowUp" && key !== "ArrowDown") return Option.none();
|
|
183
|
+
const next = RovingTabindex.move([...matches.keys()], current, key, modifiers, {
|
|
184
|
+
orientation: "vertical",
|
|
185
|
+
direction: "ltr",
|
|
186
|
+
loop: true
|
|
187
|
+
});
|
|
188
|
+
return next === void 0 ? Option.none() : Option.some(input.changed(input.query, next));
|
|
189
|
+
};
|
|
190
|
+
return h.div(slots.root.attrs([h.Role("dialog"), h.AriaLabel("Commands")]), [h.input(slots.input.attrs([
|
|
191
|
+
h.Type("text"),
|
|
192
|
+
h.Role("combobox"),
|
|
193
|
+
h.AriaLabel("Search commands"),
|
|
194
|
+
h.AriaExpanded(true),
|
|
195
|
+
h.AriaControls(list),
|
|
196
|
+
...highlighted === void 0 ? [] : [h.AriaActiveDescendant(optionId(highlighted))],
|
|
197
|
+
h.Value(input.query),
|
|
198
|
+
h.OnInput((query) => input.changed(query, 0)),
|
|
199
|
+
h.OnKeyDownPreventDefault(keyed)
|
|
200
|
+
])), h.ul(slots.list.attrs([h.Id(list), h.Role("listbox")]), matches.map((entry, index) => h.li(slots.option.attrs([
|
|
201
|
+
h.Id(optionId(entry)),
|
|
202
|
+
h.Role("option"),
|
|
203
|
+
h.DataAttribute("entry", entry.id),
|
|
204
|
+
h.AriaSelected(index === current),
|
|
205
|
+
h.OnClick(entry.message)
|
|
206
|
+
], {
|
|
207
|
+
index,
|
|
208
|
+
id: entry.id,
|
|
209
|
+
count: matches.length
|
|
210
|
+
}), [entry.label])))]);
|
|
211
|
+
});
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/status.ts
|
|
214
|
+
/** The elements the status line publishes: its wrapper, the counts, and one item per problem. */
|
|
215
|
+
const EditorStatusSlots = Slots.define({
|
|
216
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
217
|
+
counts: Slot.make({ capability: Capability.Base }),
|
|
218
|
+
problems: Slot.make({ capability: Capability.Collection }),
|
|
219
|
+
problem: Slot.make({ capability: Capability.Base })
|
|
220
|
+
});
|
|
221
|
+
const counted = /* @__PURE__ */ new WeakMap();
|
|
222
|
+
const countOf = (document) => {
|
|
223
|
+
const kept = counted.get(document);
|
|
224
|
+
if (kept !== void 0) return kept;
|
|
225
|
+
const counts = RichText.count(document);
|
|
226
|
+
counted.set(document, counts);
|
|
227
|
+
return counts;
|
|
228
|
+
};
|
|
229
|
+
const plural = (count, one, many) => `${count} ${count === 1 ? one : many}`;
|
|
230
|
+
/**
|
|
231
|
+
* The status line as a slot view. Each problem carries its code, and its node when it has
|
|
232
|
+
* one, as data attributes, so a Style can mark a kind and a Behavior can find the block.
|
|
233
|
+
*/
|
|
234
|
+
const editorStatus = () => SlotView.forMessages().define(EditorStatusSlots, (input, slots, h) => {
|
|
235
|
+
const { words, characters } = countOf(input.document);
|
|
236
|
+
const problems = input.diagnostics ?? [];
|
|
237
|
+
return h.div(slots.root.attrs(), [h.p(slots.counts.attrs([h.DataAttribute("status", "counts")]), [`${plural(words, "word", "words")} · ${plural(characters, "character", "characters")}`]), h.ul(slots.problems.attrs([h.DataAttribute("status", "problems")]), problems.map((problem, index) => h.li(slots.problem.attrs([h.DataAttribute("code", problem.code), ...problem.node === void 0 ? [] : [h.DataAttribute("node", problem.node)]], {
|
|
238
|
+
index,
|
|
239
|
+
id: `${problem.code}:${problem.node ?? ""}:${index}`,
|
|
240
|
+
count: problems.length
|
|
241
|
+
}), [problem.message])))]);
|
|
242
|
+
});
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/source.ts
|
|
245
|
+
/**
|
|
246
|
+
* The Markdown source editor (§8, §137): the text of a source session, what switching back
|
|
247
|
+
* would lose, and the way back — drawn through slots like the rest of the chrome.
|
|
248
|
+
*
|
|
249
|
+
* Source mode is the application's `SourceSession | null`: a session is open while it is set,
|
|
250
|
+
* and the rich editor stands still meanwhile. This view edits the session's draft and reads
|
|
251
|
+
* `closeSource` for its warnings, which is a pure read, so the list is exactly what closing
|
|
252
|
+
* now would report. What leaving does — commit at once, or confirm first when there are
|
|
253
|
+
* warnings — is the application's `update`.
|
|
254
|
+
*/
|
|
255
|
+
/** The elements the editor publishes: its wrapper, the text, the warnings, and the way back. */
|
|
256
|
+
const SourceEditorSlots = Slots.define({
|
|
257
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
258
|
+
text: Slot.make({ capability: Capability.TextInput }),
|
|
259
|
+
warnings: Slot.make({ capability: Capability.Collection }),
|
|
260
|
+
warning: Slot.make({ capability: Capability.Base }),
|
|
261
|
+
done: Slot.make({ capability: Capability.Interactive })
|
|
262
|
+
});
|
|
263
|
+
/**
|
|
264
|
+
* Puts a text area's caret at `caret` and focuses it, then reports each place the caret moves
|
|
265
|
+
* to, as the offset of its selection's focus, until released.
|
|
266
|
+
*/
|
|
267
|
+
const followCaret = (field, caret, report) => {
|
|
268
|
+
field.focus();
|
|
269
|
+
field.setSelectionRange(caret, caret);
|
|
270
|
+
let last = caret;
|
|
271
|
+
const moved = () => {
|
|
272
|
+
const at = field.selectionDirection === "backward" ? field.selectionStart : field.selectionEnd;
|
|
273
|
+
if (at === last) return;
|
|
274
|
+
last = at;
|
|
275
|
+
report(at);
|
|
276
|
+
};
|
|
277
|
+
const events = [
|
|
278
|
+
"selectionchange",
|
|
279
|
+
"select",
|
|
280
|
+
"input",
|
|
281
|
+
"keyup",
|
|
282
|
+
"mouseup"
|
|
283
|
+
];
|
|
284
|
+
for (const event of events) field.addEventListener(event, moved);
|
|
285
|
+
return () => {
|
|
286
|
+
for (const event of events) field.removeEventListener(event, moved);
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
const CaretMoved = Schema.TaggedStruct("CaretMoved", { caret: Schema.Number });
|
|
290
|
+
/** `followCaret` as a Mount; its element is the source editor's text area. */
|
|
291
|
+
const sourceCaret = Mount.defineStream("RichTextSourceCaret", {
|
|
292
|
+
args: { caret: Schema.Number },
|
|
293
|
+
messages: [CaretMoved],
|
|
294
|
+
execute: ({ element, caret }) => Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => element instanceof HTMLTextAreaElement ? followCaret(element, caret, (at) => Queue.offerUnsafe(queue, CaretMoved.make({ caret: at }))) : () => {}), (release) => Effect.sync(release)))
|
|
295
|
+
});
|
|
296
|
+
/** The caret Mount lifted into the caller's Messages, as the text area carries it. */
|
|
297
|
+
const caretMount = (caret, moved) => Mount.mapMessage(sourceCaret({ caret }), (message) => moved(message.caret));
|
|
298
|
+
/** A warning as a sentence; its code and detail also ride on the element for a Style. */
|
|
299
|
+
const describe = (diagnostic) => diagnostic.code === "UnsupportedMark" ? `${diagnostic.detail} formatting has no Markdown and will be lost` : diagnostic.code === "UnsafeUrl" ? `An unsafe ${diagnostic.detail} address will be dropped` : `${diagnostic.detail} has no Markdown form here and will be lost`;
|
|
300
|
+
const previewIds = () => {
|
|
301
|
+
let next = 0;
|
|
302
|
+
return { mint: () => `preview-${next++}` };
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* What closing the session now would give, as the view shows it: the warnings and the preview's
|
|
306
|
+
* document. An unedited draft gives back the caller's document and warns of nothing, which is
|
|
307
|
+
* `closeSource`'s rule, so it is answered without the parse `closeSource` spends placing the
|
|
308
|
+
* caret. An edited draft's answer is parsed once per draft and kept: the cache is keyed by the
|
|
309
|
+
* session's `unprintable` array, which stays the same object while the draft and caret are
|
|
310
|
+
* replaced, so moving the caret does not parse again, and a closed session's entry is collected
|
|
311
|
+
* with it.
|
|
312
|
+
*/
|
|
313
|
+
const parsed = /* @__PURE__ */ new WeakMap();
|
|
314
|
+
const closedFor = (session, document) => {
|
|
315
|
+
if (session.draft === session.printed) return {
|
|
316
|
+
document,
|
|
317
|
+
diagnostics: []
|
|
318
|
+
};
|
|
319
|
+
const kept = parsed.get(session.unprintable);
|
|
320
|
+
if (kept?.draft === session.draft) return kept.closed;
|
|
321
|
+
const closed = closeSource(session, document, previewIds());
|
|
322
|
+
parsed.set(session.unprintable, {
|
|
323
|
+
draft: session.draft,
|
|
324
|
+
closed
|
|
325
|
+
});
|
|
326
|
+
return closed;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* The source editor as a slot view: a text area holding the draft, then — once the draft is
|
|
330
|
+
* edited — one warning per thing switching back would lose or refuse, then the way back.
|
|
331
|
+
*/
|
|
332
|
+
const sourceEditor = () => SlotView.forMessages().define(SourceEditorSlots, (input, slots, h) => {
|
|
333
|
+
const warnings = closedFor(input.session, input.document).diagnostics;
|
|
334
|
+
return h.div(slots.root.attrs(), [
|
|
335
|
+
h.textarea(slots.text.attrs([
|
|
336
|
+
h.AriaLabel("Markdown source"),
|
|
337
|
+
h.DataAttribute("source", "text"),
|
|
338
|
+
h.Value(input.session.draft),
|
|
339
|
+
h.OnInput(input.drafted),
|
|
340
|
+
h.OnMount(caretMount(input.session.caret, input.moved))
|
|
341
|
+
])),
|
|
342
|
+
h.ul(slots.warnings.attrs([h.DataAttribute("source", "warnings")]), warnings.map((warning, index) => h.li(slots.warning.attrs([h.DataAttribute("code", warning.code), h.DataAttribute("detail", warning.detail)], {
|
|
343
|
+
index,
|
|
344
|
+
id: `${warning.code}:${warning.detail}:${index}`,
|
|
345
|
+
count: warnings.length
|
|
346
|
+
}), [describe(warning)]))),
|
|
347
|
+
h.button(slots.done.attrs([
|
|
348
|
+
h.Type("button"),
|
|
349
|
+
h.DataAttribute("source", "done"),
|
|
350
|
+
h.OnClick(input.done)
|
|
351
|
+
]), ["Rich text"])
|
|
352
|
+
]);
|
|
353
|
+
});
|
|
354
|
+
/** The preview publishes one element: the rendered draft. */
|
|
355
|
+
const SourcePreviewSlots = Slots.define({ root: Slot.make({ capability: Capability.Container }) });
|
|
356
|
+
/**
|
|
357
|
+
* The draft as the document it would become, for split mode: drawn beside `sourceEditor`, it
|
|
358
|
+
* shows what switching back would commit. It is the read-only renderer's output, so it
|
|
359
|
+
* dispatches nothing, and it shares the editor's parse of the draft.
|
|
360
|
+
*/
|
|
361
|
+
const sourcePreview = () => SlotView.forMessages().define(SourcePreviewSlots, (input, slots, h) => h.div(slots.root.attrs([h.DataAttribute("source", "preview"), h.AriaLabel("Preview")]), [renderDocument(closedFor(input.session, input.document).document, input.rendering ?? RichText.noRendering)]));
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/link.ts
|
|
364
|
+
/**
|
|
365
|
+
* The link editor (§124 §11, §132): an address field and the two things it can do, drawn
|
|
366
|
+
* through slots like the toolbar and the slash menu.
|
|
367
|
+
*
|
|
368
|
+
* It holds no state. The link it edits is a read of the document (`RichText.linkAt`), the
|
|
369
|
+
* address being typed is the caller's `draft`, and what it sends is an editor Message
|
|
370
|
+
* wrapped for the caller — `AppliedMark` to link the selection or change the link around
|
|
371
|
+
* the caret, `ClearedMark` to remove it — so the editor Bundle makes each one transition.
|
|
372
|
+
* Where it appears, and when, is the caller's: only the caller knows where the caret is.
|
|
373
|
+
*/
|
|
374
|
+
/** The elements the editor publishes: its wrapper, the address field, and its two buttons. */
|
|
375
|
+
const LinkEditorSlots = Slots.define({
|
|
376
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
377
|
+
input: Slot.make({ capability: Capability.TextInput }),
|
|
378
|
+
apply: Slot.make({ capability: Capability.Interactive }),
|
|
379
|
+
remove: Slot.make({ capability: Capability.Interactive })
|
|
380
|
+
});
|
|
381
|
+
/**
|
|
382
|
+
* The link editor as a slot view. Applying needs an address the URL policy accepts
|
|
383
|
+
* (`RichText.safeUrl`), which is what it sends, and something to link: a range, or a caret
|
|
384
|
+
* inside a link. Otherwise the apply button is disabled and Enter in the field does nothing.
|
|
385
|
+
* The remove button is drawn only inside a link.
|
|
386
|
+
*/
|
|
387
|
+
const linkEditor = () => SlotView.forMessages().define(LinkEditorSlots, (input, slots, h) => {
|
|
388
|
+
const link = RichText.linkAt(input.document, input.selection);
|
|
389
|
+
const href = RichText.safeUrl(input.draft);
|
|
390
|
+
const apply = href === void 0 || link === void 0 && !RichText.coversText(input.selection) ? void 0 : input.wrap(Message.AppliedMark({ mark: {
|
|
391
|
+
name: "Link",
|
|
392
|
+
props: { href }
|
|
393
|
+
} }));
|
|
394
|
+
return h.div(slots.root.attrs([h.Role("group"), h.AriaLabel("Link")]), [
|
|
395
|
+
h.input(slots.input.attrs([
|
|
396
|
+
h.Type("url"),
|
|
397
|
+
h.DataAttribute("link", "address"),
|
|
398
|
+
h.AriaLabel("Link address"),
|
|
399
|
+
h.Value(input.draft),
|
|
400
|
+
h.OnInput(input.drafted),
|
|
401
|
+
h.OnKeyDownPreventDefault((key) => key === "Enter" && apply !== void 0 ? Option.some(apply) : Option.none())
|
|
402
|
+
])),
|
|
403
|
+
h.button(slots.apply.attrs([
|
|
404
|
+
h.Type("button"),
|
|
405
|
+
h.DataAttribute("link", "apply"),
|
|
406
|
+
h.Disabled(apply === void 0),
|
|
407
|
+
...apply === void 0 ? [] : [h.OnClick(apply)]
|
|
408
|
+
]), [link === void 0 ? "Link" : "Update"]),
|
|
409
|
+
...link === void 0 ? [] : [h.button(slots.remove.attrs([
|
|
410
|
+
h.Type("button"),
|
|
411
|
+
h.DataAttribute("link", "remove"),
|
|
412
|
+
h.OnClick(input.wrap(Message.ClearedMark({ mark: "Link" })))
|
|
413
|
+
]), ["Remove"])]
|
|
414
|
+
]);
|
|
415
|
+
});
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/menu.ts
|
|
418
|
+
/** The elements the menu publishes: its wrapper, its list, and one item per match. */
|
|
419
|
+
const SlashMenuSlots = Slots.define({
|
|
420
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
421
|
+
list: Slot.make({ capability: Capability.Collection }),
|
|
422
|
+
item: Slot.make({ capability: Capability.Interactive })
|
|
423
|
+
});
|
|
424
|
+
const slashMenuView = () => SlotView.forMessages().define(SlashMenuSlots, (input, slots, h) => {
|
|
425
|
+
const menu = slashMenu(input.entries, input.textBefore, input.index);
|
|
426
|
+
const matches = menu?.matches ?? [];
|
|
427
|
+
const highlighted = matches.findIndex((entry) => entry === menu?.highlighted);
|
|
428
|
+
return h.div(slots.root.attrs(), [h.div(slots.list.attrs([h.Role("menu")]), matches.map((entry, index) => h.button(slots.item.attrs([
|
|
429
|
+
h.Type("button"),
|
|
430
|
+
h.Role("menuitem"),
|
|
431
|
+
h.DataAttribute("entry", entry.id),
|
|
432
|
+
h.AriaCurrent(index === highlighted ? "true" : "false"),
|
|
433
|
+
h.OnClick(entry.message)
|
|
434
|
+
], {
|
|
435
|
+
index,
|
|
436
|
+
id: entry.id,
|
|
437
|
+
count: matches.length
|
|
438
|
+
}), [entry.label])))]);
|
|
439
|
+
});
|
|
440
|
+
//#endregion
|
|
4
441
|
//#region src/index.ts
|
|
442
|
+
/**
|
|
443
|
+
* `foldkit-mixins-richtext` — the editor's chrome, drawn through slots (§35, §120).
|
|
444
|
+
*
|
|
445
|
+
* The editor's Bundle renders one host element and nothing else (§29); the marks
|
|
446
|
+
* toolbar beside it is the application's chrome. This package draws that chrome as
|
|
447
|
+
* a SlotView, so every element it makes is a slot an application styles or extends
|
|
448
|
+
* the way it does any other view. It cannot wrap `marksToolbar`: a slot's
|
|
449
|
+
* contributions resolve at the element the view creates (§120). The two share
|
|
450
|
+
* `markActive` instead.
|
|
451
|
+
*/
|
|
5
452
|
/** The elements the toolbar publishes: its wrapper, its row, and one button per mark. */
|
|
6
453
|
const MarkToolbarSlots = Slots.define({
|
|
7
454
|
root: Slot.make({ capability: Capability.Container }),
|
|
@@ -28,6 +475,6 @@ const markToolbar = () => SlotView.forMessages().define(MarkToolbarSlots, (input
|
|
|
28
475
|
}), [mark])))]);
|
|
29
476
|
});
|
|
30
477
|
//#endregion
|
|
31
|
-
export { MarkToolbarSlots, markToolbar };
|
|
478
|
+
export { BlockHandleSlots, BlockStyleSlots, CommandPaletteSlots, EditorStatusSlots, LinkEditorSlots, MarkToolbarSlots, SlashMenuSlots, SourceEditorSlots, SourcePreviewSlots, blockHandle, blockStyles, commandPalette, editorStatus, linkEditor, markToolbar, matchingEntries, slashEntries, slashMenu, slashMenuView, slashMove, slashQuery, sourceEditor, sourcePreview };
|
|
32
479
|
|
|
33
480
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `foldkit-mixins-richtext` — the editor's chrome, drawn through slots (§35, §120).\n *\n * The editor's Bundle renders one host element and nothing else (§29); the marks\n * toolbar beside it is the application's chrome. This package draws that chrome as\n * a SlotView, so every element it makes is a slot an application styles or extends\n * the way it does any other view. It cannot wrap `marksToolbar`: a slot's\n * contributions resolve at the element the view creates (§120). The two share\n * `markActive` instead.\n */\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { markActive, type ToolbarState } from 'foldkit-richtext-dom/toolbar'\n\n/** The elements the toolbar publishes: its wrapper, its row, and one button per mark. */\nexport const MarkToolbarSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n toolbar: Slot.make({ capability: Capability.Collection }),\n button: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface MarkToolbarInput<Message> {\n /** What the editor projects: `document`, `selection`, and the caret's format. */\n readonly state: ToolbarState\n /** The marks to offer, by name. Defaults to the three `foldkit-richtext` ships. */\n readonly marks?: ReadonlyArray<string> | undefined\n /**\n * A mark to the Message that toggles it for this caller. The editor's\n * `Message.ToggledMark` is data, but a caller usually dispatches its wrapper\n * (`edited(...)`), which is a function — and a plain SlotView holds one.\n */\n readonly toggled: (mark: string) => Message\n}\n\n/**\n * The mark toolbar as a slot view. A Style or Behavior attaches to\n * `MarkToolbarSlots`; each button renders with its mark as the slot item's `id`, so\n * a Behavior can single one out.\n */\nexport const markToolbar = <Message>(): SlotView.SlotView<\n typeof MarkToolbarSlots,\n MarkToolbarInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(MarkToolbarSlots, (input, slots, h) => {\n const marks = input.marks ?? RichText.shippedMarks.map(definition => definition.name)\n return h.div(slots.root.attrs(), [\n h.div(\n slots.toolbar.attrs([h.Role('toolbar')]),\n marks.map((mark, index) =>\n h.button(\n slots.button.attrs(\n [\n h.Type('button'),\n h.DataAttribute('mark', mark),\n h.AriaLabel(mark),\n h.AriaPressed(markActive(input.state, mark) ? 'true' : 'false'),\n h.OnClick(input.toggled(mark)),\n ],\n { index, id: mark, count: marks.length },\n ),\n [mark],\n ),\n ),\n ),\n ])\n })\n"],"mappings":";;;;;AAgBA,MAAa,mBAAmB,MAAM,OAAO;CAC3C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,SAAS,KAAK,KAAK,EAAE,YAAY,WAAW,WAAW,CAAC;CACxD,QAAQ,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;AAC1D,CAAC;;;;;;AAoBD,MAAa,oBAKX,SAAS,YAAqB,CAAC,CAAC,OAAO,mBAAmB,OAAO,OAAO,MAAM;CAC5E,MAAM,QAAQ,MAAM,SAAS,SAAS,aAAa,KAAI,eAAc,WAAW,IAAI;CACpF,OAAO,EAAE,IAAI,MAAM,KAAK,MAAM,GAAG,CAC/B,EAAE,IACA,MAAM,QAAQ,MAAM,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,GACvC,MAAM,KAAK,MAAM,UACf,EAAE,OACA,MAAM,OAAO,MACX;EACE,EAAE,KAAK,QAAQ;EACf,EAAE,cAAc,QAAQ,IAAI;EAC5B,EAAE,UAAU,IAAI;EAChB,EAAE,YAAY,WAAW,MAAM,OAAO,IAAI,IAAI,SAAS,OAAO;EAC9D,EAAE,QAAQ,MAAM,QAAQ,IAAI,CAAC;CAC/B,GACA;EAAE;EAAO,IAAI;EAAM,OAAO,MAAM;CAAO,CACzC,GACA,CAAC,IAAI,CACP,CACF,CACF,CACF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["slashEntries","EditorMessage","editorEntries","slashMenu","EditorMessage"],"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"],"sourcesContent":["/**\n * The block style picker (§124 §11, §134): a button per text style the caret's block can take —\n * a paragraph, or a heading — drawn through slots like the mark toolbar.\n *\n * The styles are the slash menu's retype entries, so the two offer the same list under the\n * same labels. Which one is pressed is a read of the document (`RichText.textBlockAt`); what a\n * button sends is its entry's `RetypedBlock`, wrapped for the caller. Lists and quotes are not\n * styles here: leaving one is a lift, not a retype, so a picker that listed them would send a\n * Message that does not undo what it shows. A code block is not a style either, but a retype\n * leaves one (given a vocabulary that says it holds text), so the buttons stay live inside it.\n */\nimport { Equal } from 'effect'\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { slashEntries, type EditorEvent, type SlashEntry } from 'foldkit-richtext-dom/editor'\n\ntype Retype = Extract<EditorEvent, { readonly _tag: 'RetypedBlock' }>\n\nconst styles = slashEntries.filter(\n (entry): entry is SlashEntry<Retype> => entry.message._tag === 'RetypedBlock',\n)\n\n/** The elements the picker publishes: its wrapper, its row, and one button per style. */\nexport const BlockStyleSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n toolbar: Slot.make({ capability: Capability.Collection }),\n button: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface BlockStyleInput<Message> {\n readonly document: RichText.Document\n readonly selection: RichText.Selection | null\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n}\n\n/**\n * The block style picker as a slot view. The button for the style the selection's block has\n * is pressed; none is in a code block, or at a heading level the list does not offer. Every\n * button is disabled without a text selection — a node selection, or none — because a retype\n * there is refused.\n */\nexport const blockStyles = <Message>(): SlotView.SlotView<\n typeof BlockStyleSlots,\n BlockStyleInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(BlockStyleSlots, (input, slots, h): Html => {\n const current = RichText.textBlockAt(input.document, input.selection)\n const live = input.selection?.type === 'Range'\n return h.div(slots.root.attrs(), [\n h.div(\n slots.toolbar.attrs([h.Role('toolbar'), h.AriaLabel('Text style')]),\n styles.map((style, index) =>\n h.button(\n slots.button.attrs(\n [\n h.Type('button'),\n h.DataAttribute('style', style.id),\n h.AriaPressed(\n current !== undefined && Equal.equals(style.message.block, current)\n ? 'true'\n : 'false',\n ),\n h.Disabled(!live),\n ...(live ? [h.OnClick(input.wrap(style.message))] : []),\n ],\n { index, id: style.id, count: styles.length },\n ),\n [style.label],\n ),\n ),\n ),\n ])\n })\n","/**\n * The block handle (§124 §11, §144): the moves one block can make as a whole, drawn through slots\n * like the rest of the chrome.\n *\n * It holds no state. Which block it stands for is the caller's, usually one of\n * `RichText.blocksAt(document, selection)`: the outermost to move a whole list, an item to\n * reorder a list. Its siblings are a read of the document, and what it sends is the editor's\n * `MovedBlock`, wrapped for the caller.\n */\nimport type { Html } from 'foldkit/html'\nimport * as Mount from 'foldkit/mount'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { Message as EditorMessage, type EditorEvent } from 'foldkit-richtext-dom/editor'\nimport { blockDrag } from 'foldkit-richtext-dom/toolbar'\n\n/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */\nexport const BlockHandleSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n grip: Slot.make({ capability: Capability.Interactive }),\n up: Slot.make({ capability: Capability.Interactive }),\n down: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface BlockHandleInput<Message> {\n readonly document: RichText.Document\n /** The editor host's id, whose blocks a drag measures. */\n readonly hostId: string\n /** The block the handle stands for. */\n readonly node: RichText.NodeId\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n}\n\n/** The blocks either side of a block in its own container. */\nconst siblingsOf = (document: RichText.Document, node: RichText.NodeId) => {\n const found = RichText.locateBlock(document, node)\n if (found === undefined) return {}\n const container = found.path.slice(0, -1)\n const parent = container.length === 0 ? undefined : RichText.blockAtPath(document, container)\n const blocks = parent?.type === 'Node' ? (parent.blocks ?? []) : document.children\n const index = found.path[found.path.length - 1]!\n return { previous: blocks[index - 1], next: blocks[index + 1] }\n}\n\n/** The drag Mount lifted into the caller's Messages, as the grip carries it. */\nexport const dragMount = <Message>(\n hostId: string,\n node: RichText.NodeId,\n wrap: (message: EditorEvent) => Message,\n): Mount.MountAction<Message> => Mount.mapMessage(blockDrag({ hostId, node }), wrap)\n\n/**\n * The handle as a slot view. The grip drags the block wherever `RichText.moveTargets` allows\n * (`blockDrag`), and is keyed by the block, since a Mount reads its args once. Up moves the\n * block before its previous sibling and down after its next one, within its container; each is\n * disabled at its end of the container, and both when the block is not there.\n */\nexport const blockHandle = <Message>(): SlotView.SlotView<\n typeof BlockHandleSlots,\n BlockHandleInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(BlockHandleSlots, (input, slots, h): Html => {\n const { previous, next } = siblingsOf(input.document, input.node)\n const move = (to: RichText.Beside) =>\n input.wrap(EditorMessage.MovedBlock({ node: input.node, to }))\n return h.div(slots.root.attrs([h.Role('group'), h.AriaLabel('Block')]), [\n h.button(\n slots.grip.attrs([\n h.Key(input.node),\n h.Type('button'),\n h.DataAttribute('handle', 'grip'),\n h.AriaLabel('Drag to move'),\n // A drag is the pointer's alone, so the grip would be a stop in the tab order that\n // does nothing; the keyboard has up and down, which stay within the container.\n h.Tabindex(-1),\n h.OnMount(dragMount(input.hostId, input.node, input.wrap)),\n ]),\n ['⠿'],\n ),\n h.button(\n slots.up.attrs([\n h.Type('button'),\n h.DataAttribute('handle', 'up'),\n h.AriaLabel('Move up'),\n h.Disabled(previous === undefined),\n ...(previous === undefined ? [] : [h.OnClick(move({ before: previous.id }))]),\n ]),\n ['↑'],\n ),\n h.button(\n slots.down.attrs([\n h.Type('button'),\n h.DataAttribute('handle', 'down'),\n h.AriaLabel('Move down'),\n h.Disabled(next === undefined),\n ...(next === undefined ? [] : [h.OnClick(move({ after: next.id }))]),\n ]),\n ['↓'],\n ),\n ])\n })\n","/**\n * The slash menu's keys and catalogue (§119, §123): the movement rule over\n * `foldkit-primitives`' `RovingTabindex.move`, and the editor's catalogue with each\n * entry's Message wrapped for this caller.\n *\n * The query, the matching, and the menu itself are the editor's\n * (`foldkit-richtext-dom/editor`) and re-exported here, so an application that imports\n * the chrome gets one vocabulary. `slashMove` is what the caller's keys call to compute\n * an index; the menu's view is `menu.ts`.\n */\nimport type { KeyboardModifiers } from 'foldkit/html'\nimport { RovingTabindex } from 'foldkit-primitives/interaction'\nimport {\n slashEntries as editorEntries,\n slashMenu,\n type EditorEvent,\n type SlashEntry,\n} from 'foldkit-richtext-dom/editor'\n\nexport {\n matchingEntries,\n slashMenu,\n slashQuery,\n type SlashEntry,\n type SlashMenu,\n} from 'foldkit-richtext-dom/editor'\n\n/**\n * The entries this package offers: the editor's catalogue, each Message passed through\n * `wrap` — the seam the toolbar takes too, because the caller usually dispatches a\n * wrapper like `edited(...)`, which is a function.\n */\nexport const slashEntries = <Message>(\n wrap: (message: EditorEvent) => Message,\n): ReadonlyArray<SlashEntry<Message>> =>\n editorEntries.map(entry => ({ ...entry, message: wrap(entry.message) }))\n\n/**\n * The index an arrow — or Home, or End — moves the highlight to among the current\n * matches, or `undefined` when the key moves nothing. The rule is `foldkit-primitives`'\n * `RovingTabindex.move`, so the menu and any other list agree on ArrowUp/ArrowDown,\n * Home/End, wrapping, and on a modified key moving nothing; the menu adds only \"over the\n * entries the query currently matches\".\n *\n * It moves from what `slashMenu` highlights rather than from the caller's remembered\n * index, so a query that narrowed past it is not moved from a position the user cannot\n * see.\n */\nexport const slashMove = <Message>(\n entries: ReadonlyArray<SlashEntry<Message>>,\n textBefore: string,\n index: number,\n key: string,\n modifiers: KeyboardModifiers,\n): number | undefined => {\n const menu = slashMenu(entries, textBefore, index)\n if (menu === undefined || menu.matches.length === 0) return undefined\n const from = menu.highlighted === undefined ? -1 : menu.matches.indexOf(menu.highlighted)\n return RovingTabindex.move([...menu.matches.keys()], from, key, modifiers, {\n orientation: 'vertical',\n // A vertical menu never reads left or right, so the direction is not its business.\n direction: 'ltr',\n loop: true,\n })\n}\n","/**\n * The command palette (§124 §11, §68, §142): the slash menu's catalogue, searched from a field of\n * its own rather than typed into the document, drawn through slots like the rest of the chrome.\n *\n * It holds no state. Whether it is open, the query, and the highlighted index are the\n * caller's, as `{ query, index } | null` in its Model; the view filters with the slash menu's\n * `matchingEntries` and sends what the caller should store next. Choosing an entry sends the\n * entry's own Message, so a caller that closes the palette on a choice wraps its entries to\n * say so (`slashEntries(event => Message.Chose({ event }))`) — the palette cannot know which\n * of the caller's Messages it is.\n */\nimport { Option } from 'effect'\nimport type { Html, KeyboardModifiers } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport { RovingTabindex } from 'foldkit-primitives/interaction'\nimport { matchingEntries, type SlashEntry } from './slash.js'\n\n/** The elements the palette publishes: its wrapper, the search field, the list, and its options. */\nexport const CommandPaletteSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n input: Slot.make({ capability: Capability.TextInput }),\n list: Slot.make({ capability: Capability.Collection }),\n option: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface CommandPaletteInput<Message> {\n /** The element id the list and its options are named from; unique on the page. */\n readonly id: string\n /** `slashEntries(wrap)`, and whatever the application adds. */\n readonly entries: ReadonlyArray<SlashEntry<Message>>\n readonly query: string\n /** What the palette last highlighted among the matches. */\n readonly index: number\n /** What the field sends as the query changes or an arrow moves: the next query and index. */\n readonly changed: (query: string, index: number) => Message\n /** What Escape sends. */\n readonly closed: Message\n}\n\n/**\n * The palette as a slot view: a combobox field over a listbox of the matches. ArrowUp and\n * ArrowDown move the highlight, wrapping; Home and End stay the field's. Enter sends the\n * highlighted entry, and does nothing when no entry matches. A stale index — one the matches\n * do not hold — highlights the first match, as the slash menu does, so a query that narrows\n * never leaves Enter choosing nothing.\n */\nexport const commandPalette = <Message>(): SlotView.SlotView<\n typeof CommandPaletteSlots,\n CommandPaletteInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(CommandPaletteSlots, (input, slots, h): Html => {\n const matches = matchingEntries(input.entries, input.query)\n const current = matches[input.index] === undefined ? 0 : input.index\n const highlighted = matches[current]\n const list = `${input.id}-list`\n // Options have a prefix of their own, so an entry named `list` cannot take the list's id.\n const optionId = (entry: SlashEntry<Message>) => `${input.id}-option-${entry.id}`\n const keyed = (key: string, modifiers: KeyboardModifiers) => {\n if (key === 'Escape') return Option.some(input.closed)\n if (key === 'Enter') return Option.fromUndefinedOr(highlighted?.message)\n if (key !== 'ArrowUp' && key !== 'ArrowDown') return Option.none()\n const next = RovingTabindex.move([...matches.keys()], current, key, modifiers, {\n orientation: 'vertical',\n direction: 'ltr',\n loop: true,\n })\n return next === undefined ? Option.none() : Option.some(input.changed(input.query, next))\n }\n return h.div(slots.root.attrs([h.Role('dialog'), h.AriaLabel('Commands')]), [\n h.input(\n slots.input.attrs([\n h.Type('text'),\n h.Role('combobox'),\n h.AriaLabel('Search commands'),\n h.AriaExpanded(true),\n h.AriaControls(list),\n ...(highlighted === undefined ? [] : [h.AriaActiveDescendant(optionId(highlighted))]),\n h.Value(input.query),\n h.OnInput(query => input.changed(query, 0)),\n h.OnKeyDownPreventDefault(keyed),\n ]),\n ),\n h.ul(\n slots.list.attrs([h.Id(list), h.Role('listbox')]),\n matches.map((entry, index) =>\n h.li(\n slots.option.attrs(\n [\n h.Id(optionId(entry)),\n h.Role('option'),\n h.DataAttribute('entry', entry.id),\n h.AriaSelected(index === current),\n h.OnClick(entry.message),\n ],\n { index, id: entry.id, count: matches.length },\n ),\n [entry.label],\n ),\n ),\n ),\n ])\n })\n","/**\n * The editor's status line (§124 §11, §141): how long the document is, and what the application\n * found wrong with it, drawn through slots like the rest of the chrome.\n *\n * It sends nothing. The counts are `RichText.count`; the problems are whatever the caller\n * passes, usually `RichText.validate` against its Kit, which this view does not run, because\n * which Kit a document answers to is the application's.\n */\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\n\n/** The elements the status line publishes: its wrapper, the counts, and one item per problem. */\nexport const EditorStatusSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n counts: Slot.make({ capability: Capability.Base }),\n problems: Slot.make({ capability: Capability.Collection }),\n problem: Slot.make({ capability: Capability.Base }),\n})\n\nexport interface EditorStatusInput {\n readonly document: RichText.Document\n /** What the application found wrong with the document. None is shown when absent. */\n readonly diagnostics?: ReadonlyArray<RichText.Diagnostic> | undefined\n}\n\n// A caret move redraws the status without changing the document, so counts are kept per\n// document value; each edit makes a new one, and a dropped one is collected with its entry.\nconst counted = new WeakMap<RichText.Document, ReturnType<typeof RichText.count>>()\nconst countOf = (document: RichText.Document) => {\n const kept = counted.get(document)\n if (kept !== undefined) return kept\n const counts = RichText.count(document)\n counted.set(document, counts)\n return counts\n}\n\nconst plural = (count: number, one: string, many: string) => `${count} ${count === 1 ? one : many}`\n\n/**\n * The status line as a slot view. Each problem carries its code, and its node when it has\n * one, as data attributes, so a Style can mark a kind and a Behavior can find the block.\n */\nexport const editorStatus = <Message>(): SlotView.SlotView<\n typeof EditorStatusSlots,\n EditorStatusInput,\n Message\n> =>\n SlotView.forMessages<Message>().define(EditorStatusSlots, (input, slots, h): Html => {\n const { words, characters } = countOf(input.document)\n const problems = input.diagnostics ?? []\n return h.div(slots.root.attrs(), [\n h.p(slots.counts.attrs([h.DataAttribute('status', 'counts')]), [\n `${plural(words, 'word', 'words')} · ${plural(characters, 'character', 'characters')}`,\n ]),\n h.ul(\n slots.problems.attrs([h.DataAttribute('status', 'problems')]),\n problems.map((problem, index) =>\n h.li(\n slots.problem.attrs(\n [\n h.DataAttribute('code', problem.code),\n ...(problem.node === undefined ? [] : [h.DataAttribute('node', problem.node)]),\n ],\n {\n index,\n id: `${problem.code}:${problem.node ?? ''}:${index}`,\n count: problems.length,\n },\n ),\n [problem.message],\n ),\n ),\n ),\n ])\n })\n","/**\n * The Markdown source editor (§8, §137): the text of a source session, what switching back\n * would lose, and the way back — drawn through slots like the rest of the chrome.\n *\n * Source mode is the application's `SourceSession | null`: a session is open while it is set,\n * and the rich editor stands still meanwhile. This view edits the session's draft and reads\n * `closeSource` for its warnings, which is a pure read, so the list is exactly what closing\n * now would report. What leaving does — commit at once, or confirm first when there are\n * warnings — is the application's `update`.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport type { Html } from 'foldkit/html'\nimport * as Mount from 'foldkit/mount'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { renderDocument } from 'foldkit-richtext-dom/view'\nimport {\n closeSource,\n type ClosedSource,\n type MarkdownDiagnostic,\n type SourceSession,\n} from 'foldkit-richtext-markdown'\n\n/** The elements the editor publishes: its wrapper, the text, the warnings, and the way back. */\nexport const SourceEditorSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n text: Slot.make({ capability: Capability.TextInput }),\n warnings: Slot.make({ capability: Capability.Collection }),\n warning: Slot.make({ capability: Capability.Base }),\n done: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface SourceEditorInput<Message> {\n readonly session: SourceSession\n /** The document the session was opened on, which the application still holds. */\n readonly document: RichText.Document\n /** What the text area sends as the Markdown changes: the next draft. */\n readonly drafted: (draft: string) => Message\n /** What the text area sends as its caret moves: the session's next `caret` (§147). */\n readonly moved: (caret: number) => Message\n /** What the way back sends. */\n readonly done: Message\n}\n\n/**\n * Puts a text area's caret at `caret` and focuses it, then reports each place the caret moves\n * to, as the offset of its selection's focus, until released.\n */\nexport const followCaret = (\n field: HTMLTextAreaElement,\n caret: number,\n report: (caret: number) => void,\n): (() => void) => {\n field.focus()\n field.setSelectionRange(caret, caret)\n let last = caret\n const moved = () => {\n const at = field.selectionDirection === 'backward' ? field.selectionStart : field.selectionEnd\n if (at === last) return\n last = at\n report(at)\n }\n // A caret moves by typing, by keys, by the pointer, and by selecting; browsers that fire\n // `selectionchange` on the field itself cover all of these, and the rest are for the others.\n const events = ['selectionchange', 'select', 'input', 'keyup', 'mouseup'] as const\n for (const event of events) field.addEventListener(event, moved)\n return () => {\n for (const event of events) field.removeEventListener(event, moved)\n }\n}\n\nconst CaretMoved = Schema.TaggedStruct('CaretMoved', { caret: Schema.Number })\n\n/** `followCaret` as a Mount; its element is the source editor's text area. */\nconst sourceCaret = Mount.defineStream('RichTextSourceCaret', {\n args: { caret: Schema.Number },\n messages: [CaretMoved],\n execute: ({ element, caret }) =>\n Stream.callback<typeof CaretMoved.Type>(queue =>\n Effect.acquireRelease(\n Effect.sync(() =>\n element instanceof HTMLTextAreaElement\n ? followCaret(element, caret, at =>\n Queue.offerUnsafe(queue, CaretMoved.make({ caret: at })),\n )\n : () => {},\n ),\n release => Effect.sync(release),\n ),\n ),\n})\n\n/** The caret Mount lifted into the caller's Messages, as the text area carries it. */\nexport const caretMount = <Message>(\n caret: number,\n moved: (caret: number) => Message,\n): Mount.MountAction<Message> =>\n Mount.mapMessage(sourceCaret({ caret }), message => moved(message.caret))\n\n/** A warning as a sentence; its code and detail also ride on the element for a Style. */\nconst describe = (diagnostic: MarkdownDiagnostic): string =>\n diagnostic.code === 'UnsupportedMark'\n ? `${diagnostic.detail} formatting has no Markdown and will be lost`\n : diagnostic.code === 'UnsafeUrl'\n ? `An unsafe ${diagnostic.detail} address will be dropped`\n : `${diagnostic.detail} has no Markdown form here and will be lost`\n\n// A preview mints identities nobody keeps; they only have to be distinct within one parse.\nconst previewIds = () => {\n let next = 0\n return { mint: () => `preview-${next++}` }\n}\n\n/**\n * What closing the session now would give, as the view shows it: the warnings and the preview's\n * document. An unedited draft gives back the caller's document and warns of nothing, which is\n * `closeSource`'s rule, so it is answered without the parse `closeSource` spends placing the\n * caret. An edited draft's answer is parsed once per draft and kept: the cache is keyed by the\n * session's `unprintable` array, which stays the same object while the draft and caret are\n * replaced, so moving the caret does not parse again, and a closed session's entry is collected\n * with it.\n */\nconst parsed = new WeakMap<object, { readonly draft: string; readonly closed: ClosedSource }>()\nconst closedFor = (\n session: SourceSession,\n document: RichText.Document,\n): Pick<ClosedSource, 'document' | 'diagnostics'> => {\n if (session.draft === session.printed) return { document, diagnostics: [] }\n const kept = parsed.get(session.unprintable)\n if (kept?.draft === session.draft) return kept.closed\n const closed = closeSource(session, document, previewIds())\n parsed.set(session.unprintable, { draft: session.draft, closed })\n return closed\n}\n\n/**\n * The source editor as a slot view: a text area holding the draft, then — once the draft is\n * edited — one warning per thing switching back would lose or refuse, then the way back.\n */\nexport const sourceEditor = <Message>(): SlotView.SlotView<\n typeof SourceEditorSlots,\n SourceEditorInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(SourceEditorSlots, (input, slots, h): Html => {\n const warnings = closedFor(input.session, input.document).diagnostics\n return h.div(slots.root.attrs(), [\n h.textarea(\n // A slot's attributes are typed for every element, and Foldkit's textarea excludes\n // `InnerHTML`; the Form and Builder families narrow the same way (none is set here).\n slots.text.attrs([\n h.AriaLabel('Markdown source'),\n h.DataAttribute('source', 'text'),\n h.Value(input.session.draft),\n h.OnInput(input.drafted),\n // Read once, when the text area is drawn: the session's caret as it opened.\n h.OnMount(caretMount(input.session.caret, input.moved)),\n ]) as Parameters<typeof h.textarea>[0],\n ),\n h.ul(\n slots.warnings.attrs([h.DataAttribute('source', 'warnings')]),\n warnings.map((warning, index) =>\n h.li(\n slots.warning.attrs(\n [h.DataAttribute('code', warning.code), h.DataAttribute('detail', warning.detail)],\n { index, id: `${warning.code}:${warning.detail}:${index}`, count: warnings.length },\n ),\n [describe(warning)],\n ),\n ),\n ),\n h.button(\n slots.done.attrs([\n h.Type('button'),\n h.DataAttribute('source', 'done'),\n h.OnClick(input.done),\n ]),\n ['Rich text'],\n ),\n ])\n })\n\n/** The preview publishes one element: the rendered draft. */\nexport const SourcePreviewSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n})\n\nexport interface SourcePreviewInput {\n readonly session: SourceSession\n readonly document: RichText.Document\n /** How declared kinds and marks render, as in the rich editor. Defaults to `noRendering`. */\n readonly rendering?: RichText.Rendering | undefined\n}\n\n/**\n * The draft as the document it would become, for split mode: drawn beside `sourceEditor`, it\n * shows what switching back would commit. It is the read-only renderer's output, so it\n * dispatches nothing, and it shares the editor's parse of the draft.\n */\nexport const sourcePreview = <Message>(): SlotView.SlotView<\n typeof SourcePreviewSlots,\n SourcePreviewInput,\n Message\n> =>\n SlotView.forMessages<Message>().define(SourcePreviewSlots, (input, slots, h): Html =>\n h.div(slots.root.attrs([h.DataAttribute('source', 'preview'), h.AriaLabel('Preview')]), [\n renderDocument(\n closedFor(input.session, input.document).document,\n input.rendering ?? RichText.noRendering,\n ),\n ]),\n )\n","/**\n * The link editor (§124 §11, §132): an address field and the two things it can do, drawn\n * through slots like the toolbar and the slash menu.\n *\n * It holds no state. The link it edits is a read of the document (`RichText.linkAt`), the\n * address being typed is the caller's `draft`, and what it sends is an editor Message\n * wrapped for the caller — `AppliedMark` to link the selection or change the link around\n * the caret, `ClearedMark` to remove it — so the editor Bundle makes each one transition.\n * Where it appears, and when, is the caller's: only the caller knows where the caret is.\n */\nimport { Option } from 'effect'\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { Message as EditorMessage, type EditorEvent } from 'foldkit-richtext-dom/editor'\n\n/** The elements the editor publishes: its wrapper, the address field, and its two buttons. */\nexport const LinkEditorSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n input: Slot.make({ capability: Capability.TextInput }),\n apply: Slot.make({ capability: Capability.Interactive }),\n remove: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface LinkEditorInput<Message> {\n readonly document: RichText.Document\n readonly selection: RichText.Selection | null\n /** The address as typed so far; `RichText.linkAt(...)?.href` is what to start it from. */\n readonly draft: string\n /** What the field sends as the address changes. */\n readonly drafted: (href: string) => Message\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n}\n\n/**\n * The link editor as a slot view. Applying needs an address the URL policy accepts\n * (`RichText.safeUrl`), which is what it sends, and something to link: a range, or a caret\n * inside a link. Otherwise the apply button is disabled and Enter in the field does nothing.\n * The remove button is drawn only inside a link.\n */\nexport const linkEditor = <Message>(): SlotView.SlotView<\n typeof LinkEditorSlots,\n LinkEditorInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(LinkEditorSlots, (input, slots, h): Html => {\n const link = RichText.linkAt(input.document, input.selection)\n const href = RichText.safeUrl(input.draft)\n const apply =\n href === undefined || (link === undefined && !RichText.coversText(input.selection))\n ? undefined\n : input.wrap(EditorMessage.AppliedMark({ mark: { name: 'Link', props: { href } } }))\n return h.div(slots.root.attrs([h.Role('group'), h.AriaLabel('Link')]), [\n h.input(\n slots.input.attrs([\n h.Type('url'),\n h.DataAttribute('link', 'address'),\n h.AriaLabel('Link address'),\n h.Value(input.draft),\n h.OnInput(input.drafted),\n h.OnKeyDownPreventDefault(key =>\n key === 'Enter' && apply !== undefined ? Option.some(apply) : Option.none(),\n ),\n ]),\n ),\n h.button(\n slots.apply.attrs([\n h.Type('button'),\n h.DataAttribute('link', 'apply'),\n h.Disabled(apply === undefined),\n ...(apply === undefined ? [] : [h.OnClick(apply)]),\n ]),\n [link === undefined ? 'Link' : 'Update'],\n ),\n ...(link === undefined\n ? []\n : [\n h.button(\n slots.remove.attrs([\n h.Type('button'),\n h.DataAttribute('link', 'remove'),\n h.OnClick(input.wrap(EditorMessage.ClearedMark({ mark: 'Link' }))),\n ]),\n ['Remove'],\n ),\n ]),\n ])\n })\n","/**\n * The slash menu's view (§119, §123): what a caret in a query shows. It is a\n * `SlotView`, so every element it makes is a slot an application styles or extends,\n * exactly as the mark toolbar's are.\n *\n * The list is a value, not state. `slashMenu` decides what matches and what is\n * highlighted, `slashMove` moves the highlight from the caller's keys, and this renders\n * the answer — so the view keeps no Model of its own and the two places that must agree,\n * the render and the `update` that resolves Enter, read the same functions.\n *\n * Outside a query the view renders an empty list; the caller places it only when\n * `slashMenu` says there is a menu, because only the caller knows where the caret is.\n */\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport { slashMenu, type SlashEntry } from './slash.js'\n\n/** The elements the menu publishes: its wrapper, its list, and one item per match. */\nexport const SlashMenuSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n list: Slot.make({ capability: Capability.Collection }),\n item: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface SlashMenuInput<Message> {\n /** `slashEntries` for this package's catalogue, or an application's own. */\n readonly entries: ReadonlyArray<SlashEntry<Message>>\n /** The caret's block text before it: `RichText.textBefore(document, position)`. */\n readonly textBefore: string\n /** What the menu last highlighted; `slashMove` is what moves it. */\n readonly index: number\n}\n\nexport const slashMenuView = <Message>(): SlotView.SlotView<\n typeof SlashMenuSlots,\n SlashMenuInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(SlashMenuSlots, (input, slots, h): Html => {\n const menu = slashMenu(input.entries, input.textBefore, input.index)\n const matches = menu?.matches ?? []\n const highlighted = matches.findIndex(entry => entry === menu?.highlighted)\n return h.div(slots.root.attrs(), [\n h.div(\n slots.list.attrs([h.Role('menu')]),\n matches.map((entry, index) =>\n h.button(\n slots.item.attrs(\n [\n h.Type('button'),\n h.Role('menuitem'),\n h.DataAttribute('entry', entry.id),\n h.AriaCurrent(index === highlighted ? 'true' : 'false'),\n h.OnClick(entry.message),\n ],\n { index, id: entry.id, count: matches.length },\n ),\n [entry.label],\n ),\n ),\n ),\n ])\n })\n","/**\n * `foldkit-mixins-richtext` — the editor's chrome, drawn through slots (§35, §120).\n *\n * The editor's Bundle renders one host element and nothing else (§29); the marks\n * toolbar beside it is the application's chrome. This package draws that chrome as\n * a SlotView, so every element it makes is a slot an application styles or extends\n * the way it does any other view. It cannot wrap `marksToolbar`: a slot's\n * contributions resolve at the element the view creates (§120). The two share\n * `markActive` instead.\n */\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { markActive, type ToolbarState } from 'foldkit-richtext-dom/toolbar'\n\n/** The elements the toolbar publishes: its wrapper, its row, and one button per mark. */\nexport const MarkToolbarSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n toolbar: Slot.make({ capability: Capability.Collection }),\n button: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface MarkToolbarInput<Message> {\n /** What the editor projects: `document`, `selection`, and the caret's format. */\n readonly state: ToolbarState\n /** The marks to offer, by name. Defaults to the three `foldkit-richtext` ships. */\n readonly marks?: ReadonlyArray<string> | undefined\n /**\n * A mark to the Message that toggles it for this caller. The editor's\n * `Message.ToggledMark` is data, but a caller usually dispatches its wrapper\n * (`edited(...)`), which is a function — and a plain SlotView holds one.\n */\n readonly toggled: (mark: string) => Message\n}\n\n/**\n * The mark toolbar as a slot view. A Style or Behavior attaches to\n * `MarkToolbarSlots`; each button renders with its mark as the slot item's `id`, so\n * a Behavior can single one out.\n */\nexport const markToolbar = <Message>(): SlotView.SlotView<\n typeof MarkToolbarSlots,\n MarkToolbarInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(MarkToolbarSlots, (input, slots, h) => {\n const marks = input.marks ?? RichText.shippedMarks.map(definition => definition.name)\n return h.div(slots.root.attrs(), [\n h.div(\n slots.toolbar.attrs([h.Role('toolbar')]),\n marks.map((mark, index) =>\n h.button(\n slots.button.attrs(\n [\n h.Type('button'),\n h.DataAttribute('mark', mark),\n h.AriaLabel(mark),\n h.AriaPressed(markActive(input.state, mark) ? 'true' : 'false'),\n h.OnClick(input.toggled(mark)),\n ],\n { index, id: mark, count: marks.length },\n ),\n [mark],\n ),\n ),\n ),\n ])\n })\n\n/** The block style picker's view and its slots (§134). */\nexport { BlockStyleSlots, blockStyles, type BlockStyleInput } from './style.js'\n\n/** The block handle's view and its slots (§144). */\nexport { BlockHandleSlots, blockHandle, type BlockHandleInput } from './handle.js'\n\n/** The command palette's view and its slots (§142). */\nexport { CommandPaletteSlots, commandPalette, type CommandPaletteInput } from './palette.js'\n\n/** The status line's view and its slots (§141). */\nexport { EditorStatusSlots, editorStatus, type EditorStatusInput } from './status.js'\n\n/** The Markdown source editor's view and its slots (§137). */\nexport {\n SourceEditorSlots,\n SourcePreviewSlots,\n sourceEditor,\n sourcePreview,\n type SourceEditorInput,\n type SourcePreviewInput,\n} from './source.js'\n\n/** The link editor's view and its slots (§132). */\nexport { LinkEditorSlots, linkEditor, type LinkEditorInput } from './link.js'\n\n/** The menu's view and its slots (§123), beside the vocabulary it renders. */\nexport { SlashMenuSlots, slashMenuView, type SlashMenuInput } from './menu.js'\n\n/**\n * The slash menu's vocabulary (§123) travels with the chrome it belongs to, so an\n * application importing the family gets the entries and the query rule too.\n */\nexport {\n matchingEntries,\n slashEntries,\n slashMenu,\n slashMove,\n slashQuery,\n type SlashEntry,\n type SlashMenu,\n} from './slash.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,SAASA,eAAa,QACzB,UAAuC,MAAM,QAAQ,SAAS,cACjE;;AAGA,MAAa,kBAAkB,MAAM,OAAO;CAC1C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,SAAS,KAAK,KAAK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AAE,QAAQ,MAAM,OAAO;CACzB,GACA;EAAE;EAAO,IAAI,MAAM;EAAI,OAAO,QAAQ;CAAO,CAC/C,GACA,CAAC,MAAM,KAAK,CACd,CACF,CACF,CACF,CAAC;AACH,CAAC;;;;;;;;;;;;;;AC/CH,MAAa,mBAAmB,MAAM,OAAO;CAC3C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,SAAS,KAAK,KAAK,EAAE,YAAY,WAAW,WAAW,CAAC;CACxD,QAAQ,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;AAC1D,CAAC;;;;;;AAoBD,MAAa,oBAKX,SAAS,YAAqB,CAAC,CAAC,OAAO,mBAAmB,OAAO,OAAO,MAAM;CAC5E,MAAM,QAAQ,MAAM,SAAS,SAAS,aAAa,KAAI,eAAc,WAAW,IAAI;CACpF,OAAO,EAAE,IAAI,MAAM,KAAK,MAAM,GAAG,CAC/B,EAAE,IACA,MAAM,QAAQ,MAAM,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,GACvC,MAAM,KAAK,MAAM,UACf,EAAE,OACA,MAAM,OAAO,MACX;EACE,EAAE,KAAK,QAAQ;EACf,EAAE,cAAc,QAAQ,IAAI;EAC5B,EAAE,UAAU,IAAI;EAChB,EAAE,YAAY,WAAW,MAAM,OAAO,IAAI,IAAI,SAAS,OAAO;EAC9D,EAAE,QAAQ,MAAM,QAAQ,IAAI,CAAC;CAC/B,GACA;EAAE;EAAO,IAAI;EAAM,OAAO,MAAM;CAAO,CACzC,GACA,CAAC,IAAI,CACP,CACF,CACF,CACF,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-mixins-richtext",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The rich-text editor's chrome, drawn through Mixins slots.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
+
"foldkit-plus:source": "./src/index.ts",
|
|
31
32
|
"types": "./dist/index.d.mts",
|
|
32
33
|
"import": "./dist/index.mjs"
|
|
33
34
|
}
|
|
@@ -38,16 +39,19 @@
|
|
|
38
39
|
"LICENSE"
|
|
39
40
|
],
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"foldkit-
|
|
42
|
-
"foldkit-
|
|
43
|
-
"foldkit-
|
|
42
|
+
"foldkit-mixins": "0.6.0",
|
|
43
|
+
"foldkit-primitives": "0.5.0",
|
|
44
|
+
"foldkit-richtext": "0.3.0",
|
|
45
|
+
"foldkit-richtext-dom": "0.3.0",
|
|
46
|
+
"foldkit-richtext-markdown": "0.2.0"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
|
-
"
|
|
49
|
+
"effect": "^4.0.0",
|
|
50
|
+
"foldkit": "^0.165.0"
|
|
47
51
|
},
|
|
48
52
|
"devDependencies": {
|
|
49
|
-
"effect": "4.0.0
|
|
50
|
-
"foldkit": "0.
|
|
53
|
+
"effect": "4.0.0",
|
|
54
|
+
"foldkit": "0.165.0",
|
|
51
55
|
"jsdom": "26.1.0",
|
|
52
56
|
"tsdown": "^0.23.0",
|
|
53
57
|
"typescript": "5.9.3"
|