/* 8-BIT NES — type surface (hand-written; the package ships zero-build ESM). */ /** [freqHz, durationSec] pairs played as a square-wave sequence. */ export type SfxSeq = ReadonlyArray; /** localStorage wrapper that falls back to memory in private mode / quota errors. */ export declare const store: { get(key: string): string | null; set(key: string, value: string): void; }; /** Built-in chiptune SFX sequences. */ export declare const SFX: { coin: SfxSeq; bad: SfxSeq; clear: SfxSeq; unlock: SfxSeq; }; /** Play a square-wave sequence. Silent when muted or audio unavailable — never throws. */ export declare function bleep(seq: SfxSeq): void; export declare function setMute(muted: boolean): void; export declare function isMuted(): boolean; /** Float a "+N XP" label upward from an element (smooth ease-out motion). */ export declare function floatXP(el: HTMLElement, text?: string, color?: string): void; /** Dispatch XP on the `nes:xp` document bus (an listens) + optional floater. */ export declare function grantXP(amount: number, srcEl?: HTMLElement): void; /** Accent names mapped in base.css (`--accent` + `--accent-d`). `good` (green) is the primary/default. */ export type Accent = | "blue" | "gold" | "cyan" | "purple" | "lime" | "teal" | "indigo" | "pink" | "steel" | "good" | "warn" | "crit"; /** Options for {@link toast}. */ export interface ToastOptions { /** Accent name mapped in base.css (`good`/green default — the primary accent). */ accent?: Accent; /** Auto-dismiss delay in ms; `0` keeps it (and forces a dismiss button). Default 3200. */ timeout?: number; /** A mono uppercase line above the message. */ title?: string; /** An UNDO-style button; clicking it runs `onClick` and dismisses the toast. */ action?: { label: string; onClick?: () => void }; /** Show the ✕. Default true (always true when `timeout` is 0). */ dismissible?: boolean; /** Treat `msg` as markup. Default false — `msg` is text, so it cannot inject. */ html?: boolean; /** How many toasts stay on screen; the oldest beyond this are dropped. Default 4. */ max?: number; /** Bleep on show. Default true (`crit` bleeps sad). */ sound?: boolean; } /** A toast element, with its own dismiss. */ export interface ToastElement extends HTMLElement { /** Fade it out and remove it. Safe to call twice. */ dismiss(): void; } /** * Show a transient toast (auto-creates the live-region host on first call). * `msg` is TEXT unless `html: true`. Pauses while hovered or focused, and can be * swiped away on touch. A `crit` toast interrupts (assertive) instead of waiting. */ export declare function toast(msg: string, opts?: ToastOptions): ToastElement; /** Options for {@link confirmDialog}. */ export interface ConfirmOptions { /** The question, in the header. Default "Are you sure?". */ title?: string; /** One line of consequence — say what cannot be undone. */ body?: string; /** The destructive button's text. Default "Confirm". */ confirmLabel?: string; /** The safe button's text. Default "Cancel". */ cancelLabel?: string; /** Accent for the dialog and the confirm button. Default "crit". */ accent?: Accent; /** Treat `body` as markup. Default false. */ html?: boolean; } /** * A destructive confirm as a promise, on `.showModal()`. Resolves false on * Cancel, Esc and a backdrop click. Focus starts on Cancel, so Enter is never the * destructive answer. */ export declare function confirmDialog(opts?: ConfirmOptions): Promise; /** Highlight code to HTML with `.t-*` token spans (used by ). */ export declare function highlightCode(code: string): string; /** A breakpoint width read from tokens.css, so JS switches shape at the same width * a media query does (CSS cannot read a var() inside `@media`). * `matchMedia(`(min-width: ${bp("lg")})`)` */ export declare function bp(name: "sm" | "lg" | "xl", fallback?: string): string; /* ---- custom elements ---- */ export interface NesSoundElement extends HTMLElement {} export interface NesCollapsibleElement extends HTMLElement {} export interface NesHudElement extends HTMLElement { /** Add XP directly (also persisted under `${ns}_xp`). */ add(amount: number): void; } export interface NesQuizElement extends HTMLElement {} export interface NesTabsElement extends HTMLElement {} export interface NesCodeElement extends HTMLElement {} /* ---- Form module ---- */ /** : native constraint validation → inline errors → `nes:submit`. */ export interface NesFormElement extends HTMLElement { /** The wrapping
(created on connect). */ form: HTMLFormElement; /** Validate every control; on success dispatch `nes:submit`, else focus the first bad field. */ submit(): void; } /** : auto-wired − [n] + stepper over a native number input. */ export interface NesNumberElement extends HTMLElement { value: string; } /** * : cycle a small option set with ◀ / ▶ (arcade settings row). * Options come from a child `