@master/css 2.0.0-rc.68 → 2.0.0-rc.69

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.
Files changed (107) hide show
  1. package/dist/common.cjs +0 -2
  2. package/dist/common.d.ts +0 -1
  3. package/dist/common.mjs +1 -2
  4. package/dist/config/functions.cjs +9 -243
  5. package/dist/config/functions.d.ts +137 -2
  6. package/dist/config/functions.mjs +9 -243
  7. package/dist/config/index.cjs +2 -2
  8. package/dist/config/index.mjs +2 -2
  9. package/dist/config/modes.cjs +307 -3
  10. package/dist/config/modes.d.ts +306 -2
  11. package/dist/config/modes.mjs +307 -3
  12. package/dist/config/rules.cjs +740 -782
  13. package/dist/config/rules.d.ts +692 -683
  14. package/dist/config/rules.mjs +741 -783
  15. package/dist/config/utilities.cjs +328 -97
  16. package/dist/config/utilities.d.ts +247 -16
  17. package/dist/config/utilities.mjs +328 -97
  18. package/dist/config/variables.cjs +88 -460
  19. package/dist/config/variables.d.ts +358 -369
  20. package/dist/config/variables.mjs +88 -460
  21. package/dist/core.cjs +234 -234
  22. package/dist/core.d.ts +5 -3
  23. package/dist/core.mjs +234 -234
  24. package/dist/create.cjs +10 -0
  25. package/dist/create.d.ts +3 -0
  26. package/dist/create.mjs +8 -0
  27. package/dist/declarers/core.group.cjs +99 -0
  28. package/dist/declarers/core.group.d.ts +2 -0
  29. package/dist/declarers/core.group.mjs +97 -0
  30. package/dist/declarers/core.variable.cjs +9 -0
  31. package/dist/declarers/core.variable.d.ts +4 -0
  32. package/dist/declarers/core.variable.mjs +7 -0
  33. package/dist/declarers/index.cjs +13 -0
  34. package/dist/declarers/index.d.ts +10 -0
  35. package/dist/declarers/index.mjs +11 -0
  36. package/dist/declarers/pair.cjs +12 -0
  37. package/dist/declarers/pair.d.ts +4 -0
  38. package/dist/declarers/pair.mjs +10 -0
  39. package/dist/factories/with-syntax-layer.cjs +0 -2
  40. package/dist/factories/with-syntax-layer.mjs +0 -2
  41. package/dist/function-transformers/core.calc.cjs +225 -0
  42. package/dist/function-transformers/core.calc.d.ts +2 -0
  43. package/dist/function-transformers/core.calc.mjs +223 -0
  44. package/dist/function-transformers/core.variable.cjs +23 -0
  45. package/dist/function-transformers/core.variable.d.ts +7 -0
  46. package/dist/function-transformers/core.variable.mjs +21 -0
  47. package/dist/function-transformers/index.cjs +11 -0
  48. package/dist/function-transformers/index.d.ts +8 -0
  49. package/dist/function-transformers/index.mjs +9 -0
  50. package/dist/index.cjs +10 -1
  51. package/dist/index.d.ts +8 -2
  52. package/dist/index.mjs +6 -1
  53. package/dist/layer.cjs +2 -4
  54. package/dist/layer.mjs +2 -4
  55. package/dist/non-layer.cjs +2 -4
  56. package/dist/non-layer.mjs +2 -4
  57. package/dist/syntax-rule-type.cjs +8 -7
  58. package/dist/syntax-rule-type.d.ts +7 -7
  59. package/dist/syntax-rule-type.mjs +8 -7
  60. package/dist/syntax-rule.cjs +305 -258
  61. package/dist/syntax-rule.d.ts +2 -2
  62. package/dist/syntax-rule.mjs +306 -259
  63. package/dist/{utils/autofill-solid-style.cjs → transformers/auto-fill-solid.cjs} +3 -3
  64. package/dist/transformers/auto-fill-solid.d.ts +2 -0
  65. package/dist/{utils/autofill-solid-style.mjs → transformers/auto-fill-solid.mjs} +3 -3
  66. package/dist/transformers/index.cjs +9 -0
  67. package/dist/transformers/index.d.ts +6 -0
  68. package/dist/transformers/index.mjs +7 -0
  69. package/dist/types/common.d.ts +0 -2
  70. package/dist/types/config.d.ts +24 -20
  71. package/dist/types/syntax.d.ts +10 -8
  72. package/dist/utils/equal-selectors.cjs +1 -2
  73. package/dist/utils/equal-selectors.mjs +1 -2
  74. package/dist/utils/extend-config.cjs +83 -44
  75. package/dist/utils/extend-config.d.ts +10 -1
  76. package/dist/utils/extend-config.mjs +83 -44
  77. package/dist/utils/flatten-meta-object.cjs +38 -0
  78. package/dist/utils/flatten-meta-object.d.ts +13 -0
  79. package/dist/utils/flatten-meta-object.mjs +36 -0
  80. package/dist/utils/flatten-object.cjs +13 -9
  81. package/dist/utils/flatten-object.d.ts +1 -1
  82. package/dist/utils/flatten-object.mjs +13 -9
  83. package/dist/utils/generate-css.cjs +2 -2
  84. package/dist/utils/generate-css.d.ts +1 -2
  85. package/dist/utils/generate-css.mjs +2 -2
  86. package/dist/utils/minify-extended-config.cjs +64 -0
  87. package/dist/utils/minify-extended-config.d.ts +9 -0
  88. package/dist/utils/minify-extended-config.mjs +62 -0
  89. package/dist/utils/nest-meta-object.cjs +25 -0
  90. package/dist/utils/nest-meta-object.d.ts +7 -0
  91. package/dist/utils/nest-meta-object.mjs +23 -0
  92. package/dist/utils/parse-at.cjs +1 -2
  93. package/dist/utils/parse-at.d.ts +2 -2
  94. package/dist/utils/parse-at.mjs +1 -2
  95. package/dist/utils/parse-pair.cjs +3 -6
  96. package/dist/utils/parse-pair.mjs +3 -6
  97. package/dist/utils/parse-selector.cjs +2 -4
  98. package/dist/utils/parse-selector.d.ts +2 -2
  99. package/dist/utils/parse-selector.mjs +2 -4
  100. package/dist/utils/sort-readable-classes.cjs +2 -2
  101. package/dist/utils/sort-readable-classes.d.ts +1 -2
  102. package/dist/utils/sort-readable-classes.mjs +2 -2
  103. package/dist/variable-rule.cjs +35 -29
  104. package/dist/variable-rule.d.ts +16 -6
  105. package/dist/variable-rule.mjs +35 -29
  106. package/package.json +1 -1
  107. package/dist/utils/autofill-solid-style.d.ts +0 -3
package/dist/common.cjs CHANGED
@@ -109,7 +109,6 @@ const UNIT_REGEX = /^([+-.]?\d+(?:\.?\d+)?)(%|cm|mm|q|in|pt|pc|px|em|rem|ex|rex|
109
109
  const IMAGE_VALUE_REGEX = /(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\(.*\)/;
110
110
  const COLOR_VALUE_REGEX = /(?:#|(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla|light-dark)\(.*\)|(?:\$colors)(?![a-zA-Z0-9-]))/;
111
111
  const NUMBER_VALUE_REGEX = /(?:[\d.]|(?:max|min|calc|clamp)\([^|]*\))/;
112
- const OFFICIAL_URL = new URL('https://rc.css.master.co');
113
112
  const CLASS_ATTRIBUTES = [
114
113
  'class',
115
114
  'className'
@@ -196,7 +195,6 @@ exports.COMPARISION_OPERATORS = COMPARISION_OPERATORS;
196
195
  exports.DELIMITER_SIGN = DELIMITER_SIGN;
197
196
  exports.IMAGE_VALUE_REGEX = IMAGE_VALUE_REGEX;
198
197
  exports.NUMBER_VALUE_REGEX = NUMBER_VALUE_REGEX;
199
- exports.OFFICIAL_URL = OFFICIAL_URL;
200
198
  exports.QUERY_COMPARISON_OPERATORS = QUERY_COMPARISON_OPERATORS;
201
199
  exports.QUERY_LOGICAL_OPERATORS = QUERY_LOGICAL_OPERATORS;
202
200
  exports.SELECTOR_COMBINATORS = SELECTOR_COMBINATORS;
package/dist/common.d.ts CHANGED
@@ -20,7 +20,6 @@ export declare const UNIT_REGEX: RegExp;
20
20
  export declare const IMAGE_VALUE_REGEX: RegExp;
21
21
  export declare const COLOR_VALUE_REGEX: RegExp;
22
22
  export declare const NUMBER_VALUE_REGEX: RegExp;
23
- export declare const OFFICIAL_URL: URL;
24
23
  export declare const CLASS_ATTRIBUTES: string[];
25
24
  export declare const CLASS_DECLARATIONS: string[];
26
25
  export declare const CLASS_FUNCTIONS: string[];
package/dist/common.mjs CHANGED
@@ -107,7 +107,6 @@ const UNIT_REGEX = /^([+-.]?\d+(?:\.?\d+)?)(%|cm|mm|q|in|pt|pc|px|em|rem|ex|rex|
107
107
  const IMAGE_VALUE_REGEX = /(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\(.*\)/;
108
108
  const COLOR_VALUE_REGEX = /(?:#|(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla|light-dark)\(.*\)|(?:\$colors)(?![a-zA-Z0-9-]))/;
109
109
  const NUMBER_VALUE_REGEX = /(?:[\d.]|(?:max|min|calc|clamp)\([^|]*\))/;
110
- const OFFICIAL_URL = new URL('https://rc.css.master.co');
111
110
  const CLASS_ATTRIBUTES = [
112
111
  'class',
113
112
  'className'
@@ -178,4 +177,4 @@ const AT_COMPARABLE_FEATURES = [
178
177
  ];
179
178
  const __UNSORTED__ = '__UNSORTED__';
180
179
 
181
- export { ANIMATION_SIGN, AT_COMPARABLE_FEATURES, AT_COMPARISON_OPERATORS, AT_IDENTIFIERS, AT_LOGICAL_OPERATORS, AT_SIGN, BASE_UNIT_REGEX, BORDER_STYLE_VALUES, CLASS_ATTRIBUTES, CLASS_DECLARATIONS, CLASS_FUNCTIONS, COLOR_VALUE_REGEX, COMPARISION_OPERATORS, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_COMBINATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS, __UNSORTED__ };
180
+ export { ANIMATION_SIGN, AT_COMPARABLE_FEATURES, AT_COMPARISON_OPERATORS, AT_IDENTIFIERS, AT_LOGICAL_OPERATORS, AT_SIGN, BASE_UNIT_REGEX, BORDER_STYLE_VALUES, CLASS_ATTRIBUTES, CLASS_DECLARATIONS, CLASS_FUNCTIONS, COLOR_VALUE_REGEX, COMPARISION_OPERATORS, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_COMBINATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS, __UNSORTED__ };
@@ -1,249 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var common = require('../common.cjs');
4
-
5
3
  const functions = {
6
- $: {
7
- transform (value) {
8
- let name;
9
- let fallback;
10
- const firstCommaIndex = value.indexOf(',');
11
- if (firstCommaIndex !== -1) {
12
- name = value.slice(0, firstCommaIndex);
13
- fallback = value.slice(firstCommaIndex + 1);
14
- } else {
15
- name = value;
16
- }
17
- return [
18
- {
19
- type: 'variable',
20
- name,
21
- fallback,
22
- token: value
23
- }
24
- ];
25
- }
26
- },
27
- calc: {
28
- transform (value, bypassVariableNames) {
29
- const valueComponents = [];
30
- let i = 0;
31
- const anaylzeDeeply = (currentValueComponents, bypassHandlingSeparator, parentBypassParsing, parentUnitChecking, isVarFunction)=>{
32
- const isChildHandler = valueComponents !== currentValueComponents;
33
- const unparsedValueComponents = [];
34
- let bypassParsing = false;
35
- let hasUnit = false;
36
- let currentHasUnit = false;
37
- let unitChecking = false;
38
- let childHasUnit = undefined;
39
- let current = '';
40
- const clear = (separator, prefix = '', suffix = '')=>{
41
- if (childHasUnit === false && separator !== ' ' && this.definition.unit) {
42
- childHasUnit = undefined;
43
- if (!unitChecking) {
44
- pushUnitValueComponents();
45
- }
46
- }
47
- if (current) {
48
- if (!isVarFunction) {
49
- const result = common.BASE_UNIT_REGEX.exec(current);
50
- if (result) {
51
- current = (+result[1] * (this.css.config.baseUnit ?? 1)).toString();
52
- }
53
- }
54
- if (!bypassParsing && !parentBypassParsing) {
55
- const valueComponent = {
56
- ...this.parseValue(current),
57
- token: current
58
- };
59
- if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
60
- hasUnit = true;
61
- }
62
- if (unitChecking) {
63
- if (isNaN(+current)) {
64
- if (valueComponent.type === 'number') {
65
- currentValueComponents.push(valueComponent);
66
- currentHasUnit = true;
67
- } else {
68
- currentValueComponents.push(valueComponent);
69
- }
70
- } else {
71
- currentValueComponents.push({
72
- type: 'number',
73
- value: +current,
74
- token: current
75
- });
76
- }
77
- } else {
78
- if (isChildHandler) {
79
- const newValueComponent = {
80
- type: 'string',
81
- value: current,
82
- token: current
83
- };
84
- unparsedValueComponents.push(newValueComponent);
85
- currentValueComponents.push(newValueComponent);
86
- } else {
87
- currentValueComponents.push(valueComponent);
88
- }
89
- }
90
- } else {
91
- currentValueComponents.push({
92
- type: 'string',
93
- value: current,
94
- token: current
95
- });
96
- }
97
- current = '';
98
- }
99
- if (separator) {
100
- if (separator === '+' || separator === '-') {
101
- handleUnitChecking();
102
- }
103
- if (prefix && value[i - 1] === ' ') {
104
- prefix = '';
105
- }
106
- if (suffix && value[i + 1] === ' ') {
107
- suffix = '';
108
- }
109
- if (bypassHandlingSeparator) {
110
- currentValueComponents.push({
111
- type: 'separator',
112
- value: separator,
113
- text: separator,
114
- token: separator
115
- });
116
- } else {
117
- currentValueComponents.push({
118
- type: 'separator',
119
- value: separator,
120
- text: prefix + separator + suffix,
121
- token: separator
122
- });
123
- }
124
- }
125
- bypassParsing = false;
126
- };
127
- const pushUnitValueComponents = ()=>{
128
- if (this.definition.unit === 'rem' || this.definition.unit === 'em') {
129
- currentValueComponents.push({
130
- type: 'separator',
131
- value: '/',
132
- text: ' / ',
133
- token: '/'
134
- }, {
135
- type: 'number',
136
- value: this.css.config.rootSize,
137
- token: String(this.css.config.rootSize)
138
- });
139
- }
140
- currentValueComponents.push({
141
- type: 'separator',
142
- value: '*',
143
- text: ' * ',
144
- token: '*'
145
- }, {
146
- type: 'number',
147
- value: 1,
148
- unit: this.definition.unit,
149
- token: this.definition.unit
150
- });
151
- };
152
- const handleUnitChecking = ()=>{
153
- if (unitChecking && !currentHasUnit && !parentUnitChecking && (!isChildHandler || hasUnit)) {
154
- pushUnitValueComponents();
155
- }
156
- unitChecking = false;
157
- currentHasUnit = false;
158
- };
159
- for(; i < value.length; i++){
160
- const char = value[i];
161
- if (char === '(') {
162
- const symbolResult = /^([+-])/.exec(current);
163
- if (symbolResult) {
164
- currentValueComponents.push({
165
- type: 'string',
166
- value: symbolResult[1],
167
- token: symbolResult[1]
168
- });
169
- }
170
- const functionName = symbolResult ? current.slice(1) : current;
171
- const newValueComponent = {
172
- type: 'function',
173
- name: functionName,
174
- symbol: char,
175
- children: [],
176
- bypassTransform: functionName === 'calc',
177
- token: current
178
- };
179
- currentValueComponents.push(newValueComponent);
180
- current = '';
181
- i++;
182
- const isVarFunction = functionName === '$' || functionName === 'var';
183
- childHasUnit = anaylzeDeeply(newValueComponent.children, functionName !== '' && functionName !== 'calc' && (isVarFunction || Object.prototype.hasOwnProperty.call(functions, functionName)), bypassParsing || isVarFunction || unitChecking && currentHasUnit, unitChecking, isVarFunction) || functionName === 'var';
184
- if (!childHasUnit && functionName === '$') {
185
- const variableType = this.css.variables.get(newValueComponent.children[0].value)?.type;
186
- childHasUnit = !variableType || variableType === 'string';
187
- }
188
- if (childHasUnit) {
189
- hasUnit = true;
190
- currentHasUnit = true;
191
- }
192
- } else if (char === ')') {
193
- clear('');
194
- if (hasUnit) {
195
- for (const eachUnparsedValueComponent of unparsedValueComponents){
196
- Object.assign(eachUnparsedValueComponent, this.parseValue(eachUnparsedValueComponent.value));
197
- }
198
- }
199
- return hasUnit;
200
- } else if (char === ',') {
201
- clear(char, '', ' ');
202
- } else if (char === ' ') {
203
- clear(char);
204
- } else {
205
- const previousChar = value[i - 1];
206
- switch(char){
207
- case '+':
208
- if (!current && previousChar !== ')') {
209
- current += char;
210
- } else {
211
- clear(char, ' ', ' ');
212
- }
213
- break;
214
- case '-':
215
- if (!current && previousChar !== ')') {
216
- current += char;
217
- } else {
218
- clear(char, ' ', ' ');
219
- }
220
- break;
221
- case '*':
222
- if (this.definition.unit) {
223
- unitChecking = true;
224
- }
225
- clear(char, ' ', ' ');
226
- break;
227
- case '/':
228
- if (this.definition.unit) {
229
- unitChecking = true;
230
- }
231
- clear(char, ' ', ' ');
232
- bypassParsing = true;
233
- break;
234
- default:
235
- current += char;
236
- break;
237
- }
238
- }
239
- }
240
- clear('');
241
- handleUnitChecking();
242
- };
243
- anaylzeDeeply(valueComponents, false, false, false, false);
244
- return 'calc(' + this.resolveValue(valueComponents, functions.calc.unit ?? this.definition.unit, bypassVariableNames, true) + ')';
245
- }
246
- },
247
4
  translate: {
248
5
  unit: 'rem'
249
6
  },
@@ -259,6 +16,9 @@ const functions = {
259
16
  translate3d: {
260
17
  unit: 'rem'
261
18
  },
19
+ perspective: {
20
+ unit: 'rem'
21
+ },
262
22
  skew: {
263
23
  unit: 'deg'
264
24
  },
@@ -369,6 +129,12 @@ const functions = {
369
129
  },
370
130
  'scaleZ': {
371
131
  unit: ''
132
+ },
133
+ $: {
134
+ transformer: 'core.variable'
135
+ },
136
+ calc: {
137
+ transformer: 'core.calc'
372
138
  }
373
139
  };
374
140
 
@@ -1,3 +1,138 @@
1
- import { FunctionDefinitions } from '../types/config';
2
- declare const functions: FunctionDefinitions;
1
+ declare const functions: {
2
+ translate: {
3
+ unit: string;
4
+ };
5
+ translateX: {
6
+ unit: string;
7
+ };
8
+ translateY: {
9
+ unit: string;
10
+ };
11
+ translateZ: {
12
+ unit: string;
13
+ };
14
+ translate3d: {
15
+ unit: string;
16
+ };
17
+ perspective: {
18
+ unit: string;
19
+ };
20
+ skew: {
21
+ unit: string;
22
+ };
23
+ skewX: {
24
+ unit: string;
25
+ };
26
+ skewY: {
27
+ unit: string;
28
+ };
29
+ skewZ: {
30
+ unit: string;
31
+ };
32
+ skew3d: {
33
+ unit: string;
34
+ };
35
+ rotate: {
36
+ unit: string;
37
+ };
38
+ rotateX: {
39
+ unit: string;
40
+ };
41
+ rotateY: {
42
+ unit: string;
43
+ };
44
+ rotateZ: {
45
+ unit: string;
46
+ };
47
+ rotate3d: {
48
+ unit: string;
49
+ };
50
+ blur: {
51
+ unit: string;
52
+ };
53
+ 'drop-shadow': {
54
+ unit: string;
55
+ };
56
+ 'hue-rotate': {
57
+ unit: string;
58
+ };
59
+ rgb: {
60
+ unit: string;
61
+ };
62
+ rgba: {
63
+ unit: string;
64
+ };
65
+ hsl: {
66
+ unit: string;
67
+ };
68
+ hsla: {
69
+ unit: string;
70
+ };
71
+ color: {
72
+ unit: string;
73
+ };
74
+ 'color-contrast': {
75
+ unit: string;
76
+ };
77
+ 'color-mix': {
78
+ unit: string;
79
+ };
80
+ hwb: {
81
+ unit: string;
82
+ };
83
+ lab: {
84
+ unit: string;
85
+ };
86
+ lch: {
87
+ unit: string;
88
+ };
89
+ oklab: {
90
+ unit: string;
91
+ };
92
+ oklch: {
93
+ unit: string;
94
+ };
95
+ 'light-dark': {
96
+ unit: string;
97
+ };
98
+ clamp: {
99
+ unit: string;
100
+ };
101
+ repeat: {
102
+ unit: string;
103
+ };
104
+ 'linear-gradient': {};
105
+ 'radial-gradient': {};
106
+ 'conic-gradient': {};
107
+ 'repeating-linear-gradient': {};
108
+ 'repeating-radial-gradient': {};
109
+ 'repeating-conic-gradient': {};
110
+ matrix: {
111
+ unit: string;
112
+ };
113
+ matrix3d: {
114
+ unit: string;
115
+ };
116
+ scale: {
117
+ unit: string;
118
+ };
119
+ scale3d: {
120
+ unit: string;
121
+ };
122
+ scaleX: {
123
+ unit: string;
124
+ };
125
+ scaleY: {
126
+ unit: string;
127
+ };
128
+ scaleZ: {
129
+ unit: string;
130
+ };
131
+ $: {
132
+ transformer: "core.variable";
133
+ };
134
+ calc: {
135
+ transformer: "core.calc";
136
+ };
137
+ };
3
138
  export default functions;