/** * Copyright Aquera Inc 2023 * * This source code is licensed under the BSD-3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit'; import NileElement from '../internal/nile-element'; export type NileMinimapOrientation = 'horizontal' | 'vertical' | 'auto'; export type NileMinimapMode = 'segments' | 'track'; export type NileMinimapAxis = 'horizontal' | 'vertical'; export type NileMinimapSource = 'drag' | 'click' | 'wheel' | 'keyboard'; /** Formats the `aria-valuetext` in segments mode. */ export type NileMinimapValueTextFormatter = (first: number, last: number, total: number) => string; /** * A small overview of any scrolling container. It mirrors the container's * scroll position and lets people drag, click, wheel or key to another part of * it. One axis at a time: horizontal for boards and wide tables, vertical for * long documents and lists. It adds to the native scrollbar; it never replaces * it. * * NxtGen theme only: styles use `--ng-*` tokens with no legacy `--nile-*` * fallbacks, so the page must load the NxtGen theme (e.g. `nxtgen.css`). * * @tag nile-minimap * @summary Scroll overview that attaches to a scroll container by id and lets people navigate it. * * @event nile-navigate - Fired before the minimap scrolls the container. Cancelable: `preventDefault()` skips the scroll. Detail: { position: number, ratio: number, source: 'drag' | 'click' | 'wheel' | 'keyboard', orientation: 'horizontal' | 'vertical' } * @event nile-overflow-change - Fired once on first measure, then whenever overflow on the active axis starts or stops. Detail: { overflowing: boolean, orientation: 'horizontal' | 'vertical' } * * @csspart base - The container surface. * @csspart track - The scaled area; drawn as a rail in track mode. * @csspart segment - One block per item matched by `itemSelector`. * @csspart viewport - The focusable, draggable thumb (`role="scrollbar"`). * * @cssproperty --nile-minimap-width - Width of the minimap (112px). Swaps with height in vertical mode. * @cssproperty --nile-minimap-height - Height of the minimap (40px). Swaps with width in vertical mode. */ export declare class NileMinimap extends NileElement { static styles: CSSResultGroup; /** Id of the scroll container, resolved in the minimap's root node. The only way to attach. */ for: string; /** Which axis the minimap represents. `auto` picks the overflowing axis (horizontal first). */ orientation: NileMinimapOrientation; /** `segments` draws one block per item; `track` draws a single rail. */ mode: NileMinimapMode; /** Selector queried on the container to find the segment items. */ itemSelector: string; /** Hides the host while nothing overflows. */ hideWhenFits: boolean; /** Smooth scroll for click and keyboard. Always off under reduced motion. */ smooth: boolean; /** Still mirrors scrolling, but can't be used. */ disabled: boolean; /** Accessible name on the viewport. */ label: string; /** * Keeps the minimap hidden until the container scrolls, then fades it out * after `hideDelay` ms without scrolling. It stays visible while it is * hovered, focused or being dragged. Hidden, it keeps its space and ignores * the pointer. */ autoHide: boolean; /** With `autoHide`, milliseconds without scrolling before the minimap fades out. */ hideDelay: number; /** Builds the `aria-valuetext` in segments mode. */ formatValueText: NileMinimapValueTextFormatter; private base; private trackEl; private segsEl; private viewport; private resolvedDir; private target; private axis; private geo; private observed; private overflowing; private segOn; private rtl; private raf; private full; private pending; private pendingAt; private retried; private retryRaf; private contentSize; private clientSize; private maxScroll; private trackLen; private vpLen; private ro; private mo; private onScroll; private hideTimer; private hovered; private focused; private onPointerEnter; private onPointerLeave; private onFocusIn; private onFocusOut; private drag; private dragRaf; private lastMove; private reduceMotion; connectedCallback(): void; disconnectedCallback(): void; firstUpdated(): void; updated(changed: PropertyValues): void; render(): TemplateResult; private get held(); /** Shows an auto-hidden minimap and restarts the countdown to hiding it. */ private reveal; private queueHide; private resolveTarget; private attach; private detach; private schedule; private layout; private renderSegments; private refresh; private go; private cur; private step; private bindInteractions; } export default NileMinimap; declare global { interface HTMLElementTagNameMap { 'nile-minimap': NileMinimap; } }