import { a as RichTextColor, c as SectionCatalog, f as SectionItem, l as SectionDef, o as RichTextFieldOptions, s as RichTextTypography, t as BlockCatalog, u as SectionField } from "../sections-WxUvdqm-.js"; import { t as RenderTurnstileOptions } from "../turnstile-client-Nho8q7tc.js"; import { r as FormConfig } from "../types-Bv7XuMW0.js"; import { Extension, NodeJSON } from "prosekit/core"; import { Command } from "@prosekit/pm/state"; import { SolidNodeViewComponent } from "prosekit/solid"; import { JSX } from "solid-js"; //#region src/client/autosave.d.ts /** Public option shape. `true`/`undefined` enable with the default delay; an * object tunes the debounce; `false` disables (opt-out—auto-save is on by * default). */ type AutoSaveOption = boolean | { debounceMs?: number; }; //#endregion //#region src/client/realtime.d.ts /** Public option shape (mirrors `AutoSaveOption`). `true` enables with defaults; an * object tunes the outbound throttle; `false`/`undefined` disable (off by default). */ type RealtimeOption = boolean | { throttleMs?: number; }; interface RealtimePeer { id: string; name: string; } /** Held soft-locks: field name → the editor id currently holding it. */ type RealtimeLocks = Record; /** The minimal `WebSocket` surface the client drives—so tests can inject a fake * without a real socket. A DOM `WebSocket` satisfies it structurally. */ interface WebSocketLike { send(data: string): void; close(code?: number, reason?: string): void; readyState: number; onopen: ((ev?: unknown) => void) | null; onmessage: ((ev: { data: unknown; }) => void) | null; onclose: ((ev?: unknown) => void) | null; onerror: ((ev?: unknown) => void) | null; } interface RealtimeHandlers { /** Presence changed—the full peer list (includes you; the UI dedupes/excludes). */ onPresence?(peers: RealtimePeer[]): void; /** Held soft-locks changed. */ onLocks?(locks: RealtimeLocks): void; /** A peer edited a (non-lock-guarded) field—apply it optimistically. */ onRemoteChange?(field: string, value: unknown): void; /** The current field snapshot at connect time (pending edits since the last flush). */ onSnapshot?(snapshot: Record): void; /** Socket up/down—the surface flips between publishing here and its fetch fallback. */ onStatus?(connected: boolean): void; } interface RealtimeSession { /** Publish a local field edit (trailing-throttled; coalesced per field). No-op * while disconnected—the surface uses its debounced fetch then. */ publish(field: string, value: unknown): void; /** Acquire a rich-text soft-lock (sent immediately). */ claim(field: string): void; /** Release a soft-lock (sent immediately). */ release(field: string): void; /** Whether the socket is currently open. */ connected(): boolean; /** This editor's own presence, once the `welcome` handshake has landed. */ you(): RealtimePeer | null; /** Close intentionally—stops heartbeat + reconnect. */ close(): void; } interface ConnectRealtimeOptions extends RealtimeHandlers { slug: string; id: number; /** Mount base. Default `/api/louise/realtime`. */ path?: string; /** Trailing-throttle window for outbound changes, ms. Default 150. */ throttleMs?: number; /** Heartbeat ping interval, ms. Default 25000 (keeps proxies from idling out). */ heartbeatMs?: number; /** Cap on the reconnect backoff, ms. Default 15000. */ maxBackoffMs?: number; /** Test seam—build the socket. Default `(url) => new WebSocket(url)`. */ socketFactory?: (url: string) => WebSocketLike; } /** * Open a realtime edit session. Returns immediately with a {@link RealtimeSession} * handle; the socket connects in the background and the handlers fire as messages * arrive. On an unexpected close it reconnects with exponential backoff and * re-handshakes, so a transient blip self-heals; `close()` stops it for good. */ declare function connectRealtime(opts: ConnectRealtimeOptions): RealtimeSession; //#endregion //#region src/client/RichText.d.ts interface RichTextProps { /** Starting document—ProseMirror JSON, or an HTML string to parse. */ initialDoc?: NodeJSON | string; /** Fires on every document edit. */ onDocChange?: (getJSON: () => NodeJSON) => void; /** Receives the field handle once the editor is live. */ ref?: (field: RichTextField) => void; /** Show the formatting toolbar (default true). */ toolbar?: boolean; /** Enable the page builder (#16): its builder blocks (hero, columns, * gallery …), the slash menu, and the "+ Block" button. For a full page body. */ builder?: boolean; /** @deprecated Renamed {@link RichTextProps.builder} (#537); a section's * `blocks` are a different thing. Still read when `builder` is unset. */ blocks?: boolean; /** Enable the Harper grammar/spelling checker (#110). Off by default; when on, * the WASM checker is lazy-loaded and issues are underlined with suggestions. */ grammar?: boolean; /** Light-inline mode (#182): the format bubble shows only inline formatting * (bold/italic/underline/strike/link/colour) and the block drag-handle is * omitted—for section rich-text fields (a tagline, a body line), not a full * page body. The schema is unchanged; only the chrome is trimmed. */ minimal?: boolean; /** Inline mode (#182): a single-line rich-text field—a heading or tagline the * site renders inside its own element (`

`). Like `minimal` * for chrome (inline formatting only), but ALSO constrains the value to inline * HTML: block-splitting keys are suppressed, a multi-line paste is flattened * to one line with a space where each line break was, and the value * serializes with no block wrapper, so editing a heading can't turn it into a `

`/`

` that * nests in the element and loses its brand style. The level stays whatever the * site's element is—the editor never changes it. */ inline?: boolean; /** Show the "Insert image" button in the block-controls group (default true). * Only relevant in non-`minimal` mode, where the block controls render. Pass * `false` to drop it—for example, a section heading field where an inline image * makes no sense but the other block buttons (heading/list/quote) do. */ image?: boolean; /** The text colors to offer, as theme tokens (#605). Default: primary, * secondary, accent, and neutral. An empty list hides the color button. */ colors?: readonly RichTextColor[]; /** Typographic input rules (#606): dashes, an ellipsis, and, with `quotes`, * curly quotes. Off when absent. */ typography?: RichTextTypography; /** Show the Language button, which marks a phrase with `` (#606). */ language?: boolean; /** Where the editor sits (#761). `panel` (the default) is a field in the * drawer or a form: the surface gets the panel's padding, minimum height, * and type size. `canvas` is a field edited in place on the live page, * inside the site's own element: the surface inherits that element's font, * color, and spacing, so a heading still looks like the heading while it's * edited. `mountRichText` defaults to `canvas`. */ surface?: "panel" | "canvas"; /** A class for the editing surface, in place of the one `surface` picks. */ class?: string; } interface RichTextField { /** Current document as ProseMirror JSON. */ getJSON: () => NodeJSON; /** Current document serialized to HTML—what the site stores + renders. */ getHTML: () => string; /** Tear the editor down and stop listening. */ destroy: () => void; } declare function RichText(props: RichTextProps): import("solid-js").JSX.Element; /** * Vanilla-DOM adapter for the inline surface: takes over `el` (which already * contains the server-rendered rich text) with the same Solid-hosted editor. * `onChange` fires on every edit so the caller can mark the field dirty. The * editor is on the canvas, inside the site's own element, so its surface * inherits that element's type (`surface: "canvas"`) unless `opts.surface` * says otherwise. */ declare function mountRichText(el: HTMLElement, onChange: () => void, initialDoc?: NodeJSON, opts?: { builder?: boolean; /** @deprecated Renamed `builder` (#537). */ blocks?: boolean; grammar?: boolean; minimal?: boolean; image?: boolean; inline?: boolean; colors?: readonly RichTextColor[]; typography?: RichTextTypography; language?: boolean; surface?: "panel" | "canvas"; }): RichTextField; //#endregion //#region src/client/icons.d.ts declare const icons: { readonly bold: any; readonly translate: any; readonly italic: any; readonly underline: any; readonly strike: any; readonly heading: any; readonly paragraph: any; readonly palette: any; readonly image: any; readonly listBullets: any; readonly listNumbers: any; readonly quote: any; readonly list: any; readonly x: any; readonly caretUp: any; readonly caretDown: any; readonly caretRight: any; readonly dragHandle: any; readonly pencil: any; readonly check: any; readonly trash: any; readonly plus: any; readonly minus: any; readonly signOut: any; readonly gear: any; readonly fileText: any; readonly house: any; readonly user: any; readonly star: any; readonly starFill: any; readonly sparkle: any; readonly link: any; readonly lock: any; readonly history: any; readonly arrowSquareOut: any; }; type IconName = keyof typeof icons; /** Inline Phosphor icon. `size` is a CSS length (default 1em). */ declare function Icon(props: { name: IconName; size?: string; class?: string; }): import("solid-js").JSX.Element; //#endregion //#region src/client/blocks.d.ts interface BlockAttrSpec { default: string; /** Serialized as this data-* attribute (for example, "data-size"). */ attr: string; } /** One builder block's schema: a ProseMirror node the page builder inserts * into a rich-text field (#537 named it apart from a section's `BlockDef` in * `louise-toolkit/content`, a different thing). */ interface BuilderBlockDef { /** Node name in the schema (for example, "dividerBlock"). */ name: string; /** `data-block` token—the stable identity in serialized HTML. */ block: string; /** Serialized tag (section/figure/hr/…). */ tag: string; /** `pb-*` class on the serialized element. */ class: string; /** ProseMirror content expression; omit for leaf blocks. */ content?: string; /** Attribute specs, keyed by node attr name. */ attrs?: Record; /** True for content-less blocks (divider). */ atom?: boolean; /** Editing chrome—optional: container blocks render fine through * ProseMirror's default toDOM rendering with CSS-only chrome. */ component?: SolidNodeViewComponent; } /** * Define a builder block: node spec (persistence) + Solid node view * (editing chrome), mirroring how the resizable image is wired in RichText. */ /** @deprecated Renamed {@link BuilderBlockDef} (#537). A section's `BlockDef` * in `louise-toolkit/content` is a different thing. */ type BlockDef = BuilderBlockDef; declare function defineBlock(def: BuilderBlockDef): Extension; /** Registry consumed by the inserter (slash menu + button). */ interface BlockEntry { /** Inserter label. */ label: string; /** Inserter keywords. */ keywords: string[]; /** The command that inserts this block. */ command: Command; } declare const BLOCKS: BlockEntry[]; /** All block extensions, unioned—opt in via RichText's `blocks` prop. */ declare function defineBlocksExtension(): Extension; declare function BlockInserterButton(): import("solid-js").JSX.Element; declare function BlockInserter(): import("solid-js").JSX.Element; //#endregion //#region src/client/styles.d.ts declare function injectStyles(): void; //#endregion //#region src/client/link-field.d.ts /** One selectable destination in the picker. */ interface PageChoice { /** The href this option writes, for example, `/about`. */ path: string; /** What the editor sees. */ title: string; } //#endregion //#region src/client/sections.d.ts /** * One shared site-settings value the editor may edit on-canvas (Phase B / * #376): a {@link SectionField} (its `type` picks the control, its `label` * names the wrench) plus the chrome surfaces that render it—the half of the * used-in count that no `sections` JSON records. */ type SharedValueDef = SectionField & { surfaces?: string[]; }; /** * Rich-text editor options—an alias for the schema's {@link RichTextFieldOptions}, * which is where these now belong (ADR 0010 A2 / #345): a field declares its own, * in the catalog, next to the rest of what it is. * * Kept as a name because it is the published one, and because `mountSections` * still accepts a site-wide default under it. * * Omit for the light-inline bubble (`{ minimal: true }`)—inline formatting only * (bold/italic/underline/strike/link/colour), the mode #182 designed for section * fields. For the full formatting bar pass `{ minimal: false, grammar: true }`: * `minimal: false` surfaces the prose block buttons plus the AI-rewrite sparkle, * and `grammar` lazy-loads Harper. `blocks` is a SEPARATE opt-in—the page * BUILDER palette (#16), meant for full page bodies rather than a one-line * heading. */ type SectionRichTextOptions = RichTextFieldOptions; interface SectionsEditorProps { catalog: SectionCatalog; /** The block palette (ADR 0005)—enables adding blocks to a section whose * `blocks` policy allows a type. Optional: omit for a sections-only site. */ blocks?: BlockCatalog; /** Editor options for section `richtext` fields (headings/prose the render * marks `data-louise-type="richtext"`). Defaults to the light-inline bubble; * pass `{ minimal: false, grammar: true }` to opt into the full formatting bar * (heading/list/quote/image buttons + grammar + AI rewrite). See * {@link SectionRichTextOptions}. */ richText?: SectionRichTextOptions; /** * Named rich-text presets a render can opt individual fields into, by stamping * `data-louise-rt=""` next to `data-louise-type="richtext"`. Falls back to * {@link richText} for any field that names no mode (or an unknown one). * * `richText` alone is all-or-nothing, which breaks down as soon as one page has * both kinds of rich text: a site whose headings need `inline` (so editing can't * turn an `

` into a nested `

`) would force that same single-line mode onto * a prose body, losing paragraphs and lists. Per-field modes let both coexist: * * richText: { inline: true }, // headings * richTextModes: { prose: { minimal: false, grammar: true } }, // bodies */ richTextModes?: Record; /** * Code-defined routes to offer in a `link` field's page picker, alongside the * `pages` rows it fetches. * * The picker's page list comes from `/api/louise/pages`, which only knows about * DB-backed pages. A site's hand-authored routes—`/shop`, `/contact`—have no * row, so without this the picker is missing exactly the destinations most CTAs * point at and reads as broken. Same idea as the Settings Pages panel's * `builtInPages`. */ builtInRoutes?: PageChoice[]; /** * SHARED site-settings values editable on-canvas (ADR 0010 Phase B / #376), * keyed by settings key. A render stamps `data-louise-node="settings."` * on the element showing the value—Nav, Footer, a location panel—and a * declared key resolves to a green wrench-only node whose inspector edits * the SOURCE: one value, every surface, saved immediately through the * settings route (there is no settings draft—the band says so). * * `surfaces` names the chrome surfaces that render the key ("the header")—the * part of the used-in count no page's `sections` JSON records. Pages * are counted from the catalog's `consumes` declarations. */ shared?: Record; /** * How the picker turns a `pages` row's slug into a path. Default `/${slug}`. * * For the row a site renders somewhere other than its slug—the `home` row * served at `/`—the default offers editors a duplicate-content alias * (`/home`) next to the real destination. Map it here and the picker's * path-dedupe collapses the pair into the built-in entry. */ pagePathForSlug?: (slug: string) => string; pageId: number; initial: SectionItem[]; /** Auto-save inline section edits as a draft on an idle debounce—never * publishes, and structural changes keep their own save+reload. On by default; * pass `false` to opt out (manual Save draft button), or `{ debounceMs }`. */ autoSave?: AutoSaveOption; /** The collection slug this sections page belongs to (for the realtime DO * address `/`). Default `"pages"`. */ collection?: string; /** Opt this sections page into a real-time session (ADR 0002 / #71)—**presence * only** for now: the shared bar shows the other editors on the page. Sections * persistence stays on the proven debounced-fetch draft path (a live canvas sync * is a follow-up). Off by default; degrades silently when the socket can't open. */ realtime?: RealtimeOption; } /** * Vanilla-DOM adapter: enable in-place editing over `el` (the server-rendered * bespoke sections) and mount the on-canvas editing chrome, in edit mode. The * bespoke render is left in place—only made editable. Returns the disposer. */ declare function mountSections(el: HTMLElement, opts: SectionsEditorProps): () => void; //#endregion //#region src/client/forms.d.ts interface FormProps { /** The form definition (from `defineForm`)—its fields + name drive rendering. */ form: FormConfig; /** POST target. Default `/api/louise/forms/` (matches `formRoute`). */ action?: string; /** * Where a `file` field uploads, which answers `{ url }`. No default: the * toolkit's media route is for editors, so a visitor's upload needs a route * of the site's own, wrapped in `publicRoute` with its own size, type, and * rate limits. Without it, a form with a `file` field logs an error at mount * and refuses the upload. */ mediaAction?: string; /** * Render a Turnstile widget above the submit button and send its token as * `cf-turnstile-response`. Set it when the form declares `spam.turnstile` * and the site passes `formRoute` a `turnstileSecret`, or every submit is * refused. Take `siteKey` from `activeCaptcha`, so the widget and the server * check stay on or off together. */ turnstile?: Pick; /** Message shown after a successful submit. Default "Thanks—we'll be in touch." */ successMessage?: string; /** Called after a 201. */ onSuccess?: () => void; /** Extra class on the `

`. */ class?: string; } declare function Form(props: FormProps): JSX.Element; /** * Mount a {@link Form} into a DOM node for a non-Solid site (mirrors * `mountSections`). Returns a disposer. The host's markup is replaced by the * rendered form. */ declare function mountForm(host: HTMLElement, props: FormProps): () => void; //#endregion //#region src/client/lifecycle.d.ts /** The two moments a host reports around a soft navigation. */ type LouiseNavigationPhase = "before-swap" | "after-swap"; type Handler = () => void; /** * Subscribe to a navigation phase. Returns an unsubscribe. * * Internal to the client modules—a site wires {@link louiseNavigation} * instead. Exported because the section dock and the settings drawer are * separate entry points that each need the signal. */ declare function onLouiseNavigate(phase: LouiseNavigationPhase, handler: Handler): () => void; /** * What a host calls when its router swaps the page. * * Both are safe to call when nothing is mounted, and safe to call repeatedly—a * host can wire them once for the document's lifetime. */ declare const louiseNavigation: { /** The DOM is about to be replaced. Flushes pending edits. */ readonly beforeSwap: () => void; /** The new DOM is in place. Tears down what belonged to the old page. */ readonly afterSwap: () => void; }; //#endregion //#region src/client/index.d.ts interface MountLouiseOptions { /** Opens Louise Settings (wired to the bar's Settings action). */ onOpenSettings: () => void; /** When set, this page uses the versioned draft workflow: inline saves stage a * draft on this page id (`POST …/pages/:id/versions`) merging every changed * field, and a Publish button promotes it (`POST …/publish`)—instead of * writing each field live via `/save`. The page must render its editable * fields' current draft values in edit mode (see the site's draft resume). */ versionedPageId?: number; /** Auto-save inline edits on an idle debounce, reusing this surface's existing * save (a live field save, or a draft on a versioned page)—never publishes. * On by default; pass `false` to opt out (back to a manual Save button), or an * object to tune the debounce (`{ debounceMs }`). */ autoSave?: AutoSaveOption; /** Enable the Harper grammar/spelling checker (#110) on rich-text fields. Off by * default; when on, the WASM checker is lazy-loaded (runs on-device—the text * never leaves the browser) and issues are underlined with click-to-apply * suggestions. English-only for now. * * WEIGHT: Harper ships its dictionary inside the WASM module—~10 MB gzipped, * fetched once per editor session on first use. It's dynamically imported, so * leaving this off costs nothing and public pages never see it; just don't * enable it expecting a small download. */ grammar?: boolean; /** Opt this page into a real-time multi-editor session (ADR 0002 / #71): * connect to the per-page Durable Object for presence, live field echo, and a * rich-text soft-lock. **Versioned pages only** (realtime persists as drafts), so * it's ignored unless `versionedPageId` is set. Degradation-first: if the socket * can't open (no `EDIT_SESSION` binding → the route returns 503) editing silently falls * back to the debounced-fetch auto-save. Off by default; `{ throttleMs }` tunes * the outbound change rate. */ realtime?: RealtimeOption; /** * Typed action callables for the **normal** (debounced) auto-save path * (#138). The site injects `actions.louise.save` / `actions.louise.saveDraft`—which * the host imports from its own framework; this framework-agnostic client * can't. Each must **resolve on success and reject on failure** (the site wraps * the action's `{ data, error }` accordingly). * * The **unload** flush (tab-hide / page-hide / `beforeunload`) always uses the * raw `keepalive` fetch instead—a framework action client can't set `keepalive`, * so a save fired while navigating away would be dropped. Omit `actions` to keep * every save on the raw `/api/louise/*` routes (unchanged). */ actions?: { /** Live field save—mirrors `louiseSaveAction`'s input. */ save?: (input: { collection: string; key: string; field: string; value: unknown; }) => Promise; /** Versioned draft save—mirrors `louiseSaveDraftAction`'s input, and * resolves with its result, which carries `revs` or `conflicts`. */ saveDraft?: (input: { id: number; data: Record; base?: Record; }) => Promise; }; } /** * Should a click on `target` be swallowed instead of navigating? * * True only for a link INSIDE an editing surface—the region being edited. * Site chrome (header nav, footer, brand, skip link) returns false and * navigates normally, which is how an editor moves between pages without first * leaving edit mode. * * Exported for the test that pins both halves: blocking too little loses an * edit to a stray click; blocking too much strands the editor on one page. */ declare function isEditableSurfaceLink(target: Element | null): boolean; declare function mountLouise(opts: MountLouiseOptions): void; //#endregion export { type AutoSaveOption, BLOCKS, type BlockDef, type BlockEntry, BlockInserter, BlockInserterButton, type BuilderBlockDef, Form, type FormProps, Icon, type IconName, type LouiseNavigationPhase, MountLouiseOptions, type PageChoice, type RealtimeOption, type RealtimePeer, type RealtimeSession, RichText, type RichTextField, type RichTextProps, type SectionCatalog, type SectionDef, type SectionField, type SectionItem, type SectionsEditorProps, connectRealtime, defineBlock, defineBlocksExtension, icons, injectStyles, isEditableSurfaceLink, louiseNavigation, mountForm, mountLouise, mountRichText, mountSections, onLouiseNavigate };