@taiga-ui/kit
Version:
Taiga UI Angular main components kit
55 lines (51 loc) • 17.1 kB
JavaScript
import * as i0 from '@angular/core';
import { Component, ViewEncapsulation, ChangeDetectionStrategy, inject, Directive, Input } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { ResizeObserverService } from '@ng-web-apis/resize-observer';
import { tuiZonefull, tuiWatch } from '@taiga-ui/cdk/observables';
import { tuiWithStyles } from '@taiga-ui/cdk/utils/miscellaneous';
import { map } from 'rxjs';
const rowsInSvg = 3;
class TuiSensitiveStyles {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSensitiveStyles, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSensitiveStyles, isStandalone: true, selector: "ng-component", host: { classAttribute: "tui-sensitive-styles" }, ngImport: i0, template: '', isInline: true, styles: [".tui-sensitive{position:relative;line-height:1em;clip-path:inset(0 round .25rem)}.tui-sensitive:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:\"\";display:block!important;background:currentColor;border-radius:inherit;-webkit-mask:url('data:image/svg+xml,<svg width=\"360\" height=\"72\" preserveAspectRatio=\"none\" fill=\"black\" xmlns=\"http://www.w3.org/2000/svg\"><rect opacity=\"0.2\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"336\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"120\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"216\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"312\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"144\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"192\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"288\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"240\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.24\" x=\"72\" width=\"24\" height=\"24\"/><rect opacity=\"0.34\" x=\"264\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"168\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"336\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"120\" y=\"0\" width=\"24\" height=\"24\" /><rect opacity=\"0.3\" x=\"216\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"24\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"312\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"144\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"192\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"48\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"288\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.38\" x=\"96\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"240\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"72\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"264\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" x=\"168\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"240\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"72\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"192\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.34\" x=\"216\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"24\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"168\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"264\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.31\" x=\"288\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"312\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.28\" x=\"144\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"336\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"120\" y=\"48\" width=\"24\" height=\"24\"/></svg>') var(--t-offset, 0) 0 / auto var(--t-mask-height);mask:url('data:image/svg+xml,<svg width=\"360\" height=\"72\" preserveAspectRatio=\"none\" fill=\"black\" xmlns=\"http://www.w3.org/2000/svg\"><rect opacity=\"0.2\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"336\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"120\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"216\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"312\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"144\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"192\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"288\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"240\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.24\" x=\"72\" width=\"24\" height=\"24\"/><rect opacity=\"0.34\" x=\"264\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"168\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"336\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"120\" y=\"0\" width=\"24\" height=\"24\" /><rect opacity=\"0.3\" x=\"216\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"24\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"312\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"144\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"192\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"48\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"288\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.38\" x=\"96\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"240\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"72\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"264\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" x=\"168\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"240\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"72\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"192\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.34\" x=\"216\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"24\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"168\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"264\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.31\" x=\"288\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"312\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.28\" x=\"144\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"336\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"120\" y=\"48\" width=\"24\" height=\"24\"/></svg>') var(--t-offset, 0) 0 / auto var(--t-mask-height);margin:0!important}.tui-sensitive.tui-sensitive{-webkit-text-fill-color:transparent}span.tui-sensitive,a.tui-sensitive{display:inline-block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSensitiveStyles, decorators: [{
type: Component,
args: [{ standalone: true, template: '', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
class: 'tui-sensitive-styles',
}, styles: [".tui-sensitive{position:relative;line-height:1em;clip-path:inset(0 round .25rem)}.tui-sensitive:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:\"\";display:block!important;background:currentColor;border-radius:inherit;-webkit-mask:url('data:image/svg+xml,<svg width=\"360\" height=\"72\" preserveAspectRatio=\"none\" fill=\"black\" xmlns=\"http://www.w3.org/2000/svg\"><rect opacity=\"0.2\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"336\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"120\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"216\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"312\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"144\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"192\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"288\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"240\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.24\" x=\"72\" width=\"24\" height=\"24\"/><rect opacity=\"0.34\" x=\"264\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"168\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"336\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"120\" y=\"0\" width=\"24\" height=\"24\" /><rect opacity=\"0.3\" x=\"216\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"24\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"312\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"144\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"192\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"48\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"288\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.38\" x=\"96\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"240\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"72\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"264\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" x=\"168\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"240\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"72\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"192\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.34\" x=\"216\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"24\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"168\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"264\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.31\" x=\"288\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"312\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.28\" x=\"144\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"336\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"120\" y=\"48\" width=\"24\" height=\"24\"/></svg>') var(--t-offset, 0) 0 / auto var(--t-mask-height);mask:url('data:image/svg+xml,<svg width=\"360\" height=\"72\" preserveAspectRatio=\"none\" fill=\"black\" xmlns=\"http://www.w3.org/2000/svg\"><rect opacity=\"0.2\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"336\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"120\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"216\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"312\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"144\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"192\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"288\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"240\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.24\" x=\"72\" width=\"24\" height=\"24\"/><rect opacity=\"0.34\" x=\"264\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"168\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"336\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"120\" y=\"0\" width=\"24\" height=\"24\" /><rect opacity=\"0.3\" x=\"216\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"24\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"312\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"144\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"192\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"48\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"288\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.38\" x=\"96\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"240\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"72\" y=\"24\" width=\"24\" height=\"24\"/><rect opacity=\"0.2\" x=\"264\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" x=\"168\" y=\"0\" width=\"24\" height=\"24\"/><rect opacity=\"0.35\" x=\"240\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.4\" x=\"72\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"192\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"48\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.34\" x=\"216\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"24\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"168\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.32\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"264\" y=\"48\" width=\"24\" height=\"24\"/> <rect opacity=\"0.31\" x=\"288\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.3\" x=\"96\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.25\" x=\"312\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.28\" x=\"144\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.36\" x=\"336\" y=\"48\" width=\"24\" height=\"24\"/><rect opacity=\"0.21\" x=\"120\" y=\"48\" width=\"24\" height=\"24\"/></svg>') var(--t-offset, 0) 0 / auto var(--t-mask-height);margin:0!important}.tui-sensitive.tui-sensitive{-webkit-text-fill-color:transparent}span.tui-sensitive,a.tui-sensitive{display:inline-block}\n"] }]
}] });
class TuiSensitive {
constructor() {
this.nothing = tuiWithStyles(TuiSensitiveStyles);
this.offset = Math.round(Math.random() * 10) * 10;
this.height = toSignal(inject(ResizeObserverService, { self: true }).pipe(map((entry) => {
const height = entry[0]?.contentRect.height ?? 0;
return [Math.max(2, Math.floor(height / 16) + 1), height];
}), map(([rows, height]) => height * (rowsInSvg / rows)), tuiZonefull(), tuiWatch()));
this.tuiSensitive = false;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSensitive, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiSensitive, isStandalone: true, selector: "[tuiSensitive]", inputs: { tuiSensitive: "tuiSensitive" }, host: { properties: { "style.--t-offset.px": "offset", "style.--t-mask-height.px": "height()", "class.tui-sensitive": "tuiSensitive" } }, providers: [ResizeObserverService], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSensitive, decorators: [{
type: Directive,
args: [{
standalone: true,
selector: '[tuiSensitive]',
providers: [ResizeObserverService],
host: {
'[style.--t-offset.px]': 'offset',
'[style.--t-mask-height.px]': 'height()',
'[class.tui-sensitive]': 'tuiSensitive',
},
}]
}], propDecorators: { tuiSensitive: [{
type: Input
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { TuiSensitive };
//# sourceMappingURL=taiga-ui-kit-directives-sensitive.mjs.map