@unocss/transformer-attributify-jsx 0.46.5 → 0.47.0

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/index.cjs CHANGED
@@ -14,7 +14,7 @@ function createFilter(include, exclude) {
14
14
  const elementRE = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gs;
15
15
  const attributeRE = /([a-zA-Z()#][\[?a-zA-Z0-9-_:()#%\]?]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g;
16
16
  const classFilterRE = /(className|class)\s*=\s*\{[^\}]*\}/i;
17
- const curlybraceRE = /\{.+\}/g;
17
+ const curlybraceRE = /\w+\s?=\s?\{.+?\}/g;
18
18
  function transformerAttributifyJsx(options = {}) {
19
19
  const {
20
20
  blocklist = []
@@ -46,7 +46,7 @@ function transformerAttributifyJsx(options = {}) {
46
46
  if (classNamePart)
47
47
  attributifyPart = item[3].replace(classFilterRE, " ".repeat(classNamePart[0].length));
48
48
  if (curlybraceRE.test(attributifyPart))
49
- continue;
49
+ attributifyPart = attributifyPart.replace(curlybraceRE, (match) => " ".repeat(match.length));
50
50
  for (const attr of attributifyPart.matchAll(attributeRE)) {
51
51
  const matchedRule = attr[0].replace(/\:/i, "-");
52
52
  if (matchedRule.includes("=") || isBlocked(matchedRule))
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SourceCodeTransformer } from '@unocss/core';
2
2
 
3
- declare type FilterPattern = Array<string | RegExp> | string | RegExp | null;
3
+ type FilterPattern = Array<string | RegExp> | string | RegExp | null;
4
4
  interface TransformerAttributifyJsxOptions {
5
5
  /**
6
6
  * the list of attributes to ignore
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ function createFilter(include, exclude) {
12
12
  const elementRE = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/gs;
13
13
  const attributeRE = /([a-zA-Z()#][\[?a-zA-Z0-9-_:()#%\]?]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g;
14
14
  const classFilterRE = /(className|class)\s*=\s*\{[^\}]*\}/i;
15
- const curlybraceRE = /\{.+\}/g;
15
+ const curlybraceRE = /\w+\s?=\s?\{.+?\}/g;
16
16
  function transformerAttributifyJsx(options = {}) {
17
17
  const {
18
18
  blocklist = []
@@ -44,7 +44,7 @@ function transformerAttributifyJsx(options = {}) {
44
44
  if (classNamePart)
45
45
  attributifyPart = item[3].replace(classFilterRE, " ".repeat(classNamePart[0].length));
46
46
  if (curlybraceRE.test(attributifyPart))
47
- continue;
47
+ attributifyPart = attributifyPart.replace(curlybraceRE, (match) => " ".repeat(match.length));
48
48
  for (const attr of attributifyPart.matchAll(attributeRE)) {
49
49
  const matchedRule = attr[0].replace(/\:/i, "-");
50
50
  if (matchedRule.includes("=") || isBlocked(matchedRule))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/transformer-attributify-jsx",
3
- "version": "0.46.5",
3
+ "version": "0.47.0",
4
4
  "description": "Support valueless attributify in JSX/TSX.",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@unocss/core": "0.46.5"
36
+ "@unocss/core": "0.47.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "magic-string": "^0.26.7"