UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

32 lines 791 B
import { AbstractLegend, } from './AbstractLegend.js'; export class Legend extends AbstractLegend { #items = []; #cachedItems; constructor(props) { super(props); this.#update(props); } update(props) { this.#update(props); super.update(props); } #update({ items }) { this.#items = items ?? []; this.#cachedItems = undefined; } get items() { return this.#items; } set items(items) { this.#items = items; this.#cachedItems = undefined; this.invalidateSize(); } collectItems() { if (!this.#cachedItems) { this.#cachedItems = this.computeItems(this.#items); } return this.#cachedItems; } } //# sourceMappingURL=Legend.js.map