@svgflex/angular 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,21 +19,28 @@ class SvgLoaderService {
19
19
  }
20
20
  /**
21
21
  * Loads SVG content from a URL with caching
22
+ * @param url - URL to load the SVG from
23
+ * @param replaceColors - Whether to replace hardcoded colors with currentColor (default: true)
22
24
  */
23
- loadSvg(url) {
24
- console.log('[SvgLoaderService] Loading SVG from:', url);
25
- if (this.cache.has(url)) {
26
- console.log('[SvgLoaderService] Returning cached SVG for:', url);
27
- return this.cache.get(url);
25
+ loadSvg(url, replaceColors = true) {
26
+ console.log('[SvgLoaderService] Loading SVG from:', url, 'replaceColors:', replaceColors);
27
+ // Check cache with both url and replaceColors as key
28
+ if (!this.cache.has(url)) {
29
+ this.cache.set(url, new Map());
30
+ }
31
+ const urlCache = this.cache.get(url);
32
+ if (urlCache.has(replaceColors)) {
33
+ console.log('[SvgLoaderService] Returning cached SVG for:', url, 'replaceColors:', replaceColors);
34
+ return urlCache.get(replaceColors);
28
35
  }
29
36
  const svg$ = this.http.get(url, { responseType: 'text' }).pipe(map(svgContent => {
30
37
  console.log('[SvgLoaderService] Successfully loaded SVG from:', url, 'Length:', svgContent.length);
31
- return sanitizeSvg(svgContent);
38
+ return sanitizeSvg(svgContent, replaceColors);
32
39
  }), catchError(error => {
33
40
  console.error(`[SvgLoaderService] Failed to load SVG from ${url}:`, error);
34
41
  return of('');
35
42
  }), shareReplay(1));
36
- this.cache.set(url, svg$);
43
+ urlCache.set(replaceColors, svg$);
37
44
  return svg$;
38
45
  }
39
46
  /**
@@ -79,10 +86,13 @@ class SvgflexComponent {
79
86
  alt;
80
87
  /** Whether to inline the SVG (default: true) */
81
88
  inline = true;
89
+ /** Whether to replace hardcoded colors with currentColor (default: true) */
90
+ replaceColors = true;
82
91
  // Processed values
83
92
  width = '24px';
84
93
  height = '24px';
85
94
  processedColor = 'currentColor';
95
+ processedReplaceColors = true;
86
96
  svgContent = null;
87
97
  // Apply CSS classes to :host element
88
98
  get hostClasses() {
@@ -102,32 +112,35 @@ class SvgflexComponent {
102
112
  size: this.size,
103
113
  class: this.class,
104
114
  ariaLabel: this.ariaLabel || this.alt,
105
- inline: this.inline
115
+ inline: this.inline,
116
+ replaceColors: this.replaceColors
106
117
  };
107
118
  const processed = processSvgConfig(config);
108
119
  this.width = processed.width;
109
120
  this.height = processed.height;
110
121
  this.processedColor = processed.color;
122
+ this.processedReplaceColors = processed.replaceColors;
111
123
  this.ariaLabel = processed.ariaLabel;
112
124
  console.log('[SvgflexComponent] Processed config:', {
113
125
  width: this.width,
114
126
  height: this.height,
115
127
  color: this.processedColor,
128
+ replaceColors: this.processedReplaceColors,
116
129
  src: this.src
117
130
  });
118
131
  // Load SVG content if inline mode is enabled
119
132
  // Check if src or inline changed, or if it's the first change (firstChange)
120
- if (this.inline && (changes['src'] || changes['inline'] || Object.keys(changes).length > 0)) {
133
+ if (this.inline && (changes['src'] || changes['inline'] || changes['replaceColors'] || Object.keys(changes).length > 0)) {
121
134
  this.loadSvgContent();
122
135
  }
123
136
  }
124
137
  loadSvgContent() {
125
- console.log('[SvgflexComponent] loadSvgContent called, src:', this.src, 'inline:', this.inline);
138
+ console.log('[SvgflexComponent] loadSvgContent called, src:', this.src, 'inline:', this.inline, 'replaceColors:', this.processedReplaceColors);
126
139
  if (!this.src) {
127
140
  console.log('[SvgflexComponent] No src provided, skipping load');
128
141
  return;
129
142
  }
130
- this.svgLoader.loadSvg(this.src).subscribe((content) => {
143
+ this.svgLoader.loadSvg(this.src, this.processedReplaceColors).subscribe((content) => {
131
144
  console.log('[SvgflexComponent] Received SVG content, length:', content.length);
132
145
  if (content) {
133
146
  // SVG is already sanitized by SvgLoaderService
@@ -141,7 +154,7 @@ class SvgflexComponent {
141
154
  });
142
155
  }
143
156
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: SvgflexComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
144
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: SvgflexComponent, isStandalone: true, selector: "svgflex", inputs: { src: "src", color: "color", size: "size", class: "class", ariaLabel: "ariaLabel", alt: "alt", inline: "inline" }, host: { properties: { "class": "this.hostClasses", "style.width": "this.hostWidth", "style.height": "this.hostHeight" } }, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"svgflex-container\"\n [style.color]=\"processedColor\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.role]=\"ariaLabel ? 'img' : null\"\n [attr.title]=\"ariaLabel\"\n>\n @if (inline && svgContent) {\n <div [innerHTML]=\"svgContent\" class=\"svgflex-inline\"></div>\n } @else if (!inline) {\n <img\n [src]=\"src\"\n [alt]=\"ariaLabel || ''\"\n [title]=\"ariaLabel\"\n [style.width]=\"width\"\n [style.height]=\"height\"\n />\n } @else {\n <div class=\"svgflex-loading\"></div>\n }\n</div>\n", styles: [":host{display:inline-block}:host.block{display:block}:host.flex{display:flex}.svgflex-container{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:inherit}.svgflex-inline{display:contents}.svgflex-inline ::ng-deep svg{width:100%;height:100%;fill:currentColor}.svgflex-inline ::ng-deep svg path,.svgflex-inline ::ng-deep svg circle,.svgflex-inline ::ng-deep svg rect,.svgflex-inline ::ng-deep svg polygon,.svgflex-inline ::ng-deep svg polyline,.svgflex-inline ::ng-deep svg ellipse,.svgflex-inline ::ng-deep svg line{fill:currentColor}.svgflex-inline ::ng-deep svg[stroke]{stroke:currentColor}.svgflex-inline ::ng-deep svg[stroke] path,.svgflex-inline ::ng-deep svg[stroke] circle,.svgflex-inline ::ng-deep svg[stroke] rect,.svgflex-inline ::ng-deep svg[stroke] polygon,.svgflex-inline ::ng-deep svg[stroke] polyline,.svgflex-inline ::ng-deep svg[stroke] ellipse,.svgflex-inline ::ng-deep svg[stroke] line{stroke:currentColor}.svgflex-loading{width:100%;height:100%;background-color:currentColor;opacity:.1;border-radius:2px}img{display:block;max-width:100%;max-height:100%}:host.icon-sm{width:16px;height:16px}:host.icon-md{width:24px;height:24px}:host.icon-lg{width:32px;height:32px}:host.icon-xl{width:48px;height:48px}:host.icon-2xl{width:64px;height:64px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
157
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: SvgflexComponent, isStandalone: true, selector: "svgflex", inputs: { src: "src", color: "color", size: "size", class: "class", ariaLabel: "ariaLabel", alt: "alt", inline: "inline", replaceColors: "replaceColors" }, host: { properties: { "class": "this.hostClasses", "style.width": "this.hostWidth", "style.height": "this.hostHeight" } }, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"svgflex-container\"\n [style.color]=\"processedColor\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.role]=\"ariaLabel ? 'img' : null\"\n [attr.title]=\"ariaLabel\"\n>\n @if (inline && svgContent) {\n <div [innerHTML]=\"svgContent\" class=\"svgflex-inline\"></div>\n } @else if (!inline) {\n <img\n [src]=\"src\"\n [alt]=\"ariaLabel || ''\"\n [title]=\"ariaLabel\"\n [style.width]=\"width\"\n [style.height]=\"height\"\n />\n } @else {\n <div class=\"svgflex-loading\"></div>\n }\n</div>\n", styles: [":host{display:inline-block}:host.block{display:block}:host.flex{display:flex}.svgflex-container{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:inherit}.svgflex-inline{display:contents}.svgflex-inline ::ng-deep svg{width:100%;height:100%;fill:currentColor}.svgflex-inline ::ng-deep svg path,.svgflex-inline ::ng-deep svg circle,.svgflex-inline ::ng-deep svg rect,.svgflex-inline ::ng-deep svg polygon,.svgflex-inline ::ng-deep svg polyline,.svgflex-inline ::ng-deep svg ellipse,.svgflex-inline ::ng-deep svg line{fill:currentColor}.svgflex-inline ::ng-deep svg[stroke]{stroke:currentColor}.svgflex-inline ::ng-deep svg[stroke] path,.svgflex-inline ::ng-deep svg[stroke] circle,.svgflex-inline ::ng-deep svg[stroke] rect,.svgflex-inline ::ng-deep svg[stroke] polygon,.svgflex-inline ::ng-deep svg[stroke] polyline,.svgflex-inline ::ng-deep svg[stroke] ellipse,.svgflex-inline ::ng-deep svg[stroke] line{stroke:currentColor}.svgflex-loading{width:100%;height:100%;background-color:currentColor;opacity:.1;border-radius:2px}img{display:block;max-width:100%;max-height:100%}:host.icon-sm{width:16px;height:16px}:host.icon-md{width:24px;height:24px}:host.icon-lg{width:32px;height:32px}:host.icon-xl{width:48px;height:48px}:host.icon-2xl{width:64px;height:64px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
145
158
  }
146
159
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: SvgflexComponent, decorators: [{
147
160
  type: Component,
@@ -161,6 +174,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
161
174
  type: Input
162
175
  }], inline: [{
163
176
  type: Input
177
+ }], replaceColors: [{
178
+ type: Input
164
179
  }], hostClasses: [{
165
180
  type: HostBinding,
166
181
  args: ['class']
@@ -1 +1 @@
1
- {"version":3,"file":"svgflex-angular.mjs","sources":["../../../packages/angular/src/lib/services/svg-loader.service.ts","../../../packages/angular/src/lib/components/svgflex.component.ts","../../../packages/angular/src/lib/components/svgflex.component.html","../../../packages/angular/src/public-api.ts","../../../packages/angular/src/svgflex-angular.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\nimport { map, catchError, shareReplay } from 'rxjs/operators';\nimport { sanitizeSvg } from '@svgflex/core';\n\n/**\n * Service for loading and caching SVG content\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class SvgLoaderService {\n private cache = new Map<string, Observable<string>>();\n\n constructor(private http: HttpClient) {}\n\n /**\n * Loads SVG content from a URL with caching\n */\n loadSvg(url: string): Observable<string> {\n console.log('[SvgLoaderService] Loading SVG from:', url);\n\n if (this.cache.has(url)) {\n console.log('[SvgLoaderService] Returning cached SVG for:', url);\n return this.cache.get(url)!;\n }\n\n const svg$ = this.http.get(url, { responseType: 'text' }).pipe(\n map(svgContent => {\n console.log('[SvgLoaderService] Successfully loaded SVG from:', url, 'Length:', svgContent.length);\n return sanitizeSvg(svgContent);\n }),\n catchError(error => {\n console.error(`[SvgLoaderService] Failed to load SVG from ${url}:`, error);\n return of('');\n }),\n shareReplay(1)\n );\n\n this.cache.set(url, svg$);\n return svg$;\n }\n\n /**\n * Clears the SVG cache\n */\n clearCache(): void {\n this.cache.clear();\n }\n}\n","import {\n Component,\n Input,\n OnChanges,\n SimpleChanges,\n HostBinding,\n inject\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { CommonModule } from '@angular/common';\nimport { SvgLoaderService } from '../services/svg-loader.service';\nimport { processSvgConfig, SvgFlexConfig, SvgSize, SvgColor } from '@svgflex/core';\n\n/**\n * SVGFlex Component\n *\n * Renders SVG icons with customizable color and size.\n * Supports both inline SVG (for full style control) and external references.\n *\n * @example\n * <svgflex src=\"assets/icons/home.svg\" color=\"red\" size=\"32\"></svgflex>\n * <svgflex src=\"assets/icons/user.svg\" color=\"currentColor\" [size]=\"{width: '2rem', height: '2rem'}\"></svgflex>\n */\n@Component({\n selector: 'svgflex',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './svgflex.component.html',\n styleUrl: './svgflex.component.scss'\n})\nexport class SvgflexComponent implements OnChanges {\n private svgLoader = inject(SvgLoaderService);\n private sanitizer = inject(DomSanitizer);\n\n /** Path or URL to the SVG file */\n @Input({ required: true }) src!: string;\n\n /** Color for the SVG (defaults to 'currentColor') */\n @Input() color?: SvgColor;\n\n /** Size for the SVG (number in px, string with units, or {width, height} object) */\n @Input() size?: SvgSize;\n\n /** Additional CSS classes */\n @Input() class?: string;\n\n /** Accessibility label */\n @Input() ariaLabel?: string;\n\n /** Alternative text / Accessibility label (alias for ariaLabel) */\n @Input() alt?: string;\n\n /** Whether to inline the SVG (default: true) */\n @Input() inline: boolean = true;\n\n // Processed values\n protected width: string = '24px';\n protected height: string = '24px';\n protected processedColor: string = 'currentColor';\n protected svgContent: any = null;\n\n // Apply CSS classes to :host element\n @HostBinding('class')\n get hostClasses(): string {\n return this.class || '';\n }\n\n // Apply inline styles to :host element when size is specified\n @HostBinding('style.width')\n get hostWidth(): string | null {\n return this.size ? this.width : null;\n }\n\n @HostBinding('style.height')\n get hostHeight(): string | null {\n return this.size ? this.height : null;\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n const config: SvgFlexConfig = {\n src: this.src,\n color: this.color,\n size: this.size,\n class: this.class,\n ariaLabel: this.ariaLabel || this.alt,\n inline: this.inline\n };\n\n const processed = processSvgConfig(config);\n\n this.width = processed.width;\n this.height = processed.height;\n this.processedColor = processed.color;\n this.ariaLabel = processed.ariaLabel;\n\n console.log('[SvgflexComponent] Processed config:', {\n width: this.width,\n height: this.height,\n color: this.processedColor,\n src: this.src\n });\n\n // Load SVG content if inline mode is enabled\n // Check if src or inline changed, or if it's the first change (firstChange)\n if (this.inline && (changes['src'] || changes['inline'] || Object.keys(changes).length > 0)) {\n this.loadSvgContent();\n }\n }\n\n private loadSvgContent(): void {\n console.log('[SvgflexComponent] loadSvgContent called, src:', this.src, 'inline:', this.inline);\n\n if (!this.src) {\n console.log('[SvgflexComponent] No src provided, skipping load');\n return;\n }\n\n this.svgLoader.loadSvg(this.src).subscribe((content: string) => {\n console.log('[SvgflexComponent] Received SVG content, length:', content.length);\n if (content) {\n // SVG is already sanitized by SvgLoaderService\n // Directly bypass security and trust the HTML\n this.svgContent = this.sanitizer.bypassSecurityTrustHtml(content);\n console.log('[SvgflexComponent] SVG content set successfully');\n } else {\n console.log('[SvgflexComponent] Received empty content');\n }\n });\n }\n}\n","<div\n class=\"svgflex-container\"\n [style.color]=\"processedColor\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.role]=\"ariaLabel ? 'img' : null\"\n [attr.title]=\"ariaLabel\"\n>\n @if (inline && svgContent) {\n <div [innerHTML]=\"svgContent\" class=\"svgflex-inline\"></div>\n } @else if (!inline) {\n <img\n [src]=\"src\"\n [alt]=\"ariaLabel || ''\"\n [title]=\"ariaLabel\"\n [style.width]=\"width\"\n [style.height]=\"height\"\n />\n } @else {\n <div class=\"svgflex-loading\"></div>\n }\n</div>\n","/*\n * Public API Surface of @svgflex/angular\n */\n\n// Components\nexport * from './lib/components/svgflex.component';\n\n// Services\nexport * from './lib/services/svg-loader.service';\n\n// Re-export core types and utils for convenience\nexport * from '@svgflex/core';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,gBAAgB,CAAA;AAGP,IAAA,IAAA;AAFZ,IAAA,KAAK,GAAG,IAAI,GAAG,EAA8B;AAErD,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAA,CAAA,IAAI,GAAJ,IAAI;IAAe;AAEvC;;AAEG;AACH,IAAA,OAAO,CAAC,GAAW,EAAA;AACjB,QAAA,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,GAAG,CAAC;QAExD,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AACvB,YAAA,OAAO,CAAC,GAAG,CAAC,8CAA8C,EAAE,GAAG,CAAC;YAChE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE;QAC7B;QAEA,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAC5D,GAAG,CAAC,UAAU,IAAG;AACf,YAAA,OAAO,CAAC,GAAG,CAAC,kDAAkD,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC;AAClG,YAAA,OAAO,WAAW,CAAC,UAAU,CAAC;AAChC,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AA,iBAAA,EAAA,EAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EC9B7B,oiBAqBA,EAAA,MAAA,EAAA,CAAA,gxCAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDKY,YAAY,EAAA,CAAA,EAAA,CAAA;;2FAIX,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAP5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,oiBAAA,EAAA,MAAA,EAAA,CAAA,gxCAAA,CAAA,EAAA;;sBAStB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB;;sBAGA;;sBAGA;;sBAGA;;sBAGA;;sBAGA;;sBASA,WAAW;uBAAC,OAAO;;sBAMnB,WAAW;uBAAC,aAAa;;sBAKzB,WAAW;uBAAC,cAAc;;;AEzE7B;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
1
+ {"version":3,"file":"svgflex-angular.mjs","sources":["../../../packages/angular/src/lib/services/svg-loader.service.ts","../../../packages/angular/src/lib/components/svgflex.component.ts","../../../packages/angular/src/lib/components/svgflex.component.html","../../../packages/angular/src/public-api.ts","../../../packages/angular/src/svgflex-angular.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\nimport { map, catchError, shareReplay } from 'rxjs/operators';\nimport { sanitizeSvg } from '@svgflex/core';\n\n/**\n * Service for loading and caching SVG content\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class SvgLoaderService {\n private cache = new Map<string, Map<boolean, Observable<string>>>();\n\n constructor(private http: HttpClient) {}\n\n /**\n * Loads SVG content from a URL with caching\n * @param url - URL to load the SVG from\n * @param replaceColors - Whether to replace hardcoded colors with currentColor (default: true)\n */\n loadSvg(url: string, replaceColors: boolean = true): Observable<string> {\n console.log('[SvgLoaderService] Loading SVG from:', url, 'replaceColors:', replaceColors);\n\n // Check cache with both url and replaceColors as key\n if (!this.cache.has(url)) {\n this.cache.set(url, new Map());\n }\n\n const urlCache = this.cache.get(url)!;\n if (urlCache.has(replaceColors)) {\n console.log('[SvgLoaderService] Returning cached SVG for:', url, 'replaceColors:', replaceColors);\n return urlCache.get(replaceColors)!;\n }\n\n const svg$ = this.http.get(url, { responseType: 'text' }).pipe(\n map(svgContent => {\n console.log('[SvgLoaderService] Successfully loaded SVG from:', url, 'Length:', svgContent.length);\n return sanitizeSvg(svgContent, replaceColors);\n }),\n catchError(error => {\n console.error(`[SvgLoaderService] Failed to load SVG from ${url}:`, error);\n return of('');\n }),\n shareReplay(1)\n );\n\n urlCache.set(replaceColors, svg$);\n return svg$;\n }\n\n /**\n * Clears the SVG cache\n */\n clearCache(): void {\n this.cache.clear();\n }\n}\n","import {\n Component,\n Input,\n OnChanges,\n SimpleChanges,\n HostBinding,\n inject\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { CommonModule } from '@angular/common';\nimport { SvgLoaderService } from '../services/svg-loader.service';\nimport { processSvgConfig, SvgFlexConfig, SvgSize, SvgColor } from '@svgflex/core';\n\n/**\n * SVGFlex Component\n *\n * Renders SVG icons with customizable color and size.\n * Supports both inline SVG (for full style control) and external references.\n *\n * @example\n * <svgflex src=\"assets/icons/home.svg\" color=\"red\" size=\"32\"></svgflex>\n * <svgflex src=\"assets/icons/user.svg\" color=\"currentColor\" [size]=\"{width: '2rem', height: '2rem'}\"></svgflex>\n */\n@Component({\n selector: 'svgflex',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './svgflex.component.html',\n styleUrl: './svgflex.component.scss'\n})\nexport class SvgflexComponent implements OnChanges {\n private svgLoader = inject(SvgLoaderService);\n private sanitizer = inject(DomSanitizer);\n\n /** Path or URL to the SVG file */\n @Input({ required: true }) src!: string;\n\n /** Color for the SVG (defaults to 'currentColor') */\n @Input() color?: SvgColor;\n\n /** Size for the SVG (number in px, string with units, or {width, height} object) */\n @Input() size?: SvgSize;\n\n /** Additional CSS classes */\n @Input() class?: string;\n\n /** Accessibility label */\n @Input() ariaLabel?: string;\n\n /** Alternative text / Accessibility label (alias for ariaLabel) */\n @Input() alt?: string;\n\n /** Whether to inline the SVG (default: true) */\n @Input() inline: boolean = true;\n\n /** Whether to replace hardcoded colors with currentColor (default: true) */\n @Input() replaceColors: boolean = true;\n\n // Processed values\n protected width: string = '24px';\n protected height: string = '24px';\n protected processedColor: string = 'currentColor';\n protected processedReplaceColors: boolean = true;\n protected svgContent: any = null;\n\n // Apply CSS classes to :host element\n @HostBinding('class')\n get hostClasses(): string {\n return this.class || '';\n }\n\n // Apply inline styles to :host element when size is specified\n @HostBinding('style.width')\n get hostWidth(): string | null {\n return this.size ? this.width : null;\n }\n\n @HostBinding('style.height')\n get hostHeight(): string | null {\n return this.size ? this.height : null;\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n const config: SvgFlexConfig = {\n src: this.src,\n color: this.color,\n size: this.size,\n class: this.class,\n ariaLabel: this.ariaLabel || this.alt,\n inline: this.inline,\n replaceColors: this.replaceColors\n };\n\n const processed = processSvgConfig(config);\n\n this.width = processed.width;\n this.height = processed.height;\n this.processedColor = processed.color;\n this.processedReplaceColors = processed.replaceColors;\n this.ariaLabel = processed.ariaLabel;\n\n console.log('[SvgflexComponent] Processed config:', {\n width: this.width,\n height: this.height,\n color: this.processedColor,\n replaceColors: this.processedReplaceColors,\n src: this.src\n });\n\n // Load SVG content if inline mode is enabled\n // Check if src or inline changed, or if it's the first change (firstChange)\n if (this.inline && (changes['src'] || changes['inline'] || changes['replaceColors'] || Object.keys(changes).length > 0)) {\n this.loadSvgContent();\n }\n }\n\n private loadSvgContent(): void {\n console.log('[SvgflexComponent] loadSvgContent called, src:', this.src, 'inline:', this.inline, 'replaceColors:', this.processedReplaceColors);\n\n if (!this.src) {\n console.log('[SvgflexComponent] No src provided, skipping load');\n return;\n }\n\n this.svgLoader.loadSvg(this.src, this.processedReplaceColors).subscribe((content: string) => {\n console.log('[SvgflexComponent] Received SVG content, length:', content.length);\n if (content) {\n // SVG is already sanitized by SvgLoaderService\n // Directly bypass security and trust the HTML\n this.svgContent = this.sanitizer.bypassSecurityTrustHtml(content);\n console.log('[SvgflexComponent] SVG content set successfully');\n } else {\n console.log('[SvgflexComponent] Received empty content');\n }\n });\n }\n}\n","<div\n class=\"svgflex-container\"\n [style.color]=\"processedColor\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.role]=\"ariaLabel ? 'img' : null\"\n [attr.title]=\"ariaLabel\"\n>\n @if (inline && svgContent) {\n <div [innerHTML]=\"svgContent\" class=\"svgflex-inline\"></div>\n } @else if (!inline) {\n <img\n [src]=\"src\"\n [alt]=\"ariaLabel || ''\"\n [title]=\"ariaLabel\"\n [style.width]=\"width\"\n [style.height]=\"height\"\n />\n } @else {\n <div class=\"svgflex-loading\"></div>\n }\n</div>\n","/*\n * Public API Surface of @svgflex/angular\n */\n\n// Components\nexport * from './lib/components/svgflex.component';\n\n// Services\nexport * from './lib/services/svg-loader.service';\n\n// Re-export core types and utils for convenience\nexport * from '@svgflex/core';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,gBAAgB,CAAA;AAGP,IAAA,IAAA;AAFZ,IAAA,KAAK,GAAG,IAAI,GAAG,EAA4C;AAEnE,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAA,CAAA,IAAI,GAAJ,IAAI;IAAe;AAEvC;;;;AAIG;AACH,IAAA,OAAO,CAAC,GAAW,EAAE,aAAA,GAAyB,IAAI,EAAA;QAChD,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,GAAG,EAAE,gBAAgB,EAAE,aAAa,CAAC;;QAGzF,IAAI,CAAC,IAAI,CAAC,K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AAA,CAAA,EAAA,CAAA;;2FAIX,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAP5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,oiBAAA,EAAA,MAAA,EAAA,CAAA,gxCAAA,CAAA,EAAA;;sBAStB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB;;sBAGA;;sBAGA;;sBAGA;;sBAGA;;sBAGA;;sBAGA;;sBAUA,WAAW;uBAAC,OAAO;;sBAMnB,WAAW;uBAAC,aAAa;;sBAKzB,WAAW;uBAAC,cAAc;;;AE7E7B;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -32,9 +32,12 @@ declare class SvgflexComponent implements OnChanges {
32
32
  alt?: string;
33
33
  /** Whether to inline the SVG (default: true) */
34
34
  inline: boolean;
35
+ /** Whether to replace hardcoded colors with currentColor (default: true) */
36
+ replaceColors: boolean;
35
37
  protected width: string;
36
38
  protected height: string;
37
39
  protected processedColor: string;
40
+ protected processedReplaceColors: boolean;
38
41
  protected svgContent: any;
39
42
  get hostClasses(): string;
40
43
  get hostWidth(): string | null;
@@ -42,7 +45,7 @@ declare class SvgflexComponent implements OnChanges {
42
45
  ngOnChanges(changes: SimpleChanges): void;
43
46
  private loadSvgContent;
44
47
  static ɵfac: i0.ɵɵFactoryDeclaration<SvgflexComponent, never>;
45
- static ɵcmp: i0.ɵɵComponentDeclaration<SvgflexComponent, "svgflex", never, { "src": { "alias": "src"; "required": true; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "class": { "alias": "class"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "inline": { "alias": "inline"; "required": false; }; }, {}, never, never, true, never>;
48
+ static ɵcmp: i0.ɵɵComponentDeclaration<SvgflexComponent, "svgflex", never, { "src": { "alias": "src"; "required": true; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "class": { "alias": "class"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "inline": { "alias": "inline"; "required": false; }; "replaceColors": { "alias": "replaceColors"; "required": false; }; }, {}, never, never, true, never>;
46
49
  }
47
50
 
48
51
  /**
@@ -54,8 +57,10 @@ declare class SvgLoaderService {
54
57
  constructor(http: HttpClient);
55
58
  /**
56
59
  * Loads SVG content from a URL with caching
60
+ * @param url - URL to load the SVG from
61
+ * @param replaceColors - Whether to replace hardcoded colors with currentColor (default: true)
57
62
  */
58
- loadSvg(url: string): Observable<string>;
63
+ loadSvg(url: string, replaceColors?: boolean): Observable<string>;
59
64
  /**
60
65
  * Clears the SVG cache
61
66
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svgflex/angular",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Angular library for SVG icons with easy color and size customization",
5
5
  "keywords": [
6
6
  "svg",
@@ -28,7 +28,7 @@
28
28
  "peerDependencies": {
29
29
  "@angular/common": "^20.0.0",
30
30
  "@angular/core": "^20.0.0",
31
- "@svgflex/core": "^0.1.1"
31
+ "@svgflex/core": "^0.1.2"
32
32
  },
33
33
  "dependencies": {
34
34
  "tslib": "^2.3.0"