@master/css 2.0.0-rc.15 → 2.0.0-rc.17

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 (73) hide show
  1. package/dist/_virtual/_commonjsHelpers.cjs +5 -0
  2. package/dist/_virtual/_commonjsHelpers.mjs +3 -0
  3. package/dist/_virtual/css-escape.cjs +5 -0
  4. package/dist/_virtual/css-escape.mjs +3 -0
  5. package/dist/bin/index.cjs +11 -0
  6. package/dist/bin/index.mjs +9 -0
  7. package/dist/config/animations.cjs +113 -0
  8. package/dist/config/animations.mjs +111 -0
  9. package/dist/config/functions.cjs +352 -0
  10. package/dist/config/functions.mjs +350 -0
  11. package/dist/config/index.cjs +34 -0
  12. package/dist/config/index.mjs +25 -0
  13. package/dist/config/media-queries.cjs +7 -0
  14. package/dist/config/media-queries.mjs +1 -0
  15. package/dist/config/rules.cjs +2190 -0
  16. package/dist/config/rules.mjs +2184 -0
  17. package/dist/config/selectors.cjs +29 -0
  18. package/dist/config/selectors.mjs +27 -0
  19. package/dist/config/semantics.cjs +194 -0
  20. package/dist/config/semantics.mjs +192 -0
  21. package/dist/config/styles.cjs +2 -0
  22. package/dist/config/styles.mjs +1 -0
  23. package/dist/config/variables.cjs +583 -0
  24. package/dist/config/variables.mjs +581 -0
  25. package/dist/constants/base-unit-regex.cjs +5 -0
  26. package/dist/constants/base-unit-regex.mjs +3 -0
  27. package/dist/constants/start-symbol.cjs +10 -0
  28. package/dist/constants/start-symbol.mjs +8 -0
  29. package/dist/core.cjs +979 -0
  30. package/dist/core.d.ts +2 -3
  31. package/dist/core.mjs +974 -0
  32. package/dist/functions/reorder-for-readable-classes.cjs +68 -0
  33. package/dist/functions/reorder-for-readable-classes.d.ts +1 -1
  34. package/dist/functions/reorder-for-readable-classes.mjs +66 -0
  35. package/dist/functions/transform-color-with-opacity.cjs +9 -0
  36. package/dist/functions/transform-color-with-opacity.mjs +7 -0
  37. package/dist/index.cjs +37 -0
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.mjs +13 -0
  40. package/dist/layer.cjs +23 -0
  41. package/dist/layer.mjs +23 -0
  42. package/dist/polyfills/css-escape.cjs +8 -0
  43. package/dist/polyfills/css-escape.mjs +2 -0
  44. package/dist/polyfills/css-escape2.cjs +68 -0
  45. package/dist/polyfills/css-escape2.mjs +64 -0
  46. package/dist/rule.cjs +702 -0
  47. package/dist/rule.d.ts +1 -1
  48. package/dist/rule.mjs +700 -0
  49. package/dist/shared/utils/css-escape.cjs +56 -0
  50. package/dist/shared/utils/css-escape.mjs +54 -0
  51. package/dist/tokens/screen-sizes.cjs +17 -0
  52. package/dist/tokens/screen-sizes.mjs +15 -0
  53. package/dist/utils/concat-arrays.cjs +12 -0
  54. package/dist/utils/concat-arrays.mjs +10 -0
  55. package/dist/utils/extend-config.cjs +59 -0
  56. package/dist/utils/extend-config.mjs +57 -0
  57. package/dist/utils/flatten-object.cjs +15 -0
  58. package/dist/utils/flatten-object.mjs +13 -0
  59. package/dist/utils/get-type.cjs +12 -0
  60. package/dist/utils/get-type.mjs +10 -0
  61. package/dist/utils/hex-to-rgb.cjs +30 -0
  62. package/dist/utils/hex-to-rgb.mjs +28 -0
  63. package/dist/utils/is-plain-object.cjs +15 -0
  64. package/dist/utils/is-plain-object.mjs +13 -0
  65. package/dist/utils/is-symbol.cjs +14 -0
  66. package/dist/utils/is-symbol.mjs +12 -0
  67. package/dist/utils/rgb-to-hex.cjs +7 -0
  68. package/dist/utils/rgb-to-hex.mjs +5 -0
  69. package/package.json +1 -1
  70. package/dist/bin/index.bundle.js +0 -1
  71. package/dist/index.bundle.js +0 -1
  72. package/dist/index.bundle.mjs +0 -1
  73. package/dist/types/global.d.ts +0 -5
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
+
5
+ exports.commonjsGlobal = commonjsGlobal;
@@ -0,0 +1,3 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ export { commonjsGlobal };
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var cssEscape = {};
4
+
5
+ exports.__exports = cssEscape;
@@ -0,0 +1,3 @@
1
+ var cssEscape = {};
2
+
3
+ export { cssEscape as __exports };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var child_process = require('child_process');
4
+
5
+ try {
6
+ child_process.execSync('mastercss', {
7
+ stdio: 'inherit'
8
+ });
9
+ } catch (error) {
10
+ console.error('Command not found. Try installing "@master/css-cli" first.');
11
+ }
@@ -0,0 +1,9 @@
1
+ import { execSync } from 'child_process';
2
+
3
+ try {
4
+ execSync('mastercss', {
5
+ stdio: 'inherit'
6
+ });
7
+ } catch (error) {
8
+ console.error('Command not found. Try installing "@master/css-cli" first.');
9
+ }
@@ -0,0 +1,113 @@
1
+ 'use strict';
2
+
3
+ const animations = {
4
+ fade: {
5
+ '0%': {
6
+ opacity: 0
7
+ },
8
+ to: {
9
+ opacity: 1
10
+ }
11
+ },
12
+ flash: {
13
+ '0%,50%,to': {
14
+ opacity: 1
15
+ },
16
+ '25%,75%': {
17
+ opacity: 0
18
+ }
19
+ },
20
+ float: {
21
+ '0%': {
22
+ transform: 'none'
23
+ },
24
+ '50%': {
25
+ transform: 'translateY(-1.25rem)'
26
+ },
27
+ to: {
28
+ transform: 'none'
29
+ }
30
+ },
31
+ heart: {
32
+ '0%': {
33
+ transform: 'scale(1)'
34
+ },
35
+ '14%': {
36
+ transform: 'scale(1.3)'
37
+ },
38
+ '28%': {
39
+ transform: 'scale(1)'
40
+ },
41
+ '42%': {
42
+ transform: 'scale(1.3)'
43
+ },
44
+ '70%': {
45
+ transform: 'scale(1)'
46
+ }
47
+ },
48
+ jump: {
49
+ '0%,to': {
50
+ transform: 'translateY(-25%)',
51
+ 'animation-timing-function': 'cubic-bezier(.8,0,1,1)'
52
+ },
53
+ '50%': {
54
+ transform: 'translateY(0)',
55
+ 'animation-timing-function': 'cubic-bezier(0,0,.2,1)'
56
+ }
57
+ },
58
+ ping: {
59
+ '75%,to': {
60
+ transform: 'scale(2)',
61
+ opacity: 0
62
+ }
63
+ },
64
+ pulse: {
65
+ '0%': {
66
+ transform: 'none'
67
+ },
68
+ '50%': {
69
+ transform: 'scale(1.05)'
70
+ },
71
+ to: {
72
+ transform: 'none'
73
+ }
74
+ },
75
+ rotate: {
76
+ '0%': {
77
+ transform: 'rotate(-360deg)'
78
+ },
79
+ to: {
80
+ transform: 'none'
81
+ }
82
+ },
83
+ shake: {
84
+ '0%': {
85
+ transform: 'none'
86
+ },
87
+ '6.5%': {
88
+ transform: 'translateX(-6px) rotateY(-9deg)'
89
+ },
90
+ '18.5%': {
91
+ transform: 'translateX(5px) rotateY(7deg)'
92
+ },
93
+ '31.5%': {
94
+ transform: 'translateX(-3px) rotateY(-5deg)'
95
+ },
96
+ '43.5%': {
97
+ transform: 'translateX(2px) rotateY(3deg)'
98
+ },
99
+ '50%': {
100
+ transform: 'none'
101
+ }
102
+ },
103
+ zoom: {
104
+ '0%': {
105
+ transform: 'scale(0)'
106
+ },
107
+ to: {
108
+ transform: 'none'
109
+ }
110
+ }
111
+ };
112
+
113
+ module.exports = animations;
@@ -0,0 +1,111 @@
1
+ const animations = {
2
+ fade: {
3
+ '0%': {
4
+ opacity: 0
5
+ },
6
+ to: {
7
+ opacity: 1
8
+ }
9
+ },
10
+ flash: {
11
+ '0%,50%,to': {
12
+ opacity: 1
13
+ },
14
+ '25%,75%': {
15
+ opacity: 0
16
+ }
17
+ },
18
+ float: {
19
+ '0%': {
20
+ transform: 'none'
21
+ },
22
+ '50%': {
23
+ transform: 'translateY(-1.25rem)'
24
+ },
25
+ to: {
26
+ transform: 'none'
27
+ }
28
+ },
29
+ heart: {
30
+ '0%': {
31
+ transform: 'scale(1)'
32
+ },
33
+ '14%': {
34
+ transform: 'scale(1.3)'
35
+ },
36
+ '28%': {
37
+ transform: 'scale(1)'
38
+ },
39
+ '42%': {
40
+ transform: 'scale(1.3)'
41
+ },
42
+ '70%': {
43
+ transform: 'scale(1)'
44
+ }
45
+ },
46
+ jump: {
47
+ '0%,to': {
48
+ transform: 'translateY(-25%)',
49
+ 'animation-timing-function': 'cubic-bezier(.8,0,1,1)'
50
+ },
51
+ '50%': {
52
+ transform: 'translateY(0)',
53
+ 'animation-timing-function': 'cubic-bezier(0,0,.2,1)'
54
+ }
55
+ },
56
+ ping: {
57
+ '75%,to': {
58
+ transform: 'scale(2)',
59
+ opacity: 0
60
+ }
61
+ },
62
+ pulse: {
63
+ '0%': {
64
+ transform: 'none'
65
+ },
66
+ '50%': {
67
+ transform: 'scale(1.05)'
68
+ },
69
+ to: {
70
+ transform: 'none'
71
+ }
72
+ },
73
+ rotate: {
74
+ '0%': {
75
+ transform: 'rotate(-360deg)'
76
+ },
77
+ to: {
78
+ transform: 'none'
79
+ }
80
+ },
81
+ shake: {
82
+ '0%': {
83
+ transform: 'none'
84
+ },
85
+ '6.5%': {
86
+ transform: 'translateX(-6px) rotateY(-9deg)'
87
+ },
88
+ '18.5%': {
89
+ transform: 'translateX(5px) rotateY(7deg)'
90
+ },
91
+ '31.5%': {
92
+ transform: 'translateX(-3px) rotateY(-5deg)'
93
+ },
94
+ '43.5%': {
95
+ transform: 'translateX(2px) rotateY(3deg)'
96
+ },
97
+ '50%': {
98
+ transform: 'none'
99
+ }
100
+ },
101
+ zoom: {
102
+ '0%': {
103
+ transform: 'scale(0)'
104
+ },
105
+ to: {
106
+ transform: 'none'
107
+ }
108
+ }
109
+ };
110
+
111
+ export { animations as default };
@@ -0,0 +1,352 @@
1
+ 'use strict';
2
+
3
+ var baseUnitRegex = require('../constants/base-unit-regex.cjs');
4
+
5
+ const functions = {
6
+ $: {
7
+ colored: true,
8
+ transform (value) {
9
+ let name;
10
+ let fallback;
11
+ const firstCommaIndex = value.indexOf(',');
12
+ if (firstCommaIndex !== -1) {
13
+ name = value.slice(0, firstCommaIndex);
14
+ fallback = value.slice(firstCommaIndex + 1);
15
+ } else {
16
+ name = value;
17
+ }
18
+ return [
19
+ {
20
+ type: 'variable',
21
+ name,
22
+ fallback
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 = baseUnitRegex.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 = this.parseValueComponent(current);
56
+ if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
57
+ hasUnit = true;
58
+ }
59
+ if (unitChecking) {
60
+ if (isNaN(+current)) {
61
+ if (valueComponent.type === 'number') {
62
+ currentValueComponents.push(valueComponent);
63
+ currentHasUnit = true;
64
+ } else {
65
+ currentValueComponents.push(valueComponent);
66
+ }
67
+ } else {
68
+ currentValueComponents.push({
69
+ type: 'number',
70
+ value: +current
71
+ });
72
+ }
73
+ } else {
74
+ if (isChildHandler) {
75
+ const newValueComponent = {
76
+ type: 'string',
77
+ value: current
78
+ };
79
+ unparsedValueComponents.push(newValueComponent);
80
+ currentValueComponents.push(newValueComponent);
81
+ } else {
82
+ currentValueComponents.push(valueComponent);
83
+ }
84
+ }
85
+ } else {
86
+ currentValueComponents.push({
87
+ type: 'string',
88
+ value: current
89
+ });
90
+ }
91
+ current = '';
92
+ }
93
+ if (separator) {
94
+ if (separator === '+' || separator === '-') {
95
+ handleUnitChecking();
96
+ }
97
+ if (prefix && value[i - 1] === ' ') {
98
+ prefix = '';
99
+ }
100
+ if (suffix && value[i + 1] === ' ') {
101
+ suffix = '';
102
+ }
103
+ if (bypassHandlingSeparator) {
104
+ currentValueComponents.push({
105
+ type: 'separator',
106
+ value: separator,
107
+ text: separator
108
+ });
109
+ } else {
110
+ currentValueComponents.push({
111
+ type: 'separator',
112
+ value: separator,
113
+ text: prefix + separator + suffix
114
+ });
115
+ }
116
+ }
117
+ bypassParsing = false;
118
+ };
119
+ const pushUnitValueComponents = ()=>{
120
+ if (this.definition.unit === 'rem' || this.definition.unit === 'em') {
121
+ currentValueComponents.push({
122
+ type: 'separator',
123
+ value: '/',
124
+ text: ' / '
125
+ }, {
126
+ type: 'number',
127
+ value: this.css.config.rootSize
128
+ });
129
+ }
130
+ currentValueComponents.push({
131
+ type: 'separator',
132
+ value: '*',
133
+ text: ' * '
134
+ }, {
135
+ type: 'number',
136
+ value: 1,
137
+ unit: this.definition.unit
138
+ });
139
+ };
140
+ const handleUnitChecking = ()=>{
141
+ if (unitChecking && !currentHasUnit && !parentUnitChecking && (!isChildHandler || hasUnit)) {
142
+ pushUnitValueComponents();
143
+ }
144
+ unitChecking = false;
145
+ currentHasUnit = false;
146
+ };
147
+ for(; i < value.length; i++){
148
+ const char = value[i];
149
+ if (char === '(') {
150
+ const symbolResult = /^([+-])/.exec(current);
151
+ if (symbolResult) {
152
+ currentValueComponents.push({
153
+ type: 'string',
154
+ value: symbolResult[1]
155
+ });
156
+ }
157
+ const functionName = symbolResult ? current.slice(1) : current;
158
+ const newValueComponent = {
159
+ type: 'function',
160
+ name: functionName,
161
+ symbol: char,
162
+ children: [],
163
+ bypassTransform: functionName === 'calc'
164
+ };
165
+ currentValueComponents.push(newValueComponent);
166
+ current = '';
167
+ i++;
168
+ const isVarFunction = functionName === '$' || functionName === 'var';
169
+ childHasUnit = anaylzeDeeply(newValueComponent.children, functionName !== '' && functionName !== 'calc' && (isVarFunction || Object.prototype.hasOwnProperty.call(functions, functionName)), bypassParsing || isVarFunction || unitChecking && currentHasUnit, unitChecking, isVarFunction) || functionName === 'var';
170
+ if (!childHasUnit && functionName === '$') {
171
+ const variableType = this.css.variables[newValueComponent.children[0].value]?.type;
172
+ childHasUnit = !variableType || variableType === 'string';
173
+ }
174
+ if (childHasUnit) {
175
+ hasUnit = true;
176
+ currentHasUnit = true;
177
+ }
178
+ } else if (char === ')') {
179
+ clear('');
180
+ if (hasUnit) {
181
+ for (const eachUnparsedValueComponent of unparsedValueComponents){
182
+ Object.assign(eachUnparsedValueComponent, this.parseValueComponent(eachUnparsedValueComponent.value));
183
+ }
184
+ }
185
+ return hasUnit;
186
+ } else if (char === ',') {
187
+ clear(char, '', ' ');
188
+ } else if (char === ' ') {
189
+ clear(char);
190
+ } else {
191
+ const previousChar = value[i - 1];
192
+ switch(char){
193
+ case '+':
194
+ if (!current && previousChar !== ')') {
195
+ current += char;
196
+ } else {
197
+ clear(char, ' ', ' ');
198
+ }
199
+ break;
200
+ case '-':
201
+ if (!current && previousChar !== ')') {
202
+ current += char;
203
+ } else {
204
+ clear(char, ' ', ' ');
205
+ }
206
+ break;
207
+ case '*':
208
+ if (this.definition.unit) {
209
+ unitChecking = true;
210
+ }
211
+ clear(char, ' ', ' ');
212
+ break;
213
+ case '/':
214
+ if (this.definition.unit) {
215
+ unitChecking = true;
216
+ }
217
+ clear(char, ' ', ' ');
218
+ bypassParsing = true;
219
+ break;
220
+ default:
221
+ current += char;
222
+ break;
223
+ }
224
+ }
225
+ }
226
+ clear('');
227
+ handleUnitChecking();
228
+ };
229
+ anaylzeDeeply(valueComponents, false, false, false, false);
230
+ return 'calc(' + this.resolveValue(valueComponents, functions.calc.unit ?? this.definition.unit, bypassVariableNames, true) + ')';
231
+ }
232
+ },
233
+ translate: {
234
+ unit: 'rem'
235
+ },
236
+ translateX: {
237
+ unit: 'rem'
238
+ },
239
+ translateY: {
240
+ unit: 'rem'
241
+ },
242
+ translateZ: {
243
+ unit: 'rem'
244
+ },
245
+ translate3d: {
246
+ unit: 'rem'
247
+ },
248
+ skew: {
249
+ unit: 'deg'
250
+ },
251
+ skewX: {
252
+ unit: 'deg'
253
+ },
254
+ skewY: {
255
+ unit: 'deg'
256
+ },
257
+ skewZ: {
258
+ unit: 'deg'
259
+ },
260
+ skew3d: {
261
+ unit: 'deg'
262
+ },
263
+ rotate: {
264
+ unit: 'deg'
265
+ },
266
+ rotateX: {
267
+ unit: 'deg'
268
+ },
269
+ rotateY: {
270
+ unit: 'deg'
271
+ },
272
+ rotateZ: {
273
+ unit: 'deg'
274
+ },
275
+ rotate3d: {
276
+ unit: 'deg'
277
+ },
278
+ blur: {
279
+ unit: 'rem'
280
+ },
281
+ 'drop-shadow': {
282
+ unit: 'rem'
283
+ },
284
+ 'hue-rotate': {
285
+ unit: 'deg'
286
+ },
287
+ rgb: {
288
+ unit: ''
289
+ },
290
+ rgba: {
291
+ unit: ''
292
+ },
293
+ hsl: {
294
+ unit: ''
295
+ },
296
+ hsla: {
297
+ unit: ''
298
+ },
299
+ color: {
300
+ unit: '',
301
+ colored: true
302
+ },
303
+ 'color-contrast': {
304
+ unit: '',
305
+ colored: true
306
+ },
307
+ 'color-mix': {
308
+ unit: '',
309
+ colored: true
310
+ },
311
+ hwb: {
312
+ unit: ''
313
+ },
314
+ lab: {
315
+ unit: ''
316
+ },
317
+ lch: {
318
+ unit: ''
319
+ },
320
+ oklab: {
321
+ unit: ''
322
+ },
323
+ oklch: {
324
+ unit: ''
325
+ },
326
+ clamp: {
327
+ unit: ''
328
+ },
329
+ repeat: {
330
+ unit: ''
331
+ },
332
+ 'linear-gradient': {
333
+ colored: true
334
+ },
335
+ 'radial-gradient': {
336
+ colored: true
337
+ },
338
+ 'conic-gradient': {
339
+ colored: true
340
+ },
341
+ 'repeating-linear-gradient': {
342
+ colored: true
343
+ },
344
+ 'repeating-radial-gradient': {
345
+ colored: true
346
+ },
347
+ 'repeating-conic-gradient': {
348
+ colored: true
349
+ }
350
+ };
351
+
352
+ module.exports = functions;