{"version":3,"file":"forty-cdk-table-virtualization.mjs","sources":["../../../projects/forty-cdk/table-virtualization/src/table-virtualized-navigator.ts","../../../projects/forty-cdk/table-virtualization/src/table-virtualized.ts","../../../projects/forty-cdk/table-virtualization/src/public-api.ts","../../../projects/forty-cdk/table-virtualization/src/forty-cdk-table-virtualization.ts"],"sourcesContent":["import { signal, type Signal } from '@angular/core';\n\nimport { type ForTableRowHandle } from 'forty-cdk/core';\n\n/**\n * An absolute `(rowIndex, 0-based column)` target awaiting the row to mount,\n * plus the travel `direction` used to step over full-span variant rows (which\n * register no cells and so cannot receive roving focus).\n */\ninterface PendingTarget {\n  readonly row: number;\n  readonly col: number;\n  readonly direction: 1 | -1;\n}\n\ntype ProbeResult = 'focused' | 'variant' | 'disabled' | 'unmounted';\n\n/**\n * Dependencies for `TableVirtualizedNavigator`. Wires the bridge to the table's\n * live row registry and the companion's scroll method.\n */\nexport interface TableVirtualizedNavigatorDeps {\n  /** Live registered data rows, so the bridge can resolve a pending target once it mounts. */\n  readonly rows: Signal<readonly ForTableRowHandle[]>;\n  /** Scroll the virtualizer so the row at the absolute index mounts. */\n  readonly scrollToRow: (index: number) => void;\n  /** The scroll container's bounding rect, or `null` before it is available. */\n  readonly scrollViewportRect: () => DOMRect | null;\n  /** The true total data-row count, used to clamp when stepping over variant rows. */\n  readonly rowCount: () => number;\n  /** The count of currently loaded data rows (the body dataset length), or `undefined` when unknown (raw-primitive rendering). Cross-window targets are clamped to this so an out-of-prefix row never stashes a pending focus move that can only resolve when a far page later loads. */\n  readonly loadedRowCount?: () => number | undefined;\n}\n\n/**\n * Cross-window keyboard-navigation bridge for a virtualized `[forTable]` grid,\n * owned by `[forTableVirtualized]`. The grid keeps roving-tabindex and renders\n * only a window of rows, so a navigation target can land on a row that is not\n * currently mounted. This bridge resolves that:\n *\n * - **Move** — `navigateTo(row, col, direction)` focuses the cell at the\n *   absolute `(row, col)` when its row is already rendered; otherwise it stashes\n *   the target and calls `scrollToRow(row)` to mount it.\n * - **Resolve** — once the freshly-mounted row registers, the companion's bridge\n *   effect calls `tryResolvePending`, which moves roving focus onto the target\n *   cell (its `(focus)` handler promotes it to the active roving cell) and clears\n *   the pending target.\n *\n * Full-span **variant rows** (group headers / separators / summary rows) mount\n * as a single presentational cell and register no cell handles, so they cannot\n * hold roving focus; likewise a mounted row whose target-column cell is\n * `disabled` (e.g. skeleton / placeholder rows) cannot receive focus. When a\n * target lands on either, the bridge steps `row` by `direction` (clamped to the\n * loaded prefix) to the adjacent enabled data cell — scrolling it in when it is\n * outside the window — and clears the target if the dataset bound is reached\n * with no landable data row in that direction, so a stale target can never\n * later steal focus.\n *\n * Off-prefix targets are clamped to the last loaded row: when `loadedRowCount`\n * is smaller than the total `rowCount` (a server-paged grid whose far pages are\n * not yet loaded), a target beyond the loaded prefix restarts at the last loaded\n * row searching upward, so a Ctrl+End / Page / Arrow move can never stash a\n * pending focus that only resolves — and steals focus — when a far page later\n * mounts.\n *\n * Mirrors the 1D `ListboxVirtualizedNavigator` precedent, adapted to the table's\n * roving + focused-row-retention model. Internal — not re-exported from\n * `table/index.ts` or `public-api.ts`.\n */\nexport class TableVirtualizedNavigator {\n  readonly #deps: TableVirtualizedNavigatorDeps;\n\n  readonly #pending = signal<PendingTarget | null>(null);\n\n  constructor(deps: TableVirtualizedNavigatorDeps) {\n    this.#deps = deps;\n  }\n\n  /**\n   * Move roving focus to the data cell at the absolute `(row, col)`, travelling\n   * in `direction` (`+1` down / `-1` up) so full-span variant rows are stepped\n   * over. When the target row is already rendered as a data row, focuses\n   * immediately. Otherwise stashes the target and scrolls it into the window;\n   * the bridge effect resolves it once the row mounts.\n   */\n  navigateTo(row: number, col: number, direction: 1 | -1): void {\n    this.#resolve(row, col, direction);\n  }\n\n  /** Scroll the virtualizer so the row at the absolute `index` is in the window. */\n  scrollToRow(index: number): void {\n    this.#deps.scrollToRow(index);\n  }\n\n  /** The scroll container's bounding rect, or `null` before it is available. */\n  scrollViewportRect(): DOMRect | null {\n    return this.#deps.scrollViewportRect();\n  }\n\n  /**\n   * Resolve a pending cross-window navigation: once the row carrying the pending\n   * absolute index mounts, focus its cell and clear the pending target. Returns\n   * `true` when a pending request was resolved, `false` otherwise. Called from\n   * the companion's bridge effect whenever the rendered rows change.\n   */\n  tryResolvePending(): boolean {\n    const pending = this.#pending();\n    if (pending === null) {\n      return false;\n    }\n    return this.#resolve(pending.row, pending.col, pending.direction);\n  }\n\n  /**\n   * Drop any stashed cross-window target. `ForTable` calls this on the next\n   * keyboard interaction that reaches the grid, so a pending move set by an\n   * earlier Ctrl+End / Page / Arrow is superseded rather than teleporting focus\n   * when a far page later mounts.\n   */\n  clearPending(): void {\n    this.#pending.set(null);\n  }\n\n  #resolve(row: number, col: number, direction: 1 | -1): boolean {\n    const count = this.#deps.rowCount();\n    const bound = Math.min(this.#deps.loadedRowCount?.() ?? count, count);\n    let target = row;\n    let dir = direction;\n    if (bound > 0 && target >= bound) {\n      target = bound - 1;\n      dir = -1;\n    }\n    while (target >= 0 && target < bound) {\n      const result = this.#probeCell(target, col);\n      if (result === 'focused') {\n        this.#pending.set(null);\n        return true;\n      }\n      if (result === 'unmounted') {\n        const current = this.#pending();\n        const unchanged =\n          current !== null &&\n          current.row === target &&\n          current.col === col &&\n          current.direction === dir;\n        if (!unchanged) {\n          this.#pending.set({ row: target, col, direction: dir });\n          this.#deps.scrollToRow(target);\n        }\n        return false;\n      }\n      target += dir;\n    }\n    this.#pending.set(null);\n    return false;\n  }\n\n  #probeCell(row: number, col: number): ProbeResult {\n    const handle = this.#deps.rows().find((r) => r.virtualIndex() === row);\n    if (!handle) {\n      return 'unmounted';\n    }\n    const cells = handle.cells();\n    const cell = cells[col] ?? cells[cells.length - 1];\n    if (!cell) {\n      return 'variant';\n    }\n    if (cell.disabled()) {\n      return 'disabled';\n    }\n    cell.host.focus();\n    return 'focused';\n  }\n}\n","import {\n  computed,\n  DestroyRef,\n  Directive,\n  effect,\n  ElementRef,\n  inject,\n  input,\n  numberAttribute,\n} from '@angular/core';\n\nimport {\n  orphanContextError,\n  TABLE_REGISTRATION_CONTEXT,\n  type TableRegistrationContext,\n} from 'forty-cdk/core';\nimport { FOR_TABLE_CONTEXT, type ForTableContext } from 'forty-cdk/table';\nimport { injectVirtualizer, type VirtualItem } from 'forty-cdk/virtualization';\n\nimport { TableVirtualizedNavigator } from './table-virtualized-navigator';\n\nfunction injectTableContext(): ForTableContext {\n  const ctx = inject(FOR_TABLE_CONTEXT, { optional: true });\n  if (!ctx) {\n    throw orphanContextError({\n      code: 'FORCDK-TABLE-VIRTUALIZATION-001',\n      piece: 'ForTableVirtualized',\n      root: '[forTable]',\n      token: 'FOR_TABLE_CONTEXT',\n    });\n  }\n  return ctx;\n}\n\nfunction injectTableRegistration(): TableRegistrationContext {\n  const registration = inject(TABLE_REGISTRATION_CONTEXT, { optional: true });\n  if (!registration) {\n    throw orphanContextError({\n      code: 'FORCDK-TABLE-VIRTUALIZATION-002',\n      piece: 'ForTableVirtualized',\n      root: '[forTable]',\n      token: 'TABLE_REGISTRATION_CONTEXT',\n    });\n  }\n  return registration;\n}\n\n/**\n * Opt-in row-virtualization companion for `[forTable]` in `<div role>` grid mode. Place it on the\n * same element as `[forTable]`; it builds the windowing core from the table's `[rowCount]` and\n * exposes the visible window for the consumer to render with their own `@for` + position transform.\n *\n * Tree-shakeable: `ForTable` never imports the virtualization core — only consumers that import\n * `ForTableVirtualized` bundle `@tanstack/virtual-core`.\n *\n * The focused row is kept mounted even when scrolled out of the window so the roving-focused\n * `gridcell` is never unmounted. SSR-safe: off-browser the window is empty and\n * `totalSize` is the estimate-based total.\n *\n * Also drives cross-window keyboard navigation: when an Arrow / Page / Ctrl+Home / Ctrl+End grid\n * action resolves a row outside the rendered window, it scrolls that row into view and moves roving\n * focus onto the target cell once it mounts (preserving the current column). `ForTable` stays\n * unaware of virtualization — it delegates the row-crossing move through the table context.\n */\n@Directive({\n  selector: '[forTableVirtualized]',\n  exportAs: 'forTableVirtualized',\n})\nexport class ForTableVirtualized {\n  readonly #ctx = injectTableContext();\n  readonly #registration = injectTableRegistration();\n  readonly #rootEl = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n  /** Estimated row size in px along the scroll axis (the fixed-size fast path). Read for the size estimate. */\n  readonly estimateRowSize = input(44, { transform: numberAttribute });\n\n  /**\n   * Scroll container. Defaults to the table root element (the scroll container in `<div>` grid\n   * mode). Bind it explicitly when the scroll container is an **ancestor** of the table — e.g. an\n   * app-shell viewport that scrolls projected content — since the table cannot inject an ancestor\n   * it does not own. A design-system wrapper can re-expose or rename this input through\n   * `hostDirectives` input aliasing (`inputs: ['scrollElement: scrollContainer']`) with no bridging\n   * effect required.\n   */\n  readonly scrollElement = input<HTMLElement | null>(null);\n\n  readonly #scrollElement = computed(() => this.scrollElement() ?? this.#rootEl);\n  readonly #rowCount = computed(() => this.#ctx.rowCount() ?? 0);\n\n  readonly #virtualizer = injectVirtualizer({\n    count: this.#rowCount,\n    estimateSize: () => this.estimateRowSize(),\n    scrollElement: this.#scrollElement,\n  });\n\n  readonly #navigator = new TableVirtualizedNavigator({\n    rows: this.#registration.rows,\n    scrollToRow: (index) => this.scrollToRow(index),\n    scrollViewportRect: () => this.#scrollElement().getBoundingClientRect(),\n    rowCount: this.#rowCount,\n    loadedRowCount: () => this.#ctx.loadedRowCount(),\n  });\n\n  constructor() {\n    this.#registration.registerVirtualNavigation(this.#navigator);\n    this.#registration.registerVirtualWindow({\n      rows: this.virtualRows,\n      totalSize: this.totalSize,\n      measureRow: (element) => this.measureRow(element),\n    });\n    inject(DestroyRef).onDestroy(() => {\n      this.#registration.registerVirtualNavigation(null);\n      this.#registration.registerVirtualWindow(null);\n    });\n    effect(() => {\n      this.#registration.rows();\n      this.#navigator.tryResolvePending();\n    });\n  }\n\n  /**\n   * The rows in the visible window plus overscan, augmented to always include the focused row and\n   * the row being reordered even when they are scrolled out of view (so the roving-focused cell\n   * stays mounted, and a pointer reorder drag never unmounts the lifted row). Render these with\n   * `@for (vrow of v.virtualRows(); track vrow.index)` and position each row absolutely with\n   * `transform: translateY(vrow.start + 'px')`. Bind each row's `[virtualIndex]=\"vrow.index\"`.\n   */\n  readonly virtualRows = computed<readonly VirtualItem[]>(() => {\n    const items = this.#virtualizer.virtualItems();\n    const retain = new Set<number>();\n    const focused = this.#ctx.focusedRowIndex();\n    if (focused !== null) {\n      retain.add(focused);\n    }\n    const reordering = this.#registration.reorderingRowIndex();\n    if (reordering !== null) {\n      retain.add(reordering);\n    }\n    for (const it of items) {\n      retain.delete(it.index);\n    }\n    if (retain.size === 0) {\n      return items;\n    }\n    const size = this.estimateRowSize();\n    const retained: VirtualItem[] = [...retain].map(\n      (index) =>\n        this.#virtualizer.measurementFor(index) ?? { index, key: index, start: index * size, size },\n    );\n    return [...items, ...retained].sort((a, b) => a.index - b.index);\n  });\n\n  /** Total scroll size of all rows in px. Bind to the body container's height to size the scroll range. */\n  readonly totalSize = this.#virtualizer.totalSize;\n\n  /**\n   * The rendered window as the inclusive-exclusive `[firstIndex, lastIndex + 1)` index range,\n   * sourced from the underlying virtualizer (the true window) — not from {@link virtualRows},\n   * which is augmented with the focused / reordering rows. So a row retained out of the window\n   * never widens this range. Plugs straight into `injectInfiniteScroll({ range, count, onLoadMore })`.\n   */\n  readonly range = this.#virtualizer.range;\n\n  /**\n   * Scroll the container so the row at `index` is in view. Cross-window keyboard\n   * navigation calls this internally; consumers may also call it to scroll\n   * programmatically.\n   */\n  scrollToRow(index: number, options?: { align?: 'start' | 'center' | 'end' | 'auto' }): void {\n    this.#virtualizer.scrollToIndex(index, options);\n  }\n\n  /**\n   * Record the measured size of a rendered row element (dynamic / measured row heights).\n   * Passing `null` sweeps evicted rows recycled out of the window from the measurement cache.\n   */\n  measureRow(element: HTMLElement | null): void {\n    this.#virtualizer.measureElement(element);\n  }\n}\n","/*\n * Public API surface of forty-cdk/table-virtualization.\n *\n * The `[forTableVirtualized]` adapter ships from its own secondary entry point\n * because it composes two primitives: it reads the table's context and\n * registration surface from `forty-cdk/table` and builds its window with\n * `forty-cdk/virtualization`. Keeping it here is what lets `forty-cdk/virtualization`\n * stay free of any other primitive's module graph, so a consumer virtualizing a\n * plain list never resolves the table entry point.\n */\n\nexport { ForTableVirtualized } from './table-virtualized';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;MACU,yBAAyB,CAAA;AAC3B,IAAA,KAAK;IAEL,QAAQ,GAAG,MAAM,CAAuB,IAAI;iFAAC;AAEtD,IAAA,WAAA,CAAY,IAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;IACnB;AAEA;;;;;;AAMG;AACH,IAAA,UAAU,CAAC,GAAW,EAAE,GAAW,EAAE,SAAiB,EAAA;QACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC;IACpC;;AAGA,IAAA,WAAW,CAAC,KAAa,EAAA;AACvB,QAAA,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;IAC/B;;IAGA,kBAAkB,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE;IACxC;AAEA;;;;;AAKG;IACH,iBAAiB,GAAA;AACf,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE;AAC/B,QAAA,IAAI,OAAO,KAAK,IAAI,EAAE;AACpB,YAAA,OAAO,KAAK;QACd;AACA,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC;IACnE;AAEA;;;;;AAKG;IACH,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;IACzB;AAEA,IAAA,QAAQ,CAAC,GAAW,EAAE,GAAW,EAAE,SAAiB,EAAA;Q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