Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788/** Visibility and live-layer updates for the browser controller. @module */
import { buildLayers, } from '../deck-config.ts';import type { PackageProbe, } from '../probe.ts';import type { Session, } from './controller-session-types.ts';import { computeVisibleIndices, } from './filter.ts';
/** Recomputes visible indices and updates the visibility counter. @param session - Mutable session receiving computed visibility. @param probes - Source probes. @example ```ts recomputeVisibility({ session, probes, }); ``` */export function recomputeVisibility({ session, probes,}: { session: Session; probes: readonly PackageProbe[];}): void { session.visibleIndices = computeVisibleIndices({ probes, toggles: session.state .toggles, ranges: session.state .ranges, search: session.state .search, dimMapping: session.state .dimMapping, },); /** Counter element absent from tests and partial pages. */ const counter = document.querySelector<HTMLElement>('#visibility-counter',); if (counter !== null) { counter.textContent = `${session.visibleIndices .size .toString()} of ${probes.length .toString()} visible`; }}
/** Pushes freshly built layers into the live Deck renderer. @param session - Mutable live renderer session. @param probes - Source probes. @mutates session through session.deck.setProps renderer capability @example ```ts rerenderLayers({ session, probes, }); ``` */export function rerenderLayers({ session, probes,}: { session: Session; probes: readonly PackageProbe[];}): void { /** Layers rebuilt from current session inputs. */ const layers = buildLayers({ probes, state: session.state, visibleIndices: session.visibleIndices, bounds: session.bounds, chrome: session.chrome, },); session.deck .setProps({ layers: [...layers,], },);}