@processpuzzle/widgets 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -2,7 +2,41 @@
2
2
  ![Build and Test](https://github.com/ZsZs/processpuzzle/actions/workflows/build-widgets.yml/badge.svg)
3
3
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=processpuzzle_widgets&metric=alert_status)](https://sonarcloud.io/summary?id=processpuzzle_widgets)
4
4
  [![Node version](https://img.shields.io/npm/v/%40processpuzzle%2Fwidgets?style=flat)](https://www.npmjs.com/package/@processpuzzle/widgets)
5
+
5
6
  This library provides a range of small widgets that can be built into an Angular application. These widgets primarily define UI elements
6
7
  but also domain classes or signal stores. Some of them are even persistent, so they need appropriate configuration to access the backend.
7
8
 
9
+ ## Language Selector Component
10
+ The **LanguageSelector** is an Angular component designed to allow users to select their preferred language in an application. It integrates seamlessly with the Transloco library for internationalization and supports dynamic updates of the application's language.
11
+
12
+ ### Features
13
+ - **Language Selection**: Allows switching between predefined languages.
14
+ - **Integration with Transloco**: Updates active language using `TranslocoService`.
15
+ - **Dynamic Label Translation**: Displays localized language names.
16
+ - **Single Selection**: Users can select only one language at a time.
17
+ - **Customizable Options**: Easily configure available languages and their labels.
18
+ ### Setup and Usage
19
+ #### Installation
20
+ Ensure that you have the required dependencies for Angular Material and Transloco installed:
21
+ ```
22
+ npm install @angular/material @jsverse/transloco
23
+ ```
24
+ ### Template Example
25
+ Add the `LanguageSelector` component to your application:
26
+ ```xhtml
27
+ <pp-language-selector [languages]="languages" [selectedLanguage]="selectedLanguage"></pp-language-selector>
28
+ ```
29
+ ### Component Configuration
30
+ #### Input Properties
31
+
32
+ | Input | Type | Description |
33
+ | --- | --- | --- |
34
+ | `languages` | `Array` | An array of available language objects. Each object should include `code`, `label`, and `flag`. |
35
+ | `selectedLanguage` | `string` | The current active language code. This value indicates which language is selected by default. |
36
+ Example Language Configuration:
37
+
38
+ ## Like Button Component
39
+
40
+ ## Navigate Back Button Component
8
41
 
42
+ ## Share Button Component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processpuzzle/widgets",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -17,10 +17,8 @@
17
17
  "dependencies": {
18
18
  "tslib": "^2.8.1"
19
19
  },
20
- "sideEffects": false,
21
- "module": "fesm2022/processpuzzle-widgets.mjs",
22
- "typings": "index.d.ts",
23
20
  "exports": {
21
+ "./i18n/*": "./i18n/pp-widgets/*",
24
22
  "./package.json": {
25
23
  "default": "./package.json"
26
24
  },
@@ -28,5 +26,12 @@
28
26
  "types": "./index.d.ts",
29
27
  "default": "./fesm2022/processpuzzle-widgets.mjs"
30
28
  }
31
- }
29
+ },
30
+ "files": [
31
+ "dist/libs/widgets/",
32
+ "i18n/"
33
+ ],
34
+ "sideEffects": false,
35
+ "module": "fesm2022/processpuzzle-widgets.mjs",
36
+ "typings": "index.d.ts"
32
37
  }
@@ -1,85 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, inject, Component } from '@angular/core';
3
- import { Stack } from '@processpuzzle/util';
4
- import * as i1 from '@angular/router';
5
- import { NavigationEnd } from '@angular/router';
6
- import { MatIcon } from '@angular/material/icon';
7
- import { MatIconButton } from '@angular/material/button';
8
-
9
- class NavigateBackService {
10
- router;
11
- routeHistory = new Stack();
12
- constructor(router) {
13
- this.router = router;
14
- this.router.events.subscribe((event) => {
15
- if (event instanceof NavigationEnd) {
16
- this.addRouteToStack(event.urlAfterRedirects); // Add the current route to the stack
17
- }
18
- });
19
- }
20
- // region public accessor methods
21
- goBack() {
22
- if (this.routeHistory.size() > 1) {
23
- this.routeHistory.pop(); // Remove current route
24
- const previousRoute = this.routeHistory.pop(); // Get the previous route
25
- if (previousRoute) {
26
- this.router.navigateByUrl(previousRoute); // Navigate to the previous route
27
- }
28
- }
29
- else {
30
- console.warn('No previous routes to navigate back to.');
31
- }
32
- }
33
- getRouteStack() {
34
- return this.routeHistory;
35
- }
36
- clearHistory() {
37
- this.routeHistory.clear();
38
- }
39
- // endregion
40
- // protected, private helper methods
41
- addRouteToStack(route) {
42
- if (this.routeHistory.size() === 0 || this.routeHistory.peek() !== route) {
43
- this.routeHistory.push(route);
44
- }
45
- }
46
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NavigateBackService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
47
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NavigateBackService, providedIn: 'root' });
48
- }
49
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NavigateBackService, decorators: [{
50
- type: Injectable,
51
- args: [{ providedIn: 'root' }]
52
- }], ctorParameters: () => [{ type: i1.Router }] });
53
-
54
- class NavigateBackComponent {
55
- service = inject(NavigateBackService);
56
- // region event handling methods
57
- onNavigateBack() {
58
- this.service.goBack(); // Call the service to handle navigation
59
- }
60
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NavigateBackComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
61
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: NavigateBackComponent, isStandalone: true, selector: "pp-navigate-back", ngImport: i0, template: `
62
- <button mat-icon-button aria-label="Go back" (click)="onNavigateBack()">
63
- <mat-icon class="material-symbols-outlined fat-back-arrow">arrow_back</mat-icon>
64
- </button>
65
- `, isInline: true, styles: [".fat-back-arrow{font-size:24px;font-variation-settings:\"wght\" 1200;color:#000}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] });
66
- }
67
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NavigateBackComponent, decorators: [{
68
- type: Component,
69
- args: [{ selector: 'pp-navigate-back', imports: [MatIcon, MatIconButton], template: `
70
- <button mat-icon-button aria-label="Go back" (click)="onNavigateBack()">
71
- <mat-icon class="material-symbols-outlined fat-back-arrow">arrow_back</mat-icon>
72
- </button>
73
- `, styles: [".fat-back-arrow{font-size:24px;font-variation-settings:\"wght\" 1200;color:#000}\n"] }]
74
- }] });
75
-
76
- /*
77
- * Public API Surface of @processpuzzle/widgets
78
- */
79
-
80
- /**
81
- * Generated bundle index. Do not edit.
82
- */
83
-
84
- export { NavigateBackComponent };
85
- //# sourceMappingURL=processpuzzle-widgets.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processpuzzle-widgets.mjs","sources":["../../../../libs/widgets/src/lib/navigate-back/navigate-back.service.ts","../../../../libs/widgets/src/lib/navigate-back/navigate-back.component.ts","../../../../libs/widgets/src/public-api.ts","../../../../libs/widgets/src/processpuzzle-widgets.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Stack } from '@processpuzzle/util';\nimport { NavigationEnd, Router } from '@angular/router';\n\n@Injectable({ providedIn: 'root' })\nexport class NavigateBackService {\n private routeHistory = new Stack<string>();\n\n constructor(private router: Router) {\n this.router.events.subscribe((event) => {\n if (event instanceof NavigationEnd) {\n this.addRouteToStack(event.urlAfterRedirects); // Add the current route to the stack\n }\n });\n }\n\n // region public accessor methods\n public goBack(): void {\n if (this.routeHistory.size() > 1) {\n this.routeHistory.pop(); // Remove current route\n const previousRoute = this.routeHistory.pop(); // Get the previous route\n if (previousRoute) {\n this.router.navigateByUrl(previousRoute); // Navigate to the previous route\n }\n } else {\n console.warn('No previous routes to navigate back to.');\n }\n }\n\n public getRouteStack(): Stack<string> {\n return this.routeHistory;\n }\n\n public clearHistory(): void {\n this.routeHistory.clear();\n }\n\n // endregion\n\n // protected, private helper methods\n private addRouteToStack(route: string): void {\n if (this.routeHistory.size() === 0 || this.routeHistory.peek() !== route) {\n this.routeHistory.push(route);\n }\n }\n\n // endregion\n}\n","import { Component, inject } from '@angular/core';\nimport { NavigateBackService } from './navigate-back.service';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatIconButton } from '@angular/material/button';\n\n@Component({\n selector: 'pp-navigate-back',\n imports: [MatIcon, MatIconButton],\n template: `\n <button mat-icon-button aria-label=\"Go back\" (click)=\"onNavigateBack()\">\n <mat-icon class=\"material-symbols-outlined fat-back-arrow\">arrow_back</mat-icon>\n </button>\n `,\n styles: [\n `\n .fat-back-arrow {\n font-size: 24px; /* Größerer und fetterer Pfeil */\n font-variation-settings: 'wght' 1200; /* Fettigkeitsgrad (700 = fett) */\n color: #000; /* Schwarz als Farbe */\n }\n `,\n ],\n})\nexport class NavigateBackComponent {\n readonly service = inject(NavigateBackService);\n\n // region event handling methods\n onNavigateBack(): void {\n this.service.goBack(); // Call the service to handle navigation\n }\n\n // endregion\n}\n","/*\n * Public API Surface of @processpuzzle/widgets\n */\n\nexport { NavigateBackComponent } from './lib/navigate-back/navigate-back.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAKa,mBAAmB,CAAA;AAGV,IAAA,MAAA;AAFZ,IAAA,YAAY,GAAG,IAAI,KAAK,EAAU;AAE1C,IAAA,WAAA,CAAoB,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM;QACxB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,KAAI;AACrC,YAAA,IAAI,KAAK,YAAY,aAAa,EAAE;gBAClC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;;AAElD,SAAC,CAAC;;;IAIG,MAAM,GAAA;QACX,IAAI,IAAI,CAAC,YAAY,CAAC,IA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AA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAArB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,EAftB,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA;;;;GAIT,EALS,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oFAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,OAAO,2IAAE,aAAa,EAAA,QAAA,EAAA,yBAAA,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAgBrB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAlBjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,WACnB,CAAC,OAAO,EAAE,aAAa,CAAC,EACvB,QAAA,EAAA;;;;AAIT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,oFAAA,CAAA,EAAA;;;ACZH;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@processpuzzle/widgets" />
5
- export * from './public-api';
@@ -1,8 +0,0 @@
1
- import { NavigateBackService } from './navigate-back.service';
2
- import * as i0 from "@angular/core";
3
- export declare class NavigateBackComponent {
4
- readonly service: NavigateBackService;
5
- onNavigateBack(): void;
6
- static ɵfac: i0.ɵɵFactoryDeclaration<NavigateBackComponent, never>;
7
- static ɵcmp: i0.ɵɵComponentDeclaration<NavigateBackComponent, "pp-navigate-back", never, {}, {}, never, never, true, never>;
8
- }
@@ -1,14 +0,0 @@
1
- import { Stack } from '@processpuzzle/util';
2
- import { Router } from '@angular/router';
3
- import * as i0 from "@angular/core";
4
- export declare class NavigateBackService {
5
- private router;
6
- private routeHistory;
7
- constructor(router: Router);
8
- goBack(): void;
9
- getRouteStack(): Stack<string>;
10
- clearHistory(): void;
11
- private addRouteToStack;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<NavigateBackService, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<NavigateBackService>;
14
- }
package/public-api.d.ts DELETED
@@ -1 +0,0 @@
1
- export { NavigateBackComponent } from './lib/navigate-back/navigate-back.component';