import type { SourceOverlayOptions } from './types.js'; import type { FeatureSettings, SettingSources } from '../types/timeline.js'; import { type CssSheetBuild } from './css-sheet-build.js'; import type { ChildStateMode } from './runtime/child-state.js'; export type { CssSheetBuild } from './css-sheet-build.js'; /** * On-page HMR feedback: a small pulsing indicator in the corner of the host * page that briefly animates on each HMR update, for at-a-glance feedback * without watching the console. */ export interface HmrIndicatorOptions { /** Inject the indicator element. Defaults to `true` (when HMR is enabled). */ enabled?: boolean; /** * Show a cumulative update count next to the dot (idle opacity 0.5 instead * of fully transparent). Defaults to `false`. */ count?: boolean; } /** * HMR for Lit component classes and its on-page feedback. */ export interface HmrOptions { /** * Enable in-place HMR for Lit component classes. When `false`, the plugin * skips all HMR transforms and runtime injection. Defaults to `true`. */ enabled?: boolean; /** * Cycle `disconnectedCallback()`/`connectedCallback()` on live instances * after a hot patch. Interning makes this mostly unnecessary, so it's * opt-in. Defaults to `false`. */ reconnect?: boolean; /** * Rewrite native `#private` class members to stable `Symbol.for` keys in * dev so classes using them can be hot-patched in place. This trades real * privacy and brand checks for working HMR, in dev only; builds are never * touched. Defaults to `true`. */ privateFields?: boolean; /** * What to do when a component can't be hot-patched in place (e.g. * standard `accessor` decorators). Defaults to `'reload'`. */ onIncompatible?: 'reload' | 'warn'; /** * What happens to custom elements inside a template whose text a hot patch * changed. lit-html clones fresh DOM for the edited template, so those * elements are re-created. * * - `'reset'`: they start over from their defaults. * - `'transfer'`: each new element takes the old one's reactive properties * and `#private` state (keys the new template binds or sets as an * attribute keep the template's value). * - `'reuse'`: where the new element carries no bindings, the old element * (identity, shadow DOM, controllers) is put back in its place; elsewhere * as `'transfer'`. * * Defaults to `'transfer'`. */ childState?: ChildStateMode; /** * The on-page update indicator. `true` enables it without a count; an * object configures it. Forced off when HMR itself is disabled. Defaults * to enabled (without a count). */ indicator?: boolean | HmrIndicatorOptions; } /** * Options for the Lit Vite plugin. * * Every option also resolves from environment variables (and `.env` files) * with the `LIT_PLUGIN` prefix — e.g. `LIT_PLUGIN_HMR_INDICATOR=true`. Options * passed here take precedence over env vars, which take precedence over the * built-in defaults. */ export interface LitPluginOptions { /** * HMR for Lit components and its on-page feedback. `true`/`false` toggles * the whole feature (patching and indicator); an object configures it. * Defaults to enabled. */ hmr?: boolean | HmrOptions; /** * Dev-only click-to-open-in-IDE inspector for Lit custom elements. * Toggle with Ctrl+Shift+S (configurable via `key`). Defaults to `false`. */ sourceOverlay?: boolean | SourceOverlayOptions; /** * Vite DevTools Timeline panel — a Vue DevTools–style layered event stream * for Lit lifecycle, render, mouse, and keyboard events. * * With the `@vitejs/devtools` Vite plugin (`DevTools()`) active, the panel * is a dock in Vite DevTools. Without it, the plugin serves the panel on * the dev server at `/__lit/` and prints that URL; its RPC asks for the * one-time code printed in the terminal unless * `VITE_DEVTOOLS_DISABLE_CLIENT_AUTH=true`. Defaults to `false` while * experimental. * * `true` enables all built-in layers with defaults. */ timeline?: boolean; /** * What a `?css-sheet` import compiles to under `vite build`. * - `'url'`: fetch-backed sheet over the emitted `.css` asset * - `'inline'`: css text embedded in the JS chunk, processed by the css * pipeline (`?inline`) * - `'inline-raw'`: css text embedded verbatim, skipping the css pipeline * (`?raw`) * - `'auto'`: `'inline'` when `build.lib` is set, `'url'` otherwise * * Dev is always the fetch-backed HMR form regardless of this setting. * Defaults to `'auto'`. */ cssSheetBuild?: CssSheetBuild; /** * Answer Chrome's `/.well-known/appspecific/com.chrome.devtools.json` in * dev, so DevTools can connect the project as a workspace and save Sources * panel edits to disk. `true` uses Vite's workspace root; a string names * the folder (relative to Vite's root). Only loopback clients get an * answer. Defaults to `true`. */ devtoolsWorkspace?: boolean | string; } /** Plugin options after merging explicit options, env vars, and defaults. */ export interface ResolvedOptions { hmrEnabled: boolean; reconnect: boolean; privateFields: boolean; onIncompatible: 'reload' | 'warn'; childState: ChildStateMode; indicator: false | { count: boolean; }; sourceOverlay: false | SourceOverlayOptions; timeline: boolean; cssSheetBuild: CssSheetBuild; devtoolsWorkspace: boolean | string; /** * Which layer each panel-visible setting came from. Source-overlay keys are * present only when the overlay is enabled. */ sources: SettingSources; } /** * Merge explicit options over env vars over defaults (in that precedence) into * the flat shape the plugin hooks consume. */ export declare const resolveOptions: (options: LitPluginOptions, env: Record) => ResolvedOptions; /** * Flattens resolved options into the JSON-serializable shape the panel's * Settings tab consumes (callback options like `exclude`/`onSelect` dropped; * a custom editor object reported as `"custom"`). Default key/editor/throttle * are applied here so the panel shows the effective values the runtime uses. */ export declare const toFeatureSettings: (r: ResolvedOptions) => FeatureSettings; /** * The editor the developer named, if any. Unlike {@link toFeatureSettings}, * which reports `vscode` for "never chose", this stays `undefined` then, so a * default never turns into a forced launcher. */ export declare const configuredEditor: (r: ResolvedOptions) => string | undefined; //# sourceMappingURL=options.d.ts.map