@unocss/preset-attributify 0.47.5 → 0.48.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
@@ -118,7 +118,7 @@ const strippedPrefixes = [
118
118
  ];
119
119
  const splitterRE = /[\s'"`;]+/g;
120
120
  const elementRE = /<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs;
121
- const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms;
121
+ const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms;
122
122
  const defaultIgnoreAttributes = ["placeholder"];
123
123
  const extractorAttributify = (options) => {
124
124
  const ignoreAttributes = options?.ignoreAttributes ?? defaultIgnoreAttributes;
@@ -149,6 +149,8 @@ const extractorAttributify = (options) => {
149
149
  if (["class", "className"].includes(name)) {
150
150
  return content.split(splitterRE).filter(core.isValidSelector);
151
151
  } else {
152
+ if (options?.prefixedOnly && options.prefix && !name.startsWith(options.prefix))
153
+ return [];
152
154
  const extractTernary = Array.from(content.matchAll(/(?:[\?:].*?)(["'])([^\1]*?)\1/gms)).map(([, , v]) => v.split(splitterRE)).flat();
153
155
  return (extractTernary.length ? extractTernary : content.split(splitterRE)).filter(Boolean).map((v) => `[${name}~="${v}"]`);
154
156
  }
package/dist/index.mjs CHANGED
@@ -114,7 +114,7 @@ const strippedPrefixes = [
114
114
  ];
115
115
  const splitterRE = /[\s'"`;]+/g;
116
116
  const elementRE = /<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs;
117
- const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms;
117
+ const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms;
118
118
  const defaultIgnoreAttributes = ["placeholder"];
119
119
  const extractorAttributify = (options) => {
120
120
  const ignoreAttributes = options?.ignoreAttributes ?? defaultIgnoreAttributes;
@@ -145,6 +145,8 @@ const extractorAttributify = (options) => {
145
145
  if (["class", "className"].includes(name)) {
146
146
  return content.split(splitterRE).filter(isValidSelector);
147
147
  } else {
148
+ if (options?.prefixedOnly && options.prefix && !name.startsWith(options.prefix))
149
+ return [];
148
150
  const extractTernary = Array.from(content.matchAll(/(?:[\?:].*?)(["'])([^\1]*?)\1/gms)).map(([, , v]) => v.split(splitterRE)).flat();
149
151
  return (extractTernary.length ? extractTernary : content.split(splitterRE)).filter(Boolean).map((v) => `[${name}~="${v}"]`);
150
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-attributify",
3
- "version": "0.47.5",
3
+ "version": "0.48.0",
4
4
  "description": "Attributify preset for UnoCSS",
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.47.5"
36
+ "@unocss/core": "0.48.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "unbuild",