@master/css 2.0.0-rc.4 → 2.0.0-rc.40

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 (111) hide show
  1. package/README.md +4 -43
  2. package/dist/_virtual/_commonjsHelpers.cjs +5 -0
  3. package/dist/_virtual/_commonjsHelpers.mjs +3 -0
  4. package/dist/_virtual/css-escape.cjs +5 -0
  5. package/dist/_virtual/css-escape.mjs +3 -0
  6. package/dist/bin/index.cjs +11 -0
  7. package/dist/bin/index.d.ts +0 -1
  8. package/dist/bin/index.mjs +9 -0
  9. package/dist/common.cjs +159 -0
  10. package/dist/common.d.ts +26 -0
  11. package/dist/common.mjs +137 -0
  12. package/dist/config/animations.cjs +113 -0
  13. package/dist/config/animations.mjs +111 -0
  14. package/dist/config/at.cjs +14 -0
  15. package/dist/config/at.d.ts +11 -0
  16. package/dist/config/at.mjs +12 -0
  17. package/dist/config/functions.cjs +351 -0
  18. package/dist/config/functions.mjs +349 -0
  19. package/dist/config/index.cjs +36 -0
  20. package/dist/config/index.d.ts +17 -14
  21. package/dist/config/index.mjs +26 -0
  22. package/dist/config/modes.cjs +8 -0
  23. package/dist/config/modes.d.ts +3 -0
  24. package/dist/config/modes.mjs +6 -0
  25. package/dist/config/rules.cjs +2283 -0
  26. package/dist/config/rules.d.ts +9 -6
  27. package/dist/config/rules.mjs +2281 -0
  28. package/dist/config/selectors.cjs +28 -0
  29. package/dist/config/selectors.d.ts +0 -1
  30. package/dist/config/selectors.mjs +26 -0
  31. package/dist/config/styles.cjs +2 -0
  32. package/dist/config/styles.mjs +1 -0
  33. package/dist/config/utilities.cjs +203 -0
  34. package/dist/config/{semantics.d.ts → utilities.d.ts} +14 -5
  35. package/dist/config/utilities.mjs +201 -0
  36. package/dist/config/variables.cjs +127 -0
  37. package/dist/config/variables.d.ts +132 -177
  38. package/dist/config/variables.mjs +125 -0
  39. package/dist/core.cjs +1040 -0
  40. package/dist/core.d.ts +37 -33
  41. package/dist/core.mjs +1035 -0
  42. package/dist/index.cjs +73 -0
  43. package/dist/index.d.ts +15 -8
  44. package/dist/index.mjs +22 -0
  45. package/dist/layer.cjs +28 -0
  46. package/dist/layer.d.ts +26 -9
  47. package/dist/layer.mjs +26 -0
  48. package/dist/polyfills/css-escape.cjs +8 -0
  49. package/dist/polyfills/css-escape.mjs +2 -0
  50. package/dist/polyfills/css-escape2.cjs +68 -0
  51. package/dist/polyfills/css-escape2.mjs +64 -0
  52. package/dist/rule.cjs +722 -0
  53. package/dist/rule.d.ts +60 -22
  54. package/dist/rule.mjs +720 -0
  55. package/dist/shared/utils/css-escape.cjs +56 -0
  56. package/dist/shared/utils/css-escape.mjs +54 -0
  57. package/dist/types/global.cjs +2 -0
  58. package/dist/types/global.d.ts +3 -3
  59. package/dist/types/global.mjs +1 -0
  60. package/dist/utils/are-rule-at-equal.cjs +22 -0
  61. package/dist/utils/are-rule-at-equal.d.ts +2 -0
  62. package/dist/utils/are-rule-at-equal.mjs +20 -0
  63. package/dist/utils/are-rule-modes-equal.cjs +7 -0
  64. package/dist/utils/are-rule-modes-equal.d.ts +2 -0
  65. package/dist/utils/are-rule-modes-equal.mjs +5 -0
  66. package/dist/utils/are-rule-selectors-equal.cjs +29 -0
  67. package/dist/utils/are-rule-selectors-equal.d.ts +2 -0
  68. package/dist/utils/are-rule-selectors-equal.mjs +27 -0
  69. package/dist/utils/are-rule-states-equal.cjs +11 -0
  70. package/dist/utils/are-rule-states-equal.d.ts +2 -0
  71. package/dist/utils/are-rule-states-equal.mjs +9 -0
  72. package/dist/utils/are-rules-duplicated.cjs +17 -0
  73. package/dist/utils/are-rules-duplicated.d.ts +2 -0
  74. package/dist/utils/are-rules-duplicated.mjs +15 -0
  75. package/dist/utils/autofill-solid-style.cjs +31 -0
  76. package/dist/utils/autofill-solid-style.d.ts +3 -0
  77. package/dist/utils/autofill-solid-style.mjs +29 -0
  78. package/dist/utils/extend-config.cjs +73 -0
  79. package/dist/utils/extend-config.d.ts +1 -1
  80. package/dist/utils/extend-config.mjs +71 -0
  81. package/dist/utils/flatten-object.cjs +15 -0
  82. package/dist/utils/flatten-object.mjs +13 -0
  83. package/dist/utils/generate-css.cjs +13 -0
  84. package/dist/utils/generate-css.d.ts +2 -0
  85. package/dist/utils/generate-css.mjs +11 -0
  86. package/dist/utils/hex-to-rgb.cjs +30 -0
  87. package/dist/utils/hex-to-rgb.d.ts +1 -1
  88. package/dist/utils/hex-to-rgb.mjs +28 -0
  89. package/dist/utils/is-core-rule.cjs +9 -0
  90. package/dist/utils/is-core-rule.d.ts +1 -0
  91. package/dist/utils/is-core-rule.mjs +7 -0
  92. package/dist/utils/reorder-for-readable-classes.cjs +62 -0
  93. package/dist/{functions → utils}/reorder-for-readable-classes.d.ts +2 -6
  94. package/dist/utils/reorder-for-readable-classes.mjs +60 -0
  95. package/package.json +1 -1
  96. package/dist/bin/index.bundle.js +0 -36
  97. package/dist/config/media-queries.d.ts +0 -1
  98. package/dist/constants/base-unit-regex.d.ts +0 -1
  99. package/dist/constants/config-esm-text.d.ts +0 -1
  100. package/dist/constants/config-text.d.ts +0 -1
  101. package/dist/constants/config-ts-text.d.ts +0 -1
  102. package/dist/constants/start-symbol.d.ts +0 -6
  103. package/dist/functions/transform-color-with-opacity.d.ts +0 -1
  104. package/dist/index.bundle.js +0 -35
  105. package/dist/index.bundle.mjs +0 -35
  106. package/dist/tokens/screen-sizes.d.ts +0 -14
  107. package/dist/utils/concat-arrays.d.ts +0 -1
  108. package/dist/utils/get-type.d.ts +0 -7
  109. package/dist/utils/is-plain-object.d.ts +0 -8
  110. package/dist/utils/is-symbol.d.ts +0 -7
  111. package/dist/utils/rgb-to-hex.d.ts +0 -1
@@ -0,0 +1,11 @@
1
+ declare const at: {
2
+ all: string;
3
+ print: string;
4
+ screen: string;
5
+ speech: string;
6
+ landscape: string;
7
+ portrait: string;
8
+ motion: string;
9
+ 'reduced-motion': string;
10
+ };
11
+ export default at;
@@ -0,0 +1,12 @@
1
+ const at = {
2
+ all: 'media all',
3
+ print: 'media print',
4
+ screen: 'media screen',
5
+ speech: 'media speech',
6
+ landscape: 'media (orientation:landscape)',
7
+ portrait: 'media (orientation:portrait)',
8
+ motion: 'media (prefers-reduced-motion:no-preference)',
9
+ 'reduced-motion': 'media (prefers-reduced-motion:reduce)'
10
+ };
11
+
12
+ export { at as default };
@@ -0,0 +1,351 @@
1
+ 'use strict';
2
+
3
+ var common = require('../common.cjs');
4
+
5
+ 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[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
+ translate: {
248
+ unit: 'rem'
249
+ },
250
+ translateX: {
251
+ unit: 'rem'
252
+ },
253
+ translateY: {
254
+ unit: 'rem'
255
+ },
256
+ translateZ: {
257
+ unit: 'rem'
258
+ },
259
+ translate3d: {
260
+ unit: 'rem'
261
+ },
262
+ skew: {
263
+ unit: 'deg'
264
+ },
265
+ skewX: {
266
+ unit: 'deg'
267
+ },
268
+ skewY: {
269
+ unit: 'deg'
270
+ },
271
+ skewZ: {
272
+ unit: 'deg'
273
+ },
274
+ skew3d: {
275
+ unit: 'deg'
276
+ },
277
+ rotate: {
278
+ unit: 'deg'
279
+ },
280
+ rotateX: {
281
+ unit: 'deg'
282
+ },
283
+ rotateY: {
284
+ unit: 'deg'
285
+ },
286
+ rotateZ: {
287
+ unit: 'deg'
288
+ },
289
+ rotate3d: {
290
+ unit: 'deg'
291
+ },
292
+ blur: {
293
+ unit: 'rem'
294
+ },
295
+ 'drop-shadow': {
296
+ unit: 'rem'
297
+ },
298
+ 'hue-rotate': {
299
+ unit: 'deg'
300
+ },
301
+ rgb: {
302
+ unit: ''
303
+ },
304
+ rgba: {
305
+ unit: ''
306
+ },
307
+ hsl: {
308
+ unit: ''
309
+ },
310
+ hsla: {
311
+ unit: ''
312
+ },
313
+ color: {
314
+ unit: ''
315
+ },
316
+ 'color-contrast': {
317
+ unit: ''
318
+ },
319
+ 'color-mix': {
320
+ unit: ''
321
+ },
322
+ hwb: {
323
+ unit: ''
324
+ },
325
+ lab: {
326
+ unit: ''
327
+ },
328
+ lch: {
329
+ unit: ''
330
+ },
331
+ oklab: {
332
+ unit: ''
333
+ },
334
+ oklch: {
335
+ unit: ''
336
+ },
337
+ clamp: {
338
+ unit: ''
339
+ },
340
+ repeat: {
341
+ unit: ''
342
+ },
343
+ 'linear-gradient': {},
344
+ 'radial-gradient': {},
345
+ 'conic-gradient': {},
346
+ 'repeating-linear-gradient': {},
347
+ 'repeating-radial-gradient': {},
348
+ 'repeating-conic-gradient': {}
349
+ };
350
+
351
+ module.exports = functions;