foldkit-richtext-dom 0.6.4 → 0.6.5
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/dist/{decorations-Ar6URa7n.mjs → decorations-D0J3rIhW.mjs} +2 -3
- package/dist/{decorations-Ar6URa7n.mjs.map → decorations-D0J3rIhW.mjs.map} +1 -1
- package/dist/{editor-Cmo24yol.d.mts → editor-BZCv53Ut.d.mts} +2 -4
- package/dist/editor-BZCv53Ut.d.mts.map +1 -0
- package/dist/editor-bundle.d.mts +3 -5
- package/dist/editor-bundle.d.mts.map +1 -1
- package/dist/editor-bundle.mjs +1 -2
- package/dist/editor.d.mts +1 -1
- package/dist/editor.mjs +1 -2
- package/dist/{events-De4SvZil.d.mts → events-DwwsjT-_.d.mts} +2 -4
- package/dist/events-DwwsjT-_.d.mts.map +1 -0
- package/dist/events.d.mts +1 -1
- package/dist/events.mjs +1 -2
- package/dist/{filler-D2_wc_8Z.mjs → filler-DkAb1dBX.mjs} +2 -3
- package/dist/{filler-D2_wc_8Z.mjs.map → filler-DkAb1dBX.mjs.map} +1 -1
- package/dist/{host-BKvhyPj-.d.mts → host-BMTXAFJJ.d.mts} +3 -5
- package/dist/host-BMTXAFJJ.d.mts.map +1 -0
- package/dist/host.d.mts +1 -1
- package/dist/host.mjs +1 -2
- package/dist/html.d.mts +0 -2
- package/dist/html.d.mts.map +1 -1
- package/dist/html.mjs +2 -3
- package/dist/{index-DDV_JesZ.d.mts → index-Cf3l7Noc.d.mts} +1 -3
- package/dist/index-Cf3l7Noc.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +3 -4
- package/dist/input.d.mts +0 -2
- package/dist/input.d.mts.map +1 -1
- package/dist/input.mjs +1 -2
- package/dist/toolbar.d.mts +0 -6
- package/dist/toolbar.d.mts.map +1 -1
- package/dist/toolbar.mjs +3 -6
- package/dist/toolbar.mjs.map +1 -1
- package/dist/view.d.mts +0 -2
- package/dist/view.d.mts.map +1 -1
- package/dist/view.mjs +3 -4
- package/package.json +5 -5
- package/dist/editor-Cmo24yol.d.mts.map +0 -1
- package/dist/events-De4SvZil.d.mts.map +0 -1
- package/dist/host-BKvhyPj-.d.mts.map +0 -1
- package/dist/index-DDV_JesZ.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as RichText from "foldkit-richtext";
|
|
2
|
-
|
|
2
|
+
// src/decorations.ts
|
|
3
3
|
/**
|
|
4
4
|
* How decorations are drawn (§129), shared by the editor and the read-only view so one
|
|
5
5
|
* stylesheet serves both.
|
|
@@ -51,7 +51,6 @@ const decorationAttributes = (decoration) => {
|
|
|
51
51
|
const fields = typeof data === "object" && data !== null && !Array.isArray(data) ? Object.entries(data).filter((field) => typeof field[1] === "string" && FIELD.test(field[0])) : [];
|
|
52
52
|
return [["data-decoration", decoration.kind], ...fields.map(([name, value]) => [`data-decoration-${name}`, value])];
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { decorationSpans as n, piecesOf as r, decorationAttributes as t };
|
|
56
55
|
|
|
57
|
-
//# sourceMappingURL=decorations-
|
|
56
|
+
//# sourceMappingURL=decorations-D0J3rIhW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorations-
|
|
1
|
+
{"version":3,"file":"decorations-D0J3rIhW.mjs","names":[],"sources":["../src/decorations.ts"],"sourcesContent":["/**\n * How decorations are drawn (§129), shared by the editor and the read-only view so one\n * stylesheet serves both.\n */\nimport * as RichText from 'foldkit-richtext'\n\nexport type Spans = ReadonlyMap<RichText.NodeId, ReadonlyArray<RichText.DecorationSpan>>\n\n/**\n * The decorations over each run (`RichText.decorationsIn`), plus an empty span, `{ from: 0,\n * to: 0 }`, on an empty run a decoration starts or ends in. The core draws nothing over no\n * text, but another person's caret on an empty line still has to show.\n */\nexport const decorationSpans = (\n document: RichText.Document,\n set: RichText.DecorationSet,\n): Spans => {\n const spans = RichText.decorationsIn(document, set)\n if (set.length === 0) return spans\n const lengths = new Map<RichText.NodeId, number>()\n const visit = (blocks: ReadonlyArray<RichText.Block>): void => {\n for (const block of blocks) {\n for (const run of block.children) lengths.set(run.id, run.text.length)\n if (block.type === 'Node' && block.blocks !== undefined) visit(block.blocks)\n }\n }\n visit(document.children)\n const withEmpty = new Map(spans)\n for (const decoration of set) {\n const { from, to } = decoration\n // Both ends must resolve, as `decorationsIn` requires.\n if (!lengths.has(from.node) || !lengths.has(to.node)) continue\n for (const node of from.node === to.node ? [from.node] : [from.node, to.node]) {\n if (lengths.get(node) !== 0) continue\n withEmpty.set(node, [...(withEmpty.get(node) ?? []), { from: 0, to: 0, decoration }])\n }\n }\n return withEmpty\n}\n\n/** `RichText.runPieces`, except that an empty run carries the empty spans on it. */\nexport const piecesOf = (\n text: string,\n spans: ReadonlyArray<RichText.DecorationSpan>,\n): ReadonlyArray<RichText.RunPiece> =>\n text.length === 0\n ? [{ text, decorations: spans.map(span => span.decoration) }]\n : RichText.runPieces(text, spans)\n\nconst FIELD = /^[a-z][a-z0-9-]*$/\n\n/**\n * The attributes a decoration's element carries: `data-decoration` names its kind, and each\n * string field of `data` named in lowercase letters, digits, and hyphens rides as\n * `data-decoration-<name>`, for a stylesheet's `attr()`. Anything else in `data` is not drawn.\n */\nexport const decorationAttributes = (\n decoration: RichText.Decoration,\n): ReadonlyArray<readonly [string, string]> => {\n const data: unknown = decoration.data\n const fields =\n typeof data === 'object' && data !== null && !Array.isArray(data)\n ? Object.entries(data).filter(\n (field): field is [string, string] =>\n typeof field[1] === 'string' && FIELD.test(field[0]),\n )\n : []\n return [\n ['data-decoration', decoration.kind],\n ...fields.map(([name, value]) => [`data-decoration-${name}`, value] as const),\n ]\n}\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,mBACX,UACA,QACU;CACV,MAAM,QAAQ,SAAS,cAAc,UAAU,GAAG;CAClD,IAAI,IAAI,WAAW,GAAG,OAAO;CAC7B,MAAM,0BAAU,IAAI,IAA6B;C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AC,mBAAmB,QAAQ,KAAK,CAAU,CAC9E;AACF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as KeyBinding, n as Attachment, r as Decorate } from "./events-
|
|
1
|
+
import { a as KeyBinding, n as Attachment, r as Decorate } from "./events-DwwsjT-_.mjs";
|
|
2
2
|
import * as RichText from "foldkit-richtext";
|
|
3
3
|
import { Schema } from "effect";
|
|
4
4
|
import * as Mount from "foldkit/mount";
|
|
5
|
-
//#region src/editor.d.ts
|
|
6
5
|
declare const Message: import("foldkit/message").MessageUnion<{
|
|
7
6
|
readonly Typed: {
|
|
8
7
|
text: Schema.String;
|
|
@@ -1120,6 +1119,5 @@ declare const events: Mount.MountDefinitionWithArgs<"RichTextDomEvents", {
|
|
|
1120
1119
|
};
|
|
1121
1120
|
}[];
|
|
1122
1121
|
}>;
|
|
1123
|
-
//#endregion
|
|
1124
1122
|
export { toMessage as _, SlashMenu as a, events as c, matchingEntries as d, patchEditor as f, slashQuery as g, slashMenu as h, SlashEntry as i, focusEditor as l, slashEntries as m, EditorEvent as n, answerEditor as o, redecorateEditor as p, Message as r, attachEditor as s, EditorDrawing as t, heldDocument as u };
|
|
1125
|
-
//# sourceMappingURL=editor-
|
|
1123
|
+
//# sourceMappingURL=editor-BZCv53Ut.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-BZCv53Ut.d.mts","names":["_$__events_js0.Attachment"],"sources":["../src/editor.ts"],"mappings":";;;;cAyBa,mCAAO;;IACT,MAAI,OAAA;;;;;;IAIE,MAAI,OAAA;;;;IAEJ,MAAI,OAAA,gBAAA,OAAA,gBAAA,OAAA;;;;;;;;;;IAKJ,MAAI,OAAA,gBAAA,OAAA,gBAAA,OAAA;;;;;;IACH,OAAK,OAAA,gBAAA,OAAA;;;;;;;;;IAEL,YAAU,OAAA,OAAA,OAAA;;;;;;;IAER,IAAE,OAAA;;;;;;;;;IAIN,MAAI,OAAA,MAAA,OAAA;IAAmB,IA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AU;;WAEV,SAAS;;WAET;;WAEA;;WAEA;;;;;;;;cASE,aAAU;;;;;;;;cA8BV,cAAc,cAAc,WAAW;;;;;;cAoGvC,kBAAmB,SAAO,SAC5B,cAAc,WAAW,WAAS,kBAE1C,cAAc,WAAW;;UAaX,UAAU;WAChB;WACA,SAAS,cAAc,WAAW;;WAElC,aAAa,WAAW;;;;;;;;;;;;;cActB,YAAa,SAAO,SACtB,cAAc,WAAW,WAAS,oBACzB,kBAEjB,UAAU;;UAQI;WACN,YAAY,SAAS;WACrB,WAAW;;WAEX;;WAEA;;WAEA,QAAQ,SAAS;;WAEjB,SAAS,cAAc;;;;;;;cAQrB,eAAY,MACjB,SAAO,SACJ,SAAS,UAAQ,OACnB,SAAS,sBAAoB,UAC3B,kBAAAA;;;;;;cA2BE,cAAW,gBACR,OACP,SAAS,aAAW,WAChB,SAAS;;cAWT,eAAY;;cAMZ,mBAAgB;;;;;cAWhB,cAAW,gBAAkB,WAAa,SAAS;;;;;cAWnD,eAAY,mBAAqB,SAAS;;;;cAQ1C,QAAM,MAAA"}
|
package/dist/editor-bundle.d.mts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { a as KeyBinding, r as Decorate } from "./events-
|
|
2
|
-
import { i as SlashEntry, n as EditorEvent, r as Message } from "./editor-
|
|
3
|
-
import { n as Vocabulary } from "./host-
|
|
1
|
+
import { a as KeyBinding, r as Decorate } from "./events-DwwsjT-_.mjs";
|
|
2
|
+
import { i as SlashEntry, n as EditorEvent, r as Message } from "./editor-BZCv53Ut.mjs";
|
|
3
|
+
import { n as Vocabulary } from "./host-BMTXAFJJ.mjs";
|
|
4
4
|
import * as RichText from "foldkit-richtext";
|
|
5
5
|
import { Option, Schema } from "effect";
|
|
6
6
|
import { Bundle, Wrapped } from "foldkit-bundle";
|
|
7
7
|
import * as Submodel from "foldkit/submodel";
|
|
8
8
|
import * as Command from "foldkit/command";
|
|
9
9
|
import * as Update from "foldkit/update";
|
|
10
|
-
//#region src/editor-bundle.d.ts
|
|
11
10
|
/** Interaction state the parent owns beside the document. */
|
|
12
11
|
export declare const EditorState: Schema.Struct<{
|
|
13
12
|
readonly selection: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -8287,5 +8286,4 @@ export declare const selected: (selection: RichText.Selection | null) => ParentM
|
|
|
8287
8286
|
export declare const undone: () => ParentMessage;
|
|
8288
8287
|
export declare const redone: () => ParentMessage;
|
|
8289
8288
|
export declare const patched: () => ParentMessage;
|
|
8290
|
-
//#endregion
|
|
8291
8289
|
//# sourceMappingURL=editor-bundle.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-bundle.d.mts","names":[],"sources":["../src/editor-bundle.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor-bundle.d.mts","names":[],"sources":["../src/editor-bundle.ts"],"mappings":";;;;;;;;;;qBAqDa,aAAW,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBZ,qBAAqB,YAAY;qBAEhC,OAAK,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAGN,SAAM,SAAa,YAAU;qBAC7B,QAAK,iBAAmB;qBACxB,UAAO,oDAAsD;qBAE7D,UAAO,iBAAmB;qBAC1B,UAAO,MAAU,SAAS,YAAU;qBAEpC,UAAO,iBAAmB;qBAC1B,UAAO,OAAW,SAAS,cAAY;qBAEvC,UAAO,YAAgB,cAAc,SAAS,eAAa;qBAE3D,YAAS,IAAQ,SAAS,cAAY;qBAEtC,cAAa;qBACb,QAAK,MAAU,SAAS,QAAM,IAAM,SAAS,WAAS;qBAEtD,WAAQ,OAAW,SAAS,OAAK,KAAO,SAAS,WAAS;qBAE1D,UAAO,MAAU,SAAS,WAAS;qBAEnC,eAAY,MAAU,SAAS,QAAM,OAAS,OAAO,eAAa;qBAElE,WAAQ,WAAe,SAAS,qBAAmB;qBAEnD,cAAa;qBACb,cAAa;qBACb,eAAc"}
|
package/dist/editor-bundle.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { defineMessageUnion } from "foldkit/message";
|
|
|
7
7
|
import { define } from "foldkit/customElement";
|
|
8
8
|
import { Bundle, Link } from "foldkit-bundle";
|
|
9
9
|
import * as Submodel from "foldkit/submodel";
|
|
10
|
-
|
|
10
|
+
// src/editor-bundle.ts
|
|
11
11
|
/**
|
|
12
12
|
* The controlled-editor feasibility harness (§27): the authoritative Document
|
|
13
13
|
* lives in the parent Model, the editor Bundle reads it through its Link, and a
|
|
@@ -628,7 +628,6 @@ const selected = (selection) => edited(Message.Selected({ selection }));
|
|
|
628
628
|
const undone = () => edited(Message.Undone());
|
|
629
629
|
const redone = () => edited(Message.Redone());
|
|
630
630
|
const patched = () => edited(Message.Patched());
|
|
631
|
-
//#endregion
|
|
632
631
|
export { Editor, EditorState, EditorView, Model, ParentMessage, application, applied, changedProps, cleared, converted, deleted, edited, editor, editorAt, editorView, focus, inserted, lifted, menuTextOf, moved, overlay, patchTo, patched, placeEditor, pressed, redone, replaceChangeSet, retyped, selected, toggled, typed, undone, update, wrapped };
|
|
633
632
|
|
|
634
633
|
//# sourceMappingURL=editor-bundle.mjs.map
|
package/dist/editor.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as toMessage, a as SlashMenu, c as events, d as matchingEntries, f as patchEditor, g as slashQuery, h as slashMenu, i as SlashEntry, l as focusEditor, m as slashEntries, n as EditorEvent, o as answerEditor, p as redecorateEditor, r as Message, s as attachEditor, t as EditorDrawing, u as heldDocument } from "./editor-
|
|
1
|
+
import { _ as toMessage, a as SlashMenu, c as events, d as matchingEntries, f as patchEditor, g as slashQuery, h as slashMenu, i as SlashEntry, l as focusEditor, m as slashEntries, n as EditorEvent, o as answerEditor, p as redecorateEditor, r as Message, s as attachEditor, t as EditorDrawing, u as heldDocument } from "./editor-BZCv53Ut.mjs";
|
|
2
2
|
export { EditorDrawing, EditorEvent, Message, SlashEntry, SlashMenu, answerEditor, attachEditor, events, focusEditor, heldDocument, matchingEntries, patchEditor, redecorateEditor, slashEntries, slashMenu, slashQuery, toMessage };
|
package/dist/editor.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import * as RichText from "foldkit-richtext";
|
|
|
3
3
|
import { Effect, Queue, Schema, Stream } from "effect";
|
|
4
4
|
import * as Mount from "foldkit/mount";
|
|
5
5
|
import { defineMessageUnion } from "foldkit/message";
|
|
6
|
-
|
|
6
|
+
// src/editor.ts
|
|
7
7
|
/**
|
|
8
8
|
* The editor's Message vocabulary and the mount that produces it (§§31, 118).
|
|
9
9
|
*
|
|
@@ -415,7 +415,6 @@ const events = Mount.defineStream("RichTextDomEvents", {
|
|
|
415
415
|
keymap: keymapFor(element.id)
|
|
416
416
|
})), () => Effect.sync(() => releaseMount(element))))
|
|
417
417
|
});
|
|
418
|
-
//#endregion
|
|
419
418
|
export { Message, answerEditor, attachEditor, events, focusEditor, heldDocument, matchingEntries, patchEditor, redecorateEditor, slashEntries, slashMenu, slashQuery, toMessage };
|
|
420
419
|
|
|
421
420
|
//# sourceMappingURL=editor.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as EditorDom } from "./index-
|
|
1
|
+
import { t as EditorDom } from "./index-Cf3l7Noc.mjs";
|
|
2
2
|
import * as RichText from "foldkit-richtext";
|
|
3
|
-
//#region src/events.d.ts
|
|
4
3
|
interface Intent {
|
|
5
4
|
/** The semantic command to run, when the event maps to one. */
|
|
6
5
|
readonly command?: RichText.Command;
|
|
@@ -118,6 +117,5 @@ interface Attachment {
|
|
|
118
117
|
* patches whatever the application commits.
|
|
119
118
|
*/
|
|
120
119
|
declare const attach: (dom: EditorDom, options: AttachOptions) => Attachment;
|
|
121
|
-
//#endregion
|
|
122
120
|
export { KeyBinding as a, intentFor as c, Intent as i, readSelection as l, Attachment as n, SLICE_CLIPBOARD_TYPE as o, Decorate as r, attach as s, AttachOptions as t, restoreSelection as u };
|
|
123
|
-
//# sourceMappingURL=events-
|
|
121
|
+
//# sourceMappingURL=events-DwwsjT-_.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-DwwsjT-_.d.mts","names":[],"sources":["../src/events.ts"],"mappings":";;UAkBiB;;WAEN,UAAU,SAAS;;WAEnB;WACA;;;;;;;;UASM;;WAEN;WACA,SAAS,SAAS;;;;;;;;;;cAkDhB,YAAS,OACb,OAAK,qBAAA,SAEJ,cAAc,gBACrB;cAmEU,gBAAa,KAAS,cAAY,SAAS;;;;;;cA4B3C,mBAAgB,KAAS,WAAS,WAAa,SAAS;;cA4BxD;UAOI;;WAEN,WAAW,SAAS,SAAS;;WAE7B,aAAa;;;;;;WAMb,eAAe,WAAW,SAAS;;;;;WAKnC,MAAM,SAAS;;WAEf,SAAS,cAAc;;;;;WAKvB,WAAW;;WAEX;;;;;;WAMA;;;;;WAKA,QAAQ,SAAS;;WAEjB,aAAa,MAAM,SAAS,QAAQ;;;KAInC,YAAY,UAAU,SAAS,aAAa,SAAS;UAYhD;;WAEN,eAAe;;;;;WAKf,OAAO,OAAO,SAAS,aAAa,WAAW,SAAS;;;;;;WAMxD;;;;;;WAMA,QAAQ,WAAW,SAAS;;;;;WAK5B,YAAY,SAAS;;WAErB;;;;;WAKA;WACA;;;;;;;cA8GE,SAAM,KAAS,WAAS,SAAW,kBAAgB"}
|
package/dist/events.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as KeyBinding, c as intentFor, i as Intent, l as readSelection, n as Attachment, o as SLICE_CLIPBOARD_TYPE, r as Decorate, s as attach, t as AttachOptions, u as restoreSelection } from "./events-
|
|
1
|
+
import { a as KeyBinding, c as intentFor, i as Intent, l as readSelection, n as Attachment, o as SLICE_CLIPBOARD_TYPE, r as Decorate, s as attach, t as AttachOptions, u as restoreSelection } from "./events-DwwsjT-_.mjs";
|
|
2
2
|
export { AttachOptions, Attachment, Decorate, Intent, KeyBinding, SLICE_CLIPBOARD_TYPE, attach, intentFor, readSelection, restoreSelection };
|
package/dist/events.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { patch, positionToRange, rangeToPosition, repair } from "./index.mjs";
|
|
2
2
|
import { parseHtml } from "./html.mjs";
|
|
3
3
|
import * as RichText from "foldkit-richtext";
|
|
4
|
-
|
|
4
|
+
// src/events.ts
|
|
5
5
|
/**
|
|
6
6
|
* Browser events as editor intent (§§30–31). The adapter owns the subtree, so
|
|
7
7
|
* every event it understands is `preventDefault`ed: the browser must not mutate
|
|
@@ -781,7 +781,6 @@ const attach = (dom, options) => {
|
|
|
781
781
|
}
|
|
782
782
|
};
|
|
783
783
|
};
|
|
784
|
-
//#endregion
|
|
785
784
|
export { SLICE_CLIPBOARD_TYPE, attach, intentFor, readSelection, restoreSelection };
|
|
786
785
|
|
|
787
786
|
//# sourceMappingURL=events.mjs.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/filler.ts
|
|
2
2
|
const FILLER_ATTRIBUTE = "data-richtext-filler";
|
|
3
3
|
/** Whether a block's text is all empty runs: a line the caret has nothing to stand beside. */
|
|
4
4
|
const needsFiller = (block) => block.type !== "Unknown" && block.children.length > 0 && block.children.every((run) => run.text === "");
|
|
5
|
-
//#endregion
|
|
6
5
|
export { needsFiller as n, FILLER_ATTRIBUTE as t };
|
|
7
6
|
|
|
8
|
-
//# sourceMappingURL=filler-
|
|
7
|
+
//# sourceMappingURL=filler-DkAb1dBX.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filler-
|
|
1
|
+
{"version":3,"file":"filler-DkAb1dBX.mjs","names":[],"sources":["../src/filler.ts"],"sourcesContent":["/**\n * The `<br>` an empty line holds. A browser can neither draw a caret in an empty text node nor\n * move one onto it with the arrow keys, so an empty line made with Enter could not be reached;\n * the `<br>` is a line the caret can stand on. It holds no text and no position, `mount` and\n * `renderEditable` both draw it, so server markup is still adopted, and an import drops it.\n */\nimport type * as RichText from 'foldkit-richtext'\n\nexport const FILLER_ATTRIBUTE = 'data-richtext-filler'\n\n/** Whether a block's text is all empty runs: a line the caret has nothing to stand beside. */\nexport const needsFiller = (block: RichText.Block): boolean =>\n block.type !== 'Unknown' &&\n block.children.length > 0 &&\n block.children.every(run => run.text === '')\n"],"mappings":";AAQA,MAAa,mBAAmB;;AAGhC,MAAa,eAAe,UAC1B,MAAM,SAAS,aACf,MAAM,SAAS,SAAS,KACxB,MAAM,SAAS,OAAM,QAAO,IAAI,SAAS,EAAE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as KeyBinding, n as Attachment, r as Decorate, t as AttachOptions } from "./events-
|
|
2
|
-
import { i as SlashEntry, n as EditorEvent } from "./editor-
|
|
1
|
+
import { a as KeyBinding, n as Attachment, r as Decorate, t as AttachOptions } from "./events-DwwsjT-_.mjs";
|
|
2
|
+
import { i as SlashEntry, n as EditorEvent } from "./editor-BZCv53Ut.mjs";
|
|
3
3
|
import * as RichText from "foldkit-richtext";
|
|
4
|
-
//#region src/host.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The vocabulary an editor resolves edits against: the mark and node registries `run`
|
|
7
6
|
* consults to refuse an edit a declaration forbids (§125). Both are optional, and a
|
|
@@ -100,6 +99,5 @@ declare const attachmentIn: (host: Element) => Attachment | undefined;
|
|
|
100
99
|
* (a route returning, a row re-rendered) renders the same way it did (§122).
|
|
101
100
|
*/
|
|
102
101
|
declare const releaseMount: (host: Element) => void;
|
|
103
|
-
//#endregion
|
|
104
102
|
export { vocabularyFor as S, placeholdersFor as _, inputRulesFor as a, serverRenderedFor as b, placeDecorations as c, placeOverlay as d, placePlaceholders as f, placeVocabulary as g, placeSlashEntries as h, decorationsFor as i, placeInputRules as l, placeServerRendered as m, Vocabulary as n, keymapFor as o, placeRendering as p, attachmentIn as r, mountInto as s, Placeholders as t, placeKeymap as u, releaseMount as v, slashEntriesFor as x, renderingFor as y };
|
|
105
|
-
//# sourceMappingURL=host-
|
|
103
|
+
//# sourceMappingURL=host-BMTXAFJJ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-BMTXAFJJ.d.mts","names":[],"sources":["../src/host.ts"],"mappings":";;;;;;;;UA0BiB;WACN,QAAQ,SAAS;WACjB,QAAQ,SAAS;;;;;;;cAQf,kBAAe,gBAAkB,YAAc;;cAK/C,gBAAa,mBAAqB;;;;;cAQlC,mBAAgB,gBAAkB,UAAY;;;;;cAU9C,eAAY,gBAAkB,aAAe,SAAS;;;;;cAQtD,iBAAc,mBACP;;;;;cASP,sBAAmB,gBAAkB;;cAKrC,oBAAiB;;UAIb;;WAEN;;WAEA;;;;;;cASE,oBAAiB,gBAAkB,QAAU;;cAK7C,kBAAe,mBAAqB;;cAKpC,cAAW,gBAAkB,QAAU,cAAc;;cAKrD,YAAS,mBAAqB,cAAc;;;;;cAQ5C,oBAAiB,gBACd,SACL,cAAc,WAAW;;cAOvB,kBAAe,mBAEzB,cAAc,WAAW;;;;;;;cAUf,kBAAe,gBAAkB,OAAS,cAAc,SAAS;;cAKjE,gBAAa,mBAAqB,cAAc,SAAS;;;;;;;cASzD,iBAAc,gBAAkB,WAAa,SAAS;;cAKtD,eAAY,mBAAqB,SAAS;;;;;;;cAS1C,YAAS,MACd,SAAO,SACJ,SAAS,UAAQ,SACjB,eAAa,YACX,SAAS,cACnB;;cAgBU,eAAY,MAAU,YAAU;;;;;;;cAQhC,eAAY,MAAU"}
|
package/dist/host.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as vocabularyFor, _ as placeholdersFor, a as inputRulesFor, b as serverRenderedFor, c as placeDecorations, d as placeOverlay, f as placePlaceholders, g as placeVocabulary, h as placeSlashEntries, i as decorationsFor, l as placeInputRules, m as placeServerRendered, n as Vocabulary, o as keymapFor, p as placeRendering, r as attachmentIn, s as mountInto, t as Placeholders, u as placeKeymap, v as releaseMount, x as slashEntriesFor, y as renderingFor } from "./host-
|
|
1
|
+
import { S as vocabularyFor, _ as placeholdersFor, a as inputRulesFor, b as serverRenderedFor, c as placeDecorations, d as placeOverlay, f as placePlaceholders, g as placeVocabulary, h as placeSlashEntries, i as decorationsFor, l as placeInputRules, m as placeServerRendered, n as Vocabulary, o as keymapFor, p as placeRendering, r as attachmentIn, s as mountInto, t as Placeholders, u as placeKeymap, v as releaseMount, x as slashEntriesFor, y as renderingFor } from "./host-BMTXAFJJ.mjs";
|
|
2
2
|
export { Placeholders, Vocabulary, attachmentIn, decorationsFor, inputRulesFor, keymapFor, mountInto, placeDecorations, placeInputRules, placeKeymap, placeOverlay, placePlaceholders, placeRendering, placeServerRendered, placeSlashEntries, placeVocabulary, placeholdersFor, releaseMount, renderingFor, serverRenderedFor, slashEntriesFor, vocabularyFor };
|
package/dist/host.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { adopt, mount } from "./index.mjs";
|
|
2
2
|
import { attach } from "./events.mjs";
|
|
3
3
|
import * as RichText from "foldkit-richtext";
|
|
4
|
-
|
|
4
|
+
// src/host.ts
|
|
5
5
|
/**
|
|
6
6
|
* The host-element mount (§118): the bridge between a Foldkit view and the owned
|
|
7
7
|
* subtree. A view renders a host element and mounts the interpreter into it once;
|
|
@@ -135,7 +135,6 @@ const releaseMount = (host) => {
|
|
|
135
135
|
attachment.detach();
|
|
136
136
|
attachment.current().root.remove();
|
|
137
137
|
};
|
|
138
|
-
//#endregion
|
|
139
138
|
export { attachmentIn, decorationsFor, inputRulesFor, keymapFor, mountInto, placeDecorations, placeInputRules, placeKeymap, placeOverlay, placePlaceholders, placeRendering, placeServerRendered, placeSlashEntries, placeVocabulary, placeholdersFor, releaseMount, renderingFor, serverRenderedFor, slashEntriesFor, vocabularyFor };
|
|
140
139
|
|
|
141
140
|
//# sourceMappingURL=host.mjs.map
|
package/dist/html.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as RichText from "foldkit-richtext";
|
|
2
|
-
//#region src/html.d.ts
|
|
3
2
|
export interface HtmlDiagnostic {
|
|
4
3
|
readonly code: 'Dropped' | 'Unwrapped' | 'Undeclared' | 'UnsafeAttribute';
|
|
5
4
|
readonly detail: string;
|
|
@@ -15,5 +14,4 @@ export interface ParseOptions {
|
|
|
15
14
|
}
|
|
16
15
|
/** Parses HTML into semantic blocks, reporting everything it refused. */
|
|
17
16
|
export declare const parseHtml: (html: string, options: ParseOptions) => ParsedHtml;
|
|
18
|
-
//#endregion
|
|
19
17
|
//# sourceMappingURL=html.d.mts.map
|
package/dist/html.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.mts","names":[],"sources":["../src/html.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"html.d.mts","names":[],"sources":["../src/html.ts"],"mappings":";iBAYiB;WACN;WACA;;iBAGM;WACN,QAAQ,cAAc,SAAS;WAC/B,aAAa,cAAc;;iBAGrB;;WAEN,MAAM,SAAS;WACf;;;qBA8aE,YAAS,cAAgB,SAAW,iBAAe"}
|
package/dist/html.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as FILLER_ATTRIBUTE } from "./filler-
|
|
1
|
+
import { t as FILLER_ATTRIBUTE } from "./filler-DkAb1dBX.mjs";
|
|
2
2
|
import * as RichText from "foldkit-richtext";
|
|
3
|
-
|
|
3
|
+
// src/html.ts
|
|
4
4
|
/**
|
|
5
5
|
* HTML import, constrained by a Kit (§70, §124 §10). The parser walks a `DOMParser` tree
|
|
6
6
|
* with a whitelist: known block tags become blocks, known inline tags become marks, our
|
|
@@ -360,7 +360,6 @@ const parseHtml = (html, options) => {
|
|
|
360
360
|
diagnostics
|
|
361
361
|
};
|
|
362
362
|
};
|
|
363
|
-
//#endregion
|
|
364
363
|
export { parseHtml };
|
|
365
364
|
|
|
366
365
|
//# sourceMappingURL=html.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as RichText from "foldkit-richtext";
|
|
2
|
-
//#region src/index.d.ts
|
|
3
2
|
interface EditorDom {
|
|
4
3
|
/** The owned subtree root. Everything inside belongs to this interpreter. */
|
|
5
4
|
readonly root: HTMLElement;
|
|
@@ -52,6 +51,5 @@ declare const toText: (dom: EditorDom) => string;
|
|
|
52
51
|
* drift, paid when a composition ends rather than on every edit.
|
|
53
52
|
*/
|
|
54
53
|
declare const repair: (dom: EditorDom, content: RichText.Document) => EditorDom;
|
|
55
|
-
//#endregion
|
|
56
54
|
export { positionToRange as a, toText as c, patch as i, adopt as n, rangeToPosition as o, mount as r, repair as s, EditorDom as t };
|
|
57
|
-
//# sourceMappingURL=index-
|
|
55
|
+
//# sourceMappingURL=index-Cf3l7Noc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Cf3l7Noc.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";UAWiB;;WAEN,MAAM;;WAEN,UAAU,YAAY,SAAS,QAAQ;;WAEvC,SAAS,SAAS;;WAElB,WAAW,SAAS;;WAEpB,aAAa,SAAS;;;;;;;cA+KpB,QAAK,OACT,UAAQ,SACN,SAAS,UAAQ,YACf,SAAS,WAAS,cAChB,SAAS,kBACrB;;;;;;;;;cA8BU,QAAK,UACN,SAAO,SACR,SAAS,UAAQ,YACf,SAAS,WAAS,cAChB,SAAS,kBACrB;cAsEU,QAAK,KACX,WAAS,SACL,SAAS,UAAQ,WACf,SAAS,WAAS,cAChB,SAAS,kBACrB;;;;;cAkKU,kBAAe,KAAS,WAAS,UAAY,SAAS,aAAW;;;;;;;cAoFjE,kBAAe,KACrB,WAAS,WACH,MAAI,4BAEd,SAAS;;cAgCC,SAAM,KAAS;;;;;;;;;;cAmDf,SAAM,KAAS,WAAS,SAAW,SAAS,aAAW"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as positionToRange, c as toText, i as patch, n as adopt, o as rangeToPosition, r as mount, s as repair, t as EditorDom } from "./index-
|
|
1
|
+
import { a as positionToRange, c as toText, i as patch, n as adopt, o as rangeToPosition, r as mount, s as repair, t as EditorDom } from "./index-Cf3l7Noc.mjs";
|
|
2
2
|
export { EditorDom, adopt, mount, patch, positionToRange, rangeToPosition, repair, toText };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as decorationSpans, r as piecesOf, t as decorationAttributes } from "./decorations-
|
|
2
|
-
import { n as needsFiller, t as FILLER_ATTRIBUTE } from "./filler-
|
|
1
|
+
import { n as decorationSpans, r as piecesOf, t as decorationAttributes } from "./decorations-D0J3rIhW.mjs";
|
|
2
|
+
import { n as needsFiller, t as FILLER_ATTRIBUTE } from "./filler-DkAb1dBX.mjs";
|
|
3
3
|
import * as RichText from "foldkit-richtext";
|
|
4
|
-
|
|
4
|
+
// src/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* The DOM interpreter for an editable subtree: it renders a semantic Document
|
|
7
7
|
* into an owned subtree, maps positions both ways, and patches only the nodes a
|
|
@@ -481,7 +481,6 @@ const repair = (dom, content) => {
|
|
|
481
481
|
selectionChanged: false
|
|
482
482
|
}, dom.decorations);
|
|
483
483
|
};
|
|
484
|
-
//#endregion
|
|
485
484
|
export { adopt, mount, patch, positionToRange, rangeToPosition, repair, toText };
|
|
486
485
|
|
|
487
486
|
//# sourceMappingURL=index.mjs.map
|
package/dist/input.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { EditorPlacement } from "./editor-bundle.mjs";
|
|
|
2
2
|
import * as RichText from "foldkit-richtext";
|
|
3
3
|
import { Option, Schema } from "effect";
|
|
4
4
|
import { Bundle } from "foldkit-bundle";
|
|
5
|
-
//#region src/input.d.ts
|
|
6
5
|
/** The editor with its document in its own Model: no parent, so no OutMessage. */
|
|
7
6
|
export declare const EditorInput: Bundle.Bundle<"RichTextInput", {
|
|
8
7
|
readonly hostId: string;
|
|
@@ -1188,5 +1187,4 @@ export declare const richTextInput: (hostId: string, placement?: EditorPlacement
|
|
|
1188
1187
|
}[];
|
|
1189
1188
|
})[];
|
|
1190
1189
|
}, {}>;
|
|
1191
|
-
//#endregion
|
|
1192
1190
|
//# sourceMappingURL=input.d.mts.map
|
package/dist/input.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.mts","names":[],"sources":["../src/input.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.d.mts","names":[],"sources":["../src/input.ts"],"mappings":";;;;;qBAyCa,aAAW,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6BX,gBAAa,gBAAkB,YAAa,2CAAe"}
|
package/dist/input.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as RichText from "foldkit-richtext";
|
|
|
4
4
|
import { Option, Schema } from "effect";
|
|
5
5
|
import { Bundle } from "foldkit-bundle";
|
|
6
6
|
import { Input } from "foldkit-form";
|
|
7
|
-
|
|
7
|
+
// src/input.ts
|
|
8
8
|
/**
|
|
9
9
|
* The rich-text editor as a form control (§124 §12, §139): a document a `foldkit-form` key
|
|
10
10
|
* validates and submits.
|
|
@@ -84,7 +84,6 @@ const richTextInput = (hostId, placement = {}) => {
|
|
|
84
84
|
})
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
|
-
//#endregion
|
|
88
87
|
export { EditorInput, richTextInput };
|
|
89
88
|
|
|
90
89
|
//# sourceMappingURL=input.mjs.map
|
package/dist/toolbar.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import * as RichText from "foldkit-richtext";
|
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import * as Mount from "foldkit/mount";
|
|
4
4
|
import { Html, HtmlBuilder } from "foldkit/html";
|
|
5
|
-
//#region src/floating.d.ts
|
|
6
5
|
/** `anchorToSelection` as a Mount, for the element a floating toolbar is drawn in. */
|
|
7
6
|
export declare const selectionAnchor: Mount.MountDefinitionWithArgs<"RichTextSelectionAnchor", {
|
|
8
7
|
/** The editor host's id: a selection anywhere else leaves the element where it is. */
|
|
@@ -26,8 +25,6 @@ export declare const blockAnchor: Mount.MountDefinitionWithArgs<"RichTextBlockAn
|
|
|
26
25
|
*/
|
|
27
26
|
side: Schema.optionalKey<Schema.Literals<readonly ["left", "above", "inside-end"]>>;
|
|
28
27
|
}, never>;
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/drag.d.ts
|
|
31
28
|
/** `dragBlock` as a Mount, for a block handle's grip; its drop is the editor's `MovedBlock`. */
|
|
32
29
|
export declare const blockDrag: Mount.MountDefinitionWithArgs<"RichTextBlockDrag", {
|
|
33
30
|
/** The editor host's id. */
|
|
@@ -45,8 +42,6 @@ export declare const blockDrag: Mount.MountDefinitionWithArgs<"RichTextBlockDrag
|
|
|
45
42
|
readonly before?: never;
|
|
46
43
|
};
|
|
47
44
|
}>;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/toolbar.d.ts
|
|
50
45
|
/** The editor state a toolbar reads: what a Bundle projects, without the rest. */
|
|
51
46
|
export interface ToolbarState {
|
|
52
47
|
readonly document: RichText.Document;
|
|
@@ -68,5 +63,4 @@ export interface ToolbarOptions<Message> {
|
|
|
68
63
|
export declare const markActive: (state: ToolbarState, mark: string) => boolean;
|
|
69
64
|
/** Buttons for the editor's marks. The application decides where they go. */
|
|
70
65
|
export declare const marksToolbar: <Message>(options: ToolbarOptions<Message>) => (h: HtmlBuilder<Message>) => Html;
|
|
71
|
-
//#endregion
|
|
72
66
|
//# sourceMappingURL=toolbar.d.mts.map
|
package/dist/toolbar.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.d.mts","names":[],"sources":["../src/floating.ts","../src/drag.ts","../src/toolbar.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolbar.d.mts","names":[],"sources":["../src/floating.ts","../src/drag.ts","../src/toolbar.ts"],"mappings":";;;;;qBAgPa,iBAAe,MAAA;;;;;;;;;qBAqBf,aAAW,MAAA;;;;;;;;;;;;;;qBCgCX,WAAS,MAAA;;;;;;;;;;;;;;;;;iBCzRL;WACN,UAAU,SAAS;WACnB,WAAW,SAAS;WACpB,aAAa;;iBAGP,eAAe;WACrB,OAAO;;WAEP,QAAQ;;WAER,YAAY,iBAAiB;;;;;;;qBAQ3B,aAAU,OAAW,cAAY;;qBAMjC,eACV,SAAO,SAAW,eAAe,cAAQ,GACtC,YAAY,aAAW"}
|
package/dist/toolbar.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { Message } from "./editor.mjs";
|
|
|
3
3
|
import * as RichText from "foldkit-richtext";
|
|
4
4
|
import { Effect, Queue, Schema, Stream } from "effect";
|
|
5
5
|
import * as Mount from "foldkit/mount";
|
|
6
|
-
|
|
6
|
+
// src/floating.ts
|
|
7
7
|
/**
|
|
8
8
|
* Chrome placed against the editor's content (§143, §144): a floating toolbar over the page's
|
|
9
9
|
* selection, and a block handle beside its block, each re-placed as the page lays out again.
|
|
@@ -211,8 +211,7 @@ const blockAnchor = Mount.defineStream("RichTextBlockAnchor", {
|
|
|
211
211
|
messages: [Schema.Never],
|
|
212
212
|
execute: ({ element, hostId, node, gap, side }) => Stream.callback(() => Effect.acquireRelease(Effect.sync(() => anchorToBlock(element, hostId, node, gap, side ?? "left")), (release) => Effect.sync(release)))
|
|
213
213
|
});
|
|
214
|
-
|
|
215
|
-
//#region src/drag.ts
|
|
214
|
+
// src/drag.ts
|
|
216
215
|
/**
|
|
217
216
|
* Dragging a block by its handle (§148): the pointer picks a place beside any block the block may
|
|
218
217
|
* move beside (`RichText.moveTargets`, so across containers where the vocabulary allows, §149), a
|
|
@@ -451,8 +450,7 @@ const blockDrag = Mount.defineStream("RichTextBlockDrag", {
|
|
|
451
450
|
to
|
|
452
451
|
})))), (release) => Effect.sync(release)))
|
|
453
452
|
});
|
|
454
|
-
|
|
455
|
-
//#region src/toolbar.ts
|
|
453
|
+
// src/toolbar.ts
|
|
456
454
|
/**
|
|
457
455
|
* A mark is active when the caret carries it, or — with no stored format — when
|
|
458
456
|
* every run the selection covers does (§119). Exported because a Mixins slot view
|
|
@@ -470,7 +468,6 @@ const marksToolbar = (options) => (h) => {
|
|
|
470
468
|
h.OnClick(options.toMessage(mark))
|
|
471
469
|
], [mark])));
|
|
472
470
|
};
|
|
473
|
-
//#endregion
|
|
474
471
|
export { blockAnchor, blockDrag, markActive, marksToolbar, selectionAnchor };
|
|
475
472
|
|
|
476
473
|
//# sourceMappingURL=toolbar.mjs.map
|
package/dist/toolbar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.mjs","names":[],"sources":["../src/floating.ts","../src/drag.ts","../src/toolbar.ts"],"sourcesContent":["/**\n * Chrome placed against the editor's content (§143, §144): a floating toolbar over the page's\n * selection, and a block handle beside its block, each re-placed as the page lays out again.\n *\n * Whether either is drawn is the view's, from the Model; these only move it. They write\n * `position`, `top`, `left`, and `data-placement` on the element itself, as `foldkit-mixins-ui`'s\n * Anchor does, so a Style on the element must leave those alone. They listen only while mounted.\n *\n * A Mount reads its args once, when its element is inserted; a later render with other args\n * patches the same element and the Mount never sees them. So a caller whose block changes keys\n * the element by it (`h.Key(node)`), and each block gets a fresh element and a fresh Mount.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport * as RichText from 'foldkit-richtext'\nimport { attachmentIn } from './host.js'\n\ninterface Box {\n readonly top: number\n readonly left: number\n readonly width: number\n readonly height: number\n}\n\n/**\n * Where the floating box goes, in viewport coordinates: centred over the target and `gap` above\n * it, or below it when there is no room above; kept inside the viewport's width.\n */\nexport const placeOver = (\n target: Box,\n floating: Pick<Box, 'width' | 'height'>,\n viewport: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'top' | 'bottom' } => {\n const above = target.top - gap - floating.height\n const centred = target.left + target.width / 2 - floating.width / 2\n return {\n top: above >= 0 ? above : target.top + target.height + gap,\n left: Math.max(0, Math.min(centred, viewport.width - floating.width)),\n placement: above >= 0 ? 'top' : 'bottom',\n }\n}\n\n/**\n * Where a box goes under a caret, in viewport coordinates: `gap` below it, or above it when there\n * is no room below; kept inside the viewport's width. What a slash menu opens at.\n */\nexport const placeUnder = (\n target: Box,\n floating: Pick<Box, 'width' | 'height'>,\n viewport: Pick<Box, 'width' | 'height'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'top' | 'bottom' } => {\n const below = target.top + target.height + gap\n const fits = below + floating.height <= viewport.height\n return {\n top: fits ? below : Math.max(0, target.top - gap - floating.height),\n left: Math.max(0, Math.min(target.left, viewport.width - floating.width)),\n placement: fits ? 'bottom' : 'top',\n }\n}\n\n/**\n * The box a range occupies. A caret in an empty text node has no box of its own (every\n * browser reports zeros), so it is read from the element the caret is in.\n */\nconst rangeBox = (range: Range): Box => {\n const box = range.getBoundingClientRect()\n if (box.width !== 0 || box.height !== 0 || box.top !== 0 || box.left !== 0) return box\n const container = range.startContainer\n const element = container instanceof Element ? container : container.parentElement\n return element === null ? box : element.getBoundingClientRect()\n}\n\n/**\n * Where a block's toolbar goes: `gap` above the block's top, aligned with its left edge, or just\n * inside its top when there is no room above (a block at the top of the window).\n */\nexport const placeAbove = (\n target: Box,\n floating: Pick<Box, 'width' | 'height'>,\n viewport: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'top' | 'inside' } => {\n const above = target.top - gap - floating.height\n return {\n top: above >= 0 ? above : Math.max(0, target.top + gap),\n left: Math.max(0, Math.min(target.left, viewport.width - floating.width)),\n placement: above >= 0 ? 'top' : 'inside',\n }\n}\n\n/** Where a handle goes: level with the block's top, `gap` to its left, never past the left edge. */\nexport const placeBeside = (\n target: Box,\n floating: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'left' } => ({\n top: target.top,\n left: Math.max(0, target.left - gap - floating.width),\n placement: 'left',\n})\n\n/** Where a block's floating element goes: `blockAnchor`'s `side`. */\nconst BlockSide = Schema.Literals(['left', 'above', 'inside-end'])\ntype BlockSide = typeof BlockSide.Type\n\n/**\n * Where a block's own toolbar goes when it should cover nothing around the block: inside its top\n * right corner, `gap` in from both edges, and never past the block's left edge.\n */\nexport const placeInsideEnd = (\n target: Box,\n floating: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'inside' } => ({\n top: target.top + gap,\n left: Math.max(target.left, target.left + target.width - gap - floating.width),\n placement: 'inside',\n})\n\ntype Styled = Element & ElementCSSInlineStyle\n\nconst write = (\n element: Styled,\n at: { readonly top: number; readonly left: number; readonly placement: string },\n) => {\n element.style.top = `${at.top}px`\n element.style.left = `${at.left}px`\n element.setAttribute('data-placement', at.placement)\n}\n\n/** Calls `place` on any scroll and on resize, until the returned release. */\nconst onLayout = (view: Window, place: () => void, element: Styled) => {\n // The element's own size too: it is measured where it is placed, and one drawn before its\n // styles or content settle (a menu a query narrows) would stay where its first size put it.\n const sizes = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(place)\n // Capture: a scrolling container's scroll does not bubble, but it passes the window first.\n view.addEventListener('scroll', place, true)\n view.addEventListener('resize', place)\n sizes?.observe(element)\n return () => {\n view.removeEventListener('scroll', place, true)\n view.removeEventListener('resize', place)\n sizes?.disconnect()\n }\n}\n\n/**\n * Places `element` over the selection in `hostId` now and on each change, until released. With\n * `caret`, it follows a collapsed selection too, under it, as a slash menu does; otherwise a\n * caret leaves it where it is, as a toolbar for selected text wants.\n */\nexport const anchorToSelection = (element: Styled, hostId: string, gap: number, caret = false) => {\n const owner = element.ownerDocument\n const view = owner.defaultView\n if (view === null) return () => {}\n // Fixed before anything is measured: in flow the element's box is not the one it floats with.\n element.style.position = 'fixed'\n const place = () => {\n const selection = view.getSelection()\n const host = owner.getElementById(hostId)\n if (selection === null || selection.rangeCount === 0 || host === null) return\n const range = selection.getRangeAt(0)\n if ((range.collapsed && !caret) || !host.contains(range.commonAncestorContainer)) return\n const floating = element.getBoundingClientRect()\n write(\n element,\n caret\n ? placeUnder(\n rangeBox(range),\n floating,\n { width: view.innerWidth, height: view.innerHeight },\n gap,\n )\n : placeOver(rangeBox(range), floating, { width: view.innerWidth }, gap),\n )\n }\n place()\n owner.addEventListener('selectionchange', place)\n const release = onLayout(view, place, element)\n return () => {\n owner.removeEventListener('selectionchange', place)\n release()\n }\n}\n\n/**\n * Places `element` beside block `node` of the editor in `hostId` now and on each change, until\n * released. A block missing from the editor leaves the element where it is.\n */\nexport const anchorToBlock = (\n element: Styled,\n hostId: string,\n node: RichText.NodeId,\n gap: number,\n side: BlockSide = 'left',\n) => {\n const owner = element.ownerDocument\n const view = owner.defaultView\n if (view === null) return () => {}\n element.style.position = 'fixed'\n // A patch moves blocks without moving the page: text typed above one, or the move a handle sent.\n // The host is looked up on each placement, since it can be drawn after the handle or replaced:\n // while it is missing the page is watched for it, and once found its parent is watched too.\n const observer = new view.MutationObserver(() => place())\n let observed: Element | null | undefined\n const place = () => {\n const host = owner.getElementById(hostId)\n if (host !== observed) {\n observer.disconnect()\n if (host === null) {\n observer.observe(owner.documentElement, { childList: true, subtree: true })\n } else {\n observer.observe(host, { childList: true, subtree: true, characterData: true })\n if (host.parentElement !== null) observer.observe(host.parentElement, { childList: true })\n }\n observed = host\n }\n if (host === null) return\n const block = attachmentIn(host)?.current().elements.get(node)\n if (block === undefined) return\n const box = block.getBoundingClientRect()\n const floating = element.getBoundingClientRect()\n const placed = {\n left: () => placeBeside(box, floating, gap),\n above: () => placeAbove(box, floating, { width: view.innerWidth }, gap),\n 'inside-end': () => placeInsideEnd(box, floating, gap),\n } satisfies Record<BlockSide, () => unknown>\n write(element, placed[side]())\n }\n place()\n const release = onLayout(view, place, element)\n return () => {\n observer.disconnect()\n release()\n }\n}\n\n/** `anchorToSelection` as a Mount, for the element a floating toolbar is drawn in. */\nexport const selectionAnchor = Mount.defineStream('RichTextSelectionAnchor', {\n args: {\n /** The editor host's id: a selection anywhere else leaves the element where it is. */\n hostId: Schema.String,\n /** Pixels between the selection and the element. */\n gap: Schema.Number,\n /** Follow a caret as well, under it: a slash menu's place. Absent, only selected text. */\n caret: Schema.optionalKey(Schema.Boolean),\n },\n messages: [Schema.Never],\n execute: ({ element, hostId, gap, caret }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n // A Mount's element is one the view drew, an HTML or SVG element, and both carry `style`.\n Effect.sync(() => anchorToSelection(element as Styled, hostId, gap, caret === true)),\n release => Effect.sync(release),\n ),\n ),\n})\n\n/** `anchorToBlock` as a Mount, for the element a block handle is drawn in. Key that element by `node`. */\nexport const blockAnchor = Mount.defineStream('RichTextBlockAnchor', {\n args: {\n /** The editor host's id. */\n hostId: Schema.String,\n /** The block the handle stands for. */\n node: RichText.NodeId,\n /** Pixels between the handle and the block. */\n gap: Schema.Number,\n /**\n * Beside the block's left edge (a handle), above it (a block's toolbar), or inside its top\n * right corner (a toolbar that should cover nothing around the block). Default left.\n */\n side: Schema.optionalKey(BlockSide),\n },\n messages: [Schema.Never],\n execute: ({ element, hostId, node, gap, side }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => anchorToBlock(element as Styled, hostId, node, gap, side ?? 'left')),\n release => Effect.sync(release),\n ),\n ),\n})\n","/**\n * Dragging a block by its handle (§148): the pointer picks a place beside any block the block may\n * move beside (`RichText.moveTargets`, so across containers where the vocabulary allows, §149), a\n * line outside the editable subtree shows it, and the drop sends `MovedBlock` there.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport * as RichText from 'foldkit-richtext'\nimport { Message } from './editor.js'\nimport { attachmentIn, vocabularyFor } from './host.js'\n\n/** A block the dragged one may land beside: its place in the document and on the page. */\nexport interface Placed {\n readonly id: RichText.NodeId\n /** Its container, as a key its siblings share, and its index there. */\n readonly container: string\n readonly index: number\n readonly top: number\n readonly bottom: number\n}\n\n/**\n * Where a pointer at `y` drops block `moving`, itself one of `targets` (in document order): beside\n * the target whose edge is nearest, before one at its top and after one at its bottom. Of two\n * edges equally near, the later target's wins. Undefined when that is where the block already is.\n *\n * A container's edge and its first or last block's are one edge: the block's wins while the\n * pointer is inside that block, and the container's once it is past it, or the container's own\n * edge could never be reached.\n */\nexport const dropBeside = (\n targets: ReadonlyArray<Placed>,\n moving: RichText.NodeId,\n y: number,\n): RichText.Beside | undefined => {\n const self = targets.find(target => target.id === moving)\n let nearest:\n | {\n readonly target: Placed\n readonly after: boolean\n readonly edge: number\n readonly distance: number\n }\n | undefined\n for (const target of targets) {\n for (const after of [false, true]) {\n const edge = after ? target.bottom : target.top\n const distance = Math.abs(y - edge)\n if (\n nearest === undefined ||\n distance < nearest.distance ||\n (distance === nearest.distance &&\n (edge !== nearest.edge || (y >= target.top && y <= target.bottom)))\n )\n nearest = { target, after, edge, distance }\n }\n }\n if (self === undefined || nearest === undefined) return undefined\n const { target, after } = nearest\n const stays =\n target.id === moving ||\n (target.container === self.container && target.index === self.index + (after ? -1 : 1))\n return stays ? undefined : after ? { after: target.id } : { before: target.id }\n}\n\n/** Each block's container key and index, from one walk of the document. */\nconst placesOf = (\n blocks: ReadonlyArray<RichText.Block>,\n container = '',\n into = new Map<RichText.NodeId, { readonly container: string; readonly index: number }>(),\n) => {\n for (const [index, block] of blocks.entries()) {\n into.set(block.id, { container, index })\n if (block.type === 'Node' && block.blocks !== undefined) placesOf(block.blocks, block.id, into)\n }\n return into\n}\n\n/** How far, in CSS pixels, a press on the handle moves before it is a drag rather than a tap. */\nexport const DRAG_THRESHOLD = 5\n\n/** How near the window's top or bottom a dragging pointer scrolls the page, in pixels. */\nconst SCROLL_EDGE = 48\n/** How far a frame scrolls with the pointer at the very edge; less the further in it is. */\nconst SCROLL_STEP = 18\n\n/**\n * How far a drag scrolls the page this frame for a pointer at `y` in a window `height` tall:\n * up near the top, down near the bottom, faster the nearer the edge, and not at all between.\n */\nexport const edgeScroll = (y: number, height: number): number => {\n const nearTop = SCROLL_EDGE - y\n const nearBottom = y - (height - SCROLL_EDGE)\n if (nearTop > 0) return -Math.ceil((Math.min(nearTop, SCROLL_EDGE) / SCROLL_EDGE) * SCROLL_STEP)\n if (nearBottom > 0)\n return Math.ceil((Math.min(nearBottom, SCROLL_EDGE) / SCROLL_EDGE) * SCROLL_STEP)\n return 0\n}\n\ninterface Pointed extends Event {\n readonly clientX?: number\n readonly clientY?: number\n readonly buttons?: number\n readonly pointerId?: number\n readonly button?: number\n readonly key?: string\n}\n\n/**\n * Lets `handle` drag block `node` of the editor in `hostId`: a press on it starts, the pointer\n * moving picks the place, release drops there through `dropped`, and Escape or a cancelled\n * pointer ends it without a drop. The page is listened to only while a press is under way, in\n * the capture phase, so a handler that stops a release does not hide it. The line is an element\n * of its own, `[data-richtext-drop]`, fixed at the edge the block would land on, for a\n * stylesheet to draw; once the pointer moves, the block being dragged carries\n * `data-richtext-dragging` until the drag ends, so a stylesheet can show which one it is, and\n * the page's root element carries `data-richtext-drag`, for a `grabbing` cursor everywhere the\n * pointer goes rather than the text's caret. The\n * handle takes `touch-action: none` while attached, or a touch would\n * pan the page and cancel the drag.\n */\nexport const dragBlock = (\n handle: Element,\n hostId: string,\n node: RichText.NodeId,\n dropped: (to: RichText.Beside) => void,\n): (() => void) => {\n const owner = handle.ownerDocument\n let pointer: number | undefined\n let pressed = false\n let target: RichText.Beside | undefined\n let line: HTMLElement | undefined\n /** The dragged block's element, marked once the pointer moves: a press alone marks nothing. */\n let moving: HTMLElement | undefined\n let marked = false\n // Where the pointer last was, for a scroll that moves the blocks under a still pointer.\n let lastY = 0\n // Where it went down: until it has moved `DRAG_THRESHOLD` from there, the press is a tap.\n let startX = 0\n let startY = 0\n const { style } = handle as Element & ElementCSSInlineStyle\n const touchAction = style.getPropertyValue('touch-action')\n style.setProperty('touch-action', 'none')\n\n const draw = (at: { readonly top: number; readonly left: number; readonly width: number }) => {\n line ??= owner.body.appendChild(owner.createElement('div'))\n line.setAttribute('data-richtext-drop', '')\n line.style.position = 'fixed'\n line.style.top = `${at.top}px`\n line.style.left = `${at.left}px`\n line.style.width = `${at.width}px`\n }\n // What a drag can land beside is fixed when it starts; where those blocks are on the page is\n // read again as the pointer moves, since the page can scroll under it.\n let targets: ReadonlyArray<{\n readonly id: RichText.NodeId\n readonly container: string\n readonly index: number\n readonly element: HTMLElement\n }> = []\n /** Whether an event is the pressing pointer's: another finger or pen does not steer the drag. */\n const ours = (event: Event) => pointer === undefined || (event as Pointed).pointerId === pointer\n /** Picks the place for a pointer at `y` from where the blocks are now, and draws its line. */\n const place = (y: number) => {\n lastY = y\n const placed = targets.map(each => {\n const box = each.element.getBoundingClientRect()\n return { ...each, top: box.top, bottom: box.bottom, left: box.left, width: box.width }\n })\n target = dropBeside(placed, node, y)\n const edge =\n target === undefined\n ? undefined\n : 'before' in target\n ? { id: target.before, top: true }\n : { id: target.after, top: false }\n const block = edge === undefined ? undefined : placed.find(each => each.id === edge.id)\n if (edge === undefined || block === undefined) {\n line?.remove()\n line = undefined\n return\n }\n draw({ top: edge.top ? block.top : block.bottom, left: block.left, width: block.width })\n }\n const moved = (event: Event) => {\n const pointed = event as Pointed\n if (!ours(pointed)) return\n // A move with the button up is a release this page never heard: over a frame, say.\n if (((pointed.buttons ?? 1) & 1) === 0) return end(false)\n if (!marked) {\n // A finger's tap wanders a pixel or two; only a move past that is a drag.\n const x = (pointed.clientX ?? startX) - startX\n const y = (pointed.clientY ?? startY) - startY\n if (Math.hypot(x, y) < DRAG_THRESHOLD) return\n moving?.setAttribute('data-richtext-dragging', '')\n owner.documentElement.setAttribute('data-richtext-drag', '')\n marked = true\n }\n place(pointed.clientY ?? lastY)\n scrollSoon()\n }\n // A block can be dragged past what the window shows: held near an edge, the pointer scrolls\n // the page a frame at a time, and the scroll listener re-places the line.\n const view = owner.defaultView\n let frame: number | undefined\n const scrollSoon = () => {\n if (frame !== undefined || view === null || edgeScroll(lastY, view.innerHeight) === 0) return\n frame = view.requestAnimationFrame(() => {\n frame = undefined\n if (!marked) return\n view.scrollBy(0, edgeScroll(lastY, view.innerHeight))\n scrollSoon()\n })\n }\n const end = (drop: boolean): void => {\n if (frame !== undefined) view?.cancelAnimationFrame(frame)\n frame = undefined\n const chosen = target\n pressed = false\n pointer = undefined\n target = undefined\n targets = []\n line?.remove()\n line = undefined\n moving?.removeAttribute('data-richtext-dragging')\n owner.documentElement.removeAttribute('data-richtext-drag')\n moving = undefined\n marked = false\n for (const [type, listener] of onPage) owner.removeEventListener(type, listener, true)\n if (drop && chosen !== undefined) dropped(chosen)\n }\n const onPage: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n ['pointermove', moved],\n [\n 'pointerup',\n event => {\n if (!ours(event)) return\n // A press that never became a drag drops nothing: it was a tap on the handle.\n if (!marked) return end(false)\n // The place is the release's own, not the last move's: the page may have scrolled.\n place((event as Pointed).clientY ?? lastY)\n end(true)\n },\n ],\n ['scroll', () => place(lastY)],\n [\n 'pointercancel',\n event => {\n if (ours(event)) end(false)\n },\n ],\n [\n 'keydown',\n event => {\n if ((event as Pointed).key !== 'Escape') return\n event.preventDefault()\n end(false)\n },\n ],\n ]\n const pressedOn = (event: Event) => {\n const pointed = event as Pointed\n if (pressed || (pointed.button ?? 0) !== 0) return\n pressed = true\n pointer = pointed.pointerId\n lastY = pointed.clientY ?? 0\n startX = pointed.clientX ?? 0\n startY = lastY\n const host = owner.getElementById(hostId)\n const dom = host === null ? undefined : attachmentIn(host)?.current()\n if (dom !== undefined) {\n moving = dom.elements.get(node)\n const places = placesOf(dom.content.children)\n targets = RichText.moveTargets(dom.content, node, vocabularyFor(hostId).nodes).flatMap(id => {\n const place = places.get(id)\n const element = dom.elements.get(id)\n return place === undefined || element === undefined ? [] : [{ id, ...place, element }]\n })\n }\n // The press is the handle's, not the start of a text selection in the page.\n event.preventDefault()\n for (const [type, listener] of onPage) owner.addEventListener(type, listener, true)\n }\n handle.addEventListener('pointerdown', pressedOn)\n return () => {\n handle.removeEventListener('pointerdown', pressedOn)\n if (touchAction === '') style.removeProperty('touch-action')\n else style.setProperty('touch-action', touchAction)\n if (pressed) end(false)\n }\n}\n\n/** `dragBlock` as a Mount, for a block handle's grip; its drop is the editor's `MovedBlock`. */\nexport const blockDrag = Mount.defineStream('RichTextBlockDrag', {\n args: {\n /** The editor host's id. */\n hostId: Schema.String,\n /** The block the handle stands for. */\n node: RichText.NodeId,\n },\n messages: [Message.MovedBlock],\n execute: ({ element, hostId, node }) =>\n Stream.callback<typeof Message.MovedBlock.Type>(queue =>\n Effect.acquireRelease(\n Effect.sync(() =>\n dragBlock(element, hostId, node, to =>\n Queue.offerUnsafe(queue, Message.MovedBlock({ node, to })),\n ),\n ),\n release => Effect.sync(release),\n ),\n ),\n})\n","/**\n * The marks toolbar (§35, §119): a button per mark, dispatching the same Messages\n * a chord does. It is the application's chrome, not the editor's — §29 gives the\n * editor the `contenteditable` subtree and the application everything around it —\n * so this renders a value the application places beside the editor's host, and it\n * never touches the DOM the editor owns. A Mixins slot family wraps these buttons\n * when an application needs to restyle or replace parts.\n */\nimport type { Html, HtmlBuilder } from 'foldkit/html'\nimport * as RichText from 'foldkit-richtext'\n\n/** The editor state a toolbar reads: what a Bundle projects, without the rest. */\nexport interface ToolbarState {\n readonly document: RichText.Document\n readonly selection: RichText.Selection | null\n readonly storedMarks: ReadonlyArray<string> | null\n}\n\nexport interface ToolbarOptions<Message> {\n readonly state: ToolbarState\n /** The marks to offer, by name. Defaults to the three the package ships. */\n readonly marks?: ReadonlyArray<string> | undefined\n /** How a mark becomes the application's Message, usually its editor wrapper. */\n readonly toMessage: (mark: string) => Message\n}\n\n/**\n * A mark is active when the caret carries it, or — with no stored format — when\n * every run the selection covers does (§119). Exported because a Mixins slot view\n * renders its own buttons and needs the same rule.\n */\nexport const markActive = (state: ToolbarState, mark: string): boolean =>\n state.storedMarks !== null\n ? state.storedMarks.includes(mark)\n : RichText.marksInRange(state.document, state.selection).has(mark)\n\n/** Buttons for the editor's marks. The application decides where they go. */\nexport const marksToolbar =\n <Message>(options: ToolbarOptions<Message>) =>\n (h: HtmlBuilder<Message>): Html => {\n const marks = options.marks ?? RichText.shippedMarks.map(definition => definition.name)\n return h.div(\n [h.DataAttribute('toolbar', 'marks')],\n marks.map(mark =>\n h.button(\n [\n h.Type('button'),\n h.DataAttribute('mark', mark),\n h.AriaLabel(mark),\n h.AriaPressed(markActive(options.state, mark) ? 'true' : 'false'),\n h.OnClick(options.toMessage(mark)),\n ],\n [mark],\n ),\n ),\n )\n }\n\n/** What places a floating toolbar over the selection (§143), and a block handle beside its block (§144). */\nexport { blockAnchor, selectionAnchor } from './floating.js'\n\n/** What drags a block by its handle, to wherever its kind may stand (§148, §149). */\nexport { blockDrag } from './drag.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,aACX,QACA,UACA,UACA,QAC0F;CAC1F,MAAM,QAAQ,OAAO,MAAM,MAAM,SAAS;CAC1C,MAAM,UAAU,OAAO,OAAO,OAAO,QAAQ,IAAI,SAAS,QAAQ;CAClE,OAAO;EACL,KAAK,SAAS,IAAI,QAAQ,OAAO,MAAM,OAAO,SAAS;EACvD,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,SAAS,QAAQ,SAAS,KAAK,CAAC;EACpE,WAAW,SAAS,IAAI,QAAQ;CAClC;AACF;;;;;AAMA,MAAa,cACX,QACA,UACA,UACA,QAC0F;CAC1F,MAAM,QAAQ,OAAO,MAAM,OAAO,SAAS;CAC3C,MAAM,OAAO,QAAQ,SAAS,UAAU,SAAS;CACjD,OAAO;EACL,KAAK,OAAO,QAAQ,KAAK,IAAI,GAAG,OAAO,MAAM,MAAM,SAAS,MAAM;EAClE,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,OAAO,MAAM,SAAS,QAAQ,SAAS,KAAK,CAAC;EACxE,WAAW,OAAO,WAAW;CAC/B;AACF;;;;;AAMA,MAAM,YAAY,UAA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AAS,SAAS,aAAa,KAAI,eAAc,WAAW,IAAI;CACtF,OAAO,EAAE,IACP,CAAC,EAAE,cAAc,WAAW,OAAO,CAAC,GACpC,MAAM,KAAI,SACR,EAAE,OACA;EACE,EAAE,KAAK,QAAQ;EACf,EAAE,cAAc,QAAQ,IAAI;EAC5B,EAAE,UAAU,IAAI;EAChB,EAAE,YAAY,WAAW,QAAQ,OAAO,IAAI,IAAI,SAAS,OAAO;EAChE,EAAE,QAAQ,QAAQ,UAAU,IAAI,CAAC;CACnC,GACA,CAAC,IAAI,CACP,CACF,CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"toolbar.mjs","names":[],"sources":["../src/floating.ts","../src/drag.ts","../src/toolbar.ts"],"sourcesContent":["/**\n * Chrome placed against the editor's content (§143, §144): a floating toolbar over the page's\n * selection, and a block handle beside its block, each re-placed as the page lays out again.\n *\n * Whether either is drawn is the view's, from the Model; these only move it. They write\n * `position`, `top`, `left`, and `data-placement` on the element itself, as `foldkit-mixins-ui`'s\n * Anchor does, so a Style on the element must leave those alone. They listen only while mounted.\n *\n * A Mount reads its args once, when its element is inserted; a later render with other args\n * patches the same element and the Mount never sees them. So a caller whose block changes keys\n * the element by it (`h.Key(node)`), and each block gets a fresh element and a fresh Mount.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport * as RichText from 'foldkit-richtext'\nimport { attachmentIn } from './host.js'\n\ninterface Box {\n readonly top: number\n readonly left: number\n readonly width: number\n readonly height: number\n}\n\n/**\n * Where the floating box goes, in viewport coordinates: centred over the target and `gap` above\n * it, or below it when there is no room above; kept inside the viewport's width.\n */\nexport const placeOver = (\n target: Box,\n floating: Pick<Box, 'width' | 'height'>,\n viewport: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'top' | 'bottom' } => {\n const above = target.top - gap - floating.height\n const centred = target.left + target.width / 2 - floating.width / 2\n return {\n top: above >= 0 ? above : target.top + target.height + gap,\n left: Math.max(0, Math.min(centred, viewport.width - floating.width)),\n placement: above >= 0 ? 'top' : 'bottom',\n }\n}\n\n/**\n * Where a box goes under a caret, in viewport coordinates: `gap` below it, or above it when there\n * is no room below; kept inside the viewport's width. What a slash menu opens at.\n */\nexport const placeUnder = (\n target: Box,\n floating: Pick<Box, 'width' | 'height'>,\n viewport: Pick<Box, 'width' | 'height'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'top' | 'bottom' } => {\n const below = target.top + target.height + gap\n const fits = below + floating.height <= viewport.height\n return {\n top: fits ? below : Math.max(0, target.top - gap - floating.height),\n left: Math.max(0, Math.min(target.left, viewport.width - floating.width)),\n placement: fits ? 'bottom' : 'top',\n }\n}\n\n/**\n * The box a range occupies. A caret in an empty text node has no box of its own (every\n * browser reports zeros), so it is read from the element the caret is in.\n */\nconst rangeBox = (range: Range): Box => {\n const box = range.getBoundingClientRect()\n if (box.width !== 0 || box.height !== 0 || box.top !== 0 || box.left !== 0) return box\n const container = range.startContainer\n const element = container instanceof Element ? container : container.parentElement\n return element === null ? box : element.getBoundingClientRect()\n}\n\n/**\n * Where a block's toolbar goes: `gap` above the block's top, aligned with its left edge, or just\n * inside its top when there is no room above (a block at the top of the window).\n */\nexport const placeAbove = (\n target: Box,\n floating: Pick<Box, 'width' | 'height'>,\n viewport: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'top' | 'inside' } => {\n const above = target.top - gap - floating.height\n return {\n top: above >= 0 ? above : Math.max(0, target.top + gap),\n left: Math.max(0, Math.min(target.left, viewport.width - floating.width)),\n placement: above >= 0 ? 'top' : 'inside',\n }\n}\n\n/** Where a handle goes: level with the block's top, `gap` to its left, never past the left edge. */\nexport const placeBeside = (\n target: Box,\n floating: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'left' } => ({\n top: target.top,\n left: Math.max(0, target.left - gap - floating.width),\n placement: 'left',\n})\n\n/** Where a block's floating element goes: `blockAnchor`'s `side`. */\nconst BlockSide = Schema.Literals(['left', 'above', 'inside-end'])\ntype BlockSide = typeof BlockSide.Type\n\n/**\n * Where a block's own toolbar goes when it should cover nothing around the block: inside its top\n * right corner, `gap` in from both edges, and never past the block's left edge.\n */\nexport const placeInsideEnd = (\n target: Box,\n floating: Pick<Box, 'width'>,\n gap: number,\n): { readonly top: number; readonly left: number; readonly placement: 'inside' } => ({\n top: target.top + gap,\n left: Math.max(target.left, target.left + target.width - gap - floating.width),\n placement: 'inside',\n})\n\ntype Styled = Element & ElementCSSInlineStyle\n\nconst write = (\n element: Styled,\n at: { readonly top: number; readonly left: number; readonly placement: string },\n) => {\n element.style.top = `${at.top}px`\n element.style.left = `${at.left}px`\n element.setAttribute('data-placement', at.placement)\n}\n\n/** Calls `place` on any scroll and on resize, until the returned release. */\nconst onLayout = (view: Window, place: () => void, element: Styled) => {\n // The element's own size too: it is measured where it is placed, and one drawn before its\n // styles or content settle (a menu a query narrows) would stay where its first size put it.\n const sizes = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(place)\n // Capture: a scrolling container's scroll does not bubble, but it passes the window first.\n view.addEventListener('scroll', place, true)\n view.addEventListener('resize', place)\n sizes?.observe(element)\n return () => {\n view.removeEventListener('scroll', place, true)\n view.removeEventListener('resize', place)\n sizes?.disconnect()\n }\n}\n\n/**\n * Places `element` over the selection in `hostId` now and on each change, until released. With\n * `caret`, it follows a collapsed selection too, under it, as a slash menu does; otherwise a\n * caret leaves it where it is, as a toolbar for selected text wants.\n */\nexport const anchorToSelection = (element: Styled, hostId: string, gap: number, caret = false) => {\n const owner = element.ownerDocument\n const view = owner.defaultView\n if (view === null) return () => {}\n // Fixed before anything is measured: in flow the element's box is not the one it floats with.\n element.style.position = 'fixed'\n const place = () => {\n const selection = view.getSelection()\n const host = owner.getElementById(hostId)\n if (selection === null || selection.rangeCount === 0 || host === null) return\n const range = selection.getRangeAt(0)\n if ((range.collapsed && !caret) || !host.contains(range.commonAncestorContainer)) return\n const floating = element.getBoundingClientRect()\n write(\n element,\n caret\n ? placeUnder(\n rangeBox(range),\n floating,\n { width: view.innerWidth, height: view.innerHeight },\n gap,\n )\n : placeOver(rangeBox(range), floating, { width: view.innerWidth }, gap),\n )\n }\n place()\n owner.addEventListener('selectionchange', place)\n const release = onLayout(view, place, element)\n return () => {\n owner.removeEventListener('selectionchange', place)\n release()\n }\n}\n\n/**\n * Places `element` beside block `node` of the editor in `hostId` now and on each change, until\n * released. A block missing from the editor leaves the element where it is.\n */\nexport const anchorToBlock = (\n element: Styled,\n hostId: string,\n node: RichText.NodeId,\n gap: number,\n side: BlockSide = 'left',\n) => {\n const owner = element.ownerDocument\n const view = owner.defaultView\n if (view === null) return () => {}\n element.style.position = 'fixed'\n // A patch moves blocks without moving the page: text typed above one, or the move a handle sent.\n // The host is looked up on each placement, since it can be drawn after the handle or replaced:\n // while it is missing the page is watched for it, and once found its parent is watched too.\n const observer = new view.MutationObserver(() => place())\n let observed: Element | null | undefined\n const place = () => {\n const host = owner.getElementById(hostId)\n if (host !== observed) {\n observer.disconnect()\n if (host === null) {\n observer.observe(owner.documentElement, { childList: true, subtree: true })\n } else {\n observer.observe(host, { childList: true, subtree: true, characterData: true })\n if (host.parentElement !== null) observer.observe(host.parentElement, { childList: true })\n }\n observed = host\n }\n if (host === null) return\n const block = attachmentIn(host)?.current().elements.get(node)\n if (block === undefined) return\n const box = block.getBoundingClientRect()\n const floating = element.getBoundingClientRect()\n const placed = {\n left: () => placeBeside(box, floating, gap),\n above: () => placeAbove(box, floating, { width: view.innerWidth }, gap),\n 'inside-end': () => placeInsideEnd(box, floating, gap),\n } satisfies Record<BlockSide, () => unknown>\n write(element, placed[side]())\n }\n place()\n const release = onLayout(view, place, element)\n return () => {\n observer.disconnect()\n release()\n }\n}\n\n/** `anchorToSelection` as a Mount, for the element a floating toolbar is drawn in. */\nexport const selectionAnchor = Mount.defineStream('RichTextSelectionAnchor', {\n args: {\n /** The editor host's id: a selection anywhere else leaves the element where it is. */\n hostId: Schema.String,\n /** Pixels between the selection and the element. */\n gap: Schema.Number,\n /** Follow a caret as well, under it: a slash menu's place. Absent, only selected text. */\n caret: Schema.optionalKey(Schema.Boolean),\n },\n messages: [Schema.Never],\n execute: ({ element, hostId, gap, caret }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n // A Mount's element is one the view drew, an HTML or SVG element, and both carry `style`.\n Effect.sync(() => anchorToSelection(element as Styled, hostId, gap, caret === true)),\n release => Effect.sync(release),\n ),\n ),\n})\n\n/** `anchorToBlock` as a Mount, for the element a block handle is drawn in. Key that element by `node`. */\nexport const blockAnchor = Mount.defineStream('RichTextBlockAnchor', {\n args: {\n /** The editor host's id. */\n hostId: Schema.String,\n /** The block the handle stands for. */\n node: RichText.NodeId,\n /** Pixels between the handle and the block. */\n gap: Schema.Number,\n /**\n * Beside the block's left edge (a handle), above it (a block's toolbar), or inside its top\n * right corner (a toolbar that should cover nothing around the block). Default left.\n */\n side: Schema.optionalKey(BlockSide),\n },\n messages: [Schema.Never],\n execute: ({ element, hostId, node, gap, side }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => anchorToBlock(element as Styled, hostId, node, gap, side ?? 'left')),\n release => Effect.sync(release),\n ),\n ),\n})\n","/**\n * Dragging a block by its handle (§148): the pointer picks a place beside any block the block may\n * move beside (`RichText.moveTargets`, so across containers where the vocabulary allows, §149), a\n * line outside the editable subtree shows it, and the drop sends `MovedBlock` there.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport * as RichText from 'foldkit-richtext'\nimport { Message } from './editor.js'\nimport { attachmentIn, vocabularyFor } from './host.js'\n\n/** A block the dragged one may land beside: its place in the document and on the page. */\nexport interface Placed {\n readonly id: RichText.NodeId\n /** Its container, as a key its siblings share, and its index there. */\n readonly container: string\n readonly index: number\n readonly top: number\n readonly bottom: number\n}\n\n/**\n * Where a pointer at `y` drops block `moving`, itself one of `targets` (in document order): beside\n * the target whose edge is nearest, before one at its top and after one at its bottom. Of two\n * edges equally near, the later target's wins. Undefined when that is where the block already is.\n *\n * A container's edge and its first or last block's are one edge: the block's wins while the\n * pointer is inside that block, and the container's once it is past it, or the container's own\n * edge could never be reached.\n */\nexport const dropBeside = (\n targets: ReadonlyArray<Placed>,\n moving: RichText.NodeId,\n y: number,\n): RichText.Beside | undefined => {\n const self = targets.find(target => target.id === moving)\n let nearest:\n | {\n readonly target: Placed\n readonly after: boolean\n readonly edge: number\n readonly distance: number\n }\n | undefined\n for (const target of targets) {\n for (const after of [false, true]) {\n const edge = after ? target.bottom : target.top\n const distance = Math.abs(y - edge)\n if (\n nearest === undefined ||\n distance < nearest.distance ||\n (distance === nearest.distance &&\n (edge !== nearest.edge || (y >= target.top && y <= target.bottom)))\n )\n nearest = { target, after, edge, distance }\n }\n }\n if (self === undefined || nearest === undefined) return undefined\n const { target, after } = nearest\n const stays =\n target.id === moving ||\n (target.container === self.container && target.index === self.index + (after ? -1 : 1))\n return stays ? undefined : after ? { after: target.id } : { before: target.id }\n}\n\n/** Each block's container key and index, from one walk of the document. */\nconst placesOf = (\n blocks: ReadonlyArray<RichText.Block>,\n container = '',\n into = new Map<RichText.NodeId, { readonly container: string; readonly index: number }>(),\n) => {\n for (const [index, block] of blocks.entries()) {\n into.set(block.id, { container, index })\n if (block.type === 'Node' && block.blocks !== undefined) placesOf(block.blocks, block.id, into)\n }\n return into\n}\n\n/** How far, in CSS pixels, a press on the handle moves before it is a drag rather than a tap. */\nexport const DRAG_THRESHOLD = 5\n\n/** How near the window's top or bottom a dragging pointer scrolls the page, in pixels. */\nconst SCROLL_EDGE = 48\n/** How far a frame scrolls with the pointer at the very edge; less the further in it is. */\nconst SCROLL_STEP = 18\n\n/**\n * How far a drag scrolls the page this frame for a pointer at `y` in a window `height` tall:\n * up near the top, down near the bottom, faster the nearer the edge, and not at all between.\n */\nexport const edgeScroll = (y: number, height: number): number => {\n const nearTop = SCROLL_EDGE - y\n const nearBottom = y - (height - SCROLL_EDGE)\n if (nearTop > 0) return -Math.ceil((Math.min(nearTop, SCROLL_EDGE) / SCROLL_EDGE) * SCROLL_STEP)\n if (nearBottom > 0)\n return Math.ceil((Math.min(nearBottom, SCROLL_EDGE) / SCROLL_EDGE) * SCROLL_STEP)\n return 0\n}\n\ninterface Pointed extends Event {\n readonly clientX?: number\n readonly clientY?: number\n readonly buttons?: number\n readonly pointerId?: number\n readonly button?: number\n readonly key?: string\n}\n\n/**\n * Lets `handle` drag block `node` of the editor in `hostId`: a press on it starts, the pointer\n * moving picks the place, release drops there through `dropped`, and Escape or a cancelled\n * pointer ends it without a drop. The page is listened to only while a press is under way, in\n * the capture phase, so a handler that stops a release does not hide it. The line is an element\n * of its own, `[data-richtext-drop]`, fixed at the edge the block would land on, for a\n * stylesheet to draw; once the pointer moves, the block being dragged carries\n * `data-richtext-dragging` until the drag ends, so a stylesheet can show which one it is, and\n * the page's root element carries `data-richtext-drag`, for a `grabbing` cursor everywhere the\n * pointer goes rather than the text's caret. The\n * handle takes `touch-action: none` while attached, or a touch would\n * pan the page and cancel the drag.\n */\nexport const dragBlock = (\n handle: Element,\n hostId: string,\n node: RichText.NodeId,\n dropped: (to: RichText.Beside) => void,\n): (() => void) => {\n const owner = handle.ownerDocument\n let pointer: number | undefined\n let pressed = false\n let target: RichText.Beside | undefined\n let line: HTMLElement | undefined\n /** The dragged block's element, marked once the pointer moves: a press alone marks nothing. */\n let moving: HTMLElement | undefined\n let marked = false\n // Where the pointer last was, for a scroll that moves the blocks under a still pointer.\n let lastY = 0\n // Where it went down: until it has moved `DRAG_THRESHOLD` from there, the press is a tap.\n let startX = 0\n let startY = 0\n const { style } = handle as Element & ElementCSSInlineStyle\n const touchAction = style.getPropertyValue('touch-action')\n style.setProperty('touch-action', 'none')\n\n const draw = (at: { readonly top: number; readonly left: number; readonly width: number }) => {\n line ??= owner.body.appendChild(owner.createElement('div'))\n line.setAttribute('data-richtext-drop', '')\n line.style.position = 'fixed'\n line.style.top = `${at.top}px`\n line.style.left = `${at.left}px`\n line.style.width = `${at.width}px`\n }\n // What a drag can land beside is fixed when it starts; where those blocks are on the page is\n // read again as the pointer moves, since the page can scroll under it.\n let targets: ReadonlyArray<{\n readonly id: RichText.NodeId\n readonly container: string\n readonly index: number\n readonly element: HTMLElement\n }> = []\n /** Whether an event is the pressing pointer's: another finger or pen does not steer the drag. */\n const ours = (event: Event) => pointer === undefined || (event as Pointed).pointerId === pointer\n /** Picks the place for a pointer at `y` from where the blocks are now, and draws its line. */\n const place = (y: number) => {\n lastY = y\n const placed = targets.map(each => {\n const box = each.element.getBoundingClientRect()\n return { ...each, top: box.top, bottom: box.bottom, left: box.left, width: box.width }\n })\n target = dropBeside(placed, node, y)\n const edge =\n target === undefined\n ? undefined\n : 'before' in target\n ? { id: target.before, top: true }\n : { id: target.after, top: false }\n const block = edge === undefined ? undefined : placed.find(each => each.id === edge.id)\n if (edge === undefined || block === undefined) {\n line?.remove()\n line = undefined\n return\n }\n draw({ top: edge.top ? block.top : block.bottom, left: block.left, width: block.width })\n }\n const moved = (event: Event) => {\n const pointed = event as Pointed\n if (!ours(pointed)) return\n // A move with the button up is a release this page never heard: over a frame, say.\n if (((pointed.buttons ?? 1) & 1) === 0) return end(false)\n if (!marked) {\n // A finger's tap wanders a pixel or two; only a move past that is a drag.\n const x = (pointed.clientX ?? startX) - startX\n const y = (pointed.clientY ?? startY) - startY\n if (Math.hypot(x, y) < DRAG_THRESHOLD) return\n moving?.setAttribute('data-richtext-dragging', '')\n owner.documentElement.setAttribute('data-richtext-drag', '')\n marked = true\n }\n place(pointed.clientY ?? lastY)\n scrollSoon()\n }\n // A block can be dragged past what the window shows: held near an edge, the pointer scrolls\n // the page a frame at a time, and the scroll listener re-places the line.\n const view = owner.defaultView\n let frame: number | undefined\n const scrollSoon = () => {\n if (frame !== undefined || view === null || edgeScroll(lastY, view.innerHeight) === 0) return\n frame = view.requestAnimationFrame(() => {\n frame = undefined\n if (!marked) return\n view.scrollBy(0, edgeScroll(lastY, view.innerHeight))\n scrollSoon()\n })\n }\n const end = (drop: boolean): void => {\n if (frame !== undefined) view?.cancelAnimationFrame(frame)\n frame = undefined\n const chosen = target\n pressed = false\n pointer = undefined\n target = undefined\n targets = []\n line?.remove()\n line = undefined\n moving?.removeAttribute('data-richtext-dragging')\n owner.documentElement.removeAttribute('data-richtext-drag')\n moving = undefined\n marked = false\n for (const [type, listener] of onPage) owner.removeEventListener(type, listener, true)\n if (drop && chosen !== undefined) dropped(chosen)\n }\n const onPage: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n ['pointermove', moved],\n [\n 'pointerup',\n event => {\n if (!ours(event)) return\n // A press that never became a drag drops nothing: it was a tap on the handle.\n if (!marked) return end(false)\n // The place is the release's own, not the last move's: the page may have scrolled.\n place((event as Pointed).clientY ?? lastY)\n end(true)\n },\n ],\n ['scroll', () => place(lastY)],\n [\n 'pointercancel',\n event => {\n if (ours(event)) end(false)\n },\n ],\n [\n 'keydown',\n event => {\n if ((event as Pointed).key !== 'Escape') return\n event.preventDefault()\n end(false)\n },\n ],\n ]\n const pressedOn = (event: Event) => {\n const pointed = event as Pointed\n if (pressed || (pointed.button ?? 0) !== 0) return\n pressed = true\n pointer = pointed.pointerId\n lastY = pointed.clientY ?? 0\n startX = pointed.clientX ?? 0\n startY = lastY\n const host = owner.getElementById(hostId)\n const dom = host === null ? undefined : attachmentIn(host)?.current()\n if (dom !== undefined) {\n moving = dom.elements.get(node)\n const places = placesOf(dom.content.children)\n targets = RichText.moveTargets(dom.content, node, vocabularyFor(hostId).nodes).flatMap(id => {\n const place = places.get(id)\n const element = dom.elements.get(id)\n return place === undefined || element === undefined ? [] : [{ id, ...place, element }]\n })\n }\n // The press is the handle's, not the start of a text selection in the page.\n event.preventDefault()\n for (const [type, listener] of onPage) owner.addEventListener(type, listener, true)\n }\n handle.addEventListener('pointerdown', pressedOn)\n return () => {\n handle.removeEventListener('pointerdown', pressedOn)\n if (touchAction === '') style.removeProperty('touch-action')\n else style.setProperty('touch-action', touchAction)\n if (pressed) end(false)\n }\n}\n\n/** `dragBlock` as a Mount, for a block handle's grip; its drop is the editor's `MovedBlock`. */\nexport const blockDrag = Mount.defineStream('RichTextBlockDrag', {\n args: {\n /** The editor host's id. */\n hostId: Schema.String,\n /** The block the handle stands for. */\n node: RichText.NodeId,\n },\n messages: [Message.MovedBlock],\n execute: ({ element, hostId, node }) =>\n Stream.callback<typeof Message.MovedBlock.Type>(queue =>\n Effect.acquireRelease(\n Effect.sync(() =>\n dragBlock(element, hostId, node, to =>\n Queue.offerUnsafe(queue, Message.MovedBlock({ node, to })),\n ),\n ),\n release => Effect.sync(release),\n ),\n ),\n})\n","/**\n * The marks toolbar (§35, §119): a button per mark, dispatching the same Messages\n * a chord does. It is the application's chrome, not the editor's — §29 gives the\n * editor the `contenteditable` subtree and the application everything around it —\n * so this renders a value the application places beside the editor's host, and it\n * never touches the DOM the editor owns. A Mixins slot family wraps these buttons\n * when an application needs to restyle or replace parts.\n */\nimport type { Html, HtmlBuilder } from 'foldkit/html'\nimport * as RichText from 'foldkit-richtext'\n\n/** The editor state a toolbar reads: what a Bundle projects, without the rest. */\nexport interface ToolbarState {\n readonly document: RichText.Document\n readonly selection: RichText.Selection | null\n readonly storedMarks: ReadonlyArray<string> | null\n}\n\nexport interface ToolbarOptions<Message> {\n readonly state: ToolbarState\n /** The marks to offer, by name. Defaults to the three the package ships. */\n readonly marks?: ReadonlyArray<string> | undefined\n /** How a mark becomes the application's Message, usually its editor wrapper. */\n readonly toMessage: (mark: string) => Message\n}\n\n/**\n * A mark is active when the caret carries it, or — with no stored format — when\n * every run the selection covers does (§119). Exported because a Mixins slot view\n * renders its own buttons and needs the same rule.\n */\nexport const markActive = (state: ToolbarState, mark: string): boolean =>\n state.storedMarks !== null\n ? state.storedMarks.includes(mark)\n : RichText.marksInRange(state.document, state.selection).has(mark)\n\n/** Buttons for the editor's marks. The application decides where they go. */\nexport const marksToolbar =\n <Message>(options: ToolbarOptions<Message>) =>\n (h: HtmlBuilder<Message>): Html => {\n const marks = options.marks ?? RichText.shippedMarks.map(definition => definition.name)\n return h.div(\n [h.DataAttribute('toolbar', 'marks')],\n marks.map(mark =>\n h.button(\n [\n h.Type('button'),\n h.DataAttribute('mark', mark),\n h.AriaLabel(mark),\n h.AriaPressed(markActive(options.state, mark) ? 'true' : 'false'),\n h.OnClick(options.toMessage(mark)),\n ],\n [mark],\n ),\n ),\n )\n }\n\n/** What places a floating toolbar over the selection (§143), and a block handle beside its block (§144). */\nexport { blockAnchor, selectionAnchor } from './floating.js'\n\n/** What drags a block by its handle, to wherever its kind may stand (§148, §149). */\nexport { blockDrag } from './drag.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,aACX,QACA,UACA,UACA,QAC0F;CAC1F,MAAM,QAAQ,OAAO,MAAM,MAAM,SAAS;CAC1C,MAAM,UAAU,OAAO,OAAO,OAAO,QAAQ,IAAI,SAAS,QAAQ;CAClE,OAAO;EACL,KAAK,SAAS,IAAI,QAAQ,OAAO,MAAM,OAAO,SAAS;EACvD,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,SAAS,QAAQ,SAAS,KAAK,CAAC;EACpE,WAAW,SAAS,IAAI,QAAQ;CAClC;AACF;;;;;AAMA,MAAa,cACX,QACA,UACA,UACA,QAC0F;CAC1F,MAAM,QAAQ,OAAO,MAAM,OAAO,SAAS;CAC3C,MAAM,OAAO,QAAQ,SAAS,UAAU,SAAS;CACjD,OAAO;EACL,KAAK,OAAO,QAAQ,KAAK,IAAI,GAAG,OAAO,MAAM,MAAM,SAAS,MAAM;EAClE,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,OAAO,MAAM,SAAS,QAAQ,SAAS,KAAK,CAAC;EACxE,WAAW,OAAO,WAAW;CAC/B;AACF;;;;;AAMA,MAAM,YAAY,UAAsB;CACtC,MAAM,MAAM,MAAM,sBAAsB;CACxC,IAAI,IAAI,UAAU,KAAK,IAAI,WAAW,KAAK,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,OAAO,CAAC,GACpC,MAAM,KAAI,SACR,EAAE,OACA;EACE,EAAE,KAAK,QAAQ;EACf,EAAE,cAAc,QAAQ,IAAI;EAC5B,EAAE,UAAU,IAAI;EAChB,EAAE,YAAY,WAAW,QAAQ,OAAO,IAAI,IAAI,SAAS,OAAO;EAChE,EAAE,QAAQ,QAAQ,UAAU,IAAI,CAAC;CACnC,GACA,CAAC,IAAI,CACP,CACF,CACF;AACF"}
|
package/dist/view.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as RichText from "foldkit-richtext";
|
|
2
2
|
import { Html } from "foldkit/html";
|
|
3
|
-
//#region src/view.d.ts
|
|
4
3
|
/** One element per block, ready to place in any Foldkit view. */
|
|
5
4
|
export declare const renderBlocks: (blocks: ReadonlyArray<RichText.Block>, renderer?: RichText.Rendering) => ReadonlyArray<Html>;
|
|
6
5
|
/**
|
|
@@ -17,5 +16,4 @@ export declare const renderDocument: (document: RichText.Document, renderer?: Ri
|
|
|
17
16
|
* registry and decorations the editor will mount with.
|
|
18
17
|
*/
|
|
19
18
|
export declare const renderEditable: (document: RichText.Document, renderer?: RichText.Rendering, decorations?: RichText.DecorationSet) => Html;
|
|
20
|
-
//#endregion
|
|
21
19
|
//# sourceMappingURL=view.d.mts.map
|
package/dist/view.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.mts","names":[],"sources":["../src/view.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"view.d.mts","names":[],"sources":["../src/view.ts"],"mappings":";;;qBAiJa,eAAY,QACf,cAAc,SAAS,QAAM,WAC3B,SAAS,cAClB,cAAc;;;;;;;qBAQJ,iBAAc,UACf,SAAS,UAAQ,WACjB,SAAS,WAAS,cACf,SAAS,kBACrB;;;;;;;qBAyEU,iBAAc,UACf,SAAS,UAAQ,WACjB,SAAS,WAAS,cACf,SAAS,kBACrB"}
|
package/dist/view.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as decorationSpans, r as piecesOf, t as decorationAttributes } from "./decorations-
|
|
2
|
-
import { n as needsFiller, t as FILLER_ATTRIBUTE } from "./filler-
|
|
1
|
+
import { n as decorationSpans, r as piecesOf, t as decorationAttributes } from "./decorations-D0J3rIhW.mjs";
|
|
2
|
+
import { n as needsFiller, t as FILLER_ATTRIBUTE } from "./filler-DkAb1dBX.mjs";
|
|
3
3
|
import * as RichText from "foldkit-richtext";
|
|
4
4
|
import { define } from "foldkit/customElement";
|
|
5
5
|
import { inertHtml } from "foldkit/html";
|
|
6
|
-
|
|
6
|
+
// src/view.ts
|
|
7
7
|
/**
|
|
8
8
|
* The read-only renderer (§33): a Document becomes ordinary Foldkit `Html`, so
|
|
9
9
|
* SSR, static pages, CMS visitor rendering, and email generation all reuse one
|
|
@@ -151,7 +151,6 @@ const renderEditable = (document, renderer = RichText.noRendering, decorations =
|
|
|
151
151
|
inertHtml.Attribute("aria-multiline", "true")
|
|
152
152
|
], document.children.map((block) => editableBlock(renderer, block, spans)));
|
|
153
153
|
};
|
|
154
|
-
//#endregion
|
|
155
154
|
export { renderBlocks, renderDocument, renderEditable };
|
|
156
155
|
|
|
157
156
|
//# sourceMappingURL=view.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-richtext-dom",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "The DOM interpreter for a foldkit-richtext editable subtree.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
"LICENSE"
|
|
81
81
|
],
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"foldkit-richtext": "0.5.
|
|
83
|
+
"foldkit-richtext": "0.5.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"effect": "^4.0.0",
|
|
87
87
|
"foldkit": "^0.169.0",
|
|
88
88
|
"foldkit-bundle": "^0.8.1",
|
|
89
|
-
"foldkit-form": "^0.
|
|
89
|
+
"foldkit-form": "^0.8.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependenciesMeta": {
|
|
92
92
|
"foldkit-form": {
|
|
@@ -99,9 +99,9 @@
|
|
|
99
99
|
"jsdom": "30.1.3",
|
|
100
100
|
"tsdown": "^0.23.1",
|
|
101
101
|
"typescript": "7.0.2",
|
|
102
|
-
"foldkit-entity": "0.11.0",
|
|
103
102
|
"foldkit-bundle": "0.8.1",
|
|
104
|
-
"foldkit-
|
|
103
|
+
"foldkit-entity": "0.12.0",
|
|
104
|
+
"foldkit-form": "0.8.0"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"build": "tsdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-Cmo24yol.d.mts","names":["_$__events_js0.Attachment"],"sources":["../src/editor.ts"],"mappings":";;;;;cAyBa,mCAAO;;IACT,MAAI,OAAA;;;;;;IAIE,MAAI,OAAA;;;;IAEJ,MAAI,OAAA,gBAAA,OAAA,gBAAA,OAAA;;;;;;;;;;IAKJ,MAAI,OAAA,gBAAA,OAAA,gBAAA,OAAA;;;;;;IACH,OAAK,OAAA,gBAAA,OAAA;;;;;;;;;IAEL,YAAU,OAAA,OAAA,OAAA;;;;;;;IAER,IAAE,OAAA;;;;;;;;;IAIN,MAAI,OAAA,MAAA,OAAA;IAAmB,IAAE,OAAA,gBAAA,OAAA;;;;;;;;;;IAEtB,OAAK,OAAA,gBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAkB,IAAE,OAAA,YAAA,O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