Skip to content

Commit

Permalink
chore(deps): switched to esbuild ⬆️
Browse files Browse the repository at this point in the history
  • Loading branch information
jensmeichler committed Nov 8, 2023
1 parent d4d4efe commit 20a6b51
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 51 deletions.
5 changes: 4 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prefix": "cb",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-devkit/build-angular:browser-esbuild",
"options": {
"outputPath": "dist/clipboard",
"index": "src/index.html",
Expand Down Expand Up @@ -79,6 +79,9 @@
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"port": 4201
},
"configurations": {
"production": {
"browserTarget": "clipboard:build:production"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "clipboard",
"version": "1.0.0",
"scripts": {
"start": "ng serve --port 4201",
"start": "ng serve",
"build": "ng build --base-href",
"lint": "ng lint",
"e2e": "cypress open --e2e",
Expand Down
8 changes: 4 additions & 4 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,29 @@

<mat-divider></mat-divider>

<ng-container *ngIf="dataService.undoPossible | async">
<ng-container *ngIf="redoService.undoPossible | async">
<button (click)="dataService.undo()" mat-menu-item [attr.aria-label]="'UNDO_LAST_ACTION' | translate">
<mat-icon>undo</mat-icon>
{{ 'UNDO_LAST_ACTION' | translate }}
</button>
</ng-container>

<ng-container *ngIf="dataService.redoPossible | async">
<ng-container *ngIf="redoService.redoPossible | async">
<button (click)="dataService.redo()" mat-menu-item [attr.aria-label]="'REDO_LAST_ACTION' | translate">
<mat-icon>redo</mat-icon>
{{ 'REDO_LAST_ACTION' | translate }}
</button>
</ng-container>

<ng-container *ngIf="dataService.restorePossible | async">
<ng-container *ngIf="redoService.restorePossible | async">
<button (click)="dataService.restoreTab()" mat-menu-item [attr.aria-label]="'RESTORE_CLOSED_TAB' | translate">
<mat-icon>restore_page</mat-icon>
{{ 'RESTORE_CLOSED_TAB' | translate }}
</button>
</ng-container>

<mat-divider
*ngIf="(dataService.redoPossible | async) || (dataService.undoPossible | async) || (dataService.restorePossible | async)">
*ngIf="(redoService.redoPossible | async) || (redoService.undoPossible | async) || (redoService.restorePossible | async)">
</mat-divider>

<button (click)="saveTabOrSelection()" mat-menu-item [attr.aria-label]="'SAVE_TAB' | translate">
Expand Down
15 changes: 7 additions & 8 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {MatDialog} from "@angular/material/dialog";
import {MatMenuTrigger} from "@angular/material/menu";
import {ActivatedRoute, Router} from "@angular/router";
import {CdkDragDrop, CdkDragEnd} from "@angular/cdk/drag-drop";
import {TranslateService} from "@ngx-translate/core";
import {dialog} from "@tauri-apps/api";
import {take} from "rxjs";
import {
Expand All @@ -37,7 +36,7 @@ import {
FileAccessService,
HashyService,
SettingsService,
ClipboardService
ClipboardService, HistoryService
} from "@clipboardjesus/services";

/**
Expand Down Expand Up @@ -90,11 +89,11 @@ export class AppComponent implements OnInit {
* @param bottomSheet reference to the material bottom sheet
* @param clipboard reference to the clipboard service
* @param dataService reference to the data service
* @param redoService reference to the history service (Handles undo and redo)
* @param hashy reference to the hashy service
* @param router reference to the angular router
* @param activatedRoute reference to the angular activated route
* @param cache reference to the cache service
* @param translate reference to the ngx translate service
* @param settings reference to the settings service
* @param fileAccessService reference to the file access service
* @param cdr reference to the change detector
Expand All @@ -103,13 +102,13 @@ export class AppComponent implements OnInit {
private readonly dialog: MatDialog,
private readonly bottomSheet: MatBottomSheet,
private readonly clipboard: ClipboardService,
public readonly dataService: DataService,
public readonly hashy: HashyService,
protected readonly dataService: DataService,
protected readonly redoService: HistoryService,
protected readonly hashy: HashyService,
private readonly router: Router,
private readonly activatedRoute: ActivatedRoute,
private readonly cache: CacheService,
private readonly translate: TranslateService,
public readonly settings: SettingsService,
protected readonly settings: SettingsService,
private readonly fileAccessService: FileAccessService,
cdr: ChangeDetectorRef,
) {
Expand Down Expand Up @@ -627,7 +626,7 @@ export class AppComponent implements OnInit {
* This method saves the current mouse position to create
* the draggable at this position (if chosen in context menu).
* @param event
* @param ignoreMousePosition If {@link true} the new draggable
* @param ignoreMousePosition If true the new draggable
* will be created in the top left corner of the tab
*/
showContextMenu(event: MouseEvent, ignoreMousePosition?: boolean): void {
Expand Down
7 changes: 0 additions & 7 deletions src/app/services/cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ import {HistoryService, StorageService} from "@clipboardjesus/services";
providedIn: 'root',
})
export class CacheService {
/** Whether the user can redo the last undone action. */
redoPossible = this.redoService.redoPossible;
/** Whether the user can undo the last action. */
undoPossible = this.redoService.undoPossible;
/** Whether the user can restore the lastly deleted tab. */
restorePossible = this.redoService.restorePossible;

/**
* Create an instance of the cache service.
*/
Expand Down
11 changes: 1 addition & 10 deletions src/app/services/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,11 @@ export class DataService extends DisposableService {

/** Array of all tabs. */
tabs: Tab[] = [];
/** Get all available tab indexes. */
get tabIndexes() { return this.tabs.map(x => x.index.toString()); }
/** Get the currently selected tab. */
get tab(): Tab { return this.tabs[this.selectedTabIndex]; }
/** Overwrite the currently selected tab. */
set tab(tab: Tab) { this.tabs[this.selectedTabIndex] = tab; }

/** Whether the user can redo the last undone action. */
redoPossible = this.cache.redoPossible;
/** Whether the user can undo the last action. */
undoPossible = this.cache.undoPossible;
/** Whether the user can restore the lastly deleted tab. */
restorePossible = this.cache.restorePossible;

/** An array of all objects that are colored. */
private colorizedObjects: Colored[] = [];

Expand Down Expand Up @@ -268,7 +259,7 @@ export class DataService extends DisposableService {
}

/**
* Sets the selected property to {@link true} for all selectable items.
* Sets the selected property to true for all selectable items.
* __Will just be applied for the currently selected tab!__
*/
selectAll(): void {
Expand Down
41 changes: 24 additions & 17 deletions src/app/services/history.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@ import {DisposableService} from "@clipboardjesus/services/disposable.service";
providedIn: 'root',
})
export class HistoryService extends DisposableService {
/** Whether the user can redo the last undone action. */
private _undoPossible = new BehaviorSubject<boolean>(false);
/** Whether the user can undo the last action. */
private _redoPossible = new BehaviorSubject<boolean>(false);
/** Whether the user can restore the lastly deleted tab. */
private _restorePossible = new BehaviorSubject<boolean>(false);

/** Whether the user can redo the last undone action. (Readonly) */
readonly undoPossible = this._undoPossible.asObservable();
/** Whether the user can undo the last action. (Readonly) */
readonly redoPossible = this._redoPossible.asObservable();
/** Whether the user can restore the lastly deleted tab. (Readonly) */
readonly restorePossible = this._restorePossible.asObservable();

/** Array of tab arrays which contains history information. */
possibleUndos: Tab[][] = [];
/** Array of tab arrays which contains history information. */
possibleRedos: Tab[][] = [];
/** Array of tabs which contains history information about deleted tabs. */
possibleRestores: Tab[] = [];

/** Whether the user can redo the last undone action. */
undoPossible = new BehaviorSubject<boolean>(false);
/** Whether the user can undo the last action. */
redoPossible = new BehaviorSubject<boolean>(false);
/** Whether the user can restore the lastly deleted tab. */
restorePossible = new BehaviorSubject<boolean>(false);

/**
* Create an instance of the history service.
*/
Expand Down Expand Up @@ -107,7 +114,7 @@ export class HistoryService extends DisposableService {
recreate(): Tab | undefined {
const restoredTab = this.possibleRestores.pop();
if (!this.possibleRestores.length) {
this.restorePossible.next(false);
this._restorePossible.next(false);
}
return restoredTab;
}
Expand Down Expand Up @@ -137,7 +144,7 @@ export class HistoryService extends DisposableService {
const tab = this.storageService.fetchTab(index);
if (tab) {
this.possibleRestores.push(tab);
this.restorePossible.next(true);
this._restorePossible.next(true);
}
this.possibleUndos[index] = [];
this.possibleRedos[index] = [];
Expand All @@ -148,15 +155,15 @@ export class HistoryService extends DisposableService {
* @param index The index of the deleted tab.
*/
private updateHistory(index: number): void {
if (!this.possibleUndos[index].length && this.undoPossible.getValue()) {
this.undoPossible.next(false);
} else if (this.possibleUndos[index].length && !this.undoPossible.getValue()) {
this.undoPossible.next(true);
if (!this.possibleUndos[index].length && this._undoPossible.getValue()) {
this._undoPossible.next(false);
} else if (this.possibleUndos[index].length && !this._undoPossible.getValue()) {
this._undoPossible.next(true);
}
if (!this.possibleRedos[index].length && this.redoPossible.getValue()) {
this.redoPossible.next(false);
} else if (this.possibleRedos[index].length && !this.redoPossible.getValue()) {
this.redoPossible.next(true);
if (!this.possibleRedos[index].length && this._redoPossible.getValue()) {
this._redoPossible.next(false);
} else if (this.possibleRedos[index].length && !this._redoPossible.getValue()) {
this._redoPossible.next(true);
}
}
}
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2020",
"module": "es2020",
"target": "ES2022",
"module": "ES2022",
"lib": [
"es2020",
"ES2022",
"dom"
],
"paths": {
Expand Down

0 comments on commit 20a6b51

Please sign in to comment.