@chisquare-tech/origine-ngx-apps-code 0.9.0 → 0.11.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.
|
@@ -122,6 +122,13 @@ class CodeApi {
|
|
|
122
122
|
p['q'] = q;
|
|
123
123
|
return this.api.get(`${this.repoPath(project, name)}/refs`, p).pipe(map((r) => data(r) ?? []));
|
|
124
124
|
}
|
|
125
|
+
/** Searches the repository's default branch (text, or a regular expression). */
|
|
126
|
+
searchCode(project, name, q, regex = false) {
|
|
127
|
+
const p = { q };
|
|
128
|
+
if (regex)
|
|
129
|
+
p['regex'] = 'true';
|
|
130
|
+
return this.api.get(`${this.repoPath(project, name)}/search`, p).pipe(map((r) => data(r) ?? { hits: [], repos: 0 }));
|
|
131
|
+
}
|
|
125
132
|
collaborators(project, name) {
|
|
126
133
|
return this.api.get(`${this.repoPath(project, name)}/collaborators`).pipe(map((r) => data(r) ?? []));
|
|
127
134
|
}
|
|
@@ -1291,6 +1298,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1291
1298
|
// /{org}/{project}/code/{repo}?ref=&path= (prototype "code_repo"): the repository's files at a
|
|
1292
1299
|
// branch, tag or commit, the last commit of each entry, the README, the clone menu and languages.
|
|
1293
1300
|
class RepoHomePage extends RepoPage {
|
|
1301
|
+
searchCode() {
|
|
1302
|
+
const q = this.codeQuery.trim();
|
|
1303
|
+
if (q)
|
|
1304
|
+
void this.router.navigate(this.link('search'), { queryParams: { q } });
|
|
1305
|
+
}
|
|
1294
1306
|
constructor() {
|
|
1295
1307
|
super();
|
|
1296
1308
|
this.router = inject(Router);
|
|
@@ -1302,6 +1314,7 @@ class RepoHomePage extends RepoPage {
|
|
|
1302
1314
|
this.proto = signal('https', ...(ngDevMode ? [{ debugName: "proto" }] : /* istanbul ignore next */ []));
|
|
1303
1315
|
this.cloneOpen = signal(false, ...(ngDevMode ? [{ debugName: "cloneOpen" }] : /* istanbul ignore next */ []));
|
|
1304
1316
|
this.addOpen = signal(false, ...(ngDevMode ? [{ debugName: "addOpen" }] : /* istanbul ignore next */ []));
|
|
1317
|
+
this.codeQuery = '';
|
|
1305
1318
|
this.copied = signal(false, ...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
|
|
1306
1319
|
this.finding = signal(false, ...(ngDevMode ? [{ debugName: "finding" }] : /* istanbul ignore next */ []));
|
|
1307
1320
|
this.fq = signal('', ...(ngDevMode ? [{ debugName: "fq" }] : /* istanbul ignore next */ []));
|
|
@@ -1429,6 +1442,7 @@ class RepoHomePage extends RepoPage {
|
|
|
1429
1442
|
@for (c of crumbs(); track c.path) {<span class="o-faint">/</span><a [routerLink]="link()" [queryParams]="qp(c.path)">{{ c.name }}</a>}
|
|
1430
1443
|
</nav>
|
|
1431
1444
|
<span class="o-r"></span>
|
|
1445
|
+
<form class="o-flex" (ngSubmit)="searchCode()" role="search"><input class="o-in o-sm o-mono" style="width:180px" name="cq" [(ngModel)]="codeQuery" placeholder="Search code" aria-label="Search code" data-testid="repo-code-search" /></form>
|
|
1432
1446
|
<button type="button" class="o-btn o-sm" (click)="openFinder()">Go to file <span class="o-kbd">T</span></button>
|
|
1433
1447
|
@if (canWrite()) {
|
|
1434
1448
|
<span class="anchor add">
|
|
@@ -1469,7 +1483,7 @@ class RepoHomePage extends RepoPage {
|
|
|
1469
1483
|
@for (e of tree()?.entries ?? []; track e.path) {
|
|
1470
1484
|
<a class="o-row o-click" [routerLink]="e.type === 'tree' ? link() : link('blob')" [queryParams]="qp(e.path)" [attr.data-testid]="'entry-' + e.name">
|
|
1471
1485
|
<span class="ic" aria-hidden="true">{{ e.type === 'tree' ? '▸' : '·' }}</span>
|
|
1472
|
-
<span class="o-mono o-sm" style="width:200px;flex:none" [class.o-b5]="e.type === 'tree'">{{ e.name }}</span>
|
|
1486
|
+
<span class="o-mono o-sm" style="width:200px;flex:none" [class.o-b5]="e.type === 'tree'">{{ e.name }}@if (e.lfs) {<span class="o-chip" style="margin-left:6px" title="Stored with Git LFS" [attr.data-testid]="'lfs-' + e.name">LFS</span>}</span>
|
|
1473
1487
|
<span class="o-ell o-faint o-sm" style="flex:1">{{ e.lastCommit?.subject }}</span>
|
|
1474
1488
|
<span class="o-faint o-sm">{{ ago(e.lastCommit?.committer?.when) }}</span>
|
|
1475
1489
|
</a>
|
|
@@ -1518,7 +1532,7 @@ class RepoHomePage extends RepoPage {
|
|
|
1518
1532
|
</div>
|
|
1519
1533
|
</div>
|
|
1520
1534
|
}
|
|
1521
|
-
`, isInline: true, styles: [".anchor{position:relative}.ic{width:18px;flex:none;color:var(--o-dim);text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: RefPicker, selector: "o-ref-picker", inputs: ["repo", "current"], outputs: ["picked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1535
|
+
`, isInline: true, styles: [".anchor{position:relative}.ic{width:18px;flex:none;color:var(--o-dim);text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: RefPicker, selector: "o-ref-picker", inputs: ["repo", "current"], outputs: ["picked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1522
1536
|
}
|
|
1523
1537
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: RepoHomePage, decorators: [{
|
|
1524
1538
|
type: Component,
|
|
@@ -1560,6 +1574,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1560
1574
|
@for (c of crumbs(); track c.path) {<span class="o-faint">/</span><a [routerLink]="link()" [queryParams]="qp(c.path)">{{ c.name }}</a>}
|
|
1561
1575
|
</nav>
|
|
1562
1576
|
<span class="o-r"></span>
|
|
1577
|
+
<form class="o-flex" (ngSubmit)="searchCode()" role="search"><input class="o-in o-sm o-mono" style="width:180px" name="cq" [(ngModel)]="codeQuery" placeholder="Search code" aria-label="Search code" data-testid="repo-code-search" /></form>
|
|
1563
1578
|
<button type="button" class="o-btn o-sm" (click)="openFinder()">Go to file <span class="o-kbd">T</span></button>
|
|
1564
1579
|
@if (canWrite()) {
|
|
1565
1580
|
<span class="anchor add">
|
|
@@ -1600,7 +1615,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1600
1615
|
@for (e of tree()?.entries ?? []; track e.path) {
|
|
1601
1616
|
<a class="o-row o-click" [routerLink]="e.type === 'tree' ? link() : link('blob')" [queryParams]="qp(e.path)" [attr.data-testid]="'entry-' + e.name">
|
|
1602
1617
|
<span class="ic" aria-hidden="true">{{ e.type === 'tree' ? '▸' : '·' }}</span>
|
|
1603
|
-
<span class="o-mono o-sm" style="width:200px;flex:none" [class.o-b5]="e.type === 'tree'">{{ e.name }}</span>
|
|
1618
|
+
<span class="o-mono o-sm" style="width:200px;flex:none" [class.o-b5]="e.type === 'tree'">{{ e.name }}@if (e.lfs) {<span class="o-chip" style="margin-left:6px" title="Stored with Git LFS" [attr.data-testid]="'lfs-' + e.name">LFS</span>}</span>
|
|
1604
1619
|
<span class="o-ell o-faint o-sm" style="flex:1">{{ e.lastCommit?.subject }}</span>
|
|
1605
1620
|
<span class="o-faint o-sm">{{ ago(e.lastCommit?.committer?.when) }}</span>
|
|
1606
1621
|
</a>
|
|
@@ -1775,6 +1790,7 @@ class FilePage extends RepoPage {
|
|
|
1775
1790
|
this.copied = signal(false, ...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
|
|
1776
1791
|
this.ago = (s) => ago(s);
|
|
1777
1792
|
this.initials = initials;
|
|
1793
|
+
this.size = size;
|
|
1778
1794
|
this.crumbs = computed(() => {
|
|
1779
1795
|
const parts = this.path().split('/').filter(Boolean);
|
|
1780
1796
|
return parts.map((name, i) => ({ name, path: parts.slice(0, i + 1).join('/') }));
|
|
@@ -1783,7 +1799,7 @@ class FilePage extends RepoPage {
|
|
|
1783
1799
|
const b = this.blob();
|
|
1784
1800
|
if (!b)
|
|
1785
1801
|
return '';
|
|
1786
|
-
return [b.binary ? '' : `${b.lineCount} lines`, size(b.size), b.language ?? ''].filter(Boolean).join(' · ');
|
|
1802
|
+
return [b.lfs ? 'Stored with Git LFS' : '', b.binary || b.truncated ? '' : `${b.lineCount} lines`, size(b.size), b.language ?? ''].filter(Boolean).join(' · ');
|
|
1787
1803
|
}, ...(ngDevMode ? [{ debugName: "meta" }] : /* istanbul ignore next */ []));
|
|
1788
1804
|
this.mode = signal('', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1789
1805
|
this.text = signal(null, ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
@@ -1939,7 +1955,7 @@ class FilePage extends RepoPage {
|
|
|
1939
1955
|
@if (!b.binary) {<button type="button" class="o-btn o-xs" (click)="copyText()">{{ copied() ? 'Copied' : 'Copy' }}</button>}
|
|
1940
1956
|
@if (b.downloadUrl) {<a class="o-btn o-xs" [href]="b.downloadUrl">Download</a>}
|
|
1941
1957
|
@if (editable()) {
|
|
1942
|
-
@if (!b.binary && !b.truncated) {<button type="button" class="o-btn o-xs" (click)="startEdit()" [disabled]="mode() !== ''" data-testid="file-edit">Edit</button>}
|
|
1958
|
+
@if (!b.binary && !b.truncated && !b.lfs) {<button type="button" class="o-btn o-xs" (click)="startEdit()" [disabled]="mode() !== ''" data-testid="file-edit">Edit</button>}
|
|
1943
1959
|
<button type="button" class="o-btn o-xs" (click)="mode.set('delete')" [disabled]="mode() !== ''" data-testid="file-delete">Delete</button>
|
|
1944
1960
|
}
|
|
1945
1961
|
</span>
|
|
@@ -1960,6 +1976,8 @@ class FilePage extends RepoPage {
|
|
|
1960
1976
|
}
|
|
1961
1977
|
@if (b.image && b.rawUrl) {
|
|
1962
1978
|
<div class="o-cb" style="text-align:center"><img [src]="b.rawUrl" [alt]="b.name" style="max-width:100%" /></div>
|
|
1979
|
+
} @else if (b.lfs && !b.lfs.stored) {
|
|
1980
|
+
<div class="o-empty" data-testid="lfs-missing">This file is a Git LFS pointer to an object that was never uploaded (<span class="o-mono">{{ b.lfs.oid.slice(0, 12) }}</span>, {{ size(b.lfs.size) }}).</div>
|
|
1963
1981
|
} @else if (b.binary || b.truncated) {
|
|
1964
1982
|
<div class="o-empty">{{ b.binary ? 'A binary file.' : 'Too large to show here.' }} @if (b.rawUrl) {<a [href]="b.rawUrl" target="_blank" rel="noopener">View raw</a>}</div>
|
|
1965
1983
|
} @else if (b.markdown && view() === 'preview') {
|
|
@@ -2023,7 +2041,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
2023
2041
|
@if (!b.binary) {<button type="button" class="o-btn o-xs" (click)="copyText()">{{ copied() ? 'Copied' : 'Copy' }}</button>}
|
|
2024
2042
|
@if (b.downloadUrl) {<a class="o-btn o-xs" [href]="b.downloadUrl">Download</a>}
|
|
2025
2043
|
@if (editable()) {
|
|
2026
|
-
@if (!b.binary && !b.truncated) {<button type="button" class="o-btn o-xs" (click)="startEdit()" [disabled]="mode() !== ''" data-testid="file-edit">Edit</button>}
|
|
2044
|
+
@if (!b.binary && !b.truncated && !b.lfs) {<button type="button" class="o-btn o-xs" (click)="startEdit()" [disabled]="mode() !== ''" data-testid="file-edit">Edit</button>}
|
|
2027
2045
|
<button type="button" class="o-btn o-xs" (click)="mode.set('delete')" [disabled]="mode() !== ''" data-testid="file-delete">Delete</button>
|
|
2028
2046
|
}
|
|
2029
2047
|
</span>
|
|
@@ -2044,6 +2062,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
2044
2062
|
}
|
|
2045
2063
|
@if (b.image && b.rawUrl) {
|
|
2046
2064
|
<div class="o-cb" style="text-align:center"><img [src]="b.rawUrl" [alt]="b.name" style="max-width:100%" /></div>
|
|
2065
|
+
} @else if (b.lfs && !b.lfs.stored) {
|
|
2066
|
+
<div class="o-empty" data-testid="lfs-missing">This file is a Git LFS pointer to an object that was never uploaded (<span class="o-mono">{{ b.lfs.oid.slice(0, 12) }}</span>, {{ size(b.lfs.size) }}).</div>
|
|
2047
2067
|
} @else if (b.binary || b.truncated) {
|
|
2048
2068
|
<div class="o-empty">{{ b.binary ? 'A binary file.' : 'Too large to show here.' }} @if (b.rawUrl) {<a [href]="b.rawUrl" target="_blank" rel="noopener">View raw</a>}</div>
|
|
2049
2069
|
} @else if (b.markdown && view() === 'preview') {
|
|
@@ -4323,6 +4343,115 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
4323
4343
|
}]
|
|
4324
4344
|
}], ctorParameters: () => [] });
|
|
4325
4345
|
|
|
4346
|
+
// /{org}/{project}/code/{repo}/search?q=®ex= (DEV-11): code search over the repository's default
|
|
4347
|
+
// branch, text or a regular expression; each file with its matching lines, the matches marked, a
|
|
4348
|
+
// line opening the file there.
|
|
4349
|
+
class CodeSearchPage extends RepoPage {
|
|
4350
|
+
constructor() {
|
|
4351
|
+
super();
|
|
4352
|
+
this.router = inject(Router);
|
|
4353
|
+
this.hits = signal([], ...(ngDevMode ? [{ debugName: "hits" }] : /* istanbul ignore next */ []));
|
|
4354
|
+
this.searched = signal(false, ...(ngDevMode ? [{ debugName: "searched" }] : /* istanbul ignore next */ []));
|
|
4355
|
+
this.text = '';
|
|
4356
|
+
this.regex = false;
|
|
4357
|
+
this.route.queryParamMap.subscribe((q) => {
|
|
4358
|
+
this.text = q.get('q') ?? '';
|
|
4359
|
+
this.regex = q.get('regex') === 'true';
|
|
4360
|
+
const r = this.repo();
|
|
4361
|
+
if (r && r.name === this.name())
|
|
4362
|
+
this.load(r);
|
|
4363
|
+
});
|
|
4364
|
+
}
|
|
4365
|
+
onRepo(r) {
|
|
4366
|
+
this.load(r);
|
|
4367
|
+
}
|
|
4368
|
+
go() {
|
|
4369
|
+
void this.router.navigate(this.link('search'), { queryParams: { q: this.text.trim(), regex: this.regex ? 'true' : null } });
|
|
4370
|
+
}
|
|
4371
|
+
load(r) {
|
|
4372
|
+
const q = this.text.trim();
|
|
4373
|
+
if (!q)
|
|
4374
|
+
return;
|
|
4375
|
+
this.error.set('');
|
|
4376
|
+
this.api.searchCode(this.projectId(), r.name, q, this.regex).subscribe({
|
|
4377
|
+
next: (res) => { this.hits.set(res.hits); this.searched.set(true); },
|
|
4378
|
+
error: (e) => { this.hits.set([]); this.searched.set(false); this.error.set(apiMessage(e, 'Could not search the code.')); },
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
/** A line cut into plain and matched pieces (ranges are byte offsets; the text is UTF-8). */
|
|
4382
|
+
pieces(text, ranges) {
|
|
4383
|
+
if (!ranges?.length)
|
|
4384
|
+
return [{ text, hit: false }];
|
|
4385
|
+
const bytes = new TextEncoder().encode(text);
|
|
4386
|
+
const dec = new TextDecoder();
|
|
4387
|
+
const out = [];
|
|
4388
|
+
let at = 0;
|
|
4389
|
+
for (const [a, b] of [...ranges].sort((x, y) => x[0] - y[0])) {
|
|
4390
|
+
if (a > at)
|
|
4391
|
+
out.push({ text: dec.decode(bytes.slice(at, a)), hit: false });
|
|
4392
|
+
out.push({ text: dec.decode(bytes.slice(Math.max(a, at), b)), hit: true });
|
|
4393
|
+
at = Math.max(at, b);
|
|
4394
|
+
}
|
|
4395
|
+
if (at < bytes.length)
|
|
4396
|
+
out.push({ text: dec.decode(bytes.slice(at)), hit: false });
|
|
4397
|
+
return out;
|
|
4398
|
+
}
|
|
4399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: CodeSearchPage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4400
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: CodeSearchPage, isStandalone: true, selector: "o-code-search", usesInheritance: true, ngImport: i0, template: `
|
|
4401
|
+
<div class="o-page o-wide">
|
|
4402
|
+
@if (repo(); as r) {
|
|
4403
|
+
<form class="o-flex o-wrap" (ngSubmit)="go()" role="search" aria-label="Search code">
|
|
4404
|
+
<input class="o-in o-mono" style="flex:1;min-width:220px" name="q" [(ngModel)]="text" placeholder="Search {{ r.name }} (default branch)" aria-label="Search code" data-testid="code-search-q" />
|
|
4405
|
+
<label class="o-flex o-sm"><input type="checkbox" name="regex" [(ngModel)]="regex" data-testid="code-search-regex" /> Regular expression</label>
|
|
4406
|
+
<button type="submit" class="o-btn o-dark" [disabled]="!text.trim()">Search</button>
|
|
4407
|
+
</form>
|
|
4408
|
+
@if (error()) {<div class="o-note o-red" role="alert">{{ error() }}</div>}
|
|
4409
|
+
@if (searched()) {
|
|
4410
|
+
<span class="o-faint o-sm" aria-live="polite" data-testid="code-search-count">{{ hits().length }} {{ hits().length === 1 ? 'file' : 'files' }}{{ hits().length >= 50 ? ' (the first 50)' : '' }} on {{ r.defaultBranch }}</span>
|
|
4411
|
+
@for (h of hits(); track h.path) {
|
|
4412
|
+
<div class="o-card" [attr.data-testid]="'code-hit-' + h.path">
|
|
4413
|
+
<div class="o-ch" style="background:var(--o-well)"><a class="o-mono o-sm" [routerLink]="link('blob')" [queryParams]="{ path: h.path }">{{ h.path }}</a>@if (h.nameMatch && !h.lines.length) {<span class="o-faint o-sm">matches the file name</span>}</div>
|
|
4414
|
+
@for (l of h.lines; track l.number) {
|
|
4415
|
+
<a class="ln" [routerLink]="link('blob')" [queryParams]="{ path: h.path }" [fragment]="'L' + l.number"><span class="n">{{ l.number }}</span><span>@for (p of pieces(l.text, l.ranges); track $index) {@if (p.hit) {<mark>{{ p.text }}</mark>} @else {{{ p.text }}}}</span></a>
|
|
4416
|
+
}
|
|
4417
|
+
</div>
|
|
4418
|
+
} @empty {
|
|
4419
|
+
<div class="o-card"><div class="o-empty">Nothing matches on {{ r.defaultBranch }}.</div></div>
|
|
4420
|
+
}
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
</div>
|
|
4424
|
+
`, isInline: true, styles: [".ln{display:flex;gap:10px;font-family:var(--o-mono);font-size:12px;padding:2px 12px;color:var(--o-tx);text-decoration:none;white-space:pre}.ln:hover{background:var(--o-well)}.ln .n{color:var(--o-faint);min-width:40px;text-align:right}mark{background:#fee484;color:inherit;border-radius:2px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4425
|
+
}
|
|
4426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: CodeSearchPage, decorators: [{
|
|
4427
|
+
type: Component,
|
|
4428
|
+
args: [{ selector: 'o-code-search', imports: [FormsModule, RouterLink], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
4429
|
+
<div class="o-page o-wide">
|
|
4430
|
+
@if (repo(); as r) {
|
|
4431
|
+
<form class="o-flex o-wrap" (ngSubmit)="go()" role="search" aria-label="Search code">
|
|
4432
|
+
<input class="o-in o-mono" style="flex:1;min-width:220px" name="q" [(ngModel)]="text" placeholder="Search {{ r.name }} (default branch)" aria-label="Search code" data-testid="code-search-q" />
|
|
4433
|
+
<label class="o-flex o-sm"><input type="checkbox" name="regex" [(ngModel)]="regex" data-testid="code-search-regex" /> Regular expression</label>
|
|
4434
|
+
<button type="submit" class="o-btn o-dark" [disabled]="!text.trim()">Search</button>
|
|
4435
|
+
</form>
|
|
4436
|
+
@if (error()) {<div class="o-note o-red" role="alert">{{ error() }}</div>}
|
|
4437
|
+
@if (searched()) {
|
|
4438
|
+
<span class="o-faint o-sm" aria-live="polite" data-testid="code-search-count">{{ hits().length }} {{ hits().length === 1 ? 'file' : 'files' }}{{ hits().length >= 50 ? ' (the first 50)' : '' }} on {{ r.defaultBranch }}</span>
|
|
4439
|
+
@for (h of hits(); track h.path) {
|
|
4440
|
+
<div class="o-card" [attr.data-testid]="'code-hit-' + h.path">
|
|
4441
|
+
<div class="o-ch" style="background:var(--o-well)"><a class="o-mono o-sm" [routerLink]="link('blob')" [queryParams]="{ path: h.path }">{{ h.path }}</a>@if (h.nameMatch && !h.lines.length) {<span class="o-faint o-sm">matches the file name</span>}</div>
|
|
4442
|
+
@for (l of h.lines; track l.number) {
|
|
4443
|
+
<a class="ln" [routerLink]="link('blob')" [queryParams]="{ path: h.path }" [fragment]="'L' + l.number"><span class="n">{{ l.number }}</span><span>@for (p of pieces(l.text, l.ranges); track $index) {@if (p.hit) {<mark>{{ p.text }}</mark>} @else {{{ p.text }}}}</span></a>
|
|
4444
|
+
}
|
|
4445
|
+
</div>
|
|
4446
|
+
} @empty {
|
|
4447
|
+
<div class="o-card"><div class="o-empty">Nothing matches on {{ r.defaultBranch }}.</div></div>
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4451
|
+
</div>
|
|
4452
|
+
`, styles: [".ln{display:flex;gap:10px;font-family:var(--o-mono);font-size:12px;padding:2px 12px;color:var(--o-tx);text-decoration:none;white-space:pre}.ln:hover{background:var(--o-well)}.ln .n{color:var(--o-faint);min-width:40px;text-align:right}mark{background:#fee484;color:inherit;border-radius:2px}\n"] }]
|
|
4453
|
+
}], ctorParameters: () => [] });
|
|
4454
|
+
|
|
4326
4455
|
/*
|
|
4327
4456
|
* @chisquare-tech/origine-ngx-apps-code: the Code module's screens (TRD §6.10). The host app provides
|
|
4328
4457
|
* CodeHost and mounts the pages at /{org}/{project}/code, /code/new, /code/pulls and
|
|
@@ -4333,5 +4462,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
4333
4462
|
* Generated bundle index. Do not edit.
|
|
4334
4463
|
*/
|
|
4335
4464
|
|
|
4336
|
-
export { BranchesPage, CodeApi, CodeHost, CommitBox, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewFilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, matchesPattern, pair, shortDate, size, verifyWhy };
|
|
4465
|
+
export { BranchesPage, CodeApi, CodeHost, CodeSearchPage, CommitBox, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewFilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, matchesPattern, pair, shortDate, size, verifyWhy };
|
|
4337
4466
|
//# sourceMappingURL=chisquare-tech-origine-ngx-apps-code.mjs.map
|