import type { ComponentType } from 'react'; import { Extension, Node } from '@tiptap/core'; import { type Transaction } from '@tiptap/pm/state'; import { type LinkPlace } from './LinkPlaces'; /** * `id` on every block, carried as the `blockId` attribute. * * A global attribute rather than one per node type, because §13.3 puts an id * on **every** block and a type that quietly lacked one would mint a fresh id * on every save — detaching each anchored comment on it (RFC 0.4 §6) with * nothing on screen to say so. * * Rendered as `data-block-id`, which is what `RichText` already emits, so the * reading and the editing surface address a block the same way. * * **A split gives the new half its own id, the moment it happens** (MAN-10). * ProseMirror copies a split node's attrs to both halves, so Enter leaves two * blocks claiming one id. Enter at the very start of a paragraph puts the * copy *above* it — and once something is typed there, nothing at save time * can tell which half was the original, so protocol's `fromEditorDocument` * gave the id, and every comment anchored to it, to the new line. Settled * here instead, in the same transaction, where the change itself says which * copy the original carried on into — so a copy pasted above a block does * not take its id either. The others get fresh ids. `fromEditorDocument` * keeps its own rule (the copy that holds text) as the backstop for an * editor without this extension; where the change says nothing, this falls * back to that rule too. * * **A block that arrives without an id gets one, the moment it arrives** * (MAN-11): a paste, a `/` menu insert, the empty paragraph a new editor * starts with and the one StarterKit keeps at the end. `fromEditorDocument` * mints an id for such a block on every save and the editor never sees it, so * each save gave it a different one — a blur with no edit published again, and * a comment anchored to it in between was detached. The editor's first * document is filled in when it is created, outside the undo history and * without an update, so opening a description is not an edit. * * **A wrap or a lift hands the id on** (MAN-12). Turning a paragraph into a * quote or a list wraps it, and ProseMirror leaves its attrs on the paragraph * inside — where the save flattens it and drops the id, so the quote or list * item was published under a new one and every comment anchored to the * paragraph was detached. The quote or the list item takes the paragraph's id * instead, and the list around it a fresh one; lifting the text back out hands * the id to the paragraph again. The paragraph inside keeps no id, as one * loaded from a stored document has none. */ export declare const BlockId: Extension; /** What a reference's view is handed: the `nostr:` URI it stands for, and the URL a URL chip was written as. */ export interface ReferenceViewProps { uri: string; href?: string; /** * Where it sits, so how it draws: `chip` in a sentence, `row` alone on its * line, `card` in the row's place (`LinkPlaces`, §13.3). Always `chip` in an * editor without `LinkPlaces`. */ place?: LinkPlace; /** Being edited: a click opens its menu rather than it, so a row or card shows no hover preview. */ editing?: boolean; } export interface ReferenceNodeOptions { /** * Draws the reference as the thing it points at — the app's own chip, which * knows how to resolve it. Without one, the URI is drawn as text. */ view: ComponentType | null; } /** * A `nostr:` reference, drawn as the thing it points at — SPEC §13.1. * * An **atom**: it has no editable interior, because its text is the URI and * nobody edits half a `naddr`. Selecting it selects the whole reference, which * is also how deleting one works. `marks` carries the run's other marks, so a * bold reference comes back bold. * * `embed` is the card its writer chose — `detailed`, drawn in the row's place * when the reference is alone on its line, or null for its row (SPEC §13.3, "A * reference's card"; older writers wrote `compact`, which draws the row) — and * `extra` every key of the mark this version does not know. Both are declared * so that ProseMirror keeps them: an undeclared attribute is dropped when the * node is made, and the card with it. With `LinkPlaces`, the view is told where * the reference sits (`place`) and draws its chip, row or card. * * `href` makes it a **URL chip**: an app URL that reads as the chip of what it * names, and is that URL on the wire (§13.3). `uri` is what it names, filled in * by `LinkChips` once the app has resolved it; until then it draws as the URL. */ export declare const ReferenceNode: Node; /** * A block this editor has no design for, kept whole. * * §13.3: a reader MUST render an unknown block's inline text and MUST NOT drop * it silently. **An editor is the dangerous case** — ProseMirror discards a * node its schema does not know, and the save after that would delete somebody * else's block with no error anywhere on the way. So the block's own JSON * rides in `source`, and protocol's `fromEditorDocument` hands it back * untouched; `text` is its inline text, worked out by `toEditorDocument`. * * Not editable, deliberately: an affordance that lets a person change * something they cannot see is worse than one that says the content is there * and belongs to another surface. * * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/the-block-editor-kit-lives-in-protocol-and-ui.md */ export declare const UnknownBlock: Node; /** What an attachment's view is handed: the block's `imeta` fields. */ export interface AttachmentViewProps { attrs: Record; } export interface AttachmentNodeOptions { /** Draws the file — the app's own attachment card. Without one, its name is drawn as text. */ view: ComponentType | null; } /** * A file placed in a document — SPEC §13.3's `attachment` block (SHI-2). * * An atom: the file is the block, there is nothing inside it to edit, and a * caret that could sit "inside" an image is a way to produce documents no * reader has a rule for. Selectable and deletable, so removing one is Backspace * like anything else. * * Its attributes are the `imeta` fields exactly, because that is what §13.3 * specifies. Each is declared, and that is not boilerplate: ProseMirror **drops * an attribute its schema does not name**, so an undeclared `thumb` would * survive the editor and vanish on save — the silent deletion `UnknownBlock` * exists to prevent. */ export declare const AttachmentNode: Node; /** * Whether a change is a click on a checklist item's box. The click does not * focus the editor, so no blur follows it: an editor that saves on blur saves * a tick straight away instead (RIC-19, Miky 2026-10-13: one click ticks). */ export declare function isChecklistTick(transaction: Transaction): boolean; /** * A checklist item — SPEC §13.3's `checked` on a list item (RIC-19): `true` * ticked, `false` not, absent a plain item. Add it beside `BlockId`. * * - **The box ticks with one click**, where the description is read, and the * change says so (`isChecklistTick`), so the app saves it at once. * - **`[ ] ` or `[] ` at the start of a line** makes it, `[x] ` ticked; in a * list it turns that item into one. * - **Enter** starts the next item unticked: a new item never takes the tick * of the one it was split from. At the start of an item, the text moves down * with its tick and the empty item above is unticked. On an empty item Enter * leaves the list, as in any list. * - **Backspace** at the start of a checklist item takes its box away first; * the next one joins it to the item above, as in any list. * * An editor without it drops `checked` on save and keeps the item and its text. */ export declare const Checklist: Extension; /** * A callout — SPEC §13.3's `tone` on a quote (RIC-19): a quote drawn to stand * out, in one of GitHub's alert kinds (`note`, `tip`, `important`, `warning`, * `caution`). Its look is `RichText`'s, by `data-tone`; a tone it does not * know looks like `note`, and the editor keeps it as written. Add it beside * `BlockId`. */ export declare const Callout: Extension; //# sourceMappingURL=BlockNodes.d.ts.map