export abstract class TokenFlow { /** * The required number of children for this flow type, or null if there is no fixed requirement. */ get requiredLength(): number | null { return null; } /** * If a selection range extends from within one child to within another child, * this function determines whether a third child is considered to be "within" * those two children (inclusive of those two) for the purposes of selection highlighting. * @param anchorIndex The index of the first child in the selection range * @param headIndex The index of the second child in the selection range * @param otherIndex The index of the child to test * @returns Whether the child at otherIndex is between the children at anchorIndex and headIndex */ isWithin( anchorIndex: number, headIndex: number, otherIndex: number ): boolean { const minIndex = Math.min(anchorIndex, headIndex); const maxIndex = Math.max(anchorIndex, headIndex); return otherIndex >= minIndex && otherIndex <= maxIndex; } /** * When navigating vertically (e.g., with the up/down arrow keys), this function provides a list of candidate child indices * to move to from a given child index in the specified direction. * @param direction The direction of navigation ("up" or "down") * @param fromIndex The current child index * @returns An array of candidate child indices to navigate to */ verticalCandidates( _direction: "up" | "down", _fromIndex: number, _length: number ): number[] { return []; } }