@chisquare-tech/origine-ngx-apps-code 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chisquare-tech/origine-ngx-apps-code",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Origine's Code module screens: repositories, files, commits, branches, pull requests and review, repository settings.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,8 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { Signal } from '@angular/core';
2
+ import { Signal, AfterViewInit } from '@angular/core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { ActivatedRoute } from '@angular/router';
5
+ import * as _chisquare_tech_origine_ngx_apps_code from '@chisquare-tech/origine-ngx-apps-code';
5
6
 
6
7
  /** A person in the organization, as the host knows them (identity's members). */
7
8
  interface CodePerson {
@@ -367,7 +368,10 @@ declare class CodeApi {
367
368
  }): Observable<Commit[]>;
368
369
  commit(project: string, name: string, sha: string): Observable<CommitDetail>;
369
370
  /** One file's hunks from base to head ("" base: the head's first parent). */
370
- diff(project: string, name: string, head: string, path: string, base?: string): Observable<FileDiff>;
371
+ diff(project: string, name: string, head: string, path: string, base?: string, opts?: {
372
+ context?: number;
373
+ ignoreSpace?: boolean;
374
+ }): Observable<FileDiff>;
371
375
  compare(project: string, name: string, base: string, head: string): Observable<Comparison>;
372
376
  refs(project: string, name: string, kind?: 'branch' | 'tag', q?: string): Observable<Ref[]>;
373
377
  createBranch(project: string, name: string, branch: string, from: string): Observable<unknown>;
@@ -412,6 +416,8 @@ declare class CodeApi {
412
416
  }): Observable<Pull>;
413
417
  conversation(project: string, name: string, n: number): Observable<Timeline>;
414
418
  comment(project: string, name: string, n: number, c: NewComment): Observable<PRComment>;
419
+ /** Discards one of the caller's pending review comments. */
420
+ discardComment(project: string, name: string, n: number, id: string): Observable<unknown>;
415
421
  review(project: string, name: string, n: number, state: 'commented' | 'approved' | 'changes_requested', body?: string): Observable<Review>;
416
422
  resolve(project: string, name: string, n: number, thread: string, on: boolean): Observable<unknown>;
417
423
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CodeApi, never>;
@@ -504,27 +510,47 @@ interface LineComment {
504
510
  side: 'old' | 'new';
505
511
  line: number;
506
512
  body: string;
513
+ /** Part of the caller's review, posted when it is submitted. */
514
+ pending: boolean;
507
515
  }
508
516
  interface ThreadReply {
509
517
  threadId: string;
510
518
  body: string;
511
519
  }
512
- declare class DiffView {
520
+ /** One row of the split view: the old side and the new side. */
521
+ interface SplitRow {
522
+ left?: DiffLine;
523
+ right?: DiffLine;
524
+ }
525
+ declare class DiffView implements AfterViewInit {
513
526
  private readonly api;
514
527
  private readonly host;
528
+ private readonly el;
529
+ private readonly destroyRef;
515
530
  readonly repo: _angular_core.InputSignal<string>;
516
531
  readonly file: _angular_core.InputSignal<FileChange>;
517
532
  readonly head: _angular_core.InputSignal<string>;
518
533
  readonly base: _angular_core.InputSignal<string>;
519
534
  readonly threads: _angular_core.InputSignal<Thread[]>;
520
535
  readonly canComment: _angular_core.InputSignal<boolean>;
536
+ readonly mode: _angular_core.InputSignal<"unified" | "split">;
537
+ readonly ignoreSpace: _angular_core.InputSignal<boolean>;
538
+ /** The file is marked viewed (pull requests); null hides the Viewed button. */
539
+ readonly viewed: _angular_core.InputSignal<boolean | null>;
540
+ /** The caller has a pending review on this pull request. */
541
+ readonly reviewing: _angular_core.InputSignal<boolean>;
521
542
  readonly comment: _angular_core.OutputEmitterRef<LineComment>;
522
543
  readonly reply: _angular_core.OutputEmitterRef<ThreadReply>;
523
544
  readonly resolve: _angular_core.OutputEmitterRef<{
524
545
  threadId: string;
525
546
  resolved: boolean;
526
547
  }>;
548
+ readonly discard: _angular_core.OutputEmitterRef<string>;
549
+ readonly viewedChange: _angular_core.OutputEmitterRef<boolean>;
527
550
  protected readonly open: _angular_core.WritableSignal<boolean>;
551
+ protected readonly visible: _angular_core.WritableSignal<boolean>;
552
+ protected readonly waiting: _angular_core.WritableSignal<boolean>;
553
+ protected readonly context: _angular_core.WritableSignal<number>;
528
554
  protected readonly diff: _angular_core.WritableSignal<FileDiff | null>;
529
555
  protected readonly error: _angular_core.WritableSignal<string>;
530
556
  protected readonly drafting: _angular_core.WritableSignal<string>;
@@ -532,18 +558,30 @@ declare class DiffView {
532
558
  protected readonly replies: _angular_core.WritableSignal<Record<string, string>>;
533
559
  protected readonly people: _angular_core.Signal<People>;
534
560
  protected readonly threadsHere: _angular_core.Signal<Thread[]>;
561
+ protected readonly viewable: _angular_core.Signal<boolean>;
562
+ protected readonly me: _angular_core.Signal<string>;
563
+ protected readonly splitRows: _angular_core.Signal<SplitRow[][]>;
535
564
  protected readonly ago: (s?: string) => string;
565
+ private asked;
536
566
  constructor();
567
+ ngAfterViewInit(): void;
568
+ protected load(): void;
569
+ protected toggleOpen(): void;
570
+ protected moreContext(): void;
537
571
  protected key(l: DiffLine): string;
538
572
  protected lineOf(l: DiffLine): number;
573
+ /** The lines of a split row that threads and drafts hang from (a context line once). */
574
+ protected rowLines(r: SplitRow): DiffLine[];
539
575
  protected threadsAt(l: DiffLine): Thread[];
540
576
  protected startComment(l: DiffLine): void;
541
- protected send(l: DiffLine): void;
577
+ protected send(l: DiffLine, pending: boolean): void;
542
578
  protected setReply(id: string, v: string): void;
543
579
  protected sendReply(id: string): void;
544
580
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DiffView, never>;
545
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DiffView, "o-diff", never, { "repo": { "alias": "repo"; "required": true; "isSignal": true; }; "file": { "alias": "file"; "required": true; "isSignal": true; }; "head": { "alias": "head"; "required": true; "isSignal": true; }; "base": { "alias": "base"; "required": false; "isSignal": true; }; "threads": { "alias": "threads"; "required": false; "isSignal": true; }; "canComment": { "alias": "canComment"; "required": false; "isSignal": true; }; }, { "comment": "comment"; "reply": "reply"; "resolve": "resolve"; }, never, ["*"], true, never>;
581
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DiffView, "o-diff", never, { "repo": { "alias": "repo"; "required": true; "isSignal": true; }; "file": { "alias": "file"; "required": true; "isSignal": true; }; "head": { "alias": "head"; "required": true; "isSignal": true; }; "base": { "alias": "base"; "required": false; "isSignal": true; }; "threads": { "alias": "threads"; "required": false; "isSignal": true; }; "canComment": { "alias": "canComment"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "ignoreSpace": { "alias": "ignoreSpace"; "required": false; "isSignal": true; }; "viewed": { "alias": "viewed"; "required": false; "isSignal": true; }; "reviewing": { "alias": "reviewing"; "required": false; "isSignal": true; }; }, { "comment": "comment"; "reply": "reply"; "resolve": "resolve"; "discard": "discard"; "viewedChange": "viewedChange"; }, never, ["*"], true, never>;
546
582
  }
583
+ /** Pairs a hunk's lines side by side: context on both sides, a run of removals beside the run of additions that follows it. */
584
+ declare function pair(lines: DiffLine[]): SplitRow[];
547
585
 
548
586
  declare class ReposPage {
549
587
  protected readonly host: CodeHost;
@@ -811,6 +849,13 @@ declare class PullPage extends RepoPage {
811
849
  protected readonly initials: typeof initials;
812
850
  protected readonly dot: typeof checkDot;
813
851
  protected readonly threads: _angular_core.Signal<Thread[]>;
852
+ protected readonly mode: _angular_core.WritableSignal<"unified" | "split">;
853
+ protected readonly hideWs: _angular_core.WritableSignal<boolean>;
854
+ /** Files marked viewed, kept per pull request head in this browser (a new push resets them). */
855
+ protected readonly viewed: _angular_core.WritableSignal<Record<string, boolean>>;
856
+ protected readonly viewedCount: _angular_core.Signal<number>;
857
+ /** The caller's pending review comments (shown only to them until the review is submitted). */
858
+ protected readonly myPending: _angular_core.Signal<_chisquare_tech_origine_ngx_apps_code.PRComment[]>;
814
859
  protected readonly openThreads: _angular_core.Signal<number>;
815
860
  protected readonly tabs: _angular_core.Signal<{
816
861
  id: Tab;
@@ -852,6 +897,12 @@ declare class PullPage extends RepoPage {
852
897
  protected submitReview(): void;
853
898
  protected addComment(): void;
854
899
  protected lineComment(c: LineComment): void;
900
+ protected discard(id: string): void;
901
+ protected setMode(m: 'unified' | 'split'): void;
902
+ private viewedKey;
903
+ protected isViewed(path: string): boolean;
904
+ protected setViewed(path: string, on: boolean): void;
905
+ protected jump(path: string): void;
855
906
  protected reply(r: ThreadReply): void;
856
907
  protected resolve(e: {
857
908
  threadId: string;
@@ -924,5 +975,5 @@ declare class RepoSettingsPage extends RepoPage {
924
975
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<RepoSettingsPage, "o-code-settings", never, {}, {}, never, never, true, never>;
925
976
  }
926
977
 
927
- export { BranchesPage, CodeApi, CodeHost, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, shortDate, size };
928
- export type { BlameHunk, Blob, CheckStatus, CodePerson, CodeProject, Commit, CommitDetail, Comparison, DiffHunk, DiffLine, Entry, FileChange, FileDiff, Gate, GateRow, GitPerson, Language, LineComment, NewComment, PRComment, Protection, Pull, PullBrief, Ref, Repo, Review, ReviewBrief, Thread, ThreadReply, Timeline, Tree };
978
+ export { BranchesPage, CodeApi, CodeHost, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, pair, shortDate, size };
979
+ export type { BlameHunk, Blob, CheckStatus, CodePerson, CodeProject, Commit, CommitDetail, Comparison, DiffHunk, DiffLine, Entry, FileChange, FileDiff, Gate, GateRow, GitPerson, Language, LineComment, NewComment, PRComment, Protection, Pull, PullBrief, Ref, Repo, Review, ReviewBrief, SplitRow, Thread, ThreadReply, Timeline, Tree };