UNPKG

ngx-x-browser-svg-mask

Version:

Angular attribute directive that handles cross browser considerations for applying SVG image masks in the DOM.

1 lines 4.55 kB
{"version":3,"file":"ngx-x-browser-svg-mask.mjs","sources":["../../../projects/ngx-x-browser-svg-mask/src/lib/directive/ngx-x-browser-svg-mask.directive.ts","../../../projects/ngx-x-browser-svg-mask/src/lib/ngx-x-browser-svg-mask.module.ts","../../../projects/ngx-x-browser-svg-mask/src/public-api.ts","../../../projects/ngx-x-browser-svg-mask/src/ngx-x-browser-svg-mask.ts"],"sourcesContent":["import { Directive, ElementRef, HostBinding, Input } from '@angular/core';\n\n@Directive({\n selector: '[ngxSVGMask]',\n standalone: false,\n})\nexport class NgxXBrowserSVGMaskDirective {\n @Input('ngxSVGMask') public mask: string;\n\n /**\n * Host binding to apply the svg image element node type attribute.\n */\n @HostBinding('attr.mask')\n private get svgMaskImage(): string | undefined {\n if (this.el.nativeElement.nodeName.toLowerCase() === 'image') {\n return this.maskImage;\n } else {\n return undefined;\n }\n }\n\n /**\n * Host binding to apply the standard css style to non-image type element nodes.\n */\n @HostBinding('style.mask-image')\n private get cssMaskImage(): string | undefined {\n if (this.el.nativeElement.nodeName.toLowerCase() !== 'image') {\n return this.maskImage;\n } else {\n return undefined;\n }\n }\n\n /**\n * Host binding to apply the webkit style to non-image type element nodes.\n */\n @HostBinding('style.-webkit-mask-image')\n private get cssWebkitMaskImage(): string | undefined {\n if (this.el.nativeElement.nodeName.toLowerCase() !== 'image') {\n return this.maskImage;\n } else {\n return undefined;\n }\n }\n\n /**\n * Read only property that calculates the direct url path for the image mask that we want to use.\n *\n * @return The mask with full url route designated.\n */\n private get maskImage(): string {\n return 'url(' + window.location.pathname.slice(1) + window.location.search + this.mask + ')';\n }\n\n public constructor(private el: ElementRef) {\n this.mask = '';\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { NgxXBrowserSVGMaskDirective } from './directive/ngx-x-browser-svg-mask.directive';\n\n@NgModule({\n declarations: [NgxXBrowserSVGMaskDirective],\n imports: [],\n exports: [NgxXBrowserSVGMaskDirective],\n})\nexport class NgxXBrowserSVGMaskModule {}\n","/*\n * Public API Surface of ngx-x-browser-svg-mask\n */\n\nexport * from './lib/directive/ngx-x-browser-svg-mask.directive';\nexport * from './lib/ngx-x-browser-svg-mask.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAMa,2BAA2B,CAAA;AAGtC;;AAEG;AACH,IAAA,IACY,YAAY,GAAA;AACtB,QAAA,IAAI,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE;YAC5D,OAAO,IAAI,CAAC,SAAS;QACvB;aAAO;AACL,YAAA,OAAO,SAAS;QAClB;IACF;AAEA;;AAEG;AACH,IAAA,IACY,YAAY,GAAA;AACtB,QAAA,IAAI,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE;YAC5D,OAAO,IAAI,CAAC,SAAS;QACvB;aAAO;AACL,YAAA,OAAO,SAAS;QAClB;IACF;AAEA;;AAEG;AACH,IAAA,IACY,kBAAkB,GAAA;AAC5B,QAAA,IAAI,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE;YAC5D,OAAO,IAAI,CAAC,SAAS;QACvB;aAAO;AACL,YAAA,OAAO,SAAS;QAClB;IACF;AAEA;;;;AAIG;AACH,IAAA,IAAY,SAAS,GAAA;QACnB,OAAO,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG;IAC9F;AAEA,IAAA,WAAA,CAA2B,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;AAC3B,QAAA,IAAI,CAAC,IAA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