import type { Adapter } from '@mui/x-scheduler-internals/use-adapter'; import type { SchedulerEventId, SchedulerEventOccurrence, SchedulerResource, SchedulerResourceId } from '@mui/x-scheduler-internals/models'; import { computeElementPositionInCollection } from '@mui/x-scheduler-internals/internals'; import type { TimelineAxis } from '@mui/x-scheduler-internals/internals'; import type { EventsCellLaneMetrics } from "../rowGeometry.mjs"; export interface DependencyArrowPoint { x: number; y: number; } export interface DependencyArrowAnchor { rowIndex: number; /** * The resource of the row: the appearance identity, since the occurrence (and its * key) repeats on every row of a multi-resource event. */ resourceId: SchedulerResourceId; occurrence: SchedulerEventOccurrence; } export interface DependencyArrowObstacle { occurrenceKey: string; x1: number; x2: number; y1: number; y2: number; } export interface DependencyAnchorResolverParameters { adapter: Adapter; /** * The visible resources with their occurrences, in row render order. */ resources: readonly { resource: SchedulerResource; occurrences: SchedulerEventOccurrence[]; }[]; /** * The y offset of each row in pixels, in the same order as `resources`. */ rowPositions: readonly number[]; /** * The visible date range and daily hour window the arrows are positioned in. */ axis: TimelineAxis; durationMs: number; /** * Positions already computed by the axis filter, when the hour window is trimmed. */ positionByOccurrenceKey?: ReadonlyMap> | null; /** * The width of the events area in pixels (tick count × tick width). */ eventsWidth: number; laneMetrics: EventsCellLaneMetrics; /** * When provided, the appearance lookup only indexes these events (the dependency * endpoints) on its single build pass; any other id — the in-flight creation's * events — falls back to a targeted scan cached per id. Without it every occurrence * gets an entry, which is pure allocation waste on large collections. */ endpointIds?: ReadonlySet; } export interface DependencyAnchorResolver { eventsWidth: number; /** * How far from the source anchor a route runs its horizontal detour. */ detourOffset: number; /** * The row appearances of an event. An event assigned to several resources appears * once in each of its rows. */ getAppearances: (eventId: SchedulerEventId) => readonly DependencyArrowAnchor[]; /** * Whether the row is laid out and can anchor an arrow. A row can briefly have no * position when the resources change before the virtualizer re-measures them. */ hasRowPosition: (rowIndex: number) => boolean; /** * The pixel point of an anchor's start or end edge, vertically centered on its lane. */ getEdgePoint: (anchor: DependencyArrowAnchor, edge: 'start' | 'end') => DependencyArrowPoint; /** * The cached position of an occurrence in the collection (fractions and edge * overflow flags), shared with the terminals overlay. */ getPosition: (occurrence: SchedulerEventOccurrence) => ReturnType; /** * The event boxes of a row, used to pick the elbow candidate crossing the fewest * events. */ getRowObstacles: (rowIndex: number) => DependencyArrowObstacle[]; } /** * Creates the anchor machinery shared by the dependency arrows and the provisional * (rubber-band) arrow. Anchors are derived from the data model (not measured on the * DOM) so arrows can reach events that the virtualizer did not mount. * Lookups are cached per instance: recreate the resolver when any parameter changes. */ export declare function createDependencyAnchorResolver(parameters: DependencyAnchorResolverParameters): DependencyAnchorResolver; /** * The pixel point of an event edge, used to anchor the provisional (rubber-band) * arrow. Anchors on the appearance matching the occurrence key and the resource (the * key alone repeats on every row of a multi-resource event), falling back to the * event's first appearance when they are `null` or unknown. `null` when the anchoring * appearance's row is not laid out. */ export declare function getEventEdgeAnchor(resolver: DependencyAnchorResolver, eventId: SchedulerEventId, edge: 'start' | 'end', occurrenceKey?: string | null, resourceId?: SchedulerResourceId | null): DependencyArrowPoint | null;