@gehdoc/svg-to-video 0.29.3 → 0.29.5
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.
|
@@ -216,6 +216,19 @@ export const analyzeSvgAnimation = (svgContent, parserOverride) => {
|
|
|
216
216
|
}
|
|
217
217
|
return undefined;
|
|
218
218
|
};
|
|
219
|
+
/**
|
|
220
|
+
* Parses an SVG dimension attribute value (e.g. "100", "100px") into a pixel number.
|
|
221
|
+
* Returns NaN if the value is missing or uses relative/non-pixel units (e.g. "%", "em", "pt").
|
|
222
|
+
*/
|
|
223
|
+
export function parsePixelDimension(val) {
|
|
224
|
+
if (!val)
|
|
225
|
+
return NaN;
|
|
226
|
+
const match = val.trim().match(/^([\d.eE+-]+)\s*(px)?$/i);
|
|
227
|
+
if (!match)
|
|
228
|
+
return NaN;
|
|
229
|
+
const num = parseFloat(match[1]);
|
|
230
|
+
return isNaN(num) ? NaN : num;
|
|
231
|
+
}
|
|
219
232
|
/**
|
|
220
233
|
* Parses SVG content to extract width and height from width/height attributes or viewBox.
|
|
221
234
|
* Accepts an optional DOMParser override for non-browser environments.
|
|
@@ -231,8 +244,10 @@ export const parseSvgDimensions = (svgContent, parserOverride) => {
|
|
|
231
244
|
const svg = doc.querySelector('svg');
|
|
232
245
|
if (!svg)
|
|
233
246
|
throw new Error('Invalid SVG content');
|
|
234
|
-
|
|
235
|
-
|
|
247
|
+
const widthAttr = svg.getAttribute('width');
|
|
248
|
+
const heightAttr = svg.getAttribute('height');
|
|
249
|
+
let width = parsePixelDimension(widthAttr);
|
|
250
|
+
let height = parsePixelDimension(heightAttr);
|
|
236
251
|
const viewBox = svg.getAttribute('viewBox');
|
|
237
252
|
let isDimensionsDetected = !(isNaN(width) || isNaN(height));
|
|
238
253
|
if (!isDimensionsDetected && viewBox) {
|
package/dist/src/mcp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gehdoc/svg-to-video",
|
|
3
3
|
"mcpName": "io.github.GehDoc/svg-to-video",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Professional animated SVG to Video (MP4/WebM/MKV/MOV) and Animated Image (aPNG/GIF) converter featuring frame-accurate rendering, CLI automation, Model Context Protocol (MCP) server integration, and a serverless Web Studio.",
|
|
7
7
|
"imports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/GehDoc/svg-to-video/?sponsor=1"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=22.
|
|
23
|
+
"node": ">=22.22.2"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"animation",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"ffprobe-static": "^3.1.0",
|
|
75
75
|
"globals": "^17.4.0",
|
|
76
76
|
"husky": "^9.1.7",
|
|
77
|
-
"lint-staged": "^
|
|
77
|
+
"lint-staged": "^17.6.0",
|
|
78
78
|
"pngjs": "^7.0.0",
|
|
79
79
|
"prettier": "^3.8.1",
|
|
80
80
|
"prettier-plugin-sh": "^0.19.0",
|