@remotion/shapes 4.0.85 → 4.0.87

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.
@@ -26,6 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.RenderSvg = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
+ const react_dom_1 = require("react-dom");
30
+ const does_react_support_canary_1 = require("../utils/does-react-support-canary");
29
31
  const RenderSvg = ({ width, height, path, style, pathStyle, transformOrigin, debug, instructions, ...props }) => {
30
32
  const actualStyle = (0, react_1.useMemo)(() => {
31
33
  return {
@@ -39,7 +41,10 @@ const RenderSvg = ({ width, height, path, style, pathStyle, transformOrigin, deb
39
41
  ...(pathStyle !== null && pathStyle !== void 0 ? pathStyle : {}),
40
42
  };
41
43
  }, [pathStyle]);
42
- return ((0, jsx_runtime_1.jsxs)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: actualStyle, children: [(0, jsx_runtime_1.jsx)("path", { "transform-origin": transformOrigin, d: path, style: actualPathStyle, ...props }), debug
44
+ const reactSupportsTransformOrigin = (0, does_react_support_canary_1.doesReactSupportTransformOriginProperty)(react_dom_1.version);
45
+ return ((0, jsx_runtime_1.jsxs)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: actualStyle, children: [(0, jsx_runtime_1.jsx)("path", { "transform-origin": reactSupportsTransformOrigin ? undefined : transformOrigin,
46
+ // @ts-expect-error
47
+ transformOrigin: reactSupportsTransformOrigin ? transformOrigin : undefined, d: path, style: actualPathStyle, ...props }), debug
43
48
  ? instructions.map((i, index) => {
44
49
  if (i.type === 'C') {
45
50
  const prevInstruction = index === 0
@@ -0,0 +1 @@
1
+ export declare const doesReactSupportTransformOriginProperty: (version: string) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.doesReactSupportTransformOriginProperty = void 0;
4
+ const doesReactSupportTransformOriginProperty = (version) => {
5
+ if (version.includes('canary') || version.includes('experimental')) {
6
+ const last8Chars = parseInt(version.slice(-8), 10);
7
+ return last8Chars > 20230209;
8
+ }
9
+ const [major, minor] = version.split('.').map(Number);
10
+ return major > 18 || (major === 18 && minor >= 3);
11
+ };
12
+ exports.doesReactSupportTransformOriginProperty = doesReactSupportTransformOriginProperty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/shapes",
3
- "version": "4.0.85",
3
+ "version": "4.0.87",
4
4
  "description": "Utility functions and components for SVG shapes",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -13,6 +13,7 @@
13
13
  "url": "https://github.com/remotion-dev/remotion/issues"
14
14
  },
15
15
  "devDependencies": {
16
+ "@types/react-dom": "18.0.11",
16
17
  "@jonny/eslint-config": "3.0.276",
17
18
  "@testing-library/react": "^13.4.0",
18
19
  "@types/node": "18.14.6",
@@ -38,7 +39,7 @@
38
39
  "react-dom": ">=16.8.0"
39
40
  },
40
41
  "dependencies": {
41
- "@remotion/paths": "4.0.85"
42
+ "@remotion/paths": "4.0.87"
42
43
  },
43
44
  "scripts": {
44
45
  "formatting": "prettier src --check",