import { AcApDocManager, AcApLayerInfo } from '@mlightcad/cad-simple-viewer'; import { AcCmColor, AcCmTransparency, AcDbDatabase } from '@mlightcad/data-model'; /** * UI-ready layer row for layer palettes, toolbars, and similar Vue components. * * Extends {@link AcApLayerInfo} with additional fields read from the layer table * record (linetype, line weight, plottable flag, etc.). */ export interface LayerInfo extends AcApLayerInfo { /** Whether the layer contains at least one entity in the drawing database. */ isInUse: boolean; /** Whether the layer is included when the drawing is plotted. */ isPlottable: boolean; /** Layer transparency as an AutoCAD-style percentage string (for example `0`). */ transparency: string; /** Assigned linetype name (for example `Continuous`). */ linetype: string; /** Line weight in hundredths of a millimeter; `-1` means default/by-layer. */ lineWeight: number; /** Optional layer description text. */ description: string; } /** * Identifies which layer visibility flag a toggle operation should flip. */ export type LayerStateToggleKey = 'on' | 'frozen' | 'locked'; /** * Point-in-time capture of layer on/frozen/locked states and the current layer. * * Used by undo/redo and "layer previous" flows to restore a prior configuration. */ export interface LayerStateSnapshot { /** Current layer name (`CLAYER`) at the time of capture. */ clayer: string; /** Shallow copies of {@link LayerInfo} rows at the time of capture. */ states: LayerInfo[]; } /** * Layer management composable for Vue UI components. * * Subscribes to the active document's {@link AcApLayerStore} and exposes reactive * layer rows plus mutation helpers. State resynchronizes when the user switches * documents or when the layer table changes. * * @param editor - Application document manager that owns the active drawing. * @returns Reactive layer state and mutation functions for the active document. * * @example * ```typescript * import { AcApDocManager } from '@mlightcad/cad-simple-viewer' * import { useLayers } from '@mlightcad/cad-viewer' * * const { layers, currentLayerName, setLayerOn, toggleLayerFrozen } = * useLayers(AcApDocManager.instance) * * setLayerOn('Walls', true) * toggleLayerFrozen('Dimensions') * ``` */ export declare function useLayers(editor: AcApDocManager): { /** Reactive list of layer rows for the active document. */ layers: import('vue').Reactive; /** Writable computed current layer name (`CLAYER`). */ currentLayerName: import('vue').WritableComputedRef; /** Computed {@link LayerInfo} for {@link currentLayerName}. */ currentLayerInfo: import('vue').ComputedRef; /** Sets the current layer. See {@link setCurrentLayer}. */ setCurrentLayer: (layerName: string) => boolean; /** Turns a layer on or off. See {@link setLayerOn}. */ setLayerOn: (layerName: string, isOn: boolean) => boolean; /** Freezes or thaws a layer. See {@link setLayerFrozen}. */ setLayerFrozen: (layerName: string, isFrozen: boolean) => boolean; /** Locks or unlocks a layer. See {@link setLayerLocked}. */ setLayerLocked: (layerName: string, isLocked: boolean) => boolean; /** Toggles layer on/off. See {@link toggleLayerOn}. */ toggleLayerOn: (layerName: string) => boolean; /** Toggles layer frozen/thawed. See {@link toggleLayerFrozen}. */ toggleLayerFrozen: (layerName: string) => boolean; /** Toggles layer locked/unlocked. See {@link toggleLayerLocked}. */ toggleLayerLocked: (layerName: string) => boolean; /** Toggles one of on, frozen, or locked. See {@link toggleLayerState}. */ toggleLayerState: (layerName: string, state: LayerStateToggleKey) => boolean; /** Isolates a single visible layer. See {@link isolateLayer}. */ isolateLayer: (layerName: string) => boolean; /** Turns all layers on. See {@link setAllLayersOn}. */ setAllLayersOn: () => boolean; /** Captures current layer states for undo/previous. See {@link captureLayerSnapshot}. */ captureLayerSnapshot: (db?: AcDbDatabase) => LayerStateSnapshot | null; /** Restores a captured layer snapshot. See {@link applyLayerSnapshot}. */ applyLayerSnapshot: (snapshot: LayerStateSnapshot, db?: AcDbDatabase) => boolean; /** Sets layer color. See {@link setLayerColor}. */ setLayerColor: (layerName: string, color: AcCmColor) => boolean; /** Sets layer line weight. See {@link setLayerLineWeight}. */ setLayerLineWeight: (layerName: string, lineWeight: number) => boolean; /** Sets layer plottable flag. See {@link setLayerPlottable}. */ setLayerPlottable: (layerName: string, isPlottable: boolean) => boolean; /** Sets layer linetype. See {@link setLayerLinetype}. */ setLayerLinetype: (layerName: string, linetype: string) => boolean; /** Sets layer transparency. See {@link setLayerTransparency}. */ setLayerTransparency: (layerName: string, transparency: AcCmTransparency) => boolean; /** Sets layer description. See {@link setLayerDescription}. */ setLayerDescription: (layerName: string, description: string) => boolean; }; //# sourceMappingURL=useLayers.d.ts.map