@dcsl/flex-ui 0.0.4

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,63 @@
1
+ # FlexNgControls
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build flex-ui-controls
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/flex-ui-controls
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
42
+
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
+
61
+ ## Additional Resources
62
+
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,70 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Renderer2, HostListener, ViewChild, Component } from '@angular/core';
3
+
4
+ class FlexPanelComponent {
5
+ resizeObserver;
6
+ mutationObserver;
7
+ comp;
8
+ renderer = inject(Renderer2);
9
+ constructor() { }
10
+ ngAfterViewInit() {
11
+ this.adjustHeight();
12
+ // ✅ Recalculate on window resize
13
+ if ('ResizeObserver' in window) {
14
+ this.resizeObserver = new ResizeObserver(() => this.adjustHeight());
15
+ this.resizeObserver.observe(document.body);
16
+ }
17
+ // ✅ Also observe DOM changes that may shift this element
18
+ this.mutationObserver = new MutationObserver(() => this.adjustHeight());
19
+ this.mutationObserver.observe(document.body, {
20
+ attributes: true,
21
+ childList: true,
22
+ subtree: true
23
+ });
24
+ }
25
+ onWindowResize() {
26
+ this.adjustHeight();
27
+ }
28
+ adjustHeight() {
29
+ // const host: HTMLElement = this.el.nativeElement;
30
+ const top = this.comp.nativeElement.getBoundingClientRect().top;
31
+ const viewportHeight = window.innerHeight;
32
+ const newHeight = viewportHeight - top;
33
+ this.renderer.setStyle(this.comp?.nativeElement, 'height', `${newHeight}px`);
34
+ this.renderer.setStyle(this.comp?.nativeElement, 'width', '100%');
35
+ // console.log(host);
36
+ }
37
+ ngOnDestroy() {
38
+ if (this.resizeObserver) {
39
+ this.resizeObserver.disconnect();
40
+ }
41
+ if (this.mutationObserver) {
42
+ this.mutationObserver.disconnect();
43
+ }
44
+ }
45
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
46
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: FlexPanelComponent, isStandalone: true, selector: "lib-flex-panel", host: { listeners: { "window:resize": "onWindowResize()" } }, viewQueries: [{ propertyName: "comp", first: true, predicate: ["abc"], descendants: true }], ngImport: i0, template: "<div class=\"stretch-container\" #abc>\r\n <ng-content></ng-content>\r\n</div>", styles: [".stretch-container{width:100%;height:100%}\n"] });
47
+ }
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexPanelComponent, decorators: [{
49
+ type: Component,
50
+ args: [{ selector: 'lib-flex-panel', imports: [], template: "<div class=\"stretch-container\" #abc>\r\n <ng-content></ng-content>\r\n</div>", styles: [".stretch-container{width:100%;height:100%}\n"] }]
51
+ }], ctorParameters: () => [], propDecorators: { comp: [{
52
+ type: ViewChild,
53
+ args: ["abc"]
54
+ }], onWindowResize: [{
55
+ type: HostListener,
56
+ args: ['window:resize']
57
+ }] } });
58
+
59
+ /*
60
+ * Public API Surface of flex-ui-controls
61
+ */
62
+ // export * from './lib/flex-ui-controls.service';
63
+ // export * from './lib/flex-ui-controls.component';
64
+
65
+ /**
66
+ * Generated bundle index. Do not edit.
67
+ */
68
+
69
+ export { FlexPanelComponent };
70
+ //# sourceMappingURL=dcsl-flex-ui.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dcsl-flex-ui.mjs","sources":["../../../projects/flex-ui-controls/src/lib/flex-panel/flex-panel.component.ts","../../../projects/flex-ui-controls/src/lib/flex-panel/flex-panel.component.html","../../../projects/flex-ui-controls/src/public-api.ts","../../../projects/flex-ui-controls/src/dcsl-flex-ui.ts"],"sourcesContent":["import { Component, ElementRef, HostListener, inject, Renderer2, ViewChild } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-flex-panel',\r\n imports: [],\r\n templateUrl: './flex-panel.component.html',\r\n styleUrl: './flex-panel.component.css'\r\n})\r\n\r\nexport class FlexPanelComponent {\r\n private resizeObserver?: ResizeObserver;\r\n private mutationObserver?: MutationObserver;\r\n\r\n @ViewChild(\"abc\") comp?: ElementRef<HTMLDivElement>;\r\n\r\n private renderer = inject(Renderer2);\r\n\r\n constructor() { }\r\n\r\n ngAfterViewInit() {\r\n this.adjustHeight();\r\n\r\n // ✅ Recalculate on window resize\r\n if ('ResizeObserver' in window) {\r\n this.resizeObserver = new ResizeObserver(() => this.adjustHeight());\r\n this.resizeObserver.observe(document.body);\r\n }\r\n\r\n // ✅ Also observe DOM changes that may shift this element\r\n this.mutationObserver = new MutationObserver(() => this.adjustHeight());\r\n this.mutationObserver.observe(document.body, {\r\n attributes: true,\r\n childList: true,\r\n subtree: true\r\n });\r\n\r\n\r\n }\r\n\r\n @HostListener('window:resize')\r\n onWindowResize() {\r\n this.adjustHeight();\r\n }\r\n\r\n private adjustHeight() {\r\n // const host: HTMLElement = this.el.nativeElement;\r\n const top = this.comp!.nativeElement.getBoundingClientRect().top;\r\n const viewportHeight = window.innerHeight;\r\n const newHeight = viewportHeight - top;\r\n\r\n this.renderer.setStyle(this.comp?.nativeElement, 'height', `${newHeight}px`);\r\n this.renderer.setStyle(this.comp?.nativeElement, 'width', '100%');\r\n\r\n // console.log(host);\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.resizeObserver) {\r\n this.resizeObserver.disconnect();\r\n }\r\n if (this.mutationObserver) {\r\n this.mutationObserver.disconnect();\r\n }\r\n }\r\n}\r\n","<div class=\"stretch-container\" #abc>\r\n <ng-content></ng-content>\r\n</div>","/*\r\n * Public API Surface of flex-ui-controls\r\n */\r\n\r\n// export * from './lib/flex-ui-controls.service';\r\n// export * from './lib/flex-ui-controls.component';\r\nexport * from './lib/flex-panel/flex-panel.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MASa,kBAAkB,CAAA;AACrB,IAAA,cAAc;AACd,IAAA,gBAAgB;AAEN,IAAA,IAAI;AAEd,IAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAEpC,IAAA,WAAA,GAAA,EAAgB;IAEhB,eAAe,GAAA;QACb,IAAI,CAAC,YAAY,EAAE;;AAGnB,QAAA,IAAI,gBAAgB,IAAI,MAAM,EAAE;AAC9B,YAAA,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YACnE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5C;;AAGA,QAAA,IAAI,CAAC,gBAAgB,GAAG,I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EAAA,CAAA,8CAAA,CAAA,EAAA,CAAA;;2FDOO,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,WACjB,EAAE,EAAA,QAAA,EAAA,mFAAA,EAAA,MAAA,EAAA,CAAA,8CAAA,CAAA,EAAA;wDASO,IAAI,EAAA,CAAA;sBAArB,SAAS;uBAAC,KAAK;gBA2BhB,cAAc,EAAA,CAAA;sBADb,YAAY;uBAAC,eAAe;;;AEvC/B;;AAEG;AAEH;AACA;;ACLA;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import * as i0 from '@angular/core';
2
+ import { ElementRef } from '@angular/core';
3
+
4
+ declare class FlexPanelComponent {
5
+ private resizeObserver?;
6
+ private mutationObserver?;
7
+ comp?: ElementRef<HTMLDivElement>;
8
+ private renderer;
9
+ constructor();
10
+ ngAfterViewInit(): void;
11
+ onWindowResize(): void;
12
+ private adjustHeight;
13
+ ngOnDestroy(): void;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<FlexPanelComponent, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<FlexPanelComponent, "lib-flex-panel", never, {}, {}, never, ["*"], true, never>;
16
+ }
17
+
18
+ export { FlexPanelComponent };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@dcsl/flex-ui",
3
+ "version": "0.0.4",
4
+ "peerDependencies": {
5
+ "@angular/common": ">=20.0.0",
6
+ "@angular/core": ">=20.0.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "module": "fesm2022/dcsl-flex-ui.mjs",
13
+ "typings": "index.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./index.d.ts",
20
+ "default": "./fesm2022/dcsl-flex-ui.mjs"
21
+ }
22
+ }
23
+ }