@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.
- package/LICENSE.md +21 -0
- package/README.md +15 -2
- package/fesm2022/gravionlabs-helix-code-git.mjs +974 -0
- package/fesm2022/gravionlabs-helix-code-git.mjs.map +1 -0
- package/fesm2022/gravionlabs-helix-code.mjs +2822 -0
- package/fesm2022/gravionlabs-helix-code.mjs.map +1 -0
- package/package.json +78 -3
- package/types/gravionlabs-helix-code-git.d.ts +334 -0
- package/types/gravionlabs-helix-code.d.ts +604 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { TemplateRef } from "@angular/core";
|
|
3
|
+
import { CdkVirtualScrollViewport } from "@angular/cdk/scrolling";
|
|
4
|
+
/** The state of a file in a change set. */
|
|
5
|
+
type HxChangeStatus = 'added' | 'modified' | 'deleted' | 'renamed' | 'untracked' | 'conflicted';
|
|
6
|
+
/** One file of a change set. */
|
|
7
|
+
interface HxChangedFile {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
/** The previous path of a renamed file. */
|
|
10
|
+
readonly oldPath?: string;
|
|
11
|
+
readonly status: HxChangeStatus;
|
|
12
|
+
readonly additions?: number;
|
|
13
|
+
readonly deletions?: number;
|
|
14
|
+
/** A binary file has no line counts. */
|
|
15
|
+
readonly binary?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Marks the `<ng-template>` that adds actions to each row of `hx-changed-files`. The context
|
|
19
|
+
* `$implicit` is the `HxChangedFile` of the row.
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* <hx-changed-files [files]="files">
|
|
23
|
+
* <ng-template hxChangedFileActions let-file><button>Stage {{ file.path }}</button></ng-template>
|
|
24
|
+
* </hx-changed-files>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class HxChangedFileActions {
|
|
28
|
+
readonly template: TemplateRef<{
|
|
29
|
+
$implicit: HxChangedFile;
|
|
30
|
+
}>;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HxChangedFileActions, never>;
|
|
32
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HxChangedFileActions, "ng-template[hxChangedFileActions]", never, {}, {}, never, never, true, never>;
|
|
33
|
+
}
|
|
34
|
+
interface Row$1 {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly file: HxChangedFile;
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly folder: string;
|
|
39
|
+
readonly letter: string;
|
|
40
|
+
readonly label: string;
|
|
41
|
+
readonly counts: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Lists the files of a change set with status, line counts and a header with the totals. One file
|
|
45
|
+
* is selected; arrow keys move, Enter or Space selects.
|
|
46
|
+
*
|
|
47
|
+
* ```html
|
|
48
|
+
* <hx-changed-files aria-label="Changes" [files]="files" [selected]="path" (selectedChange)="path = $event" />
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare class HxChangedFiles {
|
|
52
|
+
#private;
|
|
53
|
+
/** The files of the change set. */
|
|
54
|
+
readonly files: import("@angular/core").InputSignal<readonly HxChangedFile[]>;
|
|
55
|
+
/** The path of the selected file. */
|
|
56
|
+
readonly selected: import("@angular/core").InputSignal<string | null>;
|
|
57
|
+
/** The accessible name of the list. */
|
|
58
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
59
|
+
readonly ariaLabelledby: import("@angular/core").InputSignal<string | null>;
|
|
60
|
+
/** Emits the path of the file the user selects. */
|
|
61
|
+
readonly selectedChange: import("@angular/core").OutputEmitterRef<string>;
|
|
62
|
+
protected readonly actions: import("@angular/core").Signal<HxChangedFileActions | undefined>;
|
|
63
|
+
protected readonly active: import("@angular/core").WritableSignal<number>;
|
|
64
|
+
protected readonly rows: import("@angular/core").Signal<readonly Row$1[]>;
|
|
65
|
+
/** The index that holds the keyboard focus mark: the one moved to, else the selected one, else 0. */
|
|
66
|
+
protected readonly activeIndex: import("@angular/core").Signal<number>;
|
|
67
|
+
protected readonly activeId: import("@angular/core").Signal<string>;
|
|
68
|
+
protected readonly totals: import("@angular/core").Signal<{
|
|
69
|
+
count: number;
|
|
70
|
+
additions: number;
|
|
71
|
+
deletions: number;
|
|
72
|
+
}>;
|
|
73
|
+
protected select(index: number): void;
|
|
74
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
75
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HxChangedFiles, never>;
|
|
76
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HxChangedFiles, "hx-changed-files", never, {
|
|
77
|
+
"files": {
|
|
78
|
+
"alias": "files";
|
|
79
|
+
"required": true;
|
|
80
|
+
"isSignal": true;
|
|
81
|
+
};
|
|
82
|
+
"selected": {
|
|
83
|
+
"alias": "selected";
|
|
84
|
+
"required": false;
|
|
85
|
+
"isSignal": true;
|
|
86
|
+
};
|
|
87
|
+
"ariaLabel": {
|
|
88
|
+
"alias": "aria-label";
|
|
89
|
+
"required": false;
|
|
90
|
+
"isSignal": true;
|
|
91
|
+
};
|
|
92
|
+
"ariaLabelledby": {
|
|
93
|
+
"alias": "aria-labelledby";
|
|
94
|
+
"required": false;
|
|
95
|
+
"isSignal": true;
|
|
96
|
+
};
|
|
97
|
+
}, {
|
|
98
|
+
"selectedChange": "selectedChange";
|
|
99
|
+
}, ["actions"], never, true, never>;
|
|
100
|
+
}
|
|
101
|
+
/** Number of line colors; matches `--hx-graph-lane-1` to `--hx-graph-lane-8`. */
|
|
102
|
+
export declare const HX_GRAPH_COLORS = 8;
|
|
103
|
+
interface HxCommitRef {
|
|
104
|
+
name: string;
|
|
105
|
+
kind: 'branch' | 'remote' | 'tag' | 'head';
|
|
106
|
+
}
|
|
107
|
+
interface HxCommit {
|
|
108
|
+
id: string;
|
|
109
|
+
/** All parents; the first one is the main line. */
|
|
110
|
+
parents: string[];
|
|
111
|
+
message: string;
|
|
112
|
+
author: string;
|
|
113
|
+
/** Unix seconds. */
|
|
114
|
+
time: number;
|
|
115
|
+
refs?: HxCommitRef[];
|
|
116
|
+
}
|
|
117
|
+
interface HxGraphSegment {
|
|
118
|
+
/** Lane at the top edge of the row. */
|
|
119
|
+
fromLane: number;
|
|
120
|
+
/** Lane at the bottom edge of the row. */
|
|
121
|
+
toLane: number;
|
|
122
|
+
/** Palette index 0 to 7. */
|
|
123
|
+
color: number;
|
|
124
|
+
kind: 'pass-through' | 'branch-out' | 'merge-in';
|
|
125
|
+
}
|
|
126
|
+
interface HxGraphRow {
|
|
127
|
+
lane: number;
|
|
128
|
+
/** Palette index of the line the commit sits on. */
|
|
129
|
+
color: number;
|
|
130
|
+
/**
|
|
131
|
+
* True when a line enters the commit dot from the top edge (a lane expected
|
|
132
|
+
* this commit). False for a branch tip.
|
|
133
|
+
*/
|
|
134
|
+
hasIncoming: boolean;
|
|
135
|
+
segments: HxGraphSegment[];
|
|
136
|
+
}
|
|
137
|
+
interface HxOpenLane {
|
|
138
|
+
/** Id of the commit this lane expects next. */
|
|
139
|
+
id: string;
|
|
140
|
+
color: number;
|
|
141
|
+
}
|
|
142
|
+
interface HxLayoutState {
|
|
143
|
+
/** Per lane: the open line, or `null` when the lane is free. */
|
|
144
|
+
lanes: (HxOpenLane | null)[];
|
|
145
|
+
/** Next value of the color counter (not reduced). */
|
|
146
|
+
nextColor: number;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Lays out commits for a graph. Input order is kept: a commit comes before its
|
|
150
|
+
* parents. Pass the `state` of an earlier call as `previous` to continue a
|
|
151
|
+
* layout page by page.
|
|
152
|
+
*/
|
|
153
|
+
export declare function hxLayoutCommits(commits: readonly HxCommit[], previous?: HxLayoutState): {
|
|
154
|
+
rows: HxGraphRow[];
|
|
155
|
+
state: HxLayoutState;
|
|
156
|
+
};
|
|
157
|
+
/** Context of the `hxCommitGraphRowCell` template: `$implicit` is the commit, `row` its layout. */
|
|
158
|
+
interface HxCommitGraphRowCellContext {
|
|
159
|
+
$implicit: HxCommit;
|
|
160
|
+
row: HxGraphRow;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Marks the `<ng-template>` that renders extra content at the end of each row of `hx-commit-graph`.
|
|
164
|
+
*
|
|
165
|
+
* ```html
|
|
166
|
+
* <hx-commit-graph [commits]="commits">
|
|
167
|
+
* <ng-template hxCommitGraphRowCell let-commit let-row="row"><button>Pick</button></ng-template>
|
|
168
|
+
* </hx-commit-graph>
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare class HxCommitGraphRowCell {
|
|
172
|
+
readonly template: TemplateRef<HxCommitGraphRowCellContext>;
|
|
173
|
+
static ngTemplateContextGuard(_dir: HxCommitGraphRowCell, _ctx: unknown): _ctx is HxCommitGraphRowCellContext;
|
|
174
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HxCommitGraphRowCell, never>;
|
|
175
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HxCommitGraphRowCell, "ng-template[hxCommitGraphRowCell]", never, {}, {}, never, never, true, never>;
|
|
176
|
+
}
|
|
177
|
+
interface Path {
|
|
178
|
+
readonly d: string;
|
|
179
|
+
readonly color: number;
|
|
180
|
+
}
|
|
181
|
+
interface Dot {
|
|
182
|
+
readonly cx: number;
|
|
183
|
+
readonly color: number;
|
|
184
|
+
readonly merge: boolean;
|
|
185
|
+
}
|
|
186
|
+
interface Row {
|
|
187
|
+
readonly id: string;
|
|
188
|
+
readonly commit: HxCommit;
|
|
189
|
+
readonly layout: HxGraphRow;
|
|
190
|
+
readonly paths: readonly Path[];
|
|
191
|
+
readonly dot: Dot;
|
|
192
|
+
readonly name: string;
|
|
193
|
+
readonly time: string;
|
|
194
|
+
readonly refs: readonly {
|
|
195
|
+
name: string;
|
|
196
|
+
kind: HxCommitRef['kind'];
|
|
197
|
+
}[];
|
|
198
|
+
readonly subject: string;
|
|
199
|
+
}
|
|
200
|
+
/** Relative time ("5 min ago"); a date (`2026-01-31`) from 30 days on. */
|
|
201
|
+
export declare function hxFormatCommitTime(secs: number, now?: number): string;
|
|
202
|
+
interface Model {
|
|
203
|
+
readonly rows: readonly Row[];
|
|
204
|
+
/** Lanes the layout needs, before `maxLanes` limits them. */
|
|
205
|
+
readonly lanes: number;
|
|
206
|
+
/** Index of each commit id. */
|
|
207
|
+
readonly index: ReadonlyMap<string, number>;
|
|
208
|
+
/** `append` when the commits continued the previous list, else `full`. */
|
|
209
|
+
readonly kind: 'append' | 'full';
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Shows a commit history as rows: the graph, ref labels, message, author and time. One commit is
|
|
213
|
+
* selected; arrow keys, Home and End move. Only the visible rows are in the DOM; `loadMore` asks
|
|
214
|
+
* for the next page.
|
|
215
|
+
*
|
|
216
|
+
* ```html
|
|
217
|
+
* <hx-commit-graph aria-label="History" [commits]="commits" [(selected)]="id" />
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
export declare class HxCommitGraph {
|
|
221
|
+
#private;
|
|
222
|
+
/** The commits, a commit before its parents. */
|
|
223
|
+
readonly commits: import("@angular/core").InputSignal<readonly HxCommit[]>;
|
|
224
|
+
/** The id of the selected commit. */
|
|
225
|
+
readonly selected: import("@angular/core").InputSignal<string | null>;
|
|
226
|
+
/** Maximum number of lanes drawn; further lanes are folded into the last one. */
|
|
227
|
+
readonly maxLanes: import("@angular/core").InputSignal<number>;
|
|
228
|
+
/** Height of one row in px. Rows and their SVG have exactly this height. */
|
|
229
|
+
readonly rowHeight: import("@angular/core").InputSignal<number>;
|
|
230
|
+
/** Rows rendered above and below the visible rows. */
|
|
231
|
+
readonly buffer: import("@angular/core").InputSignal<number>;
|
|
232
|
+
/** Whether more commits can be loaded; `loadMore` fires only while this is true. */
|
|
233
|
+
readonly hasMore: import("@angular/core").InputSignal<boolean>;
|
|
234
|
+
/** Whether a page is loading; shows a row with a spinner and holds back `loadMore`. */
|
|
235
|
+
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
236
|
+
/** `loadMore` fires when the last rendered row is within this many rows of the end. */
|
|
237
|
+
readonly loadMoreThreshold: import("@angular/core").InputSignal<number>;
|
|
238
|
+
/** Formats a Unix time in seconds; the default is relative ("5 min ago"). */
|
|
239
|
+
readonly formatTime: import("@angular/core").InputSignal<(secs: number) => string>;
|
|
240
|
+
/** The accessible name of the list. */
|
|
241
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
242
|
+
readonly ariaLabelledby: import("@angular/core").InputSignal<string | null>;
|
|
243
|
+
/** Emits the id of the commit the user selects. */
|
|
244
|
+
readonly selectedChange: import("@angular/core").OutputEmitterRef<string>;
|
|
245
|
+
/** Emits when the user reaches the end of the loaded commits and `hasMore` is true. */
|
|
246
|
+
readonly loadMore: import("@angular/core").OutputEmitterRef<void>;
|
|
247
|
+
protected readonly rowCell: import("@angular/core").Signal<HxCommitGraphRowCell | undefined>;
|
|
248
|
+
protected readonly viewport: import("@angular/core").Signal<CdkVirtualScrollViewport | undefined>;
|
|
249
|
+
protected readonly active: import("@angular/core").WritableSignal<string | null>;
|
|
250
|
+
protected readonly dotRadius = 4;
|
|
251
|
+
protected readonly bufferPx: import("@angular/core").Signal<number>;
|
|
252
|
+
protected readonly model: import("@angular/core").Signal<Model>;
|
|
253
|
+
protected readonly rows: import("@angular/core").Signal<readonly Row[]>;
|
|
254
|
+
/** Number of lanes the graph column shows. */
|
|
255
|
+
protected readonly laneCount: import("@angular/core").Signal<number>;
|
|
256
|
+
protected readonly graphWidth: import("@angular/core").Signal<number>;
|
|
257
|
+
protected readonly activeIndex: import("@angular/core").Signal<number>;
|
|
258
|
+
protected readonly activeId: import("@angular/core").Signal<string>;
|
|
259
|
+
constructor();
|
|
260
|
+
/**
|
|
261
|
+
* Scrolls a loaded commit to the nearest visible position. Returns `false`, without scrolling,
|
|
262
|
+
* when the commit is not loaded.
|
|
263
|
+
*/
|
|
264
|
+
reveal(id: string): boolean;
|
|
265
|
+
protected trackRow(_index: number, row: Row): string;
|
|
266
|
+
protected refLabel(kind: HxCommitRef['kind']): string;
|
|
267
|
+
protected label(row: Row): string;
|
|
268
|
+
protected select(index: number): void;
|
|
269
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
270
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HxCommitGraph, never>;
|
|
271
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HxCommitGraph, "hx-commit-graph", never, {
|
|
272
|
+
"commits": {
|
|
273
|
+
"alias": "commits";
|
|
274
|
+
"required": true;
|
|
275
|
+
"isSignal": true;
|
|
276
|
+
};
|
|
277
|
+
"selected": {
|
|
278
|
+
"alias": "selected";
|
|
279
|
+
"required": false;
|
|
280
|
+
"isSignal": true;
|
|
281
|
+
};
|
|
282
|
+
"maxLanes": {
|
|
283
|
+
"alias": "maxLanes";
|
|
284
|
+
"required": false;
|
|
285
|
+
"isSignal": true;
|
|
286
|
+
};
|
|
287
|
+
"rowHeight": {
|
|
288
|
+
"alias": "rowHeight";
|
|
289
|
+
"required": false;
|
|
290
|
+
"isSignal": true;
|
|
291
|
+
};
|
|
292
|
+
"buffer": {
|
|
293
|
+
"alias": "buffer";
|
|
294
|
+
"required": false;
|
|
295
|
+
"isSignal": true;
|
|
296
|
+
};
|
|
297
|
+
"hasMore": {
|
|
298
|
+
"alias": "hasMore";
|
|
299
|
+
"required": false;
|
|
300
|
+
"isSignal": true;
|
|
301
|
+
};
|
|
302
|
+
"loading": {
|
|
303
|
+
"alias": "loading";
|
|
304
|
+
"required": false;
|
|
305
|
+
"isSignal": true;
|
|
306
|
+
};
|
|
307
|
+
"loadMoreThreshold": {
|
|
308
|
+
"alias": "loadMoreThreshold";
|
|
309
|
+
"required": false;
|
|
310
|
+
"isSignal": true;
|
|
311
|
+
};
|
|
312
|
+
"formatTime": {
|
|
313
|
+
"alias": "formatTime";
|
|
314
|
+
"required": false;
|
|
315
|
+
"isSignal": true;
|
|
316
|
+
};
|
|
317
|
+
"ariaLabel": {
|
|
318
|
+
"alias": "aria-label";
|
|
319
|
+
"required": false;
|
|
320
|
+
"isSignal": true;
|
|
321
|
+
};
|
|
322
|
+
"ariaLabelledby": {
|
|
323
|
+
"alias": "aria-labelledby";
|
|
324
|
+
"required": false;
|
|
325
|
+
"isSignal": true;
|
|
326
|
+
};
|
|
327
|
+
}, {
|
|
328
|
+
"selectedChange": "selectedChange";
|
|
329
|
+
"loadMore": "loadMore";
|
|
330
|
+
}, ["rowCell"], never, true, never>;
|
|
331
|
+
}
|
|
332
|
+
/** Version of `@gravionlabs/helix-code/git`. */
|
|
333
|
+
export declare const HELIX_CODE_GIT_VERSION = "0.1.0";
|
|
334
|
+
export type { HxChangeStatus, HxChangedFile, HxCommit, HxCommitGraphRowCellContext, HxCommitRef, HxGraphRow, HxGraphSegment, HxLayoutState, HxOpenLane };
|