angular-toolbox 1.1.1 → 1.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.
Files changed (33) hide show
  1. package/README.md +24 -24
  2. package/esm2022/lib/model/business/ui/index.mjs +2 -1
  3. package/esm2022/lib/model/business/ui/window/index.mjs +5 -0
  4. package/esm2022/lib/model/business/ui/window/window-feature-state.mjs +22 -0
  5. package/esm2022/lib/model/business/ui/window/window-init.mjs +9 -0
  6. package/esm2022/lib/model/business/ui/window/window-ref.mjs +9 -0
  7. package/esm2022/lib/model/business/ui/window/window-target.mjs +34 -0
  8. package/esm2022/lib/model/service/mock/http/logging/atx-http-mock-console.service.mjs +45 -55
  9. package/esm2022/lib/model/service/ui/index.mjs +2 -1
  10. package/esm2022/lib/model/service/ui/window/abstract-window.service.mjs +44 -0
  11. package/esm2022/lib/model/service/ui/window/index.mjs +3 -0
  12. package/esm2022/lib/model/service/ui/window/window.service.mjs +97 -0
  13. package/esm2022/lib/model/service/version/angular-toolbox-version.service.mjs +4 -4
  14. package/esm2022/lib/util/window/window-features-builder.mjs +78 -0
  15. package/esm2022/lib/util/window/window-header-tag-util.mjs +42 -0
  16. package/fesm2022/angular-toolbox.mjs +371 -57
  17. package/fesm2022/angular-toolbox.mjs.map +1 -1
  18. package/lib/model/business/ui/index.d.ts +1 -0
  19. package/lib/model/business/ui/window/index.d.ts +4 -0
  20. package/lib/model/business/ui/window/window-feature-state.d.ts +20 -0
  21. package/lib/model/business/ui/window/window-init.d.ts +70 -0
  22. package/lib/model/business/ui/window/window-ref.d.ts +21 -0
  23. package/lib/model/business/ui/window/window-target.d.ts +32 -0
  24. package/lib/model/service/mock/http/logging/atx-http-mock-console.service.d.ts +17 -23
  25. package/lib/model/service/ui/index.d.ts +1 -0
  26. package/lib/model/service/ui/window/abstract-window.service.d.ts +60 -0
  27. package/lib/model/service/ui/window/index.d.ts +2 -0
  28. package/lib/model/service/ui/window/window.service.d.ts +48 -0
  29. package/lib/util/window/window-features-builder.d.ts +42 -0
  30. package/lib/util/window/window-header-tag-util.d.ts +27 -0
  31. package/package.json +1 -1
  32. package/esm2022/lib/model/business/mock/http/popup/atx-http-mock-console-popup.mjs +0 -9
  33. package/lib/model/business/mock/http/popup/atx-http-mock-console-popup.d.ts +0 -23
@@ -2,3 +2,4 @@ export * from './dark-mode-config';
2
2
  export * from './dark-mode.constant';
3
3
  export * from './dark-mode-config.provider';
4
4
  export * from './scroll-behavior.type';
5
+ export * from './window';
@@ -0,0 +1,4 @@
1
+ export * from './window-ref';
2
+ export * from './window-init';
3
+ export * from './window-feature-state';
4
+ export * from './window-target';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ /**
9
+ * Specifies values used to activate, or deactivate, a feature for a browser window created by the `WindowService.open()` method.
10
+ */
11
+ export declare enum WindowFeatureState {
12
+ /**
13
+ * The value used to activate a feature.
14
+ */
15
+ YES = "yes",
16
+ /**
17
+ * The value used to deactivate a feature.
18
+ */
19
+ NO = "no"
20
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { WindowFeatureState } from "./window-feature-state";
9
+ import { WindowTarget } from "./window-target";
10
+ /**
11
+ * Defines the APi used to initialize the windows created by the `WindowService.open()` method.
12
+ */
13
+ export interface WindowInit {
14
+ /**
15
+ * The name of the browsing context the resource is being loaded into.
16
+ */
17
+ target?: WindowTarget;
18
+ /**
19
+ * The title of the new window.
20
+ */
21
+ title?: string;
22
+ /**
23
+ * The icon of the new window.
24
+ */
25
+ icon?: string;
26
+ /**
27
+ * Specifies the distance in pixels from the left side of the work area as defined by the user's operating system where the new window will be generated.
28
+ */
29
+ left?: number;
30
+ /**
31
+ * Specifies the distance in pixels from the top side of the work area as defined by the user's operating system where the new window will be generated.
32
+ */
33
+ top?: number;
34
+ /**
35
+ * Specifies the width of the content area, including scrollbars. The minimum required value is `100`.
36
+ */
37
+ width?: number;
38
+ /**
39
+ * Specifies the height of the content area, including scrollbars. The minimum required value is `100`.
40
+ */
41
+ height?: number;
42
+ /**
43
+ * Specifies whether the directories are activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
44
+ */
45
+ directories?: WindowFeatureState;
46
+ /**
47
+ * Specifies whether the title bar is activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
48
+ */
49
+ titlebar?: WindowFeatureState;
50
+ /**
51
+ * Specifies whether the scrollbars are activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
52
+ */
53
+ scrollbars?: WindowFeatureState;
54
+ /**
55
+ * Specifies whether the toolbar is activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
56
+ */
57
+ toolbar?: WindowFeatureState;
58
+ /**
59
+ * Specifies whether the location is activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
60
+ */
61
+ location?: WindowFeatureState;
62
+ /**
63
+ * Specifies whether the status is activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
64
+ */
65
+ status?: WindowFeatureState;
66
+ /**
67
+ * Specifies whether the menu bar is activated (`WindowFeatureState.YES`), or not (`WindowFeatureState.NO`).
68
+ */
69
+ menubar?: WindowFeatureState;
70
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { ComponentRef } from "@angular/core";
9
+ /**
10
+ * Defines the type of objects managed by the `AbstractWindowService` class.
11
+ */
12
+ export interface WindowRef<T, U> {
13
+ /**
14
+ * The reference to a window stored within the `AbstractWindowService` class.
15
+ */
16
+ window: U;
17
+ /**
18
+ * The reference to the Angular component displayed within a window.
19
+ */
20
+ componentRef: ComponentRef<T>;
21
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ /**
9
+ * Specifies the name of the browsing context the resource is being loaded into.
10
+ */
11
+ export declare enum WindowTarget {
12
+ /**
13
+ * The current browsing context.
14
+ */
15
+ SELF = "self",
16
+ /**
17
+ * Usually a new tab, but users can configure browsers to open a new window instead.
18
+ */
19
+ BLANK = "_blank",
20
+ /**
21
+ * The parent browsing context of the current one. If no parent, behaves as `WindowTarget.SELF`.
22
+ */
23
+ PARENT = "_parent",
24
+ /**
25
+ * The topmost browsing context.
26
+ */
27
+ TOP = "_top",
28
+ /**
29
+ * Allows embedded fenced frames to navigate the top-level frame.
30
+ */
31
+ UNFENCED_TOP = "_unfencedTop"
32
+ }
@@ -5,53 +5,47 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be found in
6
6
  * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
7
  */
8
- import { ApplicationRef, OnDestroy } from "@angular/core";
9
- import { AtxHttpMockConsolePopup } from "../../../../business/mock/http/popup/atx-http-mock-console-popup";
8
+ import { OnDestroy } from "@angular/core";
9
+ import { AtxMonitoringConsoleComponent } from "../../../../../framework/mock/http-monitoring-console";
10
+ import { WindowService } from "../../../ui";
11
+ import { WindowInit, WindowRef } from "../../../../business";
10
12
  import * as i0 from "@angular/core";
13
+ /**
14
+ * @private
15
+ */
16
+ export declare const FEATURES: WindowInit;
11
17
  /**
12
18
  * Provides functionality to display the ATX monitoring console within a new window.
13
19
  */
14
20
  export declare class AtxHttpMockConsoleService implements OnDestroy {
15
- private _appRef;
16
- /**
17
- * @private
18
- */
19
- private _window;
20
- /**
21
- * @private
22
- */
23
- private _componentRef;
21
+ private _windowSrv;
24
22
  /**
25
23
  * @private
26
24
  */
27
- readonly ICON: string;
25
+ private _uuid;
28
26
  /**
29
27
  * @private
30
28
  */
31
- constructor(_appRef: ApplicationRef);
29
+ constructor(_windowSrv: WindowService);
32
30
  /**
33
31
  * Opens the ATX monitoring console within a new window and returns reference objects
34
32
  * to control it.
35
- *
36
- * @returns An `AtxHttpMockConsolePopup` object.
37
33
  */
38
- open(): AtxHttpMockConsolePopup | null;
34
+ open(): void;
39
35
  /**
40
36
  * Closes the ATX monitoring console currently opened within a popup window.
41
37
  */
42
38
  close(): void;
43
39
  /**
44
- * @private
45
- */
46
- ngOnDestroy(): void;
47
- /**
48
- * @private
40
+ * Returns reference to the opened popup window.
41
+ *
42
+ * @returns A `WindowRef` object, or undefined if the ATX monitoring console is not opened.
49
43
  */
50
- private beforUnloadHandler;
44
+ getWindowRef(): WindowRef<AtxMonitoringConsoleComponent, Window> | undefined;
51
45
  /**
52
46
  * @private
53
47
  */
54
- private createHeadTags;
48
+ ngOnDestroy(): void;
55
49
  static ɵfac: i0.ɵɵFactoryDeclaration<AtxHttpMockConsoleService, never>;
56
50
  static ɵprov: i0.ɵɵInjectableDeclaration<AtxHttpMockConsoleService>;
57
51
  }
@@ -1,3 +1,4 @@
1
1
  export * from './dark-mode.service';
2
2
  export * from './scroll.service';
3
3
  export * from './app-bridge.service';
4
+ export * from './window';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { Type } from "@angular/core";
9
+ import { Uuid } from "../../../../util";
10
+ import { Destroyable, WindowRef } from "../../../business";
11
+ /**
12
+ * The abstract class that must be implemented by services that provide
13
+ * functionality to display Angular component within a new browser window.
14
+ */
15
+ export declare abstract class AbstractWindowService implements Destroyable {
16
+ /**
17
+ * @private
18
+ */
19
+ protected windowRefMap: Map<Uuid, WindowRef<any, any>>;
20
+ /**
21
+ * Returns the window reference object associated with the specified `Uuid` object.
22
+ *
23
+ * @param uuid The `Uuid` object associated with the window reference to get.
24
+ *
25
+ * @returns A `WindowRef` object, or `undefined` if the reference cannot be found.
26
+ */
27
+ get(uuid: Uuid): WindowRef<any, any> | undefined;
28
+ /**
29
+ * Returns all the window reference objects created by the service.
30
+ *
31
+ * @returns A list of `WindowRef` objects created by this service.
32
+ */
33
+ getAll(): WindowRef<any, any>[];
34
+ /**
35
+ * @private
36
+ */
37
+ destroy(): void;
38
+ /**
39
+ * Opens a new browser window with the specified properties and attaches an instance of
40
+ * the specified component into the window container.
41
+ *
42
+ * @param component The component to attach in the new window.
43
+ * @param init The config used to initialize the window.
44
+ *
45
+ * @returns A `Uuid` object.
46
+ */
47
+ abstract open<T>(component: Type<T>, init?: any): Uuid;
48
+ /**
49
+ * Closes the window associated with the specified `Uuid` object.
50
+ *
51
+ * @param uuid The `Uuid` object associated with the window to close.
52
+ *
53
+ * @returns `true` whether the window exists and is closed; `false` otherwise.
54
+ */
55
+ abstract close(uuid: Uuid): boolean;
56
+ /**
57
+ * Closes all opened windows.
58
+ */
59
+ abstract closeAll(): void;
60
+ }
@@ -0,0 +1,2 @@
1
+ export * from './abstract-window.service';
2
+ export * from './window.service';
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { ApplicationRef, OnDestroy, Type } from "@angular/core";
9
+ import { Uuid } from "../../../../util";
10
+ import { WindowInit } from "../../../business";
11
+ import { AbstractWindowService } from "./abstract-window.service";
12
+ import * as i0 from "@angular/core";
13
+ /**
14
+ * Provides functionality to display Angular component within a new browser window.
15
+ */
16
+ export declare class WindowService extends AbstractWindowService implements OnDestroy {
17
+ private _appRef;
18
+ /**
19
+ * @private
20
+ */
21
+ constructor(_appRef: ApplicationRef);
22
+ /**
23
+ * @inheritdoc
24
+ */
25
+ open<T>(component: Type<T>, init?: WindowInit): Uuid;
26
+ /**
27
+ * @inheritdoc
28
+ */
29
+ close(uuid: Uuid): boolean;
30
+ /**
31
+ * @inheritdoc
32
+ */
33
+ closeAll(): void;
34
+ /**
35
+ * @private
36
+ */
37
+ ngOnDestroy(): void;
38
+ /**
39
+ * @private
40
+ */
41
+ private beforUnloadHandler;
42
+ /**
43
+ * @private
44
+ */
45
+ private getTarget;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<WindowService, never>;
47
+ static ɵprov: i0.ɵɵInjectableDeclaration<WindowService>;
48
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { WindowInit } from "../../model";
9
+ /**
10
+ * A static builder that creates the features associated with a popup window created by
11
+ * the `WindowService.open()` method.
12
+ */
13
+ export declare class BrowserWindowFeaturesBuilder {
14
+ /**
15
+ * Builds a string that represents the features parameter of the `Window.open()` method.
16
+ *
17
+ * @param init A `WindowInit` object that contains data to initialize the features string.
18
+ *
19
+ * @returns A string that represents the features parameter of the `Window.open()` method.
20
+ */
21
+ static build(init?: WindowInit): string;
22
+ /**
23
+ * @private
24
+ */
25
+ static getLeft(init?: WindowInit): string;
26
+ /**
27
+ * @private
28
+ */
29
+ static getTop(init?: WindowInit): string;
30
+ /**
31
+ * @private
32
+ */
33
+ static getWidth(init?: WindowInit): string;
34
+ /**
35
+ * @private
36
+ */
37
+ static getHeight(init?: WindowInit): string;
38
+ /**
39
+ * @private
40
+ */
41
+ static getPopupProp(property: string, init?: WindowInit): string;
42
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { WindowInit } from "../../model";
9
+ /**
10
+ * A static utility class that creates header tags for windows created by the `WindowService.open()` method.
11
+ */
12
+ export declare class WindowHeaderTagUtil {
13
+ /**
14
+ * Sets the title of the specified window if defined in the `WindowInit` config object.
15
+ *
16
+ * @param win The window for which to set the title.
17
+ * @param init The `WindowInit` config object used to initialize the window.
18
+ */
19
+ static setTitle(win: Window, init?: WindowInit): void;
20
+ /**
21
+ * Sets the icon of the specified window if defined in the `WindowInit` config object.
22
+ *
23
+ * @param win The window for which to set the icon.
24
+ * @param init The `WindowInit` config object used to initialize the window.
25
+ */
26
+ static setIcon(win: Window, init?: WindowInit): void;
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-toolbox",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^18.0.0",
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Pascal ECHEMANN. All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be found in
6
- * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
- */
8
- export {};
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR4LWh0dHAtbW9jay1jb25zb2xlLXBvcHVwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci10b29sYm94L3NyYy9saWIvbW9kZWwvYnVzaW5lc3MvbW9jay9odHRwL3BvcHVwL2F0eC1odHR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VydmljZWAgY2xhc3MuXHJcbiAgICAgKi9cclxuICAgIHBvcHVwOiBXaW5kb3c7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBUaGUgcmVmZXJlbmNlIHRvIGEgYEF0eE1vbml0b3JpbmdDb25zb2xlQ29tcG9uZW50YCBpbnN0YW5jZSBjcmVhdGVkIHdpdGggdGhlIGBBdHhIdHRwTW9ja0NvbnNvbGVTZXJ2aWNlYCBjbGFzcy5cclxuICAgICAqL1xyXG4gICAgY29tcG9uZW50UmVmOiBDb21wb25lbnRSZWY8QXR4TW9uaXRvcmluZ0NvbnNvbGVDb21wb25lbnQ+O1xyXG59Il19
@@ -1,23 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Pascal ECHEMANN. All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be found in
6
- * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
- */
8
- import { ComponentRef } from "@angular/core";
9
- import { AtxMonitoringConsoleComponent } from "../../../../../framework";
10
- /**
11
- * The `AtxHttpMockConsolePopup` interface provides component references for
12
- * the ATX monitoring console objects created with the `AtxHttpMockConsoleService` class.
13
- */
14
- export interface AtxHttpMockConsolePopup {
15
- /**
16
- * The reference to a popup window created with the `AtxHttpMockConsoleService` class.
17
- */
18
- popup: Window;
19
- /**
20
- * The reference to a `AtxMonitoringConsoleComponent` instance created with the `AtxHttpMockConsoleService` class.
21
- */
22
- componentRef: ComponentRef<AtxMonitoringConsoleComponent>;
23
- }