@master/css 2.0.0-rc.2 → 2.0.0-rc.20

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 (82) 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/config/animations.cjs +113 -0
  10. package/dist/config/animations.mjs +111 -0
  11. package/dist/config/functions.cjs +352 -0
  12. package/dist/config/functions.mjs +350 -0
  13. package/dist/config/index.cjs +34 -0
  14. package/dist/config/index.d.ts +1 -1
  15. package/dist/config/index.mjs +25 -0
  16. package/dist/config/media-queries.cjs +7 -0
  17. package/dist/config/media-queries.mjs +1 -0
  18. package/dist/config/rules.cjs +2190 -0
  19. package/dist/config/rules.mjs +2184 -0
  20. package/dist/config/selectors.cjs +29 -0
  21. package/dist/config/selectors.mjs +27 -0
  22. package/dist/config/semantics.cjs +194 -0
  23. package/dist/config/semantics.mjs +192 -0
  24. package/dist/config/styles.cjs +2 -0
  25. package/dist/config/styles.mjs +1 -0
  26. package/dist/config/variables.cjs +583 -0
  27. package/dist/config/variables.d.ts +8 -0
  28. package/dist/config/variables.mjs +581 -0
  29. package/dist/constants/base-unit-regex.cjs +5 -0
  30. package/dist/constants/base-unit-regex.mjs +3 -0
  31. package/dist/constants/start-symbol.cjs +10 -0
  32. package/dist/constants/start-symbol.mjs +8 -0
  33. package/dist/core.cjs +979 -0
  34. package/dist/core.d.ts +16 -16
  35. package/dist/core.mjs +974 -0
  36. package/dist/functions/reorder-for-readable-classes.cjs +68 -0
  37. package/dist/functions/reorder-for-readable-classes.d.ts +1 -1
  38. package/dist/functions/reorder-for-readable-classes.mjs +66 -0
  39. package/dist/functions/transform-color-with-opacity.cjs +9 -0
  40. package/dist/functions/transform-color-with-opacity.mjs +7 -0
  41. package/dist/index.cjs +37 -0
  42. package/dist/index.d.ts +3 -6
  43. package/dist/index.mjs +13 -0
  44. package/dist/layer.cjs +23 -0
  45. package/dist/layer.mjs +23 -0
  46. package/dist/polyfills/css-escape.cjs +8 -0
  47. package/dist/polyfills/css-escape.mjs +2 -0
  48. package/dist/polyfills/css-escape2.cjs +68 -0
  49. package/dist/polyfills/css-escape2.mjs +64 -0
  50. package/dist/rule.cjs +702 -0
  51. package/dist/rule.d.ts +2 -2
  52. package/dist/rule.mjs +700 -0
  53. package/dist/shared/utils/css-escape.cjs +56 -0
  54. package/dist/shared/utils/css-escape.mjs +54 -0
  55. package/dist/tokens/screen-sizes.cjs +17 -0
  56. package/dist/tokens/screen-sizes.mjs +15 -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/concat-arrays.cjs +12 -0
  61. package/dist/utils/concat-arrays.mjs +10 -0
  62. package/dist/utils/extend-config.cjs +59 -0
  63. package/dist/utils/extend-config.mjs +57 -0
  64. package/dist/utils/flatten-object.cjs +15 -0
  65. package/dist/utils/flatten-object.mjs +13 -0
  66. package/dist/utils/get-type.cjs +12 -0
  67. package/dist/utils/get-type.mjs +10 -0
  68. package/dist/utils/hex-to-rgb.cjs +30 -0
  69. package/dist/utils/hex-to-rgb.mjs +28 -0
  70. package/dist/utils/is-plain-object.cjs +15 -0
  71. package/dist/utils/is-plain-object.mjs +13 -0
  72. package/dist/utils/is-symbol.cjs +14 -0
  73. package/dist/utils/is-symbol.mjs +12 -0
  74. package/dist/utils/rgb-to-hex.cjs +7 -0
  75. package/dist/utils/rgb-to-hex.mjs +5 -0
  76. package/package.json +1 -1
  77. package/dist/bin/index.bundle.js +0 -36
  78. package/dist/constants/config-esm-text.d.ts +0 -1
  79. package/dist/constants/config-text.d.ts +0 -1
  80. package/dist/constants/config-ts-text.d.ts +0 -1
  81. package/dist/index.bundle.js +0 -35
  82. package/dist/index.bundle.mjs +0 -35
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ function cssEscape(value) {
4
+ if (typeof CSS !== 'undefined') return CSS.escape(value);
5
+ if (arguments.length == 0) {
6
+ throw new TypeError('`CSS.escape` requires an argument.');
7
+ }
8
+ const string = String(value);
9
+ const length = string.length;
10
+ let index = -1;
11
+ let result = '';
12
+ let codeUnit;
13
+ const firstCodeUnit = string.charCodeAt(0);
14
+ if (// If the character is the first character and is a `-` (U+002D), and
15
+ // there is no second character, […]
16
+ length == 1 && firstCodeUnit == 0x002D) {
17
+ return '\\' + string;
18
+ }
19
+ while(++index < length){
20
+ codeUnit = string.charCodeAt(index);
21
+ // Note: there’s no need to special-case astral symbols, surrogate
22
+ // pairs, or lone surrogates.
23
+ // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
24
+ // (U+FFFD).
25
+ if (codeUnit == 0x0000) {
26
+ result += '\uFFFD';
27
+ continue;
28
+ }
29
+ if (// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
30
+ // U+007F, […]
31
+ codeUnit >= 0x0001 && codeUnit <= 0x001F || codeUnit == 0x007F || // If the character is the first character and is in the range [0-9]
32
+ // (U+0030 to U+0039), […]
33
+ index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039 || // If the character is the second character and is in the range [0-9]
34
+ // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
35
+ index == 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && firstCodeUnit == 0x002D) {
36
+ // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
37
+ result += '\\' + codeUnit.toString(16) + ' ';
38
+ continue;
39
+ }
40
+ // If the character is not handled by one of the above rules and is
41
+ // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
42
+ // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
43
+ // U+005A), or [a-z] (U+0061 to U+007A), […]
44
+ if (codeUnit >= 0x0080 || codeUnit == 0x002D || codeUnit == 0x005F || codeUnit >= 0x0030 && codeUnit <= 0x0039 || codeUnit >= 0x0041 && codeUnit <= 0x005A || codeUnit >= 0x0061 && codeUnit <= 0x007A) {
45
+ // the character itself
46
+ result += string.charAt(index);
47
+ continue;
48
+ }
49
+ // Otherwise, the escaped character.
50
+ // https://drafts.csswg.org/cssom/#escape-a-character
51
+ result += '\\' + string.charAt(index);
52
+ }
53
+ return result;
54
+ }
55
+
56
+ module.exports = cssEscape;
@@ -0,0 +1,54 @@
1
+ function cssEscape(value) {
2
+ if (typeof CSS !== 'undefined') return CSS.escape(value);
3
+ if (arguments.length == 0) {
4
+ throw new TypeError('`CSS.escape` requires an argument.');
5
+ }
6
+ const string = String(value);
7
+ const length = string.length;
8
+ let index = -1;
9
+ let result = '';
10
+ let codeUnit;
11
+ const firstCodeUnit = string.charCodeAt(0);
12
+ if (// If the character is the first character and is a `-` (U+002D), and
13
+ // there is no second character, […]
14
+ length == 1 && firstCodeUnit == 0x002D) {
15
+ return '\\' + string;
16
+ }
17
+ while(++index < length){
18
+ codeUnit = string.charCodeAt(index);
19
+ // Note: there’s no need to special-case astral symbols, surrogate
20
+ // pairs, or lone surrogates.
21
+ // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
22
+ // (U+FFFD).
23
+ if (codeUnit == 0x0000) {
24
+ result += '\uFFFD';
25
+ continue;
26
+ }
27
+ if (// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
28
+ // U+007F, […]
29
+ codeUnit >= 0x0001 && codeUnit <= 0x001F || codeUnit == 0x007F || // If the character is the first character and is in the range [0-9]
30
+ // (U+0030 to U+0039), […]
31
+ index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039 || // If the character is the second character and is in the range [0-9]
32
+ // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
33
+ index == 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && firstCodeUnit == 0x002D) {
34
+ // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
35
+ result += '\\' + codeUnit.toString(16) + ' ';
36
+ continue;
37
+ }
38
+ // If the character is not handled by one of the above rules and is
39
+ // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
40
+ // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
41
+ // U+005A), or [a-z] (U+0061 to U+007A), […]
42
+ if (codeUnit >= 0x0080 || codeUnit == 0x002D || codeUnit == 0x005F || codeUnit >= 0x0030 && codeUnit <= 0x0039 || codeUnit >= 0x0041 && codeUnit <= 0x005A || codeUnit >= 0x0061 && codeUnit <= 0x007A) {
43
+ // the character itself
44
+ result += string.charAt(index);
45
+ continue;
46
+ }
47
+ // Otherwise, the escaped character.
48
+ // https://drafts.csswg.org/cssom/#escape-a-character
49
+ result += '\\' + string.charAt(index);
50
+ }
51
+ return result;
52
+ }
53
+
54
+ export { cssEscape as default };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var mediaQueries = {
4
+ '4xs': 360,
5
+ '3xs': 480,
6
+ '2xs': 600,
7
+ 'xs': 768,
8
+ 'sm': 834,
9
+ 'md': 1024,
10
+ 'lg': 1280,
11
+ 'xl': 1440,
12
+ '2xl': 1600,
13
+ '3xl': 1920,
14
+ '4xl': 2560
15
+ };
16
+
17
+ module.exports = mediaQueries;
@@ -0,0 +1,15 @@
1
+ var mediaQueries = {
2
+ '4xs': 360,
3
+ '3xs': 480,
4
+ '2xs': 600,
5
+ 'xs': 768,
6
+ 'sm': 834,
7
+ 'md': 1024,
8
+ 'lg': 1280,
9
+ 'xl': 1440,
10
+ '2xl': 1600,
11
+ '3xl': 1920,
12
+ '4xl': 2560
13
+ };
14
+
15
+ export { mediaQueries as default };
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -1,5 +1,5 @@
1
- import type { MasterCSS as _MasterCSS } from '../core';
1
+ import type Core from '../core';
2
2
  declare global {
3
- var MasterCSS: typeof _MasterCSS;
4
- var masterCSSs: _MasterCSS[];
3
+ var masterCSSs: Core[];
4
+ var MasterCSS: typeof Core;
5
5
  }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function concatArrays(originVal, newVal) {
4
+ if (Array.isArray(originVal) && Array.isArray(newVal)) {
5
+ // concat logic
6
+ return originVal.concat(newVal);
7
+ }
8
+ return newVal // always return newVal as fallback!!
9
+ ;
10
+ }
11
+
12
+ exports.concatArrays = concatArrays;
@@ -0,0 +1,10 @@
1
+ function concatArrays(originVal, newVal) {
2
+ if (Array.isArray(originVal) && Array.isArray(newVal)) {
3
+ // concat logic
4
+ return originVal.concat(newVal);
5
+ }
6
+ return newVal // always return newVal as fallback!!
7
+ ;
8
+ }
9
+
10
+ export { concatArrays };
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ var extend = require('@techor/extend');
4
+
5
+ function extendConfig(...configs) {
6
+ const formatConfig = (config)=>{
7
+ const clonedConfig = extend({}, config);
8
+ const formatDeeply = (obj)=>{
9
+ for(const key in obj){
10
+ const value = obj[key];
11
+ if (typeof value === 'object' && !Array.isArray(value)) {
12
+ formatDeeply(value);
13
+ } else if (key && !key.startsWith('@')) {
14
+ obj[key] = {
15
+ '': value
16
+ };
17
+ }
18
+ }
19
+ };
20
+ if (clonedConfig.styles) {
21
+ formatDeeply(clonedConfig.styles);
22
+ } else {
23
+ clonedConfig.styles = {};
24
+ }
25
+ if (clonedConfig.mediaQueries) {
26
+ formatDeeply(clonedConfig.mediaQueries);
27
+ } else {
28
+ clonedConfig.mediaQueries = {};
29
+ }
30
+ if (clonedConfig.variables) {
31
+ formatDeeply(clonedConfig.variables);
32
+ } else {
33
+ clonedConfig.variables = {};
34
+ }
35
+ return clonedConfig;
36
+ };
37
+ const formattedConfigs = [];
38
+ for (const eachConfig of configs){
39
+ (function getConfigsDeeply(config) {
40
+ if (config.extends?.length) {
41
+ for (const eachExtend of config.extends){
42
+ getConfigsDeeply('config' in eachExtend ? eachExtend.config : eachExtend);
43
+ }
44
+ }
45
+ formattedConfigs.push(formatConfig(config));
46
+ })(eachConfig);
47
+ }
48
+ let extendedConfig = formattedConfigs[0];
49
+ for(let i = 1; i < formattedConfigs.length; i++){
50
+ const currentFormattedConfig = formattedConfigs[i];
51
+ extendedConfig = extend(extendedConfig, currentFormattedConfig);
52
+ if (Object.prototype.hasOwnProperty.call(currentFormattedConfig, 'animations') && extendedConfig.animations) {
53
+ Object.assign(extendedConfig.animations, currentFormattedConfig.animations);
54
+ }
55
+ }
56
+ return extendedConfig;
57
+ }
58
+
59
+ exports.extendConfig = extendConfig;
@@ -0,0 +1,57 @@
1
+ import extend from '@techor/extend';
2
+
3
+ function extendConfig(...configs) {
4
+ const formatConfig = (config)=>{
5
+ const clonedConfig = extend({}, config);
6
+ const formatDeeply = (obj)=>{
7
+ for(const key in obj){
8
+ const value = obj[key];
9
+ if (typeof value === 'object' && !Array.isArray(value)) {
10
+ formatDeeply(value);
11
+ } else if (key && !key.startsWith('@')) {
12
+ obj[key] = {
13
+ '': value
14
+ };
15
+ }
16
+ }
17
+ };
18
+ if (clonedConfig.styles) {
19
+ formatDeeply(clonedConfig.styles);
20
+ } else {
21
+ clonedConfig.styles = {};
22
+ }
23
+ if (clonedConfig.mediaQueries) {
24
+ formatDeeply(clonedConfig.mediaQueries);
25
+ } else {
26
+ clonedConfig.mediaQueries = {};
27
+ }
28
+ if (clonedConfig.variables) {
29
+ formatDeeply(clonedConfig.variables);
30
+ } else {
31
+ clonedConfig.variables = {};
32
+ }
33
+ return clonedConfig;
34
+ };
35
+ const formattedConfigs = [];
36
+ for (const eachConfig of configs){
37
+ (function getConfigsDeeply(config) {
38
+ if (config.extends?.length) {
39
+ for (const eachExtend of config.extends){
40
+ getConfigsDeeply('config' in eachExtend ? eachExtend.config : eachExtend);
41
+ }
42
+ }
43
+ formattedConfigs.push(formatConfig(config));
44
+ })(eachConfig);
45
+ }
46
+ let extendedConfig = formattedConfigs[0];
47
+ for(let i = 1; i < formattedConfigs.length; i++){
48
+ const currentFormattedConfig = formattedConfigs[i];
49
+ extendedConfig = extend(extendedConfig, currentFormattedConfig);
50
+ if (Object.prototype.hasOwnProperty.call(currentFormattedConfig, 'animations') && extendedConfig.animations) {
51
+ Object.assign(extendedConfig.animations, currentFormattedConfig.animations);
52
+ }
53
+ }
54
+ return extendedConfig;
55
+ }
56
+
57
+ export { extendConfig };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ function flattenObject(obj, parentKey = '') {
4
+ return Object.entries(obj).reduce((acc, [key, value])=>{
5
+ const currentKey = parentKey ? `${parentKey}${key ? '-' + key : ''}` : key;
6
+ if (typeof value === 'object' && !Array.isArray(value)) {
7
+ Object.assign(acc, flattenObject(value, currentKey));
8
+ } else {
9
+ acc[currentKey] = value;
10
+ }
11
+ return acc;
12
+ }, {});
13
+ }
14
+
15
+ exports.flattenObject = flattenObject;
@@ -0,0 +1,13 @@
1
+ function flattenObject(obj, parentKey = '') {
2
+ return Object.entries(obj).reduce((acc, [key, value])=>{
3
+ const currentKey = parentKey ? `${parentKey}${key ? '-' + key : ''}` : key;
4
+ if (typeof value === 'object' && !Array.isArray(value)) {
5
+ Object.assign(acc, flattenObject(value, currentKey));
6
+ } else {
7
+ acc[currentKey] = value;
8
+ }
9
+ return acc;
10
+ }, {});
11
+ }
12
+
13
+ export { flattenObject };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Returns the object type of the given payload
5
+ *
6
+ * @param {*} payload
7
+ * @returns {string}
8
+ */ function getType(payload) {
9
+ return Object.prototype.toString.call(payload).slice(8, -1);
10
+ }
11
+
12
+ exports.getType = getType;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the object type of the given payload
3
+ *
4
+ * @param {*} payload
5
+ * @returns {string}
6
+ */ function getType(payload) {
7
+ return Object.prototype.toString.call(payload).slice(8, -1);
8
+ }
9
+
10
+ export { getType };
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ function hexToRgb(hex) {
4
+ if (hex.startsWith('#')) {
5
+ hex = hex.slice(1);
6
+ }
7
+ let r;
8
+ let g;
9
+ let b;
10
+ let a;
11
+ if (hex.length === 3 || hex.length === 4) {
12
+ r = parseInt(hex[0] + hex[0], 16);
13
+ g = parseInt(hex[1] + hex[1], 16);
14
+ b = parseInt(hex[2] + hex[2], 16);
15
+ a = hex.length === 4 ? Math.round(parseInt(hex[3] + hex[3], 16) / 255 * 100) / 100 : 1;
16
+ } else if (hex.length === 6 || hex.length === 8) {
17
+ r = parseInt(hex.slice(0, 2), 16);
18
+ g = parseInt(hex.slice(2, 4), 16);
19
+ b = parseInt(hex.slice(4, 6), 16);
20
+ a = hex.length === 8 ? Math.round(parseInt(hex.slice(6, 8), 16) / 255 * 100) / 100 : 1;
21
+ }
22
+ return [
23
+ r,
24
+ g,
25
+ b,
26
+ a
27
+ ];
28
+ }
29
+
30
+ exports.hexToRgb = hexToRgb;
@@ -0,0 +1,28 @@
1
+ function hexToRgb(hex) {
2
+ if (hex.startsWith('#')) {
3
+ hex = hex.slice(1);
4
+ }
5
+ let r;
6
+ let g;
7
+ let b;
8
+ let a;
9
+ if (hex.length === 3 || hex.length === 4) {
10
+ r = parseInt(hex[0] + hex[0], 16);
11
+ g = parseInt(hex[1] + hex[1], 16);
12
+ b = parseInt(hex[2] + hex[2], 16);
13
+ a = hex.length === 4 ? Math.round(parseInt(hex[3] + hex[3], 16) / 255 * 100) / 100 : 1;
14
+ } else if (hex.length === 6 || hex.length === 8) {
15
+ r = parseInt(hex.slice(0, 2), 16);
16
+ g = parseInt(hex.slice(2, 4), 16);
17
+ b = parseInt(hex.slice(4, 6), 16);
18
+ a = hex.length === 8 ? Math.round(parseInt(hex.slice(6, 8), 16) / 255 * 100) / 100 : 1;
19
+ }
20
+ return [
21
+ r,
22
+ g,
23
+ b,
24
+ a
25
+ ];
26
+ }
27
+
28
+ export { hexToRgb };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var getType = require('./get-type.cjs');
4
+
5
+ /**
6
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
7
+ *
8
+ * @param {*} payload
9
+ * @returns {payload is PlainObject}
10
+ */ function isPlainObject(payload) {
11
+ if (getType.getType(payload) !== 'Object') return false;
12
+ return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
13
+ }
14
+
15
+ exports.isPlainObject = isPlainObject;
@@ -0,0 +1,13 @@
1
+ import { getType } from './get-type.mjs';
2
+
3
+ /**
4
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
5
+ *
6
+ * @param {*} payload
7
+ * @returns {payload is PlainObject}
8
+ */ function isPlainObject(payload) {
9
+ if (getType(payload) !== 'Object') return false;
10
+ return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
11
+ }
12
+
13
+ export { isPlainObject };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var getType = require('./get-type.cjs');
4
+
5
+ /**
6
+ * Returns whether the payload is a Symbol
7
+ *
8
+ * @param {*} payload
9
+ * @returns {payload is symbol}
10
+ */ function isSymbol(payload) {
11
+ return getType.getType(payload) === 'Symbol';
12
+ }
13
+
14
+ exports.isSymbol = isSymbol;
@@ -0,0 +1,12 @@
1
+ import { getType } from './get-type.mjs';
2
+
3
+ /**
4
+ * Returns whether the payload is a Symbol
5
+ *
6
+ * @param {*} payload
7
+ * @returns {payload is symbol}
8
+ */ function isSymbol(payload) {
9
+ return getType(payload) === 'Symbol';
10
+ }
11
+
12
+ export { isSymbol };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ function rgbToHex(r, g, b) {
4
+ return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
5
+ }
6
+
7
+ exports.rgbToHex = rgbToHex;
@@ -0,0 +1,5 @@
1
+ function rgbToHex(r, g, b) {
2
+ return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
3
+ }
4
+
5
+ export { rgbToHex };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/css","scripts":{"build":"techor pack --declare --external @master/css-renderer @master/css-extractor","dev":"pnpm run build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"license":"MIT","description":"A markup-driven CSS language with enhanced syntax","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.bundle.js","jsnext:main":"./dist/index.bundle.mjs","esnext":"./dist/index.bundle.mjs","module":"./dist/index.bundle.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.bundle.js","import":"./dist/index.bundle.mjs","types":"./dist/index.d.ts"}},"bin":{"mcss":"./dist/bin/index.bundle.js","mastercss":"./dist/bin/index.bundle.js"},"files":["dist"],"publishConfig":{"access":"public"},"dependencies":{"@master/normal.css":"^2.0.0-rc.2","@techor/fs":"^2.5.24","@techor/log":"^2.5.24","commander":"^11.0.0"},"devDependencies":{"@techor/extend":"^2.5.24","@techor/pack":"^2.5.24","@types/jest":"^29.5.11","css-shared":"^2.0.0-rc.2","csstype":"^3.1.2","puppeteer":"^21.0.1","vite":"^4.2.1"},"version":"2.0.0-rc.2"}
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/normal.css":"^2.0.0-rc.20","@techor/extend":"^3.0.16"},"devDependencies":{"css-shared":"^2.0.0-rc.20","csstype":"^3.1.3"},"version":"2.0.0-rc.20"}
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";var h=Object.create;var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var O=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of _(o))!E.call(e,s)&&s!==t&&d(e,s,{get:()=>o[s],enumerable:!(r=C(o,s))||r.enumerable});return e};var p=(e,o,t)=>(t=e!=null?h(x(e)):{},O(o||!e||!e.__esModule?d(t,"default",{value:e,enumerable:!0}):t,e));var T=require("commander"),m=p(require("path")),a=p(require("fs"));var S=`/** @type {import('@master/css').Config} */
3
- export default {
4
- styles: {},
5
- rules: {},
6
- variables: {},
7
- semantics: {},
8
- mediaQueries: {},
9
- animations: {},
10
- selectors: {},
11
- functions: {}
12
- }
13
- `;var y=`/** @type {import('@master/css').Config} */
14
- module.exports = {
15
- styles: {},
16
- rules: {},
17
- variables: {},
18
- semantics: {},
19
- mediaQueries: {},
20
- animations: {},
21
- selectors: {},
22
- functions: {}
23
- }
24
- `;var g=`import type { Config } from '@master/css'
25
-
26
- export default {
27
- styles: {},
28
- rules: {},
29
- variables: {},
30
- semantics: {},
31
- mediaQueries: {},
32
- animations: {},
33
- selectors: {},
34
- functions: {}
35
- } as Config
36
- `;var n=p(require("@techor/log")),l=require("@techor/fs"),{version:v,name:j,description:F}=(0,l.readJSONFileSync)(m.default.resolve(__dirname,"../../package.json")),c=new T.Command;c.name(j).description(F).version(v||"0.0.0");c.command("init").description("Initialize definition files for Master CSS").option("-o, --override","Override existing definition file").option("--esm","ES Module .mjs").option("--ts","TypeScript .ts").option("--cjs","CommonJS .js").action(async function(e){let{esm:o,ts:t,cjs:r}=e;if(!o&&!t&&!r)if(a.default.existsSync("tsconfig.json"))t=!0;else{let{type:i}=(0,l.readJSONFileSync)("./package.json")||{};i==="module"?o=!0:r=!0}let s=(i,f)=>{let u=a.default.existsSync(m.default.join(process.cwd(),i));u?u&&e.override?(a.default.writeFileSync(i,f),n.default.ok`**${i}** file is overridden`):n.default.x`**${i}** file already exists`:(a.default.writeFileSync(i,f),n.default.ok`**${i}** file is created`)};o&&s("master.css.mjs",S),t&&s("master.css.ts",g),r&&s("master.css.js",y)});c.command("render").description("Scans HTML and injects generated CSS rules").argument("<source paths>","The path in glob patterns of the source of the HTML file").option("-c --config <path>","The source path of the Master CSS configuration","master.css.*").option("-a --analyze","Analyze injected CSS and HTML size ( brotli ) without writing to file").action(async function(e,o){try{await require("@master/css-renderer/actions/main")(e,o)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-renderer** first`:console.error(t)}});c.command("extract").argument("[source paths]","The glob pattern path to extract sources").option("-w, --watch","Watch file changed and generate CSS rules.").option("-o, --output <path>","Specify your CSS file output path").option("-v, --verbose","Verbose logging 0~N","1").option("--options <path>","Specify your extractor options sources","master.css-extractor.*").action(async function(e,o){try{await require("@master/css-extractor/actions/main")(e,o)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-extractor** first`:console.error(t)}});c.parse();
@@ -1 +0,0 @@
1
- export declare const CONFIG_ESM_TEXT = "/** @type {import('@master/css').Config} */\nexport default {\n styles: {},\n rules: {},\n variables: {},\n semantics: {},\n mediaQueries: {},\n animations: {},\n selectors: {},\n functions: {}\n}\n";
@@ -1 +0,0 @@
1
- export declare const CONFIG_TEXT = "/** @type {import('@master/css').Config} */\nmodule.exports = {\n styles: {},\n rules: {},\n variables: {},\n semantics: {},\n mediaQueries: {},\n animations: {},\n selectors: {},\n functions: {}\n}\n";
@@ -1 +0,0 @@
1
- export declare const CONFIG_TS_TEXT = "import type { Config } from '@master/css'\n\nexport default {\n styles: {},\n rules: {},\n variables: {},\n semantics: {},\n mediaQueries: {},\n animations: {},\n selectors: {},\n functions: {}\n} as Config\n";