@unocss/preset-attributify
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -42,23 +42,26 @@ var __create = Object.create; | ||
var valuedAttributeRE = /([?]|[\w:-]+)(?:=(["'])([^\2]+?)\2)?/g; | ||
var extractorAttributify = (options) => (code) => { | ||
const result = Array.from(code.matchAll(elementRE)).flatMap((match) => Array.from((match[1] || "").matchAll(valuedAttributeRE))).flatMap(([, name, _, content]) => { | ||
for (const prefix of strippedPrefixes) { | ||
if (name.startsWith(prefix)) { | ||
name = name.slice(prefix.length); | ||
break; | ||
var extractorAttributify = (options) => ({ | ||
name: "attributify", | ||
extract({ code }) { | ||
const result = Array.from(code.matchAll(elementRE)).flatMap((match) => Array.from((match[1] || "").matchAll(valuedAttributeRE))).flatMap(([, name, _, content]) => { | ||
for (const prefix of strippedPrefixes) { | ||
if (name.startsWith(prefix)) { | ||
name = name.slice(prefix.length); | ||
break; | ||
} | ||
} | ||
} | ||
if (!content) { | ||
if ((0, import_core.isValidSelector)(name) && (options == null ? void 0 : options.nonValuedAttribute) !== false) | ||
return [`[${name}=""]`]; | ||
return []; | ||
} | ||
if (["class", "className"].includes(name)) { | ||
return content.split(splitterRE).filter(import_core.isValidSelector); | ||
} else { | ||
return content.split(splitterRE).filter(Boolean).map((v) => `[${name}~="${v}"]`); | ||
} | ||
}); | ||
return new Set(result); | ||
}; | ||
if (!content) { | ||
if ((0, import_core.isValidSelector)(name) && (options == null ? void 0 : options.nonValuedAttribute) !== false) | ||
return [`[${name}=""]`]; | ||
return []; | ||
} | ||
if (["class", "className"].includes(name)) { | ||
return content.split(splitterRE).filter(import_core.isValidSelector); | ||
} else { | ||
return content.split(splitterRE).filter(Boolean).map((v) => `[${name}~="${v}"]`); | ||
} | ||
}); | ||
return new Set(result); | ||
} | ||
}); | ||
@@ -65,0 +68,0 @@ // src/variant.ts |
{ | ||
"name": "@unocss/preset-attributify", | ||
"version": "0.5.1", | ||
"description": "", | ||
"keywords": [], | ||
"homepage": "https://github.com/antfu/unocss#readme", | ||
"version": "0.6.0", | ||
"description": "Attributify preset for UnoCSS", | ||
"keywords": [ | ||
"unocss", | ||
"unocss-preset" | ||
], | ||
"homepage": "https://github.com/antfu/unocss/tree/main/packages/preset-attributify#readme", | ||
"bugs": { | ||
@@ -12,3 +15,4 @@ "url": "https://github.com/antfu/unocss/issues" | ||
"type": "git", | ||
"url": "git+https://github.com/antfu/unocss.git" | ||
"url": "git+https://github.com/antfu/unocss.git", | ||
"directory": "packages/preset-attributify" | ||
}, | ||
@@ -32,3 +36,3 @@ "funding": "https://github.com/sponsors/antfu", | ||
"dependencies": { | ||
"@unocss/core": "0.5.1" | ||
"@unocss/core": "0.6.0" | ||
}, | ||
@@ -35,0 +39,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10949
220
+ Added@unocss/core@0.6.0(transitive)
- Removed@unocss/core@0.5.1(transitive)
Updated@unocss/core@0.6.0