foldkit-mixins-richtext 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code.d.ts +32 -0
- package/dist/code.d.ts.map +1 -0
- package/dist/code.js +39 -0
- package/dist/code.js.map +1 -0
- package/dist/contents.d.ts +22 -0
- package/dist/contents.d.ts.map +1 -0
- package/dist/contents.js +29 -0
- package/dist/contents.js.map +1 -0
- package/dist/find.d.ts +41 -0
- package/dist/find.d.ts.map +1 -0
- package/dist/find.js +91 -0
- package/dist/find.js.map +1 -0
- package/dist/footnote.d.ts +26 -0
- package/dist/footnote.d.ts.map +1 -0
- package/dist/footnote.js +43 -0
- package/dist/footnote.js.map +1 -0
- package/dist/handle.d.ts +30 -0
- package/dist/handle.d.ts.map +1 -0
- package/dist/handle.js +58 -0
- package/dist/handle.js.map +1 -0
- package/dist/iconData.d.ts +4 -0
- package/dist/iconData.d.ts.map +1 -0
- package/dist/iconData.js +1038 -0
- package/dist/iconData.js.map +1 -0
- package/dist/icons.d.ts +16 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +34 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/link.d.ts +44 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +77 -0
- package/dist/link.js.map +1 -0
- package/dist/menu.d.ts +26 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +44 -0
- package/dist/menu.js.map +1 -0
- package/dist/palette.d.ts +31 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +72 -0
- package/dist/palette.js.map +1 -0
- package/dist/slash.d.ts +22 -0
- package/dist/slash.d.ts.map +1 -0
- package/dist/slash.js +36 -0
- package/dist/slash.js.map +1 -0
- package/dist/source.d.ts +52 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +127 -0
- package/dist/source.js.map +1 -0
- package/dist/status.d.ts +20 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +35 -0
- package/dist/status.js.map +1 -0
- package/dist/style.d.ts +49 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +99 -0
- package/dist/style.js.map +1 -0
- package/dist/table.d.ts +23 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +81 -0
- package/dist/table.js.map +1 -0
- package/package.json +13 -13
- package/dist/index.d.mts +0 -407
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -1858
- package/dist/index.mjs.map +0 -1
package/dist/code.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { EditorEvent } from "foldkit-richtext-dom/editor";
|
|
4
|
+
/** The elements the toolbar publishes: its wrapper, the language picker, and the Copy button. */
|
|
5
|
+
export declare const CodeToolbarSlots: Slots.Contract<{
|
|
6
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
7
|
+
readonly language: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
8
|
+
readonly copy: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
9
|
+
}>;
|
|
10
|
+
/** A language the picker offers: the `language` prop's value, and what the picker shows. */
|
|
11
|
+
export interface CodeLanguage {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CodeToolbarInput<Message> {
|
|
16
|
+
readonly document: RichText.Document;
|
|
17
|
+
/** The code block the toolbar is for. */
|
|
18
|
+
readonly node: RichText.NodeId;
|
|
19
|
+
/** What the picker offers, in order; `''` is code with no language. */
|
|
20
|
+
readonly languages: ReadonlyArray<CodeLanguage>;
|
|
21
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
22
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
23
|
+
/** What Copy sends: the caller copies the block's text (`RichText.toText([block])`). */
|
|
24
|
+
readonly copied: Message;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The code block toolbar as a slot view. The picker shows the block's language, and a language
|
|
28
|
+
* the list does not name is offered as itself, so choosing nothing never changes it. Nothing is
|
|
29
|
+
* drawn for a block that is not there.
|
|
30
|
+
*/
|
|
31
|
+
export declare const codeToolbar: <Message>() => SlotView.SlotView<typeof CodeToolbarSlots, CodeToolbarInput<Message>, Message>;
|
|
32
|
+
//# sourceMappingURL=code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.d.ts","names":[],"sources":["../src/code.ts"],"mappings":";;;;qBAYa,kBAAgB,MAAA;;;;;;iBAOZ;WACN;WACA;;iBAGM,iBAAiB;WACvB,UAAU,SAAS;;WAEnB,MAAM,SAAS;;WAEf,WAAW,cAAc;;WAEzB,OAAO,SAAS,gBAAgB;;WAEhC,QAAQ;;;;;;;qBAQN,cAAe,cAAY,SAAS,gBACxC,kBACP,iBAAiB,UACjB"}
|
package/dist/code.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { Message } from "foldkit-richtext-dom/editor";
|
|
4
|
+
// src/code.ts
|
|
5
|
+
/** The elements the toolbar publishes: its wrapper, the language picker, and the Copy button. */
|
|
6
|
+
const CodeToolbarSlots = Slots.define({
|
|
7
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
8
|
+
language: Slot.make({ capability: Capability.Interactive }),
|
|
9
|
+
copy: Slot.make({ capability: Capability.Interactive })
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* The code block toolbar as a slot view. The picker shows the block's language, and a language
|
|
13
|
+
* the list does not name is offered as itself, so choosing nothing never changes it. Nothing is
|
|
14
|
+
* drawn for a block that is not there.
|
|
15
|
+
*/
|
|
16
|
+
const codeToolbar = () => SlotView.forMessages().define(CodeToolbarSlots, (input, slots, h) => {
|
|
17
|
+
const block = RichText.locateBlock(input.document, input.node)?.block;
|
|
18
|
+
const current = block?.type === "Node" ? block.props.language : void 0;
|
|
19
|
+
const language = typeof current === "string" ? current : "";
|
|
20
|
+
const languages = input.languages.some((each) => each.id === language) ? input.languages : [...input.languages, {
|
|
21
|
+
id: language,
|
|
22
|
+
label: language
|
|
23
|
+
}];
|
|
24
|
+
return h.div(slots.root.attrs([h.Role("toolbar"), h.AriaLabel("Code")]), [h.select(slots.language.attrs([
|
|
25
|
+
h.AriaLabel("Language"),
|
|
26
|
+
h.Value(language),
|
|
27
|
+
h.OnChange((chosen) => input.wrap(Message.ChangedProps({
|
|
28
|
+
node: input.node,
|
|
29
|
+
props: { language: chosen }
|
|
30
|
+
})))
|
|
31
|
+
]), languages.map((each) => h.option([h.Value(each.id), h.Selected(each.id === language)], [each.label]))), h.button(slots.copy.attrs([
|
|
32
|
+
h.Type("button"),
|
|
33
|
+
h.DataAttribute("code", "copy"),
|
|
34
|
+
h.OnClick(input.copied)
|
|
35
|
+
]), ["Copy"])]);
|
|
36
|
+
});
|
|
37
|
+
export { CodeToolbarSlots, codeToolbar };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=code.js.map
|
package/dist/code.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","names":["EditorMessage"],"sources":["../src/code.ts"],"sourcesContent":["/**\n * The code block toolbar: the block's language, chosen from the caller's list, and a Copy\n * button, drawn through slots. The language is the block's `language` prop, set through the\n * editor's `ChangedProps`, so it is saved and undone with the text; copying is the caller's\n * own Message, since writing to the clipboard is a Command the editor does not own.\n */\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { Message as EditorMessage, type EditorEvent } from 'foldkit-richtext-dom/editor'\n\n/** The elements the toolbar publishes: its wrapper, the language picker, and the Copy button. */\nexport const CodeToolbarSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n language: Slot.make({ capability: Capability.Interactive }),\n copy: Slot.make({ capability: Capability.Interactive }),\n})\n\n/** A language the picker offers: the `language` prop's value, and what the picker shows. */\nexport interface CodeLanguage {\n readonly id: string\n readonly label: string\n}\n\nexport interface CodeToolbarInput<Message> {\n readonly document: RichText.Document\n /** The code block the toolbar is for. */\n readonly node: RichText.NodeId\n /** What the picker offers, in order; `''` is code with no language. */\n readonly languages: ReadonlyArray<CodeLanguage>\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n /** What Copy sends: the caller copies the block's text (`RichText.toText([block])`). */\n readonly copied: Message\n}\n\n/**\n * The code block toolbar as a slot view. The picker shows the block's language, and a language\n * the list does not name is offered as itself, so choosing nothing never changes it. Nothing is\n * drawn for a block that is not there.\n */\nexport const codeToolbar = <Message>(): SlotView.SlotView<\n typeof CodeToolbarSlots,\n CodeToolbarInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(CodeToolbarSlots, (input, slots, h): Html => {\n const block = RichText.locateBlock(input.document, input.node)?.block\n const current = block?.type === 'Node' ? block.props.language : undefined\n const language = typeof current === 'string' ? current : ''\n const languages = input.languages.some(each => each.id === language)\n ? input.languages\n : [...input.languages, { id: language, label: language }]\n return h.div(slots.root.attrs([h.Role('toolbar'), h.AriaLabel('Code')]), [\n h.select(\n slots.language.attrs([\n h.AriaLabel('Language'),\n h.Value(language),\n h.OnChange(chosen =>\n input.wrap(\n EditorMessage.ChangedProps({ node: input.node, props: { language: chosen } }),\n ),\n ),\n ]),\n languages.map(each =>\n h.option([h.Value(each.id), h.Selected(each.id === language)], [each.label]),\n ),\n ),\n h.button(\n slots.copy.attrs([\n h.Type('button'),\n h.DataAttribute('code', 'copy'),\n h.OnClick(input.copied),\n ]),\n ['Copy'],\n ),\n ])\n })\n"],"mappings":";;;;;AAYA,MAAa,mBAAmB,MAAM,OAAO;CAC3C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,UAAU,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;CAC1D,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;AACxD,CAAC;;;;;;AAyBD,MAAa,oBAKX,SAAS,YAAqB,CAAC,CAAC,OAAO,mBAAmB,OAAO,OAAO,MAAY;CAClF,MAAM,QAAQ,SAAS,YAAY,MAAM,UAAU,MAAM,IAAI,CAAC,EAAE;CAChE,MAAM,UAAU,OAAO,SAAS,SAAS,MAAM,MAAM,WAAW,KAAA;CAChE,MAAM,WAAW,OAAO,YAAY,WAAW,UAAU;CACzD,MAAM,YAAY,MAAM,UAAU,MAAK,SAAQ,KAAK,OAAO,QAAQ,IAC/D,MAAM,YACN,CAAC,GAAG,MAAM,WAAW;EAAE,IAAI;EAAU,OAAO;CAAS,CAAC;CAC1D,OAAO,EAAE,IAAI,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,SAAS,GAAG,EAAE,UAAU,MAAM,CAAC,CAAC,GAAG,CACvE,EAAE,OACA,MAAM,SAAS,MAAM;EACnB,EAAE,UAAU,UAAU;EACtB,EAAE,MAAM,QAAQ;EAChB,EAAE,UAAS,WACT,MAAM,KACJA,QAAc,aAAa;GAAE,MAAM,MAAM;GAAM,OAAO,EAAE,UAAU,OAAO;EAAE,CAAC,CAC9E,CACF;CACF,CAAC,GACD,UAAU,KAAI,SACZ,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAC7E,CACF,GACA,EAAE,OACA,MAAM,KAAK,MAAM;EACf,EAAE,KAAK,QAAQ;EACf,EAAE,cAAc,QAAQ,MAAM;EAC9B,EAAE,QAAQ,MAAM,MAAM;CACxB,CAAC,GACD,CAAC,MAAM,CACT,CACF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
/**
|
|
4
|
+
* The elements the contents publish: the `nav`, its list, and one entry per heading. An entry
|
|
5
|
+
* carries its depth as `--fk-toc-level` (1 for the shallowest level the document uses) and
|
|
6
|
+
* `aria-current="location"` for the section the selection is in.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TableOfContentsSlots: Slots.Contract<{
|
|
9
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
10
|
+
readonly list: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
11
|
+
readonly entry: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
12
|
+
}>;
|
|
13
|
+
export interface TableOfContentsInput<Message> {
|
|
14
|
+
readonly document: RichText.Document;
|
|
15
|
+
/** Where the caret is, whose section is marked current. */
|
|
16
|
+
readonly selection: RichText.Selection | null;
|
|
17
|
+
/** A heading was chosen. */
|
|
18
|
+
readonly chosen: (node: RichText.NodeId) => Message;
|
|
19
|
+
}
|
|
20
|
+
/** The contents as a slot view; nothing is drawn for a document with no headings. */
|
|
21
|
+
export declare const tableOfContents: <Message>() => SlotView.SlotView<typeof TableOfContentsSlots, TableOfContentsInput<Message>, Message>;
|
|
22
|
+
//# sourceMappingURL=contents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contents.d.ts","names":[],"sources":["../src/contents.ts"],"mappings":";;;;;;;qBAca,sBAAoB,MAAA;;;;;iBAMhB,qBAAqB;WAC3B,UAAU,SAAS;;WAEnB,WAAW,SAAS;;WAEpB,SAAS,MAAM,SAAS,WAAW;;;qBAIjC,kBAAmB,cAAY,SAAS,gBAC5C,sBACP,qBAAqB,UACrB"}
|
package/dist/contents.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
// src/contents.ts
|
|
4
|
+
/**
|
|
5
|
+
* The elements the contents publish: the `nav`, its list, and one entry per heading. An entry
|
|
6
|
+
* carries its depth as `--fk-toc-level` (1 for the shallowest level the document uses) and
|
|
7
|
+
* `aria-current="location"` for the section the selection is in.
|
|
8
|
+
*/
|
|
9
|
+
const TableOfContentsSlots = Slots.define({
|
|
10
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
11
|
+
list: Slot.make({ capability: Capability.Container }),
|
|
12
|
+
entry: Slot.make({ capability: Capability.Interactive })
|
|
13
|
+
});
|
|
14
|
+
/** The contents as a slot view; nothing is drawn for a document with no headings. */
|
|
15
|
+
const tableOfContents = () => SlotView.forMessages().define(TableOfContentsSlots, (input, slots, h) => {
|
|
16
|
+
const entries = RichText.outlineOf(input.document);
|
|
17
|
+
if (entries.length === 0) return h.empty;
|
|
18
|
+
const top = Math.min(...entries.map((entry) => entry.level));
|
|
19
|
+
const current = RichText.sectionAt(input.document, input.selection);
|
|
20
|
+
return h.nav(slots.root.attrs([h.AriaLabel("Contents")]), [h.ul(slots.list.attrs(), entries.map((entry) => h.li([h.Key(entry.node)], [h.button(slots.entry.attrs([
|
|
21
|
+
h.Type("button"),
|
|
22
|
+
h.Style({ "--fk-toc-level": String(entry.level - top + 1) }),
|
|
23
|
+
...entry.node === current ? [h.AriaCurrent("location")] : [],
|
|
24
|
+
h.OnClick(input.chosen(entry.node))
|
|
25
|
+
]), [entry.text])])))]);
|
|
26
|
+
});
|
|
27
|
+
export { TableOfContentsSlots, tableOfContents };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=contents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contents.js","names":[],"sources":["../src/contents.ts"],"sourcesContent":["/**\n * The table of contents: the document's headings as links, drawn through slots. It is a read of\n * the document (`RichText.outlineOf`) and holds no state; choosing a heading is the caller's\n * Message, since moving the caret there and scrolling to it are the caller's to do.\n */\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\n\n/**\n * The elements the contents publish: the `nav`, its list, and one entry per heading. An entry\n * carries its depth as `--fk-toc-level` (1 for the shallowest level the document uses) and\n * `aria-current=\"location\"` for the section the selection is in.\n */\nexport const TableOfContentsSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n list: Slot.make({ capability: Capability.Container }),\n entry: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface TableOfContentsInput<Message> {\n readonly document: RichText.Document\n /** Where the caret is, whose section is marked current. */\n readonly selection: RichText.Selection | null\n /** A heading was chosen. */\n readonly chosen: (node: RichText.NodeId) => Message\n}\n\n/** The contents as a slot view; nothing is drawn for a document with no headings. */\nexport const tableOfContents = <Message>(): SlotView.SlotView<\n typeof TableOfContentsSlots,\n TableOfContentsInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(TableOfContentsSlots, (input, slots, h): Html => {\n const entries = RichText.outlineOf(input.document)\n if (entries.length === 0) return h.empty\n const top = Math.min(...entries.map(entry => entry.level))\n const current = RichText.sectionAt(input.document, input.selection)\n return h.nav(slots.root.attrs([h.AriaLabel('Contents')]), [\n h.ul(\n slots.list.attrs(),\n entries.map(entry =>\n h.li(\n [h.Key(entry.node)],\n [\n h.button(\n slots.entry.attrs([\n h.Type('button'),\n h.Style({ '--fk-toc-level': String(entry.level - top + 1) }),\n ...(entry.node === current ? [h.AriaCurrent('location')] : []),\n h.OnClick(input.chosen(entry.node)),\n ]),\n [entry.text],\n ),\n ],\n ),\n ),\n ),\n ])\n })\n"],"mappings":";;;;;;;;AAcA,MAAa,uBAAuB,MAAM,OAAO;CAC/C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,OAAO,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;AACzD,CAAC;;AAWD,MAAa,wBAKX,SAAS,YAAqB,CAAC,CAAC,OAAO,uBAAuB,OAAO,OAAO,MAAY;CACtF,MAAM,UAAU,SAAS,UAAU,MAAM,QAAQ;CACjD,IAAI,QAAQ,WAAW,GAAG,OAAO,EAAE;CACnC,MAAM,MAAM,KAAK,IAAI,GAAG,QAAQ,KAAI,UAAS,MAAM,KAAK,CAAC;CACzD,MAAM,UAAU,SAAS,UAAU,MAAM,UAAU,MAAM,SAAS;CAClE,OAAO,EAAE,IAAI,MAAM,KAAK,MAAM,CAAC,EAAE,UAAU,UAAU,CAAC,CAAC,GAAG,CACxD,EAAE,GACA,MAAM,KAAK,MAAM,GACjB,QAAQ,KAAI,UACV,EAAE,GACA,CAAC,EAAE,IAAI,MAAM,IAAI,CAAC,GAClB,CACE,EAAE,OACA,MAAM,MAAM,MAAM;EAChB,EAAE,KAAK,QAAQ;EACf,EAAE,MAAM,EAAE,kBAAkB,OAAO,MAAM,QAAQ,MAAM,CAAC,EAAE,CAAC;EAC3D,GAAI,MAAM,SAAS,UAAU,CAAC,EAAE,YAAY,UAAU,CAAC,IAAI,CAAC;EAC5D,EAAE,QAAQ,MAAM,OAAO,MAAM,IAAI,CAAC;CACpC,CAAC,GACD,CAAC,MAAM,IAAI,CACb,CACF,CACF,CACF,CACF,CACF,CAAC;AACH,CAAC"}
|
package/dist/find.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { EditorEvent } from "foldkit-richtext-dom/editor";
|
|
4
|
+
/** The elements the bar publishes: its wrapper, its two fields, the count, and its buttons. */
|
|
5
|
+
export declare const FindReplaceSlots: Slots.Contract<{
|
|
6
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
7
|
+
readonly field: Slot.UnnamedSlot<Capability.Capability<"TextInput", readonly [Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
8
|
+
readonly count: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
9
|
+
readonly button: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
10
|
+
}>;
|
|
11
|
+
export interface FindReplaceInput<Message> {
|
|
12
|
+
readonly document: RichText.Document;
|
|
13
|
+
readonly query: string;
|
|
14
|
+
readonly replacement: string;
|
|
15
|
+
/** The match the bar is on, by its index in `RichText.findMatches`. */
|
|
16
|
+
readonly current: number;
|
|
17
|
+
readonly caseSensitive: boolean;
|
|
18
|
+
readonly queried: (query: string) => Message;
|
|
19
|
+
readonly replacementDrafted: (replacement: string) => Message;
|
|
20
|
+
/**
|
|
21
|
+
* Go to the next match (1) or the previous one (-1). The caller moves its current match with
|
|
22
|
+
* `stepMatch` against its Model as it is then, since keys can come faster than the bar is drawn.
|
|
23
|
+
*/
|
|
24
|
+
readonly stepped: (step: 1 | -1) => Message;
|
|
25
|
+
readonly caseToggled: Message;
|
|
26
|
+
readonly closed: Message;
|
|
27
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
28
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The index a step from `current` lands on among `count` matches, wrapping at either end, so
|
|
32
|
+
* Enter keeps cycling through them as a browser's find does.
|
|
33
|
+
*/
|
|
34
|
+
export declare const stepMatch: (current: number, count: number, step: 1 | -1) => number;
|
|
35
|
+
/**
|
|
36
|
+
* The bar as a slot view. Enter in the find field goes to the next match and Shift+Enter to the
|
|
37
|
+
* previous one; Escape in either field closes it. Replace replaces the current match and Replace
|
|
38
|
+
* all every one; both are disabled with no match. Each button carries `data-find`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const findReplace: <Message>() => SlotView.SlotView<typeof FindReplaceSlots, FindReplaceInput<Message>, Message>;
|
|
41
|
+
//# sourceMappingURL=find.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find.d.ts","names":[],"sources":["../src/find.ts"],"mappings":";;;;qBAca,kBAAgB,MAAA;;;;;;iBAOZ,iBAAiB;WACvB,UAAU,SAAS;WACnB;WACA;;WAEA;WACA;WACA,UAAU,kBAAkB;WAC5B,qBAAqB,wBAAwB;;;;;WAK7C,UAAU,iBAAiB;WAC3B,aAAa;WACb,QAAQ;;WAER,OAAO,SAAS,gBAAgB;;;;;;qBAO9B,YAAS,iBAAmB,eAAe;;;;;;qBAQ3C,cAAe,cAAY,SAAS,gBACxC,kBACP,iBAAiB,UACjB"}
|
package/dist/find.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { Message } from "foldkit-richtext-dom/editor";
|
|
4
|
+
import { Option } from "effect";
|
|
5
|
+
import { richTextIcon } from "./icons.js";
|
|
6
|
+
// src/find.ts
|
|
7
|
+
/**
|
|
8
|
+
* The find and replace bar, drawn through slots. Like the rest of the chrome it holds no state:
|
|
9
|
+
* the query, the replacement, which match is current and whether case counts are the caller's,
|
|
10
|
+
* the matches are a read of the document (`RichText.findMatches`), and replacing is the editor's
|
|
11
|
+
* own `ReplacedText`, so a replacement is an edit with an undo step like any other.
|
|
12
|
+
*/
|
|
13
|
+
/** The elements the bar publishes: its wrapper, its two fields, the count, and its buttons. */
|
|
14
|
+
const FindReplaceSlots = Slots.define({
|
|
15
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
16
|
+
field: Slot.make({ capability: Capability.TextInput }),
|
|
17
|
+
count: Slot.make({ capability: Capability.Container }),
|
|
18
|
+
button: Slot.make({ capability: Capability.Interactive })
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The index a step from `current` lands on among `count` matches, wrapping at either end, so
|
|
22
|
+
* Enter keeps cycling through them as a browser's find does.
|
|
23
|
+
*/
|
|
24
|
+
const stepMatch = (current, count, step) => count === 0 ? 0 : ((current + step) % count + count) % count;
|
|
25
|
+
/**
|
|
26
|
+
* The bar as a slot view. Enter in the find field goes to the next match and Shift+Enter to the
|
|
27
|
+
* previous one; Escape in either field closes it. Replace replaces the current match and Replace
|
|
28
|
+
* all every one; both are disabled with no match. Each button carries `data-find`.
|
|
29
|
+
*/
|
|
30
|
+
const findReplace = () => SlotView.forMessages().define(FindReplaceSlots, (input, slots, h) => {
|
|
31
|
+
const count = RichText.findMatches(input.document, input.query, input).length;
|
|
32
|
+
const current = Math.min(input.current, Math.max(0, count - 1));
|
|
33
|
+
const replaced = (at) => input.wrap(Message.ReplacedText({
|
|
34
|
+
query: input.query,
|
|
35
|
+
replacement: input.replacement,
|
|
36
|
+
caseSensitive: input.caseSensitive,
|
|
37
|
+
...at === void 0 ? {} : { at }
|
|
38
|
+
}));
|
|
39
|
+
const button = (id, label, message, { disabled = false, pressed, icon } = {}) => h.button(slots.button.attrs([
|
|
40
|
+
h.Type("button"),
|
|
41
|
+
h.DataAttribute("find", id),
|
|
42
|
+
h.AriaLabel(label),
|
|
43
|
+
...icon === void 0 ? [] : [h.Title(label)],
|
|
44
|
+
...pressed === void 0 ? [] : [h.AriaPressed(pressed ? "true" : "false")],
|
|
45
|
+
h.Disabled(disabled),
|
|
46
|
+
...disabled ? [] : [h.OnClick(message)]
|
|
47
|
+
]), [icon === void 0 ? label : richTextIcon(h, icon)]);
|
|
48
|
+
return h.div(slots.root.attrs([h.Role("search"), h.AriaLabel("Find and replace")]), [
|
|
49
|
+
h.input(slots.field.attrs([
|
|
50
|
+
h.Type("search"),
|
|
51
|
+
h.DataAttribute("find", "query"),
|
|
52
|
+
h.AriaLabel("Find"),
|
|
53
|
+
h.Placeholder("Find"),
|
|
54
|
+
h.Value(input.query),
|
|
55
|
+
h.OnInput(input.queried),
|
|
56
|
+
h.OnKeyDownPreventDefault((key, modifiers) => {
|
|
57
|
+
if (key === "Escape") return Option.some(input.closed);
|
|
58
|
+
if (key !== "Enter" || count === 0) return Option.none();
|
|
59
|
+
return Option.some(input.stepped(modifiers.shiftKey ? -1 : 1));
|
|
60
|
+
})
|
|
61
|
+
])),
|
|
62
|
+
h.span(slots.count.attrs([h.AriaLive("polite")]), [input.query === "" ? "" : count === 0 ? "No matches" : `${current + 1} of ${count}`]),
|
|
63
|
+
button("previous", "Previous match", input.stepped(-1), {
|
|
64
|
+
disabled: count === 0,
|
|
65
|
+
icon: "chevron-up"
|
|
66
|
+
}),
|
|
67
|
+
button("next", "Next match", input.stepped(1), {
|
|
68
|
+
disabled: count === 0,
|
|
69
|
+
icon: "chevron-down"
|
|
70
|
+
}),
|
|
71
|
+
button("case", "Match case", input.caseToggled, {
|
|
72
|
+
pressed: input.caseSensitive,
|
|
73
|
+
icon: "match-case"
|
|
74
|
+
}),
|
|
75
|
+
h.input(slots.field.attrs([
|
|
76
|
+
h.Type("text"),
|
|
77
|
+
h.DataAttribute("find", "replacement"),
|
|
78
|
+
h.AriaLabel("Replace with"),
|
|
79
|
+
h.Placeholder("Replace with"),
|
|
80
|
+
h.Value(input.replacement),
|
|
81
|
+
h.OnInput(input.replacementDrafted),
|
|
82
|
+
h.OnKeyDownPreventDefault((key) => key === "Escape" ? Option.some(input.closed) : Option.none())
|
|
83
|
+
])),
|
|
84
|
+
button("replace", "Replace", replaced(current), { disabled: count === 0 }),
|
|
85
|
+
button("replace-all", "Replace all", replaced(void 0), { disabled: count === 0 }),
|
|
86
|
+
button("close", "Close", input.closed, { icon: "close" })
|
|
87
|
+
]);
|
|
88
|
+
});
|
|
89
|
+
export { FindReplaceSlots, findReplace, stepMatch };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=find.js.map
|
package/dist/find.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find.js","names":["EditorMessage"],"sources":["../src/find.ts"],"sourcesContent":["/**\n * The find and replace bar, drawn through slots. Like the rest of the chrome it holds no state:\n * the query, the replacement, which match is current and whether case counts are the caller's,\n * the matches are a read of the document (`RichText.findMatches`), and replacing is the editor's\n * own `ReplacedText`, so a replacement is an edit with an undo step like any other.\n */\nimport { Option } from 'effect'\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { Message as EditorMessage, type EditorEvent } from 'foldkit-richtext-dom/editor'\nimport { richTextIcon, type RichTextIconName } from './icons.js'\n\n/** The elements the bar publishes: its wrapper, its two fields, the count, and its buttons. */\nexport const FindReplaceSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n field: Slot.make({ capability: Capability.TextInput }),\n count: Slot.make({ capability: Capability.Container }),\n button: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface FindReplaceInput<Message> {\n readonly document: RichText.Document\n readonly query: string\n readonly replacement: string\n /** The match the bar is on, by its index in `RichText.findMatches`. */\n readonly current: number\n readonly caseSensitive: boolean\n readonly queried: (query: string) => Message\n readonly replacementDrafted: (replacement: string) => Message\n /**\n * Go to the next match (1) or the previous one (-1). The caller moves its current match with\n * `stepMatch` against its Model as it is then, since keys can come faster than the bar is drawn.\n */\n readonly stepped: (step: 1 | -1) => Message\n readonly caseToggled: Message\n readonly closed: Message\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n}\n\n/**\n * The index a step from `current` lands on among `count` matches, wrapping at either end, so\n * Enter keeps cycling through them as a browser's find does.\n */\nexport const stepMatch = (current: number, count: number, step: 1 | -1): number =>\n count === 0 ? 0 : (((current + step) % count) + count) % count\n\n/**\n * The bar as a slot view. Enter in the find field goes to the next match and Shift+Enter to the\n * previous one; Escape in either field closes it. Replace replaces the current match and Replace\n * all every one; both are disabled with no match. Each button carries `data-find`.\n */\nexport const findReplace = <Message>(): SlotView.SlotView<\n typeof FindReplaceSlots,\n FindReplaceInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(FindReplaceSlots, (input, slots, h): Html => {\n const count = RichText.findMatches(input.document, input.query, input).length\n const current = Math.min(input.current, Math.max(0, count - 1))\n const replaced = (at: number | undefined) =>\n input.wrap(\n EditorMessage.ReplacedText({\n query: input.query,\n replacement: input.replacement,\n caseSensitive: input.caseSensitive,\n ...(at === undefined ? {} : { at }),\n }),\n )\n const button = (\n id: string,\n label: string,\n message: Message,\n {\n disabled = false,\n pressed,\n icon,\n }: {\n readonly disabled?: boolean\n readonly pressed?: boolean\n /** Drawn in place of the label, which then names the button and is its tooltip. */\n readonly icon?: RichTextIconName\n } = {},\n ) =>\n h.button(\n slots.button.attrs([\n h.Type('button'),\n h.DataAttribute('find', id),\n h.AriaLabel(label),\n ...(icon === undefined ? [] : [h.Title(label)]),\n ...(pressed === undefined ? [] : [h.AriaPressed(pressed ? 'true' : 'false')]),\n h.Disabled(disabled),\n ...(disabled ? [] : [h.OnClick(message)]),\n ]),\n [icon === undefined ? label : richTextIcon(h, icon)],\n )\n return h.div(slots.root.attrs([h.Role('search'), h.AriaLabel('Find and replace')]), [\n h.input(\n slots.field.attrs([\n h.Type('search'),\n h.DataAttribute('find', 'query'),\n h.AriaLabel('Find'),\n h.Placeholder('Find'),\n h.Value(input.query),\n h.OnInput(input.queried),\n h.OnKeyDownPreventDefault((key, modifiers) => {\n if (key === 'Escape') return Option.some(input.closed)\n if (key !== 'Enter' || count === 0) return Option.none()\n return Option.some(input.stepped(modifiers.shiftKey ? -1 : 1))\n }),\n ]),\n ),\n h.span(slots.count.attrs([h.AriaLive('polite')]), [\n input.query === '' ? '' : count === 0 ? 'No matches' : `${current + 1} of ${count}`,\n ]),\n button('previous', 'Previous match', input.stepped(-1), {\n disabled: count === 0,\n icon: 'chevron-up',\n }),\n button('next', 'Next match', input.stepped(1), {\n disabled: count === 0,\n icon: 'chevron-down',\n }),\n button('case', 'Match case', input.caseToggled, {\n pressed: input.caseSensitive,\n icon: 'match-case',\n }),\n h.input(\n slots.field.attrs([\n h.Type('text'),\n h.DataAttribute('find', 'replacement'),\n h.AriaLabel('Replace with'),\n h.Placeholder('Replace with'),\n h.Value(input.replacement),\n h.OnInput(input.replacementDrafted),\n h.OnKeyDownPreventDefault(key =>\n key === 'Escape' ? Option.some(input.closed) : Option.none(),\n ),\n ]),\n ),\n button('replace', 'Replace', replaced(current), { disabled: count === 0 }),\n button('replace-all', 'Replace all', replaced(undefined), { disabled: count === 0 }),\n button('close', 'Close', input.closed, { icon: 'close' }),\n ])\n })\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { EditorEvent } from "foldkit-richtext-dom/editor";
|
|
4
|
+
/** The elements the preview publishes: its card, the label field, the note's text, and the button. */
|
|
5
|
+
export declare const FootnotePreviewSlots: Slots.Contract<{
|
|
6
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
7
|
+
readonly label: Slot.UnnamedSlot<Capability.Capability<"TextInput", readonly [Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
8
|
+
readonly text: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
9
|
+
readonly button: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
10
|
+
}>;
|
|
11
|
+
export interface FootnotePreviewInput<Message> {
|
|
12
|
+
readonly document: RichText.Document;
|
|
13
|
+
readonly selection: RichText.Selection | null;
|
|
14
|
+
/** Go to the note: the caller puts the caret at the definition's start (`focus`). */
|
|
15
|
+
readonly opened: (definition: RichText.NodeId) => Message;
|
|
16
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
17
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The preview as a slot view, drawn while the caret is in a footnote reference and nothing
|
|
21
|
+
* otherwise. The label field renames the footnote when it changes (`RenamedFootnote`, which the
|
|
22
|
+
* editor refuses for a label in use). A note with no text reads "No note yet"; with no definition
|
|
23
|
+
* at all, Go to note is disabled.
|
|
24
|
+
*/
|
|
25
|
+
export declare const footnotePreview: <Message>() => SlotView.SlotView<typeof FootnotePreviewSlots, FootnotePreviewInput<Message>, Message>;
|
|
26
|
+
//# sourceMappingURL=footnote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footnote.d.ts","names":[],"sources":["../src/footnote.ts"],"mappings":";;;;qBAYa,sBAAoB,MAAA;;;;;;iBAOhB,qBAAqB;WAC3B,UAAU,SAAS;WACnB,WAAW,SAAS;;WAEpB,SAAS,YAAY,SAAS,WAAW;;WAEzC,OAAO,SAAS,gBAAgB;;;;;;;;qBAS9B,kBAAmB,cAAY,SAAS,gBAC5C,sBACP,qBAAqB,UACrB"}
|
package/dist/footnote.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { Message } from "foldkit-richtext-dom/editor";
|
|
4
|
+
// src/footnote.ts
|
|
5
|
+
/** The elements the preview publishes: its card, the label field, the note's text, and the button. */
|
|
6
|
+
const FootnotePreviewSlots = Slots.define({
|
|
7
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
8
|
+
label: Slot.make({ capability: Capability.TextInput }),
|
|
9
|
+
text: Slot.make({ capability: Capability.Container }),
|
|
10
|
+
button: Slot.make({ capability: Capability.Interactive })
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* The preview as a slot view, drawn while the caret is in a footnote reference and nothing
|
|
14
|
+
* otherwise. The label field renames the footnote when it changes (`RenamedFootnote`, which the
|
|
15
|
+
* editor refuses for a label in use). A note with no text reads "No note yet"; with no definition
|
|
16
|
+
* at all, Go to note is disabled.
|
|
17
|
+
*/
|
|
18
|
+
const footnotePreview = () => SlotView.forMessages().define(FootnotePreviewSlots, (input, slots, h) => {
|
|
19
|
+
const label = RichText.footnoteAt(input.document, input.selection);
|
|
20
|
+
if (label === void 0) return h.empty;
|
|
21
|
+
const note = RichText.footnotesOf(input.document).find((each) => each.label === label);
|
|
22
|
+
const definition = note?.definition;
|
|
23
|
+
return h.div(slots.root.attrs([h.Role("group"), h.AriaLabel(`Footnote ${label}`)]), [
|
|
24
|
+
h.input(slots.label.attrs([
|
|
25
|
+
h.Type("text"),
|
|
26
|
+
h.AriaLabel("Footnote label"),
|
|
27
|
+
h.Value(label),
|
|
28
|
+
h.OnChange((to) => input.wrap(Message.RenamedFootnote({
|
|
29
|
+
from: label,
|
|
30
|
+
to
|
|
31
|
+
})))
|
|
32
|
+
])),
|
|
33
|
+
h.p(slots.text.attrs(), [note === void 0 || note.text === "" ? "No note yet" : note.text]),
|
|
34
|
+
h.button(slots.button.attrs([
|
|
35
|
+
h.Type("button"),
|
|
36
|
+
h.Disabled(definition === void 0),
|
|
37
|
+
...definition === void 0 ? [] : [h.OnClick(input.opened(definition))]
|
|
38
|
+
]), ["Go to note"])
|
|
39
|
+
]);
|
|
40
|
+
});
|
|
41
|
+
export { FootnotePreviewSlots, footnotePreview };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=footnote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footnote.js","names":["EditorMessage"],"sources":["../src/footnote.ts"],"sourcesContent":["/**\n * The footnote preview: the note a reference at the caret points to, a way to go to it, and its\n * label to rename, drawn through slots. It holds no state: which footnote is a read of the\n * document (`RichText.footnoteAt`), renaming is the editor's own `RenamedFootnote`, and going to\n * the note is the caller's Message, since moving the focus there is a Command the caller runs.\n */\nimport type { Html } from 'foldkit/html'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { Message as EditorMessage, type EditorEvent } from 'foldkit-richtext-dom/editor'\n\n/** The elements the preview publishes: its card, the label field, the note's text, and the button. */\nexport const FootnotePreviewSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n label: Slot.make({ capability: Capability.TextInput }),\n text: Slot.make({ capability: Capability.Container }),\n button: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface FootnotePreviewInput<Message> {\n readonly document: RichText.Document\n readonly selection: RichText.Selection | null\n /** Go to the note: the caller puts the caret at the definition's start (`focus`). */\n readonly opened: (definition: RichText.NodeId) => Message\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n}\n\n/**\n * The preview as a slot view, drawn while the caret is in a footnote reference and nothing\n * otherwise. The label field renames the footnote when it changes (`RenamedFootnote`, which the\n * editor refuses for a label in use). A note with no text reads \"No note yet\"; with no definition\n * at all, Go to note is disabled.\n */\nexport const footnotePreview = <Message>(): SlotView.SlotView<\n typeof FootnotePreviewSlots,\n FootnotePreviewInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(FootnotePreviewSlots, (input, slots, h): Html => {\n const label = RichText.footnoteAt(input.document, input.selection)\n if (label === undefined) return h.empty\n const note = RichText.footnotesOf(input.document).find(each => each.label === label)\n const definition = note?.definition\n return h.div(slots.root.attrs([h.Role('group'), h.AriaLabel(`Footnote ${label}`)]), [\n h.input(\n slots.label.attrs([\n h.Type('text'),\n h.AriaLabel('Footnote label'),\n h.Value(label),\n h.OnChange(to => input.wrap(EditorMessage.RenamedFootnote({ from: label, to }))),\n ]),\n ),\n h.p(slots.text.attrs(), [note === undefined || note.text === '' ? 'No note yet' : note.text]),\n h.button(\n slots.button.attrs([\n h.Type('button'),\n h.Disabled(definition === undefined),\n ...(definition === undefined ? [] : [h.OnClick(input.opened(definition))]),\n ]),\n ['Go to note'],\n ),\n ])\n })\n"],"mappings":";;;;;AAYA,MAAa,uBAAuB,MAAM,OAAO;CAC/C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,OAAO,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACrD,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,QAAQ,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;AAC1D,CAAC;;;;;;;AAiBD,MAAa,wBAKX,SAAS,YAAqB,CAAC,CAAC,OAAO,uBAAuB,OAAO,OAAO,MAAY;CACtF,MAAM,QAAQ,SAAS,WAAW,MAAM,UAAU,MAAM,SAAS;CACjE,IAAI,UAAU,KAAA,GAAW,OAAO,EAAE;CAClC,MAAM,OAAO,SAAS,YAAY,MAAM,QAAQ,CAAC,CAAC,MAAK,SAAQ,KAAK,UAAU,KAAK;CACnF,MAAM,aAAa,MAAM;CACzB,OAAO,EAAE,IAAI,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,OAAO,GAAG,EAAE,UAAU,YAAY,OAAO,CAAC,CAAC,GAAG;EAClF,EAAE,MACA,MAAM,MAAM,MAAM;GAChB,EAAE,KAAK,MAAM;GACb,EAAE,UAAU,gBAAgB;GAC5B,EAAE,MAAM,KAAK;GACb,EAAE,UAAS,OAAM,MAAM,KAAKA,QAAc,gBAAgB;IAAE,MAAM;IAAO;GAAG,CAAC,CAAC,CAAC;EACjF,CAAC,CACH;EACA,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,CAAC,SAAS,KAAA,KAAa,KAAK,SAAS,KAAK,gBAAgB,KAAK,IAAI,CAAC;EAC5F,EAAE,OACA,MAAM,OAAO,MAAM;GACjB,EAAE,KAAK,QAAQ;GACf,EAAE,SAAS,eAAe,KAAA,CAAS;GACnC,GAAI,eAAe,KAAA,IAAY,CAAC,IAAI,CAAC,EAAE,QAAQ,MAAM,OAAO,UAAU,CAAC,CAAC;EAC1E,CAAC,GACD,CAAC,YAAY,CACf;CACF,CAAC;AACH,CAAC"}
|
package/dist/handle.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { EditorEvent } from "foldkit-richtext-dom/editor";
|
|
4
|
+
import * as Mount from "foldkit/mount";
|
|
5
|
+
/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */
|
|
6
|
+
export declare const BlockHandleSlots: Slots.Contract<{
|
|
7
|
+
readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
8
|
+
readonly grip: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
9
|
+
readonly up: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
10
|
+
readonly down: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>;
|
|
11
|
+
}>;
|
|
12
|
+
export interface BlockHandleInput<Message> {
|
|
13
|
+
readonly document: RichText.Document;
|
|
14
|
+
/** The editor host's id, whose blocks a drag measures. */
|
|
15
|
+
readonly hostId: string;
|
|
16
|
+
/** The block the handle stands for. */
|
|
17
|
+
readonly node: RichText.NodeId;
|
|
18
|
+
/** An editor Message as this caller's, usually its `edited(...)` wrapper. */
|
|
19
|
+
readonly wrap: (message: EditorEvent) => Message;
|
|
20
|
+
}
|
|
21
|
+
/** The drag Mount lifted into the caller's Messages, as the grip carries it. */
|
|
22
|
+
export declare const dragMount: <Message>(hostId: string, node: RichText.NodeId, wrap: (message: EditorEvent) => Message) => Mount.MountAction<Message>;
|
|
23
|
+
/**
|
|
24
|
+
* The handle as a slot view. The grip drags the block wherever `RichText.moveTargets` allows
|
|
25
|
+
* (`blockDrag`), and is keyed by the block, since a Mount reads its args once. Up moves the
|
|
26
|
+
* block before its previous sibling and down after its next one, within its container; each is
|
|
27
|
+
* disabled at its end of the container, and both when the block is not there.
|
|
28
|
+
*/
|
|
29
|
+
export declare const blockHandle: <Message>() => SlotView.SlotView<typeof BlockHandleSlots, BlockHandleInput<Message>, Message>;
|
|
30
|
+
//# sourceMappingURL=handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.d.ts","names":[],"sources":["../src/handle.ts"],"mappings":";;;;;qBAiBa,kBAAgB,MAAA;;;;;;iBAOZ,iBAAiB;WACvB,UAAU,SAAS;;WAEnB;;WAEA,MAAM,SAAS;;WAEf,OAAO,SAAS,gBAAgB;;;qBAI9B,YAAa,SAAO,gBACjB,MACR,SAAS,QAAM,OACd,SAAS,gBAAgB,YAC/B,MAAM,YAAY;;;;;;;qBAQR,cAAe,cAAY,SAAS,gBACxC,kBACP,iBAAiB,UACjB"}
|
package/dist/handle.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Capability, Slot, SlotView, Slots } from "foldkit-mixins";
|
|
2
|
+
import * as RichText from "foldkit-richtext";
|
|
3
|
+
import { Message } from "foldkit-richtext-dom/editor";
|
|
4
|
+
import * as Mount from "foldkit/mount";
|
|
5
|
+
import { blockDrag } from "foldkit-richtext-dom/toolbar";
|
|
6
|
+
// src/handle.ts
|
|
7
|
+
/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */
|
|
8
|
+
const BlockHandleSlots = Slots.define({
|
|
9
|
+
root: Slot.make({ capability: Capability.Container }),
|
|
10
|
+
grip: Slot.make({ capability: Capability.Interactive }),
|
|
11
|
+
up: Slot.make({ capability: Capability.Interactive }),
|
|
12
|
+
down: Slot.make({ capability: Capability.Interactive })
|
|
13
|
+
});
|
|
14
|
+
/** The drag Mount lifted into the caller's Messages, as the grip carries it. */
|
|
15
|
+
const dragMount = (hostId, node, wrap) => Mount.mapMessage(blockDrag({
|
|
16
|
+
hostId,
|
|
17
|
+
node
|
|
18
|
+
}), wrap);
|
|
19
|
+
/**
|
|
20
|
+
* The handle as a slot view. The grip drags the block wherever `RichText.moveTargets` allows
|
|
21
|
+
* (`blockDrag`), and is keyed by the block, since a Mount reads its args once. Up moves the
|
|
22
|
+
* block before its previous sibling and down after its next one, within its container; each is
|
|
23
|
+
* disabled at its end of the container, and both when the block is not there.
|
|
24
|
+
*/
|
|
25
|
+
const blockHandle = () => SlotView.forMessages().define(BlockHandleSlots, (input, slots, h) => {
|
|
26
|
+
const { previous, next } = RichText.siblingsOf(input.document, input.node);
|
|
27
|
+
const move = (to) => input.wrap(Message.MovedBlock({
|
|
28
|
+
node: input.node,
|
|
29
|
+
to
|
|
30
|
+
}));
|
|
31
|
+
return h.div(slots.root.attrs([h.Role("group"), h.AriaLabel("Block")]), [
|
|
32
|
+
h.button(slots.grip.attrs([
|
|
33
|
+
h.Key(input.node),
|
|
34
|
+
h.Type("button"),
|
|
35
|
+
h.DataAttribute("handle", "grip"),
|
|
36
|
+
h.AriaLabel("Drag to move"),
|
|
37
|
+
h.Tabindex(-1),
|
|
38
|
+
h.OnMount(dragMount(input.hostId, input.node, input.wrap))
|
|
39
|
+
]), ["⠿"]),
|
|
40
|
+
h.button(slots.up.attrs([
|
|
41
|
+
h.Type("button"),
|
|
42
|
+
h.DataAttribute("handle", "up"),
|
|
43
|
+
h.AriaLabel("Move up"),
|
|
44
|
+
h.Disabled(previous === void 0),
|
|
45
|
+
...previous === void 0 ? [] : [h.OnClick(move({ before: previous.id }))]
|
|
46
|
+
]), ["↑"]),
|
|
47
|
+
h.button(slots.down.attrs([
|
|
48
|
+
h.Type("button"),
|
|
49
|
+
h.DataAttribute("handle", "down"),
|
|
50
|
+
h.AriaLabel("Move down"),
|
|
51
|
+
h.Disabled(next === void 0),
|
|
52
|
+
...next === void 0 ? [] : [h.OnClick(move({ after: next.id }))]
|
|
53
|
+
]), ["↓"])
|
|
54
|
+
]);
|
|
55
|
+
});
|
|
56
|
+
export { BlockHandleSlots, blockHandle, dragMount };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.js","names":["EditorMessage"],"sources":["../src/handle.ts"],"sourcesContent":["/**\n * The block handle (§124 §11, §144): the moves one block can make as a whole, drawn through slots\n * like the rest of the chrome.\n *\n * It holds no state. Which block it stands for is the caller's, usually one of\n * `RichText.blocksAt(document, selection)`: the outermost to move a whole list, an item to\n * reorder a list. Its siblings are a read of the document, and what it sends is the editor's\n * `MovedBlock`, wrapped for the caller.\n */\nimport type { Html } from 'foldkit/html'\nimport * as Mount from 'foldkit/mount'\nimport { Capability, Slot, Slots, SlotView } from 'foldkit-mixins'\nimport * as RichText from 'foldkit-richtext'\nimport { Message as EditorMessage, type EditorEvent } from 'foldkit-richtext-dom/editor'\nimport { blockDrag } from 'foldkit-richtext-dom/toolbar'\n\n/** The elements the handle publishes: its wrapper, the grip it is dragged by, and its two moves. */\nexport const BlockHandleSlots = Slots.define({\n root: Slot.make({ capability: Capability.Container }),\n grip: Slot.make({ capability: Capability.Interactive }),\n up: Slot.make({ capability: Capability.Interactive }),\n down: Slot.make({ capability: Capability.Interactive }),\n})\n\nexport interface BlockHandleInput<Message> {\n readonly document: RichText.Document\n /** The editor host's id, whose blocks a drag measures. */\n readonly hostId: string\n /** The block the handle stands for. */\n readonly node: RichText.NodeId\n /** An editor Message as this caller's, usually its `edited(...)` wrapper. */\n readonly wrap: (message: EditorEvent) => Message\n}\n\n/** The drag Mount lifted into the caller's Messages, as the grip carries it. */\nexport const dragMount = <Message>(\n hostId: string,\n node: RichText.NodeId,\n wrap: (message: EditorEvent) => Message,\n): Mount.MountAction<Message> => Mount.mapMessage(blockDrag({ hostId, node }), wrap)\n\n/**\n * The handle as a slot view. The grip drags the block wherever `RichText.moveTargets` allows\n * (`blockDrag`), and is keyed by the block, since a Mount reads its args once. Up moves the\n * block before its previous sibling and down after its next one, within its container; each is\n * disabled at its end of the container, and both when the block is not there.\n */\nexport const blockHandle = <Message>(): SlotView.SlotView<\n typeof BlockHandleSlots,\n BlockHandleInput<Message>,\n Message\n> =>\n SlotView.forMessages<Message>().define(BlockHandleSlots, (input, slots, h): Html => {\n const { previous, next } = RichText.siblingsOf(input.document, input.node)\n const move = (to: RichText.Beside) =>\n input.wrap(EditorMessage.MovedBlock({ node: input.node, to }))\n return h.div(slots.root.attrs([h.Role('group'), h.AriaLabel('Block')]), [\n h.button(\n slots.grip.attrs([\n h.Key(input.node),\n h.Type('button'),\n h.DataAttribute('handle', 'grip'),\n h.AriaLabel('Drag to move'),\n // A drag is the pointer's alone, so the grip would be a stop in the tab order that\n // does nothing; the keyboard has up and down, which stay within the container.\n h.Tabindex(-1),\n h.OnMount(dragMount(input.hostId, input.node, input.wrap)),\n ]),\n ['⠿'],\n ),\n h.button(\n slots.up.attrs([\n h.Type('button'),\n h.DataAttribute('handle', 'up'),\n h.AriaLabel('Move up'),\n h.Disabled(previous === undefined),\n ...(previous === undefined ? [] : [h.OnClick(move({ before: previous.id }))]),\n ]),\n ['↑'],\n ),\n h.button(\n slots.down.attrs([\n h.Type('button'),\n h.DataAttribute('handle', 'down'),\n h.AriaLabel('Move down'),\n h.Disabled(next === undefined),\n ...(next === undefined ? [] : [h.OnClick(move({ after: next.id }))]),\n ]),\n ['↓'],\n ),\n ])\n })\n"],"mappings":";;;;;;;AAiBA,MAAa,mBAAmB,MAAM,OAAO;CAC3C,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,UAAU,CAAC;CACpD,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;CACtD,IAAI,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;CACpD,MAAM,KAAK,KAAK,EAAE,YAAY,WAAW,YAAY,CAAC;AACxD,CAAC;;AAaD,MAAa,aACX,QACA,MACA,SAC+B,MAAM,WAAW,UAAU;CAAE;CAAQ;AAAK,CAAC,GAAG,IAAI;;;;;;;AAQnF,MAAa,oBAKX,SAAS,YAAqB,CAAC,CAAC,OAAO,mBAAmB,OAAO,OAAO,MAAY;CAClF,MAAM,EAAE,UAAU,SAAS,SAAS,WAAW,MAAM,UAAU,MAAM,IAAI;CACzE,MAAM,QAAQ,OACZ,MAAM,KAAKA,QAAc,WAAW;EAAE,MAAM,MAAM;EAAM;CAAG,CAAC,CAAC;CAC/D,OAAO,EAAE,IAAI,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,OAAO,GAAG,EAAE,UAAU,OAAO,CAAC,CAAC,GAAG;EACtE,EAAE,OACA,MAAM,KAAK,MAAM;GACf,EAAE,IAAI,MAAM,IAAI;GAChB,EAAE,KAAK,QAAQ;GACf,EAAE,cAAc,UAAU,MAAM;GAChC,EAAE,UAAU,cAAc;GAG1B,EAAE,SAAS,EAAE;GACb,EAAE,QAAQ,UAAU,MAAM,QAAQ,MAAM,MAAM,MAAM,IAAI,CAAC;EAC3D,CAAC,GACD,CAAC,GAAG,CACN;EACA,EAAE,OACA,MAAM,GAAG,MAAM;GACb,EAAE,KAAK,QAAQ;GACf,EAAE,cAAc,UAAU,IAAI;GAC9B,EAAE,UAAU,SAAS;GACrB,EAAE,SAAS,aAAa,KAAA,CAAS;GACjC,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,EAAE,QAAQ,SAAS,GAAG,CAAC,CAAC,CAAC;EAC7E,CAAC,GACD,CAAC,GAAG,CACN;EACA,EAAE,OACA,MAAM,KAAK,MAAM;GACf,EAAE,KAAK,QAAQ;GACf,EAAE,cAAc,UAAU,MAAM;GAChC,EAAE,UAAU,WAAW;GACvB,EAAE,SAAS,SAAS,KAAA,CAAS;GAC7B,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC;EACpE,CAAC,GACD,CAAC,GAAG,CACN;CACF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IconData } from "foldkit-media";
|
|
2
|
+
export type IconName = 'paragraph' | 'heading-1' | 'heading-2' | 'heading-3' | 'quote' | 'bulleted-list' | 'numbered-list' | 'checklist' | 'code-block' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'code' | 'highlight' | 'kbd' | 'link' | 'comment' | 'table' | 'image' | 'video' | 'audio' | 'file' | 'callout' | 'toggle' | 'divider' | 'footnote' | 'undo' | 'redo' | 'search' | 'replace' | 'match-case' | 'download' | 'copy' | 'trash' | 'plus' | 'more' | 'grip' | 'close' | 'check' | 'chevron-down' | 'chevron-up' | 'chevron-right' | 'back' | 'contents' | 'reset';
|
|
3
|
+
export declare const icons: { readonly [Name in IconName]: IconData; };
|
|
4
|
+
//# sourceMappingURL=iconData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconData.d.ts","names":[],"sources":["../src/iconData.ts"],"mappings":";YAIY;qBAgDC,mBAAmB,QAAQ,WAAW"}
|