@master/css 2.0.0-rc.28 → 2.0.0-rc.29

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/common.cjs CHANGED
@@ -104,10 +104,31 @@ const IMAGE_VALUE_REGEX = /(?:url|linear-gradient|radial-gradient|repeating-line
104
104
  const COLOR_VALUE_REGEX = /(?:#|(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla)\\(.*\\)|(?:\$colors)(?![a-zA-Z0-9-]))/;
105
105
  const NUMBER_VALUE_REGEX = /(?:[\d.]|(?:max|min|calc|clamp)\(.*\))/;
106
106
  const OFFICIAL_URL = new URL('https://rc.css.master.co');
107
+ const CLASS_ATTRIBUTES = [
108
+ 'class',
109
+ 'className'
110
+ ];
111
+ const CLASS_DECLARATIONS = [
112
+ 'styles'
113
+ ];
114
+ const CLASS_FUNCTIONS = [
115
+ 'clsx',
116
+ 'cva',
117
+ 'ctl',
118
+ 'cv',
119
+ 'class',
120
+ 'classnames',
121
+ 'classVariant',
122
+ 'styled(?:\\s+)?(?:\\.\\w+)?',
123
+ 'classList(?:\\s+)?\\.(?:add|remove|toggle|replace)'
124
+ ];
107
125
 
108
126
  exports.ANIMATION_SIGN = ANIMATION_SIGN;
109
127
  exports.AT_SIGN = AT_SIGN;
110
128
  exports.BASE_UNIT_REGEX = BASE_UNIT_REGEX;
129
+ exports.CLASS_ATTRIBUTES = CLASS_ATTRIBUTES;
130
+ exports.CLASS_DECLARATIONS = CLASS_DECLARATIONS;
131
+ exports.CLASS_FUNCTIONS = CLASS_FUNCTIONS;
111
132
  exports.COLOR_VALUE_REGEX = COLOR_VALUE_REGEX;
112
133
  exports.DELIMITER_SIGN = DELIMITER_SIGN;
113
134
  exports.IMAGE_VALUE_REGEX = IMAGE_VALUE_REGEX;
package/dist/common.d.ts CHANGED
@@ -20,3 +20,6 @@ export declare const IMAGE_VALUE_REGEX: RegExp;
20
20
  export declare const COLOR_VALUE_REGEX: RegExp;
21
21
  export declare const NUMBER_VALUE_REGEX: RegExp;
22
22
  export declare const OFFICIAL_URL: URL;
23
+ export declare const CLASS_ATTRIBUTES: string[];
24
+ export declare const CLASS_DECLARATIONS: string[];
25
+ export declare const CLASS_FUNCTIONS: string[];
package/dist/common.mjs CHANGED
@@ -102,5 +102,23 @@ const IMAGE_VALUE_REGEX = /(?:url|linear-gradient|radial-gradient|repeating-line
102
102
  const COLOR_VALUE_REGEX = /(?:#|(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla)\\(.*\\)|(?:\$colors)(?![a-zA-Z0-9-]))/;
103
103
  const NUMBER_VALUE_REGEX = /(?:[\d.]|(?:max|min|calc|clamp)\(.*\))/;
104
104
  const OFFICIAL_URL = new URL('https://rc.css.master.co');
105
+ const CLASS_ATTRIBUTES = [
106
+ 'class',
107
+ 'className'
108
+ ];
109
+ const CLASS_DECLARATIONS = [
110
+ 'styles'
111
+ ];
112
+ const CLASS_FUNCTIONS = [
113
+ 'clsx',
114
+ 'cva',
115
+ 'ctl',
116
+ 'cv',
117
+ 'class',
118
+ 'classnames',
119
+ 'classVariant',
120
+ 'styled(?:\\s+)?(?:\\.\\w+)?',
121
+ 'classList(?:\\s+)?\\.(?:add|remove|toggle|replace)'
122
+ ];
105
123
 
106
- export { ANIMATION_SIGN, AT_SIGN, BASE_UNIT_REGEX, COLOR_VALUE_REGEX, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS };
124
+ export { ANIMATION_SIGN, AT_SIGN, BASE_UNIT_REGEX, CLASS_ATTRIBUTES, CLASS_DECLARATIONS, CLASS_FUNCTIONS, COLOR_VALUE_REGEX, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS };
@@ -31,5 +31,6 @@ exports.utilities = utilities;
31
31
  exports.animations = animations;
32
32
  exports.variables = variables;
33
33
  exports.rules = rules.default;
34
+ exports.modes = modes;
34
35
  exports.functions = functions;
35
36
  exports.config = config;
@@ -4,11 +4,12 @@ import utilities from './utilities';
4
4
  import animations from './animations';
5
5
  import variables from './variables';
6
6
  import rules from './rules';
7
+ import modes from './modes';
7
8
  import functions from './functions';
8
9
  import type { PropertiesHyphen } from 'csstype';
9
10
  import type { Rule, RuleDefinition, ValueComponent } from '../rule';
10
11
  declare const config: Config;
11
- export { config, queries, selectors, utilities, rules, functions, animations, variables };
12
+ export { config, queries, selectors, utilities, rules, functions, animations, variables, modes };
12
13
  export type VariableValue = number | string | Array<number | string>;
13
14
  export type VariableDefinition = {
14
15
  [key in '' | `@${string}` | string]?: VariableValue | VariableDefinition;
@@ -23,4 +23,4 @@ const config = {
23
23
  important: false
24
24
  };
25
25
 
26
- export { animations, config, functions, queries, rules, selectors, utilities, variables };
26
+ export { animations, config, functions, modes, queries, rules, selectors, utilities, variables };
package/dist/core.cjs CHANGED
@@ -930,9 +930,11 @@ class MasterCSS {
930
930
  case 'host':
931
931
  selectorText = `:host(.${mode})`;
932
932
  break;
933
- default:
933
+ case 'class':
934
934
  selectorText = `.${mode}`;
935
935
  break;
936
+ default:
937
+ return;
936
938
  }
937
939
  } else {
938
940
  selectorText = ':root';
package/dist/core.mjs CHANGED
@@ -926,9 +926,11 @@ class MasterCSS {
926
926
  case 'host':
927
927
  selectorText = `:host(.${mode})`;
928
928
  break;
929
- default:
929
+ case 'class':
930
930
  selectorText = `.${mode}`;
931
931
  break;
932
+ default:
933
+ return;
932
934
  }
933
935
  } else {
934
936
  selectorText = ':root';
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ var utilities = require('./config/utilities.cjs');
22
22
  var functions = require('./config/functions.cjs');
23
23
  var animations = require('./config/animations.cjs');
24
24
  var variables = require('./config/variables.cjs');
25
+ var modes = require('./config/modes.cjs');
25
26
  var rules = require('./config/rules.cjs');
26
27
 
27
28
 
@@ -31,6 +32,9 @@ exports.Rule = rule.Rule;
31
32
  exports.ANIMATION_SIGN = common.ANIMATION_SIGN;
32
33
  exports.AT_SIGN = common.AT_SIGN;
33
34
  exports.BASE_UNIT_REGEX = common.BASE_UNIT_REGEX;
35
+ exports.CLASS_ATTRIBUTES = common.CLASS_ATTRIBUTES;
36
+ exports.CLASS_DECLARATIONS = common.CLASS_DECLARATIONS;
37
+ exports.CLASS_FUNCTIONS = common.CLASS_FUNCTIONS;
34
38
  exports.COLOR_VALUE_REGEX = common.COLOR_VALUE_REGEX;
35
39
  exports.DELIMITER_SIGN = common.DELIMITER_SIGN;
36
40
  exports.IMAGE_VALUE_REGEX = common.IMAGE_VALUE_REGEX;
@@ -64,4 +68,5 @@ exports.utilities = utilities;
64
68
  exports.functions = functions;
65
69
  exports.animations = animations;
66
70
  exports.variables = variables;
71
+ exports.modes = modes;
67
72
  exports.rules = rules.default;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export { config } from './config/index.mjs';
2
2
  export { Rule } from './rule.mjs';
3
- export { ANIMATION_SIGN, AT_SIGN, BASE_UNIT_REGEX, COLOR_VALUE_REGEX, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS } from './common.mjs';
3
+ export { ANIMATION_SIGN, AT_SIGN, BASE_UNIT_REGEX, CLASS_ATTRIBUTES, CLASS_DECLARATIONS, CLASS_FUNCTIONS, COLOR_VALUE_REGEX, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS } from './common.mjs';
4
4
  export { default as MasterCSS, default, masterCSSs } from './core.mjs';
5
5
  export { default as Layer } from './layer.mjs';
6
6
  export { default as extendConfig } from './utils/extend-config.mjs';
@@ -18,4 +18,5 @@ export { default as utilities } from './config/utilities.mjs';
18
18
  export { default as functions } from './config/functions.mjs';
19
19
  export { default as animations } from './config/animations.mjs';
20
20
  export { default as variables } from './config/variables.mjs';
21
+ export { default as modes } from './config/modes.mjs';
21
22
  export { default as rules } from './config/rules.mjs';
package/dist/rule.cjs CHANGED
@@ -558,7 +558,7 @@ class Rule {
558
558
  analyzeToken(atToken);
559
559
  }
560
560
  if (!atComponents.length) {
561
- if (!isAmpersandIncluded) {
561
+ if (!isAmpersandIncluded && modes?.[atToken]) {
562
562
  this.mode = atToken;
563
563
  continue;
564
564
  }
package/dist/rule.mjs CHANGED
@@ -556,7 +556,7 @@ class Rule {
556
556
  analyzeToken(atToken);
557
557
  }
558
558
  if (!atComponents.length) {
559
- if (!isAmpersandIncluded) {
559
+ if (!isAmpersandIncluded && modes?.[atToken]) {
560
560
  this.mode = atToken;
561
561
  continue;
562
562
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/css","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"license":"MIT","description":"The CSS language and framework for rapidly building modern and high-performance websites","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/css"},"keywords":["style","styles","html","variants","virtual","virtual-css","utility","css","ui","lightweight","class","webpack","plugin","integration","vite","parcel","build-tools","mastercss"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/colors":"^2.0.0","@master/normal.css":"^2.1.0","@techor/extend":"^3.0.18"},"devDependencies":{"@master/css-shared":"^2.0.0-rc.28","csstype":"^3.1.3"},"version":"2.0.0-rc.28"}
1
+ {"name":"@master/css","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"license":"MIT","description":"The CSS language and framework for rapidly building modern and high-performance websites","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/core"},"keywords":["style","styles","html","variants","virtual","virtual-css","utility","css","ui","lightweight","class","webpack","plugin","integration","vite","parcel","build-tools","mastercss"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/colors":"^2.0.0","@master/normal.css":"^2.1.0","@techor/extend":"^3.0.18"},"devDependencies":{"@master/css-shared":"^2.0.0-rc.29","csstype":"^3.1.3"},"version":"2.0.0-rc.29"}