@emasoft/svg-matrix 1.3.4 → 1.3.6

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/dist/version.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.3.4",
3
- "buildTime": "2026-01-25T12:44:06.936Z",
2
+ "version": "1.3.6",
3
+ "buildTime": "2026-01-29T23:57:56.507Z",
4
4
  "bundles": {
5
5
  "esm": [
6
6
  {
@@ -11,14 +11,14 @@
11
11
  },
12
12
  {
13
13
  "name": "svg-toolbox.min.js",
14
- "size": 577298,
15
- "gzipSize": 152361,
14
+ "size": 595472,
15
+ "gzipSize": 157634,
16
16
  "description": "ESM bundle for bundlers/Node.js (includes decimal.js)"
17
17
  },
18
18
  {
19
19
  "name": "svgm.min.js",
20
- "size": 602600,
21
- "gzipSize": 159489,
20
+ "size": 620774,
21
+ "gzipSize": 164735,
22
22
  "description": "ESM bundle for bundlers/Node.js (includes decimal.js)"
23
23
  }
24
24
  ],
@@ -31,8 +31,8 @@
31
31
  },
32
32
  {
33
33
  "name": "svg-toolbox.global.min.js",
34
- "size": 577427,
35
- "gzipSize": 151728,
34
+ "size": 595602,
35
+ "gzipSize": 156939,
36
36
  "description": "IIFE bundle for browsers via <script> (includes decimal.js)"
37
37
  },
38
38
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emasoft/svg-matrix",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Arbitrary-precision matrix, vector and affine transformation library for JavaScript using decimal.js",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -384,6 +384,12 @@ export function optimizeAnimationValues(values, precision = 3) {
384
384
  );
385
385
  }
386
386
 
387
+ // Preserve data URIs exactly (they contain semicolons that shouldn't be split)
388
+ // Data URIs have format: data:[<mediatype>][;base64],<data>
389
+ if (values.startsWith("data:")) {
390
+ return values;
391
+ }
392
+
387
393
  // Split by semicolon
388
394
  const parts = values.split(";");
389
395
 
@@ -398,6 +404,29 @@ export function optimizeAnimationValues(values, precision = 3) {
398
404
  return trimmed;
399
405
  }
400
406
 
407
+ // Preserve data URIs exactly (e.g., data:image/jpeg;base64,...)
408
+ if (trimmed.startsWith("data:")) {
409
+ return trimmed;
410
+ }
411
+
412
+ // Preserve color functions (rgb, rgba, hsl, hsla, etc.) exactly
413
+ // These contain parentheses and commas that should not be modified
414
+ if (/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklch|oklab|color)\s*\(/i.test(trimmed)) {
415
+ return trimmed;
416
+ }
417
+
418
+ // Preserve SVG path data (starts with path command M, m, L, l, etc.)
419
+ // Path data format: "M 26.5,32.5 L 33.5,32.5 C 40,50 60,70 80,90 Z"
420
+ if (/^[MmZzLlHhVvCcSsQqTtAa][\s\d.,+-]+/.test(trimmed)) {
421
+ return trimmed;
422
+ }
423
+
424
+ // Preserve font-family values (comma-separated font names with possible quotes)
425
+ // Pattern: word or quoted string, followed by comma and more words/quotes
426
+ if (/^(['"]?[\w\s-]+['"]?,\s*)+['"]?[\w\s-]+['"]?$/.test(trimmed)) {
427
+ return trimmed;
428
+ }
429
+
401
430
  // Try to parse as numbers (could be space-separated like "0 0" for translate)
402
431
  const nums = trimmed.split(/[\s,]+/).filter((n) => n); // Filter empty strings
403
432
  const optimizedNums = nums.map((n) => {
package/src/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * SVG path conversion, and 2D/3D affine transformations using Decimal.js.
6
6
  *
7
7
  * @module @emasoft/svg-matrix
8
- * @version 1.3.4
8
+ * @version 1.3.6
9
9
  * @license MIT
10
10
  *
11
11
  * @example
@@ -135,7 +135,7 @@ Decimal.set({ precision: 80 });
135
135
  * Library version
136
136
  * @constant {string}
137
137
  */
138
- export const VERSION = "1.3.4";
138
+ export const VERSION = "1.3.6";
139
139
 
140
140
  /**
141
141
  * Default precision for path output (decimal places)