/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { StickySection } from "@elaraai/east-ui-components/internal"; import type { DrawnItem, DrawnZone } from "./canvas/drawn.js"; import { type NavZone } from "./canvas/model.js"; /** Where a row stands among the rows listed beside it, under one zone or at the top: what a reader hears while the rest scroll out. */ export interface IndexPlace { /** Its place, from 1. */ readonly position: number; /** How many rows are listed beside it, itself among them. */ readonly siblings: number; } /** One row of the Index tab: a zone, or an item inside one — or inside none. */ export type IndexRow = IndexPlace & ({ readonly kind: "zone"; /** The zone. */ readonly zone: DrawnZone; /** How deep it nests: 0 for a zone in none. */ readonly depth: number; /** Whether it is open: its items and its nested zones listed under it. */ readonly open: boolean; /** Whether it holds anything to open. */ readonly branch: boolean; /** How many items it holds, its nested zones' among them; `undefined` while that is not whole. */ readonly count: number | undefined; } | { readonly kind: "item"; /** The item. */ readonly item: DrawnItem; /** How deep it is listed: one under its zone's, 0 for an item in no zone. */ readonly depth: number; }); /** * Whether the Index's search holds an item it searches itself — one of a kind read whole, or one a gesture made, which no * source holds: its label, its key or its kind's name holds the query, each in the app's locale's lower case. * * @param item - The item * @param query - The search; empty, every item * @param kindName - An item kind's name, by its slot * @param locale - The app's locale, which the search lowers its text in * @returns Whether it holds the item */ export declare function indexSearchHolds(item: DrawnItem, query: string, kindName: (slot: string) => string, locale: string): boolean; /** What the Index's rows take of the kinds read by area (#1393, D52). */ export interface IndexRowsOptions { /** The item kinds read by area, by slot: searched through their sources, each of their items listed is a match. */ readonly searched?: ReadonlySet | undefined; /** Whether a zone's count is whole, by its key; with none, every zone's is. */ readonly whole?: ((zone: string) => boolean) | undefined; } /** * The Index tab's rows (see the module docs). * * @param tree - The zones nested by containment, the items inside them and those in none (`buildNavTree`) * @param open - The zones the viewer has open, by key * @param query - The tab's search; empty, none * @param kindName - An item kind's name, by its slot: what the search reads beside an item's label and key * @param locale - The app's locale, which the search lowers its text in * @param options - The kinds read by area, searched through their sources, and whether a zone's count is whole * @returns The rows, in order, each with its place among the rows listed beside it */ export declare function indexRows(tree: { readonly roots: readonly NavZone[]; readonly floor: readonly DrawnItem[]; }, open: ReadonlySet, query: string, kindName: (slot: string) => string, locale: string, options?: IndexRowsOptions): IndexRow[]; /** * The open zone's section of the Index's rows (#1570): its row, heading the rows listed under it — its items and the * zones it holds — to the next row past them, so it sticks at the tree's top while they scroll under it (the shared * rows' `sections`, #1568). * * @param rows - The Index's rows ({@link indexRows}) * @param open - The open zone, by key: the deepest of the zones open; `undefined` for none * @returns Its section; none while no zone is open, the open zone is not listed, or it lists nothing under it */ export declare function indexSections(rows: readonly IndexRow[], open: string | undefined): readonly StickySection[]; /** A box in world units. */ export interface WorldBox { readonly minX: number; readonly minY: number; readonly maxX: number; readonly maxY: number; } /** The view the canvas reports: its window on the world, and whether the whole drawing is in it. */ export interface IndexViewport { /** The window, in world units. */ readonly box: WorldBox; /** Whether the camera is at its fit, the whole drawing in view: no zone is in view then. */ readonly fitted: boolean; } /** * The zone the viewport is in (see the module docs). * * @param zones - The zones drawn — a hatched one is an annotation, never in view * @param view - The canvas's view; `undefined` before it reports one * @param prev - The zone in view before * @returns The zone's key; `undefined` for none */ export declare function zoneInView(zones: readonly DrawnZone[], view: IndexViewport | undefined, prev: string | undefined): string | undefined; //# sourceMappingURL=index-tree.d.ts.map