@unocss/preset-attributify 0.58.0 → 0.58.1

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
@@ -167,6 +167,9 @@ function extractorAttributify(options) {
167
167
  }
168
168
  if (["class", "className"].includes(name)) {
169
169
  return content.split(splitterRE).filter(core.isValidSelector);
170
+ } else if (elementRE.test(content)) {
171
+ elementRE.lastIndex = 0;
172
+ return this.extract({ code: content });
170
173
  } else {
171
174
  if (options?.prefixedOnly && options.prefix && !name.startsWith(options.prefix))
172
175
  return [];
package/dist/index.d.cts CHANGED
@@ -57,17 +57,14 @@ type TwoStringsCompositionSuffix = 'r' | 'b' | 'l' | 't' | 'a';
57
57
  type TwoStringsComposition = `${TwoStringsCompositionPrefix}${TwoStringsCompositionSuffix}` | 'ha' | 'wa';
58
58
  /** Some words can be a complete unocss rule by itself */
59
59
  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';
60
- type StringNumberCompositionPrefix = 'op' | 'opacity' | 'fw' | 'p' | 'm' | 'w' | 'h' | 'z';
61
- /** Some words can be a complete unocss rule by compose a string and a number, such as op80, fw300, p2, p10px */
62
- type StringNumberComposition = `${StringNumberCompositionPrefix}${number}${'px' | ''}`;
63
60
  type PseudoPrefix = 'active' | 'before' | 'after' | 'dark' | 'light' | 'first' | 'last' | 'focus' | 'hover' | 'link' | 'root' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'enabled' | 'disabled' | 'all' | 'children';
64
61
  /** Some words can be used to separate utilities, such as font="mono light", text="sm white" */
65
- 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;
66
- type BasicAttributes = StringNumberComposition | SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
62
+ type SeparateEnabled = 'align' | 'animate' | 'backdrop' | 'bg' | 'blend' | 'border' | 'box' | 'container' | 'content' | 'cursor' | 'display' | 'divide' | 'filter' | 'flex' | 'font' | 'fw' | 'gap' | 'gradient' | 'grid' | 'h' | 'icon' | 'items' | 'justify' | 'list' | 'm' | 'op' | 'opacity' | 'order' | 'outline' | 'overflow' | 'p' | 'place' | 'pos' | 'ring' | 'select' | 'shadow' | 'space' | 'table' | 'text' | 'transform' | 'transition' | 'underline' | 'w' | 'z' | PseudoPrefix;
63
+ type BasicAttributes = SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
67
64
  type AttributifyNames<Prefix extends string = ''> = `${Prefix}${BasicAttributes}` | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
68
65
  interface AttributifyAttributes extends Partial<Record<AttributifyNames, string | boolean>> {
69
66
  }
70
67
 
71
68
  declare const presetAttributify: _unocss_core.PresetFactory<object, AttributifyOptions>;
72
69
 
73
- export { type AttributifyAttributes, type AttributifyNames, type AttributifyOptions, type BasicAttributes, type PseudoPrefix, type SeparateEnabled, type SpecialSingleWord, type StringNumberComposition, type StringNumberCompositionPrefix, type TwoStringsComposition, type TwoStringsCompositionPrefix, type TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
70
+ export { type AttributifyAttributes, type AttributifyNames, type AttributifyOptions, type BasicAttributes, type PseudoPrefix, type SeparateEnabled, type SpecialSingleWord, type TwoStringsComposition, type TwoStringsCompositionPrefix, type TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
package/dist/index.d.mts CHANGED
@@ -57,17 +57,14 @@ type TwoStringsCompositionSuffix = 'r' | 'b' | 'l' | 't' | 'a';
57
57
  type TwoStringsComposition = `${TwoStringsCompositionPrefix}${TwoStringsCompositionSuffix}` | 'ha' | 'wa';
58
58
  /** Some words can be a complete unocss rule by itself */
59
59
  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';
60
- type StringNumberCompositionPrefix = 'op' | 'opacity' | 'fw' | 'p' | 'm' | 'w' | 'h' | 'z';
61
- /** Some words can be a complete unocss rule by compose a string and a number, such as op80, fw300, p2, p10px */
62
- type StringNumberComposition = `${StringNumberCompositionPrefix}${number}${'px' | ''}`;
63
60
  type PseudoPrefix = 'active' | 'before' | 'after' | 'dark' | 'light' | 'first' | 'last' | 'focus' | 'hover' | 'link' | 'root' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'enabled' | 'disabled' | 'all' | 'children';
64
61
  /** Some words can be used to separate utilities, such as font="mono light", text="sm white" */
65
- 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;
66
- type BasicAttributes = StringNumberComposition | SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
62
+ type SeparateEnabled = 'align' | 'animate' | 'backdrop' | 'bg' | 'blend' | 'border' | 'box' | 'container' | 'content' | 'cursor' | 'display' | 'divide' | 'filter' | 'flex' | 'font' | 'fw' | 'gap' | 'gradient' | 'grid' | 'h' | 'icon' | 'items' | 'justify' | 'list' | 'm' | 'op' | 'opacity' | 'order' | 'outline' | 'overflow' | 'p' | 'place' | 'pos' | 'ring' | 'select' | 'shadow' | 'space' | 'table' | 'text' | 'transform' | 'transition' | 'underline' | 'w' | 'z' | PseudoPrefix;
63
+ type BasicAttributes = SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
67
64
  type AttributifyNames<Prefix extends string = ''> = `${Prefix}${BasicAttributes}` | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
68
65
  interface AttributifyAttributes extends Partial<Record<AttributifyNames, string | boolean>> {
69
66
  }
70
67
 
71
68
  declare const presetAttributify: _unocss_core.PresetFactory<object, AttributifyOptions>;
72
69
 
73
- export { type AttributifyAttributes, type AttributifyNames, type AttributifyOptions, type BasicAttributes, type PseudoPrefix, type SeparateEnabled, type SpecialSingleWord, type StringNumberComposition, type StringNumberCompositionPrefix, type TwoStringsComposition, type TwoStringsCompositionPrefix, type TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
70
+ export { type AttributifyAttributes, type AttributifyNames, type AttributifyOptions, type BasicAttributes, type PseudoPrefix, type SeparateEnabled, type SpecialSingleWord, type TwoStringsComposition, type TwoStringsCompositionPrefix, type TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
package/dist/index.d.ts CHANGED
@@ -57,17 +57,14 @@ type TwoStringsCompositionSuffix = 'r' | 'b' | 'l' | 't' | 'a';
57
57
  type TwoStringsComposition = `${TwoStringsCompositionPrefix}${TwoStringsCompositionSuffix}` | 'ha' | 'wa';
58
58
  /** Some words can be a complete unocss rule by itself */
59
59
  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';
60
- type StringNumberCompositionPrefix = 'op' | 'opacity' | 'fw' | 'p' | 'm' | 'w' | 'h' | 'z';
61
- /** Some words can be a complete unocss rule by compose a string and a number, such as op80, fw300, p2, p10px */
62
- type StringNumberComposition = `${StringNumberCompositionPrefix}${number}${'px' | ''}`;
63
60
  type PseudoPrefix = 'active' | 'before' | 'after' | 'dark' | 'light' | 'first' | 'last' | 'focus' | 'hover' | 'link' | 'root' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'enabled' | 'disabled' | 'all' | 'children';
64
61
  /** Some words can be used to separate utilities, such as font="mono light", text="sm white" */
65
- 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;
66
- type BasicAttributes = StringNumberComposition | SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
62
+ type SeparateEnabled = 'align' | 'animate' | 'backdrop' | 'bg' | 'blend' | 'border' | 'box' | 'container' | 'content' | 'cursor' | 'display' | 'divide' | 'filter' | 'flex' | 'font' | 'fw' | 'gap' | 'gradient' | 'grid' | 'h' | 'icon' | 'items' | 'justify' | 'list' | 'm' | 'op' | 'opacity' | 'order' | 'outline' | 'overflow' | 'p' | 'place' | 'pos' | 'ring' | 'select' | 'shadow' | 'space' | 'table' | 'text' | 'transform' | 'transition' | 'underline' | 'w' | 'z' | PseudoPrefix;
63
+ type BasicAttributes = SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
67
64
  type AttributifyNames<Prefix extends string = ''> = `${Prefix}${BasicAttributes}` | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
68
65
  interface AttributifyAttributes extends Partial<Record<AttributifyNames, string | boolean>> {
69
66
  }
70
67
 
71
68
  declare const presetAttributify: _unocss_core.PresetFactory<object, AttributifyOptions>;
72
69
 
73
- export { type AttributifyAttributes, type AttributifyNames, type AttributifyOptions, type BasicAttributes, type PseudoPrefix, type SeparateEnabled, type SpecialSingleWord, type StringNumberComposition, type StringNumberCompositionPrefix, type TwoStringsComposition, type TwoStringsCompositionPrefix, type TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
70
+ export { type AttributifyAttributes, type AttributifyNames, type AttributifyOptions, type BasicAttributes, type PseudoPrefix, type SeparateEnabled, type SpecialSingleWord, type TwoStringsComposition, type TwoStringsCompositionPrefix, type TwoStringsCompositionSuffix, autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
package/dist/index.mjs CHANGED
@@ -163,6 +163,9 @@ function extractorAttributify(options) {
163
163
  }
164
164
  if (["class", "className"].includes(name)) {
165
165
  return content.split(splitterRE).filter(isValidSelector);
166
+ } else if (elementRE.test(content)) {
167
+ elementRE.lastIndex = 0;
168
+ return this.extract({ code: content });
166
169
  } else {
167
170
  if (options?.prefixedOnly && options.prefix && !name.startsWith(options.prefix))
168
171
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-attributify",
3
- "version": "0.58.0",
3
+ "version": "0.58.1",
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.58.0"
36
+ "@unocss/core": "0.58.1"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "unbuild",