@svgflex/core 0.1.3 → 0.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svgflex/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Framework-agnostic core utilities for SVGFlex",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -8,11 +8,11 @@
8
8
  export function replaceColorsWithCurrentColor(svgContent) {
9
9
  let result = svgContent;
10
10
  // Replace fill attributes with hex colors, rgb, rgba, named colors, etc.
11
- // But preserve fill="none" and fill="transparent"
12
- result = result.replace(/fill\s*=\s*["'](?!none["']|transparent["']|currentColor["']|url\()/gi, 'fill="currentColor');
11
+ // But preserve fill="none", fill="transparent", fill="currentColor", and fill="url(...)"
12
+ result = result.replace(/fill\s*=\s*["'](?!none["']|transparent["']|currentColor["']|url\()[^"']*["']/gi, 'fill="currentColor"');
13
13
  // Replace stroke attributes with hex colors, rgb, rgba, named colors, etc.
14
- // But preserve stroke="none" and stroke="transparent"
15
- result = result.replace(/stroke\s*=\s*["'](?!none["']|transparent["']|currentColor["']|url\()/gi, 'stroke="currentColor');
14
+ // But preserve stroke="none", stroke="transparent", stroke="currentColor", and stroke="url(...)"
15
+ result = result.replace(/stroke\s*=\s*["'](?!none["']|transparent["']|currentColor["']|url\()[^"']*["']/gi, 'stroke="currentColor"');
16
16
  return result;
17
17
  }
18
18
  /**