@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/README.md +56 -0
- package/bin/svg-matrix.js +67 -3
- package/bin/svglinter.cjs +84 -0
- package/bin/svgm.js +37 -0
- package/dist/svg-matrix.global.min.js +2 -2
- package/dist/svg-matrix.min.js +2 -2
- package/dist/svg-toolbox.global.min.js +110 -110
- package/dist/svg-toolbox.min.js +110 -110
- package/dist/svgm.min.js +112 -112
- package/dist/version.json +8 -8
- package/package.json +1 -1
- package/src/animation-optimization.js +29 -0
- package/src/index.js +2 -2
- package/src/inkscape-support.js +768 -0
- package/src/svg-matrix-lib.js +2 -2
- package/src/svg-toolbox-lib.js +2 -2
- package/src/svg-toolbox.js +290 -3
- package/src/svg-validation-data.js +1 -0
- package/src/svgm-lib.js +2 -2
package/dist/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.
|
|
3
|
-
"buildTime": "2026-01-
|
|
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":
|
|
15
|
-
"gzipSize":
|
|
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":
|
|
21
|
-
"gzipSize":
|
|
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":
|
|
35
|
-
"gzipSize":
|
|
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
|
@@ -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.
|
|
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.
|
|
138
|
+
export const VERSION = "1.3.6";
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* Default precision for path output (decimal places)
|