UNPKG

@taiga-ui/cdk

Version:

Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance

31 lines (27 loc) 1.58 kB
import { isPlatformBrowser, DOCUMENT } from '@angular/common'; import * as i0 from '@angular/core'; import { InjectionToken, inject, PLATFORM_ID, DestroyRef, Directive } from '@angular/core'; import { EMPTY_FUNCTION } from '@taiga-ui/cdk/constants'; import { tuiFontSizeWatcher } from '@taiga-ui/font-watcher'; const TUI_FONT_SIZE_HANDLER = new InjectionToken(ngDevMode ? 'TUI_FONT_SIZE_HANDLER' : ''); class TuiFontSize { constructor() { this.handler = inject(TUI_FONT_SIZE_HANDLER, { optional: true }); this.enabled = !inject(TuiFontSize, { optional: true, skipSelf: true }) && isPlatformBrowser(inject(PLATFORM_ID)) && typeof ResizeObserver !== 'undefined'; this.nothing = inject(DestroyRef).onDestroy(this.enabled && this.handler ? tuiFontSizeWatcher(this.handler, inject(DOCUMENT).createElement('iframe')) : EMPTY_FUNCTION); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiFontSize, deps: [], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: TuiFontSize, isStandalone: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiFontSize, decorators: [{ type: Directive }] }); /** * Generated bundle index. Do not edit. */ export { TUI_FONT_SIZE_HANDLER, TuiFontSize }; //# sourceMappingURL=taiga-ui-cdk-directives-font-size.mjs.map