@cisstech/nge
Version:
NG Essentials is a collection of libraries for Angular developers.
176 lines (167 loc) • 8.71 kB
JavaScript
import * as i0 from '@angular/core';
import { Pipe, NgModule, TemplateRef } from '@angular/core';
import * as i1 from '@angular/platform-browser';
/**
* https://icongr.am
*/
class IconGrPipe {
transform(value) {
const pattern = /(\w+)\s+([\w-]+)((\s+(?:color|size)=[^\s]+)*)?/gm;
return value.replace(pattern, (_, type, name, params) => {
params = (params ?? '')
.trim()
.split(' ')
.filter((e) => e.trim())
.join('&');
params = params ? '?' + params : '';
return `https://icongr.am/${type.trim()}/${name.trim()}.svg${params}`;
});
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipe, isStandalone: true, name: "icongr" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipe, decorators: [{
type: Pipe,
args: [{
name: 'icongr',
standalone: true,
}]
}] });
/**
* @deprecated in favor of standalone api, so please use direclty the pipe as a standalone. Will be removed in/after v18
*/
class IconGrPipeModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipeModule, imports: [IconGrPipe], exports: [IconGrPipe] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipeModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IconGrPipeModule, decorators: [{
type: NgModule,
args: [{
imports: [IconGrPipe],
exports: [IconGrPipe],
}]
}] });
class IsObject {
transform(value) {
return typeof value === 'object';
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IsObject, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: IsObject, isStandalone: true, name: "isobject" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IsObject, decorators: [{
type: Pipe,
args: [{
name: 'isobject',
standalone: true,
}]
}] });
class IsStringPipe {
transform(value) {
return typeof value === 'string';
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IsStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: IsStringPipe, isStandalone: true, name: "isstring" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IsStringPipe, decorators: [{
type: Pipe,
args: [{
name: 'isstring',
standalone: true,
}]
}] });
class IsTemplatePipe {
transform(value) {
return value instanceof TemplateRef;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IsTemplatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: IsTemplatePipe, isStandalone: true, name: "istemplate" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: IsTemplatePipe, decorators: [{
type: Pipe,
args: [{
name: 'istemplate',
standalone: true,
}]
}] });
class LengthPipe {
transform(value) {
return Array.isArray(value) ? value.length : Object.keys(value).length;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LengthPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: LengthPipe, isStandalone: true, name: "length" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LengthPipe, decorators: [{
type: Pipe,
args: [{
name: 'length',
standalone: true,
}]
}] });
/**
* @deprecated in favor of standalone api, so please use direclty the pipe as a standalone. Will be removed in/after v18
*/
class LengthPipeModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LengthPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: LengthPipeModule, imports: [LengthPipe], exports: [LengthPipe] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LengthPipeModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: LengthPipeModule, decorators: [{
type: NgModule,
args: [{
exports: [LengthPipe],
imports: [LengthPipe],
}]
}] });
class SafePipe {
constructor(sanitiner) {
this.sanitiner = sanitiner;
}
transform(input, type) {
if (!input)
return input;
switch (type) {
case 'url':
return this.sanitiner.bypassSecurityTrustUrl(input);
case 'html':
return this.sanitiner.bypassSecurityTrustHtml(input);
case 'style':
return this.sanitiner.bypassSecurityTrustStyle(input);
case 'script':
return this.sanitiner.bypassSecurityTrustScript(input);
case 'resource':
return this.sanitiner.bypassSecurityTrustResourceUrl(input);
default:
throw new Error('Unknown type: ' + type);
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: SafePipe, isStandalone: true, name: "safe" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SafePipe, decorators: [{
type: Pipe,
args: [{
name: 'safe',
standalone: true,
}]
}], ctorParameters: () => [{ type: i1.DomSanitizer }] });
/**
* @deprecated in favor of standalone api, so please use direclty the pipe as a standalone. Will be removed in/after v18
*/
class SafePipeModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SafePipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: SafePipeModule, imports: [SafePipe], exports: [SafePipe] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SafePipeModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SafePipeModule, decorators: [{
type: NgModule,
args: [{
imports: [SafePipe],
exports: [SafePipe],
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { IconGrPipe, IconGrPipeModule, IsObject, IsStringPipe, IsTemplatePipe, LengthPipe, LengthPipeModule, SafePipe, SafePipeModule };
//# sourceMappingURL=cisstech-nge-pipes.mjs.map