import { x as FieldTypeName } from "./sections-WxUvdqm-.js"; import { t as OgCardOptions } from "./og-card-3fwMvrJq.js"; import { JSX } from "solid-js"; import { QueryClient } from "@tanstack/solid-query"; //#region src/client/settings/query.d.ts /** One field the server refused, as the editor routes report it in a 422. */ interface ApiViolation { /** The field, such as `siteName`, or a row of a list, such as `navLinks[1].href`. */ path: string; /** What to do about it, written for the owner. */ message: string; } /** The JSON a failed editor route answers with, when it answers with any. */ interface ApiErrorBody { error?: string; violations?: ApiViolation[]; } /** * A failed API call, carrying the HTTP status and the JSON body the server sent. * * The status is a property rather than only text in the message because callers * genuinely branch on it—the full-page studio redirects to sign-in on a 401, * and matching that by parsing an error string would break the first time the * message is reworded. The message is the request line, for logs; show an owner * {@link apiErrorMessage} instead. */ declare class LouiseApiError extends Error { readonly status: number; /** The parsed error body: `error`, and `violations` on a 422. Empty when the * response wasn't JSON. */ readonly body: ApiErrorBody; constructor(method: string, url: string, status: number, body?: ApiErrorBody); } /** * The text to show an owner for a thrown error. A 4xx from an editor route * carries an `error` written for the owner, such as a reserved slug, so that's * what shows. Anything else, a 5xx, a network failure, or a response without a * message, shows `fallback`, so neither a request line nor a server fault's * internals reach the owner. */ declare function apiErrorMessage(error: unknown, fallback: string): string; /** Whether an unknown thrown value is a {@link LouiseApiError} with this status. */ declare function isApiStatus(error: unknown, status: number): boolean; /** * The Settings' QueryClient. The Settings is a short-lived, editor-only surface * that opens over the live page, so: no window-focus refetch, a short stale * window to keep tab switches snappy without hammering the API, and one retry. */ declare function createSettingsQueryClient(): QueryClient; /** * A namespaced Settings query key, for example, `louiseQueryKey("products", id)`. Sites * use this for their own collections; the framework-generic ones are in * {@link louiseQueryKeys}. */ declare function louiseQueryKey(collection: string, ...rest: readonly (string | number)[]): readonly [string, string, ...(string | number)[]]; /** Query keys for the framework-generic collections. Sites add their own via * {@link louiseQueryKey} (for example, `products` or `artworks`). */ declare const louiseQueryKeys: { readonly pages: readonly ["louise", "pages"]; readonly media: readonly ["louise", "media"]; readonly settings: readonly ["louise", "settings"]; readonly inquiries: readonly ["louise", "inquiries"]; readonly editors: readonly ["louise", "editors"]; readonly overview: readonly ["louise", "overview"]; readonly health: readonly ["louise", "health"]; }; /** GET JSON, throwing {@link LouiseApiError} on a non-2xx status. */ declare function apiGet(url: string): Promise; /** Send JSON (POST/PATCH/DELETE/…) and parse the JSON response; throws * {@link LouiseApiError} on a non-2xx status. */ declare function apiSend(method: string, url: string, body?: unknown): Promise; //#endregion //#region src/client/settings/dashboard/types.d.ts /** A framework panel a card can deep-link into. `health` is a hidden drill-in * (reachable from the Health card's action, not a top-strip button). */ type DashboardPanelTarget = "home" | "pages" | "media" | "settings" | "users" | "health"; /** What a card reports up so the summary header can aggregate a traffic light. */ type CardStatus = { level: "ok"; } | { level: "attention"; count: number; label: string; } | { level: "loading"; } | { level: "absent"; }; /** Handed to every card: cross-panel deep-links + status reporting (card-scoped). */ interface DashboardApi { /** Deep-link into another surface—a framework panel or a site tab. */ open(target: { panel: DashboardPanelTarget; } | { tab: string; }): void; /** Report this card's status reactively; the header aggregates all of them. */ report(status: () => CardStatus): void; } interface DashboardCard { /** Stable id—de-dup key, query-key segment, and `hide` target. */ id: string; /** Lower renders earlier. Built-ins use 10/20/30; site cards default to 100. */ order?: number; /** Card body—typically the shared ``. Return `null` to self-suppress. */ render: (api: DashboardApi) => JSX.Element; } /** The `/api/louise/overview` payload—every slice optional so a card degrades * to "absent" (rather than erroring) when its data source isn't wired. */ interface OverviewData { content?: { drafts: number; unpublished: number; lastEditedAt?: string; }; inbox?: { unread: number; }; health?: { brokenLinks: number; missingAlt: number; seoGaps: number; checkedAt?: string; pendingMigrations?: string[]; }; } //#endregion //#region src/client/settings/fields.d.ts /** A label/href row—the shape stored in the `navLinks`/`socialLinks` JSON. */ interface LinkRow { label: string; href: string; } /** * Field types the declarative Settings renderer understands. * * An alias for the shared {@link FieldTypeName} since ADR 0010 A2—this was its * own six-name union, overlapping the section catalog's eight on four and * disagreeing on the rest, so a type added to one surface was silently absent * from the other. That asymmetry is what left settings without a `link` type and * therefore without a scheme check on stored nav destinations. * * The renderer below still only draws the six it always drew; a name it doesn't * recognise falls through to the text input, exactly as an unknown value did * before. What changed is that both surfaces now agree on what the names ARE, and * a type registered once validates on both. */ type SettingsFieldType = FieldTypeName; /** * One declarative settings field. `key` is the settings object key it reads and * writes—a framework base column (for example, `siteName`) for the built-in groups, or * a site-declared `custom` key for an extension group. */ interface SettingsFieldDef { key: string; label: string; /** Renders as a single-line text input when omitted. */ type?: SettingsFieldType; hint?: string; placeholder?: string; /** * Escape hatch for a field whose UI none of the built-in `type`s cover—a * label/value row list, a microcopy grid, a per-page SEO editor, etc. Given * the loaded value (once, at mount) and an `onChange`, it renders arbitrary * markup that persists to `key` through the same save flow as any field. * Overrides `type` when present. Manage local state internally—it's called * once, so keystrokes won't reset it. */ render?: (args: { value: unknown; onChange: (value: unknown) => void; }) => JSX.Element; } /** A titled, collapsible group of settings fields. */ interface SettingsFieldGroup { title: string; hint?: string; /** Expanded on first render (the first built-in group opens by default). */ open?: boolean; fields: SettingsFieldDef[]; } /** Collapsible settings section—native
/ (keyboard and a11y * for free) under the Louise theme. */ declare function Section(props: { title: string; hint?: string; open?: boolean; children: JSX.Element; }): JSX.Element; /** A reusable label+href list editor with add / remove / reorder. */ declare function LinkListEditor(props: { rows: LinkRow[]; setRows: (rows: LinkRow[]) => void; /** A message per row index, from the server's violations, shown under the row. */ rowErrors?: Readonly>; }): JSX.Element; /** Inline media picker: a small library grid (the same `/api/louise/media` list * the Media panel uses) for URL fields that should point at an uploaded image. * Clicking a thumbnail fills the field instead of hand-pasting a URL. */ declare function MediaUrlPicker(props: { onPick: (url: string) => void; /** The ID of an error message about the field, linked to the picker's button. */ errorId?: string; }): JSX.Element; /** An image field: live thumbnail, an upload button, a media-library picker, and * a clear button. Empty = the site shows its placeholder. By default the value * can only come from an upload or the library (a media-hosted URL)—there is * no free-form URL input, so editors can't hotlink an external image. Opt into * upload-into-slot with `upload`, a resized preview with `transform`, and the * legacy raw-URL text input with `allowUrl`. */ declare function ImageField(props: { label: string; hint?: string; value: string; onChange: (url: string) => void; /** Show an upload-into-slot button: POST the file to the media route, set the * field to the returned URL, and refresh the media list. Off by default (the * media-library picker covers the base case). */ upload?: boolean; /** Scope (R2 key prefix) sent with the upload. Default `"web"`. */ uploadScope?: string; /** Show a free-form URL text input, letting an editor paste any (external) * URL. Off by default—images should come from the media library so they * can't break or hotlink. An escape hatch for sites that knowingly want it. */ allowUrl?: boolean; /** Override the preview thumbnail URL. Defaults to a CDN derivative sized for * the 160 px preview box—pass this only to do something else. Never affects * the stored value. */ transform?: (url: string) => string; /** A message from the server about this field, shown under it. */ invalid?: string; }): JSX.Element; /** * Render one declarative settings field, dispatching on `def.type`. `value` is * the current value from the settings store; `onChange` writes the new value * back. Used for both the framework base groups and site extension groups. */ declare function SettingsField(props: { def: SettingsFieldDef; value: unknown; onChange: (value: unknown) => void; /** A message from the server about this field, shown under it and linked * with `aria-describedby`. */ error?: string; /** For a `links` field: a message per row index. */ rowErrors?: Readonly>; }): JSX.Element; //#endregion //#region src/client/settings/pages-panel.d.ts /** A code-defined route listed alongside the content pages. */ interface BuiltInPageRef { key: string; title: string; path: string; } /** A starter layout offered under "New page from template"—canned block HTML * (sanitized on save like any page body); no schema change. */ interface PageTemplate { /** Stable id. */ id: string; /** Button label. */ label: string; /** Prefilled page title (defaults to `label`). */ title?: string; /** Prefilled builder body (HTML). */ body: string; } /** A row of the site's `pages` table (the fields the panel edits). */ interface PageRow { id: number; slug: string; title: string; body: string | null; status: "draft" | "published"; /** Present when the page has drafts: the version its row holds. Its presence * is what tells the panel to publish and unpublish rather than set status. */ publishedVersionId?: number | null; seoTitle: string | null; seoDescription: string | null; ogImage: string | null; noindex: boolean; sortOrder: number | null; } declare function PagesPanel(props: { builtInPages?: BuiltInPageRef[]; pageTemplates?: PageTemplate[]; /** Match the live share-card preview to the site's real OG card (brand, * colours, footer, font). Omit for the toolkit's default card; pass `false` * when the site renders no cards, so the preview falls back to the default * share image the way a real share does. */ ogCard?: OgCardOptions | false; }): import("solid-js").JSX.Element; //#endregion //#region src/client/settings/surface.d.ts /** A site-registered collection tab (the BOTTOM group). The framework panels are * not `CollectionTab`s: they're fixed in the top strip and can't be added here. */ interface CollectionTab { /** Stable id (sites typically reuse it as a query-key segment). */ id: string; /** Tab label shown in the bottom nav. */ label: string; /** The panel body, rendered when this tab is active. */ panel: () => JSX.Element; } /** The framework panels, keyed by their top-strip icon. Home/Media/Pages/Settings * are always present; `users` is opt-in (config.users + a wired editorsRoute). * `health` is a hidden drill-in (reached from the Home Health card, not a * top-strip button). */ type FrameworkPanel = "home" | "users" | "media" | "pages" | "settings" | "health"; /** Everything both presentations need to render the same panels. */ interface SurfaceConfig { tabs?: CollectionTab[]; builtInPages?: BuiltInPageRef[]; pageTemplates?: PageTemplate[]; ogCard?: OgCardOptions | false; settingsBaseGroups?: SettingsFieldGroup[]; settingsExtension?: SettingsFieldGroup[]; settingsExtras?: () => JSX.Element; users?: boolean; usersEndpoint?: string; home?: boolean; dashboard?: { cards?: DashboardCard[]; hide?: string[]; healthEndpoint?: string; /** How old the last health check can get, in milliseconds, before the Health * panel marks it out of date. Default 36 hours. */ healthStaleAfterMs?: number; }; } //#endregion //#region src/client/settings/panel-actions.d.ts /** How an action reads: `primary` (blue Save/Publish), `ghost` (Cancel/Revert), * `danger` (Delete). Maps onto the drawer's existing button styles. */ type ActionKind = "primary" | "ghost" | "danger"; interface PanelAction { /** Stable id (dedupe / test hook). */ id: string; /** Button label, for example, "Save", "Cancel", "Publish", "Delete". */ label: string; /** Visual treatment; defaults to `ghost`. */ kind?: ActionKind; /** Runs on click / on Cmd+S when this is the enabled primary. May be async: * while its promise is pending the button shows {@link busyLabel} + disables. */ onClick: () => void | Promise; /** Reactive disabled predicate, for example, `() => !dirty()`. */ disabled?: () => boolean; /** Label shown while `onClick`'s promise is pending, for example, "Saving…". */ busyLabel?: string; } /** Status shown when a surface auto-saves (or after an explicit save settles). * A `notice` answers an action that had nothing to do, such as Save with no * changes, so a button that stays enabled still says why nothing happened. */ type SaveStatus = { state: "idle"; } | { state: "saving"; } | { state: "saved"; } | { state: "notice"; message: string; } | { state: "error"; message: string; }; interface PanelActionsApi { /** Push this view's footer frame; returns a disposer that pops exactly it. * Call in `onMount` and hand the disposer to `onCleanup` so the parent's * actions restore when this view unmounts. */ push(actions: PanelAction[], status?: () => SaveStatus): () => void; } /** * Hosts the footer frame stack and the Cmd/Ctrl+S shortcut. Wrap the drawer * body + {@link DrawerFooter} in one of these. The stack is a plain signal (not * a store) so pushed frames keep referential identity—the disposer pops by * identity, which a store's proxying would silently break. */ declare function PanelActionsProvider(props: { children: JSX.Element; }): JSX.Element; /** Access the footer action stack. Must run under a {@link PanelActionsProvider} * (the drawer body is wrapped in one); throws otherwise so a missing provider * is a loud bug rather than a silently swallowed push. */ declare function usePanelActions(): PanelActionsApi; /** * The sticky footer, rendered by the shell after `louise-drawer-body`. Shows the * top-of-stack frame's status pill + action buttons; collapses (renders nothing) * when the active view has neither actions nor a status, so list/empty panels * (Inbox, the Home dashboard) don't show a bare bar. */ declare function DrawerFooter(): JSX.Element; //#endregion export { ApiViolation as A, SettingsFieldType as C, DashboardPanelTarget as D, DashboardCard as E, createSettingsQueryClient as F, isApiStatus as I, louiseQueryKey as L, apiErrorMessage as M, apiGet as N, OverviewData as O, apiSend as P, louiseQueryKeys as R, SettingsFieldGroup as S, DashboardApi as T, LinkRow as _, PanelActionsProvider as a, SettingsField as b, CollectionTab as c, BuiltInPageRef as d, PageRow as f, LinkListEditor as g, ImageField as h, PanelActionsApi as i, LouiseApiError as j, ApiErrorBody as k, FrameworkPanel as l, PagesPanel as m, DrawerFooter as n, SaveStatus as o, PageTemplate as p, PanelAction as r, usePanelActions as s, ActionKind as t, SurfaceConfig as u, MediaUrlPicker as v, CardStatus as w, SettingsFieldDef as x, Section as y };