/** * One entry per Setting the panel shows: what it holds, its built-in default, * the `LIT_PLUGIN_*` env var that sets it, where its resolved value sits in * {@link FeatureSettings}, and how a recorded baseline compares. The override * and provenance types, the config -> override key map and the preference * defaults are all derived from here. * * Plain data with no labels: the page runtime imports this (through * `settings-override.ts`), so how a Setting looks in the Settings tab lives * in the panel (`panel/setting-presentation.ts`), which must cover every key. * * A Setting's role says what the panel can do with it: * - `override`: resolved from config, and replaceable live by a panel override. * - `preference`: a panel preference with no config value; unset means its default. * - `readonly`: resolved from config and shown, but not overridable. * - `feature`: a feature switch. Off means no runtime is injected at all, so * it can only be shown, never overridden. * * Plugin options the panel never shows (`privateFields`, `cssSheetBuild`) are * not Settings and stay in `options.ts` alone. */ import type { FeatureSettings } from '../types/timeline.js'; export type SettingRole = 'override' | 'preference' | 'readonly' | 'feature'; export interface SettingDefinition { readonly role: R; /** `select` lists its {@link values}; `text`/`number` are free-form. */ readonly kind: 'switch' | 'select' | 'text' | 'number'; /** The closed set a `select` offers, when the type has one. */ readonly values?: readonly V[]; /** The built-in default, the value when neither an option nor env sets it. */ readonly default: V; /** The full env var name, for every role but `preference`. */ readonly env?: string; /** The resolved value in the plugin's {@link FeatureSettings}; not for `preference`. */ readonly read?: (settings: FeatureSettings) => V; /** * Whether a recorded baseline can be compared with the current one. A value * that stands for something unrepresentable (a custom editor object, * reported as `'custom'`) can't, and never counts as moved. */ readonly comparable?: (value: unknown) => boolean; } export declare const SETTINGS: { readonly hmr: SettingDefinition; /** * Cycle `disconnectedCallback()`/`connectedCallback()` on live instances * after a hot patch. */ readonly hmrReconnect: SettingDefinition; /** What to do when a component can't be hot-patched in place. */ readonly hmrOnIncompatible: SettingDefinition<"reload" | "warn", "override">; /** What happens to custom elements inside an edited template. */ readonly hmrChildState: SettingDefinition<"reset" | "reuse" | "transfer", "override">; /** * Show the on-page HMR indicator. It only exists when enabled at config * time, so an override can hide or show it but not create it. */ readonly hmrIndicatorVisible: SettingDefinition; /** Show a running update count next to the indicator. */ readonly hmrIndicatorCount: SettingDefinition; readonly sourceOverlay: SettingDefinition; /** Built-in editor key for the source overlay's open-in-editor target. */ readonly sourceOverlayEditor: SettingDefinition; /** Hotkey letter combined with Ctrl+Shift to toggle the overlay. */ readonly sourceOverlayKey: SettingDefinition; readonly sourceOverlayThrottleMs: SettingDefinition; readonly timeline: SettingDefinition; /** Flash a short outline over every Lit element that completes an update. */ readonly flashUpdates: SettingDefinition; /** * Colour the flash by how often the element updated in the last second, * calm to hot, instead of one flat colour. Only meaningful with * `flashUpdates`. */ readonly flashUpdatesRamp: SettingDefinition; /** * Show each documented member's manifest description in a line under its * row in the Components details, instead of only on hover. */ readonly inlineDocs: SettingDefinition; /** * Mirror the timeline into Chrome DevTools' Performance panel as custom * tracks (via `console.timeStamp`), independent of panel recording. */ readonly chromeTracks: SettingDefinition; }; export type SettingKey = keyof typeof SETTINGS; /** The value type a Setting holds. */ export type SettingValue = (typeof SETTINGS)[K] extends SettingDefinition ? V : never; /** The Settings whose role is one of `R`. */ export type SettingKeyOf = { [K in SettingKey]: (typeof SETTINGS)[K] extends SettingDefinition ? Role extends R ? K : never : never; }[SettingKey]; /** Settings a panel override can replace and that have a config baseline. */ export type OverridableKey = SettingKeyOf<'override'>; /** Pure preferences: no config baseline. */ export type PreferenceKey = SettingKeyOf<'preference'>; /** Settings the panel shows a config origin for. */ export type SourcedKey = SettingKeyOf<'override' | 'readonly' | 'feature'>; /** Every Setting of one role, in definition order. */ export declare const settingsOf: (role: R) => Array>; /** * Whether the config value an override was made against has since changed. * * `recorded` is `undefined` for a legacy override that predates baseline * tracking, which never counts as a change (no false positives). Values are * compared structurally, unless the Setting says one side can't be compared. */ export declare const baselineChanged: (key: OverridableKey, recorded: unknown, current: unknown) => boolean; //# sourceMappingURL=setting-definitions.d.ts.map