@folijs/react 0.0.0-stage → 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.
@@ -0,0 +1,466 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AllSelection, alignAt, colorAt, insertHorizontalRule, insertPageBreak, isSafeHref, liftListItem, linkAt, listTypeAt, NodeSelection, normalizeHref, openLinkEditor, redo, redoDepth, removeLink, requestsLinkEditor, setAlign, setBlockType, setHighlight, setLink, setTextColor, sinkListItem, toggleList, toggleMark, undo, undoDepth, wrapInList, } from "@folijs/core";
3
+ import { Fragment, useEffect, useId, useRef, useState, } from "react";
4
+ import { useEditorOrContext, useEditorState } from "./editor.js";
5
+ /**
6
+ * The palettes (fixed: a document should not need a color picker). Text colors keep at least
7
+ * 4.5:1 contrast on white; highlights keep dark text readable.
8
+ */
9
+ const TEXT_COLORS = [
10
+ { name: "Automatic", color: null },
11
+ { name: "Gray", color: "#5f6368" },
12
+ { name: "Red", color: "#c00000" },
13
+ { name: "Orange", color: "#b45309" },
14
+ { name: "Green", color: "#2e7d32" },
15
+ { name: "Blue", color: "#1f5fbf" },
16
+ { name: "Purple", color: "#7030a0" },
17
+ ];
18
+ const HIGHLIGHTS = [
19
+ { name: "None", color: null },
20
+ { name: "Yellow", color: "#fff59d" },
21
+ { name: "Green", color: "#c8e6c9" },
22
+ { name: "Blue", color: "#bbdefb" },
23
+ { name: "Pink", color: "#f8bbd0" },
24
+ { name: "Orange", color: "#ffe0b2" },
25
+ { name: "Gray", color: "#e0e0e0" },
26
+ ];
27
+ /** Whether the selection holds a textblock (a caret's own block first; else it walks the range). */
28
+ function hasTextblock(state) {
29
+ if (state.selection.$from.parent.isTextblock)
30
+ return true;
31
+ let found = false;
32
+ state.doc.nodesBetween(state.selection.from, state.selection.to, (node) => {
33
+ if (node.isTextblock)
34
+ found = true;
35
+ return !found;
36
+ });
37
+ return found;
38
+ }
39
+ /** Four bars, like the alignment they stand for (x and width per bar). */
40
+ const alignIcon = (bars) => (_jsx("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", focusable: "false", children: bars.map(([x, width], i) => (_jsx("rect", { x: x, y: 2.5 + i * 3.5, width: width, height: "1.5", fill: "currentColor" }, i))) }));
41
+ const align = (value, label, bars) => ({
42
+ key: `align-${value}`,
43
+ label,
44
+ text: label,
45
+ symbol: true,
46
+ icon: alignIcon(bars),
47
+ pressed: (state) => alignAt(state) === value,
48
+ enabled: hasTextblock,
49
+ command: () => setAlign(value),
50
+ });
51
+ /** Whether the selection holds textblocks and all of them are `type` with `level` (if given). */
52
+ function blockIs(state, type, level) {
53
+ const { from, to } = state.selection;
54
+ let all = true;
55
+ let any = false;
56
+ state.doc.nodesBetween(from, to, (node) => {
57
+ if (!all)
58
+ return false;
59
+ if (node.isTextblock) {
60
+ any = true;
61
+ if (node.type.name !== type || (level && node.attrs.level !== level))
62
+ all = false;
63
+ }
64
+ return !node.isTextblock;
65
+ });
66
+ return any && all;
67
+ }
68
+ const mark = (key, label, text) => ({
69
+ key,
70
+ label,
71
+ text,
72
+ symbol: true,
73
+ pressed: (_state, editor) => editor.isMarkActive(key),
74
+ command: () => toggleMark(key),
75
+ });
76
+ const heading = (level) => ({
77
+ key: `h${level}`,
78
+ label: `Heading ${level}`,
79
+ text: `H${level}`,
80
+ pressed: (state) => blockIs(state, "heading", level),
81
+ // Pressing an active heading turns it back into a paragraph.
82
+ command: (state) => blockIs(state, "heading", level)
83
+ ? setBlockType("paragraph")
84
+ : setBlockType("heading", { level }),
85
+ });
86
+ const GROUPS = [
87
+ [
88
+ mark("bold", "Bold", "B"),
89
+ mark("italic", "Italic", "I"),
90
+ mark("underline", "Underline", "U"),
91
+ mark("strike", "Strikethrough", "S"),
92
+ {
93
+ key: "link",
94
+ label: "Link",
95
+ text: "Link",
96
+ pressed: (state) => linkAt(state) !== null,
97
+ enabled: (state) => openLinkEditor(state),
98
+ // Asks for the link dialog, as Mod-K does: the toolbar listens for that request.
99
+ command: () => openLinkEditor,
100
+ },
101
+ {
102
+ key: "textColor",
103
+ label: "Text color",
104
+ text: "A",
105
+ symbol: true,
106
+ enabled: hasTextblock,
107
+ menu: {
108
+ options: TEXT_COLORS,
109
+ value: (state) => colorAt(state, "textColor"),
110
+ pick: setTextColor,
111
+ },
112
+ },
113
+ {
114
+ key: "highlight",
115
+ label: "Highlight",
116
+ text: "H",
117
+ symbol: true,
118
+ enabled: hasTextblock,
119
+ menu: {
120
+ options: HIGHLIGHTS,
121
+ value: (state) => colorAt(state, "highlight"),
122
+ pick: setHighlight,
123
+ },
124
+ },
125
+ ],
126
+ [
127
+ {
128
+ key: "paragraph",
129
+ label: "Paragraph",
130
+ text: "¶",
131
+ symbol: true,
132
+ pressed: (state) => blockIs(state, "paragraph"),
133
+ command: () => setBlockType("paragraph"),
134
+ },
135
+ heading(1),
136
+ heading(2),
137
+ heading(3),
138
+ ],
139
+ [
140
+ align("start", "Align left", [
141
+ [1, 14],
142
+ [1, 9],
143
+ [1, 14],
144
+ [1, 9],
145
+ ]),
146
+ align("center", "Center", [
147
+ [1, 14],
148
+ [3.5, 9],
149
+ [1, 14],
150
+ [3.5, 9],
151
+ ]),
152
+ align("end", "Align right", [
153
+ [1, 14],
154
+ [6, 9],
155
+ [1, 14],
156
+ [6, 9],
157
+ ]),
158
+ align("justify", "Justify", [
159
+ [1, 14],
160
+ [1, 14],
161
+ [1, 14],
162
+ [1, 14],
163
+ ]),
164
+ ],
165
+ [
166
+ {
167
+ key: "bulletList",
168
+ label: "Bulleted list",
169
+ text: "•",
170
+ symbol: true,
171
+ pressed: (state) => listTypeAt(state)?.name === "bulletList",
172
+ enabled: (state) => listTypeAt(state) !== null || wrapInList("bulletList")(state),
173
+ command: () => toggleList("bulletList"),
174
+ },
175
+ {
176
+ key: "orderedList",
177
+ label: "Numbered list",
178
+ // A symbol, not "1.": visible text that is not part of the name fails WCAG 2.5.3.
179
+ text: "№",
180
+ symbol: true,
181
+ pressed: (state) => listTypeAt(state)?.name === "orderedList",
182
+ enabled: (state) => listTypeAt(state) !== null || wrapInList("orderedList")(state),
183
+ command: () => toggleList("orderedList"),
184
+ },
185
+ {
186
+ key: "outdent",
187
+ label: "Decrease indent",
188
+ text: "⇤",
189
+ symbol: true,
190
+ enabled: (state) => listTypeAt(state) !== null,
191
+ command: () => liftListItem(),
192
+ },
193
+ {
194
+ key: "indent",
195
+ label: "Increase indent",
196
+ text: "⇥",
197
+ symbol: true,
198
+ enabled: (state) => canIndent(state),
199
+ command: () => sinkListItem(),
200
+ },
201
+ ],
202
+ [
203
+ {
204
+ key: "undo",
205
+ label: "Undo",
206
+ text: "Undo",
207
+ enabled: (state) => undoDepth(state) > 0,
208
+ command: () => undo,
209
+ },
210
+ {
211
+ key: "redo",
212
+ label: "Redo",
213
+ text: "Redo",
214
+ enabled: (state) => redoDepth(state) > 0,
215
+ command: () => redo,
216
+ },
217
+ ],
218
+ [
219
+ {
220
+ key: "horizontalRule",
221
+ label: "Horizontal rule",
222
+ text: "―",
223
+ symbol: true,
224
+ enabled: (state) => state.selection.$from.parent.isTextblock ||
225
+ state.selection instanceof AllSelection ||
226
+ (state.selection instanceof NodeSelection && state.selection.node.isBlock),
227
+ command: () => insertHorizontalRule,
228
+ },
229
+ { key: "pageBreak", label: "Page break", text: "Page break", command: () => insertPageBreak },
230
+ ],
231
+ ];
232
+ const ITEMS = GROUPS.flat();
233
+ /** Whether the selection starts in a list item that has an item before it (cheap: no dry run). */
234
+ function canIndent(state) {
235
+ const { $from } = state.selection;
236
+ for (let depth = $from.depth; depth > 0; depth--) {
237
+ if ($from.node(depth).type.name === "listItem")
238
+ return $from.index(depth - 1) > 0;
239
+ }
240
+ return false;
241
+ }
242
+ const sameStates = (a, b) => a.length === b.length &&
243
+ a.every((item, i) => item.pressed === b[i]?.pressed &&
244
+ item.enabled === b[i]?.enabled &&
245
+ item.value === b[i]?.value);
246
+ /** Runs after every transaction: O(selection), no transactions built. */
247
+ const selectStates = (state, editor) => ITEMS.map((item) => ({
248
+ pressed: item.pressed?.(state, editor),
249
+ enabled: item.enabled?.(state) ?? true,
250
+ value: item.menu?.value(state),
251
+ }));
252
+ /**
253
+ * Formatting buttons for an editor: marks, link (a dialog, also on Mod-K in the document), text
254
+ * color and highlight menus, paragraph and heading levels, alignment, lists (bulleted,
255
+ * numbered, decrease and increase indent), undo, redo, horizontal rule, page break. One tab stop (arrow keys,
256
+ * Home and End move between buttons); toggles carry
257
+ * `aria-pressed`; a button whose command cannot run now is `aria-disabled` (still focusable).
258
+ * Clicks leave the focus and selection in the document.
259
+ */
260
+ export function FoliToolbar({ editor: given, disabled = false, onClickCommand, label = "Formatting", className, }) {
261
+ const editor = useEditorOrContext(given, "FoliToolbar");
262
+ const states = useEditorState(selectStates, { editor, isEqual: sameStates });
263
+ const [active, setActive] = useState(0);
264
+ const buttons = useRef([]);
265
+ // The open menu (a menu button's key), if any.
266
+ const [menu, setMenu] = useState(null);
267
+ useEffect(() => {
268
+ if (disabled)
269
+ setMenu(null);
270
+ }, [disabled]);
271
+ const run = (index, event) => {
272
+ const item = ITEMS[index];
273
+ if (!item || disabled || !states[index]?.enabled)
274
+ return;
275
+ if (item.menu) {
276
+ if (menu !== item.key) {
277
+ setMenu(item.key);
278
+ return;
279
+ }
280
+ // Closing by its button: the focus was in the menu, which goes away.
281
+ setMenu(null);
282
+ if (event.detail > 0 && onClickCommand)
283
+ onClickCommand();
284
+ else
285
+ buttons.current[index]?.focus();
286
+ return;
287
+ }
288
+ if (!item.command)
289
+ return;
290
+ editor.run(item.command(editor.state));
291
+ // `detail` counts pointer clicks; Enter and Space on a button give 0.
292
+ if (event.detail > 0)
293
+ onClickCommand?.();
294
+ };
295
+ // The link dialog opens on a request from the link button or Mod-K in the document, and
296
+ // gives the focus back to where it was (the document, or the button) when it closes. It is
297
+ // for the selection it opened on: a change to the document or the selection (a click in the
298
+ // document) closes it. A second request while it is open focuses it again.
299
+ const [dialog, setDialog] = useState(null);
300
+ useEffect(() => editor.subscribe((state, transactions) => {
301
+ if (disabled)
302
+ return;
303
+ if (!transactions.some(requestsLinkEditor)) {
304
+ setDialog((current) => current &&
305
+ (transactions.some((tr) => tr.docChanged) || !state.selection.eq(current.selection))
306
+ ? null
307
+ : current);
308
+ return;
309
+ }
310
+ const active = typeof document === "undefined" ? null : document.activeElement;
311
+ setDialog((current) => current
312
+ ? { ...current, request: current.request + 1 }
313
+ : {
314
+ href: linkAt(state) ?? "",
315
+ selection: state.selection,
316
+ restore: active instanceof HTMLElement ? active : null,
317
+ request: 0,
318
+ });
319
+ }), [editor, disabled]);
320
+ // A dialog never outlives a disabled toolbar (it would come back when enabled again).
321
+ useEffect(() => {
322
+ if (disabled)
323
+ setDialog(null);
324
+ }, [disabled]);
325
+ const closeDialog = () => {
326
+ dialog?.restore?.focus();
327
+ setDialog(null);
328
+ };
329
+ const onKeyDown = (event) => {
330
+ // Alt+Left (back) and other shortcuts are the browser's.
331
+ if (event.altKey || event.ctrlKey || event.metaKey)
332
+ return;
333
+ const count = ITEMS.length;
334
+ const moves = {
335
+ ArrowRight: (active + 1) % count,
336
+ ArrowLeft: (active - 1 + count) % count,
337
+ Home: 0,
338
+ End: count - 1,
339
+ };
340
+ const next = moves[event.key];
341
+ if (next === undefined)
342
+ return;
343
+ event.preventDefault();
344
+ setActive(next);
345
+ buttons.current[next]?.focus();
346
+ };
347
+ let index = 0;
348
+ return (_jsxs(_Fragment, { children: [_jsx("div", { role: "toolbar", "aria-label": label, className: className ? `foli-toolbar ${className}` : "foli-toolbar", onKeyDown: onKeyDown, children: GROUPS.map((group, g) => (_jsxs(Fragment, { children: [g > 0 && _jsx("hr", { className: "foli-toolbar-separator", "aria-orientation": "vertical" }), group.map((item) => {
349
+ const i = index++;
350
+ const state = states[i];
351
+ const off = disabled || !state?.enabled;
352
+ const button = (_jsxs("button", { ref: (element) => {
353
+ buttons.current[i] = element;
354
+ }, type: "button", className: `foli-toolbar-button foli-toolbar-${item.key}`, "aria-label": item.symbol ? item.label : undefined, title: item.label, "aria-pressed": item.pressed ? Boolean(state?.pressed) : undefined, "aria-haspopup": item.menu ? "menu" : undefined, "aria-expanded": item.menu ? menu === item.key : undefined, "aria-disabled": off || undefined, tabIndex: i === active ? 0 : -1,
355
+ // Keep the focus (and the selection) in the document on click.
356
+ onMouseDown: (event) => event.preventDefault(), onFocus: () => setActive(i), onClick: (event) => run(i, event), onKeyDown: (event) => {
357
+ // ArrowDown opens a menu (the WAI-ARIA menu button pattern).
358
+ if (!item.menu || off || event.key !== "ArrowDown")
359
+ return;
360
+ event.preventDefault();
361
+ setMenu(item.key);
362
+ }, children: [item.icon ?? item.text, item.menu && (_jsx("span", { className: "foli-toolbar-swatch", "aria-hidden": "true", style: { background: state?.value ?? "transparent" } }))] }, item.key));
363
+ const options = item.menu?.options;
364
+ if (!options || !item.menu)
365
+ return button;
366
+ const { pick } = item.menu;
367
+ return (_jsxs("span", { className: "foli-toolbar-menu", children: [button, menu === item.key && !disabled && (_jsx(ColorMenu, { label: item.label, options: options, current: state?.value ?? null, onPick: (color, pointer) => {
368
+ editor.run(pick(color));
369
+ setMenu(null);
370
+ if (pointer)
371
+ onClickCommand?.();
372
+ else
373
+ buttons.current[i]?.focus();
374
+ }, onClose: (refocus) => {
375
+ setMenu(null);
376
+ if (refocus)
377
+ buttons.current[i]?.focus();
378
+ } }))] }, item.key));
379
+ })] }, group[0]?.key))) }), dialog && !disabled && (_jsx(LinkDialog, { editor: editor, href: dialog.href, request: dialog.request, onClose: closeDialog }))] }));
380
+ }
381
+ /**
382
+ * A color menu (WAI-ARIA menu with radio items): the current color checked and focused on
383
+ * open; arrow keys, Home and End move; Enter or Space (or a click) picks; Escape closes it back
384
+ * to its button, Tab closes it and moves on; leaving it (a click elsewhere) closes it.
385
+ */
386
+ function ColorMenu({ label, options, current, onPick, onClose, }) {
387
+ const items = useRef([]);
388
+ const checked = Math.max(0, options.findIndex((option) => option.color === current));
389
+ // biome-ignore lint/correctness/useExhaustiveDependencies: focus once, on open.
390
+ useEffect(() => {
391
+ items.current[checked]?.focus();
392
+ }, []);
393
+ const onKeyDown = (event) => {
394
+ const count = options.length;
395
+ const at = items.current.indexOf(event.target);
396
+ const moves = {
397
+ ArrowDown: (at + 1) % count,
398
+ ArrowUp: (at - 1 + count) % count,
399
+ Home: 0,
400
+ End: count - 1,
401
+ };
402
+ const next = moves[event.key];
403
+ // The toolbar's own arrow keys must not see these.
404
+ event.stopPropagation();
405
+ if (next !== undefined) {
406
+ event.preventDefault();
407
+ items.current[next]?.focus();
408
+ }
409
+ else if (event.key === "Escape") {
410
+ event.preventDefault();
411
+ onClose(true);
412
+ }
413
+ else if (event.key === "Tab") {
414
+ // Back to the button, then the browser's Tab moves on from it (out of the toolbar).
415
+ onClose(true);
416
+ }
417
+ };
418
+ return (_jsx("div", { role: "menu", "aria-label": label, className: "foli-menu", onKeyDown: onKeyDown, onBlur: (event) => {
419
+ if (!event.currentTarget.contains(event.relatedTarget))
420
+ onClose(false);
421
+ }, children: options.map((option, i) => (_jsxs("button", { ref: (element) => {
422
+ items.current[i] = element;
423
+ }, type: "button", role: "menuitemradio", "aria-checked": option.color === current, tabIndex: -1, className: "foli-menu-item", onMouseDown: (event) => event.preventDefault(), onClick: (event) => onPick(option.color, event.detail > 0), children: [_jsx("span", { className: "foli-menu-swatch", "aria-hidden": "true", style: { background: option.color ?? "transparent" } }), option.name] }, option.name))) }));
424
+ }
425
+ /**
426
+ * The link dialog: a URL field (prefilled with the link at the selection), Apply, Remove link
427
+ * (for an existing link) and Cancel; Escape cancels. An unsafe or invalid URL is not applied:
428
+ * the field is marked invalid and the message is announced.
429
+ */
430
+ function LinkDialog({ editor, href, request, onClose, }) {
431
+ const [value, setValue] = useState(href);
432
+ const [invalid, setInvalid] = useState(false);
433
+ const input = useRef(null);
434
+ const id = useId();
435
+ // biome-ignore lint/correctness/useExhaustiveDependencies: each request focuses the field again.
436
+ useEffect(() => {
437
+ input.current?.focus();
438
+ input.current?.select();
439
+ }, [request]);
440
+ const apply = (event) => {
441
+ event.preventDefault();
442
+ // The same link again changes nothing (the command does not apply): that is not an error.
443
+ const normalized = normalizeHref(value);
444
+ const unchanged = isSafeHref(normalized) && linkAt(editor.state) === normalized;
445
+ if (unchanged || editor.run(setLink(value)))
446
+ onClose();
447
+ else {
448
+ setInvalid(true);
449
+ input.current?.focus();
450
+ }
451
+ };
452
+ const remove = () => {
453
+ editor.run(removeLink);
454
+ onClose();
455
+ };
456
+ return (_jsx("div", { role: "dialog", "aria-label": href ? "Edit link" : "Add link", className: "foli-link-dialog", onKeyDown: (event) => {
457
+ if (event.key !== "Escape")
458
+ return;
459
+ event.preventDefault();
460
+ onClose();
461
+ }, children: _jsxs("form", { onSubmit: apply, noValidate: true, children: [_jsx("label", { htmlFor: `${id}-url`, children: "URL" }), _jsx("input", { ref: input, id: `${id}-url`, type: "text", inputMode: "url", autoComplete: "off", spellCheck: false, value: value, "aria-invalid": invalid || undefined, "aria-describedby": invalid ? `${id}-error` : undefined, onChange: (event) => {
462
+ setValue(event.target.value);
463
+ setInvalid(false);
464
+ } }), _jsx("button", { type: "submit", children: "Apply" }), href && (_jsx("button", { type: "button", onClick: remove, children: "Remove link" })), _jsx("button", { type: "button", onClick: onClose, children: "Cancel" }), invalid && (_jsx("p", { id: `${id}-error`, className: "foli-link-error", role: "alert", children: "Enter a web or email address, or a link starting with http, https, mailto or tel." }))] }) }));
465
+ }
466
+ //# sourceMappingURL=FoliToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FoliToolbar.js","sourceRoot":"","sources":["../src/FoliToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,YAAY,EACZ,OAAO,EAEP,OAAO,EAGP,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,MAAM,EACN,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,IAAI,EACJ,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,Q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gBACE,GAAG,EAAE,KAAK,EACV,EAAE,EAAE,GAAG,EAAE,MAAM,EACf,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,KAAK,EACf,YAAY,EAAC,KAAK,EAClB,UAAU,EAAE,KAAK,EACjB,KAAK,EAAE,KAAK,kBACE,OAAO,IAAI,SAAS,sBAChB,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,EACrD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wBAC7B,UAAU,CAAC,KAAK,CAAC,CAAC;oBACpB,CAAC,GACD,EACF,iBAAQ,IAAI,EAAC,QAAQ,sBAAe,EACnC,IAAI,IAAI,CACP,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,MAAM,4BAE5B,CACV,EACD,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,uBAE7B,EACR,OAAO,IAAI,CACV,YAAG,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,iBAAiB,EAAC,IAAI,EAAC,OAAO,kGAE1D,CACL,IACI,GACH,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type Editor, type EditorState, type FoliDocument, type Plugin } from "@folijs/core";
2
+ import { type ReactNode, useLayoutEffect } from "react";
3
+ /**
4
+ * `useLayoutEffect` in the browser, `useEffect` on the server, where neither runs: React 18
5
+ * warns about a layout effect in server rendering.
6
+ */
7
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
8
+ export interface UseFoliEditorOptions {
9
+ /** Read once, when the editor is created. To load another document, `editor.setDocument()`. */
10
+ initialContent?: FoliDocument | undefined;
11
+ /** Read once, when the editor is created. */
12
+ plugins?: readonly Plugin[] | undefined;
13
+ }
14
+ /**
15
+ * A headless `Editor` (state, commands, history) owned by the calling component: created on the
16
+ * first render and kept for its lifetime. Later changes to `options` are ignored.
17
+ */
18
+ export declare function useFoliEditor(options?: UseFoliEditorOptions): Editor;
19
+ /** Makes `editor` the one `useCurrentEditor`, `useEditorState` and `FoliCanvas` use below it. */
20
+ export declare function FoliEditorProvider({ editor, children, }: {
21
+ editor: Editor;
22
+ children?: ReactNode | undefined;
23
+ }): import("react").JSX.Element;
24
+ /** The editor of the nearest `FoliEditorProvider` (or `FoliEditor`). Throws outside one. */
25
+ export declare function useCurrentEditor(): Editor;
26
+ /** `editor` if given, else the context's. */
27
+ export declare function useEditorOrContext(editor: Editor | undefined, caller: string): Editor;
28
+ export interface UseEditorStateOptions<T> {
29
+ /** Default: the context's editor. */
30
+ editor?: Editor | undefined;
31
+ /** When the selected value equals the previous one, the component does not re-render (default `Object.is`). */
32
+ isEqual?: ((a: T, b: T) => boolean) | undefined;
33
+ }
34
+ /**
35
+ * A slice of the editor state that re-renders the component only when it changes, e.g.
36
+ * `useEditorState((state, editor) => editor.isMarkActive("bold"))`. The selector runs after
37
+ * every transaction: keep it cheap.
38
+ */
39
+ export declare function useEditorState<T>(selector: (state: EditorState, editor: Editor) => T, { editor: given, isEqual }?: UseEditorStateOptions<T>): T;
40
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,MAAM,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,SAAS,EAId,eAAe,EAIhB,MAAM,OAAO,CAAC;AAEf;;;GAGG;AACH,eAAO,MAAM,yBAAyB,wBACyB,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,+FAA+F;IAC/F,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAC1C,6CAA6C;IAC7C,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAMxE;AAID,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,+BAEA;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC;AAED,6CAA6C;AAC7C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrF;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,+GAA+G;IAC/G,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACjD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,EACnD,EAAE,MAAM,EAAE,KAAK,EAAE,OAAmB,EAAE,GAAE,qBAAqB,CAAC,CAAC,CAAM,GACpE,CAAC,CAgBH"}
package/dist/editor.js ADDED
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createEditor, } from "@folijs/core";
3
+ import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, } from "react";
4
+ /**
5
+ * `useLayoutEffect` in the browser, `useEffect` on the server, where neither runs: React 18
6
+ * warns about a layout effect in server rendering.
7
+ */
8
+ export const useIsomorphicLayoutEffect = typeof document === "undefined" ? useEffect : useLayoutEffect;
9
+ /**
10
+ * A headless `Editor` (state, commands, history) owned by the calling component: created on the
11
+ * first render and kept for its lifetime. Later changes to `options` are ignored.
12
+ */
13
+ export function useFoliEditor(options = {}) {
14
+ const [editor] = useState(() => {
15
+ const { initialContent: document, plugins } = options;
16
+ return createEditor({ ...(document && { document }), ...(plugins && { plugins }) });
17
+ });
18
+ return editor;
19
+ }
20
+ const EditorContext = createContext(null);
21
+ /** Makes `editor` the one `useCurrentEditor`, `useEditorState` and `FoliCanvas` use below it. */
22
+ export function FoliEditorProvider({ editor, children, }) {
23
+ return _jsx(EditorContext.Provider, { value: editor, children: children });
24
+ }
25
+ /** The editor of the nearest `FoliEditorProvider` (or `FoliEditor`). Throws outside one. */
26
+ export function useCurrentEditor() {
27
+ const editor = useContext(EditorContext);
28
+ if (!editor)
29
+ throw new Error("useCurrentEditor: no FoliEditorProvider or FoliEditor above");
30
+ return editor;
31
+ }
32
+ /** `editor` if given, else the context's. */
33
+ export function useEditorOrContext(editor, caller) {
34
+ const context = useContext(EditorContext);
35
+ const found = editor ?? context;
36
+ if (!found)
37
+ throw new Error(`${caller}: pass an editor or render inside a FoliEditorProvider`);
38
+ return found;
39
+ }
40
+ /**
41
+ * A slice of the editor state that re-renders the component only when it changes, e.g.
42
+ * `useEditorState((state, editor) => editor.isMarkActive("bold"))`. The selector runs after
43
+ * every transaction: keep it cheap.
44
+ */
45
+ export function useEditorState(selector, { editor: given, isEqual = Object.is } = {}) {
46
+ const editor = useEditorOrContext(given, "useEditorState");
47
+ // The last selected value, kept across renders so an equal one keeps its identity (an inline
48
+ // selector is a new function every render: it runs again, the result stays the same object).
49
+ const last = useRef(null);
50
+ const subscribe = useCallback((notify) => editor.subscribe(notify), [editor]);
51
+ const getSnapshot = () => {
52
+ const state = editor.state;
53
+ const previous = last.current;
54
+ if (previous?.state === state && previous.selector === selector)
55
+ return previous.value;
56
+ const value = selector(state, editor);
57
+ const kept = previous && isEqual(previous.value, value) ? previous.value : value;
58
+ last.current = { state, selector, value: kept };
59
+ return kept;
60
+ };
61
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
62
+ }
63
+ //# sourceMappingURL=editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,GAKb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EAEb,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,EACR,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAEf;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC;AAShE;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAO,GAAyB,EAAE;IAC9D,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE;QAC7B,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACtD,OAAO,YAAY,CAAC,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,aAAa,GAAG,aAAa,CAAgB,IAAI,CAAC,CAAC;AAEzD,iGAAiG;AACjG,MAAM,UAAU,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,GAIT;IACC,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,QAAQ,GAA0B,CAAC;AACpF,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,gBAAgB;IAC9B,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACzC,IAAI,CAAC,MAA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AAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACjF,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IACF,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { FoliEditorProvider, type UseEditorStateOptions, type UseFoliEditorOptions, useCurrentEditor, useEditorState, useFoliEditor, } from "./editor.js";
2
+ export { FoliCanvas, type FoliCanvasHandle, type FoliCanvasProps } from "./FoliCanvas.js";
3
+ export { type FoliChange, FoliEditor, type FoliEditorHandle, type FoliEditorProps, } from "./FoliEditor.js";
4
+ export { FoliToolbar, type FoliToolbarProps } from "./FoliToolbar.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EACL,KAAK,UAAU,EACf,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { FoliEditorProvider, useCurrentEditor, useEditorState, useFoliEditor, } from "./editor.js";
2
+ export { FoliCanvas } from "./FoliCanvas.js";
3
+ export { FoliEditor, } from "./FoliEditor.js";
4
+ export { FoliToolbar } from "./FoliToolbar.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,gBAAgB,EAChB,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAA+C,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAEL,UAAU,GAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC"}