@gravionlabs/helix-code 0.0.0-stage → 22.8.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,974 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Directive, TemplateRef, ViewEncapsulation, computed, contentChild, effect, inject, input, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet } from "@angular/common";
4
+ import { CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport } from "@angular/cdk/scrolling";
5
+ const STATUS = {
6
+ added: {
7
+ letter: "A",
8
+ label: "Added"
9
+ },
10
+ modified: {
11
+ letter: "M",
12
+ label: "Modified"
13
+ },
14
+ deleted: {
15
+ letter: "D",
16
+ label: "Deleted"
17
+ },
18
+ renamed: {
19
+ letter: "R",
20
+ label: "Renamed"
21
+ },
22
+ untracked: {
23
+ letter: "U",
24
+ label: "Untracked"
25
+ },
26
+ conflicted: {
27
+ letter: "C",
28
+ label: "Conflicted"
29
+ }
30
+ };
31
+ var HxChangedFileActions = class HxChangedFileActions {
32
+ template = inject(TemplateRef);
33
+ static ɵfac = i0.ɵɵngDeclareFactory({
34
+ minVersion: "12.0.0",
35
+ version: "22.3.0",
36
+ ngImport: i0,
37
+ type: HxChangedFileActions,
38
+ deps: [],
39
+ target: i0.ɵɵFactoryTarget.Directive
40
+ });
41
+ static ɵdir = i0.ɵɵngDeclareDirective({
42
+ minVersion: "14.0.0",
43
+ version: "22.3.0",
44
+ type: HxChangedFileActions,
45
+ isStandalone: true,
46
+ selector: "ng-template[hxChangedFileActions]",
47
+ ngImport: i0
48
+ });
49
+ };
50
+ i0.ɵɵngDeclareClassMetadata({
51
+ minVersion: "12.0.0",
52
+ version: "22.3.0",
53
+ ngImport: i0,
54
+ type: HxChangedFileActions,
55
+ decorators: [{
56
+ type: Directive,
57
+ args: [{ selector: "ng-template[hxChangedFileActions]" }]
58
+ }]
59
+ });
60
+ let nextId$1 = 0;
61
+ var HxChangedFiles = class HxChangedFiles {
62
+ #uid = `hx-changed-files-${nextId$1++}`;
63
+ files = input.required(...ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []);
64
+ selected = input(null, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
65
+ ariaLabel = input(null, {
66
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
67
+ alias: "aria-label"
68
+ });
69
+ ariaLabelledby = input(null, {
70
+ ...ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {},
71
+ alias: "aria-labelledby"
72
+ });
73
+ selectedChange = output();
74
+ actions = contentChild(HxChangedFileActions, ...ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []);
75
+ active = signal(-1, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
76
+ rows = computed(() => this.files().map((file, i) => {
77
+ const slash = file.path.lastIndexOf("/");
78
+ const { letter, label } = STATUS[file.status];
79
+ return {
80
+ id: `${this.#uid}-${i}`,
81
+ file,
82
+ name: file.path.slice(slash + 1),
83
+ folder: slash < 0 ? "" : file.path.slice(0, slash),
84
+ letter,
85
+ label,
86
+ counts: !file.binary && (file.additions !== void 0 || file.deletions !== void 0)
87
+ };
88
+ }), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
89
+ activeIndex = computed(() => {
90
+ const n = this.rows().length;
91
+ if (n === 0) return -1;
92
+ const a = this.active();
93
+ if (a >= 0) return Math.min(a, n - 1);
94
+ const s = this.rows().findIndex((r) => r.file.path === this.selected());
95
+ return s >= 0 ? s : 0;
96
+ }, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
97
+ activeId = computed(() => this.rows()[this.activeIndex()]?.id ?? null, ...ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []);
98
+ totals = computed(() => {
99
+ let additions = 0;
100
+ let deletions = 0;
101
+ for (const f of this.files()) {
102
+ additions += f.additions ?? 0;
103
+ deletions += f.deletions ?? 0;
104
+ }
105
+ return {
106
+ count: this.files().length,
107
+ additions,
108
+ deletions
109
+ };
110
+ }, ...ngDevMode ? [{ debugName: "totals" }] : /* istanbul ignore next */ []);
111
+ select(index) {
112
+ const row = this.rows()[index];
113
+ if (!row) return;
114
+ this.active.set(index);
115
+ this.selectedChange.emit(row.file.path);
116
+ }
117
+ onKeydown(event) {
118
+ const n = this.rows().length;
119
+ if (n === 0) return;
120
+ const at = this.activeIndex();
121
+ let next;
122
+ switch (event.key) {
123
+ case "ArrowDown":
124
+ next = Math.min(at + 1, n - 1);
125
+ break;
126
+ case "ArrowUp":
127
+ next = Math.max(at - 1, 0);
128
+ break;
129
+ case "Home":
130
+ next = 0;
131
+ break;
132
+ case "End":
133
+ next = n - 1;
134
+ break;
135
+ case "Enter":
136
+ case " ":
137
+ event.preventDefault();
138
+ this.select(at);
139
+ return;
140
+ default: return;
141
+ }
142
+ event.preventDefault();
143
+ this.active.set(next);
144
+ document.getElementById(this.rows()[next].id)?.scrollIntoView?.({ block: "nearest" });
145
+ }
146
+ static ɵfac = i0.ɵɵngDeclareFactory({
147
+ minVersion: "12.0.0",
148
+ version: "22.3.0",
149
+ ngImport: i0,
150
+ type: HxChangedFiles,
151
+ deps: [],
152
+ target: i0.ɵɵFactoryTarget.Component
153
+ });
154
+ static ɵcmp = i0.ɵɵngDeclareComponent({
155
+ minVersion: "17.0.0",
156
+ version: "22.3.0",
157
+ type: HxChangedFiles,
158
+ isStandalone: true,
159
+ selector: "hx-changed-files",
160
+ inputs: {
161
+ files: {
162
+ classPropertyName: "files",
163
+ publicName: "files",
164
+ isSignal: true,
165
+ isRequired: true,
166
+ transformFunction: null
167
+ },
168
+ selected: {
169
+ classPropertyName: "selected",
170
+ publicName: "selected",
171
+ isSignal: true,
172
+ isRequired: false,
173
+ transformFunction: null
174
+ },
175
+ ariaLabel: {
176
+ classPropertyName: "ariaLabel",
177
+ publicName: "aria-label",
178
+ isSignal: true,
179
+ isRequired: false,
180
+ transformFunction: null
181
+ },
182
+ ariaLabelledby: {
183
+ classPropertyName: "ariaLabelledby",
184
+ publicName: "aria-labelledby",
185
+ isSignal: true,
186
+ isRequired: false,
187
+ transformFunction: null
188
+ }
189
+ },
190
+ outputs: { selectedChange: "selectedChange" },
191
+ host: {
192
+ properties: {
193
+ "attr.aria-label": "null",
194
+ "attr.aria-labelledby": "null"
195
+ },
196
+ classAttribute: "hx-changed-files"
197
+ },
198
+ queries: [{
199
+ propertyName: "actions",
200
+ first: true,
201
+ predicate: HxChangedFileActions,
202
+ descendants: true,
203
+ isSignal: true
204
+ }],
205
+ ngImport: i0,
206
+ template: "<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",
207
+ styles: [":host{display:block;border:1px solid var(--h-content-border-color);border-radius:var(--h-border-radius, 6px);overflow:hidden;font-size:.875rem}.hx-changed-files-header{display:flex;gap:.75rem;padding:.375rem .75rem;border-bottom:1px solid var(--h-content-border-color);color:var(--h-text-muted-color, inherit)}.hx-changed-files-list{max-height:100%;overflow:auto;outline:none}.hx-changed-files-list:focus-visible{outline:2px solid var(--p-primary-color, currentcolor);outline-offset:-2px}.hx-changed-files-row{display:flex;align-items:center}.hx-changed-files-option{display:flex;flex:1;min-width:0;align-items:center;gap:.5rem;padding:.25rem .75rem;cursor:pointer}.hx-changed-files-option:hover{background:color-mix(in srgb,currentcolor 6%,transparent)}.hx-changed-files-option.is-selected{background:color-mix(in srgb,var(--p-primary-color, currentcolor) 15%,transparent)}.hx-changed-files-option.is-active{box-shadow:inset 2px 0 0 var(--p-primary-color, currentcolor)}.hx-changed-files-status{flex:none;width:1.25rem;text-align:center;font-weight:600;font-family:monospace}.hx-changed-files-status[data-status=added],.hx-changed-files-status[data-status=untracked]{color:var(--hx-changed-added-color, var(--h-green-700))}.hx-changed-files-status[data-status=deleted],.hx-changed-files-status[data-status=conflicted]{color:var(--hx-changed-removed-color, var(--h-red-700))}.hx-changed-files-status[data-status=modified]{color:var(--p-primary-color, currentcolor)}.hx-changed-files-status[data-status=renamed]{color:var(--h-text-muted-color, currentcolor)}.hx-changed-files-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.hx-changed-files-path{display:flex;flex:1;min-width:0;gap:.5rem;white-space:nowrap}.hx-changed-files-name{flex:none}.hx-changed-files-folder,.hx-changed-files-old,.hx-changed-files-binary{overflow:hidden;text-overflow:ellipsis;color:var(--h-text-muted-color, inherit)}.hx-changed-files-counts{display:flex;flex:none;gap:.5rem}.hx-changed-files-add{color:var(--hx-changed-added-color, var(--h-green-700))}.hx-changed-files-del{color:var(--hx-changed-removed-color, var(--h-red-700))}.hx-changed-files-actions{display:flex;flex:none;gap:.25rem;padding-right:.5rem}\n"],
208
+ dependencies: [{
209
+ kind: "directive",
210
+ type: NgTemplateOutlet,
211
+ selector: "[ngTemplateOutlet]",
212
+ inputs: [
213
+ "ngTemplateOutletContext",
214
+ "ngTemplateOutlet",
215
+ "ngTemplateOutletInjector"
216
+ ]
217
+ }],
218
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
219
+ });
220
+ };
221
+ i0.ɵɵngDeclareClassMetadata({
222
+ minVersion: "12.0.0",
223
+ version: "22.3.0",
224
+ ngImport: i0,
225
+ type: HxChangedFiles,
226
+ decorators: [{
227
+ type: Component,
228
+ args: [{
229
+ selector: "hx-changed-files",
230
+ imports: [NgTemplateOutlet],
231
+ encapsulation: ViewEncapsulation.Emulated,
232
+ changeDetection: ChangeDetectionStrategy.OnPush,
233
+ host: {
234
+ class: "hx-changed-files",
235
+ "[attr.aria-label]": "null",
236
+ "[attr.aria-labelledby]": "null"
237
+ },
238
+ template: "<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",
239
+ styles: [":host{display:block;border:1px solid var(--h-content-border-color);border-radius:var(--h-border-radius, 6px);overflow:hidden;font-size:.875rem}.hx-changed-files-header{display:flex;gap:.75rem;padding:.375rem .75rem;border-bottom:1px solid var(--h-content-border-color);color:var(--h-text-muted-color, inherit)}.hx-changed-files-list{max-height:100%;overflow:auto;outline:none}.hx-changed-files-list:focus-visible{outline:2px solid var(--p-primary-color, currentcolor);outline-offset:-2px}.hx-changed-files-row{display:flex;align-items:center}.hx-changed-files-option{display:flex;flex:1;min-width:0;align-items:center;gap:.5rem;padding:.25rem .75rem;cursor:pointer}.hx-changed-files-option:hover{background:color-mix(in srgb,currentcolor 6%,transparent)}.hx-changed-files-option.is-selected{background:color-mix(in srgb,var(--p-primary-color, currentcolor) 15%,transparent)}.hx-changed-files-option.is-active{box-shadow:inset 2px 0 0 var(--p-primary-color, currentcolor)}.hx-changed-files-status{flex:none;width:1.25rem;text-align:center;font-weight:600;font-family:monospace}.hx-changed-files-status[data-status=added],.hx-changed-files-status[data-status=untracked]{color:var(--hx-changed-added-color, var(--h-green-700))}.hx-changed-files-status[data-status=deleted],.hx-changed-files-status[data-status=conflicted]{color:var(--hx-changed-removed-color, var(--h-red-700))}.hx-changed-files-status[data-status=modified]{color:var(--p-primary-color, currentcolor)}.hx-changed-files-status[data-status=renamed]{color:var(--h-text-muted-color, currentcolor)}.hx-changed-files-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.hx-changed-files-path{display:flex;flex:1;min-width:0;gap:.5rem;white-space:nowrap}.hx-changed-files-name{flex:none}.hx-changed-files-folder,.hx-changed-files-old,.hx-changed-files-binary{overflow:hidden;text-overflow:ellipsis;color:var(--h-text-muted-color, inherit)}.hx-changed-files-counts{display:flex;flex:none;gap:.5rem}.hx-changed-files-add{color:var(--hx-changed-added-color, var(--h-green-700))}.hx-changed-files-del{color:var(--hx-changed-removed-color, var(--h-red-700))}.hx-changed-files-actions{display:flex;flex:none;gap:.25rem;padding-right:.5rem}\n"]
240
+ }]
241
+ }],
242
+ propDecorators: {
243
+ files: [{
244
+ type: i0.Input,
245
+ args: [{
246
+ isSignal: true,
247
+ alias: "files",
248
+ required: true
249
+ }]
250
+ }],
251
+ selected: [{
252
+ type: i0.Input,
253
+ args: [{
254
+ isSignal: true,
255
+ alias: "selected",
256
+ required: false
257
+ }]
258
+ }],
259
+ ariaLabel: [{
260
+ type: i0.Input,
261
+ args: [{
262
+ isSignal: true,
263
+ alias: "aria-label",
264
+ required: false
265
+ }]
266
+ }],
267
+ ariaLabelledby: [{
268
+ type: i0.Input,
269
+ args: [{
270
+ isSignal: true,
271
+ alias: "aria-labelledby",
272
+ required: false
273
+ }]
274
+ }],
275
+ selectedChange: [{
276
+ type: i0.Output,
277
+ args: ["selectedChange"]
278
+ }],
279
+ actions: [{
280
+ type: i0.ContentChild,
281
+ args: [i0.forwardRef(() => HxChangedFileActions), { isSignal: true }]
282
+ }]
283
+ }
284
+ });
285
+ const HX_GRAPH_COLORS = 8;
286
+ function lowestFree(lanes) {
287
+ const free = lanes.indexOf(null);
288
+ return free === -1 ? lanes.length : free;
289
+ }
290
+ function hxLayoutCommits(commits, previous) {
291
+ const lanes = previous ? [...previous.lanes] : [];
292
+ let nextColor = previous?.nextColor ?? 0;
293
+ const rows = [];
294
+ for (const commit of commits) {
295
+ const expecting = [];
296
+ for (let i = 0; i < lanes.length; i++) if (lanes[i]?.id === commit.id) expecting.push(i);
297
+ let lane;
298
+ let color;
299
+ const hasIncoming = expecting.length > 0;
300
+ if (hasIncoming) {
301
+ lane = expecting[0];
302
+ color = lanes[lane].color;
303
+ } else {
304
+ lane = lowestFree(lanes);
305
+ color = nextColor++ % 8;
306
+ }
307
+ const segments = [];
308
+ const merged = new Set(expecting.slice(1));
309
+ const [firstParent, ...otherParents] = commit.parents;
310
+ for (let i = 0; i < lanes.length; i++) {
311
+ const open = lanes[i];
312
+ if (!open) continue;
313
+ if (merged.has(i)) {
314
+ segments.push({
315
+ fromLane: i,
316
+ toLane: lane,
317
+ color: open.color,
318
+ kind: "merge-in"
319
+ });
320
+ lanes[i] = null;
321
+ } else if (i !== lane) segments.push({
322
+ fromLane: i,
323
+ toLane: i,
324
+ color: open.color,
325
+ kind: "pass-through"
326
+ });
327
+ }
328
+ if (firstParent !== void 0) {
329
+ lanes[lane] = {
330
+ id: firstParent,
331
+ color
332
+ };
333
+ segments.push({
334
+ fromLane: lane,
335
+ toLane: lane,
336
+ color,
337
+ kind: "pass-through"
338
+ });
339
+ } else lanes[lane] = null;
340
+ for (const parent of otherParents) {
341
+ const existing = lanes.findIndex((l) => l?.id === parent);
342
+ if (existing !== -1) segments.push({
343
+ fromLane: lane,
344
+ toLane: existing,
345
+ color: lanes[existing].color,
346
+ kind: "branch-out"
347
+ });
348
+ else {
349
+ const target = lowestFree(lanes);
350
+ const parentColor = nextColor++ % 8;
351
+ lanes[target] = {
352
+ id: parent,
353
+ color: parentColor
354
+ };
355
+ segments.push({
356
+ fromLane: lane,
357
+ toLane: target,
358
+ color: parentColor,
359
+ kind: "branch-out"
360
+ });
361
+ }
362
+ }
363
+ rows.push({
364
+ lane,
365
+ color,
366
+ hasIncoming,
367
+ segments
368
+ });
369
+ }
370
+ while (lanes.length > 0 && lanes[lanes.length - 1] === null) lanes.pop();
371
+ return {
372
+ rows,
373
+ state: {
374
+ lanes,
375
+ nextColor
376
+ }
377
+ };
378
+ }
379
+ var HxCommitGraphRowCell = class HxCommitGraphRowCell {
380
+ template = inject(TemplateRef);
381
+ static ngTemplateContextGuard(_dir, _ctx) {
382
+ return true;
383
+ }
384
+ static ɵfac = i0.ɵɵngDeclareFactory({
385
+ minVersion: "12.0.0",
386
+ version: "22.3.0",
387
+ ngImport: i0,
388
+ type: HxCommitGraphRowCell,
389
+ deps: [],
390
+ target: i0.ɵɵFactoryTarget.Directive
391
+ });
392
+ static ɵdir = i0.ɵɵngDeclareDirective({
393
+ minVersion: "14.0.0",
394
+ version: "22.3.0",
395
+ type: HxCommitGraphRowCell,
396
+ isStandalone: true,
397
+ selector: "ng-template[hxCommitGraphRowCell]",
398
+ ngImport: i0
399
+ });
400
+ };
401
+ i0.ɵɵngDeclareClassMetadata({
402
+ minVersion: "12.0.0",
403
+ version: "22.3.0",
404
+ ngImport: i0,
405
+ type: HxCommitGraphRowCell,
406
+ decorators: [{
407
+ type: Directive,
408
+ args: [{ selector: "ng-template[hxCommitGraphRowCell]" }]
409
+ }]
410
+ });
411
+ const LANE_WIDTH = 16;
412
+ const ROW_HEIGHT = 28;
413
+ const DOT_RADIUS = 4;
414
+ function hxGraphRowShapes(layout, maxLanes, merge, rowHeight = ROW_HEIGHT) {
415
+ const last = Math.max(1, maxLanes) - 1;
416
+ const x = (lane) => Math.min(lane, last) * LANE_WIDTH + LANE_WIDTH / 2;
417
+ const cy = rowHeight / 2;
418
+ const lastColor = last % 8;
419
+ const colorAt = (lane, own) => lane >= last ? lastColor : own;
420
+ const paths = [];
421
+ const line = (x1, y1, x2, y2, color) => {
422
+ if (x1 === x2) paths.push({
423
+ d: `M${x1} ${y1}V${y2}`,
424
+ color
425
+ });
426
+ else {
427
+ const ym = (y1 + y2) / 2;
428
+ paths.push({
429
+ d: `M${x1} ${y1}C${x1} ${ym} ${x2} ${ym} ${x2} ${y2}`,
430
+ color
431
+ });
432
+ }
433
+ };
434
+ if (layout.hasIncoming) line(x(layout.lane), 0, x(layout.lane), cy, colorAt(layout.lane, layout.color));
435
+ for (const s of layout.segments) {
436
+ const color = colorAt(Math.max(s.fromLane, s.toLane), s.color);
437
+ switch (s.kind) {
438
+ case "pass-through":
439
+ if (s.fromLane === layout.lane) line(x(s.fromLane), cy, x(s.toLane), rowHeight, color);
440
+ else line(x(s.fromLane), 0, x(s.toLane), rowHeight, colorAt(s.fromLane, s.color));
441
+ break;
442
+ case "merge-in":
443
+ line(x(s.fromLane), 0, x(s.toLane), cy, colorAt(s.fromLane, s.color));
444
+ break;
445
+ case "branch-out": line(x(s.fromLane), cy, x(s.toLane), rowHeight, colorAt(s.toLane, s.color));
446
+ }
447
+ }
448
+ return {
449
+ paths,
450
+ dot: {
451
+ cx: x(layout.lane),
452
+ color: colorAt(layout.lane, layout.color),
453
+ merge
454
+ }
455
+ };
456
+ }
457
+ const MINUTE = 60;
458
+ const HOUR = 3600;
459
+ const DAY = 86400;
460
+ function hxFormatCommitTime(secs, now = Date.now() / 1e3) {
461
+ const diff = Math.max(0, now - secs);
462
+ if (diff < MINUTE) return "just now";
463
+ if (diff < HOUR) return `${Math.floor(diff / MINUTE)} min ago`;
464
+ if (diff < DAY) return `${Math.floor(diff / HOUR)} h ago`;
465
+ if (diff < 30 * DAY) return `${Math.floor(diff / DAY)} d ago`;
466
+ return (/* @__PURE__ */ new Date(secs * 1e3)).toISOString().slice(0, 10);
467
+ }
468
+ const REF_LABEL = {
469
+ branch: "Branch",
470
+ remote: "Remote branch",
471
+ tag: "Tag",
472
+ head: "HEAD"
473
+ };
474
+ let nextId = 0;
475
+ function lanesOf(row, from) {
476
+ let n = Math.max(from, row.lane + 1);
477
+ for (const s of row.segments) n = Math.max(n, s.fromLane + 1, s.toLane + 1);
478
+ return n;
479
+ }
480
+ var HxCommitGraph = class HxCommitGraph {
481
+ #uid = `hx-commit-graph-${nextId++}`;
482
+ #cache = null;
483
+ #loadMoreFor = -1;
484
+ commits = input.required(...ngDevMode ? [{ debugName: "commits" }] : /* istanbul ignore next */ []);
485
+ selected = input(null, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
486
+ maxLanes = input(12, ...ngDevMode ? [{ debugName: "maxLanes" }] : /* istanbul ignore next */ []);
487
+ rowHeight = input(ROW_HEIGHT, ...ngDevMode ? [{ debugName: "rowHeight" }] : /* istanbul ignore next */ []);
488
+ buffer = input(5, ...ngDevMode ? [{ debugName: "buffer" }] : /* istanbul ignore next */ []);
489
+ hasMore = input(false, ...ngDevMode ? [{ debugName: "hasMore" }] : /* istanbul ignore next */ []);
490
+ loading = input(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
491
+ loadMoreThreshold = input(20, ...ngDevMode ? [{ debugName: "loadMoreThreshold" }] : /* istanbul ignore next */ []);
492
+ formatTime = input(hxFormatCommitTime, ...ngDevMode ? [{ debugName: "formatTime" }] : /* istanbul ignore next */ []);
493
+ ariaLabel = input(null, {
494
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
495
+ alias: "aria-label"
496
+ });
497
+ ariaLabelledby = input(null, {
498
+ ...ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {},
499
+ alias: "aria-labelledby"
500
+ });
501
+ selectedChange = output();
502
+ loadMore = output();
503
+ rowCell = contentChild(HxCommitGraphRowCell, ...ngDevMode ? [{ debugName: "rowCell" }] : /* istanbul ignore next */ []);
504
+ viewport = viewChild(CdkVirtualScrollViewport, ...ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []);
505
+ active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
506
+ dotRadius = DOT_RADIUS;
507
+ #lastRendered = signal(-1, ...ngDevMode ? [{ debugName: "#lastRendered" }] : /* istanbul ignore next */ []);
508
+ bufferPx = computed(() => Math.max(0, this.buffer()) * this.rowHeight(), ...ngDevMode ? [{ debugName: "bufferPx" }] : /* istanbul ignore next */ []);
509
+ model = computed(() => {
510
+ const commits = this.commits();
511
+ const format = this.formatTime();
512
+ const maxLanes = this.maxLanes();
513
+ const rowHeight = this.rowHeight();
514
+ const prev = this.#cache;
515
+ const sameLook = !!prev && prev.format === format && prev.maxLanes === maxLanes && prev.rowHeight === rowHeight;
516
+ const append = !!prev && commits.length >= prev.commits.length && prev.commits.every((c, i) => commits[i]?.id === c.id);
517
+ if (!append) this.#loadMoreFor = -1;
518
+ let state;
519
+ let layout;
520
+ if (append) {
521
+ const more = hxLayoutCommits(commits.slice(prev.commits.length), prev.state);
522
+ state = more.state;
523
+ layout = prev.layout.concat(more.rows);
524
+ } else {
525
+ const full = hxLayoutCommits(commits);
526
+ state = full.state;
527
+ layout = full.rows;
528
+ }
529
+ const keep = append && sameLook && prev.commits.every((c, i) => commits[i] === c);
530
+ const from = keep ? prev.commits.length : 0;
531
+ const built = keep ? prev.rows.slice() : [];
532
+ const index = keep ? new Map(prev.index) : /* @__PURE__ */ new Map();
533
+ let lanes = keep ? prev.lanes : 1;
534
+ for (let i = from; i < commits.length; i++) {
535
+ const commit = commits[i];
536
+ lanes = lanesOf(layout[i], lanes);
537
+ index.set(commit.id, i);
538
+ built.push({
539
+ id: `${this.#uid}-${i}`,
540
+ commit,
541
+ layout: layout[i],
542
+ ...hxGraphRowShapes(layout[i], maxLanes, commit.parents.length > 1, rowHeight),
543
+ name: commit.author,
544
+ time: format(commit.time),
545
+ subject: commit.message.split("\n", 1)[0],
546
+ refs: (commit.refs ?? []).map((r) => ({
547
+ name: r.name,
548
+ kind: r.kind
549
+ }))
550
+ });
551
+ }
552
+ this.#cache = {
553
+ commits,
554
+ state,
555
+ layout,
556
+ rows: built,
557
+ lanes,
558
+ index,
559
+ format,
560
+ maxLanes,
561
+ rowHeight
562
+ };
563
+ return {
564
+ rows: built,
565
+ lanes,
566
+ index,
567
+ kind: append ? "append" : "full"
568
+ };
569
+ }, ...ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []);
570
+ rows = computed(() => this.model().rows, ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
571
+ laneCount = computed(() => Math.min(this.model().lanes, Math.max(1, this.maxLanes())), ...ngDevMode ? [{ debugName: "laneCount" }] : /* istanbul ignore next */ []);
572
+ graphWidth = computed(() => this.laneCount() * LANE_WIDTH, ...ngDevMode ? [{ debugName: "graphWidth" }] : /* istanbul ignore next */ []);
573
+ activeIndex = computed(() => {
574
+ if (this.rows().length === 0) return -1;
575
+ const index = this.model().index;
576
+ const a = this.active();
577
+ const own = a === null ? void 0 : index.get(a);
578
+ if (own !== void 0) return own;
579
+ return index.get(this.selected() ?? "") ?? 0;
580
+ }, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
581
+ activeId = computed(() => this.rows()[this.activeIndex()]?.id ?? null, ...ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []);
582
+ constructor() {
583
+ effect((onCleanup) => {
584
+ const viewport = this.viewport();
585
+ if (!viewport) return;
586
+ this.#lastRendered.set(viewport.getRenderedRange().end - 1);
587
+ const sub = viewport.renderedRangeStream.subscribe((r) => this.#lastRendered.set(r.end - 1));
588
+ onCleanup(() => sub.unsubscribe());
589
+ });
590
+ effect(() => {
591
+ this.model();
592
+ const length = this.commits().length;
593
+ const near = this.#lastRendered() >= length - this.loadMoreThreshold();
594
+ if (!this.hasMore() || this.loading() || length === 0 || !near) return;
595
+ untracked(() => {
596
+ if (this.#loadMoreFor === length) return;
597
+ this.#loadMoreFor = length;
598
+ this.loadMore.emit();
599
+ });
600
+ });
601
+ effect(() => {
602
+ const model = this.model();
603
+ const viewport = this.viewport();
604
+ if (model.kind !== "full" || !viewport) return;
605
+ untracked(() => {
606
+ const max = Math.max(0, model.rows.length * this.rowHeight() - viewport.getViewportSize());
607
+ if (viewport.measureScrollOffset() > max) viewport.scrollToOffset(max);
608
+ });
609
+ });
610
+ }
611
+ reveal(id) {
612
+ const index = this.model().index.get(id);
613
+ if (index === void 0) return false;
614
+ this.#scrollTo(index);
615
+ return true;
616
+ }
617
+ #scrollTo(index) {
618
+ const viewport = this.viewport();
619
+ if (!viewport) return;
620
+ const height = this.rowHeight();
621
+ const top = index * height;
622
+ const offset = viewport.measureScrollOffset();
623
+ const size = viewport.getViewportSize();
624
+ if (top < offset) viewport.scrollToOffset(top);
625
+ else if (top + height > offset + size) viewport.scrollToOffset(top + height - size);
626
+ }
627
+ trackRow(_index, row) {
628
+ return row.commit.id;
629
+ }
630
+ refLabel(kind) {
631
+ return REF_LABEL[kind];
632
+ }
633
+ label(row) {
634
+ return `${row.subject}, ${row.name}, ${row.time}`;
635
+ }
636
+ select(index) {
637
+ const row = this.rows()[index];
638
+ if (!row) return;
639
+ this.active.set(row.commit.id);
640
+ this.selectedChange.emit(row.commit.id);
641
+ }
642
+ onKeydown(event) {
643
+ const n = this.rows().length;
644
+ if (n === 0) return;
645
+ const at = this.activeIndex();
646
+ let next;
647
+ switch (event.key) {
648
+ case "ArrowDown":
649
+ next = Math.min(at + 1, n - 1);
650
+ break;
651
+ case "ArrowUp":
652
+ next = Math.max(at - 1, 0);
653
+ break;
654
+ case "Home":
655
+ next = 0;
656
+ break;
657
+ case "End":
658
+ next = n - 1;
659
+ break;
660
+ case "Enter":
661
+ case " ":
662
+ event.preventDefault();
663
+ this.select(at);
664
+ return;
665
+ default: return;
666
+ }
667
+ event.preventDefault();
668
+ this.select(next);
669
+ this.#scrollTo(next);
670
+ }
671
+ static ɵfac = i0.ɵɵngDeclareFactory({
672
+ minVersion: "12.0.0",
673
+ version: "22.3.0",
674
+ ngImport: i0,
675
+ type: HxCommitGraph,
676
+ deps: [],
677
+ target: i0.ɵɵFactoryTarget.Component
678
+ });
679
+ static ɵcmp = i0.ɵɵngDeclareComponent({
680
+ minVersion: "17.0.0",
681
+ version: "22.3.0",
682
+ type: HxCommitGraph,
683
+ isStandalone: true,
684
+ selector: "hx-commit-graph",
685
+ inputs: {
686
+ commits: {
687
+ classPropertyName: "commits",
688
+ publicName: "commits",
689
+ isSignal: true,
690
+ isRequired: true,
691
+ transformFunction: null
692
+ },
693
+ selected: {
694
+ classPropertyName: "selected",
695
+ publicName: "selected",
696
+ isSignal: true,
697
+ isRequired: false,
698
+ transformFunction: null
699
+ },
700
+ maxLanes: {
701
+ classPropertyName: "maxLanes",
702
+ publicName: "maxLanes",
703
+ isSignal: true,
704
+ isRequired: false,
705
+ transformFunction: null
706
+ },
707
+ rowHeight: {
708
+ classPropertyName: "rowHeight",
709
+ publicName: "rowHeight",
710
+ isSignal: true,
711
+ isRequired: false,
712
+ transformFunction: null
713
+ },
714
+ buffer: {
715
+ classPropertyName: "buffer",
716
+ publicName: "buffer",
717
+ isSignal: true,
718
+ isRequired: false,
719
+ transformFunction: null
720
+ },
721
+ hasMore: {
722
+ classPropertyName: "hasMore",
723
+ publicName: "hasMore",
724
+ isSignal: true,
725
+ isRequired: false,
726
+ transformFunction: null
727
+ },
728
+ loading: {
729
+ classPropertyName: "loading",
730
+ publicName: "loading",
731
+ isSignal: true,
732
+ isRequired: false,
733
+ transformFunction: null
734
+ },
735
+ loadMoreThreshold: {
736
+ classPropertyName: "loadMoreThreshold",
737
+ publicName: "loadMoreThreshold",
738
+ isSignal: true,
739
+ isRequired: false,
740
+ transformFunction: null
741
+ },
742
+ formatTime: {
743
+ classPropertyName: "formatTime",
744
+ publicName: "formatTime",
745
+ isSignal: true,
746
+ isRequired: false,
747
+ transformFunction: null
748
+ },
749
+ ariaLabel: {
750
+ classPropertyName: "ariaLabel",
751
+ publicName: "aria-label",
752
+ isSignal: true,
753
+ isRequired: false,
754
+ transformFunction: null
755
+ },
756
+ ariaLabelledby: {
757
+ classPropertyName: "ariaLabelledby",
758
+ publicName: "aria-labelledby",
759
+ isSignal: true,
760
+ isRequired: false,
761
+ transformFunction: null
762
+ }
763
+ },
764
+ outputs: {
765
+ selectedChange: "selectedChange",
766
+ loadMore: "loadMore"
767
+ },
768
+ host: {
769
+ properties: {
770
+ "attr.aria-label": "null",
771
+ "attr.aria-labelledby": "null",
772
+ "style.--hx-commit-graph-row-height": "rowHeight() + \"px\""
773
+ },
774
+ classAttribute: "hx-commit-graph"
775
+ },
776
+ queries: [{
777
+ propertyName: "rowCell",
778
+ first: true,
779
+ predicate: HxCommitGraphRowCell,
780
+ descendants: true,
781
+ isSignal: true
782
+ }],
783
+ viewQueries: [{
784
+ propertyName: "viewport",
785
+ first: true,
786
+ predicate: CdkVirtualScrollViewport,
787
+ descendants: true,
788
+ isSignal: true
789
+ }],
790
+ ngImport: i0,
791
+ template: "<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",
792
+ styles: [":host{display:flex;flex-direction:column;height:var(--hx-commit-graph-height, 24rem);--hx-commit-graph-row-height: 28px;--hx-graph-lane-1: #2563eb;--hx-graph-lane-2: #15803d;--hx-graph-lane-3: #c2410c;--hx-graph-lane-4: #7e22ce;--hx-graph-lane-5: #0f766e;--hx-graph-lane-6: #be185d;--hx-graph-lane-7: #a16207;--hx-graph-lane-8: #0e7490;border:1px solid var(--h-content-border-color);border-radius:var(--h-border-radius, 6px);overflow:hidden;font-size:.875rem}:host-context(.app-dark){--hx-graph-lane-1: #60a5fa;--hx-graph-lane-2: #4ade80;--hx-graph-lane-3: #fb923c;--hx-graph-lane-4: #c084fc;--hx-graph-lane-5: #2dd4bf;--hx-graph-lane-6: #f472b6;--hx-graph-lane-7: #facc15;--hx-graph-lane-8: #22d3ee}.hx-commit-graph-list{flex:1;min-height:0;outline:none}.hx-commit-graph-list:focus-visible{outline:2px solid var(--p-primary-color, currentcolor);outline-offset:-2px}.hx-commit-graph-row{display:flex;box-sizing:border-box;height:var(--hx-commit-graph-row-height);align-items:center}.hx-commit-graph-option{display:flex;height:100%;flex:1;min-width:0;align-items:center;gap:.5rem;padding-right:.75rem;cursor:pointer}.hx-commit-graph-option:hover{background:color-mix(in srgb,currentcolor 6%,transparent)}.hx-commit-graph-option.is-selected{background:color-mix(in srgb,var(--p-primary-color, currentcolor) 15%,transparent)}.hx-commit-graph-option.is-active{box-shadow:inset 2px 0 0 var(--p-primary-color, currentcolor)}.hx-commit-graph-svg{display:block;flex:none;fill:none}.hx-commit-graph-line{stroke-width:2;stroke-linecap:round}.hx-commit-graph-dot{stroke-width:2}.hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"0\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-1)}[data-color=\"0\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-1);fill:var(--hx-graph-lane-1)}[data-color=\"0\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"1\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-2)}[data-color=\"1\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-2);fill:var(--hx-graph-lane-2)}[data-color=\"1\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"2\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-3)}[data-color=\"2\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-3);fill:var(--hx-graph-lane-3)}[data-color=\"2\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"3\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-4)}[data-color=\"3\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-4);fill:var(--hx-graph-lane-4)}[data-color=\"3\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"4\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-5)}[data-color=\"4\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-5);fill:var(--hx-graph-lane-5)}[data-color=\"4\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"5\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-6)}[data-color=\"5\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-6);fill:var(--hx-graph-lane-6)}[data-color=\"5\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"6\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-7)}[data-color=\"6\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-7);fill:var(--hx-graph-lane-7)}[data-color=\"6\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"7\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-8)}[data-color=\"7\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-8);fill:var(--hx-graph-lane-8)}[data-color=\"7\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}.hx-commit-graph-ref{flex:none;padding:0 .375rem;border:1px solid currentcolor;border-radius:999px;font-size:.75rem;white-space:nowrap}.hx-commit-graph-ref[data-kind=branch]{color:var(--p-primary-color, currentcolor)}.hx-commit-graph-ref[data-kind=remote]{border-style:dashed;color:var(--h-text-muted-color, currentcolor)}.hx-commit-graph-ref[data-kind=tag]{border-radius:2px;color:var(--hx-changed-added-color, var(--h-green-700))}.hx-commit-graph-ref[data-kind=head]{border-width:2px;font-weight:700}.hx-commit-graph-message{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hx-commit-graph-author,.hx-commit-graph-time{flex:none;color:var(--h-text-muted-color, inherit);white-space:nowrap}.hx-commit-graph-cell{display:flex;flex:none;gap:.25rem;padding-right:.5rem}.hx-commit-graph-loading{display:flex;height:var(--hx-commit-graph-row-height);flex:none;align-items:center;gap:.5rem;padding:0 .75rem;border-top:1px solid var(--h-content-border-color);color:var(--h-text-muted-color, inherit)}.hx-commit-graph-spinner{width:1rem;height:1rem;border:2px solid currentcolor;border-radius:50%;border-right-color:transparent;animation:hx-commit-graph-spin .8s linear infinite}@media(prefers-reduced-motion:reduce){.hx-commit-graph-spinner{animation-duration:4s}}@keyframes hx-commit-graph-spin{to{transform:rotate(360deg)}}\n"],
793
+ dependencies: [
794
+ {
795
+ kind: "directive",
796
+ type: NgTemplateOutlet,
797
+ selector: "[ngTemplateOutlet]",
798
+ inputs: [
799
+ "ngTemplateOutletContext",
800
+ "ngTemplateOutlet",
801
+ "ngTemplateOutletInjector"
802
+ ]
803
+ },
804
+ {
805
+ kind: "component",
806
+ type: CdkVirtualScrollViewport,
807
+ selector: "cdk-virtual-scroll-viewport",
808
+ inputs: ["orientation", "appendOnly"],
809
+ outputs: ["scrolledIndexChange"]
810
+ },
811
+ {
812
+ kind: "directive",
813
+ type: CdkFixedSizeVirtualScroll,
814
+ selector: "cdk-virtual-scroll-viewport[itemSize]",
815
+ inputs: [
816
+ "itemSize",
817
+ "minBufferPx",
818
+ "maxBufferPx"
819
+ ]
820
+ },
821
+ {
822
+ kind: "directive",
823
+ type: CdkVirtualForOf,
824
+ selector: "[cdkVirtualFor][cdkVirtualForOf]",
825
+ inputs: [
826
+ "cdkVirtualForOf",
827
+ "cdkVirtualForTrackBy",
828
+ "cdkVirtualForTemplate",
829
+ "cdkVirtualForTemplateCacheSize"
830
+ ]
831
+ }
832
+ ],
833
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
834
+ });
835
+ };
836
+ i0.ɵɵngDeclareClassMetadata({
837
+ minVersion: "12.0.0",
838
+ version: "22.3.0",
839
+ ngImport: i0,
840
+ type: HxCommitGraph,
841
+ decorators: [{
842
+ type: Component,
843
+ args: [{
844
+ selector: "hx-commit-graph",
845
+ imports: [
846
+ NgTemplateOutlet,
847
+ CdkVirtualScrollViewport,
848
+ CdkFixedSizeVirtualScroll,
849
+ CdkVirtualForOf
850
+ ],
851
+ encapsulation: ViewEncapsulation.Emulated,
852
+ changeDetection: ChangeDetectionStrategy.OnPush,
853
+ host: {
854
+ class: "hx-commit-graph",
855
+ "[attr.aria-label]": "null",
856
+ "[attr.aria-labelledby]": "null",
857
+ "[style.--hx-commit-graph-row-height]": "rowHeight() + \"px\""
858
+ },
859
+ template: "<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",
860
+ styles: [":host{display:flex;flex-direction:column;height:var(--hx-commit-graph-height, 24rem);--hx-commit-graph-row-height: 28px;--hx-graph-lane-1: #2563eb;--hx-graph-lane-2: #15803d;--hx-graph-lane-3: #c2410c;--hx-graph-lane-4: #7e22ce;--hx-graph-lane-5: #0f766e;--hx-graph-lane-6: #be185d;--hx-graph-lane-7: #a16207;--hx-graph-lane-8: #0e7490;border:1px solid var(--h-content-border-color);border-radius:var(--h-border-radius, 6px);overflow:hidden;font-size:.875rem}:host-context(.app-dark){--hx-graph-lane-1: #60a5fa;--hx-graph-lane-2: #4ade80;--hx-graph-lane-3: #fb923c;--hx-graph-lane-4: #c084fc;--hx-graph-lane-5: #2dd4bf;--hx-graph-lane-6: #f472b6;--hx-graph-lane-7: #facc15;--hx-graph-lane-8: #22d3ee}.hx-commit-graph-list{flex:1;min-height:0;outline:none}.hx-commit-graph-list:focus-visible{outline:2px solid var(--p-primary-color, currentcolor);outline-offset:-2px}.hx-commit-graph-row{display:flex;box-sizing:border-box;height:var(--hx-commit-graph-row-height);align-items:center}.hx-commit-graph-option{display:flex;height:100%;flex:1;min-width:0;align-items:center;gap:.5rem;padding-right:.75rem;cursor:pointer}.hx-commit-graph-option:hover{background:color-mix(in srgb,currentcolor 6%,transparent)}.hx-commit-graph-option.is-selected{background:color-mix(in srgb,var(--p-primary-color, currentcolor) 15%,transparent)}.hx-commit-graph-option.is-active{box-shadow:inset 2px 0 0 var(--p-primary-color, currentcolor)}.hx-commit-graph-svg{display:block;flex:none;fill:none}.hx-commit-graph-line{stroke-width:2;stroke-linecap:round}.hx-commit-graph-dot{stroke-width:2}.hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"0\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-1)}[data-color=\"0\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-1);fill:var(--hx-graph-lane-1)}[data-color=\"0\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"1\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-2)}[data-color=\"1\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-2);fill:var(--hx-graph-lane-2)}[data-color=\"1\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"2\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-3)}[data-color=\"2\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-3);fill:var(--hx-graph-lane-3)}[data-color=\"2\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"3\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-4)}[data-color=\"3\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-4);fill:var(--hx-graph-lane-4)}[data-color=\"3\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"4\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-5)}[data-color=\"4\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-5);fill:var(--hx-graph-lane-5)}[data-color=\"4\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"5\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-6)}[data-color=\"5\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-6);fill:var(--hx-graph-lane-6)}[data-color=\"5\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"6\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-7)}[data-color=\"6\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-7);fill:var(--hx-graph-lane-7)}[data-color=\"6\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}[data-color=\"7\"].hx-commit-graph-line{stroke:var(--hx-graph-lane-8)}[data-color=\"7\"].hx-commit-graph-dot{stroke:var(--hx-graph-lane-8);fill:var(--hx-graph-lane-8)}[data-color=\"7\"].hx-commit-graph-dot.is-merge{fill:var(--h-content-background)}.hx-commit-graph-ref{flex:none;padding:0 .375rem;border:1px solid currentcolor;border-radius:999px;font-size:.75rem;white-space:nowrap}.hx-commit-graph-ref[data-kind=branch]{color:var(--p-primary-color, currentcolor)}.hx-commit-graph-ref[data-kind=remote]{border-style:dashed;color:var(--h-text-muted-color, currentcolor)}.hx-commit-graph-ref[data-kind=tag]{border-radius:2px;color:var(--hx-changed-added-color, var(--h-green-700))}.hx-commit-graph-ref[data-kind=head]{border-width:2px;font-weight:700}.hx-commit-graph-message{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hx-commit-graph-author,.hx-commit-graph-time{flex:none;color:var(--h-text-muted-color, inherit);white-space:nowrap}.hx-commit-graph-cell{display:flex;flex:none;gap:.25rem;padding-right:.5rem}.hx-commit-graph-loading{display:flex;height:var(--hx-commit-graph-row-height);flex:none;align-items:center;gap:.5rem;padding:0 .75rem;border-top:1px solid var(--h-content-border-color);color:var(--h-text-muted-color, inherit)}.hx-commit-graph-spinner{width:1rem;height:1rem;border:2px solid currentcolor;border-radius:50%;border-right-color:transparent;animation:hx-commit-graph-spin .8s linear infinite}@media(prefers-reduced-motion:reduce){.hx-commit-graph-spinner{animation-duration:4s}}@keyframes hx-commit-graph-spin{to{transform:rotate(360deg)}}\n"]
861
+ }]
862
+ }],
863
+ ctorParameters: () => [],
864
+ propDecorators: {
865
+ commits: [{
866
+ type: i0.Input,
867
+ args: [{
868
+ isSignal: true,
869
+ alias: "commits",
870
+ required: true
871
+ }]
872
+ }],
873
+ selected: [{
874
+ type: i0.Input,
875
+ args: [{
876
+ isSignal: true,
877
+ alias: "selected",
878
+ required: false
879
+ }]
880
+ }],
881
+ maxLanes: [{
882
+ type: i0.Input,
883
+ args: [{
884
+ isSignal: true,
885
+ alias: "maxLanes",
886
+ required: false
887
+ }]
888
+ }],
889
+ rowHeight: [{
890
+ type: i0.Input,
891
+ args: [{
892
+ isSignal: true,
893
+ alias: "rowHeight",
894
+ required: false
895
+ }]
896
+ }],
897
+ buffer: [{
898
+ type: i0.Input,
899
+ args: [{
900
+ isSignal: true,
901
+ alias: "buffer",
902
+ required: false
903
+ }]
904
+ }],
905
+ hasMore: [{
906
+ type: i0.Input,
907
+ args: [{
908
+ isSignal: true,
909
+ alias: "hasMore",
910
+ required: false
911
+ }]
912
+ }],
913
+ loading: [{
914
+ type: i0.Input,
915
+ args: [{
916
+ isSignal: true,
917
+ alias: "loading",
918
+ required: false
919
+ }]
920
+ }],
921
+ loadMoreThreshold: [{
922
+ type: i0.Input,
923
+ args: [{
924
+ isSignal: true,
925
+ alias: "loadMoreThreshold",
926
+ required: false
927
+ }]
928
+ }],
929
+ formatTime: [{
930
+ type: i0.Input,
931
+ args: [{
932
+ isSignal: true,
933
+ alias: "formatTime",
934
+ required: false
935
+ }]
936
+ }],
937
+ ariaLabel: [{
938
+ type: i0.Input,
939
+ args: [{
940
+ isSignal: true,
941
+ alias: "aria-label",
942
+ required: false
943
+ }]
944
+ }],
945
+ ariaLabelledby: [{
946
+ type: i0.Input,
947
+ args: [{
948
+ isSignal: true,
949
+ alias: "aria-labelledby",
950
+ required: false
951
+ }]
952
+ }],
953
+ selectedChange: [{
954
+ type: i0.Output,
955
+ args: ["selectedChange"]
956
+ }],
957
+ loadMore: [{
958
+ type: i0.Output,
959
+ args: ["loadMore"]
960
+ }],
961
+ rowCell: [{
962
+ type: i0.ContentChild,
963
+ args: [i0.forwardRef(() => HxCommitGraphRowCell), { isSignal: true }]
964
+ }],
965
+ viewport: [{
966
+ type: i0.ViewChild,
967
+ args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }]
968
+ }]
969
+ }
970
+ });
971
+ const HELIX_CODE_GIT_VERSION = "0.1.0";
972
+ export { HELIX_CODE_GIT_VERSION, HX_GRAPH_COLORS, HxChangedFileActions, HxChangedFiles, HxCommitGraph, HxCommitGraphRowCell, hxFormatCommitTime, hxLayoutCommits };
973
+
974
+ //# sourceMappingURL=gravionlabs-helix-code-git.mjs.map