@gravionlabs/helix-code 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gravionlabs-helix-code-git.mjs","names":["nextId"],"sources":["../../../projects/code/git/src/changed-files/changed-files.ts","../../../projects/code/git/src/changed-files/changed-files.html","../../../projects/code/git/src/commit-layout.ts","../../../projects/code/git/src/commit-graph.ts","../../../projects/code/git/src/commit-graph.html","../../../projects/code/git/src/public-api.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n Directive,\n inject,\n input,\n output,\n signal,\n TemplateRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\n\n/** The state of a file in a change set. */\nexport type HxChangeStatus =\n | 'added'\n | 'modified'\n | 'deleted'\n | 'renamed'\n | 'untracked'\n | 'conflicted';\n\n/** One file of a change set. */\nexport interface HxChangedFile {\n readonly path: string;\n /** The previous path of a renamed file. */\n readonly oldPath?: string;\n readonly status: HxChangeStatus;\n readonly additions?: number;\n readonly deletions?: number;\n /** A binary file has no line counts. */\n readonly binary?: boolean;\n}\n\nconst STATUS: Record<HxChangeStatus, { letter: string; label: string }> = {\n added: { letter: 'A', label: 'Added' },\n modified: { letter: 'M', label: 'Modified' },\n deleted: { letter: 'D', label: 'Deleted' },\n renamed: { letter: 'R', label: 'Renamed' },\n untracked: { letter: 'U', label: 'Untracked' },\n conflicted: { letter: 'C', label: 'Conflicted' },\n};\n\n/**\n * Marks the `<ng-template>` that adds actions to each row of `hx-changed-files`. The context\n * `$implicit` is the `HxChangedFile` of the row.\n *\n * ```html\n * <hx-changed-files [files]=\"files\">\n * <ng-template hxChangedFileActions let-file><button>Stage {{ file.path }}</button></ng-template>\n * </hx-changed-files>\n * ```\n */\n@Directive({ selector: 'ng-template[hxChangedFileActions]' })\nexport class HxChangedFileActions {\n readonly template = inject<TemplateRef<{ $implicit: HxChangedFile }>>(TemplateRef);\n}\n\ninterface Row {\n readonly id: string;\n readonly file: HxChangedFile;\n readonly name: string;\n readonly folder: string;\n readonly letter: string;\n readonly label: string;\n readonly counts: boolean;\n}\n\nlet nextId = 0;\n\n/**\n * Lists the files of a change set with status, line counts and a header with the totals. One file\n * is selected; arrow keys move, Enter or Space selects.\n *\n * ```html\n * <hx-changed-files aria-label=\"Changes\" [files]=\"files\" [selected]=\"path\" (selectedChange)=\"path = $event\" />\n * ```\n */\n@Component({\n selector: 'hx-changed-files',\n imports: [NgTemplateOutlet],\n templateUrl: './changed-files.html',\n styleUrl: './changed-files.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'hx-changed-files',\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n },\n})\nexport class HxChangedFiles {\n readonly #uid = `hx-changed-files-${nextId++}`;\n\n /** The files of the change set. */\n readonly files = input.required<readonly HxChangedFile[]>();\n /** The path of the selected file. */\n readonly selected = input<string | null>(null);\n /** The accessible name of the list. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n /** Emits the path of the file the user selects. */\n readonly selectedChange = output<string>();\n\n protected readonly actions = contentChild(HxChangedFileActions);\n protected readonly active = signal(-1);\n\n protected readonly rows = computed<readonly Row[]>(() =>\n this.files().map((file, i) => {\n const slash = file.path.lastIndexOf('/');\n const { letter, label } = STATUS[file.status];\n return {\n id: `${this.#uid}-${i}`,\n file,\n name: file.path.slice(slash + 1),\n folder: slash < 0 ? '' : file.path.slice(0, slash),\n letter,\n label,\n counts: !file.binary && (file.additions !== undefined || file.deletions !== undefined),\n };\n }),\n );\n\n /** The index that holds the keyboard focus mark: the one moved to, else the selected one, else 0. */\n protected readonly activeIndex = computed(() => {\n const n = this.rows().length;\n if (n === 0) return -1;\n const a = this.active();\n if (a >= 0) return Math.min(a, n - 1);\n const s = this.rows().findIndex((r) => r.file.path === this.selected());\n return s >= 0 ? s : 0;\n });\n\n protected readonly activeId = computed(() => this.rows()[this.activeIndex()]?.id ?? null);\n\n protected readonly totals = computed(() => {\n let additions = 0;\n let deletions = 0;\n for (const f of this.files()) {\n additions += f.additions ?? 0;\n deletions += f.deletions ?? 0;\n }\n return { count: this.files().length, additions, deletions };\n });\n\n protected select(index: number): void {\n const row = this.rows()[index];\n if (!row) return;\n this.active.set(index);\n this.selectedChange.emit(row.file.path);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const n = this.rows().length;\n if (n === 0) return;\n const at = this.activeIndex();\n let next: number;\n switch (event.key) {\n case 'ArrowDown':\n next = Math.min(at + 1, n - 1);\n break;\n case 'ArrowUp':\n next = Math.max(at - 1, 0);\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = n - 1;\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n this.select(at);\n return;\n default:\n return;\n }\n event.preventDefault();\n this.active.set(next);\n document.getElementById(this.rows()[next].id)?.scrollIntoView?.({ block: 'nearest' });\n }\n}\n","<div class=\"hx-changed-files-header\" aria-live=\"polite\">\n <span class=\"hx-changed-files-count\"\n >{{ totals().count }} {{ totals().count === 1 ? 'file' : 'files' }}</span\n >\n <span class=\"hx-changed-files-add\">+{{ totals().additions }}</span>\n <span class=\"hx-changed-files-del\">−{{ totals().deletions }}</span>\n</div>\n<div\n class=\"hx-changed-files-list\"\n role=\"listbox\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-activedescendant]=\"activeId()\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (row of rows(); track row.file.path; let i = $index) {\n <div class=\"hx-changed-files-row\" role=\"none\">\n <!-- Keys are handled on the listbox (aria-activedescendant), so the options take no focus. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"hx-changed-files-option\"\n role=\"option\"\n [id]=\"row.id\"\n [attr.aria-selected]=\"row.file.path === selected()\"\n [class.is-selected]=\"row.file.path === selected()\"\n [class.is-active]=\"i === activeIndex()\"\n (click)=\"select(i)\"\n >\n <span\n class=\"hx-changed-files-status\"\n [attr.data-status]=\"row.file.status\"\n [attr.title]=\"row.label\"\n aria-hidden=\"true\"\n >{{ row.letter }}</span\n >\n <span class=\"hx-changed-files-sr\">{{ row.label }}, </span>\n <span class=\"hx-changed-files-path\">\n <span class=\"hx-changed-files-name\">{{ row.name }}</span>\n @if (row.folder) {\n <span class=\"hx-changed-files-folder\">{{ row.folder }}</span>\n }\n @if (row.file.oldPath) {\n <span class=\"hx-changed-files-old\">{{ row.file.oldPath }} →</span>\n }\n </span>\n @if (row.file.binary) {\n <span class=\"hx-changed-files-binary\">binary</span>\n } @else if (row.counts) {\n <span class=\"hx-changed-files-counts\">\n @if (row.file.additions !== undefined) {\n <span class=\"hx-changed-files-add\">+{{ row.file.additions }}</span>\n }\n @if (row.file.deletions !== undefined) {\n <span class=\"hx-changed-files-del\">−{{ row.file.deletions }}</span>\n }\n </span>\n }\n </div>\n @if (actions(); as a) {\n <span class=\"hx-changed-files-actions\">\n <ng-container *ngTemplateOutlet=\"a.template; context: { $implicit: row.file }\" />\n </span>\n }\n </div>\n }\n</div>\n","/** Number of line colors; matches `--hx-graph-lane-1` to `--hx-graph-lane-8`. */\nexport const HX_GRAPH_COLORS = 8;\n\nexport interface HxCommitRef {\n name: string;\n kind: 'branch' | 'remote' | 'tag' | 'head';\n}\n\nexport interface HxCommit {\n id: string;\n /** All parents; the first one is the main line. */\n parents: string[];\n message: string;\n author: string;\n /** Unix seconds. */\n time: number;\n refs?: HxCommitRef[];\n}\n\nexport interface HxGraphSegment {\n /** Lane at the top edge of the row. */\n fromLane: number;\n /** Lane at the bottom edge of the row. */\n toLane: number;\n /** Palette index 0 to 7. */\n color: number;\n kind: 'pass-through' | 'branch-out' | 'merge-in';\n}\n\nexport interface HxGraphRow {\n lane: number;\n /** Palette index of the line the commit sits on. */\n color: number;\n /**\n * True when a line enters the commit dot from the top edge (a lane expected\n * this commit). False for a branch tip.\n */\n hasIncoming: boolean;\n segments: HxGraphSegment[];\n}\n\nexport interface HxOpenLane {\n /** Id of the commit this lane expects next. */\n id: string;\n color: number;\n}\n\nexport interface HxLayoutState {\n /** Per lane: the open line, or `null` when the lane is free. */\n lanes: (HxOpenLane | null)[];\n /** Next value of the color counter (not reduced). */\n nextColor: number;\n}\n\nfunction lowestFree(lanes: (HxOpenLane | null)[]): number {\n const free = lanes.indexOf(null);\n return free === -1 ? lanes.length : free;\n}\n\n/**\n * Lays out commits for a graph. Input order is kept: a commit comes before its\n * parents. Pass the `state` of an earlier call as `previous` to continue a\n * layout page by page.\n */\nexport function hxLayoutCommits(\n commits: readonly HxCommit[],\n previous?: HxLayoutState,\n): { rows: HxGraphRow[]; state: HxLayoutState } {\n const lanes: (HxOpenLane | null)[] = previous ? [...previous.lanes] : [];\n let nextColor = previous?.nextColor ?? 0;\n const rows: HxGraphRow[] = [];\n\n for (const commit of commits) {\n const expecting: number[] = [];\n for (let i = 0; i < lanes.length; i++) {\n if (lanes[i]?.id === commit.id) expecting.push(i);\n }\n\n let lane: number;\n let color: number;\n const hasIncoming = expecting.length > 0;\n if (hasIncoming) {\n lane = expecting[0];\n color = lanes[lane]!.color;\n } else {\n lane = lowestFree(lanes);\n color = nextColor++ % HX_GRAPH_COLORS;\n }\n\n const segments: HxGraphSegment[] = [];\n const merged = new Set(expecting.slice(1));\n const [firstParent, ...otherParents] = commit.parents;\n\n // Lines that end here or pass by, in lane order.\n for (let i = 0; i < lanes.length; i++) {\n const open = lanes[i];\n if (!open) continue;\n if (merged.has(i)) {\n segments.push({ fromLane: i, toLane: lane, color: open.color, kind: 'merge-in' });\n lanes[i] = null;\n } else if (i !== lane) {\n segments.push({ fromLane: i, toLane: i, color: open.color, kind: 'pass-through' });\n }\n }\n\n // The commit's own line: the first parent continues in its lane.\n if (firstParent !== undefined) {\n lanes[lane] = { id: firstParent, color };\n segments.push({ fromLane: lane, toLane: lane, color, kind: 'pass-through' });\n } else {\n lanes[lane] = null;\n }\n\n for (const parent of otherParents) {\n const existing = lanes.findIndex((l) => l?.id === parent);\n if (existing !== -1) {\n segments.push({\n fromLane: lane,\n toLane: existing,\n color: lanes[existing]!.color,\n kind: 'branch-out',\n });\n } else {\n const target = lowestFree(lanes);\n const parentColor = nextColor++ % HX_GRAPH_COLORS;\n lanes[target] = { id: parent, color: parentColor };\n segments.push({ fromLane: lane, toLane: target, color: parentColor, kind: 'branch-out' });\n }\n }\n\n rows.push({ lane, color, hasIncoming, segments });\n }\n\n while (lanes.length > 0 && lanes[lanes.length - 1] === null) lanes.pop();\n return { rows, state: { lanes, nextColor } };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n Directive,\n effect,\n inject,\n input,\n output,\n signal,\n TemplateRef,\n untracked,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollViewport,\n} from '@angular/cdk/scrolling';\nimport {\n type HxCommit,\n type HxCommitRef,\n type HxGraphRow,\n type HxLayoutState,\n HX_GRAPH_COLORS,\n hxLayoutCommits,\n} from './commit-layout';\n\n/** Context of the `hxCommitGraphRowCell` template: `$implicit` is the commit, `row` its layout. */\nexport interface HxCommitGraphRowCellContext {\n $implicit: HxCommit;\n row: HxGraphRow;\n}\n\n/**\n * Marks the `<ng-template>` that renders extra content at the end of each row of `hx-commit-graph`.\n *\n * ```html\n * <hx-commit-graph [commits]=\"commits\">\n * <ng-template hxCommitGraphRowCell let-commit let-row=\"row\"><button>Pick</button></ng-template>\n * </hx-commit-graph>\n * ```\n */\n@Directive({ selector: 'ng-template[hxCommitGraphRowCell]' })\nexport class HxCommitGraphRowCell {\n readonly template = inject<TemplateRef<HxCommitGraphRowCellContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: HxCommitGraphRowCell,\n _ctx: unknown,\n ): _ctx is HxCommitGraphRowCellContext {\n return true;\n }\n}\n\n/** Width of one lane in SVG units (px); the default height of one row. */\nconst LANE_WIDTH = 16;\nconst ROW_HEIGHT = 28;\nconst DOT_RADIUS = 4;\n\ninterface Path {\n readonly d: string;\n readonly color: number;\n}\n\ninterface Dot {\n readonly cx: number;\n readonly color: number;\n readonly merge: boolean;\n}\n\ninterface Row {\n readonly id: string;\n readonly commit: HxCommit;\n readonly layout: HxGraphRow;\n readonly paths: readonly Path[];\n readonly dot: Dot;\n readonly name: string;\n readonly time: string;\n readonly refs: readonly { name: string; kind: HxCommitRef['kind'] }[];\n readonly subject: string;\n}\n\n/**\n * Builds the SVG shapes of one row of `rowHeight` px; lanes from `maxLanes - 1` on are folded into\n * the last lane.\n */\nexport function hxGraphRowShapes(\n layout: HxGraphRow,\n maxLanes: number,\n merge: boolean,\n rowHeight = ROW_HEIGHT,\n): { paths: Path[]; dot: Dot } {\n const last = Math.max(1, maxLanes) - 1;\n const x = (lane: number) => Math.min(lane, last) * LANE_WIDTH + LANE_WIDTH / 2;\n const cy = rowHeight / 2;\n\n // The line color of the last lane is fixed, so a folded line keeps its color from row to row.\n const lastColor = last % HX_GRAPH_COLORS;\n const colorAt = (lane: number, own: number) => (lane >= last ? lastColor : own);\n\n const paths: Path[] = [];\n const line = (x1: number, y1: number, x2: number, y2: number, color: number) => {\n if (x1 === x2) {\n paths.push({ d: `M${x1} ${y1}V${y2}`, color });\n } else {\n const ym = (y1 + y2) / 2;\n paths.push({ d: `M${x1} ${y1}C${x1} ${ym} ${x2} ${ym} ${x2} ${y2}`, color });\n }\n };\n\n if (layout.hasIncoming)\n line(x(layout.lane), 0, x(layout.lane), cy, colorAt(layout.lane, layout.color));\n for (const s of layout.segments) {\n const color = colorAt(Math.max(s.fromLane, s.toLane), s.color);\n switch (s.kind) {\n case 'pass-through':\n if (s.fromLane === layout.lane) line(x(s.fromLane), cy, x(s.toLane), rowHeight, color);\n else line(x(s.fromLane), 0, x(s.toLane), rowHeight, colorAt(s.fromLane, s.color));\n break;\n case 'merge-in':\n line(x(s.fromLane), 0, x(s.toLane), cy, colorAt(s.fromLane, s.color));\n break;\n case 'branch-out':\n line(x(s.fromLane), cy, x(s.toLane), rowHeight, colorAt(s.toLane, s.color));\n break;\n }\n }\n return {\n paths,\n dot: { cx: x(layout.lane), color: colorAt(layout.lane, layout.color), merge },\n };\n}\n\nconst MINUTE = 60;\nconst HOUR = 3600;\nconst DAY = 86400;\n\n/** Relative time (\"5 min ago\"); a date (`2026-01-31`) from 30 days on. */\nexport function hxFormatCommitTime(secs: number, now = Date.now() / 1000): string {\n const diff = Math.max(0, now - secs);\n if (diff < MINUTE) return 'just now';\n if (diff < HOUR) return `${Math.floor(diff / MINUTE)} min ago`;\n if (diff < DAY) return `${Math.floor(diff / HOUR)} h ago`;\n if (diff < 30 * DAY) return `${Math.floor(diff / DAY)} d ago`;\n return new Date(secs * 1000).toISOString().slice(0, 10);\n}\n\nconst REF_LABEL: Record<HxCommitRef['kind'], string> = {\n branch: 'Branch',\n remote: 'Remote branch',\n tag: 'Tag',\n head: 'HEAD',\n};\n\nlet nextId = 0;\n\ninterface Model {\n readonly rows: readonly Row[];\n /** Lanes the layout needs, before `maxLanes` limits them. */\n readonly lanes: number;\n /** Index of each commit id. */\n readonly index: ReadonlyMap<string, number>;\n /** `append` when the commits continued the previous list, else `full`. */\n readonly kind: 'append' | 'full';\n}\n\n/** What the model needs from the previous run to continue it. */\ninterface Cache {\n readonly commits: readonly HxCommit[];\n readonly state: HxLayoutState;\n readonly layout: readonly HxGraphRow[];\n readonly rows: readonly Row[];\n readonly lanes: number;\n readonly index: ReadonlyMap<string, number>;\n readonly format: (secs: number) => string;\n readonly maxLanes: number;\n readonly rowHeight: number;\n}\n\nfunction lanesOf(row: HxGraphRow, from: number): number {\n let n = Math.max(from, row.lane + 1);\n for (const s of row.segments) n = Math.max(n, s.fromLane + 1, s.toLane + 1);\n return n;\n}\n\n/**\n * Shows a commit history as rows: the graph, ref labels, message, author and time. One commit is\n * selected; arrow keys, Home and End move. Only the visible rows are in the DOM; `loadMore` asks\n * for the next page.\n *\n * ```html\n * <hx-commit-graph aria-label=\"History\" [commits]=\"commits\" [(selected)]=\"id\" />\n * ```\n */\n@Component({\n selector: 'hx-commit-graph',\n imports: [NgTemplateOutlet, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf],\n templateUrl: './commit-graph.html',\n styleUrl: './commit-graph.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'hx-commit-graph',\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n '[style.--hx-commit-graph-row-height]': 'rowHeight() + \"px\"',\n },\n})\nexport class HxCommitGraph {\n readonly #uid = `hx-commit-graph-${nextId++}`;\n #cache: Cache | null = null;\n #loadMoreFor = -1;\n\n /** The commits, a commit before its parents. */\n readonly commits = input.required<readonly HxCommit[]>();\n /** The id of the selected commit. */\n readonly selected = input<string | null>(null);\n /** Maximum number of lanes drawn; further lanes are folded into the last one. */\n readonly maxLanes = input(12);\n /** Height of one row in px. Rows and their SVG have exactly this height. */\n readonly rowHeight = input(ROW_HEIGHT);\n /** Rows rendered above and below the visible rows. */\n readonly buffer = input(5);\n /** Whether more commits can be loaded; `loadMore` fires only while this is true. */\n readonly hasMore = input(false);\n /** Whether a page is loading; shows a row with a spinner and holds back `loadMore`. */\n readonly loading = input(false);\n /** `loadMore` fires when the last rendered row is within this many rows of the end. */\n readonly loadMoreThreshold = input(20);\n /** Formats a Unix time in seconds; the default is relative (\"5 min ago\"). */\n readonly formatTime = input<(secs: number) => string>(hxFormatCommitTime);\n /** The accessible name of the list. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n /** Emits the id of the commit the user selects. */\n readonly selectedChange = output<string>();\n /** Emits when the user reaches the end of the loaded commits and `hasMore` is true. */\n readonly loadMore = output<void>();\n\n protected readonly rowCell = contentChild(HxCommitGraphRowCell);\n protected readonly viewport = viewChild(CdkVirtualScrollViewport);\n protected readonly active = signal<string | null>(null);\n protected readonly dotRadius = DOT_RADIUS;\n readonly #lastRendered = signal(-1);\n\n protected readonly bufferPx = computed(() => Math.max(0, this.buffer()) * this.rowHeight());\n\n protected readonly model = computed<Model>(() => {\n const commits = this.commits();\n const format = this.formatTime();\n const maxLanes = this.maxLanes();\n const rowHeight = this.rowHeight();\n const prev = this.#cache;\n const sameLook =\n !!prev &&\n prev.format === format &&\n prev.maxLanes === maxLanes &&\n prev.rowHeight === rowHeight;\n const append =\n !!prev &&\n commits.length >= prev.commits.length &&\n prev.commits.every((c, i) => commits[i]?.id === c.id);\n\n // A replaced list may have the same length as before: let it page again.\n if (!append) this.#loadMoreFor = -1;\n\n let state: HxLayoutState;\n let layout: readonly HxGraphRow[];\n if (append) {\n const more = hxLayoutCommits(commits.slice(prev.commits.length), prev.state);\n state = more.state;\n layout = prev.layout.concat(more.rows);\n } else {\n const full = hxLayoutCommits(commits);\n state = full.state;\n layout = full.rows;\n }\n\n // Rows of an unchanged look stay as they are; a changed look builds them all again.\n // Commit objects that changed (new refs, same id) need new rows.\n const keep = append && sameLook && prev.commits.every((c, i) => commits[i] === c);\n const from = keep ? prev.commits.length : 0;\n const built = keep ? prev.rows.slice() : [];\n const index = keep ? new Map(prev.index) : new Map<string, number>();\n let lanes = keep ? prev.lanes : 1;\n for (let i = from; i < commits.length; i++) {\n const commit = commits[i];\n lanes = lanesOf(layout[i], lanes);\n index.set(commit.id, i);\n built.push({\n id: `${this.#uid}-${i}`,\n commit,\n layout: layout[i],\n ...hxGraphRowShapes(layout[i], maxLanes, commit.parents.length > 1, rowHeight),\n name: commit.author,\n time: format(commit.time),\n subject: commit.message.split('\\n', 1)[0],\n refs: (commit.refs ?? []).map((r) => ({ name: r.name, kind: r.kind })),\n });\n }\n\n this.#cache = {\n commits,\n state,\n layout,\n rows: built,\n lanes,\n index,\n format,\n maxLanes,\n rowHeight,\n };\n return { rows: built, lanes, index, kind: append ? 'append' : 'full' };\n });\n\n protected readonly rows = computed(() => this.model().rows);\n\n /** Number of lanes the graph column shows. */\n protected readonly laneCount = computed(() =>\n Math.min(this.model().lanes, Math.max(1, this.maxLanes())),\n );\n\n protected readonly graphWidth = computed(() => this.laneCount() * LANE_WIDTH);\n\n protected readonly activeIndex = computed(() => {\n const n = this.rows().length;\n if (n === 0) return -1;\n const index = this.model().index;\n const a = this.active();\n const own = a === null ? undefined : index.get(a);\n if (own !== undefined) return own;\n return index.get(this.selected() ?? '') ?? 0;\n });\n\n protected readonly activeId = computed(() => this.rows()[this.activeIndex()]?.id ?? null);\n\n constructor() {\n // Follow the rendered range of the viewport.\n effect((onCleanup) => {\n const viewport = this.viewport();\n if (!viewport) return;\n this.#lastRendered.set(viewport.getRenderedRange().end - 1);\n const sub = viewport.renderedRangeStream.subscribe((r) => this.#lastRendered.set(r.end - 1));\n onCleanup(() => sub.unsubscribe());\n });\n\n // Page in the next commits once, until the list grows.\n effect(() => {\n this.model(); // a replaced list resets the guard below\n const length = this.commits().length;\n const last = this.#lastRendered();\n const near = last >= length - this.loadMoreThreshold();\n if (!this.hasMore() || this.loading() || length === 0 || !near) return;\n untracked(() => {\n if (this.#loadMoreFor === length) return;\n this.#loadMoreFor = length;\n this.loadMore.emit();\n });\n });\n\n // A list that did not continue the old one: keep the scroll position inside the new length.\n effect(() => {\n const model = this.model();\n const viewport = this.viewport();\n if (model.kind !== 'full' || !viewport) return;\n untracked(() => {\n const max = Math.max(0, model.rows.length * this.rowHeight() - viewport.getViewportSize());\n if (viewport.measureScrollOffset() > max) viewport.scrollToOffset(max);\n });\n });\n }\n\n /**\n * Scrolls a loaded commit to the nearest visible position. Returns `false`, without scrolling,\n * when the commit is not loaded.\n */\n reveal(id: string): boolean {\n const index = this.model().index.get(id);\n if (index === undefined) return false;\n this.#scrollTo(index);\n return true;\n }\n\n #scrollTo(index: number): void {\n const viewport = this.viewport();\n if (!viewport) return;\n const height = this.rowHeight();\n const top = index * height;\n const offset = viewport.measureScrollOffset();\n const size = viewport.getViewportSize();\n if (top < offset) viewport.scrollToOffset(top);\n else if (top + height > offset + size) viewport.scrollToOffset(top + height - size);\n }\n\n protected trackRow(_index: number, row: Row): string {\n return row.commit.id;\n }\n\n protected refLabel(kind: HxCommitRef['kind']): string {\n return REF_LABEL[kind];\n }\n\n protected label(row: Row): string {\n return `${row.subject}, ${row.name}, ${row.time}`;\n }\n\n protected select(index: number): void {\n const row = this.rows()[index];\n if (!row) return;\n this.active.set(row.commit.id);\n this.selectedChange.emit(row.commit.id);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const n = this.rows().length;\n if (n === 0) return;\n const at = this.activeIndex();\n let next: number;\n switch (event.key) {\n case 'ArrowDown':\n next = Math.min(at + 1, n - 1);\n break;\n case 'ArrowUp':\n next = Math.max(at - 1, 0);\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = n - 1;\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n this.select(at);\n return;\n default:\n return;\n }\n event.preventDefault();\n this.select(next);\n this.#scrollTo(next);\n }\n}\n","<cdk-virtual-scroll-viewport\n class=\"hx-commit-graph-list\"\n role=\"listbox\"\n tabindex=\"0\"\n [itemSize]=\"rowHeight()\"\n [minBufferPx]=\"bufferPx()\"\n [maxBufferPx]=\"bufferPx()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-activedescendant]=\"activeId()\"\n (keydown)=\"onKeydown($event)\"\n>\n <div\n *cdkVirtualFor=\"let row of rows(); let i = index; trackBy: trackRow\"\n class=\"hx-commit-graph-row\"\n role=\"none\"\n >\n <!-- Keys are handled on the listbox (aria-activedescendant), so the options take no focus. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"hx-commit-graph-option\"\n role=\"option\"\n [id]=\"row.id\"\n [attr.aria-label]=\"label(row)\"\n [attr.aria-posinset]=\"i + 1\"\n [attr.aria-setsize]=\"rows().length\"\n [attr.aria-selected]=\"row.commit.id === selected()\"\n [class.is-selected]=\"row.commit.id === selected()\"\n [class.is-active]=\"i === activeIndex()\"\n (click)=\"select(i)\"\n >\n <svg\n class=\"hx-commit-graph-svg\"\n aria-hidden=\"true\"\n [attr.width]=\"graphWidth()\"\n [attr.height]=\"rowHeight()\"\n >\n @for (p of row.paths; track $index) {\n <path class=\"hx-commit-graph-line\" [attr.d]=\"p.d\" [attr.data-color]=\"p.color\" />\n }\n <circle\n class=\"hx-commit-graph-dot\"\n [class.is-merge]=\"row.dot.merge\"\n [attr.data-color]=\"row.dot.color\"\n [attr.cx]=\"row.dot.cx\"\n [attr.cy]=\"rowHeight() / 2\"\n [attr.r]=\"row.dot.merge ? dotRadius + 1 : dotRadius\"\n />\n </svg>\n @for (ref of row.refs; track $index) {\n <span\n class=\"hx-commit-graph-ref\"\n [attr.data-kind]=\"ref.kind\"\n [attr.title]=\"refLabel(ref.kind)\"\n >{{ ref.name }}</span\n >\n }\n <span class=\"hx-commit-graph-message\" [attr.title]=\"row.commit.message\">{{\n row.subject\n }}</span>\n <span class=\"hx-commit-graph-author\">{{ row.name }}</span>\n <span class=\"hx-commit-graph-time\">{{ row.time }}</span>\n </div>\n @if (rowCell(); as cell) {\n <span class=\"hx-commit-graph-cell\">\n <ng-container\n *ngTemplateOutlet=\"cell.template; context: { $implicit: row.commit, row: row.layout }\"\n />\n </span>\n }\n </div>\n</cdk-virtual-scroll-viewport>\n@if (loading()) {\n <div class=\"hx-commit-graph-loading\" role=\"status\">\n <span class=\"hx-commit-graph-spinner\" aria-hidden=\"true\"></span>\n <span>Loading commits</span>\n </div>\n}\n","/** Version of `@gravionlabs/helix-code/git`. */\nexport const HELIX_CODE_GIT_VERSION = '0.1.0';\n\nexport {\n HxChangedFileActions,\n HxChangedFiles,\n type HxChangedFile,\n type HxChangeStatus,\n} from './changed-files/changed-files';\n\nexport {\n hxLayoutCommits,\n HX_GRAPH_COLORS,\n type HxCommit,\n type HxCommitRef,\n type HxGraphRow,\n type HxGraphSegment,\n type HxLayoutState,\n type HxOpenLane,\n} from './commit-layout';\n\nexport {\n HxCommitGraph,\n HxCommitGraphRowCell,\n hxFormatCommitTime,\n type HxCommitGraphRowCellContext,\n} from './commit-graph';\n"],"mappings":";;;;AAoCA,MAAM,SAAoE;CACxE,OAAO;EAAE,QAAQ;EAAK,OAAO;CAAO;CACpC,UAAU;EAAE,QAAQ;EAAK,OAAO;CAAU;CAC1C,SAAS;EAAE,QAAQ;EAAK,OAAO;CAAS;CACxC,SAAS;EAAE,QAAQ;EAAK,OAAO;CAAS;CACxC,WAAW;EAAE,QAAQ;EAAK,OAAO;CAAW;CAC5C,YAAY;EAAE,QAAQ;EAAK,OAAO;CAAY;AAC/C;AAaD,IAAa,uBAAb,MAAa,qBAAoB;CACtB,WAAW,OAAkD,WAAW;CADtE,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAApB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAoB,cAAA;EAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EADhC,MAAA;EAAU,MAAA,CAAA,EAAE,UAAU,oCAAmC,CAAE;;;AAe5D,IAAIA,WAAS;AAuBb,IAAa,iBAAb,MAAa,eAAc;CAChB,OAAO,oBAAoB;CAG3B,QAAQ,MAAM,SAAoC,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAA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