@unocss/preset-attributify 0.55.0 → 0.55.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.cjs CHANGED
@@ -206,7 +206,7 @@ function presetAttributify(options = {}) {
206
206
  }
207
207
 
208
208
  exports.autocompleteExtractorAttributify = autocompleteExtractorAttributify;
209
- exports["default"] = presetAttributify;
209
+ exports.default = presetAttributify;
210
210
  exports.defaultIgnoreAttributes = defaultIgnoreAttributes;
211
211
  exports.extractorAttributify = extractorAttributify;
212
212
  exports.presetAttributify = presetAttributify;
@@ -0,0 +1,72 @@
1
+ import { PresetOptions, AutoCompleteExtractor, Extractor, VariantObject, Preset } from '@unocss/core';
2
+
3
+ interface AttributifyOptions extends PresetOptions {
4
+ /**
5
+ * Only generate CSS for attributify or class
6
+ *
7
+ * @default false
8
+ */
9
+ strict?: boolean;
10
+ /**
11
+ * @default 'un-'
12
+ */
13
+ prefix?: string;
14
+ /**
15
+ * Only match for prefixed attributes
16
+ *
17
+ * @default false
18
+ */
19
+ prefixedOnly?: boolean;
20
+ /**
21
+ * Support matching non-valued attributes
22
+ *
23
+ * For example
24
+ * ```html
25
+ * <div mt-2 />
26
+ * ```
27
+ *
28
+ * @default true
29
+ */
30
+ nonValuedAttribute?: boolean;
31
+ /**
32
+ * A list of attributes to be ignored from extracting.
33
+ */
34
+ ignoreAttributes?: string[];
35
+ /**
36
+ * Non-valued attributes will also match if the actual value represented in DOM is `true`.
37
+ * This option exists for supporting frameworks that encodes non-valued attributes as `true`.
38
+ * Enabling this option will break rules that ends with `true`.
39
+ *
40
+ * @default false
41
+ */
42
+ trueToNonValued?: boolean;
43
+ }
44
+
45
+ declare function autocompleteExtractorAttributify(options?: AttributifyOptions): AutoCompleteExtractor;
46
+
47
+ declare const defaultIgnoreAttributes: string[];
48
+ declare function extractorAttributify(options?: AttributifyOptions): Extractor;
49
+
50
+ declare const variantsRE: RegExp;
51
+ declare function variantAttributify(options?: AttributifyOptions): VariantObject;
52
+
53
+ type TwoStringsCompositionPrefix = 'm' | 'p';
54
+ type TwoStringsCompositionSuffix = 'r' | 'b' | 'l' | 't' | 'a';
55
+ /** Some words can compose with two strings to become a complete unocss rule such as ha, mr, mb */
56
+ type TwoStringsComposition = `${TwoStringsCompositionPrefix}${TwoStringsCompositionSuffix}` | 'ha' | 'wa';
57
+ /** Some words can be a complete unocss rule by itself */
58
+ type SpecialSingleWord = 'container' | 'flex' | 'block' | 'inline' | 'table' | 'isolate' | 'absolute' | 'relative' | 'fixed' | 'sticky' | 'static' | 'visible' | 'invisible' | 'grow' | 'shrink' | 'antialiased' | 'italic' | 'ordinal' | 'overline' | 'underline' | 'uppercase' | 'lowercase' | 'capitalize' | 'truncate' | 'border' | 'rounded' | 'outline' | 'ring' | 'shadow' | 'blur' | 'grayscale' | 'invert' | 'sepia' | 'transition' | 'resize' | 'transform' | 'filter';
59
+ type StringNumberCompositionPrefix = 'op' | 'opacity' | 'fw' | 'p' | 'm' | 'w' | 'h' | 'z';
60
+ /** Some words can be a complete unocss rule by compose a string and a number, such as op80, fw300, p2, p10px */
61
+ type StringNumberComposition = `${StringNumberCompositionPrefix}${number}${'px' | ''}`;
62
+ type PseudoPrefix = 'active' | 'before' | 'after' | 'dark' | 'light' | 'first' | 'last' | 'focus' | 'hover' | 'link' | 'root' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'enabled' | 'disabled' | 'all' | 'children';
63
+ /** Some words can be used to separate utilities, such as font="mono light", text="sm white" */
64
+ type SeparateEnabled = 'align' | 'animate' | 'backdrop' | 'bg' | 'blend' | 'border' | 'box' | 'container' | 'content' | 'cursor' | 'display' | 'divide' | 'filter' | 'flex' | 'font' | 'gap' | 'gradient' | 'grid' | 'h' | 'icon' | 'items' | 'justify' | 'list' | 'm' | 'opacity' | 'order' | 'outline' | 'overflow' | 'p' | 'place' | 'pos' | 'ring' | 'select' | 'shadow' | 'space' | 'table' | 'text' | 'transform' | 'transition' | 'underline' | 'w' | 'z' | PseudoPrefix;
65
+ type BasicAttributes = StringNumberComposition | SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
66
+ type AttributifyNames<Prefix extends string = ''> = `${Prefix}${BasicAttributes}` | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
67
+ interface AttributifyAttributes extends Partial<Record<AttributifyNames, string | boolean>> {
68
+ }
69
+
70
+ declare function presetAttributify(options?: AttributifyOptions): Preset;
71
+
72
+ export { AttributifyAttributes, AttributifyNames, AttributifyOptions, BasicAttributes, PseudoPrefix, SeparateEnabled, SpecialSingleWord, StringNumberComposition, StringNumberCompositionPrefix, TwoStringsComposition, TwoStringsCompositionPrefix, TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
@@ -0,0 +1,72 @@
1
+ import { PresetOptions, AutoCompleteExtractor, Extractor, VariantObject, Preset } from '@unocss/core';
2
+
3
+ interface AttributifyOptions extends PresetOptions {
4
+ /**
5
+ * Only generate CSS for attributify or class
6
+ *
7
+ * @default false
8
+ */
9
+ strict?: boolean;
10
+ /**
11
+ * @default 'un-'
12
+ */
13
+ prefix?: string;
14
+ /**
15
+ * Only match for prefixed attributes
16
+ *
17
+ * @default false
18
+ */
19
+ prefixedOnly?: boolean;
20
+ /**
21
+ * Support matching non-valued attributes
22
+ *
23
+ * For example
24
+ * ```html
25
+ * <div mt-2 />
26
+ * ```
27
+ *
28
+ * @default true
29
+ */
30
+ nonValuedAttribute?: boolean;
31
+ /**
32
+ * A list of attributes to be ignored from extracting.
33
+ */
34
+ ignoreAttributes?: string[];
35
+ /**
36
+ * Non-valued attributes will also match if the actual value represented in DOM is `true`.
37
+ * This option exists for supporting frameworks that encodes non-valued attributes as `true`.
38
+ * Enabling this option will break rules that ends with `true`.
39
+ *
40
+ * @default false
41
+ */
42
+ trueToNonValued?: boolean;
43
+ }
44
+
45
+ declare function autocompleteExtractorAttributify(options?: AttributifyOptions): AutoCompleteExtractor;
46
+
47
+ declare const defaultIgnoreAttributes: string[];
48
+ declare function extractorAttributify(options?: AttributifyOptions): Extractor;
49
+
50
+ declare const variantsRE: RegExp;
51
+ declare function variantAttributify(options?: AttributifyOptions): VariantObject;
52
+
53
+ type TwoStringsCompositionPrefix = 'm' | 'p';
54
+ type TwoStringsCompositionSuffix = 'r' | 'b' | 'l' | 't' | 'a';
55
+ /** Some words can compose with two strings to become a complete unocss rule such as ha, mr, mb */
56
+ type TwoStringsComposition = `${TwoStringsCompositionPrefix}${TwoStringsCompositionSuffix}` | 'ha' | 'wa';
57
+ /** Some words can be a complete unocss rule by itself */
58
+ type SpecialSingleWord = 'container' | 'flex' | 'block' | 'inline' | 'table' | 'isolate' | 'absolute' | 'relative' | 'fixed' | 'sticky' | 'static' | 'visible' | 'invisible' | 'grow' | 'shrink' | 'antialiased' | 'italic' | 'ordinal' | 'overline' | 'underline' | 'uppercase' | 'lowercase' | 'capitalize' | 'truncate' | 'border' | 'rounded' | 'outline' | 'ring' | 'shadow' | 'blur' | 'grayscale' | 'invert' | 'sepia' | 'transition' | 'resize' | 'transform' | 'filter';
59
+ type StringNumberCompositionPrefix = 'op' | 'opacity' | 'fw' | 'p' | 'm' | 'w' | 'h' | 'z';
60
+ /** Some words can be a complete unocss rule by compose a string and a number, such as op80, fw300, p2, p10px */
61
+ type StringNumberComposition = `${StringNumberCompositionPrefix}${number}${'px' | ''}`;
62
+ type PseudoPrefix = 'active' | 'before' | 'after' | 'dark' | 'light' | 'first' | 'last' | 'focus' | 'hover' | 'link' | 'root' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'enabled' | 'disabled' | 'all' | 'children';
63
+ /** Some words can be used to separate utilities, such as font="mono light", text="sm white" */
64
+ type SeparateEnabled = 'align' | 'animate' | 'backdrop' | 'bg' | 'blend' | 'border' | 'box' | 'container' | 'content' | 'cursor' | 'display' | 'divide' | 'filter' | 'flex' | 'font' | 'gap' | 'gradient' | 'grid' | 'h' | 'icon' | 'items' | 'justify' | 'list' | 'm' | 'opacity' | 'order' | 'outline' | 'overflow' | 'p' | 'place' | 'pos' | 'ring' | 'select' | 'shadow' | 'space' | 'table' | 'text' | 'transform' | 'transition' | 'underline' | 'w' | 'z' | PseudoPrefix;
65
+ type BasicAttributes = StringNumberComposition | SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
66
+ type AttributifyNames<Prefix extends string = ''> = `${Prefix}${BasicAttributes}` | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
67
+ interface AttributifyAttributes extends Partial<Record<AttributifyNames, string | boolean>> {
68
+ }
69
+
70
+ declare function presetAttributify(options?: AttributifyOptions): Preset;
71
+
72
+ export { AttributifyAttributes, AttributifyNames, AttributifyOptions, BasicAttributes, PseudoPrefix, SeparateEnabled, SpecialSingleWord, StringNumberComposition, StringNumberCompositionPrefix, TwoStringsComposition, TwoStringsCompositionPrefix, TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-attributify",
3
- "version": "0.55.0",
3
+ "version": "0.55.2",
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.55.0"
36
+ "@unocss/core": "0.55.2"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "unbuild",