angular-toolbox 0.0.1

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 ADDED
@@ -0,0 +1,24 @@
1
+ # AngularToolbox
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project angular-toolbox` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project angular-toolbox`.
8
+ > Note: Don't forget to add `--project angular-toolbox` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build angular-toolbox` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build angular-toolbox`, go to the dist folder `cd dist/angular-toolbox` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test angular-toolbox` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci10b29sYm94LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci10b29sYm94L3NyYy9hbmd1bGFyLXRvb2xib3gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,2 @@
1
+ export * from './safe/safe-html.pipe';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyLXRvb2xib3gvc3JjL2xpYi9waXBlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsdUJBQXVCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NhZmUvc2FmZS1odG1sLnBpcGUnOyJdfQ==
@@ -0,0 +1,18 @@
1
+ import { Pipe } from "@angular/core";
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "@angular/platform-browser";
4
+ export class SafeHtmlPipe {
5
+ constructor(_sanitizer) {
6
+ this._sanitizer = _sanitizer;
7
+ }
8
+ transform(value) {
9
+ return this._sanitizer.bypassSecurityTrustHtml(value);
10
+ }
11
+ }
12
+ SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
13
+ SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, name: "safeHtml" });
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, decorators: [{
15
+ type: Pipe,
16
+ args: [{ name: 'safeHtml' }]
17
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2FmZS1odG1sLnBpcGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc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WwodmFsdWUpO1xyXG4gIH1cclxufSJdfQ==
@@ -0,0 +1,2 @@
1
+ export * from './subscription/subscription.service';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyLXRvb2xib3gvc3JjL2xpYi9zZXJ2aWNlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUNBQXFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3N1YnNjcmlwdGlvbi9zdWJzY3JpcHRpb24uc2VydmljZSc7Il19
@@ -0,0 +1,60 @@
1
+ import { Injectable } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * A lightweight service that helps to manage unregistration issues of Angular subscriptions.
5
+ */
6
+ export class SubscriptionService {
7
+ constructor() {
8
+ /**
9
+ * The internal Subscription instances storage.
10
+ */
11
+ this._subMap = new Map();
12
+ }
13
+ /**
14
+ * Stores a new Subscription instance associated with the specified reference.
15
+ *
16
+ * @param ref the reference for which to store a new Subscription instance.
17
+ * @param subscription the Subscription instance to register.
18
+ * @returns a reference to this SubscriptionService instance.
19
+ */
20
+ register(ref, subscription) {
21
+ if (!this._subMap.has(ref))
22
+ this._subMap.set(ref, []);
23
+ this._subMap.get(ref)?.push(subscription);
24
+ return this;
25
+ }
26
+ /**
27
+ * Unsubscribes and removes all Subscription instances associated with the specified reference.
28
+ *
29
+ * @param ref the reference for which to remove all Subscription instances.
30
+ * @returns true whether the specified reference exists; false otherwise.
31
+ */
32
+ clearAll(ref) {
33
+ let result = false;
34
+ if (this._subMap.has(ref)) {
35
+ this._subMap.get(ref)?.forEach(subscription => subscription.unsubscribe());
36
+ this._subMap.delete(ref);
37
+ result = true;
38
+ }
39
+ return result;
40
+ }
41
+ /**
42
+ * Returns all Subscription instances associated with the specified reference.
43
+ *
44
+ * @param ref the reference for which to remove get Subscription instances.
45
+ * @returns all Subscription instances associated with the specified reference, or whether
46
+ * the specified reference does not exists.
47
+ */
48
+ get(ref) {
49
+ return this._subMap.get(ref) || null;
50
+ }
51
+ }
52
+ SubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
53
+ SubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, providedIn: 'root' });
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, decorators: [{
55
+ type: Injectable,
56
+ args: [{
57
+ providedIn: 'root'
58
+ }]
59
+ }] });
60
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Vic2NyaXB0aW9uLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyLXRvb2xib3gvc3JjL2xpYi9zZXJ2aWNlL3N1YnNjcmlwdGlvbi9zdWJzY3JpcHRpb24uc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQU0zQzs7R0FFRztBQUNILE1BQU0sT0FBTyxtQkFBbUI7SUFOaEM7UUFRSTs7V0FFRztRQUNLLFlBQU8sR0FBcUMsSUFBSSxHQUFHLEVBQStCLENBQUM7S0F5QzlGO0lBdkNHOzs7Ozs7T0FNRztJQUNJLFFBQVEsQ0FBQyxHQUFXLEVBQUUsWUFBMEI7UUFDbkQsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsR0F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FuY2VzIGFzc29jaWF0ZWQgd2l0aCB0aGUgc3BlY2lmaWVkIHJlZmVyZW5jZS5cbiAgICAgKiBcbiAgICAgKiBAcGFyYW0gcmVmIHRoZSByZWZlcmVuY2UgZm9yIHdoaWNoIHRvIHJlbW92ZSBnZXQgU3Vic2NyaXB0aW9uIGluc3RhbmNlcy5cbiAgICAgKiBAcmV0dXJucyBhbGwgU3Vic2NyaXB0aW9uIGluc3RhbmNlcyBhc3NvY2lhdGVkIHdpdGggdGhlIHNwZWNpZmllZCByZWZlcmVuY2UsIG9yIHdoZXRoZXJcbiAgICAgKiAgICAgICAgICB0aGUgc3BlY2lmaWVkIHJlZmVyZW5jZSBkb2VzIG5vdCBleGlzdHMuXG4gICAgICovXG4gICAgcHVibGljIGdldChyZWY6IFN0cmluZyk6IEFycmF5PFN1YnNjcmlwdGlvbj4gfCBudWxsIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuX3N1Yk1hcC5nZXQocmVmKSB8fCBudWxsO1xuICAgIH1cbn1cbiJdfQ==
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface of angular-toolbox
3
+ */
4
+ export * from './lib/pipe';
5
+ export * from './lib/service';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItdG9vbGJveC9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsWUFBWSxDQUFDO0FBQzNCLGNBQWMsZUFBZSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBhbmd1bGFyLXRvb2xib3hcbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2xpYi9waXBlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3NlcnZpY2UnO1xuIl19
@@ -0,0 +1,89 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, Injectable } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
4
+
5
+ class SafeHtmlPipe {
6
+ constructor(_sanitizer) {
7
+ this._sanitizer = _sanitizer;
8
+ }
9
+ transform(value) {
10
+ return this._sanitizer.bypassSecurityTrustHtml(value);
11
+ }
12
+ }
13
+ SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
14
+ SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, name: "safeHtml" });
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, decorators: [{
16
+ type: Pipe,
17
+ args: [{ name: 'safeHtml' }]
18
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
19
+
20
+ /**
21
+ * A lightweight service that helps to manage unregistration issues of Angular subscriptions.
22
+ */
23
+ class SubscriptionService {
24
+ constructor() {
25
+ /**
26
+ * The internal Subscription instances storage.
27
+ */
28
+ this._subMap = new Map();
29
+ }
30
+ /**
31
+ * Stores a new Subscription instance associated with the specified reference.
32
+ *
33
+ * @param ref the reference for which to store a new Subscription instance.
34
+ * @param subscription the Subscription instance to register.
35
+ * @returns a reference to this SubscriptionService instance.
36
+ */
37
+ register(ref, subscription) {
38
+ var _a;
39
+ if (!this._subMap.has(ref))
40
+ this._subMap.set(ref, []);
41
+ (_a = this._subMap.get(ref)) === null || _a === void 0 ? void 0 : _a.push(subscription);
42
+ return this;
43
+ }
44
+ /**
45
+ * Unsubscribes and removes all Subscription instances associated with the specified reference.
46
+ *
47
+ * @param ref the reference for which to remove all Subscription instances.
48
+ * @returns true whether the specified reference exists; false otherwise.
49
+ */
50
+ clearAll(ref) {
51
+ var _a;
52
+ let result = false;
53
+ if (this._subMap.has(ref)) {
54
+ (_a = this._subMap.get(ref)) === null || _a === void 0 ? void 0 : _a.forEach(subscription => subscription.unsubscribe());
55
+ this._subMap.delete(ref);
56
+ result = true;
57
+ }
58
+ return result;
59
+ }
60
+ /**
61
+ * Returns all Subscription instances associated with the specified reference.
62
+ *
63
+ * @param ref the reference for which to remove get Subscription instances.
64
+ * @returns all Subscription instances associated with the specified reference, or whether
65
+ * the specified reference does not exists.
66
+ */
67
+ get(ref) {
68
+ return this._subMap.get(ref) || null;
69
+ }
70
+ }
71
+ SubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
72
+ SubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, providedIn: 'root' });
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, decorators: [{
74
+ type: Injectable,
75
+ args: [{
76
+ providedIn: 'root'
77
+ }]
78
+ }] });
79
+
80
+ /*
81
+ * Public API Surface of angular-toolbox
82
+ */
83
+
84
+ /**
85
+ * Generated bundle index. Do not edit.
86
+ */
87
+
88
+ export { SafeHtmlPipe, SubscriptionService };
89
+ //# sourceMappingURL=angular-toolbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-toolbox.mjs","sources":["../../../projects/angular-toolbox/src/lib/pipe/safe/safe-html.pipe.ts","../../../projects/angular-toolbox/src/lib/service/subscription/subscription.service.ts","../../../projects/angular-toolbox/src/public-api.ts","../../../projects/angular-toolbox/src/angular-toolbox.ts"],"sourcesContent":["import { DomSanitizer, SafeHtml } from '@angular/platform-browser'\r\nimport { PipeTransform, Pipe } from \"@angular/core\";\r\n\r\n@Pipe({ name: 'safeHtml'})\r\nexport class SafeHtmlPipe implements PipeTransform {\r\n\r\n constructor(private _sanitizer: DomSanitizer) {}\r\n\r\n public transform(value: string): SafeHtml {\r\n return this._sanitizer.bypassSecurityTrustHtml(value);\r\n }\r\n}","import { Injectable } from '@angular/core';\nimport { Subscription } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\n/**\n * A lightweight service that helps to manage unregistration issues of Angular subscriptions.\n */\nexport class SubscriptionService {\n\n /**\n * The internal Subscription instances storage.\n */\n private _subMap: Map<String, Array<Subscription>> = new Map<String, Array<Subscription>>();\n\n /**\n * Stores a new Subscription instance associated with the specified reference.\n * \n * @param ref the reference for which to store a new Subscription instance.\n * @param subscription the Subscription instance to register.\n * @returns a reference to this SubscriptionService instance.\n */\n public register(ref: String, subscription: Subscription): SubscriptionService {\n if (!this._subMap.has(ref)) this._subMap.set(ref, []);\n this._subMap.get(ref)?.push(subscription);\n return this;\n }\n \n /**\n * Unsubscribes and removes all Subscription instances associated with the specified reference.\n * \n * @param ref the reference for which to remove all Subscription instances.\n * @returns true whether the specified reference exists; false otherwise.\n */\n public clearAll(ref: String): boolean {\n let result: boolean = false;\n if (this._subMap.has(ref)) {\n this._subMap.get(ref)?.forEach(subscription => subscription.unsubscribe());\n this._subMap.delete(ref);\n result = true;\n }\n return result;\n }\n\n /**\n * Returns all Subscription instances associated with the specified reference.\n * \n * @param ref the reference for which to remove get Subscription instances.\n * @returns all Subscription instances associated with the specified reference, or whether\n * the specified reference does not exists.\n */\n public get(ref: String): Array<Subscription> | null {\n return this._subMap.get(ref) || null;\n }\n}\n","/*\n * Public API Surface of angular-toolbox\n */\n\nexport * from './lib/pipe';\nexport * from './lib/service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAIa,YAAY,CAAA;AAEvB,IAAA,WAAA,CAAoB,UAAwB,EAAA;AAAxB,QAAA,IAAU,CAAA,UA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G,CAAC,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,CAAC,YAAY,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;AAC3E,YAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,MAAM,GAAG,IAAI,CAAC;AACjB,SAAA;AACD,QAAA,OAAO,MAAM,CAAC;KACjB;AAED;;;;;;AAMG;AACI,IAAA,GAAG,CAAC,GAAW,EAAA;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;KACxC;;gHA7CQ,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnB,mBAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cALhB,MAAM,EAAA,CAAA,CAAA;2FAKT,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAN/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE,MAAM;iBACrB,CAAA;;;ACLD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,87 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, Injectable } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
4
+
5
+ class SafeHtmlPipe {
6
+ constructor(_sanitizer) {
7
+ this._sanitizer = _sanitizer;
8
+ }
9
+ transform(value) {
10
+ return this._sanitizer.bypassSecurityTrustHtml(value);
11
+ }
12
+ }
13
+ SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
14
+ SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, name: "safeHtml" });
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeHtmlPipe, decorators: [{
16
+ type: Pipe,
17
+ args: [{ name: 'safeHtml' }]
18
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
19
+
20
+ /**
21
+ * A lightweight service that helps to manage unregistration issues of Angular subscriptions.
22
+ */
23
+ class SubscriptionService {
24
+ constructor() {
25
+ /**
26
+ * The internal Subscription instances storage.
27
+ */
28
+ this._subMap = new Map();
29
+ }
30
+ /**
31
+ * Stores a new Subscription instance associated with the specified reference.
32
+ *
33
+ * @param ref the reference for which to store a new Subscription instance.
34
+ * @param subscription the Subscription instance to register.
35
+ * @returns a reference to this SubscriptionService instance.
36
+ */
37
+ register(ref, subscription) {
38
+ if (!this._subMap.has(ref))
39
+ this._subMap.set(ref, []);
40
+ this._subMap.get(ref)?.push(subscription);
41
+ return this;
42
+ }
43
+ /**
44
+ * Unsubscribes and removes all Subscription instances associated with the specified reference.
45
+ *
46
+ * @param ref the reference for which to remove all Subscription instances.
47
+ * @returns true whether the specified reference exists; false otherwise.
48
+ */
49
+ clearAll(ref) {
50
+ let result = false;
51
+ if (this._subMap.has(ref)) {
52
+ this._subMap.get(ref)?.forEach(subscription => subscription.unsubscribe());
53
+ this._subMap.delete(ref);
54
+ result = true;
55
+ }
56
+ return result;
57
+ }
58
+ /**
59
+ * Returns all Subscription instances associated with the specified reference.
60
+ *
61
+ * @param ref the reference for which to remove get Subscription instances.
62
+ * @returns all Subscription instances associated with the specified reference, or whether
63
+ * the specified reference does not exists.
64
+ */
65
+ get(ref) {
66
+ return this._subMap.get(ref) || null;
67
+ }
68
+ }
69
+ SubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
70
+ SubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, providedIn: 'root' });
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SubscriptionService, decorators: [{
72
+ type: Injectable,
73
+ args: [{
74
+ providedIn: 'root'
75
+ }]
76
+ }] });
77
+
78
+ /*
79
+ * Public API Surface of angular-toolbox
80
+ */
81
+
82
+ /**
83
+ * Generated bundle index. Do not edit.
84
+ */
85
+
86
+ export { SafeHtmlPipe, SubscriptionService };
87
+ //# sourceMappingURL=angular-toolbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-toolbox.mjs","sources":["../../../projects/angular-toolbox/src/lib/pipe/safe/safe-html.pipe.ts","../../../projects/angular-toolbox/src/lib/service/subscription/subscription.service.ts","../../../projects/angular-toolbox/src/public-api.ts","../../../projects/angular-toolbox/src/angular-toolbox.ts"],"sourcesContent":["import { DomSanitizer, SafeHtml } from '@angular/platform-browser'\r\nimport { PipeTransform, Pipe } from \"@angular/core\";\r\n\r\n@Pipe({ name: 'safeHtml'})\r\nexport class SafeHtmlPipe implements PipeTransform {\r\n\r\n constructor(private _sanitizer: DomSanitizer) {}\r\n\r\n public transform(value: string): SafeHtml {\r\n return this._sanitizer.bypassSecurityTrustHtml(value);\r\n }\r\n}","import { Injectable } from '@angular/core';\nimport { Subscription } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\n/**\n * A lightweight service that helps to manage unregistration issues of Angular subscriptions.\n */\nexport class SubscriptionService {\n\n /**\n * The internal Subscription instances storage.\n */\n private _subMap: Map<String, Array<Subscription>> = new Map<String, Array<Subscription>>();\n\n /**\n * Stores a new Subscription instance associated with the specified reference.\n * \n * @param ref the reference for which to store a new Subscription instance.\n * @param subscription the Subscription instance to register.\n * @returns a reference to this SubscriptionService instance.\n */\n public register(ref: String, subscription: Subscription): SubscriptionService {\n if (!this._subMap.has(ref)) this._subMap.set(ref, []);\n this._subMap.get(ref)?.push(subscription);\n return this;\n }\n \n /**\n * Unsubscribes and removes all Subscription instances associated with the specified reference.\n * \n * @param ref the reference for which to remove all Subscription instances.\n * @returns true whether the specified reference exists; false otherwise.\n */\n public clearAll(ref: String): boolean {\n let result: boolean = false;\n if (this._subMap.has(ref)) {\n this._subMap.get(ref)?.forEach(subscription => subscription.unsubscribe());\n this._subMap.delete(ref);\n result = true;\n }\n return result;\n }\n\n /**\n * Returns all Subscription instances associated with the specified reference.\n * \n * @param ref the reference for which to remove get Subscription instances.\n * @returns all Subscription instances associated with the specified reference, or whether\n * the specified reference does not exists.\n */\n public get(ref: String): Array<Subscription> | null {\n return this._subMap.get(ref) || null;\n }\n}\n","/*\n * Public API Surface of angular-toolbox\n */\n\nexport * from './lib/pipe';\nexport * from './lib/service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAIa,YAAY,CAAA;AAEvB,IAAA,WAAA,CAAoB,UAAwB,EAAA;QAAxB,IAAU,CAAA,UAAA,GAAV,UAAU,CAAc;KAAI;AAEzC,IAAA,SAAS,CAAC,KAAa,EAAA;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;KACvD;;yGANU,YAAY,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;uGAAZ,YAAY,EAAA,IAAA,EAAA,UAAA,EAAA,CAAA,CAAA;2FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,IAAI;mBAAC,EAAE,IAAI,EAAE,UAAU,EAAC,CAAA;;;ACGzB;;AAEG;MAC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A,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cALhB,MAAM,EAAA,CAAA,CAAA;2FAKT,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAN/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE,MAAM;AACrB,iBAAA,CAAA;;;ACLD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="angular-toolbox" />
5
+ export * from './public-api';
@@ -0,0 +1 @@
1
+ export * from './safe/safe-html.pipe';
@@ -0,0 +1,10 @@
1
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
2
+ import { PipeTransform } from "@angular/core";
3
+ import * as i0 from "@angular/core";
4
+ export declare class SafeHtmlPipe implements PipeTransform {
5
+ private _sanitizer;
6
+ constructor(_sanitizer: DomSanitizer);
7
+ transform(value: string): SafeHtml;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<SafeHtmlPipe, never>;
9
+ static ɵpipe: i0.ɵɵPipeDeclaration<SafeHtmlPipe, "safeHtml", false>;
10
+ }
@@ -0,0 +1 @@
1
+ export * from './subscription/subscription.service';
@@ -0,0 +1,33 @@
1
+ import { Subscription } from 'rxjs';
2
+ import * as i0 from "@angular/core";
3
+ export declare class SubscriptionService {
4
+ /**
5
+ * The internal Subscription instances storage.
6
+ */
7
+ private _subMap;
8
+ /**
9
+ * Stores a new Subscription instance associated with the specified reference.
10
+ *
11
+ * @param ref the reference for which to store a new Subscription instance.
12
+ * @param subscription the Subscription instance to register.
13
+ * @returns a reference to this SubscriptionService instance.
14
+ */
15
+ register(ref: String, subscription: Subscription): SubscriptionService;
16
+ /**
17
+ * Unsubscribes and removes all Subscription instances associated with the specified reference.
18
+ *
19
+ * @param ref the reference for which to remove all Subscription instances.
20
+ * @returns true whether the specified reference exists; false otherwise.
21
+ */
22
+ clearAll(ref: String): boolean;
23
+ /**
24
+ * Returns all Subscription instances associated with the specified reference.
25
+ *
26
+ * @param ref the reference for which to remove get Subscription instances.
27
+ * @returns all Subscription instances associated with the specified reference, or whether
28
+ * the specified reference does not exists.
29
+ */
30
+ get(ref: String): Array<Subscription> | null;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<SubscriptionService, never>;
32
+ static ɵprov: i0.ɵɵInjectableDeclaration<SubscriptionService>;
33
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "angular-toolbox",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^15.1.0",
6
+ "@angular/core": "^15.1.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "module": "fesm2015/angular-toolbox.mjs",
13
+ "es2020": "fesm2020/angular-toolbox.mjs",
14
+ "esm2020": "esm2020/angular-toolbox.mjs",
15
+ "fesm2020": "fesm2020/angular-toolbox.mjs",
16
+ "fesm2015": "fesm2015/angular-toolbox.mjs",
17
+ "typings": "index.d.ts",
18
+ "exports": {
19
+ "./package.json": {
20
+ "default": "./package.json"
21
+ },
22
+ ".": {
23
+ "types": "./index.d.ts",
24
+ "esm2020": "./esm2020/angular-toolbox.mjs",
25
+ "es2020": "./fesm2020/angular-toolbox.mjs",
26
+ "es2015": "./fesm2015/angular-toolbox.mjs",
27
+ "node": "./fesm2015/angular-toolbox.mjs",
28
+ "default": "./fesm2020/angular-toolbox.mjs"
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,2 @@
1
+ export * from './lib/pipe';
2
+ export * from './lib/service';