import { ComputedRef, Ref } from 'vue'; import { SampleGroup } from '../types'; export type SampleGroupSource = T | Ref | ComputedRef | (() => T); export interface DisplaySampleSubGroup extends SampleGroup { displayColor: string; displayBg: string; displayBorder: string; } export interface SampleMajorGroup { name: string; color: string; subGroups: DisplaySampleSubGroup[]; allSamples: string[]; } /** * One node of the sample-group display hierarchy. Interior nodes are path * prefixes of the group names (`Liver`, `Liver / High`); leaves carry the * concrete group. A group's `name` stays the full path on its leaf because * every mutation — drag, delete, colour, selection — resolves groups by name. */ export interface SampleGroupNode { /** Unique across the tree; use for `:key` and expansion state. */ key: string; /** This node's own path segment, not the full path. */ label: string; color: string; displayBg: string; displayBorder: string; /** Every sample beneath this node, in group order. */ allSamples: string[]; /** Empty for leaves. */ children: SampleGroupNode[]; /** Present only on leaves. */ group?: DisplaySampleSubGroup; } export interface UseSampleGroupsOptions { groups: SampleGroupSource; samples?: SampleGroupSource; separator?: SampleGroupSource; fallbackColor?: SampleGroupSource; } export interface UseSampleGroupsReturn { groups: ComputedRef; separator: ComputedRef; /** Full N-layer display hierarchy; one level per group-name segment. */ groupTree: ComputedRef; /** Deepest layer count across the tree (1 when groups are flat). */ maxDepth: ComputedRef; hierarchicalGroups: ComputedRef; showHierarchy: ComputedRef; groupedSamples: ComputedRef>; ungroupedSamples: ComputedRef; findGroup: (groupName: string) => SampleGroup | undefined; getGroupColor: (groupName: string) => string; } /** Shared sample-group hierarchy, color, and ungrouped-sample derivation for lab selectors. */ export declare function useSampleGroups(options: UseSampleGroupsOptions): UseSampleGroupsReturn;