foldkit-richtext-dom 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +448 -166
- package/dist/decorations-Ar6URa7n.mjs +57 -0
- package/dist/decorations-Ar6URa7n.mjs.map +1 -0
- package/dist/editor-C76tfEyV.d.mts +1016 -0
- package/dist/editor-C76tfEyV.d.mts.map +1 -0
- package/dist/editor-bundle-dnjyuk1P.d.mts +8576 -0
- package/dist/editor-bundle-dnjyuk1P.d.mts.map +1 -0
- package/dist/editor-bundle.d.mts +2 -7535
- package/dist/editor-bundle.mjs +352 -81
- package/dist/editor-bundle.mjs.map +1 -1
- package/dist/editor.d.mts +2 -849
- package/dist/editor.mjs +176 -9
- package/dist/editor.mjs.map +1 -1
- package/dist/{events-BTw9SJ7r.d.mts → events-Dasls6a_.d.mts} +31 -5
- package/dist/events-Dasls6a_.d.mts.map +1 -0
- package/dist/events.d.mts +2 -2
- package/dist/events.mjs +84 -14
- package/dist/events.mjs.map +1 -1
- package/dist/host-1dtxuKIA.d.mts +86 -0
- package/dist/host-1dtxuKIA.d.mts.map +1 -0
- package/dist/host.d.mts +2 -25
- package/dist/host.mjs +78 -6
- package/dist/host.mjs.map +1 -1
- package/dist/html.d.mts +1 -1
- package/dist/html.d.mts.map +1 -1
- package/dist/html.mjs +150 -20
- package/dist/html.mjs.map +1 -1
- package/dist/index-DDV_JesZ.d.mts +57 -0
- package/dist/index-DDV_JesZ.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +249 -99
- package/dist/index.mjs.map +1 -1
- package/dist/input.d.mts +936 -0
- package/dist/input.d.mts.map +1 -0
- package/dist/input.mjs +89 -0
- package/dist/input.mjs.map +1 -0
- package/dist/toolbar.d.mts +39 -0
- package/dist/toolbar.d.mts.map +1 -1
- package/dist/toolbar.mjs +325 -1
- package/dist/toolbar.mjs.map +1 -1
- package/dist/view.d.mts +14 -2
- package/dist/view.d.mts.map +1 -1
- package/dist/view.mjs +90 -19
- package/dist/view.mjs.map +1 -1
- package/package.json +26 -5
- package/dist/editor-bundle.d.mts.map +0 -1
- package/dist/editor.d.mts.map +0 -1
- package/dist/events-BTw9SJ7r.d.mts.map +0 -1
- package/dist/host.d.mts.map +0 -1
- package/dist/index-6QEOehXh.d.mts +0 -38
- package/dist/index-6QEOehXh.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-bundle.mjs","names":[],"sources":["../src/editor-bundle.ts"],"sourcesContent":["/**\n * The controlled-editor feasibility harness (§27): the authoritative Document\n * lives in the parent Model, the editor Bundle reads it through its Link, and a\n * single parent transition commits both the document and the interaction state.\n *\n * No DOM, no persistence, no collaboration: this exists to answer whether Bundle\n * ownership can hold a rich-text editor without a second synchronized document\n * copy or a Command that commits half the transition.\n */\nimport { Effect, Option, Schema } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle, Link, type Wrapped } from 'foldkit-bundle'\nimport * as RichText from 'foldkit-richtext'\nimport * as Submodel from 'foldkit/submodel'\nimport type * as Update from 'foldkit/update'\nimport { events, Message, patchEditor } from './editor.js'\nimport { placeRendering } from './host.js'\n\n/** Interaction state the parent owns beside the document. */\nexport const EditorState = Schema.Struct({\n selection: Schema.NullOr(RichText.Selection),\n /** Caller-owned identity source: a live edit mints, replay never does. */\n nextId: Schema.Number,\n /** Local undo history: snapshots of document plus selection. */\n history: RichText.History,\n /** Null inherits neighboring marks; an array explicitly sets them, even when empty. */\n storedMarks: Schema.NullOr(Schema.Array(Schema.String)),\n /**\n * The host element the view renders and the patch Command finds (§118). It is\n * per-placement, so it arrives as the Bundle's args and is carried here\n * because `read` re-projects the whole child from the parent.\n */\n hostId: Schema.String,\n})\nexport type EditorState = typeof EditorState.Type\n\nexport const Model = Schema.Struct({\n document: RichText.Document,\n editor: EditorState,\n})\nexport type Model = typeof Model.Type\n\n/** What the child reads: the parent's document passes through, never stored. */\nexport const EditorView = Schema.Struct({\n document: RichText.Document,\n selection: Schema.NullOr(RichText.Selection),\n nextId: Schema.Number,\n history: RichText.History,\n storedMarks: Schema.NullOr(Schema.Array(Schema.String)),\n hostId: Schema.String,\n})\nexport type EditorView = typeof EditorView.Type\n\n/** The committed edit, or the diagnostic that refused it. */\nexport type OutMessage =\n | {\n readonly _tag: 'Edited'\n readonly state: RichText.EditorState\n readonly changeSet: RichText.ChangeSet\n }\n | {\n /** Undo and redo replace the document wholesale; nothing was incremental. */\n readonly _tag: 'Replaced'\n readonly state: RichText.EditorState\n readonly changeSet: RichText.ChangeSet\n }\n | { readonly _tag: 'Rejected'; readonly error: string }\n\nconst idsOf = (content: RichText.Document): ReadonlySet<RichText.NodeId> =>\n new Set(content.children.flatMap(block => [block.id, ...block.children.map(run => run.id)]))\n\n/** Everything that differs between two whole documents, for a replace patch. */\nexport const replaceChangeSet = (\n previous: RichText.Document,\n next: RichText.Document,\n): RichText.ChangeSet => {\n const before = idsOf(previous)\n const after = idsOf(next)\n return {\n dirtyNodes: after,\n insertedNodes: new Set([...after].filter(id => !before.has(id))),\n removedNodes: new Set([...before].filter(id => !after.has(id))),\n textChanged: new Set(),\n structureChanged: true,\n selectionChanged: false,\n }\n}\n\ntype CommandMessage = Exclude<Message, { readonly _tag: 'Undone' | 'Redone' | 'Patched' }>\n\nconst toCommand = (message: CommandMessage): RichText.Command => {\n switch (message._tag) {\n case 'Typed':\n return { type: 'InsertText', text: message.text }\n case 'Backspace':\n return { type: 'DeleteBackward' }\n case 'DeletedForward':\n return { type: 'DeleteForward' }\n case 'Entered':\n return { type: 'SplitBlock' }\n case 'ToggledMark':\n return { type: 'ToggleMark', mark: message.mark }\n case 'Selected':\n return { type: 'SetSelection', selection: message.selection }\n case 'Pasted':\n return { type: 'Paste', slice: message.slice }\n }\n}\n\n/**\n * The rendering effect (§118): patch the host the view rendered, once the\n * parent's transition has committed. It commits nothing, so the one-transition\n * property the proof established is untouched.\n */\nconst patch = (hostId: string, state: RichText.EditorState, changeSet: RichText.ChangeSet) => ({\n name: 'RichText.patch',\n effect: Effect.as(\n Effect.sync(() => {\n patchEditor(hostId, state, changeSet)\n }),\n Message.Patched(),\n ),\n})\n\nexport const Editor = Bundle.make({\n name: 'RichTextEditor',\n Model: EditorView,\n Message,\n args: Schema.Struct({ hostId: Schema.String }),\n // A read-only projection has no initial content of its own; the placement\n // writes only the interaction fields back, so this never becomes the document.\n // The host id is the one thing the child seeds: it is per-placement, and `read`\n // re-projects everything else.\n init: args => ({\n model: {\n document: RichText.Document.make({ version: 1, children: [] }),\n selection: null,\n nextId: 0,\n history: RichText.emptyHistory,\n storedMarks: null,\n hostId: args.hostId,\n },\n }),\n update: (model, message): Update.ReturnWithOutMessage<EditorView, Message, OutMessage> => {\n const state: RichText.EditorState = { document: model.document, selection: model.selection }\n // The patch Command's own completion: the render already happened.\n if (message._tag === 'Patched') return { model }\n if (message._tag === 'Undone' || message._tag === 'Redone') {\n const restored =\n message._tag === 'Undone'\n ? RichText.undo(model.history, state)\n : RichText.redo(model.history, state)\n if (restored === undefined) {\n return {\n model,\n outMessage: {\n _tag: 'Rejected',\n error: message._tag === 'Undone' ? 'NothingToUndo' : 'NothingToRedo',\n },\n }\n }\n const changeSet = replaceChangeSet(model.document, restored.state.document)\n return {\n model: {\n ...model,\n selection: restored.state.selection,\n history: restored.history,\n },\n outMessage: { _tag: 'Replaced', state: restored.state, changeSet },\n commands: [patch(model.hostId, restored.state, changeSet)],\n }\n }\n let nextId = model.nextId\n // With nothing selected, a mark toggle is the caret's own state: the next\n // typed text lands with it. A caret move ends the format it was carrying.\n const collapsed =\n model.selection?.type === 'Range' &&\n model.selection.anchor.node === model.selection.focus.node &&\n model.selection.anchor.offset === model.selection.focus.offset\n // The caret never carries a mark the vocabulary cannot type, so an unknown\n // one is refused here rather than at the first keystroke after it.\n if (\n message._tag === 'ToggledMark' &&\n collapsed &&\n !RichText.shippedRegistry.declares(message.mark)\n ) {\n return { model, outMessage: { _tag: 'Rejected', error: 'InvalidInput' } }\n }\n const storedMarks =\n message._tag === 'ToggledMark' && collapsed\n ? model.storedMarks?.includes(message.mark)\n ? model.storedMarks.filter(mark => mark !== message.mark)\n : [...(model.storedMarks ?? []), message.mark]\n : message._tag === 'Selected'\n ? null\n : model.storedMarks\n const command =\n message._tag === 'Typed' && storedMarks !== null\n ? ({ type: 'InsertText', text: message.text, marks: storedMarks } as const)\n : toCommand(message)\n const result = RichText.run(state, command, { mint: () => `e${nextId++}` })\n if (!result.ok) {\n // A refused command changes nothing, so it does not burn identities.\n return { model, outMessage: { _tag: 'Rejected', error: result.error } }\n }\n // History holds content, not cursor movement: a selection change keeps the\n // redo stack, and a no-op edit adds no step to undo.\n const contentChanged = result.state.document !== model.document\n return {\n model: {\n ...model,\n selection: result.state.selection,\n nextId,\n storedMarks,\n history: contentChanged\n ? RichText.commit(model.history, state, { group: RichText.groupFor(command) })\n : model.history,\n },\n outMessage: { _tag: 'Edited', state: result.state, changeSet: result.changeSet },\n commands: [patch(model.hostId, result.state, result.changeSet)],\n }\n },\n // The host element belongs to the view; everything below it belongs to the\n // interpreter the mount attaches there.\n view: Submodel.defineView<EditorView, Message>((model, h) =>\n h.div([h.Id(model.hostId), h.OnMount(events({ content: model.document }))], []),\n ),\n})\n\nconst GotEditor = Link.wrapper('GotEditorMessage', Message)\n\nexport const ParentMessage = defineMessageUnion({ ...GotEditor.cases })\nexport type ParentMessage = typeof ParentMessage.Type\n\nconst editorLink: Link<\n Model,\n Wrapped<'GotEditorMessage', Message>,\n EditorView,\n Message\n> = Link.make({\n // The child sees the parent's document; the parent owns it.\n read: parent =>\n Option.some({\n document: parent.document,\n selection: parent.editor.selection,\n nextId: parent.editor.nextId,\n history: parent.editor.history,\n storedMarks: parent.editor.storedMarks,\n hostId: parent.editor.hostId,\n }),\n // Only interaction state is written back: the document is not the child's.\n write: (parent, child) => ({\n ...parent,\n editor: {\n selection: child.selection,\n nextId: child.nextId,\n history: child.history,\n storedMarks: child.storedMarks,\n hostId: child.hostId,\n },\n }),\n wrapper: GotEditor,\n path: ['editor'],\n})\n\n/**\n * Places one editor, bound to the host element the view renders and the patch\n * Command finds. Each placement picks its own id. A rendering registry (§121) is\n * placed for that id rather than passed as an arg (§122): it holds functions, so\n * the mount looks it up by host id instead.\n */\nexport const editorAt = (hostId: string, rendering: RichText.Rendering = RichText.noRendering) => {\n placeRendering(hostId, rendering)\n return Editor.at(editorLink, {\n args: { hostId },\n // Runs with the child already written back, in the same parent transition.\n onOut: (out: OutMessage) => (parent: Model) =>\n out._tag === 'Edited' || out._tag === 'Replaced'\n ? {\n model: {\n ...parent,\n document: out.state.document,\n editor: { ...parent.editor, selection: out.state.selection },\n },\n }\n : { model: parent },\n })\n}\n\nexport const editor = editorAt('richtext-editor')\n\nexport const application = Bundle.assemble<Model, ParentMessage>()([editor])\n\n/** The parent's update: placement Messages route to the editor, others stand still. */\nexport const update = application.update()\n\n/** Wraps one editor Message as the parent Message that carries it. */\nexport const edited = (message: Message): ParentMessage => GotEditor.make(message)\nexport const typed = (text: string): ParentMessage => edited(Message.Typed({ text }))\nexport const pressed = (tag: 'Backspace' | 'DeletedForward' | 'Entered'): ParentMessage =>\n edited(Message[tag]())\nexport const toggled = (mark: string): ParentMessage => edited(Message.ToggledMark({ mark }))\nexport const selected = (selection: RichText.Selection | null): ParentMessage =>\n edited(Message.Selected({ selection }))\nexport const undone = (): ParentMessage => edited(Message.Undone())\nexport const redone = (): ParentMessage => edited(Message.Redone())\nexport const patched = (): ParentMessage => edited(Message.Patched())\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,cAAc,OAAO,OAAO;CACvC,WAAW,OAAO,OAAO,SAAS,SAAS;;CAE3C,QAAQ,OAAO;;CAEf,SAAS,SAAS;;CAElB,aAAa,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,CAAC;;;;;;CAMtD,QAAQ,OAAO;AACjB,CAAC;AAGD,MAAa,QAAQ,OAAO,OAAO;CACjC,UAAU,SAAS;CAC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AC5F,MAAa,YAAY,cACvB,OAAO,QAAQ,SAAS,EAAE,UAAU,CAAC,CAAC;AACxC,MAAa,eAA8B,OAAO,QAAQ,OAAO,CAAC;AAClE,MAAa,eAA8B,OAAO,QAAQ,OAAO,CAAC;AAClE,MAAa,gBAA+B,OAAO,QAAQ,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"editor-bundle.mjs","names":[],"sources":["../src/editor-bundle.ts"],"sourcesContent":["/**\n * The controlled-editor feasibility harness (§27): the authoritative Document\n * lives in the parent Model, the editor Bundle reads it through its Link, and a\n * single parent transition commits both the document and the interaction state.\n *\n * No DOM, no persistence, no collaboration: this exists to answer whether Bundle\n * ownership can hold a rich-text editor without a second synchronized document\n * copy or a Command that commits half the transition.\n */\nimport { Effect, Equal, Match, Option, Schema } from 'effect'\nimport { define } from 'foldkit/customElement'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle, Link, type Wrapped } from 'foldkit-bundle'\nimport * as RichText from 'foldkit-richtext'\nimport * as Submodel from 'foldkit/submodel'\nimport type * as Command from 'foldkit/command'\nimport type * as Update from 'foldkit/update'\nimport {\n heldDocument,\n events,\n Message,\n patchEditor,\n redecorateEditor,\n slashEntries,\n slashMenu,\n} from './editor.js'\nimport {\n decorationsFor,\n inputRulesFor,\n placeDecorations,\n placeInputRules,\n placeOverlay,\n placePlaceholder,\n placeRendering,\n placeServerRendered,\n placeVocabulary,\n renderingFor,\n serverRenderedFor,\n type Vocabulary,\n vocabularyFor,\n} from './host.js'\nimport type { Decorate } from './events.js'\nimport { renderEditable } from './view.js'\n\n/** Interaction state the parent owns beside the document. */\nexport const EditorState = Schema.Struct({\n selection: Schema.NullOr(RichText.Selection),\n /** Caller-owned identity source: a live edit mints, replay never does. */\n nextId: Schema.Number,\n /** Local undo history: snapshots of document plus selection. */\n history: RichText.History,\n /** Null inherits neighboring marks; an array explicitly sets them, even when empty. */\n storedMarks: Schema.NullOr(Schema.Array(Schema.String)),\n /**\n * The highlighted entry in a live slash menu (§123). The document says whether the\n * caret is in a query and what matches; this is the one thing the menu owns, and\n * `update` resolves Enter against it.\n */\n menuIndex: Schema.Number,\n /**\n * The host element the view renders and the patch Command finds (§118). It is\n * per-placement, so it arrives as the Bundle's args and is carried here\n * because `read` re-projects the whole child from the parent.\n */\n hostId: Schema.String,\n})\nexport type EditorState = typeof EditorState.Type\n\nexport const Model = Schema.Struct({\n document: RichText.Document,\n editor: EditorState,\n})\nexport type Model = typeof Model.Type\n\n/** What the child reads: the parent's document passes through, never stored. */\nexport const EditorView = Schema.Struct({\n document: RichText.Document,\n selection: Schema.NullOr(RichText.Selection),\n nextId: Schema.Number,\n history: RichText.History,\n storedMarks: Schema.NullOr(Schema.Array(Schema.String)),\n menuIndex: Schema.Number,\n hostId: Schema.String,\n})\nexport type EditorView = typeof EditorView.Type\n\n/** The committed edit, or the diagnostic that refused it. */\nexport type OutMessage =\n | {\n readonly _tag: 'Edited'\n readonly state: RichText.EditorState\n readonly changeSet: RichText.ChangeSet\n /** What the edit applied, in order, as `RichText.run` returns them. */\n readonly transactions: ReadonlyArray<RichText.Transaction>\n }\n | {\n /** Undo and redo replace the document wholesale; nothing was incremental. */\n readonly _tag: 'Replaced'\n readonly state: RichText.EditorState\n readonly changeSet: RichText.ChangeSet\n }\n | { readonly _tag: 'Rejected'; readonly error: string }\n\n/** Where a node stands: the block holding it (null at the top), and its index there. */\ninterface Placed {\n readonly node: RichText.Block | RichText.Text\n readonly parent: RichText.NodeId | null\n readonly index: number\n}\n\n/** Every block and run of a document by id, nested ones included, with where it stands. */\nconst nodesOf = (content: RichText.Document): ReadonlyMap<RichText.NodeId, Placed> => {\n const nodes = new Map<RichText.NodeId, Placed>()\n const visit = (blocks: ReadonlyArray<RichText.Block>, parent: RichText.NodeId | null): void => {\n for (const [index, block] of blocks.entries()) {\n nodes.set(block.id, { node: block, parent, index })\n for (const [at, run] of block.children.entries()) {\n nodes.set(run.id, { node: run, parent: block.id, index: at })\n }\n if (block.type === 'Node' && block.blocks !== undefined) visit(block.blocks, block.id)\n }\n }\n visit(content.children, null)\n return nodes\n}\n\nconst sameMarks = (left: RichText.Text, right: RichText.Text): boolean =>\n left.marks.length === right.marks.length &&\n left.marks.every((mark, index) => RichText.sameMark(mark, right.marks[index]!))\n\n/** A block's own fields, apart from what it holds: its type, level, kind and props. */\nconst ownFields = ({ children: _runs, ...block }: RichText.Block): unknown => ({\n ...block,\n blocks: undefined,\n})\n\n/**\n * What differs between two whole documents, for a patch from one to the other, in a\n * transaction's terms: the runs whose text or marks changed and the blocks holding them,\n * blocks whose own fields changed, what came and went, and whether any block moved.\n */\nexport const replaceChangeSet = (\n previous: RichText.Document,\n next: RichText.Document,\n): RichText.ChangeSet => {\n const before = nodesOf(previous)\n const after = nodesOf(next)\n const dirtyNodes = new Set<RichText.NodeId>()\n const textChanged = new Set<RichText.NodeId>()\n let structureChanged = false\n for (const [id, placed] of after) {\n const was = before.get(id)\n if (placed.node.type === 'Text') {\n const run = placed.node\n const old = was?.node.type === 'Text' ? was.node : undefined\n if (old === undefined || old.text !== run.text) textChanged.add(id)\n if (old === undefined || old.text !== run.text || !sameMarks(old, run)) {\n dirtyNodes.add(id)\n if (placed.parent !== null) dirtyNodes.add(placed.parent)\n }\n // A run moved to another block, or to another place in its own, changes both blocks'\n // runs though the run itself did not change.\n if (was !== undefined && (was.parent !== placed.parent || was.index !== placed.index)) {\n if (placed.parent !== null) dirtyNodes.add(placed.parent)\n if (was.parent !== null && after.has(was.parent)) dirtyNodes.add(was.parent)\n }\n continue\n }\n if (was === undefined || was.parent !== placed.parent || was.index !== placed.index) {\n structureChanged = true\n }\n if (\n was === undefined ||\n !Equal.equals(ownFields(was.node as RichText.Block), ownFields(placed.node))\n ) {\n dirtyNodes.add(id)\n }\n }\n const removedNodes = new Set([...before.keys()].filter(id => !after.has(id)))\n for (const id of removedNodes) {\n const was = before.get(id)!\n if (was.node.type !== 'Text') structureChanged = true\n else if (was.parent !== null && after.has(was.parent)) dirtyNodes.add(was.parent)\n }\n return {\n dirtyNodes,\n insertedNodes: new Set([...after.keys()].filter(id => !before.has(id))),\n removedNodes,\n textChanged,\n structureChanged,\n selectionChanged: false,\n }\n}\n\ntype CommandMessage = Exclude<Message, { readonly _tag: 'Undone' | 'Redone' | 'Patched' }>\n\nconst toCommand = (message: CommandMessage): RichText.Command => {\n switch (message._tag) {\n case 'Typed':\n return { type: 'InsertText', text: message.text }\n case 'Backspace':\n return { type: 'DeleteBackward' }\n case 'DeletedForward':\n return { type: 'DeleteForward' }\n case 'Entered':\n return { type: 'SplitBlock' }\n case 'ToggledMark':\n return { type: 'ToggleMark', mark: message.mark }\n case 'AppliedMark':\n return { type: 'SetMark', mark: message.mark }\n case 'ClearedMark':\n return { type: 'ClearMark', mark: message.mark }\n case 'RetypedBlock':\n return { type: 'RetypeBlock', to: message.block }\n case 'WrappedBlock':\n return { type: 'WrapBlock', containers: message.containers }\n case 'ConvertedBlock':\n return { type: 'ConvertBlock', to: message.to }\n case 'LiftedBlock':\n return { type: 'LiftBlock' }\n case 'MovedBlock':\n return { type: 'MoveBlock', node: message.node, to: message.to }\n case 'Selected':\n return { type: 'SetSelection', selection: message.selection }\n case 'Pasted':\n return { type: 'Paste', slice: message.slice }\n }\n}\n\n/**\n * The rendering effect (§118): patch the host the view rendered, once the\n * parent's transition has committed. It commits nothing, so the one-transition\n * property the proof established is untouched.\n */\nconst patch = (hostId: string, state: RichText.EditorState, changeSet: RichText.ChangeSet) => ({\n name: 'RichText.patch',\n effect: Effect.as(\n Effect.sync(() => {\n patchEditor(hostId, state, changeSet)\n }),\n Message.Patched(),\n ),\n})\n\n/**\n * The text between the start of the caret's block and the caret, or `''` when the\n * selection names no caret. A menu and the input rules read this; nothing about the query\n * is stored. A range is read from its start, which is where what is typed over it lands,\n * whichever way it was dragged.\n */\nconst textBeforeOf = (model: EditorView): string => {\n if (model.selection?.type !== 'Range') return ''\n const start = RichText.rangeStart(model.document, model.selection)\n return start === undefined ? '' : RichText.textBefore(model.document, start)\n}\n\n/**\n * The kinds of the node blocks around the caret's block, innermost first; a range is read\n * from its start, as `textBeforeOf` reads it.\n */\nconst withinOf = (model: EditorView): ReadonlyArray<string> => {\n if (model.selection?.type !== 'Range') return []\n const start = RichText.rangeStart(model.document, model.selection)\n const run = start === undefined ? undefined : RichText.locateRun(model.document, start.node)\n if (run === undefined) return []\n const kinds: Array<string> = []\n for (let depth = run.path.length - 1; depth > 0; depth--) {\n const block = RichText.blockAtPath(model.document, run.path.slice(0, depth))\n if (block?.type === 'Node') kinds.push(block.kind)\n }\n return kinds\n}\n\nconst Host = define({ tag: 'foldkit-richtext', properties: {}, events: {} })\n\n/**\n * Each host id's keys, by the document shown. The host's Mount reads its document once, so a\n * document that did not come from an edit here (a form's fill or reset, an entry opened, a\n * revision restored) needs a fresh host. A committed edit moves its document's key to the next\n * document (`carryKey`), and the document it leaves keeps none, so returning to it is a new host\n * too. The first document a host id shows has no key, as the server's render has none.\n */\nconst lineages = new Map<\n string,\n { next: number; readonly keys: WeakMap<RichText.Document, number> }\n>()\n\nconst lineageOf = (hostId: string) => {\n const found = lineages.get(hostId)\n if (found !== undefined) return found\n const created = { next: 0, keys: new WeakMap<RichText.Document, number>() }\n lineages.set(hostId, created)\n return created\n}\n\nconst hostKey = (hostId: string, document: RichText.Document): string | undefined => {\n const lineage = lineageOf(hostId)\n const key = lineage.keys.get(document) ?? lineage.next++\n lineage.keys.set(document, key)\n return key === 0 ? undefined : `${hostId}-${key}`\n}\n\nconst carryKey = (hostId: string, from: RichText.Document, to: RichText.Document): void => {\n const keys = lineageOf(hostId).keys\n const key = keys.get(from)\n if (key === undefined || from === to) return\n keys.delete(from)\n keys.set(to, key)\n}\n\n/**\n * Patches the editor at `hostId` to `next`, a document the parent put in place of\n * `previous`, keeping the host element instead of mounting a new one. A parent that\n * replaces its document outside an edit here (another replica's change arriving) returns\n * this, in the same transition as the replacement.\n *\n * The host is found by the document the view renders, so `previous` is the object it\n * rendered and `next.document` the object it will render; building the Command hands the\n * host on from one to the other, so build it only to return it. The patch itself starts\n * from the latest state the editor holds (what it has drawn, or a state waiting on a\n * composition), and `next.selection` becomes the browser selection;\n * a replacement that changes nothing drawn leaves the DOM alone, selection included, as an\n * exchange that only confirms edits already shown does.\n */\nexport const patchTo = (\n hostId: string,\n previous: RichText.Document,\n next: RichText.EditorState,\n): Command.Command<Message> => {\n carryKey(hostId, previous, next.document)\n return {\n name: 'RichText.patch',\n effect: Effect.as(\n Effect.sync(() => {\n const held = heldDocument(hostId)\n // No editor is attached there: it went away while the transition was in flight.\n if (held === undefined) return\n const changeSet = replaceChangeSet(held, next.document)\n const unchanged =\n !changeSet.structureChanged &&\n changeSet.dirtyNodes.size === 0 &&\n changeSet.removedNodes.size === 0\n if (!unchanged) patchEditor(hostId, next, changeSet)\n }),\n Message.Patched(),\n ),\n }\n}\n\n/**\n * Draws `decorations` over the editor at `hostId`, beside what its placement draws, until the\n * next overlay replaces them: decorations an application derives from its own state, such as\n * other people's carets, which a placement's `decorate` cannot see. Their positions name the\n * document shown, so an application sets them again when that changes. The caret stays put.\n */\nexport const overlay = (\n hostId: string,\n decorations: RichText.DecorationSet,\n): Command.Command<Message> => ({\n name: 'RichText.overlay',\n effect: Effect.as(\n Effect.sync(() => {\n placeOverlay(hostId, decorations)\n redecorateEditor(hostId)\n }),\n Message.Patched(),\n ),\n})\n\n/**\n * The host element the editor mounts into, and whose id the patch Command finds (§118). It is a\n * custom element so hydration leaves what is inside it alone (§145): on the server it holds the\n * document's markup, which the editor adopts; in the browser the view declares it empty, and the\n * editor owns everything below.\n */\nexport const editorView = Submodel.defineView<EditorView, Message>((model, h) => {\n const serverRendered = serverRenderedFor(model.hostId)()\n const key = serverRendered ? undefined : hostKey(model.hostId, model.document)\n return Host.withMessage(h)(\n [\n h.Id(model.hostId),\n ...(key === undefined ? [] : [h.Key(key)]),\n // A custom element is inline until styled, and the editor inside it is a block.\n h.Style({ display: 'block' }),\n h.OnMount(events({ content: model.document })),\n ],\n serverRendered\n ? [\n renderEditable(\n model.document,\n renderingFor(model.hostId),\n decorationsFor(model.hostId)(model.document),\n ),\n ]\n : [],\n )\n})\n\n/** What a Message does to the editor; `Editor.update` carries the host's key on a commit. */\nconst transition = (\n model: EditorView,\n incoming: Message,\n): Update.ReturnWithOutMessage<EditorView, Message, OutMessage> => {\n const state: RichText.EditorState = { document: model.document, selection: model.selection }\n // The vocabulary this placement resolves edits against; both fields may be absent.\n const vocabulary = vocabularyFor(model.hostId)\n // A live query decides what Enter means before anything else reads the message\n // (§123): the highlighted entry applies as the Message a click would send, instead\n // of splitting, and a query that chooses nothing falls through to `incoming` and\n // still splits. Substituting the Message here rather than recursing is what makes a\n // mark entry update the caret's stored marks through the path a toggle already uses.\n const menu =\n incoming._tag === 'Entered'\n ? slashMenu(slashEntries, textBeforeOf(model), model.menuIndex)\n : undefined\n const message = menu?.highlighted?.message ?? incoming\n return Match.value(message).pipe(\n Match.withReturnType<Update.ReturnWithOutMessage<EditorView, Message, OutMessage>>(),\n Match.tags({\n // The patch Command's own completion: the render already happened.\n Patched: () => ({ model }),\n Undone: undone => travel(model, state, undone),\n Redone: redone => travel(model, state, redone),\n }),\n Match.orElse(message => {\n let nextId = model.nextId\n // With nothing selected, a mark toggle is the caret's own state: the next\n // typed text lands with it. A caret move ends the format it was carrying.\n const collapsed =\n model.selection?.type === 'Range' &&\n model.selection.anchor.node === model.selection.focus.node &&\n model.selection.anchor.offset === model.selection.focus.offset\n // The caret never carries a mark the vocabulary cannot type — an unknown one, or one\n // like Link whose props a bare name lacks — so it is refused here rather than at the\n // first keystroke after it.\n if (\n message._tag === 'ToggledMark' &&\n collapsed &&\n !(vocabulary.marks ?? RichText.shippedRegistry).accepts(message.mark)\n ) {\n return { model, outMessage: { _tag: 'Rejected', error: 'InvalidInput' } }\n }\n const storedMarks =\n message._tag === 'ToggledMark' && collapsed\n ? model.storedMarks?.includes(message.mark)\n ? model.storedMarks.filter(mark => mark !== message.mark)\n : [...(model.storedMarks ?? []), message.mark]\n : model.storedMarks\n const command =\n message._tag === 'Typed' && storedMarks !== null\n ? ({ type: 'InsertText', text: message.text, marks: storedMarks } as const)\n : toCommand(message)\n // Choosing an entry removes the query it was typed into and applies the choice as\n // one action (§124 §5), so one transition and one undo step cover both. The range is\n // a read, not state: `menu.query` is the text the document already holds, and the\n // `+ 1` is the slash that opened it.\n const queryRange =\n menu === undefined || menu.highlighted === undefined || model.selection?.type !== 'Range'\n ? undefined\n : RichText.textRangeBefore(model.document, model.selection.anchor, menu.query.length + 1)\n const runAction = (action: RichText.Action) =>\n RichText.runAction(\n state,\n action,\n { mint: () => `e${nextId++}` },\n { marks: vocabulary.marks, nodes: vocabulary.nodes },\n )\n // What is typed can be a block marker (§124 §4): the rules are the placement's own, so\n // the editor carries none of any syntax's vocabulary itself.\n const ruled =\n queryRange === undefined && message._tag === 'Typed'\n ? RichText.applyInputRules(inputRulesFor(model.hostId), {\n textBefore: textBeforeOf(model),\n text: message.text,\n insertion: command,\n within: withinOf(model),\n })\n : undefined\n const attempt = runAction(\n queryRange !== undefined\n ? [{ type: 'SetSelection', selection: queryRange }, { type: 'DeleteBackward' }, command]\n : (ruled ?? [command]),\n )\n // A rule the vocabulary refuses — a fence typed into bold text, say — leaves the marker\n // as the text it is, rather than refusing the keystroke along with it. The refused\n // attempt's identities are given back first.\n const fallback = !attempt.ok && ruled !== undefined\n if (fallback) nextId = model.nextId\n const result = fallback ? runAction([command]) : attempt\n if (!result.ok) {\n // A refused command changes nothing, so it does not burn identities.\n return { model, outMessage: { _tag: 'Rejected', error: result.error } }\n }\n // `runAction` returns the state it was given when nothing changed: a caret the browser\n // echoes back, or a command with nothing to act on. Keeping the Model keeps the page from\n // rendering, and a caret that did not move keeps the format it carries.\n if (result.state === state && storedMarks === model.storedMarks) return { model }\n // History holds content, not cursor movement: a selection change keeps the\n // redo stack, and a no-op edit adds no step to undo.\n const contentChanged = result.state.document !== model.document\n return {\n model: {\n ...model,\n selection: result.state.selection,\n nextId,\n // A caret move ends the format it was carrying.\n storedMarks: message._tag === 'Selected' ? null : storedMarks,\n history: contentChanged\n ? RichText.commit(model.history, state, { group: RichText.groupFor(command) })\n : model.history,\n },\n outMessage: {\n _tag: 'Edited',\n state: result.state,\n changeSet: result.changeSet,\n transactions: result.transactions,\n },\n commands: [patch(model.hostId, result.state, result.changeSet)],\n }\n }),\n )\n}\n\n/** Undo or redo: history restores content and selection, and the host is told as a replace. */\nconst travel = (\n model: EditorView,\n state: RichText.EditorState,\n message: Extract<Message, { readonly _tag: 'Undone' | 'Redone' }>,\n): Update.ReturnWithOutMessage<EditorView, Message, OutMessage> => {\n const restored =\n message._tag === 'Undone'\n ? RichText.undo(model.history, state)\n : RichText.redo(model.history, state)\n if (restored === undefined) {\n return {\n model,\n outMessage: {\n _tag: 'Rejected',\n error: message._tag === 'Undone' ? 'NothingToUndo' : 'NothingToRedo',\n },\n }\n }\n const changeSet = replaceChangeSet(model.document, restored.state.document)\n return {\n model: {\n ...model,\n selection: restored.state.selection,\n history: restored.history,\n },\n outMessage: { _tag: 'Replaced', state: restored.state, changeSet },\n commands: [patch(model.hostId, restored.state, changeSet)],\n }\n}\n\nexport const Editor = Bundle.make({\n name: 'RichTextEditor',\n Model: EditorView,\n Message,\n args: Schema.Struct({ hostId: Schema.String }),\n // A read-only projection has no initial content of its own; the placement\n // writes only the interaction fields back, so this never becomes the document.\n // The host id is the one thing the child seeds: it is per-placement, and `read`\n // re-projects everything else.\n init: args => ({\n model: {\n document: RichText.Document.make({ version: 1, children: [] }),\n selection: null,\n nextId: 0,\n history: RichText.emptyHistory,\n storedMarks: null,\n menuIndex: 0,\n hostId: args.hostId,\n },\n }),\n update: (model, incoming): Update.ReturnWithOutMessage<EditorView, Message, OutMessage> => {\n const result = transition(model, incoming)\n const out = result.outMessage\n if (out?._tag === 'Edited' || out?._tag === 'Replaced')\n carryKey(model.hostId, model.document, out.state.document)\n return result\n },\n // The host element belongs to the view; everything below it belongs to the\n // interpreter the mount attaches there.\n view: editorView,\n})\n\nconst GotEditor = Link.wrapper('GotEditorMessage', Message)\n\nexport const ParentMessage = defineMessageUnion({ ...GotEditor.cases })\nexport type ParentMessage = typeof ParentMessage.Type\n\nconst editorLink: Link<\n Model,\n Wrapped<'GotEditorMessage', Message>,\n EditorView,\n Message\n> = Link.make({\n // The child sees the parent's document; the parent owns it.\n read: parent =>\n Option.some({\n document: parent.document,\n selection: parent.editor.selection,\n nextId: parent.editor.nextId,\n history: parent.editor.history,\n storedMarks: parent.editor.storedMarks,\n menuIndex: parent.editor.menuIndex,\n hostId: parent.editor.hostId,\n }),\n // Only interaction state is written back: the document is not the child's. `read` builds a\n // new view each time, so the Bundle cannot see that a child returned what it read; a child\n // whose fields are the parent's own leaves the parent as it was. The placement's `init`\n // writes into a parent that has no `editor` yet.\n write: (parent, { document: _document, ...editor }) => {\n const current: EditorState | undefined = parent.editor\n return current !== undefined &&\n (Object.keys(editor) as Array<keyof EditorState>).every(key => editor[key] === current[key])\n ? parent\n : { ...parent, editor }\n },\n wrapper: GotEditor,\n path: ['editor'],\n})\n\n/**\n * What a placement gives its editor. Each is placed by host id rather than passed as an arg\n * (§122): each holds functions or schemas, which a schema-decoded arg cannot describe.\n */\nexport interface EditorPlacement {\n /** How this editor's marks and node kinds render (§121). Defaults to `noRendering`. */\n readonly rendering?: RichText.Rendering | undefined\n /** The vocabulary its edits resolve against (§125). Defaults to none. */\n readonly vocabulary?: Vocabulary | undefined\n /** The rules applied to what is typed (§128). Defaults to none. */\n readonly inputRules?: ReadonlyArray<RichText.InputRule> | undefined\n /**\n * What is drawn over the document (§129), derived from it on every patch: code\n * highlighting, for one. Defaults to nothing.\n */\n readonly decorate?: Decorate | undefined\n /** What the editor shows while its document is blank (`RichText.isBlank`). Defaults to none. */\n readonly placeholder?: string | undefined\n /**\n * Whether this render is the server's (§145), such as `foldkit-ssr`'s `SSR.serving`. While it\n * is, the host carries the document's markup, which the browser's editor adopts instead of\n * drawing again. Defaults to never, so the host is empty until the editor mounts.\n */\n readonly serverRendered?: (() => boolean) | undefined\n}\n\n/**\n * Records everything a placement names for its host id, replacing what the id had: one call,\n * so a placement cannot half-apply. `editorAt` and the form control both place through it.\n */\nexport const placeEditor = (hostId: string, placement: EditorPlacement): void => {\n placeRendering(hostId, placement.rendering ?? RichText.noRendering)\n placeVocabulary(hostId, placement.vocabulary ?? {})\n placeInputRules(hostId, placement.inputRules ?? [])\n placeDecorations(hostId, placement.decorate ?? (() => []))\n // The overlay is set by Commands after placing, so a placement starts without the last one's.\n placeOverlay(hostId, [])\n placePlaceholder(hostId, placement.placeholder)\n placeServerRendered(hostId, placement.serverRendered ?? (() => false))\n}\n\n/**\n * Places one editor, bound to the host element the view renders and the patch Command\n * finds. Each placement picks its own id and names what it places; one call records all\n * of it, so a placement cannot half-apply.\n */\nexport const editorAt = (hostId: string, placement: EditorPlacement = {}) => {\n placeEditor(hostId, placement)\n return Editor.at(editorLink, {\n args: { hostId },\n // Runs with the child already written back, in the same parent transition.\n onOut: (out: OutMessage) => (parent: Model) =>\n out._tag === 'Edited' || out._tag === 'Replaced'\n ? {\n model: {\n ...parent,\n document: out.state.document,\n editor: { ...parent.editor, selection: out.state.selection },\n },\n }\n : { model: parent },\n })\n}\n\nexport const editor = editorAt('richtext-editor')\n\nexport const application = Bundle.assemble<Model, ParentMessage>()([editor])\n\n/** The parent's update: placement Messages route to the editor, others stand still. */\nexport const update = application.update()\n\n/** Wraps one editor Message as the parent Message that carries it. */\nexport const edited = (message: Message): ParentMessage => GotEditor.make(message)\nexport const typed = (text: string): ParentMessage => edited(Message.Typed({ text }))\nexport const pressed = (tag: 'Backspace' | 'DeletedForward' | 'Entered'): ParentMessage =>\n edited(Message[tag]())\nexport const toggled = (mark: string): ParentMessage => edited(Message.ToggledMark({ mark }))\nexport const applied = (mark: RichText.RunMark): ParentMessage =>\n edited(Message.AppliedMark({ mark }))\nexport const cleared = (mark: string): ParentMessage => edited(Message.ClearedMark({ mark }))\nexport const retyped = (block: RichText.TextBlock): ParentMessage =>\n edited(Message.RetypedBlock({ block }))\nexport const wrapped = (containers: ReadonlyArray<RichText.Container>): ParentMessage =>\n edited(Message.WrappedBlock({ containers }))\nexport const converted = (to: RichText.Container): ParentMessage =>\n edited(Message.ConvertedBlock({ to }))\nexport const lifted = (): ParentMessage => edited(Message.LiftedBlock())\nexport const moved = (node: RichText.NodeId, to: RichText.Beside): ParentMessage =>\n edited(Message.MovedBlock({ node, to }))\nexport const selected = (selection: RichText.Selection | null): ParentMessage =>\n edited(Message.Selected({ selection }))\nexport const undone = (): ParentMessage => edited(Message.Undone())\nexport const redone = (): ParentMessage => edited(Message.Redone())\nexport const patched = (): ParentMessage => edited(Message.Patched())\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,cAAc,OAAO,OAAO;CACvC,WAAW,OAAO,OAAO,SAAS,SAAS;;CAE3C,QAAQ,OAAO;;CAEf,SAAS,SAAS;;CAElB,aAAa,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,CAAC;;;;;;CAMtD,WAAW,OAAO;;;;;;CAMlB,QAAQ,OAAO;AACjB,CAAC;AAGD,MAAa,QAAQ,OAAO,OAAO;CACjC,UAAU,SAAS;CACnB,QAAQ;AACV,CAAC;;AAID,MAAa,aAAa,OAAO,OAAO;CACtC,UAAU,SAAS;CACnB,WAAW,OAAO,OAAO,SAAS,SAAS;CAC3C,QAAQ,OAAO;CACf,SAAS,SAAS;CAClB,aAAa,OAAO,OAAO,OAAO,MAAM,OAAO,MAAM,CAAC;CACtD,WAAW,OAAO;CAClB,QAAQ,OAAO;AACjB,CAAC;;AA4BD,MAAM,WAAW,YAAqE;CACpF,MAAM,wBAAQ,IAAI,IAA6B;CAC/C,MAAM,SAAS,QAAuC,WAAyC;EAC7F,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,GAAG;GAC7C,MAAM,IAAI,MAAM,IAAI;IAAE,MAAM;IAAO;IAAQ;GAAM,CAAC;GAClD,KAAK,MAAM,CAAC,IAAI,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