/*!
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
export type SelectionMode = 'single' | 'multiple' | 'multiple-replace';
export type SelectionEdge = 'top' | 'middle' | 'bottom';
/** Modifier keys resolved from a pointer or keyboard event. */
export type SelectionIntent = {
/** Shift: extend from the anchor to the target. */
isRange: boolean;
/**
* Cmd on Apple platforms, Ctrl elsewhere. Ignored in `multiple`, where an
* unmodified click already toggles.
*/
isToggle: boolean;
};
/**
* Where a range is measured from.
*
* `baseSelectedIds` is the selection as it stood immediately after the anchor
* was placed. A `multiple-replace` range unions its visible members with the
* range so it can be grown and shrunk without losing earlier picks.
* `isSelected` is the state the anchor row was placed into, which a `multiple`
* range paints across its members.
*/
export type SelectionAnchor = {
baseSelectedIds: ReadonlySet;
id: string;
isSelected: boolean;
} | null;
type ComputeNextSelectionInput = {
anchor: SelectionAnchor;
intent: SelectionIntent;
/** Ids of every selectable, non-disabled item, visible or not. */
selectableIds: ReadonlySet;
/** Currently selected ids, including items inside collapsed groups. */
selectedIds: ReadonlySet;
selectionMode: SelectionMode;
targetId: string;
/** Ids of the items the user can currently see, in visual order. */
visibleIds: readonly string[];
/** Maps an item id to the id of the item that owns its group. */
parentIdById: ReadonlyMap;
};
type ComputeNextSelectionResult = {
anchor: SelectionAnchor;
selectedIds: Set;
};
/**
* Resolves a selection gesture into the complete next selection. Pure: the
* caller supplies the current state and applies the result.
*/
export declare function computeNextSelection({ anchor, intent, parentIdById, selectableIds, selectedIds, selectionMode, targetId, visibleIds, }: ComputeNextSelectionInput): ComputeNextSelectionResult;
/**
* Marks each selected item's position within its run of adjacent selected
* items, so a run can be styled as one block.
*/
export declare function computeSelectionEdges(visibleIds: readonly string[], selectedIds: ReadonlySet): Map;
export declare function countChangedIds(previous: ReadonlySet, next: ReadonlySet): number;
export declare function formatSelectionAnnouncement(selectedCount: number): string;
export {};
//# sourceMappingURL=selection.d.ts.map