|
@@ -4,9 +4,10 @@ import { NgClass, AsyncPipe, KeyValuePipe, JsonPipe } from '@angular/common';
|
|
|
import * as i1 from '@angular/platform-browser';
|
|
|
import { RouterLink } from '@angular/router';
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
-import { withLatestFrom, debounceTime, skip, BehaviorSubject, filter, Subject } from 'rxjs';
|
|
|
+import { withLatestFrom, debounceTime, skip, BehaviorSubject, filter, Subject, fromEvent } from 'rxjs';
|
|
|
import * as i1$1 from '@angular/forms';
|
|
|
import { NG_VALUE_ACCESSOR, ControlContainer, FormGroupDirective } from '@angular/forms';
|
|
|
+import { debounceTime as debounceTime$1, map, startWith } from 'rxjs/operators';
|
|
|
|
|
|
/**
|
|
|
* Used for some components to determine colouring of various elements. Relates to CSS classes to facilitate dev's life
|
|
@@ -804,6 +805,39 @@ class InputFormBase extends FormBase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+class ScreenSizeService {
|
|
|
+ constructor() {
|
|
|
+ this.destroyRef = inject(DestroyRef);
|
|
|
+ this.screenSizeSubject = new BehaviorSubject(this.getScreenSize());
|
|
|
+ this.screenSize$ = this.screenSizeSubject.asObservable();
|
|
|
+ fromEvent(window, 'resize')
|
|
|
+ .pipe(debounceTime$1(100), map(() => this.getScreenSize()), startWith(this.getScreenSize()), takeUntilDestroyed(this.destroyRef))
|
|
|
+ .subscribe(this.screenSizeSubject);
|
|
|
+ }
|
|
|
+ getScreenSize() {
|
|
|
+ const width = window.innerWidth;
|
|
|
+ if (width < 640)
|
|
|
+ return 'xs';
|
|
|
+ if (width >= 640 && width < 768)
|
|
|
+ return 'sm';
|
|
|
+ if (width >= 768 && width < 1024)
|
|
|
+ return 'md';
|
|
|
+ if (width >= 1024 && width < 1280)
|
|
|
+ return 'lg';
|
|
|
+ if (width >= 1280 && width < 1536)
|
|
|
+ return 'xl';
|
|
|
+ return '2xl';
|
|
|
+ }
|
|
|
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ScreenSizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
|
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ScreenSizeService, providedIn: 'root' }); }
|
|
|
+}
|
|
|
+i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ScreenSizeService, decorators: [{
|
|
|
+ type: Injectable,
|
|
|
+ args: [{
|
|
|
+ providedIn: 'root',
|
|
|
+ }]
|
|
|
+ }], ctorParameters: () => [] });
|
|
|
+
|
|
|
/*
|
|
|
* Public API Surface of circletone
|
|
|
*/
|
|
@@ -813,5 +847,5 @@ class InputFormBase extends FormBase {
|
|
|
* Generated bundle index. Do not edit.
|
|
|
*/
|
|
|
|
|
|
-export { AccordionComponent, AccordionItemComponent, AccordionRegistryService, AlertComponent, AvatarComponent, ButtonComponent, CardComponent, DropdownDirective, FormBase, HeaderComponent, IconComponent, InputComponent, InputFormBase, MenuComponent, MenuItemComponent, SafeImagePipe, SelectComponent, SelectFormBase, SizeEnum, TypeEnum, VariantEnum };
|
|
|
+export { AccordionComponent, AccordionItemComponent, AccordionRegistryService, AlertComponent, AvatarComponent, ButtonComponent, CardComponent, DropdownDirective, FormBase, HeaderComponent, IconComponent, InputComponent, InputFormBase, MenuComponent, MenuItemComponent, SafeImagePipe, ScreenSizeService, SelectComponent, SelectFormBase, SizeEnum, TypeEnum, VariantEnum };
|
|
|
//# sourceMappingURL=circletone.mjs.map
|