From 266ff0d8196d2164837dbc3839bbdc28eb1fe52f Mon Sep 17 00:00:00 2001 From: Diego Muracciole Date: Sun, 17 Nov 2024 01:18:10 +0100 Subject: [PATCH] feat: accept commas between transformations (#2950) --- .changeset/smart-ligers-build.md | 5 +++++ packages/stylesheet/src/transform/transform.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/smart-ligers-build.md diff --git a/.changeset/smart-ligers-build.md b/.changeset/smart-ligers-build.md new file mode 100644 index 000000000..a532d69cb --- /dev/null +++ b/.changeset/smart-ligers-build.md @@ -0,0 +1,5 @@ +--- +"@react-pdf/stylesheet": patch +--- + +feat: accept commas between transformations diff --git a/packages/stylesheet/src/transform/transform.js b/packages/stylesheet/src/transform/transform.js index 996ac3bcc..a18a5b2ab 100644 --- a/packages/stylesheet/src/transform/transform.js +++ b/packages/stylesheet/src/transform/transform.js @@ -1,5 +1,5 @@ const parse = (transformString) => { - const transforms = transformString.trim().split(/\) |\)/); + const transforms = transformString.trim().split(/\)[ ,]|\)/); // Handle "initial", "inherit", "unset". if (transforms.length === 1) { @@ -15,7 +15,7 @@ const parse = (transformString) => { const [name, rawValue] = transform.split('('); const splitChar = rawValue.indexOf(',') >= 0 ? ',' : ' '; const value = rawValue.split(splitChar).map((val) => val.trim()); - parsed.push({ operation: name, value }); + parsed.push({ operation: name.trim(), value }); } }