@master/css 2.0.0-rc.6 → 2.0.0-rc.60

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 (141) hide show
  1. package/README.md +4 -43
  2. package/dist/_virtual/_commonjsHelpers.cjs +10 -0
  3. package/dist/_virtual/_commonjsHelpers.mjs +7 -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 +16 -0
  15. package/dist/config/at.d.ts +13 -0
  16. package/dist/config/at.mjs +14 -0
  17. package/dist/config/functions.cjs +375 -0
  18. package/dist/config/functions.d.ts +1 -1
  19. package/dist/config/functions.mjs +373 -0
  20. package/dist/config/index.cjs +37 -0
  21. package/dist/config/index.d.ts +5 -62
  22. package/dist/config/index.mjs +27 -0
  23. package/dist/config/modes.cjs +8 -0
  24. package/dist/config/modes.d.ts +3 -0
  25. package/dist/config/modes.mjs +6 -0
  26. package/dist/config/rules.cjs +2330 -0
  27. package/dist/config/rules.d.ts +278 -274
  28. package/dist/config/rules.mjs +2328 -0
  29. package/dist/config/selectors.cjs +28 -0
  30. package/dist/config/selectors.d.ts +0 -1
  31. package/dist/config/selectors.mjs +26 -0
  32. package/dist/config/styles.cjs +2 -0
  33. package/dist/config/styles.d.ts +2 -2
  34. package/dist/config/styles.mjs +1 -0
  35. package/dist/config/utilities.cjs +204 -0
  36. package/dist/config/{semantics.d.ts → utilities.d.ts} +15 -5
  37. package/dist/config/utilities.mjs +202 -0
  38. package/dist/config/variables.cjs +484 -0
  39. package/dist/config/variables.d.ts +208 -312
  40. package/dist/config/variables.mjs +482 -0
  41. package/dist/core.cjs +739 -0
  42. package/dist/core.d.ts +97 -75
  43. package/dist/core.mjs +737 -0
  44. package/dist/factories/with-syntax-layer.cjs +308 -0
  45. package/dist/factories/with-syntax-layer.d.ts +26 -0
  46. package/dist/factories/with-syntax-layer.mjs +306 -0
  47. package/dist/index.cjs +82 -0
  48. package/dist/index.d.ts +21 -9
  49. package/dist/index.mjs +27 -0
  50. package/dist/layer.cjs +50 -0
  51. package/dist/layer.d.ts +14 -10
  52. package/dist/layer.mjs +48 -0
  53. package/dist/non-layer.cjs +64 -0
  54. package/dist/non-layer.d.ts +12 -0
  55. package/dist/non-layer.mjs +62 -0
  56. package/dist/polyfills/css-escape.cjs +9 -0
  57. package/dist/polyfills/css-escape.mjs +7 -0
  58. package/dist/polyfills/css-escape2.cjs +76 -0
  59. package/dist/polyfills/css-escape2.mjs +74 -0
  60. package/dist/register-global.cjs +7 -0
  61. package/dist/register-global.d.ts +5 -0
  62. package/dist/register-global.mjs +5 -0
  63. package/dist/rule.cjs +18 -0
  64. package/dist/rule.d.ts +9 -111
  65. package/dist/rule.mjs +16 -0
  66. package/dist/shared/utils/css-escape.cjs +56 -0
  67. package/dist/shared/utils/css-escape.mjs +54 -0
  68. package/dist/shared/utils/find-native-css-rule-index.cjs +12 -0
  69. package/dist/shared/utils/find-native-css-rule-index.mjs +10 -0
  70. package/dist/syntax-layer.cjs +8 -0
  71. package/dist/syntax-layer.d.ts +18 -0
  72. package/dist/syntax-layer.mjs +6 -0
  73. package/dist/syntax-rule-type.cjs +27 -0
  74. package/dist/syntax-rule-type.d.ts +28 -0
  75. package/dist/syntax-rule-type.mjs +25 -0
  76. package/dist/syntax-rule.cjs +644 -0
  77. package/dist/syntax-rule.d.ts +47 -0
  78. package/dist/syntax-rule.mjs +642 -0
  79. package/dist/types/common.cjs +2 -0
  80. package/dist/types/common.d.ts +1 -0
  81. package/dist/types/common.mjs +1 -0
  82. package/dist/types/config.cjs +2 -0
  83. package/dist/types/config.d.ts +70 -0
  84. package/dist/types/config.mjs +1 -0
  85. package/dist/types/syntax.cjs +2 -0
  86. package/dist/types/syntax.d.ts +106 -0
  87. package/dist/types/syntax.mjs +1 -0
  88. package/dist/utils/are-rule-at-equal.cjs +22 -0
  89. package/dist/utils/are-rule-at-equal.d.ts +2 -0
  90. package/dist/utils/are-rule-at-equal.mjs +20 -0
  91. package/dist/utils/are-rule-modes-equal.cjs +7 -0
  92. package/dist/utils/are-rule-modes-equal.d.ts +2 -0
  93. package/dist/utils/are-rule-modes-equal.mjs +5 -0
  94. package/dist/utils/are-rule-selectors-equal.cjs +29 -0
  95. package/dist/utils/are-rule-selectors-equal.d.ts +2 -0
  96. package/dist/utils/are-rule-selectors-equal.mjs +27 -0
  97. package/dist/utils/are-rule-states-equal.cjs +11 -0
  98. package/dist/utils/are-rule-states-equal.d.ts +2 -0
  99. package/dist/utils/are-rule-states-equal.mjs +9 -0
  100. package/dist/utils/are-rules-duplicated.cjs +17 -0
  101. package/dist/utils/are-rules-duplicated.d.ts +2 -0
  102. package/dist/utils/are-rules-duplicated.mjs +15 -0
  103. package/dist/utils/autofill-solid-style.cjs +31 -0
  104. package/dist/utils/autofill-solid-style.d.ts +3 -0
  105. package/dist/utils/autofill-solid-style.mjs +29 -0
  106. package/dist/utils/extend-config.cjs +59 -0
  107. package/dist/utils/extend-config.d.ts +2 -2
  108. package/dist/utils/extend-config.mjs +57 -0
  109. package/dist/utils/flatten-object.cjs +15 -0
  110. package/dist/utils/flatten-object.d.ts +1 -1
  111. package/dist/utils/flatten-object.mjs +13 -0
  112. package/dist/utils/generate-css.cjs +13 -0
  113. package/dist/utils/generate-css.d.ts +2 -0
  114. package/dist/utils/generate-css.mjs +11 -0
  115. package/dist/utils/hex-to-rgb.cjs +30 -0
  116. package/dist/utils/hex-to-rgb.d.ts +1 -1
  117. package/dist/utils/hex-to-rgb.mjs +28 -0
  118. package/dist/utils/is-core-rule.cjs +9 -0
  119. package/dist/utils/is-core-rule.d.ts +1 -0
  120. package/dist/utils/is-core-rule.mjs +7 -0
  121. package/dist/utils/reorder-for-readable-classes.cjs +62 -0
  122. package/dist/{functions → utils}/reorder-for-readable-classes.d.ts +2 -6
  123. package/dist/utils/reorder-for-readable-classes.mjs +60 -0
  124. package/package.json +1 -1
  125. package/dist/bin/index.bundle.js +0 -36
  126. package/dist/config/media-queries.d.ts +0 -1
  127. package/dist/constants/base-unit-regex.d.ts +0 -1
  128. package/dist/constants/config-esm-text.d.ts +0 -1
  129. package/dist/constants/config-text.d.ts +0 -1
  130. package/dist/constants/config-ts-text.d.ts +0 -1
  131. package/dist/constants/start-symbol.d.ts +0 -6
  132. package/dist/functions/transform-color-with-opacity.d.ts +0 -1
  133. package/dist/index.bundle.js +0 -35
  134. package/dist/index.bundle.mjs +0 -35
  135. package/dist/tokens/screen-sizes.d.ts +0 -14
  136. package/dist/types/global.d.ts +0 -5
  137. package/dist/utils/concat-arrays.d.ts +0 -1
  138. package/dist/utils/get-type.d.ts +0 -7
  139. package/dist/utils/is-plain-object.d.ts +0 -8
  140. package/dist/utils/is-symbol.d.ts +0 -7
  141. package/dist/utils/rgb-to-hex.d.ts +0 -1
@@ -0,0 +1,13 @@
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
+ base: string;
11
+ preset: string;
12
+ };
13
+ export default at;
@@ -0,0 +1,14 @@
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
+ base: 'layer base',
11
+ preset: 'layer preset'
12
+ };
13
+
14
+ export { at as default };
@@ -0,0 +1,375 @@
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.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
+ 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
+ 'light-dark': {
338
+ unit: ''
339
+ },
340
+ clamp: {
341
+ unit: ''
342
+ },
343
+ repeat: {
344
+ unit: ''
345
+ },
346
+ 'linear-gradient': {},
347
+ 'radial-gradient': {},
348
+ 'conic-gradient': {},
349
+ 'repeating-linear-gradient': {},
350
+ 'repeating-radial-gradient': {},
351
+ 'repeating-conic-gradient': {},
352
+ 'matrix': {
353
+ unit: ''
354
+ },
355
+ 'matrix3d': {
356
+ unit: ''
357
+ },
358
+ 'scale': {
359
+ unit: ''
360
+ },
361
+ 'scale3d': {
362
+ unit: ''
363
+ },
364
+ 'scaleX': {
365
+ unit: ''
366
+ },
367
+ 'scaleY': {
368
+ unit: ''
369
+ },
370
+ 'scaleZ': {
371
+ unit: ''
372
+ }
373
+ };
374
+
375
+ module.exports = functions;
@@ -1,3 +1,3 @@
1
- import type { FunctionDefinitions } from './';
1
+ import { FunctionDefinitions } from '../types/config';
2
2
  declare const functions: FunctionDefinitions;
3
3
  export default functions;