@unocss/preset-attributify 0.1.4 → 0.2.2

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Extractor, Variant, Preset } from '@unocss/core';
1
+ import { Extractor, VariantFunction, Preset } from '@unocss/core';
2
2
 
3
3
  interface AttributifyOptions {
4
4
  /**
@@ -32,7 +32,7 @@ interface AttributifyOptions {
32
32
 
33
33
  declare const extractorAttributify: (options?: AttributifyOptions | undefined) => Extractor;
34
34
 
35
- declare const variantAttributify: (options?: AttributifyOptions) => Variant;
35
+ declare const variantAttributify: (options?: AttributifyOptions) => VariantFunction;
36
36
 
37
37
  declare const preset: (options?: AttributifyOptions | undefined) => Preset;
38
38
 
package/dist/index.js CHANGED
@@ -67,23 +67,21 @@ var variantsRE = /^(.+\:\!?)?(.*?)$/;
67
67
  var variantAttributify = (options = {}) => {
68
68
  var _a;
69
69
  const prefix = (_a = options.prefix) != null ? _a : "un-";
70
- return {
71
- match(input) {
72
- const match = (0, import_core2.isAttributifySelector)(input);
73
- if (!match)
74
- return;
75
- let name = match[1];
76
- if (name.startsWith(prefix))
77
- name = name.slice(prefix.length);
78
- else if (options.prefixedOnly)
79
- return;
80
- const content = match[2];
81
- const [, variants = "", body = content] = content.match(variantsRE) || [];
82
- if (body === "~" || !body)
83
- return `${variants}${name}`;
84
- else
85
- return `${variants}${name}-${body}`;
86
- }
70
+ return (input) => {
71
+ const match = (0, import_core2.isAttributifySelector)(input);
72
+ if (!match)
73
+ return;
74
+ let name = match[1];
75
+ if (name.startsWith(prefix))
76
+ name = name.slice(prefix.length);
77
+ else if (options.prefixedOnly)
78
+ return;
79
+ const content = match[2];
80
+ const [, variants = "", body = content] = content.match(variantsRE) || [];
81
+ if (body === "~" || !body)
82
+ return `${variants}${name}`;
83
+ else
84
+ return `${variants}${name}-${body}`;
87
85
  };
88
86
  };
89
87
 
package/dist/index.mjs CHANGED
@@ -38,23 +38,21 @@ var variantsRE = /^(.+\:\!?)?(.*?)$/;
38
38
  var variantAttributify = (options = {}) => {
39
39
  var _a;
40
40
  const prefix = (_a = options.prefix) != null ? _a : "un-";
41
- return {
42
- match(input) {
43
- const match = isAttributifySelector(input);
44
- if (!match)
45
- return;
46
- let name = match[1];
47
- if (name.startsWith(prefix))
48
- name = name.slice(prefix.length);
49
- else if (options.prefixedOnly)
50
- return;
51
- const content = match[2];
52
- const [, variants = "", body = content] = content.match(variantsRE) || [];
53
- if (body === "~" || !body)
54
- return `${variants}${name}`;
55
- else
56
- return `${variants}${name}-${body}`;
57
- }
41
+ return (input) => {
42
+ const match = isAttributifySelector(input);
43
+ if (!match)
44
+ return;
45
+ let name = match[1];
46
+ if (name.startsWith(prefix))
47
+ name = name.slice(prefix.length);
48
+ else if (options.prefixedOnly)
49
+ return;
50
+ const content = match[2];
51
+ const [, variants = "", body = content] = content.match(variantsRE) || [];
52
+ if (body === "~" || !body)
53
+ return `${variants}${name}`;
54
+ else
55
+ return `${variants}${name}-${body}`;
58
56
  };
59
57
  };
60
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-attributify",
3
- "version": "0.1.4",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/antfu/unocss#readme",
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@unocss/core": "0.1.4"
31
+ "@unocss/core": "0.2.2"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsup",